PTP
Release 7.0

org.eclipse.ptp.pldt.common.views
Class SimpleTableMarkerView

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.ui.part.WorkbenchPart
          extended by org.eclipse.ui.part.ViewPart
              extended by org.eclipse.ptp.pldt.common.views.SimpleTableMarkerView
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IPersistable, org.eclipse.ui.IViewPart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.IWorkbenchPart3, org.eclipse.ui.part.IWorkbenchPartOrientation

public class SimpleTableMarkerView
extends org.eclipse.ui.part.ViewPart

This view shows generic artifacts, represented by a marker, that are found in a (source) file.
It provides information and actions. The object model is the marker. It provides standard columns of name, filename, lineNo, and one more.
Names and last column name provided on ctor. Intended for quick reuse. All information comes from the marker. Artifact objects containing arbitrary information can be used (not extensively tested here yet).195


Nested Class Summary
 class SimpleTableMarkerView.StackList
          a Stack that isn't based on Vector - Generic LIFO stack
 class SimpleTableMarkerView.UpdateVisitor
          Visit the resource delta to look for the marker changes we are interested in
 
Field Summary
protected  SimpleTableMarkerView.StackList changedArts_
          List of artifacts that were changed due to some action upon them in the view (currently unused)
protected  SimpleTableMarkerView.StackList changedMarkers_
          List of markers that were involved in a change on the the associated artifact due to some action upon them here in the view (currently unused)
protected  java.lang.String columnID_
          The ID used in the marker for the extra column of information (last column)
protected  org.eclipse.ptp.pldt.common.views.SimpleTableMarkerView.GenericSorter constructSorter
           
protected static java.lang.String DESCRIPTION
          Marker id for storage of additional information about the artifact
protected static java.lang.String FILENAME
          Marker ID for storage of the filename in which the artifact is found
protected  org.eclipse.ptp.pldt.common.views.SimpleTableMarkerView.FilenameSorter filenameSorter
           
protected  org.eclipse.jface.action.Action infoAction
           
protected static java.lang.String LINE
          Marker id for storage of line number on which the artifact is found.
protected  org.eclipse.ptp.pldt.common.views.SimpleTableMarkerView.GenericSorter lineNoSorter
           
protected static java.lang.String NAME
          Marker ID for artifact name - e.g.
protected  org.eclipse.ptp.pldt.common.views.SimpleTableMarkerView.GenericSorter nameArtifactSorter
           
protected  org.eclipse.jface.viewers.ViewerSorter nameSorter
           
protected  org.eclipse.ptp.pldt.common.views.SimpleTableMarkerView.GenericSorter orderSorter
           
protected  org.eclipse.jface.action.Action removeMarkerAction
           
protected  java.lang.String thingname_
          Be consistent about what we call these things; generic values (can be) replaced on ctor.
protected  java.lang.String thingnames_
           
protected  java.lang.String uniqueID_
          The ID used in the marker for the unique ID for each artifact.
protected  org.eclipse.jface.viewers.TableViewer viewer
           
protected  SimpleTableMarkerView.UpdateVisitor visitor_
           
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
SimpleTableMarkerView(org.eclipse.ui.plugin.AbstractUIPlugin thePlugin, java.lang.String thingname, java.lang.String thingnames, java.lang.String[] attrNames, java.lang.String[] colNames, java.lang.String[] markerIDs)
          Simple table view with an arbitrary number of extra columns
SimpleTableMarkerView(org.eclipse.ui.plugin.AbstractUIPlugin thePlugin, java.lang.String thingname, java.lang.String thingnames, java.lang.String columnName, java.lang.String markerID)
          Constructor with a single marker ID that is converted to a single element list
SimpleTableMarkerView(org.eclipse.ui.plugin.AbstractUIPlugin thePlugin, java.lang.String thingname, java.lang.String thingnames, java.lang.String columnName, java.lang.String[] markerIDs)
          Simple Artifact Table View constructor Everything can be null, and defaults will be taken, or read from plugin.xml for the view.
 
Method Summary
protected  void checkUndoStatus()
          Set status of undo action (enabled or disabled) based on if there are any artifact changes, or other changes, available to undo
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
          This is a callback that will allow us to create the viewer and initialize it.
 void dispose()
           
protected  void findViewInfo()
          Find info from the view info in the manifest.
protected  java.lang.String getAttribute(org.eclipse.core.resources.IMarker marker, java.lang.String attr)
          convenience method for getting attribute String value.
