Esempio n. 1
0
  private void addConfigurable(Configurable configurable, boolean addToSidePanel) {
    myName2Config.add(configurable);

    if (addToSidePanel) {
      mySidePanel.addPlace(
          createPlaceFor(configurable), new Presentation(configurable.getDisplayName()));
    }
  }
 protected void createConfigurableTabs() {
   for (Configurable configurable : getConfigurables()) {
     myTabbedPane.addTab(
         configurable.getDisplayName(),
         configurable.getIcon(),
         configurable.createComponent(),
         null);
   }
 }
 static void warn(Configurable configurable, String action, long time) {
   if (ApplicationManager.getApplication().isDispatchThread()) {
     time = System.currentTimeMillis() - time;
     int threshold = Registry.intValue("ide.settings.configurable.loading.threshold", 0);
     if (0 < threshold && threshold < time) {
       String name = configurable.getDisplayName();
       String id = ConfigurableVisitor.ByID.getID(configurable);
       LOG.warn(String.valueOf(time) + " ms to " + action + " '" + name + "' id=" + id);
     }
   }
 }
 @Nls
 @Override
 public String getDisplayName() {
   if (myEp.displayName == null && myEp.key == null) {
     boolean loaded = myConfigurable != null;
     Configurable configurable = cast(Configurable.class, this);
     if (configurable != null) {
       String name = configurable.getDisplayName();
       if (!loaded && LOG.isDebugEnabled()) {
         LOG.debug("XML does not provide displayName for " + configurable.getClass());
       }
       return name;
     }
   }
   return myEp.getDisplayName();
 }
Esempio n. 5
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();
    }
  }
Esempio n. 6
0
  @Override
  public ActionCallback navigateTo(@Nullable final Place place, final boolean requestFocus) {
    final Configurable toSelect = (Configurable) place.getPath(CATEGORY);

    JComponent detailsContent = myDetails.getTargetComponent();

    if (mySelectedConfigurable != toSelect) {
      if (mySelectedConfigurable instanceof BaseStructureConfigurable) {
        ((BaseStructureConfigurable) mySelectedConfigurable).onStructureUnselected();
      }
      saveSideProportion();
      removeSelected();

      if (toSelect != null) {
        detailsContent = toSelect.createComponent();
        myDetails.setContent(detailsContent);
      }

      mySelectedConfigurable = toSelect;
      if (mySelectedConfigurable != null) {
        myUiState.lastEditedConfigurable = mySelectedConfigurable.getDisplayName();
      }

      if (toSelect instanceof MasterDetailsComponent) {
        final MasterDetailsComponent masterDetails = (MasterDetailsComponent) toSelect;
        if (myUiState.sideProportion > 0) {
          masterDetails.getSplitter().setProportion(myUiState.sideProportion);
        }
        masterDetails.setHistory(myHistory);
      }

      if (toSelect instanceof DetailsComponent.Facade) {
        ((DetailsComponent.Facade) toSelect)
            .getDetailsComponent()
            .setBannerMinHeight(myToolbarComponent.getPreferredSize().height);
      }

      if (toSelect instanceof BaseStructureConfigurable) {
        ((BaseStructureConfigurable) toSelect).onStructureSelected();
      }
    }

    if (detailsContent != null) {
      JComponent toFocus = IdeFocusTraversalPolicy.getPreferredFocusedComponent(detailsContent);
      if (toFocus == null) {
        toFocus = detailsContent;
      }
      if (requestFocus) {
        myToFocus = toFocus;
        UIUtil.requestFocus(toFocus);
      }
    }

    final ActionCallback result = new ActionCallback();
    Place.goFurther(toSelect, place, requestFocus).notifyWhenDone(result);

    myDetails.revalidate();
    myDetails.repaint();

    if (toSelect != null) {
      mySidePanel.select(createPlaceFor(toSelect));
    }

    if (!myHistory.isNavigatingNow() && mySelectedConfigurable != null) {
      myHistory.pushQueryPlace();
    }

    return result;
  }