Index: src/org/eclipse/ui/internal/navigator/wizards/CommonWizardDescriptorManager.java
===================================================================
RCS file: /home/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/wizards/CommonWizardDescriptorManager.java,v
retrieving revision 1.4
diff -u -r1.4 CommonWizardDescriptorManager.java
--- src/org/eclipse/ui/internal/navigator/wizards/CommonWizardDescriptorManager.java 7 Apr 2006 15:33:46 -0000 1.4
+++ src/org/eclipse/ui/internal/navigator/wizards/CommonWizardDescriptorManager.java 10 Apr 2006 19:35:13 -0000
@@ -19,10 +19,10 @@
import java.util.Set;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.internal.navigator.NavigatorPlugin;
import org.eclipse.ui.internal.navigator.extensions.NavigatorContentRegistryReader;
+import org.eclipse.ui.navigator.INavigatorContentService;
/**
*
@@ -96,10 +96,12 @@
* @param aType
* The type of wizards to locate (e.g. 'new', 'import', or
* 'export' etc).
+ * @param aContentService
+ * The content service to use when deciding visibility.
* @return the best content descriptor for the given element.
*/
public String[] getEnabledCommonWizardDescriptorIds(Object anElement,
- String aType) {
+ String aType, INavigatorContentService aContentService) {
Set commonDescriptors = (Set) commonWizardDescriptors.get(aType);
if (commonDescriptors == null) {
@@ -112,7 +114,8 @@
CommonWizardDescriptor descriptor = (CommonWizardDescriptor) commonWizardDescriptorsItr
.next();
- if (descriptor.isEnabledFor(anElement)) {
+ if (isVisible(aContentService, descriptor)
+ && descriptor.isEnabledFor(anElement)) {
descriptorIds.add(descriptor.getWizardId());
}
}
@@ -121,37 +124,14 @@
}
/**
- *
- * Returns all content descriptor(s) which enable for the given element.
- *
- * @param aStructuredSelection
- * the element to return the best content descriptor for
- * @param aType
- * The type of wizards to locate (e.g. 'new', 'import', or
- * 'export' etc).
- * @return the best content descriptor for the given element.
+ * @param aContentService
+ * @param descriptor
+ * @return
*/
- public String[] getEnabledCommonWizardDescriptorIds(
- IStructuredSelection aStructuredSelection, String aType) {
- Set commonDescriptors = (Set) commonWizardDescriptors.get(aType);
- if (commonDescriptors == null) {
- return NO_DESCRIPTORS;
- }
- /* Find other Common Wizard providers which enable for this object */
- List descriptorIds = new ArrayList();
- for (Iterator commonWizardDescriptorsItr = commonDescriptors.iterator(); commonWizardDescriptorsItr
- .hasNext();) {
- CommonWizardDescriptor descriptor = (CommonWizardDescriptor) commonWizardDescriptorsItr
- .next();
-
- if (descriptor.isEnabledFor(aStructuredSelection)) {
- descriptorIds.add(descriptor.getWizardId());
- }
- }
- String[] wizardIds = new String[descriptorIds.size()];
- return (String[]) descriptorIds.toArray(wizardIds); // Collections.unmodifiableList(descriptors);
+ private boolean isVisible(INavigatorContentService aContentService, CommonWizardDescriptor descriptor) {
+ return (aContentService == null || (descriptor.getId() == null || aContentService.isVisible(descriptor.getId())));
}
-
+
private class CommonWizardRegistry extends NavigatorContentRegistryReader {
@@ -166,6 +146,22 @@
NavigatorPlugin
.logError(0, e.getMessage(), e);
}
+ } if(TAG_NAVIGATOR_CONTENT.equals(anElement.getName())) {
+
+ IConfigurationElement[] commonWizards = anElement.getChildren(TAG_COMMON_WIZARD);
+
+ String contentExtensionId = anElement.getAttribute(ATT_ID);
+ for (int i = 0; i < commonWizards.length; i++) {
+ try {
+ addCommonWizardDescriptor(new CommonWizardDescriptor(
+ anElement, contentExtensionId));
+ return true;
+ } catch (WorkbenchException e) {
+ // log an error since its not safe to open a dialog here
+ NavigatorPlugin
+ .logError(0, e.getMessage(), e);
+ }
+ }
}
return super.readElement(anElement);
}
Index: src/org/eclipse/ui/internal/navigator/wizards/CommonWizardDescriptor.java
===================================================================
RCS file: /home/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/wizards/CommonWizardDescriptor.java,v
retrieving revision 1.4
diff -u -r1.4 CommonWizardDescriptor.java
--- src/org/eclipse/ui/internal/navigator/wizards/CommonWizardDescriptor.java 7 Apr 2006 15:33:46 -0000 1.4
+++ src/org/eclipse/ui/internal/navigator/wizards/CommonWizardDescriptor.java 10 Apr 2006 19:35:12 -0000
@@ -25,6 +25,7 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.internal.navigator.NavigatorPlugin;
+import org.eclipse.ui.internal.navigator.extensions.INavigatorContentExtPtConstants;
/**
*
@@ -36,14 +37,11 @@
*
* @since 3.2
*/
-public class CommonWizardDescriptor {
+public class CommonWizardDescriptor implements INavigatorContentExtPtConstants {
- private static final String ATT_WIZARD_ID = "wizardId"; //$NON-NLS-1$
-
- private static final String ATT_TYPE = "type"; //$NON-NLS-1$
-
- private static final String TAG_ENABLEMENT = "enablement"; //$NON-NLS-1$
+ private String id;
+
private String wizardId;
private String type;
@@ -54,7 +52,7 @@
/**
* @param aConfigElement The configuration element from the extension point.
- * * @throws WorkbenchException
+ * @throws WorkbenchException
* if the configuration element could not be parsed. Reasons
* include:
*
@@ -67,6 +65,27 @@
super();
configElement = aConfigElement;
init();
+ }
+
+ /**
+ * @param aConfigElement The configuration element from the extension point.
+ * @param anId the identifier for visibility purposes.
+ *
+ * @throws WorkbenchException
+ * if the configuration element could not be parsed. Reasons
+ * include:
+ *
+ * - A required attribute is missing.
+ * - More elements are define than is allowed.
+ *
+ */
+ public CommonWizardDescriptor(IConfigurationElement aConfigElement, String anId)
+ throws WorkbenchException {
+ super();
+ configElement = aConfigElement;
+ id = anId;
+ init();
+
}
/**
@@ -125,7 +144,7 @@
return false;
}
- void init() throws WorkbenchException {
+ void init() throws WorkbenchException {
wizardId = configElement.getAttribute(ATT_WIZARD_ID);
type = configElement.getAttribute(ATT_TYPE);
@@ -176,8 +195,15 @@
* @return the declaring namespace.
*/
public String getNamespace() {
- return configElement.getDeclaringExtension().getNamespaceIdentifier();
-
+ return configElement.getDeclaringExtension().getNamespaceIdentifier();
+ }
+
+ /**
+ *
+ * @return The identifier of the wizard descriptor for visiblity purposes (or null) if none.
+ */
+ public String getId() {
+ return id;
}
}
\ No newline at end of file
Index: src/org/eclipse/ui/internal/navigator/NavigatorContentService.java
===================================================================
RCS file: /home/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/NavigatorContentService.java,v
retrieving revision 1.10
diff -u -r1.10 NavigatorContentService.java
--- src/org/eclipse/ui/internal/navigator/NavigatorContentService.java 30 Mar 2006 06:05:30 -0000 1.10
+++ src/org/eclipse/ui/internal/navigator/NavigatorContentService.java 10 Apr 2006 19:35:12 -0000
@@ -676,6 +676,22 @@
*/
public void onExtensionActivation(String aViewerId,
String[] aNavigatorExtensionId, boolean toEnable) {
+ synchronized (this) {
+ NavigatorContentDescriptor key;
+ NavigatorContentExtension extension;
+ for (Iterator iter = contentExtensions.keySet().iterator(); iter.hasNext();) {
+ key = (NavigatorContentDescriptor) iter.next();
+ INavigatorActivationService activation = getActivationService();
+ if(!activation.isNavigatorExtensionActive(key.getId())) {
+ extension = (NavigatorContentExtension) contentExtensions.remove(key);
+ /* There really shouldn't be any way that this
+ can be null, but just to be safe */
+ if(extension != null) {
+ extension.dispose();
+ }
+ }
+ }
+ }
update();
}
Index: src/org/eclipse/ui/navigator/WizardActionGroup.java
===================================================================
RCS file: /home/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/WizardActionGroup.java,v
retrieving revision 1.9
diff -u -r1.9 WizardActionGroup.java
--- src/org/eclipse/ui/navigator/WizardActionGroup.java 7 Apr 2006 15:34:22 -0000 1.9
+++ src/org/eclipse/ui/navigator/WizardActionGroup.java 10 Apr 2006 19:35:13 -0000
@@ -113,6 +113,8 @@
private String type;
+ private INavigatorContentService contentService;
+
/**
*
* @param aWindow
@@ -144,6 +146,33 @@
type = aType;
}
+
+
+ /**
+ *
+ * @param aWindow
+ * The window that will be used to acquire a Shell and a
+ * Selection Service
+ * @param aWizardRegistry
+ * The wizard registry will be used to locate the correct wizard
+ * descriptions.
+ * @param aType
+ * Indicates the value of the type attribute of the commonWizard
+ * extension point. Use any of the TYPE_XXX constants defined on
+ * this class.
+ * @param aContentService
+ * The content service to use when deciding visibility.
+ * @see PlatformUI#getWorkbench()
+ * @see IWorkbench#getNewWizardRegistry()
+ * @see IWorkbench#getImportWizardRegistry()
+ * @see IWorkbench#getExportWizardRegistry()
+ */
+ public WizardActionGroup(IWorkbenchWindow aWindow,
+ IWizardRegistry aWizardRegistry, String aType, INavigatorContentService aContentService) {
+ this(aWindow, aWizardRegistry, aType);
+ contentService = aContentService;
+
+ }
public void setContext(ActionContext aContext) {
Assert.isTrue(!disposed);
@@ -160,7 +189,7 @@
}
// null should be okay here
setWizardActionIds(CommonWizardDescriptorManager.getInstance()
- .getEnabledCommonWizardDescriptorIds(element, type));
+ .getEnabledCommonWizardDescriptorIds(element, type, contentService));
} else {
setWizardActionIds(NO_IDS);
}
#P org.eclipse.ui.navigator.resources
Index: src/org/eclipse/ui/internal/navigator/resources/actions/NewActionProvider.java
===================================================================
RCS file: /home/eclipse/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/NewActionProvider.java,v
retrieving revision 1.4
diff -u -r1.4 NewActionProvider.java
--- src/org/eclipse/ui/internal/navigator/resources/actions/NewActionProvider.java 24 Feb 2006 17:57:50 -0000 1.4
+++ src/org/eclipse/ui/internal/navigator/resources/actions/NewActionProvider.java 10 Apr 2006 19:35:13 -0000
@@ -52,10 +52,10 @@
private boolean contribute = false;
- public void init(ICommonActionExtensionSite aConfig) {
+ public void init(ICommonActionExtensionSite anExtensionSite) {
- if (aConfig.getViewSite() instanceof ICommonViewerWorkbenchSite) {
- IWorkbenchWindow window = ((ICommonViewerWorkbenchSite) aConfig
+ if (anExtensionSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
+ IWorkbenchWindow window = ((ICommonViewerWorkbenchSite) anExtensionSite
.getViewSite()).getWorkbenchWindow();
showDlgAction = ActionFactory.NEW.create(window);
newProjectAction = new NewProjectAction(window);
@@ -63,7 +63,7 @@
newWizardActionGroup = new WizardActionGroup(window, PlatformUI
.getWorkbench().getNewWizardRegistry(),
- WizardActionGroup.TYPE_NEW);
+ WizardActionGroup.TYPE_NEW, anExtensionSite.getContentService());
contribute = true;
}
Index: src/org/eclipse/ui/internal/navigator/resources/actions/PortingActionProvider.java
===================================================================
RCS file: /home/eclipse/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/PortingActionProvider.java,v
retrieving revision 1.7
diff -u -r1.7 PortingActionProvider.java
--- src/org/eclipse/ui/internal/navigator/resources/actions/PortingActionProvider.java 7 Apr 2006 15:36:10 -0000 1.7
+++ src/org/eclipse/ui/internal/navigator/resources/actions/PortingActionProvider.java 10 Apr 2006 19:35:13 -0000
@@ -72,22 +72,22 @@
private boolean contribute= false;
- public void init(ICommonActionExtensionSite aConfig) {
+ public void init(ICommonActionExtensionSite anExtensionSite) {
Assert.isTrue(!disposed);
- if (aConfig.getViewSite() instanceof ICommonViewerWorkbenchSite) {
+ if (anExtensionSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
- IWorkbenchWindow window = ((ICommonViewerWorkbenchSite) aConfig
+ IWorkbenchWindow window = ((ICommonViewerWorkbenchSite) anExtensionSite
.getViewSite()).getWorkbenchWindow();
importAction = new ImportResourcesAction(window);
exportAction = new ExportResourcesAction(window);
importWizardActionGroup = new WizardActionGroup(window, PlatformUI
.getWorkbench().getImportWizardRegistry(),
- WizardActionGroup.TYPE_IMPORT);
+ WizardActionGroup.TYPE_IMPORT, anExtensionSite.getContentService());
exportWizardActionGroup = new WizardActionGroup(window, PlatformUI
.getWorkbench().getExportWizardRegistry(),
- WizardActionGroup.TYPE_EXPORT);
+ WizardActionGroup.TYPE_EXPORT, anExtensionSite.getContentService());
contribute = true;
}
}
Index: src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceExtensionContentProvider.java
===================================================================
RCS file: /home/eclipse/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceExtensionContentProvider.java,v
retrieving revision 1.2
diff -u -r1.2 ResourceExtensionContentProvider.java
--- src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceExtensionContentProvider.java 24 Feb 2006 17:57:50 -0000 1.2
+++ src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceExtensionContentProvider.java 10 Apr 2006 19:35:13 -0000
@@ -14,6 +14,7 @@
import java.util.Collection;
import java.util.Iterator;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.jface.viewers.AbstractTreeViewer;
@@ -62,6 +63,13 @@
}
/* (non-Javadoc)
+ * @see org.eclipse.ui.model.BaseWorkbenchContentProvider#hasChildren(java.lang.Object)
+ */
+ public boolean hasChildren(Object element) {
+ return element instanceof IContainer && super.hasChildren(element);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.ui.model.WorkbenchContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
Index: icons/full/etool16/export_wiz.gif
===================================================================
RCS file: icons/full/etool16/export_wiz.gif
diff -N icons/full/etool16/export_wiz.gif
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ icons/full/etool16/export_wiz.gif 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,5 @@
+GIF89a Õ ??Ÿ?_ŸLg—QmžQl?To¡Pm?Sp¡Qm?Rn?Xt¤Xt£Xu£Yu£\x§_|«`}«_{¨cdf‚¯…¡Í†¡Í?³Ö_}«_}ªc€…¢Í†¢Í†¢Ì?ªÒ§»Ú§¼Ú¯ÁÝ3p¤3p£@w§
+\šÿÿÿ !ù &