protected  java.lang.String getConstructStr(org.eclipse.core.resources.IMarker marker)
          Get string representing the type of construct
protected  int getIntAttr(org.eclipse.core.resources.IMarker marker, java.lang.String attr)
          Get an int value that is assumed to be stored in a marker in a given attribute.
protected  int getMarkerLineNo(org.eclipse.core.resources.IMarker marker)
          Get marker line numbers.
protected  IArtifact getSimpleArtifact(org.eclipse.core.resources.IMarker marker)
          get artifact from marker
 org.eclipse.jface.resource.ImageDescriptor makeImageDescriptor(java.lang.String iconName)
          Create an ImageDescriptor for an image
protected  void makeRemoveMarkerAction()
          Make "remove marker" action to display artifact information
protected  void makeShowInfoAction()
          Make "show info" action to display artifact information
protected  void pushChangedInfo(IArtifact artifact, org.eclipse.core.resources.IMarker marker)
          Push change info (artifact and marker) onto a stack so we can remember it, for possible undo action.
 void setFocus()
          Passing the focus request to the viewer's control.
 void showMarker(org.eclipse.core.resources.IMarker marker)
          Used for debugging to expose marker information conveniently
 boolean validForAnalysis(java.lang.String filename)
          It might be useful for subclasses to override this, to say which filenames should allow the action "run analysis" to create new artifacts and thus new markers.
 
Methods inherited from class org.eclipse.ui.part.ViewPart
checkSite, getViewSite, init, init, saveState, setContentDescription, setInitializationData, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, getTitleToolTip, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
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.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

viewer

protected org.eclipse.jface.viewers.TableViewer viewer

infoAction

protected org.eclipse.jface.action.Action infoAction

removeMarkerAction

protected org.eclipse.jface.action.Action removeMarkerAction

nameSorter

protected org.eclipse.jface.viewers.ViewerSorter nameSorter

lineNoSorter

protected org.eclipse.ptp.pldt.common.views.SimpleTableMarkerView.GenericSorter lineNoSorter

filenameSorter

protected org.eclipse.ptp.pldt.common.views.SimpleTableMarkerView.FilenameSorter filenameSorter

orderSorter

protected org.eclipse.ptp.pldt.common.views.SimpleTableMarkerView.GenericSorter orderSorter

nameArtifactSorter

protected org.eclipse.ptp.pldt.common.views.SimpleTableMarkerView.GenericSorter nameArtifactSorter

constructSorter

protected org.eclipse.ptp.pldt.common.views.SimpleTableMarkerView.GenericSorter constructSorter

changedArts_

protected SimpleTableMarkerView.StackList changedArts_
List of artifacts that were changed due to some action upon them in the view (currently unused)


changedMarkers_

protected SimpleTableMarkerView.StackList changedMarkers_
List of markers that were involved in a change on the the associated artifact due to some action upon them here in the view (currently unused)


visitor_

protected SimpleTableMarkerView.UpdateVisitor visitor_

thingname_

protected java.lang.String thingname_
Be consistent about what we call these things; generic values (can be) replaced on ctor.
These are read from plugin.xml if not passed on ctor


thingnames_

protected java.lang.String thingnames_

uniqueID_

protected java.lang.String uniqueID_
The ID used in the marker for the unique ID for each artifact. Enables mapping back to the Artifact object if necessary.


columnID_

protected java.lang.String columnID_
The ID used in the marker for the extra column of information (last column)


NAME

protected static final java.lang.String NAME
Marker ID for artifact name - e.g. API name, pragma name, etc.

See Also:
Constant Field Values

FILENAME

protected static final java.lang.String FILENAME
Marker ID for storage of the filename in which the artifact is found

See Also:
Constant Field Values

LINE

protected static final java.lang.String LINE
Marker id for storage of line number on which the artifact is found. Reuse of default ID used by IMarker, repeated here for ease of use and for clarity that THIS is the marker ID for line number.

See Also:
Constant Field Values

DESCRIPTION

protected static final java.lang.String DESCRIPTION
Marker id for storage of additional information about the artifact

See Also:
Constant Field Values
Constructor Detail

SimpleTableMarkerView

public SimpleTableMarkerView(org.eclipse.ui.plugin.AbstractUIPlugin thePlugin,
                             java.lang.String thingname,
                             java.lang.String thingnames,
                             java.lang.String columnName,
                             java.lang.String[] markerIDs)
Simple Artifact Table View constructor

