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:
org.eclipse.gef.Disposable, org.eclipse.gef.ui.actions.UpdateAction, IAction
Direct Known Subclasses:
CopyAction, CutAction, DeleteNodeAction, DeleteSelectionAction, DeleteTextOnlyAction, EnclosingAction, InsertTextAction, NodeManipulateAction, RedoAction, SelectAction, UndoAction

public abstract class XMLAccessModifyAction
extends org.eclipse.gef.ui.actions.WorkbenchPartAction

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

Author:
Tomáš Studva 2.2.2006

Field Summary
protected  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)
          Constructor.
XMLAccessModifyAction(IWorkbenchPart part, int style)
          Constructor.
 
Method Summary
protected  boolean calculateEnabled()
          When overriding, call to this method as first statement is needed.
 void dispose()
           
protected  CaretManager getCaretManager()
          Returns caret provider.
protected  IDManager getIdManager()
          Getter.
protected  DocumentModifyHelper getModifyHelper()
          Getter.
protected  DomPointer getPointer()
          Returns pointer to place in DOM tree where is caret.
protected  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 e)
          Handles the exception that occured when asking for node for invalid id in IDManager: prints an error message and logs it.
protected  void handleExportException(ExportException e)
          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()
          Refreshes the properties of this action, which depends on selection.
 void run()
          Default implementation is run action in command.
protected  void runAsCommand()
          If action run method should run whole in command(and undo/redo is getUndoManager().undo/redo), override this method instead of run.
 void setWorkbenchPart(IWorkbenchPart part)
           
 
Methods inherited from class org.eclipse.gef.ui.actions.WorkbenchPartAction
execute, getCommandStack, getWorkbenchPart, init, isEnabled, refresh, setLazyEnablementCalculation, update
 
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, 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, removePropertyChangeListener
 

Field Detail

selection

protected DOMIntervalSet selection
Current selection on document.

Constructor Detail

XMLAccessModifyAction

public XMLAccessModifyAction(IWorkbenchPart part)
Constructor.

Parameters:
part - The workbench part associated with this action, not null

XMLAccessModifyAction

public XMLAccessModifyAction(IWorkbenchPart part,
                             int style)
Constructor.

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

calculateEnabled

protected boolean calculateEnabled()
When overriding, call to this method as first statement is needed.

Specified by:
calculateEnabled in class org.eclipse.gef.ui.actions.WorkbenchPartAction

processSelection

protected void processSelection()
Refreshes the properties of this action, which depends on selection. Before method execution, selection is current to editor state.


setWorkbenchPart

public void setWorkbenchPart(IWorkbenchPart part)
Overrides:
setWorkbenchPart in class org.eclipse.gef.ui.actions.WorkbenchPartAction

runAsCommand

protected void runAsCommand()
If action run method should run whole in command(and undo/redo is getUndoManager().undo/redo), override this method instead of run.


run

public void run()
Default implementation is run action in command.

Specified by:
run in interface IAction
Overrides:
run in class Action

getShell

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

Returns:
parent shell instance.

getCaretManager

protected CaretManager getCaretManager()
Returns caret provider.

Returns:
caret provider

getPointer

protected DomPointer getPointer()
Returns pointer to place in DOM tree where is caret.

Returns:
pointer in DOM

getSelectionProvider

protected IDOMSelectionProvider getSelectionProvider()
Returns DOM selection provider.

Returns:
IDOMSelectionProvider

getSelection

protected DOMIntervalSet getSelection()
Returns:
Returns the xmlSelection.

getModifyHelper

protected final DocumentModifyHelper getModifyHelper()
Getter.

Returns:
Returns the modify helper instance.

getXMLAccess

protected XMLAccess getXMLAccess()
Returns instance of the document.

Returns:
instance of document, can be null.

getIdManager

protected IDManager getIdManager()
Getter.

Returns:
IDManager instance.

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(ExportException e)
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 e)
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.

dispose

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


Copyright © 2003-2006 null. All Rights Reserved.