sk.uniba.euromath.editor.xmlEditor.actions
Class XMLAccessModifyAction

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.jface.action.AbstractAction
          extended by org.eclipse.jface.action.Action
              extended by org.eclipse.gef.ui.actions.WorkbenchPartAction
                  extended by sk.uniba.euromath.editor.xmlEditor.actions.XMLAccessModifyAction
All Implemented Interfaces:
IAdaptable, org.eclipse.gef.Disposable, org.eclipse.gef.ui.actions.UpdateAction, IAction, IMultiViewAction
Direct Known Subclasses:
AtCaretAction, ClipboardAction, DeleteElementAction, DeleteElementsOnlyAction, DeleteMixedAction, DeleteTextOnlyAction, DeleteTextPieceAction, MultiNodeEnclosingAction, NodeManipulateAction, RedoAction, SelectAction, UndoAction

public abstract class XMLAccessModifyAction
extends org.eclipse.gef.ui.actions.WorkbenchPartAction
implements IMultiViewAction, IAdaptable

Base action for generic xml modification actions.
Supposed to be subclassed. Naming convention for actions: ProccessActor[Wizard]PlaceAction.

Author:
Tomáš Studva 2.2.2006

Field Summary
protected  IAdaptable adaptableProvider
          Adaptable provider
protected  sk.baka.ikslibs.interval.DOMIntervalSet selection
          Current selection on document.
 
Fields inherited from interface org.eclipse.jface.action.IAction
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT
 
Constructor Summary
XMLAccessModifyAction(IWorkbenchPart part)
          Creates a XMLAccessModifyAction and associates it with the given editor.
XMLAccessModifyAction(IWorkbenchPart part, int style)
          Creates a XMLAccessModifyAction and associates it with the given editor.
 
Method Summary
protected  boolean calculateEnabled()
           
protected  void clear()
          Clears the selection.
protected  IAdaptable getAdaptableProvider()
           
 Object getAdapter(Class adapter)
          Method call is delagated to AdaptableProvider if is not null, if is null method is delegated to WorkbenchPart.
protected  sk.baka.ikslibs.ids.IDManager getIdManager()
          Returns IdManager.
protected  DocumentModifyHelper getModifyHelper()
          Returns the controller instance.
protected  sk.baka.ikslibs.interval.DOMIntervalSet getSelection()
           
protected  IDOMSelectionProvider getSelectionProvider()
          Returns DOM selection provider.
protected  Shell getShell()
          Returns shell where the action executes.
protected  XMLAccess getXMLAccess()
          Returns instance of the document.
protected  void handleDocumentException(DocumentException ex)
          Handles the exception that occured when asking for node for invalid id in IDManager: prints an error message and logs it.
protected  void handleDOMException(DOMException ex)
          TODO
protected  void handleExportException(sk.baka.xml.gene.ExportException ex)
          Handles the exception that occured during the document modification: prints an error message and logs it.
protected  void logError(Throwable e)
          Error logging method.
protected  void logError(Throwable e, String msg)
          Error logging method.
protected  void processSelection()
          Makes xmlSelection valid to current selection.
protected  void refresh()
           
 void setAdaptableProvider(IAdaptable a)
          Sets adaptable provider.
 void setWorkbenchPart(IWorkbenchPart part)
          Sets new workbench part.
 void setXMLAccess(XMLAccess access)
          Setter for xml access.
 void update()
           
 
Methods inherited from class org.eclipse.gef.ui.actions.WorkbenchPartAction
dispose, execute, getCommandStack, getWorkbenchPart, init, isEnabled, setLazyEnablementCalculation
 
Methods inherited from class org.eclipse.jface.action.Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, run, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from class org.eclipse.jface.action.AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.action.IAction
addPropertyChangeListener, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, removePropertyChangeListener, run, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 

Field Detail

selection

protected sk.baka.ikslibs.interval.DOMIntervalSet selection
Current selection on document.


