APStudio
Class ResourceMgtUtils

java.lang.Object
  |
  +--APStudio.ResourceMgtUtils

public class ResourceMgtUtils
extends java.lang.Object

Author:
rajags An utility class that helps in creating a Eclipse resources like files & folders, modifying the file contents ,removing,replacig files

Field Summary
static edu.neu.ccs.demeter.dj.ClassGraph cg
           
static java.util.Vector connectorList
           
static java.lang.String NEWLINE
           
static java.util.List nodeList
           
static java.lang.String strategy
           
static java.lang.String TERMINATOR
           
 
Constructor Summary
ResourceMgtUtils()
           
 
Method Summary
static void appendContents(java.lang.String sourcefile, java.lang.String target, java.lang.String connectorName)
          This is a method that takes a source file, a target string and connector Name, creates a nonstatic private (target) variable in the source file.
static void createClassGraph()
           
static org.eclipse.core.resources.IFile createFileInFolder(org.eclipse.core.resources.IFolder folder, java.lang.String fileName)
          Creates a specified file in the given folder
static void createFolderInProject(org.eclipse.core.resources.IProject project, java.lang.String folderName)
          creates a folder with folderName in the given project
static edu.neu.ccs.demeter.dj.ClassGraph getClassGraph()
           
static org.eclipse.core.resources.IFile getFile(org.eclipse.core.resources.IProject proj, java.lang.String fileName)
           
static org.eclipse.core.resources.IFile getFile(java.lang.String fileName)
           
static java.lang.String getFileContents(java.lang.String fileName)
           
static org.eclipse.core.resources.IFolder getFolder()
           
static java.io.InputStream getInitialContents(java.lang.String fileName)
           
static java.lang.String HighlightTraversal()
           
static void removeFieldFromFile(java.lang.String fileName, java.lang.String fieldName)
          need to work on this.
static void removeFile(java.lang.String fileName)
          Given a fileName remove the file from the Resource
static void removeTemporaryFolder(org.eclipse.core.resources.IProject proj)
           
static void renameFile(java.lang.String oldName, java.lang.String newName)
          When a name of the node is changed we need to change the respective java files name .
static java.lang.String replaceContentString(java.lang.String oldName, java.lang.String newName, java.lang.String Contents)
          uses regex to match strings
static void setClassGraph(edu.neu.ccs.demeter.dj.ClassGraph c)
           
static void setFileContents(org.eclipse.core.resources.IFile file, java.lang.String Contents)
           
static void TempHighlightMethod(java.util.Vector nameList)
          Given a list of names that was traversed by the strategy this method goes through all the collected nodes and edges and highlights them if they are contained in the list
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

strategy

public static java.lang.String strategy

cg

public static edu.neu.ccs.demeter.dj.ClassGraph cg

nodeList

public static java.util.List nodeList

connectorList

public static java.util.Vector connectorList

TERMINATOR

public static java.lang.String TERMINATOR

NEWLINE

public static java.lang.String NEWLINE
Constructor Detail

ResourceMgtUtils

public ResourceMgtUtils()
Method Detail

removeTemporaryFolder

public static void removeTemporaryFolder(org.eclipse.core.resources.IProject proj)

createFolderInProject

public static void createFolderInProject(org.eclipse.core.resources.IProject project,
                                         java.lang.String folderName)
creates a folder with folderName in the given project

Parameters:
project -
folderName -

getClassGraph

public static edu.neu.ccs.demeter.dj.ClassGraph getClassGraph()

setClassGraph

public static void setClassGraph(edu.neu.ccs.demeter.dj.ClassGraph c)

createClassGraph

public static void createClassGraph()

getFolder

public static org.eclipse.core.resources.IFolder getFolder()
Returns:
A handle to the Folder created to hold java files.

HighlightTraversal

public static java.lang.String HighlightTraversal()

TempHighlightMethod

public static void TempHighlightMethod(java.util.Vector nameList)
Given a list of names that was traversed by the strategy this method goes through all the collected nodes and edges and highlights them if they are contained in the list

Parameters:
nameList - A vector of names of the nodes and edges that were traversed

removeFieldFromFile

public static void removeFieldFromFile(java.lang.String fileName,
                                       java.lang.String fieldName)
need to work on this.

Parameters:
fileName -
fieldName -

replaceContentString

public static java.lang.String replaceContentString(java.lang.String oldName,
                                                    java.lang.String newName,
                                                    java.lang.String Contents)
uses regex to match strings

Parameters:
oldName -
newName -
Contents -
Returns:
new contents with the string replaced. returns null if no match found

renameFile

public static void renameFile(java.lang.String oldName,
                              java.lang.String newName)
When a name of the node is changed we need to change the respective java files name .

Parameters:
oldName -
newName -

removeFile

public static void removeFile(java.lang.String fileName)
Given a fileName remove the file from the Resource

Parameters:
fileName -

appendContents

public static void appendContents(java.lang.String sourcefile,
                                  java.lang.String target,
                                  java.lang.String connectorName)
This is a method that takes a source file, a target string and connector Name, creates a nonstatic private (target) variable in the source file.

Parameters:
sourcefile -
target -
connectorName -

createFileInFolder

public static org.eclipse.core.resources.IFile createFileInFolder(org.eclipse.core.resources.IFolder folder,
                                                                  java.lang.String fileName)
Creates a specified file in the given folder

Parameters:
folder -
fileName -
Returns:
A handle to the createdFile

getFile

public static org.eclipse.core.resources.IFile getFile(org.eclipse.core.resources.IProject proj,
                                                       java.lang.String fileName)
Parameters:
proj -
fileName -
Returns:

getFile

public static org.eclipse.core.resources.IFile getFile(java.lang.String fileName)
Parameters:
fileName -
Returns:
A handle to the specified file if it exists

setFileContents

public static void setFileContents(org.eclipse.core.resources.IFile file,
                                   java.lang.String Contents)

getFileContents

public static java.lang.String getFileContents(java.lang.String fileName)
Parameters:
fileName -
Returns:
The contents of the file as String

getInitialContents

public static java.io.InputStream getInitialContents(java.lang.String fileName)
Returns:
The initial contents of the file as InputStream