Examples of TestViewPage


Examples of org.apache.uima.ruta.testing.ui.views.TestViewPage

  }

  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 || StringUtils.isEmpty(preFilePath)) {
      printErrorDialog("The preprocessing file was not found!");
      return null;
    }
    TypeSystemDescription defaultTypeSystemDescription = null;
    List<String> types = new ArrayList<String>();
    try {
      String tsDesc = RutaProjectUtils.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) {
      RutaAddonsPlugin.error(e);
    } catch (IOException e) {
      RutaAddonsPlugin.error(e);
    }

    Display display = Display.getDefault();
    Shell shell = new Shell(display, SWT.RESIZE | SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
    shell.setText("Select excluded types");
    SelectTypesDialog dialog = new SelectTypesDialog(shell, types, activePage.getExcludedTypes());
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    List<String> selectedTypes = dialog.getSelectedTypes();
    activePage.setExcludedTypes(selectedTypes);
    return Status.OK_STATUS;
  }
View Full Code Here

Examples of org.apache.uima.ruta.testing.ui.views.TestViewPage

  }

  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();
View Full Code Here

Examples of org.apache.uima.ruta.testing.ui.views.TestViewPage

public class ExportTabelHandler extends AbstractHandler {

  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";
   
View Full Code Here

Examples of org.apache.uima.ruta.testing.ui.views.TestViewPage

  }

  public Object execute(ExecutionEvent event) throws ExecutionException {
   
    TestPageBookView debugView = (TestPageBookView) HandlerUtil.getActivePart(event);
    TestViewPage page = (TestViewPage) debugView.getCurrentPage();
    page.previousState();
    return null;
  }
View Full Code Here

Examples of org.apache.uima.ruta.testing.ui.views.TestViewPage

  }

  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 || StringUtils.isEmpty(preFilePath)) {
      printErrorDialog("The preprocessing file was not found!");
      return null;
    }
    TypeSystemDescription defaultTypeSystemDescription = null;
    List<String> types = new ArrayList<String>();
    try {
      String tsDesc = RutaProjectUtils.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) {
      RutaAddonsPlugin.error(e);
    } catch (IOException e) {
      RutaAddonsPlugin.error(e);
    }
    Display display = Display.getDefault();
    Shell shell = new Shell(display, SWT.RESIZE | SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
    shell.setText("Select included types");
    SelectTypesDialog dialog = new SelectTypesDialog(shell, types, activePage.getIncludedTypes());
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    List<String> selectedTypes = dialog.getSelectedTypes();
    activePage.setIncludedTypes(selectedTypes);
    return Status.OK_STATUS;
  }
View Full Code Here

Examples of org.apache.uima.ruta.testing.ui.views.TestViewPage

  }

  public Object execute(ExecutionEvent event) throws ExecutionException {
    TestPageBookView debugView = (TestPageBookView) HandlerUtil.getActivePart(event);
    TestViewPage page = (TestViewPage) debugView.getCurrentPage();
    page.nextState();
    return null;
  }
View Full Code Here

Examples of org.apache.uima.ruta.testing.ui.views.TestViewPage

  }

  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,
            debugPage.getExcludedTypes(), debugPage.getIncludedTypes());

    job.addJobChangeListener(new DebugJobChangeAdapter(debugPage) {
    });

    job.schedule();
View Full Code Here

Examples of org.apache.uima.ruta.testing.ui.views.TestViewPage

    @Override
    public IStatus run(IProgressMonitor monitor) {

      // handle GUI
      final TestPageBookView testPageView = (TestPageBookView) HandlerUtil.getActivePart(event);
      final TestViewPage debugPage = (TestViewPage) testPageView.getCurrentPage();
      debugPage.saveState();
      testPageView.showBusy(true);

      // init variables
      IResource r = debugPage.getResource();
      final IFile fScript = (IFile) r;
      final IProject project = r.getProject();
      final IPath engineDescriptorPath = RutaProjectUtils.getEngineDescriptorPath(r.getLocation(),
              project);
      IPath typeSystemDescriptorPath = RutaProjectUtils.getTypeSystemDescriptorPath(
              fScript.getLocation(), project);

      // show message
      @SuppressWarnings({ "unchecked", "rawtypes" })
      ArrayList<TestCasData> testCasData = (ArrayList) debugPage.getViewer().getInput();
      int numFiles = testCasData.size();
      monitor.beginTask("Running evaluation, please wait", numFiles);

      // switch usage mode: old (only Ruta) vs. new (supports java/uimaFIT AEs)
      IPreferenceStore store = RutaAddonsPlugin.getDefault().getPreferenceStore();
View Full Code Here

Examples of org.apache.uima.ruta.testing.ui.views.TestViewPage

  }

  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.ruta.testing.annotationTest");
      view.setResource(r);
    } catch (PartInitException e) {
      RutaAddonsPlugin.error(e);
    }

    /*
 
View Full Code Here

Examples of org.apache.uima.ruta.testing.ui.views.TestViewPage

  public void dispose() {
  }

  public Object execute(ExecutionEvent event) throws ExecutionException {
    TestPageBookView debugView = (TestPageBookView) HandlerUtil.getActivePart(event);
    TestViewPage activePage = (TestViewPage) debugView.getCurrentPage();
    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();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.