Commits

af08018  committed 7de2e0d

Drawing arcs between similar ports are now allowed

  • Participants
  • Parent commits 6d68a78

Comments (0)

Files changed (30)

File src/modelicons/big/code_fragment.gif

Added
New image

File src/modelicons/big/label.gif

Removed
Old image

File src/modelicons/normal/code_fragment.gif

Added
New image

File src/modelicons/normal/label.gif

Removed
Old image

File src/nl/tudelft/lime/LimePlugin.java

 
 import nl.tudelft.lime.constants.LimeMessages;
 import nl.tudelft.lime.constants.SystemSettings;
-import nl.tudelft.lime.model.LimeLabel;
+import nl.tudelft.lime.model.LimeCodeFragment;
 import nl.tudelft.lime.model.arc.Arc;
 import nl.tudelft.lime.model.arc.Association;
 import nl.tudelft.lime.model.component.LimeComponent;
         //previously it was stored as a serialized object, but now the default type is XML
                 combined = new CombinedTemplateCreationEntry(LimeMessages.LimePlugin_Tool_CreationTool_Label_Label,
                         LimeMessages.LimePlugin_Tool_CreationTool_Label_Description,
-                        new SimpleFactory(LimeLabel.class),
+                        new SimpleFactory(LimeCodeFragment.class),
                         ImageDescriptor.createFromFile(LimeComponent.class,
-                            SystemSettings.Label_Normal_Icon_Path),
+                            SystemSettings.Code_Fragment_Normal_Icon_Path),
                         ImageDescriptor.createFromFile(LimeComponent.class,
-                            SystemSettings.Label_Big_Icon_Path));
+                            SystemSettings.Code_Fragment_Big_Icon_Path));
                 entries.add(combined);
         drawer.addAll(entries);
 

File src/nl/tudelft/lime/constants/SystemSettings.java

     public static final String Output_Port_Normal_Icon_Path = "/modelicons/normal/output.gif";
     public static final String Arc_Normal_Icon_Path = "/modelicons/normal/connection.gif";
     public static final String Association_Normal_Icon_Path = "/modelicons/normal/association.gif";
-    public static final String Label_Normal_Icon_Path = "/modelicons/normal/label.gif";
+    public static final String Code_Fragment_Normal_Icon_Path = "/modelicons/normal/code_fragment.gif";
 
     //Big Icons Path
     public static final String Component_Big_Icon_Path = "/modelicons/big/component.gif";
     public static final String Output_Port_Big_Icon_Path = "/modelicons/big/output.gif";
     public static final String Arc_Big_Icon_Path = "/modelicons/big/connection.gif";
     public static final String Association_Big_Icon_Path = "/modelicons/big/association.gif";
-    public static final String Label_Big_Icon_Path = "/modelicons/big/label.gif";
+    public static final String Code_Fragment_Big_Icon_Path = "/modelicons/big/code_fragment.gif";
 
     //other Icons
     public static final String Component_Menu_Icon_Path = "/modelicons/others/comp.gif";

File src/nl/tudelft/lime/dnd/FileTransferDragSourceListener.java

  *******************************************************************************/
 package nl.tudelft.lime.dnd;
 
