PTP
Release 7.0

org.eclipse.ptp.pldt.common.actions
Class RunAnalyseHandler

java.lang.Object
  extended by AbstractHandler
      extended by org.eclipse.ptp.pldt.common.actions.RunAnalyseHandler
Direct Known Subclasses:
RunAnalyseHandlerBase

public abstract class RunAnalyseHandler
extends AbstractHandler

RunAnalyseHandler - keeps state information for the analysis handlers in the dropdown analysis menu. Common behavior is in (derived class) RunAnalyseHandlerBase. That is, the AnalysisDropdownHandler will repeat the action of the last RunAnalyseHandler that was executed - they are cached as one of these.


Field Summary
protected  IStructuredSelection selection
          the current selection is cached here
 
Constructor Summary
RunAnalyseHandler()
          Constructor
 
Method Summary
protected  int countFiles(IResource res)
          Count the number of files in this resource (file or container).
protected  int countFiles(IResource res, String[] exts)
          count files ending in one of the given file extensions
protected  int countFilesSelected()
          Counts the number of files in the selection (leaf nodes only - Files - not the directories/containers)
Note that this makes no distinction about what type of files.
protected  int countFilesSelected(String[] exts)
           
 IStructuredSelection getSelection(ExecutionEvent event)
          Get the current selection from the handler event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

selection

protected IStructuredSelection selection
the current selection is cached here

Constructor Detail

RunAnalyseHandler

public RunAnalyseHandler()
Constructor

Method Detail

getSelection

public IStructuredSelection getSelection(ExecutionEvent event)
Get the current selection from the handler event. If it's a structured selection (e.g. resource in the project explorer) then return it. If it's e.g. a text selection in the editor, we don't care about that Note that we cache the last structured selection (like the previous "action" version of this class) since we don't get selection changed events. However, AnalysisDropDownHandler does get these events, and its value will be used if HanderUtil doesn't have any information yet.

Parameters:
event -
Returns:
the current selection if it's a structured selection e.g. in the navigator

countFilesSelected

protected int countFilesSelected()
Counts the number of files in the selection (leaf nodes only - Files - not the directories/containers)
Note that this makes no distinction about what type of files.

Returns:
number of files

countFiles

protected int countFiles(IResource res)
Count the number of files in this resource (file or container).

Parameters:
res -
Returns:

countFilesSelected

protected int countFilesSelected(String[] exts)

countFiles

protected int countFiles(IResource res,
                         String[] exts)
count files ending in one of the given file extensions

Parameters:
res -
exts - array of extensions e.g. ".h", ".hpp" etc
Returns:

PTP
Release 7.0

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