JBoss Tools SVN: r9540 - in trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4: .settings and 14 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-08-05 12:34:56 -0400 (Tue, 05 Aug 2008)
New Revision: 9540
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.classpath
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.project
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.settings/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.settings/org.eclipse.jdt.core.prefs
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/build.properties
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/end.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/process.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/start.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/state.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/super.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/transition.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/Activator.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editor/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editor/JpdlEditor.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editor/JpdlPaletteFactory.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/EndStateEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/JpdlEditPartFactory.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/StartStateEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/StateEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/TransitionEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/strategy/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/strategy/EndStateAcceptsOutgoingConnectionStrategy.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/strategy/ProcessAcceptsElementStrategy.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/strategy/StartStateAcceptsIncomingConnectionStrategy.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/SuperStateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/TransitionWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EndState.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Process.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/StartState.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/State.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/SuperState.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Transition.java
Log:
move from org.jboss.tools.flow.jpdl4.graph
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.classpath
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.classpath (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.classpath 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.project
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.project (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.project 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.flow.jpdl4</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/.settings/org.eclipse.jdt.core.prefs 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,7 @@
+#Tue Jul 15 11:36:35 CEST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Jpdl4 Plug-in
+Bundle-SymbolicName: org.jboss.tools.flow.jpdl4;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Vendor: JBoss, a Division of Red Hat
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.jboss.tools.flow.common;bundle-version="1.0.0",
+ org.jboss.tools.flow.jpdl4.core;bundle-version="1.0.0",
+ org.eclipse.core.resources;bundle-version="3.4.0",
+ org.eclipse.gef;bundle-version="3.4.0",
+ org.eclipse.ui;bundle-version="3.4.0",
+ org.eclipse.core.runtime;bundle-version="3.4.0"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.jboss.tools.flow.jpdl4.graph.Activator
+Export-Package: org.jboss.tools.flow.jpdl4.model
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/build.properties
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/build.properties (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/build.properties 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/end.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/end.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/process.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/process.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/start.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/start.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/state.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/state.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/super.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/super.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/transition.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/transition.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension point="org.eclipse.ui.editors">
+ <editor
+ name="jPDL4 Editor"
+ extensions="jpdl4"
+ icon="icons/process.gif"
+ contributorClass="org.jboss.tools.flow.editor.GenericActionBarContributor"
+ class="org.jboss.tools.flow.jpdl4.graph.editor.JpdlEditor"
+ id="org.jboss.tools.process.jpdl4.graph.editor.JpdlEditor">
+ </editor>
+ </extension>
+
+</plugin>
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/Activator.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/Activator.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/Activator.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,45 @@
+package org.jboss.tools.flow.jpdl4.graph;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.jboss.tools.process.jpdl4.graph";
+
+ private static Activator plugin;
+
+ public Activator() {
+ }
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editor/JpdlEditor.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editor/JpdlEditor.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editor/JpdlEditor.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,35 @@
+package org.jboss.tools.flow.jpdl4.graph.editor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.jboss.tools.flow.editor.GenericModelEditor;
+import org.jboss.tools.flow.jpdl4.graph.editpart.JpdlEditPartFactory;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.ProcessWrapper;
+
+public class JpdlEditor extends GenericModelEditor {
+
+ protected EditPartFactory createEditPartFactory() {
+ return new JpdlEditPartFactory();
+ }
+
+ protected PaletteRoot createPalette() {
+ return new JpdlPaletteFactory().createPalette();
+ }
+
+ protected Object createModel() {
+ return new ProcessWrapper();
+ }
+
+ protected void writeModel(OutputStream os) throws IOException {
+ // TODO
+ }
+
+ protected void createModel(InputStream is) {
+ // TODO
+ setModel(createModel());
+ }
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editor/JpdlPaletteFactory.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editor/JpdlPaletteFactory.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editor/JpdlPaletteFactory.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,77 @@
+package org.jboss.tools.flow.jpdl4.graph.editor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
+import org.eclipse.gef.palette.ConnectionCreationToolEntry;
+import org.eclipse.gef.palette.PaletteEntry;
+import org.eclipse.gef.palette.ToolEntry;
+import org.eclipse.gef.requests.SimpleFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.jboss.tools.flow.editor.PaletteFactory;
+import org.jboss.tools.flow.jpdl4.graph.Activator;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.EndStateWrapper;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.StartStateWrapper;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.StateWrapper;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.SuperStateWrapper;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.TransitionWrapper;
+
+public class JpdlPaletteFactory extends PaletteFactory {
+
+ protected List<PaletteEntry> createComponentEntries() {
+ List<PaletteEntry> entries = new ArrayList<PaletteEntry>();
+
+ CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
+ "Start",
+ "Create a new Start State",
+ StartStateWrapper.class,
+ new SimpleFactory(StartStateWrapper.class),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/start.gif")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/start.gif"))
+ );
+ entries.add(combined);
+
+ combined = new CombinedTemplateCreationEntry(
+ "State",
+ "Create a new State",
+ StateWrapper.class,
+ new SimpleFactory(StateWrapper.class),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/state.gif")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/state.gif"))
+ );
+ entries.add(combined);
+
+ combined = new CombinedTemplateCreationEntry(
+ "End",
+ "Create a new End State",
+ EndStateWrapper.class,
+ new SimpleFactory(EndStateWrapper.class),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/end.gif")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/end.gif"))
+ );
+ entries.add(combined);
+
+ combined = new CombinedTemplateCreationEntry(
+ "Super State",
+ "Create a new Super State",
+ SuperStateWrapper.class,
+ new SimpleFactory(SuperStateWrapper.class),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/super.gif")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/super.gif"))
+ );
+ entries.add(combined);
+
+ ToolEntry tool = new ConnectionCreationToolEntry(
+ "Transition",
+ "Creating a new Transition",
+ new SimpleFactory(TransitionWrapper.class),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/transition.gif")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/transition.gif"))
+ );
+ entries.add(tool);
+
+ return entries;
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/EndStateEditPart.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/EndStateEditPart.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/EndStateEditPart.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,21 @@
+package org.jboss.tools.flow.jpdl4.graph.editpart;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.flow.editor.editpart.ElementEditPart;
+import org.jboss.tools.flow.editor.figure.RectangleElementFigure;
+import org.jboss.tools.flow.jpdl4.graph.Activator;
+
+public class EndStateEditPart extends ElementEditPart {
+
+ private static final Image ICON = ImageDescriptor.createFromURL(
+ Activator.getDefault().getBundle().getEntry("icons/end.gif")).createImage();
+
+ protected IFigure createFigure() {
+ RectangleElementFigure figure = new RectangleElementFigure();
+ figure.setIcon(ICON);
+ return figure;
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/JpdlEditPartFactory.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/JpdlEditPartFactory.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/JpdlEditPartFactory.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,38 @@
+package org.jboss.tools.flow.jpdl4.graph.editpart;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.jboss.tools.flow.editor.editpart.ContainerEditPart;
+import org.jboss.tools.flow.editor.editpart.RootEditPart;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.EndStateWrapper;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.ProcessWrapper;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.StartStateWrapper;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.StateWrapper;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.SuperStateWrapper;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.TransitionWrapper;
+
+public class JpdlEditPartFactory implements EditPartFactory {
+
+ public EditPart createEditPart(EditPart context, Object model) {
+ EditPart result = null;
+ if (model instanceof ProcessWrapper) {
+ result = new RootEditPart();
+ } else if (model instanceof SuperStateWrapper) {
+ result = new ContainerEditPart();
+ } else if (model instanceof StartStateWrapper) {
+ result = new StartStateEditPart();
+ } else if (model instanceof StateWrapper) {
+ result = new StateEditPart();
+ } else if (model instanceof EndStateWrapper) {
+ result = new EndStateEditPart();
+ } else if (model instanceof TransitionWrapper) {
+ result = new TransitionEditPart();
+ } else {
+ throw new IllegalArgumentException(
+ "Unknown model object " + model);
+ }
+ result.setModel(model);
+ return result;
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/StartStateEditPart.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/StartStateEditPart.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/StartStateEditPart.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,21 @@
+package org.jboss.tools.flow.jpdl4.graph.editpart;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.flow.editor.editpart.ElementEditPart;
+import org.jboss.tools.flow.editor.figure.RectangleElementFigure;
+import org.jboss.tools.flow.jpdl4.graph.Activator;
+
+public class StartStateEditPart extends ElementEditPart {
+
+ private static final Image ICON = ImageDescriptor.createFromURL(
+ Activator.getDefault().getBundle().getEntry("icons/start.gif")).createImage();
+
+ protected IFigure createFigure() {
+ RectangleElementFigure figure = new RectangleElementFigure();
+ figure.setIcon(ICON);
+ return figure;
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/StateEditPart.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/StateEditPart.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/StateEditPart.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,25 @@
+package org.jboss.tools.flow.jpdl4.graph.editpart;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.jboss.tools.flow.editor.editpart.ElementEditPart;
+import org.jboss.tools.flow.editor.figure.RoundedRectangleElementFigure;
+import org.jboss.tools.flow.jpdl4.graph.Activator;
+
+public class StateEditPart extends ElementEditPart {
+
+ private static final Image ICON = ImageDescriptor.createFromURL(
+ Activator.getDefault().getBundle().getEntry("icons/state.gif")).createImage();
+ private static final Color COLOR = new Color(Display.getCurrent(), 255, 250, 205);
+
+ protected IFigure createFigure() {
+ RoundedRectangleElementFigure figure = new RoundedRectangleElementFigure();
+ figure.setIcon(ICON);
+ figure.setColor(COLOR);
+ return figure;
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/TransitionEditPart.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/TransitionEditPart.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/editpart/TransitionEditPart.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,12 @@
+package org.jboss.tools.flow.jpdl4.graph.editpart;
+
+import org.jboss.tools.flow.editor.editpart.ConnectionEditPart;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.TransitionWrapper;
+
+public class TransitionEditPart extends ConnectionEditPart {
+
+ protected Class<?> getElementConnectionType() {
+ return TransitionWrapper.class;
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/strategy/EndStateAcceptsOutgoingConnectionStrategy.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/strategy/EndStateAcceptsOutgoingConnectionStrategy.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/strategy/EndStateAcceptsOutgoingConnectionStrategy.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,16 @@
+package org.jboss.tools.flow.jpdl4.graph.strategy;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.editor.strategy.AcceptsOutgoingConnectionStrategy;
+
+public class EndStateAcceptsOutgoingConnectionStrategy implements AcceptsOutgoingConnectionStrategy {
+
+ public boolean acceptsOutgoingConnection(Connection connection, Node source) {
+ return false;
+ }
+
+ public void setNode(Node node) {
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/strategy/ProcessAcceptsElementStrategy.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/strategy/ProcessAcceptsElementStrategy.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/strategy/ProcessAcceptsElementStrategy.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,28 @@
+package org.jboss.tools.flow.jpdl4.graph.strategy;
+
+import org.jboss.tools.flow.common.model.Container;
+import org.jboss.tools.flow.editor.strategy.AcceptsElementStrategy;
+import org.jboss.tools.flow.jpdl4.model.Process;
+import org.jboss.tools.flow.jpdl4.model.StartState;
+
+public class ProcessAcceptsElementStrategy implements AcceptsElementStrategy {
+
+ private Process process;
+
+ public boolean acceptsElement(Object element) {
+ if (process == null) {
+ return false;
+ } else if (element instanceof StartState) {
+ return process.getStartState() == null;
+ } else {
+ return true;
+ }
+ }
+
+ public void setContainer(Container container) {
+ if (container instanceof Process) {
+ this.process = (Process)container;
+ }
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/strategy/StartStateAcceptsIncomingConnectionStrategy.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/strategy/StartStateAcceptsIncomingConnectionStrategy.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/strategy/StartStateAcceptsIncomingConnectionStrategy.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,16 @@
+package org.jboss.tools.flow.jpdl4.graph.strategy;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.editor.strategy.AcceptsIncomingConnectionStrategy;
+
+public class StartStateAcceptsIncomingConnectionStrategy implements AcceptsIncomingConnectionStrategy {
+
+ public boolean acceptsIncomingConnection(Connection connection, Node source) {
+ return false;
+ }
+
+ public void setNode(Node node) {
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,19 @@
+package org.jboss.tools.flow.jpdl4.graph.wrapper;
+
+import org.jboss.tools.flow.editor.core.DefaultNodeWrapper;
+import org.jboss.tools.flow.editor.strategy.AcceptsOutgoingConnectionStrategy;
+import org.jboss.tools.flow.jpdl4.graph.strategy.EndStateAcceptsOutgoingConnectionStrategy;
+import org.jboss.tools.flow.jpdl4.model.EndState;
+
+public class EndStateWrapper extends DefaultNodeWrapper {
+
+ public EndStateWrapper() {
+ EndState element = new EndState();
+ setElement(element);
+ setName("End");
+ AcceptsOutgoingConnectionStrategy strategy = new EndStateAcceptsOutgoingConnectionStrategy();
+ strategy.setNode(element);
+ setAcceptsOutgoingConnectionStrategy(strategy);
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,17 @@
+package org.jboss.tools.flow.jpdl4.graph.wrapper;
+
+import org.jboss.tools.flow.editor.core.DefaultFlowWrapper;
+import org.jboss.tools.flow.jpdl4.graph.strategy.ProcessAcceptsElementStrategy;
+import org.jboss.tools.flow.jpdl4.model.Process;
+
+public class ProcessWrapper extends DefaultFlowWrapper {
+
+ public ProcessWrapper() {
+ Process process = new Process();
+ setElement(process);
+ ProcessAcceptsElementStrategy acceptsElementStrategy = new ProcessAcceptsElementStrategy();
+ acceptsElementStrategy.setContainer(process);
+ setAcceptsElementStrategy(acceptsElementStrategy);
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,19 @@
+package org.jboss.tools.flow.jpdl4.graph.wrapper;
+
+import org.jboss.tools.flow.editor.core.DefaultNodeWrapper;
+import org.jboss.tools.flow.editor.strategy.AcceptsIncomingConnectionStrategy;
+import org.jboss.tools.flow.jpdl4.graph.strategy.StartStateAcceptsIncomingConnectionStrategy;
+import org.jboss.tools.flow.jpdl4.model.StartState;
+
+public class StartStateWrapper extends DefaultNodeWrapper {
+
+ public StartStateWrapper() {
+ StartState element = new StartState();
+ setElement(element);
+ setName("Start");
+ AcceptsIncomingConnectionStrategy strategy = new StartStateAcceptsIncomingConnectionStrategy();
+ strategy.setNode(element);
+
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,14 @@
+package org.jboss.tools.flow.jpdl4.graph.wrapper;
+
+import org.jboss.tools.flow.editor.core.DefaultNodeWrapper;
+import org.jboss.tools.flow.jpdl4.model.State;
+
+public class StateWrapper extends DefaultNodeWrapper {
+
+ public StateWrapper() {
+ State element = new State();
+ setElement(element);
+ element.setName("State");
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/SuperStateWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/SuperStateWrapper.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/SuperStateWrapper.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,12 @@
+package org.jboss.tools.flow.jpdl4.graph.wrapper;
+
+import org.jboss.tools.flow.editor.core.DefaultContainerWrapper;
+import org.jboss.tools.flow.jpdl4.model.SuperState;
+
+public class SuperStateWrapper extends DefaultContainerWrapper {
+
+ public SuperStateWrapper() {
+ setElement(new SuperState());
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/TransitionWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/TransitionWrapper.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/graph/wrapper/TransitionWrapper.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,7 @@
+package org.jboss.tools.flow.jpdl4.graph.wrapper;
+
+import org.jboss.tools.flow.editor.core.DefaultConnectionWrapper;
+
+public class TransitionWrapper extends DefaultConnectionWrapper {
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EndState.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EndState.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EndState.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,7 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import org.jboss.tools.flow.common.model.DefaultNode;
+
+public class EndState extends DefaultNode {
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Process.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Process.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Process.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,20 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import java.util.Iterator;
+
+import org.jboss.tools.flow.common.model.DefaultFlow;
+import org.jboss.tools.flow.common.model.Node;
+
+public class Process extends DefaultFlow {
+
+ public StartState getStartState() {
+ for (Iterator<Node> iterator = getNodes().iterator(); iterator.hasNext(); ) {
+ Node node = iterator.next();
+ if (node instanceof StartState) {
+ return (StartState)node;
+ }
+ }
+ return null;
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/StartState.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/StartState.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/StartState.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,7 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import org.jboss.tools.flow.common.model.DefaultNode;
+
+public class StartState extends DefaultNode {
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/State.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/State.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/State.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,7 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import org.jboss.tools.flow.common.model.DefaultNode;
+
+public class State extends DefaultNode {
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/SuperState.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/SuperState.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/SuperState.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,7 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import org.jboss.tools.flow.common.model.DefaultContainer;
+
+public class SuperState extends DefaultContainer {
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Transition.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Transition.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Transition.java 2008-08-05 16:34:56 UTC (rev 9540)
@@ -0,0 +1,12 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import org.jboss.tools.flow.common.model.DefaultConnection;
+import org.jboss.tools.flow.common.model.Node;
+
+public class Transition extends DefaultConnection {
+
+ public Transition(Node from, Node to) {
+ super(from, to);
+ }
+
+}
16 years, 5 months
JBoss Tools SVN: r9539 - trunk/jbpm/plugins.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-08-05 12:34:03 -0400 (Tue, 05 Aug 2008)
New Revision: 9539
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/
Log:
Move from org.jboss.tools.flow.jpdl4.graph
16 years, 5 months
JBoss Tools SVN: r9538 - in trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph: src/org/jboss/tools/flow/jpdl4 and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-08-05 12:32:31 -0400 (Tue, 05 Aug 2008)
New Revision: 9538
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/model/
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/META-INF/MANIFEST.MF
Log:
move of model to org.jboss.tools.flow.jpdl4.graph
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/META-INF/MANIFEST.MF
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/META-INF/MANIFEST.MF 2008-08-05 16:32:08 UTC (rev 9537)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/META-INF/MANIFEST.MF 2008-08-05 16:32:31 UTC (rev 9538)
@@ -13,3 +13,4 @@
org.eclipse.core.runtime;bundle-version="3.4.0"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.jboss.tools.flow.jpdl4.graph.Activator
+Export-Package: org.jboss.tools.flow.jpdl4.model
Copied: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/model (from rev 9534, trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model)
16 years, 5 months
JBoss Tools SVN: r9537 - in trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core: src and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-08-05 12:32:08 -0400 (Tue, 05 Aug 2008)
New Revision: 9537
Removed:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/META-INF/MANIFEST.MF
Log:
move of model to org.jboss.tools.flow.jpdl4.graph
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/META-INF/MANIFEST.MF 2008-08-05 16:30:29 UTC (rev 9536)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/META-INF/MANIFEST.MF 2008-08-05 16:32:08 UTC (rev 9537)
@@ -5,5 +5,4 @@
Bundle-Version: 1.0.0
Bundle-Vendor: JBoss, a Division of Red Hat
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.jboss.tools.flow.jpdl4.model
Require-Bundle: org.jboss.tools.flow.common;bundle-version="1.0.0"
16 years, 5 months
JBoss Tools SVN: r9536 - trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-08-05 12:30:29 -0400 (Tue, 05 Aug 2008)
New Revision: 9536
Modified:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF
Log:
removed dependency on org.jboss.tools.flow.common.core
Modified: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF 2008-08-05 16:29:32 UTC (rev 9535)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF 2008-08-05 16:30:29 UTC (rev 9536)
@@ -11,7 +11,7 @@
org.eclipse.gef,
org.eclipse.ui,
org.eclipse.ui.ide,
- org.jboss.tools.flow.common.graph
+ org.jboss.tools.flow.common
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
lib/drools-core.jar
16 years, 5 months
JBoss Tools SVN: r9535 - in trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph: src/org/jboss/tools/flow/jpdl4/graph/strategy and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-08-05 12:29:32 -0400 (Tue, 05 Aug 2008)
New Revision: 9535
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/META-INF/MANIFEST.MF
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/strategy/ProcessAcceptsElementStrategy.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/SuperStateWrapper.java
Log:
rename of org.jboss.tools.flow.jpdl4.core to org.jboss.tools.flow.jpdl4.model
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/META-INF/MANIFEST.MF
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/META-INF/MANIFEST.MF 2008-08-05 16:28:58 UTC (rev 9534)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/META-INF/MANIFEST.MF 2008-08-05 16:29:32 UTC (rev 9535)
@@ -5,8 +5,7 @@
Bundle-Version: 1.0.0
Bundle-Vendor: JBoss, a Division of Red Hat
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Require-Bundle: org.jboss.tools.flow.common.core;bundle-version="1.0.0",
- org.jboss.tools.flow.common.graph;bundle-version="1.0.0",
+Require-Bundle: org.jboss.tools.flow.common;bundle-version="1.0.0",
org.jboss.tools.flow.jpdl4.core;bundle-version="1.0.0",
org.eclipse.core.resources;bundle-version="3.4.0",
org.eclipse.gef;bundle-version="3.4.0",
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/strategy/ProcessAcceptsElementStrategy.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/strategy/ProcessAcceptsElementStrategy.java 2008-08-05 16:28:58 UTC (rev 9534)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/strategy/ProcessAcceptsElementStrategy.java 2008-08-05 16:29:32 UTC (rev 9535)
@@ -2,8 +2,8 @@
import org.jboss.tools.flow.common.model.Container;
import org.jboss.tools.flow.editor.strategy.AcceptsElementStrategy;
-import org.jboss.tools.flow.jpdl4.core.Process;
-import org.jboss.tools.flow.jpdl4.core.StartState;
+import org.jboss.tools.flow.jpdl4.model.Process;
+import org.jboss.tools.flow.jpdl4.model.StartState;
public class ProcessAcceptsElementStrategy implements AcceptsElementStrategy {
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java 2008-08-05 16:28:58 UTC (rev 9534)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java 2008-08-05 16:29:32 UTC (rev 9535)
@@ -2,8 +2,8 @@
import org.jboss.tools.flow.editor.core.DefaultNodeWrapper;
import org.jboss.tools.flow.editor.strategy.AcceptsOutgoingConnectionStrategy;
-import org.jboss.tools.flow.jpdl4.core.EndState;
import org.jboss.tools.flow.jpdl4.graph.strategy.EndStateAcceptsOutgoingConnectionStrategy;
+import org.jboss.tools.flow.jpdl4.model.EndState;
public class EndStateWrapper extends DefaultNodeWrapper {
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java 2008-08-05 16:28:58 UTC (rev 9534)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java 2008-08-05 16:29:32 UTC (rev 9535)
@@ -1,8 +1,8 @@
package org.jboss.tools.flow.jpdl4.graph.wrapper;
import org.jboss.tools.flow.editor.core.DefaultFlowWrapper;
-import org.jboss.tools.flow.jpdl4.core.Process;
import org.jboss.tools.flow.jpdl4.graph.strategy.ProcessAcceptsElementStrategy;
+import org.jboss.tools.flow.jpdl4.model.Process;
public class ProcessWrapper extends DefaultFlowWrapper {
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java 2008-08-05 16:28:58 UTC (rev 9534)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java 2008-08-05 16:29:32 UTC (rev 9535)
@@ -2,8 +2,8 @@
import org.jboss.tools.flow.editor.core.DefaultNodeWrapper;
import org.jboss.tools.flow.editor.strategy.AcceptsIncomingConnectionStrategy;
-import org.jboss.tools.flow.jpdl4.core.StartState;
import org.jboss.tools.flow.jpdl4.graph.strategy.StartStateAcceptsIncomingConnectionStrategy;
+import org.jboss.tools.flow.jpdl4.model.StartState;
public class StartStateWrapper extends DefaultNodeWrapper {
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java 2008-08-05 16:28:58 UTC (rev 9534)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java 2008-08-05 16:29:32 UTC (rev 9535)
@@ -1,7 +1,7 @@
package org.jboss.tools.flow.jpdl4.graph.wrapper;
import org.jboss.tools.flow.editor.core.DefaultNodeWrapper;
-import org.jboss.tools.flow.jpdl4.core.State;
+import org.jboss.tools.flow.jpdl4.model.State;
public class StateWrapper extends DefaultNodeWrapper {
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/SuperStateWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/SuperStateWrapper.java 2008-08-05 16:28:58 UTC (rev 9534)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/SuperStateWrapper.java 2008-08-05 16:29:32 UTC (rev 9535)
@@ -1,7 +1,7 @@
package org.jboss.tools.flow.jpdl4.graph.wrapper;
import org.jboss.tools.flow.editor.core.DefaultContainerWrapper;
-import org.jboss.tools.flow.jpdl4.core.SuperState;
+import org.jboss.tools.flow.jpdl4.model.SuperState;
public class SuperStateWrapper extends DefaultContainerWrapper {
16 years, 5 months
JBoss Tools SVN: r9534 - in trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core: src/org/jboss/tools/flow/jpdl4 and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-08-05 12:28:58 -0400 (Tue, 05 Aug 2008)
New Revision: 9534
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/EndState.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Process.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/StartState.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/State.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/SuperState.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Transition.java
Removed:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/EndState.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Node.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Process.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/StartState.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/State.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Transition.java
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/META-INF/MANIFEST.MF
Log:
rename of org.jboss.tools.flow.jpdl4.core to org.jboss.tools.flow.jpdl4.model
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/META-INF/MANIFEST.MF 2008-08-05 16:26:59 UTC (rev 9533)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/META-INF/MANIFEST.MF 2008-08-05 16:28:58 UTC (rev 9534)
@@ -5,5 +5,5 @@
Bundle-Version: 1.0.0
Bundle-Vendor: JBoss, a Division of Red Hat
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.jboss.tools.flow.jpdl4.core
-Require-Bundle: org.jboss.tools.flow.common.core;bundle-version="1.0.0"
+Export-Package: org.jboss.tools.flow.jpdl4.model
+Require-Bundle: org.jboss.tools.flow.common;bundle-version="1.0.0"
Copied: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model (from rev 9246, trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core)
Deleted: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/EndState.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/EndState.java 2008-07-23 14:27:17 UTC (rev 9246)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/EndState.java 2008-08-05 16:28:58 UTC (rev 9534)
@@ -1,5 +0,0 @@
-package org.jboss.tools.flow.jpdl4.core;
-
-public class EndState extends Node {
-
-}
Copied: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/EndState.java (from rev 9528, trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/EndState.java)
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/EndState.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/EndState.java 2008-08-05 16:28:58 UTC (rev 9534)
@@ -0,0 +1,7 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import org.jboss.tools.flow.common.model.DefaultNode;
+
+public class EndState extends DefaultNode {
+
+}
Deleted: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Node.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/Node.java 2008-07-23 14:27:17 UTC (rev 9246)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Node.java 2008-08-05 16:28:58 UTC (rev 9534)
@@ -1,45 +0,0 @@
-package org.jboss.tools.flow.jpdl4.core;
-
-import java.util.HashMap;
-
-public class Node {
-
- private long id;
- private String name;
- private Process container;
-
- private HashMap<String, Object> metaData = new HashMap<String, Object>();
-
- public long getId() {
- return id;
- }
-
- public void setId(long l) {
- id = l;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setMetaData(String key, Object value) {
- metaData.put(key, value);
- }
-
- public Object getMetaData(String key) {
- return metaData.get(key);
- }
-
- public Object getNodeContainer() {
- return container;
- }
-
- public void setNodeContainer(Process container) {
- this.container = container;
- }
-
-}
Deleted: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Process.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/Process.java 2008-07-23 14:27:17 UTC (rev 9246)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Process.java 2008-08-05 16:28:58 UTC (rev 9534)
@@ -1,43 +0,0 @@
-package org.jboss.tools.flow.jpdl4.core;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-public class Process {
-
- private String name;
- private HashMap<String, Object> metaData = new HashMap<String, Object>();
- private ArrayList<Node> nodes = new ArrayList<Node>();
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Object getMetaData(String key) {
- return metaData.get(key);
- }
-
- public void setMetaData(String key, Object value) {
- metaData.put(key, value);
- }
-
- public List<Node> getNodes() {
- return nodes;
- }
-
- public void addNode(Node node) {
- nodes.add(node);
- node.setNodeContainer(this);
- }
-
- public void removeNode(Node node) {
- node.setNodeContainer(null);
- nodes.remove(node);
- }
-
-}
Copied: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Process.java (from rev 9528, trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/Process.java)
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Process.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Process.java 2008-08-05 16:28:58 UTC (rev 9534)
@@ -0,0 +1,20 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import java.util.Iterator;
+
+import org.jboss.tools.flow.common.model.DefaultFlow;
+import org.jboss.tools.flow.common.model.Node;
+
+public class Process extends DefaultFlow {
+
+ public StartState getStartState() {
+ for (Iterator<Node> iterator = getNodes().iterator(); iterator.hasNext(); ) {
+ Node node = iterator.next();
+ if (node instanceof StartState) {
+ return (StartState)node;
+ }
+ }
+ return null;
+ }
+
+}
Deleted: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/StartState.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/StartState.java 2008-07-23 14:27:17 UTC (rev 9246)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/StartState.java 2008-08-05 16:28:58 UTC (rev 9534)
@@ -1,5 +0,0 @@
-package org.jboss.tools.flow.jpdl4.core;
-
-public class StartState extends Node {
-
-}
Copied: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/StartState.java (from rev 9528, trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/StartState.java)
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/StartState.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/StartState.java 2008-08-05 16:28:58 UTC (rev 9534)
@@ -0,0 +1,7 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import org.jboss.tools.flow.common.model.DefaultNode;
+
+public class StartState extends DefaultNode {
+
+}
Deleted: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/State.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/State.java 2008-07-23 14:27:17 UTC (rev 9246)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/State.java 2008-08-05 16:28:58 UTC (rev 9534)
@@ -1,5 +0,0 @@
-package org.jboss.tools.flow.jpdl4.core;
-
-public class State extends Node {
-
-}
Copied: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/State.java (from rev 9528, trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/State.java)
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/State.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/State.java 2008-08-05 16:28:58 UTC (rev 9534)
@@ -0,0 +1,7 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import org.jboss.tools.flow.common.model.DefaultNode;
+
+public class State extends DefaultNode {
+
+}
Copied: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/SuperState.java (from rev 9528, trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/SuperState.java)
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/SuperState.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/SuperState.java 2008-08-05 16:28:58 UTC (rev 9534)
@@ -0,0 +1,7 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import org.jboss.tools.flow.common.model.DefaultContainer;
+
+public class SuperState extends DefaultContainer {
+
+}
Deleted: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Transition.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/Transition.java 2008-07-23 14:27:17 UTC (rev 9246)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Transition.java 2008-08-05 16:28:58 UTC (rev 9534)
@@ -1,20 +0,0 @@
-package org.jboss.tools.flow.jpdl4.core;
-
-import java.util.HashMap;
-
-public class Transition {
-
- private HashMap<String, Object> metaData = new HashMap<String, Object>();
-
- public Transition(Node from, Node to) {
- }
-
- public Object getMetaData(String key) {
- return metaData.get(key);
- }
-
- public void setMetaData(String key, Object value) {
- metaData.put(key, value);
- }
-
-}
Copied: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Transition.java (from rev 9528, trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/Transition.java)
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Transition.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/model/Transition.java 2008-08-05 16:28:58 UTC (rev 9534)
@@ -0,0 +1,12 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import org.jboss.tools.flow.common.model.DefaultConnection;
+import org.jboss.tools.flow.common.model.Node;
+
+public class Transition extends DefaultConnection {
+
+ public Transition(Node from, Node to) {
+ super(from, to);
+ }
+
+}
16 years, 5 months
JBoss Tools SVN: r9533 - trunk/flow/plugins/org.jboss.tools.flow.common/META-INF.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-08-05 12:26:59 -0400 (Tue, 05 Aug 2008)
New Revision: 9533
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF
Log:
removed dependency on org.jboss.tools.flow.common.core
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF 2008-08-05 16:25:42 UTC (rev 9532)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF 2008-08-05 16:26:59 UTC (rev 9533)
@@ -6,7 +6,6 @@
Bundle-Activator: org.jboss.tools.flow.Activator
Bundle-Vendor: JBoss
Require-Bundle:
- org.jboss.tools.flow.common.core;bundle-version="1.0.0",
org.eclipse.ui.views,
org.eclipse.draw2d,
org.eclipse.gef,
16 years, 5 months
JBoss Tools SVN: r9532 - in trunk/flow/plugins/org.jboss.tools.flow.common: .settings and 17 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-08-05 12:25:42 -0400 (Tue, 05 Aug 2008)
New Revision: 9532
Added:
trunk/flow/plugins/org.jboss.tools.flow.common/.classpath
trunk/flow/plugins/org.jboss.tools.flow.common/.project
trunk/flow/plugins/org.jboss.tools.flow.common/.settings/
trunk/flow/plugins/org.jboss.tools.flow.common/.settings/org.eclipse.jdt.core.prefs
trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/
trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF
trunk/flow/plugins/org.jboss.tools.flow.common/build.properties
trunk/flow/plugins/org.jboss.tools.flow.common/icons/
trunk/flow/plugins/org.jboss.tools.flow.common/icons/layoutH.gif
trunk/flow/plugins/org.jboss.tools.flow.common/icons/layoutV.gif
trunk/flow/plugins/org.jboss.tools.flow.common/src/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/Activator.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Connection.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Container.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultConnection.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultContainer.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultFlow.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultNode.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Flow.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Node.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/DropDownMenuWithDefaultAction.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/GenericActionBarContributor.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/GenericContextMenuProvider.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/GenericModelEditor.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/OverviewOutlinePage.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/PaletteFactory.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/action/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/action/HorizontalAutoLayoutAction.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/action/VerticalAutoLayoutAction.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/AddElementCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ChangeConstraintCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/CreateBendpointCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/DeleteBendpointCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/DeleteConnectionCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/DeleteElementCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ElementConnectionCreateCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/MoveBendpointCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ReconnectElementConnectionSourceCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ReconnectElementConnectionTargetCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/RenameElementCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/SplitConnectionCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractConnectionWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractContainerWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractFlowWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractNodeWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ConnectionWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ContainerWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultConnectionWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultContainerWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultFlowWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultNodeWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ModelEvent.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ModelListener.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/NodeWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/Wrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/CellEditorLocator.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/ConnectionEditPart.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/ContainerEditPart.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/ElementEditPart.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/RootEditPart.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/AbstractElementFigure.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/ElementContainerFigure.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/ElementFigure.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/EllipseElementFigure.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/RectangleElementFigure.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/RoundedRectangleElementFigure.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ConnectionBendpointEditPolicy.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ConnectionEditPolicy.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementContainerLayoutEditPolicy.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementDirectEditManager.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementDirectEditPolicy.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementEditPolicy.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementNodeEditPolicy.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/strategy/
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/strategy/AcceptsElementStrategy.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/strategy/AcceptsIncomingConnectionStrategy.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/strategy/AcceptsOutgoingConnectionStrategy.java
Log:
Added: trunk/flow/plugins/org.jboss.tools.flow.common/.classpath
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/.classpath (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/.classpath 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/flow/plugins/org.jboss.tools.flow.common/.project
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/.project (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/.project 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.flow.common</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/flow/plugins/org.jboss.tools.flow.common/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/.settings/org.eclipse.jdt.core.prefs 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,7 @@
+#Tue Jul 15 11:46:18 CEST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,30 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JBoss Tools Process Plug-in
+Bundle-SymbolicName: org.jboss.tools.flow.common;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.tools.flow.Activator
+Bundle-Vendor: JBoss
+Require-Bundle:
+ org.jboss.tools.flow.common.core;bundle-version="1.0.0",
+ org.eclipse.ui.views,
+ org.eclipse.draw2d,
+ org.eclipse.gef,
+ org.eclipse.jface,
+ org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide
+Bundle-ActivationPolicy: lazy
+Export-Package: org.jboss.tools.flow;uses:="org.eclipse.core.runtime,org.eclipse.ui.plugin,org.osgi.framework",
+ org.jboss.tools.flow.common.model,
+ org.jboss.tools.flow.editor,
+ org.jboss.tools.flow.editor.action,
+ org.jboss.tools.flow.editor.command,
+ org.jboss.tools.flow.editor.core,
+ org.jboss.tools.flow.editor.editpart,
+ org.jboss.tools.flow.editor.figure,
+ org.jboss.tools.flow.editor.policy,
+ org.jboss.tools.flow.editor.strategy
+Bundle-ClassPath: .
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added: trunk/flow/plugins/org.jboss.tools.flow.common/build.properties
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/build.properties (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/build.properties 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,8 @@
+jars.compile.order = .
+source.. = src/
+src.includes = src/,\
+ build.properties,\
+ META-INF/
+bin.includes = .,\
+ META-INF/
+output.. = bin/
Added: trunk/flow/plugins/org.jboss.tools.flow.common/icons/layoutH.gif
===================================================================
(Binary files differ)
Property changes on: trunk/flow/plugins/org.jboss.tools.flow.common/icons/layoutH.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/flow/plugins/org.jboss.tools.flow.common/icons/layoutV.gif
===================================================================
(Binary files differ)
Property changes on: trunk/flow/plugins/org.jboss.tools.flow.common/icons/layoutV.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/Activator.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/Activator.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/Activator.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,64 @@
+package org.jboss.tools.flow;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">kris verlaenen </a>
+ */
+public class Activator extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.jboss.tools.process";
+
+ private static Activator plugin;
+
+ public Activator() {
+ plugin = this;
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ }
+
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ private static String getUniqueIdentifier() {
+ if (getDefault() == null ) {
+ return PLUGIN_ID;
+ }
+ return getDefault().getBundle().getSymbolicName();
+ }
+
+ public static void log(Throwable t) {
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(), 0,
+ "Internal error in JBoss Tools Process Plugin: ", t));
+ }
+
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Connection.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Connection.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Connection.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,56 @@
+package org.jboss.tools.flow.common.model;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Represents a connection between two nodes in a workflow.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public interface Connection {
+
+ /**
+ * Returns the from node of the connection.
+ * @return the from node of the connection.
+ */
+ Node getFrom();
+
+ /**
+ * Returns the to node of the connection
+ * @return the to node of the connection
+ */
+ Node getTo();
+
+ /**
+ * Returns the type of the connection at the from node
+ *
+ * @return the type of the connection at the from node
+ */
+ String getFromType();
+
+ /**
+ * Returns the type of the connection at the to node
+ *
+ * @return the type of the connection at the to node
+ */
+ String getToType();
+
+ void setMetaData(String name, Object value);
+
+ Object getMetaData(String name);
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Container.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Container.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Container.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,47 @@
+package org.jboss.tools.flow.common.model;
+
+import java.util.List;
+
+/**
+ * A container of nodes.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public interface Container {
+
+ /**
+ * Returns the nodes of this node container.
+ *
+ * @return the nodes of this node container
+ */
+ List<Node> getNodes();
+
+ /**
+ * Returns the node with the given id
+ *
+ * @param id
+ * the node id
+ * @return the node with the given id
+ * @throws IllegalArgumentException
+ * if an unknown id is passed
+ */
+ Node getNode(long id);
+
+ /**
+ * Method for adding a node to this node container.
+ * Note that the node will get an id unique for this node container.
+ *
+ * @param node the node to be added
+ * @throws IllegalArgumentException if <code>node</code> is null
+ */
+ void addNode(Node node);
+
+ /**
+ * Method for removing a node from this node container
+ *
+ * @param node the node to be removed
+ * @throws IllegalArgumentException if <code>node</code> is null or unknown
+ */
+ void removeNode(Node node);
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultConnection.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultConnection.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultConnection.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,39 @@
+package org.jboss.tools.flow.common.model;
+
+import java.util.HashMap;
+
+public class DefaultConnection implements Connection {
+
+ private HashMap<String, Object> metaData = new HashMap<String, Object>();
+ private Node from, to;
+
+ public DefaultConnection(Node from, Node to) {
+ this.from = from;
+ this.to = to;
+ }
+
+ public Object getMetaData(String key) {
+ return metaData.get(key);
+ }
+
+ public void setMetaData(String key, Object value) {
+ metaData.put(key, value);
+ }
+
+ public Node getFrom() {
+ return from;
+ }
+
+ public Node getTo() {
+ return to;
+ }
+
+ public String getFromType() {
+ return null;
+ }
+
+ public String getToType() {
+ return null;
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultContainer.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultContainer.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultContainer.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,52 @@
+package org.jboss.tools.flow.common.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class DefaultContainer extends DefaultNode implements Container {
+
+ private String name;
+ private HashMap<String, Object> metaData = new HashMap<String, Object>();
+ private ArrayList<Node> nodes = new ArrayList<Node>();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Object getMetaData(String key) {
+ return metaData.get(key);
+ }
+
+ public void setMetaData(String key, Object value) {
+ metaData.put(key, value);
+ }
+
+ public List<Node> getNodes() {
+ return nodes;
+ }
+
+ public void addNode(Node node) {
+ nodes.add(node);
+ node.setNodeContainer(this);
+ }
+
+ public void removeNode(Node node) {
+ node.setNodeContainer(null);
+ nodes.remove(node);
+ }
+
+ public Node getNode(long id) {
+ for (Node node : nodes) {
+ if (node.getId() == id) {
+ return node;
+ }
+ }
+ return null;
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultFlow.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultFlow.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultFlow.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,88 @@
+package org.jboss.tools.flow.common.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class DefaultFlow implements Flow {
+
+ private String name;
+ private HashMap<String, Object> metaData = new HashMap<String, Object>();
+ private ArrayList<Node> nodes = new ArrayList<Node>();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Object getMetaData(String key) {
+ return metaData.get(key);
+ }
+
+ public void setMetaData(String key, Object value) {
+ metaData.put(key, value);
+ }
+
+ public List<Node> getNodes() {
+ return nodes;
+ }
+
+ public void addNode(Node node) {
+ nodes.add(node);
+ node.setNodeContainer(this);
+ }
+
+ public void removeNode(Node node) {
+ node.setNodeContainer(null);
+ nodes.remove(node);
+ }
+
+ public String getId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getPackageName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getVersion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setId(String id) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setPackageName(String packageName) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setType(String type) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setVersion(String version) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Node getNode(long id) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultNode.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultNode.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/DefaultNode.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,87 @@
+package org.jboss.tools.flow.common.model;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class DefaultNode implements Node {
+
+ private long id;
+ private String name;
+ private Container container;
+
+ private HashMap<String, Object> metaData = new HashMap<String, Object>();
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long l) {
+ id = l;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setMetaData(String key, Object value) {
+ metaData.put(key, value);
+ }
+
+ public Object getMetaData(String key) {
+ return metaData.get(key);
+ }
+
+ public Container getNodeContainer() {
+ return container;
+ }
+
+ public void setNodeContainer(Container container) {
+ this.container = container;
+ }
+
+ public void addIncomingConnection(String type, Connection connection) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addOutgoingConnection(String type, Connection connection) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Map<String, List<Connection>> getIncomingConnections() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<Connection> getIncomingConnections(String type) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Map<String, List<Connection>> getOutgoingConnections() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<Connection> getOutgoingConnections(String type) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void removeIncomingConnection(String type, Connection connection) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeOutgoingConnection(String type, Connection connection) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Flow.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Flow.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Flow.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,99 @@
+package org.jboss.tools.flow.common.model;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Represents a some process definition.
+ * A process has a name and a unique id.
+ * When a new version of a process is created, the name stays the same,
+ * but the id and the version of the process should be different.
+ * Different types of processes could be defined (e.g. RuleFlow).
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public interface Flow extends Container {
+
+ /**
+ * Sets the id of this process.
+ * The id should uniquely identify this process.
+ * @param id the id of the process
+ */
+ void setId(String id);
+
+ /**
+ * Returns the id of this process.
+ * @return the id of this process
+ */
+ String getId();
+
+ /**
+ * Sets the name of this process.
+ * @param name the name of this process
+ */
+ void setName(String name);
+
+ /**
+ * Returns the name of this process.
+ * If no name is specified, null is returned.
+ * @return the name of this process
+ */
+ String getName();
+
+ /**
+ * Sets the version of this process.
+ * @param version the version of this process
+ */
+ void setVersion(String version);
+
+ /**
+ * Returns the version of this process.
+ * If no version is specified, null is returned.
+ * @return the version of this process
+ */
+ String getVersion();
+
+ /**
+ * Sets the type of this process.
+ * @param type the type of this process
+ */
+ void setType(String type);
+
+ /**
+ * Returns the type of this process.
+ * @return the type of this process
+ */
+ String getType();
+
+ /**
+ * Sets the package name of this RuleFlow process
+ *
+ * @param packageName the package name of this RuleFlow process
+ */
+ void setPackageName(String packageName);
+
+ /**
+ * Returns the package name of this RuleFlow process
+ *
+ * @return the package name of this RuleFlow process
+ */
+ String getPackageName();
+
+ void setMetaData(String name, Object value);
+
+ Object getMetaData(String name);
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Node.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Node.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Node.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,91 @@
+package org.jboss.tools.flow.common.model;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Represents a node in a workflow process.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public interface Node {
+
+ /**
+ * Returns the id of the node
+ *
+ * @return the id of the node
+ */
+ long getId();
+
+ /**
+ * Method for setting the id of the node
+ *
+ * @param id the id of the node
+ */
+ void setId(long id);
+
+ /**
+ * Returns the name of the node
+ *
+ * @return the name of the node
+ */
+ String getName();
+
+ /**
+ * Method for setting the name of the node
+ *
+ * @param name the name of the node
+ */
+ void setName(String name);
+
+ /**
+ * Returns the incoming connections
+ *
+ * @return the incoming connections
+ */
+ Map<String, List<Connection>> getIncomingConnections();
+
+ /**
+ * Returns the outgoing connections
+ *
+ * @return the outgoing connections
+ */
+ Map<String, List<Connection>> getOutgoingConnections();
+
+ void addIncomingConnection(String type, Connection connection);
+
+ void addOutgoingConnection(String type, Connection connection);
+
+ void removeIncomingConnection(String type, Connection connection);
+
+ void removeOutgoingConnection(String type, Connection connection);
+
+ List<Connection> getIncomingConnections(String type);
+
+ List<Connection> getOutgoingConnections(String type);
+
+ Container getNodeContainer();
+
+ void setNodeContainer(Container nodeContainer);
+
+ void setMetaData(String name, Object value);
+
+ Object getMetaData(String name);
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/DropDownMenuWithDefaultAction.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/DropDownMenuWithDefaultAction.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/DropDownMenuWithDefaultAction.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,147 @@
+package org.jboss.tools.flow.editor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+public class DropDownMenuWithDefaultAction extends Action implements IMenuCreator {
+
+ private Menu dropDownMenu;
+ private IAction delegate;
+ private List<Object> list;
+ private IPropertyChangeListener enabledListener;
+ private SelectionListener selectionListener;
+
+ public DropDownMenuWithDefaultAction(final IAction action) {
+ this.selectionListener = new ItemSelectionListener(this);
+ setMenuCreator(this);
+ this.dropDownMenu = null;
+ setAction(action);
+ this.list = new ArrayList<Object>();
+ }
+
+ public void dispose() {
+ if (this.dropDownMenu != null) {
+ this.dropDownMenu.dispose();
+ this.dropDownMenu = null;
+ }
+ }
+
+ public void add(final IContributionItem item) {
+ this.list.add(item);
+ }
+
+ public void add(final IAction action) {
+ this.list.add(action);
+ }
+
+ public Menu getMenu(final Control parent) {
+ if (this.dropDownMenu == null) {
+ this.dropDownMenu = new Menu(parent);
+ populateMenu();
+ }
+ return this.dropDownMenu;
+ }
+
+ public Menu getMenu(final Menu parent) {
+ if (this.dropDownMenu == null) {
+ this.dropDownMenu = new Menu(parent);
+ populateMenu();
+ }
+ return this.dropDownMenu;
+ }
+
+ private void populateMenu() {
+ for (Object object: list) {
+ if (object instanceof IContributionItem) {
+ final IContributionItem item = (IContributionItem) object;
+ item.fill(this.dropDownMenu, -1);
+ } else {
+ final IAction action = (IAction) object;
+ final ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(this.dropDownMenu, -1);
+ }
+ }
+ final MenuItem[] items = this.dropDownMenu.getItems();
+ for (int i = 0; i < items.length; i++) {
+ items[i].addSelectionListener(this.selectionListener);
+ }
+ }
+
+ public void setAction(final IAction action) {
+ if (this.enabledListener == null) {
+ this.enabledListener = new EnabledPropertyChangeListener(this);
+ }
+ setText(action.getText());
+ setToolTipText(action.getToolTipText());
+ setImageDescriptor(action.getImageDescriptor());
+ setDisabledImageDescriptor(action.getDisabledImageDescriptor());
+ setEnabled(action.isEnabled());
+ setDescription(action.getDescription());
+ setHelpListener(action.getHelpListener());
+ setHoverImageDescriptor(action.getHoverImageDescriptor());
+ if (this.delegate != null) {
+ this.delegate.removePropertyChangeListener(this.enabledListener);
+ }
+ this.delegate = action;
+ this.delegate.addPropertyChangeListener(this.enabledListener);
+ }
+
+ public void run() {
+ this.delegate.run();
+ }
+
+ public static class EnabledPropertyChangeListener implements IPropertyChangeListener {
+ private IAction action;
+
+ public EnabledPropertyChangeListener(final IAction action) {
+ this.action = action;
+ }
+
+ public void propertyChange(final PropertyChangeEvent event) {
+ if (event.getProperty().equals(IAction.ENABLED)) {
+ this.action.setEnabled(((Boolean) event.getNewValue())
+ .booleanValue());
+ }
+ }
+ }
+
+ public static class ItemSelectionListener implements SelectionListener {
+ private DropDownMenuWithDefaultAction dropDownMenu;
+
+ public ItemSelectionListener(
+ final DropDownMenuWithDefaultAction dropDownMenu) {
+ this.dropDownMenu = dropDownMenu;
+ }
+
+ public void widgetDefaultSelected(final SelectionEvent e) {
+ final MenuItem menuItem = (MenuItem) e.getSource();
+ if (menuItem.getData() instanceof ActionContributionItem) {
+ final ActionContributionItem item = (ActionContributionItem) menuItem
+ .getData();
+ this.dropDownMenu.setAction(item.getAction());
+ }
+ }
+
+ public void widgetSelected(final SelectionEvent e) {
+ final MenuItem menuItem = (MenuItem) e.getSource();
+ if (menuItem.getData() instanceof ActionContributionItem) {
+ final ActionContributionItem item = (ActionContributionItem) menuItem
+ .getData();
+ this.dropDownMenu.setAction(item.getAction());
+ }
+ }
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/GenericActionBarContributor.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/GenericActionBarContributor.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/GenericActionBarContributor.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,102 @@
+package org.jboss.tools.flow.editor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.gef.ui.actions.ActionBarContributor;
+import org.eclipse.gef.ui.actions.AlignmentRetargetAction;
+import org.eclipse.gef.ui.actions.DeleteRetargetAction;
+import org.eclipse.gef.ui.actions.GEFActionConstants;
+import org.eclipse.gef.ui.actions.RedoRetargetAction;
+import org.eclipse.gef.ui.actions.UndoRetargetAction;
+import org.eclipse.gef.ui.actions.ZoomComboContributionItem;
+import org.eclipse.gef.ui.actions.ZoomInRetargetAction;
+import org.eclipse.gef.ui.actions.ZoomOutRetargetAction;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.RetargetAction;
+import org.jboss.tools.flow.Activator;
+import org.jboss.tools.flow.editor.action.HorizontalAutoLayoutAction;
+import org.jboss.tools.flow.editor.action.VerticalAutoLayoutAction;
+
+/**
+ * Common implementation of a ActionBarContributor.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class GenericActionBarContributor extends ActionBarContributor {
+
+ protected void buildActions() {
+ addRetargetAction( new UndoRetargetAction() );
+ addRetargetAction( new RedoRetargetAction() );
+ addRetargetAction( new DeleteRetargetAction() );
+
+ addRetargetAction( new ZoomInRetargetAction() );
+ addRetargetAction( new ZoomOutRetargetAction() );
+
+ addRetargetAction( new AlignmentRetargetAction( PositionConstants.LEFT ) );
+ addRetargetAction( new AlignmentRetargetAction( PositionConstants.CENTER ) );
+ addRetargetAction( new AlignmentRetargetAction( PositionConstants.RIGHT ) );
+ addRetargetAction( new AlignmentRetargetAction( PositionConstants.TOP ) );
+ addRetargetAction( new AlignmentRetargetAction( PositionConstants.MIDDLE ) );
+ addRetargetAction( new AlignmentRetargetAction( PositionConstants.BOTTOM ) );
+
+ addRetargetAction( new RetargetAction(
+ GEFActionConstants.TOGGLE_GRID_VISIBILITY, "Grid" ));
+
+ RetargetAction verticalAutoLayoutAction = new RetargetAction(VerticalAutoLayoutAction.ID, null);
+ verticalAutoLayoutAction.setImageDescriptor(
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/layoutV.gif")));
+ addRetargetAction(verticalAutoLayoutAction);
+
+ RetargetAction horizontalAutoLayoutAction = new RetargetAction(HorizontalAutoLayoutAction.ID, null);
+ horizontalAutoLayoutAction.setImageDescriptor(
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/layoutH.gif")));
+ addRetargetAction(horizontalAutoLayoutAction);
+
+ }
+
+ public void contributeToToolBar(IToolBarManager toolBarManager) {
+ toolBarManager.add( getAction( ActionFactory.UNDO.getId() ) );
+ toolBarManager.add( getAction( ActionFactory.REDO.getId() ) );
+ toolBarManager.add( new Separator() );
+ toolBarManager.add( new ZoomComboContributionItem( getPage() ) );
+ toolBarManager.add( new Separator() );
+
+ DropDownMenuWithDefaultAction alignMenu = new DropDownMenuWithDefaultAction( getActionRegistry().getAction( GEFActionConstants.ALIGN_LEFT ) );
+ alignMenu.add( getActionRegistry().getAction( GEFActionConstants.ALIGN_LEFT ) );
+ alignMenu.add( getActionRegistry().getAction( GEFActionConstants.ALIGN_CENTER ) );
+ alignMenu.add( getActionRegistry().getAction( GEFActionConstants.ALIGN_RIGHT ) );
+ alignMenu.add( new Separator() );
+ alignMenu.add( getActionRegistry().getAction( GEFActionConstants.ALIGN_TOP ) );
+ alignMenu.add( getActionRegistry().getAction( GEFActionConstants.ALIGN_MIDDLE ) );
+ alignMenu.add( getActionRegistry().getAction( GEFActionConstants.ALIGN_BOTTOM ) );
+ toolBarManager.add( alignMenu );
+
+ toolBarManager.add( new Separator() );
+ toolBarManager.add( getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY) );
+
+ toolBarManager.add( new Separator());
+ toolBarManager.add( getAction(VerticalAutoLayoutAction.ID));
+ toolBarManager.add( getAction(HorizontalAutoLayoutAction.ID));
+ }
+
+ protected void declareGlobalActionKeys() {
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/GenericContextMenuProvider.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/GenericContextMenuProvider.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/GenericContextMenuProvider.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,61 @@
+package org.jboss.tools.flow.editor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.ContextMenuProvider;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.actions.GEFActionConstants;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.ui.actions.ActionFactory;
+
+/**
+ * Common implementation of a ContextMenuProvider.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class GenericContextMenuProvider extends ContextMenuProvider {
+
+ private ActionRegistry actionRegistry;
+
+ public GenericContextMenuProvider(GraphicalViewer viewer, ActionRegistry registry) {
+ super(viewer);
+ setActionRegistry(registry);
+ }
+
+ public void buildContextMenu(IMenuManager menu) {
+ GEFActionConstants.addStandardActionGroups(menu);
+ IAction action = getActionRegistry().getAction(ActionFactory.UNDO.getId());
+ menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action);
+ action = getActionRegistry().getAction(ActionFactory.REDO.getId());
+ menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action);
+ action = getActionRegistry().getAction(ActionFactory.DELETE.getId());
+ if (action.isEnabled()) {
+ menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
+ }
+ }
+
+ private ActionRegistry getActionRegistry() {
+ return actionRegistry;
+ }
+
+ public void setActionRegistry(ActionRegistry registry) {
+ actionRegistry = registry;
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/GenericModelEditor.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/GenericModelEditor.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/GenericModelEditor.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,374 @@
+package org.jboss.tools.flow.editor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.EventObject;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.SWTGraphics;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.ContextMenuProvider;
+import org.eclipse.gef.DefaultEditDomain;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gef.KeyHandler;
+import org.eclipse.gef.KeyStroke;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.editparts.LayerManager;
+import org.eclipse.gef.editparts.ScalableRootEditPart;
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.actions.AlignmentAction;
+import org.eclipse.gef.ui.actions.DirectEditAction;
+import org.eclipse.gef.ui.actions.GEFActionConstants;
+import org.eclipse.gef.ui.actions.ToggleGridAction;
+import org.eclipse.gef.ui.parts.GraphicalEditorWithPalette;
+import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.ImageLoader;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.SaveAsDialog;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+import org.jboss.tools.flow.Activator;
+import org.jboss.tools.flow.editor.action.HorizontalAutoLayoutAction;
+import org.jboss.tools.flow.editor.action.VerticalAutoLayoutAction;
+
+/**
+ * Abstract implementation of a graphical editor.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class GenericModelEditor extends GraphicalEditorWithPalette {
+
+ private Object model;
+ private boolean savePreviouslyNeeded = false;
+ private KeyHandler sharedKeyHandler;
+ private PaletteRoot root;
+ private OverviewOutlinePage overviewOutlinePage;
+
+ public GenericModelEditor() {
+ setEditDomain(new DefaultEditDomain(this));
+ }
+
+ protected void setModel(Object model) {
+ this.model = model;
+ }
+
+ public Object getModel() {
+ return model;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void createActions() {
+ super.createActions();
+ ActionRegistry registry = getActionRegistry();
+
+ IAction action = new DirectEditAction((IWorkbenchPart) this);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+
+ action = new AlignmentAction((IWorkbenchPart) this,
+ PositionConstants.LEFT);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+
+ action = new AlignmentAction((IWorkbenchPart) this,
+ PositionConstants.CENTER);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+
+ action = new AlignmentAction((IWorkbenchPart) this,
+ PositionConstants.RIGHT);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+
+ action = new AlignmentAction((IWorkbenchPart) this,
+ PositionConstants.TOP);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+
+ action = new AlignmentAction((IWorkbenchPart) this,
+ PositionConstants.MIDDLE);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+
+ action = new AlignmentAction((IWorkbenchPart) this,
+ PositionConstants.BOTTOM);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+ }
+
+ public void commandStackChanged(EventObject event) {
+ if (isDirty()) {
+ if (!savePreviouslyNeeded()) {
+ setSavePreviouslyNeeded(true);
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+ } else {
+ setSavePreviouslyNeeded(false);
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+ super.commandStackChanged(event);
+ }
+
+ protected abstract void writeModel(OutputStream os) throws IOException;
+
+ protected void configureGraphicalViewer() {
+ super.configureGraphicalViewer();
+ getGraphicalViewer().setRootEditPart(new ScalableRootEditPart());
+ getGraphicalViewer().setEditPartFactory(createEditPartFactory());
+ getGraphicalViewer().setKeyHandler(
+ new GraphicalViewerKeyHandler(getGraphicalViewer())
+ .setParent(getCommonKeyHandler()));
+
+ IAction showGrid = new ToggleGridAction(getGraphicalViewer());
+ getActionRegistry().registerAction(showGrid);
+
+ IAction layoutVertically = new VerticalAutoLayoutAction(getGraphicalViewer());
+ getActionRegistry().registerAction(layoutVertically);
+ IAction layoutHorizontally = new HorizontalAutoLayoutAction(getGraphicalViewer());
+ getActionRegistry().registerAction(layoutHorizontally);
+
+
+ ContextMenuProvider provider = new GenericContextMenuProvider(
+ getGraphicalViewer(), getActionRegistry());
+ getGraphicalViewer().setContextMenu(provider);
+ getSite().registerContextMenu("org.jboss.tools.flow.editor.contextmenu",
+ provider, getGraphicalViewer());
+ }
+
+ protected abstract EditPartFactory createEditPartFactory();
+
+ protected void initializeGraphicalViewer() {
+ getGraphicalViewer().setContents(model);
+ }
+
+ public void doSave(IProgressMonitor monitor) {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ writeModel(out);
+ IFile file = ((IFileEditorInput) getEditorInput()).getFile();
+ file.setContents(new ByteArrayInputStream(out.toByteArray()), true,
+ false, monitor);
+ out.close();
+ getCommandStack().markSaveLocation();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void doSaveAs() {
+ SaveAsDialog dialog = new SaveAsDialog(getSite().getWorkbenchWindow()
+ .getShell());
+ dialog.setOriginalFile(((IFileEditorInput) getEditorInput()).getFile());
+ dialog.open();
+ IPath path = dialog.getResult();
+
+ if (path == null) {
+ return;
+ }
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ final IFile file = workspace.getRoot().getFile(path);
+
+ WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+ public void execute(final IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ writeModel(out);
+ file.create(new ByteArrayInputStream(out.toByteArray()),
+ true, monitor);
+ out.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ };
+
+ try {
+ new ProgressMonitorDialog(getSite().getWorkbenchWindow().getShell())
+ .run(false, true, op);
+ setInput(new FileEditorInput(file));
+ getCommandStack().markSaveLocation();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected KeyHandler getCommonKeyHandler() {
+ if (sharedKeyHandler == null) {
+ sharedKeyHandler = new KeyHandler();
+ sharedKeyHandler
+ .put(KeyStroke.getPressed(SWT.DEL, 127, 0),
+ getActionRegistry().getAction(
+ ActionFactory.DELETE.getId()));
+ sharedKeyHandler.put(KeyStroke.getPressed(SWT.F2, 0),
+ getActionRegistry().getAction(
+ GEFActionConstants.DIRECT_EDIT));
+ }
+ return sharedKeyHandler;
+ }
+
+ public boolean isDirty() {
+ return isSaveOnCloseNeeded();
+ }
+
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ public boolean isSaveOnCloseNeeded() {
+ return getCommandStack().isDirty();
+ }
+
+ private boolean savePreviouslyNeeded() {
+ return savePreviouslyNeeded;
+ }
+
+ private void setSavePreviouslyNeeded(boolean value) {
+ savePreviouslyNeeded = value;
+ }
+
+ protected PaletteRoot getPaletteRoot() {
+ if (root == null) {
+ root = createPalette();
+ }
+ return root;
+ }
+
+ protected abstract PaletteRoot createPalette();
+
+ protected void setInput(IEditorInput input) {
+ super.setInput(input);
+
+ IFile file = getFile();
+ setPartName(file.getName());
+ try {
+ InputStream is = file.getContents(false);
+ createModel(is);
+ } catch (Throwable t) {
+ Activator.log(t);
+ }
+ if (getGraphicalViewer() != null) {
+ initializeGraphicalViewer();
+ }
+ }
+
+ public IFile getFile() {
+ return ((IFileEditorInput) getEditorInput()).getFile();
+ }
+
+ public IProject getProject() {
+ IFile file = getFile();
+ if (file != null) {
+ return file.getProject();
+ }
+ return null;
+ }
+
+ protected abstract void createModel(InputStream is);
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class type) {
+ if (type == IContentOutlinePage.class) {
+ return getOverviewOutlinePage();
+ }
+ if (type == ZoomManager.class) {
+ return ((ScalableRootEditPart) getGraphicalViewer()
+ .getRootEditPart()).getZoomManager();
+ }
+ return super.getAdapter(type);
+ }
+
+ protected OverviewOutlinePage getOverviewOutlinePage() {
+ if (null == overviewOutlinePage && null != getGraphicalViewer()) {
+ ScalableRootEditPart rootEditPart = (ScalableRootEditPart) getGraphicalViewer()
+ .getRootEditPart();
+ overviewOutlinePage = new OverviewOutlinePage(rootEditPart);
+ }
+ return overviewOutlinePage;
+ }
+
+ public String getContributorId() {
+ return getSite().getId();
+ }
+
+ /**
+ * Writes the content of this editor to the given stream.
+ * Possible formats are for example SWT.IMAGE_BMP, IMAGE_GIF,
+ * IMAGE_JPEG, IMAGE_PNG.
+ * @param stream
+ * @param format
+ */
+ public void createImage(OutputStream stream, int format) {
+ SWTGraphics g = null;
+ GC gc = null;
+ Image image = null;
+ LayerManager layerManager = (LayerManager)
+ getGraphicalViewer().getEditPartRegistry().get(LayerManager.ID);
+ IFigure figure = layerManager.getLayer(LayerConstants.PRINTABLE_LAYERS);
+ Rectangle r = figure.getBounds();
+ try {
+ image = new Image(Display.getDefault(), r.width, r.height);
+ gc = new GC(image);
+ g = new SWTGraphics(gc);
+ g.translate(r.x * -1, r.y * -1);
+ figure.paint(g);
+ ImageLoader imageLoader = new ImageLoader();
+ imageLoader.data = new ImageData[] { image.getImageData() };
+ imageLoader.save(stream, format);
+ } catch (Throwable t) {
+ Activator.log(t);
+ } finally {
+ if (g != null) {
+ g.dispose();
+ }
+ if (gc != null) {
+ gc.dispose();
+ }
+ if (image != null) {
+ image.dispose();
+ }
+ }
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/OverviewOutlinePage.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/OverviewOutlinePage.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/OverviewOutlinePage.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,91 @@
+package org.jboss.tools.flow.editor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.LightweightSystem;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.Viewport;
+import org.eclipse.draw2d.parts.ScrollableThumbnail;
+import org.eclipse.draw2d.parts.Thumbnail;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.editparts.ScalableRootEditPart;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.part.Page;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+/**
+ * Common implementation of an outline page.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class OverviewOutlinePage extends Page implements IContentOutlinePage {
+
+ private Canvas overview;
+ private ScalableRootEditPart rootEditPart;
+ private Thumbnail thumbnail;
+
+ public OverviewOutlinePage(ScalableRootEditPart rootEditPart) {
+ this.rootEditPart = rootEditPart;
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ }
+
+ public void createControl(Composite parent) {
+ overview = new Canvas(parent, SWT.NONE);
+ LightweightSystem lws = new LightweightSystem(overview);
+ thumbnail = new ScrollableThumbnail((Viewport) rootEditPart.getFigure());
+ thumbnail.setBorder(new MarginBorder(3));
+ thumbnail.setSource(rootEditPart
+ .getLayer(LayerConstants.PRINTABLE_LAYERS));
+ lws.setContents(thumbnail);
+ }
+
+ public void dispose() {
+ if (null != thumbnail) {
+ thumbnail.deactivate();
+ }
+ super.dispose();
+ }
+
+ public Control getControl() {
+ return overview;
+ }
+
+ public ISelection getSelection() {
+ return StructuredSelection.EMPTY;
+ }
+
+ public void removeSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ }
+
+ public void setFocus() {
+ if (getControl() != null) {
+ getControl().setFocus();
+ }
+ }
+
+ public void setSelection(ISelection selection) {
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/PaletteFactory.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/PaletteFactory.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/PaletteFactory.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,76 @@
+package org.jboss.tools.flow.editor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.palette.MarqueeToolEntry;
+import org.eclipse.gef.palette.PaletteContainer;
+import org.eclipse.gef.palette.PaletteDrawer;
+import org.eclipse.gef.palette.PaletteEntry;
+import org.eclipse.gef.palette.PaletteGroup;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.palette.SelectionToolEntry;
+import org.eclipse.gef.palette.ToolEntry;
+
+/**
+ * Factory for creating a RuleFlow palette.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class PaletteFactory {
+
+ public PaletteRoot createPalette() {
+ PaletteRoot palette = new PaletteRoot();
+ palette.addAll(createCategories(palette));
+ return palette;
+ }
+
+ protected List<PaletteContainer> createCategories(PaletteRoot root) {
+ List<PaletteContainer> categories = new ArrayList<PaletteContainer>();
+ categories.add(createControlGroup(root));
+ categories.add(createComponentsDrawer());
+ return categories;
+ }
+
+ protected PaletteContainer createControlGroup(PaletteRoot root) {
+ PaletteGroup controlGroup = new PaletteGroup("Control Group");
+
+ List<PaletteEntry> entries = new ArrayList<PaletteEntry>();
+
+ ToolEntry tool = new SelectionToolEntry();
+ entries.add(tool);
+ root.setDefaultEntry(tool);
+
+ tool = new MarqueeToolEntry();
+ entries.add(tool);
+
+ controlGroup.addAll(entries);
+ return controlGroup;
+ }
+
+ protected PaletteContainer createComponentsDrawer() {
+ PaletteDrawer drawer = new PaletteDrawer("Components", null);
+ List<PaletteEntry> entries = createComponentEntries();
+ drawer.addAll(entries);
+ return drawer;
+ }
+
+ protected abstract List<PaletteEntry> createComponentEntries();
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/action/HorizontalAutoLayoutAction.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/action/HorizontalAutoLayoutAction.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/action/HorizontalAutoLayoutAction.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,56 @@
+package org.jboss.tools.flow.editor.action;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Map;
+
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.graph.DirectedGraph;
+import org.eclipse.draw2d.graph.Node;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.jboss.tools.flow.Activator;
+
+/**
+ * Action for auto layouting a process.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class HorizontalAutoLayoutAction extends VerticalAutoLayoutAction {
+
+ public static final String ID = "org.jboss.tools.process.editor.action.HorizontalAutoLayoutAction";
+
+ public HorizontalAutoLayoutAction(GraphicalViewer diagramViewer) {
+ super(diagramViewer);
+ }
+
+ protected void initialize() {
+ setId(ID);
+ setText("Auto Layout (Horizontal)");
+ setImageDescriptor(
+ ImageDescriptor.createFromURL(
+ Activator.getDefault().getBundle().getEntry("icons/layoutH.gif")));
+ setToolTipText("Auto layout the process (horizontal)");
+ }
+
+ protected DirectedGraph createDirectedGraph(Map<String, Node> mapping) {
+ DirectedGraph graph = super.createDirectedGraph(mapping);
+ graph.setDirection(PositionConstants.HORIZONTAL);
+ return graph;
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/action/VerticalAutoLayoutAction.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/action/VerticalAutoLayoutAction.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/action/VerticalAutoLayoutAction.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,103 @@
+package org.jboss.tools.flow.editor.action;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.draw2d.graph.DirectedGraph;
+import org.eclipse.draw2d.graph.DirectedGraphLayout;
+import org.eclipse.draw2d.graph.Edge;
+import org.eclipse.draw2d.graph.Node;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.jboss.tools.flow.Activator;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.AbstractFlowWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * Action for auto layouting a process.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class VerticalAutoLayoutAction extends Action implements IAction {
+
+ public static final String ID = "org.jboss.tools.process.editor.action.VerticalAutoLayoutAction";
+
+ private GraphicalViewer diagramViewer;
+
+ public VerticalAutoLayoutAction(GraphicalViewer diagramViewer) {
+ this.diagramViewer = diagramViewer;
+ initialize();
+ }
+
+ protected void initialize() {
+ setId(ID);
+ setText("Auto Layout (Vertical)");
+ setImageDescriptor(
+ ImageDescriptor.createFromURL(
+ Activator.getDefault().getBundle().getEntry("icons/layoutV.gif")));
+ setToolTipText("Auto layout the process (vertical)");
+ }
+
+ public void run() {
+ Map<String, Node> mapping = new HashMap<String, Node>();
+ DirectedGraph graph = createDirectedGraph(mapping);
+ DirectedGraphLayout layout = new DirectedGraphLayout();
+ layout.visit(graph);
+ for (Map.Entry<String, Node> entry: mapping.entrySet()) {
+ Node node = entry.getValue();
+ NodeWrapper nodeWrapper =
+ ((AbstractFlowWrapper)diagramViewer.getContents().getModel()).getElement(entry.getKey());
+ nodeWrapper.setConstraint(new Rectangle(node.x, node.y, node.width, node.height));
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected DirectedGraph createDirectedGraph(Map<String, Node> mapping) {
+ DirectedGraph graph = new DirectedGraph();
+ AbstractFlowWrapper processWrapper = (AbstractFlowWrapper)diagramViewer.getContents().getModel();
+ for (NodeWrapper elementWrapper: processWrapper.getElements()) {
+ Node node = new Node();
+ Integer width = (Integer) elementWrapper.getConstraint().width;
+ Integer height = (Integer) elementWrapper.getConstraint().height;
+ if (width == null || width <= 0) {
+ width = 80;
+ }
+ if (height == null || height <= 0) {
+ height = 40;
+ }
+ node.setSize(new Dimension(width, height));
+ graph.nodes.add(node);
+ mapping.put(elementWrapper.getId(), node);
+ }
+ for (NodeWrapper elementWrapper: processWrapper.getElements()) {
+ for (AbstractConnectionWrapper connection: elementWrapper.getIncomingConnections()) {
+ Node source = mapping.get(connection.getSource().getId());
+ Node target = mapping.get(connection.getTarget().getId());
+ graph.edges.add(new Edge(source, target));
+ }
+ }
+ return graph;
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/AddElementCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/AddElementCommand.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/AddElementCommand.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,63 @@
+package org.jboss.tools.flow.editor.command;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.flow.editor.core.ContainerWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * A command for adding an element.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class AddElementCommand extends Command {
+
+ private NodeWrapper child;
+ private ContainerWrapper parent;
+
+ public void execute() {
+ parent.addElement(child);
+ child.setParent(parent);
+ }
+
+ protected ContainerWrapper getParent() {
+ return parent;
+ }
+
+ protected NodeWrapper getChild() {
+ return child;
+ }
+
+ public void setChild(NodeWrapper newChild) {
+ child = newChild;
+ }
+
+ public void setParent(ContainerWrapper newParent) {
+ parent = newParent;
+ }
+
+ public void undo() {
+ parent.removeElement(child);
+ child.setParent(null);
+ }
+
+ public boolean canExecute() {
+ return parent.acceptsElement(child);
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ChangeConstraintCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ChangeConstraintCommand.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ChangeConstraintCommand.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,50 @@
+package org.jboss.tools.flow.editor.command;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * A command for changing a constraint.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ChangeConstraintCommand extends Command {
+
+ private NodeWrapper element;
+ private Rectangle constraint;
+ private Rectangle oldConstraint;
+
+ public void execute() {
+ element.setConstraint(constraint);
+ }
+
+ public void setConstraint(Rectangle rect) {
+ constraint = rect;
+ }
+
+ public void setElement(NodeWrapper element) {
+ this.element = element;
+ oldConstraint = element.getConstraint();
+ }
+
+ public void undo() {
+ element.setConstraint(oldConstraint);
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/CreateBendpointCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/CreateBendpointCommand.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/CreateBendpointCommand.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,53 @@
+package org.jboss.tools.flow.editor.command;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+
+/**
+ * A command for creating a bendpoint.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class CreateBendpointCommand extends Command {
+
+ private AbstractConnectionWrapper connection;
+ private Point location;
+ private int index;
+
+ public void execute() {
+ connection.addBendpoint(index, location);
+ }
+
+ public void setConnection(Object model) {
+ connection = (AbstractConnectionWrapper) model;
+ }
+
+ public void setIndex(int i) {
+ index = i;
+ }
+
+ public void setLocation(Point point) {
+ location = point;
+ }
+
+ public void undo() {
+ connection.removeBendpoint(index);
+ }
+}
\ No newline at end of file
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/DeleteBendpointCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/DeleteBendpointCommand.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/DeleteBendpointCommand.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,51 @@
+package org.jboss.tools.flow.editor.command;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+
+
+/**
+ * A command for deleting a bendpoint.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class DeleteBendpointCommand extends Command {
+
+ private AbstractConnectionWrapper connection;
+ private Point oldLocation;
+ private int index;
+
+ public void execute() {
+ oldLocation = (Point) connection.getBendpoints().get(index);
+ connection.removeBendpoint(index);
+ }
+
+ public void setConnectionModel(Object model) {
+ connection = (AbstractConnectionWrapper) model;
+ }
+
+ public void setIndex(int i) {
+ index = i;
+ }
+
+ public void undo() {
+ connection.addBendpoint(index, oldLocation);
+ }
+}
\ No newline at end of file
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/DeleteConnectionCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/DeleteConnectionCommand.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/DeleteConnectionCommand.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,53 @@
+package org.jboss.tools.flow.editor.command;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * A command for deleting a connection.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class DeleteConnectionCommand extends Command {
+
+ private NodeWrapper source;
+ private NodeWrapper target;
+ private AbstractConnectionWrapper connection;
+
+ public void execute() {
+ connection.disconnect();
+ }
+
+ public void setSource(NodeWrapper action) {
+ source = action;
+ }
+
+ public void setTarget(NodeWrapper action) {
+ target = action;
+ }
+
+ public void setAntecedentTaskConnection(AbstractConnectionWrapper connection) {
+ this.connection = connection;
+ }
+
+ public void undo() {
+ connection.connect(source, target);
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/DeleteElementCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/DeleteElementCommand.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/DeleteElementCommand.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,95 @@
+package org.jboss.tools.flow.editor.command;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.ContainerWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * A command for deleting an element.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class DeleteElementCommand extends Command {
+
+ private NodeWrapper child;
+ private ContainerWrapper parent;
+
+ private List<NodeWrapper> incomingElementWrappers = new ArrayList<NodeWrapper>();
+ private List<NodeWrapper> outgoingElementWrappers = new ArrayList<NodeWrapper>();
+ private List<AbstractConnectionWrapper> incomingConnections = new ArrayList<AbstractConnectionWrapper>();
+ private List<AbstractConnectionWrapper> outgoingConnections = new ArrayList<AbstractConnectionWrapper>();
+
+
+ private void deleteConnections(NodeWrapper element) {
+ for (AbstractConnectionWrapper connection: element.getIncomingConnections()) {
+ incomingElementWrappers.add(connection.getSource());
+ incomingConnections.add(connection);
+ }
+ for (AbstractConnectionWrapper connection: element.getOutgoingConnections()) {
+ outgoingElementWrappers.add(connection.getTarget());
+ outgoingConnections.add(connection);
+ }
+ for (AbstractConnectionWrapper connection: incomingConnections) {
+ connection.disconnect();
+ }
+ for (AbstractConnectionWrapper connection: outgoingConnections) {
+ connection.disconnect();
+ }
+ }
+
+ public void execute() {
+ deleteConnections(child);
+ parent.removeElement(child);
+ }
+
+ private void restoreConnections() {
+ int i = 0;
+ for (AbstractConnectionWrapper connection: incomingConnections) {
+ connection.connect((NodeWrapper) incomingElementWrappers.get(i), child);
+ i++;
+ }
+ i = 0;
+ for (AbstractConnectionWrapper connection: outgoingConnections) {
+ connection.connect(child, (NodeWrapper) outgoingElementWrappers.get(i));
+ i++;
+ }
+ incomingConnections.clear();
+ incomingElementWrappers.clear();
+ outgoingConnections.clear();
+ outgoingElementWrappers.clear();
+ }
+
+ public void setChild(NodeWrapper child) {
+ this.child = child;
+ }
+
+ public void setParent(ContainerWrapper parent) {
+ this.parent = parent;
+ }
+
+ public void undo() {
+ parent.addElement(child);
+ restoreConnections();
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ElementConnectionCreateCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ElementConnectionCreateCommand.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ElementConnectionCreateCommand.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,80 @@
+package org.jboss.tools.flow.editor.command;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * A command for creating an element.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ElementConnectionCreateCommand extends Command {
+
+ private AbstractConnectionWrapper connection;
+ private NodeWrapper source;
+ private NodeWrapper target;
+
+ public boolean canExecute() {
+ if (source.equals(target)) {
+ return false;
+ }
+ // Check for existence of connection already
+ for (AbstractConnectionWrapper connection: source.getOutgoingConnections()) {
+ if (connection.getTarget().equals(target)) {
+ return false;
+ }
+ }
+ return source.acceptsOutgoingConnection(connection, target)
+ && target != null && target.acceptsIncomingConnection(connection, source);
+ }
+
+ public void execute() {
+ connection.connect(source, target);
+ }
+
+ public NodeWrapper getSource() {
+ return source;
+ }
+
+ public NodeWrapper getTarget() {
+ return target;
+ }
+
+ public void redo() {
+ connection.connect(source, target);
+ }
+
+ public void setSource(NodeWrapper source) {
+ this.source = source;
+ }
+
+ public void setConnection(AbstractConnectionWrapper connection) {
+ this.connection = connection;
+ }
+
+ public void setTarget(NodeWrapper target) {
+ this.target = target;
+ }
+
+ public void undo() {
+ connection.disconnect();
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/MoveBendpointCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/MoveBendpointCommand.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/MoveBendpointCommand.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,54 @@
+package org.jboss.tools.flow.editor.command;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+
+/**
+ * A command for moving a bendpoint.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class MoveBendpointCommand extends Command {
+
+ private AbstractConnectionWrapper connection;
+ private Point oldLocation, newLocation;
+ private int index;
+
+ public void execute() {
+ oldLocation = (Point) connection.getBendpoints().get(index);
+ connection.replaceBendpoint(index, newLocation);
+ }
+
+ public void setConnectionModel(Object model) {
+ connection = (AbstractConnectionWrapper) model;
+ }
+
+ public void setIndex(int i) {
+ index = i;
+ }
+
+ public void setNewLocation(Point point) {
+ newLocation = point;
+ }
+
+ public void undo() {
+ connection.replaceBendpoint(index, oldLocation);
+ }
+}
\ No newline at end of file
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ReconnectElementConnectionSourceCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ReconnectElementConnectionSourceCommand.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ReconnectElementConnectionSourceCommand.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,73 @@
+package org.jboss.tools.flow.editor.command;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * A command for reconnecting the source of a connection.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ReconnectElementConnectionSourceCommand extends Command {
+
+ private AbstractConnectionWrapper connection;
+ private NodeWrapper target;
+ private NodeWrapper oldSource;
+ private NodeWrapper newSource;
+
+ public boolean canExecute() {
+ if (connection.getTarget().equals(newSource)) {
+ return false;
+ }
+ for (AbstractConnectionWrapper connection: newSource.getOutgoingConnections()) {
+ if (connection.getTarget().equals(target) && !connection.getSource().equals(oldSource)) {
+ return false;
+ }
+ }
+ return newSource.acceptsOutgoingConnection(connection, target); //XXX
+ }
+
+ public void execute() {
+ if (newSource != null) {
+ connection.disconnect();
+ connection.connect(newSource, target);
+ }
+ }
+
+ public void setSource(NodeWrapper source) {
+ this.newSource = source;
+ }
+
+ public void setConnection(AbstractConnectionWrapper connection) {
+ this.connection = connection;
+ this.target = connection.getTarget();
+ this.oldSource = connection.getSource();
+ }
+
+ public void undo() {
+ connection.disconnect();
+ connection.connect(oldSource, target);
+ }
+
+ public void redo() {
+ connection.disconnect();
+ connection.connect(newSource, target);
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ReconnectElementConnectionTargetCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ReconnectElementConnectionTargetCommand.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/ReconnectElementConnectionTargetCommand.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,74 @@
+package org.jboss.tools.flow.editor.command;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * A command for reconnecting the target of a connection.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ReconnectElementConnectionTargetCommand extends Command {
+
+ private AbstractConnectionWrapper connection;
+ private NodeWrapper oldTarget;
+ private NodeWrapper newTarget;
+ private NodeWrapper source;
+
+
+ public boolean canExecute() {
+ if (connection.getSource().equals(newTarget)) {
+ return false;
+ }
+ for (AbstractConnectionWrapper connection: newTarget.getIncomingConnections()) {
+ if (connection.getSource().equals(source) && !connection.getTarget().equals(oldTarget)) {
+ return false;
+ }
+ }
+ return newTarget.acceptsIncomingConnection(connection, source);
+ }
+
+ public void execute() {
+ if (newTarget != null) {
+ connection.disconnect();
+ connection.connect(source, newTarget);
+ }
+ }
+
+ public void setTarget(NodeWrapper target) {
+ this.newTarget = target;
+ }
+
+ public void setConnection(AbstractConnectionWrapper connection) {
+ this.connection = connection;
+ this.source = connection.getSource();
+ this.oldTarget = connection.getTarget();
+ }
+
+ public void undo() {
+ connection.disconnect();
+ connection.connect(source, oldTarget);
+ }
+
+ public void redo() {
+ connection.disconnect();
+ connection.connect(source, newTarget);
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/RenameElementCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/RenameElementCommand.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/RenameElementCommand.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,52 @@
+package org.jboss.tools.flow.editor.command;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * A command for renaming an element.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class RenameElementCommand extends Command {
+
+ private NodeWrapper source;
+ private String name;
+ private String oldName;
+
+ public void execute() {
+ source.setName(name);
+ }
+
+ public void setName(String string) {
+ name = string;
+ }
+
+ public void setOldName(String string) {
+ oldName = string;
+ }
+
+ public void setSource(NodeWrapper action) {
+ source = action;
+ }
+
+ public void undo() {
+ source.setName(oldName);
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/SplitConnectionCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/SplitConnectionCommand.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/command/SplitConnectionCommand.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,94 @@
+package org.jboss.tools.flow.editor.command;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.AbstractFlowWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * A command for splitting a connection.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class SplitConnectionCommand extends Command {
+
+ private AbstractFlowWrapper parent;
+ private NodeWrapper oldSource;
+ private NodeWrapper oldTarget;
+ private AbstractConnectionWrapper oldConnection;
+ private AbstractConnectionWrapper secondConnection;
+ private NodeWrapper newElement;
+
+ public void setNewSecondConnection(AbstractConnectionWrapper connection) {
+ if (connection == null) {
+ throw new IllegalArgumentException("new second connection cannot be null");
+ }
+ this.secondConnection = connection;
+ }
+
+ public void execute() {
+ if (secondConnection == null) {
+ throw new IllegalStateException("new second connection is still null");
+ }
+ oldConnection.disconnect();
+ parent.addElement(newElement);
+ newElement.setParent(parent);
+ oldConnection.connect(oldSource, newElement);
+ secondConnection.connect(newElement, oldTarget);
+ }
+
+ public void setParent(AbstractFlowWrapper process) {
+ if (process == null) {
+ throw new IllegalArgumentException("process is null");
+ }
+ parent = process;
+ }
+
+ public void setElementConnection(AbstractConnectionWrapper connection) {
+ if (connection == null) {
+ throw new IllegalArgumentException("Element connection is null");
+ }
+ this.oldConnection = connection;
+ oldSource = connection.getSource();
+ oldTarget = connection.getTarget();
+ }
+
+ public void setNewElement(NodeWrapper newElement) {
+ if (newElement == null) {
+ throw new IllegalArgumentException("NewElement is null");
+ }
+ this.newElement = newElement;
+
+ }
+
+ public void undo() {
+ oldConnection.disconnect();
+ secondConnection.disconnect();
+ parent.removeElement(newElement);
+ newElement.setParent(null);
+ oldConnection.connect(oldSource, oldTarget);
+ }
+
+ public boolean canExecute() {
+ return parent.acceptsElement(newElement) &&
+ newElement.acceptsIncomingConnection(oldConnection, oldSource) &&
+ newElement.acceptsOutgoingConnection(secondConnection, oldTarget);
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractConnectionWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractConnectionWrapper.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractConnectionWrapper.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,147 @@
+package org.jboss.tools.flow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Point;
+
+/**
+ * A connection between two model elements.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class AbstractConnectionWrapper extends AbstractWrapper implements ConnectionWrapper {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final int CHANGE_BENDPOINTS = 1;
+
+ private Object element;
+ private NodeWrapper source;
+ private NodeWrapper target;
+ private transient List<Point> bendpoints = new ArrayList<Point>();
+ private transient List<ModelListener> listeners = new ArrayList<ModelListener>();
+
+ public void setElement(Object element) {
+ this.element = element;
+ }
+
+ public Object getElement() {
+ return element;
+ }
+
+ public void localSetSource(NodeWrapper source) {
+ this.source = source;
+ }
+
+ public void localSetTarget(NodeWrapper target) {
+ this.target = target;
+ }
+
+ public void disconnect() {
+ if (source == null) {
+ throw new IllegalStateException("Can't disconnect, source is null");
+ }
+ if (target == null) {
+ throw new IllegalStateException("Can't disconnect, target is null");
+ }
+ source.removeOutgoingConnection(this);
+ target.removeIncomingConnection(this);
+ source = null;
+ target = null;
+ }
+
+ public void connect(NodeWrapper source, NodeWrapper target) {
+ if (source == null) {
+ throw new IllegalArgumentException("source is null");
+ }
+ if (this.source != null) {
+ throw new IllegalStateException("The source of a connection cannot be changed");
+ }
+ if (target == null) {
+ throw new IllegalArgumentException("target is null");
+ }
+ if (this.target != null) {
+ throw new IllegalStateException("The target of a connection cannot be changed");
+ }
+ this.source = source;
+ this.target = target;
+ source.addOutgoingConnection(this);
+ target.addIncomingConnection(this);
+ }
+
+
+ public NodeWrapper getSource() {
+ return source;
+ }
+
+ public NodeWrapper getTarget() {
+ return target;
+ }
+
+ public void addBendpoint(int index, Point point) {
+ bendpoints.add(index, point);
+ internalSetBendpoints(bendpoints);
+ notifyListeners(CHANGE_BENDPOINTS);
+ }
+
+ public void removeBendpoint(int index) {
+ bendpoints.remove(index);
+ internalSetBendpoints(bendpoints);
+ notifyListeners(CHANGE_BENDPOINTS);
+ }
+
+ public void replaceBendpoint(int index, Point point) {
+ bendpoints.set(index, point);
+ internalSetBendpoints(bendpoints);
+ notifyListeners(CHANGE_BENDPOINTS);
+ }
+
+ protected void internalSetBendpoints(List<Point> bendPoints) {
+ }
+
+ public void localSetBendpoints(List<Point> bendpoints) {
+ this.bendpoints = bendpoints;
+ }
+
+ public List<Point> getBendpoints() {
+ if (bendpoints == null) {
+ bendpoints = internalGetBendpoints();
+ }
+ return bendpoints;
+ }
+
+ protected abstract List<Point> internalGetBendpoints();
+
+ 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);
+ }
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractContainerWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractContainerWrapper.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractContainerWrapper.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,71 @@
+package org.jboss.tools.flow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class AbstractContainerWrapper extends AbstractNodeWrapper implements ContainerWrapper {
+
+ public static final int CHANGE_ELEMENTS = 4;
+
+ List<NodeWrapper> elements = new ArrayList<NodeWrapper>();
+
+ public void addElement(NodeWrapper element) {
+ internalAddElement(element);
+ localAddElement(element);
+ notifyListeners(CHANGE_ELEMENTS);
+ }
+
+ public void localAddElement(NodeWrapper element) {
+ elements.add(element);
+ }
+
+ protected abstract void internalAddElement(NodeWrapper element);
+
+ public void removeElement(NodeWrapper element) {
+ internalRemoveElement(element);
+ elements.remove(element);
+ element.setParent(null);
+ notifyListeners(CHANGE_ELEMENTS);
+ }
+
+ protected abstract void internalRemoveElement(NodeWrapper element);
+
+ public List<NodeWrapper> getElements() {
+ return elements;
+ }
+
+ public AbstractFlowWrapper getFlowWrapper() {
+ return getParent().getFlowWrapper();
+ }
+
+ public boolean acceptsElement(NodeWrapper element) {
+ return true;
+ }
+
+ public boolean acceptsIncomingConnection(
+ ConnectionWrapper connection, NodeWrapper source) {
+ return true;
+ }
+
+ public boolean acceptsOutgoingConnection(
+ ConnectionWrapper connection, NodeWrapper target) {
+ return true;
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractFlowWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractFlowWrapper.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractFlowWrapper.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,105 @@
+package org.jboss.tools.flow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A wrapper for a process element.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class AbstractFlowWrapper extends AbstractWrapper implements ContainerWrapper {
+
+ public static final int CHANGE_ELEMENTS = 1;
+ public static final int CHANGE_VISUAL = 2;
+
+ public static final Integer ROUTER_LAYOUT_MANUAL = new Integer(0);
+ public static final Integer ROUTER_LAYOUT_MANHATTAN = new Integer(1);
+ public static final Integer ROUTER_LAYOUT_SHORTEST_PATH = new Integer(2);
+
+ private Map<String, NodeWrapper> elements = new HashMap<String, NodeWrapper>();
+ private transient List<ModelListener> listeners = new ArrayList<ModelListener>();
+
+ public abstract Integer getRouterLayout();
+
+ public void setRouterLayout(Integer routerLayout) {
+ internalSetRouterLayout(routerLayout);
+ notifyListeners(CHANGE_VISUAL);
+ }
+
+ protected void internalSetRouterLayout(Integer routerLayout) {
+ }
+
+ public List<NodeWrapper> getElements() {
+ return Collections.unmodifiableList(
+ new ArrayList<NodeWrapper>(elements.values()));
+ }
+
+ public NodeWrapper getElement(String id) {
+ return (NodeWrapper) elements.get(id);
+ }
+
+ public void addElement(NodeWrapper element) {
+ if (!acceptsElement(element)) return;
+ internalAddElement(element);
+ localAddElement(element);
+ notifyListeners(CHANGE_ELEMENTS);
+ }
+
+ public void localAddElement(NodeWrapper element) {
+ elements.put(element.getId(), element);
+ }
+
+ public boolean acceptsElement(NodeWrapper element) {
+ return true;
+ }
+
+ protected abstract void internalAddElement(NodeWrapper element);
+
+ public void removeElement(NodeWrapper element) {
+ elements.remove(element.getId());
+ notifyListeners(CHANGE_ELEMENTS);
+ internalRemoveElement(element);
+ }
+
+ protected abstract void internalRemoveElement(NodeWrapper element);
+
+ public AbstractFlowWrapper getFlowWrapper() {
+ return this;
+ }
+
+ public void addListener(ModelListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeListener(ModelListener listener) {
+ listeners.remove(listener);
+ }
+
+ public void notifyListeners(int change) {
+ ModelEvent event = new ModelEvent(change);
+ for (ModelListener listener: listeners) {
+ listener.modelChanged(event);
+ }
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractNodeWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractNodeWrapper.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractNodeWrapper.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,149 @@
+package org.jboss.tools.flow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
+
+/**
+ * Default wrapper of a model element.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class AbstractNodeWrapper extends AbstractWrapper implements NodeWrapper {
+
+ protected static IPropertyDescriptor[] descriptors;
+
+ public static final String NAME = "Name";
+ static {
+ descriptors = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(NAME, "Name"),
+ };
+ }
+
+ private ContainerWrapper parent;
+ private transient Rectangle constraint;
+ private List<AbstractConnectionWrapper> incomingConnections = new ArrayList<AbstractConnectionWrapper>();
+ private List<AbstractConnectionWrapper> outgoingConnections = new ArrayList<AbstractConnectionWrapper>();
+ private transient List<ModelListener> listeners = new ArrayList<ModelListener>();
+
+ public void setConstraint(Rectangle constraint) {
+ this.constraint = constraint;
+ internalSetConstraint(constraint);
+ notifyListeners(CHANGE_VISUAL);
+ }
+
+ protected abstract void internalSetConstraint(Rectangle constraint);
+
+ public Rectangle getConstraint() {
+ if (constraint == null) {
+ constraint = internalGetConstraint();
+ }
+ return constraint;
+ }
+
+ protected abstract Rectangle internalGetConstraint();
+
+ public void setParent(ContainerWrapper parent) {
+ this.parent = parent;
+ }
+
+ public ContainerWrapper getParent() {
+ return parent;
+ }
+
+ public List<AbstractConnectionWrapper> getOutgoingConnections() {
+ return Collections.unmodifiableList(outgoingConnections);
+ }
+
+ public List<AbstractConnectionWrapper> getIncomingConnections() {
+ return Collections.unmodifiableList(incomingConnections);
+ }
+
+ public void addIncomingConnection(AbstractConnectionWrapper connection) {
+ localAddIncomingConnection(connection);
+ internalAddIncomingConnection(connection);
+ notifyListeners(CHANGE_INCOMING_CONNECTIONS);
+ }
+
+ public void localAddIncomingConnection(AbstractConnectionWrapper connection) {
+ incomingConnections.add(connection);
+ }
+
+ protected void internalAddIncomingConnection(AbstractConnectionWrapper connection) {
+ }
+
+ public void removeIncomingConnection(AbstractConnectionWrapper connection) {
+ incomingConnections.remove(connection);
+ internalRemoveIncomingConnection(connection);
+ notifyListeners(CHANGE_INCOMING_CONNECTIONS);
+ }
+
+ protected void internalRemoveIncomingConnection(AbstractConnectionWrapper connection) {
+ }
+
+ public void addOutgoingConnection(AbstractConnectionWrapper connection) {
+ localAddOutgoingConnection(connection);
+ internalAddOutgoingConnection(connection);
+ notifyListeners(CHANGE_OUTGOING_CONNECTIONS);
+ }
+
+ public void localAddOutgoingConnection(AbstractConnectionWrapper connection) {
+ outgoingConnections.add(connection);
+ }
+
+ protected void internalAddOutgoingConnection(AbstractConnectionWrapper connection) {
+ }
+
+ public void removeOutgoingConnection(AbstractConnectionWrapper connection) {
+ outgoingConnections.remove(connection);
+ internalRemoveOutgoingConnection(connection);
+ notifyListeners(CHANGE_OUTGOING_CONNECTIONS);
+ }
+
+ protected void internalRemoveOutgoingConnection(AbstractConnectionWrapper connection) {
+ }
+
+ public void setName(String name) {
+ internalSetName(name);
+ notifyListeners(CHANGE_VISUAL);
+ }
+
+ protected void internalSetName(String name) {
+ }
+
+ 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);
+ }
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractWrapper.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/AbstractWrapper.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,15 @@
+package org.jboss.tools.flow.editor.core;
+
+public abstract class AbstractWrapper implements Wrapper {
+
+ private Object element;
+
+ public void setElement(Object element) {
+ this.element = element;
+ }
+
+ public Object getElement() {
+ return element;
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ConnectionWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ConnectionWrapper.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ConnectionWrapper.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,5 @@
+package org.jboss.tools.flow.editor.core;
+
+public interface ConnectionWrapper extends Wrapper {
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ContainerWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ContainerWrapper.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ContainerWrapper.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,35 @@
+package org.jboss.tools.flow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+
+public interface ContainerWrapper extends Wrapper {
+
+ void addElement(NodeWrapper element);
+
+ void localAddElement(NodeWrapper element);
+
+ void removeElement(NodeWrapper element);
+
+ List<NodeWrapper> getElements();
+
+ AbstractFlowWrapper getFlowWrapper();
+
+ boolean acceptsElement(NodeWrapper element);
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultConnectionWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultConnectionWrapper.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultConnectionWrapper.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,65 @@
+package org.jboss.tools.flow.editor.core;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.DefaultConnection;
+import org.jboss.tools.flow.common.model.Node;
+
+
+public class DefaultConnectionWrapper extends AbstractConnectionWrapper {
+
+ public Connection getConnection() {
+ return (Connection)getElement();
+ }
+
+ protected List<Point> internalGetBendpoints() {
+ return (List<Point>) stringToBendpoints((String) getConnection().getMetaData("bendpoints"));
+ }
+
+ protected void internalSetBendpoints(List<Point> bendpoints) {
+ getConnection().setMetaData("bendpoints", bendpointsToString(bendpoints));
+ }
+
+ private String bendpointsToString(List<Point> bendpoints) {
+ if (bendpoints == null) {
+ return null;
+ }
+ String result = "[";
+ for (Iterator<Point> iterator = bendpoints.iterator(); iterator.hasNext(); ) {
+ Point point = iterator.next();
+ result += point.x + "," + point.y + (iterator.hasNext() ? ";" : "");
+ }
+ result += "]";
+ return result;
+ }
+
+ private List<Point> stringToBendpoints(String s) {
+ List<Point> result = new ArrayList<Point>();
+ if (s == null) {
+ return result;
+ }
+ s = s.substring(1, s.length() - 1);
+ String[] bendpoints = s.split(";");
+ for (String bendpoint: bendpoints) {
+ String[] xy = bendpoint.split(",");
+ result.add(new Point(new Integer(xy[0]), new Integer(xy[1])));
+ }
+ return result;
+ }
+
+
+ public void connect(NodeWrapper source, NodeWrapper target) {
+ super.connect(source, target);
+ Node from = (Node)getSource().getElement();
+ Node to = (Node)getTarget().getElement();
+ setElement(createConnection(from, to));
+ }
+
+ protected Connection createConnection(Node from, Node to) {
+ return new DefaultConnection(from, to);
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultContainerWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultContainerWrapper.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultContainerWrapper.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,108 @@
+package org.jboss.tools.flow.editor.core;
+
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Container;
+import org.jboss.tools.flow.common.model.Flow;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.editor.strategy.AcceptsIncomingConnectionStrategy;
+import org.jboss.tools.flow.editor.strategy.AcceptsOutgoingConnectionStrategy;
+
+public class DefaultContainerWrapper extends AbstractContainerWrapper {
+
+ private AcceptsIncomingConnectionStrategy incomingConnectionStrategy;
+ private AcceptsOutgoingConnectionStrategy outgoingConnectionStrategy;
+
+ protected void internalAddElement(NodeWrapper element) {
+ Node node = (Node)element.getElement();
+ List<Node> nodes = ((Flow)getFlowWrapper().getElement()).getNodes();
+ long id = 0;
+ for (Node n: nodes) {
+ if (n.getId() > id) {
+ id = n.getId();
+ }
+ }
+ node.setId(++id);
+ ((Container)getParent().getElement()).addNode(node);
+ }
+
+
+ protected void internalRemoveElement(NodeWrapper element) {
+ ((Container)getParent().getElement()).removeNode((Node)element.getElement());
+ }
+
+
+ protected Rectangle internalGetConstraint() {
+ Node node = getNode();
+ Integer x = (Integer) node.getMetaData("x");
+ Integer y = (Integer) node.getMetaData("y");
+ Integer width = (Integer) node.getMetaData("width");
+ Integer height = (Integer) node.getMetaData("height");
+ return new Rectangle(x == null ? 0 : x, y == null ? 0 : y,
+ width == null ? -1 : width, height == null ? -1 : height);
+ }
+
+
+ protected void internalSetConstraint(Rectangle constraint) {
+ Node node = getNode();
+ node.setMetaData("x", constraint.x);
+ node.setMetaData("y", constraint.y);
+ node.setMetaData("width", constraint.width);
+ node.setMetaData("height", constraint.height);
+ }
+
+
+ public String getId() {
+ long id = getNode().getId();
+ return id == -1 ? null : getNode().getId() + "";
+ }
+
+ public String getName() {
+ return getNode().getName();
+ }
+
+ public Node getNode() {
+ return (Node)getElement();
+ }
+
+ public boolean acceptsElement(NodeWrapper element) {
+ return getParent().acceptsElement(element);
+ }
+
+ public void setAcceptsIncomingConnectionStrategy(AcceptsIncomingConnectionStrategy strategy) {
+ this.incomingConnectionStrategy = strategy;
+ }
+
+ public void setAcceptsOutgoingConnectionStrategy(AcceptsOutgoingConnectionStrategy strategy) {
+ this.outgoingConnectionStrategy = strategy;
+ }
+
+ public boolean acceptsIncomingConnection(
+ ConnectionWrapper connectionWrapper, NodeWrapper sourceWrapper) {
+ if (connectionWrapper == null || sourceWrapper == null) {
+ return false;
+ } else if (incomingConnectionStrategy != null) {
+ return incomingConnectionStrategy.acceptsIncomingConnection(
+ (Connection)connectionWrapper.getElement(),
+ (Node)sourceWrapper.getElement());
+ } else {
+ return super.acceptsIncomingConnection(connectionWrapper, sourceWrapper);
+ }
+ }
+
+ public boolean acceptsOutgoingConnection(
+ ConnectionWrapper connectionWrapper, NodeWrapper targetWrapper) {
+ if (connectionWrapper == null || targetWrapper == null) {
+ return false;
+ } else if (outgoingConnectionStrategy != null) {
+ return outgoingConnectionStrategy.acceptsOutgoingConnection(
+ (Connection)connectionWrapper.getElement(),
+ (Node)targetWrapper.getElement());
+ } else {
+ return super.acceptsOutgoingConnection(connectionWrapper, targetWrapper);
+ }
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultFlowWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultFlowWrapper.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultFlowWrapper.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,55 @@
+package org.jboss.tools.flow.editor.core;
+
+import org.jboss.tools.flow.common.model.Flow;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.editor.core.AbstractFlowWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+import org.jboss.tools.flow.editor.strategy.AcceptsElementStrategy;
+
+public class DefaultFlowWrapper extends AbstractFlowWrapper {
+
+ private AcceptsElementStrategy acceptsElementStrategy;
+
+ public Integer getRouterLayout() {
+ Integer routerLayout = (Integer) ((Flow)getElement()).getMetaData("routerLayout");
+ if (routerLayout == null) {
+ return ROUTER_LAYOUT_MANUAL;
+ }
+ return routerLayout;
+ }
+
+ public void internalSetRouterLayout(Integer routerLayout) {
+ ((Flow)getElement()).setMetaData("routerLayout", routerLayout);
+ }
+
+ protected void internalAddElement(NodeWrapper element) {
+ Node node = (Node)element.getElement();
+ long id = 0;
+ for (Node n: ((Flow)getElement()).getNodes()) {
+ if (n.getId() > id) {
+ id = n.getId();
+ }
+ }
+ node.setId(++id);
+ ((Flow)getElement()).addNode(node);
+ }
+
+ protected void internalRemoveElement(NodeWrapper element) {
+ ((Flow)getElement()).removeNode((Node)element.getElement());
+ }
+
+ public boolean acceptsElement(NodeWrapper wrapper) {
+ if (wrapper == null) {
+ return false;
+ } else if (acceptsElementStrategy != null) {
+ return acceptsElementStrategy.acceptsElement(wrapper.getElement());
+ } else {
+ return true;
+ }
+ }
+
+ public void setAcceptsElementStrategy(AcceptsElementStrategy strategy) {
+ this.acceptsElementStrategy = strategy;
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultNodeWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultNodeWrapper.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/DefaultNodeWrapper.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,87 @@
+package org.jboss.tools.flow.editor.core;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.editor.strategy.AcceptsIncomingConnectionStrategy;
+import org.jboss.tools.flow.editor.strategy.AcceptsOutgoingConnectionStrategy;
+
+public abstract class DefaultNodeWrapper extends AbstractNodeWrapper {
+
+ private AcceptsIncomingConnectionStrategy incomingConnectionStrategy;
+ private AcceptsOutgoingConnectionStrategy outgoingConnectionStrategy;
+
+ public void setNode(Node node) {
+ setElement(node);
+ }
+
+ public Node getNode() {
+ return (Node) getElement();
+ }
+
+ public String getId() {
+ long id = getNode().getId();
+ return id == -1 ? null : getNode().getId() + "";
+ }
+
+ public String getName() {
+ return getNode().getName();
+ }
+
+ public void internalSetName(String name) {
+ getNode().setName(name);
+ notifyListeners(CHANGE_VISUAL);
+ }
+
+ protected void internalSetConstraint(Rectangle constraint) {
+ Node node = getNode();
+ node.setMetaData("x", constraint.x);
+ node.setMetaData("y", constraint.y);
+ node.setMetaData("width", constraint.width);
+ node.setMetaData("height", constraint.height);
+ }
+
+ public Rectangle internalGetConstraint() {
+ Node node = getNode();
+ Integer x = (Integer) node.getMetaData("x");
+ Integer y = (Integer) node.getMetaData("y");
+ Integer width = (Integer) node.getMetaData("width");
+ Integer height = (Integer) node.getMetaData("height");
+ return new Rectangle(x == null ? 0 : x, y == null ? 0 : y,
+ width == null ? -1 : width, height == null ? -1 : height);
+ }
+
+ public void setAcceptsIncomingConnectionStrategy(AcceptsIncomingConnectionStrategy strategy) {
+ this.incomingConnectionStrategy = strategy;
+ }
+
+ public void setAcceptsOutgoingConnectionStrategy(AcceptsOutgoingConnectionStrategy strategy) {
+ this.outgoingConnectionStrategy = strategy;
+ }
+
+ public boolean acceptsIncomingConnection(
+ ConnectionWrapper connectionWrapper, NodeWrapper sourceWrapper) {
+ if (connectionWrapper == null || sourceWrapper == null) {
+ return false;
+ } else if (incomingConnectionStrategy != null) {
+ return incomingConnectionStrategy.acceptsIncomingConnection(
+ (Connection)connectionWrapper.getElement(),
+ (Node)sourceWrapper.getElement());
+ } else {
+ return true;
+ }
+ }
+
+ public boolean acceptsOutgoingConnection(
+ ConnectionWrapper connectionWrapper, NodeWrapper targetWrapper) {
+ if (connectionWrapper == null || targetWrapper == null) {
+ return false;
+ } else if (outgoingConnectionStrategy != null) {
+ return outgoingConnectionStrategy.acceptsOutgoingConnection(
+ (Connection)connectionWrapper.getElement(),
+ (Node)targetWrapper.getElement());
+ } else {
+ return true;
+ }
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ModelEvent.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ModelEvent.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ModelEvent.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,36 @@
+package org.jboss.tools.flow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Event notifying a change in a model element.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ModelEvent {
+
+ private int change;
+
+ public ModelEvent(int change) {
+ this.change = change;
+ }
+
+ public int getChange() {
+ return change;
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ModelListener.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ModelListener.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/ModelListener.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,28 @@
+package org.jboss.tools.flow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * A listener for model events.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public interface ModelListener {
+
+ void modelChanged(ModelEvent event);
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/NodeWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/NodeWrapper.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/NodeWrapper.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,58 @@
+package org.jboss.tools.flow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * Wrapper of a model element.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public interface NodeWrapper extends Wrapper {
+
+ static final int CHANGE_INCOMING_CONNECTIONS = 1;
+ static final int CHANGE_OUTGOING_CONNECTIONS = 2;
+ static final int CHANGE_VISUAL = 3;
+
+ String getId();
+ String getName();
+ void setName(String name);
+
+ void setConstraint(Rectangle constraint);
+ Rectangle getConstraint();
+
+ void setParent(ContainerWrapper parent);
+ ContainerWrapper getParent();
+
+ List<AbstractConnectionWrapper> getOutgoingConnections();
+ List<AbstractConnectionWrapper> getIncomingConnections();
+ void addIncomingConnection(AbstractConnectionWrapper connection);
+ void localAddIncomingConnection(AbstractConnectionWrapper connection);
+ void removeIncomingConnection(AbstractConnectionWrapper connection);
+ void addOutgoingConnection(AbstractConnectionWrapper connection);
+ void localAddOutgoingConnection(AbstractConnectionWrapper connection);
+ void removeOutgoingConnection(AbstractConnectionWrapper connection);
+ boolean acceptsIncomingConnection(ConnectionWrapper connection, NodeWrapper source);
+ boolean acceptsOutgoingConnection(ConnectionWrapper connection, NodeWrapper target);
+
+ void addListener(ModelListener listener);
+ void removeListener(ModelListener listener);
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/Wrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/Wrapper.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/core/Wrapper.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,8 @@
+package org.jboss.tools.flow.editor.core;
+
+public interface Wrapper {
+
+ void setElement(Object element);
+ Object getElement();
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/CellEditorLocator.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/CellEditorLocator.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/CellEditorLocator.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,56 @@
+package org.jboss.tools.flow.editor.editpart;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Text;
+
+import org.eclipse.jface.viewers.CellEditor;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * A CellEditorLocator for elements.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class CellEditorLocator implements org.eclipse.gef.tools.CellEditorLocator {
+
+ private Label label;
+
+ public CellEditorLocator(Label label) {
+ setLabel(label);
+ }
+
+ public void relocate(CellEditor cellEditor) {
+ Text text = (Text) cellEditor.getControl();
+ Point pref = text.computeSize(-1, -1);
+ Rectangle rect = label.getTextBounds().getCopy();
+ label.translateToAbsolute(rect);
+ text.setBounds(rect.x - 1, rect.y - 1, pref.x + 1, pref.y + 1);
+ }
+
+ protected Label getLabel() {
+ return label;
+ }
+
+ protected void setLabel(Label label) {
+ this.label = label;
+ }
+
+}
\ No newline at end of file
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/ConnectionEditPart.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/ConnectionEditPart.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/ConnectionEditPart.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,112 @@
+package org.jboss.tools.flow.editor.editpart;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.AbsoluteBendpoint;
+import org.eclipse.draw2d.BendpointConnectionRouter;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+import org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy;
+import org.eclipse.gef.requests.CreationFactory;
+import org.eclipse.gef.requests.SimpleFactory;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.ModelEvent;
+import org.jboss.tools.flow.editor.core.ModelListener;
+import org.jboss.tools.flow.editor.policy.ConnectionBendpointEditPolicy;
+import org.jboss.tools.flow.editor.policy.ConnectionEditPolicy;
+
+/**
+ * Implementation of a connection EditPart.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class ConnectionEditPart extends AbstractConnectionEditPart implements ModelListener {
+
+ public AbstractConnectionWrapper getElementConnection() {
+ return (AbstractConnectionWrapper) getModel();
+ }
+
+ protected void createEditPolicies() {
+ ConnectionEditPolicy connectionEditPolicy = new ConnectionEditPolicy();
+ connectionEditPolicy.setElementConnectionFactory(getElementConnectionFactory());
+ installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new ConnectionEndpointEditPolicy());
+ installEditPolicy(EditPolicy.CONNECTION_ROLE, connectionEditPolicy);
+ installEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE, new ConnectionBendpointEditPolicy());
+ }
+
+ protected CreationFactory getElementConnectionFactory() {
+ return new SimpleFactory(getElementConnectionType());
+ }
+
+
+ protected abstract Class<?> getElementConnectionType();
+
+// protected abstract ConnectionFactory getElementConnectionFactory();
+
+ protected IFigure createFigure() {
+ PolylineConnection result = new PolylineConnection();
+ result.setConnectionRouter(new BendpointConnectionRouter());
+ result.setTargetDecoration(new PolygonDecoration());
+ return result;
+ }
+
+ public void setSelected(int value) {
+ super.setSelected(value);
+ if (value != EditPart.SELECTED_NONE) {
+ ((PolylineConnection)getFigure()).setLineWidth(2);
+ } else {
+ ((PolylineConnection)getFigure()).setLineWidth(1);
+ }
+ }
+
+ public void modelChanged(ModelEvent event) {
+ if (event.getChange() == AbstractConnectionWrapper.CHANGE_BENDPOINTS) {
+ refreshBendpoints();
+ }
+ }
+
+ public void activate() {
+ super.activate();
+ getElementConnection().addListener(this);
+ }
+
+ public void deactivate() {
+ getElementConnection().removeListener(this);
+ super.deactivate();
+ }
+
+ protected void refreshBendpoints() {
+ List<Point> bendpoints = getElementConnection().getBendpoints();
+ List<Point> constraint = new ArrayList<Point>();
+ for (int i = 0; i < bendpoints.size(); i++) {
+ constraint.add(new AbsoluteBendpoint((Point) bendpoints.get(i)));
+ }
+ getConnectionFigure().setRoutingConstraint(constraint);
+ }
+
+ protected void refreshVisuals() {
+ refreshBendpoints();
+ }
+}
\ No newline at end of file
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/ContainerEditPart.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/ContainerEditPart.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/ContainerEditPart.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,72 @@
+package org.jboss.tools.flow.editor.editpart;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.MouseWheelHelper;
+import org.eclipse.gef.editparts.ViewportMouseWheelHelper;
+import org.jboss.tools.flow.editor.core.AbstractContainerWrapper;
+import org.jboss.tools.flow.editor.core.ModelEvent;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+import org.jboss.tools.flow.editor.figure.ElementContainerFigure;
+import org.jboss.tools.flow.editor.policy.ElementContainerLayoutEditPolicy;
+
+public class ContainerEditPart extends ElementEditPart {
+
+ protected AbstractContainerWrapper getElementContainerElementWrapper() {
+ return (AbstractContainerWrapper) getModel();
+ }
+
+ protected IFigure createFigure() {
+ return new ElementContainerFigure();
+ }
+
+ protected void createEditPolicies() {
+ super.createEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, null);
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new ElementContainerLayoutEditPolicy());
+ }
+
+ public void modelChanged(ModelEvent event) {
+ if (event.getChange() == AbstractContainerWrapper.CHANGE_ELEMENTS) {
+ refreshChildren();
+ } else if (event.getChange() == AbstractContainerWrapper.CHANGE_ELEMENTS) {
+ refreshChildren();
+ } else {
+ super.modelChanged(event);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class key) {
+ if (key == MouseWheelHelper.class) {
+ return new ViewportMouseWheelHelper(this);
+ }
+ return super.getAdapter(key);
+ }
+
+ protected List<NodeWrapper> getModelChildren() {
+ return getElementContainerElementWrapper().getElements();
+ }
+
+ public IFigure getContentPane() {
+ return ((ElementContainerFigure) getFigure()).getPane();
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/ElementEditPart.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/ElementEditPart.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/ElementEditPart.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,146 @@
+package org.jboss.tools.flow.editor.editpart;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.Label;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.NodeEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.ModelEvent;
+import org.jboss.tools.flow.editor.core.ModelListener;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+import org.jboss.tools.flow.editor.figure.ElementFigure;
+import org.jboss.tools.flow.editor.policy.ElementDirectEditManager;
+import org.jboss.tools.flow.editor.policy.ElementDirectEditPolicy;
+import org.jboss.tools.flow.editor.policy.ElementEditPolicy;
+import org.jboss.tools.flow.editor.policy.ElementNodeEditPolicy;
+
+/**
+ * Default implementation of an element EditPart.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class ElementEditPart extends AbstractGraphicalEditPart implements NodeEditPart, ModelListener {
+
+ private DirectEditManager manager;
+
+ public NodeWrapper getElementWrapper() {
+ return (NodeWrapper) getModel();
+ }
+
+ public ElementFigure getElementFigure() {
+ return (ElementFigure) getFigure();
+ }
+
+ protected void createEditPolicies() {
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new ElementNodeEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ElementEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new ElementDirectEditPolicy());
+ }
+
+ protected List<AbstractConnectionWrapper> getModelSourceConnections() {
+ return getElementWrapper().getOutgoingConnections();
+ }
+
+ protected List<AbstractConnectionWrapper> getModelTargetConnections() {
+ return getElementWrapper().getIncomingConnections();
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connection) {
+ return getElementFigure().getSourceConnectionAnchor();
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connection) {
+ return getElementFigure().getTargetConnectionAnchor();
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor(Request request) {
+ return getElementFigure().getSourceConnectionAnchor();
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(Request request) {
+ return getElementFigure().getTargetConnectionAnchor();
+ }
+
+ protected void refreshVisuals() {
+ NodeWrapper element = getElementWrapper();
+ ElementFigure figure = (ElementFigure) getFigure();
+ figure.setText(element.getName());
+ if (element.getConstraint().width == -1) {
+ element.getConstraint().width = figure.getBounds().width;
+ }
+ if (element.getConstraint().height == -1) {
+ element.getConstraint().height = figure.getBounds().height;
+ }
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, figure, element.getConstraint());
+ }
+
+ public void modelChanged(ModelEvent event) {
+ if (event.getChange() == NodeWrapper.CHANGE_INCOMING_CONNECTIONS) {
+ refreshTargetConnections();
+ } else if (event.getChange() == NodeWrapper.CHANGE_OUTGOING_CONNECTIONS) {
+ refreshSourceConnections();
+ } else if (event.getChange() == NodeWrapper.CHANGE_VISUAL) {
+ refreshVisuals();
+ }
+ }
+
+ public void activate() {
+ super.activate();
+ getElementWrapper().addListener(this);
+ }
+
+ public void deactivate() {
+ getElementWrapper().removeListener(this);
+ super.deactivate();
+ }
+
+ public void performRequest(Request request) {
+ if (request.getType() == RequestConstants.REQ_DIRECT_EDIT) {
+ performDirectEdit();
+ } if (request.getType() == RequestConstants.REQ_OPEN) {
+ doubleClicked();
+ } else {
+ super.performRequest(request);
+ }
+ }
+
+ protected void doubleClicked() {
+ // do nothing
+ }
+
+ private void performDirectEdit() {
+ Label label = ((ElementFigure) getFigure()).getLabel();
+ if (label == null) {
+ return;
+ }
+ if (manager == null) {
+ manager = new ElementDirectEditManager(this, new CellEditorLocator(label));
+ }
+ manager.show();
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/RootEditPart.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/RootEditPart.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/editpart/RootEditPart.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,137 @@
+package org.jboss.tools.flow.editor.editpart;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+
+import org.eclipse.draw2d.Animation;
+import org.eclipse.draw2d.AutomaticRouter;
+import org.eclipse.draw2d.BendpointConnectionRouter;
+import org.eclipse.draw2d.ConnectionLayer;
+import org.eclipse.draw2d.FanRouter;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ManhattanConnectionRouter;
+import org.eclipse.draw2d.ShortestPathConnectionRouter;
+import org.eclipse.draw2d.XYLayout;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.SnapToGrid;
+import org.eclipse.gef.SnapToHelper;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.editpolicies.RootComponentEditPolicy;
+import org.eclipse.swt.SWT;
+import org.jboss.tools.flow.editor.core.AbstractFlowWrapper;
+import org.jboss.tools.flow.editor.core.ModelEvent;
+import org.jboss.tools.flow.editor.core.ModelListener;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+import org.jboss.tools.flow.editor.figure.ElementFigure;
+import org.jboss.tools.flow.editor.policy.ElementContainerLayoutEditPolicy;
+
+/**
+ * Default implementation of a process EditPart.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class RootEditPart extends AbstractGraphicalEditPart implements ModelListener {
+
+ public AbstractFlowWrapper getProcessWrapper() {
+ return (AbstractFlowWrapper) getModel();
+ }
+
+ protected IFigure createFigure() {
+ Figure f = new Figure();
+ f.setLayoutManager(new XYLayout());
+ return f;
+ }
+
+ protected void createEditPolicies() {
+ installEditPolicy(EditPolicy.NODE_ROLE, null);
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, null);
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new ElementContainerLayoutEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy());
+ }
+
+ protected List<NodeWrapper> getModelChildren() {
+ return getProcessWrapper().getElements();
+ }
+
+ public void activate() {
+ super.activate();
+ getProcessWrapper().addListener(this);
+ }
+
+ public void deactivate() {
+ getProcessWrapper().removeListener(this);
+ super.deactivate();
+ }
+
+ public void modelChanged(ModelEvent event) {
+ if (event.getChange() == AbstractFlowWrapper.CHANGE_ELEMENTS) {
+ refreshChildren();
+ } else if (event.getChange() == AbstractFlowWrapper.CHANGE_VISUAL) {
+ refreshVisuals();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class adapter) {
+ if (adapter == SnapToHelper.class) {
+ Boolean val = (Boolean) getViewer().getProperty(SnapToGrid.PROPERTY_GRID_ENABLED);
+ if (val != null && val.booleanValue()) {
+ return new SnapToGrid(this);
+ }
+ }
+ return super.getAdapter(adapter);
+ }
+
+ protected void refreshVisuals() {
+ Animation.markBegin();
+ ConnectionLayer layer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
+ if ((getViewer().getControl().getStyle() & SWT.MIRRORED ) == 0) {
+ layer.setAntialias(SWT.ON);
+ }
+
+ if (getProcessWrapper().getRouterLayout().equals(AbstractFlowWrapper.ROUTER_LAYOUT_MANUAL)) {
+ AutomaticRouter router = new FanRouter();
+ router.setNextRouter(new BendpointConnectionRouter());
+ layer.setConnectionRouter(router);
+ } else if (getProcessWrapper().getRouterLayout().equals(AbstractFlowWrapper.ROUTER_LAYOUT_MANHATTAN)) {
+ layer.setConnectionRouter(new ManhattanConnectionRouter());
+ } else {
+ layer.setConnectionRouter(new ShortestPathConnectionRouter(getFigure()));
+ }
+ Animation.run(400);
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean setTableModelBounds() {
+ List<ElementEditPart> tableParts = getChildren();
+ for (ElementEditPart elementEditPart: tableParts) {
+ ElementFigure elementFigure = (ElementFigure) elementEditPart.getFigure();
+ if (elementFigure == null) {
+ continue;
+ }
+ Rectangle constraint = elementFigure.getBounds().getCopy();
+ NodeWrapper elementWrapper = elementEditPart.getElementWrapper();
+ elementWrapper.setConstraint(constraint);
+ }
+ return true;
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/AbstractElementFigure.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/AbstractElementFigure.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/AbstractElementFigure.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,86 @@
+package org.jboss.tools.flow.editor.figure;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.ChopboxAnchor;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.Panel;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Default implementation of an element Figure.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class AbstractElementFigure extends Panel implements ElementFigure {
+
+ private boolean selected;
+ private Label label = new Label();
+
+ public AbstractElementFigure() {
+ add(label);
+ customizeFigure();
+ setSize(80, 40);
+ }
+
+ public void setIcon(Image icon) {
+ label.setIcon(icon);
+ }
+
+ public void setText(String text) {
+ label.setText(text);
+ }
+
+ public Label getLabel() {
+ return label;
+ }
+
+ public void setColor(Color color) {
+ setBackgroundColor(color);
+ }
+
+ public void setBounds(Rectangle bounds) {
+ super.setBounds(bounds);
+ label.setBounds(bounds);
+ }
+
+ protected abstract void customizeFigure();
+
+ public void setSelected(boolean b) {
+ selected = b;
+ }
+
+ public boolean isSelected() {
+ return selected;
+ }
+
+ public void setFocus(boolean b) {
+ repaint();
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor() {
+ return new ChopboxAnchor(this);
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor() {
+ return new ChopboxAnchor(this);
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/ElementContainerFigure.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/ElementContainerFigure.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/ElementContainerFigure.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,82 @@
+package org.jboss.tools.flow.editor.figure;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.ChopboxAnchor;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FreeformLayer;
+import org.eclipse.draw2d.FreeformLayout;
+import org.eclipse.draw2d.FreeformViewport;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.LineBorder;
+import org.eclipse.draw2d.ScrollPane;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.swt.graphics.Image;
+
+public class ElementContainerFigure extends Figure implements ElementFigure {
+
+ private IFigure pane;
+ private boolean selected = false;
+
+ public ElementContainerFigure() {
+ setSize(200, 150);
+ ScrollPane scrollpane = new ScrollPane();
+ pane = new FreeformLayer();
+ pane.setLayoutManager(new FreeformLayout());
+ setLayoutManager(new StackLayout());
+ add(scrollpane);
+ scrollpane.setViewport(new FreeformViewport());
+ scrollpane.setContents(pane);
+ setBorder(new LineBorder(1));
+ }
+
+ public Label getLabel() {
+ return null;
+ }
+
+ public boolean isSelected() {
+ return selected;
+ }
+
+ public void setIcon(Image icon) {
+ // Do nothing
+ }
+
+ public void setSelected(boolean b) {
+ this.selected = b;
+ ((LineBorder) getBorder()).setWidth(b ? 3 : 1);
+ }
+
+ public void setText(String text) {
+ // Do nothing
+ }
+
+ public IFigure getPane() {
+ return pane;
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor() {
+ return new ChopboxAnchor(this);
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor() {
+ return new ChopboxAnchor(this);
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/ElementFigure.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/ElementFigure.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/ElementFigure.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,46 @@
+package org.jboss.tools.flow.editor.figure;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Default implementation of an element Figure.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public interface ElementFigure extends IFigure {
+
+ void setIcon(Image icon);
+
+ void setText(String text);
+
+ void setSelected(boolean b);
+
+ boolean isSelected();
+
+ Label getLabel();
+
+ ConnectionAnchor getSourceConnectionAnchor();
+
+ ConnectionAnchor getTargetConnectionAnchor();
+
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/EllipseElementFigure.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/EllipseElementFigure.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/EllipseElementFigure.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,42 @@
+package org.jboss.tools.flow.editor.figure;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.Ellipse;
+import org.eclipse.draw2d.EllipseAnchor;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Color;
+
+public class EllipseElementFigure extends AbstractElementFigure {
+
+ private Ellipse ellipse;
+
+ protected void customizeFigure() {
+ ellipse = new Ellipse();
+ add(ellipse, 0);
+ ellipse.setBounds(getBounds());
+ }
+
+ public void setColor(Color color) {
+ ellipse.setBackgroundColor(color);
+ }
+
+ public void setBounds(Rectangle rectangle) {
+ super.setBounds(rectangle);
+ ellipse.setBounds(rectangle);
+ }
+
+ public void setSelected(boolean b) {
+ super.setSelected(b);
+ ellipse.setLineWidth(b ? 3 : 1);
+ repaint();
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor() {
+ return new EllipseAnchor(this);
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor() {
+ return new EllipseAnchor(this);
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/RectangleElementFigure.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/RectangleElementFigure.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/RectangleElementFigure.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,33 @@
+package org.jboss.tools.flow.editor.figure;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.LineBorder;
+
+public class RectangleElementFigure extends AbstractElementFigure {
+
+ protected void customizeFigure() {
+ setBorder(new LineBorder(1));
+ }
+
+ public void setSelected(boolean b) {
+ super.setSelected(b);
+ ((LineBorder) getBorder()).setWidth(b ? 3 : 1);
+ repaint();
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/RoundedRectangleElementFigure.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/RoundedRectangleElementFigure.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/figure/RoundedRectangleElementFigure.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,51 @@
+package org.jboss.tools.flow.editor.figure;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.RoundedRectangle;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Color;
+
+public class RoundedRectangleElementFigure extends AbstractElementFigure {
+
+ private RoundedRectangle rectangle;
+
+ protected void customizeFigure() {
+ rectangle = new RoundedRectangle();
+ rectangle.setCornerDimensions(new Dimension(25, 25));
+ add(rectangle, 0);
+ rectangle.setBounds(getBounds());
+ setSelected(false);
+ }
+
+ public void setColor(Color color) {
+ rectangle.setBackgroundColor(color);
+ }
+
+ public void setBounds(Rectangle rectangle) {
+ super.setBounds(rectangle);
+ this.rectangle.setBounds(rectangle);
+ }
+
+ public void setSelected(boolean b) {
+ super.setSelected(b);
+ rectangle.setLineWidth(b ? 3 : 1);
+ repaint();
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ConnectionBendpointEditPolicy.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ConnectionBendpointEditPolicy.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ConnectionBendpointEditPolicy.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,65 @@
+package org.jboss.tools.flow.editor.policy;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.BendpointEditPolicy;
+import org.eclipse.gef.requests.BendpointRequest;
+import org.jboss.tools.flow.editor.command.CreateBendpointCommand;
+import org.jboss.tools.flow.editor.command.DeleteBendpointCommand;
+import org.jboss.tools.flow.editor.command.MoveBendpointCommand;
+
+/**
+ * Policy for bendpoints of connections.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ConnectionBendpointEditPolicy extends BendpointEditPolicy {
+
+ protected Command getCreateBendpointCommand(BendpointRequest request) {
+ Point point = request.getLocation();
+ getConnection().translateToRelative(point);
+
+ CreateBendpointCommand command = new CreateBendpointCommand();
+ command.setLocation(point);
+ command.setConnection(getHost().getModel());
+ command.setIndex(request.getIndex());
+
+ return command;
+ }
+
+ protected Command getDeleteBendpointCommand(BendpointRequest request) {
+ DeleteBendpointCommand command = new DeleteBendpointCommand();
+ command.setConnectionModel(getHost().getModel());
+ command.setIndex(request.getIndex());
+ return command;
+ }
+
+ protected Command getMoveBendpointCommand(BendpointRequest request) {
+ Point location = request.getLocation();
+ getConnection().translateToRelative(location);
+
+ MoveBendpointCommand command = new MoveBendpointCommand();
+ command.setConnectionModel(getHost().getModel());
+ command.setIndex(request.getIndex());
+ command.setNewLocation(location);
+
+ return command;
+
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ConnectionEditPolicy.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ConnectionEditPolicy.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ConnectionEditPolicy.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,100 @@
+package org.jboss.tools.flow.editor.policy;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gef.requests.CreationFactory;
+import org.eclipse.gef.requests.GroupRequest;
+import org.jboss.tools.flow.editor.command.DeleteConnectionCommand;
+import org.jboss.tools.flow.editor.command.SplitConnectionCommand;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.AbstractFlowWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+import org.jboss.tools.flow.editor.editpart.ConnectionEditPart;
+
+/**
+ * Policy for editing connections.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ConnectionEditPolicy extends org.eclipse.gef.editpolicies.ConnectionEditPolicy {
+
+// private ConnectionFactory elementConnectionFactory;
+
+ private CreationFactory elementConnectionFactory;
+
+ public void setElementConnectionFactory(CreationFactory elementConnectionFactory) {
+ this.elementConnectionFactory = elementConnectionFactory;
+ }
+
+ public Command getCommand(Request request) {
+ if (REQ_CREATE.equals(request.getType())) {
+ return getSplitTransitionCommand(request);
+ }
+ return super.getCommand(request);
+ }
+
+ private PolylineConnection getConnectionFigure() {
+ return ((PolylineConnection) ((ConnectionEditPart) getHost()).getFigure());
+ }
+
+ protected Command getDeleteCommand(GroupRequest request) {
+ DeleteConnectionCommand cmd = new DeleteConnectionCommand();
+ AbstractConnectionWrapper connection = (AbstractConnectionWrapper) getHost().getModel();
+ cmd.setAntecedentTaskConnection(connection);
+ cmd.setSource(connection.getSource());
+ cmd.setTarget(connection.getTarget());
+ return cmd;
+ }
+
+ protected Command getSplitTransitionCommand(Request request) {
+ if (elementConnectionFactory == null) {
+ throw new IllegalStateException("DefaultElementConnectionFactory is null");
+ }
+ SplitConnectionCommand cmd = new SplitConnectionCommand();
+ cmd.setElementConnection(((AbstractConnectionWrapper) getHost().getModel()));
+ cmd.setNewSecondConnection((AbstractConnectionWrapper)elementConnectionFactory.getNewObject());
+ cmd.setParent(((AbstractFlowWrapper) ((ConnectionEditPart) getHost())
+ .getSource().getParent().getModel()));
+ cmd.setNewElement(((NodeWrapper) ((CreateRequest) request).getNewObject()));
+ return cmd;
+ }
+
+ public EditPart getTargetEditPart(Request request) {
+ if (REQ_CREATE.equals(request.getType())) {
+ return getHost();
+ }
+ return null;
+ }
+
+ public void eraseTargetFeedback(Request request) {
+ if (REQ_CREATE.equals(request.getType())) {
+ getConnectionFigure().setLineWidth(1);
+ }
+ }
+
+ public void showTargetFeedback(Request request) {
+ if (REQ_CREATE.equals(request.getType())) {
+ getConnectionFigure().setLineWidth(2);
+ }
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementContainerLayoutEditPolicy.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementContainerLayoutEditPolicy.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementContainerLayoutEditPolicy.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,61 @@
+package org.jboss.tools.flow.editor.policy;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.jboss.tools.flow.editor.command.AddElementCommand;
+import org.jboss.tools.flow.editor.command.ChangeConstraintCommand;
+import org.jboss.tools.flow.editor.core.ContainerWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * Policy for performing layout of a process.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ElementContainerLayoutEditPolicy extends XYLayoutEditPolicy {
+
+ protected Command getCreateCommand(CreateRequest request) {
+ AddElementCommand command = new AddElementCommand();
+ command.setParent((ContainerWrapper) getHost().getModel());
+ NodeWrapper element = (NodeWrapper) request.getNewObject();
+ element.setConstraint((Rectangle) getConstraintFor(request));
+ command.setChild(element);
+ return command;
+ }
+
+ protected Command getDeleteDependantCommand(Request request) {
+ return null;
+ }
+
+ protected Command createAddCommand(EditPart child, Object constraint) {
+ // TODO this is needed to allow dragging of elements from one container to another
+ return null;
+ }
+
+ protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
+ ChangeConstraintCommand command = new ChangeConstraintCommand();
+ command.setElement((NodeWrapper) child.getModel());
+ command.setConstraint((Rectangle)constraint);
+ return command;
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementDirectEditManager.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementDirectEditManager.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementDirectEditManager.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,45 @@
+package org.jboss.tools.flow.editor.policy;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+import org.jboss.tools.flow.editor.editpart.ElementEditPart;
+
+/**
+ * Manager for directly editing elements.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ElementDirectEditManager extends DirectEditManager {
+
+ private NodeWrapper element;
+
+ public ElementDirectEditManager(ElementEditPart source, CellEditorLocator locator) {
+ super(source, TextCellEditor.class, locator);
+ element = source.getElementWrapper();
+ }
+
+ protected void initCellEditor() {
+ getCellEditor().setValue(element.getName());
+ Text text = (Text) getCellEditor().getControl();
+ text.selectAll();
+ }
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementDirectEditPolicy.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementDirectEditPolicy.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementDirectEditPolicy.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,46 @@
+package org.jboss.tools.flow.editor.policy;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.DirectEditPolicy;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.jboss.tools.flow.editor.command.RenameElementCommand;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+import org.jboss.tools.flow.editor.figure.ElementFigure;
+
+/**
+ * Policy for directly editing elements.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ElementDirectEditPolicy extends DirectEditPolicy {
+
+ protected Command getDirectEditCommand(DirectEditRequest request) {
+ RenameElementCommand cmd = new RenameElementCommand();
+ cmd.setSource((NodeWrapper) getHost().getModel());
+ cmd.setOldName(((NodeWrapper) getHost().getModel()).getName());
+ cmd.setName((String) request.getCellEditor().getValue());
+ return cmd;
+ }
+
+ protected void showCurrentEditValue(DirectEditRequest request) {
+ String value = (String) request.getCellEditor().getValue();
+ ((ElementFigure) getHostFigure()).setText(value);
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementEditPolicy.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementEditPolicy.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementEditPolicy.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,41 @@
+package org.jboss.tools.flow.editor.policy;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.ComponentEditPolicy;
+import org.eclipse.gef.requests.GroupRequest;
+import org.jboss.tools.flow.editor.command.DeleteElementCommand;
+import org.jboss.tools.flow.editor.core.ContainerWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * Policy for editing elements.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ElementEditPolicy extends ComponentEditPolicy {
+
+ protected Command createDeleteCommand(GroupRequest deleteRequest) {
+ ContainerWrapper parent = (ContainerWrapper) getHost().getParent().getModel();
+ DeleteElementCommand deleteCmd = new DeleteElementCommand();
+ deleteCmd.setParent(parent);
+ deleteCmd.setChild((NodeWrapper) (getHost().getModel()));
+ return deleteCmd;
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementNodeEditPolicy.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementNodeEditPolicy.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/policy/ElementNodeEditPolicy.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,78 @@
+package org.jboss.tools.flow.editor.policy;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy;
+import org.eclipse.gef.requests.CreateConnectionRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.jboss.tools.flow.editor.command.ElementConnectionCreateCommand;
+import org.jboss.tools.flow.editor.command.ReconnectElementConnectionSourceCommand;
+import org.jboss.tools.flow.editor.command.ReconnectElementConnectionTargetCommand;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+import org.jboss.tools.flow.editor.editpart.ElementEditPart;
+
+/**
+ * Policy for editing an element node.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ElementNodeEditPolicy extends GraphicalNodeEditPolicy {
+
+ protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
+ ElementConnectionCreateCommand cmd =
+ (ElementConnectionCreateCommand) request.getStartCommand();
+ cmd.setConnection((AbstractConnectionWrapper) request.getNewObject());
+ cmd.setTarget(getElement());
+ return cmd;
+ }
+
+ protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
+ ElementConnectionCreateCommand cmd =
+ new ElementConnectionCreateCommand();
+ cmd.setConnection((AbstractConnectionWrapper) request.getNewObject());
+ cmd.setSource(getElement());
+ request.setStartCommand(cmd);
+ return cmd;
+ }
+
+ protected ElementEditPart getActivityPart() {
+ return (ElementEditPart) getHost();
+ }
+
+ protected NodeWrapper getElement() {
+ return (NodeWrapper) getHost().getModel();
+ }
+
+ protected Command getReconnectSourceCommand(ReconnectRequest request) {
+ ReconnectElementConnectionSourceCommand cmd
+ = new ReconnectElementConnectionSourceCommand();
+ cmd.setConnection((AbstractConnectionWrapper) request.getConnectionEditPart().getModel());
+ cmd.setSource(getElement());
+ return cmd;
+ }
+
+ protected Command getReconnectTargetCommand(ReconnectRequest request) {
+ ReconnectElementConnectionTargetCommand cmd
+ = new ReconnectElementConnectionTargetCommand();
+ cmd.setConnection((AbstractConnectionWrapper) request.getConnectionEditPart().getModel());
+ cmd.setTarget(getElement());
+ return cmd;
+ }
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/strategy/AcceptsElementStrategy.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/strategy/AcceptsElementStrategy.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/strategy/AcceptsElementStrategy.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,11 @@
+package org.jboss.tools.flow.editor.strategy;
+
+import org.jboss.tools.flow.common.model.Container;
+
+public interface AcceptsElementStrategy {
+
+ void setContainer(Container container);
+
+ boolean acceptsElement(Object element);
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/strategy/AcceptsIncomingConnectionStrategy.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/strategy/AcceptsIncomingConnectionStrategy.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/strategy/AcceptsIncomingConnectionStrategy.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,13 @@
+package org.jboss.tools.flow.editor.strategy;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+
+public interface AcceptsIncomingConnectionStrategy {
+
+ void setNode(Node node);
+
+ boolean acceptsIncomingConnection(Connection connection, Node source);
+
+
+}
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/strategy/AcceptsOutgoingConnectionStrategy.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/strategy/AcceptsOutgoingConnectionStrategy.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/editor/strategy/AcceptsOutgoingConnectionStrategy.java 2008-08-05 16:25:42 UTC (rev 9532)
@@ -0,0 +1,13 @@
+package org.jboss.tools.flow.editor.strategy;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+
+public interface AcceptsOutgoingConnectionStrategy {
+
+ void setNode(Node node);
+
+ boolean acceptsOutgoingConnection(Connection connection, Node target);
+
+
+}
16 years, 5 months
JBoss Tools SVN: r9531 - trunk/flow/plugins.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-08-05 12:24:40 -0400 (Tue, 05 Aug 2008)
New Revision: 9531
Added:
trunk/flow/plugins/org.jboss.tools.flow.common/
Log:
Move from org.jboss.tools.flow.common.graph
16 years, 5 months