### Eclipse Workspace Patch 1.0
#P org.eclipse.gmf.runtime.common.ui.services
Index: src/org/eclipse/gmf/runtime/common/ui/services/elementselection/ElementSelectionComposite.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.common.ui.services/src/org/eclipse/gmf/runtime/common/ui/services/elementselection/ElementSelectionComposite.java,v
retrieving revision 1.6
diff -u -r1.6 ElementSelectionComposite.java
--- src/org/eclipse/gmf/runtime/common/ui/services/elementselection/ElementSelectionComposite.java 6 Apr 2006 20:40:42 -0000 1.6
+++ src/org/eclipse/gmf/runtime/common/ui/services/elementselection/ElementSelectionComposite.java 23 Jun 2006 17:59:38 -0000
@@ -90,9 +90,16 @@
* The job running the element selection service.
*/
private Job job;
+
+ /**
+ * The selection service to use to search for elements.
+ */
+ private final ElementSelectionService selectionService;
/**
- * Constructs a new instance that will create the new composite.
+ * Constructs a new instance that will create the new composite. I will use
+ * the default {@linkplain ElementSelectionService#getInstance() selection service}
+ * to process the input.
*
* @param title
* the dialog title
@@ -101,9 +108,24 @@
*/
public ElementSelectionComposite(String title,
AbstractElementSelectionInput input) {
- super();
- this.title = title;
- this.input = input;
+ this(title, input, ElementSelectionService.getInstance());
+ }
+
+ /**
+ * Constructs a new instance that will create the new composite.
+ *
+ * @param title the dialog title
+ * @param input the element selection input
+ * @param selectionService the selection service to use to process the
+ * input
+ */
+ public ElementSelectionComposite(String title,
+ AbstractElementSelectionInput input,
+ ElementSelectionService selectionService) {
+ super();
+ this.title = title;
+ this.input = input;
+ this.selectionService = selectionService;
}
/**
@@ -250,8 +272,7 @@
CommonUIServicesMessages.ElementSelectionService_ProgressName,
IProgressMonitor.UNKNOWN);
- job = ElementSelectionService.getInstance().getMatchingObjects(
- input, this);
+ job = selectionService.getMatchingObjects(input, this);
}
}
Index: src/org/eclipse/gmf/runtime/common/ui/services/elementselection/AbstractElementSelectionProvider.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.common.ui.services/src/org/eclipse/gmf/runtime/common/ui/services/elementselection/AbstractElementSelectionProvider.java,v
retrieving revision 1.3
diff -u -r1.3 AbstractElementSelectionProvider.java
--- src/org/eclipse/gmf/runtime/common/ui/services/elementselection/AbstractElementSelectionProvider.java 31 Mar 2006 02:09:33 -0000 1.3
+++ src/org/eclipse/gmf/runtime/common/ui/services/elementselection/AbstractElementSelectionProvider.java 23 Jun 2006 17:59:38 -0000
@@ -51,8 +51,19 @@
IElementSelectionInput input, IElementSelectionListener listener) {
elementSelectionInput = input;
elementSelectionListener = listener;
- ElementSelectionServiceJob job = new ElementSelectionServiceJob(
- getJobName(), this);
+ ElementSelectionServiceJob job = createSelectionJob();
+ return job;
+ }
+
+ /**
+ * Creates the selection service job that runs the provider's search.
+ * This method should configure the new job with the appropriate
+ * priority, scheduling rules, etc. but should not schedule it.
+ *
+ * @return a new selection provider job
+ */
+ protected ElementSelectionServiceJob createSelectionJob() {
+ ElementSelectionServiceJob job = new ElementSelectionServiceJob(getJobName(), this);
job.setPriority(Job.SHORT);
return job;
}
Index: src/org/eclipse/gmf/runtime/common/ui/services/elementselection/ElementSelectionService.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.common.ui.services/src/org/eclipse/gmf/runtime/common/ui/services/elementselection/ElementSelectionService.java,v
retrieving revision 1.4
diff -u -r1.4 ElementSelectionService.java
--- src/org/eclipse/gmf/runtime/common/ui/services/elementselection/ElementSelectionService.java 5 Jun 2006 18:30:29 -0000 1.4
+++ src/org/eclipse/gmf/runtime/common/ui/services/elementselection/ElementSelectionService.java 23 Jun 2006 17:59:38 -0000
@@ -71,8 +71,7 @@
private final static ElementSelectionService instance = new ElementSelectionService();
static {
- instance.configureProviders(CommonUIServicesPlugin.getPluginId(),
- "elementSelectionProviders"); //$NON-NLS-1$
+ instance.configureProviders();
}
/**
@@ -110,12 +109,23 @@
IElementSelectionInput input, IElementSelectionListener listener) {
elementSelectionInput = input;
elementSelectionListener = listener;
- ElementSelectionServiceJob job = new ElementSelectionServiceJob(
- getJobName(), this);
- job.setPriority(Job.SHORT);
+ ElementSelectionServiceJob job = createSelectionJob();
job.schedule();
return job;
}
+
+ /**
+ * Creates the selection service job that manages the individual provider
+ * search jobs. This method should configure the new job with the appropriate
+ * priority, scheduling rules, etc. but should not schedule it.
+ *
+ * @return a new selection service job
+ */
+ protected ElementSelectionServiceJob createSelectionJob() {
+ ElementSelectionServiceJob job = new ElementSelectionServiceJob(getJobName(), this);
+ job.setPriority(Job.SHORT);
+ return job;
+ }
/**
* {@inheritDoc}
@@ -153,9 +163,12 @@
}
for (Iterator i = jobsClone.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry) i.next();
+ IElementSelectionProvider provider = (IElementSelectionProvider) entry
+ .getKey();
ElementSelectionServiceJob job = (ElementSelectionServiceJob) entry
.getValue();
- job.schedule();
+
+ schedule(provider, job);
}
/**
@@ -179,6 +192,16 @@
}
monitor.done();
}
+
+ /**
+ * Schedules the specified selection provider job.
+ *
+ * @param provider a selection provider
+ * @param job the provider
's job
+ */
+ protected void schedule(IElementSelectionProvider provider, ElementSelectionServiceJob job) {
+ job.schedule();
+ }
/**
* Resolve the matching object to a modeling object. The service always
@@ -300,4 +323,14 @@
IConfigurationElement element) {
return new ProviderDescriptor(element);
}
+
+ /**
+ * Configures my providers from the elementSelectionProviders
+ * extension point.
+ */
+ protected void configureProviders() {
+ configureProviders(
+ CommonUIServicesPlugin.getPluginId(),
+ "elementSelectionProviders"); //$NON-NLS-1$
+ }
}