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/08/12 12:28:19 UTC
svn commit: r1157036 [3/5] - in /uima/sandbox/trunk/TextMarker/uimaj-ep-cev:
./ .settings/ META-INF/ icons/ lib/ schema/ src/ src/main/ src/main/java/
src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/uima/
src/main/java/org/apache/...
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/CEVTypeOrderedRootTreeNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/CEVTypeOrderedRootTreeNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/CEVTypeTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/CEVTypeTreeNode.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/CEVTypeTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/CEVTypeTreeNode.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,54 @@
+/*
+ * 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.cev.data.tree;
+
+import org.apache.uima.cas.Type;
+
+public class CEVTypeTreeNode extends CEVAbstractTreeNode {
+
+ private Type type;
+
+ public CEVTypeTreeNode(Type type) {
+ this(null, type);
+ }
+
+ public CEVTypeTreeNode(ICEVTreeNode parent, Type type) {
+ super(parent);
+ this.type = type;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.cev.data.tree.ICEVTreeNode#getName()
+ */
+ public String getName() {
+ return type.getName();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.cev.data.tree.ICEVTreeNode#getType()
+ */
+ public Type getType() {
+ return type;
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/CEVTypeTreeNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/CEVTypeTreeNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVAnnotationNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVAnnotationNode.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVAnnotationNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVAnnotationNode.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,29 @@
+/*
+ * 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.cev.data.tree;
+
+import org.apache.uima.cas.text.AnnotationFS;
+
+
+public interface ICEVAnnotationNode {
+
+ AnnotationFS getAnnotation();
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVAnnotationNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVAnnotationNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVRootTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVRootTreeNode.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVRootTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVRootTreeNode.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,39 @@
+/*
+ * 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.cev.data.tree;
+
+import java.util.LinkedList;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+
+public interface ICEVRootTreeNode extends ICEVTreeNode {
+
+ public void insertFS(FeatureStructure annotation);
+
+ public LinkedList<ICEVTreeNode> getNodes();
+
+ public LinkedList<ICEVTreeNode> getNodes(Type type);
+
+ public LinkedList<ICEVTreeNode> getNodes(AnnotationFS annot);
+
+ public void sort();
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVRootTreeNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVRootTreeNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVTreeNode.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVTreeNode.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,47 @@
+/*
+ * 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.cev.data.tree;
+
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.uima.cas.Type;
+
+public interface ICEVTreeNode {
+
+ public void addChild(ICEVTreeNode child);
+
+ public ICEVTreeNode[] getChildren();
+
+ public Iterator<ICEVTreeNode> getChildrenIterator();
+
+ public String getName();
+
+ public ICEVTreeNode getParent();
+
+ public boolean hasChildren();
+
+ public Type getType();
+
+ public void getNodes(LinkedList<ICEVTreeNode> list);
+
+ public void sort(Comparator<ICEVTreeNode> cp);
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVTreeNode.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/data/tree/ICEVTreeNode.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/editor/CEVViewer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/editor/CEVViewer.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/editor/CEVViewer.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/editor/CEVViewer.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,614 @@
+/*
+ * 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.cev.editor;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cev.CEVPlugin;
+import org.apache.uima.cev.artifactViewer.ArtifactModifier;
+import org.apache.uima.cev.data.CEVData;
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.data.ICEVAnnotationListener;
+import org.apache.uima.cev.extension.ICEVArtifactViewer;
+import org.apache.uima.cev.extension.ICEVArtifactViewerFactory;
+import org.apache.uima.cev.extension.ICEVEditor;
+import org.apache.uima.cev.extension.ICEVEditorFactory;
+import org.apache.uima.cev.extension.ICEVSearchStrategy;
+import org.apache.uima.cev.extension.ICEVView;
+import org.apache.uima.cev.extension.ICEVViewFactory;
+import org.apache.uima.cev.preferences.CEVPreferenceConstants;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.tools.stylemap.StyleMapEntry;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XmlCasSerializer;
+import org.eclipse.core.internal.resources.Resource;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.MultiPageEditorPart;
+import org.xml.sax.SAXException;
+
+public class CEVViewer extends MultiPageEditorPart implements IResourceChangeListener,
+ ICEVAnnotationListener, MouseListener, SelectionListener {
+
+ private CTabFolder[] folderArray;
+
+ private CEVDocument casDocument;
+
+ private CEVData activeCASData;
+
+ private boolean dirty;
+
+ private Map<Class<?>, ICEVView> views;
+
+ private Map<Class<?>, ICEVEditor> editors;
+
+ private Map<Class<?>, ICEVViewFactory> viewAdapter;
+
+ private Map<Class<?>, ICEVEditorFactory> editorAdapter;
+
+ private List<ICEVSearchStrategy> searchStrategies;
+
+ private List<ICEVArtifactViewerFactory> artifactViewerFactories;
+
+ private FileEditorInput inputFile;
+
+ private Map<Integer, List<ICEVArtifactViewer>> casViews;
+
+ private List<Type> initialVisibleTypes;
+
+ public CEVViewer() {
+ super();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
+ dirty = false;
+ views = new HashMap<Class<?>, ICEVView>();
+ editors = new HashMap<Class<?>, ICEVEditor>();
+ viewAdapter = CEVPlugin.getViewAdapters();
+ editorAdapter = CEVPlugin.getEditorAdapters();
+ searchStrategies = CEVPlugin.getSearchStrategies();
+ artifactViewerFactories = CEVPlugin.getArtifactViewerFactories();
+ }
+
+ @Override
+ protected void createPages() {
+ if (casDocument == null) {
+ return;
+ }
+ folderArray = new CTabFolder[casDocument.count()];
+ casViews = new HashMap<Integer, List<ICEVArtifactViewer>>();
+ int index = 0;
+ for (CEVData each : casDocument.getCASData()) {
+ CTabFolder folder = new CTabFolder(getContainer(), SWT.BOTTOM | SWT.FLAT);
+ folder.addSelectionListener(this);
+ addPage(index, folder);
+ setPageText(index, each.getViewName());
+ folderArray[index] = folder;
+ ArrayList<ICEVArtifactViewer> artifactViewerListOfFolder = new ArrayList<ICEVArtifactViewer>();
+ casViews.put(index, artifactViewerListOfFolder);
+ for (ICEVArtifactViewerFactory eachFactory : artifactViewerFactories) {
+ if (eachFactory.isAble(each.getCAS())) {
+ CTabItem tabItem = new CTabItem(folder, SWT.NONE);
+ try {
+ ICEVArtifactViewer artifactViewer = eachFactory.createArtifactViewer(this, tabItem,
+ each);
+ artifactViewerListOfFolder.add(artifactViewer);
+ } catch (PartInitException e) {
+ CEVPlugin.error(e);
+ }
+ }
+ }
+ folder.setSelection(0);
+ index++;
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.MultiPageEditorPart#dispose()
+ */
+ @Override
+ public void dispose() {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ if (casViews != null) {
+ for (List<ICEVArtifactViewer> eachList : casViews.values()) {
+ for (ICEVArtifactViewer each : eachList) {
+ if (each != null) {
+ each.dispose();
+ }
+ }
+ }
+ casViews.clear();
+ }
+ if (casDocument != null) {
+ casDocument.dispose();
+ casDocument = null;
+ }
+ super.dispose();
+ }
+
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ CAS newCas = casDocument.getMainCas();
+ List<ArtifactModifier> modifiers = new ArrayList<ArtifactModifier>();
+ for (Integer eachIndex : casViews.keySet()) {
+ for (ICEVArtifactViewer each : casViews.get(eachIndex)) {
+ if (each instanceof ArtifactModifier) {
+ modifiers.add((ArtifactModifier) each);
+ }
+ }
+ }
+ if (!modifiers.isEmpty()) {
+ try {
+ newCas = casDocument.createCas();
+ } catch (ResourceInitializationException e) {
+ CEVPlugin.error(e);
+ } catch (InvalidXMLException e) {
+ CEVPlugin.error(e);
+ }
+
+ org.apache.uima.util.CasCopier.copyCas(casDocument.getMainCas(), newCas, false);
+ for (Integer eachIndex : casViews.keySet()) {
+ for (ICEVArtifactViewer each : casViews.get(eachIndex)) {
+ if (each instanceof ArtifactModifier) {
+ ArtifactModifier am = (ArtifactModifier) each;
+ am.modifyCas(casDocument, newCas, eachIndex);
+ }
+ }
+ }
+ }
+ try {
+ IFile iFile = ((FileEditorInput) getEditorInput()).getFile();
+ File file = iFile.getLocation().toFile();
+ XmlCasSerializer.serialize(newCas, new FileOutputStream(file));
+ iFile.getParent().refreshLocal(Resource.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch (Exception e) {
+ CEVPlugin.error(e);
+ }
+ setDirty(false);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.EditorPart#doSaveAs()
+ */
+ @Override
+ public void doSaveAs() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.MultiPageEditorPart#init(org.eclipse.ui.IEditorSite,
+ * org.eclipse.ui.IEditorInput)
+ */
+ @Override
+ public void init(IEditorSite site, final IEditorInput editorInput) throws PartInitException {
+ if (!(editorInput instanceof FileEditorInput))
+ throw new PartInitException("Invalid Input: Must be IFileEditorInput");
+ super.init(site, editorInput);
+
+ setPartName(((FileEditorInput) editorInput).getName());
+
+ createCAS((FileEditorInput) editorInput);
+ if (casDocument != null) {
+ for (CEVData casData : casDocument.getCASData()) {
+ casData.addAnnotationListener(CEVViewer.this);
+
+ }
+ }
+
+ initialVisibleTypes = new ArrayList<Type>();
+ if (casDocument != null) {
+ Map<String, StyleMapEntry> styleMap = casDocument.getStyleMap();
+ if (styleMap != null) {
+ for (Entry<String, StyleMapEntry> each : styleMap.entrySet()) {
+ Type type = casDocument.getMainCas().getTypeSystem().getType(each.getKey());
+ if (type != null) {
+ initialVisibleTypes.add(type);
+ }
+ }
+ }
+ }
+ }
+
+ private void closeEditor() {
+ getSite().getPage().closeEditor(CEVViewer.this, false);
+ }
+
+ private void createCAS(FileEditorInput inputFile) throws PartInitException {
+ this.inputFile = inputFile;
+ try {
+ IFile file = null;
+ for (ICEVSearchStrategy each : searchStrategies) {
+ try {
+ file = each.searchDescriptor(inputFile.getFile());
+ } catch (Exception e) {
+ }
+ if (file != null) {
+ break;
+ }
+ }
+ if (file != null) {
+ casDocument = new CEVDocument(file, inputFile.getFile());
+ }
+ } catch (IllegalArgumentException e) {
+ throw new PartInitException(e.getMessage());
+ } catch (IOException e) {
+ throw new PartInitException(e.getMessage());
+ } catch (InvalidXMLException e) {
+ throw new PartInitException(e.getMessage());
+ } catch (SAXException e) {
+ throw new PartInitException(e.getMessage());
+ } catch (ResourceInitializationException e) {
+ throw new PartInitException(e.getMessage());
+ }
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IEditorPart.
+ */
+ @Override
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.MultiPageEditorPart#isDirty()
+ */
+ @Override
+ public boolean isDirty() {
+ return dirty;
+ }
+
+ public void setDirty(boolean dirty) {
+ this.dirty = dirty;
+ firePropertyChange(PROP_DIRTY);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.MultiPageEditorPart#pageChange(int)
+ */
+ @Override
+ protected void pageChange(int newPageIndex) {
+ super.pageChange(newPageIndex);
+
+ activeCASData = casDocument.getCASData(newPageIndex);
+
+ for (List<ICEVArtifactViewer> eachList : casViews.values()) {
+ for (ICEVArtifactViewer each : eachList) {
+ each.viewChanged(activeCASData);
+ }
+ }
+ for (ICEVView each : views.values()) {
+ each.viewChanged(newPageIndex);
+ }
+ for (ICEVEditor each : editors.values()) {
+ each.viewChanged(newPageIndex);
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org
+ * .eclipse.core.resources.IResourceChangeEvent)
+ */
+ public void resourceChanged(final IResourceChangeEvent event) {
+ IPreferenceStore store = CEVPlugin.getDefault().getPreferenceStore();
+ boolean reload = store.getBoolean(CEVPreferenceConstants.P_AUTO_REFRESH);
+ if (reload) {
+ IResourceDelta findInDelta = findInDelta(event.getDelta(), inputFile.getFile().getFullPath());
+ if (findInDelta != null) {
+
+ final CEVViewer t = this;
+ Display display = Display.getCurrent();
+ if (display == null) {
+ // [FIXME] get correct display or replace code
+
+ display = getEditorSite().getWorkbenchWindow().getShell().getDisplay();
+ // display = activeText.getDisplay();
+ if (display == null) {
+ display = getActiveEditor().getSite().getShell().getDisplay();
+ }
+ }
+ display.asyncExec(new Runnable() {
+ public void run() {
+
+ int page = getActivePage();
+ if (casDocument != null) {
+ for (CEVData casData : casDocument.getCASData()) {
+ casData.removeAnnotationListener(t);
+ }
+ }
+ try {
+ init(getEditorSite(), inputFile);
+ } catch (PartInitException e) {
+ CEVPlugin.error(e);
+ }
+
+ for (ICEVView each : views.values()) {
+ each.casChanged(casDocument);
+ }
+ for (ICEVEditor each : editors.values()) {
+ each.casChanged(casDocument);
+ }
+ pageChange(page);
+ }
+ });
+ }
+ }
+ }
+
+ private IResourceDelta findInDelta(IResourceDelta delta, IPath target) {
+ if (delta.getFullPath().equals(target)) {
+ return delta;
+ } else {
+ for (IResourceDelta each : delta.getAffectedChildren(IResourceDelta.CHANGED)) {
+ IResourceDelta findInDelta = findInDelta(each, target);
+ if (findInDelta != null) {
+ return findInDelta;
+ }
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.MultiPageEditorPart#getAdapter(java.lang.Class)
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class required) {
+
+ if (viewAdapter.containsKey(required)) {
+ ICEVView view = null;
+ if (views.containsKey(required)) {
+ view = views.get(required);
+ } else {
+ ICEVViewFactory viewFactory = viewAdapter.get(required);
+ view = viewFactory.createView(this, casDocument, getActivePage());
+ if (view != null) {
+ views.put(required, view);
+ }
+ }
+ return view;
+ }
+
+ if (editorAdapter.containsKey(required)) {
+ ICEVEditor editor = null;
+ if (editors.containsKey(required)) {
+ editor = editors.get(required);
+ } else {
+ ICEVEditorFactory editorFactory = editorAdapter.get(required);
+ editor = editorFactory.createEditor(this, casDocument, getActivePage());
+ if (editor != null) {
+ editors.put(required, editor);
+ }
+ }
+ return editor;
+ }
+
+ return super.getAdapter(required);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.uniwue.casviewer.data.ICASAnnotationStateListener#annotationStateChanged
+ * (org.apache.uima.cas.Type)
+ */
+ public void annotationStateChanged(Type type) {
+ int activePage = getActivePage();
+ int selectionIndex = folderArray[activePage].getSelectionIndex();
+ ICEVArtifactViewer viewer = getSelectedViewer(activePage, selectionIndex);
+ viewer.annotationStateChanged(type);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.uniwue.casviewer.data.ICASAnnotationStateListener#annotationStateChanged
+ * (org.apache.uima.cas.text.AnnotationFS)
+ */
+ public void annotationStateChanged(AnnotationFS annot) {
+ int activePage = getActivePage();
+ int selectionIndex = folderArray[activePage].getSelectionIndex();
+ ICEVArtifactViewer viewer = getSelectedViewer(activePage, selectionIndex);
+ viewer.annotationStateChanged();
+ }
+
+ private ICEVArtifactViewer getSelectedViewer(int folderIndex, int tabIndex) {
+ List<ICEVArtifactViewer> list = casViews.get(folderIndex);
+ ICEVArtifactViewer viewer = list.get(tabIndex);
+ return viewer;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt .events.MouseEvent)
+ */
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events .MouseEvent)
+ */
+ public void mouseDown(MouseEvent event) {
+
+ // TODO add this functionality again:
+ int activePage = getActivePage();
+ int selectionIndex = folderArray[activePage].getSelectionIndex();
+ ICEVArtifactViewer viewer = getSelectedViewer(activePage, selectionIndex);
+ if (event.button == 3) {
+ // showPopup();
+ } else {
+ try {
+ int offsetAtLocation = viewer.getOffsetAtLocation(new Point(event.x, event.y));
+ if (offsetAtLocation >= 0) {
+ showSelection(offsetAtLocation);
+ }
+ } catch (Exception e) {
+ }
+ }
+ // if (selectionIndex == plainTextIndex[activePage]) {
+ // try {
+ // showSelection(activeText.getOffsetAtLocation(new Point(event.x, event.y)));
+ // } catch (Exception e) {
+ // }
+ // } else if (event.button == 3)
+ // showPopup();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events. MouseEvent)
+ */
+ public void mouseUp(MouseEvent event) {
+ int activePage = getActivePage();
+ int selectionIndex = folderArray[activePage].getSelectionIndex();
+ ICEVArtifactViewer viewer = getSelectedViewer(activePage, selectionIndex);
+ IPreferenceStore store = CEVPlugin.getDefault().getPreferenceStore();
+ boolean selectOnly = store.getBoolean(CEVPreferenceConstants.P_SELECT_ONLY);
+ if (event.button == 1 && (selectOnly || (event.stateMask & SWT.ALT) != 0)) {
+ Point selection = viewer.getViewerSelectionRange();
+ for (ICEVEditor each : editors.values()) {
+ each.textSelected(selection.x, selection.x + selection.y);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.uniwue.casviewer.data.ICASAnnotationColorListener#colorChanged(org
+ * .apache.uima.cas.Type)
+ */
+ public void colorChanged(Type type) {
+ annotationStateChanged(type);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.cev.data.ICEVAnnotationListener#annotationAdded(org.apache
+ * .uima.cas.text.AnnotationFS)
+ */
+ public void annotationsAdded(List<AnnotationFS> annots) {
+ setDirty(true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.cev.data.ICEVAnnotationListener#annotationRemoved(org.apache
+ * .uima.cas.text.AnnotationFS)
+ */
+ public void annotationsRemoved(List<AnnotationFS> annots) {
+ setDirty(true);
+ }
+
+ public void moveToAnnotation(AnnotationFS annot) {
+ int activePage = getActivePage();
+ int selectionIndex = folderArray[activePage].getSelectionIndex();
+ ICEVArtifactViewer viewer = getSelectedViewer(activePage, selectionIndex);
+ viewer.moveToAnnotation(annot);
+
+ }
+
+ public void showSelection(int pos) {
+ for (ICEVView each : views.values()) {
+ each.newSelection(pos);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse
+ * .swt.events.SelectionEvent)
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
+ * .events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent e) {
+ int activePage = getActivePage();
+ int selectionIndex = folderArray[activePage].getSelectionIndex();
+ ICEVArtifactViewer viewer = getSelectedViewer(activePage, selectionIndex);
+ viewer.viewerWidgetSelected();
+ }
+
+ public void handleViewerPropertyChange(int propertyId) {
+ handlePropertyChange(propertyId);
+ }
+
+ public List<Type> getInitialVisibleTypes() {
+ return initialVisibleTypes;
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/editor/CEVViewer.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/editor/CEVViewer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/editor/CEVViewerContributor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/editor/CEVViewerContributor.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/editor/CEVViewerContributor.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/editor/CEVViewerContributor.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,48 @@
+/*
+ * 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.cev.editor;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class CEVViewerContributor extends MultiPageEditorActionBarContributor {
+
+ private IEditorPart activeEditorPart;
+
+ public CEVViewerContributor() {
+ super();
+ }
+
+ protected IAction getAction(ITextEditor editor, String actionID) {
+ return (editor == null ? null : editor.getAction(actionID));
+ }
+
+ /*
+ * (non-JavaDoc) Method declared in AbstractMultiPageEditorActionBarContributor.
+ */
+ @Override
+ public void setActivePage(IEditorPart part) {
+ if (activeEditorPart == part)
+ return;
+ activeEditorPart = part;
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/editor/CEVViewerContributor.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/editor/CEVViewerContributor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/AbstractArtifactViewerFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/AbstractArtifactViewerFactory.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/AbstractArtifactViewerFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/AbstractArtifactViewerFactory.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,35 @@
+/*
+ * 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.cev.extension;
+
+public abstract class AbstractArtifactViewerFactory implements ICEVArtifactViewerFactory {
+
+ private int priority;
+
+ public int getPriority() {
+ return priority;
+ }
+
+ public void setPriority(int priority) {
+ this.priority = priority;
+
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/AbstractArtifactViewerFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/AbstractArtifactViewerFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVArtifactViewer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVArtifactViewer.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVArtifactViewer.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVArtifactViewer.java Fri Aug 12 10:28:15 2011
@@ -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.cev.extension;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cev.data.CEVData;
+import org.eclipse.swt.graphics.Point;
+
+public interface ICEVArtifactViewer {
+
+ void annotationStateChanged(Type type);
+
+ void annotationStateChanged();
+
+ Point getViewerSelectionRange();
+
+ void dispose();
+
+ void viewerWidgetSelected();
+
+ void moveToAnnotation(AnnotationFS annot);
+
+ void viewChanged(CEVData casData);
+
+ int getOffsetAtLocation(Point point);
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVArtifactViewer.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVArtifactViewer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVArtifactViewerFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVArtifactViewerFactory.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVArtifactViewerFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVArtifactViewerFactory.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,40 @@
+/*
+ * 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.cev.extension;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cev.data.CEVData;
+import org.apache.uima.cev.editor.CEVViewer;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.ui.PartInitException;
+
+
+public interface ICEVArtifactViewerFactory {
+
+ ICEVArtifactViewer createArtifactViewer(CEVViewer viewer, CTabItem tabItem, CEVData casData)
+ throws PartInitException;
+
+ void setPriority(int priority);
+
+ int getPriority();
+
+ boolean isAble(CAS cas);
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVArtifactViewerFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVArtifactViewerFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVEditor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVEditor.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVEditor.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVEditor.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,26 @@
+/*
+ * 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.cev.extension;
+
+public interface ICEVEditor extends ICEVExtension {
+
+ void textSelected(int start, int end);
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVEditor.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVEditor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVEditorFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVEditorFactory.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVEditorFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVEditorFactory.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,30 @@
+/*
+ * 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.cev.extension;
+
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.editor.CEVViewer;
+
+public interface ICEVEditorFactory {
+
+ ICEVEditor createEditor(CEVViewer viewer, CEVDocument cevDocument, int index);
+
+ Class<?> getAdapterInterface();
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVEditorFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVEditorFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVExtension.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVExtension.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVExtension.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVExtension.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,30 @@
+/*
+ * 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.cev.extension;
+
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.data.ICEVAnnotationListener;
+
+public interface ICEVExtension extends ICEVAnnotationListener {
+
+ void viewChanged(int newIndex);
+
+ void casChanged(CEVDocument casDocument);
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVExtension.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVExtension.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVSearchStrategy.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVSearchStrategy.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVSearchStrategy.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVSearchStrategy.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,30 @@
+/*
+ * 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.cev.extension;
+
+import org.eclipse.core.resources.IFile;
+
+
+public interface ICEVSearchStrategy {
+
+ IFile searchDescriptor(IFile file);
+
+ int getPriority();
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVSearchStrategy.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVSearchStrategy.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVSearchStrategyFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVSearchStrategyFactory.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVSearchStrategyFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVSearchStrategyFactory.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,26 @@
+/*
+ * 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.cev.extension;
+
+public interface ICEVSearchStrategyFactory {
+
+ ICEVSearchStrategy createSearchStrategy(int priority);
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVSearchStrategyFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVSearchStrategyFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVView.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVView.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVView.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVView.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,26 @@
+/*
+ * 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.cev.extension;
+
+import org.apache.uima.cev.data.ICEVAnnotationSelectionListener;
+
+public interface ICEVView extends ICEVExtension, ICEVAnnotationSelectionListener {
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVView.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVView.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVViewFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVViewFactory.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVViewFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVViewFactory.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,30 @@
+/*
+ * 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.cev.extension;
+
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.editor.CEVViewer;
+
+public interface ICEVViewFactory {
+
+ ICEVView createView(CEVViewer viewer, CEVDocument cevDocument, int index);
+
+ Class<?> getAdapterInterface();
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVViewFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/extension/ICEVViewFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVAnnotationFilterEditor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVAnnotationFilterEditor.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVAnnotationFilterEditor.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVAnnotationFilterEditor.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,78 @@
+/*
+ * 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.cev.preferences;
+
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.preference.ListEditor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
+public class CEVAnnotationFilterEditor extends ListEditor {
+
+ public CEVAnnotationFilterEditor(String name, String labelText, Composite parent) {
+ super(name, labelText, parent);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.ListEditor#createList(java.lang.String[])
+ */
+ @Override
+ protected String createList(String[] items) {
+ StringBuffer strBuffer = new StringBuffer();
+
+ for (int i = 0; i < items.length; i++) {
+ strBuffer.append(items[i]);
+ if (i < items.length - 1)
+ strBuffer.append('|');
+ }
+
+ return strBuffer.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.ListEditor#getNewInputObject()
+ */
+ @Override
+ protected String getNewInputObject() {
+ InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(), "Annotation Type",
+ "Enter Annotation Type Name", null, null);
+ if (dlg.open() == Window.OK) {
+ return dlg.getValue();
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.ListEditor#parseString(java.lang.String)
+ */
+ @Override
+ protected String[] parseString(String stringList) {
+ return stringList.split("\\|");
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVAnnotationFilterEditor.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVAnnotationFilterEditor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVPreferenceConstants.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVPreferenceConstants.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVPreferenceConstants.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVPreferenceConstants.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,51 @@
+/*
+ * 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.cev.preferences;
+
+public class CEVPreferenceConstants {
+
+ public static final String P_ANNOTATION_FILTER = "annotationFilter";
+
+ public static final String P_ANNOTATION_REPR = "annotationRpr";
+
+ public static final String P_ANNOTATION_REPR_HTML = "html";
+
+ public static final String P_ANNOTATION_REPR_TEXT = "text";
+
+ public static final String[][] P_ANNOTATION_REPR_VALUES = new String[][] {
+ { "&HTML", P_ANNOTATION_REPR_HTML }, { "&Text", P_ANNOTATION_REPR_TEXT } };
+
+ public static final String P_ANNOTATION_BROWSER_TREE_ORDER = "annotationBrowserTreeOrder";
+
+ public static final String P_ANNOTATION_BROWSER_TREE_ORDER_TYPE = "type";
+
+ public static final String P_ANNOTATION_BROWSER_TREE_ORDER_ANNOT = "annot";
+
+ public static final String[][] P_ANNOTATION_BROWSER_TREE_ORDER_VALUE = new String[][] {
+ { "&Type Ordered", P_ANNOTATION_BROWSER_TREE_ORDER_TYPE },
+ { "&Annotation Ordered", P_ANNOTATION_BROWSER_TREE_ORDER_ANNOT } };
+
+ public static final String P_ANNOTATION_EDITOR_TRIM = "trim";
+
+ public static final String P_AUTO_REFRESH = "autoRefresh";
+
+ public static final String P_SELECT_ONLY = "selectOnly";
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVPreferenceConstants.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVPreferenceConstants.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVPreferenceInitializer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVPreferenceInitializer.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVPreferenceInitializer.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVPreferenceInitializer.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,49 @@
+/*
+ * 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.cev.preferences;
+
+import org.apache.uima.cev.CEVPlugin;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+public class CEVPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
+ * initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = CEVPlugin.getDefault().getPreferenceStore();
+
+ store.setDefault(CEVPreferenceConstants.P_ANNOTATION_REPR,
+ CEVPreferenceConstants.P_ANNOTATION_REPR_TEXT);
+
+ store.setDefault(CEVPreferenceConstants.P_ANNOTATION_BROWSER_TREE_ORDER,
+ CEVPreferenceConstants.P_ANNOTATION_BROWSER_TREE_ORDER_TYPE);
+
+ store.setDefault(CEVPreferenceConstants.P_ANNOTATION_EDITOR_TRIM, true);
+ store.setDefault(CEVPreferenceConstants.P_AUTO_REFRESH, true);
+ store.setDefault(CEVPreferenceConstants.P_SELECT_ONLY, false);
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVPreferenceInitializer.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVPreferenceInitializer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVViewerAnnotationFilterPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVViewerAnnotationFilterPreferencePage.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVViewerAnnotationFilterPreferencePage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVViewerAnnotationFilterPreferencePage.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,49 @@
+/*
+ * 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.cev.preferences;
+
+import org.apache.uima.cev.CEVPlugin;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class CEVViewerAnnotationFilterPreferencePage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+
+ public CEVViewerAnnotationFilterPreferencePage() {
+ super(GRID);
+ setPreferenceStore(CEVPlugin.getDefault().getPreferenceStore());
+ }
+
+ @Override
+ public void createFieldEditors() {
+ addField(new CEVAnnotationFilterEditor(CEVPreferenceConstants.P_ANNOTATION_FILTER,
+ "Annotation Types", getFieldEditorParent()));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVViewerAnnotationFilterPreferencePage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVViewerAnnotationFilterPreferencePage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVViewerTreeViewPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVViewerTreeViewPreferencePage.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVViewerTreeViewPreferencePage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVViewerTreeViewPreferencePage.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,66 @@
+/*
+ * 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.cev.preferences;
+
+import org.apache.uima.cev.CEVPlugin;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.RadioGroupFieldEditor;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class CEVViewerTreeViewPreferencePage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+
+ public CEVViewerTreeViewPreferencePage() {
+ super(GRID);
+ setPreferenceStore(CEVPlugin.getDefault().getPreferenceStore());
+ }
+
+ @Override
+ public void createFieldEditors() {
+ RadioGroupFieldEditor editor = new RadioGroupFieldEditor(
+ CEVPreferenceConstants.P_ANNOTATION_BROWSER_TREE_ORDER,
+ "Default tree order for the Annotation Browser", 1,
+ CEVPreferenceConstants.P_ANNOTATION_BROWSER_TREE_ORDER_VALUE, getFieldEditorParent());
+ addField(editor);
+ editor.setEnabled(false, getFieldEditorParent());
+
+ addField(new RadioGroupFieldEditor(CEVPreferenceConstants.P_ANNOTATION_REPR,
+ "Default annotation representation in Annotation Browser and Selection Browser", 1,
+ CEVPreferenceConstants.P_ANNOTATION_REPR_VALUES, getFieldEditorParent()));
+ addField(new BooleanFieldEditor(CEVPreferenceConstants.P_ANNOTATION_EDITOR_TRIM,
+ "Trim selected text in annotation editor", getFieldEditorParent()));
+ addField(new BooleanFieldEditor(CEVPreferenceConstants.P_AUTO_REFRESH, "Reload changed CAS",
+ getFieldEditorParent()));
+ addField(new BooleanFieldEditor(CEVPreferenceConstants.P_SELECT_ONLY,
+ "Initiate the creation of annotations with the selection of text",
+ getFieldEditorParent()));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVViewerTreeViewPreferencePage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/preferences/CEVViewerTreeViewPreferencePage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/AllXmlInProjectStrategy.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/AllXmlInProjectStrategy.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/AllXmlInProjectStrategy.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/AllXmlInProjectStrategy.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,103 @@
+/*
+ * 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.cev.searchStrategy;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.uima.cev.extension.ICEVSearchStrategy;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.dialogs.ListDialog;
+
+public class AllXmlInProjectStrategy implements ICEVSearchStrategy {
+
+ private int priority;
+
+ public AllXmlInProjectStrategy(int priority) {
+ super();
+ this.priority = priority;
+ }
+
+ public int getPriority() {
+ return priority;
+ }
+
+ public IFile searchDescriptor(IFile file) {
+ IProject project = file.getProject();
+ try {
+ List<IFile> list = collectTypeSystems(project);
+ if (list.size() == 1) {
+ return list.get(0);
+ }
+ Collections.sort(list, new IFileComparator());
+ ListDialog ld = new ListDialog(Display.getCurrent().getActiveShell());
+ ld.setContentProvider(new CEVCollectionContentProvider<LinkedList<IFile>>());
+ ld.setLabelProvider(new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ return ((IFile) element).getName();
+ }
+ });
+ if (list == null || list.isEmpty()) {
+ return null;
+ }
+
+ ld.setTitle("Select Type System Descriptor");
+ ld.setInput(list);
+ ld.open();
+
+ if (ld.getResult() != null) {
+ return (IFile) ld.getResult()[0];
+ } else {
+ return null;
+ }
+ } catch (Exception e) {
+ return null;
+ }
+
+ }
+
+ private List<IFile> collectTypeSystems(IContainer folder) throws CoreException {
+ List<IFile> result = new ArrayList<IFile>();
+ for (IResource each : folder.members()) {
+ if (each instanceof IContainer) {
+ result.addAll(collectTypeSystems((IContainer) each));
+ } else {
+ String fileExtension = each.getFileExtension();
+ if (each instanceof IFile
+ && fileExtension != null
+ && fileExtension.equals("xml")
+ && !each.getFullPath().removeFileExtension().lastSegment().toLowerCase()
+ .endsWith("stylemap")) {
+ result.add((IFile) each);
+ }
+ }
+ }
+ return result;
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/AllXmlInProjectStrategy.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/AllXmlInProjectStrategy.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/AllXmlInProjectStrategyFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/AllXmlInProjectStrategyFactory.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/AllXmlInProjectStrategyFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/AllXmlInProjectStrategyFactory.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,31 @@
+/*
+ * 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.cev.searchStrategy;
+
+import org.apache.uima.cev.extension.ICEVSearchStrategy;
+import org.apache.uima.cev.extension.ICEVSearchStrategyFactory;
+
+public class AllXmlInProjectStrategyFactory implements ICEVSearchStrategyFactory {
+
+ public ICEVSearchStrategy createSearchStrategy(int priority) {
+ return new AllXmlInProjectStrategy(priority);
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/AllXmlInProjectStrategyFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/AllXmlInProjectStrategyFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/CEVCollectionContentProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/CEVCollectionContentProvider.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/CEVCollectionContentProvider.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/CEVCollectionContentProvider.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,55 @@
+/*
+ * 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.cev.searchStrategy;
+
+import java.util.Collection;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+public class CEVCollectionContentProvider<T extends Collection<?>> implements
+ IStructuredContentProvider {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ return ((T) inputElement).toArray();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
+ * java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/CEVCollectionContentProvider.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/CEVCollectionContentProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/IFileComparator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/IFileComparator.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/IFileComparator.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/IFileComparator.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,35 @@
+/*
+ * 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.cev.searchStrategy;
+
+import java.util.Comparator;
+
+import org.eclipse.core.resources.IFile;
+
+public class IFileComparator implements Comparator<IFile> {
+
+ @Override
+ public int compare(IFile o1, IFile o2) {
+ if (o1 == null || o2 == null)
+ return 0;
+ return o1.getName().compareTo(o2.getName());
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/IFileComparator.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/IFileComparator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/SelectInFolderStrategy.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/SelectInFolderStrategy.java?rev=1157036&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/SelectInFolderStrategy.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/SelectInFolderStrategy.java Fri Aug 12 10:28:15 2011
@@ -0,0 +1,86 @@
+/*
+ * 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.cev.searchStrategy;
+
+import java.util.Collections;
+import java.util.LinkedList;
+
+import org.apache.uima.cev.extension.ICEVSearchStrategy;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.dialogs.ListDialog;
+
+
+public class SelectInFolderStrategy implements ICEVSearchStrategy {
+
+ private int priority;
+
+ public SelectInFolderStrategy(int priority) {
+ super();
+ this.priority = priority;
+ }
+
+ public IFile searchDescriptor(IFile file) {
+ LinkedList<IFile> files = new LinkedList<IFile>();
+ try {
+ for (IResource r : file.getParent().members()) {
+ if (r.getType() == IResource.FILE
+ && r.getFullPath().getFileExtension().toLowerCase().equals("xml")
+ && !r.getFullPath().removeFileExtension().lastSegment().toLowerCase().endsWith(
+ "stylemap"))
+ files.add((IFile) r);
+ }
+ } catch (CoreException e) {
+ return null;
+ }
+ if (files.isEmpty()) {
+ return null;
+ }
+ if (files.size() == 1) {
+ return files.get(0);
+ }
+ Collections.sort(files, new IFileComparator());
+ ListDialog ld = new ListDialog(Display.getCurrent().getActiveShell());
+ ld.setContentProvider(new CEVCollectionContentProvider<LinkedList<IFile>>());
+ ld.setLabelProvider(new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ return ((IFile) element).getName();
+ }
+ });
+ ld.setTitle("Select Type System Descriptor");
+ ld.setInput(files);
+ ld.open();
+
+ if (ld.getResult() != null) {
+ return (IFile) ld.getResult()[0];
+ } else {
+ return null;
+ }
+ }
+
+ public int getPriority() {
+ return priority;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/SelectInFolderStrategy.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-cev/src/main/java/org/apache/uima/cev/searchStrategy/SelectInFolderStrategy.java
------------------------------------------------------------------------------
svn:mime-type = text/plain