Author: koen.aers(a)jboss.com
Date: 2008-07-23 10:26:18 -0400 (Wed, 23 Jul 2008)
New Revision: 9245
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/.classpath
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/.project
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/.settings/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/.settings/org.eclipse.jdt.core.prefs
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/META-INF/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/META-INF/MANIFEST.MF
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/build.properties
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/end.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/process.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/processH.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/processV.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/start.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/state.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/plugin.xml
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/Activator.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editor/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editor/JpdlEditor.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editor/JpdlPaletteFactory.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/EndStateEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/JpdlEditPartFactory.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/StartStateEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/StateEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/TransitionEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/BaseNodeWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/EndStateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/ProcessWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/StartStateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/StateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/TransitionWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/TransitionWrapperFactory.java
Log:
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/.classpath
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/.classpath
(rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/.classpath 2008-07-23 14:26:18 UTC
(rev 9245)
@@ -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.graph/.project
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/.project
(rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/.project 2008-07-23 14:26:18 UTC
(rev 9245)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.flow.jpdl4.graph</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.graph/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/.settings/org.eclipse.jdt.core.prefs 2008-07-23
14:26:18 UTC (rev 9245)
@@ -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.graph/META-INF/MANIFEST.MF
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/META-INF/MANIFEST.MF 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Jpdl4 Plug-in
+Bundle-SymbolicName: org.jboss.tools.flow.jpdl4.graph;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.graph;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",
+ org.jboss.tools.flow.jpdl4.core;bundle-version="1.0.0"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.jboss.tools.process.jpdl4.graph.Activator
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/build.properties
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/build.properties
(rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/build.properties 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/end.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/end.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/process.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/process.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/processH.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/processH.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/processV.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/processV.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/start.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/start.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/state.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/icons/state.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/plugin.xml
(rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/plugin.xml 2008-07-23 14:26:18 UTC
(rev 9245)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension point="org.eclipse.ui.editors">
+ <editor
+ name="RuleFlow Editor"
+ extensions="jpdl4"
+ icon="icons/processH.gif"
+
contributorClass="org.jboss.tools.process.editor.GenericActionBarContributor"
+ class="org.jboss.tools.process.jpdl4.graph.editor.JpdlEditor"
+ id="org.jboss.tools.process.jpdl4.graph.editor.JpdlEditor">
+ </editor>
+ </extension>
+
+ <extension
+ point = "org.eclipse.ui.editorActions">
+ <editorContribution
+
id="org.jboss.tools.process.editor.action.VerticalAutoLayoutAction"
+
targetID="org.jboss.tools.process.jpdl4.graph.editor.JpdlEditor">
+ <action
+ id="org.jboss.tools.process.editor.action.VerticalAutoLayoutAction"
+ label="Auto Layout (Vertical)"
+ toolbarPath="Process"
+ icon="icons/processV.gif"
+ tooltip="Auto layout the process (vertical)"
+
class="org.jboss.tools.process.editor.action.VerticalAutoLayoutAction"
+ />
+ </editorContribution>
+ <editorContribution
+
id="org.jboss.tools.process.editor.action.HorizontalAutoLayoutAction"
+
targetID="org.jboss.tools.process.jpdl4.graph.editor.JpdlEditor">
+ <action
+ id="org.jboss.tools.process.editor.action.HorizontalAutoLayoutAction"
+ label="Auto Layout (Horizontal)"
+ toolbarPath="Process"
+ icon="icons/processH.gif"
+ tooltip="Auto layout the process (horizontal)"
+
class="org.jboss.tools.process.editor.action.HorizontalAutoLayoutAction"
+ />
+ </editorContribution>
+ </extension>
+
+</plugin>
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/Activator.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/Activator.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/Activator.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,45 @@
+package org.jboss.tools.process.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.graph/src/org/jboss/tools/process/jpdl4/graph/editor/JpdlEditor.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editor/JpdlEditor.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editor/JpdlEditor.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,35 @@
+package org.jboss.tools.process.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.process.jpdl4.graph.editpart.JpdlEditPartFactory;
+import org.jboss.tools.process.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.graph/src/org/jboss/tools/process/jpdl4/graph/editor/JpdlPaletteFactory.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editor/JpdlPaletteFactory.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editor/JpdlPaletteFactory.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,48 @@
+package org.jboss.tools.process.jpdl4.graph.editor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
+import org.eclipse.gef.palette.PaletteEntry;
+import org.eclipse.gef.requests.SimpleFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.jboss.tools.flow.editor.PaletteFactory;
+import org.jboss.tools.process.jpdl4.graph.Activator;
+import org.jboss.tools.process.jpdl4.graph.wrapper.StartStateWrapper;
+import org.jboss.tools.process.jpdl4.graph.wrapper.StateWrapper;
+import org.jboss.tools.process.jpdl4.graph.wrapper.TransitionWrapperFactory;
+
+public class JpdlPaletteFactory extends PaletteFactory {
+
+ public JpdlPaletteFactory() {
+ super(new TransitionWrapperFactory());
+ }
+
+ 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);
+
+ return entries;
+ }
+
+}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/EndStateEditPart.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/EndStateEditPart.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/EndStateEditPart.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,21 @@
+package org.jboss.tools.process.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.process.jpdl4.graph.Activator;
+
+public class EndStateEditPart 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.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/JpdlEditPartFactory.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/JpdlEditPartFactory.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/JpdlEditPartFactory.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,31 @@
+package org.jboss.tools.process.jpdl4.graph.editpart;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.jboss.tools.flow.editor.editpart.RootEditPart;
+import org.jboss.tools.process.jpdl4.graph.wrapper.ProcessWrapper;
+import org.jboss.tools.process.jpdl4.graph.wrapper.StartStateWrapper;
+import org.jboss.tools.process.jpdl4.graph.wrapper.StateWrapper;
+import org.jboss.tools.process.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 StartStateWrapper) {
+ result = new StartStateEditPart();
+ } else if (model instanceof StateWrapper) {
+ result = new StateEditPart();
+ } 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.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/StartStateEditPart.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/StartStateEditPart.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/StartStateEditPart.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,21 @@
+package org.jboss.tools.process.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.process.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.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/StateEditPart.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/StateEditPart.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/StateEditPart.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,25 @@
+package org.jboss.tools.process.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.process.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.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/TransitionEditPart.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/TransitionEditPart.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/editpart/TransitionEditPart.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,13 @@
+package org.jboss.tools.process.jpdl4.graph.editpart;
+
+import org.jboss.tools.flow.editor.core.ConnectionFactory;
+import org.jboss.tools.flow.editor.editpart.ConnectionEditPart;
+import org.jboss.tools.process.jpdl4.graph.wrapper.TransitionWrapperFactory;
+
+public class TransitionEditPart extends ConnectionEditPart {
+
+ protected ConnectionFactory getElementConnectionFactory() {
+ return new TransitionWrapperFactory();
+ }
+
+}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/BaseNodeWrapper.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/BaseNodeWrapper.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/BaseNodeWrapper.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,63 @@
+package org.jboss.tools.process.jpdl4.graph.wrapper;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.AbstractNodeWrapper;
+import org.jboss.tools.process.jpdl4.core.Node;
+
+public abstract class BaseNodeWrapper extends AbstractNodeWrapper {
+
+ 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 boolean acceptsIncomingConnection(AbstractConnectionWrapper connection,
BaseNodeWrapper source) {
+ return source == null
+ || ((BaseNodeWrapper) source).getNode().getNodeContainer() ==
getNode().getNodeContainer();
+ }
+
+ public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection,
BaseNodeWrapper target) {
+ return target == null
+ || ((BaseNodeWrapper) target).getNode().getNodeContainer() ==
getNode().getNodeContainer();
+ }
+
+}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/EndStateWrapper.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/EndStateWrapper.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/EndStateWrapper.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,26 @@
+package org.jboss.tools.process.jpdl4.graph.wrapper;
+
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+import org.jboss.tools.process.jpdl4.core.EndState;
+
+public class EndStateWrapper extends BaseNodeWrapper {
+
+ public EndStateWrapper() {
+ setElement(new EndState());
+ setName("End");
+ }
+
+ public EndState getEndState() {
+ return (EndState) getElement();
+ }
+
+ public boolean acceptsIncomingConnection(AbstractConnectionWrapper connection,
NodeWrapper source) {
+ return super.acceptsIncomingConnection(connection, (BaseNodeWrapper)source)
+ && getIncomingConnections().isEmpty();
+ }
+
+ public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection,
NodeWrapper target) {
+ return false;
+ }
+}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/ProcessWrapper.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/ProcessWrapper.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/ProcessWrapper.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,56 @@
+package org.jboss.tools.process.jpdl4.graph.wrapper;
+
+import org.jboss.tools.flow.editor.core.AbstractRootWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+import org.jboss.tools.process.jpdl4.core.Node;
+import org.jboss.tools.process.jpdl4.core.Process;
+
+public class ProcessWrapper extends AbstractRootWrapper {
+
+ private static final long serialVersionUID = 400L;
+
+ public ProcessWrapper() {
+ setElement(new Process());
+ }
+
+ public Process getProcess() {
+ return (Process) getElement();
+ }
+
+ public String getName() {
+ return getProcess().getName();
+ }
+
+ public void setName(String name) {
+ getProcess().setName(name);
+ }
+
+ public Integer getRouterLayout() {
+ Integer routerLayout = (Integer)
getProcess().getMetaData("routerLayout");
+ if (routerLayout == null) {
+ return ROUTER_LAYOUT_MANUAL;
+ }
+ return routerLayout;
+ }
+
+ public void internalSetRouterLayout(Integer routerLayout) {
+ getProcess().setMetaData("routerLayout", routerLayout);
+ }
+
+ protected void internalAddElement(NodeWrapper element) {
+ Node node = ((BaseNodeWrapper) element).getNode();
+ long id = 0;
+ for (Node n: getProcess().getNodes()) {
+ if (n.getId() > id) {
+ id = n.getId();
+ }
+ }
+ node.setId(++id);
+ getProcess().addNode(node);
+ }
+
+ protected void internalRemoveElement(NodeWrapper element) {
+ getProcess().removeNode(((BaseNodeWrapper) element).getNode());
+ }
+
+}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/StartStateWrapper.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/StartStateWrapper.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/StartStateWrapper.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,28 @@
+package org.jboss.tools.process.jpdl4.graph.wrapper;
+
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+import org.jboss.tools.process.jpdl4.core.StartState;
+
+public class StartStateWrapper extends BaseNodeWrapper {
+
+ private static final long serialVersionUID = 1L;
+
+ public StartStateWrapper() {
+ setElement(new StartState());
+ setName("Start");
+ }
+
+ public StartState getStartState() {
+ return (StartState) getElement();
+ }
+
+ public boolean acceptsIncomingConnection(AbstractConnectionWrapper connection,
NodeWrapper source) {
+ return false;
+ }
+
+ public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection,
NodeWrapper target) {
+ return super.acceptsOutgoingConnection(connection, (BaseNodeWrapper)target)
+ && getOutgoingConnections().isEmpty();
+ }
+}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/StateWrapper.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/StateWrapper.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/StateWrapper.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,28 @@
+package org.jboss.tools.process.jpdl4.graph.wrapper;
+
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+import org.jboss.tools.process.jpdl4.core.State;
+
+public class StateWrapper extends BaseNodeWrapper {
+
+ public StateWrapper() {
+ setElement(new State());
+ getState().setName("State");
+ }
+
+ public State getState() {
+ return (State) getElement();
+ }
+
+ public boolean acceptsIncomingConnection(AbstractConnectionWrapper connection,
NodeWrapper source) {
+ return super.acceptsIncomingConnection(connection, (BaseNodeWrapper)source)
+ && getIncomingConnections().isEmpty();
+ }
+
+ public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection,
NodeWrapper target) {
+ return super.acceptsOutgoingConnection(connection, (BaseNodeWrapper)target)
+ && getOutgoingConnections().isEmpty();
+ }
+
+}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/TransitionWrapper.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/TransitionWrapper.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/TransitionWrapper.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,68 @@
+package org.jboss.tools.process.jpdl4.graph.wrapper;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+import org.jboss.tools.process.jpdl4.core.Node;
+import org.jboss.tools.process.jpdl4.core.Transition;
+
+public class TransitionWrapper extends AbstractConnectionWrapper {
+
+ public TransitionWrapper() {
+ }
+
+ public Transition getTransition() {
+ return (Transition)getElement();
+ }
+
+ public void localSetTransition(Transition transition) {
+ setElement(transition);
+ }
+
+ public void connect(NodeWrapper source, NodeWrapper target) {
+ super.connect(source, target);
+ Node from = ((BaseNodeWrapper) getSource()).getNode();
+ Node to = ((BaseNodeWrapper) getTarget()).getNode();
+ setElement(new Transition(from, to));
+ }
+
+ protected List<Point> internalGetBendpoints() {
+ return (List<Point>) stringToBendpoints((String)
getTransition().getMetaData("bendpoints"));
+ }
+
+ protected void internalSetBendpoints(List<Point> bendpoints) {
+ getTransition().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;
+ }
+
+}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/TransitionWrapperFactory.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/TransitionWrapperFactory.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/process/jpdl4/graph/wrapper/TransitionWrapperFactory.java 2008-07-23
14:26:18 UTC (rev 9245)
@@ -0,0 +1,12 @@
+package org.jboss.tools.process.jpdl4.graph.wrapper;
+
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.ConnectionFactory;
+
+public class TransitionWrapperFactory implements ConnectionFactory {
+
+ public AbstractConnectionWrapper createElementConnection() {
+ return new TransitionWrapper();
+ }
+
+}