roneditor.ruleview
Class RulePage

java.lang.Object
  extended by org.eclipse.ui.part.Page
      extended by roneditor.AbstractMultiViewerPage
          extended by roneditor.ruleview.RulePage
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.emf.common.notify.Adapter, org.eclipse.gef.commands.CommandStackListener, org.eclipse.jface.viewers.ISelectionChangedListener, org.eclipse.ui.part.IPage, org.eclipse.ui.part.IPageBookViewPage

public class RulePage
extends AbstractMultiViewerPage

This is an implementation of AbstractPageBookView to display Rules.

It uses ObjectNetViewEditPartFactory and RulePageContextMenuProvider, configures the keyhandler and creates actions to move ONNodes by pressing keys.

On model change nothing is done.

Author:
Tony Modica

Nested Class Summary
 
Nested classes/interfaces inherited from class roneditor.AbstractMultiViewerPage
AbstractMultiViewerPage.MultiViewerPageViewer
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
org.eclipse.emf.common.notify.Adapter.Internal
 
Constructor Summary
RulePage(ronmodel.Rule rule, org.eclipse.ui.IEditorPart editor)
           
 
Method Summary
protected  void createActions()
          To be implemented by subclasses.
protected  ContextMenuProviderWithActionRegistry createContextMenuProvider(org.eclipse.gef.EditPartViewer viewer)
          Subclasses must implement to specify the ContextMenuProviderWithActionRegistry that should be used by this page's GraphicalViewers and is responsible to show the created actions in the context menu.
protected  org.eclipse.gef.EditPartFactory createEditPartFactory()
          Subclasses must implement to specify the EditPartFactory that should be used by this page's GraphicalViewers.
protected  org.eclipse.gef.palette.PaletteRoot createPaletteRoot()
          Subclasses must implement to specify the PaletteRoot that should be used by this page's EditDomain and which defines the contents of the palette.
 int getNumberOfViewers()
          A RulePage shows three nets: NAC, LHS and RHS of the Rule.
 ronmodel.Rule getRule()
           
protected  int[] getThumbSashWeights()
          The two values in the returned array specify how the flyout composite's space is being divided between the palette entries and the thumbnail in the palette.
 org.eclipse.emf.ecore.EObject[] getViewerContents()
          A RulePage shows the first NAC of the Rule and the LHS and RHS.
 void notifyChanged(org.eclipse.emf.common.notify.Notification notification)
           
protected  void setupKeyHandler(org.eclipse.gef.KeyHandler kh)
          Subclasses must implement to associate KeyStrokes with Actions in the passed KeyHandler} which is the one used for the GraphicalViewers.
 
Methods inherited from class roneditor.AbstractMultiViewerPage
commandStackChanged, createControl, dispose, getActionRegistry, getAdapter, getControl, getEditor, getKeyHandler, getModel, getStatusLineManager, getTarget, getToolBarManager, getViewers, getViewersContents, init, isAdapterForType, registerHandleForEditorAction, selectionChanged, setCurrentViewer, setFocus, setTarget, setViewersContents, switchViewerVisibility, updateActions
 
Methods inherited from class org.eclipse.ui.part.Page
getSite, makeContributions, setActionBars
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RulePage

public RulePage(ronmodel.Rule rule,
                org.eclipse.ui.IEditorPart editor)
Method Detail

createActions

protected void createActions()
Description copied from class: AbstractMultiViewerPage
To be implemented by subclasses. Actions have to be registered via AbstractMultiViewerPage.getActionRegistry().
WorkbenchPartActions should get the editor (AbstractMultiViewerPage.getEditor()) as workbench part in their constructor.
To register actions as handles for RetargetActions you may use AbstractMultiViewerPage.registerHandleForEditorAction(String) with a string that matches both the RetargetAction's and the handle's ID.

In AbstractMultiViewerPage.setCurrentViewer(roneditor.AbstractMultiViewerPage.MultiViewerPageViewer) the AbstractMultiViewerPage.currentViewer will be set with SelectionAction.setSelectionProvider(ISelectionProvider) for SelectionActions.

Specified by:
createActions in class AbstractMultiViewerPage
See Also:
to find out which actions will be created by default.

setupKeyHandler

protected void setupKeyHandler(org.eclipse.gef.KeyHandler kh)
Description copied from class: AbstractMultiViewerPage
Subclasses must implement to associate KeyStrokes with Actions in the passed KeyHandler} which is the one used for the GraphicalViewers.

Specified by:
setupKeyHandler in class AbstractMultiViewerPage
See Also:
AbstractMultiViewerPage.createGraphicalViewerComposite()

createEditPartFactory

protected org.eclipse.gef.EditPartFactory createEditPartFactory()
Description copied from class: AbstractMultiViewerPage
Subclasses must implement to specify the EditPartFactory that should be used by this page's GraphicalViewers.

Specified by:
createEditPartFactory in class AbstractMultiViewerPage
Returns:
The EditPartFactory for the GraphicalViewers of this page.
See Also:
AbstractMultiViewerPage.createGraphicalViewerComposite()

createContextMenuProvider

protected ContextMenuProviderWithActionRegistry createContextMenuProvider(org.eclipse.gef.EditPartViewer viewer)
Description copied from class: AbstractMultiViewerPage
Subclasses must implement to specify the ContextMenuProviderWithActionRegistry that should be used by this page's GraphicalViewers and is responsible to show the created actions in the context menu.

Specified by:
createContextMenuProvider in class AbstractMultiViewerPage
Parameters:
viewer - The graphical viewer for context menu provider
Returns:
The ContextMenuProviderWithActionRegistry for the specified GraphicalViewer.
See Also:
AbstractMultiViewerPage.createGraphicalViewerComposite()

createPaletteRoot

protected org.eclipse.gef.palette.PaletteRoot createPaletteRoot()
Description copied from class: AbstractMultiViewerPage
Subclasses must implement to specify the PaletteRoot that should be used by this page's EditDomain and which defines the contents of the palette.

Specified by:
createPaletteRoot in class AbstractMultiViewerPage
Returns:
The PaletteRoot for the EditDomain of this page.

getThumbSashWeights

protected int[] getThumbSashWeights()
Description copied from class: AbstractMultiViewerPage
The two values in the returned array specify how the flyout composite's space is being divided between the palette entries and the thumbnail in the palette. When implementing this template should be used:
return new int[] { Palette_Weight, Thumb_Weight };

Specified by:
getThumbSashWeights in class AbstractMultiViewerPage
Returns:
An array of 2 integers describing the ratio of the palette to the thumbnail.

notifyChanged

public void notifyChanged(org.eclipse.emf.common.notify.Notification notification)

getNumberOfViewers

public int getNumberOfViewers()
A RulePage shows three nets: NAC, LHS and RHS of the Rule.

Specified by:
getNumberOfViewers in class AbstractMultiViewerPage
Returns:
The number of viewers that shall be created on this page.
See Also:
AbstractMultiViewerPage.getViewerContents(), AbstractMultiViewerPage.createGraphicalViewerComposite()

getViewerContents

public org.eclipse.emf.ecore.EObject[] getViewerContents()
A RulePage shows the first NAC of the Rule and the LHS and RHS.

Specified by:
getViewerContents in class AbstractMultiViewerPage
Returns:
The objects that will be set as contents in each of AbstractMultiViewerPage.viewers.
See Also:
AbstractMultiViewerPage.setViewersContents(int, EObject), AbstractMultiViewerPage.createGraphicalViewerComposite()

getRule

public ronmodel.Rule getRule()
Returns:
The model of the page casted to a Rule.