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 [8/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...

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/ExportTabelHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/ExportTabelHandler.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/ExportTabelHandler.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/ExportTabelHandler.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,84 @@
+/*
+ * 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.testing.ui.handlers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.uima.textmarker.testing.ui.views.EvalDataDialog;
+import org.apache.uima.textmarker.testing.ui.views.TestCasData;
+import org.apache.uima.textmarker.testing.ui.views.TestPageBookView;
+import org.apache.uima.textmarker.testing.ui.views.TestViewPage;
+import org.apache.uima.textmarker.testing.ui.views.evalDataTable.TypeEvalData;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class ExportTabelHandler extends AbstractHandler {
+
+  @Override
+  public Object execute(ExecutionEvent event) throws ExecutionException {
+    TestPageBookView debugView = (TestPageBookView) HandlerUtil.getActivePart(event);
+    TestViewPage debugPage = (TestViewPage) debugView.getCurrentPage();
+    
+    TableViewer viewer = debugPage.getViewer();
+    
+    Shell shell = HandlerUtil.getActiveShell(event);
+    
+    String evalData = "Test File,Type,TP,FP,FN,Recall,Prec,F-1\n";
+    
+    
+    ArrayList<TestCasData> dataList = (ArrayList)viewer.getInput();
+    
+    for (TestCasData entry : dataList) {
+      Collection<TypeEvalData> col = entry.getTypeEvalData().values();
+      for (TypeEvalData data : col) {
+        if (!data.getTypeName().equals("Total")) {
+          
+        
+        
+        String column = entry.getPath().lastSegment() + ","
+        + data.getTypeName() + "," 
+        + String.valueOf(data.getTruePositives()) + "," 
+        + String.valueOf(data.getFalsePositives()) + "," 
+        + String.valueOf(data.getFalseNegatives()) + "," 
+        + String.valueOf(data.getRecall()) + "," 
+        + String.valueOf(data.getPrecision()) + "," 
+        + String.valueOf(data.getFOne())
+        + "\n";
+        evalData = evalData+ column;
+      }
+      }
+      
+    }
+
+    EvalDataDialog dialog = new EvalDataDialog(shell, evalData);
+    dialog.open();
+    
+//    MessageDialog.openConfirm(shell, "Evaluation Data", text);
+
+    return null;
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/ExportTabelHandler.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/ExportTabelHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/LoadFilesFromFolderHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/LoadFilesFromFolderHandler.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/LoadFilesFromFolderHandler.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/LoadFilesFromFolderHandler.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,148 @@
+/*
+ * 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.testing.ui.handlers;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.apache.uima.textmarker.testing.ui.views.TestCasData;
+import org.apache.uima.textmarker.testing.ui.views.TestPageBookView;
+import org.apache.uima.textmarker.testing.ui.views.TestViewPage;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.core.internal.resources.Folder;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class LoadFilesFromFolderHandler implements IHandler {
+
+  TestPageBookView debugView;
+
+  TestViewPage debugPage;
+
+  @Override
+  public void addHandlerListener(IHandlerListener handlerListener) {
+
+  }
+
+  @Override
+  public void dispose() {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public Object execute(ExecutionEvent event) throws ExecutionException {
+
+    debugView = (TestPageBookView) HandlerUtil.getActivePart(event);
+    debugPage = (TestViewPage) debugView.getCurrentPage();
+    IProject project = debugPage.getResource().getProject();
+
+    IViewPart scriptExpl = HandlerUtil.getActiveSite(event).getWorkbenchWindow().getActivePage()
+            .findView("org.eclipse.dltk.ui.ScriptExplorer");
+    ISelection select = scriptExpl.getViewSite().getSelectionProvider().getSelection();
+
+    if (select != null && select instanceof StructuredSelection) {
+      StructuredSelection structSelect = (StructuredSelection) select;
+      Iterator iter = structSelect.iterator();
+      while (iter.hasNext()) {
+        Object o = iter.next();
+        if (o instanceof Folder) {
+          Folder folder = (Folder) o;
+          IPath path2Folder = folder.getFullPath().removeFirstSegments(1);
+          IFolder testFolder = project.getFolder(path2Folder);
+
+          loadFolder(testFolder);
+        }
+      }
+    }
+    return null;
+  }
+
+  @Override
+  public boolean isEnabled() {
+    // TODO Auto-generated method stub
+    return true;
+  }
+
+  @Override
+  public boolean isHandled() {
+    // TODO Auto-generated method stub
+    return true;
+  }
+
+  @Override
+  public void removeHandlerListener(IHandlerListener handlerListener) {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void loadFolder(IFolder folder) {
+    try {
+      IResource[] children = folder.members();
+      for (IResource r : children) {
+        // if (r instanceof IFolder) {
+        // loadFolder((IFolder)r);
+        // }
+        if (r instanceof IFile) {
+          if (r != null && r instanceof IFile && r.getLocation().getFileExtension().equals("xmi")) {
+            add2Viewer(r.getLocation());
+          }
+        }
+      }
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+
+  }
+
+  public void add2Viewer(IPath p) {
+
+    TestViewPage debugPage = (TestViewPage) debugView.getCurrentPage();
+
+    TableViewer viewer = debugPage.getViewer();
+
+    if (viewer.getInput() instanceof ArrayList) {
+      ArrayList input = (ArrayList) debugPage.getViewer().getInput();
+      input.add(new TestCasData(p));
+      viewer.refresh();
+
+      if (input.get(0) != null) {
+        TestCasData data = (TestCasData) input.get(0);
+        if (data.wasEvaluated()) {
+          debugPage.updateSingleTestInformation(data);
+        }
+      }
+    }
+
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/LoadFilesFromFolderHandler.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/LoadFilesFromFolderHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/NextTestCaseHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/NextTestCaseHandler.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/NextTestCaseHandler.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/NextTestCaseHandler.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,71 @@
+/*
+ * 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.testing.ui.handlers;
+
+import org.apache.uima.textmarker.testing.ui.views.TestPageBookView;
+import org.apache.uima.textmarker.testing.ui.views.TestViewPage;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class NextTestCaseHandler implements IHandler {
+
+  @Override
+  public void addHandlerListener(IHandlerListener handlerListener) {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void dispose() {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public Object execute(ExecutionEvent event) throws ExecutionException {
+    TestPageBookView debugView = (TestPageBookView) HandlerUtil.getActivePart(event);
+    TestViewPage page = (TestViewPage) debugView.getCurrentPage();
+    page.nextState();
+    return null;
+  }
+
+  @Override
+  public boolean isEnabled() {
+    // TODO Auto-generated method stub
+    return true;
+  }
+
+  @Override
+  public boolean isHandled() {
+    // TODO Auto-generated method stub
+    return true;
+  }
+
+  @Override
+  public void removeHandlerListener(IHandlerListener handlerListener) {
+    // TODO Auto-generated method stub
+
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/NextTestCaseHandler.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/NextTestCaseHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/PreviousTestCaseHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/PreviousTestCaseHandler.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/PreviousTestCaseHandler.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/PreviousTestCaseHandler.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,72 @@
+/*
+ * 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.testing.ui.handlers;
+
+import org.apache.uima.textmarker.testing.ui.views.TestPageBookView;
+import org.apache.uima.textmarker.testing.ui.views.TestViewPage;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class PreviousTestCaseHandler implements IHandler {
+
+  @Override
+  public void addHandlerListener(IHandlerListener handlerListener) {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void dispose() {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public Object execute(ExecutionEvent event) throws ExecutionException {
+    
+    TestPageBookView debugView = (TestPageBookView) HandlerUtil.getActivePart(event);
+    TestViewPage page = (TestViewPage) debugView.getCurrentPage();
+    page.previousState();
+    return null;
+  }
+
+  @Override
+  public boolean isEnabled() {
+    // TODO Auto-generated method stub
+    return true;
+  }
+
+  @Override
+  public boolean isHandled() {
+    // TODO Auto-generated method stub
+    return true;
+  }
+
+  @Override
+  public void removeHandlerListener(IHandlerListener handlerListener) {
+    // TODO Auto-generated method stub
+
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/PreviousTestCaseHandler.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/PreviousTestCaseHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RemoveTestsHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RemoveTestsHandler.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RemoveTestsHandler.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RemoveTestsHandler.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,90 @@
+/*
+ * 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.testing.ui.handlers;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.uima.textmarker.testing.ui.views.TestCasData;
+import org.apache.uima.textmarker.testing.ui.views.TestPageBookView;
+import org.apache.uima.textmarker.testing.ui.views.TestViewPage;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class RemoveTestsHandler implements IHandler {
+
+  @Override
+  public void addHandlerListener(IHandlerListener handlerListener) {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void dispose() {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public Object execute(ExecutionEvent event) throws ExecutionException {
+    TestPageBookView debugView = (TestPageBookView) HandlerUtil.getActivePart(event);
+    TestViewPage activePage = (TestViewPage) debugView.getCurrentPage();
+    activePage.saveState();
+    TableViewer viewer = activePage.getViewer();
+    List list = (List) viewer.getInput();
+    if (viewer.getSelection() == null) {
+      // TODO Refactor this
+    } else if (viewer.getSelection() instanceof StructuredSelection) {
+      StructuredSelection selection = (StructuredSelection) viewer.getSelection();
+      Iterator<TestCasData> iter = selection.iterator();
+      while (iter.hasNext()) {
+        list.remove(iter.next());
+      }
+    }
+    viewer.refresh(false);
+    // debugView.saveState();
+    return null;
+  }
+
+  @Override
+  public boolean isEnabled() {
+    // TODO Auto-generated method stub
+    return true;
+  }
+
+  @Override
+  public boolean isHandled() {
+    // TODO Auto-generated method stub
+    return true;
+  }
+
+  @Override
+  public void removeHandlerListener(IHandlerListener handlerListener) {
+    // TODO Auto-generated method stub
+
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RemoveTestsHandler.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RemoveTestsHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RerunActionHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RerunActionHandler.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RerunActionHandler.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RerunActionHandler.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,386 @@
+/*
+ * 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.testing.ui.handlers;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.cas.impl.XmiCasDeserializer;
+import org.apache.uima.cas.impl.XmiCasSerializer;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cas.text.AnnotationIndex;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.ResourceSpecifier;
+import org.apache.uima.resource.metadata.FsIndexDescription;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.apache.uima.textmarker.addons.TextMarkerAddonsPlugin;
+import org.apache.uima.textmarker.ide.TextMarkerIdePlugin;
+import org.apache.uima.textmarker.ide.core.builder.TextMarkerProjectUtils;
+import org.apache.uima.textmarker.testing.evaluator.ICasEvaluator;
+import org.apache.uima.textmarker.testing.preferences.TestingPreferenceConstants;
+import org.apache.uima.textmarker.testing.ui.views.TestCasData;
+import org.apache.uima.textmarker.testing.ui.views.TestPageBookView;
+import org.apache.uima.textmarker.testing.ui.views.TestViewPage;
+import org.apache.uima.textmarker.testing.ui.views.evalDataTable.TypeEvalData;
+import org.apache.uima.textmarker.testing.ui.views.util.EvalDataProcessor;
+import org.apache.uima.textmarker.type.EvalAnnotation;
+import org.apache.uima.util.CasCreationUtils;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XMLInputSource;
+import org.apache.uima.util.XMLSerializer;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.xml.sax.SAXException;
+
+public class RerunActionHandler implements IHandler {
+
+  private class DebugJobChangeAdapter extends JobChangeAdapter {
+
+    private TestViewPage page;
+
+    DebugJobChangeAdapter(TestViewPage page) {
+      super();
+      this.page = page;
+    }
+
+    @Override
+    public void done(IJobChangeEvent event) {
+      if (event.getResult().isOK()) {
+        page.getControl().getDisplay().asyncExec(new Runnable() {
+          public void run() {
+            page.updateInfoPanel();
+          }
+        });
+      }
+    }
+  }
+
+  private class RerunHandlerJob extends Job {
+    ExecutionEvent event;
+
+    String viewCasName;
+
+    RerunHandlerJob(ExecutionEvent event, String scriptName, String viewCasName) {
+      super("Testing " + scriptName + "...");
+      this.event = event;
+      this.viewCasName = viewCasName;
+      setUser(true);
+    }
+
+    @Override
+    public IStatus run(IProgressMonitor monitor) {
+      final TestPageBookView debugView = (TestPageBookView) HandlerUtil.getActivePart(event);
+      final TestViewPage debugPage = (TestViewPage) debugView.getCurrentPage();
+      debugPage.saveState();
+      debugView.showBusy(true);
+      IResource r = debugPage.getResource();
+      ArrayList<TestCasData> testCasData = (ArrayList) debugPage.getViewer().getInput();
+      monitor.beginTask("Running evaluation, please wait", testCasData.size());
+      IProject project = r.getProject();
+      IPath engineDescriptorPath = TextMarkerProjectUtils.getEngineDescriptorPath(r.getLocation(),
+              project);
+      try {
+        XMLInputSource in = new XMLInputSource(engineDescriptorPath.toPortableString());
+        ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
+        AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(specifier);
+
+        String desc = null;
+        desc = engineDescriptorPath.toPortableString();
+        XMLInputSource in2 = new XMLInputSource(desc);
+        Object descriptor = UIMAFramework.getXMLParser().parse(in2);
+        CAS runCas = ae.newCAS();
+
+        for (TestCasData td : testCasData) {
+          runCas.reset();
+          String elementName = r.getLocation().lastSegment();
+          monitor.setTaskName("Evaluating " + td.getPath().lastSegment());
+          int lastIndexOf = elementName.lastIndexOf(".tm");
+          if (lastIndexOf != -1) {
+            elementName = elementName.substring(0, lastIndexOf);
+          }
+
+          CAS testCas = getTestCas(descriptor);
+          FileInputStream inputStream = null;
+          try {
+            inputStream = new FileInputStream(new File(td.getPath().toPortableString()));
+            XmiCasDeserializer.deserialize(inputStream, testCas, true);
+          } finally {
+            if (inputStream != null) {
+              inputStream.close();
+            }
+          }
+
+          for (Iterator<CAS> iterator = testCas.getViewIterator(); iterator.hasNext();) {
+            CAS each = (CAS) iterator.next();
+            String viewName = each.getViewName();
+            try {
+              CAS view = runCas.getView(viewName);
+              view.setDocumentText(each.getDocumentText());
+
+            } catch (Exception e) {
+            }
+          }
+
+          testCas = testCas.getView(viewCasName);
+          runCas = runCas.getView(viewCasName);
+
+          IPreferenceStore store = TextMarkerAddonsPlugin.getDefault().getPreferenceStore();
+          String factoryName = store.getString(TestingPreferenceConstants.EVALUATOR_FACTORY);
+          ICasEvaluator evaluator = TextMarkerAddonsPlugin.getCasEvaluatorFactoryById(factoryName)
+                  .createEvaluator();
+
+          ae.process(runCas);
+          CAS resultCas = evaluator.evaluate(testCas, runCas, debugPage.getExcludedTypes());
+
+          IPath path2Test = td.getPath().removeLastSegments(1);
+
+          IPath estimatedTestPath = project.getFullPath().append(
+                  TextMarkerProjectUtils.getDefaultTestLocation());
+          IPath path2recource = r.getFullPath();
+          IPath projectRelativePath2Script = path2recource.removeFirstSegments(2);
+          IPath estimatedTestFolderPath = estimatedTestPath.append(projectRelativePath2Script
+                  .removeFileExtension());
+
+          IPath path2Result = path2Test.append(TestCasData.RESULT_FOLDER);
+          IPath path2ResultFile = path2Result.append(td.getPath().removeFileExtension()
+                  .lastSegment()
+                  + ".result.xmi");
+
+          if (!path2Test.toOSString().contains(estimatedTestFolderPath.toOSString())) {
+            path2Result = project.getLocation()
+                    .append(TextMarkerProjectUtils.getDefaultTestLocation())
+                    .append(TextMarkerProjectUtils.getDefaultTempTestLocation());
+            path2ResultFile = path2Result.append(td.getPath().removeFileExtension().lastSegment()
+                    + ".result.xmi");
+          }
+
+          File resultFile = new File(path2ResultFile.toPortableString());
+          writeXmi(resultCas, resultFile);
+
+          td.setResultPath(path2ResultFile);
+
+          // calculateEvaluatData(td, resultCas);
+
+          EvalDataProcessor.calculateEvaluatData(td, resultCas);
+
+          debugView.getDefaultPage().getControl().getDisplay().asyncExec(new Runnable() {
+            @Override
+            public void run() {
+              debugPage.getViewer().refresh();
+            }
+          });
+          monitor.worked(1);
+          r.getProject().getFolder(path2Result)
+                  .refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+          runCas.release();
+          if (monitor.isCanceled())
+            return Status.CANCEL_STATUS;
+        }
+      } catch (Exception e) {
+        TextMarkerIdePlugin.error(e);
+      }
+
+      monitor.done();
+      debugView.showBusy(false);
+      return Status.OK_STATUS;
+
+    }
+
+    private CAS getTestCas(Object descriptor) throws ResourceInitializationException,
+            InvalidXMLException {
+      CAS testCas = null;
+      if (descriptor instanceof AnalysisEngineDescription) {
+        testCas = CasCreationUtils.createCas((AnalysisEngineDescription) descriptor);
+      } else if (descriptor instanceof TypeSystemDescription) {
+        TypeSystemDescription tsDesc = (TypeSystemDescription) descriptor;
+        tsDesc.resolveImports();
+        testCas = CasCreationUtils.createCas(tsDesc, null, new FsIndexDescription[0]);
+        // TODO: where are the type priorities?
+      }
+      return testCas;
+    }
+  }
+
+  @Override
+  public void addHandlerListener(IHandlerListener handlerListener) {
+
+  }
+
+  @Override
+  public void dispose() {
+
+  }
+
+  @Override
+  public Object execute(ExecutionEvent event) throws ExecutionException {
+
+    TestPageBookView debugView = (TestPageBookView) HandlerUtil.getActivePart(event);
+    TestViewPage debugPage = (TestViewPage) debugView.getCurrentPage();
+
+    String viewCasName = debugPage.getSelectedViewCasName();
+    String scriptName = debugPage.getResource().getLocation().lastSegment();
+    RerunHandlerJob job = new RerunHandlerJob(event, scriptName, viewCasName);
+
+    job.addJobChangeListener(new DebugJobChangeAdapter(debugPage) {
+    });
+
+    job.schedule();
+
+    return null;
+  }
+
+  private static void writeXmi(CAS aCas, File name) throws IOException, SAXException {
+    FileOutputStream out = null;
+    try {
+      name.getParentFile().mkdirs();
+      if (!name.exists()) {
+        name.createNewFile();
+      }
+      out = new FileOutputStream(name);
+      XmiCasSerializer ser = new XmiCasSerializer(aCas.getTypeSystem());
+      XMLSerializer xmlSer = new XMLSerializer(out, false);
+      ser.serialize(aCas, xmlSer.getContentHandler());
+    } catch (Exception e) {
+      TextMarkerIdePlugin.error(e);
+    } finally {
+      if (out != null) {
+        out.close();
+      }
+    }
+  }
+
+  @Override
+  public boolean isEnabled() {
+    return true;
+  }
+
+  @Override
+  public boolean isHandled() {
+    return true;
+  }
+
+  @Override
+  public void removeHandlerListener(IHandlerListener handlerListener) {
+
+  }
+
+  public void calculateEvaluatData(TestCasData data, CAS resultCas) {
+    data.setEvaluationStatus(true);
+    TypeSystem ts = resultCas.getTypeSystem();
+    Type falsePositiveType = ts.getType(ICasEvaluator.FALSE_POSITIVE);
+    Type falseNegativeType = ts.getType(ICasEvaluator.FALSE_NEGATIVE);
+    Type truePositiveType = ts.getType(ICasEvaluator.TRUE_POSITIVE);
+
+    int falsePositiveCount = resultCas.getAnnotationIndex(falsePositiveType).size();
+    int falseNegativeCount = resultCas.getAnnotationIndex(falseNegativeType).size();
+    int truePositiveCount = resultCas.getAnnotationIndex(truePositiveType).size();
+
+    data.setTruePositiveCount(truePositiveCount);
+    data.setFalsePositiveCount(falsePositiveCount);
+    data.setFalseNegativeCount(falseNegativeCount);
+
+    HashMap map = new HashMap();
+
+    AnnotationIndex<AnnotationFS> index = resultCas.getAnnotationIndex(truePositiveType);
+
+    FSIterator iter = index.iterator();
+
+    while (iter.isValid()) {
+      EvalAnnotation a = (EvalAnnotation) iter.next();
+      Annotation original = a.getOriginal();
+      Type originalType = original.getType();
+
+      if (map.containsKey(originalType.getName())) {
+        TypeEvalData element = (TypeEvalData) map.get(originalType.getName());
+        int oldCount = element.getTruePositives();
+        element.setTruePositives(oldCount + 1);
+      } else {
+        TypeEvalData newData = new TypeEvalData(originalType.getName(), 1, 0, 0);
+        map.put(originalType.getName(), newData);
+      }
+    }
+
+    index = resultCas.getAnnotationIndex(falsePositiveType);
+    iter = index.iterator();
+
+    while (iter.isValid()) {
+      EvalAnnotation a = (EvalAnnotation) iter.next();
+      Annotation original = a.getOriginal();
+      Type originalType = original.getType();
+
+      if (map.containsKey(originalType.getName())) {
+        TypeEvalData element = (TypeEvalData) map.get(originalType.getName());
+        int oldCount = element.getFalsePositives();
+        element.setFalsePositives(oldCount + 1);
+      } else {
+        TypeEvalData newData = new TypeEvalData(originalType.getName(), 0, 1, 0);
+        map.put(originalType.getName(), newData);
+      }
+    }
+
+    index = resultCas.getAnnotationIndex(falseNegativeType);
+    iter = index.iterator();
+
+    while (iter.isValid()) {
+      EvalAnnotation a = (EvalAnnotation) iter.next();
+      Annotation original = a.getOriginal();
+      Type originalType = original.getType();
+
+      if (map.containsKey(originalType.getName())) {
+        TypeEvalData element = (TypeEvalData) map.get(originalType.getName());
+        int oldCount = element.getFalseNegatives();
+        element.setFalseNegatives(oldCount + 1);
+      } else {
+        TypeEvalData newData = new TypeEvalData(originalType.getName(), 0, 0, 1);
+        map.put(originalType.getName(), newData);
+      }
+    }
+
+    data.setTypeEvalData(map);
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RerunActionHandler.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RerunActionHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RunTestHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RunTestHandler.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RunTestHandler.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RunTestHandler.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,112 @@
+/*
+ * 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.testing.ui.handlers;
+
+import org.apache.uima.textmarker.testing.ui.views.TestViewPage;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.FileEditorInput;
+
+public class RunTestHandler implements IHandler {
+
+  private IResource resource;
+
+  @Override
+  public void addHandlerListener(IHandlerListener handlerListener) {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void dispose() {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public Object execute(ExecutionEvent event) throws ExecutionException {
+
+    // TODO create a new view for every resource file
+    TestViewPage view = null;
+    try {
+      FileEditorInput input = (FileEditorInput) HandlerUtil.getActiveEditor(event).getEditorInput();
+      IResource r = input.getFile();
+      view = (TestViewPage) HandlerUtil.getActiveWorkbenchWindow(event).getWorkbench()
+              .getActiveWorkbenchWindow().getActivePage()
+              .showView("org.apache.uima.textmarker.testing.annotationTest");
+      view.setResource(r);
+    } catch (PartInitException e) {
+      // TODO Auto-generated catch block
+      e.printStackTrace();
+    }
+
+    /*
+     * TODO Create a separate view for every tm project that is selected if
+     * (HandlerUtil.getActiveMenuSelection(event) instanceof IStructuredSelection) { // if
+     * (HandlerUtil.getCurrentSelection(event) instanceof IStructuredSelection) {
+     * StructuredSelection selection =
+     * (StructuredSelection)HandlerUtil.getActiveMenuSelection(event);; // StructuredSelection
+     * selection = (StructuredSelection)HandlerUtil.getCurrentSelection(event); Iterator iter =
+     * selection.iterator(); ArrayList<IResource> selectionList = new ArrayList<IResource>(); while
+     * (iter.hasNext()) {
+     * 
+     * Object obj = iter.next(); if (obj instanceof IResource) { selectionList.add((IResource)obj);
+     * } view.setResource(selectionList.get(0)); if (selectionList.get(0) == null) {
+     * System.out.println("keks"); } //view.setTitle(selectionList.get(0).getName()); }
+     * 
+     * ArrayList<String> testList = new ArrayList<String>();
+     * 
+     * if (view.getViewer() != null) { List list = view.getViewer().getList(); for (int i = 0; i <
+     * list.getItemCount(); i++) { String s = view.getViewer().getList().getItem(i).toString();
+     * testList.add(s); } }
+     * 
+     * IResource resource = selectionList.get(0); for (String s : testList) {
+     * 
+     * }
+     * 
+     * }
+     */
+    return null;
+  }
+
+  @Override
+  public boolean isEnabled() {
+    // TODO Auto-generated method stub
+    return true;
+  }
+
+  @Override
+  public boolean isHandled() {
+    // TODO Auto-generated method stub
+    return true;
+  }
+
+  @Override
+  public void removeHandlerListener(IHandlerListener handlerListener) {
+    // TODO Auto-generated method stub
+
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RunTestHandler.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/RunTestHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectEvaluatorHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectEvaluatorHandler.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectEvaluatorHandler.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectEvaluatorHandler.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,67 @@
+/*
+ * 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.testing.ui.handlers;
+
+import org.apache.uima.textmarker.testing.preferences.TestingPreferencePage;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class SelectEvaluatorHandler implements IHandler {
+
+  @Override
+  public void addHandlerListener(IHandlerListener handlerListener) {
+
+  }
+
+  @Override
+  public void dispose() {
+
+  }
+
+  @Override
+  public Object execute(ExecutionEvent event) throws ExecutionException {
+    Dialog dialog = PreferencesUtil.createPreferenceDialogOn(HandlerUtil.getActiveShell(event),
+            TestingPreferencePage.ID, new String[] { TestingPreferencePage.ID }, null);
+    dialog.open();
+    return null;
+  }
+
+  @Override
+  public boolean isEnabled() {
+    return true;
+  }
+
+  @Override
+  public boolean isHandled() {
+    return true;
+  }
+
+  @Override
+  public void removeHandlerListener(IHandlerListener handlerListener) {
+
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectEvaluatorHandler.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectEvaluatorHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectTypesDialog.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectTypesDialog.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectTypesDialog.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectTypesDialog.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,257 @@
+/*
+ * 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.testing.ui.handlers;
+
+import java.awt.Toolkit;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.textmarker.testing.ui.views.TestViewPage;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Widget;
+
+
+public class SelectTypesDialog extends Dialog implements Listener {
+
+  private Shell shell;
+
+  private Text typeNameUI;
+
+  private Table matchingTypesUI;
+
+  // private Table nameSpacesUI;
+
+  public String typeName = "error-TypeName-never-set";
+
+  private Button okButton;
+
+  private Button cancelButton;
+
+  private TestViewPage owner;
+
+  private List<String> types;
+
+  private List<String> excluded;
+
+  public SelectTypesDialog(Shell shell, List<String> types, TestViewPage owner) {
+    super(shell);
+    this.shell = shell;
+    this.types = types;
+    this.owner = owner;
+    this.excluded = owner.getExcludedTypes();
+    createDialogArea();
+    init();
+  }
+
+  protected Control createDialogArea() {
+    Composite mainArea = (Composite) createDialogArea(shell);
+    createWideLabel(mainArea, "  Type Name:");
+
+    typeNameUI = newText(mainArea, SWT.SINGLE, "Specify the type name");
+    typeNameUI.addListener(SWT.Modify, this);
+
+    createWideLabel(mainArea, "  Matching Types:");
+
+    matchingTypesUI = newTable(mainArea, SWT.CHECK);
+    ((GridData) matchingTypesUI.getLayoutData()).heightHint = 250;
+    ((GridData) matchingTypesUI.getLayoutData()).minimumHeight = 100;
+    typeNameUI.addListener(SWT.CHECK, this);
+
+    displayFilteredTypes("");
+    createButtonBar(mainArea);
+    return mainArea;
+  }
+
+  @Override
+  protected Control createDialogArea(Composite parent) {
+    Composite composite = new Composite(parent, SWT.NONE);
+    GridLayout layout = new GridLayout();
+    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+    layout.verticalSpacing = 3;
+    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+    composite.setLayout(layout);
+    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+    applyDialogFont(composite);
+    return composite;
+  }
+
+  @Override
+  protected Control createButtonBar(Composite parent) {
+    Composite composite = new Composite(parent, SWT.NONE);
+    GridLayout layout = new GridLayout();
+    layout.numColumns = 0;
+    layout.makeColumnsEqualWidth = true;
+    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+    composite.setLayout(layout);
+    GridData data = new GridData(SWT.CENTER, SWT.CENTER, false, false);
+    composite.setLayoutData(data);
+
+    createButtonsForButtonBar(composite);
+    return composite;
+  }
+
+  @Override
+  protected void createButtonsForButtonBar(Composite parent) {
+    okButton = createButton(parent, IDialogConstants.OK_ID, "OK", true);
+    cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, "    Cancel    ", false);
+  }
+
+  private void init() {
+
+    TableItem[] items = matchingTypesUI.getItems();
+    for (TableItem tableItem : items) {
+      if (excluded.contains(tableItem.getText())) {
+        tableItem.setChecked(true);
+      }
+    }
+
+    okButton.addSelectionListener(new SelectionAdapter() {
+      @Override
+      public void widgetSelected(SelectionEvent event) {
+        TableItem[] items = matchingTypesUI.getItems();
+        List<String> selection = new ArrayList<String>();
+        for (TableItem tableItem : items) {
+          if (tableItem.getChecked()) {
+            selection.add(tableItem.getText());
+          }
+        }
+        owner.setExcludedTypes(selection);
+        shell.dispose();
+      }
+    });
+
+    cancelButton.addSelectionListener(new SelectionAdapter() {
+      @Override
+      public void widgetSelected(SelectionEvent event) {
+        shell.dispose();
+      }
+    });
+
+    Display display = Display.getDefault();
+    int width = 300;
+    int height = 400;
+    shell.setSize(width, height);
+    shell.setMinimumSize(200, 250);
+    shell.setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - width) / 2, (Toolkit
+            .getDefaultToolkit().getScreenSize().height - height) / 2);
+    shell.setLayout(new FillLayout());
+    shell.layout();
+    shell.open();
+    while (!shell.isDisposed()) {
+      if (!display.readAndDispatch())
+        display.sleep();
+    }
+
+  }
+
+  protected Label createWideLabel(Composite parent, String message) {
+    Label label = null;
+    label = new Label(parent, SWT.WRAP);
+    label.setText(null != message ? message : "");
+    GridData data = new GridData(GridData.FILL_HORIZONTAL);
+    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+    data.verticalAlignment = SWT.CENTER;
+    label.setLayoutData(data);
+    return label;
+  }
+
+  protected Text newText(Composite parent, int style, String tip) {
+    Text t = new Text(parent, style | SWT.BORDER);
+    t.setToolTipText(tip);
+    t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+    t.addListener(SWT.KeyUp, this);
+    t.addListener(SWT.MouseUp, this);
+    return t;
+  }
+
+  protected Table newTable(Composite parent, int style) {
+    Table table = new Table(parent, style | SWT.BORDER);
+    GridData gd = new GridData(GridData.FILL_BOTH);
+    table.setLayoutData(gd);
+    table.addListener(SWT.Selection, this);
+    table.addListener(SWT.KeyUp, this);
+    return table;
+  }
+
+  private void displayFilteredTypes(String aTypeName) {
+    matchingTypesUI.setRedraw(false);
+    matchingTypesUI.removeAll();
+    String topEntry = "";
+    aTypeName = aTypeName.toLowerCase();
+    for (String type : types) {
+      String candidateTypeName = type.toLowerCase();
+      if (aTypeName.trim().equals("") || candidateTypeName.indexOf(aTypeName) != -1) {
+
+        if (topEntry.equals("")) {
+          topEntry = type;
+        }
+        TableItem item = new TableItem(matchingTypesUI, SWT.NULL);
+        item.setText(type);
+        if (excluded.contains(item.getText())) {
+          item.setChecked(true);
+        }
+
+      }
+    }
+    matchingTypesUI.setRedraw(true);
+  }
+
+  public void handleEvent(Event event) {
+    if (event.widget == typeNameUI && event.type == SWT.Modify) {
+      displayFilteredTypes(typeNameUI.getText());
+    } else if (event.widget == matchingTypesUI) {
+      Widget item = event.item;
+      if (item instanceof TableItem) {
+        TableItem ti = (TableItem) item;
+        if (ti.getChecked()) {
+          excluded.add(ti.getText());
+        } else {
+          excluded.remove(ti.getText());
+        }
+      }
+    }
+  }
+
+  public boolean isValid() {
+    return true;
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectTypesDialog.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectTypesDialog.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectedExcludedTypesHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectedExcludedTypesHandler.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectedExcludedTypesHandler.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectedExcludedTypesHandler.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,121 @@
+/*
+ * 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.testing.ui.handlers;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.resource.metadata.TypeDescription;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.apache.uima.textmarker.addons.TextMarkerAddonsPlugin;
+import org.apache.uima.textmarker.ide.core.builder.TextMarkerProjectUtils;
+import org.apache.uima.textmarker.testing.ui.views.TestPageBookView;
+import org.apache.uima.textmarker.testing.ui.views.TestViewPage;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XMLInputSource;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class SelectedExcludedTypesHandler implements IHandler {
+
+  @Override
+  public void addHandlerListener(IHandlerListener handlerListener) {
+
+  }
+
+  @Override
+  public void dispose() {
+
+  }
+
+  @Override
+  public Object execute(ExecutionEvent event) throws ExecutionException {
+    TestPageBookView debugView = (TestPageBookView) HandlerUtil.getActivePart(event);
+    TestViewPage activePage = (TestViewPage) debugView.getCurrentPage();
+    IResource resource = activePage.getResource();
+    IPath location = resource.getLocation();
+    String preFilePath = location.toPortableString();
+    File preFile = new File(preFilePath);
+    if (preFile.exists() == false || preFilePath.equals("")) {
+      printErrorDialog("The preprocessing file was not found!");
+      return null;
+    }
+    TypeSystemDescription defaultTypeSystemDescription = null;
+    List<String> types = new ArrayList<String>();
+    try {
+      String tsDesc = TextMarkerProjectUtils.getTypeSystemDescriptorPath(location,
+              resource.getProject()).toPortableString();
+
+      defaultTypeSystemDescription = UIMAFramework.getXMLParser().parseTypeSystemDescription(
+              new XMLInputSource(new File(tsDesc)));
+      defaultTypeSystemDescription.resolveImports();
+      TypeDescription[] systemTypes = defaultTypeSystemDescription.getTypes();
+      for (TypeDescription typeDescription : systemTypes) {
+        types.add(typeDescription.getName());
+      }
+      Collections.sort(types);
+    } catch (InvalidXMLException e) {
+      TextMarkerAddonsPlugin.error(e);
+    } catch (IOException e) {
+      TextMarkerAddonsPlugin.error(e);
+    }
+    Display display = Display.getDefault();
+    Shell shell = new Shell(display, SWT.RESIZE | SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
+    shell.setText("Excluded types");
+    new SelectTypesDialog(shell, types, activePage);
+    return null;
+  }
+
+  @Override
+  public boolean isEnabled() {
+    return true;
+  }
+
+  @Override
+  public boolean isHandled() {
+    return true;
+  }
+
+  public static void printErrorDialog(String error) {
+    ErrorDialog.openError(Display.getCurrent().getActiveShell(), "File not Found!", error,
+            new Status(IStatus.ERROR, "-1", "File not found!"));
+  }
+
+  @Override
+  public void removeHandlerListener(IHandlerListener handlerListener) {
+
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectedExcludedTypesHandler.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/handlers/SelectedExcludedTypesHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/EvalDataDialog.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/EvalDataDialog.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/EvalDataDialog.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/EvalDataDialog.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,62 @@
+/*
+ * 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.testing.ui.views;
+
+import org.eclipse.jface.window.ApplicationWindow;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class EvalDataDialog extends ApplicationWindow {
+  
+  Composite overlay;
+  String data;
+  public EvalDataDialog(Shell parentShell, String data) {
+    super(parentShell);
+    this.data=data;
+    // TODO Auto-generated constructor stub
+  }
+  
+  protected Control createContents (Composite parent) {
+    GridLayout layout = new GridLayout();
+    parent.setLayout(layout);
+    parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+    
+    
+    
+    Text text = new Text (parent, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
+    text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
+    text.setText("No data aviable");
+    text.setLayoutData(new GridData(GridData.FILL_BOTH));
+    
+    if (text != null) {
+      text.setText(data);
+    }
+    
+    return parent;
+    
+    
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/EvalDataDialog.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/EvalDataDialog.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/InfoPanel.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/InfoPanel.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/InfoPanel.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/InfoPanel.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,155 @@
+/*
+ * 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.testing.ui.views;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class InfoPanel extends Composite {
+
+  private final Image fErrorIcon = TestViewPage.createImage("/icons/error_ovr.gif"); //$NON-NLS-1$
+
+  private final Image fFailureIcon = TestViewPage.createImage("/icons/failed_ovr.gif"); //$NON-NLS-1$
+
+  Text fileLabel;
+
+  Text runLabel;
+
+  Text fpLabel;
+
+  Text fnLabel;
+
+  Text fMLabel;
+
+  Combo comboBox;
+
+  public InfoPanel(Composite parent) {
+    super(parent, SWT.WRAP);
+    GridLayout gridLayout = new GridLayout();
+    gridLayout.numColumns = 4;
+    setLayout(gridLayout);
+
+    Composite fileInfoComposite = new Composite(this, SWT.WRAP);
+    GridLayout fileInfoLayout = new GridLayout();
+    fileInfoLayout.numColumns = 3;
+    fileInfoComposite.setLayout(fileInfoLayout);
+
+    GridData fileInfoData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+    // fileInfoData.grabExcessHorizontalSpace = true;
+    fileInfoComposite.setLayoutData(fileInfoData);
+    fileLabel = createLabel("Script :", null, "--", fileInfoComposite);
+
+    comboBox = new Combo(this, SWT.DROP_DOWN);
+    comboBox.add("_InitialView");
+    comboBox.select(0);
+
+    Composite testInfoComposite = new Composite(this, SWT.WRAP);
+    GridData data = new GridData();
+    data.horizontalSpan = 2;
+    testInfoComposite.setLayoutData(data);
+
+    GridLayout testInfoLayout = new GridLayout();
+    testInfoLayout.numColumns = 12;
+
+    GridData testInfoData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
+            | GridData.FILL_HORIZONTAL);
+    testInfoComposite.setLayoutData(testInfoData);
+    testInfoComposite.setLayout(testInfoLayout);
+
+    runLabel = createLabel("TP :", null, "0", testInfoComposite);
+    fpLabel = createLabel("FP :", fErrorIcon, "0", testInfoComposite);
+    fnLabel = createLabel("FN :", fFailureIcon, "0", testInfoComposite);
+    fMLabel = createLabel("F1 :", null, "0", testInfoComposite);
+  }
+
+  public void dispose() {
+    super.dispose();
+    fErrorIcon.dispose();
+    fFailureIcon.dispose();
+  }
+
+  private Text createLabel(String name, Image image, String init, Composite parent) {
+
+    Label label = new Label(parent, SWT.NONE);
+    if (image != null) {
+      image.setBackground(label.getBackground());
+      label.setImage(image);
+    }
+    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+    label = new Label(parent, SWT.NONE);
+    label.setText(name);
+    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+    // label.setFont(JFaceResources.getBannerFont());
+
+    Text value = new Text(parent, SWT.READ_ONLY);
+    value.setText(init);
+    // bug: 39661 Junit test counters do not repaint correctly [JUnit]
+    value.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+    value
+            .setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
+                    | GridData.FILL_HORIZONTAL));
+    return value;
+  }
+
+  public void setRuns(int x) {
+    this.runLabel.setText(String.valueOf(x));
+  }
+
+  public void setFP(int x) {
+    fpLabel.setText(String.valueOf(x));
+
+  }
+
+  public void setFN(int x) {
+    fnLabel.setText(String.valueOf(x));
+  }
+
+  public void setFilename(String filename) {
+    fileLabel.setText(filename);
+  }
+
+  public void setFMeasure(double f) {
+    fMLabel.setText(String.valueOf(f));
+  }
+
+  public Combo getComboBox() {
+    return comboBox;
+  }
+
+  public String getSelectedViewCasName() {
+    return comboBox.getText();
+  }
+
+  public void addCASViewNamesToCombo(List<String> list) {
+    for (String s : list) {
+      comboBox.add(s);
+    }
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/InfoPanel.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/InfoPanel.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListContentProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListContentProvider.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListContentProvider.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListContentProvider.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,43 @@
+/*
+ * 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.testing.ui.views;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+public class ListContentProvider implements IStructuredContentProvider {
+
+  @Override
+  public Object[] getElements(Object inputElement) {
+    return ((ArrayList<?>) inputElement).toArray();
+  }
+
+  @Override
+  public void dispose() {
+
+  }
+
+  @Override
+  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/testing/ui/views/ListContentProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListContentProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListDropAdapter.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListDropAdapter.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListDropAdapter.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListDropAdapter.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.testing.ui.views;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.ViewerDropAdapter;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.TransferData;
+
+public class ListDropAdapter extends ViewerDropAdapter {
+
+  public ListDropAdapter(TableViewer viewer) {
+    super(viewer);
+  }
+
+  @Override
+  public boolean performDrop(Object data) {
+
+    String[] filesArray = (String[]) data;
+    TableViewer viewer = (TableViewer) getViewer();
+
+    ArrayList<TestCasData> testCASes;
+    if (viewer.getInput() == null) {
+      testCASes = new ArrayList<TestCasData>();
+    } else {
+      testCASes = (ArrayList) viewer.getInput();
+    }
+
+    for (int i = 0; i < filesArray.length; i++) {
+      if (filesArray[i].endsWith("xmi")) {
+        TestCasData testData = new TestCasData(new Path(filesArray[i]));
+        testCASes.add(testData);
+      }
+    }
+    viewer.setInput(testCASes);
+    viewer.refresh();
+    return true;
+  }
+
+  @Override
+  public boolean validateDrop(Object target, int operation, TransferData transferType) {
+    // TODO Auto-generated method stub
+    return FileTransfer.getInstance().isSupportedType(transferType);
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListDropAdapter.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListDropAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListLabelProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListLabelProvider.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListLabelProvider.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListLabelProvider.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,117 @@
+/*
+ * 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.testing.ui.views;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+
+public class ListLabelProvider implements ILabelProvider {
+
+  private final Image blue = TestViewPage.createImage("/icons/bullet_blue.png"); //$NON-NLS-1$
+
+  private final Image green = TestViewPage.createImage("/icons/bullet_green.png"); //$NON-NLS-1$
+
+  private final Image yellow = TestViewPage.createImage("/icons/bullet_yellow.png"); //$NON-NLS-1$
+
+  private final Image orange = TestViewPage.createImage("/icons/bullet_orange.png"); //$NON-NLS-1$
+
+  private final Image red = TestViewPage.createImage("/icons/bullet_red.png"); //$NON-NLS-1$
+
+  private final Image black = TestViewPage.createImage("/icons/bullet_black.png"); //$NON-NLS-1$
+
+  private final Image pink = TestViewPage.createImage("/icons/bullet_pink.png"); //$NON-NLS-1$
+
+  @Override
+  public Image getImage(Object element) {
+    if (element instanceof TestCasData) {
+      TestCasData testData = (TestCasData) element;
+      if (testData.getResultPath() == null) {
+        return black;
+      } else {
+        int tp = testData.getTruePositiveCount();
+        int fp = testData.getFalsePositiveCount();
+        int fn = testData.getFalseNegativeCount();
+        int error = fp + fn;
+        double percent = ((double) error / (double) tp);
+        if (fp == 0 && fn == 0) {
+          return green;
+        } else if (percent >= 0.25) {
+          return red;
+        } else if (percent <= 0.05) {
+          return yellow;
+        } else if (percent < 0.25) {
+          return orange;
+        } else if (fp == 0) {
+          return blue;
+        } else if (fn == 0) {
+          return pink;
+        }
+
+      }
+    }
+    return black;
+  }
+
+  @Override
+  public String getText(Object element) {
+    if (element instanceof TestCasData) {
+      TestCasData testData = (TestCasData) element;
+      String lastSegment = testData.getPath().lastSegment();
+      if (testData.getResultPath() == null) {
+        lastSegment += " [not available]";
+      } else {
+        int tp = testData.getTruePositiveCount();
+        int fp = testData.getFalsePositiveCount();
+        int fn = testData.getFalseNegativeCount();
+        lastSegment += " [" + tp + "|" + fp + "|" + fn + "]";
+      }
+      return lastSegment;
+    }
+    return "error";
+  }
+
+  @Override
+  public void addListener(ILabelProviderListener listener) {
+
+  }
+
+  @Override
+  public void dispose() {
+    black.dispose();
+    blue.dispose();
+    pink.dispose();
+    green.dispose();
+    yellow.dispose();
+    orange.dispose();
+    red.dispose();
+  }
+
+  @Override
+  public boolean isLabelProperty(Object element, String property) {
+    return false;
+  }
+
+  @Override
+  public void removeListener(ILabelProviderListener listener) {
+
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListLabelProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/ListLabelProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/OutputFolder.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/OutputFolder.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/OutputFolder.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/OutputFolder.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,79 @@
+/*
+ * 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.testing.ui.views;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+
+public class OutputFolder extends Composite {
+
+  public OutputFolder(Composite parent) {
+    super(parent, SWT.WRAP);
+    GridLayout gridLayout = new GridLayout();
+    gridLayout.numColumns = 1;
+    setLayout(gridLayout);
+
+    TabFolder tFolder = new TabFolder(this, SWT.WRAP);
+
+    // TabItem failures = new TabItem(tFolder, SWT.NONE);
+    // failures.setText("Failures");
+    // Text failuresText = new Text(tFolder, SWT.BORDER | SWT.MULTI);
+    // failuresText.setText("Failures Info");
+    // failures.setControl(failuresText);
+    //		
+    // TabItem falsePositives = new TabItem (tFolder,SWT.NONE);
+    // falsePositives.setText("False Positives");
+    // Text fPositivesText = new Text (tFolder, SWT.BORDER | SWT.MULTI);
+    // fPositivesText.setText("False Positives");
+    // falsePositives.setControl(fPositivesText);
+    //		
+    // TabItem falseNegatives = new TabItem (tFolder,SWT.NONE);
+    // falseNegatives.setText("False Negatives");
+    // Text fNegativesText = new Text(tFolder, SWT.BORDER | SWT.MULTI);
+    // fNegativesText.setText("False Negatives");
+    // falseNegatives.setControl(fNegativesText);
+
+    TabItem failuresTab = createTab(tFolder, "Failures", "Insert Failures here");
+    TabItem fPositivesTab = createTab(tFolder, "FPositives", "Insert false positives here");
+    TabItem fNegativesTab = createTab(tFolder, "FNegatives", "Insert false negatives here");
+
+    GridData tFolderData = new GridData();
+    tFolderData.horizontalAlignment = GridData.FILL;
+    tFolderData.verticalAlignment = GridData.FILL;
+    tFolderData.horizontalSpan = 1;
+    tFolderData.grabExcessHorizontalSpace = true;
+    tFolderData.grabExcessVerticalSpace = true;
+    tFolder.setLayoutData(tFolderData);
+  }
+
+  private TabItem createTab(TabFolder tFolder, String name, String input) {
+    TabItem tab = new TabItem(tFolder, SWT.NONE);
+    tab.setText(name);
+    Text text = new Text(tFolder, SWT.BORDER | SWT.MULTI);
+    text.setText(input);
+    tab.setControl(text);
+    return tab;
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/OutputFolder.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/testing/ui/views/OutputFolder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain