X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/obfuscator/export/ObfuscatorExportWizard.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/obfuscator/export/ObfuscatorExportWizard.java index 3e92b98..5111b04 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/obfuscator/export/ObfuscatorExportWizard.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/obfuscator/export/ObfuscatorExportWizard.java @@ -27,99 +27,113 @@ import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.plugin.AbstractUIPlugin; - /** - * Standard workbench wizard for exporting resources from the workspace - * to the local file system. + * Standard workbench wizard for exporting resources from the workspace to the + * local file system. *
- * This class may be instantiated and used without further configuration; - * this class is not intended to be subclassed. + * This class may be instantiated and used without further configuration; this + * class is not intended to be subclassed. *
** Example: + * *
* IWizard wizard = new ObfuscatorExportWizard(); * wizard.init(workbench, selection); * WizardDialog dialog = new WizardDialog(shell, wizard); * dialog.open(); *- * During the call to
open
, the wizard dialog is presented to the
- * user. When the user hits Finish, the user-selected workspace resources
- * are exported to the user-specified location in the local file system,
- * the dialog closes, and the call to open
returns.
+ *
+ * During the call to open
, the wizard dialog is presented to
+ * the user. When the user hits Finish, the user-selected workspace resources
+ * are exported to the user-specified location in the local file system, the
+ * dialog closes, and the call to open
returns.
*
*/
public class ObfuscatorExportWizard extends Wizard implements IExportWizard {
private IWorkbench workbench;
+
private IStructuredSelection selection;
+
private WizardObfuscatorResourceExportPage1 mainPage;
-/**
- * Creates a wizard for exporting workspace resources to the local file system.
- */
-public ObfuscatorExportWizard() {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("ObfuscatorExportWizard");//$NON-NLS-1$
- if(section == null)
- section = workbenchSettings.addNewSection("ObfuscatorExportWizard");//$NON-NLS-1$
- setDialogSettings(section);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public void addPages() {
- super.addPages();
- mainPage = new WizardObfuscatorResourceExportPage1(selection);
- addPage(mainPage);
-}
-/**
- * Returns the image descriptor with the given relative path.
- */
-private ImageDescriptor getImageDescriptor(String relativePath) {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- URL installURL = plugin.getBundle().getEntry("/");
- URL url = new URL(installURL, iconPath + relativePath);
- return ImageDescriptor.createFromURL(url);
+
+ /**
+ * Creates a wizard for exporting workspace resources to the local file
+ * system.
+ */
+ public ObfuscatorExportWizard() {
+ AbstractUIPlugin plugin = (AbstractUIPlugin) Platform
+ .getPlugin(PlatformUI.PLUGIN_ID);
+ IDialogSettings workbenchSettings = plugin.getDialogSettings();
+ IDialogSettings section = workbenchSettings
+ .getSection("ObfuscatorExportWizard");//$NON-NLS-1$
+ if (section == null)
+ section = workbenchSettings.addNewSection("ObfuscatorExportWizard");//$NON-NLS-1$
+ setDialogSettings(section);
}
- catch (MalformedURLException e) {
- // Should not happen
- return null;
+
+ /*
+ * (non-Javadoc) Method declared on IWizard.
+ */
+ public void addPages() {
+ super.addPages();
+ mainPage = new WizardObfuscatorResourceExportPage1(selection);
+ addPage(mainPage);
+ }
+
+ /**
+ * Returns the image descriptor with the given relative path.
+ */
+ private ImageDescriptor getImageDescriptor(String relativePath) {
+ String iconPath = "icons/full/";//$NON-NLS-1$
+ try {
+ AbstractUIPlugin plugin = (AbstractUIPlugin) Platform
+ .getPlugin(PlatformUI.PLUGIN_ID);
+ URL installURL = plugin.getBundle().getEntry("/");
+ URL url = new URL(installURL, iconPath + relativePath);
+ return ImageDescriptor.createFromURL(url);
+ } catch (MalformedURLException e) {
+ // Should not happen
+ return null;
+ }
}
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchWizard.
- */
-public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- this.workbench = workbench;
+ /*
+ * (non-Javadoc) Method declared on IWorkbenchWizard.
+ */
+ public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
+ this.workbench = workbench;
- //Make it the current selection by default but look it up otherwise
+ // Make it the current selection by default but look it up otherwise
- selection = currentSelection;
+ selection = currentSelection;
- if(currentSelection.isEmpty() && workbench.getActiveWorkbenchWindow() != null){
- IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
- if(page != null){
- IEditorPart currentEditor = page.getActiveEditor();
- if(currentEditor != null){
- Object selectedResource = currentEditor.getEditorInput().getAdapter(IResource.class);
- if(selectedResource != null)
- selection = new StructuredSelection(selectedResource);
+ if (currentSelection.isEmpty()
+ && workbench.getActiveWorkbenchWindow() != null) {
+ IWorkbenchPage page = workbench.getActiveWorkbenchWindow()
+ .getActivePage();
+ if (page != null) {
+ IEditorPart currentEditor = page.getActiveEditor();
+ if (currentEditor != null) {
+ Object selectedResource = currentEditor.getEditorInput()
+ .getAdapter(IResource.class);
+ if (selectedResource != null)
+ selection = new StructuredSelection(selectedResource);
+ }
}
}
+
+ setWindowTitle(ObfuscatorExportMessages
+ .getString("ObfuscatorTransfer.export")); //$NON-NLS-1$
+ setDefaultPageImageDescriptor(getImageDescriptor("wizban/exportdir_wiz.gif"));//$NON-NLS-1$
+ setNeedsProgressMonitor(true);
}
- setWindowTitle(ObfuscatorExportMessages.getString("ObfuscatorTransfer.export")); //$NON-NLS-1$
- setDefaultPageImageDescriptor(getImageDescriptor("wizban/exportdir_wiz.gif"));//$NON-NLS-1$
- setNeedsProgressMonitor(true);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public boolean performFinish() {
- return mainPage.finish();
-}
+ /*
+ * (non-Javadoc) Method declared on IWizard.
+ */
+ public boolean performFinish() {
+ return mainPage.finish();
+ }
}