Author: koen.aers(a)jboss.com
Date: 2009-02-24 07:58:16 -0500 (Tue, 24 Feb 2009)
New Revision: 13758
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/command/RenameElementCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/AbstractConnectionWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/AbstractWrapper.java
Log:
- rename source is IPropertySource ipv Wrapper
- removed duplicate listener list
- only take property changes into account for label editpart
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/command/RenameElementCommand.java
===================================================================
---
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/command/RenameElementCommand.java 2009-02-24
11:32:16 UTC (rev 13757)
+++
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/command/RenameElementCommand.java 2009-02-24
12:58:16 UTC (rev 13758)
@@ -19,7 +19,6 @@
import org.eclipse.gef.commands.Command;
import org.eclipse.ui.views.properties.IPropertySource;
import org.jboss.tools.flow.common.properties.IPropertyId;
-import org.jboss.tools.flow.common.wrapper.Wrapper;
/**
* A command for renaming an element.
@@ -28,15 +27,14 @@
*/
public class RenameElementCommand extends Command {
- private Wrapper source;
+ private IPropertySource source;
private String name;
private String oldName;
public void execute() {
- IPropertySource propertySource =
(IPropertySource)source.getAdapter(IPropertySource.class);
- if (propertySource != null) {
- propertySource.setPropertyValue(IPropertyId.NAME, name);
+ if (source != null) {
+ source.setPropertyValue(IPropertyId.NAME, name);
}
}
@@ -48,14 +46,13 @@
oldName = string;
}
- public void setSource(Wrapper action) {
- source = action;
+ public void setSource(IPropertySource propertySource) {
+ source = propertySource;
}
public void undo() {
- IPropertySource propertySource =
(IPropertySource)source.getAdapter(IPropertySource.class);
- if (propertySource != null) {
- propertySource.setPropertyValue(IPropertyId.NAME, oldName);
+ if (source != null) {
+ source.setPropertyValue(IPropertyId.NAME, oldName);
}
}
}
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java
===================================================================
---
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java 2009-02-24
11:32:16 UTC (rev 13757)
+++
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java 2009-02-24
12:58:16 UTC (rev 13758)
@@ -106,7 +106,9 @@
}
public void modelChanged(ModelEvent event) {
- refreshVisuals();
+ if (event.getChange() == Wrapper.CHANGE_PROPERTY) {
+ refreshVisuals();
+ }
}
private class LabelConstraint implements Locator {
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/AbstractConnectionWrapper.java
===================================================================
---
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/AbstractConnectionWrapper.java 2009-02-24
11:32:16 UTC (rev 13757)
+++
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/AbstractConnectionWrapper.java 2009-02-24
12:58:16 UTC (rev 13758)
@@ -34,7 +34,6 @@
private NodeWrapper target;
private LabelWrapper label;
private transient List<Point> bendpoints = new ArrayList<Point>();
- private transient List<ModelListener> listeners = new
ArrayList<ModelListener>();
public void localSetSource(NodeWrapper source) {
this.source = source;
@@ -127,19 +126,4 @@
return label;
}
- public void addListener(ModelListener listener) {
- listeners.add(listener);
- }
-
- public void removeListener(ModelListener listener) {
- listeners.remove(listener);
- }
-
- protected void notifyListeners(int change) {
- ModelEvent event = new ModelEvent(change);
- for (ModelListener listener : listeners) {
- listener.modelChanged(event);
- }
- }
-
}
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/AbstractWrapper.java
===================================================================
---
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/AbstractWrapper.java 2009-02-24
11:32:16 UTC (rev 13757)
+++
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/AbstractWrapper.java 2009-02-24
12:58:16 UTC (rev 13758)
@@ -34,6 +34,10 @@
listener.modelChanged(event);
}
}
+
+ public void notifyListeners(int change) {
+ notifyListeners(change, null);
+ }
public Object getEditableValue() {
if (getPropertySource() != null) {
Show replies by date