Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.port80.eclipse.jdt.graph.views
Class GraphViewer  view GraphViewer download GraphViewer.java

java.lang.Object
  extended byorg.eclipse.ui.part.WorkbenchPart
      extended byorg.eclipse.ui.part.EditorPart
          extended bycom.port80.eclipse.jdt.graph.views.GraphViewer
All Implemented Interfaces:
java.util.EventListener, org.eclipse.core.runtime.IAdaptable, org.eclipse.ui.IEditorPart, org.eclipse.core.runtime.IExecutableExtension, com.port80.swt.widgets.IGraphViewer, org.eclipse.ui.ISaveablePart, org.eclipse.jface.viewers.ISelectionProvider, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.swt.events.KeyListener, org.eclipse.swt.internal.SWTEventListener

public class GraphViewer
extends org.eclipse.ui.part.EditorPart
implements com.port80.swt.widgets.IGraphViewer, org.eclipse.jface.viewers.ISelectionProvider, org.eclipse.swt.events.KeyListener

A graph viewer in eclipse to view graph rendered in a BufferedImage.


Nested Class Summary
(package private) static class GraphViewer.GraphContentProvider
           
(package private)  class GraphViewer.GraphLabelComparator
           
(package private) static class GraphViewer.GraphLabelProvider
           
(package private)  class GraphViewer.StatusLine
           
 
Field Summary
private static int ALPHA_HIGHLIGHT
           
private static int COLOR_HIGHLIGHT
           
private static boolean DEBUG
           
private  boolean fBeginFindSession
           
private  com.port80.swt.widgets.ScrolledCanvas fCanvas
           
private  GraphViewer.GraphContentProvider fContentProvider
           
private  boolean fDirty
           
private  java.lang.String fFilepath
           
private  boolean fForwardFind
           
private  com.port80.graph.IGraph fGraph
           
private  org.eclipse.swt.graphics.Image fImage
           
private  GraphViewer.GraphLabelComparator fLabelComparator
           
private  GraphViewer.GraphLabelProvider fLabelProvider
           
private  org.eclipse.swt.widgets.Menu fPopup
           
private  java.util.List fSelectedRegions
          The list of ImageRegionInfo of the selected regions in the back buffer.
private  java.util.List fSelection
           
private  java.util.List fSelectionListeners
           
private  com.port80.swt.widgets.IStatusLine fStatusLine
           
private static java.lang.String NAME
           
private static int PASSES
           
private static int SEED
           
 
Fields inherited from class org.eclipse.ui.part.EditorPart
 
Fields inherited from class org.eclipse.ui.part.WorkbenchPart
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
GraphViewer()
           
 
Method Summary
 void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
          Adds a listener for selection changes in this selection provider.
(package private)  void beginIncrementalFind(boolean forward)
           
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
          Creates the SWT controls for this workbench part.
private  org.eclipse.swt.widgets.Menu createPopup()
           
private  void deHighlightSelection()
           
 void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
          Saves the contents of this part.
 void doSaveAs()
          Saves the contents of this part to another object.
(package private)  com.port80.swt.widgets.ScrolledCanvas getCanvas()
           
 org.eclipse.jface.viewers.IStructuredContentProvider getContentProvider()
           
 org.eclipse.swt.widgets.Control getControl()
           
(package private)  org.eclipse.swt.graphics.Image getImage()
           
 java.util.Comparator getLabelComparator()
           
 org.eclipse.jface.viewers.ILabelProvider getLabelProvider()
           
 org.eclipse.jface.viewers.ISelection getSelection()
          Returns the current selection for this provider.
 void gotoMarker(org.eclipse.core.resources.IMarker marker)
           
private  void highlightSelection()
           
 void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input)
          Initializes this editor with the given editor site and input.
 boolean isDirty()
          Returns whether the contents of this part have changed since the last save operation.
 boolean isSaveAsAllowed()
          Returns whether the "Save As" operation is supported by this part.
 boolean isSaveOnCloseNeeded()
          Returns whether the contents of this part should be saved when the part is closed.
 void keyPressed(org.eclipse.swt.events.KeyEvent e)
          Sent when a key is pressed on the system keyboard.
 void keyReleased(org.eclipse.swt.events.KeyEvent e)
          Sent when a key is released on the system keyboard.
