Skip to content
Snippets Groups Projects
Commit f055db6c authored by Florian Hölzl's avatar Florian Hölzl
Browse files

unde/redo actions finally work

some clean up
parent 84257888
No related branches found
No related tags found
No related merge requests found
Showing
with 39 additions and 27 deletions
...@@ -86,4 +86,16 @@ public abstract class GraphicalEditPartBase<T extends EObject> extends ...@@ -86,4 +86,16 @@ public abstract class GraphicalEditPartBase<T extends EObject> extends
modelElement.eAdapters().remove(fullRefreshAdapter); modelElement.eAdapters().remove(fullRefreshAdapter);
super.deactivate(); super.deactivate();
} }
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class key) {
// EObjectSelectionUtils requires us to adapt to EObject, since
// graphical edit parts can be provided as selection as well.
if (key == EObject.class) {
return modelElement;
}
return super.getAdapter(key);
}
} }
...@@ -29,7 +29,6 @@ import org.eclipse.jface.resource.ImageDescriptor; ...@@ -29,7 +29,6 @@ import org.eclipse.jface.resource.ImageDescriptor;
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 39A7CCEBD43D310CCB0F78BF6714E3AE * @ConQAT.Rating YELLOW Hash: 39A7CCEBD43D310CCB0F78BF6714E3AE
*/ */
// TODO (FH): move to UI
public abstract class EObjectActionBase extends Action { public abstract class EObjectActionBase extends Action {
/** Stores the target {@link EObject}. */ /** Stores the target {@link EObject}. */
......
...@@ -33,7 +33,6 @@ import org.fortiss.tooling.kernel.ui.interfaces.IModelElementHandler; ...@@ -33,7 +33,6 @@ import org.fortiss.tooling.kernel.ui.interfaces.IModelElementHandler;
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: D35DD317B0C9AB5C153A5FEB5BC870EE * @ConQAT.Rating YELLOW Hash: D35DD317B0C9AB5C153A5FEB5BC870EE
*/ */
// TODO (FH): move UI parts
public abstract class ModelElementHandlerBase<T extends EObject> implements public abstract class ModelElementHandlerBase<T extends EObject> implements
IModelElementHandler<T> { IModelElementHandler<T> {
......
...@@ -43,7 +43,6 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; ...@@ -43,7 +43,6 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: 52DBB44E0AFA61A036B9C2A5297E3BA5 * @ConQAT.Rating RED Hash: 52DBB44E0AFA61A036B9C2A5297E3BA5
*/ */
// TODO (FH): move to UI
public abstract class PropertySectionBase extends AbstractPropertySection { public abstract class PropertySectionBase extends AbstractPropertySection {
/** Label width. */ /** Label width. */
......
...@@ -27,7 +27,6 @@ import org.fortiss.tooling.kernel.ui.internal.editor.BindingEditor; ...@@ -27,7 +27,6 @@ import org.fortiss.tooling.kernel.ui.internal.editor.BindingEditor;
* @version $Rev: 18709 $ * @version $Rev: 18709 $
* @ConQAT.Rating YELLOW Hash: 6A3E42B1BE8519EA4B528FBF2E8D3F0A * @ConQAT.Rating YELLOW Hash: 6A3E42B1BE8519EA4B528FBF2E8D3F0A
*/ */
// TODO (FH): move to UI
public interface IBindingEditorPageChangeListener { public interface IBindingEditorPageChangeListener {
/** Indicates a page change. */ /** Indicates a page change. */
......
...@@ -31,7 +31,6 @@ import org.fortiss.tooling.kernel.ui.services.IContextMenuService; ...@@ -31,7 +31,6 @@ import org.fortiss.tooling.kernel.ui.services.IContextMenuService;
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: 2EACD5609822D5747074DB89E6956349 * @ConQAT.Rating RED Hash: 2EACD5609822D5747074DB89E6956349
*/ */
// TODO (FH): move to UI
public interface ICustomMenuContributor { public interface ICustomMenuContributor {
/** Returns the contributed items, i.e., actions or menus. */ /** Returns the contributed items, i.e., actions or menus. */
......
...@@ -29,7 +29,6 @@ import org.fortiss.tooling.kernel.interfaces.IEObjectAware; ...@@ -29,7 +29,6 @@ import org.fortiss.tooling.kernel.interfaces.IEObjectAware;
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 4AC49B113174D91D434A480C3456423F * @ConQAT.Rating YELLOW Hash: 4AC49B113174D91D434A480C3456423F
*/ */
// TODO (FH): move to UI
public interface IEditorBinding<T extends EObject> extends public interface IEditorBinding<T extends EObject> extends
IEObjectAware<EObject> { IEObjectAware<EObject> {
......
...@@ -42,7 +42,7 @@ import org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils; ...@@ -42,7 +42,7 @@ import org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils;
* @author hoelzlf * @author hoelzlf
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 5DDB14A5557BDA2375928D87F4F4B2BB * @ConQAT.Rating YELLOW Hash: 0DEA10AF5172CF62CC2C422274B84220
*/ */
public class ActionService implements IActionService, public class ActionService implements IActionService,
ITopLevelElementChangeListener, CommandStackListener { ITopLevelElementChangeListener, CommandStackListener {
...@@ -102,7 +102,15 @@ public class ActionService implements IActionService, ...@@ -102,7 +102,15 @@ public class ActionService implements IActionService,
/** Constructor. */ /** Constructor. */
public ActionService() { public ActionService() {
globalUndoAction.setId(ActionFactory.UNDO.getId());
globalRedoAction.setId(ActionFactory.REDO.getId());
globalDeleteAction.setId(ActionFactory.DELETE.getId());
for (ITopLevelElementContext context : IPersistencyService.INSTANCE
.getTopLevelElementContexts()) {
context.addCommandStackListener(this);
}
IPersistencyService.INSTANCE.addTopLevelElementListener(this);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
...@@ -116,13 +124,11 @@ public class ActionService implements IActionService, ...@@ -116,13 +124,11 @@ public class ActionService implements IActionService,
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public void registerGlobalActions(IActionBars actionBars) { public void registerGlobalActions(IActionBars actionBars) {
globalUndoAction.setId(ActionFactory.UNDO.getId());
globalUndoAction.setActionDefinitionId(ActionFactory.UNDO globalUndoAction.setActionDefinitionId(ActionFactory.UNDO
.getCommandId()); .getCommandId());
actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(),
globalUndoAction); globalUndoAction);
globalRedoAction.setId(ActionFactory.REDO.getId());
globalRedoAction.setActionDefinitionId(ActionFactory.REDO globalRedoAction.setActionDefinitionId(ActionFactory.REDO
.getCommandId()); .getCommandId());
actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(),
......
...@@ -35,7 +35,6 @@ import org.fortiss.tooling.kernel.ui.services.IContextMenuService; ...@@ -35,7 +35,6 @@ import org.fortiss.tooling.kernel.ui.services.IContextMenuService;
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: 28C94C43A9B4498417187CD8F0EFBC57 * @ConQAT.Rating RED Hash: 28C94C43A9B4498417187CD8F0EFBC57
*/ */
// TODO (FH): move to UI
public class ContextMenuService implements IContextMenuService { public class ContextMenuService implements IContextMenuService {
/** {@inheritDoc} */ /** {@inheritDoc} */
......
...@@ -33,7 +33,7 @@ import org.fortiss.tooling.kernel.ui.services.IModelElementService; ...@@ -33,7 +33,7 @@ import org.fortiss.tooling.kernel.ui.services.IModelElementService;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: BF8801A688B2F4465A25325299BF0215 * @ConQAT.Rating YELLOW Hash: 9D99C615FF981BE0831593DC3600D498
*/ */
public class ModelElementService extends public class ModelElementService extends
EObjectAwareServiceBase<IModelElementHandler<EObject>> implements EObjectAwareServiceBase<IModelElementHandler<EObject>> implements
......
...@@ -47,7 +47,7 @@ import org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils; ...@@ -47,7 +47,7 @@ import org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 0DBA8B19BC7741F646B0FECB369E177F * @ConQAT.Rating YELLOW Hash: B7F899DC2CFB74320D2F7A19A2D5FEBB
*/ */
public class NavigatorService implements INavigatorService, public class NavigatorService implements INavigatorService,
ITopLevelElementChangeListener, CommandStackListener { ITopLevelElementChangeListener, CommandStackListener {
......
...@@ -25,9 +25,9 @@ import org.fortiss.tooling.kernel.ui.services.IPropertiesService; ...@@ -25,9 +25,9 @@ import org.fortiss.tooling.kernel.ui.services.IPropertiesService;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: 923634855866E1E514EC11821EC8506A * @ConQAT.Rating YELLOW Hash: 37CDABB5D03E1D2F534D83EB55855351
* *
*/ */
public class PropertiesService implements IPropertiesService { public class PropertiesService implements IPropertiesService {
// nothing to do yet
} }
...@@ -55,7 +55,6 @@ import org.fortiss.tooling.kernel.ui.services.IModelElementService; ...@@ -55,7 +55,6 @@ import org.fortiss.tooling.kernel.ui.services.IModelElementService;
* @version $Rev: 18709 $ * @version $Rev: 18709 $
* @ConQAT.Rating RED Hash: A43DAF31B100FF92B123EA6A31C86CBA * @ConQAT.Rating RED Hash: A43DAF31B100FF92B123EA6A31C86CBA
*/ */
// TODO (FH): move to UI
public class LibraryView extends ViewPart { public class LibraryView extends ViewPart {
/** The viewer. */ /** The viewer. */
......
...@@ -23,12 +23,12 @@ import org.fortiss.tooling.kernel.ui.internal.ActionService; ...@@ -23,12 +23,12 @@ import org.fortiss.tooling.kernel.ui.internal.ActionService;
/** /**
* The action service manages registration and execution of actions including * The action service manages registration and execution of actions including
* global actions like undo and redo. * global actions like undo, redo, and delete.
* *
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 11C327F4AFE805D0DA6CB14BF7021FB9 * @ConQAT.Rating YELLOW Hash: 2B3895F36532E6A497B12746C07D91D8
*/ */
public interface IActionService { public interface IActionService {
...@@ -38,9 +38,13 @@ public interface IActionService { ...@@ -38,9 +38,13 @@ public interface IActionService {
/** Registers global actions with the given {@link IActionBars}. */ /** Registers global actions with the given {@link IActionBars}. */
void registerGlobalActions(IActionBars actionBars); void registerGlobalActions(IActionBars actionBars);
/** Adds the global default actions like undo to the given context menu. */ /** Adds the global default actions to the given context menu. */
void addGlobalDefaultActionSectionToMenu(IMenuManager menuManager); void addGlobalDefaultActionSectionToMenu(IMenuManager menuManager);
/** Refreshes the enabled state of the global actions. */ /**
* Refreshes the enabled state of the global actions. This method should be
* called when a selection changes. It is automatically called by the action
* service when any command stack changes.
*/
void refresh(); void refresh();
} }
...@@ -28,9 +28,8 @@ import org.fortiss.tooling.kernel.ui.internal.ContextMenuService; ...@@ -28,9 +28,8 @@ import org.fortiss.tooling.kernel.ui.internal.ContextMenuService;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 6DC07C7AF82987C8C1B81DF8C2CABCEF * @ConQAT.Rating YELLOW Hash: 898966F83FD7AF20C4620A8AAB017EC0
*/ */
// TODO (FH): move to UI
public interface IContextMenuService { public interface IContextMenuService {
/** Custom menu section separator id. */ /** Custom menu section separator id. */
......
...@@ -27,7 +27,7 @@ import org.fortiss.tooling.kernel.ui.internal.EditPartFactoryService; ...@@ -27,7 +27,7 @@ import org.fortiss.tooling.kernel.ui.internal.EditPartFactoryService;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: A052488068BAE9406F9BEAD648E70BD7 * @ConQAT.Rating YELLOW Hash: F01D48DCA4F80858F39646340CE0E5F2
*/ */
public interface IEditPartFactoryService extends EditPartFactory { public interface IEditPartFactoryService extends EditPartFactory {
......
...@@ -29,7 +29,7 @@ import org.fortiss.tooling.kernel.ui.internal.EditorService; ...@@ -29,7 +29,7 @@ import org.fortiss.tooling.kernel.ui.internal.EditorService;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 0345494D4037310F62B12BB3806E9C77 * @ConQAT.Rating YELLOW Hash: 2C420A3D582F2726FBC96D141CEAEF81
*/ */
public interface IEditorService { public interface IEditorService {
......
...@@ -28,7 +28,7 @@ import org.fortiss.tooling.kernel.ui.internal.ModelElementService; ...@@ -28,7 +28,7 @@ import org.fortiss.tooling.kernel.ui.internal.ModelElementService;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 4FEBCD30257311CA3D9D20F66CC2B1FA * @ConQAT.Rating YELLOW Hash: 84FA1569F479C2625D09D0CA2C9A170D
*/ */
public interface IModelElementService { public interface IModelElementService {
......
...@@ -29,9 +29,8 @@ import org.fortiss.tooling.kernel.ui.internal.NavigatorService; ...@@ -29,9 +29,8 @@ import org.fortiss.tooling.kernel.ui.internal.NavigatorService;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: 9B9DAAC0BFE14D2AE78C879E96598ED5 * @ConQAT.Rating YELLOW Hash: 3C201DC07138A2C1A15C710F8A81A242
*/ */
// TODO (FH): move to UI
public interface INavigatorService { public interface INavigatorService {
/** Returns the singleton instance of the service. */ /** Returns the singleton instance of the service. */
public static final INavigatorService INSTANCE = new NavigatorService(); public static final INavigatorService INSTANCE = new NavigatorService();
......
...@@ -25,7 +25,7 @@ import org.fortiss.tooling.kernel.ui.internal.PropertiesService; ...@@ -25,7 +25,7 @@ import org.fortiss.tooling.kernel.ui.internal.PropertiesService;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: E340ED4EFA15B122B4074F128F0A330F * @ConQAT.Rating YELLOW Hash: 102C35BC9B6C4C7BFE71810750CD4D20
*/ */
public interface IPropertiesService { public interface IPropertiesService {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment