org.jmlspecs.eclipse.jdt.ui
Class WarningDeclarationsAction

java.lang.Object
  extended by org.jmlspecs.eclipse.jdt.ui.WarningDeclarationsAction
All Implemented Interfaces:
org.eclipse.ui.IActionDelegate, org.eclipse.ui.IEditorActionDelegate

public class WarningDeclarationsAction
extends java.lang.Object
implements org.eclipse.ui.IEditorActionDelegate

This is the class that implements the action method for the 'Go To associated specification' menu item - through the run method. It needs to identify the marker being selected, then find the associated information in that marker, and finally open an editor on the correct file and location.

Author:
David Cok

Constructor Summary
WarningDeclarationsAction()
           
 
Method Summary
static java.util.List getMarkers(org.eclipse.ui.IWorkbenchWindow window, org.eclipse.jface.viewers.ISelection selection)
          Gets all the markers corresponding to the stated selection
static void openEditor(org.eclipse.ui.IWorkbenchWindow window, java.lang.String data)
          Utility routine that opens up an editor in the given window corresponding to the data string.
 void run(org.eclipse.jface.action.IAction action)
           
static void run(org.eclipse.swt.widgets.Shell shell, org.eclipse.ui.IWorkbenchWindow window, org.eclipse.jface.viewers.ISelection selection)
          TODO
 void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection)
           
 void setActiveEditor(org.eclipse.jface.action.IAction action, org.eclipse.ui.IEditorPart targetEditor)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WarningDeclarationsAction

public WarningDeclarationsAction()
Method Detail

setActiveEditor

public void setActiveEditor(org.eclipse.jface.action.IAction action,
                            org.eclipse.ui.IEditorPart targetEditor)
Specified by:
setActiveEditor in interface org.eclipse.ui.IEditorActionDelegate

run

public void run(org.eclipse.jface.action.IAction action)
Specified by:
run in interface org.eclipse.ui.IActionDelegate

run

public static void run(org.eclipse.swt.widgets.Shell shell,
                       org.eclipse.ui.IWorkbenchWindow window,
                       org.eclipse.jface.viewers.ISelection selection)
TODO

Parameters:
shell -
window -
selection -

getMarkers

public static java.util.List getMarkers(org.eclipse.ui.IWorkbenchWindow window,
                                        org.eclipse.jface.viewers.ISelection selection)
Gets all the markers corresponding to the stated selection

Parameters:
selection -
Returns:
List of IMarker objects in selection

openEditor

public static void openEditor(org.eclipse.ui.IWorkbenchWindow window,
                              java.lang.String data)
                       throws java.lang.Exception
Utility routine that opens up an editor in the given window corresponding to the data string. The expected format of the data is a space separated combination of absolute file-system file name, the 1-based line number, and the 0-based character position within the file.

Parameters:
window - the workbench window in which we are working
data - the file, line number, and character position
Throws:
java.lang.Exception

selectionChanged

public void selectionChanged(org.eclipse.jface.action.IAction action,
                             org.eclipse.jface.viewers.ISelection selection)
Specified by:
selectionChanged in interface org.eclipse.ui.IActionDelegate