diff --git a/de.bmotionstudio.gef.editor/icons/eclipse16/updated_co.gif b/de.bmotionstudio.gef.editor/icons/eclipse16/updated_co.gif new file mode 100644 index 0000000000000000000000000000000000000000..0d686ab4593b4242cc91a9e79bbbd4bf177f1d69 Binary files /dev/null and b/de.bmotionstudio.gef.editor/icons/eclipse16/updated_co.gif differ diff --git a/de.bmotionstudio.gef.editor/icons/eclipse16/updated_col.gif b/de.bmotionstudio.gef.editor/icons/eclipse16/updated_col.gif new file mode 100644 index 0000000000000000000000000000000000000000..cab08b4083c5102f7c5f203ee59e7e605dcd11a2 Binary files /dev/null and b/de.bmotionstudio.gef.editor/icons/eclipse16/updated_col.gif differ diff --git a/de.bmotionstudio.gef.editor/plugin.xml b/de.bmotionstudio.gef.editor/plugin.xml index 5be99e2974e7bb3004ff6166878b13223ed00f95..599ff15f4cf4723470fbb48d910af602aa1fdcea 100644 --- a/de.bmotionstudio.gef.editor/plugin.xml +++ b/de.bmotionstudio.gef.editor/plugin.xml @@ -290,6 +290,10 @@ class="de.bmotionstudio.gef.editor.observer.ExternalObserverScript" name="External Observer Script"> </observer> + <observer + class="de.bmotionstudio.gef.editor.observer.TableObserver" + name="Table Observer"> + </observer> <observer class="de.bmotionstudio.gef.editor.observer.ColumnObserver" name="Column Observer"> @@ -380,6 +384,9 @@ <control id="de.bmotionstudio.gef.editor.table"> </control> + <control + id="de.bmotionstudio.gef.editor.tablecolumn"> + </control> </observer> <observer id="de.bmotionstudio.gef.editor.observer.SwitchCoordinates"> @@ -470,6 +477,9 @@ <control id="de.bmotionstudio.gef.editor.table"> </control> + <control + id="de.bmotionstudio.gef.editor.tablecolumn"> + </control> </observer> <observer id="de.bmotionstudio.gef.editor.observer.SwitchChildCoordinates"> @@ -518,6 +528,9 @@ <control id="de.bmotionstudio.gef.editor.table"> </control> + <control + id="de.bmotionstudio.gef.editor.tablecolumn"> + </control> </observer> <observer id="de.bmotionstudio.gef.editor.observer.SwitchImage"> @@ -540,6 +553,12 @@ id="de.bmotionstudio.gef.editor.tablecolumn"> </control> </observer> + <observer + id="de.bmotionstudio.gef.editor.observer.TableObserver"> + <control + id="de.bmotionstudio.gef.editor.table"> + </control> + </observer> </include> </extension> </plugin> diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AbstractBControlService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AbstractBControlService.java index f0a5f6c8febb8efdc0da4eb6b840e2d4792b7c50..3f3fd561503b1fa2b0afb3cd0dc629e141ddc594 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AbstractBControlService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AbstractBControlService.java @@ -13,6 +13,8 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; import de.bmotionstudio.gef.editor.internal.BControlTemplate; import de.bmotionstudio.gef.editor.model.Visualization; +import de.bmotionstudio.gef.editor.part.BControlTreeEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractTreeEditPart; /** * @author Lukas Ladenberger @@ -40,4 +42,8 @@ public abstract class AbstractBControlService { return true; } + public BMSAbstractTreeEditPart createTreeEditPart() { + return new BControlTreeEditPart(); + } + } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AttributeConstants.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AttributeConstants.java index 56ddf9afb27f53172c11eb238f659cb74684dda4..b0283c6bb06649d3f144ea8820366055d9087665 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AttributeConstants.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AttributeConstants.java @@ -51,6 +51,7 @@ public final class AttributeConstants { public static final String ATTRIBUTE_COORDINATES = "de.bmotionstudio.gef.editor.attribute.BAttributeCoordinates"; public static final String ATTRIBUTE_MISC = "de.bmotionstudio.gef.editor.attribute.BAttributeMisc"; public static final String ATTRIBUTE_MAIN = "de.bmotionstudio.gef.editor.attribute.BAttributeMain"; + public static final String ATTRIBUTE_CONNECTION = "de.bmotionstudio.gef.editor.attribute.BAttributeConnection"; public static final String EVENT_MOUSECLICK = "de.bmotionstudio.gef.editor.event.OnClickEvent"; public static final String EVENT_MOUSEDBLCLICK = "de.bmotionstudio.gef.editor.event.OnDblClickEvent"; diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AppContextMenuProvider.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMSContextMenuProvider.java similarity index 64% rename from de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AppContextMenuProvider.java rename to de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMSContextMenuProvider.java index 221e61ab8575c5fd656f01a173c4c8bf4c58ff7b..9822355aa3049caf66bd4c8c764786da49fd4053 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/AppContextMenuProvider.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMSContextMenuProvider.java @@ -14,6 +14,7 @@ import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.Platform; import org.eclipse.gef.ContextMenuProvider; import org.eclipse.gef.EditPartViewer; +import org.eclipse.gef.editparts.AbstractEditPart; import org.eclipse.gef.ui.actions.ActionRegistry; import org.eclipse.gef.ui.actions.GEFActionConstants; import org.eclipse.jface.action.IAction; @@ -24,11 +25,11 @@ import org.eclipse.ui.actions.ActionFactory; import de.bmotionstudio.gef.editor.action.OpenSchedulerEventAction; import de.bmotionstudio.gef.editor.model.BControl; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; -import de.bmotionstudio.gef.editor.part.VisualizationPart; +import de.bmotionstudio.gef.editor.model.ObserverRootVirtualTreeNode; +import de.bmotionstudio.gef.editor.model.Visualization; import de.bmotionstudio.gef.editor.scheduler.SchedulerEvent; -public class AppContextMenuProvider extends ContextMenuProvider { +public class BMSContextMenuProvider extends ContextMenuProvider { private ActionRegistry actionRegistry; @@ -36,7 +37,7 @@ public class AppContextMenuProvider extends ContextMenuProvider { private String[] eventIDs = { AttributeConstants.EVENT_MOUSECLICK }; - public AppContextMenuProvider(EditPartViewer viewer, ActionRegistry registry) { + public BMSContextMenuProvider(EditPartViewer viewer, ActionRegistry registry) { super(viewer); setActionRegistry(registry); } @@ -54,42 +55,53 @@ public class AppContextMenuProvider extends ContextMenuProvider { action = getActionRegistry().getAction(ActionFactory.REDO.getId()); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action); - action = actionRegistry.getAction(ActionFactory.COPY.getId()); + action = getActionRegistry().getAction(ActionFactory.COPY.getId()); menu.appendToGroup(GEFActionConstants.GROUP_COPY, action); - action = actionRegistry.getAction(ActionFactory.PASTE.getId()); + action = getActionRegistry().getAction(ActionFactory.PASTE.getId()); menu.appendToGroup(GEFActionConstants.GROUP_COPY, action); action = getActionRegistry().getAction(ActionFactory.DELETE.getId()); menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action); - buildCustomMenu(menu); + Object sel = ((IStructuredSelection) getViewer().getSelection()) + .getFirstElement(); - buildObserverMenu(menu); - - buildEventMenu(menu); + if (sel instanceof AbstractEditPart) { + AbstractEditPart editPart = (AbstractEditPart) sel; + buildCustomMenu(menu, editPart); + buildObserverMenu(menu, editPart); + buildEventMenu(menu, editPart); + } } - private void buildCustomMenu(IMenuManager menu) { + private void buildCustomMenu(IMenuManager menu, AbstractEditPart editPart) { - IExtensionPoint extensionPoint = registry - .getExtensionPoint("de.bmotionstudio.gef.editor.installMenu"); - for (IExtension extension : extensionPoint.getExtensions()) { - for (IConfigurationElement configurationElement : extension - .getConfigurationElements()) { + Object model = editPart.getModel(); - if ("menu".equals(configurationElement.getName())) { + if (model instanceof BControl) { - try { + IExtensionPoint extensionPoint = registry + .getExtensionPoint("de.bmotionstudio.gef.editor.installMenu"); + for (IExtension extension : extensionPoint.getExtensions()) { + for (IConfigurationElement configurationElement : extension + .getConfigurationElements()) { + + if ("menu".equals(configurationElement.getName())) { + + try { + + IInstallMenu installMenuClass = (IInstallMenu) configurationElement + .createExecutableExtension("class"); - IInstallMenu installMenuClass = (IInstallMenu) configurationElement - .createExecutableExtension("class"); + installMenuClass.installMenu(menu, + getActionRegistry()); - installMenuClass.installMenu(menu, getActionRegistry()); + } catch (final CoreException e) { + e.printStackTrace(); + } - } catch (final CoreException e) { - e.printStackTrace(); } } @@ -100,55 +112,55 @@ public class AppContextMenuProvider extends ContextMenuProvider { } - private void buildObserverMenu(IMenuManager menu) { + private void buildObserverMenu(IMenuManager menu, AbstractEditPart editPart) { + + Object model = editPart.getModel(); + + BControl bcontrol = null; + + if (model instanceof BControl) + bcontrol = (BControl) model; + else if (model instanceof ObserverRootVirtualTreeNode) + bcontrol = ((ObserverRootVirtualTreeNode) model).getControl(); + else + return; - final MenuManager handleObserverMenu = new MenuManager("Observers", + final MenuManager handleObserverMenu = new MenuManager("Observer", BMotionStudioImage.getImageDescriptor( BMotionEditorPlugin.PLUGIN_ID, "icons/icon_observer.gif"), "observerMenu"); menu.appendToGroup(GEFActionConstants.GROUP_ADD, handleObserverMenu); - IStructuredSelection selection = (IStructuredSelection) BMotionEditorPlugin - .getActiveEditor().getEditorSite().getSelectionProvider() - .getSelection(); - - if (selection.getFirstElement() instanceof AppAbstractEditPart) { - - BControl bcontrol = (BControl) ((AppAbstractEditPart) selection - .getFirstElement()).getModel(); - - IExtensionPoint extensionPoint = registry - .getExtensionPoint("de.bmotionstudio.gef.editor.observer"); - for (IExtension extension : extensionPoint.getExtensions()) { - for (IConfigurationElement configurationElement : extension - .getConfigurationElements()) { - - if ("observer".equals(configurationElement.getName())) { + IExtensionPoint extensionPoint = registry + .getExtensionPoint("de.bmotionstudio.gef.editor.observer"); + for (IExtension extension : extensionPoint.getExtensions()) { + for (IConfigurationElement configurationElement : extension + .getConfigurationElements()) { - final String observerClassName = configurationElement - .getAttribute("class"); - final String observerName = configurationElement - .getAttribute("name"); + if ("observer".equals(configurationElement.getName())) { - if (checkIncludeObserver(observerClassName, bcontrol)) { + final String observerClassName = configurationElement + .getAttribute("class"); + final String observerName = configurationElement + .getAttribute("name"); - IAction action = getActionRegistry().getAction( - "de.bmotionstudio.gef.editor.observerAction." - + observerClassName); - action.setText(observerName); - action.setToolTipText(observerName); + if (checkIncludeObserver(observerClassName, bcontrol)) { - if (bcontrol.hasObserver(observerClassName)) { - action.setImageDescriptor(BMotionStudioImage - .getImageDescriptor( - BMotionEditorPlugin.PLUGIN_ID, - "icons/icon_chop.gif")); - } else { - action.setImageDescriptor(null); - } - handleObserverMenu.add(action); + IAction action = getActionRegistry().getAction( + "de.bmotionstudio.gef.editor.observerAction." + + observerClassName); + action.setText(observerName); + action.setToolTipText(observerName); + if (bcontrol.hasObserver(observerClassName)) { + action.setImageDescriptor(BMotionStudioImage + .getImageDescriptor( + BMotionEditorPlugin.PLUGIN_ID, + "icons/icon_chop.gif")); + } else { + action.setImageDescriptor(null); } + handleObserverMenu.add(action); } @@ -212,23 +224,19 @@ public class AppContextMenuProvider extends ContextMenuProvider { } - private void buildEventMenu(IMenuManager menu) { + private void buildEventMenu(IMenuManager menu, AbstractEditPart editPart) { - MenuManager handleEventMenu = new MenuManager("Events", - BMotionStudioImage.getImageDescriptor( - BMotionEditorPlugin.PLUGIN_ID, "icons/icon_event.png"), - "eventMenu"); - menu.appendToGroup(GEFActionConstants.GROUP_ADD, handleEventMenu); + Object model = editPart.getModel(); - IStructuredSelection selection = (IStructuredSelection) BMotionEditorPlugin - .getActiveEditor().getEditorSite().getSelectionProvider() - .getSelection(); + if (model instanceof BControl && !(model instanceof Visualization)) { - if ((selection.getFirstElement() instanceof AppAbstractEditPart) - && !(selection.getFirstElement() instanceof VisualizationPart)) { + MenuManager handleEventMenu = new MenuManager("Events", + BMotionStudioImage.getImageDescriptor( + BMotionEditorPlugin.PLUGIN_ID, + "icons/icon_event.png"), "eventMenu"); + menu.appendToGroup(GEFActionConstants.GROUP_ADD, handleEventMenu); - BControl bcontrol = (BControl) ((AppAbstractEditPart) selection - .getFirstElement()).getModel(); + BControl bcontrol = (BControl) model; // Has event if (bcontrol.hasEvent(eventIDs[0])) { @@ -297,7 +305,6 @@ public class AppContextMenuProvider extends ContextMenuProvider { } } - } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionSelectionSynchronizer.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionSelectionSynchronizer.java index 3bf703a63778ad8c668afb657a682a507cc22e94..2a3753c6242a62bf1ae3897773c38acf261ff0f1 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionSelectionSynchronizer.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionSelectionSynchronizer.java @@ -23,23 +23,24 @@ public class BMotionSelectionSynchronizer extends SelectionSynchronizer { } protected EditPart convert(EditPartViewer viewer, EditPart part) { - + EditPart p = super.convert(viewer, part); if (viewer instanceof ScrollingGraphicalViewer || viewer instanceof TreeViewer) { - BControl control = (BControl) part.getModel(); - String id = control.getID(); - BControl editControl = editor.getEditPage().getVisualization() - .getBControl(id); - Object temp = viewer.getEditPartRegistry().get(editControl); - EditPart newPart = null; - if (temp != null) { - newPart = (EditPart) temp; + Object model = part.getModel(); + if (model instanceof BControl) { + BControl control = (BControl) model; + String id = control.getID(); + BControl editControl = editor.getEditPage().getVisualization() + .getBControl(id); + Object temp = viewer.getEditPartRegistry().get(editControl); + EditPart newPart = null; + if (temp != null) { + newPart = (EditPart) temp; + } + return newPart; } - return newPart; - } else { - return super.convert(viewer, part); } - + return p; } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionStudioEditorPage.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionStudioEditorPage.java index 6fb06c9db4e6fee602bb85500ddfb0720370fbfb..4ab8aad00d2d3ebebaa117f4ab4f408c5b01bb09 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionStudioEditorPage.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionStudioEditorPage.java @@ -70,6 +70,7 @@ import org.eclipse.gef.ui.rulers.RulerComposite; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.events.DisposeEvent; @@ -104,8 +105,10 @@ import de.bmotionstudio.gef.editor.library.AttributeTransferDropTargetListener; import de.bmotionstudio.gef.editor.model.BMotionRuler; import de.bmotionstudio.gef.editor.model.BMotionRulerProvider; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppEditPartFactory; -import de.bmotionstudio.gef.editor.part.AppTreeEditPartFactory; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractTreeEditPart; +import de.bmotionstudio.gef.editor.part.BMSEditPartFactory; +import de.bmotionstudio.gef.editor.part.BMSTreeEditPartFactory; public class BMotionStudioEditorPage extends GraphicalEditorWithFlyoutPalette { @@ -152,10 +155,18 @@ public class BMotionStudioEditorPage extends GraphicalEditorWithFlyoutPalette { @Override public void selectionChanged(IWorkbenchPart part, ISelection selection) { + // If not the active editor, ignore selection changed. - if (getBMotionStudioEditor().equals( + if (!getBMotionStudioEditor().equals( getSite().getPage().getActiveEditor())) + return; + + Object selectedElement = ((IStructuredSelection) selection) + .getFirstElement(); + if (selectedElement instanceof BMSAbstractEditPart + || selectedElement instanceof BMSAbstractTreeEditPart) updateActions(getSelectionActions()); + } /** @@ -495,7 +506,7 @@ public class BMotionStudioEditorPage extends GraphicalEditorWithFlyoutPalette { super.configureGraphicalViewer(); ScrollingGraphicalViewer viewer = (ScrollingGraphicalViewer) getGraphicalViewer(); - viewer.setEditPartFactory(new AppEditPartFactory()); + viewer.setEditPartFactory(new BMSEditPartFactory()); ScalableRootEditPart rootEditPart = new ScalableRootEditPart(); GridLayer gridLayer = (GridLayer) rootEditPart @@ -533,7 +544,7 @@ public class BMotionStudioEditorPage extends GraphicalEditorWithFlyoutPalette { getActionRegistry().registerAction( new ToggleGridAction(getGraphicalViewer())); - ContextMenuProvider provider = new AppContextMenuProvider(viewer, + ContextMenuProvider provider = new BMSContextMenuProvider(viewer, getActionRegistry()); viewer.setContextMenu(provider); @@ -670,8 +681,8 @@ public class BMotionStudioEditorPage extends GraphicalEditorWithFlyoutPalette { protected void configureOutlineViewer() { getViewer().setEditDomain(getEditDomain()); - getViewer().setEditPartFactory(new AppTreeEditPartFactory()); - ContextMenuProvider provider = new AppContextMenuProvider( + getViewer().setEditPartFactory(new BMSTreeEditPartFactory()); + ContextMenuProvider provider = new BMSContextMenuProvider( getViewer(), getActionRegistry()); getViewer().setContextMenu(provider); getViewer().setKeyHandler(getCommonKeyHandler()); @@ -736,13 +747,6 @@ public class BMotionStudioEditorPage extends GraphicalEditorWithFlyoutPalette { } }; - // collapseAllAction - // .setImageDescriptor(ImageDescriptor - // .createFromImage(PlatformUI - // .getWorkbench() - // .getSharedImages() - // .getImage( - // ISharedImages.IMG_ELCL_COLLAPSEALL))); getSite().getActionBars().getMenuManager().add(expandAllAction); getSite().getActionBars().getMenuManager().add(collapseAllAction); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionStudioRunPage.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionStudioRunPage.java index 36b084166896ebf03787820cba0f5221acd09430..ee49bff3c4f1f2116d8c0c3f5016c236c46a2fee 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionStudioRunPage.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionStudioRunPage.java @@ -31,7 +31,7 @@ import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.actions.ActionFactory; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppEditPartFactory; +import de.bmotionstudio.gef.editor.part.BMSEditPartFactory; public class BMotionStudioRunPage extends GraphicalEditor { @@ -125,7 +125,7 @@ public class BMotionStudioRunPage extends GraphicalEditor { super.configureGraphicalViewer(); ScrollingGraphicalViewer viewer = (ScrollingGraphicalViewer) getGraphicalViewer(); - viewer.setEditPartFactory(new AppEditPartFactory()); + viewer.setEditPartFactory(new BMSEditPartFactory()); ScalableRootEditPart rootEditPart = new ScalableRootEditPart(); viewer.setRootEditPart(rootEditPart); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/EditorImageRegistry.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/EditorImageRegistry.java index 907bae7fe86f3a5689d699007f4592afe20fa782..5829e8f85304e9f030a9b896bc0aefaa917bfd21 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/EditorImageRegistry.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/EditorImageRegistry.java @@ -25,6 +25,8 @@ public class EditorImageRegistry implements IBMotionStudioImageRegistry { public static final String IMG_ICON_CONNECTION24 = "icon_connection24"; public static final String IMG_ICON_NEW_WIZ = "icon_new_wiz"; public static final String IMG_ICON_DELETE_EDIT = "icon_delete_edit"; + public static final String IMG_ICON_TR_UP = "icon_tr_up"; + public static final String IMG_ICON_TR_LEFT = "icon_tr_left"; public static final String IMG_ICON_JPG = "icon_jpg"; public static final String IMG_ICON_GIF = "icon_gif"; @@ -66,6 +68,13 @@ public class EditorImageRegistry implements IBMotionStudioImageRegistry { BMotionStudioImage.registerImage(IMG_ICON_DELETE_EDIT, "org.eclipse.ui", "$nl$/icons/full/etool16/delete_edit.gif"); + BMotionStudioImage + .registerImage(IMG_ICON_TR_UP, BMotionEditorPlugin.PLUGIN_ID, + "icons/eclipse16/updated_co.gif"); + BMotionStudioImage.registerImage(IMG_ICON_TR_LEFT, + BMotionEditorPlugin.PLUGIN_ID, + "icons/eclipse16/updated_col.gif"); + BMotionStudioImage.registerImage(IMG_ICON_JPG, BMotionEditorPlugin.PLUGIN_ID, "icons/icon_jpg.gif"); BMotionStudioImage.registerImage(IMG_ICON_GIF, diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/IBControlService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/IBControlService.java index 832bd0c1df5d40bcba75a573b11c182aff40a13c..a55c324a812e760764e8e0c8a0aa1d19de10bdfe 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/IBControlService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/IBControlService.java @@ -11,7 +11,8 @@ import org.eclipse.gef.palette.ToolEntry; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractTreeEditPart; /** * @author Lukas Ladenberger @@ -21,7 +22,9 @@ public interface IBControlService { public BControl createControl(Visualization visualization); - public AppAbstractEditPart createEditPart(); + public BMSAbstractEditPart createEditPart(); + + public BMSAbstractTreeEditPart createTreeEditPart(); public ToolEntry createToolEntry(Visualization visualization, IConfigurationElement configurationElement); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BMotionObserverWizardDialog.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BMotionObserverWizardDialog.java index 46ff0b2aefbf331ebb500d982903448255c75270..b5ccee629af599d22f068f274a63be7b2e341788 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BMotionObserverWizardDialog.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BMotionObserverWizardDialog.java @@ -16,7 +16,7 @@ public class BMotionObserverWizardDialog extends BMotionAbstractWizardDialog { public BMotionObserverWizardDialog(IWorkbenchPart workbenchPart, IWizard newWizard) { super(workbenchPart, newWizard); - setShellStyle(SWT.CLOSE); + setShellStyle(SWT.CLOSE | SWT.RESIZE); setDeleteToolTip("Delete Observer"); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToBottomAction.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToBottomAction.java index 0a599f4e003db6814fba319f412f22720939b1d6..397d02a95c5046767fa45ca13b5ebd90d8a36890 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToBottomAction.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToBottomAction.java @@ -17,7 +17,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; import de.bmotionstudio.gef.editor.BMotionEditorPlugin; import de.bmotionstudio.gef.editor.command.BringToBottomCommand; import de.bmotionstudio.gef.editor.model.BControl; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.VisualizationPart; public class BringToBottomAction extends SelectionAction { @@ -66,9 +66,9 @@ public class BringToBottomAction extends SelectionAction { List<?> selectedObjects = getSelectedObjects(); for (Object obj : selectedObjects) { - if (obj instanceof AppAbstractEditPart) { + if (obj instanceof BMSAbstractEditPart) { modelList - .add((BControl) ((AppAbstractEditPart) obj).getModel()); + .add((BControl) ((BMSAbstractEditPart) obj).getModel()); } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToBottomStepAction.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToBottomStepAction.java index 5ab0686daa9e7509083ae407650666b0fac39618..2ae5a88cf2e37c04393cf9498ef252acb756f209 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToBottomStepAction.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToBottomStepAction.java @@ -17,7 +17,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; import de.bmotionstudio.gef.editor.BMotionEditorPlugin; import de.bmotionstudio.gef.editor.command.BringToBottomStepCommand; import de.bmotionstudio.gef.editor.model.BControl; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.VisualizationPart; public class BringToBottomStepAction extends SelectionAction { @@ -67,9 +67,9 @@ public class BringToBottomStepAction extends SelectionAction { List<?> selectedObjects = getSelectedObjects(); for (Object obj : selectedObjects) { - if (obj instanceof AppAbstractEditPart) { + if (obj instanceof BMSAbstractEditPart) { modelList - .add((BControl) ((AppAbstractEditPart) obj).getModel()); + .add((BControl) ((BMSAbstractEditPart) obj).getModel()); } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToTopAction.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToTopAction.java index 0789ad7329d4d4d50343a28f13bff3c397fe243d..d407ac20bb81c128f1dd5aa7c97c5ba6ea2b19b3 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToTopAction.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToTopAction.java @@ -17,7 +17,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; import de.bmotionstudio.gef.editor.BMotionEditorPlugin; import de.bmotionstudio.gef.editor.command.BringToTopCommand; import de.bmotionstudio.gef.editor.model.BControl; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.VisualizationPart; public class BringToTopAction extends SelectionAction { @@ -62,8 +62,8 @@ public class BringToTopAction extends SelectionAction { List<BControl> controlList = new ArrayList<BControl>(); List<?> selectedObjects = getSelectedObjects(); for (Object obj : selectedObjects) { - if (obj instanceof AppAbstractEditPart) { - controlList.add((BControl) ((AppAbstractEditPart) obj) + if (obj instanceof BMSAbstractEditPart) { + controlList.add((BControl) ((BMSAbstractEditPart) obj) .getModel()); } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToTopStepAction.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToTopStepAction.java index 2e0e89c5d76013b7fc913b1ed8b280512cad01b8..2491e8cba9c41b340bfc81e1d95fb7c4f4c50953 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToTopStepAction.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/BringToTopStepAction.java @@ -17,7 +17,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; import de.bmotionstudio.gef.editor.BMotionEditorPlugin; import de.bmotionstudio.gef.editor.command.BringToTopStepCommand; import de.bmotionstudio.gef.editor.model.BControl; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.VisualizationPart; public class BringToTopStepAction extends SelectionAction { @@ -66,9 +66,9 @@ public class BringToTopStepAction extends SelectionAction { List<?> selectedObjects = getSelectedObjects(); for (Object obj : selectedObjects) { - if (obj instanceof AppAbstractEditPart) { + if (obj instanceof BMSAbstractEditPart) { modelList - .add((BControl) ((AppAbstractEditPart) obj).getModel()); + .add((BControl) ((BMSAbstractEditPart) obj).getModel()); } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/CopyAction.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/CopyAction.java index 7f59b18c7d63d10518003dbcc5c57c5301f3da5a..d2e6dfdcccfaf7818c317c221d5f93b6fff237b3 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/CopyAction.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/CopyAction.java @@ -53,10 +53,11 @@ public class CopyAction extends SelectionAction { Object nextElement = it.next(); if (nextElement instanceof EditPart) { EditPart ep = (EditPart) nextElement; - BControl node = (BControl) ep.getModel(); - if (!cmd.isCopyableControl(node)) - return null; - cmd.addElement(node); + if (ep.getModel() instanceof BControl) { + BControl node = (BControl) ep.getModel(); + if (cmd.isCopyableControl(node)) + cmd.addElement(node); + } } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/FitImageAction.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/FitImageAction.java index c8e06a550d8a87acc93298e9e087fed126fafb7f..c0b1dd01618bf5766ae3e2c6e9f9aae8e8c35c47 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/FitImageAction.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/FitImageAction.java @@ -54,10 +54,12 @@ public class FitImageAction extends SelectionAction { for (Object obj : selectedObjects) { if (obj instanceof EditPart) { EditPart part = (EditPart) obj; - BControl bcontrol = (BControl) part.getModel(); - if (bcontrol - .getAttributeValue(AttributeConstants.ATTRIBUTE_IMAGE) != null) { - return true; + if (part.getModel() instanceof BControl) { + BControl bcontrol = (BControl) part.getModel(); + if (bcontrol + .getAttributeValue(AttributeConstants.ATTRIBUTE_IMAGE) != null) { + return true; + } } } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/OpenObserverAction.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/OpenObserverAction.java index f63e35f8a0cc0a6d2ef637b27692362e2527d7f5..4ed52392ac795a04f75fad7fcda720ef926d3210 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/OpenObserverAction.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/OpenObserverAction.java @@ -14,11 +14,12 @@ import org.eclipse.gef.ui.actions.SelectionAction; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.ui.IWorkbenchPart; -import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.BMotionEditorPlugin; import de.bmotionstudio.gef.editor.BMotionStudioImage; -import de.bmotionstudio.gef.editor.command.ObserverCommand; +import de.bmotionstudio.gef.editor.command.RemoveObserverCommand; +import de.bmotionstudio.gef.editor.command.SetObserverCommand; import de.bmotionstudio.gef.editor.model.BControl; +import de.bmotionstudio.gef.editor.model.ObserverRootVirtualTreeNode; import de.bmotionstudio.gef.editor.observer.Observer; import de.bmotionstudio.gef.editor.observer.ObserverWizard; import de.prob.logging.Logger; @@ -26,9 +27,6 @@ import de.prob.logging.Logger; public class OpenObserverAction extends SelectionAction { private String className; - private Observer clonedObserver; - private Observer newObserver; - private BControl actionControl; public OpenObserverAction(IWorkbenchPart part) { super(part); @@ -48,35 +46,35 @@ public class OpenObserverAction extends SelectionAction { @Override public void run() { - clonedObserver = null; - - actionControl = getControl(); + BControl actionControl = getControl(); if (actionControl != null) { - newObserver = getControl().getObserver(getClassName()); + Observer oldObserver = null; + Observer observer = getControl().getObserver(getClassName()); - // Add Observer - if (newObserver == null) { + // If an observer does not exist, add one + if (observer == null) { try { - newObserver = (Observer) BMotionEditorPlugin + observer = (Observer) BMotionEditorPlugin .getObserverExtension(getClassName()) .createExecutableExtension("class"); } catch (CoreException e) { } - } else { // Edit Observer + } else { // else edit the current observer - // Clone Observer + // therefore, clone the current observer, if the user aborts + // editing the current observer try { - clonedObserver = newObserver.clone(); + oldObserver = observer.clone(); } catch (CloneNotSupportedException e) { } } - ObserverWizard wizard = newObserver.getWizard(getControl()); + ObserverWizard wizard = observer.getWizard(actionControl); if (wizard != null) { @@ -84,65 +82,76 @@ public class OpenObserverAction extends SelectionAction { getWorkbenchPart(), wizard); dialog.create(); dialog.getShell().setSize(wizard.getSize()); - String title = "Observer: " - + newObserver.getName() - + " Control: " - + getControl().getAttributeValue( - AttributeConstants.ATTRIBUTE_ID); + String title = "Observer: " + observer.getName() + + " Control: " + getControl().getID(); wizard.setWindowTitle("BMotion Studio Observer Wizard"); dialog.setTitle(title); - dialog.setMessage(newObserver.getDescription()); + dialog.setMessage(observer.getDescription()); dialog.setTitleImage(BMotionStudioImage .getImage(BMotionStudioImage.IMG_LOGO_BMOTION64)); int status = dialog.open(); + // The user clicked on the "OK" button in order to confirm his + // changes on the observer if (status == WizardDialog.OK) { - ObserverCommand observerCommand = createObserverCommandCommand(); - observerCommand.setNewObserver(newObserver); - + // If the observer delete flag is set to true, delete the + // observer anyway if (wizard.isObserverDelete()) { - - RemoveObserverAction action = new RemoveObserverAction( - getWorkbenchPart()); - action.setControl(getControl()); - action.setObserver(newObserver); - action.run(); - + RemoveObserverCommand cmd = createRemoveObserverCommand( + observer, actionControl); + execute(cmd); } else { - if (clonedObserver != null) { - observerCommand.setClonedObserver(clonedObserver); - } - execute(observerCommand); + SetObserverCommand cmd = createObserverSetCommand( + actionControl, observer, oldObserver); + execute(cmd); } + // else the user canceled his changes on the observer } else if (status == WizardDialog.CANCEL) { - if (clonedObserver != null) - actionControl.addObserver(clonedObserver); + // Reset observer without using a command! + if (oldObserver != null) + actionControl.getObservers().put(oldObserver.getID(), + oldObserver); + // else the user clicked on the delete button in order to + // delete the observer } else if (status == BMotionObserverWizardDialog.DELETE) { - RemoveObserverAction action = new RemoveObserverAction( - getWorkbenchPart()); - action.setControl(getControl()); - action.setObserver(newObserver); - action.run(); + RemoveObserverCommand cmd = createRemoveObserverCommand( + observer, actionControl); + execute(cmd); } } else { Logger.notifyUserWithoutBugreport("The Observer \"" - + newObserver.getName() + + observer.getName() + "\" does not support a wizard."); } } } - public ObserverCommand createObserverCommandCommand() { - ObserverCommand command = new ObserverCommand(); - command.setClassName(getClassName()); - command.setControl(actionControl); - return command; + private RemoveObserverCommand createRemoveObserverCommand( + Observer observer, BControl control) { + RemoveObserverCommand cmd = new RemoveObserverCommand(); + cmd.setControl(control); + cmd.setObserver(observer); + return cmd; + } + + public SetObserverCommand createObserverSetCommand(BControl control, + Observer newObserver, Observer oldObserver) { + SetObserverCommand cmd = new SetObserverCommand(); + cmd.setNewObserver(newObserver); + cmd.setOldObserver(oldObserver); + cmd.setControl(control); + return cmd; + } + + public SetObserverCommand createObserverSetCommand(BControl control, + Observer newObserver) { + return createObserverSetCommand(control, newObserver, null); } public void setClassName(String className) { @@ -162,8 +171,15 @@ public class OpenObserverAction extends SelectionAction { if ((objects.get(0) instanceof EditPart)) { EditPart part = (EditPart) objects.get(0); - return (BControl) part.getModel(); + BControl control = null; + if (part.getModel() instanceof ObserverRootVirtualTreeNode) + control = ((ObserverRootVirtualTreeNode) part.getModel()) + .getControl(); + else if (part.getModel() instanceof BControl) + control = (BControl) part.getModel(); + return control; } + return null; } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/PasteAction.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/PasteAction.java index 25cc581f3994b7b1facde5886068b8909095e454..35515085d31c1b240a6a825ad2569579997f7f91 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/PasteAction.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/PasteAction.java @@ -52,10 +52,11 @@ public class PasteAction extends SelectionAction { Object nextElement = it.next(); if (nextElement instanceof EditPart) { EditPart ep = (EditPart) nextElement; - BControl node = (BControl) ep.getModel(); - if (!cmd.isContainer(node)) - return null; - cmd.addElement(node); + if (ep.getModel() instanceof BControl) { + BControl node = (BControl) ep.getModel(); + if (cmd.isContainer(node)) + cmd.addElement(node); + } } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/RenameAction.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/RenameAction.java index 9e3529477541ca7c0ad0fa5a963d155c71d2ebc4..080cadb502769b19452c9593a5c1acab8c2a7cff 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/RenameAction.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/RenameAction.java @@ -21,7 +21,6 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.BMotionEditorPlugin; -import de.bmotionstudio.gef.editor.internal.RenameWizard; import de.bmotionstudio.gef.editor.model.BControl; public class RenameAction extends SelectionAction { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/internal/RenameWizard.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/RenameWizard.java similarity index 93% rename from de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/internal/RenameWizard.java rename to de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/RenameWizard.java index 117a244f3aa03bc54f91db884197286d6d49db1b..34c95998316f8cf40ae8974e4b34245682a88989 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/internal/RenameWizard.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/action/RenameWizard.java @@ -4,7 +4,7 @@ * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) * */ -package de.bmotionstudio.gef.editor.internal; +package de.bmotionstudio.gef.editor.action; import org.eclipse.jface.wizard.Wizard; import org.eclipse.jface.wizard.WizardPage; diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/AbstractAttribute.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/AbstractAttribute.java index 0de1ef287ce66ad14499141c51fe22e03cea03e6..a274533a1e953b7fdbdf3d538da52fcba675c965 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/AbstractAttribute.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/AbstractAttribute.java @@ -31,24 +31,30 @@ public abstract class AbstractAttribute implements IPropertySource, Cloneable { private transient BControl control; private transient PropertyDescriptor propertyDescriptor; private transient Object initValue; + private transient Object defaultValue; private transient boolean editable; private transient boolean show; private transient String group; + private transient boolean isInitialized; + // The current value of the attribute private Object value; - public AbstractAttribute(Object value) { - this(value, true, true); - } - - public AbstractAttribute(Object value, boolean isEditable, - boolean showInPropertiesView) { - this.value = value; - this.initValue = value; - this.editable = isEditable; - this.show = showInPropertiesView; + public AbstractAttribute() { } + // public AbstractAttribute(Object value) { + // this(value, true, true); + // } + // + // public AbstractAttribute(Object value, boolean isEditable, + // boolean showInPropertiesView) { + // this.value = value; + // this.initValue = value; + // this.editable = isEditable; + // this.show = showInPropertiesView; + // } + private Object readResolve() { this.initValue = this.value; return this; @@ -202,4 +208,20 @@ public abstract class AbstractAttribute implements IPropertySource, Cloneable { this.control = control; } + public Object getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(Object defaultValue) { + this.defaultValue = defaultValue; + } + + public boolean isInitialized() { + return isInitialized; + } + + public void setInitialized(boolean isInitialized) { + this.isInitialized = isInitialized; + } + } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeAlpha.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeAlpha.java index fe192157564608b16cc527627ed8ff49cd13ec62..41eea7fe4cf1e7e5b45e4bb9c3663568d9a244d1 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeAlpha.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeAlpha.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.SliderPropertyDescriptor; public class BAttributeAlpha extends AbstractAttribute { - public BAttributeAlpha(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { SliderPropertyDescriptor descriptor = new SliderPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundColor.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundColor.java index 0023246f77f3519457e9c64abf7ba27698fff49f..a0fc14f98a6360befc1174041a259a3e63f8bd15 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundColor.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundColor.java @@ -14,10 +14,6 @@ import de.bmotionstudio.gef.editor.model.BControl; public class BAttributeBackgroundColor extends AbstractAttribute { - public BAttributeBackgroundColor(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new ColorPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundVisible.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundVisible.java index 05c468b63454bd7836f67c8c319cb7660f76de34..32054a9bcfbcf20d3d71c5b1f8888543cea1fdd4 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundVisible.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeBackgroundVisible.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor; public class BAttributeBackgroundVisible extends AbstractAttribute { - public BAttributeBackgroundVisible(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new CheckboxPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeButtonGroup.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeButtonGroup.java index e15182719126fc38f4fd36bd599f1938e6f6c0f0..aefb1043c6432f9211035c47bacd2414f8e4f186 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeButtonGroup.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeButtonGroup.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeButtonGroup extends AbstractAttribute { - public BAttributeButtonGroup(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeChecked.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeChecked.java index d3013220cac3d2a736d85297118267822590618b..de45a3afa7ef6ac7a2fd7fef8aa397bc3f4097d9 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeChecked.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeChecked.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor; public class BAttributeChecked extends AbstractAttribute { - public BAttributeChecked(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new CheckboxPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeColumns.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeColumns.java index 12a636d196f8838fb2daf5c2561d8c3aa829aae2..0ce92a69dfb946a91ed7ae400d66c5d4bc115784 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeColumns.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeColumns.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeColumns extends AbstractAttribute { - public BAttributeColumns(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnection.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnection.java index 19428d8be059cc602dd29770813165943a53820a..1e5e4a1f744ca396414720aaffa89c47cbb4335f 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnection.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnection.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.PropertyDescriptor; public class BAttributeConnection extends AbstractAttribute { - public BAttributeConnection(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { PropertyDescriptor descriptor = new PropertyDescriptor(getID(), diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionSourceDecoration.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionSourceDecoration.java index 89a5c58c734618d066772afe071dc0d56dfee25b..f62678f88021e50313abdd9c669ef285a0efee00 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionSourceDecoration.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionSourceDecoration.java @@ -14,10 +14,6 @@ public class BAttributeConnectionSourceDecoration extends AbstractAttribute { public static int DECORATION_NONE = 0; public static int DECORATION_TRIANGLE = 1; - public BAttributeConnectionSourceDecoration(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionTargetDecoration.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionTargetDecoration.java index fc9f9353cddc3a0533becdac8368e2e67909b373..1e22657db49af91185ec7a3a09933c4c96255995 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionTargetDecoration.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeConnectionTargetDecoration.java @@ -14,10 +14,6 @@ public class BAttributeConnectionTargetDecoration extends AbstractAttribute { public static int DECORATION_NONE = 0; public static int DECORATION_TRIANGLE = 1; - public BAttributeConnectionTargetDecoration(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCoordinates.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCoordinates.java index 2aeb359d027bd32783119b814a50786e7f8c476b..01447dc77778aacadc5c49759927c443c0fae044 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCoordinates.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCoordinates.java @@ -14,10 +14,6 @@ import de.bmotionstudio.gef.editor.AttributeConstants; public class BAttributeCoordinates extends AbstractAttribute { - public BAttributeCoordinates(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { PropertyDescriptor descriptor = new PropertyDescriptor(getID(), diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCustom.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCustom.java index a2ff6fa20caa0970d0519bad991a4f0b1a0f93c6..3342762ea41d5a1bd5c15dcdd10bfaa5de7c65a1 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCustom.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeCustom.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeCustom extends AbstractAttribute { - public BAttributeCustom(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeDirection.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeDirection.java index 899f70124e929d6150108db251f236ec33856895..40f9418e0d102f3fcef33835d9b8bf4e5032af8f 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeDirection.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeDirection.java @@ -16,10 +16,6 @@ public class BAttributeDirection extends AbstractAttribute { public static final int WEST = 2; public static final int EAST = 3; - public BAttributeDirection(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeEnabled.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeEnabled.java index 170e1dfde4ec606c0932fe2fcb03fd8eb0ec7b0e..c8ae7422abfbac9531e3c50dc7a1fd5e7edc880d 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeEnabled.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeEnabled.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor; public class BAttributeEnabled extends AbstractAttribute { - public BAttributeEnabled(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new CheckboxPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFalseValue.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFalseValue.java index 74a13b83fc362de800c0fcc8f04be96177e67318..6ea18bb04de84c3ce408fca33826389887caab6e 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFalseValue.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFalseValue.java @@ -5,10 +5,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeFalseValue extends AbstractAttribute { - public BAttributeFalseValue(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFillType.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFillType.java index 81abe496879115fa02f1c2bf99682cd727f57344..bd57f9d8331fced4d4615e54ca82a798d563b78f 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFillType.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFillType.java @@ -16,10 +16,6 @@ public class BAttributeFillType extends AbstractAttribute { public static final int SHADED = 2; public static final int GRADIENT = 3; - public BAttributeFillType(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFont.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFont.java index 85986759f8aed85204a780a1d4f54082296b91f0..9c89418c917993b50709ce32f80c38eace929c38 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFont.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeFont.java @@ -12,10 +12,6 @@ import de.bmotionstudio.gef.editor.property.FontPropertyDescriptor; public class BAttributeFont extends AbstractAttribute { - public BAttributeFont(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new FontPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeForegroundColor.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeForegroundColor.java index cf4abf23f94cd929925ae936b74ba1c6aeae5888..8a17fe1387f029e02c9aeb4e83712038a6015974 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeForegroundColor.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeForegroundColor.java @@ -14,10 +14,6 @@ import de.bmotionstudio.gef.editor.model.BControl; public class BAttributeForegroundColor extends AbstractAttribute { - public BAttributeForegroundColor(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new ColorPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeHeight.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeHeight.java index 5947e5cd808c696ae11196e1b7eddc77c2b98fb7..b0a6191af1cacc545bef905f191f6f5a4368dc83 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeHeight.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeHeight.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeHeight extends AbstractAttribute { - public BAttributeHeight(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeID.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeID.java index b181122cdbd830bab5682d75b05d494f0fb8e00d..2af7dadd08c395f66de3c039e3f0589e91026b29 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeID.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeID.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.model.BControl; public class BAttributeID extends AbstractAttribute { - public BAttributeID(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { TextPropertyDescriptor descriptor = new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeImage.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeImage.java index 86f1d299bf2ef2cf3811c6eee0916e062ae9605f..d3938ae21abf2fa4daf34d75e2e98360323fb80a 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeImage.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeImage.java @@ -16,10 +16,6 @@ import de.bmotionstudio.gef.editor.property.ImagePropertyDescriptor; public class BAttributeImage extends AbstractAttribute { - public BAttributeImage(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new ImagePropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLabel.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLabel.java index a3f962a2702da02a2554dd4cb6f2b2476904edda..47b72fb46604377bf1413358d8da5e0a73afc405 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLabel.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLabel.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeLabel extends AbstractAttribute { - public BAttributeLabel(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineStyle.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineStyle.java index 9e0132d7d607e9eb4d1f08f382ea7894a5489e9b..262e5fd9f207c86ed9ac5f8efa634baf4a574741 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineStyle.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineStyle.java @@ -17,10 +17,6 @@ public class BAttributeLineStyle extends AbstractAttribute { public static final int DASHED_DOTTED_CONNECTION = 3; public static final int DASHED_DOTTED_DOTTED_CONNECTION = 4; - public BAttributeLineStyle(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineWidth.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineWidth.java index b9503fbf6287dbbfeb8d0729fd759c842cb9e728..b40020c53d0e67dd551de27b0b8da041a677969e 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineWidth.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeLineWidth.java @@ -7,10 +7,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeLineWidth extends AbstractAttribute { - public BAttributeLineWidth(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMain.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMain.java index 2870f97b871646f1bc141b5c33f76b3dde21b219..8429e40309d287c54bd43f4c5084aa2202f6b988 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMain.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMain.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.PropertyDescriptor; public class BAttributeMain extends AbstractAttribute { - public BAttributeMain(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { PropertyDescriptor descriptor = new PropertyDescriptor(getID(), diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMisc.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMisc.java index 658f9e91b231ea21d6383cc32298f73424977693..c32fa2681fc10cd3b7feec57da712a1ab11d5a1e 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMisc.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeMisc.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.PropertyDescriptor; public class BAttributeMisc extends AbstractAttribute { - public BAttributeMisc(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { PropertyDescriptor descriptor = new PropertyDescriptor(getID(), diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetH.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetH.java index f173bbfb605a0c922380c2e9db6bae83e9eba08f..f91d9446c4d5e770093a6b1fa33d1f9346dcf678 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetH.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetH.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeOffsetH extends AbstractAttribute { - public BAttributeOffsetH(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetV.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetV.java index 9fafedfc1c7588060e666ac95d51344bc3c9dfc5..6c8ef25c738659a4104e00e83cbdfd2510197994 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetV.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOffsetV.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeOffsetV extends AbstractAttribute { - public BAttributeOffsetV(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOrientation.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOrientation.java index 365995bcfef2ae6b62f13a29989d01d5e38d0856..ac0656a50f6ed5df19491f483d73d4583f105c00 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOrientation.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOrientation.java @@ -8,10 +8,6 @@ public class BAttributeOrientation extends AbstractAttribute { public static final int HORIZONTAL = 0; public static final int VERTICAL = 1; - public BAttributeOrientation(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOutlineAlpha.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOutlineAlpha.java index f583a8f03f37c48592c2358a6217a1f2b347b7b3..218e74deb39827dcd8360fab13c0945df4e8d301 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOutlineAlpha.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeOutlineAlpha.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.SliderPropertyDescriptor; public class BAttributeOutlineAlpha extends AbstractAttribute { - public BAttributeOutlineAlpha(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { SliderPropertyDescriptor descriptor = new SliderPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeRows.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeRows.java index b3df0f422b0fab661a49ac893d785b2c3cda0a00..dbd8fdd42d5ae5f3ed1c6f3c9c606241e70512e9 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeRows.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeRows.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeRows extends AbstractAttribute { - public BAttributeRows(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeShape.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeShape.java index b2200082614890de744321a1e8f86a278dcead36..48547232461d0040a8621ef9bab07845280ac066 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeShape.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeShape.java @@ -16,10 +16,6 @@ public class BAttributeShape extends AbstractAttribute { public static final int SHAPE_TRIANGLE = 2; public static final int SHAPE_DIAMOND = 3; - public BAttributeShape(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new ComboBoxPropertyDescriptor(getID(), getName(), new String[] { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeSize.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeSize.java index 1920190f623c1673e57861794d8c816dc21a6796..6244b248374f1b34a0529c6417e5353b2794bdc3 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeSize.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeSize.java @@ -14,9 +14,7 @@ import de.bmotionstudio.gef.editor.AttributeConstants; public class BAttributeSize extends AbstractAttribute { - public BAttributeSize(Object value) { - super(value); - } + public static final String ID = "de.bmotionstudio.gef.editor.attribute.BAttributeSize"; @Override public PropertyDescriptor preparePropertyDescriptor() { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeText.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeText.java index 97d071630c2c0df0fdc1159ecb2d74de2f47fd23..b5c18d5cb2fd25574d1d944cdb7a07205c259bc4 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeText.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeText.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeText extends AbstractAttribute { - public BAttributeText(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTextColor.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTextColor.java index dbba315d244d7655012a87b6072cc0db9ca37eda..d6e6465095ab97d39429c1884d3c94146979f78d 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTextColor.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTextColor.java @@ -14,10 +14,6 @@ import de.bmotionstudio.gef.editor.model.BControl; public class BAttributeTextColor extends AbstractAttribute { - public BAttributeTextColor(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new ColorPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTrueValue.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTrueValue.java index 3d58d1fbd9b9645fb4df65b4b0ed72f3ee1adb24..27ef95ab61e8058fcaa4ac0074a6263f50f5b507 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTrueValue.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeTrueValue.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeTrueValue extends AbstractAttribute { - public BAttributeTrueValue(Object value) { - super(value); - } - @Override public PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeValue.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeValue.java index 2b0aaf110088d54fde29b51a5fc1f5125ba80b54..f6f62ad7e605d95ced4751aa3c67008d825f3c1b 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeValue.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeValue.java @@ -11,10 +11,6 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; public class BAttributeValue extends AbstractAttribute { - public BAttributeValue(Object value) { - super(value); - } - @Override protected PropertyDescriptor preparePropertyDescriptor() { return new TextPropertyDescriptor(getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeVisible.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeVisible.java index bbf89608770e925157c6fcf401e58fcd3338d59b..de3ca30f252777eb3dfb15629c0e776f5a362535 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeVisible.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeVisible.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.CheckboxPropertyDescriptor; public class BAttributeVisible extends AbstractAttribute { - public BAttributeVisible(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { return new CheckboxPropertyDescriptor(getID(), getName()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeWidth.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeWidth.java index 34844653d9226fbca2ab5020f527fb7d43718cc0..7885372386ae8b8f99b8f7ab76881eb4f88f2ff4 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeWidth.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeWidth.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeWidth extends AbstractAttribute { - public BAttributeWidth(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeX.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeX.java index e3f911398536a6f4a871fdd8b037608462a064a0..3494ad60a75d272f602f573076858a504e1251e4 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeX.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeX.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeX extends AbstractAttribute { - public BAttributeX(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeY.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeY.java index 45c5959a7837d01f33fe22d722db436167b3d7fa..1ac072819bf8e01d9e6f04d04d8a04b3941729cc 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeY.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/attribute/BAttributeY.java @@ -13,10 +13,6 @@ import de.bmotionstudio.gef.editor.property.IntegerPropertyDescriptor; public class BAttributeY extends AbstractAttribute { - public BAttributeY(Object value) { - super(value); - } - public PropertyDescriptor preparePropertyDescriptor() { IntegerPropertyDescriptor descriptor = new IntegerPropertyDescriptor( getID(), getName()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/command/ObserverCommand.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/command/SetObserverCommand.java similarity index 61% rename from de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/command/ObserverCommand.java rename to de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/command/SetObserverCommand.java index b27dd0d833d937e1c2d39fbd37043cd6c41c5a91..76d48c5491d39d8b67579dbb2c04b775c803a23f 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/command/ObserverCommand.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/command/SetObserverCommand.java @@ -11,53 +11,46 @@ import org.eclipse.gef.commands.Command; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.observer.Observer; -public class ObserverCommand extends Command { +public class SetObserverCommand extends Command { - private String className; - private Observer clonedObserver; + private Observer oldObserver; private Observer newObserver; private Observer clonedNewObserver; private BControl control; public void execute() { - + // Clone the new observer try { clonedNewObserver = newObserver.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } - + // Set the new observer control.addObserver(newObserver); - } public boolean canExecute() { + if (newObserver == null || control == null) + return false; return true; } public void undo() { - - // Remove completely new Observer - if (clonedObserver == null) { - control.removeObserver(getClassName()); - } else { // Reset Observer - control.addObserver(clonedObserver); + // If we had an old observer, set the old one + if (oldObserver != null) { + control.addObserver(oldObserver); + // else remove the observer + } else { + control.removeObserver(newObserver); } - } public void redo() { + // Redo method adds the cloned observer, since the observer could be + // changed during set and redo action control.addObserver(clonedNewObserver); } - public void setClassName(String className) { - this.className = className; - } - - public String getClassName() { - return className; - } - public void setControl(BControl control) { this.control = control; } @@ -66,12 +59,12 @@ public class ObserverCommand extends Command { return this.control; } - public Observer getClonedObserver() { - return clonedObserver; + public Observer getOldObserver() { + return oldObserver; } - public void setClonedObserver(Observer clonedObserver) { - this.clonedObserver = clonedObserver; + public void setOldObserver(Observer oldObserver) { + this.oldObserver = oldObserver; } public Observer getNewObserver() { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/edit/TextEditManager.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/edit/TextEditManager.java index 82065ecd1d75b43fcbabbcef511437de882d9256..c2ad978d12b81b1248409b800616cceddc1487f7 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/edit/TextEditManager.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/edit/TextEditManager.java @@ -26,7 +26,7 @@ import org.eclipse.ui.part.CellEditorActionHandler; import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.model.BControl; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; public class TextEditManager extends DirectEditManager { @@ -41,7 +41,7 @@ public class TextEditManager extends DirectEditManager { } }; - public TextEditManager(AppAbstractEditPart source, CellEditorLocator locator) { + public TextEditManager(BMSAbstractEditPart source, CellEditorLocator locator) { super(source, null, locator); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/AppDeletePolicy.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSDeletePolicy.java similarity index 89% rename from de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/AppDeletePolicy.java rename to de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSDeletePolicy.java index e6e18db463743f48589a4b97253412a7328a0084..21f255bd50f434c9648132b238f1f83c9af2c124 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/AppDeletePolicy.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSDeletePolicy.java @@ -13,7 +13,7 @@ import org.eclipse.gef.requests.GroupRequest; import de.bmotionstudio.gef.editor.command.DeleteCommand; import de.bmotionstudio.gef.editor.model.BControl; -public class AppDeletePolicy extends ComponentEditPolicy { +public class BMSDeletePolicy extends ComponentEditPolicy { protected Command createDeleteCommand(GroupRequest deleteRequest) { DeleteCommand command = new DeleteCommand((BControl) getHost() diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/AppEditLayoutPolicy.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSEditLayoutPolicy.java similarity index 87% rename from de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/AppEditLayoutPolicy.java rename to de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSEditLayoutPolicy.java index 5fcc1fe24c6c002c48b4e7b7dd3dae3ccf268a1e..8eae508da5b13fa6318f457154eca3cecb12eb69 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/AppEditLayoutPolicy.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSEditLayoutPolicy.java @@ -27,9 +27,9 @@ import de.bmotionstudio.gef.editor.command.ChangeGuideCommand; import de.bmotionstudio.gef.editor.command.CreateCommand; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.BMotionGuide; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; -public class AppEditLayoutPolicy extends XYLayoutEditPolicy { +public class BMSEditLayoutPolicy extends XYLayoutEditPolicy { @Override protected Command createChangeConstraintCommand(EditPart child, @@ -136,17 +136,18 @@ public class AppEditLayoutPolicy extends XYLayoutEditPolicy { protected Command getCreateCommand(CreateRequest request) { if (request.getType() == REQ_CREATE - && getHost() instanceof AppAbstractEditPart) { + && getHost() instanceof BMSAbstractEditPart) { - if (((BControl) ((AppAbstractEditPart) getHost()).getModel()) + if (((BControl) ((BMSAbstractEditPart) getHost()).getModel()) .canHaveChildren()) { BControl newObj = (BControl) request.getNewObject(); - CreateCommand createCmd = new CreateCommand( - newObj, (BControl) getHost().getModel()); + CreateCommand createCmd = new CreateCommand(newObj, + (BControl) getHost().getModel()); Rectangle constraint = (Rectangle) getConstraintFor(request); + constraint.x = (constraint.x < 0) ? 0 : constraint.x; constraint.y = (constraint.y < 0) ? 0 : constraint.y; @@ -157,19 +158,21 @@ public class AppEditLayoutPolicy extends XYLayoutEditPolicy { .getAttributes().get( AttributeConstants.ATTRIBUTE_HEIGHT); - if (atrWidth != null) { - constraint.width = Integer.valueOf(atrWidth.getValue() - .toString()); + Integer cWidth = Integer.valueOf(atrWidth.getDefaultValue() + .toString()); + if (!atrWidth.isEditable()) { + constraint.width = cWidth; } else { - constraint.width = (constraint.width <= 0) ? 100 + constraint.width = (constraint.width <= 0) ? cWidth : constraint.width; } - if (atrHeight != null) { - constraint.height = Integer.valueOf(atrHeight.getValue() - .toString()); + Integer cHeight = Integer.valueOf(atrHeight.getDefaultValue() + .toString()); + if (!atrHeight.isEditable()) { + constraint.height = cHeight; } else { - constraint.height = (constraint.height <= 0) ? 100 + constraint.height = (constraint.height <= 0) ? cHeight : constraint.height; } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSFlowEditPolicy.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSFlowEditPolicy.java new file mode 100644 index 0000000000000000000000000000000000000000..a45115c212a4dca98ec140b632769818626d0803 --- /dev/null +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSFlowEditPolicy.java @@ -0,0 +1,292 @@ +/** + * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, + * Heinrich Heine Universitaet Duesseldorf + * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) + * */ +package de.bmotionstudio.gef.editor.editpolicy; + +import java.util.List; + +import org.eclipse.draw2d.FlowLayout; +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.PositionConstants; +import org.eclipse.draw2d.ToolbarLayout; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.PrecisionRectangle; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.draw2d.geometry.Translatable; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.CompoundCommand; +import org.eclipse.gef.editpolicies.FlowLayoutEditPolicy; +import org.eclipse.gef.requests.ChangeBoundsRequest; +import org.eclipse.gef.requests.CreateRequest; + +import de.bmotionstudio.gef.editor.command.AddCommand; +import de.bmotionstudio.gef.editor.command.BControlChangeLayoutCommand; +import de.bmotionstudio.gef.editor.command.ReorderPartCommand; +import de.bmotionstudio.gef.editor.model.BControl; +import de.bmotionstudio.gef.editor.model.BTable; +import de.bmotionstudio.gef.editor.model.BTableCell; +import de.bmotionstudio.gef.editor.model.BTableColumn; + +public class BMSFlowEditPolicy extends FlowLayoutEditPolicy { + + private static final Dimension PREFERRED_SIZE = new Dimension(-1, -1); + + /** + * Constant being used to indicate that upon creation (or during move) a + * size was not specified. + * + * @since 3.7 + */ + protected static final Dimension UNSPECIFIED_SIZE = new Dimension(); + + @Override + protected Command createAddCommand(EditPart child, EditPart after) { + + BControl childModel = (BControl) child.getModel(); + BControl parentModel = (BControl) getHost().getModel(); + if ((childModel instanceof BTableColumn && parentModel instanceof BTable) + || (childModel instanceof BTableCell + && parentModel instanceof BTableColumn && childModel + .getParent().equals(parentModel))) { + AddCommand command = new AddCommand(); + command.setChild(childModel); + command.setParent(parentModel); + int index = getHost().getChildren().indexOf(after); + command.setIndex(index); + return command; + } + return null; + } + + @Override + public Command getCommand(Request request) { + if (REQ_RESIZE_CHILDREN.equals(request.getType())) + return getResizeChildrenCommand((ChangeBoundsRequest) request); + return super.getCommand(request); + } + + protected Command getResizeChildrenCommand(ChangeBoundsRequest request) { + CompoundCommand resize = new CompoundCommand(); + Command c; + GraphicalEditPart child; + List<?> children = request.getEditParts(); + for (int i = 0; i < children.size(); i++) { + child = (GraphicalEditPart) children.get(i); + c = createChangeConstraintCommand( + request, + child, + translateToModelConstraint(getConstraintFor(request, child))); + resize.add(c); + } + return resize.unwrap(); + } + + protected Command createChangeConstraintCommand( + ChangeBoundsRequest request, EditPart child, Object constraint) { + BControlChangeLayoutCommand cmd = new BControlChangeLayoutCommand(); + cmd.setModel(child.getModel()); + cmd.setConstraint((Rectangle) constraint); + return cmd; + } + + /** + * Generates a draw2d constraint object for the given + * <code>ChangeBoundsRequest</code> and child EditPart by delegating to + * {@link #getConstraintFor(Request, GraphicalEditPart, Rectangle)}. + * + * The rectangle being passed over to + * {@link #getConstraintFor(Request, GraphicalEditPart, Rectangle)} is + * calculated based on the child figure's current bounds and the + * ChangeBoundsRequest's move and resize deltas. It is made layout-relative + * by using {@link #translateFromAbsoluteToLayoutRelative(Translatable)} + * before calling + * {@link #getConstraintFor(Request, GraphicalEditPart, Rectangle)}. + * + * @param request + * the ChangeBoundsRequest + * @param child + * the child EditPart for which the constraint should be + * generated + * @return the draw2d constraint + */ + protected Object getConstraintFor(ChangeBoundsRequest request, + GraphicalEditPart child) { + Rectangle locationAndSize = new PrecisionRectangle(child.getFigure() + .getBounds()); + child.getFigure().translateToAbsolute(locationAndSize); + locationAndSize = request.getTransformedRectangle(locationAndSize); + translateFromAbsoluteToLayoutRelative(locationAndSize); + return getConstraintFor(request, child, locationAndSize); + } + + /** + * Responsible of generating a draw2d constraint for the given Rectangle, + * which represents the already transformed (layout-relative) position and + * size of the given Request. + * + * By default, this method delegates to {@link #getConstraintFor(Point)} or + * {@link #getConstraintFor(Rectangle)}, dependent on whether the size of + * the rectangle is an {@link #UNSPECIFIED_SIZE} or not. + * + * Subclasses may overwrite this method in case they need the request or the + * edit part (which will of course not be set during creation) to calculate + * a layout constraint for the request. + * + * @param rectangle + * the Rectangle relative to the {@link #getLayoutOrigin() layout + * origin} + * @return the constraint + * @since 3.7 + */ + protected Object getConstraintFor(Request request, GraphicalEditPart child, + Rectangle rectangle) { + if (UNSPECIFIED_SIZE.equals(rectangle.getSize())) { + return getConstraintFor(rectangle.getLocation()); + } + return getConstraintFor(rectangle); + } + + /** + * Generates a draw2d constraint for the given <code>CreateRequest</code> by + * delegating to + * {@link #getConstraintFor(Request, GraphicalEditPart, Rectangle)}. + * + * If the CreateRequest has a size, is used during size-on-drop creation, a + * Rectangle of the request's location and size is passed with the + * delegation. Otherwise, a rectangle with the request's location and an + * empty size (0,0) is passed over. + * <P> + * The CreateRequest's location is relative to the Viewer. The location is + * made layout-relative by using + * {@link #translateFromAbsoluteToLayoutRelative(Translatable)} before + * calling {@link #getConstraintFor(Request, GraphicalEditPart, Rectangle)}. + * + * @param request + * the CreateRequest + * @return a draw2d constraint + */ + protected Object getConstraintFor(CreateRequest request) { + Rectangle locationAndSize = null; + if (request.getSize() == null || request.getSize().isEmpty()) { + locationAndSize = new PrecisionRectangle(request.getLocation(), + UNSPECIFIED_SIZE); + } else { + locationAndSize = new PrecisionRectangle(request.getLocation(), + request.getSize()); + } + translateFromAbsoluteToLayoutRelative(locationAndSize); + return getConstraintFor(request, null, locationAndSize); + } + + /** + * Generates a draw2d constraint given a <code>Point</code>. This method is + * called during creation, when only a mouse location is available, as well + * as during move, in case no resizing is involved. + * + * @param point + * the Point relative to the {@link #getLayoutOrigin() layout + * origin} + * @return the constraint + */ + protected Object getConstraintFor(Point p) { + return new Rectangle(p, PREFERRED_SIZE); + } + + /** + * Generates a draw2d constraint given a <code>Rectangle</code>. This method + * is called during most operations. + * + * @param rect + * the Rectangle relative to the {@link #getLayoutOrigin() layout + * origin} + * @return the constraint + */ + protected Object getConstraintFor(Rectangle r) { + return new Rectangle(r); + } + + /** + * Converts a constraint from the format used by LayoutManagers, to the form + * stored in the model. + * + * @param figureConstraint + * the draw2d constraint + * @return the model constraint + */ + protected Object translateToModelConstraint(Object figureConstraint) { + return figureConstraint; + } + + /** + * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#createChildEditPolicy(org.eclipse.gef.EditPart) + */ + protected EditPolicy createChildEditPolicy(EditPart child) { + BMSResizableEditPolicy policy = new BMSResizableEditPolicy(); + policy.setResizeDirections(PositionConstants.EAST + | PositionConstants.WEST); + return policy; + } + + @Override + protected Command createMoveChildCommand(EditPart child, EditPart after) { + + BControl childModel = (BControl) child.getModel(); + BControl parentModel = (BControl) getHost().getModel(); + + if ((childModel instanceof BTableColumn && parentModel instanceof BTable) + || (childModel instanceof BTableCell && parentModel instanceof BTableColumn)) { + 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; + } + + return null; + + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + // CreateCommand command = new CreateCommand( + // (BControl) request.getNewObject(), (BControl) getHost() + // .getModel()); + // EditPart after = getInsertionReference(request); + // command.setLayout(new Rectangle(0, 0, 100, 25)); + // int index = getHost().getChildren().indexOf(after); + // command.setIndex(index); + // return command; + return null; + } + + @Override + protected boolean isHorizontal() { + IFigure figure = getLayoutContainer(); + if (figure.getLayoutManager() instanceof ToolbarLayout) { + return ((ToolbarLayout) figure.getLayoutManager()).isHorizontal(); + } else if (figure.getLayoutManager() instanceof FlowLayout) { + return ((FlowLayout) figure.getLayoutManager()).isHorizontal(); + } + return false; + } + + @Override + public void showLayoutTargetFeedback(Request request) { + if (request instanceof CreateRequest) { + Object newObject = ((CreateRequest) request).getNewObject(); + if (!(newObject instanceof BTableColumn || newObject instanceof BTableCell)) + return; + } + super.showLayoutTargetFeedback(request); + } + +} diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMotionNodeEditPolicy.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSNodeEditPolicy.java similarity index 94% rename from de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMotionNodeEditPolicy.java rename to de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSNodeEditPolicy.java index 71e68f16775c4bd77a02435070de5179d75e7607..cfb5c0cba8a0ddb00792ca2bfa8744dac33a5b7b 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMotionNodeEditPolicy.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSNodeEditPolicy.java @@ -16,7 +16,7 @@ import de.bmotionstudio.gef.editor.command.ConnectionReconnectCommand; import de.bmotionstudio.gef.editor.model.BConnection; import de.bmotionstudio.gef.editor.model.BControl; -public class BMotionNodeEditPolicy extends GraphicalNodeEditPolicy { +public class BMSNodeEditPolicy extends GraphicalNodeEditPolicy { /* * (non-Javadoc) diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMotionStudioResizableEditPolicy.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSResizableEditPolicy.java similarity index 93% rename from de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMotionStudioResizableEditPolicy.java rename to de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSResizableEditPolicy.java index cbe96daaf417a66b0d166d8d4fa292a28c853097..0c51a081ccef22f7cff3e5ee76d8273819b8f891 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMotionStudioResizableEditPolicy.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMSResizableEditPolicy.java @@ -15,7 +15,7 @@ import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gef.LayerConstants; import org.eclipse.gef.editpolicies.ResizableEditPolicy; -public class BMotionStudioResizableEditPolicy extends ResizableEditPolicy { +public class BMSResizableEditPolicy extends ResizableEditPolicy { /** * Creates the figure used for feedback. diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMotionStudioFlowEditPolicy.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMotionStudioFlowEditPolicy.java deleted file mode 100644 index 956819493c3a5554155a51cf5f936bd59fd19356..0000000000000000000000000000000000000000 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/BMotionStudioFlowEditPolicy.java +++ /dev/null @@ -1,113 +0,0 @@ -/** - * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, - * Heinrich Heine Universitaet Duesseldorf - * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) - * */ -package de.bmotionstudio.gef.editor.editpolicy; - -import org.eclipse.draw2d.FlowLayout; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.FlowLayoutEditPolicy; -import org.eclipse.gef.requests.CreateRequest; - -import de.bmotionstudio.gef.editor.command.AddCommand; -import de.bmotionstudio.gef.editor.command.ReorderPartCommand; -import de.bmotionstudio.gef.editor.model.BControl; -import de.bmotionstudio.gef.editor.model.BTable; -import de.bmotionstudio.gef.editor.model.BTableCell; -import de.bmotionstudio.gef.editor.model.BTableColumn; - -public class BMotionStudioFlowEditPolicy extends FlowLayoutEditPolicy { - - @Override - protected Command createAddCommand(EditPart child, EditPart after) { - - BControl childModel = (BControl) child.getModel(); - BControl parentModel = (BControl) getHost().getModel(); - if ((childModel instanceof BTableColumn && parentModel instanceof BTable) - || (childModel instanceof BTableCell - && parentModel instanceof BTableColumn && childModel - .getParent().equals(parentModel))) { - AddCommand command = new AddCommand(); - command.setChild(childModel); - command.setParent(parentModel); - int index = getHost().getChildren().indexOf(after); - command.setIndex(index); - return command; - } - return null; - } - - /** - * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#createChildEditPolicy(org.eclipse.gef.EditPart) - */ - protected EditPolicy createChildEditPolicy(EditPart child) { - BMotionStudioResizableEditPolicy policy = new BMotionStudioResizableEditPolicy(); - policy.setResizeDirections(PositionConstants.EAST - | PositionConstants.WEST); - return policy; - } - - @Override - protected Command createMoveChildCommand(EditPart child, EditPart after) { - - - BControl childModel = (BControl) child.getModel(); - BControl parentModel = (BControl) getHost().getModel(); - - if ((childModel instanceof BTableColumn && parentModel instanceof BTable) - || (childModel instanceof BTableCell && parentModel instanceof BTableColumn)) { - 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; - } - - return null; - - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - // CreateCommand command = new CreateCommand( - // (BControl) request.getNewObject(), (BControl) getHost() - // .getModel()); - // EditPart after = getInsertionReference(request); - // command.setLayout(new Rectangle(0, 0, 100, 25)); - // int index = getHost().getChildren().indexOf(after); - // command.setIndex(index); - // return command; - return null; - } - - @Override - protected boolean isHorizontal() { - IFigure figure = getLayoutContainer(); - if (figure.getLayoutManager() instanceof ToolbarLayout) { - return ((ToolbarLayout) figure.getLayoutManager()).isHorizontal(); - } else if (figure.getLayoutManager() instanceof FlowLayout) { - return ((FlowLayout) figure.getLayoutManager()).isHorizontal(); - } - return false; - } - - @Override - public void showLayoutTargetFeedback(Request request) { - if (request instanceof CreateRequest) { - Object newObject = ((CreateRequest) request).getNewObject(); - if (!(newObject instanceof BTableColumn || newObject instanceof BTableCell)) - return; - } - super.showLayoutTargetFeedback(request); - } - -} diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/ChangeAttributePolicy.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/ChangeAttributePolicy.java index cfeb087846f7263a215af10a187f2999a7eca1d9..781627fa430f9ac8bfae681adc2f5c01ab88f7dd 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/ChangeAttributePolicy.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/ChangeAttributePolicy.java @@ -13,7 +13,7 @@ import org.eclipse.gef.editpolicies.AbstractEditPolicy; import de.bmotionstudio.gef.editor.library.AbstractLibraryCommand; import de.bmotionstudio.gef.editor.library.AttributeRequest; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; public class ChangeAttributePolicy extends AbstractEditPolicy { @@ -25,7 +25,7 @@ public class ChangeAttributePolicy extends AbstractEditPolicy { && request instanceof AttributeRequest) { AttributeRequest changeAttributeReq = (AttributeRequest) request; if (changeAttributeReq.getAttributeTransferObject() != null) { - AbstractLibraryCommand command = ((AppAbstractEditPart) getHost()) + AbstractLibraryCommand command = ((BMSAbstractEditPart) getHost()) .getLibraryCommand(changeAttributeReq); if (command != null) { command.setEditPart(getHost()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/CustomDirectEditPolicy.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/CustomDirectEditPolicy.java index 0676c50ab47bd98a5fd9a44c929bf0e7de2dc97c..a25a39d8859a2d736cde7e70e2e77dd9ab4730c0 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/CustomDirectEditPolicy.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/editpolicy/CustomDirectEditPolicy.java @@ -12,7 +12,7 @@ import org.eclipse.gef.requests.DirectEditRequest; import de.bmotionstudio.gef.editor.command.RenameCommand; import de.bmotionstudio.gef.editor.model.BControl; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; public class CustomDirectEditPolicy extends DirectEditPolicy { @@ -21,7 +21,7 @@ public class CustomDirectEditPolicy extends DirectEditPolicy { */ protected Command getDirectEditCommand(DirectEditRequest edit) { String labelText = (String) edit.getCellEditor().getValue(); - AppAbstractEditPart label = (AppAbstractEditPart) getHost(); + BMSAbstractEditPart label = (BMSAbstractEditPart) getHost(); RenameCommand command = new RenameCommand(); command.setControl((BControl) label.getModel()); command.setNewString(labelText); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/eventb/EventBHelper.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/eventb/EventBHelper.java index 8e38321cd1a05a202ef222c752bcd764c728ffc3..62f1087c4a17fafe0483af6149f0ac8ccf909ee4 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/eventb/EventBHelper.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/eventb/EventBHelper.java @@ -11,8 +11,8 @@ import java.util.Collections; import java.util.List; import org.eclipse.core.resources.IFile; -import org.eventb.core.IMachineRoot; import org.eventb.core.ISCConstant; +import org.eventb.core.ISCContextRoot; import org.eventb.core.ISCEvent; import org.eventb.core.ISCGuard; import org.eventb.core.ISCInternalContext; @@ -20,6 +20,10 @@ import org.eventb.core.ISCInvariant; import org.eventb.core.ISCMachineRoot; import org.eventb.core.ISCParameter; import org.eventb.core.ISCVariable; +import org.eventb.core.ast.FormulaFactory; +import org.eventb.core.basis.ContextRoot; +import org.eventb.core.basis.EventBRoot; +import org.eventb.core.basis.MachineRoot; import org.rodinp.core.IRodinFile; import org.rodinp.core.IRodinProject; import org.rodinp.core.RodinCore; @@ -29,18 +33,19 @@ import de.bmotionstudio.gef.editor.model.Visualization; import de.prob.logging.Logger; public final class EventBHelper { + + private static FormulaFactory formularFactory = FormulaFactory.getDefault(); - public static ISCMachineRoot getCorrespondingFile(IFile file, + public static EventBRoot getCorrespondingFile(IFile file, String machineFileName) { IRodinProject rProject = RodinCore.valueOf(file.getProject()); - ISCMachineRoot machineRoot = null; + EventBRoot root = null; if (rProject != null) { IRodinFile rFile = rProject.getRodinFile(machineFileName); - if (rFile != null && rFile.getRoot() instanceof IMachineRoot) - machineRoot = ((IMachineRoot) rFile.getRoot()) - .getSCMachineRoot(); + if (rFile != null && rFile.getRoot() instanceof EventBRoot) + root = (EventBRoot) rFile.getRoot(); } - return machineRoot; + return root; } public static List<MachineOperation> getOperations( @@ -50,11 +55,15 @@ public final class EventBHelper { if (visualization.getLanguage().equals("EventB")) { - ISCMachineRoot machineRoot = null; - machineRoot = getCorrespondingFile(visualization.getProjectFile(), + EventBRoot correspondingFile = getCorrespondingFile( + visualization.getProjectFile(), visualization.getMachineName()); - if (machineRoot != null) { + if (correspondingFile instanceof MachineRoot + && correspondingFile.exists()) { + + ISCMachineRoot machineRoot = correspondingFile + .getSCMachineRoot(); try { @@ -85,10 +94,10 @@ public final class EventBHelper { .unmodifiableList(new ArrayList<MachineOperation>()); } + } else if (visualization.getLanguage().equals("ClassicalB")) { + // TODO: Implement me!!! } - } else if (visualization.getLanguage().equals("ClassicalB")) { - // TODO: Implement me!!! } return tmpSet; @@ -98,30 +107,32 @@ public final class EventBHelper { public static List<MachineContentObject> getVariables( Visualization visualization) { - ISCMachineRoot machineRoot = null; - - machineRoot = getCorrespondingFile(visualization.getProjectFile(), - visualization.getMachineName()); + EventBRoot correspondingFile = getCorrespondingFile( + visualization.getProjectFile(), visualization.getMachineName()); - ISCVariable[] vars = null; ArrayList<MachineContentObject> tmpSet = new ArrayList<MachineContentObject>(); - try { - vars = machineRoot.getSCVariables(); + if (correspondingFile instanceof MachineRoot + && correspondingFile.exists()) { - for (ISCVariable var : vars) { - - MachineContentObject machinevar = new MachineContentObject( - var.getIdentifierString()); - tmpSet.add(machinevar); + ISCMachineRoot machineRoot = correspondingFile.getSCMachineRoot(); + try { + ISCVariable[] vars = machineRoot.getSCVariables(); + for (ISCVariable var : vars) { + MachineContentObject machinevar = new MachineContentObject( + var.getIdentifierString()); + machinevar.setType(var.getType(formularFactory)); + tmpSet.add(machinevar); + } + } catch (RodinDBException e) { + String message = "Rodin DB Exception while getting variables: " + + e.getLocalizedMessage(); + Logger.notifyUser(message, e); + return Collections + .unmodifiableList(new ArrayList<MachineContentObject>()); } - } catch (RodinDBException e) { - String message = "Rodin DB Exception while getting variables: " - + e.getLocalizedMessage(); - Logger.notifyUser(message, e); - return Collections - .unmodifiableList(new ArrayList<MachineContentObject>()); + } return tmpSet; @@ -131,69 +142,95 @@ public final class EventBHelper { public static List<MachineContentObject> getInvariants( Visualization visualization) { - ISCMachineRoot machineRoot = null; + EventBRoot correspondingFile = getCorrespondingFile( + visualization.getProjectFile(), visualization.getMachineName()); - machineRoot = getCorrespondingFile(visualization.getProjectFile(), - visualization.getMachineName()); - - ISCInvariant[] invariants = null; ArrayList<MachineContentObject> tmpSet = new ArrayList<MachineContentObject>(); - try { - invariants = machineRoot.getSCInvariants(); - - for (ISCInvariant inv : invariants) { + if (correspondingFile instanceof MachineRoot + && correspondingFile.exists()) { - MachineContentObject machineinv = new MachineContentObject( - inv.getPredicateString()); - tmpSet.add(machineinv); + ISCMachineRoot machineRoot = correspondingFile.getSCMachineRoot(); + try { + ISCInvariant[] invariants = machineRoot.getSCInvariants(); + for (ISCInvariant inv : invariants) { + MachineContentObject machineinv = new MachineContentObject( + inv.getPredicateString()); + tmpSet.add(machineinv); + } + } catch (RodinDBException e) { + String message = "Rodin DB Exception while getting invariants: " + + e.getLocalizedMessage(); + Logger.notifyUser(message, e); + return Collections + .unmodifiableList(new ArrayList<MachineContentObject>()); } - } catch (RodinDBException e) { - String message = "Rodin DB Exception while getting invariants: " - + e.getLocalizedMessage(); - Logger.notifyUser(message, e); - return Collections - .unmodifiableList(new ArrayList<MachineContentObject>()); + } return tmpSet; + } public static List<MachineContentObject> getConstants( Visualization visualization) { - ISCMachineRoot machineRoot = null; - - machineRoot = getCorrespondingFile(visualization.getProjectFile(), - visualization.getMachineName()); + EventBRoot correspondingFile = getCorrespondingFile( + visualization.getProjectFile(), visualization.getMachineName()); ArrayList<MachineContentObject> tmpSet = new ArrayList<MachineContentObject>(); - try { + if (correspondingFile.exists()) { - ISCInternalContext[] seenContexts = machineRoot.getSCSeenContexts(); - for (ISCInternalContext context : seenContexts) { + try { + if (correspondingFile instanceof MachineRoot) { - for (ISCConstant constant : context.getSCConstants()) { + ISCMachineRoot machineRoot = correspondingFile + .getSCMachineRoot(); - MachineContentObject machineinv = new MachineContentObject( - constant.getIdentifierString()); - tmpSet.add(machineinv); + ISCInternalContext[] seenContexts = machineRoot + .getSCSeenContexts(); + for (ISCInternalContext context : seenContexts) { + + for (ISCConstant constant : context.getSCConstants()) { + + MachineContentObject machineinv = new MachineContentObject( + constant.getIdentifierString()); + machineinv.setType(constant + .getType(formularFactory)); + tmpSet.add(machineinv); + + } + + } + + } else if (correspondingFile instanceof ContextRoot) { + + ISCContextRoot contextRoot = correspondingFile + .getSCContextRoot(); + for (ISCConstant constant : contextRoot.getSCConstants()) { + MachineContentObject machineinv = new MachineContentObject( + constant.getIdentifierString()); + machineinv.setType(constant.getType(formularFactory)); + tmpSet.add(machineinv); + } } + } catch (RodinDBException e) { + String message = "Rodin DB Exception while getting constants: " + + e.getLocalizedMessage(); + Logger.notifyUser(message, e); + return Collections + .unmodifiableList(new ArrayList<MachineContentObject>()); } - } catch (RodinDBException e) { - String message = "Rodin DB Exception while getting constants: " - + e.getLocalizedMessage(); - Logger.notifyUser(message, e); - return Collections - .unmodifiableList(new ArrayList<MachineContentObject>()); } return tmpSet; + } + } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/eventb/MachineContentObject.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/eventb/MachineContentObject.java index d032677402fc822500ba698ee4874eb6de46e371..e96ac7b06d2282ca95ac0713d56474ccc7a31b38 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/eventb/MachineContentObject.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/eventb/MachineContentObject.java @@ -6,12 +6,15 @@ package de.bmotionstudio.gef.editor.eventb; +import org.eventb.core.ast.Type; + import de.bmotionstudio.gef.editor.BindingObject; public class MachineContentObject extends BindingObject { - private String label; + private String label; + private Type type; public MachineContentObject(String label) { this.setLabel(label); @@ -27,6 +30,14 @@ public class MachineContentObject extends BindingObject { public String toString() { return this.label; - } + } + + public Type getType() { + return type; + } + + public void setType(Type type) { + this.type = type; + } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/TableCellFigure.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/TableCellFigure.java index 09fa6fa84acfab68cb940adbfe6c51657d82c5dc..c9cf14e5e1e9eb334be3c423412a2376f55aa126 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/TableCellFigure.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/TableCellFigure.java @@ -32,6 +32,7 @@ public class TableCellFigure extends AbstractTableFigure { Color foregroundColor = getForegroundColor(); if (foregroundColor != null) g.setForegroundColor(foregroundColor); + // Bottom cell line g.drawLine(r.x, r.y, r.x + r.width, r.y); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/TableColumnFigure.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/TableColumnFigure.java index e036e5d6863b911b900ce07012635ed3b6ff0715..1b03990e88d9fd86f86035d8f48b58e6e78128b1 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/TableColumnFigure.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/TableColumnFigure.java @@ -10,7 +10,7 @@ public class TableColumnFigure extends AbstractTableFigure { public TableColumnFigure() { ToolbarLayout toolbarLayout = new ToolbarLayout(); setLayoutManager(toolbarLayout); - setOpaque(true); + setOpaque(false); } @Override @@ -19,9 +19,11 @@ public class TableColumnFigure extends AbstractTableFigure { Color foregroundColor = getForegroundColor(); if (foregroundColor != null) g.setForegroundColor(foregroundColor); - g.drawLine(r.x, r.y, r.x + r.width, r.y); - g.drawLine(r.x, r.y, r.x, r.y + r.height - 1); - g.drawLine(r.x, r.y + r.height - 1, r.x + r.width, r.y + r.height - 1); + // g.drawLine(r.x, r.y, r.x + r.width, r.y); + // Left line + g.drawLine(r.x, r.y, r.x, r.y + r.height - 15); + // Bottom line + g.drawLine(r.x, r.y + r.height - 15, r.x + r.width, r.y + r.height - 15); super.paintBorder(g); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/TableFigure.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/TableFigure.java index fb322781139451c5f90a087cb2513e1eabdfc9bf..3f0dafe095a12ff114047216986abd403ab3f66a 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/TableFigure.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/TableFigure.java @@ -15,17 +15,17 @@ public class TableFigure extends AbstractTableFigure { public TableFigure() { ToolbarLayout toolbarLayout = new ToolbarLayout(); toolbarLayout.setHorizontal(true); - toolbarLayout.setStretchMinorAxis(false); setLayoutManager(toolbarLayout); - setOpaque(true); + setOpaque(false); } @Override protected void paintBorder(Graphics g) { Rectangle r = getClientArea(); g.setForegroundColor(getForegroundColor()); - g.drawLine(r.x + r.width - 1, r.y, r.x + r.width - 1, r.y + r.height - - 1); + // Right table border line + g.drawLine(r.x + r.width - 21, r.y, r.x + r.width - 21, r.y + r.height + - 15); super.paintBorder(g); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/internal/BControlPropertySource.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/internal/BControlPropertySource.java index 0dffa83af3bf68c5c5a3964c8eb79464fb1266e8..625d75213e4d709338b1c3cacff9411096d350f1 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/internal/BControlPropertySource.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/internal/BControlPropertySource.java @@ -19,9 +19,8 @@ public class BControlPropertySource extends AbstractAttribute { private BAttributeMisc miscAttribute; public BControlPropertySource(BControl control) { - super(null); this.control = control; - this.miscAttribute = new BAttributeMisc(null); + this.miscAttribute = new BAttributeMisc(); addChild(this.miscAttribute); init(); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BButton.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BButton.java index 4e504fe9f8b582312cfad166c773d3062fcec261..ba400c1ec2d1ba36747eca9a3b28729f5d507052 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BButton.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BButton.java @@ -9,10 +9,6 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.swt.graphics.RGB; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.attribute.BAttributeBackgroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeEnabled; -import de.bmotionstudio.gef.editor.attribute.BAttributeText; -import de.bmotionstudio.gef.editor.attribute.BAttributeTextColor; /** * @author Lukas Ladenberger @@ -35,12 +31,15 @@ public class BButton extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeText(DEFAULT_TEXT)); - initAttribute(new BAttributeBackgroundColor(new RGB(192, 192, 192))); - initAttribute(new BAttributeTextColor(new RGB(0, 0, 0))); - initAttribute(new BAttributeEnabled(true)); - getAttribute(AttributeConstants.ATTRIBUTE_HEIGHT).setValue(25); - getAttribute(AttributeConstants.ATTRIBUTE_WIDTH).setValue(100); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT, DEFAULT_TEXT); + initAttribute(AttributeConstants.ATTRIBUTE_BACKGROUND_COLOR, new RGB( + 192, 192, 192)); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT_COLOR, new RGB(0, 0, 0)); + initAttribute(AttributeConstants.ATTRIBUTE_ENABLED, true); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 25, + AttributeConstants.ATTRIBUTE_SIZE); + initAttribute(AttributeConstants.ATTRIBUTE_WIDTH, 100, + AttributeConstants.ATTRIBUTE_SIZE); } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BCheckbox.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BCheckbox.java index 32b0235053ac80f1e731fd4c3a05c022bb29aeb2..39cc02f81a4a35c00c4b83f9465eea0feff746aa 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BCheckbox.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BCheckbox.java @@ -9,12 +9,6 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.swt.graphics.RGB; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.attribute.BAttributeChecked; -import de.bmotionstudio.gef.editor.attribute.BAttributeEnabled; -import de.bmotionstudio.gef.editor.attribute.BAttributeFalseValue; -import de.bmotionstudio.gef.editor.attribute.BAttributeText; -import de.bmotionstudio.gef.editor.attribute.BAttributeTextColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeTrueValue; /** * @author Lukas Ladenberger @@ -37,14 +31,14 @@ public class BCheckbox extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeText(DEFAULT_TEXT)); - initAttribute(new BAttributeTextColor(new RGB(0, 0, 0))); - initAttribute(new BAttributeChecked(true)); - initAttribute(new BAttributeEnabled(true)); - initAttribute(new BAttributeTrueValue("")); - initAttribute(new BAttributeFalseValue("")); - getAttribute(AttributeConstants.ATTRIBUTE_HEIGHT).setValue(21); - getAttribute(AttributeConstants.ATTRIBUTE_HEIGHT).setEditable(false); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT, DEFAULT_TEXT); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT_COLOR, new RGB(0, 0, 0)); + initAttribute(AttributeConstants.ATTRIBUTE_CHECKED, true); + initAttribute(AttributeConstants.ATTRIBUTE_ENABLED, true); + initAttribute(AttributeConstants.ATTRIBUTE_TRUEVALUE, ""); + initAttribute(AttributeConstants.ATTRIBUTE_FALSEVALUE, ""); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 21, false, false, + AttributeConstants.ATTRIBUTE_SIZE); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BComposite.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BComposite.java index bd27178b389ce230c92a0be75cc1d86651f0d9fd..8bfb44d6867ec5b7d26dbc8204373114e8973410 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BComposite.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BComposite.java @@ -8,8 +8,7 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.swt.graphics.RGB; -import de.bmotionstudio.gef.editor.attribute.BAttributeBackgroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeImage; +import de.bmotionstudio.gef.editor.AttributeConstants; /** * @author Lukas Ladenberger @@ -30,8 +29,9 @@ public class BComposite extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeBackgroundColor(new RGB(192, 192, 192))); - initAttribute(new BAttributeImage(null)); + initAttribute(AttributeConstants.ATTRIBUTE_BACKGROUND_COLOR, new RGB( + 192, 192, 192)); + initAttribute(AttributeConstants.ATTRIBUTE_IMAGE, null); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BConnection.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BConnection.java index 7bc29f41187bf6c9727fdae329b3c39956eebf2a..048da4cfc3c726f28410804f93b96adf8ba02e4f 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BConnection.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BConnection.java @@ -8,14 +8,10 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.swt.graphics.RGB; -import de.bmotionstudio.gef.editor.attribute.BAttributeConnection; +import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.attribute.BAttributeConnectionSourceDecoration; import de.bmotionstudio.gef.editor.attribute.BAttributeConnectionTargetDecoration; -import de.bmotionstudio.gef.editor.attribute.BAttributeForegroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeLabel; import de.bmotionstudio.gef.editor.attribute.BAttributeLineStyle; -import de.bmotionstudio.gef.editor.attribute.BAttributeLineWidth; -import de.bmotionstudio.gef.editor.internal.BControlPropertySource; public class BConnection extends BControl { @@ -121,21 +117,24 @@ public class BConnection extends BControl { @Override protected void initAttributes() { - BAttributeConnection bAttributeConnection = new BAttributeConnection( - null); - initAttribute(bAttributeConnection, BControlPropertySource.ROOT); - initAttribute(new BAttributeLineWidth(1), bAttributeConnection); - initAttribute(new BAttributeLineStyle( - BAttributeLineStyle.SOLID_CONNECTION), bAttributeConnection); - initAttribute(new BAttributeForegroundColor(new RGB(0, 0, 0)), - bAttributeConnection); - initAttribute(new BAttributeConnectionSourceDecoration( - BAttributeConnectionSourceDecoration.DECORATION_NONE), - bAttributeConnection); - initAttribute(new BAttributeConnectionTargetDecoration( - BAttributeConnectionTargetDecoration.DECORATION_NONE), - bAttributeConnection); - initAttribute(new BAttributeLabel("Label..."), bAttributeConnection); + initAttribute(AttributeConstants.ATTRIBUTE_CONNECTION, null); + initAttribute(AttributeConstants.ATTRIBUTE_LINEWIDTH, 1, + AttributeConstants.ATTRIBUTE_CONNECTION); + initAttribute(AttributeConstants.ATTRIBUTE_LINESTYLE, + BAttributeLineStyle.SOLID_CONNECTION, + AttributeConstants.ATTRIBUTE_CONNECTION); + initAttribute(AttributeConstants.ATTRIBUTE_FOREGROUND_COLOR, new RGB(0, + 0, 0), AttributeConstants.ATTRIBUTE_CONNECTION); + initAttribute( + AttributeConstants.ATTRIBUTE_CONNECTION_SOURCE_DECORATION, + BAttributeConnectionSourceDecoration.DECORATION_NONE, + AttributeConstants.ATTRIBUTE_CONNECTION); + initAttribute( + AttributeConstants.ATTRIBUTE_CONNECTION_TARGET_DECORATION, + BAttributeConnectionTargetDecoration.DECORATION_NONE, + AttributeConstants.ATTRIBUTE_CONNECTION); + initAttribute(AttributeConstants.ATTRIBUTE_LABEL, "Label...", + AttributeConstants.ATTRIBUTE_CONNECTION); } } \ No newline at end of file diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java index 0af0557d5e5d946e0e4a40d39b66a0dbc0f764d6..d0ed727fd2470fc8f7b181f2bc9a50bbcb2fa4cb 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java @@ -29,15 +29,6 @@ import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.BMotionEditorPlugin; import de.bmotionstudio.gef.editor.BMotionStudioImage; import de.bmotionstudio.gef.editor.attribute.AbstractAttribute; -import de.bmotionstudio.gef.editor.attribute.BAttributeCoordinates; -import de.bmotionstudio.gef.editor.attribute.BAttributeCustom; -import de.bmotionstudio.gef.editor.attribute.BAttributeHeight; -import de.bmotionstudio.gef.editor.attribute.BAttributeID; -import de.bmotionstudio.gef.editor.attribute.BAttributeSize; -import de.bmotionstudio.gef.editor.attribute.BAttributeVisible; -import de.bmotionstudio.gef.editor.attribute.BAttributeWidth; -import de.bmotionstudio.gef.editor.attribute.BAttributeX; -import de.bmotionstudio.gef.editor.attribute.BAttributeY; import de.bmotionstudio.gef.editor.internal.BControlPropertySource; import de.bmotionstudio.gef.editor.observer.IObserverListener; import de.bmotionstudio.gef.editor.observer.Observer; @@ -102,6 +93,14 @@ public abstract class BControl implements IAdaptable, Cloneable { /** Property ID to use when the list of incoming connections is modified. */ public static final String TARGET_CONNECTIONS_PROP = "BMS.TargetConn"; + public static final String[] standardAttributes = { + AttributeConstants.ATTRIBUTE_X, + AttributeConstants.ATTRIBUTE_Y, AttributeConstants.ATTRIBUTE_WIDTH, + AttributeConstants.ATTRIBUTE_HEIGHT, + AttributeConstants.ATTRIBUTE_ID, + AttributeConstants.ATTRIBUTE_CUSTOM, + AttributeConstants.ATTRIBUTE_VISIBLE }; + public BControl(Visualization visualization) { this.visualization = visualization; this.children = new BControlList(); @@ -172,7 +171,17 @@ public abstract class BControl implements IAdaptable, Cloneable { private void init() { - // Init ID + // Init custom control attributes + initAttributes(); + + // Init standard control attributes + initStandardAttributes(); + + } + + private void initStandardAttributes() { + + // Init unique ID String ID; if (this instanceof Visualization) ID = "visualization"; @@ -180,25 +189,45 @@ public abstract class BControl implements IAdaptable, Cloneable { ID = UUID.randomUUID().toString(); else ID = (visualization.getMaxIDString(type)); - initAttribute(new BAttributeID(ID), AbstractAttribute.ROOT); - - // Init location and dimension attributes - BAttributeCoordinates coordinatesAtr = new BAttributeCoordinates(null); - initAttribute(coordinatesAtr, AbstractAttribute.ROOT); - initAttribute(new BAttributeX(100), coordinatesAtr); - initAttribute(new BAttributeY(100), coordinatesAtr); - - BAttributeSize sizeAtr = new BAttributeSize(null); - initAttribute(sizeAtr, AbstractAttribute.ROOT); - initAttribute(new BAttributeWidth(100), sizeAtr); - initAttribute(new BAttributeHeight(100), sizeAtr); + initAttribute(AttributeConstants.ATTRIBUTE_ID, ID, + AbstractAttribute.ROOT); + + initAttribute(AttributeConstants.ATTRIBUTE_MISC, "", + AbstractAttribute.ROOT); + + // initAttribute(new BAttributeID(ID), AbstractAttribute.ROOT); + + // Init location and size attributes + initAttribute(AttributeConstants.ATTRIBUTE_COORDINATES, null, + AbstractAttribute.ROOT); + initAttribute(AttributeConstants.ATTRIBUTE_X, 100, + AttributeConstants.ATTRIBUTE_COORDINATES); + initAttribute(AttributeConstants.ATTRIBUTE_Y, 100, + AttributeConstants.ATTRIBUTE_COORDINATES); + + // BAttributeCoordinates coordinatesAtr = new + // BAttributeCoordinates(null); + // initAttribute(coordinatesAtr, AbstractAttribute.ROOT); + // initAttribute(new BAttributeX(100), coordinatesAtr); + // initAttribute(new BAttributeY(100), coordinatesAtr); + + initAttribute(AttributeConstants.ATTRIBUTE_SIZE, null, + AbstractAttribute.ROOT); + initAttribute(AttributeConstants.ATTRIBUTE_WIDTH, 100, + AttributeConstants.ATTRIBUTE_SIZE); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 100, + AttributeConstants.ATTRIBUTE_SIZE); + + // BAttributeSize sizeAtr = new BAttributeSize(null); + // initAttribute(sizeAtr, AbstractAttribute.ROOT); + // initAttribute(new BAttributeWidth(100), sizeAtr); + // initAttribute(new BAttributeHeight(100), sizeAtr); // Init visible and this attribute - initAttribute(new BAttributeVisible(true), AbstractAttribute.ROOT); - initAttribute(new BAttributeCustom(""), AbstractAttribute.ROOT); - - // Init custom control attributes - initAttributes(); + initAttribute(AttributeConstants.ATTRIBUTE_VISIBLE, true, + AbstractAttribute.ROOT); + initAttribute(AttributeConstants.ATTRIBUTE_CUSTOM, 100, + AbstractAttribute.ROOT); } @@ -433,6 +462,10 @@ public abstract class BControl implements IAdaptable, Cloneable { } } + public void removeObserver(Observer observer) { + removeObserver(observer.getID()); + } + public void removeObserver(String observerID) { if (hasObserver(observerID)) observers.get(observerID).beforeDelete(this); @@ -738,26 +771,103 @@ public abstract class BControl implements IAdaptable, Cloneable { public abstract String getType(); - protected void initAttribute(AbstractAttribute atr) { - AbstractAttribute matr = getAttributes().get(atr.getID()); - if (matr != null) { - matr.setEditable(atr.isEditable()); - matr.setGroup(atr.getGroup()); - matr.setShow(atr.show()); - } else { - getAttributes().put(atr.getID(), atr); - } + protected void initAttribute(String id, Object defaultValue) { + initAttribute(id, defaultValue, true, true, + AttributeConstants.ATTRIBUTE_MISC); } - protected void initAttribute(AbstractAttribute atr, AbstractAttribute group) { - initAttribute(atr, group.getClass().getName()); + protected void initAttribute(String id, Object defaultValue, String groupID) { + initAttribute(id, defaultValue, true, true, groupID); } - protected void initAttribute(AbstractAttribute atr, String group) { - atr.setGroup(group); - initAttribute(atr); + protected void initAttribute(String id, Object defaultValue, + boolean editable, boolean show) { + initAttribute(id, defaultValue, editable, show, + AttributeConstants.ATTRIBUTE_MISC); } + protected void initAttribute(String id, Object defaultValue, + boolean editable, boolean show, String groupID) { + + AbstractAttribute atr = getAttribute(id); + + // If no attribute exists yet, create a new one and set the value + if (atr == null) { + atr = (AbstractAttribute) reflectiveGet(id); + if (atr != null) { + atr.setValue(defaultValue); + getAttributes().put(atr.getID(), atr); + } else { + return; + } + } + + if (!atr.isInitialized()) { + atr.setDefaultValue(defaultValue); + atr.setGroup(groupID); + atr.setEditable(editable); + atr.setShow(show); + atr.setInitialized(true); + } + + } + + // protected void initAttribute(AbstractAttribute atr) { + // AbstractAttribute matr = getAttributes().get(atr.getID()); + // if (matr != null) { + // matr.setEditable(atr.isEditable()); + // matr.setGroup(atr.getGroup()); + // matr.setShow(atr.show()); + // matr.setDefaultValue(atr.getValue()); + // } else { + // atr.setDefaultValue(atr.getValue()); + // getAttributes().put(atr.getID(), atr); + // } + // } + + private Object reflectiveGet(String className) { + Object newInstance = null; + try { + Class<?> forName = Class.forName(className); + newInstance = forName.newInstance(); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return newInstance; + } + + // protected void initAttribute(AbstractAttribute atr, AbstractAttribute + // group) { + // initAttribute(atr, group.getClass().getName()); + // } + // + // protected void initAttribute(AbstractAttribute atr, String group) { + // atr.setGroup(group); + // initAttribute(atr); + // } + // + // protected void initAttribute(AbstractAttribute atr, boolean editable, + // boolean show) { + // atr.setEditable(editable); + // atr.setShow(show); + // initAttribute(atr); + // } + // + // protected void initAttribute(AbstractAttribute atr, boolean editable) { + // atr.setEditable(editable); + // initAttribute(atr); + // } + // + // protected void initAttribute(AbstractAttribute atr, String group, + // boolean editable) { + // atr.setEditable(editable); + // initAttribute(atr, group); + // } + public boolean canHaveChildren() { return false; } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BImage.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BImage.java index 56bfeb04b8aaed27b1f8b8973aebc1d2a99e4468..4a62e4490f480b66d861cb8c90b6d7c657087b1b 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BImage.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BImage.java @@ -6,7 +6,7 @@ package de.bmotionstudio.gef.editor.model; -import de.bmotionstudio.gef.editor.attribute.BAttributeImage; +import de.bmotionstudio.gef.editor.AttributeConstants; /** * @author Lukas Ladenberger @@ -27,7 +27,7 @@ public class BImage extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeImage(null)); + initAttribute(AttributeConstants.ATTRIBUTE_IMAGE, null); } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BRadioButton.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BRadioButton.java index a05d99e1161b2e256d6e214ab911cd01dbb3a40f..d4fb6291a82a2e261e7235f4c38952ad2a666c26 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BRadioButton.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BRadioButton.java @@ -12,12 +12,6 @@ import org.eclipse.swt.graphics.RGB; import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.ButtonGroupHelper; -import de.bmotionstudio.gef.editor.attribute.BAttributeButtonGroup; -import de.bmotionstudio.gef.editor.attribute.BAttributeChecked; -import de.bmotionstudio.gef.editor.attribute.BAttributeEnabled; -import de.bmotionstudio.gef.editor.attribute.BAttributeText; -import de.bmotionstudio.gef.editor.attribute.BAttributeTextColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeValue; /** * @author Lukas Ladenberger @@ -45,14 +39,14 @@ public class BRadioButton extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeText(DEFAULT_TEXT)); - initAttribute(new BAttributeTextColor(new RGB(0, 0, 0))); - initAttribute(new BAttributeChecked(true)); - initAttribute(new BAttributeValue("")); - initAttribute(new BAttributeButtonGroup("")); - initAttribute(new BAttributeEnabled(true)); - getAttribute(AttributeConstants.ATTRIBUTE_HEIGHT).setValue(21); - getAttribute(AttributeConstants.ATTRIBUTE_HEIGHT).setEditable(false); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT, DEFAULT_TEXT); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT_COLOR, new RGB(0, 0, 0)); + initAttribute(AttributeConstants.ATTRIBUTE_CHECKED, true); + initAttribute(AttributeConstants.ATTRIBUTE_ENABLED, true); + initAttribute(AttributeConstants.ATTRIBUTE_VALUE, ""); + initAttribute(AttributeConstants.ATTRIBUTE_BUTTONGROUP, ""); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 21, false, false, + AttributeConstants.ATTRIBUTE_SIZE); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BShape.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BShape.java index 41acfd9a9e617e68f29573b442f1dc28934534ea..91d912289965f1aff6955b06b639110a2fdd1195 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BShape.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BShape.java @@ -11,14 +11,9 @@ import org.eclipse.swt.graphics.RGB; import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.BMotionStudioImage; -import de.bmotionstudio.gef.editor.attribute.BAttributeAlpha; -import de.bmotionstudio.gef.editor.attribute.BAttributeBackgroundColor; import de.bmotionstudio.gef.editor.attribute.BAttributeDirection; import de.bmotionstudio.gef.editor.attribute.BAttributeFillType; -import de.bmotionstudio.gef.editor.attribute.BAttributeForegroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeImage; import de.bmotionstudio.gef.editor.attribute.BAttributeOrientation; -import de.bmotionstudio.gef.editor.attribute.BAttributeOutlineAlpha; import de.bmotionstudio.gef.editor.attribute.BAttributeShape; /** @@ -45,16 +40,21 @@ public class BShape extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeBackgroundColor(new RGB(255, 0, 0))); - initAttribute(new BAttributeForegroundColor(new RGB(0, 0, 0))); - initAttribute(new BAttributeImage(null)); - initAttribute(new BAttributeAlpha(255)); - initAttribute(new BAttributeOutlineAlpha(0)); - initAttribute(new BAttributeShape(BAttributeShape.SHAPE_RECTANGLE)); - initAttribute(new BAttributeOrientation( - BAttributeOrientation.HORIZONTAL)); - initAttribute(new BAttributeDirection(BAttributeDirection.NORTH)); - initAttribute(new BAttributeFillType(BAttributeFillType.FILLED)); + initAttribute(AttributeConstants.ATTRIBUTE_BACKGROUND_COLOR, new RGB( + 255, 0, 0)); + initAttribute(AttributeConstants.ATTRIBUTE_FOREGROUND_COLOR, new RGB(0, + 0, 0)); + initAttribute(AttributeConstants.ATTRIBUTE_IMAGE, null); + initAttribute(AttributeConstants.ATTRIBUTE_ALPHA, 255); + initAttribute(AttributeConstants.ATTRIBUTE_OUTLINEALPHA, 0); + initAttribute(AttributeConstants.ATTRIBUTE_SHAPE, + BAttributeShape.SHAPE_RECTANGLE); + initAttribute(AttributeConstants.ATTRIBUTE_ORIENTATION, + BAttributeOrientation.HORIZONTAL); + initAttribute(AttributeConstants.ATTRIBUTE_DIRECTION, + BAttributeDirection.NORTH); + initAttribute(AttributeConstants.ATTRIBUTE_FILLTYPE, + BAttributeFillType.FILLED); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTable.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTable.java index dbb450c311d872077d1542c36331160fd9fd099a..cf3f7cb1c146632586d4fcc39c08daf0333c6c8a 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTable.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTable.java @@ -4,9 +4,7 @@ import org.eclipse.draw2d.ColorConstants; import org.eclipse.draw2d.geometry.Rectangle; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.attribute.BAttributeColumns; -import de.bmotionstudio.gef.editor.attribute.BAttributeForegroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeRows; +import de.bmotionstudio.gef.editor.attribute.AbstractAttribute; import de.bmotionstudio.gef.editor.command.CreateCommand; public class BTable extends BControl { @@ -17,8 +15,8 @@ public class BTable extends BControl { super(visualization); - int numberOfColumns = 2; - int numberOfRows = 2; + int numberOfColumns = 1; + int numberOfRows = 1; CreateCommand cmd; for (int i = 0; i < numberOfColumns; i++) { @@ -43,17 +41,16 @@ public class BTable extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeForegroundColor( - ColorConstants.black.getRGB())); - initAttribute(new BAttributeColumns(2)); - initAttribute(new BAttributeRows(2)); - getAttributes().get(AttributeConstants.ATTRIBUTE_SIZE).setShow(false); - getAttributes().get(AttributeConstants.ATTRIBUTE_COORDINATES).setShow( - false); - getAttributes().get(AttributeConstants.ATTRIBUTE_HEIGHT).setEditable( - false); - getAttributes().get(AttributeConstants.ATTRIBUTE_WIDTH).setEditable( - false); + initAttribute(AttributeConstants.ATTRIBUTE_SIZE, null, false, false, + AbstractAttribute.ROOT); + initAttribute(AttributeConstants.ATTRIBUTE_WIDTH, 0, false, false, + AttributeConstants.ATTRIBUTE_SIZE); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 0, false, false, + AttributeConstants.ATTRIBUTE_SIZE); + initAttribute(AttributeConstants.ATTRIBUTE_FOREGROUND_COLOR, + ColorConstants.black.getRGB()); + initAttribute(AttributeConstants.ATTRIBUTE_COLUMNS, 1); + initAttribute(AttributeConstants.ATTRIBUTE_ROWS, 1); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableCell.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableCell.java index 587e2cdf6281cc14a709f88dd0bd30aa713dae02..3a37da71a3d2087b455e3ea07d970a780f2368df 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableCell.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableCell.java @@ -3,10 +3,6 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.draw2d.ColorConstants; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.attribute.BAttributeBackgroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeForegroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeText; -import de.bmotionstudio.gef.editor.attribute.BAttributeTextColor; public class BTableCell extends BControl { @@ -18,25 +14,15 @@ public class BTableCell extends BControl { @Override protected void initAttributes() { - - initAttribute(new BAttributeBackgroundColor( - ColorConstants.white.getRGB())); - BAttributeForegroundColor bAttributeForegroundColor = new BAttributeForegroundColor( + initAttribute(AttributeConstants.ATTRIBUTE_BACKGROUND_COLOR, + ColorConstants.white.getRGB()); + initAttribute(AttributeConstants.ATTRIBUTE_FOREGROUND_COLOR, + ColorConstants.black.getRGB(), true, false); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT_COLOR, ColorConstants.black.getRGB()); - bAttributeForegroundColor.setShow(false); - initAttribute(bAttributeForegroundColor); - initAttribute(new BAttributeTextColor(ColorConstants.black.getRGB())); - initAttribute(new BAttributeText("")); - setAttributeValue(AttributeConstants.ATTRIBUTE_HEIGHT, 20); - setAttributeValue(AttributeConstants.ATTRIBUTE_WIDTH, 50); - getAttributes().get(AttributeConstants.ATTRIBUTE_HEIGHT).setEditable( - false); - getAttributes().get(AttributeConstants.ATTRIBUTE_WIDTH).setEditable( - false); - getAttributes().get(AttributeConstants.ATTRIBUTE_SIZE).setShow(false); - getAttributes().get(AttributeConstants.ATTRIBUTE_COORDINATES).setShow( - false); - + initAttribute(AttributeConstants.ATTRIBUTE_TEXT, ""); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 20, false, false, + AttributeConstants.ATTRIBUTE_SIZE); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableColumn.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableColumn.java index fc64b9ed8123ebd1dfd0499dafd92857e872eb06..6c4bb368ee601432ced67ef61068fd1c845d7993 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableColumn.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTableColumn.java @@ -3,7 +3,6 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.draw2d.ColorConstants; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.attribute.BAttributeForegroundColor; public class BTableColumn extends BControl { @@ -15,28 +14,10 @@ public class BTableColumn extends BControl { @Override protected void initAttributes() { - - // initAttribute(new BAttributeBackgroundColor( - // ColorConstants.white.getRGB())); - BAttributeForegroundColor bAttributeForegroundColor = new BAttributeForegroundColor( - ColorConstants.black.getRGB()); - bAttributeForegroundColor.setShow(false); - initAttribute(bAttributeForegroundColor); - // initAttribute(new - // BAttributeTextColor(ColorConstants.black.getRGB())); - getAttributes().get(AttributeConstants.ATTRIBUTE_HEIGHT).setEditable( - false); - getAttributes().get(AttributeConstants.ATTRIBUTE_HEIGHT).setShow(false); - getAttributes().get(AttributeConstants.ATTRIBUTE_COORDINATES).setShow( - false); - - // Background Color - // Font - // Foreground Color - - // Width - // Height (not editable) --> determined by number of cells - + initAttribute(AttributeConstants.ATTRIBUTE_FOREGROUND_COLOR, + ColorConstants.black.getRGB(), true, false); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 0, false, false, + AttributeConstants.ATTRIBUTE_SIZE); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BText.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BText.java index 0e713693b0ddcd75bf44869b9842317d47a6eeba..c74bfa38c918a783ea30063f0767df9fdb525549 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BText.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BText.java @@ -8,11 +8,7 @@ package de.bmotionstudio.gef.editor.model; import org.eclipse.swt.graphics.RGB; -import de.bmotionstudio.gef.editor.attribute.BAttributeBackgroundColor; -import de.bmotionstudio.gef.editor.attribute.BAttributeBackgroundVisible; -import de.bmotionstudio.gef.editor.attribute.BAttributeFont; -import de.bmotionstudio.gef.editor.attribute.BAttributeText; -import de.bmotionstudio.gef.editor.attribute.BAttributeTextColor; +import de.bmotionstudio.gef.editor.AttributeConstants; /** * @author Lukas Ladenberger @@ -35,12 +31,13 @@ public class BText extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeText(DEFAULT_TEXT)); - initAttribute(new BAttributeBackgroundColor(new RGB(255, 255, 255))); - initAttribute(new BAttributeTextColor(new RGB(0, 0, 0))); - initAttribute(new BAttributeBackgroundVisible(true)); - initAttribute(new BAttributeFont( - "1||9.75|0|WINDOWS|1|-13|0|0|0|400|0|0|0|0|0|0|0|0|")); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT, DEFAULT_TEXT); + initAttribute(AttributeConstants.ATTRIBUTE_BACKGROUND_COLOR, new RGB( + 255, 255, 255)); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT_COLOR, DEFAULT_TEXT); + initAttribute(AttributeConstants.ATTRIBUTE_BACKGROUND_VISIBLE, true); + initAttribute(AttributeConstants.ATTRIBUTE_FONT, + "1||9.75|0|WINDOWS|1|-13|0|0|0|400|0|0|0|0|0|0|0|0|"); } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTextfield.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTextfield.java index e0d323c5ce2005008306e42cbca002899cd7bf8b..d832ef10832f46d861d50e00bcc1f541b6b83e91 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTextfield.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BTextfield.java @@ -7,7 +7,6 @@ package de.bmotionstudio.gef.editor.model; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.attribute.BAttributeText; /** * @author Lukas Ladenberger @@ -30,8 +29,9 @@ public class BTextfield extends BControl { @Override protected void initAttributes() { - initAttribute(new BAttributeText(DEFAULT_TEXT)); - getAttribute(AttributeConstants.ATTRIBUTE_HEIGHT).setValue(21); + initAttribute(AttributeConstants.ATTRIBUTE_TEXT, DEFAULT_TEXT); + initAttribute(AttributeConstants.ATTRIBUTE_HEIGHT, 21, + AttributeConstants.ATTRIBUTE_SIZE); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/ObserverRootVirtualTreeNode.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/ObserverRootVirtualTreeNode.java new file mode 100644 index 0000000000000000000000000000000000000000..8562f648692ec3d27aa319bf66ce9aed15adb9cb --- /dev/null +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/ObserverRootVirtualTreeNode.java @@ -0,0 +1,31 @@ +/** + * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, + * Heinrich Heine Universitaet Duesseldorf + * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) + * */ + +package de.bmotionstudio.gef.editor.model; + +import java.util.Collection; + +import de.bmotionstudio.gef.editor.observer.Observer; + +public class ObserverRootVirtualTreeNode { + + private Collection<Observer> observer; + private BControl control; + + public ObserverRootVirtualTreeNode(BControl control) { + this.observer = control.getObservers().values(); + this.control = control; + } + + public Collection<Observer> getObserver() { + return observer; + } + + public BControl getControl() { + return control; + } + +} diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/ColumnObserver.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/ColumnObserver.java index 5b02178d00847f836dd6c3ea5b56c99c6d8054fb..04309d362c320e767f78cd5de856cdfd7495d5b8 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/ColumnObserver.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/ColumnObserver.java @@ -1,17 +1,38 @@ package de.bmotionstudio.gef.editor.observer; +import java.util.LinkedList; +import java.util.List; + import de.bmotionstudio.gef.editor.Animation; import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.attribute.AbstractAttribute; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.observer.wizard.WizardColumnObserver; import de.bmotionstudio.gef.editor.util.BMSUtil; +import de.prob.unicode.UnicodeTranslator; public class ColumnObserver extends Observer { private String expression; private String predicate; + public static List<String> split(String input, char tempReplacement) { + while (input.matches(".*\"[^\\{\\}]+,[^\\{\\}]+.*")) { + input = input.replaceAll("(\"[^\\{\\}]+),([^\\{\\}]+)", "$1" + + tempReplacement + "$2"); + } + while (input.matches(".*\\{[^\\}]+,[^\\}]+\\}.*")) { + input = input.replaceAll("(\\{[^\\}]+),([^\\}]+\\})", "$1" + + tempReplacement + "$2"); + } + String[] split = input.split(","); + List<String> output = new LinkedList<String>(); + for (String s : split) { + output.add(s.replaceAll(tempReplacement + "", ",").trim()); + } + return output; + } + @Override public void check(Animation animation, BControl control) { @@ -25,24 +46,29 @@ public class ColumnObserver extends Observer { String fEval = BMSUtil.parseExpression(expression, control, animation); - fEval = fEval.replace("}", "").replace("{", ""); - String[] splitArray = fEval.split(","); + fEval = UnicodeTranslator.toAscii(fEval); + fEval = fEval.replaceAll("^\\{", ""); + fEval = fEval.replaceAll("\\}$", ""); + List<String> output = split(fEval, '#'); AbstractAttribute attributeRows = control.getParent().getAttribute( AttributeConstants.ATTRIBUTE_ROWS); - Integer defaultRows = Integer.valueOf(attributeRows - .getInitValue().toString()); + Integer defaultRows = Integer.valueOf(attributeRows.getInitValue() + .toString()); control.getParent().setAttributeValue( AttributeConstants.ATTRIBUTE_ROWS, - defaultRows + splitArray.length, true, false); + defaultRows + output.size(), true, false); - for (int i = defaultRows; i < splitArray.length + defaultRows; i++) { + for (int i = defaultRows; i < output.size() + defaultRows; i++) { + String val = output.get(i - defaultRows); + if (val != null && val.length() > 0) + val = UnicodeTranslator.toUnicode(val); control.getChildrenArray() .get(i) .setAttributeValue(AttributeConstants.ATTRIBUTE_TEXT, - splitArray[i - defaultRows]); + val); } } @@ -70,4 +96,4 @@ public class ColumnObserver extends Observer { return new WizardColumnObserver(control, this); } -} +} \ No newline at end of file diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/TableObserver.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/TableObserver.java new file mode 100644 index 0000000000000000000000000000000000000000..9ad72ca8e76de21b1fe7c98f8f5e1c0029210c71 --- /dev/null +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/TableObserver.java @@ -0,0 +1,175 @@ +package de.bmotionstudio.gef.editor.observer; + +import java.util.LinkedList; +import java.util.List; + +import de.bmotionstudio.gef.editor.Animation; +import de.bmotionstudio.gef.editor.AttributeConstants; +import de.bmotionstudio.gef.editor.attribute.AbstractAttribute; +import de.bmotionstudio.gef.editor.model.BControl; +import de.bmotionstudio.gef.editor.observer.wizard.WizardTableObserver; +import de.bmotionstudio.gef.editor.util.BMSUtil; +import de.prob.unicode.UnicodeTranslator; + +public class TableObserver extends Observer { + + private String expression; + private String predicate; + private boolean overrideCells; + private boolean keepHeader; + + public static List<String> split(String input, char tempReplacement) { + while (input.matches(".*\\{[^\\}]+,[^\\}]+\\}.*")) { + input = input.replaceAll("(\\{[^\\}]+),([^\\}]+\\})", "$1" + + tempReplacement + "$2"); + } + List<String> output = new LinkedList<String>(); + if (input.length() > 0) { + String[] split = input.split(","); + for (String s : split) { + output.add(s.replaceAll(tempReplacement + "", ",").trim()); + } + } + return output; + } + + public static List<String> split2(String input, char tempReplacement) { + while (input.matches(".*\\([^\\)]+\\|->[^\\)]+\\).*")) { + input = input.replaceAll("(\\([^\\)]+)\\|->([^\\)]+\\))", "$1" + + tempReplacement + "$2"); + } + List<String> output = new LinkedList<String>(); + if (input.length() > 0) { + String[] split = input.split("\\|->"); + for (String s : split) { + output.add(s.replaceAll(tempReplacement + "", "\\|->").trim()); + } + } + return output; + } + + + @Override + public void check(Animation animation, BControl control) { + + // First evaluate predicate (predicate field) + String bolValue = "true"; + if (predicate != null && predicate.length() > 0) { + bolValue = BMSUtil.parsePredicate(predicate, control, animation); + } + + if (Boolean.valueOf(bolValue)) { + + String fEval = BMSUtil.parseExpression(expression, control, + animation); + + fEval = UnicodeTranslator.toAscii(fEval); + fEval = fEval.replaceAll("^\\{", ""); + fEval = fEval.replaceAll("\\}$", ""); + + String input = fEval; + List<String> rows = split(input, '#'); + + Integer numberOfOldRows = 0; + Integer numberOfOldColumns = 0; + + if (!overrideCells) { + AbstractAttribute attributeRows = control + .getAttribute(AttributeConstants.ATTRIBUTE_ROWS); + numberOfOldRows = Integer.valueOf(attributeRows.getInitValue() + .toString()); + AbstractAttribute attributeColumns = control + .getAttribute(AttributeConstants.ATTRIBUTE_COLUMNS); + numberOfOldColumns = Integer.valueOf(attributeColumns + .getInitValue().toString()); + } else if (keepHeader) { + numberOfOldRows = 1; + } + + int numberOfNewRows = rows.size(); + + // Set the correct number of rows + control.setAttributeValue(AttributeConstants.ATTRIBUTE_ROWS, + numberOfNewRows + numberOfOldRows, true, false); + + boolean setColumns = false; + + // Set content and the correct number of columns + for (int i = numberOfOldRows; i < numberOfNewRows + numberOfOldRows; i++) { + + String content = rows.get(i - numberOfOldRows); + + if (content != null && content.length() > 0) + content = UnicodeTranslator.toAscii(content); + + content = content.replaceAll("^\\(", ""); + content = content.replaceAll("\\)$", ""); + + List<String> columns = split2(content, '#'); + int numberOfNewColumns = columns.size(); + + // Set only one time the number of columns! + if (!setColumns) { + int ncolumns = numberOfNewColumns; + if (numberOfOldColumns > numberOfNewColumns) + ncolumns = numberOfOldColumns; + control.setAttributeValue( + AttributeConstants.ATTRIBUTE_COLUMNS, ncolumns, + true, false); + setColumns = true; + } + + for (int z = 0; z < numberOfNewColumns; z++) { + String val = columns.get(z); + BControl column = control.getChildrenArray().get(z); + BControl cell = column.getChildrenArray().get(i); + if (val != null && val.length() > 0) + val = UnicodeTranslator.toUnicode(val); + cell.setAttributeValue(AttributeConstants.ATTRIBUTE_TEXT, + val); + } + + } + + } + + } + + public void setExpression(String expression) { + this.expression = expression; + } + + public String getExpression() { + return expression; + } + + public String getPredicate() { + return predicate; + } + + public void setPredicate(String predicate) { + this.predicate = predicate; + } + + @Override + public ObserverWizard getWizard(BControl control) { + return new WizardTableObserver(control, this); + } + + public boolean isOverrideCells() { + return overrideCells; + } + + public void setOverrideCells(boolean overrideCells) { + this.overrideCells = overrideCells; + } + + public boolean isKeepHeader() { + return keepHeader; + } + + public void setKeepHeader(boolean keepHeader) { + this.keepHeader = keepHeader; + } + +} diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/AbstractObserverWizardPage.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/AbstractObserverWizardPage.java new file mode 100644 index 0000000000000000000000000000000000000000..2450ad1a6a17dcc9def5a1c29a412d5a6b689dca --- /dev/null +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/AbstractObserverWizardPage.java @@ -0,0 +1,30 @@ +/** + * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, + * Heinrich Heine Universitaet Duesseldorf + * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) + * */ + +package de.bmotionstudio.gef.editor.observer.wizard; + +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.PlatformUI; + +import de.bmotionstudio.gef.editor.observer.Observer; + +public class AbstractObserverWizardPage extends WizardPage { + + private Observer observer; + + protected AbstractObserverWizardPage(String pageName, Observer observer) { + super(pageName); + this.observer = observer; + } + + @Override + public void createControl(Composite parent) { + PlatformUI.getWorkbench().getHelpSystem() + .setHelp(parent, observer.getClass().getName()); + } + +} diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverCSwitchCoordinates.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverCSwitchCoordinates.java index 38305895ce7b0dc8bf14daf12637378cd77d9eb9..ff64394fa76ba39d96523a797bcf36a5b6593a2c 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverCSwitchCoordinates.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverCSwitchCoordinates.java @@ -21,7 +21,6 @@ import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -55,16 +54,19 @@ public class WizardObserverCSwitchCoordinates extends ObserverWizard { private String lastChangedControlID; - private class ObserverCSwitchCoordinatesPage extends WizardPage { + private class ObserverCSwitchCoordinatesPage extends + AbstractObserverWizardPage { private TableViewer tableViewer; protected ObserverCSwitchCoordinatesPage(final String pageName) { - super(pageName); + super(pageName, getObserver()); } public void createControl(Composite parent) { + super.createControl(parent); + DataBindingContext dbc = new DataBindingContext(); Composite container = new Composite(parent, SWT.NONE); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverListenOperationByPredicate.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverListenOperationByPredicate.java index e5bf19cf76510f3bfe7df16a056fc6c5a3239c65..cb308453068a52019fdad27dd76c93647b11d6ce 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverListenOperationByPredicate.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverListenOperationByPredicate.java @@ -30,7 +30,6 @@ import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.events.FocusEvent; @@ -68,16 +67,19 @@ public class WizardObserverListenOperationByPredicate extends ObserverWizard { private String lastChangedAttributeID; - private class ObserverListenOperationByPredicatePage extends WizardPage { + private class ObserverListenOperationByPredicatePage extends + AbstractObserverWizardPage { private TableViewer tableViewer; protected ObserverListenOperationByPredicatePage(final String pageName) { - super(pageName); + super(pageName, getObserver()); } public void createControl(final Composite parent) { + super.createControl(parent); + DataBindingContext dbc = new DataBindingContext(); Composite container = new Composite(parent, SWT.NONE); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSetAttribute.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSetAttribute.java index fae15b93d5eb8f872d7481ec19c451c0a67c2588..9e55dcc031391ca7758b5d24e84842e4def1fb66 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSetAttribute.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSetAttribute.java @@ -29,7 +29,6 @@ import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.events.FocusEvent; @@ -68,18 +67,20 @@ public class WizardObserverSetAttribute extends ObserverWizard { private String lastChangedAttributeID; - private class WizardSetAttributePage extends WizardPage { + private class WizardSetAttributePage extends AbstractObserverWizardPage { private WritableList input; private TableViewer tableViewer; protected WizardSetAttributePage(final String pageName) { - super(pageName); + super(pageName, getObserver()); } public void createControl(Composite parent) { + super.createControl(parent); + DataBindingContext dbc = new DataBindingContext(); GridLayout gl = new GridLayout(1, true); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSimpleValueDisplay.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSimpleValueDisplay.java index f8a7040057b65872931d09c65190837f27bd4c36..1f9a6b76e83c627a1de6fc7c4efc9159d53e4d58 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSimpleValueDisplay.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSimpleValueDisplay.java @@ -10,7 +10,6 @@ import org.eclipse.core.databinding.DataBindingContext; import org.eclipse.core.databinding.beans.BeansObservables; import org.eclipse.jface.databinding.swt.SWTObservables; import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; @@ -29,7 +28,8 @@ import de.bmotionstudio.gef.editor.observer.SimpleValueDisplay; public class WizardObserverSimpleValueDisplay extends ObserverWizard { - private class ObserverSimpleValueDisplayPage extends WizardPage { + private class ObserverSimpleValueDisplayPage extends + AbstractObserverWizardPage { private Text txtReplacementString; private Text txtExpression; @@ -40,11 +40,13 @@ public class WizardObserverSimpleValueDisplay extends ObserverWizard { } protected ObserverSimpleValueDisplayPage(final String pageName) { - super(pageName); + super(pageName, getObserver()); } public void createControl(final Composite parent) { + super.createControl(parent); + final DataBindingContext dbc = new DataBindingContext(); Composite container = new Composite(parent, SWT.NONE); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSwitchCoordinates.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSwitchCoordinates.java index b0082eefde87049d99f7c320587a2c3916b47636..12146bfe53df4b83082531e9adc7e4095d955ae2 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSwitchCoordinates.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSwitchCoordinates.java @@ -22,7 +22,6 @@ import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -54,16 +53,19 @@ import de.bmotionstudio.gef.editor.util.BMotionWizardUtil; public class WizardObserverSwitchCoordinates extends ObserverWizard { - private class ObserverToggleCoordinatesPage extends WizardPage { + private class ObserverToggleCoordinatesPage extends + AbstractObserverWizardPage { private TableViewer tableViewer; protected ObserverToggleCoordinatesPage(final String pageName) { - super(pageName); + super(pageName, getObserver()); } public void createControl(Composite parent) { + super.createControl(parent); + DataBindingContext dbc = new DataBindingContext(); Composite container = new Composite(parent, SWT.NONE); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSwitchImage.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSwitchImage.java index b9e689f1bb1cbeb0da42dc59d61602594492e33a..b9ac288535d963e97bd5a4076387a2d024e49f08 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSwitchImage.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardObserverSwitchImage.java @@ -22,7 +22,6 @@ import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -56,16 +55,18 @@ import de.bmotionstudio.gef.editor.util.BMotionWizardUtil; public class WizardObserverSwitchImage extends ObserverWizard { - private class ObserverSwitchImagePage extends WizardPage { + private class ObserverSwitchImagePage extends AbstractObserverWizardPage { private TableViewer tableViewer; protected ObserverSwitchImagePage(final String pageName) { - super(pageName); + super(pageName, getObserver()); } public void createControl(final Composite parent) { + super.createControl(parent); + DataBindingContext dbc = new DataBindingContext(); Composite container = new Composite(parent, SWT.NONE); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardTableObserver.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardTableObserver.java new file mode 100644 index 0000000000000000000000000000000000000000..e816e1d3ee2c517bca6e12dd054b201e29cea5e2 --- /dev/null +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/wizard/WizardTableObserver.java @@ -0,0 +1,210 @@ +/** + * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, + * Heinrich Heine Universitaet Duesseldorf + * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) + * */ + +package de.bmotionstudio.gef.editor.observer.wizard; + +import java.util.ArrayList; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeansObservables; +import org.eclipse.jface.databinding.swt.SWTObservables; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.List; +import org.eclipse.swt.widgets.Text; +import org.eventb.core.ast.PowerSetType; + +import de.bmotionstudio.gef.editor.eventb.EventBHelper; +import de.bmotionstudio.gef.editor.eventb.MachineContentObject; +import de.bmotionstudio.gef.editor.model.BControl; +import de.bmotionstudio.gef.editor.observer.Observer; +import de.bmotionstudio.gef.editor.observer.ObserverWizard; +import de.bmotionstudio.gef.editor.observer.TableObserver; + +public class WizardTableObserver extends ObserverWizard { + + private class TableObserverPage extends WizardPage { + + private Text txtExpression; + private Text txtPredicate; + private Button cbOverrideCells; + private Button cbKeepHeader; + + public Text getTxtExpression() { + return txtExpression; + } + + protected TableObserverPage(final String pageName) { + super(pageName); + } + + public void createControl(final Composite parent) { + + final DataBindingContext dbc = new DataBindingContext(); + + parent.setLayout(new GridLayout(1, true)); + + Group group = new Group(parent, SWT.None); + group.setText("General settings"); + RowLayout rowLayout = new RowLayout(); + rowLayout.marginLeft = 10; + rowLayout.marginTop = 10; + rowLayout.marginBottom = 10; + group.setLayout(rowLayout); + group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + cbOverrideCells = new Button(group, SWT.CHECK); + cbOverrideCells.setText("Override cells"); + + cbKeepHeader = new Button(group, SWT.CHECK); + cbKeepHeader.setText("Keep header"); + + Group container = new Group(parent, SWT.None); + container.setText("Formal model"); + container.setLayout(new GridLayout(2, false)); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Composite conLeft = new Composite(container, SWT.NONE); + conLeft.setLayoutData(new GridData(GridData.FILL_BOTH)); + conLeft.setLayout(new GridLayout(2, false)); + + Label lb = new Label(conLeft, SWT.NONE); + lb.setText("Predicate:"); + + txtPredicate = new Text(conLeft, SWT.BORDER); + txtPredicate.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txtPredicate.setFont(new Font(Display.getDefault(), new FontData( + "Arial", 10, SWT.NONE))); + + lb = new Label(conLeft, SWT.NONE); + lb.setText("Expression:"); + lb.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + txtExpression = new Text(conLeft, SWT.BORDER | SWT.MULTI + | SWT.WRAP); + txtExpression.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Composite conRight = new Composite(container, SWT.NONE); + + GridData gData = new GridData(GridData.FILL_VERTICAL); + gData.widthHint = 125; + + conRight.setLayoutData(gData); + conRight.setLayout(new GridLayout(1, false)); + + lb = new Label(conRight, SWT.WRAP); + lb.setText("Power sets:"); + lb.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + + ArrayList<String> relationList = new ArrayList<String>(); + + java.util.List<MachineContentObject> constants = EventBHelper + .getConstants(getBControl().getVisualization()); + for (MachineContentObject mobj : constants) { + if (mobj.getType() instanceof PowerSetType) { + relationList.add(mobj.getLabel()); + } + } + + java.util.List<MachineContentObject> variables = EventBHelper + .getVariables(getBControl().getVisualization()); + for (MachineContentObject mobj : variables) { + if (mobj.getType() instanceof PowerSetType) { + relationList.add(mobj.getLabel()); + } + } + + final List list = new List(conRight, SWT.SINGLE | SWT.BORDER + | SWT.V_SCROLL); + list.setLayoutData(new GridData(GridData.FILL_BOTH)); + list.setItems(relationList.toArray(new String[relationList.size()])); + + list.addMouseListener(new MouseAdapter() { + public void mouseDoubleClick(MouseEvent e) { + String[] selection = list.getSelection(); + if (selection.length > 0) + txtExpression.setText(txtExpression.getText() + " " + + selection[0]); + } + }); + initBindings(dbc); + + setControl(conLeft); + + } + + private void initBindings(DataBindingContext dbc) { + + dbc.bindValue(SWTObservables.observeText(txtPredicate, SWT.Modify), + BeansObservables.observeValue( + (TableObserver) getObserver(), "predicate")); + + dbc.bindValue( + SWTObservables.observeText(txtExpression, SWT.Modify), + BeansObservables.observeValue( + (TableObserver) getObserver(), "expression")); + + dbc.bindValue(SWTObservables.observeSelection(cbOverrideCells), + BeansObservables.observeValue( + (TableObserver) getObserver(), "overrideCells")); + + dbc.bindValue(SWTObservables.observeSelection(cbKeepHeader), + BeansObservables.observeValue( + (TableObserver) getObserver(), "keepHeader")); + + } + + } + + public WizardTableObserver(BControl bcontrol, + Observer bobserver) { + super(bcontrol, bobserver); + addPage(new TableObserverPage("TableObserverPage")); + } + + @Override + protected Boolean prepareToFinish() { + + TableObserverPage page = (TableObserverPage) getPage("TableObserverPage"); + + String errorStr = ""; + + if (page.getTxtExpression().getText().length() == 0) + errorStr += "Please enter an expression.\n"; + + if (page.getErrorMessage() != null) + errorStr += "Please check the syntax/parser error.\n"; + + if (errorStr.length() > 0) { + MessageDialog.openError(Display.getDefault().getActiveShell(), + "An Error occured", errorStr); + return false; + } + + return true; + + } + + @Override + public Point getSize() { + return new Point(600, 500); + } + +} diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/AppAbstractTreeEditPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/AppAbstractTreeEditPart.java deleted file mode 100644 index 598d5f6bef4f92f5d7c2d4c703bf311331ed999d..0000000000000000000000000000000000000000 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/AppAbstractTreeEditPart.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, - * Heinrich Heine Universitaet Duesseldorf - * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) - * */ - -package de.bmotionstudio.gef.editor.part; - -import java.beans.PropertyChangeListener; - -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.editparts.AbstractTreeEditPart; -import org.eclipse.ui.IPageLayout; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; - -import de.bmotionstudio.gef.editor.editpolicy.AppDeletePolicy; -import de.bmotionstudio.gef.editor.model.BControl; - -public abstract class AppAbstractTreeEditPart extends AbstractTreeEditPart - implements PropertyChangeListener { - - public void activate() { - if (!isActive()) { - super.activate(); - ((BControl) getModel()).addPropertyChangeListener(this); - } - } - - public void deactivate() { - if (isActive()) { - super.deactivate(); - ((BControl) getModel()).removePropertyChangeListener(this); - } - } - - @Override - public void performRequest(Request req) { - if (req.getType().equals(RequestConstants.REQ_OPEN)) { - try { - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - page.showView(IPageLayout.ID_PROP_SHEET); - } catch (PartInitException e) { - e.printStackTrace(); - } - } - } - - @Override - protected void createEditPolicies() { - installEditPolicy(EditPolicy.COMPONENT_ROLE, new AppDeletePolicy()); - } - -} diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/AppTreeEditPartFactory.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/AppTreeEditPartFactory.java deleted file mode 100644 index 42aa2bc89431930956047e78a6a921b167517199..0000000000000000000000000000000000000000 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/AppTreeEditPartFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, - * Heinrich Heine Universitaet Duesseldorf - * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) - * */ - -package de.bmotionstudio.gef.editor.part; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartFactory; - -import de.bmotionstudio.gef.editor.model.BControl; - -public class AppTreeEditPartFactory implements EditPartFactory { - - public EditPart createEditPart(EditPart context, Object model) { - BControlTreeEditPart part = null; - if (model instanceof BControl) { - part = new BControlTreeEditPart(); - if (part != null) - part.setModel(model); - } - return part; - } - -} diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BButtonPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BButtonPart.java index 9b8a4ab84fba92da177f7b4fec5002e82b208c26..73b1fc4e3bc7c6abae8f7c9a743cdfffcdd25725 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BButtonPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BButtonPart.java @@ -17,14 +17,14 @@ import org.eclipse.swt.graphics.RGB; import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.edit.TextCellEditorLocator; import de.bmotionstudio.gef.editor.edit.TextEditManager; -import de.bmotionstudio.gef.editor.editpolicy.AppDeletePolicy; -import de.bmotionstudio.gef.editor.editpolicy.BMotionNodeEditPolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSDeletePolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSNodeEditPolicy; import de.bmotionstudio.gef.editor.editpolicy.CustomDirectEditPolicy; import de.bmotionstudio.gef.editor.editpolicy.RenamePolicy; import de.bmotionstudio.gef.editor.figure.ButtonFigure; import de.bmotionstudio.gef.editor.model.BControl; -public class BButtonPart extends AppAbstractEditPart { +public class BButtonPart extends BMSAbstractEditPart { @Override public void refreshEditFigure(IFigure figure, BControl model, @@ -71,12 +71,12 @@ public class BButtonPart extends AppAbstractEditPart { @Override protected void prepareEditPolicies() { - installEditPolicy(EditPolicy.COMPONENT_ROLE, new AppDeletePolicy()); + installEditPolicy(EditPolicy.COMPONENT_ROLE, new BMSDeletePolicy()); installEditPolicy(EditPolicy.NODE_ROLE, new RenamePolicy()); installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new CustomDirectEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, - new BMotionNodeEditPolicy()); + new BMSNodeEditPolicy()); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BCheckboxPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BCheckboxPart.java index 21ca996cdbc9996cdb904bd4c51f51bc2ce956bf..9ef072e05b0e86bb1067354f87def9f4a48a5541 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BCheckboxPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BCheckboxPart.java @@ -23,15 +23,15 @@ import de.bmotionstudio.gef.editor.BMotionStudioImage; import de.bmotionstudio.gef.editor.EditorImageRegistry; import de.bmotionstudio.gef.editor.edit.TextCellEditorLocator; import de.bmotionstudio.gef.editor.edit.TextEditManager; -import de.bmotionstudio.gef.editor.editpolicy.AppDeletePolicy; -import de.bmotionstudio.gef.editor.editpolicy.BMotionNodeEditPolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSDeletePolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSNodeEditPolicy; import de.bmotionstudio.gef.editor.editpolicy.CustomDirectEditPolicy; import de.bmotionstudio.gef.editor.editpolicy.RenamePolicy; import de.bmotionstudio.gef.editor.figure.AbstractBMotionFigure; import de.bmotionstudio.gef.editor.figure.CheckboxFigure; import de.bmotionstudio.gef.editor.model.BControl; -public class BCheckboxPart extends AppAbstractEditPart { +public class BCheckboxPart extends BMSAbstractEditPart { private ChangeListener changeListener = new ChangeListener() { @Override @@ -125,12 +125,12 @@ public class BCheckboxPart extends AppAbstractEditPart { @Override protected void prepareEditPolicies() { - installEditPolicy(EditPolicy.COMPONENT_ROLE, new AppDeletePolicy()); + installEditPolicy(EditPolicy.COMPONENT_ROLE, new BMSDeletePolicy()); installEditPolicy(EditPolicy.NODE_ROLE, new RenamePolicy()); installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new CustomDirectEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, - new BMotionNodeEditPolicy()); + new BMSNodeEditPolicy()); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BCompositePart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BCompositePart.java index 1e363ea954bbba36b1c44bdcbfcda3c26a06294d..3fc4c4458cc5f73a829005c984ed3c325a8dc6a2 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BCompositePart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BCompositePart.java @@ -26,9 +26,9 @@ import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.editpolicy.AppDeletePolicy; -import de.bmotionstudio.gef.editor.editpolicy.AppEditLayoutPolicy; -import de.bmotionstudio.gef.editor.editpolicy.BMotionNodeEditPolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSDeletePolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSEditLayoutPolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSNodeEditPolicy; import de.bmotionstudio.gef.editor.editpolicy.ChangeAttributePolicy; import de.bmotionstudio.gef.editor.figure.CompositeFigure; import de.bmotionstudio.gef.editor.library.AbstractLibraryCommand; @@ -37,7 +37,7 @@ import de.bmotionstudio.gef.editor.library.LibraryImageCommand; import de.bmotionstudio.gef.editor.library.LibraryVariableCommand; import de.bmotionstudio.gef.editor.model.BControl; -public class BCompositePart extends AppAbstractEditPart { +public class BCompositePart extends BMSAbstractEditPart { @Override protected IFigure createEditFigure() { @@ -130,12 +130,12 @@ public class BCompositePart extends AppAbstractEditPart { @Override protected void prepareEditPolicies() { - installEditPolicy(EditPolicy.COMPONENT_ROLE, new AppDeletePolicy()); - installEditPolicy(EditPolicy.LAYOUT_ROLE, new AppEditLayoutPolicy()); + installEditPolicy(EditPolicy.COMPONENT_ROLE, new BMSDeletePolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new BMSEditLayoutPolicy()); installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, null); installEditPolicy(EditPolicy.CONTAINER_ROLE, new SnapFeedbackPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, - new BMotionNodeEditPolicy()); + new BMSNodeEditPolicy()); installEditPolicy(ChangeAttributePolicy.CHANGE_ATTRIBUTE_POLICY, new ChangeAttributePolicy()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BConnectionEditPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BConnectionEditPart.java index f8cea36545181980c4cc64e3c6beb9fb98cee255..e1df86761d489ebb43030af3ba34b11035c64930 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BConnectionEditPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BConnectionEditPart.java @@ -47,7 +47,7 @@ import de.bmotionstudio.gef.editor.command.ConnectionDeleteCommand; import de.bmotionstudio.gef.editor.model.BConnection; import de.bmotionstudio.gef.editor.model.BControl; -public class BConnectionEditPart extends AppAbstractEditPart implements +public class BConnectionEditPart extends BMSAbstractEditPart implements ConnectionEditPart, LayerConstants { protected Color foregroundColor; diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BControlTreeEditPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BControlTreeEditPart.java index 74522c772573b325aa2e4779a577f256327334f1..ca5ce02f916c365d1da51e8d4f4f9ac2c01f8409 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BControlTreeEditPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BControlTreeEditPart.java @@ -7,39 +7,31 @@ package de.bmotionstudio.gef.editor.part; import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; + +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.RequestConstants; +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; import de.bmotionstudio.gef.editor.AttributeConstants; +import de.bmotionstudio.gef.editor.BMotionStudioImage; +import de.bmotionstudio.gef.editor.EditorImageRegistry; +import de.bmotionstudio.gef.editor.editpolicy.BMSDeletePolicy; import de.bmotionstudio.gef.editor.model.BConnection; import de.bmotionstudio.gef.editor.model.BControl; +import de.bmotionstudio.gef.editor.model.ObserverRootVirtualTreeNode; import de.bmotionstudio.gef.editor.model.Visualization; +import de.bmotionstudio.gef.editor.observer.IObserverListener; +import de.bmotionstudio.gef.editor.observer.Observer; -public class BControlTreeEditPart extends AppAbstractTreeEditPart { - - @Override - protected List<BControl> getModelChildren() { - Set<BControl> toShowElements = new HashSet<BControl>(); - for (BControl control : ((BControl) getModel()).getChildrenArray()) { - if (control.showInOutlineView()) - toShowElements.add(control); - List<BConnection> sourceConnections = control - .getSourceConnections(); - for (BConnection con : sourceConnections) { - if (con.showInOutlineView()) - toShowElements.add(con); - } - List<BConnection> targetConnections = control - .getTargetConnections(); - for (BConnection con : targetConnections) { - if (con.showInOutlineView()) - toShowElements.add(con); - } - } - return new ArrayList<BControl>(toShowElements); - } +public class BControlTreeEditPart extends BMSAbstractTreeEditPart implements + PropertyChangeListener, IObserverListener { public void propertyChange(final PropertyChangeEvent evt) { if (evt.getPropertyName().equals(BControl.PROPERTY_ADD) @@ -49,14 +41,103 @@ public class BControlTreeEditPart extends AppAbstractTreeEditPart { refreshVisuals(); } + @Override + protected void createEditPolicies() { + installEditPolicy(EditPolicy.COMPONENT_ROLE, new BMSDeletePolicy()); + } + + @Override + protected List<Object> getModelChildren() { + + List<Object> toShowElements = new ArrayList<Object>(); + + if (getModel() instanceof BControl) { + + BControl c = (BControl) getModel(); + + for (BControl control : c.getChildrenArray()) { + if (control.showInOutlineView()) + toShowElements.add(control); + List<BConnection> sourceConnections = control + .getSourceConnections(); + for (BConnection con : sourceConnections) { + if (con.showInOutlineView()) + toShowElements.add(con); + } + List<BConnection> targetConnections = control + .getTargetConnections(); + for (BConnection con : targetConnections) { + if (con.showInOutlineView()) + toShowElements.add(con); + } + } + + if (!(getModel() instanceof Visualization)) + toShowElements.add(new ObserverRootVirtualTreeNode(c)); + + } + + return toShowElements; + + } + + public void activate() { + if (!isActive()) { + super.activate(); + ((BControl) getModel()).addPropertyChangeListener(this); + ((BControl) getModel()).addObserverListener(this); + } + } + + public void deactivate() { + if (isActive()) { + super.deactivate(); + ((BControl) getModel()).removePropertyChangeListener(this); + ((BControl) getModel()).removeObserverListener(this); + } + } + @Override public void refreshVisuals() { - BControl bcontrol = (BControl) getModel(); - if (!(bcontrol instanceof Visualization)) { - setWidgetText(bcontrol.getAttributeValue( - AttributeConstants.ATTRIBUTE_ID).toString()); - setWidgetImage(bcontrol.getIcon()); + + Object model = getModel(); + + if (model instanceof BControl) { + BControl bcontrol = (BControl) model; + if (!(bcontrol instanceof Visualization)) { + setWidgetText(bcontrol.getAttributeValue( + AttributeConstants.ATTRIBUTE_ID).toString()); + setWidgetImage(bcontrol.getIcon()); + } + } else if (model instanceof Observer) { + setWidgetText(((Observer) model).getName()); + setWidgetImage(BMotionStudioImage + .getImage(EditorImageRegistry.IMG_ICON_OBSERVER)); + } + + } + + @Override + public void performRequest(Request req) { + if (req.getType().equals(RequestConstants.REQ_OPEN)) { + try { + IWorkbenchPage page = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getActivePage(); + page.showView(IPageLayout.ID_PROP_SHEET); + } catch (PartInitException e) { + e.printStackTrace(); + } } } + @Override + public void addedObserver(BControl control, Observer observer) { + refreshChildren(); + } + + @Override + public void removedObserver(BControl control) { + refreshChildren(); + } + } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BImagePart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BImagePart.java index 33d5600a776b099eb7f9d4a10d607fbcce9fccc9..a4e8ae67d9aa7cc6fbb6ab7f0f1bf555b338ee80 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BImagePart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BImagePart.java @@ -13,8 +13,8 @@ import org.eclipse.draw2d.IFigure; import org.eclipse.gef.EditPolicy; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.editpolicy.AppDeletePolicy; -import de.bmotionstudio.gef.editor.editpolicy.BMotionNodeEditPolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSDeletePolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSNodeEditPolicy; import de.bmotionstudio.gef.editor.editpolicy.ChangeAttributePolicy; import de.bmotionstudio.gef.editor.figure.BMSImageFigure; import de.bmotionstudio.gef.editor.library.AbstractLibraryCommand; @@ -22,7 +22,7 @@ import de.bmotionstudio.gef.editor.library.AttributeRequest; import de.bmotionstudio.gef.editor.library.LibraryImageCommand; import de.bmotionstudio.gef.editor.model.BControl; -public class BImagePart extends AppAbstractEditPart { +public class BImagePart extends BMSAbstractEditPart { @Override public void refreshEditFigure(IFigure figure, BControl model, @@ -67,9 +67,9 @@ public class BImagePart extends AppAbstractEditPart { @Override protected void prepareEditPolicies() { - installEditPolicy(EditPolicy.COMPONENT_ROLE, new AppDeletePolicy()); + installEditPolicy(EditPolicy.COMPONENT_ROLE, new BMSDeletePolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, - new BMotionNodeEditPolicy()); + new BMSNodeEditPolicy()); installEditPolicy(ChangeAttributePolicy.CHANGE_ATTRIBUTE_POLICY, new ChangeAttributePolicy()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/AppAbstractEditPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractEditPart.java similarity index 95% rename from de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/AppAbstractEditPart.java rename to de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractEditPart.java index 91a5bc5ac8126ea58d40898cac1c77e759e5f432..86445e7c736389788219bbd461ffc373631eec35 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/AppAbstractEditPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractEditPart.java @@ -47,7 +47,7 @@ import de.bmotionstudio.gef.editor.model.Visualization; import de.bmotionstudio.gef.editor.observer.IObserverListener; import de.bmotionstudio.gef.editor.observer.Observer; -public abstract class AppAbstractEditPart extends AbstractGraphicalEditPart +public abstract class BMSAbstractEditPart extends AbstractGraphicalEditPart implements PropertyChangeListener, IObserverListener, IAdaptable, NodeEditPart { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractTreeEditPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractTreeEditPart.java new file mode 100644 index 0000000000000000000000000000000000000000..8c74cbf3ba53659ffa08ebc02633c9b672dfffe2 --- /dev/null +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractTreeEditPart.java @@ -0,0 +1,15 @@ +/** + * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, + * Heinrich Heine Universitaet Duesseldorf + * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) + * */ + +package de.bmotionstudio.gef.editor.part; + +import org.eclipse.gef.editparts.AbstractTreeEditPart; + +public abstract class BMSAbstractTreeEditPart extends AbstractTreeEditPart { + + + +} diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/AppEditPartFactory.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSEditPartFactory.java similarity index 92% rename from de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/AppEditPartFactory.java rename to de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSEditPartFactory.java index ed44ebee49f3f665eec1254841f206e51380b760..6c8852b5ac991853484358e154e17f135006c0c0 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/AppEditPartFactory.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSEditPartFactory.java @@ -17,7 +17,7 @@ import de.bmotionstudio.gef.editor.IBControlService; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.Visualization; -public class AppEditPartFactory implements EditPartFactory { +public class BMSEditPartFactory implements EditPartFactory { @Override public EditPart createEditPart(EditPart context, Object model) { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSTreeEditPartFactory.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSTreeEditPartFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..51d2a0c771cfbf37f87c8df2ddd33d4dd8afae51 --- /dev/null +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSTreeEditPartFactory.java @@ -0,0 +1,55 @@ +/** + * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, + * Heinrich Heine Universitaet Duesseldorf + * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) + * */ + +package de.bmotionstudio.gef.editor.part; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPartFactory; + +import de.bmotionstudio.gef.editor.BMotionEditorPlugin; +import de.bmotionstudio.gef.editor.IBControlService; +import de.bmotionstudio.gef.editor.model.BControl; +import de.bmotionstudio.gef.editor.model.ObserverRootVirtualTreeNode; +import de.bmotionstudio.gef.editor.observer.Observer; + +public class BMSTreeEditPartFactory implements EditPartFactory { + + public EditPart createEditPart(EditPart context, Object model) { + + BMSAbstractTreeEditPart part = null; + + if (model instanceof BControl) { + + BControl control = (BControl) model; + + try { + IConfigurationElement configElement = BMotionEditorPlugin + .getControlServices().get(control.getType()); + if (configElement != null) { + IBControlService service = (IBControlService) configElement + .createExecutableExtension("service"); + part = service.createTreeEditPart(); + } + } catch (CoreException e) { + e.printStackTrace(); + } + + } else if (model instanceof Observer) { + part = new ObserverTreeEditPart(); + } else if (model instanceof ObserverRootVirtualTreeNode) { + part = new ObserverRootTreeEditpart(); + } + + if (part != null) + part.setModel(model); + + return part; + + } + +} diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BRadioButtonPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BRadioButtonPart.java index f4ad340be62284ad1c6ce9d3a390393c3160e08a..6f69bd69f50f3c567dd7d3cd129ca2b703833c50 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BRadioButtonPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BRadioButtonPart.java @@ -24,15 +24,15 @@ import de.bmotionstudio.gef.editor.ButtonGroupHelper; import de.bmotionstudio.gef.editor.ImageRegistry; import de.bmotionstudio.gef.editor.edit.TextCellEditorLocator; import de.bmotionstudio.gef.editor.edit.TextEditManager; -import de.bmotionstudio.gef.editor.editpolicy.AppDeletePolicy; -import de.bmotionstudio.gef.editor.editpolicy.BMotionNodeEditPolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSDeletePolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSNodeEditPolicy; import de.bmotionstudio.gef.editor.editpolicy.CustomDirectEditPolicy; import de.bmotionstudio.gef.editor.editpolicy.RenamePolicy; import de.bmotionstudio.gef.editor.figure.AbstractBMotionFigure; import de.bmotionstudio.gef.editor.figure.RadioButtonFigure; import de.bmotionstudio.gef.editor.model.BControl; -public class BRadioButtonPart extends AppAbstractEditPart { +public class BRadioButtonPart extends BMSAbstractEditPart { private ChangeListener changeListener = new ChangeListener() { @Override @@ -142,12 +142,12 @@ public class BRadioButtonPart extends AppAbstractEditPart { @Override protected void prepareEditPolicies() { - installEditPolicy(EditPolicy.COMPONENT_ROLE, new AppDeletePolicy()); + installEditPolicy(EditPolicy.COMPONENT_ROLE, new BMSDeletePolicy()); installEditPolicy(EditPolicy.NODE_ROLE, new RenamePolicy()); installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new CustomDirectEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, - new BMotionNodeEditPolicy()); + new BMSNodeEditPolicy()); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BShapePart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BShapePart.java index 1ffe72f87ae2e019e9b5e5fb9265e615c88b5596..c38752cc2141155e68d1c67be2956d521ed1a6ba 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BShapePart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BShapePart.java @@ -17,12 +17,12 @@ import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.editpolicy.AppDeletePolicy; -import de.bmotionstudio.gef.editor.editpolicy.BMotionNodeEditPolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSDeletePolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSNodeEditPolicy; import de.bmotionstudio.gef.editor.figure.ShapeFigure; import de.bmotionstudio.gef.editor.model.BControl; -public class BShapePart extends AppAbstractEditPart { +public class BShapePart extends BMSAbstractEditPart { @Override public void refreshEditFigure(IFigure figure, BControl model, @@ -117,9 +117,9 @@ public class BShapePart extends AppAbstractEditPart { @Override protected void prepareEditPolicies() { - installEditPolicy(EditPolicy.COMPONENT_ROLE, new AppDeletePolicy()); + installEditPolicy(EditPolicy.COMPONENT_ROLE, new BMSDeletePolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, - new BMotionNodeEditPolicy()); + new BMSNodeEditPolicy()); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTableCellPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTableCellPart.java index dba8ecf10865c8195fb1d48a36b55ac813c4d0e2..fa8c5c2d98facbdd870ebc8737e129f16cfe0da9 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTableCellPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTableCellPart.java @@ -16,7 +16,7 @@ import de.bmotionstudio.gef.editor.editpolicy.RenamePolicy; import de.bmotionstudio.gef.editor.figure.TableCellFigure; import de.bmotionstudio.gef.editor.model.BControl; -public class BTableCellPart extends AppAbstractEditPart { +public class BTableCellPart extends BMSAbstractEditPart { @Override protected IFigure createEditFigure() { @@ -30,6 +30,7 @@ public class BTableCellPart extends AppAbstractEditPart { installEditPolicy(EditPolicy.NODE_ROLE, new RenamePolicy()); } + @Override protected void prepareRunPolicies() { } @@ -62,6 +63,18 @@ public class BTableCellPart extends AppAbstractEditPart { } + @Override + protected void refreshEditLayout(IFigure figure, BControl control) { + + // Set size of parent column + int width = control.getDimension().width; + control.getParent().setAttributeValue( + AttributeConstants.ATTRIBUTE_WIDTH, width); + + super.refreshEditLayout(figure, control); + + } + private void performDirectEdit() { new TextEditManager(this, new TextCellEditorLocator( (IFigure) getFigure())).show(); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTableColumnPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTableColumnPart.java index 49cfccce4221d7aea645ef752e40062d925e844c..77c24203b26f7dc263453ae7da664924791705d6 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTableColumnPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTableColumnPart.java @@ -4,28 +4,38 @@ import java.beans.PropertyChangeEvent; import java.util.List; import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; import org.eclipse.gef.EditPolicy; import org.eclipse.swt.graphics.RGB; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.editpolicy.BMotionNodeEditPolicy; -import de.bmotionstudio.gef.editor.editpolicy.BMotionStudioFlowEditPolicy; +import de.bmotionstudio.gef.editor.BMotionStudioImage; +import de.bmotionstudio.gef.editor.EditorImageRegistry; +import de.bmotionstudio.gef.editor.editpolicy.BMSNodeEditPolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSFlowEditPolicy; import de.bmotionstudio.gef.editor.figure.TableColumnFigure; import de.bmotionstudio.gef.editor.model.BControl; -public class BTableColumnPart extends AppAbstractEditPart { +public class BTableColumnPart extends BMSAbstractEditPart { @Override protected IFigure createEditFigure() { - return new TableColumnFigure(); + TableColumnFigure tableColumnFigure = new TableColumnFigure(); + Label figure = new Label(); + tableColumnFigure.add(figure); + if (!isRunning()) { + figure.setIcon(BMotionStudioImage + .getImage(EditorImageRegistry.IMG_ICON_TR_UP)); + } + return tableColumnFigure; } @Override protected void prepareEditPolicies() { installEditPolicy(EditPolicy.LAYOUT_ROLE, - new BMotionStudioFlowEditPolicy()); + new BMSFlowEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, - new BMotionNodeEditPolicy()); + new BMSNodeEditPolicy()); } @Override @@ -67,12 +77,25 @@ public class BTableColumnPart extends AppAbstractEditPart { @Override protected void refreshEditLayout(IFigure figure, BControl control) { - if (getParent() instanceof AppAbstractEditPart) { - AppAbstractEditPart tablePart = (AppAbstractEditPart) getParent(); + + int width = control.getDimension().width; + + // Change width of all cells + List<BControl> cells = control.getChildrenArray(); + for (BControl cell : cells) { + cell.setAttributeValue(AttributeConstants.ATTRIBUTE_WIDTH, width, + true, true); + } + + // Notify parent table about change + if (getParent() instanceof BMSAbstractEditPart) { + BMSAbstractEditPart tablePart = (BMSAbstractEditPart) getParent(); tablePart.refreshEditLayout(tablePart.getFigure(), control.getParent()); } + super.refreshEditLayout(figure, control); + } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTablePart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTablePart.java index 78d6bc0d12c7319ffd0c67d1dfdebe50b1fb0fa1..4c93761eca5d506f7b6b05f57103cef962e3ccf0 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTablePart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTablePart.java @@ -4,34 +4,44 @@ import java.beans.PropertyChangeEvent; import java.util.List; import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.gef.EditPolicy; import org.eclipse.swt.graphics.RGB; import de.bmotionstudio.gef.editor.AttributeConstants; +import de.bmotionstudio.gef.editor.BMotionStudioImage; +import de.bmotionstudio.gef.editor.EditorImageRegistry; import de.bmotionstudio.gef.editor.command.CreateCommand; -import de.bmotionstudio.gef.editor.editpolicy.AppDeletePolicy; -import de.bmotionstudio.gef.editor.editpolicy.BMotionNodeEditPolicy; -import de.bmotionstudio.gef.editor.editpolicy.BMotionStudioFlowEditPolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSDeletePolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSNodeEditPolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSFlowEditPolicy; import de.bmotionstudio.gef.editor.figure.TableFigure; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.BTableCell; import de.bmotionstudio.gef.editor.model.BTableColumn; -public class BTablePart extends AppAbstractEditPart { +public class BTablePart extends BMSAbstractEditPart { @Override protected IFigure createEditFigure() { - return new TableFigure(); + TableFigure tableFigure = new TableFigure(); + Label figure = new Label(); + tableFigure.add(figure); + if (!isRunning()) { + figure.setIcon(BMotionStudioImage + .getImage(EditorImageRegistry.IMG_ICON_TR_LEFT)); + } + return tableFigure; } @Override protected void prepareEditPolicies() { installEditPolicy(EditPolicy.LAYOUT_ROLE, - new BMotionStudioFlowEditPolicy()); - installEditPolicy(EditPolicy.COMPONENT_ROLE, new AppDeletePolicy()); + new BMSFlowEditPolicy()); + installEditPolicy(EditPolicy.COMPONENT_ROLE, new BMSDeletePolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, - new BMotionNodeEditPolicy()); + new BMSNodeEditPolicy()); } @Override @@ -54,7 +64,9 @@ public class BTablePart extends AppAbstractEditPart { figure.getParent().setConstraint( figure, new Rectangle(control.getLocation().x, control.getLocation().y, - width + 1, (rows * 20) + 1)); + width + 21, (rows * 20) + 15)); + + // super.refreshEditLayout(figure, control); } @@ -93,7 +105,7 @@ public class BTablePart extends AppAbstractEditPart { BTableColumn bTableColumn = new BTableColumn( model.getVisualization()); CreateCommand cmd = new CreateCommand(bTableColumn, model); - cmd.setLayout(new Rectangle(0, 0, 50, 25)); + // cmd.setLayout(new Rectangle(0, 0, 50, 40)); cmd.execute(); Integer numberOfRows = Integer.valueOf(model.getAttributeValue( AttributeConstants.ATTRIBUTE_ROWS).toString()); @@ -125,22 +137,18 @@ public class BTablePart extends AppAbstractEditPart { } private void refreshRows(BControl column, int numberOfRows) { - Integer numberOfCurrentRows = column.getChildrenArray().size(); - if (numberOfRows < numberOfCurrentRows) { for (int i = numberOfCurrentRows - 1; i >= numberOfRows; i--) { column.removeChild(i); } } - for (int i = numberOfCurrentRows; i < numberOfRows; i++) { CreateCommand cmd = new CreateCommand(new BTableCell( column.getVisualization()), column); - cmd.setLayout(new Rectangle(0, 0, 50, 20)); + cmd.setLayout(new Rectangle(0, 0, column.getDimension().width, 20)); cmd.execute(); } - } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTextPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTextPart.java index 5de397b03f7d9a59b8da669bc3a0256c769d3ef6..652b0bab5958ae873936d3bd9886f8572d4a96b7 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTextPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTextPart.java @@ -18,8 +18,8 @@ import org.eclipse.swt.widgets.Display; import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.edit.TextCellEditorLocator; import de.bmotionstudio.gef.editor.edit.TextEditManager; -import de.bmotionstudio.gef.editor.editpolicy.AppDeletePolicy; -import de.bmotionstudio.gef.editor.editpolicy.BMotionNodeEditPolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSDeletePolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSNodeEditPolicy; import de.bmotionstudio.gef.editor.editpolicy.ChangeAttributePolicy; import de.bmotionstudio.gef.editor.editpolicy.CustomDirectEditPolicy; import de.bmotionstudio.gef.editor.editpolicy.RenamePolicy; @@ -29,7 +29,7 @@ import de.bmotionstudio.gef.editor.library.AttributeRequest; import de.bmotionstudio.gef.editor.library.LibraryVariableCommand; import de.bmotionstudio.gef.editor.model.BControl; -public class BTextPart extends AppAbstractEditPart { +public class BTextPart extends BMSAbstractEditPart { @Override public void refreshEditFigure(IFigure figure, BControl model, @@ -97,12 +97,12 @@ public class BTextPart extends AppAbstractEditPart { @Override protected void prepareEditPolicies() { - installEditPolicy(EditPolicy.COMPONENT_ROLE, new AppDeletePolicy()); + installEditPolicy(EditPolicy.COMPONENT_ROLE, new BMSDeletePolicy()); installEditPolicy(EditPolicy.NODE_ROLE, new RenamePolicy()); installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new CustomDirectEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, - new BMotionNodeEditPolicy()); + new BMSNodeEditPolicy()); installEditPolicy(ChangeAttributePolicy.CHANGE_ATTRIBUTE_POLICY, new ChangeAttributePolicy()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTextfieldPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTextfieldPart.java index 424e6da84bae178d6f899f815bec15bea6d630fe..e0b313669d34d08a8e7921452c7e229b4e7c5b0a 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTextfieldPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BTextfieldPart.java @@ -19,15 +19,15 @@ import org.eclipse.gef.RequestConstants; import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.edit.TextCellEditorLocator; import de.bmotionstudio.gef.editor.edit.TextEditManager; -import de.bmotionstudio.gef.editor.editpolicy.AppDeletePolicy; -import de.bmotionstudio.gef.editor.editpolicy.BMotionNodeEditPolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSDeletePolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSNodeEditPolicy; import de.bmotionstudio.gef.editor.editpolicy.CustomDirectEditPolicy; import de.bmotionstudio.gef.editor.editpolicy.RenamePolicy; import de.bmotionstudio.gef.editor.figure.AbstractBMotionFigure; import de.bmotionstudio.gef.editor.figure.TextfieldFigure; import de.bmotionstudio.gef.editor.model.BControl; -public class BTextfieldPart extends AppAbstractEditPart { +public class BTextfieldPart extends BMSAbstractEditPart { private TextEditManager textEditManager; @@ -111,12 +111,12 @@ public class BTextfieldPart extends AppAbstractEditPart { @Override protected void prepareEditPolicies() { - installEditPolicy(EditPolicy.COMPONENT_ROLE, new AppDeletePolicy()); + installEditPolicy(EditPolicy.COMPONENT_ROLE, new BMSDeletePolicy()); installEditPolicy(EditPolicy.NODE_ROLE, new RenamePolicy()); installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new CustomDirectEditPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, - new BMotionNodeEditPolicy()); + new BMSNodeEditPolicy()); } @Override diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/ObserverRootTreeEditpart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/ObserverRootTreeEditpart.java new file mode 100644 index 0000000000000000000000000000000000000000..fd70efd9d5462ae343e734f5806cd167851ff937 --- /dev/null +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/ObserverRootTreeEditpart.java @@ -0,0 +1,61 @@ +/** + * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, + * Heinrich Heine Universitaet Duesseldorf + * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) + * */ + +package de.bmotionstudio.gef.editor.part; + +import java.util.ArrayList; +import java.util.List; + +import de.bmotionstudio.gef.editor.BMotionStudioImage; +import de.bmotionstudio.gef.editor.EditorImageRegistry; +import de.bmotionstudio.gef.editor.model.BControl; +import de.bmotionstudio.gef.editor.model.ObserverRootVirtualTreeNode; +import de.bmotionstudio.gef.editor.observer.IObserverListener; +import de.bmotionstudio.gef.editor.observer.Observer; + +public class ObserverRootTreeEditpart extends BMSAbstractTreeEditPart implements + IObserverListener { + + public void activate() { + if (!isActive()) { + super.activate(); + ((ObserverRootVirtualTreeNode) getModel()).getControl() + .addObserverListener(this); + } + } + + public void deactivate() { + if (isActive()) { + super.deactivate(); + ((ObserverRootVirtualTreeNode) getModel()).getControl() + .removeObserverListener(this); + } + } + + @Override + protected List<Object> getModelChildren() { + ObserverRootVirtualTreeNode model = (ObserverRootVirtualTreeNode) getModel(); + return new ArrayList<Object>(model.getObserver()); + } + + @Override + public void refreshVisuals() { + setWidgetText("Observer"); + setWidgetImage(BMotionStudioImage + .getImage(EditorImageRegistry.IMG_ICON_OBSERVER)); + } + + @Override + public void addedObserver(BControl control, Observer observer) { + refreshChildren(); + } + + @Override + public void removedObserver(BControl control) { + refreshChildren(); + } + +} diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/ObserverTreeEditPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/ObserverTreeEditPart.java new file mode 100644 index 0000000000000000000000000000000000000000..1c4105be5172b24af2e1e3e0ec455b900d152696 --- /dev/null +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/ObserverTreeEditPart.java @@ -0,0 +1,23 @@ +/** + * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, + * Heinrich Heine Universitaet Duesseldorf + * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) + * */ + +package de.bmotionstudio.gef.editor.part; + +import de.bmotionstudio.gef.editor.BMotionStudioImage; +import de.bmotionstudio.gef.editor.EditorImageRegistry; +import de.bmotionstudio.gef.editor.observer.Observer; + +public class ObserverTreeEditPart extends BMSAbstractTreeEditPart { + + @Override + public void refreshVisuals() { + Observer o = (Observer) getModel(); + setWidgetText(o.getName()); + setWidgetImage(BMotionStudioImage + .getImage(EditorImageRegistry.IMG_ICON_OBSERVER)); + } + +} diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/UnknownPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/UnknownPart.java index 5b18e42c3141e42b02b961b8e7180e199242df9d..9742455691d3b9f7ce60162437c6c1f067d09235 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/UnknownPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/UnknownPart.java @@ -13,7 +13,7 @@ import org.eclipse.draw2d.IFigure; import de.bmotionstudio.gef.editor.figure.UnknownBControl; import de.bmotionstudio.gef.editor.model.BControl; -public class UnknownPart extends AppAbstractEditPart { +public class UnknownPart extends BMSAbstractEditPart { public static String ID = "de.bmotionstudio.gef.editor.unknown"; diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/VisualizationPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/VisualizationPart.java index ffa7230bbf89cbb2e068be3fe99a9102ae33f935..2ecbed079706725e80ce8962d1dd1915cecdb5ee 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/VisualizationPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/VisualizationPart.java @@ -24,8 +24,8 @@ import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; import de.bmotionstudio.gef.editor.AttributeConstants; -import de.bmotionstudio.gef.editor.editpolicy.AppDeletePolicy; -import de.bmotionstudio.gef.editor.editpolicy.AppEditLayoutPolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSDeletePolicy; +import de.bmotionstudio.gef.editor.editpolicy.BMSEditLayoutPolicy; import de.bmotionstudio.gef.editor.editpolicy.ChangeAttributePolicy; import de.bmotionstudio.gef.editor.figure.VisualizationFigure; import de.bmotionstudio.gef.editor.library.AbstractLibraryCommand; @@ -34,7 +34,7 @@ import de.bmotionstudio.gef.editor.library.LibraryImageCommand; import de.bmotionstudio.gef.editor.library.LibraryVariableCommand; import de.bmotionstudio.gef.editor.model.BControl; -public class VisualizationPart extends AppAbstractEditPart { +public class VisualizationPart extends BMSAbstractEditPart { public static String ID = "de.bmotionstudio.gef.editor.visualization"; @@ -50,8 +50,8 @@ public class VisualizationPart extends AppAbstractEditPart { @Override protected void prepareEditPolicies() { - installEditPolicy(EditPolicy.COMPONENT_ROLE, new AppDeletePolicy()); - installEditPolicy(EditPolicy.LAYOUT_ROLE, new AppEditLayoutPolicy()); + installEditPolicy(EditPolicy.COMPONENT_ROLE, new BMSDeletePolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new BMSEditLayoutPolicy()); installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null); installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, null); installEditPolicy(EditPolicy.CONTAINER_ROLE, new SnapFeedbackPolicy()); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BButtonService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BButtonService.java index e53c63a05dc0f372ca7e1194cdf167cf63de45eb..e0b5b38b09a6429c1c2a66bdc71929c3d3a8abcd 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BButtonService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BButtonService.java @@ -11,7 +11,7 @@ import de.bmotionstudio.gef.editor.IBControlService; import de.bmotionstudio.gef.editor.model.BButton; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.BButtonPart; /** @@ -39,7 +39,7 @@ public class BButtonService extends AbstractBControlService implements * @see de.bmotionstudio.gef.editor.IBControlService#createEditPart() */ @Override - public AppAbstractEditPart createEditPart() { + public BMSAbstractEditPart createEditPart() { return new BButtonPart(); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BCheckboxService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BCheckboxService.java index 7172275ab638423a14842f84b49ef5d6d0119822..dcaebcef01eac35993dd90a28542946e5bb9325e 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BCheckboxService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BCheckboxService.java @@ -11,7 +11,7 @@ import de.bmotionstudio.gef.editor.IBControlService; import de.bmotionstudio.gef.editor.model.BCheckbox; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.BCheckboxPart; /** @@ -39,7 +39,7 @@ public class BCheckboxService extends AbstractBControlService implements * @see de.bmotionstudio.gef.editor.IBControlService#createEditPart() */ @Override - public AppAbstractEditPart createEditPart() { + public BMSAbstractEditPart createEditPart() { return new BCheckboxPart(); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BCompositeService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BCompositeService.java index 863246a333f93ee035c93db0d7b9a7d92b247f23..4a11b1d1c33fbcdecb4d0a06c05ca1115270a412 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BCompositeService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BCompositeService.java @@ -11,7 +11,7 @@ import de.bmotionstudio.gef.editor.IBControlService; import de.bmotionstudio.gef.editor.model.BComposite; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.BCompositePart; /** @@ -39,7 +39,7 @@ public class BCompositeService extends AbstractBControlService implements * @see de.bmotionstudio.gef.editor.IBControlService#createEditPart() */ @Override - public AppAbstractEditPart createEditPart() { + public BMSAbstractEditPart createEditPart() { return new BCompositePart(); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BConnectionService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BConnectionService.java index 6d88ddebb508cdb3ccbcf52694e68b9c3ace855d..8c2c8e97317f5a65067764c37f9c72ec8b9e4cda 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BConnectionService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BConnectionService.java @@ -17,7 +17,7 @@ import de.bmotionstudio.gef.editor.IBControlService; import de.bmotionstudio.gef.editor.model.BConnection; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.BConnectionEditPart; /** @@ -47,7 +47,7 @@ public class BConnectionService extends AbstractBControlService implements } @Override - public AppAbstractEditPart createEditPart() { + public BMSAbstractEditPart createEditPart() { return new BConnectionEditPart(); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BEllipseService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BEllipseService.java index 40de317b91f70560053cf0bc8bb4a292974d6bb8..ffaf7f7dceeebc27954799e4b6fbf7961a9171ee 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BEllipseService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BEllipseService.java @@ -7,7 +7,7 @@ import de.bmotionstudio.gef.editor.attribute.BAttributeShape; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.BShape; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.BShapePart; public class BEllipseService extends AbstractBControlService implements @@ -26,7 +26,7 @@ public class BEllipseService extends AbstractBControlService implements } @Override - public AppAbstractEditPart createEditPart() { + public BMSAbstractEditPart createEditPart() { return new BShapePart(); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BImageService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BImageService.java index 22886fb67758dde65a147b9148d93b48e373301e..e70769ac275e2571a66cce4bc76a5518011b1c5d 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BImageService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BImageService.java @@ -11,7 +11,7 @@ import de.bmotionstudio.gef.editor.IBControlService; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.BImage; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.BImagePart; /** @@ -39,7 +39,7 @@ public class BImageService extends AbstractBControlService implements * @see de.bmotionstudio.gef.editor.IBControlService#createEditPart() */ @Override - public AppAbstractEditPart createEditPart() { + public BMSAbstractEditPart createEditPart() { return new BImagePart(); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BRadioButtonService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BRadioButtonService.java index 58d463b8fe2b51f4902841013c619dab5a90e754..ae4b4250f88f47e70170eaef67dfd984d425af36 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BRadioButtonService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BRadioButtonService.java @@ -11,7 +11,7 @@ import de.bmotionstudio.gef.editor.IBControlService; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.BRadioButton; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.BRadioButtonPart; /** @@ -39,7 +39,7 @@ public class BRadioButtonService extends AbstractBControlService implements * @see de.bmotionstudio.gef.editor.IBControlService#createEditPart() */ @Override - public AppAbstractEditPart createEditPart() { + public BMSAbstractEditPart createEditPart() { return new BRadioButtonPart(); } } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BRectangleService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BRectangleService.java index 4f74a1bab73bda064da23af7bf5914915a4347f0..f29b430d7c111916fc541e1f804fab319b757262 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BRectangleService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BRectangleService.java @@ -11,7 +11,7 @@ import de.bmotionstudio.gef.editor.IBControlService; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.BShape; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.BShapePart; /** @@ -39,7 +39,7 @@ public class BRectangleService extends AbstractBControlService implements * @see de.bmotionstudio.gef.editor.IBControlService#createEditPart() */ @Override - public AppAbstractEditPart createEditPart() { + public BMSAbstractEditPart createEditPart() { return new BShapePart(); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTableCellService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTableCellService.java index 36bd5c52047bc58d165b7e74a0290abb8fac9b9a..38c27cbaf1e5a37e64e8d174a8a24c9964117e09 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTableCellService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTableCellService.java @@ -5,7 +5,9 @@ import de.bmotionstudio.gef.editor.IBControlService; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.BTableCell; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BControlTreeEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractTreeEditPart; import de.bmotionstudio.gef.editor.part.BTableCellPart; public class BTableCellService extends AbstractBControlService implements @@ -17,7 +19,7 @@ public class BTableCellService extends AbstractBControlService implements } @Override - public AppAbstractEditPart createEditPart() { + public BMSAbstractEditPart createEditPart() { return new BTableCellPart(); } @@ -26,4 +28,13 @@ public class BTableCellService extends AbstractBControlService implements return false; } + @Override + public BMSAbstractTreeEditPart createTreeEditPart() { + return new BControlTreeEditPart() { + @Override + protected void createEditPolicies() { + } + }; + } + } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTableColumnService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTableColumnService.java index ea26c6326c5b225dd9ee8293d681bef037cba479..6290adc316a60ca35f9cff2883b2bfb4947d6b43 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTableColumnService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTableColumnService.java @@ -5,7 +5,9 @@ import de.bmotionstudio.gef.editor.IBControlService; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.BTableColumn; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BControlTreeEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractTreeEditPart; import de.bmotionstudio.gef.editor.part.BTableColumnPart; public class BTableColumnService extends AbstractBControlService implements @@ -17,7 +19,7 @@ public class BTableColumnService extends AbstractBControlService implements } @Override - public AppAbstractEditPart createEditPart() { + public BMSAbstractEditPart createEditPart() { return new BTableColumnPart(); } @@ -26,4 +28,13 @@ public class BTableColumnService extends AbstractBControlService implements return false; } + @Override + public BMSAbstractTreeEditPart createTreeEditPart() { + return new BControlTreeEditPart() { + @Override + protected void createEditPolicies() { + } + }; + } + } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTableService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTableService.java index da6182eb66ce3f9ab851be83e7a5da67531a01bd..67da1a6148b0f376502b36e0047ce42a98a36e70 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTableService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTableService.java @@ -5,7 +5,7 @@ import de.bmotionstudio.gef.editor.IBControlService; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.BTable; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.BTablePart; public class BTableService extends AbstractBControlService implements @@ -17,7 +17,7 @@ public class BTableService extends AbstractBControlService implements } @Override - public AppAbstractEditPart createEditPart() { + public BMSAbstractEditPart createEditPart() { return new BTablePart(); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTextService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTextService.java index 4eb9bc34fedd686cb9f948559c1f141fe7c5bd7e..77fcbaa39c22f72ab5fc3b3e70c13bbe32709245 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTextService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTextService.java @@ -11,7 +11,7 @@ import de.bmotionstudio.gef.editor.IBControlService; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.BText; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.BTextPart; /** @@ -39,7 +39,7 @@ public class BTextService extends AbstractBControlService implements * @see de.bmotionstudio.gef.editor.IBControlService#createEditPart() */ @Override - public AppAbstractEditPart createEditPart() { + public BMSAbstractEditPart createEditPart() { return new BTextPart(); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTextfieldService.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTextfieldService.java index 1512b76a57cb7d9c82cad81d94f02cf59964597f..694879b12b6db775ff764b93e24d10bdd8fe06a2 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTextfieldService.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/service/BTextfieldService.java @@ -11,7 +11,7 @@ import de.bmotionstudio.gef.editor.IBControlService; import de.bmotionstudio.gef.editor.model.BControl; import de.bmotionstudio.gef.editor.model.BTextfield; import de.bmotionstudio.gef.editor.model.Visualization; -import de.bmotionstudio.gef.editor.part.AppAbstractEditPart; +import de.bmotionstudio.gef.editor.part.BMSAbstractEditPart; import de.bmotionstudio.gef.editor.part.BTextfieldPart; /** @@ -39,7 +39,7 @@ public class BTextfieldService extends AbstractBControlService implements * @see de.bmotionstudio.gef.editor.IBControlService#createEditPart() */ @Override - public AppAbstractEditPart createEditPart() { + public BMSAbstractEditPart createEditPart() { return new BTextfieldPart(); } diff --git a/de.bmotionstudio.help/.classpath b/de.bmotionstudio.help/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..d340cf91de61e0d4f233094a17166bcf96660af6 --- /dev/null +++ b/de.bmotionstudio.help/.classpath @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry exported="true" kind="lib" path="lib/org.eclipse.mylyn.wikitext.core_1.7.0.I20120513-1032.jar"/> + <classpathentry exported="true" kind="lib" path="lib/org.eclipse.mylyn.wikitext.mediawiki.core_1.7.0.I20120513-1032.jar"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/de.bmotionstudio.help/.gitignore b/de.bmotionstudio.help/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..035de1b11b9c848db744ce94f72e26bdcbcfacb6 --- /dev/null +++ b/de.bmotionstudio.help/.gitignore @@ -0,0 +1,5 @@ +User-Guide-Glossary-toc.xml +User-Guide-Reference-toc.xml +User-Guide-Tutorial-toc.xml +tmp/ +User_Guide/ \ No newline at end of file diff --git a/de.bmotionstudio.help/.project b/de.bmotionstudio.help/.project new file mode 100644 index 0000000000000000000000000000000000000000..9162b9f5bf81284341c67694c5e5e63d6b534265 --- /dev/null +++ b/de.bmotionstudio.help/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>de.bmotionstudio.help</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/de.bmotionstudio.help/.settings/org.eclipse.jdt.core.prefs b/de.bmotionstudio.help/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f84eafc964bdfb1f40a434083bdd428ec56ec668 --- /dev/null +++ b/de.bmotionstudio.help/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Aug 31 09:17:40 CEST 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/de.bmotionstudio.help/META-INF/MANIFEST.MF b/de.bmotionstudio.help/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..2a3c26e48a13dd905f4cf8073d66bcae49f1d6c3 --- /dev/null +++ b/de.bmotionstudio.help/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: BMotion Studio Help +Bundle-SymbolicName: de.bmotionstudio.help;singleton:=true +Bundle-Version: 1.0.0.qualifier +Require-Bundle: org.eclipse.help;bundle-version="3.5.100" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-Vendor: HHU Düsseldorf STUPS Group +Eclipse-RegisterBuddy: de.bmotionstudio.gef.editor +Bundle-ClassPath: lib/org.eclipse.mylyn.wikitext.core_1.7.0.I20120513-1032.jar, + lib/org.eclipse.mylyn.wikitext.mediawiki.core_1.7.0.I20120513-1032.jar, + . diff --git a/de.bmotionstudio.help/about.html b/de.bmotionstudio.help/about.html new file mode 100644 index 0000000000000000000000000000000000000000..b8193ece10e08aa3ee2d279b713d12e7705a8c0e --- /dev/null +++ b/de.bmotionstudio.help/about.html @@ -0,0 +1,28 @@ +<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> + <title>About</title> + </head> + <body> + +<h2>About This Content</h2> + +<p>June 25, 2008</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p> + +</body> +</html> \ No newline at end of file diff --git a/de.bmotionstudio.help/build.properties b/de.bmotionstudio.help/build.properties new file mode 100644 index 0000000000000000000000000000000000000000..09563db790fc9bcca7e53d8bc3d91a8924c720a4 --- /dev/null +++ b/de.bmotionstudio.help/build.properties @@ -0,0 +1,12 @@ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + toc.xml,\ + User-Guide-Tutorial-toc.xml,\ + User-Guide-Reference-toc.xml,\ + images/,\ + User_Guide/,\ + about.html,\ + doc/,\ + User-Guide-Glossary-toc.xml,\ + contextDefinitionFile.xml diff --git a/de.bmotionstudio.help/contextDefinitionFile.xml b/de.bmotionstudio.help/contextDefinitionFile.xml new file mode 100644 index 0000000000000000000000000000000000000000..6fa0faade9b6af80bf0f3f232539b266ae76e886 --- /dev/null +++ b/de.bmotionstudio.help/contextDefinitionFile.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<contexts> + <context id="SwitchChildCoordinates"> + <topic href="User_Guide/Reference/Observer.html#Switch_Child_Coordinates" label="Switch Child Coordinates Observer" /> + </context> + <context id="SwitchCoordinates"> + <topic href="User_Guide/Reference/Observer.html#Switch_Coordinates" label="Switch Coordinates Observer"/> + </context> + <context id="SetAttribute"> + <topic href="User_Guide/Reference/Observer.html#Set_Attribute" label="Set Attribute Observer"/> + </context> + <context id="SimpleValueDisplay"> + <topic href="User_Guide/Reference/Observer.html#Simple_Value_Display" label="Simple Value Display Observer"/> + </context> + <context id="SwitchImage"> + <topic href="User_Guide/Reference/Observer.html#Switch_Image" label="Switch Image Observer"/> + </context> + <context id="ListenOperationByPredicate"> + <topic href="User_Guide/Reference/Observer.html#Listen_Operation" label="Listen Operation Observer"/> + </context> +</contexts> diff --git a/de.bmotionstudio.help/customBuild.xml b/de.bmotionstudio.help/customBuild.xml new file mode 100644 index 0000000000000000000000000000000000000000..9885823bf43374c91fed743860767d28de87d6c7 --- /dev/null +++ b/de.bmotionstudio.help/customBuild.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- + Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf. + 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: + Lukas Ladenberger - initial API and implementation + --> + +<project name="org.eclipse.mylyn.wikitext.example" default="all"> + <description> + Generate Eclipse help content for the BMotion Studio user guide + </description> + + <property name="help.doc.url.base" value="http://www.stups.uni-duesseldorf.de/bmotionstudio"/> + <property name="wiki.url.base" value="${help.doc.url.base}"/> + <property name="imageFolder" value="images"/> + + <path id="wikitext.tasks.classpath"> + <fileset dir="lib"> + <include name="org.eclipse.mylyn.wikitext.*core*.jar"/> + </fileset> + </path> + + <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/internal/wikitext/mediawiki/core/tasks/tasks.properties"/> + <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties"/> + + <target name="init"> + <mkdir dir="tmp"/> + </target> + + <target name="clean" depends="init"> + <delete includeemptydirs="true" failonerror="false"> + <fileset dir="tmp"/> + </delete> + </target> + + <target name="all" depends="generate-help, test"/> + + <target name="generate-help" depends="init" description="Generate Eclipse help content for the BMotion Studio user guide"> + <mediawiki-to-eclipse-help + wikiBaseUrl="${help.doc.url.base}" + validate="true" + failonvalidationerror="true" + prependImagePrefix="${imageFolder}" + formatoutput="true" + defaultAbsoluteLinkTarget="bms_external" + dest="${basedir}" + title="BMotion Studio User Guide" + generateUnifiedToc="false"> + <path name="User_Guide/Tutorial" title="BMotion Studio Tutorial" generateToc="true"/> + <path name="User_Guide/Reference" title="BMotion Studio Reference" generateToc="true"/> + <pageAppendum> += Updating This Document = + +This document is maintained in a collaborative wiki. If you wish to update or modify this document please visit http://www.stups.uni-duesseldorf.de/bmotionstudio. + </pageAppendum> + </mediawiki-to-eclipse-help> + + </target> + + <target name="test" depends="init" description="verify that all of the HTML files are well-formed XML"> + <echo level="info"> +Validating help content XML and HTML files: The Eclipse help system expects well-formed XML + +If validation fails it is because either: + +* the userguide source code is poorly formed, or +* the WikiText MediaWiki parser has a bug + +Problems with userguide source are usually caused by improper use of HTML markup in the MediaWiki source, +or inadvertently starting a line with a space character (in MediaWiki this starts a preformatted block) + </echo> + + <!-- + Don't bother with DTD validation: we only care if the files are well-formed. + We therefore provide an empty DTD + --> + <mkdir dir="tmp"/> + <echo file="tmp/__empty.dtd" message=""/> + <xmlvalidate lenient="true"> + <fileset dir="."> + <include name="**/*.xml"/> + </fileset> + <fileset dir="."> + <include name="**/*.html"/> + </fileset> + <fileset dir="."> + <include name="*toc.xml"/> + </fileset> + <dtd publicid="-//W3C//DTD XHTML 1.0 Transitional//EN" location="${basedir}/tmp/__empty.dtd"/> + </xmlvalidate> + + </target> +</project> diff --git a/de.bmotionstudio.help/doc/notices.html b/de.bmotionstudio.help/doc/notices.html new file mode 100644 index 0000000000000000000000000000000000000000..cdbda6cc94e4cb5f3a5efabf6ce1f0cb5e1d426b --- /dev/null +++ b/de.bmotionstudio.help/doc/notices.html @@ -0,0 +1,17 @@ +<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> + <title>Legal Notices</title> + </head> + <body> +<h3> +<a NAME="Notices"></a>Notices</h3> +<p> +The material in this guide is Copyright (c) 2012 HHU STUPS Group and others. +</p> +<p> +<a href="../about.html">Terms and conditions regarding the use of this guide.</a> +</p> +</body> +</html> diff --git a/de.bmotionstudio.help/images/home.gif b/de.bmotionstudio.help/images/home.gif new file mode 100644 index 0000000000000000000000000000000000000000..4472e8ce5b377934abe5910749b8c58591947424 Binary files /dev/null and b/de.bmotionstudio.help/images/home.gif differ diff --git a/de.bmotionstudio.help/images/next.gif b/de.bmotionstudio.help/images/next.gif new file mode 100644 index 0000000000000000000000000000000000000000..e2f8c3e1feeb0541239db4061812008af2225105 Binary files /dev/null and b/de.bmotionstudio.help/images/next.gif differ diff --git a/de.bmotionstudio.help/images/prev.gif b/de.bmotionstudio.help/images/prev.gif new file mode 100644 index 0000000000000000000000000000000000000000..4fb41501036b940c99c8a839d7459c88eb98385c Binary files /dev/null and b/de.bmotionstudio.help/images/prev.gif differ diff --git a/de.bmotionstudio.help/lib/org.eclipse.mylyn.wikitext.core_1.7.0.I20120513-1032.jar b/de.bmotionstudio.help/lib/org.eclipse.mylyn.wikitext.core_1.7.0.I20120513-1032.jar new file mode 100644 index 0000000000000000000000000000000000000000..d70798e0076e5b0df6e268b2ce97d4bccfad72fa Binary files /dev/null and b/de.bmotionstudio.help/lib/org.eclipse.mylyn.wikitext.core_1.7.0.I20120513-1032.jar differ diff --git a/de.bmotionstudio.help/lib/org.eclipse.mylyn.wikitext.mediawiki.core_1.7.0.I20120513-1032.jar b/de.bmotionstudio.help/lib/org.eclipse.mylyn.wikitext.mediawiki.core_1.7.0.I20120513-1032.jar new file mode 100644 index 0000000000000000000000000000000000000000..4a060b5670b93729693955f4debbceecba8ebc69 Binary files /dev/null and b/de.bmotionstudio.help/lib/org.eclipse.mylyn.wikitext.mediawiki.core_1.7.0.I20120513-1032.jar differ diff --git a/de.bmotionstudio.help/plugin.xml b/de.bmotionstudio.help/plugin.xml new file mode 100644 index 0000000000000000000000000000000000000000..edb7436b8b6783656d3430b8a0710c5924357088 --- /dev/null +++ b/de.bmotionstudio.help/plugin.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + <extension + point="org.eclipse.help.toc"> + <toc + category="BMS" + file="toc.xml" + primary="true"> + </toc> + <toc + category="BMS" + file="User-Guide-Tutorial-toc.xml" + primary="false"> + </toc> + <toc + category="BMS" + file="User-Guide-Reference-toc.xml" + primary="false"> + </toc> + </extension> + <extension + point="org.eclipse.help.contexts"> + <contexts + file="contextDefinitionFile.xml" + plugin="de.bmotionstudio.gef.editor.observer"> + </contexts> + </extension> + +</plugin> diff --git a/de.bmotionstudio.help/toc.xml b/de.bmotionstudio.help/toc.xml new file mode 100644 index 0000000000000000000000000000000000000000..95c83a4d527e1dc8ca8d580b90d1b90e59b2b42c --- /dev/null +++ b/de.bmotionstudio.help/toc.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?NLS TYPE="org.eclipse.help.toc"?> +<toc label="BMotion Studio User Guide"> + <anchor id="before-reference"/> + <topic label="Tutorial"> + <anchor id="before-tutorial-content"/> + <link toc="User-Guide-Tutorial-toc.xml"/> + <anchor id="after-tutorial-content"/> + <anchor id="additions-tutorial"/> + </topic> + <topic label="Reference"> + <anchor id="before-reference-content"/> + <link toc="User-Guide-Reference-toc.xml"/> + <anchor id="after-reference-content"/> + <anchor id="additions-reference" /> + </topic> + <anchor id="after-reference"/> + <anchor id="additions"/> + <topic href="doc/notices.html" label="Legal" /> +</toc> + diff --git a/settings.gradle b/settings.gradle index b18aa1f325dab18ad9d17d9ead455fa936a5b8c1..bb2187c38344f1fac923b7dee971552ee4cdd523 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,2 @@ -include 'de.prob.core', 'de.bmotionstudio.gef.editor' ,'de.bmotionstudio.rodin', 'de.prob.plugin', 'de.prob.ui', 'de.prob2.feature' +include 'de.prob.core', 'de.bmotionstudio.gef.editor' ,'de.bmotionstudio.rodin', 'de.bmotionstudio.help' , 'de.prob.plugin', 'de.prob.ui', 'de.prob2.feature' diff --git a/tycho_build.gradle b/tycho_build.gradle index 330b23a4fbf879af2f6f0df17b1f6d36db9df4b9..494fb8fccb03065f4f7566fadcebda93833d1d82 100644 --- a/tycho_build.gradle +++ b/tycho_build.gradle @@ -1,3 +1,13 @@ +/* + Build Script can be executed via 'gradle install' + Build Script Dependencies can be downloaded via 'gradle collectDepenencies' + Executing the Build Script and download Dependencies can be executed via 'gradle completeInstall' + For a complete classPath Refresh please execute 'gradle deleteFromClassPath setClassPath' + Pom Generation can be executed via gradle deploy + +*/ + + apply plugin: 'base' import groovy.io.FileType @@ -128,8 +138,9 @@ def groupId(){ * This Group ID will be used in every sub project */ -def addLibToCP(def project, File filePar, def libPar){ +def addLibToCP(def project, def libPar){ + def filePar = new File(workspacePath+project+"/.classpath") boolean notYetAdded = true filePar.eachLine{ line -> def pattern = ".*${dependencyFolder}${libPar}.*" @@ -139,25 +150,60 @@ def addLibToCP(def project, File filePar, def libPar){ } if(notYetAdded){ - File newCP = new File(project+'/.cp') + File newCP = new File(workspacePath+project+'/.cp') filePar.eachLine{ line -> + if(line ==~ /.*<\/classpath>.*/){ - String entry = '<classpathentry exported="true" kind="lib" path="lib/dependencies/'+libPar+'"/>'+'\n</classpath>\n' + String entry = '\t<classpathentry exported="true" kind="lib" path="'+dependencyFolder+libPar+'"/>'+'\n</classpath>\n' line = line.replaceAll(/<\/classpath>/, entry) - println line - newCP << line+"\n" + println project + " : "+ libPar +" added to classpath" + newCP << line }else{ newCP << line+"\n" } } filePar.delete() - newCP.renameTo(project+'/.classpath') + newCP.renameTo(workspacePath+project+'/.classpath') }else{ println project + " : "+ libPar +" classpath entry already present" } } +// Add certain Jar to Library + + +def deleteLibFromCP(def project){ + + def filePar = new File(workspacePath+project+"/.classpath") + boolean deleteCP = false + def newCP = new File(workspacePath+project+'/cp') + def pattern = ".*${dependencyFolder}[^<].*/>" + + filePar.eachLine{ line -> + + if(line ==~ /\n(\ |\t)*/) line = line.replaceAll(/\n(\ |\t)*/, '') // delete empty lines + if(line ==~ /${pattern}/){ + deleteCP = true + def pattern2 = '(\\ |\\t)*<classpathentry exported="true" kind="lib" path="'+dependencyFolder+"[^<].*"+'"/>(\\ |\\t)*' + line = line.replaceAll(/${pattern2}/, '') + newCP << line + }else{ + newCP << line+"\n" + } + } + if(!deleteCP){ + println project + " : no dependencies from "+ dependencyFolder+" found in classpath file! " + newCP.delete() + }else{ + filePar.delete() + newCP.renameTo(workspacePath+project+'/.classpath') + println workspacePath+project+'/.classpath' +"!" + } +} +// deletes whole DependenciesLibrary Folder + + ///////////////////////////////////////////////////////////////////////////////////////// // -- !!! DEFINING SUB PROJECTS !!! -- // @@ -167,14 +213,14 @@ subprojects { apply plugin: 'base' apply plugin: 'java' - apply plugin: 'eclipse' +// apply plugin: 'eclipse' task deleteArtifacts(type: Delete) { delete 'target','pom.xml' } ///// Copy Dependencies into subprojects DependencyFolder ///// - task collectDependencies(type: Copy){ + task collectDependencies(type: Copy) { from configurations.compile @@ -183,36 +229,60 @@ subprojects { } - task setClassPath(dependsOn: 'collectDependencies'){ - + task setClassPath(dependsOn: 'collectDependencies')<<{ + + description = "\tAdds all your Dependencies from your local lib folder in each project to it's classpath" + def dependencyList = [] try{ - def dir = new File(project.name+"/"+dependencyFolder).eachFile() { file-> + def dir = new File(workspacePath+project.name+"/"+dependencyFolder).eachFile() { file-> dependencyList << file.getName() - } + } if(features.every{ it != project.name }){ - - def cpFile = new File(project.name+"/.classpath") for(int icp = 0; icp < dependencyList.size; icp++){ - addLibToCP(project.name, cpFile, dependencyList[icp]) + addLibToCP(project.name, dependencyList[icp]) } /*dependencyList.each{ dep-> - println project.name+": "+ dep - }*/ - + println project.name+": "+ dep // could still be usefull for debugging, that's why it's not deleted + }*/ } + def warningReadMe = new File(workspacePath+project.name+"/"+dependencyFolder+"_README.txt") + warningReadMe.delete() + warningReadMe << "Do Not Remove any Jars/Libraries in this Folder!\nThis folder contains all of your dependencies defined in your gradle script.\n" + warningReadMe << "Removing or renaming any of these files will result in an Error in your .classpath file\n" + warningReadMe << "If any error concerning missing dependencies should occur please run 'gradle deleteFromClassPath setClassPath' in your workspace folder from your shell." + + }catch(Exception e){ println project.name+" has no dependencies in '${dependencyFolder}' defined: Classpath will not be changed" } }// setClassPath - eclipse.classpath.file { - whenMerged { classpath -> - classpath.entries.findAll { entry -> entry.kind == 'lib' }*.exported = true - } + + task deleteFromClassPath()<<{ + + description = "\tDeletes all your Dependencies located in your local lib folder from each project's classpath" + + try{ + + boolean depsDelete = false + def depsFolder = new File(workspacePath+project.name+'/'+dependencyFolder) + if(depsFolder.exists()) depsDelete = true + depsFolder.deleteDir() + + if(features.every{ it != project.name } && depsDelete){ + deleteLibFromCP(project.name) + } + + }catch(Exception e){ + println project.name+" has no dependencies in '${dependencyFolder}' defined: Classpath will not be changed" + } + } + + /////---- For a complete classPath Refresh please execute 'gradle deleteFromClassPath setClassPath' ----/////// //////////////////////////////////////////////////////////////////////////////////////////// @@ -572,5 +642,6 @@ def feature(artifactId, versionNumber) { """ // end of feature pom // Build Script can be executed via gradle install +// For a complete classPath Refresh please execute 'gradle deleteFromClassPath setClassPath' // Pom Generation can be executed via gradle deploy