You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2011/04/06 13:11:43 UTC

svn commit: r1089400 - in /uima/uimaj/trunk/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher: AnalysisEngineLaunchConfigurationDelegate.java ui/AnalysisEngineMainTab.java

Author: joern
Date: Wed Apr  6 11:11:43 2011
New Revision: 1089400

URL: http://svn.apache.org/viewvc?rev=1089400&view=rev
Log:
UIMA-2100 All paths are now workspace relative instead of project relative

Modified:
    uima/uimaj/trunk/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/AnalysisEngineLaunchConfigurationDelegate.java
    uima/uimaj/trunk/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/ui/AnalysisEngineMainTab.java

Modified: uima/uimaj/trunk/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/AnalysisEngineLaunchConfigurationDelegate.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/AnalysisEngineLaunchConfigurationDelegate.java?rev=1089400&r1=1089399&r2=1089400&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/AnalysisEngineLaunchConfigurationDelegate.java (original)
+++ uima/uimaj/trunk/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/AnalysisEngineLaunchConfigurationDelegate.java Wed Apr  6 11:11:43 2011
@@ -72,9 +72,14 @@ public class AnalysisEngineLaunchConfigu
     
     StringBuilder cmdline = new StringBuilder();
     cmdline.append(RemoteLauncher.DESCRIPTOR_PARAM + " ");
-    cmdline.append(configuration.getAttribute(LauncherConstants.ATTR_DESCRIPTOR_NAME, "") + " ");
+    String descriptorPath = configuration.getAttribute(LauncherConstants.ATTR_DESCRIPTOR_NAME, "");
+    IResource descriptor = ResourcesPlugin.getWorkspace().getRoot().findMember(descriptorPath);
+    cmdline.append(descriptor.getLocation().toOSString() + " ");
     cmdline.append(RemoteLauncher.INPUT_RESOURCE_PARAM + " ");
-    cmdline.append(configuration.getAttribute(LauncherConstants.ATTR_INPUT_NAME, "") + " ");
+    
+    String inputResourcePath = configuration.getAttribute(LauncherConstants.ATTR_INPUT_NAME, "");
+    IResource inputResource = ResourcesPlugin.getWorkspace().getRoot().findMember(inputResourcePath);
+    cmdline.append(inputResource.getLocation().toOSString() + " ");
     
     String formatName = configuration.getAttribute(LauncherConstants.ATTR_INPUT_FORMAT_NAME,
            " "); 
@@ -91,7 +96,9 @@ public class AnalysisEngineLaunchConfigu
     cmdline.append(RemoteLauncher.INPUT_RECURSIVE_PARAM + " ");
     cmdline.append(configuration.getAttribute(LauncherConstants.ATTR_INPUT_RECURSIVELY_NAME, false) + " ");
     cmdline.append(RemoteLauncher.OUTPUT_FOLDER_PARAM + " ");
-    cmdline.append(configuration.getAttribute(LauncherConstants.ATTR_OUTPUT_FOLDER_NAME, "") + " ");
+    String outputFolderPath = configuration.getAttribute(LauncherConstants.ATTR_OUTPUT_FOLDER_NAME, "");
+    IResource outputFolder = ResourcesPlugin.getWorkspace().getRoot().findMember(outputFolderPath);
+    cmdline.append(outputFolder.getLocation().toOSString() + " ");
     cmdline.append(RemoteLauncher.OUTPUT_CLEAR_PARAM + " ");
     cmdline.append(configuration.getAttribute(LauncherConstants.ATTR_OUTPUT_CLEAR_NAME, false));
     

Modified: uima/uimaj/trunk/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/ui/AnalysisEngineMainTab.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/ui/AnalysisEngineMainTab.java?rev=1089400&r1=1089399&r2=1089400&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/ui/AnalysisEngineMainTab.java (original)
+++ uima/uimaj/trunk/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/ui/AnalysisEngineMainTab.java Wed Apr  6 11:11:43 2011
@@ -99,14 +99,10 @@ public class AnalysisEngineMainTab exten
   }
   
   private IContainer getContainer(String path) {
-    IProject project = getSelectedProject();
-    
-    if (project != null) {
-      Path containerPath = new Path(path);
-      IResource resource =  project.findMember(containerPath);
-      if (resource instanceof IContainer)
-        return (IContainer) resource;
-    }
+	Path containerPath = new Path(path);
+	IResource resource =  getWorkspaceRoot().findMember(containerPath);
+	if (resource instanceof IContainer)
+	  return (IContainer) resource;
     
     return null;
   }
@@ -193,11 +189,12 @@ public class AnalysisEngineMainTab exten
                 new WorkbenchLabelProvider(), new WorkbenchContentProvider());
         dialog.setTitle("Select descriptor");
         dialog.setMessage("Select descriptor");
-        dialog.setInput(getSelectedProject());
+        dialog.setInput(getWorkspaceRoot());
+        dialog.setInitialSelection(getWorkspaceRoot().findMember(descriptorText.getText()));
         if (dialog.open() == IDialogConstants.OK_ID) {
           IResource resource = (IResource) dialog.getFirstResult();
           if (resource != null) {
-            String fileLoc = resource.getProjectRelativePath().toString();
+            String fileLoc = resource.getFullPath().toString();
             descriptorText.setText(fileLoc);
           }
         }
@@ -233,10 +230,11 @@ public class AnalysisEngineMainTab exten
         dialog.setTitle("Select input folder or file");
         dialog.setMessage("Select input folder or file");
         dialog.setInput(getSelectedProject());
+        dialog.setInitialSelection(getWorkspaceRoot().findMember(inputText.getText()));
         if (dialog.open() == IDialogConstants.OK_ID) {
           IResource resource = (IResource) dialog.getFirstResult();
           if (resource != null) {
-            String fileLoc = resource.getProjectRelativePath().toString();
+            String fileLoc = resource.getFullPath().toString();
             inputText.setText(fileLoc);
           }
         }
@@ -392,17 +390,15 @@ public class AnalysisEngineMainTab exten
       return false;
     }
     
-    IProject project = (IProject) projectResource;
-    
     // Descriptor must be set and valid file
-    IResource descriptorResource = project.findMember(descriptorText.getText());
+    IResource descriptorResource = getWorkspaceRoot().findMember(descriptorText.getText());
     if (!(descriptorResource instanceof IFile)) {
       setErrorMessage("Descriptor must be an existing file!");
       return false;
     }
     
     // Input folder or file must be set
-    IResource inputResource = project.findMember(inputText.getText());
+    IResource inputResource = getWorkspaceRoot().findMember(inputText.getText());
     if (inputResource == null) {
       setErrorMessage("Input resource must be an existing file or folder!");
       return false;
@@ -428,7 +424,7 @@ public class AnalysisEngineMainTab exten
     
     // Validate output folder
     if (outputFolderText.getText().length() > 0) {
-      IResource outputResource = project.findMember(outputFolderText.getText());
+      IResource outputResource = getWorkspaceRoot().findMember(outputFolderText.getText());
       if (!(outputResource instanceof IFolder)) {
         setErrorMessage("The output folder must be a valid folder or not be set!");
         return false;