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/06/28 14:21:31 UTC
svn commit: r1140560 - in /uima/uimaj/trunk:
uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePlugin.java
uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/CasEditorPlugin.java
Author: joern
Date: Tue Jun 28 12:21:30 2011
New Revision: 1140560
URL: http://svn.apache.org/viewvc?rev=1140560&view=rev
Log:
UIMA-2151 Moved Cas Editor Project migration logic to ide plugin
Modified:
uima/uimaj/trunk/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePlugin.java
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/CasEditorPlugin.java
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePlugin.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePlugin.java?rev=1140560&r1=1140559&r2=1140560&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePlugin.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePlugin.java Tue Jun 28 12:21:30 2011
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.uima.caseditor;
+package org.apache.uima.caseditor.ide;
import java.io.IOException;
import java.io.InputStream;
@@ -34,22 +34,19 @@ import org.eclipse.core.runtime.CoreExce
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* TODO: add javadoc here
*/
-public class CasEditorPlugin extends AbstractUIPlugin {
- public static final String ID = "org.apache.uima.caseditor";
-
- private static final String ICONS_PATH = "icons/";
+public class CasEditorIdePlugin extends AbstractUIPlugin {
+ public static final String ID = "org.apache.uima.caseditor.ide";
/**
* The shared instance.
*/
- private static CasEditorPlugin sPlugin;
+ private static CasEditorIdePlugin sPlugin;
/**
* Resource bundle.
@@ -62,7 +59,7 @@ public class CasEditorPlugin extends Abs
/**
* The constructor.
*/
- public CasEditorPlugin() {
+ public CasEditorIdePlugin() {
super();
sPlugin = this;
@@ -169,7 +166,7 @@ public class CasEditorPlugin extends Abs
*
* @return the TaePlugin
*/
- public static CasEditorPlugin getDefault() {
+ public static CasEditorIdePlugin getDefault() {
return sPlugin;
}
@@ -218,16 +215,6 @@ public class CasEditorPlugin extends Abs
public static void logError(String message) {
getDefault().getLog().log(new Status(IStatus.ERROR, ID, message));
}
-
- /**
- * Retrieves an image.
- *
- * @param image
- * @return the requested image if not available null
- */
- public static ImageDescriptor getTaeImageDescriptor(Images image) {
- return imageDescriptorFromPlugin(ID, ICONS_PATH + image.getPath());
- }
public boolean getAndClearShowMigrationDialogFlag() {
if (showMigrationDialog) {
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/CasEditorPlugin.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/CasEditorPlugin.java?rev=1140560&r1=1140559&r2=1140560&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/CasEditorPlugin.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/CasEditorPlugin.java Tue Jun 28 12:21:30 2011
@@ -19,20 +19,10 @@
package org.apache.uima.caseditor;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import org.apache.uima.caseditor.core.model.dotcorpus.DotCorpus;
-import org.apache.uima.caseditor.core.model.dotcorpus.DotCorpusSerializer;
-import org.apache.uima.caseditor.ui.property.TypeSystemLocationPropertyPage;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -55,9 +45,6 @@ public class CasEditorPlugin extends Abs
* Resource bundle.
*/
private ResourceBundle mResourceBundle;
-
-
- private boolean showMigrationDialog = false;
/**
* The constructor.
@@ -77,77 +64,6 @@ public class CasEditorPlugin extends Abs
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
-
- // Backward compatibility: Migrate old Cas Editor Projects
-
- // Scan for all Nlp nature projects
- IProject projects[] = ResourcesPlugin.getWorkspace().getRoot().getProjects();
-
- for (IProject project : projects) {
- // if nlp nature project
-
- if (project.isOpen() && project.hasNature("org.apache.uima.caseditor.NLPProject")) {
-
- // if ts property is not set ...
- String typeSystemLocation;
- try {
- typeSystemLocation = project.getPersistentProperty(new QualifiedName("",
- TypeSystemLocationPropertyPage.TYPE_SYSTEM_PROPERTY));
- } catch (CoreException e) {
- typeSystemLocation = null;
- }
-
- if (typeSystemLocation == null) {
- // 1. Read dotCorpus
- IFile dotCorpusFile = project.getFile(".corpus");
-
-
- if (dotCorpusFile.exists()) {
-
- InputStream dotCorpusIn = null;
-
- try {
- dotCorpusIn = dotCorpusFile.getContents();
- }
- catch (CoreException e) {
- log(e);
- }
-
- IFile typeSystemFile = null;
- if (dotCorpusIn != null) {
- try {
- DotCorpus dotCorpus = DotCorpusSerializer.parseDotCorpus(dotCorpusIn);
-
- if (dotCorpus.getTypeSystemFileName() != null)
- typeSystemFile = project.getFile(dotCorpus.getTypeSystemFileName());
- }
- finally {
- try {
- dotCorpusIn.close();
- }
- catch (IOException e) {
- log(e);
- }
- }
- }
-
- if (typeSystemFile != null && typeSystemFile.exists()) {
- // 2. Set type system file accordingly
- TypeSystemLocationPropertyPage.setTypeSystemLocation(project, typeSystemFile.getFullPath().toString());
-
- // 3. Try to copy dotCorpus file to type system location
- try {
- dotCorpusFile.copy(project.getFile(typeSystemFile.getParent().getProjectRelativePath() + "/"
- + ".style-" + typeSystemFile.getName()).getFullPath(), true, null);
- showMigrationDialog = true;
- } catch (CoreException e) {
- log(e);
- }
- }
- }
- }
- }
- }
}
/**
@@ -228,14 +144,4 @@ public class CasEditorPlugin extends Abs
public static ImageDescriptor getTaeImageDescriptor(Images image) {
return imageDescriptorFromPlugin(ID, ICONS_PATH + image.getPath());
}
-
- public boolean getAndClearShowMigrationDialogFlag() {
- if (showMigrationDialog) {
- showMigrationDialog = false;
- return true;
- }
-
- return false;
- }
-
}