private void removeFromEditor() {
    Editor editor = mySearchResults.getEditor();
    if (myReplacementBalloon != null) {
      myReplacementBalloon.hide();
    }

    if (editor != null) {

      for (VisibleAreaListener visibleAreaListener : myVisibleAreaListenersToRemove) {
        editor.getScrollingModel().removeVisibleAreaListener(visibleAreaListener);
      }
      myVisibleAreaListenersToRemove.clear();
      Project project = mySearchResults.getProject();
      if (project != null && !project.isDisposed()) {
        for (RangeHighlighter h : myHighlighters) {
          HighlightManager.getInstance(project).removeSegmentHighlighter(editor, h);
        }
        if (myCursorHighlighter != null) {
          HighlightManager.getInstance(project)
              .removeSegmentHighlighter(editor, myCursorHighlighter);
          myCursorHighlighter = null;
        }
      }
      myHighlighters.clear();
      if (myListeningSelection) {
        editor.getSelectionModel().removeSelectionListener(this);
        myListeningSelection = false;
      }
    }
  }
 public void clear() {
   for (EditorWindow window : myWindows) {
     window.dispose();
   }
   removeAll();
   myWindows.clear();
   setCurrentWindow(null);
   repaint(); // revalidate doesn't repaint correctly after "Close All"
 }
 private void selectionChanged() {
   myBackSlashPressed.clear();
   UIUtil.invokeLaterIfNeeded(
       new Runnable() {
         @Override
         public void run() {
           updateEditorsFromProperties();
         }
       });
 }
 @TestOnly
 public void dropAllUnsavedDocuments() {
   if (!ApplicationManager.getApplication().isUnitTestMode()) {
     throw new RuntimeException("This method is only for test mode!");
   }
   ApplicationManager.getApplication().assertWriteAccessAllowed();
   if (!myUnsavedDocuments.isEmpty()) {
     myUnsavedDocuments.clear();
     fireUnsavedDocumentsDropped();
   }
 }
Beispiel #5
0
 public void resetListOfExpandedNodes() {
   expandedNodes.clear();
   for (int i = 1; i < getTree().getRowCount(); i++) {
     if (getTree().isExpanded(i)) {
       Object o = getTree().getPathForRow(i).getLastPathComponent();
       if (o instanceof Config) {
         expandedNodes.add(o);
       }
     }
   }
 }
 public void disposeUIResources() {
   myState.getProportions().saveSplitterProportions(myWholePanel);
   myAutoScrollHandler.cancelAllRequests();
   myDetails.disposeUIResources();
   myInitializedConfigurables.clear();
   clearChildren();
   final String key = getComponentStateKey();
   final MasterDetailsStateService stateService = getStateService();
   if (key != null && stateService != null) {
     stateService.setComponentState(key, getState());
   }
   myCurrentConfigurable = null;
 }
 private void updateFileIconLater(VirtualFile file) {
   myFilesToUpdateIconsFor.add(file);
   myIconUpdaterAlarm.cancelAllRequests();
   myIconUpdaterAlarm.addRequest(
       () -> {
         if (myManager.getProject().isDisposed()) return;
         for (VirtualFile file1 : myFilesToUpdateIconsFor) {
           updateFileIconImmediately(file1);
         }
         myFilesToUpdateIconsFor.clear();
       },
       200,
       ModalityState.stateForComponent(this));
 }
 public void apply() throws ConfigurationException {
   if (!myModifiedModificators.isEmpty()) {
     mySdkSettingsWereModified.run();
   }
   for (SdkModificator modificator : myModifiedModificators) {
     /* This should always be true barring bug elsewhere, log error on else? */
     if (modificator.isWritable()) {
       modificator.commitChanges();
     }
   }
   myModificators.clear();
   myModifiedModificators.clear();
   mySdkListChanged = false;
   final Sdk sdk = getSelectedSdk();
   myShowMoreCallback.consume(sdk);
   PyPackageManagers.getInstance().clearCache(sdk);
   Disposer.dispose(getDisposable());
 }
  private void collectGroupingRules() {
    for (BreakpointPanelProvider provider : myBreakpointsPanelProviders) {
      provider.createBreakpointsGroupingRules(myRulesAvailable);
    }

    myRulesEnabled.clear();
    XBreakpointsDialogState settings = (getBreakpointManager()).getBreakpointsDialogSettings();

    for (XBreakpointGroupingRule rule : myRulesAvailable) {
      if (rule.isAlwaysEnabled()
          || (settings != null && settings.getSelectedGroupingRules().contains(rule.getId()))) {
        myRulesEnabled.add(rule);
      }
    }

    for (XBreakpointGroupingRule rule : myRulesAvailable) {
      if (!rule.isAlwaysEnabled()) {
        myToggleRuleActions.add(new ToggleBreakpointGroupingRuleEnabledAction(rule));
      }
    }
  }
 public void clear() {
   removeAll();
   myWindows.clear();
   setCurrentWindow(null);
   repaint(); // revalidate doesn't repaint correctly after "Close All"
 }