-import nl.tudelft.lime.edit.editpart.LimeLabelEditPart;
+import nl.tudelft.lime.edit.editpart.LimeCodeFragmentEditPart;
 
 import org.eclipse.gef.EditPartViewer;
 
     }
 
     public void dragStart(DragSourceEvent event) {
-        if (getViewer().getSelectedEditParts().get(0) instanceof LimeLabelEditPart) {
+        if (getViewer().getSelectedEditParts().get(0) instanceof LimeCodeFragmentEditPart) {
             return;
         }
 

File src/nl/tudelft/lime/edit/CodeFragmentCellEditorLocator.java

+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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 nl.tudelft.lime.edit;
+
+import nl.tudelft.lime.figures.StickyNoteFigure;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.tools.CellEditorLocator;
+
+import org.eclipse.jface.viewers.CellEditor;
+
+import org.eclipse.swt.widgets.Text;
+
+
+final public class CodeFragmentCellEditorLocator implements CellEditorLocator {
+    private StickyNoteFigure stickyNote;
+
+    public CodeFragmentCellEditorLocator(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;
+    }
+}

File src/nl/tudelft/lime/edit/GraphicalPartFactory.java

 import nl.tudelft.lime.edit.editpart.AssociationEditPart;
 import nl.tudelft.lime.edit.editpart.ComponentEditPart;
 import nl.tudelft.lime.edit.editpart.LimeDiagramEditPart;
-import nl.tudelft.lime.edit.editpart.LimeLabelEditPart;
+import nl.tudelft.lime.edit.editpart.LimeCodeFragmentEditPart;
 import nl.tudelft.lime.edit.editpart.PortEditPart;
 import nl.tudelft.lime.model.LimeDiagram;
-import nl.tudelft.lime.model.LimeLabel;
+import nl.tudelft.lime.model.LimeCodeFragment;
 import nl.tudelft.lime.model.arc.Arc;
 import nl.tudelft.lime.model.arc.Association;
 import nl.tudelft.lime.model.component.LimeComponent;
             child = new ArcEditPart();
         } else if (model instanceof Association) {
             child = new AssociationEditPart();
-        } else if (model instanceof LimeLabel) {
-            child = new LimeLabelEditPart();
+        } else if (model instanceof LimeCodeFragment) {
+            child = new LimeCodeFragmentEditPart();
         } else if (model instanceof LimeComponent) {
             child = new ComponentEditPart();
         } else if (model instanceof Port) {

File src/nl/tudelft/lime/edit/LabelCellEditorLocator.java

-/*******************************************************************************
- * Copyright (c) 2000, 2005 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 nl.tudelft.lime.edit;
-
-import nl.tudelft.lime.figures.StickyNoteFigure;
-
-import org.eclipse.draw2d.geometry.Rectangle;
-
-import org.eclipse.gef.tools.CellEditorLocator;
-
-import org.eclipse.jface.viewers.CellEditor;
-
-import org.eclipse.swt.widgets.Text;
-
-
-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;
-    }
-}

File src/nl/tudelft/lime/edit/LimeCodeFragmentEditManager.java

+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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 nl.tudelft.lime.edit;
+
+import nl.tudelft.lime.figures.StickyNoteFigure;
+
+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.jface.action.IAction;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.TextCellEditor;
+
+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.ui.IActionBars;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.part.CellEditorActionHandler;
+
+
+public class LimeCodeFragmentEditManager extends DirectEditManager {
+    private IActionBars actionBars;
+    private CellEditorActionHandler actionHandler;
+    private IAction copy;
+    private IAction cut;
+    private IAction paste;
+    private IAction undo;
+    private IAction redo;
+    private IAction find;
+    private IAction selectAll;
+    private IAction delete;
+    private double cachedZoom = -1.0;
+    private Font scaledFont;
+    private ZoomListener zoomListener = new ZoomListener() {
+            public void zoomChanged(double newZoom) {
+                updateScaledFont(newZoom);
+            }
+        };
+
+    public LimeCodeFragmentEditManager(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));
+        }
+    }
+}

File src/nl/tudelft/lime/edit/LimeLabelEditManager.java

-/*******************************************************************************
- * Copyright (c) 2000, 2005 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 nl.tudelft.lime.edit;
-
-import nl.tudelft.lime.figures.StickyNoteFigure;
-
-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.jface.action.IAction;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.TextCellEditor;
-
-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.ui.IActionBars;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.part.CellEditorActionHandler;
-
-
-public class LimeLabelEditManager extends DirectEditManager {
-    private IActionBars actionBars;
-    private CellEditorActionHandler actionHandler;
-    private IAction copy;
-    private IAction cut;
-    private IAction paste;
-    private IAction undo;
-    private IAction redo;
-    private IAction find;
-    private IAction selectAll;
-    private IAction delete;
-    private double cachedZoom = -1.0;
-    private Font scaledFont;
-    private ZoomListener zoomListener = new ZoomListener() {
-            public void zoomChanged(double newZoom) {
-                updateScaledFont(newZoom);
-            }
-        };
-
-    public LimeLabelEditManager(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));
-        }
-    }
-}

File src/nl/tudelft/lime/edit/editpart/LimeCodeFragmentEditPart.java

+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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 nl.tudelft.lime.edit.editpart;
+
+import nl.tudelft.lime.constants.LimeMessages;
+import nl.tudelft.lime.edit.CodeFragmentCellEditorLocator;
+import nl.tudelft.lime.edit.LimeCodeFragmentEditManager;
+import nl.tudelft.lime.edit.policy.CodeFragmentDirectEditPolicy;
+import nl.tudelft.lime.edit.policy.CodeFragmentEditPolicy;
+import nl.tudelft.lime.figures.StickyNoteFigure;
+import nl.tudelft.lime.model.LimeCodeFragment;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+
+import org.eclipse.swt.accessibility.AccessibleControlEvent;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+
+import java.beans.PropertyChangeEvent;
+
+
+public class LimeCodeFragmentEditPart extends LimeEditPart {
+    protected AccessibleEditPart createAccessible() {
+        return new AccessibleGraphicalEditPart() {
+                public void getValue(AccessibleControlEvent e) {
+                    e.result = getLimeLabel().getLabelContents();
+                }
+
+                public void getName(AccessibleEvent e) {
+                    e.result = LimeMessages.LimePlugin_Tool_CreationTool_LimeLabel;
+                }
+            };
+    }
+
+    protected void createEditPolicies() {
+        super.createEditPolicies();
+        installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
+        installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE,
+            new CodeFragmentDirectEditPolicy());
+        installEditPolicy(EditPolicy.COMPONENT_ROLE, new CodeFragmentEditPolicy());
+    }
+
+    protected IFigure createFigure() {
+        StickyNoteFigure label = new StickyNoteFigure();
+        label.setSize(new Dimension(150, 50));
+
+        return label;
+    }
+
+    private LimeCodeFragment getLimeLabel() {
+        return (LimeCodeFragment) getModel();
+    }
+
+    private void performDirectEdit() {
+        new LimeCodeFragmentEditManager(this,
+            new CodeFragmentCellEditorLocator((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(getLimeLabel()
+                                                     .getLabelContents());
+        super.refreshVisuals();
+    }
+}

File src/nl/tudelft/lime/edit/editpart/LimeLabelEditPart.java

-/*******************************************************************************
- * Copyright (c) 2000, 2005 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 nl.tudelft.lime.edit.editpart;
-
-import nl.tudelft.lime.constants.LimeMessages;
-import nl.tudelft.lime.edit.LabelCellEditorLocator;
-import nl.tudelft.lime.edit.LimeLabelEditManager;
-import nl.tudelft.lime.edit.policy.LabelDirectEditPolicy;
-import nl.tudelft.lime.edit.policy.LabelEditPolicy;
-import nl.tudelft.lime.figures.StickyNoteFigure;
-import nl.tudelft.lime.model.LimeLabel;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-
-import org.eclipse.swt.accessibility.AccessibleControlEvent;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-
-import java.beans.PropertyChangeEvent;
-
-
-public class LimeLabelEditPart extends LimeEditPart {
-    protected AccessibleEditPart createAccessible() {
-        return new AccessibleGraphicalEditPart() {
-                public void getValue(AccessibleControlEvent e) {
-                    e.result = getLimeLabel().getLabelContents();
-                }
-
-                public void getName(AccessibleEvent e) {
-                    e.result = LimeMessages.LimePlugin_Tool_CreationTool_LimeLabel;
-                }
-            };
-    }
-
-    protected void createEditPolicies() {
-        super.createEditPolicies();
-        installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
-        installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE,
-            new LabelDirectEditPolicy());
-        installEditPolicy(EditPolicy.COMPONENT_ROLE, new LabelEditPolicy());
-    }
-
-    protected IFigure createFigure() {
-        StickyNoteFigure label = new StickyNoteFigure();
-        label.setSize(new Dimension(150, 50));
-
-        return label;
-    }
-
-    private LimeLabel getLimeLabel() {
-        return (LimeLabel) getModel();
-    }
-
-    private void performDirectEdit() {
-        new LimeLabelEditManager(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(getLimeLabel()
-                                                     .getLabelContents());
-        super.refreshVisuals();
-    }
-}

File src/nl/tudelft/lime/edit/policy/CodeFragmentDirectEditPolicy.java

+package nl.tudelft.lime.edit.policy;
+
+import nl.tudelft.lime.edit.editpart.LimeCodeFragmentEditPart;
+import nl.tudelft.lime.figures.StickyNoteFigure;
+import nl.tudelft.lime.model.LimeCodeFragment;
+import nl.tudelft.lime.model.commands.LimeCodeFragmentCommand;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.DirectEditPolicy;
+import org.eclipse.gef.requests.DirectEditRequest;
+
+
+/**
+ * {@link CodeFragmentDirectEditPolicy} is used when you want to
+ * edit a label text directly
+ * @author mazaninfardi
+ * based on IBM 'Logic Designer' exmaple
+ */
+public class CodeFragmentDirectEditPolicy extends DirectEditPolicy {
+    /**
+     * This command is called when you single click on a Label
+     * @see DirectEditPolicy#getDirectEditCommand(DirectEditRequest)
+     */
+    protected Command getDirectEditCommand(DirectEditRequest edit) {
+        String labelText = (String) edit.getCellEditor().getValue();
+        LimeCodeFragmentEditPart label = (LimeCodeFragmentEditPart) getHost();
+        LimeCodeFragmentCommand command = new LimeCodeFragmentCommand((LimeCodeFragment) 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();
+    }
+}

File src/nl/tudelft/lime/edit/policy/CodeFragmentEditPolicy.java

+package nl.tudelft.lime.edit.policy;
+
+import nl.tudelft.lime.edit.NativeDropRequest;
+import nl.tudelft.lime.model.LimeCodeFragment;
+import nl.tudelft.lime.model.commands.LimeCodeFragmentCommand;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+
+
+/**
+ * {@link CodeFragmentEditPolicy} is used when you want to edit the label
+ * by clicking on rename from the context menu
+ * @author mazaninfardi
+ *
+ */
+public class CodeFragmentEditPolicy extends ElementEditPolicy {
+    public Command getCommand(Request request) {
+        if (NativeDropRequest.ID.equals(request.getType())) {
+            return getDropTextCommand((NativeDropRequest) request);
+        }
+
+        return super.getCommand(request);
+    }
+
+    protected Command getDropTextCommand(NativeDropRequest request) {
+        LimeCodeFragmentCommand command = new LimeCodeFragmentCommand((LimeCodeFragment) getHost()
+                                                                        .getModel(),
+                (String) request.getData());
+
+        return command;
+    }
+
+    public EditPart getTargetEditPart(Request request) {
+        if (NativeDropRequest.ID.equals(request.getType())) {
+            return getHost();
+        }
+
+        return super.getTargetEditPart(request);
+    }
+}

File src/nl/tudelft/lime/edit/policy/LabelDirectEditPolicy.java

-package nl.tudelft.lime.edit.policy;
-
-import nl.tudelft.lime.edit.editpart.LimeLabelEditPart;
-import nl.tudelft.lime.figures.StickyNoteFigure;
-import nl.tudelft.lime.model.LimeLabel;
-import nl.tudelft.lime.model.commands.LimeLabelCommand;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.DirectEditPolicy;
-import org.eclipse.gef.requests.DirectEditRequest;
-
-
-/**
- * {@link LabelDirectEditPolicy} is used when you want to
- * edit a label text directly
- * @author mazaninfardi
- * based on IBM 'Logic Designer' exmaple
- */
-public class LabelDirectEditPolicy extends DirectEditPolicy {
-    /**
-     * This command is called when you single click on a Label
-     * @see DirectEditPolicy#getDirectEditCommand(DirectEditRequest)
-     */
-    protected Command getDirectEditCommand(DirectEditRequest edit) {
-        String labelText = (String) edit.getCellEditor().getValue();
-        LimeLabelEditPart label = (LimeLabelEditPart) getHost();
-        LimeLabelCommand command = new LimeLabelCommand((LimeLabel) 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();
-    }
-}

File src/nl/tudelft/lime/edit/policy/LabelEditPolicy.java

-package nl.tudelft.lime.edit.policy;
-
-import nl.tudelft.lime.edit.NativeDropRequest;
-import nl.tudelft.lime.model.LimeLabel;
-import nl.tudelft.lime.model.commands.LimeLabelCommand;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-
-
-/**
- * {@link LabelEditPolicy} is used when you want to edit the label
- * by clicking on rename from the context menu
- * @author mazaninfardi
- *
- */
-public class LabelEditPolicy extends ElementEditPolicy {
-    public Command getCommand(Request request) {
-        if (NativeDropRequest.ID.equals(request.getType())) {
-            return getDropTextCommand((NativeDropRequest) request);
-        }
-
-        return super.getCommand(request);
-    }
-
-    protected Command getDropTextCommand(NativeDropRequest request) {
-        LimeLabelCommand command = new LimeLabelCommand((LimeLabel) getHost()
-                                                                        .getModel(),
-                (String) request.getData());
-
-        return command;
-    }
-
-    public EditPart getTargetEditPart(Request request) {
-        if (NativeDropRequest.ID.equals(request.getType())) {
-            return getHost();
-        }
-
-        return super.getTargetEditPart(request);
-    }
-}

File src/nl/tudelft/lime/edit/policy/LimeXYLayoutEditPolicy.java

 import java.util.List;
 
 import nl.tudelft.lime.constants.LimeMessages;
-import nl.tudelft.lime.edit.editpart.LimeLabelEditPart;
+import nl.tudelft.lime.edit.editpart.LimeCodeFragmentEditPart;
 import nl.tudelft.lime.figures.ComponentFigure;
 import nl.tudelft.lime.figures.LimeColorConstants;
 import nl.tudelft.lime.figures.StickyNoteFigure;
 import nl.tudelft.lime.model.LimeDiagram;
 import nl.tudelft.lime.model.LimeGuide;
-import nl.tudelft.lime.model.LimeLabel;
+import nl.tudelft.lime.model.LimeCodeFragment;
 import nl.tudelft.lime.model.LimeSubpart;
 import nl.tudelft.lime.model.commands.AddCommand;
 import nl.tudelft.lime.model.commands.ChangeGuideCommand;
      */
     @Override
     protected EditPolicy createChildEditPolicy(EditPart child) {
-        if (child instanceof LimeLabelEditPart) {
+        if (child instanceof LimeCodeFragmentEditPart) {
             ResizableEditPolicy policy = new WhileDraggingEditPolicy();
             policy.setResizeDirections(PositionConstants.EAST |
                 PositionConstants.NORTH | PositionConstants.SOUTH |
 
         if (createRequest.getNewObject() instanceof LimeComponent) {
             figure = new ComponentFigure();
-        } else if (createRequest.getNewObject() instanceof LimeLabel) {
+        } else if (createRequest.getNewObject() instanceof LimeCodeFragment) {
             figure = new StickyNoteFigure();
         } else {
             figure = new RectangleFigure();

File src/nl/tudelft/lime/edit/policy/WhileDraggingEditPolicy.java

 import nl.tudelft.lime.figures.NodeFigure;
 import nl.tudelft.lime.figures.OutputPortFigure;
 import nl.tudelft.lime.figures.StickyNoteFigure;
-import nl.tudelft.lime.model.LimeLabel;
+import nl.tudelft.lime.model.LimeCodeFragment;
 import nl.tudelft.lime.model.component.LimeComponent;
 import nl.tudelft.lime.model.port.InputPort;
 import nl.tudelft.lime.model.port.OutputPort;
 
         if (modelPart instanceof LimeComponent) {
             figure = new ComponentFigure();
-        } else if (modelPart instanceof LimeLabel) {
+        } else if (modelPart instanceof LimeCodeFragment) {
             figure = new StickyNoteFigure();
         } else if (modelPart instanceof InputPort) {
             figure = new InputPortFigure();

File src/nl/tudelft/lime/model/LimeCodeFragment.java

+package nl.tudelft.lime.model;
+
+import java.io.IOException;
+
+import nl.tudelft.lime.constants.LimeMessages;
+import nl.tudelft.lime.constants.SystemSettings;
+
+import org.eclipse.draw2d.geometry.Dimension;
+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;
+
+
+public class LimeCodeFragment extends LimeSubpart {
+    static final long serialVersionUID = 1;
+    private static Image Lime_LABEL_ICON = createImage(LimeCodeFragment.class,
+            SystemSettings.Code_Fragment_Normal_Icon_Path);
+    private static int count;
+    private String text = LimeMessages.LimePlugin_Tool_CreationTool_LimeLabel;
+    public static final String Property_ID_Label_Context = SystemSettings.PropertyDescriptor_Label_Context_ID;
+    public static final String LABEL_DEFAULT_CONTEXT = "iterative";
+    private String context = LABEL_DEFAULT_CONTEXT;
+    protected static IPropertyDescriptor[] newDescriptors = null;
+
+    static {
+        PropertyDescriptor contextProp = new TextPropertyDescriptor(Property_ID_Label_Context,
+                LimeMessages.PropertyDescriptor_Label_Context_Label);
+
+        int length = 0;
+
+        if (descriptors != null) {
+            length = descriptors.length;
+        }
+
+        newDescriptors = new IPropertyDescriptor[length + 1];
+
+        //copy super properties
+        for (int i = 0; i < length; i++)
+            newDescriptors[i] = descriptors[i];
+
+        //add componentspecific properties
+        newDescriptors[length] = contextProp;
+    }
+    
+    public IPropertyDescriptor[] getPropertyDescriptors() {
+        return newDescriptors;
+    }
+    
+    public LimeCodeFragment() {
+        super();
+    }
+
+    public String getLabelContents() {
+        return text;
+    }
+
+    public Image getIconImage() {
+        return Lime_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();
+    
+    }
+    /** (non-Javadoc)
+     * @see nl.tudelft.lime.model.LimeSubpart#setPropertyValue(java.lang.Object, java.lang.Object)
+     */
+    @Override
+    public void setPropertyValue(Object id, Object value) {
+        if (Property_ID_Label_Context.equals(id)) {
+            setContext((String) value);
+        } else {
+            super.setPropertyValue(id, value);
+        }
+    }
+    
+    public Object getPropertyValue(Object propName) {
+        if (Property_ID_Label_Context.equals(propName)) {
+            return getContext();
+        }
+        return super.getPropertyValue(propName);
+    }
+    
+    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$
+    }
+
+    @Override
+    public String getDefaultName() {
+        return LimeMessages.LimePlugin_Tool_CreationTool_LimeLabel;
+    }
+
+	public String getContext() {
+		return context;
+	}
+
+	public void setContext(String context) {
+		this.context = context;
+	}
+    
+}

File src/nl/tudelft/lime/model/LimeLabel.java

-package nl.tudelft.lime.model;
-
-import java.io.IOException;
-
-import nl.tudelft.lime.constants.LimeMessages;
-import nl.tudelft.lime.constants.SystemSettings;
-
-import org.eclipse.draw2d.geometry.Dimension;
-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;
-
-
-public class LimeLabel extends LimeSubpart {
-    static final long serialVersionUID = 1;
-    private static Image Lime_LABEL_ICON = createImage(LimeLabel.class,
-            SystemSettings.Label_Normal_Icon_Path);
-    private static int count;
-    private String text = LimeMessages.LimePlugin_Tool_CreationTool_LimeLabel;
-    public static final String Property_ID_Label_Context = SystemSettings.PropertyDescriptor_Label_Context_ID;
-    public static final String LABEL_DEFAULT_CONTEXT = "iterative";
-    private String context = LABEL_DEFAULT_CONTEXT;
-    protected static IPropertyDescriptor[] newDescriptors = null;
-
-    static {
-        PropertyDescriptor contextProp = new TextPropertyDescriptor(Property_ID_Label_Context,
-                LimeMessages.PropertyDescriptor_Label_Context_Label);
-
-        int length = 0;
-
-        if (descriptors != null) {
-            length = descriptors.length;
-        }
-
-        newDescriptors = new IPropertyDescriptor[length + 1];
-
-        //copy super properties
-        for (int i = 0; i < length; i++)
-            newDescriptors[i] = descriptors[i];
-
-        //add componentspecific properties
-        newDescriptors[length] = contextProp;
-    }
-    
-    public IPropertyDescriptor[] getPropertyDescriptors() {
-        return newDescriptors;
-    }
-    
-    public LimeLabel() {
-        super();
-    }
-
-    public String getLabelContents() {
-        return text;
-    }
-
-    public Image getIconImage() {
-        return Lime_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();
-    
-    }
-    /** (non-Javadoc)
-     * @see nl.tudelft.lime.model.LimeSubpart#setPropertyValue(java.lang.Object, java.lang.Object)
-     */
-    @Override
-    public void setPropertyValue(Object id, Object value) {
-        if (Property_ID_Label_Context.equals(id)) {
-            setContext((String) value);
-        } else {
-            super.setPropertyValue(id, value);
-        }
-    }
-    
-    public Object getPropertyValue(Object propName) {
-        if (Property_ID_Label_Context.equals(propName)) {
-            return getContext();
-        }
-        return super.getPropertyValue(propName);
-    }
-    
-    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$
-    }
-
-    @Override
-    public String getDefaultName() {
-        return LimeMessages.LimePlugin_Tool_CreationTool_LimeLabel;
-    }
-
-	public String getContext() {
-		return context;
-	}
-
-	public void setContext(String context) {
-		this.context = context;
-	}
-    
-}

File src/nl/tudelft/lime/model/commands/AddCommand.java

 import nl.tudelft.lime.constants.LimeMessages;
 import nl.tudelft.lime.model.LimeDiagram;
 import nl.tudelft.lime.model.LimeElement;
-import nl.tudelft.lime.model.LimeLabel;
+import nl.tudelft.lime.model.LimeCodeFragment;
 import nl.tudelft.lime.model.LimeSubpart;
 import nl.tudelft.lime.model.component.LimeComponent;
 import nl.tudelft.lime.model.port.InputPort;
     @Override
     public boolean canExecute() {
         if ((child instanceof InputPort || child instanceof OutputPort ||
-                child instanceof LimeLabel) &&
+                child instanceof LimeCodeFragment) &&
                 !(parent instanceof LimeComponent)) {
             return false;
         }

File src/nl/tudelft/lime/model/commands/CloneCommand.java

 import nl.tudelft.lime.model.LimeDiagram;
 import nl.tudelft.lime.model.LimeElement;
 import nl.tudelft.lime.model.LimeGuide;
-import nl.tudelft.lime.model.LimeLabel;
+import nl.tudelft.lime.model.LimeCodeFragment;
 import nl.tudelft.lime.model.LimeSubpart;
 import nl.tudelft.lime.model.arc.Arc;
 import nl.tudelft.lime.model.arc.ArcBendpoint;
             newPart = new OutputPort();
         } else if (oldPart instanceof LimeComponent) {
             newPart = new LimeComponent();
-        } else if (oldPart instanceof LimeLabel) {
-            newPart = new LimeLabel();
-            ((LimeLabel) newPart).setLabelContents(((LimeLabel) oldPart).getLabelContents());
+        } else if (oldPart instanceof LimeCodeFragment) {
+            newPart = new LimeCodeFragment();
+            ((LimeCodeFragment) newPart).setLabelContents(((LimeCodeFragment) oldPart).getLabelContents());
         } else if (oldPart instanceof InputPort) {
             newPart = new InputPort();
         }

File src/nl/tudelft/lime/model/commands/CreateCommand.java

 import nl.tudelft.lime.constants.LimeMessages;
 import nl.tudelft.lime.model.LimeDiagram;
 import nl.tudelft.lime.model.LimeElement;
-import nl.tudelft.lime.model.LimeLabel;
+import nl.tudelft.lime.model.LimeCodeFragment;
 import nl.tudelft.lime.model.LimeSubpart;
 import nl.tudelft.lime.model.component.LimeComponent;
 import nl.tudelft.lime.model.port.InputPort;
     public boolean canExecute() {
         //ports and labels (code fragment) can only be added to a component
         if ((child instanceof InputPort || child instanceof OutputPort ||
-                child instanceof LimeLabel) &&
+                child instanceof LimeCodeFragment) &&
                 !(parent instanceof LimeComponent)) {
             return false;
         }

File src/nl/tudelft/lime/model/commands/LimeCodeFragmentCommand.java

+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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 nl.tudelft.lime.model.commands;
+
+import nl.tudelft.lime.model.LimeCodeFragment;
+
+import org.eclipse.gef.commands.Command;
+
+
+public class LimeCodeFragmentCommand extends Command {
+    private String newName;
+    private String oldName;
+    private LimeCodeFragment label;
+
+    public LimeCodeFragmentCommand(LimeCodeFragment 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);
+    }
+}

File src/nl/tudelft/lime/model/commands/LimeLabelCommand.java

-/*******************************************************************************
- * Copyright (c) 2000, 2005 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 nl.tudelft.lime.model.commands;
-
-import nl.tudelft.lime.model.LimeLabel;
-
-import org.eclipse.gef.commands.Command;
-
-
-public class LimeLabelCommand extends Command {
-    private String newName;
-    private String oldName;
-    private LimeLabel label;
-
-    public LimeLabelCommand(LimeLabel 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);
-    }
-}

File src/nl/tudelft/lime/model/commands/connection/ArcCommand.java

  */
 package nl.tudelft.lime.model.commands.connection;
 
-import nl.tudelft.lime.model.port.InputPort;
-import nl.tudelft.lime.model.port.OutputPort;
+import nl.tudelft.lime.model.port.Port;
 
 
 /**
  */
 public class ArcCommand extends ConnectionCommand {
     public boolean canExecute() {
-        if ((source instanceof OutputPort && target instanceof InputPort) ||
+        if ((source instanceof Port && target instanceof Port) ||
                 ((source == null) && (target == null) &&
-                oldSource instanceof OutputPort &&
-                oldTarget instanceof InputPort)) {
+                oldSource instanceof Port &&
+                oldTarget instanceof Port)) {
             return true;
         } else {
             return false;

File src/nl/tudelft/lime/model/component/LimeComponent.java

 import nl.tudelft.lime.constants.SystemSettings;
 import nl.tudelft.lime.model.LimeDiagram;
 import nl.tudelft.lime.model.LimeElement;
-import nl.tudelft.lime.model.LimeLabel;
+import nl.tudelft.lime.model.LimeCodeFragment;
 
 import org.eclipse.ui.views.properties.IPropertyDescriptor;
 import org.eclipse.ui.views.properties.PropertyDescriptor;
      * contents of that label
      * @return code fragment for a component
      */
-	public List<LimeLabel> getCodeFragments() {
-		List<LimeLabel> codeFragments = new ArrayList<LimeLabel>();
+	public List<LimeCodeFragment> getCodeFragments() {
+		List<LimeCodeFragment> codeFragments = new ArrayList<LimeCodeFragment>();
 		for (LimeElement child :children){
-			if (child instanceof LimeLabel){
-				codeFragments.add(((LimeLabel)child));
+			if (child instanceof LimeCodeFragment){
+				codeFragments.add(((LimeCodeFragment)child));
 			}
 		}
 		return codeFragments;

File src/nl/tudelft/lime/xml/XMLFactory.java

 
 import nl.tudelft.lime.model.LimeDiagram;
 import nl.tudelft.lime.model.LimeElement;
-import nl.tudelft.lime.model.LimeLabel;
+import nl.tudelft.lime.model.LimeCodeFragment;
 import nl.tudelft.lime.model.LimeSubpart;
 import nl.tudelft.lime.model.arc.Arc;
 import nl.tudelft.lime.model.arc.Association;
                             throw new XMLFormatNotCorrectException();
                         }
 
-                        OutputPort outputPort = (OutputPort) arcsPortDictionary.get(fromOutput);
-                        InputPort inputPort = (InputPort) arcsPortDictionary.get(toInput);
+                        Port port1 = (Port) arcsPortDictionary.get(fromOutput);
+                        Port port2 = (Port) arcsPortDictionary.get(toInput);
 
-                        if ((outputPort != null) && (inputPort != null)) {
-                            arc.setSource(outputPort);
-                            arc.setTarget(inputPort);
+                        if ((port1 != null) && (port2 != null)) {
+                            arc.setSource(port1);
+                            arc.setTarget(port2);
                             arc.setTargetTerminal(Port.CONNECTION_TERMINAL);
                             arc.setSourceTerminal(Port.CONNECTION_TERMINAL);
                             arc.attachSource();
                 List<Element> codeElements = metaElement.elements(CODE_TAG);
                 
                 for (Element codeElement : codeElements){
-                    LimeLabel codeFragment = new LimeLabel();
+                    LimeCodeFragment codeFragment = new LimeCodeFragment();
 	                codeFragment.setLabelContents((String) codeElement.getData());
 	                codeFragment.setContext((String) codeElement.attributeValue(CONTEXT_ATTRIBUTE_TAG));
 	                ((LimeComponent) subpart).addChild(codeFragment);
             for (LimeElement element : children) {
                 //if it is a code fragment (label) ignore it,
                 //it is earlier handled as a meta tag
-                if (element instanceof LimeLabel) {
+                if (element instanceof LimeCodeFragment) {
                     continue;
                 }
 
     private static void addComponentAttributes(Element root,
         LimeComponent component) {
         //adding code fragment
-        List<LimeLabel> codeFragments = component.getCodeFragments();
+        List<LimeCodeFragment> codeFragments = component.getCodeFragments();
 
         if (codeFragments.size() != 0){
-        	for (LimeLabel codeFragment : codeFragments){
+        	for (LimeCodeFragment codeFragment : codeFragments){
 	            DefaultElement metaCode = new DefaultElement(META_TAG);
 	            metaCode.add(new DefaultAttribute(ID_ATTRIBUTE, META_TAG_CODE_ID));