KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > nls > GetNonExternalizedStringsAction


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.nls;
12
13 import java.lang.reflect.InvocationTargetException JavaDoc;
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 JavaDoc e) {
38         } catch (InterruptedException JavaDoc 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 JavaDoc() {
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