Author: DartPeng
Date: 2010-07-02 00:33:14 -0400 (Fri, 02 Jul 2010)
New Revision: 23170
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/TreeNodeConnectionEditPart.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/figures/LeftOrRightAnchor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
Log:
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/TreeNodeConnectionEditPart.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/TreeNodeConnectionEditPart.java 2010-07-02
00:08:51 UTC (rev 23169)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/TreeNodeConnectionEditPart.java 2010-07-02
04:33:14 UTC (rev 23170)
@@ -303,6 +303,7 @@
}
public PointList getPoints() {
+// if(true) return super.getPoints();
ConnectionAnchor sourceAnchor = getSourceConnectionAnchor();
ConnectionAnchor targetAnchor = getTargetConnectionAnchor();
boolean startLeft = false;
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/figures/LeftOrRightAnchor.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/figures/LeftOrRightAnchor.java 2010-07-02
00:08:51 UTC (rev 23169)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/figures/LeftOrRightAnchor.java 2010-07-02
04:33:14 UTC (rev 23170)
@@ -3,6 +3,7 @@
import org.eclipse.draw2d.ChopboxAnchor;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Point;
+import org.jboss.tools.smooks.graphical.figures.ContainerFigure;
public class LeftOrRightAnchor extends ChopboxAnchor {
@@ -18,9 +19,17 @@
}
public Point getLocation(Point reference) {
+// if(true) return super.getLocation(reference);
Point p;
IFigure hostFigure = getOwner();
IFigure parent = hostFigure.getParent();
+ IFigure containerFigure = hostFigure.getParent();
+ while(containerFigure != null && !(containerFigure instanceof
ContainerFigure)){
+ if(containerFigure == null || containerFigure instanceof ContainerFigure){
+ break;
+ }
+ containerFigure = containerFigure.getParent();
+ }
while(parent != null && !(parent instanceof TreeContainerFigure)){
if(parent == null || parent instanceof TreeContainerFigure){
break;
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2010-07-02
00:08:51 UTC (rev 23169)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2010-07-02
04:33:14 UTC (rev 23170)
@@ -19,7 +19,9 @@
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.ConnectionLayer;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ViewportAwareConnectionLayerClippingStrategy;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.draw2d.graph.DirectedGraph;
@@ -46,6 +48,7 @@
import org.eclipse.gef.EditPartFactory;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.LayerConstants;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.gef.commands.CommandStackEvent;
@@ -65,10 +68,6 @@
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
@@ -95,6 +94,8 @@
import org.jboss.tools.smooks.gef.tree.editparts.TreeNodeEditPart;
import org.jboss.tools.smooks.gef.tree.figures.GraphAnimation;
import org.jboss.tools.smooks.gef.tree.figures.IMoveableModel;
+import org.jboss.tools.smooks.gef.tree.figures.TreeContainerFigure;
+import org.jboss.tools.smooks.gef.tree.figures.TreeNodeFigure;
import org.jboss.tools.smooks.gef.tree.model.TreeContainerModel;
import org.jboss.tools.smooks.gef.tree.model.TreeNodeConnection;
import org.jboss.tools.smooks.gef.tree.model.TreeNodeModel;
@@ -123,7 +124,8 @@
* @author Dart
*
*/
-public class SmooksGraphicalEditorPart extends GraphicalEditor implements
ISelectionChangedListener, ISourceSynchronizeListener,
+public class SmooksGraphicalEditorPart extends GraphicalEditor implements
+ ISelectionChangedListener, ISourceSynchronizeListener,
IGraphicalEditorPart, ITaskNodeProvider, ISmooksModelValidateListener {
private CommandStackListener emfCommandStackListener = null;
@@ -180,12 +182,13 @@
}
});
- this.editDomain.getCommandStack().addCommandStackEventListener(new
CommandStackEventListener() {
+ this.editDomain.getCommandStack().addCommandStackEventListener(
+ new CommandStackEventListener() {
- public void stackChanged(CommandStackEvent event) {
- firePropertyChange(PROP_DIRTY);
- }
- });
+ public void stackChanged(CommandStackEvent event) {
+ firePropertyChange(PROP_DIRTY);
+ }
+ });
this.smooksModelProvider = provider;
this.setEditDomain(editDomain);
@@ -195,48 +198,70 @@
private void createEMFCommandStackListener() {
emfCommandStackListener = new org.eclipse.emf.common.command.CommandStackListener() {
public void commandStackChanged(EventObject event) {
- final Command mostRecentCommand = ((org.eclipse.emf.common.command.CommandStack)
event.getSource()).getMostRecentCommand();
+ final Command mostRecentCommand = ((org.eclipse.emf.common.command.CommandStack)
event
+ .getSource()).getMostRecentCommand();
final EventObject fe = event;
- getEditorSite().getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (mostRecentCommand != null) {
- Command rawCommand = mostRecentCommand;
- while (rawCommand instanceof CommandWrapper) {
- rawCommand = ((CommandWrapper) rawCommand).getCommand();
- }
- int commandType = EXECUTE_COMMAND;
- Command undoCommand = ((org.eclipse.emf.common.command.CommandStack)
fe.getSource()).getUndoCommand();
- Command redoCommand = ((org.eclipse.emf.common.command.CommandStack)
fe.getSource()).getRedoCommand();
- if (undoCommand != null || rawCommand.equals(undoCommand)) {
- commandType = EXECUTE_COMMAND;
- }
- if (redoCommand != null || rawCommand.equals(redoCommand)) {
- commandType = UNDO_COMMAND;
- }
- if (rawCommand instanceof CompoundCommand) {
- List<Command> commandList = ((CompoundCommand)
rawCommand).getCommandList();
- for (Iterator<?> iterator = commandList.iterator(); iterator.hasNext();) {
- Command command = (Command) iterator.next();
- while (command instanceof CommandWrapper) {
- command = ((CommandWrapper) command).getCommand();
+ getEditorSite().getShell().getDisplay()
+ .asyncExec(new Runnable() {
+ public void run() {
+ if (mostRecentCommand != null) {
+ Command rawCommand = mostRecentCommand;
+ while (rawCommand instanceof CommandWrapper) {
+ rawCommand = ((CommandWrapper) rawCommand)
+ .getCommand();
}
- handleInputParamChange(command);
- if (command instanceof SetCommand || command instanceof AddCommand || command
instanceof DeleteCommand
- || command instanceof RemoveCommand) {
- refershRecentAffectedModel(command, command.getAffectedObjects(),
commandType);
+ int commandType = EXECUTE_COMMAND;
+ Command undoCommand = ((org.eclipse.emf.common.command.CommandStack) fe
+ .getSource()).getUndoCommand();
+ Command redoCommand = ((org.eclipse.emf.common.command.CommandStack) fe
+ .getSource()).getRedoCommand();
+ if (undoCommand != null
+ || rawCommand.equals(undoCommand)) {
+ commandType = EXECUTE_COMMAND;
}
+ if (redoCommand != null
+ || rawCommand.equals(redoCommand)) {
+ commandType = UNDO_COMMAND;
+ }
+ if (rawCommand instanceof CompoundCommand) {
+ List<Command> commandList = ((CompoundCommand) rawCommand)
+ .getCommandList();
+ for (Iterator<?> iterator = commandList
+ .iterator(); iterator.hasNext();) {
+ Command command = (Command) iterator
+ .next();
+ while (command instanceof CommandWrapper) {
+ command = ((CommandWrapper) command)
+ .getCommand();
+ }
+ handleInputParamChange(command);
+ if (command instanceof SetCommand
+ || command instanceof AddCommand
+ || command instanceof DeleteCommand
+ || command instanceof RemoveCommand) {
+ refershRecentAffectedModel(
+ command,
+ command.getAffectedObjects(),
+ commandType);
+ }
+ }
+ } else {
+ if (rawCommand instanceof SetCommand
+ || rawCommand instanceof AddCommand
+ || rawCommand instanceof DeleteCommand
+ || rawCommand instanceof RemoveCommand) {
+ handleInputParamChange(rawCommand);
+ refershRecentAffectedModel(
+ rawCommand,
+ mostRecentCommand
+ .getAffectedObjects(),
+ commandType);
+ }
+ }
}
- } else {
- if (rawCommand instanceof SetCommand || rawCommand instanceof AddCommand
- || rawCommand instanceof DeleteCommand || rawCommand instanceof RemoveCommand)
{
- handleInputParamChange(rawCommand);
- refershRecentAffectedModel(rawCommand, mostRecentCommand.getAffectedObjects(),
commandType);
- }
}
- }
- }
- });
+ });
}
};
}
@@ -261,7 +286,8 @@
IEditorSite site = getEditorSite();
if (site instanceof SmooksTaskDetailsEditorSite) {
- FormPage page = ((SmooksTaskDetailsEditorSite) site).getParentEditor();
+ FormPage page = ((SmooksTaskDetailsEditorSite) site)
+ .getParentEditor();
FormToolkit tool = page.getManagedForm().getToolkit();
Composite mainComposite = tool.createComposite(parent);
mainComposite.setBackground(tool.getColors().getBorderColor());
@@ -280,7 +306,8 @@
return super.getGraphicalViewer();
}
- private void handleCommandStack(org.eclipse.emf.common.command.CommandStack
commandStack) {
+ private void handleCommandStack(
+ org.eclipse.emf.common.command.CommandStack commandStack) {
if (emfCommandStackListener != null) {
commandStack.addCommandStackListener(emfCommandStackListener);
}
@@ -294,7 +321,8 @@
@Override
public void dispose() {
if (smooksModelProvider != null) {
- smooksModelProvider.getEditingDomain().getCommandStack().removeCommandStackListener(emfCommandStackListener);
+ smooksModelProvider.getEditingDomain().getCommandStack()
+ .removeCommandStackListener(emfCommandStackListener);
}
super.dispose();
}
@@ -302,7 +330,8 @@
protected void autoLayoutWhenCommandChange(Command command) {
Collection<?> affectedObjects = command.getAffectedObjects();
boolean refreshInputModel = false;
- for (Iterator<?> iterator2 = affectedObjects.iterator(); iterator2.hasNext();) {
+ for (Iterator<?> iterator2 = affectedObjects.iterator(); iterator2
+ .hasNext();) {
Object object = (Object) iterator2.next();
if (command instanceof AddCommand) {
if (needToLayoutWhenAddModel(object)) {
@@ -318,7 +347,8 @@
deletedObjs = ((RemoveCommand) command).getCollection();
}
if (deletedObjs != null) {
- for (Iterator<?> iterator = deletedObjs.iterator(); iterator.hasNext();) {
+ for (Iterator<?> iterator = deletedObjs.iterator(); iterator
+ .hasNext();) {
Object object2 = (Object) iterator.next();
if (needToLayoutWhenRemoveModel(object2)) {
refreshInputModel = true;
@@ -346,7 +376,8 @@
protected void handleInputParamChange(Command command) {
Collection<?> affectedObjects = command.getAffectedObjects();
boolean refreshInputModel = false;
- for (Iterator<?> iterator2 = affectedObjects.iterator(); iterator2.hasNext();) {
+ for (Iterator<?> iterator2 = affectedObjects.iterator(); iterator2
+ .hasNext();) {
Object object = (Object) iterator2.next();
if (object instanceof ParamType) {
if (SmooksUIUtils.isInputParamType((ParamType) object)) {
@@ -366,7 +397,8 @@
deletedObjs = ((RemoveCommand) command).getCollection();
}
if (deletedObjs != null) {
- for (Iterator<?> iterator = deletedObjs.iterator(); iterator.hasNext();) {
+ for (Iterator<?> iterator = deletedObjs.iterator(); iterator
+ .hasNext();) {
Object object2 = (Object) iterator.next();
if (object2 instanceof ParamType) {
if (SmooksUIUtils.isInputParamType((ParamType) object2)) {
@@ -401,7 +433,8 @@
return new ConnectionModelFactoryImpl();
}
- public void setConnectionModelFactory(ConnectionModelFactory connectionModelFactory) {
+ public void setConnectionModelFactory(
+ ConnectionModelFactory connectionModelFactory) {
this.connectionModelFactory = connectionModelFactory;
}
@@ -416,7 +449,8 @@
return new GraphicalModelFactoryImpl();
}
- public void setGraphicalModelFactory(GraphicalModelFactoryImpl graphicalModelFactory) {
+ public void setGraphicalModelFactory(
+ GraphicalModelFactoryImpl graphicalModelFactory) {
this.graphicalModelFactory = graphicalModelFactory;
}
@@ -429,29 +463,40 @@
getSelectionActions().add(autoLayout.getId());
}
- private void deleteRelatedConnection(AbstractSmooksGraphicalModel effecedNode,
EStructuralFeature feature, SetCommand command) {
- EObject data = (EObject) AdapterFactoryEditingDomain.unwrap(effecedNode.getData());
+ private void deleteRelatedConnection(
+ AbstractSmooksGraphicalModel effecedNode,
+ EStructuralFeature feature, SetCommand command) {
+ EObject data = (EObject) AdapterFactoryEditingDomain.unwrap(effecedNode
+ .getData());
if (feature.equals(SmooksUIUtils.getBeanIDRefFeature(data))) {
- List<TreeNodeConnection> sourceConnections =
effecedNode.getSourceConnections();
- List<TreeNodeConnection> temp = new
ArrayList<TreeNodeConnection>(sourceConnections);
+ List<TreeNodeConnection> sourceConnections = effecedNode
+ .getSourceConnections();
+ List<TreeNodeConnection> temp = new ArrayList<TreeNodeConnection>(
+ sourceConnections);
for (Iterator<?> iterator = temp.iterator(); iterator.hasNext();) {
- TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator.next();
- AbstractSmooksGraphicalModel target = treeNodeConnection.getTargetNode();
+ TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator
+ .next();
+ AbstractSmooksGraphicalModel target = treeNodeConnection
+ .getTargetNode();
Object refValue = command.getValue();
if (refValue == null)
continue;
String refID = refValue.toString();
- Object targetModel = AdapterFactoryEditingDomain.unwrap(target.getData());
+ Object targetModel = AdapterFactoryEditingDomain.unwrap(target
+ .getData());
if (targetModel instanceof EObject) {
- EStructuralFeature idfeature = SmooksUIUtils.getBeanIDFeature((EObject)
targetModel);
+ EStructuralFeature idfeature = SmooksUIUtils
+ .getBeanIDFeature((EObject) targetModel);
if (idfeature == null)
continue;
Object iddata = ((EObject) targetModel).eGet(idfeature);
if (iddata != null) {
if (refID == null || !refID.equals(iddata)) {
- target.getTargetConnections().remove(treeNodeConnection);
- effecedNode.getSourceConnections().remove(treeNodeConnection);
+ target.getTargetConnections().remove(
+ treeNodeConnection);
+ effecedNode.getSourceConnections().remove(
+ treeNodeConnection);
target.fireConnectionChanged();
}
}
@@ -460,22 +505,31 @@
}
if (feature.equals(SmooksUIUtils.getBeanIDFeature(data))) {
- List<TreeNodeConnection> targetConnections =
effecedNode.getTargetConnections();
- List<TreeNodeConnection> temp = new
ArrayList<TreeNodeConnection>(targetConnections);
+ List<TreeNodeConnection> targetConnections = effecedNode
+ .getTargetConnections();
+ List<TreeNodeConnection> temp = new ArrayList<TreeNodeConnection>(
+ targetConnections);
for (Iterator<?> iterator = temp.iterator(); iterator.hasNext();) {
- TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator.next();
- AbstractSmooksGraphicalModel source = treeNodeConnection.getSourceNode();
+ TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator
+ .next();
+ AbstractSmooksGraphicalModel source = treeNodeConnection
+ .getSourceNode();
String beanID = command.getValue().toString();
- Object sourceModel = AdapterFactoryEditingDomain.unwrap(source.getData());
+ Object sourceModel = AdapterFactoryEditingDomain.unwrap(source
+ .getData());
if (sourceModel instanceof EObject) {
- EStructuralFeature idRefFeature = SmooksUIUtils.getBeanIDRefFeature((EObject)
sourceModel);
+ EStructuralFeature idRefFeature = SmooksUIUtils
+ .getBeanIDRefFeature((EObject) sourceModel);
if (idRefFeature == null)
continue;
- Object idRefData = ((EObject) sourceModel).eGet(idRefFeature);
+ Object idRefData = ((EObject) sourceModel)
+ .eGet(idRefFeature);
if (idRefData != null) {
if (beanID == null || !beanID.equals(idRefData)) {
- source.getSourceConnections().remove(treeNodeConnection);
- effecedNode.getTargetConnections().remove(treeNodeConnection);
+ source.getSourceConnections().remove(
+ treeNodeConnection);
+ effecedNode.getTargetConnections().remove(
+ treeNodeConnection);
source.fireConnectionChanged();
}
}
@@ -484,27 +538,37 @@
}
if (feature.equals(SmooksUIUtils.getSelectorFeature(data))) {
- List<TreeNodeConnection> targetConnections =
effecedNode.getTargetConnections();
- List<TreeNodeConnection> temp = new
ArrayList<TreeNodeConnection>(targetConnections);
+ List<TreeNodeConnection> targetConnections = effecedNode
+ .getTargetConnections();
+ List<TreeNodeConnection> temp = new ArrayList<TreeNodeConnection>(
+ targetConnections);
for (Iterator<?> iterator = temp.iterator(); iterator.hasNext();) {
- TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator.next();
- AbstractSmooksGraphicalModel source = treeNodeConnection.getSourceNode();
- if (source instanceof InputDataContianerModel || source instanceof
InputDataTreeNodeModel) {
+ TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator
+ .next();
+ AbstractSmooksGraphicalModel source = treeNodeConnection
+ .getSourceNode();
+ if (source instanceof InputDataContianerModel
+ || source instanceof InputDataTreeNodeModel) {
String selector = command.getValue().toString();
- Object sourceModel = AdapterFactoryEditingDomain.unwrap(source.getData());
+ Object sourceModel = AdapterFactoryEditingDomain
+ .unwrap(source.getData());
if (sourceModel instanceof IXMLStructuredObject) {
- IXMLStructuredObject root = SmooksUIUtils.getRootParent((IXMLStructuredObject)
sourceModel);
+ IXMLStructuredObject root = SmooksUIUtils
+ .getRootParent((IXMLStructuredObject) sourceModel);
Object oldNode = null;
try {
- oldNode = SmooksUIUtils.localXMLNodeWithPath(selector, root);
+ oldNode = SmooksUIUtils.localXMLNodeWithPath(
+ selector, root);
} catch (Throwable t) {
}
if (oldNode == sourceModel) {
break;
} else {
- source.getSourceConnections().remove(treeNodeConnection);
- effecedNode.getTargetConnections().remove(treeNodeConnection);
+ source.getSourceConnections().remove(
+ treeNodeConnection);
+ effecedNode.getTargetConnections().remove(
+ treeNodeConnection);
source.fireConnectionChanged();
}
}
@@ -521,43 +585,56 @@
* @param affectedObjects
* @param commandType
*/
- protected void refershRecentAffectedModel(Command command, Collection<?>
affectedObjects, int commandType) {
- for (Iterator<?> iterator = affectedObjects.iterator(); iterator.hasNext();) {
+ protected void refershRecentAffectedModel(Command command,
+ Collection<?> affectedObjects, int commandType) {
+ for (Iterator<?> iterator = affectedObjects.iterator(); iterator
+ .hasNext();) {
Object object = (Object) iterator.next();
object = AdapterFactoryEditingDomain.unwrap(object);
if (commandType == EXECUTE_COMMAND || commandType == REDO_COMMAND) {
if (object instanceof SmooksResourceListType) {
if (command instanceof AddCommand) {
- Collection<?> colletion = ((AddCommand) command).getCollection();
- for (Iterator<?> iterator2 = colletion.iterator(); iterator2.hasNext();) {
+ Collection<?> colletion = ((AddCommand) command)
+ .getCollection();
+ for (Iterator<?> iterator2 = colletion.iterator(); iterator2
+ .hasNext();) {
Object childModel = (Object) iterator2.next();
- childModel = AdapterFactoryEditingDomain.unwrap(childModel);
+ childModel = AdapterFactoryEditingDomain
+ .unwrap(childModel);
AbstractSmooksGraphicalModel graphModel = createGraphModel(childModel);
if (graphModel == null)
continue;
- root.getTargetContainerModel().addTreeNode(graphModel);
+ root.getTargetContainerModel().addTreeNode(
+ graphModel);
applyGraphicalInformation(graphModel);
Collection<TreeNodeConnection> connections =
createAllConnection(graphModel);
expandConnectedModels(connections);
}
}
- if (command instanceof DeleteCommand || command instanceof RemoveCommand) {
+ if (command instanceof DeleteCommand
+ || command instanceof RemoveCommand) {
Collection<?> colletion = null;
if (command instanceof DeleteCommand) {
- colletion = ((DeleteCommand) command).getCollection();
+ colletion = ((DeleteCommand) command)
+ .getCollection();
}
if (command instanceof RemoveCommand) {
- colletion = ((RemoveCommand) command).getCollection();
+ colletion = ((RemoveCommand) command)
+ .getCollection();
}
- for (Iterator<?> iterator2 = colletion.iterator(); iterator2.hasNext();) {
+ for (Iterator<?> iterator2 = colletion.iterator(); iterator2
+ .hasNext();) {
Object childModel = (Object) iterator2.next();
- childModel = AdapterFactoryEditingDomain.unwrap(childModel);
+ childModel = AdapterFactoryEditingDomain
+ .unwrap(childModel);
AbstractSmooksGraphicalModel graphModel = findGraphicalModel(childModel);
if (graphModel == null)
continue;
- AbstractSmooksGraphicalModel.disconnectAllConnections(graphModel);
- root.getTargetContainerModel().removeTreeNode(graphModel);
+ AbstractSmooksGraphicalModel
+ .disconnectAllConnections(graphModel);
+ root.getTargetContainerModel().removeTreeNode(
+ graphModel);
}
}
} else {
@@ -568,9 +645,11 @@
continue;
}
node.fireVisualChanged();
- EStructuralFeature feature = ((SetCommand) command).getFeature();
+ EStructuralFeature feature = ((SetCommand) command)
+ .getFeature();
if (SmooksUIUtils.isRelatedConnectionFeature(feature)) {
- deleteRelatedConnection(node, feature, (SetCommand) command);
+ deleteRelatedConnection(node, feature,
+ (SetCommand) command);
Collection<TreeNodeConnection> connections = createConnection(node);
node.fireConnectionChanged();
expandConnectedModels(connections);
@@ -584,7 +663,8 @@
if (graphModel == null)
continue;
try {
- root.getTargetContainerModel().addTreeNode(graphModel);
+ root.getTargetContainerModel().addTreeNode(
+ graphModel);
} catch (Throwable t) {
t.printStackTrace();
}
@@ -603,7 +683,8 @@
node.fireChildrenChanged();
node.fireConnectionChanged();
}
- if (command instanceof DeleteCommand || command instanceof RemoveCommand) {
+ if (command instanceof DeleteCommand
+ || command instanceof RemoveCommand) {
if (node != null) {
node.fireChildrenChanged();
}
@@ -617,13 +698,17 @@
AbstractSmooksGraphicalModel node = findGraphicalModel(object);
if (command instanceof AddCommand) {
if (object instanceof SmooksResourceListType) {
- Collection<?> cccc = ((AddCommand) command).getCollection();
- for (Iterator<?> iterator2 = cccc.iterator(); iterator2.hasNext();) {
+ Collection<?> cccc = ((AddCommand) command)
+ .getCollection();
+ for (Iterator<?> iterator2 = cccc.iterator(); iterator2
+ .hasNext();) {
Object object2 = (Object) iterator2.next();
- object2 = AdapterFactoryEditingDomain.unwrap(object2);
+ object2 = AdapterFactoryEditingDomain
+ .unwrap(object2);
AbstractSmooksGraphicalModel gmodel = findGraphicalModel(object2);
if (gmodel != null) {
- root.getTargetContainerModel().removeTreeNode(gmodel);
+ root.getTargetContainerModel().removeTreeNode(
+ gmodel);
break;
}
}
@@ -638,15 +723,18 @@
continue;
}
node.fireVisualChanged();
- EStructuralFeature feature = ((SetCommand) command).getFeature();
+ EStructuralFeature feature = ((SetCommand) command)
+ .getFeature();
if (SmooksUIUtils.isRelatedConnectionFeature(feature)) {
- deleteRelatedConnection(node, feature, (SetCommand) command);
+ deleteRelatedConnection(node, feature,
+ (SetCommand) command);
Collection<TreeNodeConnection> connections = createConnection(node);
node.fireConnectionChanged();
expandConnectedModels(connections);
}
}
- if (command instanceof DeleteCommand || command instanceof RemoveCommand) {
+ if (command instanceof DeleteCommand
+ || command instanceof RemoveCommand) {
Collection<?> cccc = null;
if (command instanceof DeleteCommand) {
cccc = ((DeleteCommand) command).getCollection();
@@ -654,19 +742,22 @@
if (command instanceof RemoveCommand) {
cccc = ((RemoveCommand) command).getCollection();
}
- for (Iterator<?> iterator2 = cccc.iterator(); iterator2.hasNext();) {
+ for (Iterator<?> iterator2 = cccc.iterator(); iterator2
+ .hasNext();) {
Object object2 = (Object) iterator2.next();
object2 = AdapterFactoryEditingDomain.unwrap(object2);
// it means that it's deletecommand undo
if (object == object2) {
EObject owner = ((EObject) object).eContainer();
if (owner instanceof SmooksResourceListType) {
- object = AdapterFactoryEditingDomain.unwrap(object);
+ object = AdapterFactoryEditingDomain
+ .unwrap(object);
AbstractSmooksGraphicalModel graphModel = createGraphModel(object);
if (graphModel == null)
continue;
node = graphModel;
- root.getTargetContainerModel().addTreeNode(graphModel);
+ root.getTargetContainerModel().addTreeNode(
+ graphModel);
Collection<TreeNodeConnection> connections =
createAllConnection(graphModel);
expandConnectedModels(connections);
applyGraphicalInformation(graphModel);
@@ -713,34 +804,70 @@
super.configureGraphicalViewer();
getGraphicalViewer().setEditDomain(editDomain);
getGraphicalViewer().setEditPartFactory(createEdtiPartFactory());
- getGraphicalViewer().getControl().addControlListener(new ControlListener() {
- public void controlResized(ControlEvent e) {
- }
+ getGraphicalViewer().setRootEditPart(
+ new FreeformGraphicalRootEditPart() {
+ public DragTracker getDragTracker(Request req) {
+ return new RightClickSelectMarqueeDragTraker();
+ }
+ });
- public void controlMoved(ControlEvent e) {
- // TODO Auto-generated method stub
+ ConnectionLayer connectionLayer = (ConnectionLayer) ((FreeformGraphicalRootEditPart)
getGraphicalViewer()
+ .getRootEditPart()).getLayer(LayerConstants.CONNECTION_LAYER);
+ connectionLayer
+ .setClippingStrategy(new ViewportAwareConnectionLayerClippingStrategy(
+ connectionLayer) {
+ protected Rectangle getAbsoluteBoundsAsCopy(IFigure figure) {
- }
- });
- getGraphicalViewer().getControl().addPaintListener(new PaintListener() {
+ Rectangle absoluteFigureBounds = figure.getBounds()
+ .getCopy();
+ figure.translateToAbsolute(absoluteFigureBounds);
- public void paintControl(PaintEvent e) {
- //
((AbstractGraphicalEditPart)getGraphicalViewer().getRootEditPart()).getFigure().getLayoutManager().layout(null);
- }
- });
+ IFigure parent = figure;
+ while(parent != null && !(parent instanceof TreeContainerFigure)){
+ parent = parent.getParent();
+ }
+ if (parent != null && parent instanceof TreeContainerFigure) {
+ Rectangle pr = parent.getBounds().getCopy();
+ parent.translateToAbsolute(pr);
+// absoluteFigureBounds.y = absoluteFigureBounds.y - 4;
+ absoluteFigureBounds.x = pr.x - 7;
+ absoluteFigureBounds.width = pr.width+14;
+ }else{
+ parent = figure;
+ while (parent != null
+ && !(parent instanceof TreeNodeFigure)) {
+ parent = parent.getParent();
+ }
+ if (parent != null && parent instanceof TreeNodeFigure) {
+ while (parent != null
+ && !(parent instanceof TreeContainerFigure)) {
+ parent = parent.getParent();
+ }
+ if (parent instanceof TreeContainerFigure) {
+ Rectangle pr = parent.getBounds().getCopy();
+ parent.translateToAbsolute(pr);
+// absoluteFigureBounds.y = absoluteFigureBounds.y - 4;
+ absoluteFigureBounds.x = pr.x - 7;
+ absoluteFigureBounds.width = pr.width+14;
+ }
+ }
+ }
+
- getGraphicalViewer().setRootEditPart(new FreeformGraphicalRootEditPart() {
- public DragTracker getDragTracker(Request req) {
- return new RightClickSelectMarqueeDragTraker();
- }
- });
+ return absoluteFigureBounds;
+ }
+ });
- getGraphicalViewer().addDropTargetListener(
- (TransferDropTargetListener) new
TemplateTransferDropTargetListener(getGraphicalViewer()));
+ getGraphicalViewer()
+ .addDropTargetListener(
+ (TransferDropTargetListener) new TemplateTransferDropTargetListener(
+ getGraphicalViewer()));
- GraphicalViewerKeyHandler keyHandler = new
GraphicalViewerKeyHandler(getGraphicalViewer());
- keyHandler.put(org.eclipse.gef.KeyStroke.getPressed(SWT.DEL, 0),
this.getActionRegistry().getAction(ActionFactory.DELETE.getId()));
+ GraphicalViewerKeyHandler keyHandler = new GraphicalViewerKeyHandler(
+ getGraphicalViewer());
+ keyHandler.put(org.eclipse.gef.KeyStroke.getPressed(SWT.DEL, 0), this
+ .getActionRegistry().getAction(ActionFactory.DELETE.getId()));
ContextMenuProvider provider = getContextMenuProvider();
getGraphicalViewer().setContextMenu(provider);
@@ -749,7 +876,8 @@
}
protected ContextMenuProvider getContextMenuProvider() {
- return new SmooksGraphicalEditorMenuContextProvider(getGraphicalViewer(),
this.getActionRegistry());
+ return new SmooksGraphicalEditorMenuContextProvider(
+ getGraphicalViewer(), this.getActionRegistry());
}
private void hookSelectionActions() {
@@ -757,7 +885,8 @@
while (actions.hasNext()) {
Object action = actions.next();
if (action instanceof SelectionAction) {
- ((SelectionAction) action).setSelectionProvider(getGraphicalViewer());
+ ((SelectionAction) action)
+ .setSelectionProvider(getGraphicalViewer());
}
}
}
@@ -768,7 +897,8 @@
InputSourceContainerModel tcontainer = new InputSourceContainerModel();
root.setSourceContainerModel(tcontainer);
root.addTreeNode(tcontainer);
- for (Iterator<?> iterator = inputDataList.iterator(); iterator.hasNext();) {
+ for (Iterator<?> iterator = inputDataList.iterator(); iterator
+ .hasNext();) {
Object object = (Object) iterator.next();
ITreeContentProvider contentProvider = new XMLStructuredDataContentProvider();
ILabelProvider labelProvider = new XMLStructuredDataLabelProvider();
@@ -781,7 +911,8 @@
}
containerModel.getChildren().add((IXMLStructuredObject) object);
if (containerModel != null) {
- TreeContainerModel container = new InputDataContianerModel(containerModel,
contentProvider, labelProvider,
+ TreeContainerModel container = new InputDataContianerModel(
+ containerModel, contentProvider, labelProvider,
getSmooksModelProvider());
tcontainer.addTreeNode(container);
inputGraphModel.add(container);
@@ -794,7 +925,8 @@
@Override
protected void hookGraphicalViewer() {
getSelectionSynchronizer().addViewer(getGraphicalViewer());
- getGraphicalViewer().addSelectionChangedListener(getSelectionSynchronizer());
+ getGraphicalViewer().addSelectionChangedListener(
+ getSelectionSynchronizer());
getGraphicalViewer().addSelectionChangedListener(this);
}
@@ -811,10 +943,13 @@
OutputTargetModel targetContainer = new OutputTargetModel();
root.addTreeNode(targetContainer);
root.setTargetContainerModel(targetContainer);
- AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain)
smooksModelProvider.getEditingDomain();
- if (inputDataList != null && obj != null && obj instanceof DocumentRoot
&& editingDomain != null) {
+ AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain)
smooksModelProvider
+ .getEditingDomain();
+ if (inputDataList != null && obj != null && obj instanceof
DocumentRoot
+ && editingDomain != null) {
createInputDataGraphModel();
- SmooksResourceListType listType = ((DocumentRoot) obj).getSmooksResourceList();
+ SmooksResourceListType listType = ((DocumentRoot) obj)
+ .getSmooksResourceList();
List<?> arcList = listType.getAbstractResourceConfig();
for (Iterator<?> iterator = arcList.iterator(); iterator.hasNext();) {
Object object = (Object) iterator.next();
@@ -838,15 +973,18 @@
this.autoLayout(false);
- List<Diagnostic> diagnosticList =
this.getSmooksModelProvider().getDiagnosticList();
+ List<Diagnostic> diagnosticList = this.getSmooksModelProvider()
+ .getDiagnosticList();
this.validateEnd(diagnosticList);
}
protected AbstractSmooksGraphicalModel createGraphModel(Object model) {
GraphicalModelFactory factory = getGraphicalModelFactory();
if (factory != null) {
- Object gmodel = factory.createGraphicalModel(model, smooksModelProvider);
- if (gmodel != null && gmodel instanceof AbstractSmooksGraphicalModel) {
+ Object gmodel = factory.createGraphicalModel(model,
+ smooksModelProvider);
+ if (gmodel != null
+ && gmodel instanceof AbstractSmooksGraphicalModel) {
AbstractSmooksGraphicalModel graphicalModel = (AbstractSmooksGraphicalModel) gmodel;
return graphicalModel;
}
@@ -859,7 +997,8 @@
if (root != null) {
List<AbstractSmooksGraphicalModel> children = new
ArrayList<AbstractSmooksGraphicalModel>();
List<?> containers = root.getChildren();
- for (Iterator<?> iterator = containers.iterator(); iterator.hasNext();) {
+ for (Iterator<?> iterator = containers.iterator(); iterator
+ .hasNext();) {
Object object = (Object) iterator.next();
if (object instanceof RootModel) {
children.addAll(((RootModel) object).getChildren());
@@ -870,7 +1009,8 @@
return connections;
}
- protected Collection<TreeNodeConnection>
createAllConnection(AbstractSmooksGraphicalModel model) {
+ protected Collection<TreeNodeConnection> createAllConnection(
+ AbstractSmooksGraphicalModel model) {
try {
if (model == null)
return null;
@@ -898,13 +1038,15 @@
}
}
- public Collection<TreeNodeConnection>
createConnection(AbstractSmooksGraphicalModel model) {
+ public Collection<TreeNodeConnection> createConnection(
+ AbstractSmooksGraphicalModel model) {
ConnectionModelFactory connectionModelFactory = getConnectionModelFactory();
List<TreeNodeConnection> cs = new ArrayList<TreeNodeConnection>();
if (connectionModelFactory != null) {
if (connectionModelFactory.hasConnection(model)) {
- Collection<TreeNodeConnection> cList =
connectionModelFactory.createConnection(inputDataList, getSmooksResourceList(),
- root, model);
+ Collection<TreeNodeConnection> cList = connectionModelFactory
+ .createConnection(inputDataList,
+ getSmooksResourceList(), root, model);
if (cList != null) {
cs.addAll(cList);
}
@@ -974,16 +1116,19 @@
return null;
}
- public void createConnection(List<AbstractSmooksGraphicalModel> children,
List<TreeNodeConnection> connections) {
+ public void createConnection(List<AbstractSmooksGraphicalModel> children,
+ List<TreeNodeConnection> connections) {
for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
- AbstractSmooksGraphicalModel abstractSmooksGraphicalModel =
(AbstractSmooksGraphicalModel) iterator.next();
+ AbstractSmooksGraphicalModel abstractSmooksGraphicalModel =
(AbstractSmooksGraphicalModel) iterator
+ .next();
if (canCreateConnection(abstractSmooksGraphicalModel)) {
Collection<TreeNodeConnection> c =
createConnection(abstractSmooksGraphicalModel);
if (c != null) {
connections.addAll(c);
}
}
- List<AbstractSmooksGraphicalModel> cchildren =
abstractSmooksGraphicalModel.getChildren();
+ List<AbstractSmooksGraphicalModel> cchildren = abstractSmooksGraphicalModel
+ .getChildren();
createConnection(cchildren, connections);
}
}
@@ -1012,35 +1157,45 @@
Object obj = smooksModelProvider.getSmooksModel();
smooksResourceList = null;
if (obj instanceof DocumentRoot) {
- smooksResourceList = ((DocumentRoot) obj).getSmooksResourceList();
- inputDataList = SelectorCreationDialog.generateInputData(smooksResourceList);
+ smooksResourceList = ((DocumentRoot) obj)
+ .getSmooksResourceList();
+ inputDataList = SelectorCreationDialog
+ .generateInputData(smooksResourceList);
}
}
}
@Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
+ public void init(IEditorSite site, IEditorInput input)
+ throws PartInitException {
super.init(site, input);
initSmooksData();
if (smooksModelProvider != null) {
- this.handleCommandStack(smooksModelProvider.getEditingDomain().getCommandStack());
+ this.handleCommandStack(smooksModelProvider.getEditingDomain()
+ .getCommandStack());
}
}
- protected void expandConnectedModels(Collection<TreeNodeConnection> connections)
{
+ protected void expandConnectedModels(
+ Collection<TreeNodeConnection> connections) {
if (connections == null || connections.isEmpty())
return;
List<TreeNodeModel> expanedTreeNodeList = new ArrayList<TreeNodeModel>();
for (Iterator<?> iterator = connections.iterator(); iterator.hasNext();) {
- TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator.next();
- AbstractSmooksGraphicalModel source = treeNodeConnection.getSourceNode();
- AbstractSmooksGraphicalModel target = treeNodeConnection.getTargetNode();
+ TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator
+ .next();
+ AbstractSmooksGraphicalModel source = treeNodeConnection
+ .getSourceNode();
+ AbstractSmooksGraphicalModel target = treeNodeConnection
+ .getTargetNode();
Object data = source.getData();
Object data2 = target.getData();
- if (source instanceof TreeNodeModel && data instanceof IXMLStructuredObject)
{
+ if (source instanceof TreeNodeModel
+ && data instanceof IXMLStructuredObject) {
expanedTreeNodeList.add((TreeNodeModel) source);
}
- if (target instanceof TreeNodeModel && data2 instanceof IXMLStructuredObject)
{
+ if (target instanceof TreeNodeModel
+ && data2 instanceof IXMLStructuredObject) {
expanedTreeNodeList.add((TreeNodeModel) target);
}
}
@@ -1050,11 +1205,13 @@
List<?> childrenEditPart = new ArrayList();
for (Iterator iterator = containers.iterator(); iterator.hasNext();) {
Object object = (Object) iterator.next();
- childrenEditPart.addAll(((EditPart)object).getChildren());
+ childrenEditPart.addAll(((EditPart) object).getChildren());
}
- for (Iterator<?> iterator = childrenEditPart.iterator(); iterator.hasNext();) {
+ for (Iterator<?> iterator = childrenEditPart.iterator(); iterator
+ .hasNext();) {
Object object = (Object) iterator.next();
- SmooksUIUtils.expandGraphTree(expanedTreeNodeList, (TreeNodeEditPart) object);
+ SmooksUIUtils.expandGraphTree(expanedTreeNodeList,
+ (TreeNodeEditPart) object);
}
}
@@ -1068,10 +1225,12 @@
@Override
protected void initializeGraphicalViewer() {
initGraphicalModel();
- ((GraphicalEditPart) getGraphicalViewer().getRootEditPart()).getFigure().validate();
+ ((GraphicalEditPart) getGraphicalViewer().getRootEditPart())
+ .getFigure().validate();
}
- protected void applyGraphicalInformation(AbstractSmooksGraphicalModel graphicalModel) {
+ protected void applyGraphicalInformation(
+ AbstractSmooksGraphicalModel graphicalModel) {
// GraphType graph1 = getSmooksGraphicsExtType().getGraph();
// applyGraphicalInformation(graph1, graphicalModel);
}
@@ -1138,7 +1297,8 @@
if (gm instanceof IMoveableModel) {
IMoveableModel graphicalModel = (IMoveableModel) gm;
map.put(graphicalModel, new Point(node.x, node.y));
- graphAnimation.recordFinal(part, new Rectangle(node.x, node.y, 0, 0));
+ graphAnimation.recordFinal(part, new Rectangle(node.x,
+ node.y, 0, 0));
}
}
IEditorSite editorSite = getEditorSite();
@@ -1193,7 +1353,8 @@
return null;
}
- protected DirectedGraph collectionGraphInformation(HashMap<Object, Node> nodeMap)
{
+ protected DirectedGraph collectionGraphInformation(
+ HashMap<Object, Node> nodeMap) {
DirectedGraph graph = new DirectedGraph();
if (getGraphicalViewer() == null) {
return graph;
@@ -1204,7 +1365,8 @@
List children = new ArrayList();
for (Iterator iterator = containers.iterator(); iterator.hasNext();) {
Object c = (Object) iterator.next();
- if (c instanceof OutputContainerEditPart || c instanceof InputSourceContainerEditPart)
{
+ if (c instanceof OutputContainerEditPart
+ || c instanceof InputSourceContainerEditPart) {
children.addAll(((AbstractGraphicalEditPart) c).getChildren());
}
// children.add(c);
@@ -1226,17 +1388,21 @@
for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
GraphicalEditPart object = (GraphicalEditPart) iterator.next();
- for (Iterator<?> iterator2 = children.iterator(); iterator2.hasNext();) {
- GraphicalEditPart testEditPart = (GraphicalEditPart) iterator2.next();
+ for (Iterator<?> iterator2 = children.iterator(); iterator2
+ .hasNext();) {
+ GraphicalEditPart testEditPart = (GraphicalEditPart) iterator2
+ .next();
Node node = nodeMap.get(object);
Node testNode = nodeMap.get(testEditPart);
if (node != null && testNode != null) {
- if (hasConnectionAssociation(object, testEditPart, SOURCE_CONNECT_TYPE)) {
+ if (hasConnectionAssociation(object, testEditPart,
+ SOURCE_CONNECT_TYPE)) {
Edge edge = new Edge(node, testNode);
edge.data = testEditPart;
graph.edges.add(edge);
}
- if (hasConnectionAssociation(object, testEditPart, TARGET_CONNECT_TYPE)) {
+ if (hasConnectionAssociation(object, testEditPart,
+ TARGET_CONNECT_TYPE)) {
Edge edge = new Edge(testNode, node);
graph.edges.add(edge);
}
@@ -1250,10 +1416,12 @@
if (model == editPart.getModel()) {
return true;
}
- AbstractSmooksGraphicalModel grphicalModel = (AbstractSmooksGraphicalModel)
editPart.getModel();
+ AbstractSmooksGraphicalModel grphicalModel = (AbstractSmooksGraphicalModel) editPart
+ .getModel();
if (!grphicalModel.getChildrenWithoutDynamic().isEmpty()) {
List<?> children = editPart.getChildren();
- for (Iterator<?> iterator2 = children.iterator(); iterator2.hasNext();) {
+ for (Iterator<?> iterator2 = children.iterator(); iterator2
+ .hasNext();) {
GraphicalEditPart gpart = (GraphicalEditPart) iterator2.next();
if (hasAssociation(model, gpart)) {
return true;
@@ -1263,7 +1431,8 @@
return false;
}
- private boolean hasConnectionAssociation(GraphicalEditPart editPart, GraphicalEditPart
testEditPart, int connectType) {
+ private boolean hasConnectionAssociation(GraphicalEditPart editPart,
+ GraphicalEditPart testEditPart, int connectType) {
List<?> sourceConnections = null;
if (connectType == SOURCE_CONNECT_TYPE) {
sourceConnections = editPart.getSourceConnections();
@@ -1271,9 +1440,11 @@
if (connectType == TARGET_CONNECT_TYPE) {
sourceConnections = editPart.getTargetConnections();
}
- for (Iterator<?> iterator = sourceConnections.iterator(); iterator.hasNext();) {
+ for (Iterator<?> iterator = sourceConnections.iterator(); iterator
+ .hasNext();) {
GraphicalEditPart object = (GraphicalEditPart) iterator.next();
- TreeNodeConnection connection = (TreeNodeConnection) object.getModel();
+ TreeNodeConnection connection = (TreeNodeConnection) object
+ .getModel();
Object testModel = null;
if (connectType == SOURCE_CONNECT_TYPE) {
testModel = connection.getTargetNode();
@@ -1285,12 +1456,15 @@
return true;
}
}
- AbstractSmooksGraphicalModel sourceGraphModel = (AbstractSmooksGraphicalModel)
editPart.getModel();
+ AbstractSmooksGraphicalModel sourceGraphModel = (AbstractSmooksGraphicalModel)
editPart
+ .getModel();
if (!sourceGraphModel.getChildrenWithoutDynamic().isEmpty()) {
List<?> children = editPart.getChildren();
for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
- GraphicalEditPart childEditPart = (GraphicalEditPart) iterator.next();
- if (hasConnectionAssociation(childEditPart, testEditPart, connectType)) {
+ GraphicalEditPart childEditPart = (GraphicalEditPart) iterator
+ .next();
+ if (hasConnectionAssociation(childEditPart, testEditPart,
+ connectType)) {
return true;
}
}
@@ -1317,7 +1491,8 @@
*/
@Override
public void doSave(IProgressMonitor monitor) {
- if (getEditDomain() != null && getEditDomain().getCommandStack() != null) {
+ if (getEditDomain() != null
+ && getEditDomain().getCommandStack() != null) {
getEditDomain().getCommandStack().flush();
}
}
@@ -1329,7 +1504,8 @@
public void selectionChanged(SelectionChangedEvent event) {
updateActions(getSelectionActions());
- ISelectionProvider provider = ((SmooksTaskDetailsEditorSite)
getSite()).getMultiPageEditor().getSite().getSelectionProvider();
+ ISelectionProvider provider = ((SmooksTaskDetailsEditorSite) getSite())
+ .getMultiPageEditor().getSite().getSelectionProvider();
if (provider != null) {
provider.setSelection(event.getSelection());
}
@@ -1354,7 +1530,8 @@
Object obj = smooksModelProvider.getSmooksModel();
smooksResourceList = null;
if (obj instanceof DocumentRoot) {
- smooksResourceList = ((DocumentRoot) obj).getSmooksResourceList();
+ smooksResourceList = ((DocumentRoot) obj)
+ .getSmooksResourceList();
}
return smooksResourceList;
}
@@ -1371,21 +1548,25 @@
public void inputTypeChanged() {
if (root != null && inputDataList != null) {
- List<Object> newInputDataList =
SelectorCreationDialog.generateInputData(getSmooksResourceListType());
+ List<Object> newInputDataList = SelectorCreationDialog
+ .generateInputData(getSmooksResourceListType());
List<InputDataContianerModel> inputs = new
ArrayList<InputDataContianerModel>();
List<AbstractSmooksGraphicalModel> children = root.getChildren();
// remove all input data graph model
for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
- AbstractSmooksGraphicalModel abstractSmooksGraphicalModel =
(AbstractSmooksGraphicalModel) iterator.next();
+ AbstractSmooksGraphicalModel abstractSmooksGraphicalModel =
(AbstractSmooksGraphicalModel) iterator
+ .next();
if (abstractSmooksGraphicalModel instanceof InputDataContianerModel) {
inputs.add((InputDataContianerModel) abstractSmooksGraphicalModel);
}
}
for (Iterator<?> iterator = inputs.iterator(); iterator.hasNext();) {
- InputDataContianerModel inputModel = (InputDataContianerModel) iterator.next();
- AbstractSmooksGraphicalModel.disconnectAllConnections(inputModel);
+ InputDataContianerModel inputModel = (InputDataContianerModel) iterator
+ .next();
+ AbstractSmooksGraphicalModel
+ .disconnectAllConnections(inputModel);
root.removeTreeNode(inputModel);
}
@@ -1412,7 +1593,8 @@
return;
List<AbstractSmooksGraphicalModel> children = root.getChildren();
for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
- AbstractSmooksGraphicalModel abstractSmooksGraphicalModel =
(AbstractSmooksGraphicalModel) iterator.next();
+ AbstractSmooksGraphicalModel abstractSmooksGraphicalModel =
(AbstractSmooksGraphicalModel) iterator
+ .next();
cleanValidationMarker(abstractSmooksGraphicalModel);
}
}
@@ -1420,9 +1602,11 @@
protected void cleanValidationMarker(AbstractSmooksGraphicalModel model) {
model.setSeverity(IValidatableModel.NONE);
model.getMessage().clear();
- List<AbstractSmooksGraphicalModel> children = model.getChildrenWithoutDynamic();
+ List<AbstractSmooksGraphicalModel> children = model
+ .getChildrenWithoutDynamic();
for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
- AbstractSmooksGraphicalModel abstractSmooksGraphicalModel =
(AbstractSmooksGraphicalModel) iterator.next();
+ AbstractSmooksGraphicalModel abstractSmooksGraphicalModel =
(AbstractSmooksGraphicalModel) iterator
+ .next();
cleanValidationMarker(abstractSmooksGraphicalModel);
}
}
@@ -1440,7 +1624,8 @@
public void run() {
cleanValidationMarker();
- for (Iterator<?> iterator = flist.iterator(); iterator.hasNext();) {
+ for (Iterator<?> iterator = flist.iterator(); iterator
+ .hasNext();) {
Diagnostic diagnostic = (Diagnostic) iterator.next();
refreshValidateResult(diagnostic);
}
@@ -1459,7 +1644,8 @@
Object obj = datas.get(1);
if (obj == Javabean12Package.Literals.BEAN_TYPE__BEAN_ID) {
String message = diagnostic.getMessage();
- if (message != null && message.startsWith("The required feature"))
{ //$NON-NLS-1$
+ if (message != null
+ && message.startsWith("The required feature")) { //$NON-NLS-1$
return Messages.SmooksJavaMappingGraphicalEditor_BeanIdEmptyErrormessage;
}
}
@@ -1469,7 +1655,8 @@
Object obj = datas.get(1);
if (obj == Javabean12Package.Literals.VALUE_TYPE__DATA) {
String message = diagnostic.getMessage();
- if (message != null && message.startsWith("The required feature"))
{ //$NON-NLS-1$
+ if (message != null
+ && message.startsWith("The required feature")) { //$NON-NLS-1$
return Messages.SmooksJavaMappingGraphicalEditor_NodeMustLinkWithSource;
}
}
@@ -1479,7 +1666,8 @@
Object obj = datas.get(1);
if (obj == Javabean12Package.Literals.WIRING_TYPE__BEAN_ID_REF) {
String message = diagnostic.getMessage();
- if (message != null && message.startsWith("The required feature"))
{ //$NON-NLS-1$
+ if (message != null
+ && message.startsWith("The required feature")) { //$NON-NLS-1$
return Messages.SmooksJavaMappingGraphicalEditor_NodeMustLinkWithJavaBean;
}
}
@@ -1498,7 +1686,8 @@
Object object = (Object) iterator2.next();
object = AdapterFactoryEditingDomain.unwrap(object);
if (object instanceof EObject) {
- AbstractSmooksGraphicalModel graphModel = SmooksGraphUtil.findSmooksGraphModel(root,
object);
+ AbstractSmooksGraphicalModel graphModel = SmooksGraphUtil
+ .findSmooksGraphModel(root, object);
if (graphModel == null)
continue;
obj = graphModel;
@@ -1509,7 +1698,8 @@
}
}
if (obj != null) {
- for (Iterator<?> iterator2 = datas.iterator(); iterator2.hasNext();) {
+ for (Iterator<?> iterator2 = datas.iterator(); iterator2
+ .hasNext();) {
Object object = (Object) iterator2.next();
object = AdapterFactoryEditingDomain.unwrap(object);
if (object instanceof EAttribute && obj != null) {