adaptableProvider

protected IAdaptable adaptableProvider
Adaptable provider

Constructor Detail

XMLAccessModifyAction

public XMLAccessModifyAction(IWorkbenchPart part)
Creates a XMLAccessModifyAction and associates it with the given editor.

Parameters:
part - The workbench part associated with this action

XMLAccessModifyAction

public XMLAccessModifyAction(IWorkbenchPart part,
                             int style)
Creates a XMLAccessModifyAction and associates it with the given editor.

Parameters:
part - The workbench part associated with this action
style - the style for this action
Method Detail

getSelectionProvider

protected IDOMSelectionProvider getSelectionProvider()
Returns DOM selection provider.

Returns:
IDOMSelectionProvider

calculateEnabled

protected boolean calculateEnabled()
Specified by:
calculateEnabled in class org.eclipse.gef.ui.actions.WorkbenchPartAction

clear

protected void clear()
Clears the selection.


getSelection

protected sk.baka.ikslibs.interval.DOMIntervalSet getSelection()
Returns:
Returns the xmlSelection.

getModifyHelper

protected final DocumentModifyHelper getModifyHelper()
Returns the controller instance.

Returns:
Returns the controller.

getXMLAccess

protected XMLAccess getXMLAccess()
Returns instance of the document.

Returns:
instance of document, never null.

getAdapter

public Object getAdapter(Class adapter)
Method call is delagated to AdaptableProvider if is not null, if is null method is delegated to WorkbenchPart.

Specified by:
getAdapter in interface IAdaptable
See Also:
IAdaptable.getAdapter(java.lang.Class)

setAdaptableProvider

public void setAdaptableProvider(IAdaptable a)
Sets adaptable provider. If adaptable provider is not set, workbench part is used as IAdaptable.

Parameters:
a - provider to set

getIdManager

protected sk.baka.ikslibs.ids.IDManager getIdManager()
Returns IdManager.

Returns:
IdManager.

processSelection

protected void processSelection()
Makes xmlSelection valid to current selection.


refresh

protected void refresh()
Overrides:
refresh in class org.eclipse.gef.ui.actions.WorkbenchPartAction

setWorkbenchPart

public void setWorkbenchPart(IWorkbenchPart part)
Description copied from interface: IMultiViewAction
Sets new workbench part. Used when active workbench part was changed.

Specified by:
setWorkbenchPart in interface IMultiViewAction
Overrides:
setWorkbenchPart in class org.eclipse.gef.ui.actions.WorkbenchPartAction
Parameters:
part - active workbench part

setXMLAccess

public void setXMLAccess(XMLAccess access)
Setter for xml access.

Parameters:
access - XMLAccess to set

logError

protected final void logError(Throwable e,
                              String msg)
Error logging method.

Parameters:
e - exception to log
msg - description of the error

logError

protected final void logError(Throwable e)
Error logging method.

Parameters:
e - exception to log

handleExportException

protected final void handleExportException(sk.baka.xml.gene.ExportException ex)
Handles the exception that occured during the document modification: prints an error message and logs it.

Parameters:
ex - exception to handle.

handleDocumentException

protected final void handleDocumentException(DocumentException ex)
Handles the exception that occured when asking for node for invalid id in IDManager: prints an error message and logs it.

Parameters:
ex - exception to handle.

handleDOMException

protected final void handleDOMException(DOMException ex)
TODO

Parameters:
ex - exception to handle.

getShell

protected final Shell getShell()
Returns shell where the action executes. Use as parent for dialogs, wizards etc.

Returns:
parent shell instance.

update

public void update()
Specified by:
update in interface org.eclipse.gef.ui.actions.UpdateAction
Overrides:
update in class org.eclipse.gef.ui.actions.WorkbenchPartAction

getAdaptableProvider

protected IAdaptable getAdaptableProvider()
Returns:
Returns the adaptableProvider.


Copyright © 2003-2006 null. All Rights Reserved.