/**
   * Checks, if the deleted node was the current category to map into. <br>
   * If <code>true</code>, set category to "unassigned".
   *
   * @param editor The editor in which the delete occured.
   */
  private void checkCategoryToMapInto(ObjectMappingMultiPageEditor editor) {

    ISelection sel = null;
    IObjectMappingCategoryPO categoryToMapInto = editor.getOmEditorBP().getCategoryToCreateIn();
    if (categoryToMapInto != null) {
      editor.getTreeViewer().setSelection(new StructuredSelection(categoryToMapInto));
      sel = editor.getTreeViewer().getSelection();
    }
    if (sel == null || sel.isEmpty()) {
      editor.getOmEditorBP().setCategoryToCreateIn(null);
      ObjectMappingModeSourceProvider omsp =
          (ObjectMappingModeSourceProvider)
              AbstractJBSourceProvider.getSourceProviderInstance(
                  null, ObjectMappingModeSourceProvider.ID);
      if (editor.getAut().equals(TestExecution.getInstance().getConnectedAut())
          && omsp != null
          && omsp.isRunning()) {
        String message =
            NLS.bind(
                Messages.TestExecutionContributorAUTStartedMapping,
                Messages.TestExecutionContributorCatUnassigned);
        int icon = Constants.MAPPING;
        Plugin.showStatusLine(icon, message);
      }
    }
  }
Exemplo n.º 2
0
 /**
  * clears the content of client
  *
  * @param alsoProjectIndependent whether also project independent editors should be closed such as
  *     the testresultviewer
  */
 public static void clearClient(final boolean alsoProjectIndependent) {
   final DataEventDispatcher ded = DataEventDispatcher.getInstance();
   TestExecution.getInstance().stopExecution();
   GeneralStorage gs = GeneralStorage.getInstance();
   if (gs != null && Persistor.instance() != null) {
     IProjectPO currProj = gs.getProject();
     if (currProj != null) {
       gs.nullProject();
     }
     gs.reset();
   }
   Plugin.getDisplay()
       .syncExec(
           new Runnable() {
             public void run() {
               Plugin.clearAllEditorsClipboard();
               final ProblemsBP problemsBP = ProblemsBP.getInstance();
               problemsBP.clearOldProblems();
               problemsBP.cleanupProblems();
               TestExecutionContributor.getInstance().getClientTest().resetToTesting();
               ded.fireRecordModeStateChanged(RecordModeState.notRunning);
               ded.fireOMStateChanged(OMState.notRunning);
               ded.fireProjectStateChanged(ProjectState.closed);
               Plugin.closeAllOpenedJubulaEditors(alsoProjectIndependent);
               ded.fireTestresultChanged(TestresultState.Clear);
               setTreeViewerInputNull(Constants.TESTRE_ID);
               for (TestCaseBrowser tcb : MultipleTCBTracker.getInstance().getOpenTCBs()) {
                 tcb.getTreeViewer().setInput(null);
               }
               setTreeViewerInputNull(Constants.TS_BROWSER_ID);
               setTreeViewerInputNull(Constants.COMPNAMEBROWSER_ID);
               clearAnalyzeResultPage();
             }
           });
   ded.fireProjectLoadedListener(new NullProgressMonitor());
 }