Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-08-10 09:07:08 +0000
committerEike Stepper2011-08-10 09:07:08 +0000
commitbe5579034b081335c2b3e48413cea6cb99991011 (patch)
tree49b3f76325d6c0eb2080acaaa3c6b785da4a03ad /plugins/org.eclipse.net4j.util.ui
parent6da925d59e1d48ac6200308c1951cc33132042a2 (diff)
downloadcdo-be5579034b081335c2b3e48413cea6cb99991011.tar.gz
cdo-be5579034b081335c2b3e48413cea6cb99991011.tar.xz
cdo-be5579034b081335c2b3e48413cea6cb99991011.zip
[354345] Enable listeners of ElementWizard to be notified about UI changes
https://bugs.eclipse.org/bugs/show_bug.cgi?id=354345
Diffstat (limited to 'plugins/org.eclipse.net4j.util.ui')
-rw-r--r--plugins/org.eclipse.net4j.util.ui/META-INF/MANIFEST.MF30
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizard.java11
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizardComposite.java47
3 files changed, 69 insertions, 19 deletions
diff --git a/plugins/org.eclipse.net4j.util.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.util.ui/META-INF/MANIFEST.MF
index 7809bb7293..03b87f98e5 100644
--- a/plugins/org.eclipse.net4j.util.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.util.ui/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.net4j.util.ui;singleton:=true
-Bundle-Version: 3.1.0.qualifier
+Bundle-Version: 3.2.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
@@ -13,17 +13,17 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.4.0,4.0.0)";visibility:=reexport,
org.eclipse.net4j.util;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.net4j.ui.shared;bundle-version="[4.0.0,5.0.0)"
-Export-Package: org.eclipse.net4j.util.internal.ui;version="3.1.0";x-internal:=true,
- org.eclipse.net4j.util.internal.ui.actions;version="3.1.0";x-internal:=true,
- org.eclipse.net4j.util.internal.ui.bundle;version="3.1.0";x-internal:=true,
- org.eclipse.net4j.util.internal.ui.messages;version="3.1.0";x-internal:=true,
- org.eclipse.net4j.util.internal.ui.views;version="3.1.0";x-internal:=true,
- org.eclipse.net4j.util.ui;version="3.1.0",
- org.eclipse.net4j.util.ui.actions;version="3.1.0",
- org.eclipse.net4j.util.ui.container;version="3.1.0",
- org.eclipse.net4j.util.ui.dnd;version="3.1.0",
- org.eclipse.net4j.util.ui.prefs;version="3.1.0",
- org.eclipse.net4j.util.ui.proposals;version="3.1.0",
- org.eclipse.net4j.util.ui.security;version="3.1.0",
- org.eclipse.net4j.util.ui.views;version="3.1.0",
- org.eclipse.net4j.util.ui.widgets;version="3.1.0"
+Export-Package: org.eclipse.net4j.util.internal.ui;version="3.2.0";x-internal:=true,
+ org.eclipse.net4j.util.internal.ui.actions;version="3.2.0";x-internal:=true,
+ org.eclipse.net4j.util.internal.ui.bundle;version="3.2.0";x-internal:=true,
+ org.eclipse.net4j.util.internal.ui.messages;version="3.2.0";x-internal:=true,
+ org.eclipse.net4j.util.internal.ui.views;version="3.2.0";x-internal:=true,
+ org.eclipse.net4j.util.ui;version="3.2.0",
+ org.eclipse.net4j.util.ui.actions;version="3.2.0",
+ org.eclipse.net4j.util.ui.container;version="3.2.0",
+ org.eclipse.net4j.util.ui.dnd;version="3.2.0",
+ org.eclipse.net4j.util.ui.prefs;version="3.2.0",
+ org.eclipse.net4j.util.ui.proposals;version="3.2.0",
+ org.eclipse.net4j.util.ui.security;version="3.2.0",
+ org.eclipse.net4j.util.ui.views;version="3.2.0",
+ org.eclipse.net4j.util.ui.widgets;version="3.2.0"
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizard.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizard.java
index 2f74085344..a3d22709a0 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizard.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizard.java
@@ -10,7 +10,9 @@
*/
package org.eclipse.net4j.util.ui.container;
+import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.event.Notifier;
import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.net4j.util.ui.ValidationContext;
@@ -24,7 +26,7 @@ import org.eclipse.swt.widgets.Text;
* @author Eike Stepper
* @since 3.1
*/
-public abstract class ElementWizard implements IElementWizard, ValidationContext
+public abstract class ElementWizard extends Notifier implements IElementWizard, ValidationContext
{
private IManagedContainer container;
@@ -86,7 +88,12 @@ public abstract class ElementWizard implements IElementWizard, ValidationContext
protected void setResultDescription(String resultDescription)
{
- this.resultDescription = resultDescription;
+ String oldDescription = this.resultDescription;
+ if (!ObjectUtil.equals(resultDescription, oldDescription))
+ {
+ this.resultDescription = resultDescription;
+ fireEvent();
+ }
}
public void setValidationError(Object source, String message)
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizardComposite.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizardComposite.java
index f6766b5d9e..257ddbb718 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizardComposite.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/container/ElementWizardComposite.java
@@ -13,6 +13,10 @@ package org.eclipse.net4j.util.ui.container;
import org.eclipse.net4j.util.container.FactoryNotFoundException;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.container.IPluginContainer;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.event.INotifier;
+import org.eclipse.net4j.util.event.Notifier;
import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.net4j.util.ui.ValidationContext;
@@ -39,7 +43,7 @@ import java.util.Map;
* @author Eike Stepper
* @since 3.1
*/
-public abstract class ElementWizardComposite extends Composite
+public abstract class ElementWizardComposite extends Composite implements IListener
{
private static final IElementWizard NO_WIZARD = new ElementWizard()
{
@@ -68,11 +72,24 @@ public abstract class ElementWizardComposite extends Composite
private boolean firstLayout = true;
+ private Notifier notifier = new Notifier();
+
public ElementWizardComposite(Composite parent, int style, String productGroup, String label)
{
+ this(parent, style, productGroup, label, null);
+ }
+
+ /**
+ * @since 3.2
+ */
+ public ElementWizardComposite(Composite parent, int style, String productGroup, String label,
+ ValidationContext validationContext)
+ {
super(parent, style);
this.productGroup = productGroup;
this.label = label;
+
+ setValidationContext(validationContext);
create();
}
@@ -122,6 +139,12 @@ public abstract class ElementWizardComposite extends Composite
getProductGroup() + ":" + factoryType, description);
wizards.add(wizard);
wizardControls.put(wizard, new ArrayList<Control>());
+
+ if (wizard instanceof ElementWizard)
+ {
+ ElementWizard impl = (ElementWizard)wizard;
+ impl.addListener(this);
+ }
}
catch (FactoryNotFoundException ex)
{
@@ -130,6 +153,14 @@ public abstract class ElementWizardComposite extends Composite
}
}
+ /**
+ * @since 3.2
+ */
+ public void notifyEvent(IEvent event)
+ {
+ notifier.fireEvent(event);
+ }
+
protected List<String> getFactoryTypes()
{
return factoryTypes;
@@ -157,7 +188,10 @@ public abstract class ElementWizardComposite extends Composite
harvestControls(wizard);
}
- setFactoryType(factoryTypes.get(0));
+ if (!factoryTypes.isEmpty())
+ {
+ setFactoryType(factoryTypes.get(0));
+ }
}
protected void factoryTypeChanged()
@@ -189,6 +223,7 @@ public abstract class ElementWizardComposite extends Composite
// layout(getChildren());
layout();
+ notifier.fireEvent();
}
@Override
@@ -222,6 +257,14 @@ public abstract class ElementWizardComposite extends Composite
return IPluginContainer.INSTANCE;
}
+ /**
+ * @since 3.2
+ */
+ public final INotifier getNotifier()
+ {
+ return notifier;
+ }
+
public String getDescription()
{
String resultType = getFactoryType();

Back to the top