diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/Animation.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/Animation.java index 0725ead409ccbc55cc3a602e498d3189b6ba9b9c..ad68cfe4d3f7e4b24b01553a5876f849079aeeb3 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/Animation.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/Animation.java @@ -103,7 +103,7 @@ public class Animation implements IAnimationListener { } public void checkObserver() { - if (visualization.isRunning()) { + // if (visualization.isRunning()) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { @@ -114,7 +114,7 @@ public class Animation implements IAnimationListener { c.checkObserver(Animation.this); } }); - } + // } } public State getState() { diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMSContextMenuProvider.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMSContextMenuProvider.java index 58faadced59bf14c5fed56a3bbbaf24c71af7097..190f268accf096a8e691d5eb487ec4350e6ff00b 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMSContextMenuProvider.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMSContextMenuProvider.java @@ -68,7 +68,7 @@ public class BMSContextMenuProvider extends ContextMenuProvider { if (sel instanceof AbstractEditPart) { AbstractEditPart editPart = (AbstractEditPart) sel; - buildCustomMenu(menu, editPart); + // buildCustomMenu(menu, editPart); buildObserverMenu(menu, editPart); buildEventMenu(menu, editPart); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionOutlinePage.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionOutlinePage.java index 45d130b5408148388e43dc89e422d7d1f7b8fbd2..c6731c18d96fcdef5503907ca44dc97435b7c212 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionOutlinePage.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/BMotionOutlinePage.java @@ -3,9 +3,11 @@ package de.bmotionstudio.gef.editor; import org.eclipse.draw2d.LightweightSystem; import org.eclipse.draw2d.Viewport; import org.eclipse.draw2d.parts.ScrollableThumbnail; +import org.eclipse.gef.ContextMenuProvider; import org.eclipse.gef.GraphicalViewer; import org.eclipse.gef.LayerConstants; import org.eclipse.gef.editparts.ScalableRootEditPart; +import org.eclipse.gef.ui.actions.ActionRegistry; import org.eclipse.gef.ui.parts.ContentOutlinePage; import org.eclipse.gef.ui.parts.TreeViewer; import org.eclipse.jface.action.Action; @@ -19,6 +21,8 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.part.IPageSite; import de.bmotionstudio.gef.editor.part.BMSTreeEditPartFactory; @@ -41,29 +45,28 @@ public class BMotionOutlinePage extends ContentOutlinePage { @Override public void init(IPageSite pageSite) { super.init(pageSite); - // IActionBars bars = pageSite.getActionBars(); - // ActionRegistry ar = getActionRegistry(); - // bars.setGlobalActionHandler(ActionFactory.UNDO.getId(), - // ar.getAction(ActionFactory.UNDO.getId())); - // bars.setGlobalActionHandler(ActionFactory.REDO.getId(), - // ar.getAction(ActionFactory.REDO.getId())); - // bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), - // ar.getAction(ActionFactory.DELETE.getId())); - // bars.setGlobalActionHandler(ActionFactory.COPY.getId(), - // ar.getAction(ActionFactory.COPY.getId())); - // bars.setGlobalActionHandler(ActionFactory.PASTE.getId(), - // ar.getAction(ActionFactory.PASTE.getId())); + IActionBars bars = pageSite.getActionBars(); + ActionRegistry ar = viewPart.getActionRegistry(); + bars.setGlobalActionHandler(ActionFactory.UNDO.getId(), + ar.getAction(ActionFactory.UNDO.getId())); + bars.setGlobalActionHandler(ActionFactory.REDO.getId(), + ar.getAction(ActionFactory.REDO.getId())); + bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), + ar.getAction(ActionFactory.DELETE.getId())); + bars.setGlobalActionHandler(ActionFactory.COPY.getId(), + ar.getAction(ActionFactory.COPY.getId())); + bars.setGlobalActionHandler(ActionFactory.PASTE.getId(), + ar.getAction(ActionFactory.PASTE.getId())); // buildCustomActions(bars, ar); - // bars.updateActionBars(); + bars.updateActionBars(); } protected void configureOutlineViewer() { getViewer().setEditDomain(this.viewPart.getEditDomain()); getViewer().setEditPartFactory(new BMSTreeEditPartFactory()); - // ContextMenuProvider provider = new - // BMSContextMenuProvider(getViewer(), - // getActionRegistry()); - // getViewer().setContextMenu(provider); + ContextMenuProvider provider = new BMSContextMenuProvider(getViewer(), + viewPart.getActionRegistry()); + getViewer().setContextMenu(provider); // getViewer().setKeyHandler(getCommonKeyHandler()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/VisualizationViewPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/VisualizationViewPart.java index 573434a867efacd60a3542594aee7d2098694550..a69514c11641dff67e81a0be1c09840f5ec5b366 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/VisualizationViewPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/VisualizationViewPart.java @@ -5,8 +5,14 @@ import java.util.EventObject; import java.util.Iterator; import java.util.List; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; import org.eclipse.draw2d.ColorConstants; import org.eclipse.draw2d.PositionConstants; +import org.eclipse.gef.ContextMenuProvider; import org.eclipse.gef.EditDomain; import org.eclipse.gef.GraphicalViewer; import org.eclipse.gef.MouseWheelHandler; @@ -19,6 +25,7 @@ import org.eclipse.gef.editparts.ScalableRootEditPart; import org.eclipse.gef.editparts.ZoomManager; import org.eclipse.gef.rulers.RulerProvider; import org.eclipse.gef.ui.actions.ActionRegistry; +import org.eclipse.gef.ui.actions.DeleteAction; import org.eclipse.gef.ui.actions.GEFActionConstants; import org.eclipse.gef.ui.actions.RedoAction; import org.eclipse.gef.ui.actions.SelectAllAction; @@ -53,6 +60,8 @@ import org.eclipse.ui.views.contentoutline.IContentOutlinePage; import org.eclipse.ui.views.properties.IPropertySheetPage; import de.bmotionstudio.gef.editor.action.CopyAction; +import de.bmotionstudio.gef.editor.action.OpenObserverAction; +import de.bmotionstudio.gef.editor.action.OpenSchedulerEventAction; import de.bmotionstudio.gef.editor.action.PasteAction; import de.bmotionstudio.gef.editor.internal.BControlTransferDropTargetListener; import de.bmotionstudio.gef.editor.model.BMotionRuler; @@ -261,9 +270,86 @@ public class VisualizationViewPart extends PageBookView implements registry.registerAction(action); getSelectionActions().add(action.getId()); + action = new DeleteAction((IWorkbenchPart) this); + registry.registerAction(action); + getSelectionActions().add(action.getId()); + action = new SelectAllAction(this); registry.registerAction(action); + installObserverActions(); + installSchedulerActions(); + + } + + private void installObserverActions() { + + IAction action; + ActionRegistry registry = getActionRegistry(); + + IExtensionRegistry reg = Platform.getExtensionRegistry(); + IExtensionPoint extensionPoint = reg + .getExtensionPoint("de.bmotionstudio.gef.editor.observer"); + for (IExtension extension : extensionPoint.getExtensions()) { + for (IConfigurationElement configurationElement : extension + .getConfigurationElements()) { + + if ("observer".equals(configurationElement.getName())) { + + String observerClassName = configurationElement + .getAttribute("class"); + + action = new OpenObserverAction(this); + action.setId("de.bmotionstudio.gef.editor.observerAction." + + observerClassName); + ((OpenObserverAction) action) + .setClassName(observerClassName); + registry.registerAction(action); + getSelectionActions().add( + "de.bmotionstudio.gef.editor.observerAction." + + observerClassName); + + } + + } + + } + + } + + private void installSchedulerActions() { + + IAction action; + ActionRegistry registry = getActionRegistry(); + + IExtensionRegistry reg = Platform.getExtensionRegistry(); + IExtensionPoint extensionPoint = reg + .getExtensionPoint("de.bmotionstudio.gef.editor.schedulerEvent"); + for (IExtension extension : extensionPoint.getExtensions()) { + for (IConfigurationElement configurationElement : extension + .getConfigurationElements()) { + + if ("schedulerEvent".equals(configurationElement.getName())) { + + String sClassName = configurationElement + .getAttribute("class"); + + action = new OpenSchedulerEventAction(this); + action.setId("de.bmotionstudio.gef.editor.SchedulerEventAction." + + sClassName); + ((OpenSchedulerEventAction) action) + .setClassName(sClassName); + registry.registerAction(action); + getSelectionActions().add( + "de.bmotionstudio.gef.editor.SchedulerEventAction." + + sClassName); + + } + + } + + } + } private class VisualizationViewPage extends Page { @@ -339,6 +425,9 @@ public class VisualizationViewPart extends PageBookView implements bars.setGlobalActionHandler(ActionFactory.PASTE.getId(), ar.getAction(ActionFactory.PASTE.getId())); + bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), + ar.getAction(ActionFactory.DELETE.getId())); + bars.updateActionBars(); } @@ -361,6 +450,10 @@ public class VisualizationViewPart extends PageBookView implements .getToolBarManager() .add(getActionRegistry().getAction( ActionFactory.PASTE.getId())); + pageSite.getActionBars() + .getToolBarManager() + .add(getActionRegistry().getAction( + ActionFactory.DELETE.getId())); pageSite.getActionBars().getToolBarManager().add(new Separator()); @@ -436,6 +529,11 @@ public class VisualizationViewPart extends PageBookView implements updateActions(selectionActions); } }); + + ContextMenuProvider provider = new BMSContextMenuProvider( + graphicalViewer, getActionRegistry()); + graphicalViewer.setContextMenu(provider); + } public GraphicalViewer getGraphicalViewer() { diff --git a/de.bmotionstudio.rodin/fragment.xml b/de.bmotionstudio.rodin/fragment.xml index 5fb8856c321fcf6aced0f36b205ed0ad51bf3536..64961101fb45c9e08b0ccca5db25db2902846921 100644 --- a/de.bmotionstudio.rodin/fragment.xml +++ b/de.bmotionstudio.rodin/fragment.xml @@ -1,21 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <fragment> - <extension - point="org.eclipse.ui.perspectives"> - <perspective - class="de.bmotionstudio.rodin.PerspectiveEditFactory" - icon="icons/logo_bmotion.png" - id="de.bmotionstudio.perspective.edit" - name="BMS Edit"> - </perspective> - <perspective - class="de.bmotionstudio.rodin.PerspectiveRunFactory" - icon="icons/icon_run.png" - id="de.bmotionstudio.perspective.run" - name="BMS Run"> - </perspective> - </extension> <extension point="org.eclipse.ui.menus"> <menuContribution