refs bug #285397 - added logic example to demo
diff --git a/bundles/org.eclipse.rap.gef.demo/plugin.xml b/bundles/org.eclipse.rap.gef.demo/plugin.xml
index 5168fbe..2ae04e5 100644
--- a/bundles/org.eclipse.rap.gef.demo/plugin.xml
+++ b/bundles/org.eclipse.rap.gef.demo/plugin.xml
@@ -40,6 +40,12 @@
             id="org.eclipse.rap.gef.demo.Application$FlowExampleView"
             name="Flow"
             restorable="true">
+      </view>
+      <view
+            class="org.eclipse.rap.gef.demo.Application$LogicExampleView"
+            id="org.eclipse.rap.gef.demo.Application$LogicExampleView"
+            name="Logic"
+            restorable="true">
       </view>      
    </extension>
    <extension
@@ -66,6 +72,16 @@
                showTitle="true"
                visible="true">
          </view>
+         <view
+               closeable="false"
+               id="org.eclipse.rap.gef.demo.Application$LogicExampleView"
+               minimized="false"
+               moveable="true"
+               relationship="stack"
+               relative="org.eclipse.rap.gef.demo.Application$Draw2DExampleView"
+               showTitle="true"
+               visible="true">
+         </view>
       </perspectiveExtension>
    </extension>
 </plugin>
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/flow/ui/FlowEditorView.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/flow/ui/FlowEditorView.java
index a0d30e1..c024ce1 100644
--- a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/flow/ui/FlowEditorView.java
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/flow/ui/FlowEditorView.java
@@ -18,7 +18,7 @@
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.gef.examples.flow.model.ActivityDiagram;
 import org.eclipse.rap.gef.demo.EditorView;
-import org.eclipse.rap.gef.demo.TimelineEditorInput;
+import org.eclipse.rap.gef.demo.DirectEditorInput;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.layout.GridData;
@@ -33,13 +33,13 @@
   public FlowEditorView () {
     super();
     editor = new FlowEditor();
-    initTimeline();
+    init();
   }
   
-  private void initTimeline () {
+  private void init () {
     try {
       IWorkbench workbench = PlatformUI.getWorkbench();
-      TimelineEditorInput input = new TimelineEditorInput();
+      DirectEditorInput input = new DirectEditorInput();
       input.setName("Flow Example");
       ((FlowEditor)editor).setInput(input);
     } 
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicContextMenuProvider.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicContextMenuProvider.java
new file mode 100644
index 0000000..d55347b
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicContextMenuProvider.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.ui.actions.ActionFactory;
+
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.actions.GEFActionConstants;
+
+import org.eclipse.gef.examples.logicdesigner.actions.IncrementDecrementAction;
+
+public class LogicContextMenuProvider extends
+		org.eclipse.gef.ContextMenuProvider {
+
+	private ActionRegistry actionRegistry;
+
+	public LogicContextMenuProvider(EditPartViewer viewer,
+			ActionRegistry registry) {
+		super(viewer);
+		setActionRegistry(registry);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.gef.ContextMenuProvider#menuAboutToShow(org.eclipse.jface
+	 * .action.IMenuManager)
+	 */
+	public void buildContextMenu(IMenuManager manager) {
+		GEFActionConstants.addStandardActionGroups(manager);
+
+		IAction action;
+
+		action = getActionRegistry().getAction(ActionFactory.UNDO.getId());
+		manager.appendToGroup(GEFActionConstants.GROUP_UNDO, action);
+
+		action = getActionRegistry().getAction(ActionFactory.REDO.getId());
+		manager.appendToGroup(GEFActionConstants.GROUP_UNDO, action);
+
+		action = getActionRegistry().getAction(ActionFactory.PASTE.getId());
+		if (action.isEnabled())
+			manager.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
+
+		action = getActionRegistry().getAction(ActionFactory.DELETE.getId());
+		if (action.isEnabled())
+			manager.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
+
+		action = getActionRegistry().getAction(GEFActionConstants.DIRECT_EDIT);
+		if (action.isEnabled())
+			manager.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
+
+		action = getActionRegistry().getAction(
+				IncrementDecrementAction.INCREMENT);
+		if (action.isEnabled())
+			manager.appendToGroup(GEFActionConstants.GROUP_REST, action);
+
+		action = getActionRegistry().getAction(
+				IncrementDecrementAction.DECREMENT);
+		if (action.isEnabled())
+			manager.appendToGroup(GEFActionConstants.GROUP_REST, action);
+
+		// Alignment Actions
+		MenuManager submenu = new MenuManager(
+				LogicMessages.AlignmentAction_AlignSubmenu_ActionLabelText);
+
+		action = getActionRegistry().getAction(GEFActionConstants.ALIGN_LEFT);
+		if (action.isEnabled())
+			submenu.add(action);
+
+		action = getActionRegistry().getAction(GEFActionConstants.ALIGN_CENTER);
+		if (action.isEnabled())
+			submenu.add(action);
+
+		action = getActionRegistry().getAction(GEFActionConstants.ALIGN_RIGHT);
+		if (action.isEnabled())
+			submenu.add(action);
+
+		submenu.add(new Separator());
+
+		action = getActionRegistry().getAction(GEFActionConstants.ALIGN_TOP);
+		if (action.isEnabled())
+			submenu.add(action);
+
+		action = getActionRegistry().getAction(GEFActionConstants.ALIGN_MIDDLE);
+		if (action.isEnabled())
+			submenu.add(action);
+
+		action = getActionRegistry().getAction(GEFActionConstants.ALIGN_BOTTOM);
+		if (action.isEnabled())
+			submenu.add(action);
+
+		if (!submenu.isEmpty())
+			manager.appendToGroup(GEFActionConstants.GROUP_REST, submenu);
+
+		action = getActionRegistry().getAction(ActionFactory.SAVE.getId());
+		manager.appendToGroup(GEFActionConstants.GROUP_SAVE, action);
+
+	}
+
+	private ActionRegistry getActionRegistry() {
+		return actionRegistry;
+	}
+
+	private void setActionRegistry(ActionRegistry registry) {
+		actionRegistry = registry;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicCreationWizard.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicCreationWizard.java
new file mode 100644
index 0000000..e93cc09
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicCreationWizard.java
@@ -0,0 +1,38 @@
+///*******************************************************************************
+// * Copyright (c) 2000, 2010 IBM Corporation and others.
+// * All rights reserved. This program and the accompanying materials
+// * are made available under the terms of the Eclipse Public License v1.0
+// * which accompanies this distribution, and is available at
+// * http://www.eclipse.org/legal/epl-v10.html
+// *
+// * Contributors:
+// *     IBM Corporation - initial API and implementation
+// *******************************************************************************/
+//package org.eclipse.gef.examples.logicdesigner;
+//
+//import org.eclipse.jface.viewers.IStructuredSelection;
+//import org.eclipse.jface.wizard.Wizard;
+//import org.eclipse.ui.INewWizard;
+//import org.eclipse.ui.IWorkbench;
+//
+//public class LogicCreationWizard extends Wizard implements INewWizard {
+//	private LogicWizardPage1 logicPage = null;
+//	private IStructuredSelection selection;
+//	private IWorkbench workbench;
+//
+//	public void addPages() {
+//		logicPage = new LogicWizardPage1(workbench, selection);
+//		addPage(logicPage);
+//	}
+//
+//	public void init(IWorkbench aWorkbench,
+//			IStructuredSelection currentSelection) {
+//		workbench = aWorkbench;
+//		selection = currentSelection;
+//	}
+//
+//	public boolean performFinish() {
+//		return logicPage.finish();
+//	}
+//
+//}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicEditor.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicEditor.java
new file mode 100644
index 0000000..7f08c01
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicEditor.java
@@ -0,0 +1,856 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.EventObject;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.ConnectionLayer;
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.draw2d.LightweightSystem;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.Viewport;
+import org.eclipse.draw2d.ViewportAwareConnectionLayerClippingStrategy;
+import org.eclipse.draw2d.parts.ScrollableThumbnail;
+import org.eclipse.draw2d.parts.Thumbnail;
+import org.eclipse.gef.ContextMenuProvider;
+import org.eclipse.gef.DefaultEditDomain;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.KeyHandler;
+import org.eclipse.gef.KeyStroke;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.MouseWheelHandler;
+import org.eclipse.gef.MouseWheelZoomHandler;
+import org.eclipse.gef.RootEditPart;
+import org.eclipse.gef.SnapToGeometry;
+import org.eclipse.gef.SnapToGrid;
+import org.eclipse.gef.dnd.TemplateTransferDragSourceListener;
+import org.eclipse.gef.dnd.TemplateTransferDropTargetListener;
+import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.examples.logicdesigner.actions.IncrementDecrementAction;
+import org.eclipse.gef.examples.logicdesigner.actions.LogicPasteTemplateAction;
+import org.eclipse.gef.examples.logicdesigner.dnd.TextTransferDropTargetListener;
+import org.eclipse.gef.examples.logicdesigner.edit.GraphicalPartFactory;
+import org.eclipse.gef.examples.logicdesigner.edit.TreePartFactory;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicRuler;
+import org.eclipse.gef.examples.logicdesigner.palette.LogicPaletteCustomizer;
+import org.eclipse.gef.examples.logicdesigner.rulers.LogicRulerProvider;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.rulers.RulerProvider;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.actions.AlignmentAction;
+import org.eclipse.gef.ui.actions.CopyTemplateAction;
+import org.eclipse.gef.ui.actions.DirectEditAction;
+import org.eclipse.gef.ui.actions.GEFActionConstants;
+import org.eclipse.gef.ui.actions.MatchHeightAction;
+import org.eclipse.gef.ui.actions.MatchWidthAction;
+import org.eclipse.gef.ui.actions.ToggleGridAction;
+import org.eclipse.gef.ui.actions.ToggleRulerVisibilityAction;
+import org.eclipse.gef.ui.actions.ToggleSnapToGeometryAction;
+import org.eclipse.gef.ui.actions.ZoomInAction;
+import org.eclipse.gef.ui.actions.ZoomOutAction;
+import org.eclipse.gef.ui.palette.PaletteViewer;
+import org.eclipse.gef.ui.palette.PaletteViewerProvider;
+import org.eclipse.gef.ui.parts.ContentOutlinePage;
+import org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette;
+import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
+import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
+import org.eclipse.gef.ui.parts.TreeViewer;
+import org.eclipse.gef.ui.rulers.RulerComposite;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.TransferDropTargetListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.part.IPageSite;
+import org.eclipse.ui.part.PageBook;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+public class LogicEditor extends GraphicalEditorWithFlyoutPalette {
+
+	class OutlinePage extends ContentOutlinePage implements IAdaptable {
+
+		private PageBook pageBook;
+		private Control outline;
+		private Canvas overview;
+		private IAction showOutlineAction, showOverviewAction;
+		static final int ID_OUTLINE = 0;
+		static final int ID_OVERVIEW = 1;
+		private Thumbnail thumbnail;
+		private DisposeListener disposeListener;
+
+		public OutlinePage(EditPartViewer viewer) {
+			super(viewer);
+		}
+
+		public void init(IPageSite pageSite) {
+			super.init(pageSite);
+			ActionRegistry registry = getActionRegistry();
+			IActionBars bars = pageSite.getActionBars();
+			String id = ActionFactory.UNDO.getId();
+			bars.setGlobalActionHandler(id, registry.getAction(id));
+			id = ActionFactory.REDO.getId();
+			bars.setGlobalActionHandler(id, registry.getAction(id));
+			id = ActionFactory.DELETE.getId();
+			bars.setGlobalActionHandler(id, registry.getAction(id));
+			id = IncrementDecrementAction.INCREMENT;
+			bars.setGlobalActionHandler(id, registry.getAction(id));
+			id = IncrementDecrementAction.DECREMENT;
+			bars.setGlobalActionHandler(id, registry.getAction(id));
+			bars.updateActionBars();
+		}
+
+		protected void configureOutlineViewer() {
+			getViewer().setEditDomain(getEditDomain());
+			getViewer().setEditPartFactory(new TreePartFactory());
+			ContextMenuProvider provider = new LogicContextMenuProvider(
+					getViewer(), getActionRegistry());
+			getViewer().setContextMenu(provider);
+			getSite().registerContextMenu(
+					"org.eclipse.gef.examples.logic.outline.contextmenu", //$NON-NLS-1$
+					provider, getSite().getSelectionProvider());
+			getViewer().setKeyHandler(getCommonKeyHandler());
+			getViewer()
+					.addDropTargetListener(
+							(TransferDropTargetListener) new TemplateTransferDropTargetListener(
+									getViewer()));
+			IToolBarManager tbm = getSite().getActionBars().getToolBarManager();
+			showOutlineAction = new Action() {
+				public void run() {
+					showPage(ID_OUTLINE);
+				}
+			};
+			showOutlineAction.setImageDescriptor(ImageDescriptor
+					.createFromFile(LogicPlugin.class, "icons/outline.gif")); //$NON-NLS-1$
+			showOutlineAction
+					.setToolTipText(LogicMessages.LogicEditor_outline_show_outline);
+			tbm.add(showOutlineAction);
+			showOverviewAction = new Action() {
+				public void run() {
+					showPage(ID_OVERVIEW);
+				}
+			};
+			showOverviewAction.setImageDescriptor(ImageDescriptor
+					.createFromFile(LogicPlugin.class, "icons/overview.gif")); //$NON-NLS-1$
+			showOverviewAction
+					.setToolTipText(LogicMessages.LogicEditor_outline_show_overview);
+			tbm.add(showOverviewAction);
+			showPage(ID_OUTLINE);
+		}
+
+		public void createControl(Composite parent) {
+			pageBook = new PageBook(parent, SWT.NONE);
+			outline = getViewer().createControl(pageBook);
+			overview = new Canvas(pageBook, SWT.NONE);
+			pageBook.showPage(outline);
+			configureOutlineViewer();
+			hookOutlineViewer();
+			initializeOutlineViewer();
+		}
+
+		public void dispose() {
+			unhookOutlineViewer();
+			if (thumbnail != null) {
+				thumbnail.deactivate();
+				thumbnail = null;
+			}
+			super.dispose();
+			LogicEditor.this.outlinePage = null;
+			outlinePage = null;
+		}
+
+		public Object getAdapter(Class type) {
+			if (type == ZoomManager.class)
+				return getGraphicalViewer().getProperty(
+						ZoomManager.class.toString());
+			return null;
+		}
+
+		public Control getControl() {
+			return pageBook;
+		}
+
+		protected void hookOutlineViewer() {
+			getSelectionSynchronizer().addViewer(getViewer());
+		}
+
+		protected void initializeOutlineViewer() {
+			setContents(getLogicDiagram());
+		}
+
+		protected void initializeOverview() {
+			LightweightSystem lws = new LightweightSystem(overview);
+			RootEditPart rep = getGraphicalViewer().getRootEditPart();
+			if (rep instanceof ScalableFreeformRootEditPart) {
+				ScalableFreeformRootEditPart root = (ScalableFreeformRootEditPart) rep;
+				thumbnail = new ScrollableThumbnail((Viewport) root.getFigure());
+				thumbnail.setBorder(new MarginBorder(3));
+				thumbnail.setSource(root
+						.getLayer(LayerConstants.PRINTABLE_LAYERS));
+				lws.setContents(thumbnail);
+				disposeListener = new DisposeListener() {
+					public void widgetDisposed(DisposeEvent e) {
+						if (thumbnail != null) {
+							thumbnail.deactivate();
+							thumbnail = null;
+						}
+					}
+				};
+				getEditor().addDisposeListener(disposeListener);
+			}
+		}
+
+		public void setContents(Object contents) {
+			getViewer().setContents(contents);
+		}
+
+		protected void showPage(int id) {
+			if (id == ID_OUTLINE) {
+				showOutlineAction.setChecked(true);
+				showOverviewAction.setChecked(false);
+				pageBook.showPage(outline);
+				if (thumbnail != null)
+					thumbnail.setVisible(false);
+			} else if (id == ID_OVERVIEW) {
+				if (thumbnail == null)
+					initializeOverview();
+				showOutlineAction.setChecked(false);
+				showOverviewAction.setChecked(true);
+				pageBook.showPage(overview);
+				thumbnail.setVisible(true);
+			}
+		}
+
+		protected void unhookOutlineViewer() {
+			getSelectionSynchronizer().removeViewer(getViewer());
+			if (disposeListener != null && getEditor() != null
+					&& !getEditor().isDisposed())
+				getEditor().removeDisposeListener(disposeListener);
+		}
+	}
+
+	private KeyHandler sharedKeyHandler;
+	private PaletteRoot root;
+	private OutlinePage outlinePage;
+	private boolean editorSaving = false;
+
+//	// This class listens to changes to the file system in the workspace, and
+//	// makes changes accordingly.
+//	// 1) An open, saved file gets deleted -> close the editor
+//	// 2) An open file gets renamed or moved -> change the editor's input
+//	// accordingly
+//	class ResourceTracker implements IResourceChangeListener,
+//			IResourceDeltaVisitor {
+//		public void resourceChanged(IResourceChangeEvent event) {
+//			IResourceDelta delta = event.getDelta();
+//			try {
+//				if (delta != null)
+//					delta.accept(this);
+//			} catch (CoreException exception) {
+//				// What should be done here?
+//			}
+//		}
+//
+//		public boolean visit(IResourceDelta delta) {
+//			if (delta == null
+//					|| !delta.getResource().equals(
+//							((IFileEditorInput) getEditorInput()).getFile()))
+//				return true;
+//
+//			if (delta.getKind() == IResourceDelta.REMOVED) {
+//				Display display = getSite().getShell().getDisplay();
+//				if ((IResourceDelta.MOVED_TO & delta.getFlags()) == 0) { // if
+//																			// the
+//																			// file
+//																			// was
+//																			// deleted
+//					// NOTE: The case where an open, unsaved file is deleted is
+//					// being handled by the
+//					// PartListener added to the Workbench in the initialize()
+//					// method.
+//					display.asyncExec(new Runnable() {
+//						public void run() {
+//							if (!isDirty())
+//								closeEditor(false);
+//						}
+//					});
+//				} else { // else if it was moved or renamed
+//					final IFile newFile = ResourcesPlugin.getWorkspace()
+//							.getRoot().getFile(delta.getMovedToPath());
+//					display.asyncExec(new Runnable() {
+//						public void run() {
+//							superSetInput(new FileEditorInput(newFile));
+//						}
+//					});
+//				}
+//			} else if (delta.getKind() == IResourceDelta.CHANGED) {
+//				if (!editorSaving) {
+//					// the file was overwritten somehow (could have been
+//					// replaced by another
+//					// version in the respository)
+//					final IFile newFile = ResourcesPlugin.getWorkspace()
+//							.getRoot().getFile(delta.getFullPath());
+//					Display display = getSite().getShell().getDisplay();
+//					display.asyncExec(new Runnable() {
+//						public void run() {
+//							setInput(new FileEditorInput(newFile));
+//							getCommandStack().flush();
+//						}
+//					});
+//				}
+//			}
+//			return false;
+//		}
+//	}
+
+//	private IPartListener partListener = new IPartListener() {
+//		// If an open, unsaved file was deleted, query the user to either do a
+//		// "Save As"
+//		// or close the editor.
+//		public void partActivated(IWorkbenchPart part) {
+//			if (part != LogicEditor.this)
+//				return;
+//			if (!((IFileEditorInput) getEditorInput()).getFile().exists()) {
+//				Shell shell = getSite().getShell();
+//				String title = LogicMessages.GraphicalEditor_FILE_DELETED_TITLE_UI;
+//				String message = LogicMessages.GraphicalEditor_FILE_DELETED_WITHOUT_SAVE_INFO;
+//				String[] buttons = {
+//						LogicMessages.GraphicalEditor_SAVE_BUTTON_UI,
+//						LogicMessages.GraphicalEditor_CLOSE_BUTTON_UI };
+//				MessageDialog dialog = new MessageDialog(shell, title, null,
+//						message, MessageDialog.QUESTION, buttons, 0);
+//				if (dialog.open() == 0) {
+//					if (!performSaveAs())
+//						partActivated(part);
+//				} else {
+//					closeEditor(false);
+//				}
+//			}
+//		}
+//
+//		public void partBroughtToTop(IWorkbenchPart part) {
+//		}
+//
+//		public void partClosed(IWorkbenchPart part) {
+//		}
+//
+//		public void partDeactivated(IWorkbenchPart part) {
+//		}
+//
+//		public void partOpened(IWorkbenchPart part) {
+//		}
+//	};
+
+	private LogicDiagram logicDiagram = new LogicDiagram();
+//	private ResourceTracker resourceListener = new ResourceTracker();
+	private RulerComposite rulerComp;
+
+	protected static final String PALETTE_DOCK_LOCATION = "Dock location"; //$NON-NLS-1$
+	protected static final String PALETTE_SIZE = "Palette Size"; //$NON-NLS-1$
+	protected static final String PALETTE_STATE = "Palette state"; //$NON-NLS-1$
+	protected static final int DEFAULT_PALETTE_SIZE = 130;
+
+	public LogicEditor() {
+		setEditDomain(new DefaultEditDomain(this));
+	}
+
+	protected void closeEditor(boolean save) {
+		getSite().getPage().closeEditor(LogicEditor.this, save);
+	}
+
+	public void commandStackChanged(EventObject event) {
+		firePropertyChange(IEditorPart.PROP_DIRTY);
+		super.commandStackChanged(event);
+	}
+
+	protected void configureGraphicalViewer() {
+		super.configureGraphicalViewer();
+		ScrollingGraphicalViewer viewer = (ScrollingGraphicalViewer) getGraphicalViewer();
+
+		ScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();
+
+		// set clipping strategy for connection layer
+		ConnectionLayer connectionLayer = (ConnectionLayer) root
+				.getLayer(LayerConstants.CONNECTION_LAYER);
+		connectionLayer
+				.setClippingStrategy(new ViewportAwareConnectionLayerClippingStrategy(
+						connectionLayer));
+
+		List zoomLevels = new ArrayList(3);
+		zoomLevels.add(ZoomManager.FIT_ALL);
+		zoomLevels.add(ZoomManager.FIT_WIDTH);
+		zoomLevels.add(ZoomManager.FIT_HEIGHT);
+		root.getZoomManager().setZoomLevelContributions(zoomLevels);
+
+		IAction zoomIn = new ZoomInAction(root.getZoomManager());
+		IAction zoomOut = new ZoomOutAction(root.getZoomManager());
+		getActionRegistry().registerAction(zoomIn);
+		getActionRegistry().registerAction(zoomOut);
+//		getSite().getKeyBindingService().registerAction(zoomIn);
+//		getSite().getKeyBindingService().registerAction(zoomOut);
+
+		viewer.setRootEditPart(root);
+
+		viewer.setEditPartFactory(new GraphicalPartFactory());
+		ContextMenuProvider provider = new LogicContextMenuProvider(viewer,
+				getActionRegistry());
+		viewer.setContextMenu(provider);
+		getSite().registerContextMenu(
+				"org.eclipse.gef.examples.logic.editor.contextmenu", //$NON-NLS-1$
+				provider, viewer);
+		viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer)
+				.setParent(getCommonKeyHandler()));
+
+		loadProperties();
+
+		// Actions
+		IAction showRulers = new ToggleRulerVisibilityAction(
+				getGraphicalViewer());
+		getActionRegistry().registerAction(showRulers);
+
+		IAction snapAction = new ToggleSnapToGeometryAction(
+				getGraphicalViewer());
+		getActionRegistry().registerAction(snapAction);
+
+		IAction showGrid = new ToggleGridAction(getGraphicalViewer());
+		getActionRegistry().registerAction(showGrid);
+
+		Listener listener = new Listener() {
+			public void handleEvent(Event event) {
+				handleActivationChanged(event);
+			}
+		};
+		getGraphicalControl().addListener(SWT.Activate, listener);
+		getGraphicalControl().addListener(SWT.Deactivate, listener);
+	}
+
+	protected void writeToOutputStream(OutputStream os) throws IOException {
+		ObjectOutputStream out = new ObjectOutputStream(os);
+		out.writeObject(getLogicDiagram());
+		out.close();
+	}
+
+	protected CustomPalettePage createPalettePage() {
+		return new CustomPalettePage(getPaletteViewerProvider()) {
+			public void init(IPageSite pageSite) {
+				super.init(pageSite);
+				IAction copy = getActionRegistry().getAction(
+						ActionFactory.COPY.getId());
+				pageSite.getActionBars().setGlobalActionHandler(
+						ActionFactory.COPY.getId(), copy);
+			}
+		};
+	}
+
+	protected PaletteViewerProvider createPaletteViewerProvider() {
+		return new PaletteViewerProvider(getEditDomain()) {
+			private IMenuListener menuListener;
+
+			protected void configurePaletteViewer(PaletteViewer viewer) {
+				super.configurePaletteViewer(viewer);
+				viewer.setCustomizer(new LogicPaletteCustomizer());
+				viewer.addDragSourceListener(new TemplateTransferDragSourceListener(
+						viewer));
+			}
+
+			protected void hookPaletteViewer(PaletteViewer viewer) {
+				super.hookPaletteViewer(viewer);
+				final CopyTemplateAction copy = (CopyTemplateAction) getActionRegistry()
+						.getAction(ActionFactory.COPY.getId());
+				viewer.addSelectionChangedListener(copy);
+				if (menuListener == null)
+					menuListener = new IMenuListener() {
+						public void menuAboutToShow(IMenuManager manager) {
+							manager.appendToGroup(
+									GEFActionConstants.GROUP_COPY, copy);
+						}
+					};
+				viewer.getContextMenu().addMenuListener(menuListener);
+			}
+		};
+	}
+
+	public void dispose() {
+//		getSite().getWorkbenchWindow().getPartService()
+//				.removePartListener(partListener);
+//		partListener = null;
+//		((IFileEditorInput) getEditorInput()).getFile().getWorkspace()
+//				.removeResourceChangeListener(resourceListener);
+		super.dispose();
+	}
+
+	public void doSave(final IProgressMonitor progressMonitor) {
+//		editorSaving = true;
+//		Platform.run(new SafeRunnable() {
+//			public void run() throws Exception {
+//				saveProperties();
+//				ByteArrayOutputStream out = new ByteArrayOutputStream();
+//				writeToOutputStream(out);
+//				IFile file = ((IFileEditorInput) getEditorInput()).getFile();
+//				file.setContents(new ByteArrayInputStream(out.toByteArray()),
+//						true, false, progressMonitor);
+//				getCommandStack().markSaveLocation();
+//			}
+//		});
+//		editorSaving = false;
+	}
+
+	public void doSaveAs() {
+		performSaveAs();
+	}
+
+	public Object getAdapter(Class type) {
+		if (type == IContentOutlinePage.class) {
+			outlinePage = new OutlinePage(new TreeViewer());
+			return outlinePage;
+		}
+		if (type == ZoomManager.class)
+			return getGraphicalViewer().getProperty(
+					ZoomManager.class.toString());
+
+		return super.getAdapter(type);
+	}
+
+	protected Control getGraphicalControl() {
+		return rulerComp;
+	}
+
+	/**
+	 * Returns the KeyHandler with common bindings for both the Outline and
+	 * Graphical Views. For example, delete is a common action.
+	 */
+	protected KeyHandler getCommonKeyHandler() {
+		if (sharedKeyHandler == null) {
+			sharedKeyHandler = new KeyHandler();
+			sharedKeyHandler.put(
+					KeyStroke.getPressed(SWT.F2, 0),
+					getActionRegistry().getAction(
+							GEFActionConstants.DIRECT_EDIT));
+		}
+		return sharedKeyHandler;
+	}
+
+	protected LogicDiagram getLogicDiagram() {
+		return logicDiagram;
+	}
+
+	protected PaletteRoot getPaletteRoot() {
+		if (root == null) {
+			root = LogicPlugin.createPalette();
+		}
+		return root;
+	}
+
+//	public void gotoMarker(IMarker marker) {
+//	}
+
+	protected void handleActivationChanged(Event event) {
+		IAction copy = null;
+		if (event.type == SWT.Deactivate)
+			copy = getActionRegistry().getAction(ActionFactory.COPY.getId());
+		if (getEditorSite().getActionBars().getGlobalActionHandler(
+				ActionFactory.COPY.getId()) != copy) {
+			getEditorSite().getActionBars().setGlobalActionHandler(
+					ActionFactory.COPY.getId(), copy);
+			getEditorSite().getActionBars().updateActionBars();
+		}
+	}
+
+	protected void initializeGraphicalViewer() {
+		super.initializeGraphicalViewer();
+		getGraphicalViewer().setContents(getLogicDiagram());
+
+		getGraphicalViewer()
+				.addDropTargetListener(
+						(TransferDropTargetListener) new TemplateTransferDropTargetListener(
+								getGraphicalViewer()));
+		getGraphicalViewer()
+				.addDropTargetListener(
+						(TransferDropTargetListener) new TextTransferDropTargetListener(
+								getGraphicalViewer(), TextTransfer
+										.getInstance()));
+	}
+
+	protected void createActions() {
+		super.createActions();
+		ActionRegistry registry = getActionRegistry();
+		IAction action;
+
+		action = new CopyTemplateAction(this);
+		registry.registerAction(action);
+
+		action = new MatchWidthAction(this);
+		registry.registerAction(action);
+		getSelectionActions().add(action.getId());
+
+		action = new MatchHeightAction(this);
+		registry.registerAction(action);
+		getSelectionActions().add(action.getId());
+
+		action = new LogicPasteTemplateAction(this);
+		registry.registerAction(action);
+		getSelectionActions().add(action.getId());
+
+		action = new IncrementDecrementAction(this, true);
+		registry.registerAction(action);
+		getSelectionActions().add(action.getId());
+
+		action = new IncrementDecrementAction(this, false);
+		registry.registerAction(action);
+		getSelectionActions().add(action.getId());
+
+		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.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.BOTTOM);
+		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.MIDDLE);
+		registry.registerAction(action);
+		getSelectionActions().add(action.getId());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.gef.ui.parts.GraphicalEditor#createGraphicalViewer(org.eclipse
+	 * .swt.widgets.Composite)
+	 */
+	protected void createGraphicalViewer(Composite parent) {
+		rulerComp = new RulerComposite(parent, SWT.NONE);
+		super.createGraphicalViewer(rulerComp);
+		rulerComp
+				.setGraphicalViewer((ScrollingGraphicalViewer) getGraphicalViewer());
+	}
+
+	protected FigureCanvas getEditor() {
+		return (FigureCanvas) getGraphicalViewer().getControl();
+	}
+
+	public boolean isSaveAsAllowed() {
+		return true;
+	}
+
+	protected void loadProperties() {
+		// Ruler properties
+		LogicRuler ruler = getLogicDiagram().getRuler(PositionConstants.WEST);
+		RulerProvider provider = null;
+		if (ruler != null) {
+			provider = new LogicRulerProvider(ruler);
+		}
+		getGraphicalViewer().setProperty(RulerProvider.PROPERTY_VERTICAL_RULER,
+				provider);
+		ruler = getLogicDiagram().getRuler(PositionConstants.NORTH);
+		provider = null;
+		if (ruler != null) {
+			provider = new LogicRulerProvider(ruler);
+		}
+		getGraphicalViewer().setProperty(
+				RulerProvider.PROPERTY_HORIZONTAL_RULER, provider);
+		getGraphicalViewer().setProperty(
+				RulerProvider.PROPERTY_RULER_VISIBILITY,
+				new Boolean(getLogicDiagram().getRulerVisibility()));
+
+		// Snap to Geometry property
+		getGraphicalViewer().setProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED,
+				new Boolean(getLogicDiagram().isSnapToGeometryEnabled()));
+
+		// Grid properties
+		getGraphicalViewer().setProperty(SnapToGrid.PROPERTY_GRID_ENABLED,
+				new Boolean(getLogicDiagram().isGridEnabled()));
+		// We keep grid visibility and enablement in sync
+		getGraphicalViewer().setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE,
+				new Boolean(getLogicDiagram().isGridEnabled()));
+
+		// Zoom
+		ZoomManager manager = (ZoomManager) getGraphicalViewer().getProperty(
+				ZoomManager.class.toString());
+		if (manager != null)
+			manager.setZoom(getLogicDiagram().getZoom());
+		// Scroll-wheel Zoom
+		getGraphicalViewer().setProperty(
+				MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1),
+				MouseWheelZoomHandler.SINGLETON);
+
+	}
+
+	protected boolean performSaveAs() {
+//		SaveAsDialog dialog = new SaveAsDialog(getSite().getWorkbenchWindow()
+//				.getShell());
+//		dialog.setOriginalFile(((IFileEditorInput) getEditorInput()).getFile());
+//		dialog.open();
+//		IPath path = dialog.getResult();
+//
+//		if (path == null)
+//			return false;
+//
+//		IWorkspace workspace = ResourcesPlugin.getWorkspace();
+//		final IFile file = workspace.getRoot().getFile(path);
+//
+//		if (!file.exists()) {
+//			WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+//				public void execute(final IProgressMonitor monitor) {
+//					saveProperties();
+//					try {
+//						ByteArrayOutputStream out = new ByteArrayOutputStream();
+//						writeToOutputStream(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);
+//			} catch (Exception e) {
+//				e.printStackTrace();
+//			}
+//		}
+//
+//		try {
+//			superSetInput(new FileEditorInput(file));
+//			getCommandStack().markSaveLocation();
+//		} catch (Exception e) {
+//			e.printStackTrace();
+//		}
+		return false;
+	}
+
+	protected void saveProperties() {
+		getLogicDiagram().setRulerVisibility(
+				((Boolean) getGraphicalViewer().getProperty(
+						RulerProvider.PROPERTY_RULER_VISIBILITY))
+						.booleanValue());
+		getLogicDiagram().setGridEnabled(
+				((Boolean) getGraphicalViewer().getProperty(
+						SnapToGrid.PROPERTY_GRID_ENABLED)).booleanValue());
+		getLogicDiagram().setSnapToGeometry(
+				((Boolean) getGraphicalViewer().getProperty(
+						SnapToGeometry.PROPERTY_SNAP_ENABLED)).booleanValue());
+		ZoomManager manager = (ZoomManager) getGraphicalViewer().getProperty(
+				ZoomManager.class.toString());
+		if (manager != null)
+			getLogicDiagram().setZoom(manager.getZoom());
+	}
+
+	protected void setInput(IEditorInput input) {
+		superSetInput(input);
+
+//		IFile file = ((IFileEditorInput) input).getFile();
+//		try {
+//			InputStream is = file.getContents(false);
+//			ObjectInputStream ois = new ObjectInputStream(is);
+		setLogicDiagram(new LogicDiagram());
+//			ois.close();
+//		} catch (Exception e) {
+//			// This is just an example. All exceptions caught here.
+//			e.printStackTrace();
+//		}
+
+//		if (!editorSaving) {
+//			if (getGraphicalViewer() != null) {
+//				getGraphicalViewer().setContents(getLogicDiagram());
+//				loadProperties();
+//			}
+//			if (outlinePage != null) {
+//				outlinePage.setContents(getLogicDiagram());
+//			}
+//		}
+	}
+
+	public void setLogicDiagram(LogicDiagram diagram) {
+		logicDiagram = diagram;
+	}
+
+	protected void superSetInput(IEditorInput input) {
+//		// The workspace never changes for an editor. So, removing and re-adding
+//		// the
+//		// resourceListener is not necessary. But it is being done here for the
+//		// sake
+//		// of proper implementation. Plus, the resourceListener needs to be
+//		// added
+//		// to the workspace the first time around.
+//		if (getEditorInput() != null) {
+//			IFile file = ((IFileEditorInput) getEditorInput()).getFile();
+//			file.getWorkspace().removeResourceChangeListener(resourceListener);
+//		}
+
+		super.setInput(input);
+
+//		if (getEditorInput() != null) {
+//			IFile file = ((IFileEditorInput) getEditorInput()).getFile();
+//			file.getWorkspace().addResourceChangeListener(resourceListener);
+//			setPartName(file.getName());
+//		}
+	}
+
+	protected void setSite(IWorkbenchPartSite site) {
+		super.setSite(site);
+//		getSite().getWorkbenchWindow().getPartService()
+//				.addPartListener(partListener);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicEditorView.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicEditorView.java
new file mode 100644
index 0000000..b46e520
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicEditorView.java
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * Copyright (c) 2009-2010 Texas Center for Applied Technology
+ * Texas Engineering Experiment Station
+ * The Texas A&M University System
+ * All Rights Reserved.
+ * 
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Austin Riddle (Texas Center for Applied Technology) - 
+ *                   initial demo implementation
+ *****************************************************************************/
+package org.eclipse.gef.examples.logicdesigner;
+
+import org.eclipse.rap.gef.demo.DirectEditorInput;
+import org.eclipse.rap.gef.demo.EditorView;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+
+public class LogicEditorView extends EditorView {
+  
+  public LogicEditorView () {
+    super();
+    editor = new LogicEditor();
+    init();
+  }
+  
+  private void init () {
+    try {
+      IWorkbench workbench = PlatformUI.getWorkbench();
+      DirectEditorInput input = new DirectEditorInput();
+      input.setName("Logic Example");
+      ((LogicEditor)editor).setInput(input);
+    } 
+    catch (Exception e) {
+      e.printStackTrace();
+    }
+  }
+  
+  public void createPartControl(Composite parent) {
+    Composite mainComposite = new Composite(parent, SWT.BORDER);
+    mainComposite.setLayout(new FillLayout());
+    super.createPartControl(mainComposite);
+  }
+  
+  public void dispose() {
+    editor.dispose();
+    super.dispose();
+  }
+  
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicMessages.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicMessages.java
new file mode 100644
index 0000000..c6a3002
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicMessages.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner;
+
+import org.eclipse.osgi.util.NLS;
+
+public class LogicMessages extends NLS {
+
+	public static String AddCommand_Label;
+	public static String AlignmentAction_AlignSubmenu_ActionLabelText;
+	public static String AndGate_LabelText;
+	public static String CellEditorValidator_NotANumberMessage;
+	public static String Circuit_LabelText;
+	public static String CloneCommand_Label;
+	public static String ConnectionCommand_Description;
+	public static String ConnectionCommand_Label;
+	public static String CreateCommand_Label;
+	public static String CreateGuideCommand_Label;
+	public static String CreateLogicPage1_Description;
+	public static String CreateLogicPage1_ModelNames_EmptyModelName;
+	public static String CreateLogicPage1_ModelNames_FourBitAdderModelName;
+	public static String CreateLogicPage1_ModelNames_GroupName;
+	public static String CreateLogicPage1_Title;
+	public static String DeleteCommand_Label;
+	public static String DeleteGuideCommand_Label;
+	public static String DimensionPropertySource_Property_Height_Label;
+	public static String DimensionPropertySource_Property_Width_Label;
+	public static String GraphicalEditor_CLOSE_BUTTON_UI;
+	public static String GraphicalEditor_FILE_DELETED_TITLE_UI;
+	public static String GraphicalEditor_FILE_DELETED_WITHOUT_SAVE_INFO;
+	public static String GraphicalEditor_SAVE_BUTTON_UI;
+	public static String GroundOutput_LabelText;
+	public static String IncrementDecrementAction_Decrement_ActionLabelText;
+	public static String IncrementDecrementAction_Decrement_ActionToolTipText;
+	public static String IncrementDecrementAction_Increment_ActionLabelText;
+	public static String IncrementDecrementAction_Increment_ActionToolTipText;
+	public static String IncrementDecrementCommand_LabelText;
+	public static String LED_LabelText;
+	public static String LiveOutput_LabelText;
+	public static String LocationPropertySource_Property_X_Label;
+	public static String LocationPropertySource_Property_Y_Label;
+	public static String LogicContainerEditPolicy_OrphanCommandLabelText;
+	public static String LogicDiagram_LabelText;
+	public static String LogicEditor_outline_show_outline;
+	public static String LogicEditor_outline_show_overview;
+	public static String LogicElementEditPolicy_OrphanCommandLabelText;
+	public static String LogicPlugin_Category_ComplexParts_Label;
+	public static String LogicPlugin_Category_Components_Label;
+	public static String LogicPlugin_Category_ControlGroup_Label;
+	public static String LogicPlugin_Tool_ConnectionCreationTool_ConnectionCreationTool_Description;
+	public static String LogicPlugin_Tool_ConnectionCreationTool_ConnectionCreationTool_Label;
+	public static String LogicPlugin_Tool_CreationTool_ANDGate_Description;
+	public static String LogicPlugin_Tool_CreationTool_ANDGate_Label;
+	public static String LogicPlugin_Tool_CreationTool_Circuit_Description;
+	public static String LogicPlugin_Tool_CreationTool_Circuit_Label;
+	public static String LogicPlugin_Tool_CreationTool_FlowContainer_Description;
+	public static String LogicPlugin_Tool_CreationTool_FlowContainer_Label;
+	public static String LogicPlugin_Tool_CreationTool_FullAdder_Description;
+	public static String LogicPlugin_Tool_CreationTool_FullAdder_Label;
+	public static String LogicPlugin_Tool_CreationTool_Ground_Description;
+	public static String LogicPlugin_Tool_CreationTool_Ground_Label;
+	public static String LogicPlugin_Tool_CreationTool_HalfAdder_Description;
+	public static String LogicPlugin_Tool_CreationTool_HalfAdder_Label;
+	public static String LogicPlugin_Tool_CreationTool_Label_Description;
+	public static String LogicPlugin_Tool_CreationTool_Label_Label;
+	public static String LogicPlugin_Tool_CreationTool_LED_Description;
+	public static String LogicPlugin_Tool_CreationTool_LED_Label;
+	public static String LogicPlugin_Tool_CreationTool_LiveGroundStack_Description;
+	public static String LogicPlugin_Tool_CreationTool_LiveGroundStack_Label;
+	public static String LogicPlugin_Tool_CreationTool_LiveOutput_Description;
+	public static String LogicPlugin_Tool_CreationTool_LiveOutput_Label;
+	public static String LogicPlugin_Tool_CreationTool_LogicLabel;
+	public static String LogicPlugin_Tool_CreationTool_ORGate_Description;
+	public static String LogicPlugin_Tool_CreationTool_ORGate_Label;
+	public static String LogicPlugin_Tool_CreationTool_XORGate_Description;
+	public static String LogicPlugin_Tool_CreationTool_XORGate_Label;
+	public static String LogicXYLayoutEditPolicy_AddCommandLabelText;
+	public static String LogicXYLayoutEditPolicy_CreateCommandLabelText;
+	public static String Marquee_Stack;
+	public static String MoveGuideCommand_Label;
+	public static String OrGate_LabelText;
+	public static String OrphanChildCommand_Label;
+	public static String PasteAction_ActionLabelText;
+	public static String PrintDialog_Height;
+	public static String PrintDialog_Page;
+	public static String PrintDialog_Tile;
+	public static String PrintDialog_Title;
+	public static String PrintDialog_Width;
+	public static String PropertyDescriptor_Label_Text;
+	public static String PropertyDescriptor_LED_Value;
+	public static String PropertyDescriptor_LogicDiagram_ConnectionRouter;
+	public static String PropertyDescriptor_LogicDiagram_Manhattan;
+	public static String PropertyDescriptor_LogicDiagram_Manual;
+	public static String PropertyDescriptor_LogicDiagram_ShortestPath;
+	public static String PropertyDescriptor_LogicSubPart_Location;
+	public static String PropertyDescriptor_LogicSubPart_Size;
+	public static String ReorderPartCommand_Label;
+	public static String SetLocationCommand_Label_Location;
+	public static String SetLocationCommand_Label_Resize;
+	public static String ViewMenu_LabelText;
+	public static String Wire_LabelText;
+	public static String XORGate_LabelText;
+
+	static {
+		NLS.initializeMessages(
+				"org.eclipse.gef.examples.logicdesigner.messages", LogicMessages.class); //$NON-NLS-1$
+	}
+
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicPlugin.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicPlugin.java
new file mode 100644
index 0000000..bb17b9e
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicPlugin.java
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
+import org.eclipse.gef.palette.ConnectionCreationToolEntry;
+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.PaletteSeparator;
+import org.eclipse.gef.palette.PaletteStack;
+import org.eclipse.gef.palette.PanningSelectionToolEntry;
+import org.eclipse.gef.palette.ToolEntry;
+import org.eclipse.gef.requests.SimpleFactory;
+import org.eclipse.gef.tools.MarqueeSelectionTool;
+
+import org.eclipse.gef.examples.logicdesigner.model.AndGate;
+import org.eclipse.gef.examples.logicdesigner.model.Circuit;
+import org.eclipse.gef.examples.logicdesigner.model.GroundOutput;
+import org.eclipse.gef.examples.logicdesigner.model.LED;
+import org.eclipse.gef.examples.logicdesigner.model.LiveOutput;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagramFactory;
+import org.eclipse.gef.examples.logicdesigner.model.LogicFlowContainer;
+import org.eclipse.gef.examples.logicdesigner.model.LogicLabel;
+import org.eclipse.gef.examples.logicdesigner.model.OrGate;
+import org.eclipse.gef.examples.logicdesigner.model.XORGate;
+
+public class LogicPlugin extends org.eclipse.ui.plugin.AbstractUIPlugin {
+
+	private static LogicPlugin singleton;
+
+	static private List createCategories(PaletteRoot root) {
+		List categories = new ArrayList();
+
+		categories.add(createControlGroup(root));
+		categories.add(createComponentsDrawer());
+		categories.add(createComplexPartsDrawer());
+		// categories.add(createTemplateComponentsDrawer());
+		// categories.add(createComplexTemplatePartsDrawer());
+
+		return categories;
+	}
+
+	static private PaletteContainer createComplexPartsDrawer() {
+		PaletteDrawer drawer = new PaletteDrawer(
+				LogicMessages.LogicPlugin_Category_ComplexParts_Label,
+				ImageDescriptor.createFromFile(Circuit.class, "icons/can.gif")); //$NON-NLS-1$
+
+		List entries = new ArrayList();
+
+		CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
+				LogicMessages.LogicPlugin_Tool_CreationTool_HalfAdder_Label,
+				LogicMessages.LogicPlugin_Tool_CreationTool_HalfAdder_Description,
+				LogicDiagramFactory.getHalfAdderFactory(),
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/halfadder16.gif"), //$NON-NLS-1$
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/halfadder24.gif") //$NON-NLS-1$
+		);
+		entries.add(combined);
+
+		combined = new CombinedTemplateCreationEntry(
+				LogicMessages.LogicPlugin_Tool_CreationTool_FullAdder_Label,
+				LogicMessages.LogicPlugin_Tool_CreationTool_FullAdder_Description,
+				LogicDiagramFactory.getFullAdderFactory(),
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/fulladder16.gif"), //$NON-NLS-1$
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/fulladder24.gif") //$NON-NLS-1$
+		);
+		entries.add(combined);
+
+		drawer.addAll(entries);
+		return drawer;
+	}
+
+	static private PaletteContainer createComponentsDrawer() {
+
+		PaletteDrawer drawer = new PaletteDrawer(
+				LogicMessages.LogicPlugin_Category_Components_Label,
+				ImageDescriptor.createFromFile(Circuit.class, "icons/comp.gif"));//$NON-NLS-1$
+
+		List entries = new ArrayList();
+
+		CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
+				LogicMessages.LogicPlugin_Tool_CreationTool_FlowContainer_Label,
+				LogicMessages.LogicPlugin_Tool_CreationTool_FlowContainer_Description,
+				new SimpleFactory(LogicFlowContainer.class),
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/logicflow16.gif"), //$NON-NLS-1$
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/logicflow24.gif")//$NON-NLS-1$
+		);
+		entries.add(combined);
+
+		combined = new CombinedTemplateCreationEntry(
+				LogicMessages.LogicPlugin_Tool_CreationTool_Circuit_Label,
+				LogicMessages.LogicPlugin_Tool_CreationTool_Circuit_Description,
+				new SimpleFactory(Circuit.class), ImageDescriptor
+						.createFromFile(Circuit.class, "icons/circuit16.gif"),//$NON-NLS-1$
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/circuit24.gif")//$NON-NLS-1$
+		);
+		entries.add(combined);
+
+		entries.add(new PaletteSeparator());
+
+		combined = new CombinedTemplateCreationEntry(
+				LogicMessages.LogicPlugin_Tool_CreationTool_Label_Label,
+				LogicMessages.LogicPlugin_Tool_CreationTool_Label_Description,
+				new SimpleFactory(LogicLabel.class),
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/label16.gif"), //$NON-NLS-1$
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/label24.gif")//$NON-NLS-1$
+		);
+		entries.add(combined);
+
+		combined = new CombinedTemplateCreationEntry(
+				LogicMessages.LogicPlugin_Tool_CreationTool_LED_Label,
+				LogicMessages.LogicPlugin_Tool_CreationTool_LED_Description,
+				new SimpleFactory(LED.class), ImageDescriptor.createFromFile(
+						Circuit.class, "icons/ledicon16.gif"), //$NON-NLS-1$
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/ledicon24.gif")//$NON-NLS-1$
+		);
+		entries.add(combined);
+
+		combined = new CombinedTemplateCreationEntry(
+				LogicMessages.LogicPlugin_Tool_CreationTool_ORGate_Label,
+				LogicMessages.LogicPlugin_Tool_CreationTool_ORGate_Description,
+				new SimpleFactory(OrGate.class),
+				ImageDescriptor.createFromFile(Circuit.class, "icons/or16.gif"),//$NON-NLS-1$
+				ImageDescriptor.createFromFile(Circuit.class, "icons/or24.gif")//$NON-NLS-1$
+		);
+		entries.add(combined);
+
+		combined = new CombinedTemplateCreationEntry(
+				LogicMessages.LogicPlugin_Tool_CreationTool_XORGate_Label,
+				LogicMessages.LogicPlugin_Tool_CreationTool_XORGate_Description,
+				new SimpleFactory(XORGate.class), ImageDescriptor
+						.createFromFile(Circuit.class, "icons/xor16.gif"),//$NON-NLS-1$
+				ImageDescriptor
+						.createFromFile(Circuit.class, "icons/xor24.gif")//$NON-NLS-1$
+		);
+		entries.add(combined);
+
+		combined = new CombinedTemplateCreationEntry(
+				LogicMessages.LogicPlugin_Tool_CreationTool_ANDGate_Label,
+				LogicMessages.LogicPlugin_Tool_CreationTool_ANDGate_Description,
+				new SimpleFactory(AndGate.class), ImageDescriptor
+						.createFromFile(Circuit.class, "icons/and16.gif"),//$NON-NLS-1$
+				ImageDescriptor
+						.createFromFile(Circuit.class, "icons/and24.gif")//$NON-NLS-1$
+		);
+		entries.add(combined);
+
+		PaletteStack liveGroundStack = new PaletteStack(
+				LogicMessages.LogicPlugin_Tool_CreationTool_LiveGroundStack_Label,
+				LogicMessages.LogicPlugin_Tool_CreationTool_LiveGroundStack_Description,
+				null);
+
+		combined = new CombinedTemplateCreationEntry(
+				LogicMessages.LogicPlugin_Tool_CreationTool_LiveOutput_Label,
+				LogicMessages.LogicPlugin_Tool_CreationTool_LiveOutput_Description,
+				new SimpleFactory(LiveOutput.class), ImageDescriptor
+						.createFromFile(Circuit.class, "icons/live16.gif"),//$NON-NLS-1$
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/live24.gif")//$NON-NLS-1$
+		);
+		liveGroundStack.add(combined);
+
+		combined = new CombinedTemplateCreationEntry(
+				LogicMessages.LogicPlugin_Tool_CreationTool_Ground_Label,
+				LogicMessages.LogicPlugin_Tool_CreationTool_Ground_Description,
+				new SimpleFactory(GroundOutput.class),
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/ground16.gif"),//$NON-NLS-1$
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/ground24.gif")//$NON-NLS-1$
+		);
+		liveGroundStack.add(combined);
+
+		entries.add(liveGroundStack);
+
+		drawer.addAll(entries);
+		return drawer;
+	}
+
+	static private PaletteContainer createControlGroup(PaletteRoot root) {
+		PaletteGroup controlGroup = new PaletteGroup(
+				LogicMessages.LogicPlugin_Category_ControlGroup_Label);
+
+		List entries = new ArrayList();
+
+		ToolEntry tool = new PanningSelectionToolEntry();
+		entries.add(tool);
+		root.setDefaultEntry(tool);
+
+		PaletteStack marqueeStack = new PaletteStack(
+				LogicMessages.Marquee_Stack, "", null); //$NON-NLS-1$
+		marqueeStack.add(new MarqueeToolEntry());
+		MarqueeToolEntry marquee = new MarqueeToolEntry();
+		marquee.setToolProperty(MarqueeSelectionTool.PROPERTY_MARQUEE_BEHAVIOR,
+				new Integer(MarqueeSelectionTool.BEHAVIOR_CONNECTIONS_TOUCHED));
+		marqueeStack.add(marquee);
+		marquee = new MarqueeToolEntry();
+		marquee.setToolProperty(MarqueeSelectionTool.PROPERTY_MARQUEE_BEHAVIOR,
+				new Integer(MarqueeSelectionTool.BEHAVIOR_CONNECTIONS_TOUCHED
+						| MarqueeSelectionTool.BEHAVIOR_NODES_CONTAINED));
+		marqueeStack.add(marquee);
+		marqueeStack
+				.setUserModificationPermission(PaletteEntry.PERMISSION_NO_MODIFICATION);
+		entries.add(marqueeStack);
+
+		tool = new ConnectionCreationToolEntry(
+				LogicMessages.LogicPlugin_Tool_ConnectionCreationTool_ConnectionCreationTool_Label,
+				LogicMessages.LogicPlugin_Tool_ConnectionCreationTool_ConnectionCreationTool_Description,
+				null, ImageDescriptor.createFromFile(Circuit.class,
+						"icons/connection16.gif"),//$NON-NLS-1$
+				ImageDescriptor.createFromFile(Circuit.class,
+						"icons/connection24.gif")//$NON-NLS-1$
+		);
+		entries.add(tool);
+		controlGroup.addAll(entries);
+		return controlGroup;
+	}
+
+	static PaletteRoot createPalette() {
+		PaletteRoot logicPalette = new PaletteRoot();
+		logicPalette.addAll(createCategories(logicPalette));
+		return logicPalette;
+	}
+
+	public static LogicPlugin getDefault() {
+		return singleton;
+	}
+
+	public LogicPlugin() {
+		if (singleton == null) {
+			singleton = this;
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicWizardPage1.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicWizardPage1.java
new file mode 100644
index 0000000..3d44002
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/LogicWizardPage1.java
@@ -0,0 +1,146 @@
+///*******************************************************************************
+// * Copyright (c) 2000, 2010 IBM Corporation and others.
+// * All rights reserved. This program and the accompanying materials
+// * are made available under the terms of the Eclipse Public License v1.0
+// * which accompanies this distribution, and is available at
+// * http://www.eclipse.org/legal/epl-v10.html
+// *
+// * Contributors:
+// *     IBM Corporation - initial API and implementation
+// *******************************************************************************/
+//package org.eclipse.gef.examples.logicdesigner;
+//
+//import java.io.ByteArrayInputStream;
+//import java.io.ByteArrayOutputStream;
+//import java.io.InputStream;
+//import java.io.ObjectOutputStream;
+//
+//import org.eclipse.swt.SWT;
+//import org.eclipse.swt.events.SelectionEvent;
+//import org.eclipse.swt.events.SelectionListener;
+//import org.eclipse.swt.layout.GridData;
+//import org.eclipse.swt.layout.GridLayout;
+//import org.eclipse.swt.widgets.Button;
+//import org.eclipse.swt.widgets.Composite;
+//import org.eclipse.swt.widgets.Group;
+//import org.eclipse.swt.widgets.Label;
+//
+//import org.eclipse.core.resources.IFile;
+//import org.eclipse.jface.resource.ImageDescriptor;
+//import org.eclipse.jface.viewers.IStructuredSelection;
+//import org.eclipse.ui.IWorkbench;
+//import org.eclipse.ui.IWorkbenchPage;
+//import org.eclipse.ui.IWorkbenchWindow;
+//import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+//import org.eclipse.ui.ide.IDE;
+//
+//import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+//import org.eclipse.gef.examples.logicdesigner.model.LogicDiagramFactory;
+//
+//public class LogicWizardPage1 extends WizardNewFileCreationPage implements
+//		SelectionListener {
+//
+//	private IWorkbench workbench;
+//	private static int exampleCount = 1;
+//	private Button model1 = null;
+//	private Button model2 = null;
+//	private int modelSelected = 1;
+//
+//	public LogicWizardPage1(IWorkbench aWorkbench,
+//			IStructuredSelection selection) {
+//		super("sampleLogicPage1", selection); //$NON-NLS-1$
+//		this.setTitle(LogicMessages.CreateLogicPage1_Title);
+//		this.setDescription(LogicMessages.CreateLogicPage1_Description);
+//		this.setImageDescriptor(ImageDescriptor.createFromFile(getClass(),
+//				"icons/logicbanner.gif")); //$NON-NLS-1$
+//		this.workbench = aWorkbench;
+//	}
+//
+//	public void createControl(Composite parent) {
+//		super.createControl(parent);
+//		this.setFileName("emptyModel" + exampleCount + ".logic"); //$NON-NLS-2$//$NON-NLS-1$
+//
+//		Composite composite = (Composite) getControl();
+//
+//		// sample section generation group
+//		Group group = new Group(composite, SWT.NONE);
+//		group.setLayout(new GridLayout());
+//		group.setText(LogicMessages.CreateLogicPage1_ModelNames_GroupName);
+//		group.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+//				| GridData.HORIZONTAL_ALIGN_FILL));
+//
+//		// sample section generation checkboxes
+//		model1 = new Button(group, SWT.RADIO);
+//		model1.setText(LogicMessages.CreateLogicPage1_ModelNames_EmptyModelName);
+//		model1.addSelectionListener(this);
+//		model1.setSelection(true);
+//
+//		model2 = new Button(group, SWT.RADIO);
+//		model2.setText(LogicMessages.CreateLogicPage1_ModelNames_FourBitAdderModelName);
+//		model2.addSelectionListener(this);
+//
+//		new Label(composite, SWT.NONE);
+//
+//		setPageComplete(validatePage());
+//	}
+//
+//	protected InputStream getInitialContents() {
+//		LogicDiagram ld = new LogicDiagram();
+//		if (modelSelected == 2)
+//			ld = (LogicDiagram) LogicDiagramFactory.createLargeModel();
+//		ByteArrayInputStream bais = null;
+//		try {
+//			ByteArrayOutputStream baos = new ByteArrayOutputStream();
+//			ObjectOutputStream oos = new ObjectOutputStream(baos);
+//			oos.writeObject(ld);
+//			oos.flush();
+//			oos.close();
+//			baos.close();
+//			bais = new ByteArrayInputStream(baos.toByteArray());
+//			bais.close();
+//		} catch (Exception e) {
+//			e.printStackTrace();
+//		}
+//		return bais;
+//	}
+//
+//	public boolean finish() {
+//		IFile newFile = createNewFile();
+//		if (newFile == null)
+//			return false; // ie.- creation was unsuccessful
+//
+//		// Since the file resource was created fine, open it for editing
+//		// iff requested by the user
+//		try {
+//			IWorkbenchWindow dwindow = workbench.getActiveWorkbenchWindow();
+//			IWorkbenchPage page = dwindow.getActivePage();
+//			if (page != null)
+//				IDE.openEditor(page, newFile, true);
+//		} catch (org.eclipse.ui.PartInitException e) {
+//			e.printStackTrace();
+//			return false;
+//		}
+//		exampleCount++;
+//		return true;
+//	}
+//
+//	/**
+//	 * @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent)
+//	 */
+//	public void widgetSelected(SelectionEvent e) {
+//		if (e.getSource() == model1) {
+//			modelSelected = 1;
+//			setFileName("emptyModel" + exampleCount + ".logic"); //$NON-NLS-2$//$NON-NLS-1$
+//		} else {
+//			modelSelected = 2;
+//			setFileName("fourBitAdder" + exampleCount + ".logic"); //$NON-NLS-2$//$NON-NLS-1$
+//		}
+//	}
+//
+//	/**
+//	 * Empty method
+//	 */
+//	public void widgetDefaultSelected(SelectionEvent e) {
+//	}
+//
+//}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/DecrementRetargetAction.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/DecrementRetargetAction.java
new file mode 100644
index 0000000..8eb0d4e
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/DecrementRetargetAction.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.actions;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.actions.RetargetAction;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.LogicPlugin;
+
+/**
+ * @author hudsonr
+ * @since 2.1
+ */
+public class DecrementRetargetAction extends RetargetAction {
+
+	/**
+	 * Constructor for IncrementRetargetAction.
+	 */
+	public DecrementRetargetAction() {
+		super(
+				IncrementDecrementAction.DECREMENT,
+				LogicMessages.IncrementDecrementAction_Decrement_ActionLabelText);
+		setToolTipText(LogicMessages.IncrementDecrementAction_Decrement_ActionToolTipText);
+		setImageDescriptor(ImageDescriptor.createFromFile(LogicPlugin.class,
+				"icons/minus.gif")); //$NON-NLS-1$
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/IncrementDecrementAction.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/IncrementDecrementAction.java
new file mode 100644
index 0000000..db7dabb
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/IncrementDecrementAction.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.actions;
+
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPart;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.LogicPlugin;
+import org.eclipse.gef.examples.logicdesigner.model.LED;
+
+public class IncrementDecrementAction extends
+		org.eclipse.gef.ui.actions.SelectionAction {
+
+	private static final String INCREMENT_REQUEST = "Increment", //$NON-NLS-1$
+			DECREMENT_REQUEST = "Decrement"; //$NON-NLS-1$
+
+	public static final String INCREMENT = "Increment", //$NON-NLS-1$
+			DECREMENT = "Decrement"; //$NON-NLS-1$
+
+	Request request;
+
+	public IncrementDecrementAction(IWorkbenchPart part, boolean increment) {
+		super(part);
+		if (increment) {
+			request = new Request(INCREMENT_REQUEST);
+			setText(LogicMessages.IncrementDecrementAction_Increment_ActionLabelText);
+			setId(INCREMENT);
+			setToolTipText(LogicMessages.IncrementDecrementAction_Increment_ActionToolTipText);
+			setImageDescriptor(ImageDescriptor.createFromFile(
+					LogicPlugin.class, "icons/plus.gif")); //$NON-NLS-1$
+		} else {
+			request = new Request(DECREMENT_REQUEST);
+			setText(LogicMessages.IncrementDecrementAction_Decrement_ActionLabelText);
+			setId(DECREMENT);
+			setToolTipText(LogicMessages.IncrementDecrementAction_Decrement_ActionToolTipText);
+			setImageDescriptor(ImageDescriptor.createFromFile(
+					LogicPlugin.class, "icons/minus.gif")); //$NON-NLS-1$
+		}
+		setHoverImageDescriptor(getImageDescriptor());
+	}
+
+	protected boolean calculateEnabled() {
+		return canPerformAction();
+	}
+
+	private boolean canPerformAction() {
+		if (getSelectedObjects().isEmpty())
+			return false;
+		List parts = getSelectedObjects();
+		for (int i = 0; i < parts.size(); i++) {
+			Object o = parts.get(i);
+			if (!(o instanceof EditPart))
+				return false;
+			EditPart part = (EditPart) o;
+			if (!(part.getModel() instanceof LED))
+				return false;
+		}
+		return true;
+	}
+
+	private Command getCommand() {
+		List editparts = getSelectedObjects();
+		CompoundCommand cc = new CompoundCommand();
+		cc.setDebugLabel("Increment/Decrement LEDs");//$NON-NLS-1$
+		for (int i = 0; i < editparts.size(); i++) {
+			EditPart part = (EditPart) editparts.get(i);
+			cc.add(part.getCommand(request));
+		}
+		return cc;
+	}
+
+	public void run() {
+		execute(getCommand());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/IncrementRetargetAction.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/IncrementRetargetAction.java
new file mode 100644
index 0000000..e9b9932
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/IncrementRetargetAction.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.actions;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.actions.RetargetAction;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.LogicPlugin;
+
+/**
+ * @author hudsonr
+ * @since 2.1
+ */
+public class IncrementRetargetAction extends RetargetAction {
+
+	/**
+	 * Constructor for IncrementRetargetAction.
+	 * 
+	 * @param actionID
+	 * @param label
+	 */
+	public IncrementRetargetAction() {
+		super(
+				IncrementDecrementAction.INCREMENT,
+				LogicMessages.IncrementDecrementAction_Increment_ActionLabelText);
+		setToolTipText(LogicMessages.IncrementDecrementAction_Increment_ActionToolTipText);
+		setImageDescriptor(ImageDescriptor.createFromFile(LogicPlugin.class,
+				"icons/plus.gif")); //$NON-NLS-1$
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/LogicActionBarContributor.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/LogicActionBarContributor.java
new file mode 100644
index 0000000..f2a9de7
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/LogicActionBarContributor.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.RetargetAction;
+
+import org.eclipse.draw2d.PositionConstants;
+
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.internal.GEFMessages;
+import org.eclipse.gef.ui.actions.ActionBarContributor;
+import org.eclipse.gef.ui.actions.AlignmentRetargetAction;
+import org.eclipse.gef.ui.actions.GEFActionConstants;
+import org.eclipse.gef.ui.actions.MatchHeightRetargetAction;
+import org.eclipse.gef.ui.actions.MatchWidthRetargetAction;
+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.gef.examples.logicdesigner.LogicMessages;
+
+public class LogicActionBarContributor extends ActionBarContributor {
+
+	/**
+	 * @see org.eclipse.gef.ui.actions.ActionBarContributor#buildActions()
+	 */
+	protected void buildActions() {
+		addRetargetAction(new UndoRetargetAction());
+		addRetargetAction(new RedoRetargetAction());
+
+		addRetargetAction(new IncrementRetargetAction());
+		addRetargetAction(new DecrementRetargetAction());
+
+		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 ZoomInRetargetAction());
+		addRetargetAction(new ZoomOutRetargetAction());
+
+		addRetargetAction(new MatchWidthRetargetAction());
+		addRetargetAction(new MatchHeightRetargetAction());
+
+		addRetargetAction(new RetargetAction(
+				GEFActionConstants.TOGGLE_RULER_VISIBILITY,
+				GEFMessages.ToggleRulerVisibility_Label, IAction.AS_CHECK_BOX));
+
+		addRetargetAction(new RetargetAction(
+				GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY,
+				GEFMessages.ToggleSnapToGeometry_Label, IAction.AS_CHECK_BOX));
+
+		addRetargetAction(new RetargetAction(
+				GEFActionConstants.TOGGLE_GRID_VISIBILITY,
+				GEFMessages.ToggleGrid_Label, IAction.AS_CHECK_BOX));
+	}
+
+	/**
+	 * @see org.eclipse.gef.ui.actions.ActionBarContributor#declareGlobalActionKeys()
+	 */
+	protected void declareGlobalActionKeys() {
+		addGlobalActionKey(ActionFactory.PRINT.getId());
+		addGlobalActionKey(ActionFactory.SELECT_ALL.getId());
+		addGlobalActionKey(ActionFactory.PASTE.getId());
+		addGlobalActionKey(ActionFactory.DELETE.getId());
+	}
+
+	/**
+	 * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToToolBar(IToolBarManager)
+	 */
+	public void contributeToToolBar(IToolBarManager tbm) {
+		tbm.add(getAction(ActionFactory.UNDO.getId()));
+		tbm.add(getAction(ActionFactory.REDO.getId()));
+
+		tbm.add(new Separator());
+		tbm.add(getAction(IncrementDecrementAction.DECREMENT));
+		tbm.add(getAction(IncrementDecrementAction.INCREMENT));
+
+		tbm.add(new Separator());
+		tbm.add(getAction(GEFActionConstants.ALIGN_LEFT));
+		tbm.add(getAction(GEFActionConstants.ALIGN_CENTER));
+		tbm.add(getAction(GEFActionConstants.ALIGN_RIGHT));
+		tbm.add(new Separator());
+		tbm.add(getAction(GEFActionConstants.ALIGN_TOP));
+		tbm.add(getAction(GEFActionConstants.ALIGN_MIDDLE));
+		tbm.add(getAction(GEFActionConstants.ALIGN_BOTTOM));
+
+		tbm.add(new Separator());
+		tbm.add(getAction(GEFActionConstants.MATCH_WIDTH));
+		tbm.add(getAction(GEFActionConstants.MATCH_HEIGHT));
+
+		tbm.add(new Separator());
+		String[] zoomStrings = new String[] { ZoomManager.FIT_ALL,
+				ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH };
+		tbm.add(new ZoomComboContributionItem(getPage(), zoomStrings));
+	}
+
+	/**
+	 * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToMenu(IMenuManager)
+	 */
+	public void contributeToMenu(IMenuManager menubar) {
+		super.contributeToMenu(menubar);
+		MenuManager viewMenu = new MenuManager(LogicMessages.ViewMenu_LabelText);
+		viewMenu.add(getAction(GEFActionConstants.ZOOM_IN));
+		viewMenu.add(getAction(GEFActionConstants.ZOOM_OUT));
+		viewMenu.add(new Separator());
+		viewMenu.add(getAction(GEFActionConstants.TOGGLE_RULER_VISIBILITY));
+		viewMenu.add(getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY));
+		viewMenu.add(getAction(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY));
+		viewMenu.add(new Separator());
+		viewMenu.add(getAction(GEFActionConstants.MATCH_WIDTH));
+		viewMenu.add(getAction(GEFActionConstants.MATCH_HEIGHT));
+		menubar.insertAfter(IWorkbenchActionConstants.M_EDIT, viewMenu);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/LogicPasteTemplateAction.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/LogicPasteTemplateAction.java
new file mode 100644
index 0000000..dfbb068
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/LogicPasteTemplateAction.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.actions;
+
+import org.eclipse.ui.IEditorPart;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.GraphicalEditPart;
+
+/**
+ * @author Eric Bordeau
+ */
+public class LogicPasteTemplateAction extends PasteTemplateAction {
+
+	/**
+	 * Constructor for LogicPasteTemplateAction.
+	 * 
+	 * @param editor
+	 */
+	public LogicPasteTemplateAction(IEditorPart editor) {
+		super(editor);
+	}
+
+	/**
+	 * @see PasteTemplateAction#getPasteLocation(GraphicalEditPart)
+	 */
+	protected Point getPasteLocation(GraphicalEditPart container) {
+		Point result = new Point(10, 10);
+		IFigure fig = container.getContentPane();
+		result.translate(fig.getClientArea(Rectangle.SINGLETON).getLocation());
+		fig.translateToAbsolute(result);
+		return result;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/PasteTemplateAction.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/PasteTemplateAction.java
new file mode 100644
index 0000000..758afe9
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/PasteTemplateAction.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.actions;
+
+import java.util.List;
+
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.actions.ActionFactory;
+
+import org.eclipse.draw2d.geometry.Point;
+
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gef.requests.CreationFactory;
+import org.eclipse.gef.ui.actions.Clipboard;
+import org.eclipse.gef.ui.actions.SelectionAction;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+/**
+ * If the current object on the clipboard is a valid template, this action will
+ * paste the template to the viewer.
+ * 
+ * @author Eric Bordeau, Pratik Shah
+ * @see org.eclipse.gef.ui.actions.CopyTemplateAction
+ */
+public abstract class PasteTemplateAction extends SelectionAction {
+
+	/**
+	 * Constructor for PasteTemplateAction.
+	 * 
+	 * @param editor
+	 */
+	public PasteTemplateAction(IWorkbenchPart editor) {
+		super(editor);
+	}
+
+	/**
+	 * @return <code>true</code> if {@link #createPasteCommand()} returns an
+	 *         executable command
+	 * @see org.eclipse.gef.ui.actions.WorkbenchPartAction#calculateEnabled()
+	 */
+	protected boolean calculateEnabled() {
+		// TODO Workaround for Bug 82622/39369. Should be removed when 39369 is
+		// fixed.
+		return true;
+	}
+
+	/**
+	 * Creates and returns a command (which may be <code>null</code>) to create
+	 * a new EditPart based on the template on the clipboard.
+	 * 
+	 * @return the paste command
+	 */
+	protected Command createPasteCommand() {
+		Command result = null;
+		List selection = getSelectedObjects();
+		if (selection != null && selection.size() == 1) {
+			Object obj = selection.get(0);
+			if (obj instanceof GraphicalEditPart) {
+				GraphicalEditPart gep = (GraphicalEditPart) obj;
+				Object template = getClipboardContents();
+				if (template != null) {
+					CreationFactory factory = getFactory(template);
+					if (factory != null) {
+						CreateRequest request = new CreateRequest();
+						request.setFactory(factory);
+						request.setLocation(getPasteLocation(gep));
+						result = gep.getCommand(request);
+					}
+				}
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * Returns the template on the clipboard, if there is one. Note that the
+	 * template on the clipboard might be from a palette from another type of
+	 * editor.
+	 * 
+	 * @return the clipboard's contents
+	 */
+	protected Object getClipboardContents() {
+		return Clipboard.getDefault().getContents();
+	}
+
+	/**
+	 * Returns the appropriate Factory object to be used for the specified
+	 * template. This Factory is used on the CreateRequest that is sent to the
+	 * target EditPart. Note that the given template might be from a palette for
+	 * a different GEF-based editor. In that case, this method can return
+	 * <code>null</code>.
+	 * 
+	 * @param template
+	 *            the template Object; it will never be <code>null</code>
+	 * @return a Factory
+	 */
+	protected CreationFactory getFactory(Object template) {
+		if (template instanceof CreationFactory)
+			return (CreationFactory) template;
+		return null;
+	}
+
+	/**
+	 * @param container
+	 *            the parent of the new part that is being pasted
+	 * @return the location at which
+	 */
+	protected abstract Point getPasteLocation(GraphicalEditPart container);
+
+	/**
+	 * @see org.eclipse.gef.ui.actions.EditorPartAction#init()
+	 */
+	protected void init() {
+		setId(ActionFactory.PASTE.getId());
+		setText(LogicMessages.PasteAction_ActionLabelText);
+	}
+
+	/**
+	 * Executes the command returned by {@link #createPasteCommand()}.
+	 */
+	public void run() {
+		execute(createPasteCommand());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/PrintModeDialog.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/PrintModeDialog.java
new file mode 100644
index 0000000..d5dc38b
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/actions/PrintModeDialog.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.actions;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+import org.eclipse.jface.dialogs.Dialog;
+
+import org.eclipse.draw2d.PrintFigureOperation;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+/**
+ * @author Eric Bordeau
+ */
+public class PrintModeDialog extends Dialog {
+
+	private Button tile, fitPage, fitWidth, fitHeight;
+
+	public PrintModeDialog(Shell shell) {
+		super(shell);
+	}
+
+	protected void cancelPressed() {
+		setReturnCode(-1);
+		close();
+	}
+
+	protected void configureShell(Shell newShell) {
+		newShell.setText(LogicMessages.PrintDialog_Title);
+		super.configureShell(newShell);
+	}
+
+	protected Control createDialogArea(Composite parent) {
+		Composite composite = (Composite) super.createDialogArea(parent);
+
+		tile = new Button(composite, SWT.RADIO);
+		tile.setText(LogicMessages.PrintDialog_Tile);
+		tile.setSelection(true);
+
+		fitPage = new Button(composite, SWT.RADIO);
+		fitPage.setText(LogicMessages.PrintDialog_Page);
+
+		fitWidth = new Button(composite, SWT.RADIO);
+		fitWidth.setText(LogicMessages.PrintDialog_Width);
+
+		fitHeight = new Button(composite, SWT.RADIO);
+		fitHeight.setText(LogicMessages.PrintDialog_Height);
+
+		return composite;
+	}
+
+	protected void okPressed() {
+		int returnCode = -1;
+		if (tile.getSelection())
+			returnCode = PrintFigureOperation.TILE;
+		else if (fitPage.getSelection())
+			returnCode = PrintFigureOperation.FIT_PAGE;
+		else if (fitHeight.getSelection())
+			returnCode = PrintFigureOperation.FIT_HEIGHT;
+		else if (fitWidth.getSelection())
+			returnCode = PrintFigureOperation.FIT_WIDTH;
+		setReturnCode(returnCode);
+		close();
+	}
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/dnd/FileTransferDragSourceListener.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/dnd/FileTransferDragSourceListener.java
new file mode 100644
index 0000000..7d4645d
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/dnd/FileTransferDragSourceListener.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.dnd;
+
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+
+import org.eclipse.gef.EditPartViewer;
+
+import org.eclipse.gef.examples.logicdesigner.edit.LogicLabelEditPart;
+
+public class FileTransferDragSourceListener extends
+		org.eclipse.gef.dnd.AbstractTransferDragSourceListener {
+
+	public FileTransferDragSourceListener(EditPartViewer viewer) {
+		super(viewer, TextTransfer.getInstance());
+	}
+
+	public FileTransferDragSourceListener(EditPartViewer viewer, Transfer xfer) {
+		super(viewer, xfer);
+	}
+
+	public void dragSetData(DragSourceEvent event) {
+		event.data = "Some text"; //$NON-NLS-1$
+	}
+
+	public void dragStart(DragSourceEvent event) {
+		if (getViewer().getSelectedEditParts().get(0) instanceof LogicLabelEditPart)
+			return;
+		event.doit = false;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/dnd/TextTransferDropTargetListener.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/dnd/TextTransferDropTargetListener.java
new file mode 100644
index 0000000..6aee724
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/dnd/TextTransferDropTargetListener.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.dnd;
+
+import org.eclipse.swt.dnd.Transfer;
+
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.dnd.AbstractTransferDropTargetListener;
+
+import org.eclipse.gef.examples.logicdesigner.edit.NativeDropRequest;
+
+public class TextTransferDropTargetListener extends
+		AbstractTransferDropTargetListener {
+
+	public TextTransferDropTargetListener(EditPartViewer viewer, Transfer xfer) {
+		super(viewer, xfer);
+	}
+
+	protected Request createTargetRequest() {
+		return new NativeDropRequest();
+	}
+
+	protected NativeDropRequest getNativeDropRequest() {
+		return (NativeDropRequest) getTargetRequest();
+	}
+
+	protected void updateTargetRequest() {
+		getNativeDropRequest().setData(getCurrentEvent().data);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/CircuitEditPart.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/CircuitEditPart.java
new file mode 100644
index 0000000..71985a2
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/CircuitEditPart.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.IScrollableFigure;
+import org.eclipse.draw2d.XYLayout;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.AccessibleAnchorProvider;
+import org.eclipse.gef.AutoexposeHelper;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.ExposeHelper;
+import org.eclipse.gef.MouseWheelHelper;
+import org.eclipse.gef.editparts.IScrollableEditPart;
+import org.eclipse.gef.editparts.ViewportAutoexposeHelper;
+import org.eclipse.gef.editparts.ViewportExposeHelper;
+import org.eclipse.gef.editparts.ViewportMouseWheelHelper;
+import org.eclipse.gef.editpolicies.ScrollableSelectionFeedbackEditPolicy;
+
+import org.eclipse.gef.examples.logicdesigner.figures.CircuitFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.FigureFactory;
+
+/**
+ * Holds a circuit, which is a container capable of holding other
+ * LogicEditParts.
+ */
+public class CircuitEditPart extends LogicContainerEditPart implements
+		IScrollableEditPart {
+
+	private static final String SCROLLABLE_SELECTION_FEEDBACK = "SCROLLABLE_SELECTION_FEEDBACK"; //$NON-NLS-1$
+
+	protected void createEditPolicies() {
+		super.createEditPolicies();
+		installEditPolicy(EditPolicy.LAYOUT_ROLE, new LogicXYLayoutEditPolicy(
+				(XYLayout) getContentPane().getLayoutManager()));
+		installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE,
+				new ContainerHighlightEditPolicy());
+		installEditPolicy(SCROLLABLE_SELECTION_FEEDBACK,
+				new ScrollableSelectionFeedbackEditPolicy());
+	}
+
+	/**
+	 * Creates a new Circuit Figure and returns it.
+	 * 
+	 * @return Figure representing the circuit.
+	 */
+	protected IFigure createFigure() {
+		return FigureFactory.createNewCircuit();
+	}
+
+	public Object getAdapter(Class key) {
+		if (key == AutoexposeHelper.class)
+			return new ViewportAutoexposeHelper(this);
+		if (key == ExposeHelper.class)
+			return new ViewportExposeHelper(this);
+		if (key == AccessibleAnchorProvider.class)
+			return new DefaultAccessibleAnchorProvider() {
+				public List getSourceAnchorLocations() {
+					List list = new ArrayList();
+					Vector sourceAnchors = getNodeFigure()
+							.getSourceConnectionAnchors();
+					Vector targetAnchors = getNodeFigure()
+							.getTargetConnectionAnchors();
+					for (int i = 0; i < sourceAnchors.size(); i++) {
+						ConnectionAnchor sourceAnchor = (ConnectionAnchor) sourceAnchors
+								.get(i);
+						ConnectionAnchor targetAnchor = (ConnectionAnchor) targetAnchors
+								.get(i);
+						list.add(new Rectangle(
+								sourceAnchor.getReferencePoint(), targetAnchor
+										.getReferencePoint()).getCenter());
+					}
+					return list;
+				}
+
+				public List getTargetAnchorLocations() {
+					return getSourceAnchorLocations();
+				}
+			};
+		if (key == MouseWheelHelper.class)
+			return new ViewportMouseWheelHelper(this);
+		return super.getAdapter(key);
+	}
+
+	/**
+	 * Returns the Figure of this as a CircuitFigure.
+	 * 
+	 * @return CircuitFigure of this.
+	 */
+	protected CircuitFigure getCircuitBoardFigure() {
+		return (CircuitFigure) getFigure();
+	}
+
+	public IFigure getContentPane() {
+		return getCircuitBoardFigure().getContentsPane();
+	}
+
+	public IScrollableFigure getScrollableFigure() {
+		return (IScrollableFigure) getFigure();
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/ContainerHighlightEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/ContainerHighlightEditPolicy.java
new file mode 100644
index 0000000..8b9f5a6
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/ContainerHighlightEditPolicy.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.swt.graphics.Color;
+
+import org.eclipse.draw2d.IFigure;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+
+import org.eclipse.gef.examples.logicdesigner.figures.LogicColorConstants;
+
+/**
+ */
+public class ContainerHighlightEditPolicy extends
+		org.eclipse.gef.editpolicies.GraphicalEditPolicy {
+
+	private Color revertColor;
+
+	public void eraseTargetFeedback(Request request) {
+		if (revertColor != null) {
+			setContainerBackground(revertColor);
+			revertColor = null;
+		}
+	}
+
+	private Color getContainerBackground() {
+		return getContainerFigure().getBackgroundColor();
+	}
+
+	private IFigure getContainerFigure() {
+		return ((GraphicalEditPart) getHost()).getFigure();
+	}
+
+	public EditPart getTargetEditPart(Request request) {
+		return request.getType().equals(RequestConstants.REQ_SELECTION_HOVER) ? getHost()
+				: null;
+	}
+
+	private void setContainerBackground(Color c) {
+		getContainerFigure().setBackgroundColor(c);
+	}
+
+	protected void showHighlight() {
+		if (revertColor == null) {
+			revertColor = getContainerBackground();
+			setContainerBackground(LogicColorConstants.logicBackgroundBlue);
+		}
+	}
+
+	public void showTargetFeedback(Request request) {
+		if (request.getType().equals(RequestConstants.REQ_MOVE)
+				|| request.getType().equals(RequestConstants.REQ_ADD)
+				|| request.getType().equals(RequestConstants.REQ_CLONE)
+				|| request.getType().equals(
+						RequestConstants.REQ_CONNECTION_START)
+				|| request.getType()
+						.equals(RequestConstants.REQ_CONNECTION_END)
+				|| request.getType().equals(RequestConstants.REQ_CREATE))
+			showHighlight();
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/GateEditPart.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/GateEditPart.java
new file mode 100644
index 0000000..bc010d6
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/GateEditPart.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.IFigure;
+
+import org.eclipse.gef.AccessibleAnchorProvider;
+
+import org.eclipse.gef.examples.logicdesigner.figures.AndGateFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.GateFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.OrGateFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.OutputFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.XOrGateFigure;
+import org.eclipse.gef.examples.logicdesigner.model.AndGate;
+import org.eclipse.gef.examples.logicdesigner.model.OrGate;
+import org.eclipse.gef.examples.logicdesigner.model.XORGate;
+
+/**
+ * EditPart for holding gates in the Logic Example.
+ */
+public class GateEditPart extends OutputEditPart {
+
+	/**
+	 * Returns a newly created Figure of this.
+	 * 
+	 * @return A new Figure of this.
+	 */
+	protected IFigure createFigure() {
+		OutputFigure figure;
+		if (getModel() == null)
+			return null;
+		if (getModel() instanceof OrGate)
+			figure = new OrGateFigure();
+		else if (getModel() instanceof AndGate)
+			figure = new AndGateFigure();
+		else if (getModel() instanceof XORGate)
+			figure = new XOrGateFigure();
+		else
+			figure = new GateFigure();
+		return figure;
+	}
+
+	public Object getAdapter(Class key) {
+		if (key == AccessibleAnchorProvider.class)
+			return new DefaultAccessibleAnchorProvider() {
+				public List getSourceAnchorLocations() {
+					List list = new ArrayList();
+					Vector sourceAnchors = getNodeFigure()
+							.getSourceConnectionAnchors();
+					for (int i = 0; i < sourceAnchors.size(); i++) {
+						ConnectionAnchor anchor = (ConnectionAnchor) sourceAnchors
+								.get(i);
+						list.add(anchor.getReferencePoint()
+								.getTranslated(0, -3));
+					}
+					return list;
+				}
+
+				public List getTargetAnchorLocations() {
+					List list = new ArrayList();
+					Vector targetAnchors = getNodeFigure()
+							.getTargetConnectionAnchors();
+					for (int i = 0; i < targetAnchors.size(); i++) {
+						ConnectionAnchor anchor = (ConnectionAnchor) targetAnchors
+								.get(i);
+						list.add(anchor.getReferencePoint());
+					}
+					return list;
+				}
+			};
+		return super.getAdapter(key);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/GraphicalPartFactory.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/GraphicalPartFactory.java
new file mode 100644
index 0000000..9bd4deb
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/GraphicalPartFactory.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+
+import org.eclipse.gef.examples.logicdesigner.model.Circuit;
+import org.eclipse.gef.examples.logicdesigner.model.Gate;
+import org.eclipse.gef.examples.logicdesigner.model.LED;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicFlowContainer;
+import org.eclipse.gef.examples.logicdesigner.model.LogicLabel;
+import org.eclipse.gef.examples.logicdesigner.model.SimpleOutput;
+import org.eclipse.gef.examples.logicdesigner.model.Wire;
+
+public class GraphicalPartFactory implements EditPartFactory {
+
+	public EditPart createEditPart(EditPart context, Object model) {
+		EditPart child = null;
+
+		if (model instanceof LogicFlowContainer)
+			child = new LogicFlowContainerEditPart();
+		else if (model instanceof Wire)
+			child = new WireEditPart();
+		else if (model instanceof LED)
+			child = new LEDEditPart();
+		else if (model instanceof LogicLabel)
+			child = new LogicLabelEditPart();
+		else if (model instanceof Circuit)
+			child = new CircuitEditPart();
+		else if (model instanceof Gate)
+			child = new GateEditPart();
+		else if (model instanceof SimpleOutput)
+			child = new OutputEditPart();
+		// Note that subclasses of LogicDiagram have already been matched above,
+		// like Circuit
+		else if (model instanceof LogicDiagram)
+			child = new LogicDiagramEditPart();
+		child.setModel(model);
+		return child;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LEDEditPart.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LEDEditPart.java
new file mode 100644
index 0000000..b7a9744
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LEDEditPart.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.swt.accessibility.AccessibleControlEvent;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Image;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.IFigure;
+
+import org.eclipse.gef.AccessibleAnchorProvider;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.figures.FigureFactory;
+import org.eclipse.gef.examples.logicdesigner.figures.LEDFigure;
+import org.eclipse.gef.examples.logicdesigner.model.LED;
+
+/**
+ * Holds the EditPart signifying an LED.
+ */
+public class LEDEditPart extends LogicEditPart {
+
+	private static Image LED_SEL_PRIM_BG;
+	private static Image LED_SEL_SECD_BG;
+
+	private static Image createImage(String name) {
+		InputStream stream = LEDFigure.class.getResourceAsStream(name);
+		Image image = new Image(null, stream);
+		try {
+			stream.close();
+		} catch (IOException ioe) {
+		}
+		return image;
+	}
+
+	protected AccessibleEditPart createAccessible() {
+		return new AccessibleGraphicalEditPart() {
+
+			public void getName(AccessibleEvent e) {
+				e.result = LogicMessages.LogicPlugin_Tool_CreationTool_LED_Label;
+			}
+
+			public void getValue(AccessibleControlEvent e) {
+				e.result = Integer.toString(getLEDModel().getValue());
+			}
+
+		};
+	}
+
+	protected void createEditPolicies() {
+		super.createEditPolicies();
+		installEditPolicy(EditPolicy.COMPONENT_ROLE, new LEDEditPolicy());
+	}
+
+	/**
+	 * Returns a newly created Figure to represent this.
+	 * 
+	 * @return Figure of this.
+	 */
+	protected IFigure createFigure() {
+		return FigureFactory.createNewLED();
+	}
+
+	public Object getAdapter(Class key) {
+		if (key == AccessibleAnchorProvider.class)
+			return new DefaultAccessibleAnchorProvider() {
+				public List getSourceAnchorLocations() {
+					List list = new ArrayList();
+					Vector sourceAnchors = getNodeFigure()
+							.getSourceConnectionAnchors();
+					for (int i = 0; i < sourceAnchors.size(); i++) {
+						ConnectionAnchor anchor = (ConnectionAnchor) sourceAnchors
+								.get(i);
+						list.add(anchor.getReferencePoint()
+								.getTranslated(0, -3));
+					}
+					return list;
+				}
+
+				public List getTargetAnchorLocations() {
+					List list = new ArrayList();
+					Vector targetAnchors = getNodeFigure()
+							.getTargetConnectionAnchors();
+					for (int i = 0; i < targetAnchors.size(); i++) {
+						ConnectionAnchor anchor = (ConnectionAnchor) targetAnchors
+								.get(i);
+						list.add(anchor.getReferencePoint().getTranslated(0, 3));
+					}
+					return list;
+				}
+			};
+		return super.getAdapter(key);
+	}
+
+	protected Image getBackgroundImage(int state) {
+		if (state == SELECTED_PRIMARY) {
+			if (LED_SEL_PRIM_BG == null)
+				LED_SEL_PRIM_BG = createImage("icons/ledbgprim.gif"); //$NON-NLS-1$
+			return LED_SEL_PRIM_BG;
+		}
+		if (state == SELECTED) {
+			if (LED_SEL_SECD_BG == null)
+				LED_SEL_SECD_BG = createImage("icons/ledbgsel.gif"); //$NON-NLS-1$
+			return LED_SEL_SECD_BG;
+		}
+		return null;
+	}
+
+	/**
+	 * Returns the Figure of this as a LEDFigure.
+	 * 
+	 * @return LEDFigure of this.
+	 */
+	public LEDFigure getLEDFigure() {
+		return (LEDFigure) getFigure();
+	}
+
+	/**
+	 * Returns the model of this as a LED.
+	 * 
+	 * @return Model of this as an LED.
+	 */
+	protected LED getLEDModel() {
+		return (LED) getModel();
+	}
+
+	public void propertyChange(java.beans.PropertyChangeEvent change) {
+		if (change.getPropertyName().equals(LED.P_VALUE))
+			refreshVisuals();
+		else
+			super.propertyChange(change);
+	}
+
+	/**
+	 * Apart from the usual visual update, it also updates the numeric contents
+	 * of the LED.
+	 */
+	public void refreshVisuals() {
+		getLEDFigure().setValue(getLEDModel().getValue());
+		super.refreshVisuals();
+	}
+
+	public void setSelected(int i) {
+		super.setSelected(i);
+		refreshVisuals();
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LEDEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LEDEditPolicy.java
new file mode 100644
index 0000000..71694a2
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LEDEditPolicy.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.LED;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+
+public class LEDEditPolicy extends LogicElementEditPolicy {
+
+	private static final String INCREMENT_REQUEST = "Increment", //$NON-NLS-1$
+			DECREMENT_REQUEST = "Decrement"; //$NON-NLS-1$
+
+	public Command getCommand(Request request) {
+		if (INCREMENT_REQUEST.equals(request.getType()))
+			return getIncrementDecrementCommand(true);
+		if (DECREMENT_REQUEST.equals(request.getType()))
+			return getIncrementDecrementCommand(false);
+		return super.getCommand(request);
+	}
+
+	protected Command getIncrementDecrementCommand(boolean type) {
+		IncrementDecrementCommand command = new IncrementDecrementCommand(type);
+		command.setChild((LogicSubpart) getHost().getModel());
+		return command;
+	}
+
+	static class IncrementDecrementCommand extends
+			org.eclipse.gef.commands.Command {
+
+		boolean isIncrement = true;
+		LED child = null;
+
+		public IncrementDecrementCommand(boolean increment) {
+			super(LogicMessages.IncrementDecrementCommand_LabelText);
+			isIncrement = increment;
+		}
+
+		public void setChild(LogicSubpart child) {
+			this.child = (LED) child;
+		}
+
+		public void execute() {
+			int value = child.getValue();
+			if (isIncrement) {
+				if (value == 15)
+					value = -1;
+				child.setValue(value + 1);
+			} else {
+				if (value == 0)
+					value = 16;
+				child.setValue(value - 1);
+			}
+		}
+
+		public void undo() {
+			isIncrement = !isIncrement;
+			execute();
+			isIncrement = !isIncrement;
+		}
+
+		public void redo() {
+			execute();
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LabelCellEditorLocator.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LabelCellEditorLocator.java
new file mode 100644
index 0000000..111707d
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LabelCellEditorLocator.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.swt.widgets.Text;
+
+import org.eclipse.jface.viewers.CellEditor;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.tools.CellEditorLocator;
+
+import org.eclipse.gef.examples.logicdesigner.figures.StickyNoteFigure;
+
+final public class LabelCellEditorLocator implements CellEditorLocator {
+
+	private StickyNoteFigure stickyNote;
+
+	public LabelCellEditorLocator(StickyNoteFigure stickyNote) {
+		setLabel(stickyNote);
+	}
+
+	public void relocate(CellEditor celleditor) {
+		Text text = (Text) celleditor.getControl();
+		Rectangle rect = stickyNote.getClientArea();
+		stickyNote.translateToAbsolute(rect);
+		org.eclipse.swt.graphics.Rectangle trim = text.computeTrim(0, 0, 0, 0);
+		rect.translate(trim.x, trim.y);
+		rect.width += trim.width;
+		rect.height += trim.height;
+		text.setBounds(rect.x, rect.y, rect.width, rect.height);
+	}
+
+	/**
+	 * Returns the stickyNote figure.
+	 */
+	protected StickyNoteFigure getLabel() {
+		return stickyNote;
+	}
+
+	/**
+	 * Sets the Sticky note figure.
+	 * 
+	 * @param stickyNote
+	 *            The stickyNote to set
+	 */
+	protected void setLabel(StickyNoteFigure stickyNote) {
+		this.stickyNote = stickyNote;
+	}
+
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LabelDirectEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LabelDirectEditPolicy.java
new file mode 100644
index 0000000..0fb8679
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LabelDirectEditPolicy.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.DirectEditPolicy;
+import org.eclipse.gef.requests.DirectEditRequest;
+
+import org.eclipse.gef.examples.logicdesigner.figures.StickyNoteFigure;
+import org.eclipse.gef.examples.logicdesigner.model.LogicLabel;
+import org.eclipse.gef.examples.logicdesigner.model.commands.LogicLabelCommand;
+
+public class LabelDirectEditPolicy extends DirectEditPolicy {
+
+	/**
+	 * @see DirectEditPolicy#getDirectEditCommand(DirectEditRequest)
+	 */
+	protected Command getDirectEditCommand(DirectEditRequest edit) {
+		String labelText = (String) edit.getCellEditor().getValue();
+		LogicLabelEditPart label = (LogicLabelEditPart) getHost();
+		LogicLabelCommand command = new LogicLabelCommand(
+				(LogicLabel) label.getModel(), labelText);
+		return command;
+	}
+
+	/**
+	 * @see DirectEditPolicy#showCurrentEditValue(DirectEditRequest)
+	 */
+	protected void showCurrentEditValue(DirectEditRequest request) {
+		String value = (String) request.getCellEditor().getValue();
+		((StickyNoteFigure) getHostFigure()).setText(value);
+		// hack to prevent async layout from placing the cell editor twice.
+		getHostFigure().getUpdateManager().performUpdate();
+
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicContainerEditPart.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicContainerEditPart.java
new file mode 100644
index 0000000..d0eb861
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicContainerEditPart.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.util.List;
+
+import org.eclipse.swt.accessibility.AccessibleEvent;
+
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+
+/**
+ * Provides support for Container EditParts.
+ */
+abstract public class LogicContainerEditPart extends LogicEditPart {
+	protected AccessibleEditPart createAccessible() {
+		return new AccessibleGraphicalEditPart() {
+			public void getName(AccessibleEvent e) {
+				e.result = getLogicDiagram().toString();
+			}
+		};
+	}
+
+	/**
+	 * Installs the desired EditPolicies for this.
+	 */
+	protected void createEditPolicies() {
+		super.createEditPolicies();
+		installEditPolicy(EditPolicy.CONTAINER_ROLE,
+				new LogicContainerEditPolicy());
+	}
+
+	/**
+	 * Returns the model of this as a LogicDiagram.
+	 * 
+	 * @return LogicDiagram of this.
+	 */
+	protected LogicDiagram getLogicDiagram() {
+		return (LogicDiagram) getModel();
+	}
+
+	/**
+	 * Returns the children of this through the model.
+	 * 
+	 * @return Children of this as a List.
+	 */
+	protected List getModelChildren() {
+		return getLogicDiagram().getChildren();
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicContainerEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicContainerEditPolicy.java
new file mode 100644
index 0000000..356ea90
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicContainerEditPolicy.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.util.List;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.editpolicies.ContainerEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gef.requests.GroupRequest;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+import org.eclipse.gef.examples.logicdesigner.model.commands.OrphanChildCommand;
+
+public class LogicContainerEditPolicy extends ContainerEditPolicy {
+
+	protected Command getCreateCommand(CreateRequest request) {
+		return null;
+	}
+
+	public Command getOrphanChildrenCommand(GroupRequest request) {
+		List parts = request.getEditParts();
+		CompoundCommand result = new CompoundCommand(
+				LogicMessages.LogicContainerEditPolicy_OrphanCommandLabelText);
+		for (int i = 0; i < parts.size(); i++) {
+			OrphanChildCommand orphan = new OrphanChildCommand();
+			orphan.setChild((LogicSubpart) ((EditPart) parts.get(i)).getModel());
+			orphan.setParent((LogicDiagram) getHost().getModel());
+			orphan.setLabel(LogicMessages.LogicElementEditPolicy_OrphanCommandLabelText);
+			result.add(orphan);
+		}
+		return result.unwrap();
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicContainerTreeEditPart.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicContainerTreeEditPart.java
new file mode 100644
index 0000000..efdefdc
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicContainerTreeEditPart.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.util.List;
+
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.RootEditPart;
+import org.eclipse.gef.editpolicies.RootComponentEditPolicy;
+
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+
+/**
+ * Tree EditPart for the Container.
+ */
+public class LogicContainerTreeEditPart extends LogicTreeEditPart {
+
+	/**
+	 * Constructor, which initializes this using the model given as input.
+	 */
+	public LogicContainerTreeEditPart(Object model) {
+		super(model);
+	}
+
+	/**
+	 * Creates and installs pertinent EditPolicies.
+	 */
+	protected void createEditPolicies() {
+		super.createEditPolicies();
+		installEditPolicy(EditPolicy.CONTAINER_ROLE,
+				new LogicContainerEditPolicy());
+		installEditPolicy(EditPolicy.TREE_CONTAINER_ROLE,
+				new LogicTreeContainerEditPolicy());
+		// If this editpart is the contents of the viewer, then it is not
+		// deletable!
+		if (getParent() instanceof RootEditPart)
+			installEditPolicy(EditPolicy.COMPONENT_ROLE,
+					new RootComponentEditPolicy());
+	}
+
+	/**
+	 * Returns the model of this as a LogicDiagram.
+	 * 
+	 * @return Model of this.
+	 */
+	protected LogicDiagram getLogicDiagram() {
+		return (LogicDiagram) getModel();
+	}
+
+	/**
+	 * Returns the children of this from the model, as this is capable enough of
+	 * holding EditParts.
+	 * 
+	 * @return List of children.
+	 */
+	protected List getModelChildren() {
+		return getLogicDiagram().getChildren();
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicDiagramEditPart.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicDiagramEditPart.java
new file mode 100644
index 0000000..d74fbf3
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicDiagramEditPart.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.beans.PropertyChangeEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+
+import org.eclipse.draw2d.Animation;
+import org.eclipse.draw2d.AutomaticRouter;
+import org.eclipse.draw2d.BendpointConnectionRouter;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.ConnectionLayer;
+import org.eclipse.draw2d.FanRouter;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FreeformLayer;
+import org.eclipse.draw2d.FreeformLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ManhattanConnectionRouter;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.ShortestPathConnectionRouter;
+import org.eclipse.draw2d.XYLayout;
+
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.CompoundSnapToHelper;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.SnapToGeometry;
+import org.eclipse.gef.SnapToGrid;
+import org.eclipse.gef.SnapToGuides;
+import org.eclipse.gef.SnapToHelper;
+import org.eclipse.gef.editpolicies.RootComponentEditPolicy;
+import org.eclipse.gef.editpolicies.SnapFeedbackPolicy;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.rulers.RulerProvider;
+import org.eclipse.gef.tools.DeselectAllTracker;
+import org.eclipse.gef.tools.MarqueeDragTracker;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+
+/**
+ * Holds all other LogicEditParts under this. It is activated by
+ * LogicEditorPart, to hold the entire model. It is sort of a blank board where
+ * all other EditParts get added.
+ */
+public class LogicDiagramEditPart extends LogicContainerEditPart implements
+		LayerConstants {
+
+	protected AccessibleEditPart createAccessible() {
+		return new AccessibleGraphicalEditPart() {
+			public void getName(AccessibleEvent e) {
+				e.result = LogicMessages.LogicDiagram_LabelText;
+			}
+		};
+	}
+
+	/**
+	 * Installs EditPolicies specific to this.
+	 */
+	protected void createEditPolicies() {
+		super.createEditPolicies();
+
+		installEditPolicy(EditPolicy.NODE_ROLE, null);
+		installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
+		installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, null);
+		installEditPolicy(EditPolicy.COMPONENT_ROLE,
+				new RootComponentEditPolicy());
+		installEditPolicy(EditPolicy.LAYOUT_ROLE, new LogicXYLayoutEditPolicy(
+				(XYLayout) getContentPane().getLayoutManager()));
+
+		installEditPolicy("Snap Feedback", new SnapFeedbackPolicy()); //$NON-NLS-1$
+	}
+
+	/**
+	 * Returns a Figure to represent this.
+	 * 
+	 * @return Figure.
+	 */
+	protected IFigure createFigure() {
+		Figure f = new FreeformLayer();
+		// f.setBorder(new GroupBoxBorder("Diagram"));
+		f.setLayoutManager(new FreeformLayout());
+		f.setBorder(new MarginBorder(5));
+		return f;
+	}
+
+	/**
+	 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+	 */
+	public Object getAdapter(Class adapter) {
+		if (adapter == SnapToHelper.class) {
+			List snapStrategies = new ArrayList();
+			Boolean val = (Boolean) getViewer().getProperty(
+					RulerProvider.PROPERTY_RULER_VISIBILITY);
+			if (val != null && val.booleanValue())
+				snapStrategies.add(new SnapToGuides(this));
+			val = (Boolean) getViewer().getProperty(
+					SnapToGeometry.PROPERTY_SNAP_ENABLED);
+			if (val != null && val.booleanValue())
+				snapStrategies.add(new SnapToGeometry(this));
+			val = (Boolean) getViewer().getProperty(
+					SnapToGrid.PROPERTY_GRID_ENABLED);
+			if (val != null && val.booleanValue())
+				snapStrategies.add(new SnapToGrid(this));
+
+			if (snapStrategies.size() == 0)
+				return null;
+			if (snapStrategies.size() == 1)
+				return snapStrategies.get(0);
+
+			SnapToHelper ss[] = new SnapToHelper[snapStrategies.size()];
+			for (int i = 0; i < snapStrategies.size(); i++)
+				ss[i] = (SnapToHelper) snapStrategies.get(i);
+			return new CompoundSnapToHelper(ss);
+		}
+		return super.getAdapter(adapter);
+	}
+
+	public DragTracker getDragTracker(Request req) {
+		if (req instanceof SelectionRequest
+				&& ((SelectionRequest) req).getLastButtonPressed() == 3)
+			return new DeselectAllTracker(this);
+		return new MarqueeDragTracker();
+	}
+
+	/**
+	 * Returns <code>NULL</code> as it does not hold any connections.
+	 * 
+	 * @return ConnectionAnchor
+	 */
+	public ConnectionAnchor getSourceConnectionAnchor(
+			ConnectionEditPart editPart) {
+		return null;
+	}
+
+	/**
+	 * Returns <code>NULL</code> as it does not hold any connections.
+	 * 
+	 * @return ConnectionAnchor
+	 */
+	public ConnectionAnchor getSourceConnectionAnchor(int x, int y) {
+		return null;
+	}
+
+	/**
+	 * Returns <code>NULL</code> as it does not hold any connections.
+	 * 
+	 * @return ConnectionAnchor
+	 */
+	public ConnectionAnchor getTargetConnectionAnchor(
+			ConnectionEditPart editPart) {
+		return null;
+	}
+
+	/**
+	 * Returns <code>NULL</code> as it does not hold any connections.
+	 * 
+	 * @return ConnectionAnchor
+	 */
+	public ConnectionAnchor getTargetConnectionAnchor(int x, int y) {
+		return null;
+	}
+
+	public void propertyChange(PropertyChangeEvent evt) {
+		if (LogicDiagram.ID_ROUTER.equals(evt.getPropertyName()))
+			refreshVisuals();
+		else
+			super.propertyChange(evt);
+	}
+
+	protected void refreshVisuals() {
+		Animation.markBegin();
+		ConnectionLayer cLayer = (ConnectionLayer) getLayer(CONNECTION_LAYER);
+		if ((getViewer().getControl().getStyle() & SWT.MIRRORED) == 0)
+			cLayer.setAntialias(SWT.ON);
+
+		if (getLogicDiagram().getConnectionRouter().equals(
+				LogicDiagram.ROUTER_MANUAL)) {
+			AutomaticRouter router = new FanRouter();
+			router.setNextRouter(new BendpointConnectionRouter());
+			cLayer.setConnectionRouter(router);
+		} else if (getLogicDiagram().getConnectionRouter().equals(
+				LogicDiagram.ROUTER_MANHATTAN))
+			cLayer.setConnectionRouter(new ManhattanConnectionRouter());
+		else
+			cLayer.setConnectionRouter(new ShortestPathConnectionRouter(
+					getFigure()));
+		Animation.run(400);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicEditPart.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicEditPart.java
new file mode 100644
index 0000000..a143e95
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicEditPart.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.NodeEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DropRequest;
+
+import org.eclipse.gef.examples.logicdesigner.figures.NodeFigure;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+import org.eclipse.gef.examples.logicdesigner.model.Wire;
+
+/**
+ * Porvides support for
+ */
+abstract public class LogicEditPart extends
+		org.eclipse.gef.editparts.AbstractGraphicalEditPart implements
+		NodeEditPart, PropertyChangeListener {
+
+	private AccessibleEditPart acc;
+
+	public void activate() {
+		if (isActive())
+			return;
+		super.activate();
+		getLogicSubpart().addPropertyChangeListener(this);
+	}
+
+	protected void createEditPolicies() {
+		installEditPolicy(EditPolicy.COMPONENT_ROLE,
+				new LogicElementEditPolicy());
+		installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE,
+				new LogicNodeEditPolicy());
+	}
+
+	abstract protected AccessibleEditPart createAccessible();
+
+	/**
+	 * Makes the EditPart insensible to changes in the model by removing itself
+	 * from the model's list of listeners.
+	 */
+	public void deactivate() {
+		if (!isActive())
+			return;
+		super.deactivate();
+		getLogicSubpart().removePropertyChangeListener(this);
+	}
+
+	protected AccessibleEditPart getAccessibleEditPart() {
+		if (acc == null)
+			acc = createAccessible();
+		return acc;
+	}
+
+	/**
+	 * Returns the model associated with this as a LogicSubPart.
+	 * 
+	 * @return The model of this as a LogicSubPart.
+	 */
+	protected LogicSubpart getLogicSubpart() {
+		return (LogicSubpart) getModel();
+	}
+
+	/**
+	 * Returns a list of connections for which this is the source.
+	 * 
+	 * @return List of connections.
+	 */
+	protected List getModelSourceConnections() {
+		return getLogicSubpart().getSourceConnections();
+	}
+
+	/**
+	 * Returns a list of connections for which this is the target.
+	 * 
+	 * @return List of connections.
+	 */
+	protected List getModelTargetConnections() {
+		return getLogicSubpart().getTargetConnections();
+	}
+
+	/**
+	 * Returns the Figure of this, as a node type figure.
+	 * 
+	 * @return Figure as a NodeFigure.
+	 */
+	protected NodeFigure getNodeFigure() {
+		return (NodeFigure) getFigure();
+	}
+
+	/**
+	 * Returns the connection anchor for the given ConnectionEditPart's source.
+	 * 
+	 * @return ConnectionAnchor.
+	 */
+	public ConnectionAnchor getSourceConnectionAnchor(
+			ConnectionEditPart connEditPart) {
+		Wire wire = (Wire) connEditPart.getModel();
+		return getNodeFigure().getConnectionAnchor(wire.getSourceTerminal());
+	}
+
+	/**
+	 * Returns the connection anchor of a source connection which is at the
+	 * given point.
+	 * 
+	 * @return ConnectionAnchor.
+	 */
+	public ConnectionAnchor getSourceConnectionAnchor(Request request) {
+		Point pt = new Point(((DropRequest) request).getLocation());
+		return getNodeFigure().getSourceConnectionAnchorAt(pt);
+	}
+
+	/**
+	 * Returns the connection anchor for the given ConnectionEditPart's target.
+	 * 
+	 * @return ConnectionAnchor.
+	 */
+	public ConnectionAnchor getTargetConnectionAnchor(
+			ConnectionEditPart connEditPart) {
+		Wire wire = (Wire) connEditPart.getModel();
+		return getNodeFigure().getConnectionAnchor(wire.getTargetTerminal());
+	}
+
+	/**
+	 * Returns the connection anchor of a terget connection which is at the
+	 * given point.
+	 * 
+	 * @return ConnectionAnchor.
+	 */
+	public ConnectionAnchor getTargetConnectionAnchor(Request request) {
+		Point pt = new Point(((DropRequest) request).getLocation());
+		return getNodeFigure().getTargetConnectionAnchorAt(pt);
+	}
+
+	/**
+	 * Returns the name of the given connection anchor.
+	 * 
+	 * @return The name of the ConnectionAnchor as a String.
+	 */
+	final protected String mapConnectionAnchorToTerminal(ConnectionAnchor c) {
+		return getNodeFigure().getConnectionAnchorName(c);
+	}
+
+	/**
+	 * Handles changes in properties of this. It is activated through the
+	 * PropertyChangeListener. It updates children, source and target
+	 * connections, and the visuals of this based on the property changed.
+	 * 
+	 * @param evt
+	 *            Event which details the property change.
+	 */
+	public void propertyChange(PropertyChangeEvent evt) {
+		String prop = evt.getPropertyName();
+		if (LogicSubpart.CHILDREN.equals(prop)) {
+			if (evt.getOldValue() instanceof Integer)
+				// new child
+				addChild(createChild(evt.getNewValue()),
+						((Integer) evt.getOldValue()).intValue());
+			else
+				// remove child
+				removeChild((EditPart) getViewer().getEditPartRegistry().get(
+						evt.getOldValue()));
+		} else if (LogicSubpart.INPUTS.equals(prop))
+			refreshTargetConnections();
+		else if (LogicSubpart.OUTPUTS.equals(prop))
+			refreshSourceConnections();
+		else if (prop.equals(LogicSubpart.ID_SIZE)
+				|| prop.equals(LogicSubpart.ID_LOCATION))
+			refreshVisuals();
+	}
+
+	/**
+	 * Updates the visual aspect of this.
+	 */
+	protected void refreshVisuals() {
+		Point loc = getLogicSubpart().getLocation();
+		Dimension size = getLogicSubpart().getSize();
+		Rectangle r = new Rectangle(loc, size);
+
+		((GraphicalEditPart) getParent()).setLayoutConstraint(this,
+				getFigure(), r);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicElementEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicElementEditPolicy.java
new file mode 100644
index 0000000..1b2db5c
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicElementEditPolicy.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.GroupRequest;
+
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+import org.eclipse.gef.examples.logicdesigner.model.commands.DeleteCommand;
+
+public class LogicElementEditPolicy extends
+		org.eclipse.gef.editpolicies.ComponentEditPolicy {
+
+	protected Command createDeleteCommand(GroupRequest request) {
+		Object parent = getHost().getParent().getModel();
+		DeleteCommand deleteCmd = new DeleteCommand();
+		deleteCmd.setParent((LogicDiagram) parent);
+		deleteCmd.setChild((LogicSubpart) getHost().getModel());
+		return deleteCmd;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicFlowContainerEditPart.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicFlowContainerEditPart.java
new file mode 100644
index 0000000..2c08925
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicFlowContainerEditPart.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FlowLayout;
+import org.eclipse.draw2d.IFigure;
+
+import org.eclipse.gef.EditPolicy;
+
+import org.eclipse.gef.examples.logicdesigner.figures.LogicFlowBorder;
+
+public class LogicFlowContainerEditPart extends LogicContainerEditPart {
+
+	protected void createEditPolicies() {
+		super.createEditPolicies();
+		installEditPolicy(EditPolicy.NODE_ROLE, null);
+		installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
+		installEditPolicy(EditPolicy.LAYOUT_ROLE, new LogicFlowEditPolicy());
+		installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE,
+				new ContainerHighlightEditPolicy());
+	}
+
+	protected IFigure createFigure() {
+		Figure figure = new Figure();
+		figure.setLayoutManager(new FlowLayout());
+		figure.setBorder(new LogicFlowBorder());
+		figure.setOpaque(true);
+		return figure;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicFlowEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicFlowEditPolicy.java
new file mode 100644
index 0000000..a9c8b2f
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicFlowEditPolicy.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.util.Iterator;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gef.requests.CreateRequest;
+
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicFlowContainer;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+import org.eclipse.gef.examples.logicdesigner.model.commands.AddCommand;
+import org.eclipse.gef.examples.logicdesigner.model.commands.CloneCommand;
+import org.eclipse.gef.examples.logicdesigner.model.commands.CreateCommand;
+import org.eclipse.gef.examples.logicdesigner.model.commands.ReorderPartCommand;
+
+public class LogicFlowEditPolicy extends
+		org.eclipse.gef.editpolicies.FlowLayoutEditPolicy {
+
+	/**
+	 * Override to return the <code>Command</code> to perform an
+	 * {@link RequestConstants#REQ_CLONE CLONE}. By default, <code>null</code>
+	 * is returned.
+	 * 
+	 * @param request
+	 *            the Clone Request
+	 * @return A command to perform the Clone.
+	 */
+	protected Command getCloneCommand(ChangeBoundsRequest request) {
+		CloneCommand clone = new CloneCommand();
+		clone.setParent((LogicDiagram) getHost().getModel());
+
+		EditPart after = getInsertionReference(request);
+		int index = getHost().getChildren().indexOf(after);
+
+		Iterator i = request.getEditParts().iterator();
+		GraphicalEditPart currPart = null;
+
+		while (i.hasNext()) {
+			currPart = (GraphicalEditPart) i.next();
+			clone.addPart((LogicSubpart) currPart.getModel(), index++);
+		}
+
+		return clone;
+	}
+
+	protected Command createAddCommand(EditPart child, EditPart after) {
+		AddCommand command = new AddCommand();
+		command.setChild((LogicSubpart) child.getModel());
+		command.setParent((LogicFlowContainer) getHost().getModel());
+		int index = getHost().getChildren().indexOf(after);
+		command.setIndex(index);
+		return command;
+	}
+
+	/**
+	 * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#createChildEditPolicy(org.eclipse.gef.EditPart)
+	 */
+	protected EditPolicy createChildEditPolicy(EditPart child) {
+		LogicResizableEditPolicy policy = new LogicResizableEditPolicy();
+		policy.setResizeDirections(0);
+		return policy;
+	}
+
+	protected Command createMoveChildCommand(EditPart child, EditPart after) {
+		LogicSubpart childModel = (LogicSubpart) child.getModel();
+		LogicDiagram parentModel = (LogicDiagram) getHost().getModel();
+		int oldIndex = getHost().getChildren().indexOf(child);
+		int newIndex = getHost().getChildren().indexOf(after);
+		if (newIndex > oldIndex)
+			newIndex--;
+		ReorderPartCommand command = new ReorderPartCommand(childModel,
+				parentModel, newIndex);
+		return command;
+	}
+
+	protected Command getCreateCommand(CreateRequest request) {
+		CreateCommand command = new CreateCommand();
+		EditPart after = getInsertionReference(request);
+		command.setChild((LogicSubpart) request.getNewObject());
+		command.setParent((LogicFlowContainer) getHost().getModel());
+		int index = getHost().getChildren().indexOf(after);
+		command.setIndex(index);
+		return command;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditManager.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditManager.java
new file mode 100644
index 0000000..5f37b33
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditManager.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.part.CellEditorActionHandler;
+
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.editparts.ZoomListener;
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gef.tools.DirectEditManager;
+
+import org.eclipse.gef.examples.logicdesigner.figures.StickyNoteFigure;
+
+public class LogicLabelEditManager extends DirectEditManager {
+
+	private IActionBars actionBars;
+	private CellEditorActionHandler actionHandler;
+	private IAction copy, cut, paste, undo, redo, find, selectAll, delete;
+	private double cachedZoom = -1.0;
+	private Font scaledFont;
+	private ZoomListener zoomListener = new ZoomListener() {
+		public void zoomChanged(double newZoom) {
+			updateScaledFont(newZoom);
+		}
+	};
+
+	public LogicLabelEditManager(GraphicalEditPart source,
+			CellEditorLocator locator) {
+		super(source, null, locator);
+	}
+
+	/**
+	 * @see org.eclipse.gef.tools.DirectEditManager#bringDown()
+	 */
+	protected void bringDown() {
+		ZoomManager zoomMgr = (ZoomManager) getEditPart().getViewer()
+				.getProperty(ZoomManager.class.toString());
+		if (zoomMgr != null)
+			zoomMgr.removeZoomListener(zoomListener);
+
+		if (actionHandler != null) {
+			actionHandler.dispose();
+			actionHandler = null;
+		}
+		if (actionBars != null) {
+			restoreSavedActions(actionBars);
+			actionBars.updateActionBars();
+			actionBars = null;
+		}
+
+		super.bringDown();
+		// dispose any scaled fonts that might have been created
+		disposeScaledFont();
+	}
+
+	protected CellEditor createCellEditorOn(Composite composite) {
+		return new TextCellEditor(composite, SWT.MULTI | SWT.WRAP);
+	}
+
+	private void disposeScaledFont() {
+		if (scaledFont != null) {
+			scaledFont.dispose();
+			scaledFont = null;
+		}
+	}
+
+	protected void initCellEditor() {
+		// update text
+		StickyNoteFigure stickyNote = (StickyNoteFigure) getEditPart()
+				.getFigure();
+		getCellEditor().setValue(stickyNote.getText());
+		// update font
+		ZoomManager zoomMgr = (ZoomManager) getEditPart().getViewer()
+				.getProperty(ZoomManager.class.toString());
+		if (zoomMgr != null) {
+			// this will force the font to be set
+			cachedZoom = -1.0;
+			updateScaledFont(zoomMgr.getZoom());
+			zoomMgr.addZoomListener(zoomListener);
+		} else
+			getCellEditor().getControl().setFont(stickyNote.getFont());
+
+		// Hook the cell editor's copy/paste actions to the actionBars so that
+		// they can
+		// be invoked via keyboard shortcuts.
+		actionBars = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+				.getActivePage().getActiveEditor().getEditorSite()
+				.getActionBars();
+		saveCurrentActions(actionBars);
+		actionHandler = new CellEditorActionHandler(actionBars);
+		actionHandler.addCellEditor(getCellEditor());
+		actionBars.updateActionBars();
+	}
+
+	private void restoreSavedActions(IActionBars actionBars) {
+		actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copy);
+		actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), paste);
+		actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), delete);
+		actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(),
+				selectAll);
+		actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), cut);
+		actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), find);
+		actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undo);
+		actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redo);
+	}
+
+	private void saveCurrentActions(IActionBars actionBars) {
+		copy = actionBars.getGlobalActionHandler(ActionFactory.COPY.getId());
+		paste = actionBars.getGlobalActionHandler(ActionFactory.PASTE.getId());
+		delete = actionBars
+				.getGlobalActionHandler(ActionFactory.DELETE.getId());
+		selectAll = actionBars.getGlobalActionHandler(ActionFactory.SELECT_ALL
+				.getId());
+		cut = actionBars.getGlobalActionHandler(ActionFactory.CUT.getId());
+		find = actionBars.getGlobalActionHandler(ActionFactory.FIND.getId());
+		undo = actionBars.getGlobalActionHandler(ActionFactory.UNDO.getId());
+		redo = actionBars.getGlobalActionHandler(ActionFactory.REDO.getId());
+	}
+
+	private void updateScaledFont(double zoom) {
+		if (cachedZoom == zoom)
+			return;
+
+		Text text = (Text) getCellEditor().getControl();
+		Font font = getEditPart().getFigure().getFont();
+
+		disposeScaledFont();
+		cachedZoom = zoom;
+		if (zoom == 1.0)
+			text.setFont(font);
+		else {
+			FontData fd = font.getFontData()[0];
+			fd.setHeight((int) (fd.getHeight() * zoom));
+			text.setFont(scaledFont = new Font(null, fd));
+		}
+	}
+
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditPart.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditPart.java
new file mode 100644
index 0000000..f241386
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditPart.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.beans.PropertyChangeEvent;
+
+import org.eclipse.swt.accessibility.AccessibleControlEvent;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+
+import org.eclipse.draw2d.IFigure;
+
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.figures.StickyNoteFigure;
+import org.eclipse.gef.examples.logicdesigner.model.LogicLabel;
+
+public class LogicLabelEditPart extends LogicEditPart {
+
+	protected AccessibleEditPart createAccessible() {
+		return new AccessibleGraphicalEditPart() {
+			public void getValue(AccessibleControlEvent e) {
+				e.result = getLogicLabel().getLabelContents();
+			}
+
+			public void getName(AccessibleEvent e) {
+				e.result = LogicMessages.LogicPlugin_Tool_CreationTool_LogicLabel;
+			}
+		};
+	}
+
+	protected void createEditPolicies() {
+		super.createEditPolicies();
+		installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
+		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE,
+				new LabelDirectEditPolicy());
+		installEditPolicy(EditPolicy.COMPONENT_ROLE, new LogicLabelEditPolicy());
+	}
+
+	protected IFigure createFigure() {
+		StickyNoteFigure label = new StickyNoteFigure();
+		return label;
+	}
+
+	private LogicLabel getLogicLabel() {
+		return (LogicLabel) getModel();
+	}
+
+	private void performDirectEdit() {
+		new LogicLabelEditManager(this, new LabelCellEditorLocator(
+				(StickyNoteFigure) getFigure())).show();
+	}
+
+	public void performRequest(Request request) {
+		if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
+			performDirectEdit();
+	}
+
+	public void propertyChange(PropertyChangeEvent evt) {
+		if (evt.getPropertyName().equalsIgnoreCase("labelContents"))//$NON-NLS-1$
+			refreshVisuals();
+		else
+			super.propertyChange(evt);
+	}
+
+	protected void refreshVisuals() {
+		((StickyNoteFigure) getFigure()).setText(getLogicLabel()
+				.getLabelContents());
+		super.refreshVisuals();
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditPolicy.java
new file mode 100644
index 0000000..4e72548
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditPolicy.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+
+import org.eclipse.gef.examples.logicdesigner.model.LogicLabel;
+import org.eclipse.gef.examples.logicdesigner.model.commands.LogicLabelCommand;
+
+public class LogicLabelEditPolicy extends LogicElementEditPolicy {
+
+	public Command getCommand(Request request) {
+		if (NativeDropRequest.ID.equals(request.getType()))
+			return getDropTextCommand((NativeDropRequest) request);
+		return super.getCommand(request);
+	}
+
+	protected Command getDropTextCommand(NativeDropRequest request) {
+		LogicLabelCommand command = new LogicLabelCommand(
+				(LogicLabel) getHost().getModel(), (String) request.getData());
+		return command;
+	}
+
+	public EditPart getTargetEditPart(Request request) {
+		if (NativeDropRequest.ID.equals(request.getType()))
+			return getHost();
+		return super.getTargetEditPart(request);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicNodeEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicNodeEditPolicy.java
new file mode 100644
index 0000000..095fddc
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicNodeEditPolicy.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PolylineConnection;
+
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.CreateConnectionRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+
+import org.eclipse.gef.examples.logicdesigner.figures.FigureFactory;
+import org.eclipse.gef.examples.logicdesigner.figures.NodeFigure;
+import org.eclipse.gef.examples.logicdesigner.model.GroundOutput;
+import org.eclipse.gef.examples.logicdesigner.model.LiveOutput;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+import org.eclipse.gef.examples.logicdesigner.model.Wire;
+import org.eclipse.gef.examples.logicdesigner.model.commands.ConnectionCommand;
+
+public class LogicNodeEditPolicy extends
+		org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy {
+
+	protected Connection createDummyConnection(Request req) {
+		PolylineConnection conn = FigureFactory.createNewWire(null);
+		return conn;
+	}
+
+	protected Command getConnectionCompleteCommand(
+			CreateConnectionRequest request) {
+		ConnectionCommand command = (ConnectionCommand) request
+				.getStartCommand();
+		command.setTarget(getLogicSubpart());
+		ConnectionAnchor ctor = getLogicEditPart().getTargetConnectionAnchor(
+				request);
+		if (ctor == null)
+			return null;
+		command.setTargetTerminal(getLogicEditPart()
+				.mapConnectionAnchorToTerminal(ctor));
+		return command;
+	}
+
+	protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
+		ConnectionCommand command = new ConnectionCommand();
+		command.setWire(new Wire());
+		command.setSource(getLogicSubpart());
+		ConnectionAnchor ctor = getLogicEditPart().getSourceConnectionAnchor(
+				request);
+		command.setSourceTerminal(getLogicEditPart()
+				.mapConnectionAnchorToTerminal(ctor));
+		request.setStartCommand(command);
+		return command;
+	}
+
+	/**
+	 * Feedback should be added to the scaled feedback layer.
+	 * 
+	 * @see org.eclipse.gef.editpolicies.GraphicalEditPolicy#getFeedbackLayer()
+	 */
+	protected IFigure getFeedbackLayer() {
+		/*
+		 * Fix for Bug# 66590 Feedback needs to be added to the scaled feedback
+		 * layer
+		 */
+		return getLayer(LayerConstants.SCALED_FEEDBACK_LAYER);
+	}
+
+	protected LogicEditPart getLogicEditPart() {
+		return (LogicEditPart) getHost();
+	}
+
+	protected LogicSubpart getLogicSubpart() {
+		return (LogicSubpart) getHost().getModel();
+	}
+
+	protected Command getReconnectTargetCommand(ReconnectRequest request) {
+		if (getLogicSubpart() instanceof LiveOutput
+				|| getLogicSubpart() instanceof GroundOutput)
+			return null;
+
+		ConnectionCommand cmd = new ConnectionCommand();
+		cmd.setWire((Wire) request.getConnectionEditPart().getModel());
+
+		ConnectionAnchor ctor = getLogicEditPart().getTargetConnectionAnchor(
+				request);
+		cmd.setTarget(getLogicSubpart());
+		cmd.setTargetTerminal(getLogicEditPart().mapConnectionAnchorToTerminal(
+				ctor));
+		return cmd;
+	}
+
+	protected Command getReconnectSourceCommand(ReconnectRequest request) {
+		ConnectionCommand cmd = new ConnectionCommand();
+		cmd.setWire((Wire) request.getConnectionEditPart().getModel());
+
+		ConnectionAnchor ctor = getLogicEditPart().getSourceConnectionAnchor(
+				request);
+		cmd.setSource(getLogicSubpart());
+		cmd.setSourceTerminal(getLogicEditPart().mapConnectionAnchorToTerminal(
+				ctor));
+		return cmd;
+	}
+
+	protected NodeFigure getNodeFigure() {
+		return (NodeFigure) ((GraphicalEditPart) getHost()).getFigure();
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicResizableEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicResizableEditPolicy.java
new file mode 100644
index 0000000..3f562f3
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicResizableEditPolicy.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.util.Iterator;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.editpolicies.ResizableEditPolicy;
+
+import org.eclipse.gef.examples.logicdesigner.figures.AndGateFeedbackFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.CircuitFeedbackFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.GroundFeedbackFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.LEDFeedbackFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.LabelFeedbackFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.LiveOutputFeedbackFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.LogicColorConstants;
+import org.eclipse.gef.examples.logicdesigner.figures.LogicFlowFeedbackFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.OrGateFeedbackFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.XOrGateFeedbackFigure;
+import org.eclipse.gef.examples.logicdesigner.model.AndGate;
+import org.eclipse.gef.examples.logicdesigner.model.Circuit;
+import org.eclipse.gef.examples.logicdesigner.model.GroundOutput;
+import org.eclipse.gef.examples.logicdesigner.model.LED;
+import org.eclipse.gef.examples.logicdesigner.model.LiveOutput;
+import org.eclipse.gef.examples.logicdesigner.model.LogicFlowContainer;
+import org.eclipse.gef.examples.logicdesigner.model.LogicLabel;
+import org.eclipse.gef.examples.logicdesigner.model.OrGate;
+import org.eclipse.gef.examples.logicdesigner.model.XORGate;
+
+/**
+ * 
+ */
+public class LogicResizableEditPolicy extends ResizableEditPolicy {
+
+	/**
+	 * Creates the figure used for feedback.
+	 * 
+	 * @return the new feedback figure
+	 */
+	protected IFigure createDragSourceFeedbackFigure() {
+		IFigure figure = createFigure((GraphicalEditPart) getHost(), null);
+
+		figure.setBounds(getInitialFeedbackBounds());
+		addFeedback(figure);
+		return figure;
+	}
+
+	protected IFigure createFigure(GraphicalEditPart part, IFigure parent) {
+		IFigure child = getCustomFeedbackFigure(part.getModel());
+
+		if (parent != null)
+			parent.add(child);
+
+		Rectangle childBounds = part.getFigure().getBounds().getCopy();
+
+		IFigure walker = part.getFigure().getParent();
+
+		while (walker != ((GraphicalEditPart) part.getParent()).getFigure()) {
+			walker.translateToParent(childBounds);
+			walker = walker.getParent();
+		}
+
+		child.setBounds(childBounds);
+
+		Iterator i = part.getChildren().iterator();
+
+		while (i.hasNext())
+			createFigure((GraphicalEditPart) i.next(), child);
+
+		return child;
+	}
+
+	protected IFigure getCustomFeedbackFigure(Object modelPart) {
+		IFigure figure;
+
+		if (modelPart instanceof Circuit)
+			figure = new CircuitFeedbackFigure();
+		else if (modelPart instanceof LogicFlowContainer)
+			figure = new LogicFlowFeedbackFigure();
+		else if (modelPart instanceof LogicLabel)
+			figure = new LabelFeedbackFigure();
+		else if (modelPart instanceof LED)
+			figure = new LEDFeedbackFigure();
+		else if (modelPart instanceof OrGate)
+			figure = new OrGateFeedbackFigure();
+		else if (modelPart instanceof XORGate)
+			figure = new XOrGateFeedbackFigure();
+		else if (modelPart instanceof GroundOutput)
+			figure = new GroundFeedbackFigure();
+		else if (modelPart instanceof LiveOutput)
+			figure = new LiveOutputFeedbackFigure();
+		else if (modelPart instanceof AndGate)
+			figure = new AndGateFeedbackFigure();
+		else {
+			figure = new RectangleFigure();
+			((RectangleFigure) figure).setXOR(true);
+			((RectangleFigure) figure).setFill(true);
+			figure.setBackgroundColor(LogicColorConstants.ghostFillColor);
+			figure.setForegroundColor(ColorConstants.white);
+		}
+
+		return figure;
+	}
+
+	/**
+	 * Returns the layer used for displaying feedback.
+	 * 
+	 * @return the feedback layer
+	 */
+	protected IFigure getFeedbackLayer() {
+		return getLayer(LayerConstants.SCALED_FEEDBACK_LAYER);
+	}
+
+	/**
+	 * @see org.eclipse.gef.editpolicies.NonResizableEditPolicy#getInitialFeedbackBounds()
+	 */
+	protected Rectangle getInitialFeedbackBounds() {
+		return getHostFigure().getBounds();
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicTreeContainerEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicTreeContainerEditPolicy.java
new file mode 100644
index 0000000..2b18f4c
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicTreeContainerEditPolicy.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.editpolicies.TreeContainerEditPolicy;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gef.requests.CreateRequest;
+
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+import org.eclipse.gef.examples.logicdesigner.model.commands.CreateCommand;
+import org.eclipse.gef.examples.logicdesigner.model.commands.ReorderPartCommand;
+
+public class LogicTreeContainerEditPolicy extends TreeContainerEditPolicy {
+
+	protected Command createCreateCommand(LogicSubpart child, Rectangle r,
+			int index, String label) {
+		CreateCommand cmd = new CreateCommand();
+		Rectangle rect;
+		if (r == null) {
+			rect = new Rectangle();
+			rect.setSize(new Dimension(-1, -1));
+		} else {
+			rect = r;
+		}
+		cmd.setLocation(rect);
+		cmd.setParent((LogicDiagram) getHost().getModel());
+		cmd.setChild(child);
+		cmd.setLabel(label);
+		if (index >= 0)
+			cmd.setIndex(index);
+		return cmd;
+	}
+
+	protected Command getAddCommand(ChangeBoundsRequest request) {
+		CompoundCommand command = new CompoundCommand();
+		command.setDebugLabel("Add in LogicTreeContainerEditPolicy");//$NON-NLS-1$
+		List editparts = request.getEditParts();
+		int index = findIndexOfTreeItemAt(request.getLocation());
+
+		for (int i = 0; i < editparts.size(); i++) {
+			EditPart child = (EditPart) editparts.get(i);
+			if (isAncestor(child, getHost()))
+				command.add(UnexecutableCommand.INSTANCE);
+			else {
+				LogicSubpart childModel = (LogicSubpart) child.getModel();
+				command.add(createCreateCommand(childModel,
+						new Rectangle(new org.eclipse.draw2d.geometry.Point(),
+								childModel.getSize()), index,
+						"Reparent LogicSubpart"));//$NON-NLS-1$
+			}
+		}
+		return command;
+	}
+
+	protected Command getCreateCommand(CreateRequest request) {
+		LogicSubpart child = (LogicSubpart) request.getNewObject();
+		int index = findIndexOfTreeItemAt(request.getLocation());
+		return createCreateCommand(child, null, index, "Create LogicSubpart");//$NON-NLS-1$
+	}
+
+	protected Command getMoveChildrenCommand(ChangeBoundsRequest request) {
+		CompoundCommand command = new CompoundCommand();
+		List editparts = request.getEditParts();
+		List children = getHost().getChildren();
+		int newIndex = findIndexOfTreeItemAt(request.getLocation());
+
+		for (int i = 0; i < editparts.size(); i++) {
+			EditPart child = (EditPart) editparts.get(i);
+			int tempIndex = newIndex;
+			int oldIndex = children.indexOf(child);
+			if (oldIndex == tempIndex || oldIndex + 1 == tempIndex) {
+				command.add(UnexecutableCommand.INSTANCE);
+				return command;
+			} else if (oldIndex <= tempIndex) {
+				tempIndex--;
+			}
+			command.add(new ReorderPartCommand((LogicSubpart) child.getModel(),
+					(LogicDiagram) getHost().getModel(), tempIndex));
+		}
+		return command;
+	}
+
+	protected boolean isAncestor(EditPart source, EditPart target) {
+		if (source == target)
+			return true;
+		if (target.getParent() != null)
+			return isAncestor(source, target.getParent());
+		return false;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicTreeEditPart.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicTreeEditPart.java
new file mode 100644
index 0000000..f962d9e
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicTreeEditPart.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+
+import org.eclipse.gef.examples.logicdesigner.model.LED;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+
+/**
+ * EditPart for Logic components in the Tree.
+ */
+public class LogicTreeEditPart extends
+		org.eclipse.gef.editparts.AbstractTreeEditPart implements
+		PropertyChangeListener {
+
+	/**
+	 * Constructor initializes this with the given model.
+	 * 
+	 * @param model
+	 *            Model for this.
+	 */
+	public LogicTreeEditPart(Object model) {
+		super(model);
+	}
+
+	public void activate() {
+		super.activate();
+		getLogicSubpart().addPropertyChangeListener(this);
+	}
+
+	/**
+	 * Creates and installs pertinent EditPolicies for this.
+	 */
+	protected void createEditPolicies() {
+		EditPolicy component;
+		if (getModel() instanceof LED)
+			component = new LEDEditPolicy();
+		else
+			component = new LogicElementEditPolicy();
+		installEditPolicy(EditPolicy.COMPONENT_ROLE, component);
+		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
+				new LogicTreeEditPolicy());
+	}
+
+	public void deactivate() {
+		getLogicSubpart().removePropertyChangeListener(this);
+		super.deactivate();
+	}
+
+	/**
+	 * Returns the model of this as a LogicSubPart.
+	 * 
+	 * @return Model of this.
+	 */
+	protected LogicSubpart getLogicSubpart() {
+		return (LogicSubpart) getModel();
+	}
+
+	/**
+	 * Returns <code>null</code> as a Tree EditPart holds no children under it.
+	 * 
+	 * @return <code>null</code>
+	 */
+	protected List getModelChildren() {
+		return Collections.EMPTY_LIST;
+	}
+
+	public void propertyChange(PropertyChangeEvent change) {
+		if (change.getPropertyName().equals(LogicDiagram.CHILDREN)) {
+			if (change.getOldValue() instanceof Integer)
+				// new child
+				addChild(createChild(change.getNewValue()),
+						((Integer) change.getOldValue()).intValue());
+			else
+				// remove child
+				removeChild((EditPart) getViewer().getEditPartRegistry().get(
+						change.getOldValue()));
+		} else
+			refreshVisuals();
+	}
+
+	/**
+	 * Refreshes the visual properties of the TreeItem for this part.
+	 */
+	protected void refreshVisuals() {
+		if (getWidget() instanceof Tree)
+			return;
+		Image image = getLogicSubpart().getIcon();
+		TreeItem item = (TreeItem) getWidget();
+		if (image != null)
+			image.setBackground(item.getParent().getBackground());
+		setWidgetImage(image);
+		setWidgetText(getLogicSubpart().toString());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicTreeEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicTreeEditPolicy.java
new file mode 100644
index 0000000..f9197ee
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicTreeEditPolicy.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.editpolicies.AbstractEditPolicy;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+
+public class LogicTreeEditPolicy extends AbstractEditPolicy {
+
+	public Command getCommand(Request req) {
+		if (REQ_MOVE.equals(req.getType()))
+			return getMoveCommand((ChangeBoundsRequest) req);
+		return null;
+	}
+
+	protected Command getMoveCommand(ChangeBoundsRequest req) {
+		EditPart parent = getHost().getParent();
+		if (parent != null) {
+			ChangeBoundsRequest request = new ChangeBoundsRequest(
+					REQ_MOVE_CHILDREN);
+			request.setEditParts(getHost());
+			request.setLocation(req.getLocation());
+			return parent.getCommand(request);
+		}
+		return UnexecutableCommand.INSTANCE;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicXYLayoutEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicXYLayoutEditPolicy.java
new file mode 100644
index 0000000..0bdb622
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/LogicXYLayoutEditPolicy.java
@@ -0,0 +1,356 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.XYLayout;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.SnapToGuides;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.editpolicies.ResizableEditPolicy;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gef.rulers.RulerProvider;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.figures.CircuitFeedbackFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.LabelFeedbackFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.LogicColorConstants;
+import org.eclipse.gef.examples.logicdesigner.figures.LogicFlowFeedbackFigure;
+import org.eclipse.gef.examples.logicdesigner.model.Circuit;
+import org.eclipse.gef.examples.logicdesigner.model.LED;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicFlowContainer;
+import org.eclipse.gef.examples.logicdesigner.model.LogicGuide;
+import org.eclipse.gef.examples.logicdesigner.model.LogicLabel;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+import org.eclipse.gef.examples.logicdesigner.model.commands.AddCommand;
+import org.eclipse.gef.examples.logicdesigner.model.commands.ChangeGuideCommand;
+import org.eclipse.gef.examples.logicdesigner.model.commands.CloneCommand;
+import org.eclipse.gef.examples.logicdesigner.model.commands.CreateCommand;
+import org.eclipse.gef.examples.logicdesigner.model.commands.SetConstraintCommand;
+
+public class LogicXYLayoutEditPolicy extends
+		org.eclipse.gef.editpolicies.XYLayoutEditPolicy {
+
+	public LogicXYLayoutEditPolicy(XYLayout layout) {
+		super();
+		setXyLayout(layout);
+	}
+
+	protected Command chainGuideAttachmentCommand(Request request,
+			LogicSubpart part, Command cmd, boolean horizontal) {
+		Command result = cmd;
+
+		// Attach to guide, if one is given
+		Integer guidePos = (Integer) request.getExtendedData().get(
+				horizontal ? SnapToGuides.KEY_HORIZONTAL_GUIDE
+						: SnapToGuides.KEY_VERTICAL_GUIDE);
+		if (guidePos != null) {
+			int alignment = ((Integer) request.getExtendedData().get(
+					horizontal ? SnapToGuides.KEY_HORIZONTAL_ANCHOR
+							: SnapToGuides.KEY_VERTICAL_ANCHOR)).intValue();
+			ChangeGuideCommand cgm = new ChangeGuideCommand(part, horizontal);
+			cgm.setNewGuide(findGuideAt(guidePos.intValue(), horizontal),
+					alignment);
+			result = result.chain(cgm);
+		}
+
+		return result;
+	}
+
+	protected Command chainGuideDetachmentCommand(Request request,
+			LogicSubpart part, Command cmd, boolean horizontal) {
+		Command result = cmd;
+
+		// Detach from guide, if none is given
+		Integer guidePos = (Integer) request.getExtendedData().get(
+				horizontal ? SnapToGuides.KEY_HORIZONTAL_GUIDE
+						: SnapToGuides.KEY_VERTICAL_GUIDE);
+		if (guidePos == null)
+			result = result.chain(new ChangeGuideCommand(part, horizontal));
+
+		return result;
+	}
+
+	protected Command createAddCommand(Request request, EditPart childEditPart,
+			Object constraint) {
+		LogicSubpart part = (LogicSubpart) childEditPart.getModel();
+		Rectangle rect = (Rectangle) constraint;
+
+		AddCommand add = new AddCommand();
+		add.setParent((LogicDiagram) getHost().getModel());
+		add.setChild(part);
+		add.setLabel(LogicMessages.LogicXYLayoutEditPolicy_AddCommandLabelText);
+		add.setDebugLabel("LogicXYEP add subpart");//$NON-NLS-1$
+
+		SetConstraintCommand setConstraint = new SetConstraintCommand();
+		setConstraint.setLocation(rect);
+		setConstraint.setPart(part);
+		setConstraint
+				.setLabel(LogicMessages.LogicXYLayoutEditPolicy_AddCommandLabelText);
+		setConstraint.setDebugLabel("LogicXYEP setConstraint");//$NON-NLS-1$
+
+		Command cmd = add.chain(setConstraint);
+		cmd = chainGuideAttachmentCommand(request, part, cmd, true);
+		cmd = chainGuideAttachmentCommand(request, part, cmd, false);
+		cmd = chainGuideDetachmentCommand(request, part, cmd, true);
+		return chainGuideDetachmentCommand(request, part, cmd, false);
+	}
+
+	/**
+	 * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createChangeConstraintCommand(org.eclipse.gef.EditPart,
+	 *      java.lang.Object)
+	 */
+	protected Command createChangeConstraintCommand(EditPart child,
+			Object constraint) {
+		return null;
+	}
+
+	protected Command createChangeConstraintCommand(
+			ChangeBoundsRequest request, EditPart child, Object constraint) {
+		SetConstraintCommand cmd = new SetConstraintCommand();
+		LogicSubpart part = (LogicSubpart) child.getModel();
+		cmd.setPart(part);
+		cmd.setLocation((Rectangle) constraint);
+		Command result = cmd;
+
+		if ((request.getResizeDirection() & PositionConstants.NORTH_SOUTH) != 0) {
+			Integer guidePos = (Integer) request.getExtendedData().get(
+					SnapToGuides.KEY_HORIZONTAL_GUIDE);
+			if (guidePos != null) {
+				result = chainGuideAttachmentCommand(request, part, result,
+						true);
+			} else if (part.getHorizontalGuide() != null) {
+				// SnapToGuides didn't provide a horizontal guide, but this part
+				// is attached
+				// to a horizontal guide. Now we check to see if the part is
+				// attached to
+				// the guide along the edge being resized. If that is the case,
+				// we need to
+				// detach the part from the guide; otherwise, we leave it alone.
+				int alignment = part.getHorizontalGuide().getAlignment(part);
+				int edgeBeingResized = 0;
+				if ((request.getResizeDirection() & PositionConstants.NORTH) != 0)
+					edgeBeingResized = -1;
+				else
+					edgeBeingResized = 1;
+				if (alignment == edgeBeingResized)
+					result = result.chain(new ChangeGuideCommand(part, true));
+			}
+		}
+
+		if ((request.getResizeDirection() & PositionConstants.EAST_WEST) != 0) {
+			Integer guidePos = (Integer) request.getExtendedData().get(
+					SnapToGuides.KEY_VERTICAL_GUIDE);
+			if (guidePos != null) {
+				result = chainGuideAttachmentCommand(request, part, result,
+						false);
+			} else if (part.getVerticalGuide() != null) {
+				int alignment = part.getVerticalGuide().getAlignment(part);
+				int edgeBeingResized = 0;
+				if ((request.getResizeDirection() & PositionConstants.WEST) != 0)
+					edgeBeingResized = -1;
+				else
+					edgeBeingResized = 1;
+				if (alignment == edgeBeingResized)
+					result = result.chain(new ChangeGuideCommand(part, false));
+			}
+		}
+
+		if (request.getType().equals(REQ_MOVE_CHILDREN)
+				|| request.getType().equals(REQ_ALIGN_CHILDREN)) {
+			result = chainGuideAttachmentCommand(request, part, result, true);
+			result = chainGuideAttachmentCommand(request, part, result, false);
+			result = chainGuideDetachmentCommand(request, part, result, true);
+			result = chainGuideDetachmentCommand(request, part, result, false);
+		}
+
+		return result;
+	}
+
+	protected EditPolicy createChildEditPolicy(EditPart child) {
+		if (child instanceof LEDEditPart || child instanceof OutputEditPart) {
+			ResizableEditPolicy policy = new LogicResizableEditPolicy();
+			policy.setResizeDirections(0);
+			return policy;
+		} else if (child instanceof LogicLabelEditPart) {
+			ResizableEditPolicy policy = new LogicResizableEditPolicy();
+			policy.setResizeDirections(PositionConstants.EAST
+					| PositionConstants.WEST);
+			return policy;
+		}
+
+		return new LogicResizableEditPolicy();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.gef.editpolicies.LayoutEditPolicy#createSizeOnDropFeedback
+	 * (org.eclipse.gef.requests.CreateRequest)
+	 */
+	protected IFigure createSizeOnDropFeedback(CreateRequest createRequest) {
+		IFigure figure;
+
+		if (createRequest.getNewObject() instanceof Circuit)
+			figure = new CircuitFeedbackFigure();
+		else if (createRequest.getNewObject() instanceof LogicFlowContainer)
+			figure = new LogicFlowFeedbackFigure();
+		else if (createRequest.getNewObject() instanceof LogicLabel)
+			figure = new LabelFeedbackFigure();
+		else {
+			figure = new RectangleFigure();
+			((RectangleFigure) figure).setXOR(true);
+			((RectangleFigure) figure).setFill(true);
+			figure.setBackgroundColor(LogicColorConstants.ghostFillColor);
+			figure.setForegroundColor(ColorConstants.white);
+		}
+
+		addFeedback(figure);
+
+		return figure;
+	}
+
+	protected LogicGuide findGuideAt(int pos, boolean horizontal) {
+		RulerProvider provider = ((RulerProvider) getHost().getViewer()
+				.getProperty(
+						horizontal ? RulerProvider.PROPERTY_VERTICAL_RULER
+								: RulerProvider.PROPERTY_HORIZONTAL_RULER));
+		return (LogicGuide) provider.getGuideAt(pos);
+	}
+
+	protected Command getAddCommand(Request generic) {
+		ChangeBoundsRequest request = (ChangeBoundsRequest) generic;
+		List editParts = request.getEditParts();
+		CompoundCommand command = new CompoundCommand();
+		command.setDebugLabel("Add in ConstrainedLayoutEditPolicy");//$NON-NLS-1$
+		GraphicalEditPart childPart;
+		Rectangle r;
+		Object constraint;
+
+		for (int i = 0; i < editParts.size(); i++) {
+			childPart = (GraphicalEditPart) editParts.get(i);
+			r = childPart.getFigure().getBounds().getCopy();
+			// convert r to absolute from childpart figure
+			childPart.getFigure().translateToAbsolute(r);
+			r = request.getTransformedRectangle(r);
+			// convert this figure to relative
+			getLayoutContainer().translateToRelative(r);
+			getLayoutContainer().translateFromParent(r);
+			r.translate(getLayoutOrigin().getNegated());
+			constraint = getConstraintFor(r);
+			command.add(createAddCommand(generic, childPart,
+					translateToModelConstraint(constraint)));
+		}
+		return command.unwrap();
+	}
+
+	/**
+	 * Override to return the <code>Command</code> to perform an
+	 * {@link RequestConstants#REQ_CLONE CLONE}. By default, <code>null</code>
+	 * is returned.
+	 * 
+	 * @param request
+	 *            the Clone Request
+	 * @return A command to perform the Clone.
+	 */
+	protected Command getCloneCommand(ChangeBoundsRequest request) {
+		CloneCommand clone = new CloneCommand();
+
+		clone.setParent((LogicDiagram) getHost().getModel());
+
+		Iterator i = request.getEditParts().iterator();
+		GraphicalEditPart currPart = null;
+
+		while (i.hasNext()) {
+			currPart = (GraphicalEditPart) i.next();
+			clone.addPart((LogicSubpart) currPart.getModel(),
+					(Rectangle) getConstraintForClone(currPart, request));
+		}
+
+		// Attach to horizontal guide, if one is given
+		Integer guidePos = (Integer) request.getExtendedData().get(
+				SnapToGuides.KEY_HORIZONTAL_GUIDE);
+		if (guidePos != null) {
+			int hAlignment = ((Integer) request.getExtendedData().get(
+					SnapToGuides.KEY_HORIZONTAL_ANCHOR)).intValue();
+			clone.setGuide(findGuideAt(guidePos.intValue(), true), hAlignment,
+					true);
+		}
+
+		// Attach to vertical guide, if one is given
+		guidePos = (Integer) request.getExtendedData().get(
+				SnapToGuides.KEY_VERTICAL_GUIDE);
+		if (guidePos != null) {
+			int vAlignment = ((Integer) request.getExtendedData().get(
+					SnapToGuides.KEY_VERTICAL_ANCHOR)).intValue();
+			clone.setGuide(findGuideAt(guidePos.intValue(), false), vAlignment,
+					false);
+		}
+
+		return clone;
+	}
+
+	protected Command getCreateCommand(CreateRequest request) {
+		CreateCommand create = new CreateCommand();
+		create.setParent((LogicDiagram) getHost().getModel());
+		LogicSubpart newPart = (LogicSubpart) request.getNewObject();
+		create.setChild(newPart);
+		Rectangle constraint = (Rectangle) getConstraintFor(request);
+		create.setLocation(constraint);
+		create.setLabel(LogicMessages.LogicXYLayoutEditPolicy_CreateCommandLabelText);
+
+		Command cmd = chainGuideAttachmentCommand(request, newPart, create,
+				true);
+		return chainGuideAttachmentCommand(request, newPart, cmd, false);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreationFeedbackOffset
+	 * (org.eclipse.gef.requests.CreateRequest)
+	 */
+	protected Insets getCreationFeedbackOffset(CreateRequest request) {
+		if (request.getNewObject() instanceof LED
+				|| request.getNewObject() instanceof Circuit)
+			return new Insets(2, 0, 2, 0);
+		return new Insets();
+	}
+
+	/**
+	 * Returns the layer used for displaying feedback.
+	 * 
+	 * @return the feedback layer
+	 */
+	protected IFigure getFeedbackLayer() {
+		return getLayer(LayerConstants.SCALED_FEEDBACK_LAYER);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/NativeDropRequest.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/NativeDropRequest.java
new file mode 100644
index 0000000..cbdc674
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/NativeDropRequest.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.gef.Request;
+
+public class NativeDropRequest extends Request {
+
+	private Object data;
+
+	public static final String ID = "$Native Drop Request";//$NON-NLS-1$
+
+	public NativeDropRequest() {
+		super(ID);
+	}
+
+	public NativeDropRequest(Object type) {
+		super(type);
+	}
+
+	public Object getData() {
+		return data;
+	}
+
+	public void setData(Object data) {
+		this.data = data;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/OutputEditPart.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/OutputEditPart.java
new file mode 100644
index 0000000..a50ae2b
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/OutputEditPart.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.swt.accessibility.AccessibleEvent;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.IFigure;
+
+import org.eclipse.gef.AccessibleAnchorProvider;
+import org.eclipse.gef.AccessibleEditPart;
+
+import org.eclipse.gef.examples.logicdesigner.figures.GroundFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.LiveOutputFigure;
+import org.eclipse.gef.examples.logicdesigner.figures.OutputFigure;
+import org.eclipse.gef.examples.logicdesigner.model.GroundOutput;
+import org.eclipse.gef.examples.logicdesigner.model.LiveOutput;
+import org.eclipse.gef.examples.logicdesigner.model.SimpleOutput;
+
+/**
+ * EditPart for Output types in Logic Example
+ */
+public class OutputEditPart extends LogicEditPart {
+
+	protected AccessibleEditPart createAccessible() {
+		return new AccessibleGraphicalEditPart() {
+			public void getName(AccessibleEvent e) {
+				e.result = getSimpleOutput().toString();
+			}
+		};
+	}
+
+	/**
+	 * Returns a newly created Figure.
+	 */
+	protected IFigure createFigure() {
+		OutputFigure figure;
+		if (getModel() == null)
+			return null;
+		else if (getModel() instanceof LiveOutput)
+			figure = new LiveOutputFigure();
+		else if (getModel() instanceof GroundOutput)
+			figure = new GroundFigure();
+		else
+			figure = new OutputFigure();
+		return figure;
+	}
+
+	public Object getAdapter(Class key) {
+		if (key == AccessibleAnchorProvider.class)
+			return new DefaultAccessibleAnchorProvider() {
+				public List getSourceAnchorLocations() {
+					List list = new ArrayList();
+					Vector sourceAnchors = getNodeFigure()
+							.getSourceConnectionAnchors();
+					for (int i = 0; i < sourceAnchors.size(); i++) {
+						ConnectionAnchor anchor = (ConnectionAnchor) sourceAnchors
+								.get(i);
+						list.add(anchor.getReferencePoint()
+								.getTranslated(0, -3));
+					}
+					return list;
+				}
+
+			};
+		return super.getAdapter(key);
+	}
+
+	/**
+	 * Returns the Figure for this as an OutputFigure.
+	 * 
+	 * @return Figure of this as a OutputFigure.
+	 */
+	protected OutputFigure getOutputFigure() {
+		return (OutputFigure) getFigure();
+	}
+
+	/**
+	 * Returns the model of this as a SimpleOutput.
+	 * 
+	 * @return Model of this as a SimpleOutput.
+	 */
+	protected SimpleOutput getSimpleOutput() {
+		return (SimpleOutput) getModel();
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/TreePartFactory.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/TreePartFactory.java
new file mode 100644
index 0000000..60e73ce
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/TreePartFactory.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+
+import org.eclipse.gef.examples.logicdesigner.model.LED;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+
+public class TreePartFactory implements EditPartFactory {
+
+	public EditPart createEditPart(EditPart context, Object model) {
+		if (model instanceof LED)
+			return new LogicTreeEditPart(model);
+		if (model instanceof LogicDiagram)
+			return new LogicContainerTreeEditPart(model);
+		return new LogicTreeEditPart(model);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/WireBendpointEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/WireBendpointEditPolicy.java
new file mode 100644
index 0000000..385b316
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/WireBendpointEditPolicy.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.geometry.Point;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.BendpointRequest;
+
+import org.eclipse.gef.examples.logicdesigner.model.Wire;
+import org.eclipse.gef.examples.logicdesigner.model.commands.BendpointCommand;
+import org.eclipse.gef.examples.logicdesigner.model.commands.CreateBendpointCommand;
+import org.eclipse.gef.examples.logicdesigner.model.commands.DeleteBendpointCommand;
+import org.eclipse.gef.examples.logicdesigner.model.commands.MoveBendpointCommand;
+
+public class WireBendpointEditPolicy extends
+		org.eclipse.gef.editpolicies.BendpointEditPolicy {
+
+	protected Command getCreateBendpointCommand(BendpointRequest request) {
+		CreateBendpointCommand com = new CreateBendpointCommand();
+		Point p = request.getLocation();
+		Connection conn = getConnection();
+
+		conn.translateToRelative(p);
+
+		com.setLocation(p);
+		Point ref1 = getConnection().getSourceAnchor().getReferencePoint();
+		Point ref2 = getConnection().getTargetAnchor().getReferencePoint();
+
+		conn.translateToRelative(ref1);
+		conn.translateToRelative(ref2);
+
+		com.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
+		com.setWire((Wire) request.getSource().getModel());
+		com.setIndex(request.getIndex());
+		return com;
+	}
+
+	protected Command getMoveBendpointCommand(BendpointRequest request) {
+		MoveBendpointCommand com = new MoveBendpointCommand();
+		Point p = request.getLocation();
+		Connection conn = getConnection();
+
+		conn.translateToRelative(p);
+
+		com.setLocation(p);
+
+		Point ref1 = getConnection().getSourceAnchor().getReferencePoint();
+		Point ref2 = getConnection().getTargetAnchor().getReferencePoint();
+
+		conn.translateToRelative(ref1);
+		conn.translateToRelative(ref2);
+
+		com.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
+		com.setWire((Wire) request.getSource().getModel());
+		com.setIndex(request.getIndex());
+		return com;
+	}
+
+	protected Command getDeleteBendpointCommand(BendpointRequest request) {
+		BendpointCommand com = new DeleteBendpointCommand();
+		Point p = request.getLocation();
+		com.setLocation(p);
+		com.setWire((Wire) request.getSource().getModel());
+		com.setIndex(request.getIndex());
+		return com;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/WireEditPart.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/WireEditPart.java
new file mode 100644
index 0000000..5158cae
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/WireEditPart.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ManhattanConnectionRouter;
+import org.eclipse.draw2d.RelativeBendpoint;
+
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.figures.FigureFactory;
+import org.eclipse.gef.examples.logicdesigner.model.Wire;
+import org.eclipse.gef.examples.logicdesigner.model.WireBendpoint;
+
+/**
+ * Implements a Connection Editpart to represent a Wire like connection.
+ * 
+ */
+public class WireEditPart extends AbstractConnectionEditPart implements
+		PropertyChangeListener {
+
+	AccessibleEditPart acc;
+
+	public static final Color alive = new Color(Display.getDefault(), 30, 144,
+			255), dead = new Color(Display.getDefault(), 30, 30, 30);
+
+	public void activate() {
+		super.activate();
+		getWire().addPropertyChangeListener(this);
+	}
+
+	public void activateFigure() {
+		super.activateFigure();
+		/*
+		 * Once the figure has been added to the ConnectionLayer, start
+		 * listening for its router to change.
+		 */
+		getFigure().addPropertyChangeListener(
+				Connection.PROPERTY_CONNECTION_ROUTER, this);
+	}
+
+	/**
+	 * Adds extra EditPolicies as required.
+	 */
+	protected void createEditPolicies() {
+		installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE,
+				new WireEndpointEditPolicy());
+		// Note that the Connection is already added to the diagram and knows
+		// its Router.
+		refreshBendpointEditPolicy();
+		installEditPolicy(EditPolicy.CONNECTION_ROLE, new WireEditPolicy());
+	}
+
+	/**
+	 * Returns a newly created Figure to represent the connection.
+	 * 
+	 * @return The created Figure.
+	 */
+	protected IFigure createFigure() {
+		Connection connx = FigureFactory.createNewBendableWire(getWire());
+		return connx;
+	}
+
+	public void deactivate() {
+		getWire().removePropertyChangeListener(this);
+		super.deactivate();
+	}
+
+	public void deactivateFigure() {
+		getFigure().removePropertyChangeListener(
+				Connection.PROPERTY_CONNECTION_ROUTER, this);
+		super.deactivateFigure();
+	}
+
+	public AccessibleEditPart getAccessibleEditPart() {
+		if (acc == null)
+			acc = new AccessibleGraphicalEditPart() {
+				public void getName(AccessibleEvent e) {
+					e.result = LogicMessages.Wire_LabelText;
+				}
+			};
+		return acc;
+	}
+
+	/**
+	 * Returns the model of this represented as a Wire.
+	 * 
+	 * @return Model of this as <code>Wire</code>
+	 */
+	protected Wire getWire() {
+		return (Wire) getModel();
+	}
+
+	/**
+	 * Returns the Figure associated with this, which draws the Wire.
+	 * 
+	 * @return Figure of this.
+	 */
+	protected IFigure getWireFigure() {
+		return getFigure();
+	}
+
+	/**
+	 * Listens to changes in properties of the Wire (like the contents being
+	 * carried), and reflects is in the visuals.
+	 * 
+	 * @param event
+	 *            Event notifying the change.
+	 */
+	public void propertyChange(PropertyChangeEvent event) {
+		String property = event.getPropertyName();
+		if (Connection.PROPERTY_CONNECTION_ROUTER.equals(property)) {
+			refreshBendpoints();
+			refreshBendpointEditPolicy();
+		}
+		if ("value".equals(property)) //$NON-NLS-1$
+			refreshVisuals();
+		if ("bendpoint".equals(property)) //$NON-NLS-1$
+			refreshBendpoints();
+	}
+
+	/**
+	 * Updates the bendpoints, based on the model.
+	 */
+	protected void refreshBendpoints() {
+		if (getConnectionFigure().getConnectionRouter() instanceof ManhattanConnectionRouter)
+			return;
+		List modelConstraint = getWire().getBendpoints();
+		List figureConstraint = new ArrayList();
+		for (int i = 0; i < modelConstraint.size(); i++) {
+			WireBendpoint wbp = (WireBendpoint) modelConstraint.get(i);
+			RelativeBendpoint rbp = new RelativeBendpoint(getConnectionFigure());
+			rbp.setRelativeDimensions(wbp.getFirstRelativeDimension(),
+					wbp.getSecondRelativeDimension());
+			rbp.setWeight((i + 1) / ((float) modelConstraint.size() + 1));
+			figureConstraint.add(rbp);
+		}
+		getConnectionFigure().setRoutingConstraint(figureConstraint);
+	}
+
+	private void refreshBendpointEditPolicy() {
+		if (getConnectionFigure().getConnectionRouter() instanceof ManhattanConnectionRouter)
+			installEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE, null);
+		else
+			installEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE,
+					new WireBendpointEditPolicy());
+	}
+
+	/**
+	 * Refreshes the visual aspects of this, based upon the model (Wire). It
+	 * changes the wire color depending on the state of Wire.
+	 * 
+	 */
+	protected void refreshVisuals() {
+		refreshBendpoints();
+		if (getWire().getValue())
+			getWireFigure().setForegroundColor(alive);
+		else
+			getWireFigure().setForegroundColor(dead);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/WireEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/WireEditPolicy.java
new file mode 100644
index 0000000..18d3d17
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/WireEditPolicy.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.GroupRequest;
+
+import org.eclipse.gef.examples.logicdesigner.model.Wire;
+import org.eclipse.gef.examples.logicdesigner.model.commands.ConnectionCommand;
+
+public class WireEditPolicy extends
+		org.eclipse.gef.editpolicies.ConnectionEditPolicy {
+
+	protected Command getDeleteCommand(GroupRequest request) {
+		ConnectionCommand c = new ConnectionCommand();
+		c.setWire((Wire) getHost().getModel());
+		return c;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/WireEndpointEditPolicy.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/WireEndpointEditPolicy.java
new file mode 100644
index 0000000..9325873
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/edit/WireEndpointEditPolicy.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.edit;
+
+import org.eclipse.draw2d.PolylineConnection;
+
+import org.eclipse.gef.GraphicalEditPart;
+
+public class WireEndpointEditPolicy extends
+		org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy {
+
+	protected void addSelectionHandles() {
+		super.addSelectionHandles();
+		getConnectionFigure().setLineWidth(2);
+	}
+
+	protected PolylineConnection getConnectionFigure() {
+		return (PolylineConnection) ((GraphicalEditPart) getHost()).getFigure();
+	}
+
+	protected void removeSelectionHandles() {
+		super.removeSelectionHandles();
+		getConnectionFigure().setLineWidth(0);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/AndGateFeedbackFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/AndGateFeedbackFigure.java
new file mode 100644
index 0000000..b86bd16
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/AndGateFeedbackFigure.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class AndGateFeedbackFigure extends AndGateFigure {
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics g) {
+		g.setXORMode(true);
+		g.setForegroundColor(ColorConstants.white);
+		g.setBackgroundColor(LogicColorConstants.ghostFillColor);
+
+		Rectangle r = getBounds().getCopy();
+		r.translate(2, 2);
+		r.setSize(11, 9);
+
+		// Draw terminals, 2 at top
+		g.drawLine(r.x + 2, r.y, r.x + 2, r.y - 2);
+		g.drawLine(r.right() - 3, r.y, r.right() - 3, r.y - 2);
+		g.drawPoint(r.x + 2, r.y);
+		g.drawPoint(r.right() - 3, r.y);
+
+		// outline main area
+		g.drawLine(r.x, r.y, r.right() - 1, r.y);
+		g.drawLine(r.right() - 1, r.y, r.right() - 1, r.bottom() - 1);
+		g.drawLine(r.x, r.y, r.x, r.bottom() - 1);
+
+		g.drawPoint(r.x, r.y);
+		g.drawPoint(r.right() - 1, r.y);
+
+		g.fillRectangle(r);
+
+		// draw and outline the arc
+		r.height = 9;
+		r.y += 4;
+		g.setForegroundColor(LogicColorConstants.ghostFillColor);
+		g.drawLine(r.x, r.y + 4, r.x + 10, r.y + 4);
+		g.setForegroundColor(ColorConstants.white);
+
+		g.drawPoint(r.x, r.y + 4);
+		g.fillArc(r, 180, 180);
+
+		r.width--;
+		r.height--;
+
+		g.drawArc(r, 180, 180);
+		g.drawLine(r.x + r.width / 2, r.bottom(), r.x + r.width / 2,
+				r.bottom() + 2);
+
+		g.drawPoint(r.x + r.width / 2, r.bottom());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/AndGateFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/AndGateFigure.java
new file mode 100644
index 0000000..0fb29f3
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/AndGateFigure.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * @author danlee
+ */
+public class AndGateFigure extends GateFigure {
+
+	private static final Dimension SIZE = new Dimension(15, 17);
+
+	/**
+	 * Constructor for AndGateFigure.
+	 */
+	public AndGateFigure() {
+		setBackgroundColor(LogicColorConstants.andGate);
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#getPreferredSize(int, int)
+	 */
+	public Dimension getPreferredSize(int wHint, int hHint) {
+		return SIZE;
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics g) {
+		Rectangle r = getBounds().getCopy();
+		r.translate(2, 2);
+		r.setSize(11, 9);
+
+		// Draw terminals, 2 at top
+		g.drawLine(r.x + 2, r.y, r.x + 2, r.y - 2);
+		g.drawLine(r.right() - 3, r.y, r.right() - 3, r.y - 2);
+
+		// draw main area
+		g.fillRectangle(r);
+
+		// outline main area
+		g.drawLine(r.x, r.y, r.right() - 1, r.y);
+		g.drawLine(r.right() - 1, r.y, r.right() - 1, r.bottom() - 1);
+		g.drawLine(r.x, r.y, r.x, r.bottom() - 1);
+
+		// draw and outline the arc
+		r.height = 9;
+		r.y += 4;
+		g.fillArc(r, 180, 180);
+		r.width--;
+		r.height--;
+		g.drawArc(r, 180, 190);
+		g.drawLine(r.x + r.width / 2, r.bottom(), r.x + r.width / 2,
+				r.bottom() + 2);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/BentCornerFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/BentCornerFigure.java
new file mode 100644
index 0000000..b216dad
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/BentCornerFigure.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * A figure that has a bent corner in the top right hand. Typically used for
+ * sticky notes.
+ */
+public class BentCornerFigure extends Figure {
+
+	/**
+	 * The default amount of pixels subtracted from the figure's height and
+	 * width to determine the size of the corner.
+	 */
+	protected static int DEFAULT_CORNER_SIZE = 10;
+
+	private int cornerSize;
+
+	/**
+	 * Constructs an empty BentCornerFigure with default background color of
+	 * ColorConstants.tooltipBackground and default corner size.
+	 */
+	public BentCornerFigure() {
+		setBackgroundColor(ColorConstants.tooltipBackground);
+		setForegroundColor(ColorConstants.tooltipForeground);
+		setCornerSize(DEFAULT_CORNER_SIZE);
+	}
+
+	/**
+	 * Returns the size, in pixels, that the figure should use to draw its bent
+	 * corner.
+	 * 
+	 * @return size of the corner
+	 */
+	public int getCornerSize() {
+		return cornerSize;
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(org.eclipse.draw2d.Graphics)
+	 */
+	protected void paintFigure(Graphics graphics) {
+		Rectangle rect = getBounds().getCopy();
+
+		graphics.translate(getLocation());
+
+		// fill the note
+		PointList outline = new PointList();
+
+		outline.addPoint(0, 0);
+		outline.addPoint(rect.width - cornerSize, 0);
+		outline.addPoint(rect.width - 1, cornerSize);
+		outline.addPoint(rect.width - 1, rect.height - 1);
+		outline.addPoint(0, rect.height - 1);
+
+		graphics.fillPolygon(outline);
+
+		// draw the inner outline
+		PointList innerLine = new PointList();
+
+		innerLine.addPoint(rect.width - cornerSize - 1, 0);
+		innerLine.addPoint(rect.width - cornerSize - 1, cornerSize);
+		innerLine.addPoint(rect.width - 1, cornerSize);
+		innerLine.addPoint(rect.width - cornerSize - 1, 0);
+		innerLine.addPoint(0, 0);
+		innerLine.addPoint(0, rect.height - 1);
+		innerLine.addPoint(rect.width - 1, rect.height - 1);
+		innerLine.addPoint(rect.width - 1, cornerSize);
+
+		graphics.drawPolygon(innerLine);
+
+		graphics.translate(getLocation().getNegated());
+	}
+
+	/**
+	 * Sets the size of the figure's corner to the given offset.
+	 * 
+	 * @param newSize
+	 *            the new size to use.
+	 */
+	public void setCornerSize(int newSize) {
+		cornerSize = newSize;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/CircuitBorder.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/CircuitBorder.java
new file mode 100644
index 0000000..08322c5
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/CircuitBorder.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.AbstractBorder;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class CircuitBorder extends AbstractBorder {
+
+	protected static Insets insets = new Insets(8, 6, 8, 6);
+	protected static PointList connector = new PointList();
+	protected static PointList bottomConnector = new PointList();
+
+	static {
+		connector.addPoint(-2, 0);
+		connector.addPoint(1, 0);
+		connector.addPoint(2, 1);
+		connector.addPoint(2, 5);
+		connector.addPoint(-1, 5);
+		connector.addPoint(-1, 1);
+
+		bottomConnector.addPoint(-2, -1);
+		bottomConnector.addPoint(1, -1);
+		bottomConnector.addPoint(2, -2);
+		bottomConnector.addPoint(2, -6);
+		bottomConnector.addPoint(-1, -6);
+		bottomConnector.addPoint(-1, -2);
+	}
+
+	private void drawConnectors(Graphics g, Rectangle rec) {
+		int y1 = rec.y, width = rec.width, x1, bottom = y1 + rec.height;
+		g.setBackgroundColor(LogicColorConstants.connectorGreen);
+		for (int i = 0; i < 4; i++) {
+			x1 = rec.x + (2 * i + 1) * width / 8;
+
+			// Draw the "gap" for the connector
+			g.setForegroundColor(ColorConstants.listBackground);
+			g.drawLine(x1 - 2, y1 + 2, x1 + 3, y1 + 2);
+
+			// Draw the connectors
+			g.setForegroundColor(LogicColorConstants.connectorGreen);
+			connector.translate(x1, y1);
+			g.fillPolygon(connector);
+			g.drawPolygon(connector);
+			connector.translate(-x1, -y1);
+			g.setForegroundColor(ColorConstants.listBackground);
+			g.drawLine(x1 - 2, bottom - 3, x1 + 3, bottom - 3);
+			g.setForegroundColor(LogicColorConstants.connectorGreen);
+			bottomConnector.translate(x1, bottom);
+			g.fillPolygon(bottomConnector);
+			g.drawPolygon(bottomConnector);
+			bottomConnector.translate(-x1, -bottom);
+		}
+	}
+
+	public Insets getInsets(IFigure figure) {
+		return insets;
+	}
+
+	public void paint(IFigure figure, Graphics g, Insets in) {
+		Rectangle r = figure.getBounds().getCropped(in);
+
+		g.setForegroundColor(LogicColorConstants.logicGreen);
+		g.setBackgroundColor(LogicColorConstants.logicGreen);
+
+		// Draw the sides of the border
+		g.fillRectangle(r.x, r.y + 2, r.width, 6);
+		g.fillRectangle(r.x, r.bottom() - 8, r.width, 6);
+		g.fillRectangle(r.x, r.y + 2, 6, r.height - 4);
+		g.fillRectangle(r.right() - 6, r.y + 2, 6, r.height - 4);
+
+		// Outline the border
+		g.setForegroundColor(LogicColorConstants.connectorGreen);
+		g.drawLine(r.x, r.y + 2, r.right() - 1, r.y + 2);
+		g.drawLine(r.x, r.bottom() - 3, r.right() - 1, r.bottom() - 3);
+		g.drawLine(r.x, r.y + 2, r.x, r.bottom() - 3);
+		g.drawLine(r.right() - 1, r.bottom() - 3, r.right() - 1, r.y + 2);
+
+		r.crop(new Insets(1, 1, 0, 0));
+		r.expand(1, 1);
+		r.crop(getInsets(figure));
+		drawConnectors(g, figure.getBounds().getCropped(in));
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/CircuitFeedbackBorder.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/CircuitFeedbackBorder.java
new file mode 100644
index 0000000..0ea0093
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/CircuitFeedbackBorder.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class CircuitFeedbackBorder extends CircuitBorder {
+
+	private void drawConnectors(Graphics g, Rectangle rec) {
+		int y1 = rec.y, width = rec.width, x1, bottom = y1 + rec.height;
+		for (int i = 0; i < 4; i++) {
+			x1 = rec.x + (2 * i + 1) * width / 8;
+
+			// Draw the "gap" for the connector
+			g.drawLine(x1 - 2, y1 + 2, x1 + 3, y1 + 2);
+
+			// Draw the connectors
+			connector.translate(x1, y1);
+			g.drawPolygon(connector);
+			connector.translate(-x1, -y1);
+			g.drawLine(x1 - 2, bottom - 3, x1 + 3, bottom - 3);
+			bottomConnector.translate(x1, bottom);
+			g.drawPolygon(bottomConnector);
+			bottomConnector.translate(-x1, -bottom);
+		}
+	}
+
+	public void paint(IFigure figure, Graphics g, Insets in) {
+		g.setXORMode(true);
+		g.setForegroundColor(ColorConstants.white);
+		g.setBackgroundColor(LogicColorConstants.ghostFillColor);
+
+		Rectangle r = figure.getBounds().getCropped(in);
+
+		// Draw the sides of the border
+		g.fillRectangle(r.x, r.y + 2, r.width, 6);
+		g.fillRectangle(r.x, r.bottom() - 8, r.width, 6);
+		g.fillRectangle(r.x, r.y + 2, 6, r.height - 4);
+		g.fillRectangle(r.right() - 6, r.y + 2, 6, r.height - 4);
+
+		g.fillRectangle(r.x, r.y + 2, 6, 6);
+		g.fillRectangle(r.x, r.bottom() - 8, 6, 6);
+		g.fillRectangle(r.right() - 6, r.y + 2, 6, 6);
+		g.fillRectangle(r.right() - 6, r.bottom() - 8, 6, 6);
+
+		// Outline the border
+		g.drawPoint(r.x, r.y + 2);
+		g.drawPoint(r.x, r.bottom() - 3);
+		g.drawPoint(r.right() - 1, r.y + 2);
+		g.drawPoint(r.right() - 1, r.bottom() - 3);
+		g.drawLine(r.x, r.y + 2, r.right() - 1, r.y + 2);
+		g.drawLine(r.x, r.bottom() - 3, r.right() - 1, r.bottom() - 3);
+		g.drawLine(r.x, r.y + 2, r.x, r.bottom() - 3);
+		g.drawLine(r.right() - 1, r.bottom() - 3, r.right() - 1, r.y + 2);
+
+		r.crop(new Insets(1, 1, 0, 0));
+		r.expand(1, 1);
+		r.crop(getInsets(figure));
+		drawConnectors(g, figure.getBounds().getCropped(in));
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/CircuitFeedbackFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/CircuitFeedbackFigure.java
new file mode 100644
index 0000000..7cac6f9
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/CircuitFeedbackFigure.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.RectangleFigure;
+
+public class CircuitFeedbackFigure extends RectangleFigure {
+
+	public CircuitFeedbackFigure() {
+		this.setFill(false);
+		this.setXOR(true);
+		setBorder(new CircuitFeedbackBorder());
+	}
+
+	protected boolean useLocalCoordinates() {
+		return true;
+	}
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/CircuitFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/CircuitFigure.java
new file mode 100644
index 0000000..9e3cc4e
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/CircuitFigure.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.FreeformLayer;
+import org.eclipse.draw2d.FreeformLayout;
+import org.eclipse.draw2d.FreeformViewport;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.IScrollableFigure;
+import org.eclipse.draw2d.PuristicScrollPane;
+import org.eclipse.draw2d.ScrollPane;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.handles.HandleBounds;
+
+import org.eclipse.gef.examples.logicdesigner.model.Circuit;
+
+public class CircuitFigure extends NodeFigure implements HandleBounds,
+		IScrollableFigure {
+
+	private ScrollPane scrollpane;
+
+	public CircuitFigure() {
+		setBorder(new CircuitBorder());
+		scrollpane = new PuristicScrollPane();
+		IFigure pane = new FreeformLayer();
+		pane.setLayoutManager(new FreeformLayout());
+		setLayoutManager(new StackLayout());
+		add(scrollpane);
+		scrollpane.setViewport(new FreeformViewport());
+		scrollpane.setContents(pane);
+
+		createConnectionAnchors();
+		setBackgroundColor(ColorConstants.listBackground);
+		setOpaque(true);
+	}
+
+	protected void createConnectionAnchors() {
+		FixedConnectionAnchor in, out;
+		for (int i = 0; i < 8; i++) {
+			in = new FixedConnectionAnchor(this);
+			out = new FixedConnectionAnchor(this);
+			if (i > 3) {
+				in.topDown = false;
+				in.offsetV = 5;
+				out.topDown = false;
+			} else {
+				out.offsetV = 5;
+			}
+			setOutputConnectionAnchor(i, out);
+			setInputConnectionAnchor(i, in);
+			outputConnectionAnchors.addElement(out);
+			inputConnectionAnchors.addElement(in);
+		}
+	}
+
+	public IFigure getContentsPane() {
+		return scrollpane.getContents();
+	}
+
+	protected FixedConnectionAnchor getInputConnectionAnchor(int i) {
+		return (FixedConnectionAnchor) connectionAnchors
+				.get(Circuit.TERMINALS_IN[i]);
+	}
+
+	/**
+	 * @see org.eclipse.gef.handles.HandleBounds#getHandleBounds()
+	 */
+	public Rectangle getHandleBounds() {
+		return getBounds().getCropped(new Insets(2, 0, 2, 0));
+	}
+
+	protected FixedConnectionAnchor getOutputConnectionAnchor(int i) {
+		return (FixedConnectionAnchor) connectionAnchors
+				.get(Circuit.TERMINALS_OUT[i]);
+	}
+
+	public Dimension getPreferredSize(int w, int h) {
+		Dimension prefSize = super.getPreferredSize(w, h);
+		Dimension defaultSize = new Dimension(100, 100);
+		prefSize.union(defaultSize);
+		return prefSize;
+	}
+
+	protected void layoutConnectionAnchors() {
+		int x;
+		for (int i = 0; i < 4; i++) {
+			x = (2 * i + 1) * getSize().width / 8;
+			getOutputConnectionAnchor(i + 4).setOffsetH(x - 1);
+			getInputConnectionAnchor(i).setOffsetH(x - 1);
+			getInputConnectionAnchor(i + 4).setOffsetH(x);
+			getOutputConnectionAnchor(i).setOffsetH(x);
+		}
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics graphics) {
+		Rectangle rect = getBounds().getCopy();
+		rect.crop(new Insets(2, 0, 2, 0));
+		graphics.fillRectangle(rect);
+	}
+
+	public void setInputConnectionAnchor(int i, ConnectionAnchor c) {
+		connectionAnchors.put(Circuit.TERMINALS_IN[i], c);
+	}
+
+	public void setOutputConnectionAnchor(int i, ConnectionAnchor c) {
+		connectionAnchors.put(Circuit.TERMINALS_OUT[i], c);
+	}
+
+	public String toString() {
+		return "CircuitBoardFigure"; //$NON-NLS-1$
+	}
+
+	public void validate() {
+		if (isValid())
+			return;
+		layoutConnectionAnchors();
+		super.validate();
+	}
+
+	protected boolean useLocalCoordinates() {
+		return true;
+	}
+
+	public ScrollPane getScrollPane() {
+		return scrollpane;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/FigureFactory.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/FigureFactory.java
new file mode 100644
index 0000000..6664122
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/FigureFactory.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.draw2d.RoutingAnimator;
+
+import org.eclipse.gef.examples.logicdesigner.model.SimpleOutput;
+import org.eclipse.gef.examples.logicdesigner.model.Wire;
+
+public class FigureFactory {
+
+	public static PolylineConnection createNewBendableWire(Wire wire) {
+		PolylineConnection conn = new PolylineConnection();
+		conn.addRoutingListener(RoutingAnimator.getDefault());
+		// conn.setSourceDecoration(new PolygonDecoration());
+		// conn.setTargetDecoration(new PolylineDecoration());
+		return conn;
+	}
+
+	public static PolylineConnection createNewWire(Wire wire) {
+
+		PolylineConnection conn = new PolylineConnection();
+		conn.addRoutingListener(RoutingAnimator.getDefault());
+		PolygonDecoration arrow;
+
+		if (wire == null || wire.getSource() instanceof SimpleOutput)
+			arrow = null;
+		else {
+			arrow = new PolygonDecoration();
+			arrow.setTemplate(PolygonDecoration.INVERTED_TRIANGLE_TIP);
+			arrow.setScale(5, 2.5);
+		}
+		conn.setSourceDecoration(arrow);
+
+		if (wire == null || wire.getTarget() instanceof SimpleOutput)
+			arrow = null;
+		else {
+			arrow = new PolygonDecoration();
+			arrow.setTemplate(PolygonDecoration.INVERTED_TRIANGLE_TIP);
+			arrow.setScale(5, 2.5);
+		}
+		conn.setTargetDecoration(arrow);
+		return conn;
+	}
+
+	public static IFigure createNewLED() {
+		return new LEDFigure();
+	}
+
+	public static IFigure createNewCircuit() {
+		CircuitFigure f = new CircuitFigure();
+		return f;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/FixedConnectionAnchor.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/FixedConnectionAnchor.java
new file mode 100644
index 0000000..146e681
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/FixedConnectionAnchor.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.AbstractConnectionAnchor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ScalableFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PrecisionPoint;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class FixedConnectionAnchor extends AbstractConnectionAnchor {
+
+	public boolean leftToRight = true;
+	public int offsetH;
+	public int offsetV;
+	public boolean topDown = true;
+
+	public FixedConnectionAnchor(IFigure owner) {
+		super(owner);
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.AbstractConnectionAnchor#ancestorMoved(IFigure)
+	 */
+	public void ancestorMoved(IFigure figure) {
+		if (figure instanceof ScalableFigure)
+			return;
+		super.ancestorMoved(figure);
+	}
+
+	public Point getLocation(Point reference) {
+		Rectangle r = getOwner().getBounds();
+		int x, y;
+		if (topDown)
+			y = r.y + offsetV;
+		else
+			y = r.bottom() - 1 - offsetV;
+
+		if (leftToRight)
+			x = r.x + offsetH;
+		else
+			x = r.right() - 1 - offsetH;
+
+		Point p = new PrecisionPoint(x, y);
+		getOwner().translateToAbsolute(p);
+		return p;
+	}
+
+	public Point getReferencePoint() {
+		return getLocation(null);
+	}
+
+	/**
+	 * @param offsetH
+	 *            The offsetH to set.
+	 */
+	public void setOffsetH(int offsetH) {
+		this.offsetH = offsetH;
+		fireAnchorMoved();
+	}
+
+	/**
+	 * @param offsetV
+	 *            The offsetV to set.
+	 */
+	public void setOffsetV(int offsetV) {
+		this.offsetV = offsetV;
+		fireAnchorMoved();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	public boolean equals(Object o) {
+		if (o instanceof FixedConnectionAnchor) {
+			FixedConnectionAnchor fa = (FixedConnectionAnchor) o;
+
+			if (fa.leftToRight == this.leftToRight
+					&& fa.topDown == this.topDown && fa.offsetH == this.offsetH
+					&& fa.offsetV == this.offsetV
+					&& fa.getOwner() == this.getOwner()) {
+				return true;
+			}
+		}
+
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#hashCode()
+	 */
+	public int hashCode() {
+		return ((this.leftToRight ? 31 : 0) + (this.topDown ? 37 : 0)
+				+ this.offsetH * 43 + this.offsetV * 47)
+				^ this.getOwner().hashCode();
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/GateFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/GateFigure.java
new file mode 100644
index 0000000..37f33d3
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/GateFigure.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.gef.examples.logicdesigner.model.Gate;
+
+public class GateFigure extends OutputFigure {
+
+	public GateFigure() {
+		FixedConnectionAnchor inputConnectionAnchorA, inputConnectionAnchorB;
+		inputConnectionAnchorA = new FixedConnectionAnchor(this);
+		inputConnectionAnchorA.offsetH = 4;
+		inputConnectionAnchorB = new FixedConnectionAnchor(this);
+		inputConnectionAnchorB.offsetH = 10;
+		inputConnectionAnchors.addElement(inputConnectionAnchorA);
+		inputConnectionAnchors.addElement(inputConnectionAnchorB);
+		connectionAnchors.put(Gate.TERMINAL_A, inputConnectionAnchorA);
+		connectionAnchors.put(Gate.TERMINAL_B, inputConnectionAnchorB);
+	}
+
+	public String toString() {
+		return "GateFigure"; //$NON-NLS-1$
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/GroundFeedbackFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/GroundFeedbackFigure.java
new file mode 100644
index 0000000..468ec7a
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/GroundFeedbackFigure.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class GroundFeedbackFigure extends GroundFigure {
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics g) {
+		g.setXORMode(true);
+		g.setForegroundColor(ColorConstants.white);
+		g.setBackgroundColor(LogicColorConstants.ghostFillColor);
+		Rectangle r = getBounds().getCopy();
+
+		g.fillOval(r);
+		r.height--;
+		r.width--;
+		g.drawOval(r);
+		g.translate(r.getLocation());
+
+		// Draw the "V"
+		g.drawLine(3, 4, 5, 9);
+		g.drawLine(5, 9, 7, 4);
+		g.drawLine(5, 8, 5, 9);
+
+		// Draw the "0"
+		g.drawOval(7, 8, 3, 3);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/GroundFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/GroundFigure.java
new file mode 100644
index 0000000..8d18006
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/GroundFigure.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * @author danlee
+ */
+public class GroundFigure extends OutputFigure {
+
+	private static final Dimension SIZE = new Dimension(15, 15);
+
+	/**
+	 * Constructor for GroundFigure.
+	 */
+	public GroundFigure() {
+		super();
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#getPreferredSize(int, int)
+	 */
+	public Dimension getPreferredSize(int wHint, int hHint) {
+		return SIZE;
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics g) {
+		Rectangle r = getBounds().getCopy();
+		g.setBackgroundColor(ColorConstants.yellow);
+
+		g.fillOval(r);
+		r.height--;
+		r.width--;
+		g.drawOval(r);
+		g.translate(r.getLocation());
+
+		// Draw the "V"
+		g.drawLine(3, 4, 5, 9);
+		g.drawLine(5, 9, 7, 4);
+
+		// Draw the "0"
+		g.drawOval(7, 8, 3, 3);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LEDFeedbackFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LEDFeedbackFigure.java
new file mode 100644
index 0000000..a73468c
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LEDFeedbackFigure.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class LEDFeedbackFigure extends LEDFigure {
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics g) {
+		g.setXORMode(true);
+		g.setForegroundColor(ColorConstants.white);
+
+		Rectangle r = getBounds().getCopy();
+		g.translate(r.getLocation());
+
+		g.setBackgroundColor(LogicColorConstants.ghostFillColor);
+		g.fillRectangle(0, 2, r.width, r.height - 4);
+
+		int right = r.width - 1;
+		g.drawLine(0, Y1, right, Y1);
+		g.drawLine(0, Y1, 0, Y2);
+		g.drawLine(0, Y2, right, Y2);
+		g.drawLine(right, Y1, right, Y2);
+
+		g.drawPoint(0, Y1);
+		g.drawPoint(right, Y1);
+		g.drawPoint(0, Y2);
+		g.drawPoint(right, Y2);
+
+		// Draw the gaps for the connectors
+		for (int i = 0; i < 4; i++) {
+			g.drawLine(GAP_CENTERS_X[i] - 2, Y1, GAP_CENTERS_X[i] + 3, Y1);
+			g.drawLine(GAP_CENTERS_X[i] - 2, Y2, GAP_CENTERS_X[i] + 3, Y2);
+		}
+
+		// Draw the connectors
+		for (int i = 0; i < 4; i++) {
+			connector.translate(GAP_CENTERS_X[i], 0);
+			g.drawPolygon(connector);
+			connector.translate(-GAP_CENTERS_X[i], 0);
+
+			bottomConnector.translate(GAP_CENTERS_X[i], r.height - 1);
+			g.drawPolygon(bottomConnector);
+			bottomConnector.translate(-GAP_CENTERS_X[i], -r.height + 1);
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LEDFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LEDFigure.java
new file mode 100644
index 0000000..33ced34
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LEDFigure.java
@@ -0,0 +1,224 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.handles.HandleBounds;
+
+import org.eclipse.gef.examples.logicdesigner.model.LED;
+
+/**
+ * @author danlee
+ */
+public class LEDFigure extends NodeFigure implements HandleBounds {
+	protected static final Dimension SIZE = new Dimension(61, 47);
+
+	/**
+	 * Color of the shadow around the LEDFigure's display
+	 */
+	public static final Color DISPLAY_SHADOW = new Color(null, 57, 117, 90);
+
+	/**
+	 * Color of the LEDFigure's displayed value
+	 */
+	public static final Color DISPLAY_TEXT = new Color(null, 255, 199, 16);
+
+	protected static final Font DISPLAY_FONT = new Font(null, "", 19, 0); //$NON-NLS-1$
+	protected static PointList connector = new PointList();
+	protected static PointList bottomConnector = new PointList();
+	protected static Rectangle displayRectangle = new Rectangle(15, 11, 31, 25);
+	protected static Rectangle displayShadow = new Rectangle(14, 10, 32, 26);
+	protected static Rectangle displayHighlight = new Rectangle(15, 11, 32, 26);
+	protected static Point valuePoint = new Point(16, 10);
+
+	static {
+		connector.addPoint(-2, 0);
+		connector.addPoint(1, 0);
+		connector.addPoint(2, 1);
+		connector.addPoint(2, 5);
+		connector.addPoint(-1, 5);
+		connector.addPoint(-1, 1);
+
+		bottomConnector.addPoint(-2, 0);
+		bottomConnector.addPoint(1, 0);
+		bottomConnector.addPoint(2, -1);
+		bottomConnector.addPoint(2, -5);
+		bottomConnector.addPoint(-1, -5);
+		bottomConnector.addPoint(-1, -1);
+	}
+
+	protected static final int[] GAP_CENTERS_X = { 8, 23, 38, 53 };
+	protected static final int Y1 = 2;
+	protected static final int Y2 = 44;
+
+	protected String value;
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#setBounds(Rectangle)
+	 */
+	public void setBounds(Rectangle rect) {
+		super.setBounds(rect);
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#setConstraint(IFigure, Object)
+	 */
+	public void setConstraint(IFigure child, Object constraint) {
+		super.setConstraint(child, constraint);
+	}
+
+	/**
+	 * Creates a new LEDFigure
+	 */
+	public LEDFigure() {
+		FixedConnectionAnchor c;
+		c = new FixedConnectionAnchor(this);
+		c.offsetH = 51;
+		connectionAnchors.put(LED.TERMINAL_1_IN, c);
+		inputConnectionAnchors.addElement(c);
+		c = new FixedConnectionAnchor(this);
+		c.offsetH = 36;
+		connectionAnchors.put(LED.TERMINAL_2_IN, c);
+		inputConnectionAnchors.addElement(c);
+		c = new FixedConnectionAnchor(this);
+		c.offsetH = 21;
+		connectionAnchors.put(LED.TERMINAL_3_IN, c);
+		inputConnectionAnchors.addElement(c);
+		c = new FixedConnectionAnchor(this);
+		c.offsetH = 6;
+		connectionAnchors.put(LED.TERMINAL_4_IN, c);
+		inputConnectionAnchors.addElement(c);
+		c = new FixedConnectionAnchor(this);
+		c.offsetH = 51;
+		c.topDown = false;
+		connectionAnchors.put(LED.TERMINAL_1_OUT, c);
+		outputConnectionAnchors.addElement(c);
+		c = new FixedConnectionAnchor(this);
+		c.offsetH = 36;
+		c.topDown = false;
+		connectionAnchors.put(LED.TERMINAL_2_OUT, c);
+		outputConnectionAnchors.addElement(c);
+		c = new FixedConnectionAnchor(this);
+		c.offsetH = 21;
+		c.topDown = false;
+		connectionAnchors.put(LED.TERMINAL_3_OUT, c);
+		outputConnectionAnchors.addElement(c);
+		c = new FixedConnectionAnchor(this);
+		c.offsetH = 6;
+		c.topDown = false;
+		connectionAnchors.put(LED.TERMINAL_4_OUT, c);
+		outputConnectionAnchors.addElement(c);
+
+	}
+
+	/**
+	 * @see org.eclipse.gef.handles.HandleBounds#getHandleBounds()
+	 */
+	public Rectangle getHandleBounds() {
+		return getBounds().getCropped(new Insets(2, 0, 2, 0));
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#getPreferredSize(int, int)
+	 */
+	public Dimension getPreferredSize(int wHint, int hHint) {
+		return SIZE;
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics g) {
+		Rectangle r = getBounds().getCopy();
+		g.translate(r.getLocation());
+		g.setBackgroundColor(LogicColorConstants.logicGreen);
+		g.setForegroundColor(LogicColorConstants.connectorGreen);
+		g.fillRectangle(0, 2, r.width, r.height - 4);
+		int right = r.width - 1;
+		g.drawLine(0, Y1, right, Y1);
+		g.drawLine(0, Y1, 0, Y2);
+
+		g.setForegroundColor(LogicColorConstants.connectorGreen);
+		g.drawLine(0, Y2, right, Y2);
+		g.drawLine(right, Y1, right, Y2);
+
+		// Draw the gaps for the connectors
+		g.setForegroundColor(ColorConstants.listBackground);
+		for (int i = 0; i < 4; i++) {
+			g.drawLine(GAP_CENTERS_X[i] - 2, Y1, GAP_CENTERS_X[i] + 3, Y1);
+			g.drawLine(GAP_CENTERS_X[i] - 2, Y2, GAP_CENTERS_X[i] + 3, Y2);
+		}
+
+		// Draw the connectors
+		g.setForegroundColor(LogicColorConstants.connectorGreen);
+		g.setBackgroundColor(LogicColorConstants.connectorGreen);
+		for (int i = 0; i < 4; i++) {
+			connector.translate(GAP_CENTERS_X[i], 0);
+			g.fillPolygon(connector);
+			g.drawPolygon(connector);
+			connector.translate(-GAP_CENTERS_X[i], 0);
+
+			bottomConnector.translate(GAP_CENTERS_X[i], r.height - 1);
+			g.fillPolygon(bottomConnector);
+			g.drawPolygon(bottomConnector);
+			bottomConnector.translate(-GAP_CENTERS_X[i], -r.height + 1);
+		}
+
+		// Draw the display
+		g.setBackgroundColor(LogicColorConstants.logicHighlight);
+		g.fillRectangle(displayHighlight);
+		g.setBackgroundColor(DISPLAY_SHADOW);
+		g.fillRectangle(displayShadow);
+		g.setBackgroundColor(ColorConstants.black);
+		g.fillRectangle(displayRectangle);
+
+		// Draw the value
+		g.setFont(DISPLAY_FONT);
+		g.setForegroundColor(DISPLAY_TEXT);
+		g.drawText(value, valuePoint);
+	}
+
+	/**
+	 * Sets the value of the LEDFigure to val.
+	 * 
+	 * @param val
+	 *            The value to set on this LEDFigure
+	 */
+	public void setValue(int val) {
+		String newValue = String.valueOf(val);
+		if (val < 10)
+			newValue = "0" + newValue; //$NON-NLS-1$
+		if (newValue.equals(value))
+			return;
+		value = newValue;
+		repaint();
+	}
+
+	/**
+	 * 
+	 * @see java.lang.Object#toString()
+	 */
+	public String toString() {
+		return "LEDFigure"; //$NON-NLS-1$
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LabelFeedbackFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LabelFeedbackFigure.java
new file mode 100644
index 0000000..72904f1
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LabelFeedbackFigure.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class LabelFeedbackFigure extends BentCornerFigure {
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics graphics) {
+		Rectangle rect = getBounds().getCopy();
+
+		graphics.setXORMode(true);
+		graphics.setForegroundColor(ColorConstants.white);
+		graphics.setBackgroundColor(LogicColorConstants.ghostFillColor);
+
+		graphics.translate(getLocation());
+
+		PointList outline = new PointList();
+
+		outline.addPoint(0, 0);
+		outline.addPoint(rect.width - getCornerSize(), 0);
+		outline.addPoint(rect.width - 1, getCornerSize());
+		outline.addPoint(rect.width - 1, rect.height - 1);
+		outline.addPoint(0, rect.height - 1);
+
+		graphics.fillPolygon(outline);
+
+		// draw the inner outline
+		PointList innerLine = new PointList();
+
+		innerLine.addPoint(rect.width - getCornerSize() - 1, 0);
+		innerLine.addPoint(rect.width - getCornerSize() - 1, getCornerSize());
+		innerLine.addPoint(rect.width - 1, getCornerSize());
+		innerLine.addPoint(rect.width - getCornerSize() - 1, 0);
+		innerLine.addPoint(0, 0);
+		innerLine.addPoint(0, rect.height - 1);
+		innerLine.addPoint(rect.width - 1, rect.height - 1);
+		innerLine.addPoint(rect.width - 1, getCornerSize());
+
+		graphics.drawPolygon(innerLine);
+
+		graphics.drawLine(rect.width - getCornerSize() - 1, 0, rect.width - 1,
+				getCornerSize());
+
+		graphics.translate(getLocation().getNegated());
+	}
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LiveOutputFeedbackFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LiveOutputFeedbackFigure.java
new file mode 100644
index 0000000..ec26bbc
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LiveOutputFeedbackFigure.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class LiveOutputFeedbackFigure extends LiveOutputFigure {
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics g) {
+		g.setXORMode(true);
+		g.setForegroundColor(ColorConstants.white);
+
+		g.setBackgroundColor(LogicColorConstants.ghostFillColor);
+
+		Rectangle r = getBounds().getCopy();
+
+		g.fillOval(r);
+		r.height--;
+		r.width--;
+		g.drawOval(r);
+		g.translate(r.getLocation());
+
+		// Draw the "V"
+		g.drawLine(3, 4, 5, 9);
+		g.drawLine(5, 9, 7, 4);
+		g.drawLine(5, 8, 5, 9);
+
+		// Draw the "+"
+		g.drawLine(9, 7, 9, 11);
+		g.drawLine(7, 9, 11, 9);
+		g.drawPoint(9, 9);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LiveOutputFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LiveOutputFigure.java
new file mode 100644
index 0000000..b5b80fb
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LiveOutputFigure.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * @author danlee
+ */
+public class LiveOutputFigure extends OutputFigure {
+	private static final Dimension SIZE = new Dimension(15, 15);
+
+	/**
+	 * Constructor for LiveOutputFigure.
+	 */
+	public LiveOutputFigure() {
+		super();
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#getPreferredSize(int, int)
+	 */
+	public Dimension getPreferredSize(int wHint, int hHint) {
+		return SIZE;
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics g) {
+		Rectangle r = getBounds().getCopy();
+		g.setBackgroundColor(ColorConstants.yellow);
+
+		g.fillOval(r);
+		r.height--;
+		r.width--;
+		g.drawOval(r);
+		g.translate(r.getLocation());
+
+		// Draw the "V"
+		g.drawLine(3, 4, 5, 9);
+		g.drawLine(5, 9, 7, 4);
+
+		// Draw the "+"
+		g.drawLine(9, 7, 9, 11);
+		g.drawLine(7, 9, 11, 9);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LogicColorConstants.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LogicColorConstants.java
new file mode 100644
index 0000000..02a172c
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LogicColorConstants.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.swt.graphics.Color;
+
+public interface LogicColorConstants {
+
+	public final static Color andGate = new Color(null, 220, 70, 80);
+	public final static Color orGate = new Color(null, 0, 134, 255);
+	public final static Color xorGate = new Color(null, 240, 240, 40);
+	public final static Color logicGreen = new Color(null, 123, 174, 148);
+	public final static Color logicHighlight = new Color(null, 66, 166, 115);
+	public final static Color connectorGreen = new Color(null, 0, 69, 40);
+	public final static Color logicBackgroundBlue = new Color(null, 200, 200,
+			240);
+	public final static Color ghostFillColor = new Color(null, 31, 31, 31);
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LogicFlowBorder.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LogicFlowBorder.java
new file mode 100644
index 0000000..a7fccf6
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LogicFlowBorder.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class LogicFlowBorder extends org.eclipse.draw2d.LineBorder {
+
+	protected int grabBarWidth = 20;
+	protected Dimension grabBarSize = new Dimension(grabBarWidth, 18);
+
+	public LogicFlowBorder() {
+	}
+
+	public LogicFlowBorder(int width) {
+		setGrabBarWidth(width);
+		grabBarSize = new Dimension(width, 18);
+	}
+
+	public Insets getInsets(IFigure figure) {
+		return new Insets(getWidth() + 2, grabBarWidth + 2, getWidth() + 2,
+				getWidth() + 2);
+	}
+
+	public Dimension getPreferredSize() {
+		return grabBarSize;
+	}
+
+	public void paint(IFigure figure, Graphics graphics, Insets insets) {
+		Rectangle bounds = figure.getBounds();
+		tempRect.setBounds(new Rectangle(bounds.x, bounds.y, grabBarWidth,
+				bounds.height));
+		graphics.setBackgroundColor(LogicColorConstants.logicGreen);
+		graphics.fillRectangle(tempRect);
+		super.paint(figure, graphics, insets);
+	}
+
+	public void setGrabBarWidth(int width) {
+		grabBarWidth = width;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LogicFlowFeedbackBorder.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LogicFlowFeedbackBorder.java
new file mode 100644
index 0000000..b81ae95
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LogicFlowFeedbackBorder.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class LogicFlowFeedbackBorder extends LogicFlowBorder {
+
+	public LogicFlowFeedbackBorder() {
+	}
+
+	public LogicFlowFeedbackBorder(int width) {
+		super(width);
+	}
+
+	public void paint(IFigure figure, Graphics graphics, Insets insets) {
+		graphics.setForegroundColor(ColorConstants.white);
+		graphics.setBackgroundColor(LogicColorConstants.ghostFillColor);
+		graphics.setXORMode(true);
+
+		Rectangle r = figure.getBounds();
+
+		graphics.drawRectangle(r.x, r.y, r.width - 1, r.height - 1);
+		// graphics.drawLine(r.x, r.y + 1, r.right() - 1, r.y + 1);
+		// graphics.drawLine(r.x, r.bottom() - 1, r.right() - 1, r.bottom() -
+		// 1);
+		// graphics.drawLine(r.x, r.y + 1, r.x, r.bottom() - 1);
+		// graphics.drawLine(r.right() - 1, r.bottom() - 1, r.right() - 1, r.y +
+		// 1);
+
+		tempRect.setBounds(new Rectangle(r.x, r.y, grabBarWidth, r.height));
+
+		graphics.fillRectangle(tempRect);
+	}
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LogicFlowFeedbackFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LogicFlowFeedbackFigure.java
new file mode 100644
index 0000000..85113bd
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/LogicFlowFeedbackFigure.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.RectangleFigure;
+
+public class LogicFlowFeedbackFigure extends RectangleFigure {
+
+	public LogicFlowFeedbackFigure() {
+		this.setFill(false);
+		this.setXOR(true);
+		setBorder(new LogicFlowFeedbackBorder());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/NodeFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/NodeFigure.java
new file mode 100644
index 0000000..7ff108b
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/NodeFigure.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.geometry.Point;
+
+public class NodeFigure extends Figure {
+
+	protected Hashtable connectionAnchors = new Hashtable(7);
+	protected Vector inputConnectionAnchors = new Vector(2, 2);
+	protected Vector outputConnectionAnchors = new Vector(2, 2);
+
+	public ConnectionAnchor connectionAnchorAt(Point p) {
+		ConnectionAnchor closest = null;
+		long min = Long.MAX_VALUE;
+
+		Enumeration e = getSourceConnectionAnchors().elements();
+		while (e.hasMoreElements()) {
+			ConnectionAnchor c = (ConnectionAnchor) e.nextElement();
+			Point p2 = c.getLocation(null);
+			long d = p.getDistance2(p2);
+			if (d < min) {
+				min = d;
+				closest = c;
+			}
+		}
+		e = getTargetConnectionAnchors().elements();
+		while (e.hasMoreElements()) {
+			ConnectionAnchor c = (ConnectionAnchor) e.nextElement();
+			Point p2 = c.getLocation(null);
+			long d = p.getDistance2(p2);
+			if (d < min) {
+				min = d;
+				closest = c;
+			}
+		}
+		return closest;
+	}
+
+	public ConnectionAnchor getConnectionAnchor(String terminal) {
+		return (ConnectionAnchor) connectionAnchors.get(terminal);
+	}
+
+	public String getConnectionAnchorName(ConnectionAnchor c) {
+		Enumeration keys = connectionAnchors.keys();
+		String key;
+		while (keys.hasMoreElements()) {
+			key = (String) keys.nextElement();
+			if (connectionAnchors.get(key).equals(c))
+				return key;
+		}
+		return null;
+	}
+
+	public ConnectionAnchor getSourceConnectionAnchorAt(Point p) {
+		ConnectionAnchor closest = null;
+		long min = Long.MAX_VALUE;
+
+		Enumeration e = getSourceConnectionAnchors().elements();
+		while (e.hasMoreElements()) {
+			ConnectionAnchor c = (ConnectionAnchor) e.nextElement();
+			Point p2 = c.getLocation(null);
+			long d = p.getDistance2(p2);
+			if (d < min) {
+				min = d;
+				closest = c;
+			}
+		}
+		return closest;
+	}
+
+	public Vector getSourceConnectionAnchors() {
+		return outputConnectionAnchors;
+	}
+
+	public ConnectionAnchor getTargetConnectionAnchorAt(Point p) {
+		ConnectionAnchor closest = null;
+		long min = Long.MAX_VALUE;
+
+		Enumeration e = getTargetConnectionAnchors().elements();
+		while (e.hasMoreElements()) {
+			ConnectionAnchor c = (ConnectionAnchor) e.nextElement();
+			Point p2 = c.getLocation(null);
+			long d = p.getDistance2(p2);
+			if (d < min) {
+				min = d;
+				closest = c;
+			}
+		}
+		return closest;
+	}
+
+	public Vector getTargetConnectionAnchors() {
+		return inputConnectionAnchors;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/OrGateFeedbackFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/OrGateFeedbackFigure.java
new file mode 100644
index 0000000..c3ceaed
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/OrGateFeedbackFigure.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class OrGateFeedbackFigure extends OrGateFigure {
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics g) {
+		g.setXORMode(true);
+		g.setForegroundColor(ColorConstants.white);
+		g.setBackgroundColor(LogicColorConstants.ghostFillColor);
+
+		Rectangle r = getBounds().getCopy();
+		r.translate(2, 2);
+		r.setSize(11, 9);
+
+		// Draw terminals, 2 at top
+		g.drawLine(r.x + 2, r.y + 2, r.x + 2, r.y - 2);
+		g.drawLine(r.right() - 3, r.y + 2, r.right() - 3, r.y - 2);
+
+		// fix it
+		g.drawPoint(r.x + 2, r.y + 2);
+		g.drawPoint(r.right() - 3, r.y + 2);
+
+		// Draw the bottom arc of the gate
+		r.y += 4;
+
+		g.fillArc(r, 180, 180);
+		r.width--;
+		r.height--;
+		g.drawPoint(r.x, r.y + 4);
+
+		g.drawArc(r, 180, 180);
+		g.drawLine(r.x + r.width / 2, r.bottom(), r.x + r.width / 2,
+				r.bottom() + 2);
+		g.drawPoint(r.x + r.width / 2, r.bottom());
+
+		// draw gate
+		g.translate(getLocation());
+		g.drawPolyline(GATE_OUTLINE);
+		g.fillPolygon(GATE_OUTLINE);
+		g.translate(getLocation().getNegated());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/OrGateFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/OrGateFigure.java
new file mode 100644
index 0000000..c1df31c
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/OrGateFigure.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * @author danlee
+ */
+public class OrGateFigure extends GateFigure {
+	protected static final Dimension SIZE = new Dimension(15, 17);
+	protected static final PointList GATE_OUTLINE = new PointList();
+
+	static {
+		GATE_OUTLINE.addPoint(2, 10);
+		GATE_OUTLINE.addPoint(2, 2);
+		GATE_OUTLINE.addPoint(4, 4);
+		GATE_OUTLINE.addPoint(6, 5);
+		GATE_OUTLINE.addPoint(7, 5);
+		GATE_OUTLINE.addPoint(8, 5);
+		GATE_OUTLINE.addPoint(10, 4);
+		GATE_OUTLINE.addPoint(12, 2);
+		GATE_OUTLINE.addPoint(12, 10);
+	}
+
+	/**
+	 * Creates a new OrGateFigure
+	 */
+	public OrGateFigure() {
+		setBackgroundColor(LogicColorConstants.orGate);
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#getPreferredSize(int, int)
+	 */
+	public Dimension getPreferredSize(int wHint, int hHint) {
+		return SIZE;
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics g) {
+		Rectangle r = getBounds().getCopy();
+		r.translate(2, 2);
+		r.setSize(11, 9);
+
+		// Draw terminals, 2 at top
+		g.drawLine(r.x + 2, r.y + 2, r.x + 2, r.y - 2);
+		g.drawLine(r.right() - 3, r.y + 2, r.right() - 3, r.y - 2);
+
+		// Draw the bottom arc of the gate
+		r.y += 4;
+		g.fillOval(r);
+		r.width--;
+		r.height--;
+		g.drawOval(r);
+		g.drawLine(r.x + r.width / 2, r.bottom(), r.x + r.width / 2,
+				r.bottom() + 2);
+
+		// draw gate
+		g.translate(getLocation());
+		g.fillPolygon(GATE_OUTLINE);
+		g.drawPolyline(GATE_OUTLINE);
+		g.translate(getLocation().getNegated());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/OutputFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/OutputFigure.java
new file mode 100644
index 0000000..1e6b438
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/OutputFigure.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.StackLayout;
+
+import org.eclipse.gef.examples.logicdesigner.model.SimpleOutput;
+
+public class OutputFigure extends NodeFigure {
+
+	public OutputFigure() {
+		FixedConnectionAnchor outputConnectionAnchor = new FixedConnectionAnchor(
+				this);
+		outputConnectionAnchor.topDown = false;
+		outputConnectionAnchor.offsetH = 7;
+		outputConnectionAnchors.addElement(outputConnectionAnchor);
+		connectionAnchors
+				.put(SimpleOutput.TERMINAL_OUT, outputConnectionAnchor);
+		setLayoutManager(new StackLayout());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/StickyNoteFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/StickyNoteFigure.java
new file mode 100644
index 0000000..3b87756
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/StickyNoteFigure.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.text.FlowPage;
+import org.eclipse.draw2d.text.ParagraphTextLayout;
+import org.eclipse.draw2d.text.TextFlow;
+
+/**
+ * A Figure with a bent corner and an embedded TextFlow within a FlowPage that
+ * contains text.
+ */
+public class StickyNoteFigure extends BentCornerFigure {
+
+	/** The inner TextFlow **/
+	private TextFlow textFlow;
+
+	/**
+	 * Creates a new StickyNoteFigure with a default MarginBorder size of
+	 * DEFAULT_CORNER_SIZE - 3 and a FlowPage containing a TextFlow with the
+	 * style WORD_WRAP_SOFT.
+	 */
+	public StickyNoteFigure() {
+		this(BentCornerFigure.DEFAULT_CORNER_SIZE - 3);
+	}
+
+	/**
+	 * Creates a new StickyNoteFigure with a MarginBorder that is the given size
+	 * and a FlowPage containing a TextFlow with the style WORD_WRAP_SOFT.
+	 * 
+	 * @param borderSize
+	 *            the size of the MarginBorder
+	 */
+	public StickyNoteFigure(int borderSize) {
+		setBorder(new MarginBorder(borderSize));
+		FlowPage flowPage = new FlowPage();
+
+		textFlow = new TextFlow();
+
+		textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
+				ParagraphTextLayout.WORD_WRAP_SOFT));
+
+		flowPage.add(textFlow);
+
+		setLayoutManager(new StackLayout());
+		add(flowPage);
+	}
+
+	/**
+	 * Returns the text inside the TextFlow.
+	 * 
+	 * @return the text flow inside the text.
+	 */
+	public String getText() {
+		return textFlow.getText();
+	}
+
+	/**
+	 * Sets the text of the TextFlow to the given value.
+	 * 
+	 * @param newText
+	 *            the new text value.
+	 */
+	public void setText(String newText) {
+		textFlow.setText(newText);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/XOrGateFeedbackFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/XOrGateFeedbackFigure.java
new file mode 100644
index 0000000..1fc2539
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/XOrGateFeedbackFigure.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class XOrGateFeedbackFigure extends XOrGateFigure {
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics g) {
+		g.setXORMode(true);
+		g.setForegroundColor(ColorConstants.white);
+		g.setBackgroundColor(LogicColorConstants.ghostFillColor);
+		Rectangle r = getBounds().getCopy();
+		r.translate(2, 2);
+		r.setSize(11, 9);
+
+		// Draw terminals, 2 at top
+		g.drawLine(r.x + 2, r.y + 2, r.x + 2, r.y - 2);
+		g.drawLine(r.right() - 3, r.y + 2, r.right() - 3, r.y - 2);
+
+		// fix it
+		g.drawPoint(r.x + 2, r.y + 2);
+		g.drawPoint(r.right() - 3, r.y + 2);
+
+		// Draw an oval that represents the bottom arc
+		r.y += 4;
+
+		/*
+		 * Draw the bottom gate arc. This is done with an oval. The oval
+		 * overlaps the top arc of the gate, so this region is clipped.
+		 */
+		g.pushState();
+		r.y++;
+		g.clipRect(r);
+		r.y--;
+
+		g.fillArc(r, 180, 180);
+		r.width--;
+		r.height--;
+		g.drawArc(r, 180, 180);
+		g.drawPoint(r.x, r.y + 4);
+		g.popState();
+		g.drawLine(r.x + r.width / 2, r.bottom(), r.x + r.width / 2,
+				r.bottom() + 2);
+		g.drawPoint(r.x + r.width / 2, r.bottom());
+
+		// Draw the gate outline and top curve
+		g.translate(getLocation());
+		g.drawPolyline(GATE_TOP);
+		g.fillPolygon(GATE_OUTLINE);
+		g.drawPolyline(GATE_OUTLINE);
+		g.translate(getLocation().negate());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/XOrGateFigure.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/XOrGateFigure.java
new file mode 100644
index 0000000..1841310
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/XOrGateFigure.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * @author danlee
+ */
+public class XOrGateFigure extends GateFigure {
+
+	protected static final Dimension SIZE = new Dimension(15, 17);
+	protected static final PointList GATE_OUTLINE = new PointList();
+	protected static final PointList GATE_TOP = new PointList();
+
+	static {
+		// setup gate outline
+		GATE_OUTLINE.addPoint(2, 10);
+		GATE_OUTLINE.addPoint(2, 4);
+		GATE_OUTLINE.addPoint(4, 6);
+		GATE_OUTLINE.addPoint(6, 7);
+		GATE_OUTLINE.addPoint(7, 7);
+		GATE_OUTLINE.addPoint(8, 7);
+		GATE_OUTLINE.addPoint(10, 6);
+		GATE_OUTLINE.addPoint(12, 4);
+		GATE_OUTLINE.addPoint(12, 10);
+
+		// setup top curve of gate
+		GATE_TOP.addPoint(2, 2);
+		GATE_TOP.addPoint(4, 4);
+		GATE_TOP.addPoint(6, 5);
+		GATE_TOP.addPoint(7, 5);
+		GATE_TOP.addPoint(8, 5);
+		GATE_TOP.addPoint(10, 4);
+		GATE_TOP.addPoint(12, 2);
+	}
+
+	/**
+	 * Constructor for XOrGateFigure.
+	 */
+	public XOrGateFigure() {
+		setBackgroundColor(LogicColorConstants.xorGate);
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#getPreferredSize(int, int)
+	 */
+	public Dimension getPreferredSize(int wHint, int hHint) {
+		return SIZE;
+	}
+
+	/**
+	 * @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
+	 */
+	protected void paintFigure(Graphics g) {
+		Rectangle r = getBounds().getCopy();
+		r.translate(2, 2);
+		r.setSize(11, 9);
+
+		// Draw terminals, 2 at top
+		g.drawLine(r.x + 2, r.y + 2, r.x + 2, r.y - 2);
+		g.drawLine(r.right() - 3, r.y + 2, r.right() - 3, r.y - 2);
+
+		// Draw an oval that represents the bottom arc
+		r.y += 4;
+
+		/*
+		 * Draw the bottom gate arc. This is done with an oval. The oval
+		 * overlaps the top arc of the gate, so this region is clipped.
+		 */
+		g.pushState();
+		r.y++;
+		g.clipRect(r);
+		r.y--;
+		g.fillOval(r);
+		r.width--;
+		r.height--;
+		g.drawOval(r);
+		g.popState();
+		g.drawLine(r.x + r.width / 2, r.bottom(), r.x + r.width / 2,
+				r.bottom() + 2);
+
+		// Draw the gate outline and top curve
+		g.translate(getLocation());
+		g.drawPolyline(GATE_TOP);
+		g.fillPolygon(GATE_OUTLINE);
+		g.drawPolyline(GATE_OUTLINE);
+		g.translate(getLocation().negate());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/downtab.bmp b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/downtab.bmp
new file mode 100644
index 0000000..1fd69f4
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/downtab.bmp
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led0.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led0.gif
new file mode 100644
index 0000000..ac189ed
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led0.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led1.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led1.gif
new file mode 100644
index 0000000..33372df
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led1.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led2.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led2.gif
new file mode 100644
index 0000000..236891c
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led2.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led3.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led3.gif
new file mode 100644
index 0000000..77249dd
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led3.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led4.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led4.gif
new file mode 100644
index 0000000..4bf20d6
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led4.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led5.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led5.gif
new file mode 100644
index 0000000..c61a483
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led5.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led6.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led6.gif
new file mode 100644
index 0000000..9af45a0
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led6.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led7.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led7.gif
new file mode 100644
index 0000000..d90f829
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led7.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led8.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led8.gif
new file mode 100644
index 0000000..067b6b8
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led8.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led9.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led9.gif
new file mode 100644
index 0000000..b2e6377
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/led9.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/ledbg.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/ledbg.gif
new file mode 100644
index 0000000..ecae5bf
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/ledbg.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/ledbgprim.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/ledbgprim.gif
new file mode 100644
index 0000000..1c29476
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/ledbgprim.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/ledbgsel.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/ledbgsel.gif
new file mode 100644
index 0000000..6c98cef
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/ledbgsel.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/starledbg.bmp b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/starledbg.bmp
new file mode 100644
index 0000000..dba316e
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/starledbg.bmp
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/uptab.bmp b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/uptab.bmp
new file mode 100644
index 0000000..fdfe849
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/figures/icons/uptab.bmp
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/logic.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/logic.gif
new file mode 100644
index 0000000..ca05b78
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/logic.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/logicbanner.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/logicbanner.gif
new file mode 100644
index 0000000..6a4deba
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/logicbanner.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/minus.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/minus.gif
new file mode 100644
index 0000000..2d44f41
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/minus.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/outline.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/outline.gif
new file mode 100644
index 0000000..852dc81
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/outline.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/overview.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/overview.gif
new file mode 100644
index 0000000..f302d8c
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/overview.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/plus.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/plus.gif
new file mode 100644
index 0000000..6e00852
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/icons/plus.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/messages.properties b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/messages.properties
new file mode 100644
index 0000000..dc409f8
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/messages.properties
@@ -0,0 +1,105 @@
+###############################################################################
+# Copyright (c) 2005, 2009 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+
+AddCommand_Label=Add command
+AlignmentAction_AlignSubmenu_ActionLabelText=&Align
+AndGate_LabelText=And Gate
+CellEditorValidator_NotANumberMessage=Not a number
+Circuit_LabelText=Circuit
+CloneCommand_Label=Clone Object
+ConnectionCommand_Description=Connection change
+ConnectionCommand_Label=wire connection
+CreateCommand_Label=Create Object
+CreateGuideCommand_Label=Create Guide
+CreateLogicPage1_Description=Create a new Logic file resource.
+CreateLogicPage1_ModelNames_EmptyModelName=E&mpty Model
+CreateLogicPage1_ModelNames_FourBitAdderModelName=F&our-bit Adder Model
+CreateLogicPage1_ModelNames_GroupName=Logic Model Samples
+CreateLogicPage1_Title=Create Logic File
+DeleteCommand_Label=Delete Object
+DeleteGuideCommand_Label=Delete Guide
+DimensionPropertySource_Property_Height_Label=Height
+DimensionPropertySource_Property_Width_Label=Width
+GraphicalEditor_CLOSE_BUTTON_UI = Close
+GraphicalEditor_FILE_DELETED_TITLE_UI = File Deleted
+GraphicalEditor_FILE_DELETED_WITHOUT_SAVE_INFO= The file has been deleted from the file system.  Do you want to save your changes or close the editor without saving?
+GraphicalEditor_SAVE_BUTTON_UI = Save
+GroundOutput_LabelText=Ground
+IncrementDecrementAction_Decrement_ActionLabelText=Decrement
+IncrementDecrementAction_Decrement_ActionToolTipText=Decrement LED
+IncrementDecrementAction_Increment_ActionLabelText=Increment
+IncrementDecrementAction_Increment_ActionToolTipText=Increment LED
+IncrementDecrementCommand_LabelText=Logic Value Change
+LED_LabelText=LED
+LiveOutput_LabelText=Positive Voltage
+LocationPropertySource_Property_X_Label=X
+LocationPropertySource_Property_Y_Label=Y
+LogicContainerEditPolicy_OrphanCommandLabelText=Orphan children
+LogicDiagram_LabelText=Logic Diagram
+LogicElementEditPolicy_OrphanCommandLabelText=Reparenting LogicSubpart
+LogicPlugin_Category_ComplexParts_Label=Canned Parts
+LogicPlugin_Category_Components_Label=Components
+LogicPlugin_Category_ControlGroup_Label=Control Group
+LogicPlugin_Tool_ConnectionCreationTool_ConnectionCreationTool_Description=Connection tool can be used to connect the various circuit parts.
+LogicPlugin_Tool_ConnectionCreationTool_ConnectionCreationTool_Label=Connection
+LogicPlugin_Tool_CreationTool_ANDGate_Description=Creates a gate that can perform the logical AND operation
+LogicPlugin_Tool_CreationTool_ANDGate_Label=And Gate
+LogicPlugin_Tool_CreationTool_Circuit_Description=Create a circuit.  It can be connected to external circuits/parts, and can have an intricate design as well.
+LogicPlugin_Tool_CreationTool_Circuit_Label=Circuit
+LogicPlugin_Tool_CreationTool_FlowContainer_Description=Creates a container that can hold other circuit components
+LogicPlugin_Tool_CreationTool_FlowContainer_Label=Flow Container
+LogicPlugin_Tool_CreationTool_FullAdder_Description=Creates a circuit representing a full-adder (uses two half-adders)
+LogicPlugin_Tool_CreationTool_FullAdder_Label=FullAdder
+LogicPlugin_Tool_CreationTool_Ground_Description=Creates a ground node, which is an electrical equivalent of logical 'false'
+LogicPlugin_Tool_CreationTool_Ground_Label=Ground
+LogicPlugin_Tool_CreationTool_HalfAdder_Description=Creates a circuit representing a half-adder
+LogicPlugin_Tool_CreationTool_HalfAdder_Label=HalfAdder
+LogicPlugin_Tool_CreationTool_Label_Label=Label
+LogicPlugin_Tool_CreationTool_Label_Description=Creates labels (they support renaming, resizing, dragging, cut and paste, etc.)
+LogicPlugin_Tool_CreationTool_LED_Description=Creates an LED which is used to read voltage input/output
+LogicPlugin_Tool_CreationTool_LED_Label=LED
+LogicPlugin_Tool_CreationTool_LiveGroundStack_Description=A stack containing the live output and ground parts
+LogicPlugin_Tool_CreationTool_LiveGroundStack_Label=Live & Ground Stack
+LogicPlugin_Tool_CreationTool_LiveOutput_Description=Creates a voltage positive node, which is an electrical equivalent of logical 'true'
+LogicPlugin_Tool_CreationTool_LiveOutput_Label=V+
+LogicPlugin_Tool_CreationTool_LogicLabel=Label
+LogicPlugin_Tool_CreationTool_ORGate_Description=Create a gate that performs the logical OR operation
+LogicPlugin_Tool_CreationTool_ORGate_Label=Or Gate
+LogicPlugin_Tool_CreationTool_XORGate_Description=Creates a gate that can perform the logical XOR operation
+LogicPlugin_Tool_CreationTool_XORGate_Label=XOR Gate
+LogicXYLayoutEditPolicy_AddCommandLabelText=Reparenting LogicSubpart
+LogicXYLayoutEditPolicy_CreateCommandLabelText=Creating LogicSubpart
+Marquee_Stack=Marquee Tools
+MoveGuideCommand_Label=Move Guide
+OrGate_LabelText=Or Gate
+OrphanChildCommand_Label=Orphan LogicSubpart
+PasteAction_ActionLabelText=&Paste
+PrintDialog_Height=Fit Height
+PrintDialog_Page=Fit Page
+PrintDialog_Tile=Tile
+PrintDialog_Title=Select Print Mode
+PrintDialog_Width=Fit Width
+PropertyDescriptor_Label_Text=Text
+PropertyDescriptor_LED_Value=Value
+PropertyDescriptor_LogicDiagram_ConnectionRouter=Connection Router
+PropertyDescriptor_LogicDiagram_Manual=Manual
+PropertyDescriptor_LogicDiagram_Manhattan=Manhattan
+PropertyDescriptor_LogicDiagram_ShortestPath=Shortest Path
+PropertyDescriptor_LogicSubPart_Location=Location
+PropertyDescriptor_LogicSubPart_Size=Size
+ReorderPartCommand_Label=Reorder Subpart
+SetLocationCommand_Label_Location=Move Object
+SetLocationCommand_Label_Resize=Resize Object
+ViewMenu_LabelText=&View
+Wire_LabelText=Wire
+XORGate_LabelText=XOR Gate
+LogicEditor_outline_show_outline=Show Outline
+LogicEditor_outline_show_overview=Show Overview
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/AndGate.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/AndGate.java
new file mode 100644
index 0000000..babaf00
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/AndGate.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.swt.graphics.Image;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+public class AndGate extends Gate {
+
+	private static Image AND_ICON = createImage(AndGate.class,
+			"icons/and16.gif"); //$NON-NLS-1$
+	static final long serialVersionUID = 1;
+
+	public Image getIconImage() {
+		return AND_ICON;
+	}
+
+	public boolean getResult() {
+		return getInput(TERMINAL_A) & getInput(TERMINAL_B);
+	}
+
+	public String toString() {
+		return LogicMessages.AndGate_LabelText + " #" + getID(); //$NON-NLS-1$
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/Circuit.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/Circuit.java
new file mode 100644
index 0000000..fac4f22
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/Circuit.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+public class Circuit extends LogicDiagram {
+
+	static final long serialVersionUID = 1;
+
+	private static int count;
+	public static String TERMINALS_OUT[] = new String[] { "1", "2", "3", "4", //$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+			"5", "6", "7", "8" };//$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+
+	public static String TERMINALS_IN[] = new String[] { "A", "B", "C", "D", //$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+			"E", "F", "G", "H" };//$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+
+	public String getNewID() {
+		return Integer.toString(count++);
+	}
+
+	public String toString() {
+		return LogicMessages.Circuit_LabelText + " #" + getID(); //$NON-NLS-1$
+	}
+
+	public void update() {
+		for (int i = 0; i < 8; i++)
+			setOutput(TERMINALS_OUT[i], getInput(TERMINALS_IN[i]));
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/DimensionPropertySource.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/DimensionPropertySource.java
new file mode 100644
index 0000000..b36201d
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/DimensionPropertySource.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
+
+import org.eclipse.draw2d.geometry.Dimension;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+public class DimensionPropertySource implements IPropertySource {
+
+	public static String ID_WIDTH = "width"; //$NON-NLS-1$
+	public static String ID_HEIGHT = "height";//$NON-NLS-1$
+	protected static IPropertyDescriptor[] descriptors;
+
+	static {
+		PropertyDescriptor widthProp = new TextPropertyDescriptor(ID_WIDTH,
+				LogicMessages.DimensionPropertySource_Property_Width_Label);
+		widthProp.setValidator(LogicNumberCellEditorValidator.instance());
+		PropertyDescriptor heightProp = new TextPropertyDescriptor(ID_HEIGHT,
+				LogicMessages.DimensionPropertySource_Property_Height_Label);
+		heightProp.setValidator(LogicNumberCellEditorValidator.instance());
+		descriptors = new IPropertyDescriptor[] { widthProp, heightProp };
+	}
+
+	protected Dimension dimension = null;
+
+	public DimensionPropertySource(Dimension dimension) {
+		this.dimension = dimension.getCopy();
+	}
+
+	public Object getEditableValue() {
+		return dimension.getCopy();
+	}
+
+	public Object getPropertyValue(Object propName) {
+		return getPropertyValue((String) propName);
+	}
+
+	public Object getPropertyValue(String propName) {
+		if (ID_HEIGHT.equals(propName)) {
+			return new String(new Integer(dimension.height).toString());
+		}
+		if (ID_WIDTH.equals(propName)) {
+			return new String(new Integer(dimension.width).toString());
+		}
+		return null;
+	}
+
+	public void setPropertyValue(Object propName, Object value) {
+		setPropertyValue((String) propName, value);
+	}
+
+	public void setPropertyValue(String propName, Object value) {
+		if (ID_HEIGHT.equals(propName)) {
+			Integer newInt = new Integer((String) value);
+			dimension.height = newInt.intValue();
+		}
+		if (ID_WIDTH.equals(propName)) {
+			Integer newInt = new Integer((String) value);
+			dimension.width = newInt.intValue();
+		}
+	}
+
+	public IPropertyDescriptor[] getPropertyDescriptors() {
+		return descriptors;
+	}
+
+	public void resetPropertyValue(String propName) {
+	}
+
+	public void resetPropertyValue(Object propName) {
+	}
+
+	public boolean isPropertySet(Object propName) {
+		return true;
+	}
+
+	public boolean isPropertySet(String propName) {
+		if (ID_HEIGHT.equals(propName) || ID_WIDTH.equals(propName))
+			return true;
+		return false;
+	}
+
+	public String toString() {
+		return new String("(" + dimension.width + "," + dimension.height + ")");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/Gate.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/Gate.java
new file mode 100644
index 0000000..2131e72
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/Gate.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+abstract public class Gate extends SimpleOutput {
+
+	static final long serialVersionUID = 1;
+	public static String TERMINAL_A = "A", //$NON-NLS-1$
+			TERMINAL_B = "B"; //$NON-NLS-1$
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/GroundOutput.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/GroundOutput.java
new file mode 100644
index 0000000..9d95f9f
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/GroundOutput.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.swt.graphics.Image;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+public class GroundOutput extends SimpleOutput {
+
+	private static Image GROUND_ICON = createImage(GroundOutput.class,
+			"icons/ground16.gif"); //$NON-NLS-1$
+	static final long serialVersionUID = 1;
+
+	public Image getIconImage() {
+		return GROUND_ICON;
+	}
+
+	public boolean getResult() {
+		return false;
+	}
+
+	public String toString() {
+		return LogicMessages.GroundOutput_LabelText;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LED.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LED.java
new file mode 100644
index 0000000..6e59937
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LED.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.swt.graphics.Image;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
+
+import org.eclipse.draw2d.geometry.Dimension;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+public class LED extends LogicSubpart {
+
+	static final long serialVersionUID = 1;
+
+	private static Image LED_ICON = createImage(LED.class,
+			"icons/ledicon16.gif"); //$NON-NLS-1$
+	private static int count;
+	public static String P_VALUE = "value"; //$NON-NLS-1$
+	protected static IPropertyDescriptor[] newDescriptors = null;
+	protected static final Dimension defaultSize = new Dimension(61, 47);
+
+	// Inputs
+	public static String TERMINAL_1_IN = "A", //$NON-NLS-1$
+			TERMINAL_2_IN = "B", //$NON-NLS-1$
+			TERMINAL_3_IN = "C", //$NON-NLS-1$
+			TERMINAL_4_IN = "D"; //$NON-NLS-1$
+			// Outputs
+	public static String TERMINAL_1_OUT = "1", //$NON-NLS-1$
+			TERMINAL_2_OUT = "2", //$NON-NLS-1$
+			TERMINAL_3_OUT = "3", //$NON-NLS-1$
+			TERMINAL_4_OUT = "4"; //$NON-NLS-1$
+
+	protected boolean bits[] = new boolean[4];
+
+	static {
+		PropertyDescriptor pValueProp = new TextPropertyDescriptor(P_VALUE,
+				LogicMessages.PropertyDescriptor_LED_Value);
+		pValueProp.setValidator(LogicNumberCellEditorValidator.instance());
+		if (descriptors != null) {
+			newDescriptors = new IPropertyDescriptor[descriptors.length + 1];
+			for (int i = 0; i < descriptors.length; i++)
+				newDescriptors[i] = descriptors[i];
+			newDescriptors[descriptors.length] = pValueProp;
+		} else
+			newDescriptors = new IPropertyDescriptor[] { pValueProp };
+	}
+
+	public LED() {
+		size.width = defaultSize.width;
+		size.height = defaultSize.height;
+		location.x = 20;
+		location.y = 20;
+	}
+
+	public Image getIconImage() {
+		return LED_ICON;
+	}
+
+	public String getNewID() {
+		return Integer.toString(count++);
+	}
+
+	public IPropertyDescriptor[] getPropertyDescriptors() {
+		return newDescriptors;
+	}
+
+	public Object getPropertyValue(Object propName) {
+		if (P_VALUE.equals(propName))
+			return new Integer(getValue()).toString();
+		if (ID_SIZE.equals(propName)) {
+			return new String(
+					"(" + getSize().width + "," + getSize().height + ")");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+		}
+		return super.getPropertyValue(propName);
+	}
+
+	public void resetPropertyValue(Object id) {
+		if (P_VALUE.equals(id))
+			setValue(0);
+		super.resetPropertyValue(id);
+	}
+
+	public int getValue() {
+		int val = 0;
+		if (bits[0])
+			val += 1;
+		if (bits[1])
+			val += 2;
+		if (bits[2])
+			val += 4;
+		if (bits[3])
+			val += 8;
+		return val;
+	}
+
+	protected boolean hasInput() {
+		return !inputs.isEmpty();
+	}
+
+	/**
+	 * Nulls out any changes to this's size as it is fixed.
+	 */
+	public void setPropertyValue(Object id, Object value) {
+		if (P_VALUE.equals(id))
+			setValue(Integer.parseInt((String) value));
+		else
+			super.setPropertyValue(id, value);
+	}
+
+	public void setSize(Dimension d) {
+		super.setSize(defaultSize);
+	}
+
+	public void setValue(int v) {
+		int val = v % 16;
+		bits = new boolean[4]; // Shorthand to set all bits to false
+		if (val >= 8)
+			bits[3] = true;
+		if (val % 8 > 3)
+			bits[2] = true;
+		if (val % 4 > 1)
+			bits[1] = true;
+		bits[0] = val % 2 == 1;
+		update();
+		firePropertyChange(P_VALUE, null, null);
+	}
+
+	public String toString() {
+		return LogicMessages.LED_LabelText + " #" + getID() //$NON-NLS-1$
+				+ " " + LogicMessages.PropertyDescriptor_LED_Value //$NON-NLS-1$
+				+ "=" + getValue(); //$NON-NLS-1$
+	}
+
+	public void update() {
+		if (hasInput()) {
+			bits = new boolean[4];
+			bits[0] = getInput(TERMINAL_1_IN);
+			bits[1] = getInput(TERMINAL_2_IN);
+			bits[2] = getInput(TERMINAL_3_IN);
+			bits[3] = getInput(TERMINAL_4_IN);
+			firePropertyChange(P_VALUE, null, null);
+		}
+
+		setOutput(TERMINAL_1_OUT, bits[0]);
+		setOutput(TERMINAL_2_OUT, bits[1]);
+		setOutput(TERMINAL_3_OUT, bits[2]);
+		setOutput(TERMINAL_4_OUT, bits[3]);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LiveOutput.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LiveOutput.java
new file mode 100644
index 0000000..1c5b3cb
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LiveOutput.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.swt.graphics.Image;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+public class LiveOutput extends SimpleOutput {
+
+	private static Image LIVE_ICON = createImage(LiveOutput.class,
+			"icons/live16.gif"); //$NON-NLS-1$
+	static final long serialVersionUID = 1;
+
+	public Image getIconImage() {
+		return LIVE_ICON;
+	}
+
+	public boolean getResult() {
+		return true;
+	}
+
+	public String toString() {
+		return LogicMessages.LiveOutput_LabelText;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LocationPropertySource.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LocationPropertySource.java
new file mode 100644
index 0000000..c35cb6f
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LocationPropertySource.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
+
+import org.eclipse.draw2d.geometry.Point;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+public class LocationPropertySource implements IPropertySource {
+
+	public static String ID_XPOS = "xPos"; //$NON-NLS-1$
+	public static String ID_YPOS = "yPos"; //$NON-NLS-1$
+	protected static IPropertyDescriptor[] descriptors;
+
+	static {
+		PropertyDescriptor xProp = new TextPropertyDescriptor(ID_XPOS,
+				LogicMessages.LocationPropertySource_Property_X_Label);
+		xProp.setValidator(LogicNumberCellEditorValidator.instance());
+		PropertyDescriptor yProp = new TextPropertyDescriptor(ID_YPOS,
+				LogicMessages.LocationPropertySource_Property_Y_Label);
+		yProp.setValidator(LogicNumberCellEditorValidator.instance());
+		descriptors = new IPropertyDescriptor[] { xProp, yProp };
+	}
+
+	protected Point point = null;
+
+	public LocationPropertySource(Point point) {
+		this.point = point.getCopy();
+	}
+
+	public Object getEditableValue() {
+		return point.getCopy();
+	}
+
+	public IPropertyDescriptor[] getPropertyDescriptors() {
+		return descriptors;
+	}
+
+	public Object getPropertyValue(Object propName) {
+		if (ID_XPOS.equals(propName)) {
+			return new String(new Integer(point.x).toString());
+		}
+		if (ID_YPOS.equals(propName)) {
+			return new String(new Integer(point.y).toString());
+		}
+		return null;
+	}
+
+	public boolean isPropertySet(Object propName) {
+		return ID_XPOS.equals(propName) || ID_YPOS.equals(propName);
+	}
+
+	public void resetPropertyValue(Object propName) {
+	}
+
+	public void setPropertyValue(Object propName, Object value) {
+		if (ID_XPOS.equals(propName)) {
+			Integer newInt = new Integer((String) value);
+			point.x = newInt.intValue();
+		}
+		if (ID_YPOS.equals(propName)) {
+			Integer newInt = new Integer((String) value);
+			point.y = newInt.intValue();
+		}
+	}
+
+	public String toString() {
+		return new String("[" + point.x + "," + point.y + "]");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicDiagram.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicDiagram.java
new file mode 100644
index 0000000..fe940ca
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicDiagram.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+
+import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+import org.eclipse.draw2d.PositionConstants;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+public class LogicDiagram extends LogicSubpart {
+	static final long serialVersionUID = 1;
+
+	public static String ID_ROUTER = "router"; //$NON-NLS-1$
+	public static Integer ROUTER_MANUAL = new Integer(0);
+	public static Integer ROUTER_MANHATTAN = new Integer(1);
+	public static Integer ROUTER_SHORTEST_PATH = new Integer(2);
+	private static int count;
+	private static Image LOGIC_ICON = createImage(LogicDiagram.class,
+			"icons/circuit16.gif"); //$NON-NLS-1$
+
+	protected List children = new ArrayList();
+	protected LogicRuler leftRuler, topRuler;
+	protected Integer connectionRouter = null;
+	private boolean rulersVisibility = false;
+	private boolean snapToGeometry = false;
+	private boolean gridEnabled = false;
+	private double zoom = 1.0;
+
+	public LogicDiagram() {
+		size.width = 100;
+		size.height = 100;
+		location.x = 20;
+		location.y = 20;
+		createRulers();
+	}
+
+	public void addChild(LogicElement child) {
+		addChild(child, -1);
+	}
+
+	public void addChild(LogicElement child, int index) {
+		if (index >= 0)
+			children.add(index, child);
+		else
+			children.add(child);
+		fireChildAdded(CHILDREN, child, new Integer(index));
+	}
+
+	protected void createRulers() {
+		leftRuler = new LogicRuler(false);
+		topRuler = new LogicRuler(true);
+	}
+
+	public List getChildren() {
+		return children;
+	}
+
+	public Integer getConnectionRouter() {
+		if (connectionRouter == null)
+			connectionRouter = ROUTER_MANUAL;
+		return connectionRouter;
+	}
+
+	public Image getIconImage() {
+		return LOGIC_ICON;
+	}
+
+	public String getNewID() {
+		return Integer.toString(count++);
+	}
+
+	public double getZoom() {
+		return zoom;
+	}
+
+	/**
+	 * Returns <code>null</code> for this model. Returns normal descriptors for
+	 * all subclasses.
+	 * 
+	 * @return Array of property descriptors.
+	 */
+	public IPropertyDescriptor[] getPropertyDescriptors() {
+		if (getClass().equals(LogicDiagram.class)) {
+			ComboBoxPropertyDescriptor cbd = new ComboBoxPropertyDescriptor(
+					ID_ROUTER,
+					LogicMessages.PropertyDescriptor_LogicDiagram_ConnectionRouter,
+					new String[] {
+							LogicMessages.PropertyDescriptor_LogicDiagram_Manual,
+							LogicMessages.PropertyDescriptor_LogicDiagram_Manhattan,
+							LogicMessages.PropertyDescriptor_LogicDiagram_ShortestPath });
+			cbd.setLabelProvider(new ConnectionRouterLabelProvider());
+			return new IPropertyDescriptor[] { cbd };
+		}
+		return super.getPropertyDescriptors();
+	}
+
+	public Object getPropertyValue(Object propName) {
+		if (propName.equals(ID_ROUTER))
+			return connectionRouter;
+		return super.getPropertyValue(propName);
+	}
+
+	public LogicRuler getRuler(int orientation) {
+		LogicRuler result = null;
+		switch (orientation) {
+		case PositionConstants.NORTH:
+			result = topRuler;
+			break;
+		case PositionConstants.WEST:
+			result = leftRuler;
+			break;
+		}
+		return result;
+	}
+
+	public boolean getRulerVisibility() {
+		return rulersVisibility;
+	}
+
+	public boolean isGridEnabled() {
+		return gridEnabled;
+	}
+
+	public boolean isSnapToGeometryEnabled() {
+		return snapToGeometry;
+	}
+
+	private void readObject(java.io.ObjectInputStream s) throws IOException,
+			ClassNotFoundException {
+		s.defaultReadObject();
+	}
+
+	public void removeChild(LogicElement child) {
+		children.remove(child);
+		fireChildRemoved(CHILDREN, child);
+	}
+
+	public void setConnectionRouter(Integer router) {
+		Integer oldConnectionRouter = connectionRouter;
+		connectionRouter = router;
+		firePropertyChange(ID_ROUTER, oldConnectionRouter, connectionRouter);
+	}
+
+	public void setPropertyValue(Object id, Object value) {
+		if (ID_ROUTER.equals(id))
+			setConnectionRouter((Integer) value);
+		else
+			super.setPropertyValue(id, value);
+	}
+
+	public void setRulerVisibility(boolean newValue) {
+		rulersVisibility = newValue;
+	}
+
+	public void setGridEnabled(boolean isEnabled) {
+		gridEnabled = isEnabled;
+	}
+
+	public void setSnapToGeometry(boolean isEnabled) {
+		snapToGeometry = isEnabled;
+	}
+
+	public void setZoom(double zoom) {
+		this.zoom = zoom;
+	}
+
+	public String toString() {
+		return LogicMessages.LogicDiagram_LabelText;
+	}
+
+	private class ConnectionRouterLabelProvider extends
+			org.eclipse.jface.viewers.LabelProvider {
+
+		public ConnectionRouterLabelProvider() {
+			super();
+		}
+
+		public String getText(Object element) {
+			if (element instanceof Integer) {
+				Integer integer = (Integer) element;
+				if (ROUTER_MANUAL.intValue() == integer.intValue())
+					return LogicMessages.PropertyDescriptor_LogicDiagram_Manual;
+				if (ROUTER_MANHATTAN.intValue() == integer.intValue())
+					return LogicMessages.PropertyDescriptor_LogicDiagram_Manhattan;
+				if (ROUTER_SHORTEST_PATH.intValue() == integer.intValue())
+					return LogicMessages.PropertyDescriptor_LogicDiagram_ShortestPath;
+			}
+			return super.getText(element);
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicDiagramFactory.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicDiagramFactory.java
new file mode 100644
index 0000000..b5d869d
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicDiagramFactory.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+
+import org.eclipse.gef.requests.CreationFactory;
+
+public class LogicDiagramFactory {
+
+	LogicDiagram root;
+
+	protected static void connect(LogicSubpart e1, String t1, LogicSubpart e2,
+			String t2) {
+		Wire wire = new Wire();
+		wire.setSource(e1);
+		wire.setSourceTerminal(t1);
+		wire.setTarget(e2);
+		wire.setTargetTerminal(t2);
+		wire.attachSource();
+		wire.attachTarget();
+	}
+
+	public static Circuit createFullAdder() {
+		final Gate or;
+		final Circuit circuit, circuit1, circuit2;
+
+		circuit1 = createHalfAdder();
+		circuit2 = createHalfAdder();
+		circuit1.setLocation(new Point(2, 10));
+		circuit2.setLocation(new Point(38, 90));
+
+		circuit = new Circuit();
+		circuit.setSize(new Dimension(120, 216));
+		or = new OrGate();
+		or.setLocation(new Point(22, 162));
+
+		circuit.addChild(circuit1);
+		circuit.addChild(circuit2);
+
+		connect(circuit, Circuit.TERMINALS_OUT[0], circuit1,
+				Circuit.TERMINALS_IN[0]);
+		connect(circuit, Circuit.TERMINALS_OUT[2], circuit1,
+				Circuit.TERMINALS_IN[3]);
+		connect(circuit, Circuit.TERMINALS_OUT[3], circuit2,
+				Circuit.TERMINALS_IN[3]);
+		connect(circuit1, Circuit.TERMINALS_OUT[7], circuit2,
+				Circuit.TERMINALS_IN[0]);
+
+		circuit.addChild(or);
+		connect(or, SimpleOutput.TERMINAL_OUT, circuit, Circuit.TERMINALS_IN[4]);
+		connect(circuit1, Circuit.TERMINALS_OUT[4], or, Gate.TERMINAL_A);
+		connect(circuit2, Circuit.TERMINALS_OUT[4], or, Gate.TERMINAL_B);
+		connect(circuit2, Circuit.TERMINALS_OUT[7], circuit,
+				Circuit.TERMINALS_IN[7]);
+
+		return circuit;
+	}
+
+	public static Circuit createHalfAdder() {
+		Gate and, xor;
+		Circuit circuit;
+
+		circuit = new Circuit();
+		circuit.setSize(new Dimension(60, 70));
+		and = new AndGate();
+		and.setLocation(new Point(2, 12));
+		xor = new XORGate();
+		xor.setLocation(new Point(22, 12));
+
+		circuit.addChild(xor);
+		circuit.addChild(and);
+
+		connect(circuit, Circuit.TERMINALS_OUT[0], and, Gate.TERMINAL_A);
+		connect(circuit, Circuit.TERMINALS_OUT[3], and, Gate.TERMINAL_B);
+		connect(circuit, Circuit.TERMINALS_OUT[0], xor, Gate.TERMINAL_A);
+		connect(circuit, Circuit.TERMINALS_OUT[3], xor, Gate.TERMINAL_B);
+
+		connect(and, SimpleOutput.TERMINAL_OUT, circuit,
+				Circuit.TERMINALS_IN[4]);
+		connect(xor, SimpleOutput.TERMINAL_OUT, circuit,
+				Circuit.TERMINALS_IN[7]);
+		return circuit;
+	}
+
+	public static Object createLargeModel() {
+		LogicDiagram root = new LogicDiagram();
+
+		final Circuit circuit1, circuit2, circuit3, circuit4;
+		final LED led1, led2, led3;
+
+		led1 = new LED();
+		led1.setValue(3);
+		led2 = new LED();
+		led2.setValue(7);
+		led3 = new LED();
+		led1.setLocation(new Point(170, 16));
+		led2.setLocation(new Point(320, 16));
+		led3.setLocation(new Point(245, 360));
+		root.addChild(led1);
+		root.addChild(led2);
+		root.addChild(led3);
+		//
+		circuit1 = createHalfAdder();
+		circuit1.setSize(new Dimension(64, 216));
+		circuit1.setLocation(new Point(455, 104));
+		root.addChild(circuit1);
+		//
+		circuit2 = createFullAdder();
+		circuit2.setLocation(new Point(305, 104));
+		root.addChild(circuit2);
+		connect(circuit1, Circuit.TERMINALS_OUT[4], circuit2,
+				Circuit.TERMINALS_IN[3]);
+		//
+		circuit3 = createFullAdder();
+		circuit3.setLocation(new Point(155, 104));
+		root.addChild(circuit3);
+		connect(circuit2, Circuit.TERMINALS_OUT[4], circuit3,
+				Circuit.TERMINALS_IN[3]);
+		//
+		circuit4 = createFullAdder();
+		circuit4.setLocation(new Point(5, 104));
+		//
+		connect(led1, LED.TERMINAL_1_OUT, circuit1, Circuit.TERMINALS_IN[0]);
+		connect(led1, LED.TERMINAL_2_OUT, circuit2, Circuit.TERMINALS_IN[0]);
+		connect(led1, LED.TERMINAL_3_OUT, circuit3, Circuit.TERMINALS_IN[0]);
+		connect(led2, LED.TERMINAL_1_OUT, circuit1, Circuit.TERMINALS_IN[3]);
+		connect(led2, LED.TERMINAL_2_OUT, circuit2, Circuit.TERMINALS_IN[2]);
+		connect(circuit1, Circuit.TERMINALS_OUT[7], led3, LED.TERMINAL_1_IN);
+		connect(circuit2, Circuit.TERMINALS_OUT[7], led3, LED.TERMINAL_2_IN);
+		connect(circuit3, Circuit.TERMINALS_OUT[7], led3, LED.TERMINAL_3_IN);
+		//
+		connect(led2, LED.TERMINAL_3_OUT, circuit3, Circuit.TERMINALS_IN[2]);
+		root.addChild(circuit4);
+		connect(led2, LED.TERMINAL_4_OUT, circuit4, Circuit.TERMINALS_IN[2]);
+		connect(circuit3, Circuit.TERMINALS_OUT[4], circuit4,
+				Circuit.TERMINALS_IN[3]);
+		connect(led1, LED.TERMINAL_4_OUT, circuit4, Circuit.TERMINALS_IN[0]);
+		connect(circuit4, Circuit.TERMINALS_OUT[7], led3, LED.TERMINAL_4_IN);
+
+		return root;
+	}
+
+	public static CreationFactory getFullAdderFactory() {
+		return new CreationFactory() {
+			public Object getNewObject() {
+				return createFullAdder();
+			}
+
+			public Object getObjectType() {
+				return "Full Adder"; //$NON-NLS-1$
+			}
+		};
+	}
+
+	public static CreationFactory getHalfAdderFactory() {
+		return new CreationFactory() {
+			public Object getNewObject() {
+				return createHalfAdder();
+			}
+
+			public Object getObjectType() {
+				return "Half Adder"; //$NON-NLS-1$
+			}
+		};
+	}
+
+	public Object createEmptyModel() {
+		root = new LogicDiagram();
+		return root;
+	}
+
+	static public Object createModel() {
+
+		LogicDiagram root = new LogicDiagram();
+
+		Circuit circuit1;
+
+		circuit1 = createHalfAdder();
+		circuit1.setLocation(new Point(50, 50));
+		root.addChild(circuit1);
+		return root;
+	}
+
+	public Object getRootElement() {
+		if (root == null)
+			createLargeModel();
+		return root;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicElement.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicElement.java
new file mode 100644
index 0000000..9b54203
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicElement.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+abstract public class LogicElement implements IPropertySource, Cloneable,
+		Serializable {
+
+	public static final String CHILDREN = "Children", //$NON-NLS-1$
+			INPUTS = "inputs", //$NON-NLS-1$
+			OUTPUTS = "outputs"; //$NON-NLS-1$
+
+	transient protected PropertyChangeSupport listeners = new PropertyChangeSupport(
+			this);
+	static final long serialVersionUID = 1;
+
+	public void addPropertyChangeListener(PropertyChangeListener l) {
+		listeners.addPropertyChangeListener(l);
+	}
+
+	protected void firePropertyChange(String prop, Object old, Object newValue) {
+		listeners.firePropertyChange(prop, old, newValue);
+	}
+
+	protected void fireChildAdded(String prop, Object child, Object index) {
+		listeners.firePropertyChange(prop, index, child);
+	}
+
+	protected void fireChildRemoved(String prop, Object child) {
+		listeners.firePropertyChange(prop, child, null);
+	}
+
+	protected void fireStructureChange(String prop, Object child) {
+		listeners.firePropertyChange(prop, null, child);
+	}
+
+	public Object getEditableValue() {
+		return this;
+	}
+
+	public IPropertyDescriptor[] getPropertyDescriptors() {
+		return new IPropertyDescriptor[0];
+	}
+
+	public Object getPropertyValue(Object propName) {
+		return null;
+	}
+
+	final Object getPropertyValue(String propName) {
+		return null;
+	}
+
+	public boolean isPropertySet(Object propName) {
+		return isPropertySet((String) propName);
+	}
+
+	final boolean isPropertySet(String propName) {
+		return true;
+	}
+
+	private void readObject(ObjectInputStream in) throws IOException,
+			ClassNotFoundException {
+		in.defaultReadObject();
+		listeners = new PropertyChangeSupport(this);
+	}
+
+	public void removePropertyChangeListener(PropertyChangeListener l) {
+		listeners.removePropertyChangeListener(l);
+	}
+
+	public void resetPropertyValue(Object propName) {
+	}
+
+	final void resetPropertyValue(String propName) {
+	}
+
+	public void setPropertyValue(Object propName, Object val) {
+	}
+
+	final void setPropertyValue(String propName, Object val) {
+	}
+
+	public void update() {
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicFlowContainer.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicFlowContainer.java
new file mode 100644
index 0000000..9583668
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicFlowContainer.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+public class LogicFlowContainer extends LogicDiagram {
+
+	static final long serialVersionUID = 1;
+
+	public String toString() {
+		return LogicMessages.LogicPlugin_Tool_CreationTool_FlowContainer_Label;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicGuide.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicGuide.java
new file mode 100644
index 0000000..f2ef53a
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicGuide.java
@@ -0,0 +1,216 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.Serializable;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+
+/**
+ * Model object representing a guide.
+ * <p>
+ * In addition to maintaining information about which parts are attached to the
+ * guide, LogicGuide also maintains information about the edge along which those
+ * parts are attached. This information is useful during resize operations to
+ * determine the attachment status of a part.
+ * 
+ * @author Pratik Shah
+ */
+public class LogicGuide implements Serializable {
+
+	/**
+	 * Property used to notify listeners when the parts attached to a guide are
+	 * changed
+	 */
+	public static final String PROPERTY_CHILDREN = "subparts changed"; //$NON-NLS-1$
+	/**
+	 * Property used to notify listeners when the guide is re-positioned
+	 */
+	public static final String PROPERTY_POSITION = "position changed"; //$NON-NLS-1$
+
+	static final long serialVersionUID = 1;
+
+	protected PropertyChangeSupport listeners = new PropertyChangeSupport(this);
+	private Map map;
+	private int position;
+	private boolean horizontal;
+
+	/**
+	 * Empty default constructor
+	 */
+	public LogicGuide() {
+		// empty constructor
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param isHorizontal
+	 *            <code>true</code> if the guide is horizontal (i.e., placed on
+	 *            a vertical ruler)
+	 */
+	public LogicGuide(boolean isHorizontal) {
+		setHorizontal(isHorizontal);
+	}
+
+	/**
+	 * @see PropertyChangeSupport#addPropertyChangeListener(java.beans.PropertyChangeListener)
+	 */
+	public void addPropertyChangeListener(PropertyChangeListener listener) {
+		listeners.addPropertyChangeListener(listener);
+	}
+
+	/*
+	 * @TODO:Pratik use PositionConstants here
+	 */
+	/**
+	 * Attaches the given part along the given edge to this guide. The
+	 * LogicSubpart is also updated to reflect this attachment.
+	 * 
+	 * @param part
+	 *            The part that is to be attached to this guide; if the part is
+	 *            already attached, its alignment is updated
+	 * @param alignment
+	 *            -1 is left or top; 0, center; 1, right or bottom
+	 */
+	public void attachPart(LogicSubpart part, int alignment) {
+		if (getMap().containsKey(part) && getAlignment(part) == alignment)
+			return;
+
+		getMap().put(part, new Integer(alignment));
+		LogicGuide parent = isHorizontal() ? part.getHorizontalGuide() : part
+				.getVerticalGuide();
+		if (parent != null && parent != this) {
+			parent.detachPart(part);
+		}
+		if (isHorizontal()) {
+			part.setHorizontalGuide(this);
+		} else {
+			part.setVerticalGuide(this);
+		}
+		listeners.firePropertyChange(PROPERTY_CHILDREN, null, part);
+	}
+
+	/**
+	 * Detaches the given part from this guide. The LogicSubpart is also updated
+	 * to reflect this change.
+	 * 
+	 * @param part
+	 *            the part that is to be detached from this guide
+	 */
+	public void detachPart(LogicSubpart part) {
+		if (getMap().containsKey(part)) {
+			getMap().remove(part);
+			if (isHorizontal()) {
+				part.setHorizontalGuide(null);
+			} else {
+				part.setVerticalGuide(null);
+			}
+			listeners.firePropertyChange(PROPERTY_CHILDREN, null, part);
+		}
+	}
+
+	/**
+	 * This methods returns the edge along which the given part is attached to
+	 * this guide. This information is used by
+	 * {@link org.eclipse.gef.examples.logicdesigner.edit.LogicXYLayoutEditPolicy
+	 * LogicXYLayoutEditPolicy} to determine whether to attach or detach a part
+	 * from a guide during resize operations.
+	 * 
+	 * @param part
+	 *            The part whose alignment has to be found
+	 * @return an int representing the edge along which the given part is
+	 *         attached to this guide; 1 is bottom or right; 0, center; -1, top
+	 *         or left; -2 if the part is not attached to this guide
+	 * @see org.eclipse.gef.examples.logicdesigner.edit.LogicXYLayoutEditPolicy#createChangeConstraintCommand(ChangeBoundsRequest,
+	 *      EditPart, Object)
+	 */
+	public int getAlignment(LogicSubpart part) {
+		if (getMap().get(part) != null)
+			return ((Integer) getMap().get(part)).intValue();
+		return -2;
+	}
+
+	/**
+	 * @return The Map containing all the parts attached to this guide, and
+	 *         their alignments; the keys are LogicSubparts and values are
+	 *         Integers
+	 */
+	public Map getMap() {
+		if (map == null) {
+			map = new Hashtable();
+		}
+		return map;
+	}
+
+	/**
+	 * @return the set of all the parts attached to this guide; a set is used
+	 *         because a part can only be attached to a guide along one edge.
+	 */
+	public Set getParts() {
+		return getMap().keySet();
+	}
+
+	/**
+	 * @return the position/location of the guide (in pixels)
+	 */
+	public int getPosition() {
+		return position;
+	}
+
+	/**
+	 * @return <code>true</code> if the guide is horizontal (i.e., placed on a
+	 *         vertical ruler)
+	 */
+	public boolean isHorizontal() {
+		return horizontal;
+	}
+
+	/**
+	 * @see PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener)
+	 */
+	public void removePropertyChangeListener(PropertyChangeListener listener) {
+		listeners.removePropertyChangeListener(listener);
+	}
+
+	/**
+	 * Sets the orientation of the guide
+	 * 
+	 * @param isHorizontal
+	 *            <code>true</code> if this guide is to be placed on a vertical
+	 *            ruler
+	 */
+	public void setHorizontal(boolean isHorizontal) {
+		horizontal = isHorizontal;
+	}
+
+	/**
+	 * Sets the location of the guide
+	 * 
+	 * @param offset
+	 *            The location of the guide (in pixels)
+	 */
+	public void setPosition(int offset) {
+		if (position != offset) {
+			int oldValue = position;
+			position = offset;
+			listeners.firePropertyChange(PROPERTY_POSITION, new Integer(
+					oldValue), new Integer(position));
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicLabel.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicLabel.java
new file mode 100644
index 0000000..d6d5f7b
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicLabel.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import java.io.IOException;
+
+import org.eclipse.swt.graphics.Image;
+
+import org.eclipse.draw2d.geometry.Dimension;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+public class LogicLabel extends LogicSubpart {
+	static final long serialVersionUID = 1;
+
+	private String text = LogicMessages.LogicPlugin_Tool_CreationTool_LogicLabel;
+
+	private static Image LOGIC_LABEL_ICON = createImage(LED.class,
+			"icons/label16.gif"); //$NON-NLS-1$
+
+	private static int count;
+
+	public LogicLabel() {
+		super();
+		size.width = 50;
+	}
+
+	public String getLabelContents() {
+		return text;
+	}
+
+	public Image getIconImage() {
+		return LOGIC_LABEL_ICON;
+	}
+
+	protected String getNewID() {
+		return Integer.toString(count++);
+	}
+
+	public Dimension getSize() {
+		return new Dimension(size.width, -1);
+	}
+
+	private void readObject(java.io.ObjectInputStream s) throws IOException,
+			ClassNotFoundException {
+		s.defaultReadObject();
+	}
+
+	public void setSize(Dimension d) {
+		d.height = -1;
+		super.setSize(d);
+	}
+
+	public void setLabelContents(String s) {
+		text = s;
+		firePropertyChange("labelContents", null, text); //$NON-NLS-2$//$NON-NLS-1$
+	}
+
+	public String toString() {
+		return LogicMessages.LogicPlugin_Tool_CreationTool_LogicLabel
+				+ " #" + getID() + " " //$NON-NLS-1$ //$NON-NLS-2$
+				+ LogicMessages.PropertyDescriptor_Label_Text
+				+ "=" + getLabelContents(); //$NON-NLS-1$ 
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicNumberCellEditorValidator.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicNumberCellEditorValidator.java
new file mode 100644
index 0000000..413122d
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicNumberCellEditorValidator.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.jface.viewers.ICellEditorValidator;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+public class LogicNumberCellEditorValidator implements ICellEditorValidator {
+
+	private static LogicNumberCellEditorValidator instance;
+
+	public static LogicNumberCellEditorValidator instance() {
+		if (instance == null)
+			instance = new LogicNumberCellEditorValidator();
+		return instance;
+	}
+
+	public String isValid(Object value) {
+		try {
+			new Integer((String) value);
+			return null;
+		} catch (NumberFormatException exc) {
+			return LogicMessages.CellEditorValidator_NotANumberMessage;
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicRuler.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicRuler.java
new file mode 100644
index 0000000..866359c
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicRuler.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.rulers.RulerProvider;
+
+/**
+ * @author Pratik Shah
+ */
+public class LogicRuler implements Serializable {
+
+	public static final String PROPERTY_CHILDREN = "children changed"; //$NON-NLS-1$
+	public static final String PROPERTY_UNIT = "units changed"; //$NON-NLS-1$
+
+	static final long serialVersionUID = 1;
+
+	protected PropertyChangeSupport listeners = new PropertyChangeSupport(this);
+	private int unit;
+	private boolean horizontal;
+	private List guides = new ArrayList();
+
+	public LogicRuler(boolean isHorizontal) {
+		this(isHorizontal, RulerProvider.UNIT_PIXELS);
+	}
+
+	public LogicRuler(boolean isHorizontal, int unit) {
+		horizontal = isHorizontal;
+		setUnit(unit);
+	}
+
+	public void addGuide(LogicGuide guide) {
+		if (!guides.contains(guide)) {
+			guide.setHorizontal(!isHorizontal());
+			guides.add(guide);
+			listeners.firePropertyChange(PROPERTY_CHILDREN, null, guide);
+		}
+	}
+
+	public void addPropertyChangeListener(PropertyChangeListener listener) {
+		listeners.addPropertyChangeListener(listener);
+	}
+
+	// the returned list should not be modified
+	public List getGuides() {
+		return guides;
+	}
+
+	public int getUnit() {
+		return unit;
+	}
+
+	public boolean isHidden() {
+		return false;
+	}
+
+	public boolean isHorizontal() {
+		return horizontal;
+	}
+
+	public void removeGuide(LogicGuide guide) {
+		if (guides.remove(guide)) {
+			listeners.firePropertyChange(PROPERTY_CHILDREN, null, guide);
+		}
+	}
+
+	public void removePropertyChangeListener(PropertyChangeListener listener) {
+		listeners.removePropertyChangeListener(listener);
+	}
+
+	public void setHidden(boolean isHidden) {
+	}
+
+	public void setUnit(int newUnit) {
+		if (unit != newUnit) {
+			int oldUnit = unit;
+			unit = newUnit;
+			listeners.firePropertyChange(PROPERTY_UNIT, oldUnit, newUnit);
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicSubpart.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicSubpart.java
new file mode 100644
index 0000000..dc1c2cf
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/LogicSubpart.java
@@ -0,0 +1,242 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.eclipse.swt.graphics.Image;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+abstract public class LogicSubpart extends LogicElement {
+
+	private String id;
+	private LogicGuide verticalGuide, horizontalGuide;
+	protected Hashtable inputs = new Hashtable(7);
+	protected Point location = new Point(0, 0);
+	protected Vector outputs = new Vector(4, 4);
+	static final long serialVersionUID = 1;
+	protected Dimension size = new Dimension(-1, -1);
+
+	protected static IPropertyDescriptor[] descriptors = null;
+	public static String ID_SIZE = "size"; //$NON-NLS-1$
+	public static String ID_LOCATION = "location"; //$NON-NLS-1$
+
+	static {
+		descriptors = new IPropertyDescriptor[] {
+				new PropertyDescriptor(ID_SIZE,
+						LogicMessages.PropertyDescriptor_LogicSubPart_Size),
+				new PropertyDescriptor(ID_LOCATION,
+						LogicMessages.PropertyDescriptor_LogicSubPart_Location) };
+	}
+
+	protected static Image createImage(Class rsrcClass, String name) {
+		InputStream stream = rsrcClass.getResourceAsStream(name);
+		Image image = null;
+		try {
+		    image = new Image(null, stream);
+			stream.close();
+		} catch (Exception ioe) {
+		}
+		return image;
+	}
+
+	public LogicSubpart() {
+		setID(getNewID());
+	}
+
+	public void connectInput(Wire w) {
+		inputs.put(w.getTargetTerminal(), w);
+		update();
+		fireStructureChange(INPUTS, w);
+	}
+
+	public void connectOutput(Wire w) {
+		outputs.addElement(w);
+		update();
+		fireStructureChange(OUTPUTS, w);
+	}
+
+	public void disconnectInput(Wire w) {
+		inputs.remove(w.getTargetTerminal());
+		update();
+		fireStructureChange(INPUTS, w);
+	}
+
+	public void disconnectOutput(Wire w) {
+		outputs.removeElement(w);
+		update();
+		fireStructureChange(OUTPUTS, w);
+	}
+
+	public Vector getConnections() {
+		Vector v = (Vector) outputs.clone();
+		Enumeration ins = inputs.elements();
+		while (ins.hasMoreElements())
+			v.addElement(ins.nextElement());
+		return v;
+	}
+
+	public LogicGuide getHorizontalGuide() {
+		return horizontalGuide;
+	}
+
+	public Image getIcon() {
+		return getIconImage();
+	}
+
+	abstract public Image getIconImage();
+
+	public String getID() {
+		return id;
+	}
+
+	protected boolean getInput(String terminal) {
+		Wire w = (Wire) inputs.get(terminal);
+		return (w == null) ? false : w.getValue();
+	}
+
+	public Point getLocation() {
+		return location;
+	}
+
+	abstract protected String getNewID();
+
+	/**
+	 * Returns useful property descriptors for the use in property sheets. this
+	 * supports location and size.
+	 * 
+	 * @return Array of property descriptors.
+	 */
+	public IPropertyDescriptor[] getPropertyDescriptors() {
+		return descriptors;
+	}
+
+	/**
+	 * Returns an Object which represents the appropriate value for the property
+	 * name supplied.
+	 * 
+	 * @param propName
+	 *            Name of the property for which the the values are needed.
+	 * @return Object which is the value of the property.
+	 */
+	public Object getPropertyValue(Object propName) {
+		if (ID_SIZE.equals(propName))
+			return new DimensionPropertySource(getSize());
+		else if (ID_LOCATION.equals(propName))
+			return new LocationPropertySource(getLocation());
+		return null;
+	}
+
+	public Dimension getSize() {
+		return size;
+	}
+
+	public Vector getSourceConnections() {
+		return (Vector) outputs.clone();
+	}
+
+	public Vector getTargetConnections() {
+		Enumeration elements = inputs.elements();
+		Vector v = new Vector(inputs.size());
+		while (elements.hasMoreElements())
+			v.addElement(elements.nextElement());
+		return v;
+	}
+
+	public LogicGuide getVerticalGuide() {
+		return verticalGuide;
+	}
+
+	/**
+ * 
+ */
+	public boolean isPropertySet() {
+		return true;
+	}
+
+	public void setHorizontalGuide(LogicGuide hGuide) {
+		horizontalGuide = hGuide;
+		/*
+		 * @TODO:Pratik firePropertyChanged?
+		 */
+	}
+
+	/*
+	 * Does nothing for the present, but could be used to reset the properties
+	 * of this to whatever values are desired.
+	 * 
+	 * @param id Parameter which is to be reset.
+	 * 
+	 * public void resetPropertyValue(Object id){ if(ID_SIZE.equals(id)){;}
+	 * if(ID_LOCATION.equals(id)){;} }
+	 */
+
+	public void setID(String s) {
+		id = s;
+	}
+
+	public void setLocation(Point p) {
+		if (location.equals(p))
+			return;
+		location = p;
+		firePropertyChange("location", null, p); //$NON-NLS-1$
+	}
+
+	protected void setOutput(String terminal, boolean val) {
+		Enumeration elements = outputs.elements();
+		Wire w;
+		while (elements.hasMoreElements()) {
+			w = (Wire) elements.nextElement();
+			if (w.getSourceTerminal().equals(terminal)
+					&& this.equals(w.getSource()))
+				w.setValue(val);
+		}
+	}
+
+	/**
+	 * Sets the value of a given property with the value supplied. Also fires a
+	 * property change if necessary.
+	 * 
+	 * @param id
+	 *            Name of the parameter to be changed.
+	 * @param value
+	 *            Value to be set to the given parameter.
+	 */
+	public void setPropertyValue(Object id, Object value) {
+		if (ID_SIZE.equals(id))
+			setSize((Dimension) value);
+		else if (ID_LOCATION.equals(id))
+			setLocation((Point) value);
+	}
+
+	public void setSize(Dimension d) {
+		if (size.equals(d))
+			return;
+		size = d;
+		firePropertyChange("size", null, size); //$NON-NLS-1$
+	}
+
+	public void setVerticalGuide(LogicGuide vGuide) {
+		verticalGuide = vGuide;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/OrGate.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/OrGate.java
new file mode 100644
index 0000000..04bc430
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/OrGate.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.swt.graphics.Image;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+public class OrGate extends Gate {
+
+	static private Image OR_ICON = createImage(OrGate.class, "icons/or16.gif"); //$NON-NLS-1$
+	static final long serialVersionUID = 1;
+
+	public Image getIconImage() {
+		return OR_ICON;
+	}
+
+	public boolean getResult() {
+		return getInput(TERMINAL_A) | getInput(TERMINAL_B);
+	}
+
+	public String toString() {
+		return LogicMessages.OrGate_LabelText + " #" + getID(); //$NON-NLS-1$
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/SimpleOutput.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/SimpleOutput.java
new file mode 100644
index 0000000..2e11449
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/SimpleOutput.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.draw2d.geometry.Dimension;
+
+abstract public class SimpleOutput extends LogicSubpart {
+
+	static final long serialVersionUID = 1;
+
+	private static int count;
+	public static String TERMINAL_OUT = "OUT"; //$NON-NLS-1$
+
+	public String getNewID() {
+		return Integer.toString(count++);
+	}
+
+	public Object getPropertyValue(Object propName) {
+		if (ID_SIZE.equals(propName)) {
+			return new String(
+					"(" + getSize().width + "," + getSize().height + ")");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+		}
+		return super.getPropertyValue(propName);
+	}
+
+	abstract public boolean getResult();
+
+	public Dimension getSize() {
+		return new Dimension(-1, -1);
+	}
+
+	public void removeOutput(Wire w) {
+		outputs.remove(w);
+	}
+
+	/**
+	 * Nulls out any changes to this and its subclasses as they are of fixed
+	 * size.
+	 */
+	public void setPropertyValue(Object id, Object value) {
+		if (ID_SIZE.equals(id))
+			super.setPropertyValue(id, new Dimension(getSize()));
+		else
+			super.setPropertyValue(id, value);
+	}
+
+	public void update() {
+		setOutput(TERMINAL_OUT, getResult());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/Wire.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/Wire.java
new file mode 100644
index 0000000..e02cd47
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/Wire.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.draw2d.Bendpoint;
+
+public class Wire extends LogicElement {
+
+	static final long serialVersionUID = 1;
+	protected boolean value;
+	protected LogicSubpart source, target;
+	protected String sourceTerminal, targetTerminal;
+	protected List bendpoints = new ArrayList();
+
+	public void attachSource() {
+		if (getSource() == null
+				|| getSource().getSourceConnections().contains(this))
+			return;
+		getSource().connectOutput(this);
+	}
+
+	public void attachTarget() {
+		if (getTarget() == null
+				|| getTarget().getTargetConnections().contains(this))
+			return;
+		getTarget().connectInput(this);
+	}
+
+	public void detachSource() {
+		if (getSource() == null)
+			return;
+		getSource().disconnectOutput(this);
+	}
+
+	public void detachTarget() {
+		if (getTarget() == null)
+			return;
+		getTarget().disconnectInput(this);
+	}
+
+	public List getBendpoints() {
+		return bendpoints;
+	}
+
+	public LogicSubpart getSource() {
+		return source;
+	}
+
+	public String getSourceTerminal() {
+		return sourceTerminal;
+	}
+
+	public LogicSubpart getTarget() {
+		return target;
+	}
+
+	public String getTargetTerminal() {
+		return targetTerminal;
+	}
+
+	public boolean getValue() {
+		return value;
+	}
+
+	public void insertBendpoint(int index, Bendpoint point) {
+		getBendpoints().add(index, point);
+		firePropertyChange("bendpoint", null, null);//$NON-NLS-1$
+	}
+
+	public void removeBendpoint(int index) {
+		getBendpoints().remove(index);
+		firePropertyChange("bendpoint", null, null);//$NON-NLS-1$
+	}
+
+	public void setBendpoint(int index, Bendpoint point) {
+		getBendpoints().set(index, point);
+		firePropertyChange("bendpoint", null, null);//$NON-NLS-1$
+	}
+
+	public void setBendpoints(Vector points) {
+		bendpoints = points;
+		firePropertyChange("bendpoint", null, null);//$NON-NLS-1$
+	}
+
+	public void setSource(LogicSubpart e) {
+		Object old = source;
+		source = e;
+		firePropertyChange("source", old, source);//$NON-NLS-1$
+	}
+
+	public void setSourceTerminal(String s) {
+		Object old = sourceTerminal;
+		sourceTerminal = s;
+		firePropertyChange("sourceTerminal", old, sourceTerminal);//$NON-NLS-1$
+	}
+
+	public void setTarget(LogicSubpart e) {
+		Object old = target;
+		target = e;
+		firePropertyChange("target", old, target);//$NON-NLS-1$
+	}
+
+	public void setTargetTerminal(String s) {
+		Object old = targetTerminal;
+		targetTerminal = s;
+		firePropertyChange("targetTerminal", old, targetTerminal);//$NON-NLS-1$
+	}
+
+	public void setValue(boolean value) {
+		if (value == this.value)
+			return;
+		this.value = value;
+		if (target != null)
+			target.update();
+		firePropertyChange("value", null, null);//$NON-NLS-1$
+	}
+
+	public String toString() {
+		return "Wire(" + getSource() + "," + getSourceTerminal() + "->" + getTarget() + "," + getTargetTerminal() + ")";//$NON-NLS-5$//$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/WireBendpoint.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/WireBendpoint.java
new file mode 100644
index 0000000..32c3ce0
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/WireBendpoint.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.draw2d.Bendpoint;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+
+public class WireBendpoint implements java.io.Serializable, Bendpoint {
+
+	private static final long serialVersionUID = 2637650104131990387L;
+	private float weight = 0.5f;
+	private Dimension d1, d2;
+
+	public WireBendpoint() {
+	}
+
+	public Dimension getFirstRelativeDimension() {
+		return d1;
+	}
+
+	public Point getLocation() {
+		return null;
+	}
+
+	public Dimension getSecondRelativeDimension() {
+		return d2;
+	}
+
+	public float getWeight() {
+		return weight;
+	}
+
+	public void setRelativeDimensions(Dimension dim1, Dimension dim2) {
+		d1 = dim1;
+		d2 = dim2;
+	}
+
+	public void setWeight(float w) {
+		weight = w;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/XORGate.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/XORGate.java
new file mode 100644
index 0000000..65140dd
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/XORGate.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model;
+
+import org.eclipse.swt.graphics.Image;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+
+public class XORGate extends Gate {
+
+	static final long serialVersionUID = 1;
+	private static Image XOR_ICON = createImage(XORGate.class,
+			"icons/xor16.gif"); //$NON-NLS-1$
+
+	public Image getIconImage() {
+		return XOR_ICON;
+	}
+
+	public boolean getResult() {
+		return getInput(TERMINAL_A) & !getInput(TERMINAL_B)
+				|| !getInput(TERMINAL_A) & getInput(TERMINAL_B);
+	}
+
+	public String toString() {
+		return LogicMessages.XORGate_LabelText + " #" + getID();//$NON-NLS-1$
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/AddCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/AddCommand.java
new file mode 100644
index 0000000..ce8c906
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/AddCommand.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+
+public class AddCommand extends org.eclipse.gef.commands.Command {
+
+	private LogicSubpart child;
+	private LogicDiagram parent;
+	private int index = -1;
+
+	public AddCommand() {
+		super(LogicMessages.AddCommand_Label);
+	}
+
+	public void execute() {
+		if (index < 0)
+			parent.addChild(child);
+		else
+			parent.addChild(child, index);
+	}
+
+	public LogicDiagram getParent() {
+		return parent;
+	}
+
+	public void redo() {
+		if (index < 0)
+			parent.addChild(child);
+		else
+			parent.addChild(child, index);
+	}
+
+	public void setChild(LogicSubpart subpart) {
+		child = subpart;
+	}
+
+	public void setIndex(int i) {
+		index = i;
+	}
+
+	public void setParent(LogicDiagram newParent) {
+		parent = newParent;
+	}
+
+	public void undo() {
+		parent.removeChild(child);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/BendpointCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/BendpointCommand.java
new file mode 100644
index 0000000..63eb596
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/BendpointCommand.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+
+import org.eclipse.gef.commands.Command;
+
+import org.eclipse.gef.examples.logicdesigner.model.Wire;
+
+public class BendpointCommand extends Command {
+
+	protected int index;
+	protected Point location;
+	protected Wire wire;
+	private Dimension d1, d2;
+
+	protected Dimension getFirstRelativeDimension() {
+		return d1;
+	}
+
+	protected Dimension getSecondRelativeDimension() {
+		return d2;
+	}
+
+	protected int getIndex() {
+		return index;
+	}
+
+	protected Point getLocation() {
+		return location;
+	}
+
+	protected Wire getWire() {
+		return wire;
+	}
+
+	public void redo() {
+		execute();
+	}
+
+	public void setRelativeDimensions(Dimension dim1, Dimension dim2) {
+		d1 = dim1;
+		d2 = dim2;
+	}
+
+	public void setIndex(int i) {
+		index = i;
+	}
+
+	public void setLocation(Point p) {
+		location = p;
+	}
+
+	public void setWire(Wire w) {
+		wire = w;
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/ChangeGuideCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/ChangeGuideCommand.java
new file mode 100644
index 0000000..869b5a1
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/ChangeGuideCommand.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import org.eclipse.gef.commands.Command;
+
+import org.eclipse.gef.examples.logicdesigner.model.LogicGuide;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+
+/**
+ * @author Pratik Shah
+ */
+public class ChangeGuideCommand extends Command {
+
+	private LogicSubpart part;
+	private LogicGuide oldGuide, newGuide;
+	private int oldAlign, newAlign;
+	private boolean horizontal;
+
+	public ChangeGuideCommand(LogicSubpart part, boolean horizontalGuide) {
+		super();
+		this.part = part;
+		horizontal = horizontalGuide;
+	}
+
+	protected void changeGuide(LogicGuide oldGuide, LogicGuide newGuide,
+			int newAlignment) {
+		if (oldGuide != null && oldGuide != newGuide) {
+			oldGuide.detachPart(part);
+		}
+		// You need to re-attach the part even if the oldGuide and the newGuide
+		// are the same
+		// because the alignment could have changed
+		if (newGuide != null) {
+			newGuide.attachPart(part, newAlignment);
+		}
+	}
+
+	public void execute() {
+		// Cache the old values
+		oldGuide = horizontal ? part.getHorizontalGuide() : part
+				.getVerticalGuide();
+		if (oldGuide != null)
+			oldAlign = oldGuide.getAlignment(part);
+
+		redo();
+	}
+
+	public void redo() {
+		changeGuide(oldGuide, newGuide, newAlign);
+	}
+
+	public void setNewGuide(LogicGuide guide, int alignment) {
+		newGuide = guide;
+		newAlign = alignment;
+	}
+
+	public void undo() {
+		changeGuide(newGuide, oldGuide, oldAlign);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/CloneCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/CloneCommand.java
new file mode 100644
index 0000000..d823872
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/CloneCommand.java
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.commands.Command;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.AndGate;
+import org.eclipse.gef.examples.logicdesigner.model.Circuit;
+import org.eclipse.gef.examples.logicdesigner.model.GroundOutput;
+import org.eclipse.gef.examples.logicdesigner.model.LED;
+import org.eclipse.gef.examples.logicdesigner.model.LiveOutput;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicFlowContainer;
+import org.eclipse.gef.examples.logicdesigner.model.LogicGuide;
+import org.eclipse.gef.examples.logicdesigner.model.LogicLabel;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+import org.eclipse.gef.examples.logicdesigner.model.OrGate;
+import org.eclipse.gef.examples.logicdesigner.model.Wire;
+import org.eclipse.gef.examples.logicdesigner.model.WireBendpoint;
+import org.eclipse.gef.examples.logicdesigner.model.XORGate;
+
+public class CloneCommand extends Command {
+
+	private List parts, newTopLevelParts, newConnections;
+	private LogicDiagram parent;
+	private Map bounds, indices, connectionPartMap;
+	private ChangeGuideCommand vGuideCommand, hGuideCommand;
+	private LogicGuide hGuide, vGuide;
+	private int hAlignment, vAlignment;
+
+	public CloneCommand() {
+		super(LogicMessages.CloneCommand_Label);
+		parts = new LinkedList();
+	}
+
+	public void addPart(LogicSubpart part, Rectangle newBounds) {
+		parts.add(part);
+		if (bounds == null) {
+			bounds = new HashMap();
+		}
+		bounds.put(part, newBounds);
+	}
+
+	public void addPart(LogicSubpart part, int index) {
+		parts.add(part);
+		if (indices == null) {
+			indices = new HashMap();
+		}
+		indices.put(part, new Integer(index));
+	}
+
+	protected void clonePart(LogicSubpart oldPart, LogicDiagram newParent,
+			Rectangle newBounds, List newConnections, Map connectionPartMap,
+			int index) {
+		LogicSubpart newPart = null;
+
+		if (oldPart instanceof AndGate) {
+			newPart = new AndGate();
+		} else if (oldPart instanceof Circuit) {
+			newPart = new Circuit();
+		} else if (oldPart instanceof GroundOutput) {
+			newPart = new GroundOutput();
+		} else if (oldPart instanceof LED) {
+			newPart = new LED();
+			newPart.setPropertyValue(LED.P_VALUE,
+					oldPart.getPropertyValue(LED.P_VALUE));
+		} else if (oldPart instanceof LiveOutput) {
+			newPart = new LiveOutput();
+		} else if (oldPart instanceof LogicLabel) {
+			newPart = new LogicLabel();
+			((LogicLabel) newPart).setLabelContents(((LogicLabel) oldPart)
+					.getLabelContents());
+		} else if (oldPart instanceof OrGate) {
+			newPart = new OrGate();
+		} else if (oldPart instanceof LogicFlowContainer) {
+			newPart = new LogicFlowContainer();
+		} else if (oldPart instanceof XORGate) {
+			newPart = new XORGate();
+		}
+
+		if (oldPart instanceof LogicDiagram) {
+			Iterator i = ((LogicDiagram) oldPart).getChildren().iterator();
+			while (i.hasNext()) {
+				// for children they will not need new bounds
+				clonePart((LogicSubpart) i.next(), (LogicDiagram) newPart,
+						null, newConnections, connectionPartMap, -1);
+			}
+		}
+
+		Iterator i = oldPart.getTargetConnections().iterator();
+		while (i.hasNext()) {
+			Wire connection = (Wire) i.next();
+			Wire newConnection = new Wire();
+			newConnection.setValue(connection.getValue());
+			newConnection.setTarget(newPart);
+			newConnection.setTargetTerminal(connection.getTargetTerminal());
+			newConnection.setSourceTerminal(connection.getSourceTerminal());
+			newConnection.setSource(connection.getSource());
+
+			Iterator b = connection.getBendpoints().iterator();
+			Vector newBendPoints = new Vector();
+
+			while (b.hasNext()) {
+				WireBendpoint bendPoint = (WireBendpoint) b.next();
+				WireBendpoint newBendPoint = new WireBendpoint();
+				newBendPoint.setRelativeDimensions(
+						bendPoint.getFirstRelativeDimension(),
+						bendPoint.getSecondRelativeDimension());
+				newBendPoint.setWeight(bendPoint.getWeight());
+				newBendPoints.add(newBendPoint);
+			}
+
+			newConnection.setBendpoints(newBendPoints);
+			newConnections.add(newConnection);
+		}
+
+		if (index < 0) {
+			newParent.addChild(newPart);
+		} else {
+			newParent.addChild(newPart, index);
+		}
+
+		newPart.setSize(oldPart.getSize());
+
+		if (newBounds != null) {
+			newPart.setLocation(newBounds.getTopLeft());
+		} else {
+			newPart.setLocation(oldPart.getLocation());
+		}
+
+		// keep track of the new parts so we can delete them in undo
+		// keep track of the oldpart -> newpart map so that we can properly
+		// attach
+		// all connections.
+		if (newParent == parent)
+			newTopLevelParts.add(newPart);
+		connectionPartMap.put(oldPart, newPart);
+	}
+
+	public void execute() {
+		connectionPartMap = new HashMap();
+		newConnections = new LinkedList();
+		newTopLevelParts = new LinkedList();
+
+		Iterator i = parts.iterator();
+
+		LogicSubpart part = null;
+		while (i.hasNext()) {
+			part = (LogicSubpart) i.next();
+			if (bounds != null && bounds.containsKey(part)) {
+				clonePart(part, parent, (Rectangle) bounds.get(part),
+						newConnections, connectionPartMap, -1);
+			} else if (indices != null && indices.containsKey(part)) {
+				clonePart(part, parent, null, newConnections,
+						connectionPartMap,
+						((Integer) indices.get(part)).intValue());
+			} else {
+				clonePart(part, parent, null, newConnections,
+						connectionPartMap, -1);
+			}
+		}
+
+		// go through and set the source of each connection to the proper
+		// source.
+		Iterator c = newConnections.iterator();
+
+		while (c.hasNext()) {
+			Wire conn = (Wire) c.next();
+			LogicSubpart source = conn.getSource();
+			if (connectionPartMap.containsKey(source)) {
+				conn.setSource((LogicSubpart) connectionPartMap.get(source));
+				conn.attachSource();
+				conn.attachTarget();
+			}
+		}
+
+		if (hGuide != null) {
+			hGuideCommand = new ChangeGuideCommand(
+					(LogicSubpart) connectionPartMap.get(parts.get(0)), true);
+			hGuideCommand.setNewGuide(hGuide, hAlignment);
+			hGuideCommand.execute();
+		}
+
+		if (vGuide != null) {
+			vGuideCommand = new ChangeGuideCommand(
+					(LogicSubpart) connectionPartMap.get(parts.get(0)), false);
+			vGuideCommand.setNewGuide(vGuide, vAlignment);
+			vGuideCommand.execute();
+		}
+	}
+
+	public void setParent(LogicDiagram parent) {
+		this.parent = parent;
+	}
+
+	public void redo() {
+		for (Iterator iter = newTopLevelParts.iterator(); iter.hasNext();)
+			parent.addChild((LogicSubpart) iter.next());
+		for (Iterator iter = newConnections.iterator(); iter.hasNext();) {
+			Wire conn = (Wire) iter.next();
+			LogicSubpart source = conn.getSource();
+			if (connectionPartMap.containsKey(source)) {
+				conn.setSource((LogicSubpart) connectionPartMap.get(source));
+				conn.attachSource();
+				conn.attachTarget();
+			}
+		}
+		if (hGuideCommand != null)
+			hGuideCommand.redo();
+		if (vGuideCommand != null)
+			vGuideCommand.redo();
+	}
+
+	public void setGuide(LogicGuide guide, int alignment, boolean isHorizontal) {
+		if (isHorizontal) {
+			hGuide = guide;
+			hAlignment = alignment;
+		} else {
+			vGuide = guide;
+			vAlignment = alignment;
+		}
+	}
+
+	public void undo() {
+		if (hGuideCommand != null)
+			hGuideCommand.undo();
+		if (vGuideCommand != null)
+			vGuideCommand.undo();
+		for (Iterator iter = newTopLevelParts.iterator(); iter.hasNext();)
+			parent.removeChild((LogicSubpart) iter.next());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/ConnectionCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/ConnectionCommand.java
new file mode 100644
index 0000000..377c7b0
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/ConnectionCommand.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.gef.commands.Command;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+import org.eclipse.gef.examples.logicdesigner.model.Wire;
+
+public class ConnectionCommand extends Command {
+
+	protected LogicSubpart oldSource;
+	protected String oldSourceTerminal;
+	protected LogicSubpart oldTarget;
+	protected String oldTargetTerminal;
+	protected LogicSubpart source;
+	protected String sourceTerminal;
+	protected LogicSubpart target;
+	protected String targetTerminal;
+	protected Wire wire;
+
+	public ConnectionCommand() {
+		super(LogicMessages.ConnectionCommand_Label);
+	}
+
+	public boolean canExecute() {
+		if (target != null) {
+			Vector conns = target.getConnections();
+			Iterator i = conns.iterator();
+			while (i.hasNext()) {
+				Wire conn = (Wire) i.next();
+				if (targetTerminal != null && conn.getTargetTerminal() != null)
+					if (conn.getTargetTerminal().equals(targetTerminal)
+							&& conn.getTarget().equals(target))
+						return false;
+			}
+		}
+		return true;
+	}
+
+	public void execute() {
+		if (source != null) {
+			wire.detachSource();
+			wire.setSource(source);
+			wire.setSourceTerminal(sourceTerminal);
+			wire.attachSource();
+		}
+		if (target != null) {
+			wire.detachTarget();
+			wire.setTarget(target);
+			wire.setTargetTerminal(targetTerminal);
+			wire.attachTarget();
+		}
+		if (source == null && target == null) {
+			wire.detachSource();
+			wire.detachTarget();
+			wire.setTarget(null);
+			wire.setSource(null);
+		}
+	}
+
+	public String getLabel() {
+		return LogicMessages.ConnectionCommand_Description;
+	}
+
+	public LogicSubpart getSource() {
+		return source;
+	}
+
+	public java.lang.String getSourceTerminal() {
+		return sourceTerminal;
+	}
+
+	public LogicSubpart getTarget() {
+		return target;
+	}
+
+	public String getTargetTerminal() {
+		return targetTerminal;
+	}
+
+	public Wire getWire() {
+		return wire;
+	}
+
+	public void redo() {
+		execute();
+	}
+
+	public void setSource(LogicSubpart newSource) {
+		source = newSource;
+	}
+
+	public void setSourceTerminal(String newSourceTerminal) {
+		sourceTerminal = newSourceTerminal;
+	}
+
+	public void setTarget(LogicSubpart newTarget) {
+		target = newTarget;
+	}
+
+	public void setTargetTerminal(String newTargetTerminal) {
+		targetTerminal = newTargetTerminal;
+	}
+
+	public void setWire(Wire w) {
+		wire = w;
+		oldSource = w.getSource();
+		oldTarget = w.getTarget();
+		oldSourceTerminal = w.getSourceTerminal();
+		oldTargetTerminal = w.getTargetTerminal();
+	}
+
+	public void undo() {
+		source = wire.getSource();
+		target = wire.getTarget();
+		sourceTerminal = wire.getSourceTerminal();
+		targetTerminal = wire.getTargetTerminal();
+
+		wire.detachSource();
+		wire.detachTarget();
+
+		wire.setSource(oldSource);
+		wire.setTarget(oldTarget);
+		wire.setSourceTerminal(oldSourceTerminal);
+		wire.setTargetTerminal(oldTargetTerminal);
+
+		wire.attachSource();
+		wire.attachTarget();
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/CreateBendpointCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/CreateBendpointCommand.java
new file mode 100644
index 0000000..d32ea42
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/CreateBendpointCommand.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import org.eclipse.gef.examples.logicdesigner.model.WireBendpoint;
+
+public class CreateBendpointCommand extends BendpointCommand {
+
+	public void execute() {
+		WireBendpoint wbp = new WireBendpoint();
+		wbp.setRelativeDimensions(getFirstRelativeDimension(),
+				getSecondRelativeDimension());
+		getWire().insertBendpoint(getIndex(), wbp);
+		super.execute();
+	}
+
+	public void undo() {
+		super.undo();
+		getWire().removeBendpoint(getIndex());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/CreateCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/CreateCommand.java
new file mode 100644
index 0000000..46dae7a
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/CreateCommand.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.Circuit;
+import org.eclipse.gef.examples.logicdesigner.model.LED;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+
+public class CreateCommand extends org.eclipse.gef.commands.Command {
+
+	private LogicSubpart child;
+	private Rectangle rect;
+	private LogicDiagram parent;
+	private int index = -1;
+
+	public CreateCommand() {
+		super(LogicMessages.CreateCommand_Label);
+	}
+
+	public boolean canExecute() {
+		return child != null && parent != null;
+	}
+
+	public void execute() {
+		if (rect != null) {
+			Insets expansion = getInsets();
+			if (!rect.isEmpty())
+				rect.expand(expansion);
+			else {
+				rect.x -= expansion.left;
+				rect.y -= expansion.top;
+			}
+			child.setLocation(rect.getLocation());
+			if (!rect.isEmpty())
+				child.setSize(rect.getSize());
+		}
+		redo();
+	}
+
+	private Insets getInsets() {
+		if (child instanceof LED || child instanceof Circuit)
+			return new Insets(2, 0, 2, 0);
+		return new Insets();
+	}
+
+	public void redo() {
+		parent.addChild(child, index);
+	}
+
+	public void setChild(LogicSubpart subpart) {
+		child = subpart;
+	}
+
+	public void setIndex(int index) {
+		this.index = index;
+	}
+
+	public void setLocation(Rectangle r) {
+		rect = r;
+	}
+
+	public void setParent(LogicDiagram newParent) {
+		parent = newParent;
+	}
+
+	public void undo() {
+		parent.removeChild(child);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/CreateGuideCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/CreateGuideCommand.java
new file mode 100644
index 0000000..c765803
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/CreateGuideCommand.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import org.eclipse.gef.commands.Command;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.LogicGuide;
+import org.eclipse.gef.examples.logicdesigner.model.LogicRuler;
+
+/**
+ * @author Pratik Shah
+ */
+public class CreateGuideCommand extends Command {
+
+	private LogicGuide guide;
+	private LogicRuler parent;
+	private int position;
+
+	public CreateGuideCommand(LogicRuler parent, int position) {
+		super(LogicMessages.CreateGuideCommand_Label);
+		this.parent = parent;
+		this.position = position;
+	}
+
+	public boolean canUndo() {
+		return true;
+	}
+
+	public void execute() {
+		if (guide == null)
+			guide = new LogicGuide(!parent.isHorizontal());
+		guide.setPosition(position);
+		parent.addGuide(guide);
+	}
+
+	public void undo() {
+		parent.removeGuide(guide);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/DeleteBendpointCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/DeleteBendpointCommand.java
new file mode 100644
index 0000000..614ba17
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/DeleteBendpointCommand.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import org.eclipse.draw2d.Bendpoint;
+
+public class DeleteBendpointCommand extends BendpointCommand {
+
+	private Bendpoint bendpoint;
+
+	public void execute() {
+		bendpoint = (Bendpoint) getWire().getBendpoints().get(getIndex());
+		getWire().removeBendpoint(getIndex());
+		super.execute();
+	}
+
+	public void undo() {
+		super.undo();
+		getWire().insertBendpoint(getIndex(), bendpoint);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/DeleteCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/DeleteCommand.java
new file mode 100644
index 0000000..eabd09e
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/DeleteCommand.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.commands.Command;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicGuide;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+import org.eclipse.gef.examples.logicdesigner.model.Wire;
+
+public class DeleteCommand extends Command {
+
+	private LogicSubpart child;
+	private LogicDiagram parent;
+	private LogicGuide vGuide, hGuide;
+	private int vAlign, hAlign;
+	private int index = -1;
+	private List sourceConnections = new ArrayList();
+	private List targetConnections = new ArrayList();
+
+	public DeleteCommand() {
+		super(LogicMessages.DeleteCommand_Label);
+	}
+
+	private void deleteConnections(LogicSubpart part) {
+		if (part instanceof LogicDiagram) {
+			List children = ((LogicDiagram) part).getChildren();
+			for (int i = 0; i < children.size(); i++)
+				deleteConnections((LogicSubpart) children.get(i));
+		}
+		sourceConnections.addAll(part.getSourceConnections());
+		for (int i = 0; i < sourceConnections.size(); i++) {
+			Wire wire = (Wire) sourceConnections.get(i);
+			wire.detachSource();
+			wire.detachTarget();
+		}
+		targetConnections.addAll(part.getTargetConnections());
+		for (int i = 0; i < targetConnections.size(); i++) {
+			Wire wire = (Wire) targetConnections.get(i);
+			wire.detachSource();
+			wire.detachTarget();
+		}
+	}
+
+	private void detachFromGuides(LogicSubpart part) {
+		if (part.getVerticalGuide() != null) {
+			vGuide = part.getVerticalGuide();
+			vAlign = vGuide.getAlignment(part);
+			vGuide.detachPart(part);
+		}
+		if (part.getHorizontalGuide() != null) {
+			hGuide = part.getHorizontalGuide();
+			hAlign = hGuide.getAlignment(part);
+			hGuide.detachPart(part);
+		}
+
+	}
+
+	public void execute() {
+		primExecute();
+	}
+
+	protected void primExecute() {
+		deleteConnections(child);
+		detachFromGuides(child);
+		index = parent.getChildren().indexOf(child);
+		parent.removeChild(child);
+	}
+
+	private void reattachToGuides(LogicSubpart part) {
+		if (vGuide != null)
+			vGuide.attachPart(part, vAlign);
+		if (hGuide != null)
+			hGuide.attachPart(part, hAlign);
+	}
+
+	public void redo() {
+		primExecute();
+	}
+
+	private void restoreConnections() {
+		for (int i = 0; i < sourceConnections.size(); i++) {
+			Wire wire = (Wire) sourceConnections.get(i);
+			wire.attachSource();
+			wire.attachTarget();
+		}
+		sourceConnections.clear();
+		for (int i = 0; i < targetConnections.size(); i++) {
+			Wire wire = (Wire) targetConnections.get(i);
+			wire.attachSource();
+			wire.attachTarget();
+		}
+		targetConnections.clear();
+	}
+
+	public void setChild(LogicSubpart c) {
+		child = c;
+	}
+
+	public void setParent(LogicDiagram p) {
+		parent = p;
+	}
+
+	public void undo() {
+		parent.addChild(child, index);
+		restoreConnections();
+		reattachToGuides(child);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/DeleteGuideCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/DeleteGuideCommand.java
new file mode 100644
index 0000000..670ad7e
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/DeleteGuideCommand.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.gef.commands.Command;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.LogicGuide;
+import org.eclipse.gef.examples.logicdesigner.model.LogicRuler;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+
+/**
+ * @author Pratik Shah
+ */
+public class DeleteGuideCommand extends Command {
+
+	private LogicRuler parent;
+	private LogicGuide guide;
+	private Map oldParts;
+
+	public DeleteGuideCommand(LogicGuide guide, LogicRuler parent) {
+		super(LogicMessages.DeleteGuideCommand_Label);
+		this.guide = guide;
+		this.parent = parent;
+	}
+
+	public boolean canUndo() {
+		return true;
+	}
+
+	public void execute() {
+		oldParts = new HashMap(guide.getMap());
+		Iterator iter = oldParts.keySet().iterator();
+		while (iter.hasNext()) {
+			guide.detachPart((LogicSubpart) iter.next());
+		}
+		parent.removeGuide(guide);
+	}
+
+	public void undo() {
+		parent.addGuide(guide);
+		Iterator iter = oldParts.keySet().iterator();
+		while (iter.hasNext()) {
+			LogicSubpart part = (LogicSubpart) iter.next();
+			guide.attachPart(part, ((Integer) oldParts.get(part)).intValue());
+		}
+	}
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/LogicLabelCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/LogicLabelCommand.java
new file mode 100644
index 0000000..72acd3d
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/LogicLabelCommand.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import org.eclipse.gef.commands.Command;
+
+import org.eclipse.gef.examples.logicdesigner.model.LogicLabel;
+
+public class LogicLabelCommand extends Command {
+
+	private String newName, oldName;
+	private LogicLabel label;
+
+	public LogicLabelCommand(LogicLabel l, String s) {
+		label = l;
+		if (s != null)
+			newName = s;
+		else
+			newName = ""; //$NON-NLS-1$
+	}
+
+	public void execute() {
+		oldName = label.getLabelContents();
+		label.setLabelContents(newName);
+	}
+
+	public void undo() {
+		label.setLabelContents(oldName);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/MoveBendpointCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/MoveBendpointCommand.java
new file mode 100644
index 0000000..2a8ded8
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/MoveBendpointCommand.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import org.eclipse.draw2d.Bendpoint;
+
+import org.eclipse.gef.examples.logicdesigner.model.WireBendpoint;
+
+public class MoveBendpointCommand extends BendpointCommand {
+
+	private Bendpoint oldBendpoint;
+
+	public void execute() {
+		WireBendpoint bp = new WireBendpoint();
+		bp.setRelativeDimensions(getFirstRelativeDimension(),
+				getSecondRelativeDimension());
+		setOldBendpoint((Bendpoint) getWire().getBendpoints().get(getIndex()));
+		getWire().setBendpoint(getIndex(), bp);
+		super.execute();
+	}
+
+	protected Bendpoint getOldBendpoint() {
+		return oldBendpoint;
+	}
+
+	public void setOldBendpoint(Bendpoint bp) {
+		oldBendpoint = bp;
+	}
+
+	public void undo() {
+		super.undo();
+		getWire().setBendpoint(getIndex(), getOldBendpoint());
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/MoveGuideCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/MoveGuideCommand.java
new file mode 100644
index 0000000..b92e244
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/MoveGuideCommand.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import java.util.Iterator;
+
+import org.eclipse.draw2d.geometry.Point;
+
+import org.eclipse.gef.commands.Command;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.LogicGuide;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+
+/**
+ * @author Pratik Shah
+ */
+public class MoveGuideCommand extends Command {
+
+	private int pDelta;
+	private LogicGuide guide;
+
+	public MoveGuideCommand(LogicGuide guide, int positionDelta) {
+		super(LogicMessages.MoveGuideCommand_Label);
+		this.guide = guide;
+		pDelta = positionDelta;
+	}
+
+	public void execute() {
+		guide.setPosition(guide.getPosition() + pDelta);
+		Iterator iter = guide.getParts().iterator();
+		while (iter.hasNext()) {
+			LogicSubpart part = (LogicSubpart) iter.next();
+			Point location = part.getLocation().getCopy();
+			if (guide.isHorizontal()) {
+				location.y += pDelta;
+			} else {
+				location.x += pDelta;
+			}
+			part.setLocation(location);
+		}
+	}
+
+	public void undo() {
+		guide.setPosition(guide.getPosition() - pDelta);
+		Iterator iter = guide.getParts().iterator();
+		while (iter.hasNext()) {
+			LogicSubpart part = (LogicSubpart) iter.next();
+			Point location = part.getLocation().getCopy();
+			if (guide.isHorizontal()) {
+				location.y -= pDelta;
+			} else {
+				location.x -= pDelta;
+			}
+			part.setLocation(location);
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/OrphanChildCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/OrphanChildCommand.java
new file mode 100644
index 0000000..e1caf4b
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/OrphanChildCommand.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Point;
+
+import org.eclipse.gef.commands.Command;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+
+public class OrphanChildCommand extends Command {
+
+	private Point oldLocation;
+	private LogicDiagram diagram;
+	private LogicSubpart child;
+	private int index;
+
+	public OrphanChildCommand() {
+		super(LogicMessages.OrphanChildCommand_Label);
+	}
+
+	public void execute() {
+		List children = diagram.getChildren();
+		index = children.indexOf(child);
+		oldLocation = child.getLocation();
+		diagram.removeChild(child);
+	}
+
+	public void redo() {
+		diagram.removeChild(child);
+	}
+
+	public void setChild(LogicSubpart child) {
+		this.child = child;
+	}
+
+	public void setParent(LogicDiagram parent) {
+		diagram = parent;
+	}
+
+	public void undo() {
+		child.setLocation(oldLocation);
+		diagram.addChild(child, index);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/ReorderPartCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/ReorderPartCommand.java
new file mode 100644
index 0000000..b3b2884
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/ReorderPartCommand.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import org.eclipse.gef.commands.Command;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.LogicDiagram;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+
+public class ReorderPartCommand extends Command {
+
+	private int oldIndex, newIndex;
+	private LogicSubpart child;
+	private LogicDiagram parent;
+
+	public ReorderPartCommand(LogicSubpart child, LogicDiagram parent,
+			int newIndex) {
+		super(LogicMessages.ReorderPartCommand_Label);
+		this.child = child;
+		this.parent = parent;
+		this.newIndex = newIndex;
+	}
+
+	public void execute() {
+		oldIndex = parent.getChildren().indexOf(child);
+		parent.removeChild(child);
+		parent.addChild(child, newIndex);
+	}
+
+	public void undo() {
+		parent.removeChild(child);
+		parent.addChild(child, oldIndex);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/SetConstraintCommand.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/SetConstraintCommand.java
new file mode 100644
index 0000000..af155e1
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/commands/SetConstraintCommand.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.model.commands;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.examples.logicdesigner.LogicMessages;
+import org.eclipse.gef.examples.logicdesigner.model.LogicSubpart;
+
+public class SetConstraintCommand extends org.eclipse.gef.commands.Command {
+
+	private Point newPos;
+	private Dimension newSize;
+	private Point oldPos;
+	private Dimension oldSize;
+	private LogicSubpart part;
+
+	public void execute() {
+		oldSize = part.getSize();
+		oldPos = part.getLocation();
+		redo();
+	}
+
+	public String getLabel() {
+		if (oldSize.equals(newSize))
+			return LogicMessages.SetLocationCommand_Label_Location;
+		return LogicMessages.SetLocationCommand_Label_Resize;
+	}
+
+	public void redo() {
+		part.setSize(newSize);
+		part.setLocation(newPos);
+	}
+
+	public void setLocation(Rectangle r) {
+		setLocation(r.getLocation());
+		setSize(r.getSize());
+	}
+
+	public void setLocation(Point p) {
+		newPos = p;
+	}
+
+	public void setPart(LogicSubpart part) {
+		this.part = part;
+	}
+
+	public void setSize(Dimension p) {
+		newSize = p;
+	}
+
+	public void undo() {
+		part.setSize(oldSize);
+		part.setLocation(oldPos);
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/and16.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/and16.gif
new file mode 100644
index 0000000..8e0282f
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/and16.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/and24.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/and24.gif
new file mode 100644
index 0000000..6e85b51
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/and24.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/arrow16.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/arrow16.gif
new file mode 100644
index 0000000..62ecc99
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/arrow16.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/arrow24.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/arrow24.gif
new file mode 100644
index 0000000..3d57241
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/arrow24.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/can.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/can.gif
new file mode 100644
index 0000000..529ddc5
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/can.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/circuit16.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/circuit16.gif
new file mode 100644
index 0000000..cb61f54
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/circuit16.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/circuit24.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/circuit24.gif
new file mode 100644
index 0000000..496eabd
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/circuit24.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/comp.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/comp.gif
new file mode 100644
index 0000000..0a62f18
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/comp.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/connection16.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/connection16.gif
new file mode 100644
index 0000000..ad8a17b
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/connection16.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/connection24.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/connection24.gif
new file mode 100644
index 0000000..6e7b81b
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/connection24.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/fulladder16.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/fulladder16.gif
new file mode 100644
index 0000000..6b47d44
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/fulladder16.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/fulladder24.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/fulladder24.gif
new file mode 100644
index 0000000..c47b60e
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/fulladder24.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/ground16.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/ground16.gif
new file mode 100644
index 0000000..5096fa9
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/ground16.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/ground24.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/ground24.gif
new file mode 100644
index 0000000..b28bc17
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/ground24.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/halfadder16.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/halfadder16.gif
new file mode 100644
index 0000000..176f369
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/halfadder16.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/halfadder24.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/halfadder24.gif
new file mode 100644
index 0000000..06d881f
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/halfadder24.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/label16.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/label16.gif
new file mode 100644
index 0000000..8a62aea
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/label16.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/label24.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/label24.gif
new file mode 100644
index 0000000..0c5265f
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/label24.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/ledicon16.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/ledicon16.gif
new file mode 100644
index 0000000..b35c29f
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/ledicon16.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/ledicon24.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/ledicon24.gif
new file mode 100644
index 0000000..7c8d52d
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/ledicon24.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/live16.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/live16.gif
new file mode 100644
index 0000000..a05d5cf
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/live16.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/live24.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/live24.gif
new file mode 100644
index 0000000..458bb59
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/live24.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/logicflow16.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/logicflow16.gif
new file mode 100644
index 0000000..4a56bb7
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/logicflow16.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/logicflow24.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/logicflow24.gif
new file mode 100644
index 0000000..9bcd3c9
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/logicflow24.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/or16.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/or16.gif
new file mode 100644
index 0000000..b7205e0
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/or16.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/or24.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/or24.gif
new file mode 100644
index 0000000..a8f0657
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/or24.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/xor16.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/xor16.gif
new file mode 100644
index 0000000..05f79f0
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/xor16.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/xor24.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/xor24.gif
new file mode 100644
index 0000000..900c731
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/xor24.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/zoomminus.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/zoomminus.gif
new file mode 100644
index 0000000..952bdbf
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/zoomminus.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/zoomplus.gif b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/zoomplus.gif
new file mode 100644
index 0000000..43df9cc
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/model/icons/zoomplus.gif
Binary files differ
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/palette/LogicPaletteCustomizer.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/palette/LogicPaletteCustomizer.java
new file mode 100644
index 0000000..53c9dc4
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/palette/LogicPaletteCustomizer.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.palette;
+
+import org.eclipse.gef.ui.palette.PaletteCustomizer;
+
+/**
+ * PaletteCustomizer for the logic example.
+ * 
+ * @author Pratik Shah
+ */
+public class LogicPaletteCustomizer extends PaletteCustomizer {
+
+	/**
+	 * @see org.eclipse.gef.ui.palette.PaletteCustomizer#revertToSaved()
+	 */
+	public void revertToSaved() {
+	}
+
+	/**
+	 * @see org.eclipse.gef.ui.palette.PaletteCustomizer#save()
+	 */
+	public void save() {
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/rulers/LogicRulerProvider.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/rulers/LogicRulerProvider.java
new file mode 100644
index 0000000..b0c9c3c
--- /dev/null
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/gef/examples/logicdesigner/rulers/LogicRulerProvider.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.gef.examples.logicdesigner.rulers;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.rulers.RulerChangeListener;
+import org.eclipse.gef.rulers.RulerProvider;
+
+import org.eclipse.gef.examples.logicdesigner.model.LogicGuide;
+import org.eclipse.gef.examples.logicdesigner.model.LogicRuler;
+import org.eclipse.gef.examples.logicdesigner.model.commands.CreateGuideCommand;
+import org.eclipse.gef.examples.logicdesigner.model.commands.DeleteGuideCommand;
+import org.eclipse.gef.examples.logicdesigner.model.commands.MoveGuideCommand;
+
+/**
+ * @author Pratik Shah
+ */
+public class LogicRulerProvider extends RulerProvider {
+
+	private LogicRuler ruler;
+	private PropertyChangeListener rulerListener = new PropertyChangeListener() {
+		public void propertyChange(PropertyChangeEvent evt) {
+			if (evt.getPropertyName().equals(LogicRuler.PROPERTY_CHILDREN)) {
+				LogicGuide guide = (LogicGuide) evt.getNewValue();
+				if (getGuides().contains(guide)) {
+					guide.addPropertyChangeListener(guideListener);
+				} else {
+					guide.removePropertyChangeListener(guideListener);
+				}
+				for (int i = 0; i < listeners.size(); i++) {
+					((RulerChangeListener) listeners.get(i))
+							.notifyGuideReparented(guide);
+				}
+			} else {
+				for (int i = 0; i < listeners.size(); i++) {
+					((RulerChangeListener) listeners.get(i))
+							.notifyUnitsChanged(ruler.getUnit());
+				}
+			}
+		}
+	};
+	private PropertyChangeListener guideListener = new PropertyChangeListener() {
+		public void propertyChange(PropertyChangeEvent evt) {
+			if (evt.getPropertyName().equals(LogicGuide.PROPERTY_CHILDREN)) {
+				for (int i = 0; i < listeners.size(); i++) {
+					((RulerChangeListener) listeners.get(i))
+							.notifyPartAttachmentChanged(evt.getNewValue(),
+									evt.getSource());
+				}
+			} else {
+				for (int i = 0; i < listeners.size(); i++) {
+					((RulerChangeListener) listeners.get(i))
+							.notifyGuideMoved(evt.getSource());
+				}
+			}
+		}
+	};
+
+	public LogicRulerProvider(LogicRuler ruler) {
+		this.ruler = ruler;
+		this.ruler.addPropertyChangeListener(rulerListener);
+		List guides = getGuides();
+		for (int i = 0; i < guides.size(); i++) {
+			((LogicGuide) guides.get(i))
+					.addPropertyChangeListener(guideListener);
+		}
+	}
+
+	public List getAttachedModelObjects(Object guide) {
+		return new ArrayList(((LogicGuide) guide).getParts());
+	}
+
+	public Command getCreateGuideCommand(int position) {
+		return new CreateGuideCommand(ruler, position);
+	}
+
+	public Command getDeleteGuideCommand(Object guide) {
+		return new DeleteGuideCommand((LogicGuide) guide, ruler);
+	}
+
+	public Command getMoveGuideCommand(Object guide, int pDelta) {
+		return new MoveGuideCommand((LogicGuide) guide, pDelta);
+	}
+
+	public int[] getGuidePositions() {
+		List guides = getGuides();
+		int[] result = new int[guides.size()];
+		for (int i = 0; i < guides.size(); i++) {
+			result[i] = ((LogicGuide) guides.get(i)).getPosition();
+		}
+		return result;
+	}
+
+	public Object getRuler() {
+		return ruler;
+	}
+
+	public int getUnit() {
+		return ruler.getUnit();
+	}
+
+	public void setUnit(int newUnit) {
+		ruler.setUnit(newUnit);
+	}
+
+	public int getGuidePosition(Object guide) {
+		return ((LogicGuide) guide).getPosition();
+	}
+
+	public List getGuides() {
+		return ruler.getGuides();
+	}
+
+}
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/rap/gef/demo/Application.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/rap/gef/demo/Application.java
index 4c6c0e0..ddcf7f6 100644
--- a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/rap/gef/demo/Application.java
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/rap/gef/demo/Application.java
@@ -30,6 +30,7 @@
 import org.eclipse.draw2d.examples.tree.SimpleTreeExample;
 import org.eclipse.draw2d.examples.tree.TreeExample;
 import org.eclipse.gef.examples.flow.ui.FlowEditorView;
+import org.eclipse.gef.examples.logicdesigner.LogicEditorView;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.IStructuredSelection;
@@ -127,7 +128,12 @@
   
   public static class FlowExampleView extends FlowEditorView 
   {
-    
+    //further implementation coming    
+  }
+  
+  public static class LogicExampleView extends LogicEditorView 
+  {
+   //further implementation coming 
   }
   
 }
diff --git a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/rap/gef/demo/TimelineEditorInput.java b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/rap/gef/demo/DirectEditorInput.java
similarity index 96%
rename from bundles/org.eclipse.rap.gef.demo/src/org/eclipse/rap/gef/demo/TimelineEditorInput.java
rename to bundles/org.eclipse.rap.gef.demo/src/org/eclipse/rap/gef/demo/DirectEditorInput.java
index 61b32fd..01fa4e2 100644
--- a/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/rap/gef/demo/TimelineEditorInput.java
+++ b/bundles/org.eclipse.rap.gef.demo/src/org/eclipse/rap/gef/demo/DirectEditorInput.java
@@ -24,7 +24,7 @@
  * @author Austin.Riddle
  *
  */
-public class TimelineEditorInput implements IEditorInput {
+public class DirectEditorInput implements IEditorInput {
 
     ActivityDiagram model = null;
     String name = "Activity Diagram Model";