You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by tw...@apache.org on 2007/09/14 13:48:32 UTC
svn commit: r575639 - in
/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor:
Application.java ui/action/CorporaCollectionReader.xml ui/action/DummyTAE.xml
Author: twgoetz
Date: Fri Sep 14 04:48:32 2007
New Revision: 575639
URL: http://svn.apache.org/viewvc?rev=575639&view=rev
Log:
Jira UIMA-565: apply UIMA-565.patch.
https://issues.apache.org/jira/browse/UIMA-565
Modified:
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/Application.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/CorporaCollectionReader.xml
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/DummyTAE.xml
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/Application.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/Application.java?rev=575639&r1=575638&r2=575639&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/Application.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/Application.java Fri Sep 14 04:48:32 2007
@@ -19,12 +19,19 @@
package org.apache.uima.caseditor;
+import java.io.File;
+import java.net.URL;
+
+import org.eclipse.core.runtime.Platform;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.ide.ChooseWorkspaceData;
+import org.eclipse.ui.internal.ide.ChooseWorkspaceDialog;
/**
* This class controls all aspects of the application's execution
@@ -38,23 +45,51 @@
Shell shell = new Shell(display, SWT.ON_TOP);
-// try {
-// if (!WorkspaceUtil.checkInstanceLocation(shell)) {
-// Platform.endSplash();
-// return EXIT_OK;
-// }
-// } finally {
-// if (shell != null) {
-// shell.dispose();
-// }
-// }
+ try {
+
+ Location instanceLocaction = Platform.getInstanceLocation();
+
+ if (instanceLocaction == null) {
+
+ // show an error to the user
+
+ Platform.endSplash();
+ return EXIT_OK;
+ }
+
+ if (instanceLocaction.isSet()) {
+ // everything is fine
+ } else {
+ ChooseWorkspaceData launchData = new ChooseWorkspaceData(instanceLocaction.getDefault());
+
+ new ChooseWorkspaceDialog(null, launchData, false, true).prompt(true);
+
+ String instancePath = launchData.getSelection();
+
+ File workspace = new File(instancePath);
+ if (!workspace.exists()) {
+ workspace.mkdir();
+ }
+
+ String path = workspace.getAbsolutePath().replace(File.separatorChar, '/');
+
+ URL candidateWorkspaceURL = new URL("file", null, path);
+
+ instanceLocaction.setURL(candidateWorkspaceURL, true);
+ launchData.writePersistedData();
+ }
+ } finally {
+ if (shell != null) {
+ shell.dispose();
+ }
+ }
try {
int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
if (returnCode != PlatformUI.RETURN_RESTART) {
return EXIT_OK;
}
-
+
// the OpenWorkspaceAction sets the PROP_EXIT_CODE before the restart
return EXIT_RELAUNCH.equals(Integer.getInteger(PROP_EXIT_CODE)) ? EXIT_RELAUNCH
: EXIT_RESTART;
@@ -65,5 +100,4 @@
public void stop() {
}
-
}
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/CorporaCollectionReader.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/CorporaCollectionReader.xml?rev=575639&r1=575638&r2=575639&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/CorporaCollectionReader.xml (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/CorporaCollectionReader.xml Fri Sep 14 04:48:32 2007
@@ -1,4 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
<collectionReaderDescription xmlns="http://uima.watson.ibm.com/resourceSpecifier">
<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
<implementationName>org.apache.uima.caseditor.uima.CorporaCollectionReader</implementationName>
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/DummyTAE.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/DummyTAE.xml?rev=575639&r1=575638&r2=575639&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/DummyTAE.xml (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/DummyTAE.xml Fri Sep 14 04:48:32 2007
@@ -1,4 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
<taeDescription xmlns="http://uima.watson.ibm.com/resourceSpecifier">
<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
<primitive>true</primitive>