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/06 11:07:33 UTC
svn commit: r573192 - in /incubator/uima/sandbox/trunk/CasEditor: ./
META-INF/ src/main/java/org/apache/uima/caseditor/
src/main/java/org/apache/uima/caseditor/core/util/
src/main/java/org/apache/uima/caseditor/editor/
src/main/java/org/apache/uima/cas...
Author: twgoetz
Date: Thu Sep 6 02:07:32 2007
New Revision: 573192
URL: http://svn.apache.org/viewvc?rev=573192&view=rev
Log:
Jira UIMA-561, UIMA-562 and UIMA-471: apply patches UIMA-561.patch, UIMA-562.patch and UIMA-471.patch.
https://issues.apache.org/jira/browse/UIMA-561
https://issues.apache.org/jira/browse/UIMA-562
https://issues.apache.org/jira/browse/UIMA-471
Added:
incubator/uima/sandbox/trunk/CasEditor/UIMA Cas Editor plugin tests.launch
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/CorpusElementFilter.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/DocumentImportStructureProvider.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizard.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizardPage.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ts.xml
Removed:
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/FileDocumentProvider.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/FileEditorInput.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/FileEditorInputFactory.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/SimpleTextEditor.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/OpenAction.java
Modified:
incubator/uima/sandbox/trunk/CasEditor/META-INF/MANIFEST.MF
incubator/uima/sandbox/trunk/CasEditor/caseditor.product
incubator/uima/sandbox/trunk/CasEditor/plugin.xml
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ApplicationWorkbenchWindowAdvisor.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/util/Primitives.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/NlpPerspectiveFactory.java
incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/OpenActionGroup.java
Modified: incubator/uima/sandbox/trunk/CasEditor/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/META-INF/MANIFEST.MF?rev=573192&r1=573191&r2=573192&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/META-INF/MANIFEST.MF (original)
+++ incubator/uima/sandbox/trunk/CasEditor/META-INF/MANIFEST.MF Thu Sep 6 02:07:32 2007
@@ -1,22 +1,34 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: UIMA CAS Editor
-Bundle-SymbolicName: org.apache.uima.caseditor;singleton:=true
-Bundle-Version: 2.2.0.incubating-SNAPSHOOT
-Bundle-Activator: org.apache.uima.caseditor.CasEditorPlugin
-Eclipse-LazyStart: true
-Bundle-Vendor: The Apache Software Foundation
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Eclipse-RegisterBuddy: org.apache.uima.runtime
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.apache.uima.runtime,
- org.eclipse.ui.views.properties.tabbed,
- org.eclipse.ui,
- org.eclipse.ui.ide,
- org.eclipse.ui.workbench.texteditor,
- org.eclipse.pde.runtime,
- org.eclipse.jface.text,
- org.eclipse.core.filesystem,
- com.ibm.icu
-Bundle-ClassPath: ./target/classes
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: UIMA CAS Editor
+Bundle-SymbolicName: org.apache.uima.caseditor;singleton:=true
+Bundle-Version: 2.2.0.incubating-SNAPSHOOT
+Bundle-ClassPath: ./target/classes
+Bundle-Activator: org.apache.uima.caseditor.CasEditorPlugin
+Bundle-Vendor: The Apache Software Foundation
+Require-Bundle: org.eclipse.core.runtime,org.eclipse.core.resources,org.apache.uima.runtime,org.eclipse.ui.views.properties.tabbed,org.eclipse.ui,org.eclipse.ui.ide,org.eclipse.ui.workbench.texteditor,org.eclipse.pde.runtime,org.eclipse.jface.text,org.eclipse.core.filesystem,com.ibm.icu
+Eclipse-RegisterBuddy: org.apache.uima.runtime
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Eclipse-LazyStart: true
+Export-Package: org.apache.uima.caseditor,
+ org.apache.uima.caseditor.core,
+ org.apache.uima.caseditor.core.model,
+ org.apache.uima.caseditor.core.model.delta,
+ org.apache.uima.caseditor.core.model.dotcorpus,
+ org.apache.uima.caseditor.core.uima,
+ org.apache.uima.caseditor.core.util,
+ org.apache.uima.caseditor.editor,
+ org.apache.uima.caseditor.editor.action,
+ org.apache.uima.caseditor.editor.annotation,
+ org.apache.uima.caseditor.editor.context,
+ org.apache.uima.caseditor.editor.editview,
+ org.apache.uima.caseditor.editor.editview.validator,
+ org.apache.uima.caseditor.editor.fsview,
+ org.apache.uima.caseditor.editor.outline,
+ org.apache.uima.caseditor.ui,
+ org.apache.uima.caseditor.ui.action,
+ org.apache.uima.caseditor.ui.corpusview,
+ org.apache.uima.caseditor.ui.model,
+ org.apache.uima.caseditor.ui.property,
+ org.apache.uima.caseditor.ui.wizards,
+ org.apache.uima.caseditor.uima
Added: incubator/uima/sandbox/trunk/CasEditor/UIMA Cas Editor plugin tests.launch
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/UIMA%20Cas%20Editor%20plugin%20tests.launch?rev=573192&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/UIMA Cas Editor plugin tests.launch (added)
+++ incubator/uima/sandbox/trunk/CasEditor/UIMA Cas Editor plugin tests.launch Thu Sep 6 02:07:32 2007
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="false"/>
+<stringAttribute key="deselected_workspace_plugins" value="opennlp.uima,AAAAAAAAA,org.apache.uima.debug,opennlp.tools,org.apache.uima.pear,org.apache.uima.jcas.jcasgenp,org.apache.uima.desceditor"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/CasEditor"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=CasEditor/src\/plugintest\/java<org.apache.uima.caseditor.core.test"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="CasEditor"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+<stringAttribute key="selected_target_plugins" value="com.ibm.icu,com.ibm.icu36.data.update,javax.servlet,org.apache.commons.logging,org.apache.lucene,org.apache.lucene.analysis,org.eclipse.ant.core,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.databinding,org.eclipse.core.expressions,org.eclipse.core.filebuffers,org.eclipse.core.filesystem,org.eclipse.core.filesystem.macosx,org.eclipse.core.jobs,org.eclipse.core.net,org.eclipse.core.resources,org.eclipse.core.resources.compatibility,org.eclipse.core.runtime,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.core.variables,org.eclipse.equinox.app,org.eclipse.equinox.common,org.eclipse.equinox.http.jetty,org.eclipse.equinox.http.servlet,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.jdt.junit4.runtime,org.eclipse.jface,org.eclipse.jface.databinding,org.eclipse.jfac
e.text,org.eclipse.osgi,org.eclipse.osgi.services,org.eclipse.pde.runtime,org.eclipse.sdk,org.eclipse.swt,org.eclipse.swt.carbon.macosx,org.eclipse.text,org.eclipse.ui,org.eclipse.ui.carbon,org.eclipse.ui.cheatsheets,org.eclipse.ui.editors,org.eclipse.ui.forms,org.eclipse.ui.ide,org.eclipse.ui.ide.application,org.eclipse.ui.navigator,org.eclipse.ui.navigator.resources,org.eclipse.ui.views,org.eclipse.ui.views.properties.tabbed,org.eclipse.ui.workbench,org.eclipse.ui.workbench.texteditor,org.eclipse.update.configurator,org.eclipse.update.core,org.eclipse.update.ui,org.junit4,org.mortbay.jetty"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
Modified: incubator/uima/sandbox/trunk/CasEditor/caseditor.product
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/caseditor.product?rev=573192&r1=573191&r2=573192&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/caseditor.product (original)
+++ incubator/uima/sandbox/trunk/CasEditor/caseditor.product Thu Sep 6 02:07:32 2007
@@ -32,7 +32,6 @@
</win>
</launcher>
-
<vm>
<linux type="ee">J2SE-1.5</linux>
<macos type="ee">J2SE-1.5</macos>
@@ -49,6 +48,7 @@
<plugin id="org.eclipse.core.contenttype"/>
<plugin id="org.eclipse.core.databinding"/>
<plugin id="org.eclipse.core.expressions"/>
+ <plugin id="org.eclipse.core.filebuffers"/>
<plugin id="org.eclipse.core.filesystem"/>
<plugin id="org.eclipse.core.filesystem.linux.ppc" fragment="true"/>
<plugin id="org.eclipse.core.filesystem.linux.x86" fragment="true"/>
@@ -86,6 +86,7 @@
<plugin id="org.eclipse.text"/>
<plugin id="org.eclipse.ui"/>
<plugin id="org.eclipse.ui.carbon" fragment="true"/>
+ <plugin id="org.eclipse.ui.editors"/>
<plugin id="org.eclipse.ui.forms"/>
<plugin id="org.eclipse.ui.ide"/>
<plugin id="org.eclipse.ui.views"/>
Modified: incubator/uima/sandbox/trunk/CasEditor/plugin.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/plugin.xml?rev=573192&r1=573191&r2=573192&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/plugin.xml (original)
+++ incubator/uima/sandbox/trunk/CasEditor/plugin.xml Thu Sep 6 02:07:32 2007
@@ -107,7 +107,7 @@
project="true"/> -->
</extension>
- <!--
+
<extension point="org.eclipse.ui.importWizards">
<wizard
class="org.apache.uima.caseditor.ui.wizards.ImportDocumentWizard"
@@ -117,7 +117,6 @@
<description>Create a Document</description>
</wizard>
</extension>
- -->
<extension point="org.eclipse.ui.perspectives">
<perspective
@@ -210,11 +209,6 @@
contributorClass="org.apache.uima.caseditor.editor.AnnotationEditorActionContributor"
id="org.apache.uima.caseditor.editor" extensions="xcas">
</editor>
-
- <editor icon="icons/svgicons/document.png"
- class="org.apache.uima.caseditor.editor.SimpleTextEditor"
- name="Text Editor" id="org.apache.uima.caseditor.texteditor"
- default="true" />
</extension>
<extension point="org.eclipse.ui.editors.annotationTypes">
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ApplicationWorkbenchWindowAdvisor.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ApplicationWorkbenchWindowAdvisor.java?rev=573192&r1=573191&r2=573192&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ApplicationWorkbenchWindowAdvisor.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ApplicationWorkbenchWindowAdvisor.java Thu Sep 6 02:07:32 2007
@@ -6,9 +6,9 @@
* 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
@@ -35,13 +35,13 @@
public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
return new ApplicationActionBarAdvisor(configurer);
}
-
+
@Override
public void preWindowOpen() {
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
- configurer.setInitialSize(new Point(400, 300));
+ configurer.setInitialSize(new Point(900, 700));
configurer.setShowCoolBar(true);
configurer.setShowStatusLine(true);
configurer.setTitle("Cas Editor");
}
-}
+}
\ No newline at end of file
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/util/Primitives.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/util/Primitives.java?rev=573192&r1=573191&r2=573192&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/util/Primitives.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/util/Primitives.java Thu Sep 6 02:07:32 2007
@@ -113,6 +113,7 @@
* @param f
* @return true if primitive otherwise false
*/
+ @Deprecated
public static boolean isPrimitive(Feature f) {
if (f == null) {
throw new IllegalArgumentException();
@@ -127,6 +128,7 @@
* @param typeName
* @return true if primitive otherwise false.
*/
+ @Deprecated
public static boolean isPrimitive(String typeName) {
if (typeName == null) {
throw new IllegalArgumentException();
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java?rev=573192&r1=573191&r2=573192&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java Thu Sep 6 02:07:32 2007
@@ -6,7 +6,6 @@
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.caseditor.CasEditorPlugin;
-import org.apache.uima.caseditor.FileEditorInput;
import org.apache.uima.caseditor.core.model.DocumentElement;
import org.apache.uima.caseditor.core.model.INlpElement;
import org.apache.uima.caseditor.editor.annotation.EclipseAnnotationPeer;
@@ -21,19 +20,20 @@
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.IAnnotationModelListener;
+import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.AbstractDocumentProvider;
/**
- * Provides the {@link org.apache.uima.caseditor.core.IDocument} for
+ * Provides the {@link org.apache.uima.caseditor.core.IDocument} for
* the {@link AnnotationEditor}.
*/
public class CasDocumentProvider extends AbstractDocumentProvider {
/**
- * The method {@link #createDocument(Object)} put error status
+ * The method {@link #createDocument(Object)} put error status
* objects for the given element in this map, if something with document creation
- * goes wrong.
- *
+ * goes wrong.
+ *
* The method {@link #getStatus(Object)} can than retrive and return the status.
*/
private Map<Object, IStatus> mElementErrorStatus = new HashMap<Object, IStatus>();
@@ -41,9 +41,9 @@
@Override
protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
return new IAnnotationModel() {
-
+
private org.apache.uima.caseditor.core.IDocument mDocument;
-
+
public void addAnnotation(Annotation annotation, Position position) {
}
@@ -60,16 +60,16 @@
public Iterator getAnnotationIterator() {
return new Iterator() {
- private Iterator mAnnotations =
+ private Iterator mAnnotations =
mDocument.getCAS().getAnnotationIndex().iterator();
-
+
public boolean hasNext() {
return mAnnotations.hasNext();
}
public Object next() {
AnnotationFS annotation = (AnnotationFS) mAnnotations.next();
-
+
EclipseAnnotationPeer peer = new EclipseAnnotationPeer(annotation.getType().getName(), false, "");
peer.setAnnotation(annotation);
return peer;
@@ -81,8 +81,8 @@
public Position getPosition(Annotation annotation) {
EclipseAnnotationPeer peer = (EclipseAnnotationPeer) annotation;
- AnnotationFS annotationFS = peer.getAnnotationFS();
- return new Position(annotationFS.getBegin(),
+ AnnotationFS annotationFS = peer.getAnnotationFS();
+ return new Position(annotationFS.getBegin(),
annotationFS.getEnd() - annotationFS.getBegin());
}
@@ -93,41 +93,41 @@
}
};
}
-
+
/**
- * Creates the a new {@link AnnotationDocument} from the given {@link FileEditorInputOLD}
- * element. For all other elemetns null is returned.
+ * Creates the a new {@link AnnotationDocument} from the given {@link FileEditorInputOLD}
+ * element. For all other elements null is returned.
*/
@Override
protected IDocument createDocument(Object element) throws CoreException {
if (element instanceof FileEditorInput) {
FileEditorInput fileInput = (FileEditorInput) element;
-
+
IFile file = fileInput.getFile();
-
+
INlpElement nlpElement = CasEditorPlugin.getNlpModel().findMember(file);
-
+
if (nlpElement instanceof DocumentElement) {
try {
- org.apache.uima.caseditor.core.IDocument workingCopy =
+ org.apache.uima.caseditor.core.IDocument workingCopy =
((DocumentElement) nlpElement).getDocument();
-
+
AnnotationDocument document = new AnnotationDocument();
document.setProject(nlpElement.getNlpProject());
-
+
document.setDocument(workingCopy);
return document;
}
catch (CoreException e) {
- mElementErrorStatus.put(element, new Status(IStatus.INFO,
+ mElementErrorStatus.put(element, new Status(IStatus.INFO,
CasEditorPlugin.ID, IStatus.ERROR,
"There is a problem with the document: " + e.getMessage(), e));
}
}
else {
IStatus status;
-
+
if (nlpElement == null) {
status = new Status(IStatus.INFO, CasEditorPlugin.ID, IStatus.ERROR,
"Document not in a corpus folder!", null);
@@ -136,21 +136,21 @@
status = new Status(IStatus.INFO, CasEditorPlugin.ID, IStatus.ERROR,
"Not a cas document!", null);
}
-
+
mElementErrorStatus.put(element, status);
}
}
-
+
return null;
}
@Override
protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
fireElementStateChanging(element);
-
- org.apache.uima.caseditor.core.IDocument casDocument =
+
+ org.apache.uima.caseditor.core.IDocument casDocument =
(org.apache.uima.caseditor.core.IDocument) document;
-
+
try {
casDocument.save();
}
@@ -158,7 +158,7 @@
fireElementStateChangeFailed(element);
throw e;
}
-
+
fireElementDirtyStateChanged(element, false);
}
@@ -166,7 +166,7 @@
protected IRunnableContext getOperationRunner(IProgressMonitor monitor) {
return null;
}
-
+
@Override
public IStatus getStatus(Object element) {
IStatus status = mElementErrorStatus.get(element);
@@ -175,6 +175,6 @@
status = super.getStatus(element);
}
- return status;
+ return status;
}
}
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/NlpPerspectiveFactory.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/NlpPerspectiveFactory.java?rev=573192&r1=573191&r2=573192&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/NlpPerspectiveFactory.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/NlpPerspectiveFactory.java Thu Sep 6 02:07:32 2007
@@ -77,8 +77,6 @@
IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT,
0.19f, editorArea);
left.addView(CorpusExplorerView.ID);
- left.addView(CorpusExplorerView.ID + "s");
-
// right views
IFolderLayout right = layout.createFolder("right", IPageLayout.RIGHT,
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/OpenActionGroup.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/OpenActionGroup.java?rev=573192&r1=573191&r2=573192&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/OpenActionGroup.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/OpenActionGroup.java Thu Sep 6 02:07:32 2007
@@ -6,9 +6,9 @@
* 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
@@ -19,10 +19,14 @@
package org.apache.uima.caseditor.ui.corpusview;
+import org.eclipse.core.resources.IFile;
import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.actions.ActionGroup;
+import org.eclipse.ui.actions.OpenFileAction;
+import org.eclipse.ui.actions.OpenWithMenu;
/**
* The OpenActionGroup contains the Open Action.
@@ -37,16 +41,16 @@
/**
* The cached OpenFileAction instance.
*/
- private OpenAction mOpenFileAction;
+ private OpenFileAction mOpenFileAction;
/**
* Initializes a the current instance.
- *
+ *
* @param page
*/
OpenActionGroup(IWorkbenchPage page) {
mPage = page;
- mOpenFileAction = new OpenAction(mPage);
+ mOpenFileAction = new OpenFileAction(mPage);
}
@Override
@@ -56,6 +60,14 @@
mOpenFileAction.selectionChanged(selection);
menu.add(mOpenFileAction);
+
+ if (selection.size() == 1 && (selection.getFirstElement() instanceof IFile)) {
+
+ MenuManager submenu = new MenuManager("Open With");
+ submenu.add(new OpenWithMenu(mPage, (IFile) selection.getFirstElement()));
+
+ menu.add(submenu);
+ }
}
/**
Added: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/CorpusElementFilter.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/CorpusElementFilter.java?rev=573192&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/CorpusElementFilter.java (added)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/CorpusElementFilter.java Thu Sep 6 02:07:32 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+package org.apache.uima.caseditor.ui.wizards;
+
+import org.apache.uima.caseditor.core.model.CorpusElement;
+import org.apache.uima.caseditor.core.model.NlpProject;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+
+public class CorpusElementFilter extends ViewerFilter {
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+
+ boolean result;
+
+ if (element instanceof NlpProject) {
+ result = true;
+ }
+ else if (element instanceof CorpusElement) {
+ result = true;
+ } else {
+ result = false;
+ }
+
+ return result;
+ }
+}
Added: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/DocumentImportStructureProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/DocumentImportStructureProvider.java?rev=573192&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/DocumentImportStructureProvider.java (added)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/DocumentImportStructureProvider.java Thu Sep 6 02:07:32 2007
@@ -0,0 +1,216 @@
+/*
+ * 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.
+ */
+
+package org.apache.uima.caseditor.ui.wizards;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultStyledDocument;
+import javax.swing.text.StyledDocument;
+import javax.swing.text.rtf.RTFEditorKit;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.impl.XCASSerializer;
+import org.apache.uima.caseditor.core.TaeError;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.apache.uima.util.CasCreationUtils;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XMLInputSource;
+import org.apache.uima.util.XMLParser;
+import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
+import org.xml.sax.SAXException;
+
+/**
+ */
+final class DocumentImportStructureProvider implements IImportStructureProvider {
+
+ /**
+ * Constructs a new DocumentImportStructureProvider object.
+ *
+ * @param containerFullPath
+ */
+ public DocumentImportStructureProvider() {
+ }
+
+ public List getChildren(Object element) {
+ return null;
+ }
+
+ private static CAS createEmtpyCAS()
+ {
+ XMLInputSource xmlTypeSystemSource = new XMLInputSource(DocumentImportStructureProvider.class
+ .getResourceAsStream("ts.xml"), new File(""));
+ XMLParser xmlParser = UIMAFramework.getXMLParser();
+
+ TypeSystemDescription typeSystemDesciptor;
+
+ try {
+ typeSystemDesciptor = (TypeSystemDescription) xmlParser
+ .parse(xmlTypeSystemSource);
+ } catch (InvalidXMLException e1) {
+ throw new TaeError("Integrated ts.xml typesystem descriptor is not valid!");
+ }
+
+ try {
+ return CasCreationUtils.createCas(typeSystemDesciptor,
+ null, null);
+ } catch (ResourceInitializationException e) {
+
+ // should not happen
+ throw new TaeError("Unexpected exception!");
+ }
+ }
+
+ private InputStream getDocument(String text) {
+
+ CAS cas = createEmtpyCAS();
+ cas.setDocumentText(text);
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream(40000);
+
+ try {
+ XCASSerializer.serialize(cas, out);
+ } catch (SAXException e) {
+ // should not happen
+ throw new TaeError("Unexpected exception!", e);
+ } catch (IOException e) {
+ // will not happen, writing to memory
+ throw new TaeError("Unexpected exception!", e);
+ }
+
+ return new ByteArrayInputStream(out.toByteArray());
+ }
+
+ public InputStream getContents(Object element) {
+ File fileToImport = (File) element;
+
+ String fileName = fileToImport.getName();
+
+ if (fileName.endsWith(".rtf")) {
+ InputStream in = null;
+
+ try {
+ in = new FileInputStream((File) element);
+ String text = convert(in);
+
+ return getDocument(text);
+ } catch (FileNotFoundException e) {
+ return null;
+ } catch (IOException e) {
+ return null;
+ } finally {
+ try {
+ if (in != null) {
+ in.close();
+ }
+ } catch (IOException e) {
+ // sorry that this can happen
+ }
+ }
+
+ } else if (fileName.endsWith(".txt")) {
+ InputStream in = null;
+ try {
+ in = new FileInputStream((File) element);
+
+ StringBuffer textStringBuffer = new StringBuffer();
+
+ byte[] readBuffer = new byte[2048];
+
+ while (in.available() > 0) {
+ int length = in.read(readBuffer);
+
+ // TODO: ask the user for the correct encoding
+ textStringBuffer.append(new String(readBuffer, 0, length)); //, "UTF-8"));
+ }
+
+ return getDocument(textStringBuffer.toString());
+ } catch (FileNotFoundException e) {
+ return null;
+ } catch (IOException e) {
+ return null;
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // sorry that this can fail
+ }
+ }
+ }
+ } else {
+ try {
+ return new FileInputStream((File) element);
+ } catch (FileNotFoundException e) {
+ return null;
+ }
+ }
+ }
+
+ private String convert(InputStream rtfDocumentInputStream) throws IOException {
+ RTFEditorKit aRtfEditorkit = new RTFEditorKit();
+
+ StyledDocument styledDoc = new DefaultStyledDocument();
+
+ String textDocument;
+
+ try {
+ aRtfEditorkit.read(rtfDocumentInputStream, styledDoc, 0);
+
+ textDocument = styledDoc.getText(0, styledDoc.getLength());
+ } catch (BadLocationException e) {
+ throw new IOException("Error during parsing");
+ }
+
+ return textDocument;
+ }
+
+ public String getFullPath(Object element) {
+ return "";
+ }
+
+ public String getLabel(Object element) {
+ File fileToImport = (File) element;
+
+ String fileName = fileToImport.getName();
+
+ if (fileName.endsWith(".rtf") || fileName.endsWith(".txt")) {
+ int nameWithouEndingLength = fileName.lastIndexOf(".");
+ String nameWithouEnding = fileName.substring(0, nameWithouEndingLength);
+
+ return nameWithouEnding + ".xcas";
+ } else {
+ return fileName;
+ }
+ }
+
+ public boolean isFolder(Object element) {
+ return ((File) element).isDirectory();
+ }
+}
\ No newline at end of file
Added: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizard.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizard.java?rev=573192&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizard.java (added)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizard.java Thu Sep 6 02:07:32 2007
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+/*
+ * 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.
+ */
+
+package org.apache.uima.caseditor.ui.wizards;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.uima.caseditor.CasEditorPlugin;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IImportWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
+import org.eclipse.ui.wizards.datatransfer.ImportOperation;
+
+/**
+ * This import dialog can import text files into a corpus.
+ * Currently plain text and rich text format is supported.
+ */
+public final class ImportDocumentWizard extends Wizard implements IImportWizard
+{
+ private ImportDocumentWizardPage mMainPage;
+
+ private IStructuredSelection mCurrentResourceSelection;
+
+ private IWorkbench mWorkbench = null;
+
+ public void init(IWorkbench workbench, IStructuredSelection selection)
+ {
+ mWorkbench = workbench;
+ mCurrentResourceSelection = selection; // if corpus set as import corpus
+
+ setWindowTitle("Import Documents");
+ }
+
+ @Override
+ public void addPages()
+ {
+ mMainPage = new ImportDocumentWizardPage("ImportDocuments", mCurrentResourceSelection);
+
+ addPage(mMainPage);
+ }
+
+ @Override
+ public boolean performFinish()
+ {
+ IImportStructureProvider importProvider = new DocumentImportStructureProvider();
+
+ ImportOperation operation = new ImportOperation(mMainPage.getImportDestinationPath(),
+ importProvider, null, mMainPage.getFilesToImport());
+
+ operation.setContext(getShell());
+
+ operation.setOverwriteResources(false);
+
+ try {
+ getContainer().run(true, true, operation);
+ } catch (InvocationTargetException e) {
+ CasEditorPlugin.log(e);
+
+ MessageDialog.openError(getContainer().getShell(),
+ "Error during import", e.getMessage());
+
+ return false;
+ } catch (InterruptedException e) {
+ return false;
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
Added: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizardPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizardPage.java?rev=573192&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizardPage.java (added)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizardPage.java Thu Sep 6 02:07:32 2007
@@ -0,0 +1,286 @@
+/*
+ * 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.
+ */
+
+package org.apache.uima.caseditor.ui.wizards;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.uima.caseditor.CasEditorPlugin;
+import org.apache.uima.caseditor.core.model.CorpusElement;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+import org.eclipse.ui.model.BaseWorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+/**
+ * The main page of the ImportDocumentWizard.
+ */
+final class ImportDocumentWizardPage extends WizardPage {
+
+ private IPath importDestinationPath;
+
+ private TableViewer fileTable;
+
+ private CorpusElement corpusElement;
+
+ protected ImportDocumentWizardPage(String pageName,
+ IStructuredSelection currentResourceSelection) {
+ super(pageName);
+
+ setMessage("Please select the documents to import.");
+
+ if (!currentResourceSelection.isEmpty()) {
+ if (currentResourceSelection.getFirstElement() instanceof CorpusElement) {
+ corpusElement = (CorpusElement) currentResourceSelection.getFirstElement();
+ importDestinationPath = corpusElement.getResource().getFullPath();
+ }
+ }
+
+ setPageComplete(false);
+ }
+
+ private void computePageComplete() {
+ setPageComplete(importDestinationPath != null && fileTable.getTable().getItemCount() > 0);
+ }
+
+ public void createControl(Composite parent) {
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(3, false));
+
+ fileTable = new TableViewer(composite);
+ GridDataFactory.fillDefaults().grab(true, true).span(2, 4).applyTo(fileTable.getControl());
+
+ Button addButton = new Button(composite, SWT.PUSH);
+ addButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING));
+ addButton.setText("Add");
+ addButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // never called
+ }
+
+ /**
+ * Opens a file dialog and adds the selected files to the file table viewer.
+ */
+ public void widgetSelected(SelectionEvent e) {
+
+ // open a file dialog
+ FileDialog fd = new FileDialog(Display.getCurrent().getActiveShell(), SWT.MULTI);
+ fd.setText("Choose text files");
+ fd.setFilterExtensions(new String[] { "*.txt", "*.rtf" });
+
+ if (fd.open() != null) {
+ for (String fileItem : fd.getFileNames()) {
+ fileTable.add(new File(fd.getFilterPath() + File.separator + fileItem));
+ }
+
+ computePageComplete();
+ }
+ }
+ });
+
+ Button removeButton = new Button(composite, SWT.PUSH);
+ removeButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING));
+ removeButton.setText("Remove");
+ removeButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // never called
+ }
+
+ /**
+ * Removes selected elements from the file table viewer.
+ */
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) fileTable.getSelection();
+
+ Iterator seletionIterator = selection.iterator();
+
+ Object selectedElements[] = new Object[selection.size()];
+
+ for (int i = 0; i < selection.size(); i++) {
+ selectedElements[i] = seletionIterator.next();
+ }
+
+ fileTable.remove(selectedElements);
+
+ computePageComplete();
+ }
+ });
+
+ Button selectAllButton = new Button(composite, SWT.PUSH);
+ selectAllButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING));
+ selectAllButton.setText("Select All");
+ selectAllButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // never called
+ }
+
+ /**
+ * Selects all elements in the file table viewer.
+ */
+ public void widgetSelected(SelectionEvent e) {
+ fileTable.getTable().selectAll();
+ fileTable.setSelection(fileTable.getSelection());
+ }
+ });
+
+ Button deselectAllButton = new Button(composite, SWT.PUSH);
+ deselectAllButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING));
+ deselectAllButton.setText("Deselect All");
+ deselectAllButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // never called
+ }
+
+ /**
+ * Deselects all elements in the file table viewer.
+ */
+ public void widgetSelected(SelectionEvent e) {
+ fileTable.getTable().deselectAll();
+ fileTable.setSelection(fileTable.getSelection());
+ }
+ });
+
+ Label corpusFolderLabel = new Label(composite, SWT.NONE);
+ corpusFolderLabel.setText("Into corpus:");
+
+ final Text corpusText = new Text(composite, SWT.READ_ONLY | SWT.BORDER);
+ corpusText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ if (importDestinationPath != null) {
+ corpusText.setText(importDestinationPath.toString());
+ computePageComplete();
+ }
+
+ Button browseForCorpusFolder = new Button(composite, SWT.NONE);
+ browseForCorpusFolder.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING));
+ browseForCorpusFolder.setText("Browse");
+ browseForCorpusFolder.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // never called
+ }
+
+ /**
+ * Opens the corpus folder chooser dialog and shows the chosen dialog in the corpus folder
+ * text field.
+ */
+ public void widgetSelected(SelectionEvent e) {
+
+ final ElementTreeSelectionDialog folderSelectionDialog = new ElementTreeSelectionDialog(
+ getShell(), new DecoratingLabelProvider(new WorkbenchLabelProvider(), PlatformUI
+ .getWorkbench().getDecoratorManager().getLabelDecorator()),
+ new BaseWorkbenchContentProvider());
+
+ folderSelectionDialog.addFilter(new CorpusElementFilter());
+
+ if (corpusElement != null) {
+ folderSelectionDialog.setInitialSelection(corpusElement);
+ }
+
+ folderSelectionDialog.setInput(CasEditorPlugin.getNlpModel());
+
+ folderSelectionDialog.setTitle("Choose corpus");
+ folderSelectionDialog.setMessage("Please choose a corpus.");
+
+ folderSelectionDialog.setValidator(new ISelectionStatusValidator() {
+ public IStatus validate(Object[] selection) {
+
+ if (selection.length == 1 && selection[0] instanceof CorpusElement) {
+ return new Status(IStatus.OK, CasEditorPlugin.ID, 0, "", null);
+ }
+
+ return new Status(IStatus.ERROR, CasEditorPlugin.ID, 0, "Please select a corpus!", null);
+ }
+ });
+
+ folderSelectionDialog.open();
+
+ Object[] results = folderSelectionDialog.getResult();
+
+ if (results != null) {
+ // validator makes sure that one CorpusElement is selected
+ corpusElement = (CorpusElement) results[0];
+
+ IFolder corpusFolder = (IFolder) corpusElement.getResource();
+ importDestinationPath = corpusFolder.getFullPath();
+
+ corpusText.setText(importDestinationPath.toString());
+
+ computePageComplete();
+ }
+ }
+ });
+
+ setControl(composite);
+ }
+
+ /**
+ * Retrieves the import destination path.
+ *
+ * @return the path or null if none
+ */
+ IPath getImportDestinationPath() {
+ return importDestinationPath;
+ }
+
+ List<File> getFilesToImport() {
+
+ List<File> files = new ArrayList<File>(fileTable.getTable().getItemCount());
+
+ for (int i = 0; i < fileTable.getTable().getItemCount(); i++) {
+ files.add((File) fileTable.getElementAt(i));
+ }
+
+ return files;
+ }
+}
\ No newline at end of file
Added: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ts.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ts.xml?rev=573192&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ts.xml (added)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/wizards/ts.xml Thu Sep 6 02:07:32 2007
@@ -0,0 +1,29 @@
+<?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.
+-->
+
+<typeSystemDescription xmlns="http://uima.watson.ibm.com/resourceSpecifier">
+<name>DummyTypeSystem</name>
+<description></description>
+<version>1.0</version>
+<vendor></vendor>
+<types>
+</types>
+</typeSystemDescription>