private  com.port80.graph.IGraph loadGraph(org.eclipse.ui.IEditorInput input)
           
 void refresh()
           
 void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
          Removes the given selection change listener from this selection provider.
 void setFocus()
          Asks this part to take focus within the workbench.
 void setInput(org.eclipse.ui.IEditorInput input)
          Sets the input to this editor.
 void setSelection(org.eclipse.jface.viewers.ISelection selection)
          Sets the current selection for this selection provider.
 void setSelection(org.eclipse.jface.viewers.IStructuredSelection selection, boolean reveal)
           
(package private)  void showPopup(org.eclipse.swt.events.MenuEvent e)
           
 
Methods inherited from class org.eclipse.ui.part.EditorPart
getEditorInput, getEditorSite, getTitleToolTip, setContentDescription, setInitializationData, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, dispose, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getPartName, getSite, getTitle, getTitleImage, removePropertyListener, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, dispose, getSite, getTitle, getTitleImage, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

NAME

private static final java.lang.String NAME
See Also:
Constant Field Values

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

SEED

private static final int SEED
See Also:
Constant Field Values

PASSES

private static final int PASSES
See Also:
Constant Field Values

ALPHA_HIGHLIGHT

private static final int ALPHA_HIGHLIGHT
See Also:
Constant Field Values

COLOR_HIGHLIGHT

private static final int COLOR_HIGHLIGHT
See Also:
Constant Field Values

fGraph

private com.port80.graph.IGraph fGraph

fFilepath

private java.lang.String fFilepath

fImage

private org.eclipse.swt.graphics.Image fImage

fPopup

private org.eclipse.swt.widgets.Menu fPopup

fStatusLine

private com.port80.swt.widgets.IStatusLine fStatusLine

fCanvas

private com.port80.swt.widgets.ScrolledCanvas fCanvas

fContentProvider

private GraphViewer.GraphContentProvider fContentProvider

fLabelProvider

private GraphViewer.GraphLabelProvider fLabelProvider

fLabelComparator

private GraphViewer.GraphLabelComparator fLabelComparator

fSelection

private java.util.List fSelection

fSelectionListeners

private java.util.List fSelectionListeners

fDirty

private boolean fDirty

fBeginFindSession

private boolean fBeginFindSession

fForwardFind

private boolean fForwardFind

fSelectedRegions

private java.util.List fSelectedRegions
The list of ImageRegionInfo of the selected regions in the back buffer. When region is deselected, image is restore into the back buffer.

Constructor Detail

GraphViewer

public GraphViewer()
Method Detail

doSave

public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
Description copied from interface: org.eclipse.ui.ISaveablePart
Saves the contents of this part.

If the save is successful, the part should fire a property changed event reflecting the new dirty state (PROP_DIRTY property).

If the save is cancelled through user action, or for any other reason, the part should invoke setCancelled on the IProgressMonitor to inform the caller.

This method is long-running; progress and cancellation are provided by the given progress monitor.

Specified by:
doSave in interface org.eclipse.ui.ISaveablePart

doSaveAs

public void doSaveAs()
Description copied from interface: org.eclipse.ui.ISaveablePart
Saves the contents of this part to another object.

Implementors are expected to open a "Save As" dialog where the user will be able to select a new name for the contents. After the selection is made, the contents should be saved to that new name. During this operation a IProgressMonitor should be used to indicate progress.

If the save is successful, the part fires a property changed event reflecting the new dirty state (PROP_DIRTY property).

Specified by:
doSaveAs in interface org.eclipse.ui.ISaveablePart

gotoMarker

public void gotoMarker(org.eclipse.core.resources.IMarker marker)

init

public void init(org.eclipse.ui.IEditorSite site,
                 org.eclipse.ui.IEditorInput input)
          throws org.eclipse.ui.PartInitException
Description copied from interface: org.eclipse.ui.IEditorPart
Initializes this editor with the given editor site and input.

This method is automatically called shortly after the part is instantiated. It marks the start of the part's lifecycle. The IWorkbenchPart.dispose 55 method will be called automically at the end of the lifecycle. Clients must not call this method.

Implementors of this method must examine the editor input object type to determine if it is understood. If not, the implementor must throw a PartInitException

Specified by:
init in interface org.eclipse.ui.IEditorPart

setInput

public void setInput(org.eclipse.ui.IEditorInput input)
Description copied from class: org.eclipse.ui.part.EditorPart
Sets the input to this editor.


isDirty

public boolean isDirty()
Description copied from interface: org.eclipse.ui.ISaveablePart
Returns whether the contents of this part have changed since the last save operation. If this value changes the part must fire a property listener event with PROP_DIRTY.

