Author: koen.aers(a)jboss.com
Date: 2009-11-11 15:50:49 -0500 (Wed, 11 Nov 2009)
New Revision: 18622
Added:
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/META-INF/MANIFEST.MF
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/plugin.properties
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/Wrapper.java
Removed:
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/META-INF/MANIFEST.MF
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/plugin.properties
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/Wrapper.java
Log:
Copied: tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common (from rev 16344,
trunk/flow/plugins/org.jboss.tools.flow.common)
Deleted: tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/META-INF/MANIFEST.MF
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF 2009-07-02
15:15:08 UTC (rev 16344)
+++ tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/META-INF/MANIFEST.MF 2009-11-11
20:50:49 UTC (rev 18622)
@@ -1,32 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name.0
-Bundle-SymbolicName: org.jboss.tools.flow.common;singleton:=true
-Bundle-Version: 1.0.0.CR1
-Bundle-Activator: org.jboss.tools.flow.common.Activator
-Bundle-Vendor: %Bundle-Vendor.0
-Require-Bundle:
- 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.common;uses:="org.eclipse.core.runtime,org.eclipse.ui.plugin,org.osgi.framework",
- org.jboss.tools.flow.common.action,
- org.jboss.tools.flow.common.command,
- org.jboss.tools.flow.common.editor,
- org.jboss.tools.flow.common.editpart,
- org.jboss.tools.flow.common.figure,
- org.jboss.tools.flow.common.model,
- org.jboss.tools.flow.common.policy,
- org.jboss.tools.flow.common.properties,
- org.jboss.tools.flow.common.registry,
- org.jboss.tools.flow.common.strategy,
- org.jboss.tools.flow.common.wrapper
-Bundle-ClassPath: .
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Localization: plugin
Copied: tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/META-INF/MANIFEST.MF (from rev
18326, trunk/flow/plugins/org.jboss.tools.flow.common/META-INF/MANIFEST.MF)
===================================================================
--- tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/META-INF/MANIFEST.MF
(rev 0)
+++ tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/META-INF/MANIFEST.MF 2009-11-11
20:50:49 UTC (rev 18622)
@@ -0,0 +1,32 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.jboss.tools.flow.common;singleton:=true
+Bundle-Version: 1.2.0.qualifier
+Bundle-Activator: org.jboss.tools.flow.common.Activator
+Bundle-Vendor: %Bundle-Vendor.0
+Require-Bundle:
+ 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.common;uses:="org.eclipse.core.runtime,org.eclipse.ui.plugin,org.osgi.framework",
+ org.jboss.tools.flow.common.action,
+ org.jboss.tools.flow.common.command,
+ org.jboss.tools.flow.common.editor,
+ org.jboss.tools.flow.common.editpart,
+ org.jboss.tools.flow.common.figure,
+ org.jboss.tools.flow.common.model,
+ org.jboss.tools.flow.common.policy,
+ org.jboss.tools.flow.common.properties,
+ org.jboss.tools.flow.common.registry,
+ org.jboss.tools.flow.common.strategy,
+ org.jboss.tools.flow.common.wrapper
+Bundle-ClassPath: .
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Localization: plugin
Deleted: tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/plugin.properties
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/plugin.properties 2009-07-02 15:15:08
UTC (rev 16344)
+++ tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/plugin.properties 2009-11-11 20:50:49
UTC (rev 18622)
@@ -1,3 +0,0 @@
-#Properties file for org.jboss.tools.flow.common
-Bundle-Vendor.0 = JBoss
-Bundle-Name.0 = JBoss Tools Process Plug-in
\ No newline at end of file
Copied: tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/plugin.properties (from rev 17988,
trunk/flow/plugins/org.jboss.tools.flow.common/plugin.properties)
===================================================================
--- tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/plugin.properties
(rev 0)
+++ tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/plugin.properties 2009-11-11 20:50:49
UTC (rev 18622)
@@ -0,0 +1,3 @@
+#Properties file for org.jboss.tools.flow.common
+Bundle-Vendor.0 = JBoss by Red Hat
+Bundle-Name.0 = Flow Language Common Tools
\ No newline at end of file
Deleted:
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java
===================================================================
---
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java 2009-07-02
15:15:08 UTC (rev 16344)
+++
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java 2009-11-11
20:50:49 UTC (rev 18622)
@@ -1,403 +0,0 @@
-package org.jboss.tools.flow.common.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.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.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-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.common.Activator;
-import org.jboss.tools.flow.common.action.HorizontalAutoLayoutAction;
-import org.jboss.tools.flow.common.action.VerticalAutoLayoutAction;
-import org.jboss.tools.flow.common.editpart.EditPartFactory;
-import org.jboss.tools.flow.common.registry.LanguageRegistry;
-
-/**
- * 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;
-
- private String language;
-
- public GenericModelEditor() {
- setEditDomain(new DefaultEditDomain(this));
- }
-
- protected void setModel(Object model) {
- this.model = model;
- }
-
- public Object getModel() {
- return model;
- }
-
- public void init(IEditorSite site, IEditorInput input)
- throws PartInitException {
- super.init(site, input);
- initializeEditDomain();
- initializeLanguage();
- }
-
- protected void initializeEditDomain() {
- setEditDomain(new DefaultEditDomain(this));
- getCommandStack().addCommandStackListener(this);
- }
-
- protected void initializeLanguage() {
- language = LanguageRegistry.getLanguageRegisteredFor(getSite().getId());
- }
-
- public String getLanguage() {
- return language;
- }
-
- @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 org.eclipse.gef.EditPartFactory createEditPartFactory() {
- return new EditPartFactory();
- }
-
- 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();
- }
- }
- }
-}
Copied:
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java
(from rev 16364,
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java)
===================================================================
---
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java
(rev 0)
+++
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java 2009-11-11
20:50:49 UTC (rev 18622)
@@ -0,0 +1,402 @@
+package org.jboss.tools.flow.common.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.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.IEditorSite;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+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.common.Activator;
+import org.jboss.tools.flow.common.action.HorizontalAutoLayoutAction;
+import org.jboss.tools.flow.common.action.VerticalAutoLayoutAction;
+import org.jboss.tools.flow.common.editpart.EditPartFactory;
+import org.jboss.tools.flow.common.registry.LanguageRegistry;
+
+/**
+ * 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;
+
+ private String language;
+
+ public GenericModelEditor() {
+ setEditDomain(new DefaultEditDomain(this));
+ }
+
+ protected void setModel(Object model) {
+ this.model = model;
+ }
+
+ public Object getModel() {
+ return model;
+ }
+
+ public void init(IEditorSite site, IEditorInput input)
+ throws PartInitException {
+ super.init(site, input);
+ initializeLanguage();
+ }
+
+ protected void initializeEditDomain() {
+ setEditDomain(new DefaultEditDomain(this));
+ getCommandStack().addCommandStackListener(this);
+ }
+
+ protected void initializeLanguage() {
+ language = LanguageRegistry.getLanguageRegisteredFor(getSite().getId());
+ }
+
+ public String getLanguage() {
+ return language;
+ }
+
+ @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 org.eclipse.gef.EditPartFactory createEditPartFactory() {
+ return new EditPartFactory();
+ }
+
+ 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();
+ }
+ }
+ }
+}
Deleted:
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java
===================================================================
---
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java 2009-07-02
15:15:08 UTC (rev 16344)
+++
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java 2009-11-11
20:50:49 UTC (rev 18622)
@@ -1,134 +0,0 @@
-package org.jboss.tools.flow.common.editpart;
-
-import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.Locator;
-import org.eclipse.draw2d.Polyline;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gef.tools.DragEditPartsTracker;
-import org.jboss.tools.flow.common.policy.ElementDirectEditManager;
-import org.jboss.tools.flow.common.policy.ElementDirectEditPolicy;
-import org.jboss.tools.flow.common.policy.LabelGraphicalNodeEditPolicy;
-import org.jboss.tools.flow.common.wrapper.LabelWrapper;
-import org.jboss.tools.flow.common.wrapper.ModelEvent;
-import org.jboss.tools.flow.common.wrapper.ModelListener;
-import org.jboss.tools.flow.common.wrapper.Wrapper;
-
-public class LabelEditPart extends AbstractGraphicalEditPart implements ModelListener {
-
- private DirectEditManager manager;
-
- @Override
- protected IFigure createFigure() {
- return new Label();
- }
-
- @Override
- protected void createEditPolicies() {
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new LabelGraphicalNodeEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new ElementDirectEditPolicy());
- }
-
- protected void refreshVisuals() {
- String text = getLabelWrapper().getText();
- Polyline polyline = (Polyline)((ConnectionEditPart)getParent()).getConnectionFigure();
- Point location = ((LabelWrapper)getModel()).getLocation();
- if (location == null) {
- location = calculateInitialLocation(polyline, text);
- ((LabelWrapper)getModel()).setLocation(location);
- }
- Label label = (Label)getFigure();
- label.setText(text);
- LabelConstraint constraint = new LabelConstraint(text, location, polyline);
- ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), constraint);
- }
-
- private Point calculateInitialLocation(Polyline polyline, String text) {
- Dimension textDimension = FigureUtilities.getTextExtents(text, figure.getFont());
- return new Point(- (textDimension.width +5) , -(textDimension.height + 5));
- }
-
- public void performRequest(Request request) {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT) {
- performDirectEdit();
- } else {
- super.performRequest(request);
- }
- }
-
- protected void performDirectEdit() {
- Label label = (Label) getFigure();
- if (label == null) {
- return;
- }
- if (manager == null) {
- manager = new ElementDirectEditManager(this, new CellEditorLocator(label));
- }
- manager.show();
- }
-
- public LabelWrapper getLabelWrapper() {
- return (LabelWrapper)getModel();
- }
-
- public DragTracker getDragTracker(Request request) {
- return new DragEditPartsTracker(this) {
- protected EditPart getTargetEditPart() {
- return getParent();
- }
- };
- }
-
- public void activate() {
- super.activate();
- getLabelWrapper().addListener(this);
- if (getParent().getModel() instanceof Wrapper) {
- ((Wrapper)getParent().getModel()).addListener(this);
- }
- }
-
- public void deactivate() {
- if (getParent().getModel() instanceof Wrapper) {
- ((Wrapper)getParent().getModel()).removeListener(this);
- }
- getLabelWrapper().removeListener(this);
- super.deactivate();
- }
-
- public void modelChanged(ModelEvent event) {
- if (event.getChangeType() == Wrapper.CHANGE_PROPERTY || event.getChangeType() ==
Wrapper.CHANGE_VISUAL) {
- refreshVisuals();
- }
- }
-
- private class LabelConstraint implements Locator {
- String text;
- Point relativeLocation;
- Polyline polyline;
- public LabelConstraint(String text, Point location, Polyline polyline) {
- this.text = text;
- this.relativeLocation = location;
- this.polyline = polyline;
- }
- public void relocate(IFigure figure) {
- Dimension minimum = FigureUtilities.getTextExtents(text, figure.getFont());
- figure.setSize(minimum);
- Point midPoint = polyline.getPoints().getMidpoint();
- Point newLocation = relativeLocation.getCopy();
- newLocation.translate(midPoint);
- figure.setLocation(newLocation);
- }
- }
-
-
-}
Copied:
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java
(from rev 17079,
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java)
===================================================================
---
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java
(rev 0)
+++
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/LabelEditPart.java 2009-11-11
20:50:49 UTC (rev 18622)
@@ -0,0 +1,134 @@
+package org.jboss.tools.flow.common.editpart;
+
+import org.eclipse.draw2d.FigureUtilities;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.Locator;
+import org.eclipse.draw2d.Polyline;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gef.tools.DragEditPartsTracker;
+import org.jboss.tools.flow.common.policy.ElementDirectEditManager;
+import org.jboss.tools.flow.common.policy.ElementDirectEditPolicy;
+import org.jboss.tools.flow.common.policy.LabelGraphicalNodeEditPolicy;
+import org.jboss.tools.flow.common.wrapper.LabelWrapper;
+import org.jboss.tools.flow.common.wrapper.ModelEvent;
+import org.jboss.tools.flow.common.wrapper.ModelListener;
+import org.jboss.tools.flow.common.wrapper.Wrapper;
+
+public class LabelEditPart extends AbstractGraphicalEditPart implements ModelListener {
+
+ private DirectEditManager manager;
+
+ @Override
+ protected IFigure createFigure() {
+ return new Label();
+ }
+
+ @Override
+ protected void createEditPolicies() {
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new LabelGraphicalNodeEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new ElementDirectEditPolicy());
+ }
+
+ protected void refreshVisuals() {
+ String text = getLabelWrapper().getText();
+ Polyline polyline = (Polyline)((ConnectionEditPart)getParent()).getConnectionFigure();
+ Point location = ((LabelWrapper)getModel()).getLocation();
+ if (location == null) {
+ location = calculateInitialLocation(polyline, text);
+ ((LabelWrapper)getModel()).setLocation(location);
+ }
+ Label label = (Label)getFigure();
+ label.setText(text == null ? "" : text);
+ LabelConstraint constraint = new LabelConstraint(text, location, polyline);
+ ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), constraint);
+ }
+
+ private Point calculateInitialLocation(Polyline polyline, String text) {
+ Dimension textDimension = FigureUtilities.getTextExtents(text, figure.getFont());
+ return new Point(- (textDimension.width +5) , -(textDimension.height + 5));
+ }
+
+ public void performRequest(Request request) {
+ if (request.getType() == RequestConstants.REQ_DIRECT_EDIT) {
+ performDirectEdit();
+ } else {
+ super.performRequest(request);
+ }
+ }
+
+ protected void performDirectEdit() {
+ Label label = (Label) getFigure();
+ if (label == null) {
+ return;
+ }
+ if (manager == null) {
+ manager = new ElementDirectEditManager(this, new CellEditorLocator(label));
+ }
+ manager.show();
+ }
+
+ public LabelWrapper getLabelWrapper() {
+ return (LabelWrapper)getModel();
+ }
+
+ public DragTracker getDragTracker(Request request) {
+ return new DragEditPartsTracker(this) {
+ protected EditPart getTargetEditPart() {
+ return getParent();
+ }
+ };
+ }
+
+ public void activate() {
+ super.activate();
+ getLabelWrapper().addListener(this);
+ if (getParent().getModel() instanceof Wrapper) {
+ ((Wrapper)getParent().getModel()).addListener(this);
+ }
+ }
+
+ public void deactivate() {
+ if (getParent().getModel() instanceof Wrapper) {
+ ((Wrapper)getParent().getModel()).removeListener(this);
+ }
+ getLabelWrapper().removeListener(this);
+ super.deactivate();
+ }
+
+ public void modelChanged(ModelEvent event) {
+ if (event.getChangeType() == Wrapper.CHANGE_PROPERTY || event.getChangeType() ==
Wrapper.CHANGE_VISUAL) {
+ refreshVisuals();
+ }
+ }
+
+ private class LabelConstraint implements Locator {
+ String text;
+ Point relativeLocation;
+ Polyline polyline;
+ public LabelConstraint(String text, Point location, Polyline polyline) {
+ this.text = text;
+ this.relativeLocation = location;
+ this.polyline = polyline;
+ }
+ public void relocate(IFigure figure) {
+ Dimension minimum = FigureUtilities.getTextExtents(text, figure.getFont());
+ figure.setSize(minimum);
+ Point midPoint = polyline.getPoints().getMidpoint();
+ Point newLocation = relativeLocation.getCopy();
+ newLocation.translate(midPoint);
+ figure.setLocation(newLocation);
+ }
+ }
+
+
+}
Deleted:
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/Wrapper.java
===================================================================
---
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/Wrapper.java 2009-07-02
15:15:08 UTC (rev 16344)
+++
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/Wrapper.java 2009-11-11
20:50:49 UTC (rev 18622)
@@ -1,34 +0,0 @@
-package org.jboss.tools.flow.common.wrapper;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.flow.common.model.Element;
-
-
-public interface Wrapper extends IAdaptable, IPropertySource, Element {
-
-// int ADD_INCOMING_CONNECTION = 1;
-// int REMOVE_INCOMING_CONNECTION = 2;
-// int ADD_OUTGOING_CONNECTION = 3;
-// int REMOVE_OUTGOING_CONNECTION = 4;
- int CHANGE_VISUAL = 5;
- int ADD_ELEMENT = 6;
- int REMOVE_ELEMENT = 7;
- int CHANGE_PROPERTY = 8;
-
-
-
- void setElement(Element element);
- Element getElement();
-
- void addChild(Object type, Element element);
- void removeChild(Object type, Element element);
- List<Element> getChildren(Object type);
-
- void addListener(ModelListener listener);
- void removeListener(ModelListener listener);
- void notifyListeners(int changeId, Object changeDiscriminator, Object changedObject,
Object oldValue, Object newValue);
-
-}
Copied:
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/Wrapper.java
(from rev 17043,
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/Wrapper.java)
===================================================================
---
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/Wrapper.java
(rev 0)
+++
tags/jbpm-jpdl-4.2/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/Wrapper.java 2009-11-11
20:50:49 UTC (rev 18622)
@@ -0,0 +1,30 @@
+package org.jboss.tools.flow.common.wrapper;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.flow.common.model.Element;
+
+
+public interface Wrapper extends IAdaptable, IPropertySource, Element {
+
+ int CHANGE_VISUAL = 5;
+ int ADD_ELEMENT = 6;
+ int REMOVE_ELEMENT = 7;
+ int CHANGE_PROPERTY = 8;
+
+
+
+ void setElement(Element element);
+ Element getElement();
+
+ void addChild(Object type, Element element);
+ void removeChild(Object type, Element element);
+ List<Element> getChildren(Object type);
+
+ void addListener(ModelListener listener);
+ void removeListener(ModelListener listener);
+ void notifyListeners(int changeId, Object changeDiscriminator, Object changedObject,
Object oldValue, Object newValue);
+
+}