1 11 package org.eclipse.pde.internal.ui.nls; 12 13 import java.lang.reflect.InvocationTargetException ; 14 15 import org.eclipse.jface.action.IAction; 16 import org.eclipse.jface.dialogs.MessageDialog; 17 import org.eclipse.jface.viewers.ISelection; 18 import org.eclipse.jface.wizard.WizardDialog; 19 import org.eclipse.pde.internal.ui.PDEPlugin; 20 import org.eclipse.pde.internal.ui.PDEUIMessages; 21 import org.eclipse.swt.custom.BusyIndicator; 22 import org.eclipse.ui.IWorkbenchWindow; 23 import org.eclipse.ui.IWorkbenchWindowActionDelegate; 24 import org.eclipse.ui.PlatformUI; 25 26 public class GetNonExternalizedStringsAction implements IWorkbenchWindowActionDelegate { 27 28 private ISelection fSelection; 29 30 public GetNonExternalizedStringsAction() { 31 } 32 33 public void run(IAction action) { 34 GetNonExternalizedStringsOperation runnable = new GetNonExternalizedStringsOperation(fSelection); 35 try { 36 PlatformUI.getWorkbench().getProgressService().busyCursorWhile(runnable); 37 } catch (InvocationTargetException e) { 38 } catch (InterruptedException e) { 39 } finally { 40 if (runnable.wasCanceled()) 41 return; 42 ModelChangeTable changeTable = runnable.getChangeTable(); 43 if (!changeTable.isEmpty()) { 44 ExternalizeStringsWizard wizard = new ExternalizeStringsWizard(changeTable); 45 final WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard); 46 BusyIndicator.showWhile(PDEPlugin.getActiveWorkbenchShell().getDisplay(), new Runnable () { 47 public void run() { 48 dialog.open(); 49 } 50 }); 51 } else 52 MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), 53 PDEUIMessages.GetNonExternalizedStringsAction_allExternalizedTitle, 54 PDEUIMessages.GetNonExternalizedStringsAction_allExternalizedMessage); 55 } 56 } 57 58 public void selectionChanged(IAction action, ISelection selection) { 59 fSelection = selection; 60 } 61 62 public void dispose() { 63 } 64 65 public void init(IWorkbenchWindow window) { 66 } 67 } 68 | Popular Tags |