Specified by:
isDirty in interface org.eclipse.ui.ISaveablePart

isSaveAsAllowed

public boolean isSaveAsAllowed()
Description copied from interface: org.eclipse.ui.ISaveablePart
Returns whether the "Save As" operation is supported by this part.

Specified by:
isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart

createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)
Description copied from interface: org.eclipse.ui.IWorkbenchPart
Creates the SWT controls for this workbench part.

Clients should not call this method (the workbench calls this method when it needs to, which may be never).

For implementors this is a multi-step process:

  1. Create one or more controls within the parent.
  2. Set the parent layout as needed.
  3. Register any global actions with the IActionService.
  4. Register any popup menus with the IActionService.
  5. Register a selection provider with the ISelectionService (optional).

Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart

setFocus

public void setFocus()
Description copied from interface: org.eclipse.ui.IWorkbenchPart
Asks this part to take focus within the workbench.

Clients should not call this method (the workbench calls this method at appropriate times). To have the workbench activate a part, use IWorkbenchPage.activate(IWorkbenchPart) instead.

Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart

isSaveOnCloseNeeded

public boolean isSaveOnCloseNeeded()
Description copied from interface: org.eclipse.ui.ISaveablePart
Returns whether the contents of this part should be saved when the part is closed.

Specified by:
isSaveOnCloseNeeded in interface org.eclipse.ui.ISaveablePart

getContentProvider

public org.eclipse.jface.viewers.IStructuredContentProvider getContentProvider()
Specified by:
getContentProvider in interface com.port80.swt.widgets.IGraphViewer

getLabelProvider

public org.eclipse.jface.viewers.ILabelProvider getLabelProvider()
Specified by:
getLabelProvider in interface com.port80.swt.widgets.IGraphViewer

getLabelComparator

public java.util.Comparator getLabelComparator()
Specified by:
getLabelComparator in interface com.port80.swt.widgets.IGraphViewer

getControl

public org.eclipse.swt.widgets.Control getControl()
Specified by:
getControl in interface com.port80.swt.widgets.IGraphViewer

refresh

public void refresh()

getCanvas

com.port80.swt.widgets.ScrolledCanvas getCanvas()

getImage

org.eclipse.swt.graphics.Image getImage()

setSelection

public void setSelection(org.eclipse.jface.viewers.ISelection selection)
Description copied from interface: org.eclipse.jface.viewers.ISelectionProvider
Sets the current selection for this selection provider.

Specified by:
setSelection in interface org.eclipse.jface.viewers.ISelectionProvider

setSelection

public void setSelection(org.eclipse.jface.viewers.IStructuredSelection selection,
                         boolean reveal)
Specified by:
setSelection in interface com.port80.swt.widgets.IGraphViewer

getSelection

public org.eclipse.jface.viewers.ISelection getSelection()
Description copied from interface: org.eclipse.jface.viewers.ISelectionProvider
Returns the current selection for this provider.

Specified by:
getSelection in interface org.eclipse.jface.viewers.ISelectionProvider

addSelectionChangedListener

public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
Description copied from interface: org.eclipse.jface.viewers.ISelectionProvider
Adds a listener for selection changes in this selection provider. Has no effect if an identical listener is already registered.

Specified by:
addSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider

removeSelectionChangedListener

public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
Description copied from interface: org.eclipse.jface.viewers.ISelectionProvider
Removes the given selection change listener from this selection provider. Has no affect if an identical listener is not registered.

Specified by:
removeSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider

deHighlightSelection

private void deHighlightSelection()

highlightSelection

private void highlightSelection()

keyPressed

public void keyPressed(org.eclipse.swt.events.KeyEvent e)
Description copied from interface: org.eclipse.swt.events.KeyListener
Sent when a key is pressed on the system keyboard.

Specified by:
keyPressed in interface org.eclipse.swt.events.KeyListener

keyReleased

public void keyReleased(org.eclipse.swt.events.KeyEvent e)
Description copied from interface: org.eclipse.swt.events.KeyListener
Sent when a key is released on the system keyboard.

Specified by:
keyReleased in interface org.eclipse.swt.events.KeyListener

loadGraph

private com.port80.graph.IGraph loadGraph(org.eclipse.ui.IEditorInput input)

createPopup

private org.eclipse.swt.widgets.Menu createPopup()

showPopup

void showPopup(org.eclipse.swt.events.MenuEvent e)

beginIncrementalFind

void beginIncrementalFind(boolean forward)