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 13:14:21 UTC
svn commit: r1157050 [3/11] - in
/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons: ./ .settings/
META-INF/ icons/ 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/o...
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamTableLabelProvider.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamTableLabelProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamView.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamView.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamView.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamView.java Fri Aug 12 11:14:14 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.textmarker.explain.basic;
+
+import org.apache.uima.cev.views.CEVPageBookView;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class BasicTokenStreamView extends CEVPageBookView {
+
+ public BasicTokenStreamView() {
+ super();
+
+ }
+
+ @Override
+ protected PageRec doCreatePage(IWorkbenchPart part) {
+
+ return doCreatePage(part, IBasicTokenStreamViewPage.class);
+
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamView.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamView.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamViewFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamViewFactory.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamViewFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamViewFactory.java Fri Aug 12 11:14:14 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.textmarker.explain.basic;
+
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.editor.CEVViewer;
+import org.apache.uima.cev.extension.ICEVView;
+import org.apache.uima.cev.extension.ICEVViewFactory;
+
+public class BasicTokenStreamViewFactory implements ICEVViewFactory {
+
+ public BasicTokenStreamViewFactory() {
+ }
+
+ public ICEVView createView(CEVViewer viewer, CEVDocument cevDocument, int index) {
+ return new BasicTokenStreamViewPage(viewer, cevDocument, index);
+ }
+
+ public Class<?> getAdapterInterface() {
+ return IBasicTokenStreamViewPage.class;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamViewFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamViewFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamViewPage.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamViewPage.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,147 @@
+/*
+ * 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.textmarker.explain.basic;
+
+import java.util.List;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cev.data.CEVData;
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.editor.CEVViewer;
+import org.apache.uima.cev.extension.ICEVView;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.part.Page;
+
+
+public class BasicTokenStreamViewPage extends Page implements IBasicTokenStreamViewPage, ICEVView,
+ IDoubleClickListener {
+
+ private TableViewer tableViewer;
+
+ private CEVViewer casViewer;
+
+ private CEVDocument casDoc;
+
+ private int current = 0;
+
+ private BasicTokenStreamTableContentProvider provider;
+
+ public BasicTokenStreamViewPage(CEVViewer casViewer, CEVDocument casDoc, int index) {
+ this.casDoc = casDoc;
+ this.casViewer = casViewer;
+ this.current = index;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ tableViewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL
+ | SWT.FULL_SELECTION);
+ provider = new BasicTokenStreamTableContentProvider(getCurrentCEVData());
+ tableViewer.setContentProvider(provider);
+ BasicTokenStreamTableLabelProvider columnLabels = new BasicTokenStreamTableLabelProvider();
+ columnLabels.createColumns(tableViewer);
+ // Set the header to visible
+ tableViewer.getTable().setHeaderVisible(true);
+ // Set the line of the table visible
+ tableViewer.getTable().setLinesVisible(true);
+ tableViewer.setInput(getSite());
+ tableViewer.addDoubleClickListener(this);
+ }
+
+ @Override
+ public Control getControl() {
+ return tableViewer.getControl();
+ }
+
+ public CEVData getCurrentCEVData() {
+ return casDoc.getCASData(current);
+ }
+
+ @Override
+ public void setFocus() {
+ tableViewer.getControl().setFocus();
+ }
+
+ public TableViewer getViewer() {
+ return this.tableViewer;
+ }
+
+ public void newSelection(int offset) {
+ Object obj = getElementAt(offset);
+ StructuredSelection selection = new StructuredSelection(obj);
+ tableViewer.setSelection(selection, true);
+ }
+
+ private Object getElementAt(int offset) {
+ if (provider != null) {
+ return provider.getEntryAt(offset);
+ }
+ return null;
+ }
+
+ public void viewChanged(int newIndex) {
+ getCurrentCEVData().removeAnnotationListener(this);
+ current = newIndex;
+ getCurrentCEVData().addAnnotationListener(this);
+ provider.init(getCurrentCEVData());
+ tableViewer.refresh();
+ }
+
+ public void annotationsAdded(List<AnnotationFS> annots) {
+
+ }
+
+ public void annotationsRemoved(List<AnnotationFS> annots) {
+
+ }
+
+ public void annotationStateChanged(Type type) {
+
+ }
+
+ public void annotationStateChanged(AnnotationFS annot) {
+
+ }
+
+ public void colorChanged(Type type) {
+
+ }
+
+ public void doubleClick(DoubleClickEvent event) {
+ if (event.getSelection() != null && event.getSelection() instanceof IStructuredSelection) {
+ Object entry = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ if (entry instanceof BasicTokenEntry) {
+ casViewer.moveToAnnotation(((BasicTokenEntry) entry).getAnnotation());
+ }
+ }
+ }
+
+ public void casChanged(CEVDocument casDocument) {
+ this.casDoc = casDocument;
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamViewPage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/BasicTokenStreamViewPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/IBasicTokenStreamViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/IBasicTokenStreamViewPage.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/IBasicTokenStreamViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/IBasicTokenStreamViewPage.java Fri Aug 12 11:14:14 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.textmarker.explain.basic;
+
+import org.apache.uima.cev.views.ICEVViewPage;
+
+public interface IBasicTokenStreamViewPage extends ICEVViewPage {
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/IBasicTokenStreamViewPage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/basic/IBasicTokenStreamViewPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementTreeContentProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementTreeContentProvider.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementTreeContentProvider.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementTreeContentProvider.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,63 @@
+/*
+ * 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.textmarker.explain.element;
+
+import org.apache.uima.textmarker.explain.tree.IExplainTreeNode;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+public class ElementTreeContentProvider implements ITreeContentProvider {
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IExplainTreeNode) {
+ IExplainTreeNode debugNode = (IExplainTreeNode) parentElement;
+ return debugNode.getChildren().toArray();
+ }
+ return null;
+ }
+
+ public Object getParent(Object element) {
+ if (element instanceof IExplainTreeNode) {
+ return ((IExplainTreeNode) element).getParent();
+ }
+ return null;
+
+ }
+
+ public Object[] getElements(Object element) {
+ return getChildren(element);
+ }
+
+ public boolean hasChildren(Object parentElement) {
+ if (parentElement instanceof IExplainTreeNode) {
+ IExplainTreeNode debugNode = (IExplainTreeNode) parentElement;
+ return debugNode.hasChildren();
+ }
+ return false;
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementTreeContentProvider.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementTreeContentProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementTreeLabelProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementTreeLabelProvider.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementTreeLabelProvider.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementTreeLabelProvider.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,97 @@
+/*
+ * 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.textmarker.explain.element;
+
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.textmarker.explain.ExplainConstants;
+import org.apache.uima.textmarker.explain.tree.ConditionNode;
+import org.apache.uima.textmarker.explain.tree.ExplainTree;
+import org.apache.uima.textmarker.explain.tree.IExplainTreeNode;
+import org.apache.uima.textmarker.explain.tree.RuleElementMatchNode;
+import org.apache.uima.textmarker.explain.tree.RuleElementMatchesNode;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+public class ElementTreeLabelProvider extends LabelProvider implements ILabelProvider {
+
+ private ElementViewPage owner;
+
+ public ElementTreeLabelProvider(ElementViewPage owner) {
+ super();
+ this.owner = owner;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof RuleElementMatchNode) {
+ RuleElementMatchNode rem = (RuleElementMatchNode) element;
+ boolean matched = rem.matched();
+ return owner.getImage(ExplainConstants.RULE_ELEMENT_MATCH_TYPE + matched);
+ } else if (element instanceof RuleElementMatchesNode) {
+ RuleElementMatchesNode rems = (RuleElementMatchesNode) element;
+ boolean matched = rems.matched();
+ return owner.getImage(ExplainConstants.RULE_ELEMENT_MATCHES_TYPE + matched);
+ } else if (element instanceof ConditionNode) {
+ ConditionNode rems = (ConditionNode) element;
+ boolean matched = rems.matched();
+ return owner.getImage(ExplainConstants.EVAL_CONDITION_TYPE + matched);
+ }
+ return owner.getImage("element");
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IExplainTreeNode) {
+ IExplainTreeNode debugNode = (IExplainTreeNode) element;
+ TypeSystem ts = debugNode.getTypeSystem();
+
+ if (element instanceof RuleElementMatchesNode) {
+ Type type = ts.getType(ExplainConstants.RULE_ELEMENT_MATCHES_TYPE);
+ FeatureStructure fs = debugNode.getFeatureStructure();
+ Feature f = type.getFeatureByBaseName(ExplainTree.ELEMENT);
+ if (f != null) {
+ String v = fs.getStringValue(f);
+ return v;
+ }
+ } else if (element instanceof RuleElementMatchNode) {
+ FeatureStructure fs = debugNode.getFeatureStructure();
+ if (fs instanceof AnnotationFS) {
+ String s = ((AnnotationFS) fs).getCoveredText();
+ s = s.replaceAll("[\\n\\r]", "");
+ return s;
+ }
+ } else if (element instanceof ConditionNode) {
+ Type type = ts.getType(ExplainConstants.EVAL_CONDITION_TYPE);
+ FeatureStructure fs = debugNode.getFeatureStructure();
+ Feature f = type.getFeatureByBaseName(ExplainTree.ELEMENT);
+ if (f != null) {
+ String v = fs.getStringValue(f);
+ return v;
+ }
+ }
+ }
+ return element.toString();
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementTreeLabelProvider.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementTreeLabelProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementView.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementView.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementView.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementView.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,37 @@
+/*
+ * 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.textmarker.explain.element;
+
+import org.apache.uima.cev.views.CEVPageBookView;
+import org.eclipse.ui.IWorkbenchPart;
+
+
+public class ElementView extends CEVPageBookView {
+
+ public ElementView() {
+ super();
+ }
+
+ @Override
+ protected PageRec doCreatePage(IWorkbenchPart part) {
+ return doCreatePage(part, IElementViewPage.class);
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementView.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementView.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementViewFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementViewFactory.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementViewFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementViewFactory.java Fri Aug 12 11:14:14 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.textmarker.explain.element;
+
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.editor.CEVViewer;
+import org.apache.uima.cev.extension.ICEVView;
+import org.apache.uima.cev.extension.ICEVViewFactory;
+
+public class ElementViewFactory implements ICEVViewFactory {
+
+ public ElementViewFactory() {
+ }
+
+ public ICEVView createView(CEVViewer viewer, CEVDocument cevDocument, int index) {
+ return new ElementViewPage(viewer, cevDocument, index);
+ }
+
+ public Class<?> getAdapterInterface() {
+ return IElementViewPage.class;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementViewFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementViewFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementViewPage.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementViewPage.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,217 @@
+/*
+ * 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.textmarker.explain.element;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cev.data.CEVData;
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.data.tree.ICEVAnnotationNode;
+import org.apache.uima.cev.editor.CEVViewer;
+import org.apache.uima.cev.extension.ICEVView;
+import org.apache.uima.textmarker.addons.TextMarkerAddonsPlugin;
+import org.apache.uima.textmarker.explain.ExplainConstants;
+import org.apache.uima.textmarker.explain.tree.IExplainTreeNode;
+import org.apache.uima.textmarker.explain.tree.RuleElementRootNode;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.part.Page;
+
+public class ElementViewPage extends Page implements IElementViewPage, ICEVView,
+ IDoubleClickListener {
+
+ private IExplainTreeNode node;
+
+ // private CheckboxTreeViewer treeView;
+ private TreeViewer treeView;
+
+ private CEVDocument casDoc;
+
+ private int current;
+
+ private CEVViewer casViewer;
+
+ private Map<String, Image> images;
+
+ public ElementViewPage(CEVViewer casViewer, CEVDocument casDoc, int index) {
+ super();
+ this.casViewer = casViewer;
+ this.casDoc = casDoc;
+ this.current = index;
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ if (images != null) {
+ for (Image each : images.values()) {
+ each.dispose();
+ }
+ }
+ }
+
+ private void initImages() {
+ images = new HashMap<String, Image>();
+ ImageDescriptor desc;
+ Image image;
+ String name;
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/chart_organisation_add.png");
+ image = desc.createImage();
+ name = ExplainConstants.RULE_ELEMENT_MATCHES_TYPE + "true";
+ images.put(name, image);
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/chart_organisation_delete.png");
+ image = desc.createImage();
+ name = ExplainConstants.RULE_ELEMENT_MATCHES_TYPE + "false";
+ images.put(name, image);
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/chart_organisation_delete.png");
+ image = desc.createImage();
+ name = "element";
+ images.put(name, image);
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/font_add.png");
+ image = desc.createImage();
+ name = ExplainConstants.RULE_ELEMENT_MATCH_TYPE + "true";
+ images.put(name, image);
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/font_delete.png");
+ image = desc.createImage();
+ name = ExplainConstants.RULE_ELEMENT_MATCH_TYPE + "false";
+ images.put(name, image);
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/accept.png");
+ image = desc.createImage();
+ name = ExplainConstants.EVAL_CONDITION_TYPE + "true";
+ images.put(name, image);
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/cancel.png");
+ image = desc.createImage();
+ name = ExplainConstants.EVAL_CONDITION_TYPE + "false";
+ images.put(name, image);
+
+ }
+
+ public Image getImage(String name) {
+ if (images == null) {
+ initImages();
+ }
+ return images.get(name);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ // treeView = new CheckboxTreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL
+ // | SWT.V_SCROLL);
+ treeView = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
+ treeView.setContentProvider(new ElementTreeContentProvider());
+ treeView.setLabelProvider(new ElementTreeLabelProvider(this));
+ treeView.setInput(node);
+ // treeView.addCheckStateListener(getCurrentCEVData());
+ treeView.addDoubleClickListener(this);
+ }
+
+ public void doubleClick(DoubleClickEvent event) {
+ if (event.getSelection() != null && event.getSelection() instanceof ITreeSelection) {
+ Object treeNode = ((ITreeSelection) event.getSelection()).getFirstElement();
+ if (treeNode instanceof ICEVAnnotationNode) {
+ casViewer.moveToAnnotation(((ICEVAnnotationNode) treeNode).getAnnotation());
+ }
+ }
+ }
+
+ public CEVData getCurrentCEVData() {
+ return casDoc.getCASData(current);
+ }
+
+ @Override
+ public Control getControl() {
+ return treeView.getControl();
+ }
+
+ @Override
+ public void setFocus() {
+ treeView.getControl().setFocus();
+ }
+
+ public void inputChange(Object newInput) {
+ if (treeView == null) {
+ return;
+ }
+ Object oldInput = treeView.getInput();
+ if ((oldInput == null && newInput == null) || (oldInput != null && oldInput.equals(newInput)))
+ return;
+
+ if (newInput != null && newInput instanceof RuleElementRootNode) {
+ treeView.setInput(newInput);
+ treeView.expandAll();
+ treeView.refresh();
+ } else {
+ treeView.setInput(null);
+ }
+ }
+
+ public void viewChanged(int newIndex) {
+ getCurrentCEVData().removeAnnotationListener(this);
+ current = newIndex;
+ getCurrentCEVData().addAnnotationListener(this);
+ inputChange(null);
+ }
+
+ public void annotationsAdded(List<AnnotationFS> annots) {
+
+ }
+
+ public void annotationsRemoved(List<AnnotationFS> annots) {
+
+ }
+
+ public void annotationStateChanged(Type type) {
+
+ }
+
+ public void annotationStateChanged(AnnotationFS annot) {
+
+ }
+
+ public void colorChanged(Type type) {
+
+ }
+
+ public void newSelection(int offset) {
+
+ }
+
+ public void casChanged(CEVDocument casDocument) {
+ this.casDoc = casDocument;
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementViewPage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/ElementViewPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/IElementViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/IElementViewPage.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/IElementViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/IElementViewPage.java Fri Aug 12 11:14:14 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.textmarker.explain.element;
+
+import org.apache.uima.cev.views.ICEVViewPage;
+
+public interface IElementViewPage extends ICEVViewPage {
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/IElementViewPage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/element/IElementViewPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedTreeContentProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedTreeContentProvider.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedTreeContentProvider.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedTreeContentProvider.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,69 @@
+/*
+ * 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.textmarker.explain.failed;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.textmarker.explain.tree.IExplainTreeNode;
+import org.apache.uima.textmarker.explain.tree.RuleMatchNode;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+public class FailedTreeContentProvider implements ITreeContentProvider {
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IExplainTreeNode) {
+ List<Object> result = new ArrayList<Object>();
+ IExplainTreeNode debugNode = (IExplainTreeNode) parentElement;
+ for (IExplainTreeNode each : debugNode.getChildren()) {
+ if (each instanceof RuleMatchNode) {
+ result.add(each);
+ }
+ }
+ return result.toArray();
+ }
+ return null;
+ }
+
+ public Object getParent(Object element) {
+ if (element instanceof IExplainTreeNode) {
+ return ((IExplainTreeNode) element).getParent();
+ }
+ return null;
+
+ }
+
+ public Object[] getElements(Object element) {
+ return getChildren(element);
+ }
+
+ public boolean hasChildren(Object parentElement) {
+ return false;
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedTreeContentProvider.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedTreeContentProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedTreeLabelProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedTreeLabelProvider.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedTreeLabelProvider.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedTreeLabelProvider.java Fri Aug 12 11:14:14 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.textmarker.explain.failed;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.textmarker.explain.tree.RuleMatchNode;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+
+public class FailedTreeLabelProvider extends LabelProvider implements ILabelProvider {
+
+ private FailedViewPage owner;
+
+ public FailedTreeLabelProvider(FailedViewPage owner) {
+ super();
+ this.owner = owner;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof RuleMatchNode) {
+ RuleMatchNode ruleMatchNode = (RuleMatchNode) element;
+ FeatureStructure fs = ruleMatchNode.getFeatureStructure();
+ if (fs != null) {
+ String name = fs.getType().getName();
+ return owner.getImage(name);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof RuleMatchNode) {
+ RuleMatchNode debugNode = (RuleMatchNode) element;
+ FeatureStructure fs = debugNode.getFeatureStructure();
+ if (fs != null) {
+ String s = ((AnnotationFS) fs).getCoveredText();
+ s = s.replaceAll("[\\n\\r]", "");
+ return s;
+ }
+ }
+
+ return element.toString();
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedTreeLabelProvider.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedTreeLabelProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedView.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedView.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedView.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedView.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,37 @@
+/*
+ * 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.textmarker.explain.failed;
+
+import org.apache.uima.cev.views.CEVPageBookView;
+import org.eclipse.ui.IWorkbenchPart;
+
+
+public class FailedView extends CEVPageBookView {
+
+ public FailedView() {
+ super();
+ }
+
+ @Override
+ protected PageRec doCreatePage(IWorkbenchPart part) {
+ return doCreatePage(part, IFailedViewPage.class);
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedView.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedView.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedViewFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedViewFactory.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedViewFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedViewFactory.java Fri Aug 12 11:14:14 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.textmarker.explain.failed;
+
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.editor.CEVViewer;
+import org.apache.uima.cev.extension.ICEVView;
+import org.apache.uima.cev.extension.ICEVViewFactory;
+
+public class FailedViewFactory implements ICEVViewFactory {
+
+ public FailedViewFactory() {
+ }
+
+ public ICEVView createView(CEVViewer viewer, CEVDocument cevDocument, int index) {
+ return new FailedViewPage(viewer, cevDocument, index);
+ }
+
+ public Class<?> getAdapterInterface() {
+ return IFailedViewPage.class;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedViewFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedViewFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedViewPage.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedViewPage.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,214 @@
+/*
+ * 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.textmarker.explain.failed;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cev.data.CEVData;
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.data.tree.ICEVAnnotationNode;
+import org.apache.uima.cev.editor.CEVViewer;
+import org.apache.uima.cev.extension.ICEVView;
+import org.apache.uima.textmarker.addons.TextMarkerAddonsPlugin;
+import org.apache.uima.textmarker.explain.ExplainConstants;
+import org.apache.uima.textmarker.explain.element.ElementViewPage;
+import org.apache.uima.textmarker.explain.element.IElementViewPage;
+import org.apache.uima.textmarker.explain.tree.FailedRootNode;
+import org.apache.uima.textmarker.explain.tree.IExplainTreeNode;
+import org.apache.uima.textmarker.explain.tree.RuleMatchNode;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.part.Page;
+
+public class FailedViewPage extends Page implements IFailedViewPage, ICEVView,
+ IDoubleClickListener, ISelectionChangedListener {
+
+ private IExplainTreeNode node;
+
+ private CheckboxTreeViewer treeView;
+
+ private CEVDocument casDoc;
+
+ private int current;
+
+ private CEVViewer casViewer;
+
+ private Map<String, Image> images;
+
+ public FailedViewPage(CEVViewer casViewer, CEVDocument casDoc, int index) {
+ super();
+ this.casViewer = casViewer;
+ this.casDoc = casDoc;
+ this.current = index;
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ if (images != null) {
+ for (Image each : images.values()) {
+ each.dispose();
+ }
+ }
+ }
+
+ private void initImages() {
+ images = new HashMap<String, Image>();
+ ImageDescriptor desc;
+ Image image;
+ String name;
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/accept.png");
+ image = desc.createImage();
+ name = "matched";
+ images.put(name, image);
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/cancel.png");
+ image = desc.createImage();
+ name = "failed";
+ images.put(name, image);
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/font_add.png");
+ image = desc.createImage();
+ name = ExplainConstants.MATCHED_RULE_MATCH_TYPE;
+ images.put(name, image);
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/font_delete.png");
+ image = desc.createImage();
+ name = ExplainConstants.FAILED_RULE_MATCH_TYPE;
+ images.put(name, image);
+ }
+
+ public Image getImage(String name) {
+ if (images == null) {
+ initImages();
+ }
+ return images.get(name);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ treeView = new CheckboxTreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
+ treeView.setContentProvider(new FailedTreeContentProvider());
+ treeView.setLabelProvider(new FailedTreeLabelProvider(this));
+ treeView.setInput(node);
+ treeView.addCheckStateListener(getCurrentCEVData());
+ treeView.addSelectionChangedListener(this);
+ treeView.addDoubleClickListener(this);
+ }
+
+ public void doubleClick(DoubleClickEvent event) {
+ if (event.getSelection() != null && event.getSelection() instanceof ITreeSelection) {
+ Object treeNode = ((ITreeSelection) event.getSelection()).getFirstElement();
+ if (treeNode instanceof ICEVAnnotationNode) {
+ casViewer.moveToAnnotation(((ICEVAnnotationNode) treeNode).getAnnotation());
+ }
+ }
+ }
+
+ public CEVData getCurrentCEVData() {
+ return casDoc.getCASData(current);
+ }
+
+ @Override
+ public Control getControl() {
+ return treeView.getControl();
+ }
+
+ @Override
+ public void setFocus() {
+ treeView.getControl().setFocus();
+ }
+
+ public void inputChange(Object newInput) {
+ if (newInput != null && newInput instanceof FailedRootNode && treeView != null) {
+ this.treeView.setInput(newInput);
+ this.treeView.refresh();
+ }
+ Object elementPage = casViewer.getAdapter(IElementViewPage.class);
+ if (elementPage instanceof ElementViewPage) {
+ ((ElementViewPage) elementPage).inputChange(null);
+ }
+ }
+
+ public void viewChanged(int newIndex) {
+ getCurrentCEVData().removeAnnotationListener(this);
+ current = newIndex;
+ getCurrentCEVData().addAnnotationListener(this);
+ inputChange(null);
+ }
+
+ public void annotationsAdded(List<AnnotationFS> annots) {
+
+ }
+
+ public void annotationsRemoved(List<AnnotationFS> annots) {
+
+ }
+
+ public void annotationStateChanged(Type type) {
+
+ }
+
+ public void annotationStateChanged(AnnotationFS annot) {
+
+ }
+
+ public void colorChanged(Type type) {
+
+ }
+
+ public void newSelection(int offset) {
+
+ }
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelection selection = event.getSelection();
+ if (selection instanceof ITreeSelection) {
+ ITreeSelection struct = (ITreeSelection) selection;
+ Object firstElement = struct.getFirstElement();
+ if (firstElement instanceof RuleMatchNode) {
+ RuleMatchNode node = (RuleMatchNode) firstElement;
+ Object elementPage = casViewer.getAdapter(IElementViewPage.class);
+ if (elementPage instanceof ElementViewPage && node.hasChildren()) {
+ ((ElementViewPage) elementPage).inputChange(node.getChildren().get(0));
+ }
+ }
+ }
+ }
+
+ public void casChanged(CEVDocument casDocument) {
+ this.casDoc = casDocument;
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedViewPage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/FailedViewPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/IFailedViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/IFailedViewPage.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/IFailedViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/IFailedViewPage.java Fri Aug 12 11:14:14 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.textmarker.explain.failed;
+
+import org.apache.uima.cev.views.ICEVViewPage;
+
+public interface IFailedViewPage extends ICEVViewPage {
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/IFailedViewPage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/failed/IFailedViewPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/IMatchedViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/IMatchedViewPage.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/IMatchedViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/IMatchedViewPage.java Fri Aug 12 11:14:14 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.textmarker.explain.matched;
+
+import org.apache.uima.cev.views.ICEVViewPage;
+
+public interface IMatchedViewPage extends ICEVViewPage {
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/IMatchedViewPage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/IMatchedViewPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedTreeContentProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedTreeContentProvider.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedTreeContentProvider.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedTreeContentProvider.java Fri Aug 12 11:14:14 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.textmarker.explain.matched;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.textmarker.explain.tree.IExplainTreeNode;
+import org.apache.uima.textmarker.explain.tree.RuleMatchNode;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+public class MatchedTreeContentProvider implements ITreeContentProvider {
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IExplainTreeNode) {
+ List<Object> result = new ArrayList<Object>();
+ IExplainTreeNode debugNode = (IExplainTreeNode) parentElement;
+ for (IExplainTreeNode each : debugNode.getChildren()) {
+ if (each instanceof RuleMatchNode) {
+ result.add(each);
+ }
+ }
+ return result.toArray();
+ }
+ return null;
+ }
+
+ public Object getParent(Object element) {
+ if (element instanceof IExplainTreeNode) {
+ return ((IExplainTreeNode) element).getParent();
+ }
+ return null;
+
+ }
+
+ public Object[] getElements(Object element) {
+ return getChildren(element);
+ }
+
+ public boolean hasChildren(Object parentElement) {
+
+ // if (parentElement instanceof IExplainTreeNode) {
+ // IExplainTreeNode debugNode = (IExplainTreeNode) parentElement;
+ // for (Object each : debugNode.getChildren()) {
+ // if(!(each instanceof ExplainRootNode)) {
+ // return true;
+ // }
+ // }
+ // }
+ return false;
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedTreeContentProvider.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedTreeContentProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedTreeLabelProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedTreeLabelProvider.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedTreeLabelProvider.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedTreeLabelProvider.java Fri Aug 12 11:14:14 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.textmarker.explain.matched;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.textmarker.explain.tree.RuleMatchNode;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+
+public class MatchedTreeLabelProvider extends LabelProvider implements ILabelProvider {
+
+ private MatchedViewPage owner;
+
+ public MatchedTreeLabelProvider(MatchedViewPage owner) {
+ super();
+ this.owner = owner;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof RuleMatchNode) {
+ RuleMatchNode ruleMatchNode = (RuleMatchNode) element;
+ FeatureStructure fs = ruleMatchNode.getFeatureStructure();
+ if (fs != null) {
+ String name = fs.getType().getName();
+ return owner.getImage(name);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof RuleMatchNode) {
+ RuleMatchNode debugNode = (RuleMatchNode) element;
+ FeatureStructure fs = debugNode.getFeatureStructure();
+ if (fs != null) {
+ String s = ((AnnotationFS) fs).getCoveredText();
+ s = s.replaceAll("[\\n\\r]", "");
+ return s;
+ }
+ }
+
+ return element.toString();
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedTreeLabelProvider.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedTreeLabelProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedView.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedView.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedView.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedView.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,37 @@
+/*
+ * 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.textmarker.explain.matched;
+
+import org.apache.uima.cev.views.CEVPageBookView;
+import org.eclipse.ui.IWorkbenchPart;
+
+
+public class MatchedView extends CEVPageBookView {
+
+ public MatchedView() {
+ super();
+ }
+
+ @Override
+ protected PageRec doCreatePage(IWorkbenchPart part) {
+ return doCreatePage(part, IMatchedViewPage.class);
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedView.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedView.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedViewFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedViewFactory.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedViewFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedViewFactory.java Fri Aug 12 11:14:14 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.textmarker.explain.matched;
+
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.editor.CEVViewer;
+import org.apache.uima.cev.extension.ICEVView;
+import org.apache.uima.cev.extension.ICEVViewFactory;
+
+public class MatchedViewFactory implements ICEVViewFactory {
+
+ public MatchedViewFactory() {
+ }
+
+ public ICEVView createView(CEVViewer viewer, CEVDocument cevDocument, int index) {
+ return new MatchedViewPage(viewer, cevDocument, index);
+ }
+
+ public Class<?> getAdapterInterface() {
+ return IMatchedViewPage.class;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedViewFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedViewFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedViewPage.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedViewPage.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,217 @@
+/*
+ * 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.textmarker.explain.matched;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cev.data.CEVData;
+import org.apache.uima.cev.data.CEVDocument;
+import org.apache.uima.cev.data.tree.ICEVAnnotationNode;
+import org.apache.uima.cev.editor.CEVViewer;
+import org.apache.uima.cev.extension.ICEVView;
+import org.apache.uima.textmarker.addons.TextMarkerAddonsPlugin;
+import org.apache.uima.textmarker.explain.ExplainConstants;
+import org.apache.uima.textmarker.explain.element.ElementViewPage;
+import org.apache.uima.textmarker.explain.element.IElementViewPage;
+import org.apache.uima.textmarker.explain.tree.IExplainTreeNode;
+import org.apache.uima.textmarker.explain.tree.MatchedRootNode;
+import org.apache.uima.textmarker.explain.tree.RuleMatchNode;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.part.Page;
+
+public class MatchedViewPage extends Page implements IMatchedViewPage, ICEVView,
+ IDoubleClickListener, ISelectionChangedListener {
+
+ private IExplainTreeNode node;
+
+ // private CASViewer casViewer;
+ private CheckboxTreeViewer treeView;
+
+ // private Tree tree;
+ private CEVDocument casDoc;
+
+ private int current;
+
+ private CEVViewer casViewer;
+
+ private Map<String, Image> images;
+
+ public MatchedViewPage(CEVViewer casViewer, CEVDocument casDoc, int index) {
+ super();
+ this.casViewer = casViewer;
+ this.casDoc = casDoc;
+ this.current = index;
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ if (images != null) {
+ for (Image each : images.values()) {
+ each.dispose();
+ }
+ }
+ }
+
+ private void initImages() {
+ images = new HashMap<String, Image>();
+ ImageDescriptor desc;
+ Image image;
+ String name;
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/accept.png");
+ image = desc.createImage();
+ name = "matched";
+ images.put(name, image);
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/cancel.png");
+ image = desc.createImage();
+ name = "failed";
+ images.put(name, image);
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/font_add.png");
+ image = desc.createImage();
+ name = ExplainConstants.MATCHED_RULE_MATCH_TYPE;
+ images.put(name, image);
+
+ desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/font_delete.png");
+ image = desc.createImage();
+ name = ExplainConstants.FAILED_RULE_MATCH_TYPE;
+ images.put(name, image);
+ }
+
+ public Image getImage(String name) {
+ if (images == null) {
+ initImages();
+ }
+ return images.get(name);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ treeView = new CheckboxTreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
+ treeView.setContentProvider(new MatchedTreeContentProvider());
+ treeView.setLabelProvider(new MatchedTreeLabelProvider(this));
+ treeView.setInput(node);
+ treeView.addCheckStateListener(getCurrentCEVData());
+ treeView.addSelectionChangedListener(this);
+ treeView.addDoubleClickListener(this);
+ }
+
+ public CEVData getCurrentCEVData() {
+ return casDoc.getCASData(current);
+ }
+
+ public void doubleClick(DoubleClickEvent event) {
+ if (event.getSelection() != null && event.getSelection() instanceof ITreeSelection) {
+ Object treeNode = ((ITreeSelection) event.getSelection()).getFirstElement();
+ if (treeNode instanceof ICEVAnnotationNode) {
+ casViewer.moveToAnnotation(((ICEVAnnotationNode) treeNode).getAnnotation());
+ }
+ }
+ }
+
+ @Override
+ public Control getControl() {
+ return treeView.getControl();
+ }
+
+ @Override
+ public void setFocus() {
+ treeView.getControl().setFocus();
+ }
+
+ public void inputChange(Object newInput) {
+ if (newInput != null && newInput instanceof MatchedRootNode && treeView != null) {
+ this.treeView.setInput(newInput);
+ this.treeView.refresh();
+ }
+ Object elementPage = casViewer.getAdapter(IElementViewPage.class);
+ if (elementPage instanceof ElementViewPage) {
+ ((ElementViewPage) elementPage).inputChange(null);
+ }
+ }
+
+ public void viewChanged(int newIndex) {
+ getCurrentCEVData().removeAnnotationListener(this);
+ current = newIndex;
+ getCurrentCEVData().addAnnotationListener(this);
+ inputChange(null);
+ }
+
+ public void annotationsAdded(List<AnnotationFS> annots) {
+
+ }
+
+ public void annotationsRemoved(List<AnnotationFS> annots) {
+
+ }
+
+ public void annotationStateChanged(Type type) {
+
+ }
+
+ public void annotationStateChanged(AnnotationFS annot) {
+
+ }
+
+ public void colorChanged(Type type) {
+
+ }
+
+ public void newSelection(int offset) {
+
+ }
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelection selection = event.getSelection();
+ if (selection instanceof ITreeSelection) {
+ ITreeSelection struct = (ITreeSelection) selection;
+ Object firstElement = struct.getFirstElement();
+ if (firstElement instanceof RuleMatchNode) {
+ RuleMatchNode node = (RuleMatchNode) firstElement;
+ Object elementPage = casViewer.getAdapter(IElementViewPage.class);
+ if (elementPage instanceof ElementViewPage && node.hasChildren()) {
+ ((ElementViewPage) elementPage).inputChange(node.getChildren().get(0));
+ }
+ }
+ }
+ }
+
+ public void casChanged(CEVDocument casDocument) {
+ this.casDoc = casDocument;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedViewPage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/matched/MatchedViewPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/IRuleListViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/IRuleListViewPage.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/IRuleListViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/IRuleListViewPage.java Fri Aug 12 11:14:14 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.textmarker.explain.rulelist;
+
+import org.apache.uima.cev.views.ICEVViewPage;
+
+public interface IRuleListViewPage extends ICEVViewPage {
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/IRuleListViewPage.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/IRuleListViewPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListSelectionView.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListSelectionView.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListSelectionView.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListSelectionView.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,36 @@
+/*
+ * 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.textmarker.explain.rulelist;
+
+import org.apache.uima.cev.views.CEVPageBookView;
+import org.eclipse.ui.IWorkbenchPart;
+
+
+public class RuleListSelectionView extends CEVPageBookView {
+
+ public RuleListSelectionView() {
+ super();
+ }
+
+ @Override
+ protected PageRec doCreatePage(IWorkbenchPart part) {
+ return doCreatePage(part, IRuleListViewPage.class);
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListSelectionView.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListSelectionView.java
------------------------------------------------------------------------------
svn:mime-type = text/plain