Beispiel #11
0
 public DISCARD resetIgnoredMembers() {
   ignoredMembers.clear();
   return this;
 }
  /**
   * Linear forward search algorithm
   *
   * @param p
   * @param algorithm
   * @param targetVars
   * @param _computeAll
   * @return
   */
  private boolean linearForwardSearch(
      PlanningContext context, EvaluationAlgorithm algorithm, boolean _computeAll) {

    /*
     * while iterating through hashset, items cant be removed from/added to
     * that set. Theyre collected into these sets and added/removedall
     * together after iteration is finished
     */
    Set<Var> newVars = new LinkedHashSet<Var>();
    Set<Var> relOutputs = new LinkedHashSet<Var>();
    Set<Var> removableVars = new LinkedHashSet<Var>();

    boolean changed = true;

    if (isLinearLoggingOn())
      logger.debug(
          "------Starting linear planning with (sub)goals: "
              + context.getRemainingGoals()
              + "--------");

    if (isLinearLoggingOn()) logger.debug("Algorithm " + algorithm);

    int counter = 1;

    while ((!_computeAll && changed && !context.getRemainingGoals().isEmpty())
        || (changed && _computeAll)) {

      if (isLinearLoggingOn()) logger.debug("----Iteration " + counter + " ----");

      counter++;
      changed = false;

      // iterate through all knownvars
      if (isLinearLoggingOn()) logger.debug("Known:" + context.getKnownVars());

      for (Var var : context.getKnownVars()) {

        if (isLinearLoggingOn()) logger.debug("Current Known: " + var);

        // Check the relations of all components
        for (Rel rel : var.getRels()) {
          if (isLinearLoggingOn()) logger.debug("And its rel: " + rel);
          if (context.isAvailableRel(rel)) {
            context.removeUnknownInput(rel, var);

            if (isLinearLoggingOn()) logger.debug("problem contains it " + rel);

            removableVars.add(var);

            if (context.isRelReadyToUse(rel) && rel.getType() != RelType.TYPE_METHOD_WITH_SUBTASK) {

              if (isLinearLoggingOn()) logger.debug("rel is ready to be used " + rel);

              boolean relIsNeeded = false;

              if (isLinearLoggingOn()) logger.debug("its outputs " + rel.getOutputs());

              for (Var relVar : rel.getOutputs()) {

                if (!context.getFoundVars().contains(relVar)) {
                  relIsNeeded = true;
                }
              }

              if (rel.getOutputs().isEmpty()) {
                relIsNeeded = true;
              }
              if (isLinearLoggingOn()) logger.debug("relIsNeeded " + relIsNeeded);

              if (relIsNeeded) {

                if (isLinearLoggingOn()) logger.debug("needed rel:  " + rel);

                if (!rel.getOutputs().isEmpty()) {
                  relOutputs.clear();
                  unfoldVarsToSet(rel.getOutputs(), relOutputs);
                  newVars.addAll(relOutputs);
                  context.getFoundVars().addAll(relOutputs);
                }
                algorithm.addRel(rel);
                if (isLinearLoggingOn()) logger.debug("algorithm " + algorithm);
              }

              context.removeRel(rel);
              changed = true;
            }
          }
        }
      }

      // remove targets if they have already been found
      for (Iterator<Var> targetIter = context.getRemainingGoals().iterator();
          targetIter.hasNext(); ) {
        Var targetVar = targetIter.next();
        if (context.getFoundVars().contains(targetVar)) {
          targetIter.remove();
        }
      }

      if (isLinearLoggingOn()) logger.debug("foundvars " + context.getFoundVars());

      context.getKnownVars().addAll(newVars);
      context.getKnownVars().removeAll(removableVars);
      newVars.clear();
    }
    if (isLinearLoggingOn()) logger.debug("algorithm " + algorithm);

    if (!_computeAll) {
      Optimizer.optimize(context, algorithm);

      if (isLinearLoggingOn()) logger.debug("optimized algorithm " + algorithm);
    }

    if (isLinearLoggingOn()) logger.debug("\n---!!!Finished linear planning!!!---\n");

    return context.getRemainingGoals().isEmpty()
        || context.getFoundVars().containsAll(context.getAllGoals());
  }