sk.uniba.euromath.editor.actions
Class AbstractActionContributor

java.lang.Object
  extended by sk.uniba.euromath.editor.actions.AbstractActionContributor
All Implemented Interfaces:
org.eclipse.gef.commands.CommandStackEventListener, IDOMSelectionChangedListener
Direct Known Subclasses:
XMLActionContributor, XMLOutlineActionContributor

public abstract class AbstractActionContributor
extends Object
implements IDOMSelectionChangedListener, org.eclipse.gef.commands.CommandStackEventListener

Generic abstract action contributor for ations of type IMultiViewAction interface. Can be used anywhere.

Author:
Tomáš Studva 16.10.2005

Constructor Summary
AbstractActionContributor(IDOMSelectionProvider selectionProvider, org.eclipse.gef.commands.CommandStack commandStack)
          Constructor.
 
Method Summary
protected  Action checkOrCreateAction(String key)
          Checks for action with id key in registry.
protected  List<Action> checkOrCreateActions(String[] keys)
          Checks for action with id key in registry.
protected abstract  void configureFactory()
          Configures factory.
 void dispose()
           
 MultiViewActionFactory getActionFactory()
           
abstract  org.eclipse.gef.ui.actions.ActionRegistry getActionRegistry()
          Returns action registry in which created actions are registered.
protected  DocumentModifyHelper getDocumentModifyHelper()
          Getter for document modifier.
abstract  IWorkbenchPart getWorkbenchPart()
          Returns workbench part for which actions are created.
 XMLAccess getXMLAccess()
          Returns XMLAccess instance.
 void selectionChanged(DOMSelectionChangedEvent event)
          Updates all actions.
 void setActionFactory(MultiViewActionFactory actionFactory)
          Setter for action factory.
 void setXMLAccess(XMLAccess xmlAccess)
           
 void stackChanged(org.eclipse.gef.commands.CommandStackEvent event)
          Updates all actions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractActionContributor

public AbstractActionContributor(IDOMSelectionProvider selectionProvider,
                                 org.eclipse.gef.commands.CommandStack commandStack)
Constructor.

Parameters:
selectionProvider - selection provider
Method Detail

dispose

public void dispose()

configureFactory

protected abstract void configureFactory()
Configures factory. Registers action in factory by their ids to their classes.


selectionChanged

public void selectionChanged(DOMSelectionChangedEvent event)
Updates all actions.

Specified by:
selectionChanged in interface IDOMSelectionChangedListener
Parameters:
event - event object describing the change

stackChanged

public void stackChanged(org.eclipse.gef.commands.CommandStackEvent event)
Updates all actions.

Specified by:
stackChanged in interface org.eclipse.gef.commands.CommandStackEventListener

checkOrCreateAction

protected Action checkOrCreateAction(String key)
Checks for action with id key in registry. If exist - is registered, than is returned. Otherwise is created by action factory. SelectionActions are added to selectionAction list for selection change update.

Parameters:
key - to identify action, must be IAction.getId()
Returns:
desired action

checkOrCreateActions

protected List<Action> checkOrCreateActions(String[] keys)
Checks for action with id key in registry. If is registered, than is added to result list. Otherwise is created by action factory and added to result list.

Parameters:
keys - to identify action, must be IAction.getId()
Returns:
desired actions

getDocumentModifyHelper

protected DocumentModifyHelper getDocumentModifyHelper()
Getter for document modifier.

Returns:
document modifier.

setXMLAccess

public void setXMLAccess(XMLAccess xmlAccess)
Parameters:
xmlAccess - The xmlAccess to set.

getXMLAccess

public XMLAccess getXMLAccess()
Returns XMLAccess instance.

Returns:
XMLAccess instance

getActionFactory

public MultiViewActionFactory getActionFactory()
Returns:
Returns the xmlActionFactory.

setActionFactory

public void setActionFactory(MultiViewActionFactory actionFactory)
Setter for action factory.

Parameters:
actionFactory - to set.

getWorkbenchPart

public abstract IWorkbenchPart getWorkbenchPart()
Returns workbench part for which actions are created.

Returns:
workbech part

getActionRegistry

public abstract org.eclipse.gef.ui.actions.ActionRegistry getActionRegistry()
Returns action registry in which created actions are registered.

Returns:
action registry


Copyright © 2003-2006 null. All Rights Reserved.