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

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
                      extended by sk.uniba.euromath.editor.xmlEditor.actions.MultiNodeEnclosingAction
All Implemented Interfaces:
IAdaptable, org.eclipse.gef.Disposable, org.eclipse.gef.ui.actions.UpdateAction, IAction, IMultiViewAction

public class MultiNodeEnclosingAction
extends XMLAccessModifyAction

Encloses selection by element, if

Author:
TV Created on 29.5.2004

Field Summary
static String id
          Default id of action.
protected  List<Node> nodes
          List of selected nodes.
protected  Element parent
          Parent of nodes to enclose.
 
Fields inherited from class sk.uniba.euromath.editor.xmlEditor.actions.XMLAccessModifyAction
adaptableProvider, selection
 
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
MultiNodeEnclosingAction()
          Constructor.
MultiNodeEnclosingAction(IWorkbenchPart part)
          Constructor.
 
Method Summary
protected  boolean calculateEnabled()
           
protected  void clear()
          Clears the selection.
protected  void findBoundNodes(Collection<Node> nodes, Node parent, Node first, Node last)
          Scans children of parent in order to find first and last node in collection nodes.
protected  Set getParents(List<? extends Node> nodesList)
           
protected  boolean isSiblingNodeCollection(Collection<Node> pNodes)
          Tests if pNodes are sibling nodes.
protected  void processSelection()
          Makes xmlSelection valid to current selection.
protected  void processSingleSelection(String id)
          If selection consists of only one id, this sets idList, offset, length.
 void run()
           
 
Methods inherited from class sk.uniba.euromath.editor.xmlEditor.actions.XMLAccessModifyAction
getAdaptableProvider, getAdapter, getIdManager, getModifyHelper, getSelection, getSelectionProvider, getShell, getXMLAccess, handleDocumentException, handleDOMException, handleExportException, logError, logError, refresh, setAdaptableProvider, setWorkbenchPart, setXMLAccess, 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, 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, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 

Field Detail

id

public static final String id
Default id of action.


parent

protected Element parent
Parent of nodes to enclose.


nodes

protected final List<Node> nodes
List of selected nodes.

Constructor Detail

MultiNodeEnclosingAction

public MultiNodeEnclosingAction()
Constructor.


MultiNodeEnclosingAction

public MultiNodeEnclosingAction(IWorkbenchPart part)
Constructor.

Parameters:
part - workbench part to associate
Method Detail

calculateEnabled

protected boolean calculateEnabled()
Overrides:
calculateEnabled in class XMLAccessModifyAction

clear

protected void clear()
Description copied from class: XMLAccessModifyAction
Clears the selection.

Overrides:
clear in class XMLAccessModifyAction

processSingleSelection

protected void processSingleSelection(String id)
If selection consists of only one id, this sets idList, offset, length.

Parameters:
id - of selected node

processSelection

protected void processSelection()
Description copied from class: XMLAccessModifyAction
Makes xmlSelection valid to current selection.

Overrides:
processSelection in class XMLAccessModifyAction

isSiblingNodeCollection

protected boolean isSiblingNodeCollection(Collection<Node> pNodes)
Tests if pNodes are sibling nodes.

Parameters:
pNodes - nodes collection to test
Returns:
true if pNodes are sibling nodes.

findBoundNodes

protected void findBoundNodes(Collection<Node> nodes,
                              Node parent,
                              Node first,
                              Node last)
Scans children of parent in order to find first and last node in collection nodes. Result is stored in fisrt and lst nodes.

Parameters:
nodes - collection of sibling nodes
parent - of nodes
first - reference for result
last - reference for result

getParents

protected Set getParents(List<? extends Node> nodesList)
Parameters:
nodesList -
Returns:
List of all parent nodes.

run

public void run()
Specified by:
run in interface IAction
Overrides:
run in class Action


Copyright © 2003-2006 null. All Rights Reserved.