1 /******************************************************************************* 2 * Copyright (c) 2005, 2019 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.pde.internal.ui.correction; 15 16 import org.eclipse.core.resources.IMarker; 17 import org.eclipse.jface.viewers.IStructuredSelection; 18 import org.eclipse.jface.viewers.StructuredSelection; 19 import org.eclipse.pde.core.IBaseModel; 20 import org.eclipse.pde.internal.ui.PDEUIMessages; 21 import org.eclipse.pde.internal.ui.nls.GetNonExternalizedStringsAction; 22 import org.eclipse.pde.internal.ui.util.SWTUtil; 23 import org.eclipse.swt.custom.BusyIndicator; 24 25 public class ExternalizeStringsResolution extends AbstractPDEMarkerResolution { 26 27 private boolean hasRun = false; 28 ExternalizeStringsResolution(int type, IMarker marker)29 public ExternalizeStringsResolution(int type, IMarker marker) { 30 super(type, marker); 31 } 32 33 @Override run(final IMarker marker)34 public void run(final IMarker marker) { 35 // even for multiple error markers, this wizard must be run only once 36 if (hasRun) 37 return; 38 BusyIndicator.showWhile(SWTUtil.getStandardDisplay(), () -> { 39 GetNonExternalizedStringsAction fGetExternAction = new GetNonExternalizedStringsAction(); 40 IStructuredSelection selection = new StructuredSelection(marker.getResource().getProject()); 41 fGetExternAction.runGetNonExternalizedStringsAction(selection); 42 hasRun = true; 43 }); 44 } 45 46 @Override createChange(IBaseModel model)47 protected void createChange(IBaseModel model) { 48 // nothin to do - all handled by run 49 } 50 51 @Override getDescription()52 public String getDescription() { 53 return PDEUIMessages.ExternalizeStringsResolution_desc; 54 } 55 56 @Override getLabel()57 public String getLabel() { 58 return PDEUIMessages.ExternalizeStringsResolution_label; 59 } 60 61 } 62