### Eclipse Workspace Patch 1.0
#P org.eclipse.ui
Index: schema/perspectiveExtensions.exsd
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui/schema/perspectiveExtensions.exsd,v
retrieving revision 1.17
diff -u -r1.17 perspectiveExtensions.exsd
--- schema/perspectiveExtensions.exsd 9 Feb 2009 19:20:37 -0000 1.17
+++ schema/perspectiveExtensions.exsd 16 Dec 2009 13:37:58 -0000
@@ -67,6 +67,8 @@
+
+
@@ -151,6 +153,36 @@
+
+
+
+
+
+ the unique identifier of the import wizard which will be added to the perspective's "Import" submenu of the "File" menu.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ the unique identifier of the export wizard which will be added to the perspective's "Export" submenu of the "File" menu.
+
+
+
+
+
+
+
+
+
#P org.eclipse.ui.ide
Index: src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java,v
retrieving revision 1.120
diff -u -r1.120 WorkbenchActionBuilder.java
--- src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java 11 May 2009 13:55:05 -0000 1.120
+++ src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java 16 Dec 2009 13:38:05 -0000
@@ -25,6 +25,7 @@
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.ICoolBarManager;
+import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
@@ -54,6 +55,7 @@
import org.eclipse.ui.ide.IIDEActionConstants;
import org.eclipse.ui.internal.IPreferenceConstants;
import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
+import org.eclipse.ui.internal.WizardMenuContributionItem;
import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.handlers.IActionCommandMappingService;
@@ -204,6 +206,10 @@
// @issue should obtain from ContributionItemFactory
private NewWizardMenu newWizardMenu;
+ private WizardMenuContributionItem importWizardContribution;
+
+ private WizardMenuContributionItem exportWizardContribution;
+
// @issue class is workbench internal
private StatusLineContributionItem statusLineItem;
@@ -470,9 +476,11 @@
menu.add(openWorkspaceAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT));
menu.add(new Separator());
- menu.add(importResourcesAction);
- menu.add(exportResourcesAction);
+
+ addImportMenu(menu);
+ addExportMenu(menu);
menu.add(new GroupMarker(IWorkbenchActionConstants.IMPORT_EXT));
+
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(new Separator());
@@ -494,6 +502,50 @@
return menu;
}
+ private void addImportMenu(MenuManager menu) {
+
+ CommandContributionItemParameter param = new CommandContributionItemParameter(window, null, IWorkbenchCommandConstants.FILE_IMPORT, CommandContributionItem.STYLE_PUSH);
+ final CommandContributionItem defaultItem = new CommandContributionItem(param);
+ menu.add(defaultItem);
+
+ String id = ActionFactory.IMPORT.getId();
+ MenuManager importMenu = new MenuManager(WorkbenchMessages.Wizard_Import, id);
+ this.importWizardContribution = new WizardMenuContributionItem.ImportWizardMenuContributionItem(getWindow());
+ importMenu.add(this.importWizardContribution);
+ menu.add(importMenu);
+
+ menu.addMenuListener(new IMenuListener() {
+
+ public void menuAboutToShow(IMenuManager manager) {
+ boolean hasItems = importWizardContribution.hasItems();
+ defaultItem.setVisible(!hasItems);
+ importWizardContribution.setVisible(hasItems);
+ }
+ });
+ }
+
+ private void addExportMenu(MenuManager menu) {
+ CommandContributionItemParameter param = new CommandContributionItemParameter(window, null, IWorkbenchCommandConstants.FILE_EXPORT, CommandContributionItem.STYLE_PUSH);
+ final CommandContributionItem defaultItem = new CommandContributionItem(param);
+ menu.add(defaultItem);
+
+ String id = ActionFactory.EXPORT.getId();
+ MenuManager exportMenu = new MenuManager(WorkbenchMessages.Wizard_Export, id);
+ this.exportWizardContribution = new WizardMenuContributionItem.ExportWizardMenuContributionItem(getWindow());
+ exportMenu.add(this.exportWizardContribution);
+ menu.add(exportMenu);
+
+ menu.addMenuListener(new IMenuListener() {
+
+ public void menuAboutToShow(IMenuManager manager) {
+ boolean hasItems = exportWizardContribution.hasItems();
+ defaultItem.setVisible(!hasItems);
+ exportWizardContribution.setVisible(hasItems);
+ }
+ });
+
+ }
+
/**
* Creates and returns the Edit menu.
*/
#P org.eclipse.ui.workbench
Index: Eclipse UI/org/eclipse/ui/IPageLayout.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageLayout.java,v
retrieving revision 1.38
diff -u -r1.38 IPageLayout.java
--- Eclipse UI/org/eclipse/ui/IPageLayout.java 25 May 2009 20:52:12 -0000 1.38
+++ Eclipse UI/org/eclipse/ui/IPageLayout.java 16 Dec 2009 13:38:18 -0000
@@ -234,15 +234,45 @@
*/
public void addNewWizardShortcut(String id);
- /**
- * Adds a perspective shortcut to the page layout.
- * These are typically shown in the UI to allow rapid navigation to appropriate new wizards.
- * For example, in the Eclipse IDE, these appear as items under the Window > Open Perspective menu.
- * The id must name a perspective extension contributed to the
- * workbench's perspectives extension point (named "org.eclipse.ui.perspectives"
).
- *
- * @param id the perspective id
- */
+ /**
+ * Adds a import wizard shortcut to the page layout. These are typically
+ * shown in the UI to allow rapid navigation to appropriate import wizards.
+ * For example, in the Eclipse IDE, these appear as items under the File >
+ * Import menu. The id must name a new wizard extension contributed to the
+ * workbench's new wizards extension point (named
+ * "org.eclipse.ui.importWizards"
).
+ *
+ * @param id
+ * the wizard id
+ * @since 3.6
+ */
+ public void addImportWizardShortcut(String id);
+
+ /**
+ * Adds a export wizard shortcut to the page layout. These are typically
+ * shown in the UI to allow rapid navigation to appropriate export wizards.
+ * For example, in the Eclipse IDE, these appear as items under the File >
+ * Export menu. The id must name a export wizard extension contributed to
+ * the workbench's new wizards extension point (named
+ * "org.eclipse.ui.exportWizards"
).
+ *
+ * @param id
+ * the wizard id
+ * @since 3.6
+ */
+ public void addExportWizardShortcut(String id);
+
+ /**
+ * Adds a perspective shortcut to the page layout. These are typically shown
+ * in the UI to allow rapid navigation to appropriate new wizards. For
+ * example, in the Eclipse IDE, these appear as items under the Window >
+ * Open Perspective menu. The id must name a perspective extension
+ * contributed to the workbench's perspectives extension point (named
+ * "org.eclipse.ui.perspectives"
).
+ *
+ * @param id
+ * the perspective id
+ */
public void addPerspectiveShortcut(String id);
/**
Index: Eclipse UI/org/eclipse/ui/IWorkbenchPage.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPage.java,v
retrieving revision 1.75
diff -u -r1.75 IWorkbenchPage.java
--- Eclipse UI/org/eclipse/ui/IWorkbenchPage.java 24 Nov 2009 13:38:25 -0000 1.75
+++ Eclipse UI/org/eclipse/ui/IWorkbenchPage.java 16 Dec 2009 13:38:18 -0000
@@ -917,6 +917,26 @@
public String[] getNewWizardShortcuts();
/**
+ * Returns the import wizard shortcuts associated with the current
+ * perspective. Returns an empty array if there is no current perspective.
+ *
+ * @see IPageLayout#addImportWizardShortcut(String)
+ * @return an array of wizard identifiers
+ * @since 3.6
+ */
+ public String[] getImportWizardShortcuts();
+
+ /**
+ * Returns the export wizard shortcuts associated with the current
+ * perspective. Returns an empty array if there is no current perspective.
+ *
+ * @see IPageLayout#addExportWizardShortcut(String)
+ * @return an array of wizard identifiers
+ * @since 3.6
+ */
+ public String[] getExportWizardShortcuts();
+
+ /**
* Returns the perspective shortcuts associated with the current
* perspective. Returns an empty array if there is no current perspective.
*
Index: Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java,v
retrieving revision 1.83
diff -u -r1.83 IWorkbenchConstants.java
--- Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java 25 May 2009 20:52:11 -0000 1.83
+++ Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java 16 Dec 2009 13:38:18 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -196,6 +196,10 @@
public static final String TAG_NEW_WIZARD_ACTION = "new_wizard_action"; //$NON-NLS-1$
+ public static final String TAG_IMPORT_WIZARD_ACTION = "import_wizard_action"; //$NON-NLS-1$
+
+ public static final String TAG_EXPORT_WIZARD_ACTION = "export_wizard_action"; //$NON-NLS-1$
+
public static final String TAG_PERSPECTIVE_ACTION = "perspective_action"; //$NON-NLS-1$
public static final String TAG_HIDE_MENU = "hide_menu_item_id"; //$NON-NLS-1$
Index: Eclipse UI/org/eclipse/ui/internal/PageLayout.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageLayout.java,v
retrieving revision 1.60
diff -u -r1.60 PageLayout.java
--- Eclipse UI/org/eclipse/ui/internal/PageLayout.java 25 May 2009 20:52:10 -0000 1.60
+++ Eclipse UI/org/eclipse/ui/internal/PageLayout.java 16 Dec 2009 13:38:18 -0000
@@ -22,7 +22,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.ui.IFolderLayout;
@@ -88,6 +87,10 @@
private ArrayList newWizardShortcuts = new ArrayList(3);
+ private ArrayList importWizardShortcuts = new ArrayList(3);
+
+ private ArrayList exportWizardShortcuts = new ArrayList(3);
+
private ArrayList perspectiveShortcuts = new ArrayList(3);
private ViewSashContainer rootLayoutContainer;
@@ -252,9 +255,37 @@
}
}
- /**
- * Add the layout part to the page's layout
- */
+ /**
+ * Adds a import wizard to the File New menu. The id must name a import
+ * wizard extension contributed to the workbench's extension point (named
+ * "org.eclipse.ui.importWizards"
).
+ *
+ * @param id
+ * the wizard id
+ */
+ public void addImportWizardShortcut(String id) {
+ if (!importWizardShortcuts.contains(id)) {
+ importWizardShortcuts.add(id);
+ }
+ }
+
+ /**
+ * Adds a export wizard to the File New menu. The id must name a export
+ * wizard extension contributed to the workbench's extension point (named
+ * "org.eclipse.ui.exportWizards"
).
+ *
+ * @param id
+ * the wizard id
+ */
+ public void addExportWizardShortcut(String id) {
+ if (!exportWizardShortcuts.contains(id)) {
+ exportWizardShortcuts.add(id);
+ }
+ }
+
+ /**
+ * Add the layout part to the page's layout
+ */
private void addPart(LayoutPart newPart, String partId, int relationship,
float ratio, String refId) {
@@ -597,9 +628,25 @@
return newWizardShortcuts;
}
- /**
- * @return the part sash container const for a layout value.
- */
+ /**
+ * @return the import wizard shortcuts associated with the page. This is a
+ * List
of String
s.
+ */
+ public ArrayList getImportWizardShortcuts() {
+ return importWizardShortcuts;
+ }
+
+ /**
+ * @return the export wizard shortcuts associated with the page. This is a
+ * List
of String
s.
+ */
+ public ArrayList getExportWizardShortcuts() {
+ return exportWizardShortcuts;
+ }
+
+ /**
+ * @return the part sash container const for a layout value.
+ */
private int getPartSashConst(int nRelationship) {
return nRelationship;
}
Index: Eclipse UI/org/eclipse/ui/internal/Perspective.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Perspective.java,v
retrieving revision 1.191
diff -u -r1.191 Perspective.java
--- Eclipse UI/org/eclipse/ui/internal/Perspective.java 8 Dec 2009 21:02:46 -0000 1.191
+++ Eclipse UI/org/eclipse/ui/internal/Perspective.java 16 Dec 2009 13:38:20 -0000
@@ -101,6 +101,10 @@
protected ArrayList newWizardShortcuts;
+ protected ArrayList importWizardShortcuts;
+
+ protected ArrayList exportWizardShortcuts;
+
protected ArrayList showViewShortcuts;
protected ArrayList perspectiveShortcuts;
@@ -406,9 +410,29 @@
return (String[]) newWizardShortcuts.toArray(new String[newWizardShortcuts.size()]);
}
- /**
- * Returns the pane for a view reference.
- */
+ /**
+ * Returns the export wizard shortcuts associated with this perspective.
+ *
+ * @return an array of export wizard identifiers
+ */
+ public String[] getImportWizardShortcuts() {
+ return (String[]) importWizardShortcuts
+ .toArray(new String[importWizardShortcuts.size()]);
+ }
+
+ /**
+ * Returns the export wizard shortcuts associated with this perspective.
+ *
+ * @return an array of export wizard identifiers
+ */
+ public String[] getExportWizardShortcuts() {
+ return (String[]) exportWizardShortcuts
+ .toArray(new String[exportWizardShortcuts.size()]);
+ }
+
+ /**
+ * Returns the pane for a view reference.
+ */
protected ViewPane getPane(IViewReference ref) {
return (ViewPane) ((WorkbenchPartReference) ref).getPane();
}
@@ -844,6 +868,8 @@
}
}
newWizardShortcuts = layout.getNewWizardShortcuts();
+ importWizardShortcuts = layout.getImportWizardShortcuts();
+ exportWizardShortcuts = layout.getExportWizardShortcuts();
showViewShortcuts = layout.getShowViewShortcuts();
perspectiveShortcuts = layout.getPerspectiveShortcuts();
showInPartIds = layout.getShowInPartIds();
@@ -1474,6 +1500,24 @@
newWizardShortcuts.add(id);
}
+ // Load "import wizard actions".
+ actions = memento
+ .getChildren(IWorkbenchConstants.TAG_IMPORT_WIZARD_ACTION);
+ importWizardShortcuts = new ArrayList(actions.length);
+ for (int x = 0; x < actions.length; x++) {
+ String id = actions[x].getString(IWorkbenchConstants.TAG_ID);
+ importWizardShortcuts.add(id);
+ }
+
+ // Load "export wizard actions".
+ actions = memento
+ .getChildren(IWorkbenchConstants.TAG_EXPORT_WIZARD_ACTION);
+ exportWizardShortcuts = new ArrayList(actions.length);
+ for (int x = 0; x < actions.length; x++) {
+ String id = actions[x].getString(IWorkbenchConstants.TAG_ID);
+ exportWizardShortcuts.add(id);
+ }
+
// Load "perspective actions".
actions = memento
.getChildren(IWorkbenchConstants.TAG_PERSPECTIVE_ACTION);
@@ -1773,6 +1817,24 @@
child.putString(IWorkbenchConstants.TAG_ID, str);
}
+ // Save "import wizard actions".
+ itr = importWizardShortcuts.iterator();
+ while (itr.hasNext()) {
+ String str = (String) itr.next();
+ IMemento child = memento
+ .createChild(IWorkbenchConstants.TAG_IMPORT_WIZARD_ACTION);
+ child.putString(IWorkbenchConstants.TAG_ID, str);
+ }
+
+ // Save "export wizard actions".
+ itr = exportWizardShortcuts.iterator();
+ while (itr.hasNext()) {
+ String str = (String) itr.next();
+ IMemento child = memento
+ .createChild(IWorkbenchConstants.TAG_EXPORT_WIZARD_ACTION);
+ child.putString(IWorkbenchConstants.TAG_ID, str);
+ }
+
// Save "perspective actions".
itr = perspectiveShortcuts.iterator();
while (itr.hasNext()) {
@@ -1986,10 +2048,23 @@
newWizardShortcuts = newList;
}
- /**
- * Sets the perspective actions for this page.
- * This is List of Strings.
- */
+ /**
+ * Sets the import wizard actions for the page. This is List of Strings.
+ */
+ public void setImportWizardActionIds(ArrayList newList) {
+ importWizardShortcuts = newList;
+ }
+
+ /**
+ * Sets the export wizard actions for the page. This is List of Strings.
+ */
+ public void setExportWizardActionIds(ArrayList newList) {
+ exportWizardShortcuts = newList;
+ }
+
+ /**
+ * Sets the perspective actions for this page. This is List of Strings.
+ */
public void setPerspectiveActionIds(ArrayList list) {
perspectiveShortcuts = list;
}
Index: Eclipse UI/org/eclipse/ui/internal/WizardMenuContributionItem.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/WizardMenuContributionItem.java
diff -N Eclipse UI/org/eclipse/ui/internal/WizardMenuContributionItem.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Eclipse UI/org/eclipse/ui/internal/WizardMenuContributionItem.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.ui.internal;
+
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.CompoundContributionItem;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.ui.IWorkbenchCommandConstants;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.eclipse.ui.menus.CommandContributionItemParameter;
+import org.eclipse.ui.wizards.IWizardDescriptor;
+import org.eclipse.ui.wizards.IWizardRegistry;
+
+/**
+ * @since 3.6
+ * @author Prakash G. R.
+ *
+ * @noextend This class is not intended to be subclassed by clients.
+ *
+ */
+public abstract class WizardMenuContributionItem extends CompoundContributionItem {
+
+ private final String wizardId;
+ private final IWorkbenchWindow window;
+ private final String commandId;
+ private IContributionItem defaultItem;
+
+ public WizardMenuContributionItem(IWorkbenchWindow window, String wizardId, String commandId) {
+ this.window = window;
+ this.wizardId = wizardId;
+ this.commandId = commandId;
+ }
+
+ protected IWorkbenchWindow getWindow() {
+ return window;
+ }
+
+ public boolean hasItems() {
+ return getWizardShortcuts().length != 0;
+ }
+
+ abstract protected IAction getDefaultItem();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
+ */
+ protected IContributionItem[] getContributionItems() {
+
+ String[] wizardShortcuts = getWizardShortcuts();
+ IWizardRegistry wizardRegistry = getWizardRegistry();
+
+ List items = new ArrayList();
+
+ for (int i = 0; i < wizardShortcuts.length; i++) {
+ Map parameters = new HashMap(1);
+ parameters.put(wizardId, wizardShortcuts[i]);
+ IWizardDescriptor wizardDesc = wizardRegistry.findWizard(wizardShortcuts[i]);
+ if (wizardDesc == null)
+ continue;
+ CommandContributionItemParameter param = new CommandContributionItemParameter(window,
+ null, commandId, parameters, wizardDesc
+ .getImageDescriptor(), null, null, wizardDesc.getLabel(), null, null,
+ CommandContributionItem.STYLE_PUSH, null, false);
+
+ CommandContributionItem contributionItem = new CommandContributionItem(param);
+ items.add(contributionItem);
+
+ }
+
+ items.add(new Separator());
+ if(defaultItem == null) {
+ IAction defaultAction = getDefaultItem();
+ defaultAction.setText(WorkbenchMessages.Wizard_Other);
+ defaultItem = new ActionContributionItem(defaultAction);
+ }
+ items.add(defaultItem);
+ return (IContributionItem[]) items.toArray(new IContributionItem[items.size()]);
+ }
+
+ protected abstract String[] getWizardShortcuts();
+
+ protected abstract IWizardRegistry getWizardRegistry();
+
+ /**
+ * @since 3.6
+ *
+ */
+ public static class ExportWizardMenuContributionItem extends WizardMenuContributionItem {
+
+ public ExportWizardMenuContributionItem(IWorkbenchWindow window) {
+ super(window, "exportWizardId", IWorkbenchCommandConstants.FILE_EXPORT); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.actions.BaseWizardMenu#getWizardShortcuts()
+ */
+ protected String[] getWizardShortcuts() {
+ return getWindow().getActivePage().getExportWizardShortcuts();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.actions.BaseWizardMenu#getWizardRegistry()
+ */
+ protected IWizardRegistry getWizardRegistry() {
+ return WorkbenchPlugin.getDefault().getExportWizardRegistry();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.actions.BaseWizardMenu#getDefaultItem()
+ */
+ protected IAction getDefaultItem() {
+ return ActionFactory.EXPORT.create(getWindow());
+ }
+
+ }
+
+ /**
+ * @since 3.6
+ *
+ */
+ public static class ImportWizardMenuContributionItem extends WizardMenuContributionItem {
+
+ public ImportWizardMenuContributionItem(IWorkbenchWindow window) {
+ super(window, "importWizardId", IWorkbenchCommandConstants.FILE_IMPORT); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.actions.BaseWizardMenu#getWizardShortcuts()
+ */
+ protected String[] getWizardShortcuts() {
+ return getWindow().getActivePage().getImportWizardShortcuts();
+ // return new String[0];
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.actions.BaseWizardMenu#getWizardRegistry()
+ */
+ protected IWizardRegistry getWizardRegistry() {
+ return WorkbenchPlugin.getDefault().getImportWizardRegistry();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.actions.BaseWizardMenu#getDefaultItem()
+ */
+ protected IAction getDefaultItem() {
+ return ActionFactory.IMPORT.create(getWindow());
+ }
+
+ }
+
+}
Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java,v
retrieving revision 1.123
diff -u -r1.123 WorkbenchMessages.java
--- Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java 24 Nov 2009 21:30:42 -0000 1.123
+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java 16 Dec 2009 13:38:40 -0000
@@ -110,6 +110,9 @@
public static String Exit_text;
public static String Exit_toolTip;
+ public static String Wizard_Import;
+ public static String Wizard_Export;
+ public static String Wizard_Other;
// --- Edit Menu ---
public static String Workbench_undo;
@@ -185,6 +188,8 @@
public static String ActionSetDialogInput_viewCategory;
public static String ActionSetDialogInput_perspectiveCategory;
public static String ActionSetDialogInput_wizardCategory;
+ public static String ActionSetDialogInput_importWizardCategory;
+ public static String ActionSetDialogInput_exportWizardCategory;
public static String Shortcuts_shortcutTab;
public static String Shortcuts_selectShortcutsLabel;
Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java,v
retrieving revision 1.331
diff -u -r1.331 WorkbenchPage.java
--- Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java 3 Dec 2009 20:05:15 -0000 1.331
+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java 16 Dec 2009 13:38:49 -0000
@@ -4903,11 +4903,37 @@
return persp.getNewWizardShortcuts();
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IWorkbenchPage#getPerspectiveShortcuts()
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPage#getImportWizardShortcuts()
+ */
+ public String[] getImportWizardShortcuts() {
+ Perspective persp = getActivePerspective();
+ if (persp == null) {
+ return new String[0];
+ }
+ return persp.getImportWizardShortcuts();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPage#getExportWizardShortcuts()
+ */
+ public String[] getExportWizardShortcuts() {
+ Perspective persp = getActivePerspective();
+ if (persp == null) {
+ return new String[0];
+ }
+ return persp.getExportWizardShortcuts();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPage#getPerspectiveShortcuts()
+ */
public String[] getPerspectiveShortcuts() {
Perspective persp = getActivePerspective();
if (persp == null) {
Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java,v
retrieving revision 1.415
diff -u -r1.415 WorkbenchWindow.java
--- Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java 3 Dec 2009 19:50:35 -0000 1.415
+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java 16 Dec 2009 13:38:55 -0000
@@ -316,13 +316,32 @@
public static final int NEW_WIZARD_SUBMENU = 0x04;
/**
+ * Constant (bit mask) indicating which the Import Wizard submenu is
+ * probably present somewhere in this window.
+ *
+ * @see #addSubmenu
+ * @since 3.6
+ */
+ public static final int IMPORT_WIZARD_SUBMENU = 0x08;
+
+ /**
+ * Constant (bit mask) indicating which the Export Wizard submenu is
+ * probably present somewhere in this window.
+ *
+ * @see #addSubmenu
+ * @since 3.6
+ */
+ public static final int EXPORT_WIZARD_SUBMENU = 0x10;
+
+ /**
* Remembers that this window contains the given submenu.
*
* @param type
- * the type of submenu, one of:
- * {@link #NEW_WIZARD_SUBMENU NEW_WIZARD_SUBMENU},
- * {@link #OPEN_PERSPECTIVE_SUBMENU OPEN_PERSPECTIVE_SUBMENU},
- * {@link #SHOW_VIEW_SUBMENU SHOW_VIEW_SUBMENU}
+ * the type of submenu, one of: {@link #NEW_WIZARD_SUBMENU
+ * NEW_WIZARD_SUBMENU}, {@link #OPEN_PERSPECTIVE_SUBMENU
+ * OPEN_PERSPECTIVE_SUBMENU}, {@link #SHOW_VIEW_SUBMENU
+ * SHOW_VIEW_SUBMENU} {@link #IMPORT_WIZARD_SUBMENU},
+ * {@link #EXPORT_WIZARD_SUBMENU}
* @see #containsSubmenu
* @since 3.0
*/
Index: Eclipse UI/org/eclipse/ui/internal/messages.properties
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties,v
retrieving revision 1.405
diff -u -r1.405 messages.properties
--- Eclipse UI/org/eclipse/ui/internal/messages.properties 24 Nov 2009 21:30:42 -0000 1.405
+++ Eclipse UI/org/eclipse/ui/internal/messages.properties 16 Dec 2009 13:38:55 -0000
@@ -66,6 +66,9 @@
OpenRecent_unableToOpen = Unable to open ''{0}''.
Exit_text = E&xit
Exit_toolTip = Exit Workbench
+Wizard_Import = &Import
+Wizard_Export = Exp&ort
+Wizard_Other = &Other...
# --- Edit Menu ---
@@ -141,6 +144,8 @@
ActionSetDialogInput_viewCategory = Show View
ActionSetDialogInput_perspectiveCategory = Open Perspective
ActionSetDialogInput_wizardCategory = New
+ActionSetDialogInput_importWizardCategory = Import
+ActionSetDialogInput_exportWizardCategory = Export
Shortcuts_shortcutTab = Shortcuts
Shortcuts_selectShortcutsLabel = Select the shortcuts that you want to see added as cascade items to the following submenus. The selections made will only affect the current perspective ({0}).
Index: Eclipse UI/org/eclipse/ui/internal/dialogs/CustomizePerspectiveDialog.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CustomizePerspectiveDialog.java,v
retrieving revision 1.81
diff -u -r1.81 CustomizePerspectiveDialog.java
--- Eclipse UI/org/eclipse/ui/internal/dialogs/CustomizePerspectiveDialog.java 25 Nov 2009 13:19:07 -0000 1.81
+++ Eclipse UI/org/eclipse/ui/internal/dialogs/CustomizePerspectiveDialog.java 16 Dec 2009 13:39:02 -0000
@@ -212,9 +212,13 @@
private DisplayItem toolBarItems;
- private Category shortcuts;
+ private Category shortcutsCategory;
- private DisplayItem wizards;
+ private DisplayItem newWizards;
+
+ private DisplayItem importWizards;
+
+ private DisplayItem exportWizards;
private DisplayItem perspectives;
@@ -1659,10 +1663,10 @@
}
sashComposite.setWeights(new int[] { 30, 70 });
- menusViewer.setInput(shortcuts);
+ menusViewer.setInput(shortcutsCategory);
- if (shortcuts.getChildren().size() > 0) {
- setSelectionOn(menusViewer, shortcuts.getChildren().get(0));
+ if (shortcutsCategory.getChildren().size() > 0) {
+ setSelectionOn(menusViewer, shortcutsCategory.getChildren().get(0));
}
return menusComposite;
@@ -2467,7 +2471,7 @@
warningImageDescriptor = ImageDescriptor.createFromURL(url);
}
- private void initializeNewWizardsMenu(DisplayItem menu,
+ private void initializeWizardsMenu(DisplayItem menu,
Category parentCategory, IWizardCategory element, List activeIds) {
Category category = new Category(element.getLabel());
parentCategory.addChild(category);
@@ -2489,19 +2493,17 @@
// @issue should not pass in null
IWizardCategory[] children = element.getCategories();
for (int i = 0; i < children.length; i++) {
- initializeNewWizardsMenu(menu, category, children[i], activeIds);
+ initializeWizardsMenu(menu, category, children[i], activeIds);
}
}
- private void initializeNewWizardsMenu(DisplayItem menu) {
- Category rootForNewWizards = new Category(
- WorkbenchMessages.ActionSetDialogInput_wizardCategory);
- shortcuts.addChild(rootForNewWizards);
+ private void initializeWizardsMenu(DisplayItem menu, String category,
+ String[] wizardIds, IWizardCategory rootCategory) {
+ Category rootForNewWizards = new Category(category);
+ shortcutsCategory.addChild(rootForNewWizards);
- IWizardCategory wizardCollection = WorkbenchPlugin.getDefault()
- .getNewWizardRegistry().getRootCategory();
- IWizardCategory[] wizardCategories = wizardCollection.getCategories();
- List activeIDs = Arrays.asList(perspective.getNewWizardShortcuts());
+ IWizardCategory[] wizardCategories = rootCategory.getCategories();
+ List activeIDs = Arrays.asList(wizardIds);
for (int i = 0; i < wizardCategories.length; i++) {
IWizardCategory element = wizardCategories[i];
@@ -2509,7 +2511,7 @@
continue;
}
- initializeNewWizardsMenu(menu, rootForNewWizards, element,
+ initializeWizardsMenu(menu, rootForNewWizards, element,
activeIDs);
}
}
@@ -2517,7 +2519,7 @@
private void initializePerspectivesMenu(DisplayItem menu) {
Category rootForPerspectives = new Category(
WorkbenchMessages.ActionSetDialogInput_perspectiveCategory);
- shortcuts.addChild(rootForPerspectives);
+ shortcutsCategory.addChild(rootForPerspectives);
IPerspectiveRegistry perspReg = WorkbenchPlugin.getDefault()
.getPerspectiveRegistry();
@@ -2546,7 +2548,7 @@
Category rootForViews = new Category(
WorkbenchMessages.ActionSetDialogInput_viewCategory);
- shortcuts.addChild(rootForViews);
+ shortcutsCategory.addChild(rootForViews);
IViewRegistry viewReg = WorkbenchPlugin.getDefault().getViewRegistry();
IViewCategory[] categories = viewReg.getCategories();
@@ -2643,7 +2645,7 @@
customizeActionBars.menuManager.updateAll(true);
customizeActionBars.coolBarManager.update(true);
- shortcuts = new Category(""); //$NON-NLS-1$
+ shortcutsCategory = new Category(""); //$NON-NLS-1$
toolBarItems = createToolBarStructure(cb);
menuItems = createMenuStructure(menu);
}
@@ -2947,21 +2949,8 @@
.get(getActionSetID(contributionItem)));
parent.addChild(menuEntry);
- if (ActionFactory.NEW.getId()
- .equals(((IContributionItem) menuItems[i].getData())
- .getId())) {
- initializeNewWizardsMenu(menuEntry);
- wizards = menuEntry;
- } else if (SHORTCUT_CONTRIBUTION_ITEM_ID_OPEN_PERSPECTIVE
- .equals(((IContributionItem) menuItems[i].getData())
- .getId())) {
- initializePerspectivesMenu(menuEntry);
- perspectives = menuEntry;
- } else if (SHORTCUT_CONTRIBUTION_ITEM_ID_SHOW_VIEW
- .equals(((IContributionItem) menuItems[i].getData())
- .getId())) {
- initializeViewsMenu(menuEntry);
- views = menuEntry;
+ if (isShortcutMenu(menuItems[i])) {
+ processShortcutMenu(menuItems[i], menuEntry);
} else {
createMenuEntries(menuItems[i].getMenu(), menuEntry,
trackDynamics);
@@ -2994,6 +2983,60 @@
}
}
+ protected void processShortcutMenu(MenuItem menuItem, DisplayItem menuEntry) {
+
+ String id = ((IContributionItem) menuItem.getData()).getId();
+ WorkbenchPlugin workbenchPlugin = WorkbenchPlugin.getDefault();
+ if (id.equals(ActionFactory.NEW.getId())) {
+ String category = WorkbenchMessages.ActionSetDialogInput_wizardCategory;
+ String[] shortcuts = perspective.getNewWizardShortcuts();
+ IWizardCategory rootCategory = workbenchPlugin.getNewWizardRegistry()
+ .getRootCategory();
+ initializeWizardsMenu(menuEntry, category, shortcuts, rootCategory);
+ newWizards = menuEntry;
+ } else if (id.equals(ActionFactory.IMPORT.getId())) {
+ String category = WorkbenchMessages.ActionSetDialogInput_importWizardCategory;
+ String[] shortcuts = perspective.getImportWizardShortcuts();
+ IWizardCategory rootCategory = workbenchPlugin
+ .getImportWizardRegistry().getRootCategory();
+ initializeWizardsMenu(menuEntry, category, shortcuts, rootCategory);
+ importWizards = menuEntry;
+ } else if (id.equals(ActionFactory.EXPORT.getId())) {
+ String category = WorkbenchMessages.ActionSetDialogInput_exportWizardCategory;
+ String[] shortcuts = perspective.getExportWizardShortcuts();
+ IWizardCategory rootCategory = workbenchPlugin
+ .getExportWizardRegistry()
+ .getRootCategory();
+ initializeWizardsMenu(menuEntry, category, shortcuts, rootCategory);
+ exportWizards = menuEntry;
+ } else if (id.equals(SHORTCUT_CONTRIBUTION_ITEM_ID_OPEN_PERSPECTIVE)) {
+ initializePerspectivesMenu(menuEntry);
+ perspectives = menuEntry;
+ } else if (id.equals(SHORTCUT_CONTRIBUTION_ITEM_ID_SHOW_VIEW)) {
+ initializeViewsMenu(menuEntry);
+ views = menuEntry;
+ }
+ }
+
+ private boolean isShortcutMenu(MenuItem menuItem) {
+
+ Object data = menuItem.getData();
+
+ if (data instanceof IContributionItem) {
+ String id = ((IContributionItem) data).getId();
+ if (id != null) {
+ if (id.equals(SHORTCUT_CONTRIBUTION_ITEM_ID_OPEN_PERSPECTIVE)
+ || id.equals(SHORTCUT_CONTRIBUTION_ITEM_ID_SHOW_VIEW)
+ || id.equals(ActionFactory.NEW.getId())
+ || id.equals(ActionFactory.IMPORT.getId())
+ || id.equals(ActionFactory.EXPORT.getId())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
private boolean getMenuItemIsVisible(DisplayItem item) {
return isAvailable(item)
&& !(perspective.getHiddenMenuItems()
@@ -3014,7 +3057,7 @@
*/
private void updateCategoryAndParents(StructuredViewer viewer,
Category category) {
- while (category.getParent() != shortcuts) {
+ while (category.getParent() != shortcutsCategory) {
viewer.update(category, null);
category = (Category) category.getParent();
}
@@ -3122,7 +3165,7 @@
if (item instanceof ShortcutItem)
return;
- if (item == wizards || item == perspectives || item == views) {
+ if (isShortcutItem(item)) {
//Shortcuts (i.e. wizards, perspectives, views) need special
//handling. Shortcuts themselves are not involved in calculating
//whether menus are visible, therefore we must record whether the
@@ -3152,6 +3195,12 @@
}
}
+ private boolean isShortcutItem(DisplayItem item) {
+ return item == newWizards || item == importWizards
+ || item == exportWizards || item == perspectives
+ || item == views;
+ }
+
private boolean updateHiddenElements(DisplayItem items, Collection currentHidden) {
boolean hasChanges = false;
@@ -3183,7 +3232,9 @@
protected void okPressed() {
// Shortcuts
if (showShortcutTab()) {
- perspective.setNewWizardActionIds(getVisibleIDs(wizards));
+ perspective.setNewWizardActionIds(getVisibleIDs(newWizards));
+ perspective.setImportWizardActionIds(getVisibleIDs(importWizards));
+ perspective.setExportWizardActionIds(getVisibleIDs(exportWizards));
perspective.setPerspectiveActionIds(getVisibleIDs(perspectives));
perspective.setShowViewActionIds(getVisibleIDs(views));
}
Index: Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java,v
retrieving revision 1.43
diff -u -r1.43 IWorkbenchRegistryConstants.java
--- Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java 2 Dec 2009 17:03:34 -0000 1.43
+++ Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java 16 Dec 2009 13:39:02 -0000
@@ -1125,6 +1125,20 @@
public static String TAG_NEW_WIZARD_SHORTCUT = "newWizardShortcut";//$NON-NLS-1$
/**
+ * Wizard shortcut tag. Value importWizardShortcut
.
+ *
+ * @since 3.6
+ */
+ public static String TAG_IMPORT_WIZARD_SHORTCUT = "importWizardShortcut";//$NON-NLS-1$
+
+ /**
+ * Wizard shortcut tag. Value exportWizardShortcut
.
+ *
+ * @since 3.6
+ */
+ public static String TAG_EXPORT_WIZARD_SHORTCUT = "exportWizardShortcut";//$NON-NLS-1$
+
+ /**
* Object contribution tag. Value objectContribution
.
*/
public static String TAG_OBJECT_CONTRIBUTION = "objectContribution";//$NON-NLS-1$
Index: Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveExtensionReader.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveExtensionReader.java,v
retrieving revision 1.31
diff -u -r1.31 PerspectiveExtensionReader.java
--- Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveExtensionReader.java 25 May 2009 20:52:15 -0000 1.31
+++ Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveExtensionReader.java 16 Dec 2009 13:39:02 -0000
@@ -17,7 +17,6 @@
import java.util.HashSet;
import java.util.Set;
-
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
@@ -119,7 +118,13 @@
} else if (type.equals(IWorkbenchRegistryConstants.TAG_VIEW_SHORTCUT)) {
result = processViewShortcut(child);
} else if (type.equals(IWorkbenchRegistryConstants.TAG_NEW_WIZARD_SHORTCUT)) {
- result = processWizardShortcut(child);
+ result = processNewWizardShortcut(child);
+ } else if (type
+ .equals(IWorkbenchRegistryConstants.TAG_IMPORT_WIZARD_SHORTCUT)) {
+ result = processImportWizardShortcut(child);
+ } else if (type
+ .equals(IWorkbenchRegistryConstants.TAG_EXPORT_WIZARD_SHORTCUT)) {
+ result = processExportWizardShortcut(child);
} else if (type.equals(IWorkbenchRegistryConstants.TAG_PERSP_SHORTCUT)) {
result = processPerspectiveShortcut(child);
} else if (type.equals(IWorkbenchRegistryConstants.TAG_SHOW_IN_PART)) {
@@ -333,10 +338,10 @@
return true;
}
- /**
- * Process a wizard shortcut
- */
- private boolean processWizardShortcut(IConfigurationElement element) {
+ /**
+ * Process a new wizard shortcut
+ */
+ private boolean processNewWizardShortcut(IConfigurationElement element) {
String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
if (id != null) {
pageLayout.addNewWizardShortcut(id);
@@ -344,6 +349,28 @@
return true;
}
+ /**
+ * Process a import wizard shortcut
+ */
+ private boolean processImportWizardShortcut(IConfigurationElement element) {
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ if (id != null) {
+ pageLayout.addImportWizardShortcut(id);
+ }
+ return true;
+ }
+
+ /**
+ * Process a export wizard shortcut
+ */
+ private boolean processExportWizardShortcut(IConfigurationElement element) {
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ if (id != null) {
+ pageLayout.addExportWizardShortcut(id);
+ }
+ return true;
+ }
+
protected boolean readElement(IConfigurationElement element) {
String type = element.getName();
if (type.equals(IWorkbenchRegistryConstants.TAG_PERSPECTIVE_EXTENSION)) {