Skip to content

Commit

Permalink
Remove unused methods and un-publish method from IRBusinessManager
Browse files Browse the repository at this point in the history
Code clean-up, and some documentation
  • Loading branch information
Valentin Georgiev committed Sep 10, 2012
1 parent 8efb63d commit c3675f3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 24 deletions.
Expand Up @@ -49,21 +49,5 @@ public interface IRBusinessManager extends IBioclipseManager {
public String ls();

@Recorded
@PublishedMethod(
methodSummary = "Handles selection and editor content execution"
)
public String evalSnippet(String seltext);

@Recorded
@PublishedMethod(
methodSummary = "Changes the file separator in filepath to /"
)
public String fixFilepath(String filepath);

@Recorded
@PublishedMethod(
methodSummary = "Gets the boolean " +
"noting if we have the right R version"
)
public boolean getRightRVersion();
}
Expand Up @@ -261,6 +261,10 @@ private void checkRdependencies() throws FileNotFoundException, BioclipseExcepti
}
}

/**
* Gets the boolean noting if we have the right R version
* @return rightRVersion boolean
*/
public boolean getRightRVersion(){
return this.rightRVersion;
}
Expand Down
Expand Up @@ -31,6 +31,7 @@ public class RunUtil {
public static String NEWLINE = System.getProperty("line.separator");
public static String cmdparser = "(;?\r?\n|;)";

//TODO: write documentation
public static String getSelectedCode(final ExecutionEvent event) throws CoreException {
try {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
Expand Down Expand Up @@ -79,6 +80,11 @@ public static String getContent(ExecutionEvent event) {
return contents;
}

/**
* Gets the active editor, checks the editor state, and returns the file system
* path of the file
* @return file path of type String
*/
public static String getFilePath() {
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (!(editor instanceof REditor)) return null;
Expand All @@ -89,24 +95,17 @@ public static String getFilePath() {
System.out.println("File path is: " + filepath);

//Get the file path with correct file separator
filepath = fixFilepath(filepath);
filepath = filepath.replace(fileseparator, "/");
return filepath;
}

public static String fixFilepath(String filepath) {
filepath = filepath.replace(fileseparator, "/");
return filepath;
}

public static String parseCommand(String command) {
String[] cmd = command.split(cmdparser);
StringBuilder builder = new StringBuilder();
for (int i = 0; i<cmd.length; i++)
if (!cmd[i].startsWith("#") && cmd[i].length() != 0) {
builder.append(cmd[i]);
// if (i < (cmd.length - 1)) {
builder.append("\n");
// }
}
String cmdstr = builder.toString();
return cmdstr;
Expand Down

0 comments on commit c3675f3

Please sign in to comment.