PTP
Release 7.0

org.eclipse.ptp.pldt.common
Class ArtifactMarkingVisitor

java.lang.Object
  extended by org.eclipse.ptp.pldt.common.ArtifactMarkingVisitor

public class ArtifactMarkingVisitor
extends java.lang.Object

Processes an IResource or an IResourceDelta to set Artifact Markers on the files and populate the data model used for the Artifact view(s).


Field Summary
protected  ArtifactManager artifactManager_
           
protected  java.lang.String markerID_
           
 
Constructor Summary
ArtifactMarkingVisitor(java.lang.String markerID)
          Constructor that uses the default behavior that WILL remove old markers on the resource before creating new ones.
ArtifactMarkingVisitor(java.lang.String markerId, boolean removeMarkers)
          Construction that allows specification of whether or not to removed old markers on this resource before creating new ones
 
Method Summary
protected  void createArtifactMarker(IResource resource, Artifact artifact, java.lang.String fn)
          create the marker for the artifact, and add it to the repository (ArtifactManager)
protected  java.util.Map<java.lang.String,java.lang.Object> createCommonMarkerAttrs(IResource resource, Artifact artifact, java.lang.String fn)
          Create marker attributes with common information shared by everyone
protected  void createMarkers(IResource resource, java.lang.String fn, Artifact[] artifacts)
          Create markers for a file.
static Artifact[] getPIs(IResource r)
          Get Artifacts for a given resource. e.g. could reads XML file that is presumed to be in same folder as resource file.
static void showArtifact(Artifact artifact)
          Show an artifact object - print for debugging/tracing purposes
 boolean visit(IResource resource)
           
 boolean visit(IResourceDelta delta)
          Implemented for IResourceDeltaVisitor Required implementation of the visit method.
 boolean visitFile(IResource resource)
          Generic visiting of a file, to presumably add markers.
 boolean visitFile(IResource resource, Artifact[] artifacts)
          Generic version to put markers on a file, given the file(resource) and the list of artifacts
 boolean visitFile(IResource resource, java.util.List<Artifact> artifacts)
          Put markers on a file where list of artifacts is a List instead of an array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

markerID_

protected java.lang.String markerID_

artifactManager_

protected ArtifactManager artifactManager_
Constructor Detail

ArtifactMarkingVisitor

public ArtifactMarkingVisitor(java.lang.String markerId,
                              boolean removeMarkers)
Construction that allows specification of whether or not to removed old markers on this resource before creating new ones

Parameters:
markerId -
removeMarkers -

ArtifactMarkingVisitor

public ArtifactMarkingVisitor(java.lang.String markerID)
Constructor that uses the default behavior that WILL remove old markers on the resource before creating new ones. (This is the former behavior, now the default behavior)

Parameters:
markerID -
Method Detail

visitFile

public boolean visitFile(IResource resource)
Generic visiting of a file, to presumably add markers. This version is called from a build.

Parameters:
resource -
Returns:

visitFile

public boolean visitFile(IResource resource,
                         Artifact[] artifacts)
Generic version to put markers on a file, given the file(resource) and the list of artifacts

Parameters:
resource -
artifacts - list of artifact objects
Returns:

visitFile

public boolean visitFile(IResource resource,
                         java.util.List<Artifact> artifacts)
Put markers on a file where list of artifacts is a List instead of an array

Parameters:
resource - the resource, presumably a file, in which the artifacts (e.g. MPI calls) were found
artifacts - found in the file, with type and location (line number etc.)
Returns:

createMarkers

protected void createMarkers(IResource resource,
                             java.lang.String fn,
                             Artifact[] artifacts)
                      throws CoreException
Create markers for a file. This method creates a marker for each artifact. It also populates/refreshes the views.

Parameters:
resource - assumed to be a file, resource upon which to place the marker(s)
fn - - filename
artifacts - - array of Artifact objects for which to create markers.
Throws:
CoreException

createArtifactMarker

protected void createArtifactMarker(IResource resource,
                                    Artifact artifact,
                                    java.lang.String fn)
                             throws CoreException
create the marker for the artifact, and add it to the repository (ArtifactManager)

Parameters:
resource -
artifact -
fn -
Throws:
CoreException

createCommonMarkerAttrs

protected java.util.Map<java.lang.String,java.lang.Object> createCommonMarkerAttrs(IResource resource,
                                                                                   Artifact artifact,
                                                                                   java.lang.String fn)
Create marker attributes with common information shared by everyone

Parameters:
resource - File on which analysis was run
artifact - the artifact object
fn - project relative path of the resource
Returns:
Note we are not creating the marker here; we do it all at once after attributes are calculated, so that a single resourceChange event gets triggered

getPIs

public static Artifact[] getPIs(IResource r)
Get Artifacts for a given resource. e.g. could reads XML file that is presumed to be in same folder as resource file.

Parameters:
r - The resource (file assumed) for which to look for artifacts
Returns:
a list of artifacts

visit

public boolean visit(IResourceDelta delta)
              throws CoreException
Implemented for IResourceDeltaVisitor Required implementation of the visit method. The IResourceDelta is processed by providing it a visitor using the accept() method and using this method in the visitor to process any events of interest. Processing continues as long as this method returns true or when the end of the IResourceDelta has been reached.

Throws:
CoreException

visit

public boolean visit(IResource resource)

showArtifact

public static void showArtifact(Artifact artifact)
Show an artifact object - print for debugging/tracing purposes

Parameters:
artifact - the Artifact Object

PTP
Release 7.0

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