Ejemplo n.º 1
0
  @Override
  public void disposeUIResources() {
    if (!myUiInitialized) return;
    final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(myProject);
    propertiesComponent.setValue("project.structure.last.edited", myUiState.lastEditedConfigurable);
    propertiesComponent.setValue(
        "project.structure.proportion", String.valueOf(myUiState.proportion));
    propertiesComponent.setValue(
        "project.structure.side.proportion", String.valueOf(myUiState.sideProportion));

    myWasUiDisposed = true;

    myUiState.proportion = mySplitter.getProportion();
    saveSideProportion();
    myContext.getDaemonAnalyzer().stop();
    for (Configurable each : myName2Config) {
      each.disposeUIResources();
    }
    myContext.clear();
    myName2Config.clear();

    myModuleConfigurator.getFacetsConfigurator().clearMaps();

    Disposer.dispose(myErrorsComponent);

    myUiInitialized = false;
  }
  public void disposeUIResources() {
    if (myUiDisposed) return;

    super.disposeUIResources();

    myUiDisposed = true;

    myAutoScrollHandler.cancelAllRequests();

    myContext.getDaemonAnalyzer().clear();

    Disposer.dispose(this);
  }
  public void init(StructureConfigurableContext context) {
    myContext = context;
    myContext
        .getDaemonAnalyzer()
        .addListener(
            new ProjectStructureDaemonAnalyzerListener() {
              public void problemsChanged(@NotNull ProjectStructureElement element) {
                if (!myTree.isShowing()) return;

                myTree.revalidate();
                myTree.repaint();
              }
            });
  }
Ejemplo n.º 4
0
 @Override
 public void setDisplayName(String name) {
   name = name.trim();
   final ModifiableModuleModel modifiableModuleModel = myConfigurator.getModuleModel();
   if (StringUtil.isEmpty(name)) return; // empty string comes on double click on module node
   if (Comparing.strEqual(name, myModuleName)) return; // nothing changed
   try {
     modifiableModuleModel.renameModule(myModule, name);
   } catch (ModuleWithNameAlreadyExistsException ignored) {
   }
   myConfigurator.moduleRenamed(myModule, myModuleName, name);
   myModuleName = name;
   myConfigurator.setModified(!Comparing.strEqual(myModuleName, myModule.getName()));
   myContext.getDaemonAnalyzer().queueUpdateForAllElementsWithErrors();
 }
  public void reset() {
    myUiDisposed = false;

    if (!myWasTreeInitialized) {
      initTree();
      myTree.setShowsRootHandles(false);
      loadTree();
    } else {
      super.disposeUIResources();
      myTree.setShowsRootHandles(false);
      loadTree();
    }
    for (ProjectStructureElement element : getProjectStructureElements()) {
      myContext.getDaemonAnalyzer().queueUpdate(element);
    }

    super.reset();
  }
Ejemplo n.º 6
0
  @Override
  public void reset() {
    // need this to ensure VFS operations will not block because of storage flushing
    // and other maintenance IO tasks run in background
    HeavyProcessLatch.INSTANCE.processStarted();

    try {
      myWasUiDisposed = false;

      myContext.reset();

      myProjectJdksModel.reset(myProject);

      Configurable toSelect = null;
      for (Configurable each : myName2Config) {
        if (myUiState.lastEditedConfigurable != null
            && myUiState.lastEditedConfigurable.equals(each.getDisplayName())) {
          toSelect = each;
        }
        if (each instanceof MasterDetailsComponent) {
          ((MasterDetailsComponent) each).setHistory(myHistory);
        }
        each.reset();
      }

      myHistory.clear();

      if (toSelect == null && myName2Config.size() > 0) {
        toSelect = myName2Config.iterator().next();
      }

      removeSelected();

      navigateTo(toSelect != null ? createPlaceFor(toSelect) : null, false);

      if (myUiState.proportion > 0) {
        mySplitter.setProportion(myUiState.proportion);
      }
    } finally {
      HeavyProcessLatch.INSTANCE.processFinished();
    }
  }
Ejemplo n.º 7
0
  @Override
  public void apply() throws ConfigurationException {
    for (Configurable each : myName2Config) {
      if (each instanceof BaseStructureConfigurable && each.isModified()) {
        ((BaseStructureConfigurable) each).checkCanApply();
      }
    }
    for (Configurable each : myName2Config) {
      if (each.isModified()) {
        each.apply();
      }
    }

    myContext.getDaemonAnalyzer().clearCaches();
    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            BuildManager.getInstance().scheduleAutoMake();
          }
        });
  }