This is an automated email from the ASF dual-hosted git repository.
rec pushed a commit to branch
refactoring/UIMA-6373-Format-UIMA-Core-Java-SDK-codebase
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git
The following commit(s) were added to
refs/heads/refactoring/UIMA-6373-Format-UIMA-Core-Java-SDK-codebase by this
push:
new 7ce3a85 [UIMA-6373] Format UIMA Core Java SDK codebase
7ce3a85 is described below
commit 7ce3a853e3658da465816d62d1e8f26387455d05
Author: Richard Eckart de Castilho <[email protected]>
AuthorDate: Thu Feb 10 14:52:30 2022 +0100
[UIMA-6373] Format UIMA Core Java SDK codebase
- Auto-format
---
.../AnalysisEngineLaunchConfigurationDelegate.java | 141 +++++-----
.../apache/uima/ep_launcher/LauncherConstants.java | 7 +-
.../apache/uima/ep_launcher/LauncherPlugin.java | 38 +--
.../apache/uima/ep_launcher/RemoteLauncher.java | 188 ++++++-------
.../uima/ep_launcher/ui/AnalysisEngineMainTab.java | 297 ++++++++++-----------
.../ep_launcher/ui/AnalysisEngineTabGroup.java | 22 +-
6 files changed, 337 insertions(+), 356 deletions(-)
diff --git
a/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/AnalysisEngineLaunchConfigurationDelegate.java
b/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/AnalysisEngineLaunchConfigurationDelegate.java
index 2b23926..954501c 100644
---
a/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/AnalysisEngineLaunchConfigurationDelegate.java
+++
b/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/AnalysisEngineLaunchConfigurationDelegate.java
@@ -44,7 +44,7 @@ import org.eclipse.jdt.launching.JavaLaunchDelegate;
import org.osgi.framework.Bundle;
/**
- * This delegate is responsible to to configure the VM and to create command
line args which will be
+ * This delegate is responsible to to configure the VM and to create command
line args which will be
* passed to the {@link RemoteLauncher}s main method.
*/
public class AnalysisEngineLaunchConfigurationDelegate extends
JavaLaunchDelegate {
@@ -68,17 +68,17 @@ public class AnalysisEngineLaunchConfigurationDelegate
extends JavaLaunchDelegat
private static void ensureResourceExists(IResource resource, String
resourceName)
throws CoreException {
if (resource == null)
- throw new CoreException(new Status(IStatus.ERROR, LauncherPlugin.ID,
"The " + resourceName
- + " does not exist!"));
+ throw new CoreException(new Status(IStatus.ERROR, LauncherPlugin.ID,
+ "The " + resourceName + " does not exist!"));
}
-
+
@Override
public String getProgramArguments(ILaunchConfiguration configuration) throws
CoreException {
-
+
// Build the command line which is passed to the launched processed, in
case the
- // parameters are not configured correctly (can only happen trough bugs in
this plugin) then
+ // parameters are not configured correctly (can only happen trough bugs in
this plugin) then
// the launched process will fail
-
+
StringBuilder cmdline = new StringBuilder();
cmdline.append(RemoteLauncher.DESCRIPTOR_PARAM + " ");
String descriptorPath =
configuration.getAttribute(LauncherConstants.ATTR_DESCRIPTOR_NAME, "");
@@ -86,50 +86,56 @@ public class AnalysisEngineLaunchConfigurationDelegate
extends JavaLaunchDelegat
ensureResourceExists(descriptor, "Analysis Engine Descritpor");
cmdline.append(descriptor.getLocation().toOSString() + " ");
cmdline.append(RemoteLauncher.INPUT_RESOURCE_PARAM + " ");
-
+
String inputResourcePath =
configuration.getAttribute(LauncherConstants.ATTR_INPUT_NAME, "");
- IResource inputResource =
ResourcesPlugin.getWorkspace().getRoot().findMember(inputResourcePath);
+ IResource inputResource = ResourcesPlugin.getWorkspace().getRoot()
+ .findMember(inputResourcePath);
ensureResourceExists(inputResource, "Input Resource");
cmdline.append(inputResource.getLocation().toOSString() + " ");
-
- String formatName =
configuration.getAttribute(LauncherConstants.ATTR_INPUT_FORMAT_NAME, " ");
+
+ String formatName =
configuration.getAttribute(LauncherConstants.ATTR_INPUT_FORMAT_NAME, " ");
cmdline.append(RemoteLauncher.INPUT_FORMAT_PARAM + " ");
cmdline.append(formatName + " ");
-
+
// if format equals PLAIN_TEXT
if (InputFormat.PLAIN_TEXT.toString().equals(formatName)) {
cmdline.append(RemoteLauncher.INPUT_ENCODING_PARAM + " ");
-
cmdline.append(configuration.getAttribute(LauncherConstants.ATTR_INPUT_ENCODING_NAME,
"")
- + " ");
-
+ cmdline.append(
+
configuration.getAttribute(LauncherConstants.ATTR_INPUT_ENCODING_NAME, "") + "
");
+
cmdline.append(RemoteLauncher.INPUT_LANGUAGE_PARAM + " ");
-
cmdline.append(configuration.getAttribute(LauncherConstants.ATTR_INPUT_LANGUAGE_NAME,
"") + " ");
-
+ cmdline.append(
+
configuration.getAttribute(LauncherConstants.ATTR_INPUT_LANGUAGE_NAME, "") + "
");
+
}
-
+
cmdline.append(RemoteLauncher.INPUT_RECURSIVE_PARAM + " ");
-
cmdline.append(configuration.getAttribute(LauncherConstants.ATTR_INPUT_RECURSIVELY_NAME,
false) + " ");
-
- String outputFolderPath =
configuration.getAttribute(LauncherConstants.ATTR_OUTPUT_FOLDER_NAME, "");
+ cmdline.append(
+
configuration.getAttribute(LauncherConstants.ATTR_INPUT_RECURSIVELY_NAME,
false) + " ");
+
+ String outputFolderPath =
configuration.getAttribute(LauncherConstants.ATTR_OUTPUT_FOLDER_NAME,
+ "");
// zero length string means that is is not set
if (outputFolderPath.length() != 0) {
- IResource outputFolder =
ResourcesPlugin.getWorkspace().getRoot().findMember(outputFolderPath);
-
+ IResource outputFolder = ResourcesPlugin.getWorkspace().getRoot()
+ .findMember(outputFolderPath);
+
ensureResourceExists(outputFolder, "Output Folder");
-
- cmdline.append(RemoteLauncher.OUTPUT_FOLDER_PARAM + " ");
- cmdline.append(outputFolder.getLocation().toOSString() + " ");
-
- // Do not delete the output folder if it is the Workspace
Root or a Project
- // It should not be possible to set it to one of both, but in
case something goes wrong
- // it should be double checked
- if (!(outputFolder instanceof IWorkspaceRoot || outputFolder
instanceof IProject)) {
- cmdline.append(RemoteLauncher.OUTPUT_CLEAR_PARAM + "
");
-
cmdline.append(configuration.getAttribute(LauncherConstants.ATTR_OUTPUT_CLEAR_NAME,
false));
- }
+
+ cmdline.append(RemoteLauncher.OUTPUT_FOLDER_PARAM + " ");
+ cmdline.append(outputFolder.getLocation().toOSString() + " ");
+
+ // Do not delete the output folder if it is the Workspace Root or a
Project
+ // It should not be possible to set it to one of both, but in case
something goes wrong
+ // it should be double checked
+ if (!(outputFolder instanceof IWorkspaceRoot || outputFolder instanceof
IProject)) {
+ cmdline.append(RemoteLauncher.OUTPUT_CLEAR_PARAM + " ");
+
cmdline.append(configuration.getAttribute(LauncherConstants.ATTR_OUTPUT_CLEAR_NAME,
false));
+ }
}
- String pgmArgs =
configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
"");
+ String pgmArgs = configuration
+
.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "");
if (pgmArgs != null) {
cmdline.append(' ').append(pgmArgs);
}
@@ -137,25 +143,24 @@ public class AnalysisEngineLaunchConfigurationDelegate
extends JavaLaunchDelegat
return cmdline.toString();
}
-
/**
- * Adds the launcher and uima core jar to the class path,
- * depending on normal mode or PDE development mode.
+ * Adds the launcher and uima core jar to the class path, depending on
normal mode or PDE
+ * development mode.
*/
@Override
public String[] getClasspath(ILaunchConfiguration configuration) throws
CoreException {
-
+
// The class path already contains the jars which are specified in the
Classpath tab
-
+
List<String> extendedClasspath = new ArrayList<>();
Collections.addAll(extendedClasspath, super.getClasspath(configuration));
-
+
// Normal mode, add the launcher plugin and uima runtime jar to the
classpath
try {
- if (!Platform.inDevelopmentMode()) {
- // Add this plugin jar to the classpath
- extendedClasspath.add(pluginIdToJarPath(LauncherPlugin.ID)); }
- else {
+ if (!Platform.inDevelopmentMode()) {
+ // Add this plugin jar to the classpath
+ extendedClasspath.add(pluginIdToJarPath(LauncherPlugin.ID));
+ } else {
// When running inside eclipse with PDE in development mode the plugins
// are not installed inform of jar files and the classes must be loaded
// from the target/classes folder or
target/org.apache.uima.runtime.*.jar file
@@ -166,43 +171,44 @@ public class AnalysisEngineLaunchConfigurationDelegate
extends JavaLaunchDelegat
// Add org.apache.uima.runtime jar to class path
Bundle bundle =
LauncherPlugin.getDefault().getBundle("org.apache.uima.runtime");
-
+
// Ignore the case when runtime bundle does not exist ...
if (bundle != null) {
// find entries: starting point, pattern, whether or not to recurse
- // all the embedded jars are at the top level, no recursion needed
- // All the jars are not needed - only the uimaj core one
- // any other jars will be provided by the launching project's
class path
- // uimaj-core provided because the launcher itself needs
uimaj-core classes
- // Found empirically that recursion is need to find the jar in
development mode
- Enumeration<?> jarEnum = bundle.findEntries("/", "uimaj-core*.jar",
Platform.inDevelopmentMode());
+ // all the embedded jars are at the top level, no recursion needed
+ // All the jars are not needed - only the uimaj core one
+ // any other jars will be provided by the launching project's class
path
+ // uimaj-core provided because the launcher itself needs uimaj-core
classes
+ // Found empirically that recursion is need to find the jar in
development mode
+ Enumeration<?> jarEnum = bundle.findEntries("/", "uimaj-core*.jar",
+ Platform.inDevelopmentMode());
while (jarEnum != null && jarEnum.hasMoreElements()) {
URL element = (URL) jarEnum.nextElement();
extendedClasspath.add(FileLocator.toFileURL(element).getFile());
}
- }
- // adds things like the top level metainf info,
+ }
+ // adds things like the top level metainf info,
// probably not required in most cases
extendedClasspath.add(pluginIdToJarPath("org.apache.uima.runtime"));
} catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, LauncherPlugin.ID,
IStatus.OK,
+ throw new CoreException(new Status(IStatus.ERROR, LauncherPlugin.ID,
IStatus.OK,
"Failed to compose classpath!", e));
}
-
+
// Dump classpath
-// for (String cp : extendedClasspath) {
-// System.out.println("Uima Launcher CP entry: " + cp);
-// }
+ // for (String cp : extendedClasspath) {
+ // System.out.println("Uima Launcher CP entry: " + cp);
+ // }
return extendedClasspath.toArray(new String[extendedClasspath.size()]);
}
-
+
@Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch
launch,
IProgressMonitor monitor) throws CoreException {
-
+
super.launch(configuration, mode, launch, monitor);
-
- // This method is called from a worker thread, so it seems
+
+ // This method is called from a worker thread, so it seems
// safe to block this tread until the VM terminates
while (!launch.isTerminated()) {
try {
@@ -211,15 +217,16 @@ public class AnalysisEngineLaunchConfigurationDelegate
extends JavaLaunchDelegat
Thread.interrupted();
}
}
-
- String outputFolderPath =
configuration.getAttribute(LauncherConstants.ATTR_OUTPUT_FOLDER_NAME, "");
+
+ String outputFolderPath =
configuration.getAttribute(LauncherConstants.ATTR_OUTPUT_FOLDER_NAME,
+ "");
// zero length string means that is is not set
if (outputFolderPath.length() != 0) {
// If the output directory is set and inside the workspace it will be
refreshed
IResource result =
ResourcesPlugin.getWorkspace().getRoot().findMember(outputFolderPath);
-
+
if (result != null)
- result.refreshLocal(IResource.DEPTH_INFINITE, null);
+ result.refreshLocal(IResource.DEPTH_INFINITE, null);
}
}
}
diff --git
a/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/LauncherConstants.java
b/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/LauncherConstants.java
index e509506..d17a997 100644
---
a/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/LauncherConstants.java
+++
b/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/LauncherConstants.java
@@ -25,13 +25,12 @@ public class LauncherConstants {
public static final String ATTR_INPUT_RECURSIVELY_NAME =
"org.apache.uima.ep_launcher.INPUT_RECURSIVELY_ATTR";
public static final String ATTR_INPUT_ENCODING_NAME =
"org.apache.uima.ep_launcher.INPUT_ENCODING_ATTR";
public static final String ATTR_INPUT_LANGUAGE_NAME =
"org.apache.uima.ep_launcher.INPUT_LANGUAGE_ATTR";
-
+
public static final String ATTR_INPUT_FORMAT_NAME =
"org.apache.uima.ep_launcher.INPUT_FORMAT_ATTR";
public static final String ATTR_OUTPUT_FOLDER_NAME =
"org.apache.uima.ep_launcher.OUTPUT_FOLDER_ATTR";
public static final String ATTR_OUTPUT_CLEAR_NAME =
"org.apache.uima.ep_launcher.OUTPUT_CLEAR_ATTR";
-
+
public enum InputFormat {
- CAS,
- PLAIN_TEXT
+ CAS, PLAIN_TEXT
}
}
diff --git
a/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/LauncherPlugin.java
b/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/LauncherPlugin.java
index eff2182..74ecce7 100644
---
a/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/LauncherPlugin.java
+++
b/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/LauncherPlugin.java
@@ -31,10 +31,9 @@ import org.osgi.service.packageadmin.PackageAdmin;
*/
public class LauncherPlugin extends Plugin {
-
/** The Constant ID. */
public static final String ID = "org.apache.uima.launcher";
-
+
/** The plugin. */
private static LauncherPlugin plugin;
@@ -48,7 +47,9 @@ public class LauncherPlugin extends Plugin {
plugin = this;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see
org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
*/
@Override
@@ -58,7 +59,9 @@ public class LauncherPlugin extends Plugin {
bundleContext = context;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see
org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
@Override
@@ -70,41 +73,44 @@ public class LauncherPlugin extends Plugin {
/**
* Gets the bundles.
*
- * @param bundleName the bundle name
- * @param version the version
+ * @param bundleName
+ * the bundle name
+ * @param version
+ * the version
* @return the bundles
*/
public Bundle[] getBundles(String bundleName, String version) {
-
+
Bundle[] bundles = Platform.getBundles(bundleName, version);
if (bundles != null) {
- return bundles;
+ return bundles;
}
// Accessing bundle which is not resolved
- PackageAdmin admin = (PackageAdmin) bundleContext.getService(
- bundleContext.getServiceReference(PackageAdmin.class.getName()));
+ PackageAdmin admin = (PackageAdmin) bundleContext
+
.getService(bundleContext.getServiceReference(PackageAdmin.class.getName()));
bundles = admin.getBundles(bundleName, version);
if (bundles != null && bundles.length > 0) {
- return bundles;
+ return bundles;
}
-
+
return null;
}
/**
* Gets the bundle.
*
- * @param bundleName the bundle name
+ * @param bundleName
+ * the bundle name
* @return the bundle
*/
public Bundle getBundle(String bundleName) {
Bundle[] bundles = getBundles(bundleName, null);
if (bundles != null && bundles.length > 0) {
- // return fist bundle, if multiple
- return bundles[0];
+ // return fist bundle, if multiple
+ return bundles[0];
}
-
+
return null;
}
diff --git
a/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/RemoteLauncher.java
b/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/RemoteLauncher.java
index d4bb627..3a95dcb 100644
---
a/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/RemoteLauncher.java
+++
b/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/RemoteLauncher.java
@@ -53,7 +53,7 @@ public class RemoteLauncher {
public static final String INPUT_LANGUAGE_PARAM = "-language";
public static final String OUTPUT_FOLDER_PARAM = "-output";
public static final String OUTPUT_CLEAR_PARAM = "-clear";
-
+
private static File descriptor;
private static File inputResource;
private static boolean inputRecursive;
@@ -62,158 +62,144 @@ public class RemoteLauncher {
private static String inputLanguage;
private static File outputFolder;
private static boolean outputFolderClear;
-
+
private static boolean parseCmdLineArgs(String[] args) {
-
+
int necessaryArgCount = 0;
-
+
int index = 0;
while (index < args.length) {
-
+
String arg = args[index++];
-
+
if (DESCRIPTOR_PARAM.equals(arg)) {
if (index >= args.length) {
return false;
}
-
+
descriptor = new File(args[index++]);
necessaryArgCount++;
- }
- else if (INPUT_RESOURCE_PARAM.equals(arg)) {
+ } else if (INPUT_RESOURCE_PARAM.equals(arg)) {
if (index >= args.length) {
return false;
}
-
+
inputResource = new File(args[index++]);
necessaryArgCount++;
- }
- else if (INPUT_RECURSIVE_PARAM.equals(arg)) {
+ } else if (INPUT_RECURSIVE_PARAM.equals(arg)) {
if (index >= args.length) {
return false;
}
-
+
inputRecursive = Boolean.parseBoolean(args[index++]);
- }
- else if (INPUT_FORMAT_PARAM.equals(arg)) {
+ } else if (INPUT_FORMAT_PARAM.equals(arg)) {
if (index >= args.length) {
return false;
}
-
+
String inputFormatName = args[index++];
-
+
if (InputFormat.CAS.toString().equals(inputFormatName)) {
inputFormat = InputFormat.CAS;
- }
- else if (InputFormat.PLAIN_TEXT.toString().equals(inputFormatName)) {
+ } else if (InputFormat.PLAIN_TEXT.toString().equals(inputFormatName)) {
inputFormat = InputFormat.PLAIN_TEXT;
- }
- else {
+ } else {
System.err.println("Unkown input format: " + inputFormatName);
return false;
}
-
- }
- else if (INPUT_ENCODING_PARAM.equals(arg)) {
+
+ } else if (INPUT_ENCODING_PARAM.equals(arg)) {
if (index >= args.length) {
return false;
}
-
+
inputEncoding = args[index++];
- }
- else if (INPUT_LANGUAGE_PARAM.equals(arg)) {
+ } else if (INPUT_LANGUAGE_PARAM.equals(arg)) {
if (index >= args.length) {
return false;
}
-
+
inputLanguage = args[index++];
- }
- else if (OUTPUT_FOLDER_PARAM.equals(arg)) {
+ } else if (OUTPUT_FOLDER_PARAM.equals(arg)) {
if (index >= args.length) {
return false;
}
-
+
outputFolder = new File(args[index++]);
- }
- else if (OUTPUT_CLEAR_PARAM.equals(arg)) {
+ } else if (OUTPUT_CLEAR_PARAM.equals(arg)) {
if (index >= args.length) {
return false;
}
-
+
outputFolderClear = Boolean.parseBoolean(args[index++]);
}
}
-
+
return necessaryArgCount == 2;
}
-
- private static void processFile(File inputFile, InputFormat format,
- AnalysisEngine aAE, CAS aCAS) throws IOException,
- AnalysisEngineProcessException {
-
+
+ private static void processFile(File inputFile, InputFormat format,
AnalysisEngine aAE, CAS aCAS)
+ throws IOException, AnalysisEngineProcessException {
+
if (InputFormat.PLAIN_TEXT.equals(format)) {
String document = FileUtils.file2String(inputFile, inputEncoding);
document = document.trim();
-
+
// put document text in CAS
aCAS.setDocumentText(document);
-
+
if (inputLanguage != null)
aCAS.setDocumentLanguage(inputLanguage);
- }
- else if (InputFormat.CAS.equals(format)) {
+ } else if (InputFormat.CAS.equals(format)) {
if (inputFile.getName().endsWith(".xmi")) {
try (FileInputStream inputStream = new FileInputStream(inputFile)) {
XmiCasDeserializer.deserialize(inputStream, aCAS, true);
} catch (SAXException e) {
throw new IOException(e.getMessage());
}
- }
- else if (inputFile.getName().endsWith(".xcas")) {
+ } else if (inputFile.getName().endsWith(".xcas")) {
try (FileInputStream inputStream = new FileInputStream(inputFile)) {
XCASDeserializer.deserialize(inputStream, aCAS, true);
} catch (SAXException e) {
throw new IOException(e.getMessage());
}
}
- }
- else {
+ } else {
throw new IllegalStateException("Unexpected format!");
}
-
+
// process
aAE.process(aCAS);
if (outputFolder != null) {
-
+
File inputDirectory;
if (inputResource.isFile()) {
inputDirectory = inputResource.getParentFile();
- }
- else {
+ } else {
inputDirectory = inputResource;
}
-
+
String inputFilePath = inputFile.getPath();
String relativeInputFilePath;
if (inputFilePath.startsWith(inputDirectory.getPath())) {
relativeInputFilePath =
inputFilePath.substring(inputDirectory.getPath().length());
- }
- else {
- System.err.println("Error: Unable to construct output file path,
output file will not be written!");
+ } else {
+ System.err.println(
+ "Error: Unable to construct output file path, output file will
not be written!");
return;
}
-
+
String outputFilePath = new File(outputFolder.getPath(),
relativeInputFilePath).getPath();
-
+
// cutoff file ending
int fileTypeIndex = outputFilePath.lastIndexOf(".");
if (fileTypeIndex != -1) {
outputFilePath = outputFilePath.substring(0, fileTypeIndex);
}
-
+
File outputFile = new File(outputFilePath + ".xmi");
-
+
// Create sub-directories
if (!outputFile.getParentFile().exists()) {
outputFile.getParentFile().mkdirs();
@@ -230,15 +216,14 @@ public class RemoteLauncher {
}
}
}
-
+
// reset the CAS to prepare it for processing the next document
aCAS.reset();
}
-
- private static void findAndProcessFiles(File inputResource, FileFilter
fileFilter,
- AnalysisEngine aAE, CAS aCAS) throws IOException,
- AnalysisEngineProcessException {
-
+
+ private static void findAndProcessFiles(File inputResource, FileFilter
fileFilter,
+ AnalysisEngine aAE, CAS aCAS) throws IOException,
AnalysisEngineProcessException {
+
// Figure out if input resource is file or directory
if (inputResource.isDirectory()) {
// get all files in the input directory
@@ -247,101 +232,96 @@ public class RemoteLauncher {
for (int i = 0; i < files.length; i++) {
if (!files[i].isDirectory()) {
processFile(files[i], inputFormat, aAE, aCAS);
- }
- else {
+ } else {
findAndProcessFiles(files[i], fileFilter, aAE, aCAS);
}
}
}
- }
- else if (inputResource.isFile()) {
+ } else if (inputResource.isFile()) {
// Just process the single file
processFile(inputResource, inputFormat, aAE, aCAS);
}
}
-
+
private static boolean deleteFile(File file) {
-
+
if (file.isDirectory()) {
File subFiles[] = file.listFiles();
-
+
boolean success = true;
for (File subFile : subFiles) {
success = success && deleteFile(subFile);
}
-
+
return success;
- }
- else {
+ } else {
return file.delete();
}
}
-
+
public static void main(String[] args) throws Exception {
-
+
// debug / testing : see if jvm arg passed in...
-
-// MemoryMXBean memoryMxBean = ManagementFactory.getMemoryMXBean();
-// long maxHeap = memoryMxBean.getHeapMemoryUsage().getMax();
-// System.out.println("JVM MaxHeap: " + maxHeap);
-
+
+ // MemoryMXBean memoryMxBean = ManagementFactory.getMemoryMXBean();
+ // long maxHeap = memoryMxBean.getHeapMemoryUsage().getMax();
+ // System.out.println("JVM MaxHeap: " + maxHeap);
+
// show what command line args (not jvm args) got passed
-// System.out.println("Cmdline args: ");
-// for (int i = 0; i < args.length; i++) {
-// System.out.println(" arg " + i + " = " + args[i]);
-// }
-
+ // System.out.println("Cmdline args: ");
+ // for (int i = 0; i < args.length; i++) {
+ // System.out.println(" arg " + i + " = " + args[i]);
+ // }
+
if (!parseCmdLineArgs(args)) {
throw new IllegalArgumentException("Passed arguments are invalid!");
}
-
+
if (outputFolder != null && outputFolderClear) {
File filesToDelete[] = outputFolder.listFiles();
-
+
for (File file : filesToDelete) {
deleteFile(file);
}
}
-
+
// get Resource Specifier from XML file
XMLInputSource in = new XMLInputSource(descriptor);
ResourceSpecifier specifier =
UIMAFramework.getXMLParser().parseResourceSpecifier(in);
-
+
// create Analysis Engine
AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(specifier);
-
+
// create a CAS
CAS cas = ae.newCAS();
-
+
// Create a file filter depending on the format
// to filter out all file which do not have the
// expected file ending
FileFilter fileFilter;
if (InputFormat.CAS.equals(inputFormat)) {
fileFilter = new FileFilter() {
-
+
@Override
public boolean accept(File file) {
- return file.getName().endsWith(".xmi") ||
file.getName().endsWith(".xcas") ||
- (inputRecursive && file.isDirectory());
+ return file.getName().endsWith(".xmi") ||
file.getName().endsWith(".xcas")
+ || (inputRecursive && file.isDirectory());
}
};
- }
- else if (InputFormat.PLAIN_TEXT.equals(inputFormat)) {
+ } else if (InputFormat.PLAIN_TEXT.equals(inputFormat)) {
fileFilter = new FileFilter() {
-
+
@Override
public boolean accept(File file) {
return file.getName().endsWith(".txt") || (inputRecursive &&
file.isDirectory());
}
};
- }
- else {
+ } else {
throw new IllegalStateException("Unexpected input format!");
}
-
+
findAndProcessFiles(inputResource, fileFilter, ae, cas);
-
+
ae.collectionProcessComplete(new ProcessTrace_impl());
ae.destroy();
}
diff --git
a/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/ui/AnalysisEngineMainTab.java
b/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/ui/AnalysisEngineMainTab.java
index 1d5eed3..bedd0f2 100644
---
a/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/ui/AnalysisEngineMainTab.java
+++
b/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/ui/AnalysisEngineMainTab.java
@@ -65,82 +65,81 @@ import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
/**
- * The Analysis Engine Main Tab is responsible to display/edit
- * the UIMA related settings, such as project, descriptor file,
- * input folders, etc.
+ * The Analysis Engine Main Tab is responsible to display/edit the UIMA
related settings, such as
+ * project, descriptor file, input folders, etc.
*/
// TODO: Add an icon for the main tab
public class AnalysisEngineMainTab extends JavaLaunchTab {
private Text projectText;
-
+
private Text descriptorText;
-
+
private Text inputText;
private Button recursivelyButton;
-
+
private Button casButton;
private Button plainTextButton;
private Combo encodingCombo;
private Text languageText;
-
+
private Text outputFolderText;
private Button clearFolderButton;
-
+
private IWorkspaceRoot getWorkspaceRoot() {
return ResourcesPlugin.getWorkspace().getRoot();
}
-
+
private IProject getSelectedProject() {
IResource project =
ResourcesPlugin.getWorkspace().getRoot().findMember(projectText.getText());
if (project instanceof IProject) {
- return (IProject) project;
+ return (IProject) project;
}
-
+
return null;
}
-
+
private IContainer getContainer(String path) {
- Path containerPath = new Path(path);
- IResource resource = getWorkspaceRoot().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;
}
-
+
@Override
public void createControl(Composite composite) {
-
+
Composite projectComposite = new Composite(composite, SWT.NONE);
GridLayout projectGridLayout = new GridLayout();
projectGridLayout.numColumns = 1;
projectGridLayout.horizontalSpacing = SWT.FILL;
projectComposite.setLayout(projectGridLayout);
-
+
// Project Group
Group projectGroup = new Group(projectComposite, SWT.None);
projectGroup.setText("Project:");
-
+
GridData projectGroupData = new GridData();
projectGroupData.grabExcessHorizontalSpace = true;
projectGroupData.horizontalAlignment = SWT.FILL;
projectGroup.setLayoutData(projectGroupData);
-
+
GridLayout projectGroupLayout = new GridLayout(2, false);
projectGroup.setLayout(projectGroupLayout);
-
+
projectText = new Text(projectGroup, SWT.BORDER);
- GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
- grab(true, false).applyTo(projectText);
+ GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false)
+ .applyTo(projectText);
projectText.addModifyListener(new ModifyListener() {
-
+
@Override
public void modifyText(ModifyEvent event) {
updateLaunchConfigurationDialog();
}
});
-
+
Button browseProject = new Button(projectGroup, SWT.NONE);
browseProject.setText("Browse ...");
browseProject.addSelectionListener(new SelectionAdapter() {
@@ -157,31 +156,31 @@ public class AnalysisEngineMainTab extends JavaLaunchTab {
if (project != null) {
dialog.setInitialSelections(new Object[] { project });
}
-
+
if (dialog.open() == Window.OK) {
IProject selectedProject = (IProject) dialog.getFirstResult();
projectText.setText(selectedProject.getName());
}
}
});
-
+
// Descriptor Group
Group descriptorGroup = new Group(projectComposite, SWT.None);
descriptorGroup.setText("Descriptor:");
-
+
GridData descriptorGroupData = new GridData();
descriptorGroupData.grabExcessHorizontalSpace = true;
descriptorGroupData.horizontalAlignment = SWT.FILL;
descriptorGroup.setLayoutData(projectGroupData);
-
+
GridLayout descriptorGroupLayout = new GridLayout(2, false);
descriptorGroup.setLayout(descriptorGroupLayout);
-
+
descriptorText = new Text(descriptorGroup, SWT.BORDER);
- GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
- grab(true, false).applyTo(descriptorText);
+ GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false)
+ .applyTo(descriptorText);
descriptorText.addModifyListener(new ModifyListener() {
-
+
@Override
public void modifyText(ModifyEvent event) {
updateLaunchConfigurationDialog();
@@ -207,28 +206,27 @@ public class AnalysisEngineMainTab extends JavaLaunchTab {
}
}
});
-
+
// Input Resource Group
Group inputResourceGroup = new Group(projectComposite, SWT.None);
inputResourceGroup.setText("Input Resource:");
-
- GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
- grab(true, false).applyTo(inputResourceGroup);
-
+
+ GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false)
+ .applyTo(inputResourceGroup);
+
GridLayout inputResourceGroupLayout = new GridLayout(2, false);
inputResourceGroup.setLayout(inputResourceGroupLayout);
-
+
inputText = new Text(inputResourceGroup, SWT.BORDER);
- GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
- grab(true, false).applyTo(inputText);
+ GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(inputText);
inputText.addModifyListener(new ModifyListener() {
-
+
@Override
public void modifyText(ModifyEvent event) {
updateLaunchConfigurationDialog();
}
});
-
+
Button browseInputResource = new Button(inputResourceGroup, SWT.NONE);
browseInputResource.setText("Browse ...");
browseInputResource.addSelectionListener(new SelectionAdapter() {
@@ -249,80 +247,80 @@ public class AnalysisEngineMainTab extends JavaLaunchTab {
}
}
});
-
+
recursivelyButton = new Button(inputResourceGroup, SWT.CHECK);
recursivelyButton.setText("Recursively, read all files under each
directory");
- GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
- grab(true, false).applyTo(recursivelyButton);
+ GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false)
+ .applyTo(recursivelyButton);
recursivelyButton.addSelectionListener(new SelectionListener() {
-
+
@Override
public void widgetSelected(SelectionEvent event) {
updateLaunchConfigurationDialog();
}
-
+
@Override
public void widgetDefaultSelected(SelectionEvent event) {
}
});
-
+
Group inputFormatGroup = new Group(projectComposite, SWT.None);
inputFormatGroup.setText("Input Format:");
-
- GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
- grab(true, false).applyTo(inputFormatGroup);
-
+
+ GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false)
+ .applyTo(inputFormatGroup);
+
GridLayout inputFormatGroupLayout = new GridLayout(4, false);
inputFormatGroup.setLayout(inputFormatGroupLayout);
-
+
casButton = new Button(inputFormatGroup, SWT.RADIO);
casButton.setText("CASes (XMI or XCAS format)");
- GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
- grab(true, false).span(4, 1).applyTo(casButton);
+ GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).span(4, 1)
+ .applyTo(casButton);
casButton.addSelectionListener(new SelectionListener() {
-
+
@Override
public void widgetSelected(SelectionEvent event) {
updateLaunchConfigurationDialog();
}
-
+
@Override
public void widgetDefaultSelected(SelectionEvent event) {
}
});
-
+
plainTextButton = new Button(inputFormatGroup, SWT.RADIO);
- GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).
- grab(false, false).applyTo(plainTextButton);
+ GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).grab(false,
false)
+ .applyTo(plainTextButton);
plainTextButton.addSelectionListener(new SelectionListener() {
-
+
@Override
public void widgetSelected(SelectionEvent event) {
encodingCombo.setEnabled(plainTextButton.getSelection());
languageText.setEnabled(plainTextButton.getSelection());
updateLaunchConfigurationDialog();
}
-
+
@Override
public void widgetDefaultSelected(SelectionEvent event) {
}
});
plainTextButton.setText("Plain Text, encoding:");
-
+
encodingCombo = new Combo(inputFormatGroup, SWT.NONE);
- GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).
- grab(false, false).applyTo(encodingCombo);
-
+ GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).grab(false,
false)
+ .applyTo(encodingCombo);
+
encodingCombo.addModifyListener(new ModifyListener() {
-
+
@Override
public void modifyText(ModifyEvent event) {
updateLaunchConfigurationDialog();
}
});
-
+
String defaultEncoding = Charset.defaultCharset().displayName();
-
+
Set<String> charsets = new HashSet<>();
charsets.add("US-ASCII");
charsets.add("ISO-8859-1");
@@ -331,56 +329,56 @@ public class AnalysisEngineMainTab extends JavaLaunchTab {
charsets.add("UTF-16LE");
charsets.add("UTF-16");
charsets.add(defaultEncoding);
-
+
encodingCombo.setItems(charsets.toArray(new String[charsets.size()]));
// Will be enabled by initializeForm if format is plain text
encodingCombo.setEnabled(false);
-
+
// Add language label
Label languageLabel = new Label(inputFormatGroup, SWT.NONE);
languageLabel.setText("Language:");
-
+
// Add language text field
- languageText = new Text(inputFormatGroup, SWT.BORDER);
- GridDataFactory.swtDefaults().hint(250, SWT.DEFAULT).align(SWT.LEFT,
SWT.CENTER).
- grab(true, false).applyTo(languageText);
-
- languageText.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent event) {
- updateLaunchConfigurationDialog();
- }
- });
-
+ languageText = new Text(inputFormatGroup, SWT.BORDER);
+ GridDataFactory.swtDefaults().hint(250, SWT.DEFAULT).align(SWT.LEFT,
SWT.CENTER)
+ .grab(true, false).applyTo(languageText);
+
+ languageText.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent event) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+
// Output Folder
Group outputFolderGroup = new Group(projectComposite, SWT.None);
outputFolderGroup.setText("Output Folder:");
- GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
- grab(true, false).applyTo(outputFolderGroup);
+ GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false)
+ .applyTo(outputFolderGroup);
GridLayout outputFolderGroupLayout = new GridLayout(2, false);
outputFolderGroup.setLayout(outputFolderGroupLayout);
outputFolderText = new Text(outputFolderGroup, SWT.BORDER);
- GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
- grab(true, false).applyTo(outputFolderText);
+ GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false)
+ .applyTo(outputFolderText);
outputFolderText.addModifyListener(new ModifyListener() {
-
+
@Override
public void modifyText(ModifyEvent event) {
updateLaunchConfigurationDialog();
}
});
-
+
Button browseOutputFolderButton = new Button(outputFolderGroup, SWT.NONE);
browseOutputFolderButton.setText("Browse ...");
browseOutputFolderButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- // TODO: Only select elements within project
+ // TODO: Only select elements within project
String currentContainerString = outputFolderText.getText();
IContainer currentContainer = getContainer(currentContainerString);
- ContainerSelectionDialog dialog = new
ContainerSelectionDialog(getShell(),
- currentContainer, false, "Select output folder");
+ ContainerSelectionDialog dialog = new
ContainerSelectionDialog(getShell(), currentContainer,
+ false, "Select output folder");
dialog.showClosedProjects(false);
dialog.open();
Object[] results = dialog.getResult();
@@ -391,17 +389,17 @@ public class AnalysisEngineMainTab extends JavaLaunchTab {
}
}
});
-
+
clearFolderButton = new Button(outputFolderGroup, SWT.CHECK);
clearFolderButton.setText("Clear the output folder");
- GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).
- grab(true, false).applyTo(clearFolderButton);
+ GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false)
+ .applyTo(clearFolderButton);
clearFolderButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent event) {
updateLaunchConfigurationDialog();
}
-
+
@Override
public void widgetDefaultSelected(SelectionEvent event) {
}
@@ -416,51 +414,49 @@ public class AnalysisEngineMainTab extends JavaLaunchTab {
@Override
public boolean isValid(ILaunchConfiguration launchConfig) {
-
+
setErrorMessage(null);
-
-
+
// Project must be set, check that project does exist
String projectName = projectText.getText();
-
+
IResource projectResource =
ResourcesPlugin.getWorkspace().getRoot().findMember(projectName);
if (!(projectResource instanceof IProject)) {
setErrorMessage("Project does not exist!");
return false;
}
-
+
// Descriptor must be set and valid file
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 =
getWorkspaceRoot().findMember(inputText.getText());
if (inputResource == null) {
setErrorMessage("Input resource must be an existing file or folder!");
return false;
}
-
+
// Validate the input encoding
if (plainTextButton.getSelection()) {
String inptuEncoding = encodingCombo.getText();
-
+
boolean isEncodingValid;
try {
isEncodingValid = Charset.isSupported(inptuEncoding);
- }
- catch (IllegalCharsetNameException e) {
+ } catch (IllegalCharsetNameException e) {
isEncodingValid = false;
}
-
+
if (!isEncodingValid) {
setErrorMessage("Invalid input format encoding!");
return false;
}
}
-
+
// Validate output folder
if (outputFolderText.getText().length() > 0) {
IResource outputResource =
getWorkspaceRoot().findMember(outputFolderText.getText());
@@ -469,41 +465,38 @@ public class AnalysisEngineMainTab extends JavaLaunchTab {
return false;
}
}
-
+
return super.isValid(launchConfig);
}
-
+
@Override
public void performApply(ILaunchConfigurationWorkingCopy config) {
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
(String) projectText.getText());
-
+
config.setAttribute(LauncherConstants.ATTR_DESCRIPTOR_NAME,
descriptorText.getText());
-
+
config.setAttribute(LauncherConstants.ATTR_INPUT_NAME,
inputText.getText());
config.setAttribute(LauncherConstants.ATTR_INPUT_RECURSIVELY_NAME,
- recursivelyButton.getSelection());
-
+ recursivelyButton.getSelection());
+
String formatName;
if (casButton.getSelection()) {
formatName = InputFormat.CAS.toString();
- }
- else if (plainTextButton.getSelection()) {
+ } else if (plainTextButton.getSelection()) {
formatName = InputFormat.PLAIN_TEXT.toString();
- }
- else {
+ } else {
throw new IllegalStateException("One button must always be selected!");
}
config.setAttribute(LauncherConstants.ATTR_INPUT_FORMAT_NAME, formatName);
-
+
config.setAttribute(LauncherConstants.ATTR_INPUT_ENCODING_NAME,
encodingCombo.getText());
-
+
config.setAttribute(LauncherConstants.ATTR_INPUT_LANGUAGE_NAME,
languageText.getText());
-
+
config.setAttribute(LauncherConstants.ATTR_OUTPUT_FOLDER_NAME,
outputFolderText.getText());
- config.setAttribute(LauncherConstants.ATTR_OUTPUT_CLEAR_NAME,
- clearFolderButton.getSelection());
+ config.setAttribute(LauncherConstants.ATTR_OUTPUT_CLEAR_NAME,
clearFolderButton.getSelection());
}
@Override
@@ -513,90 +506,92 @@ public class AnalysisEngineMainTab extends JavaLaunchTab {
config.setAttribute(LauncherConstants.ATTR_INPUT_LANGUAGE_NAME,
"x-unspecified");
config.setAttribute(LauncherConstants.ATTR_OUTPUT_CLEAR_NAME, false);
}
-
+
@Override
public void initializeFrom(ILaunchConfiguration config) {
-
+
// TODO: Log errors if reading fails?
-
+
// write values to launch configuration ...
try {
-
projectText.setText(config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
""));
+ projectText.setText(
+
config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""));
} catch (CoreException e) {
projectText.setText("");
}
-
+
try {
descriptorText.setText(config.getAttribute(LauncherConstants.ATTR_DESCRIPTOR_NAME,
""));
} catch (CoreException e) {
descriptorText.setText("");
}
-
+
try {
inputText.setText(config.getAttribute(LauncherConstants.ATTR_INPUT_NAME,
""));
} catch (CoreException e) {
inputText.setText("");
}
-
+
// recursive button
try {
- recursivelyButton.setSelection((Boolean) config.getAttribute(
- LauncherConstants.ATTR_INPUT_RECURSIVELY_NAME, false));
+ recursivelyButton.setSelection(
+ (Boolean)
config.getAttribute(LauncherConstants.ATTR_INPUT_RECURSIVELY_NAME, false));
} catch (CoreException e) {
recursivelyButton.setSelection(false);
}
-
+
// Format buttons
String formatName;
try {
- formatName =
config.getAttribute(LauncherConstants.ATTR_INPUT_FORMAT_NAME,
InputFormat.CAS.toString());
+ formatName =
config.getAttribute(LauncherConstants.ATTR_INPUT_FORMAT_NAME,
+ InputFormat.CAS.toString());
} catch (CoreException e) {
formatName = InputFormat.CAS.toString();
}
-
+
if (InputFormat.CAS.toString().equals(formatName)) {
casButton.setSelection(true);
- }
- else if (InputFormat.PLAIN_TEXT.toString().equals(formatName)) {
+ } else if (InputFormat.PLAIN_TEXT.toString().equals(formatName)) {
plainTextButton.setSelection(true);
encodingCombo.setEnabled(true);
languageText.setEnabled(true);
-
+
String language;
try {
language =
config.getAttribute(LauncherConstants.ATTR_INPUT_LANGUAGE_NAME,
"x-unspecified");
} catch (CoreException e) {
language = "x-unspecified";
}
-
+
languageText.setText(language);
}
-
+
// Always remember the input encoding, even so plain text is not selected,
// it might be convenient for the user
String inputEncoding = Charset.defaultCharset().displayName();
try {
- inputEncoding =
config.getAttribute(LauncherConstants.ATTR_INPUT_ENCODING_NAME, inputEncoding);
+ inputEncoding =
config.getAttribute(LauncherConstants.ATTR_INPUT_ENCODING_NAME,
+ inputEncoding);
} catch (CoreException e) {
}
-
+
encodingCombo.setText(inputEncoding);
-
+
// output folder
try {
outputFolderText.setText(config.getAttribute(LauncherConstants.ATTR_OUTPUT_FOLDER_NAME,
""));
} catch (CoreException e) {
outputFolderText.setText("");
}
-
+
// clear folder button
try {
- clearFolderButton.setSelection((Boolean) config.getAttribute(
- LauncherConstants.ATTR_OUTPUT_CLEAR_NAME, false));
+ clearFolderButton.setSelection(
+ (Boolean)
config.getAttribute(LauncherConstants.ATTR_OUTPUT_CLEAR_NAME, false));
} catch (CoreException e) {
clearFolderButton.setSelection(false);
}
-
+
super.initializeFrom(config);
}
}
diff --git
a/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/ui/AnalysisEngineTabGroup.java
b/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/ui/AnalysisEngineTabGroup.java
index b64ec0c..4976517 100644
---
a/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/ui/AnalysisEngineTabGroup.java
+++
b/uimaj-ep-launcher/src/main/java/org/apache/uima/ep_launcher/ui/AnalysisEngineTabGroup.java
@@ -30,26 +30,20 @@ import
org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
/**
- * The tab group to set up all the parameters which are necessary to run
- * an analysis engine.
+ * The tab group to set up all the parameters which are necessary to run an
analysis engine.
*/
public class AnalysisEngineTabGroup extends
AbstractLaunchConfigurationTabGroup {
@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
- ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
- new AnalysisEngineMainTab(),
- new JavaArgumentsTab(),
- new JavaJRETab(), // Java Runtime Environment
- new JavaClasspathTab(),
- // TODO: Error launch configuration does not support source
lookup, why not?
- // It should be on the tab.
- new SourceLookupTab(),
- new EnvironmentTab(),
- new CommonTab()
- };
-
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] { new
AnalysisEngineMainTab(),
+ new JavaArgumentsTab(), new JavaJRETab(), // Java Runtime Environment
+ new JavaClasspathTab(),
+ // TODO: Error launch configuration does not support source lookup,
why not?
+ // It should be on the tab.
+ new SourceLookupTab(), new EnvironmentTab(), new CommonTab() };
+
setTabs(tabs);
}
}