diff options
author | Nick Edgar | 2004-11-15 15:52:23 +0000 |
---|---|---|
committer | Nick Edgar | 2004-11-15 15:52:23 +0000 |
commit | 11bf534c115c428616737f84be710b817115cf72 (patch) | |
tree | 5dfabcb48501233085e39455d2747795a0aecea5 /bundles/org.eclipse.ui.workbench/Eclipse UI/org | |
parent | b55b6274efadd9e0f5a5a06309124d1d95e5d58f (diff) | |
download | eclipse.platform.ui-11bf534c115c428616737f84be710b817115cf72.tar.gz eclipse.platform.ui-11bf534c115c428616737f84be710b817115cf72.tar.xz eclipse.platform.ui-11bf534c115c428616737f84be710b817115cf72.zip |
Bug 78623 [WorkingSets] Small improvements to working sets
Diffstat (limited to 'bundles/org.eclipse.ui.workbench/Eclipse UI/org')
4 files changed, 68 insertions, 1 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSet.java index e7b6d30e54e..ac1c81e4046 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSet.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSet.java @@ -96,4 +96,14 @@ public interface IWorkingSet extends IPersistableElement { * @param name the name of the working set */ public void setName(String name); + + /** + * Returns whether this working set can be edited or not. To make + * a working set editable the attribute <code>pageClass</code> of + * the extension defining a working set must be provided. + * + * @return <code>true</code> if the working set can be edit; otherwise + * <code>false</code> + */ + public boolean isEditable(); }
\ No newline at end of file diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java index de0408fc19d..e71700eab0b 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java @@ -15,6 +15,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.swt.widgets.Shell; import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.wizard.IWizard; import org.eclipse.ui.dialogs.IWorkingSetEditWizard; import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog; @@ -157,6 +158,31 @@ public interface IWorkingSetManager { */ public IWorkingSetEditWizard createWorkingSetEditWizard( IWorkingSet workingSet); + + /** + * Creates a working set new wizard. The wizard will allow creating new + * working sets. Returns <code>null</code> if there aren't any working set + * definitions that support creation of working sets. + * <p> + * Example: + * <code> + * IWizard wizard= workingSetManager.createWorkingSetNewWizard(); + * if (wizard != null) { + * WizardDialog dialog = new WizardDialog(shell, wizard); + * + * dialog.create(); + * if (dialog.open() == Window.OK) { + * ... + * } + * } + * </code> + * </p> + * + * @return the working set new wizard or <code>null</code> + * + * @since 3.1 + */ + public IWizard createWorkingSetNewWizard(); /** * @deprecated use createWorkingSetSelectionDialog(parent, true) instead diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java index 5a15aa03207..6c8f7eb6f70 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java @@ -27,6 +27,7 @@ import org.eclipse.jface.util.Assert; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.ListenerList; import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.wizard.IWizard; import org.eclipse.ui.IElementFactory; import org.eclipse.ui.IMemento; @@ -39,6 +40,7 @@ import org.eclipse.ui.dialogs.IWorkingSetEditWizard; import org.eclipse.ui.dialogs.IWorkingSetPage; import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog; import org.eclipse.ui.internal.dialogs.WorkingSetEditWizard; +import org.eclipse.ui.internal.dialogs.WorkingSetNewWizard; import org.eclipse.ui.internal.dialogs.WorkingSetSelectionDialog; import org.eclipse.ui.internal.registry.WorkingSetDescriptor; import org.eclipse.ui.internal.registry.WorkingSetRegistry; @@ -436,6 +438,19 @@ public abstract class AbstractWorkingSetManager implements IWorkingSetManager, B return new WorkingSetSelectionDialog(parent, multi); } + /** + * {@inheritDoc} + */ + public IWizard createWorkingSetNewWizard() { + WorkingSetDescriptor[] descriptors= WorkbenchPlugin.getDefault(). + getWorkingSetRegistry().getWorkingSetDescriptors(); + for (int i= 0; i < descriptors.length; i++) { + if (descriptors[i].getPageClassName() != null) + return new WorkingSetNewWizard(); + } + return null; + } + //---- working set delta handling ------------------------------------------------- public synchronized void bundleChanged(BundleEvent event) { @@ -445,8 +460,10 @@ public abstract class AbstractWorkingSetManager implements IWorkingSetManager, B .getWorkingSetRegistry().getDescriptorsForNamespace(event.getBundle().getSymbolicName()); for (int i= 0; i < descriptors.length; i++) { WorkingSetDescriptor descriptor= descriptors[i]; - IWorkingSetUpdater updater= getUpdater(descriptor); List workingSets= getWorkingSetsForId(descriptor.getId()); + if (workingSets.size() == 0) + continue; + IWorkingSetUpdater updater= getUpdater(descriptor); for (Iterator iter= workingSets.iterator(); iter.hasNext();) { IWorkingSet workingSet= (IWorkingSet)iter.next(); if (!updater.contains(workingSet)) diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSet.java index 34bd79e9e06..d522f3cc392 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSet.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSet.java @@ -101,6 +101,20 @@ public class WorkingSet implements IAdaptable, IWorkingSet { } /** + * {@inheritDoc} + */ + public boolean isEditable() { + WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry(); + String id= getId(); + if (id == null) + return false; + WorkingSetDescriptor descriptor= registry.getWorkingSetDescriptor(id); + if (descriptor == null) + return false; + return descriptor.getPageClassName() != null; + } + + /** * Returns the receiver if the requested type is either IWorkingSet * or IPersistableElement. * |