Everything can be null, and defaults will be taken, or read from plugin.xml for the view.

Note: if a null plugIn instance is provided, the default plugin (this one) will not be able to find resources (e.g. icon images) if the derived class is in its own plug-in, and its icons are, too.


SimpleTableMarkerView

public SimpleTableMarkerView(org.eclipse.ui.plugin.AbstractUIPlugin thePlugin,
                             java.lang.String thingname,
                             java.lang.String thingnames,
                             java.lang.String columnName,
                             java.lang.String markerID)
Constructor with a single marker ID that is converted to a single element list

Parameters:
thePlugin -
thingname -
thingnames -
columnName -
markerID -

SimpleTableMarkerView

public SimpleTableMarkerView(org.eclipse.ui.plugin.AbstractUIPlugin thePlugin,
                             java.lang.String thingname,
                             java.lang.String thingnames,
                             java.lang.String[] attrNames,
                             java.lang.String[] colNames,
                             java.lang.String[] markerIDs)
Simple table view with an arbitrary number of extra columns

Parameters:
thePlugin -
thingname -
thingnames -
attrNames - list of marker attributes, for which the column values will be extractd
colNames - list of Column names, used as headers for the values found in the marker attributes
markerID_ -
Method Detail

findViewInfo

protected void findViewInfo()
Find info from the view info in the manifest. This includes the icon name, the view id (used as marker id if none given on ctor), and constructs an artifact manager for this view's artifact objects


validForAnalysis

public boolean validForAnalysis(java.lang.String filename)
It might be useful for subclasses to override this, to say which filenames should allow the action "run analysis" to create new artifacts and thus new markers.
This is a default implementation

Parameters:
filename -
Returns:

getSimpleArtifact

protected IArtifact getSimpleArtifact(org.eclipse.core.resources.IMarker marker)
get artifact from marker

Parameters:
marker -
Returns:

getConstructStr

protected java.lang.String getConstructStr(org.eclipse.core.resources.IMarker marker)
                                    throws org.eclipse.core.runtime.CoreException
Get string representing the type of construct

Parameters:
marker -
Returns:
Throws:
org.eclipse.core.runtime.CoreException

createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)
This is a callback that will allow us to create the viewer and initialize it.

Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart
Specified by:
createPartControl in class org.eclipse.ui.part.WorkbenchPart

makeShowInfoAction

protected void makeShowInfoAction()
Make "show info" action to display artifact information


makeRemoveMarkerAction

protected void makeRemoveMarkerAction()
Make "remove marker" action to display artifact information


setFocus

public void setFocus()
Passing the focus request to the viewer's control.

Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart
Specified by:
setFocus in class org.eclipse.ui.part.WorkbenchPart

dispose

public void dispose()
Specified by:
dispose in interface org.eclipse.ui.IWorkbenchPart
Overrides:
dispose in class org.eclipse.ui.part.WorkbenchPart

showMarker

public void showMarker(org.eclipse.core.resources.IMarker marker)
Used for debugging to expose marker information conveniently

Parameters:
marker -

makeImageDescriptor

public org.eclipse.jface.resource.ImageDescriptor makeImageDescriptor(java.lang.String iconName)
Create an ImageDescriptor for an image

Parameters:
iconName -
Returns:

pushChangedInfo

protected void pushChangedInfo(IArtifact artifact,
                               org.eclipse.core.resources.IMarker marker)
Push change info (artifact and marker) onto a stack so we can remember it, for possible undo action. Also enables/disables the Undo action button.

Parameters:
artifact -
marker -

checkUndoStatus

protected void checkUndoStatus()
Set status of undo action (enabled or disabled) based on if there are any artifact changes, or other changes, available to undo


getMarkerLineNo

protected int getMarkerLineNo(org.eclipse.core.resources.IMarker marker)
Get marker line numbers.

Parameters:
marker -
Returns:

getIntAttr

protected int getIntAttr(org.eclipse.core.resources.IMarker marker,
                         java.lang.String attr)
Get an int value that is assumed to be stored in a marker in a given attribute.

Parameters:
marker -
attr - the attribute name
Returns:
the int value, or 0 if none found, or invalid value found

getAttribute

protected java.lang.String getAttribute(org.eclipse.core.resources.IMarker marker,
                                        java.lang.String attr)
convenience method for getting attribute String value.

Parameters:
marker -
attr -
Returns:

PTP
Release 7.0

Copyright (c) 2011 IBM Corporation and others. All Rights Reserved.