Ejemplo n.º 1
0
 public Place createArtifactPlace(Artifact artifact) {
   Place place = createPlaceFor(myArtifactsStructureConfigurable);
   if (artifact != null) {
     place.putPath(BaseStructureConfigurable.TREE_NAME, artifact.getName());
   }
   return place;
 }
Ejemplo n.º 2
0
 public ActionCallback select(@Nullable final Facet facetToSelect, final boolean requestFocus) {
   Place place = createModulesPlace();
   if (facetToSelect != null) {
     place = place.putPath(ModuleStructureConfigurable.TREE_OBJECT, facetToSelect);
   }
   return navigateTo(place, requestFocus);
 }
Ejemplo n.º 3
0
 public ActionCallback select(
     @NotNull LibraryOrderEntry libraryOrderEntry, final boolean requestFocus) {
   final Library lib = libraryOrderEntry.getLibrary();
   if (lib == null || lib.getTable() == null) {
     return selectOrderEntry(libraryOrderEntry.getOwnerModule(), libraryOrderEntry);
   }
   Place place = createPlaceFor(getConfigurableFor(lib));
   place.putPath(BaseStructureConfigurable.TREE_NAME, libraryOrderEntry.getLibraryName());
   return navigateTo(place, requestFocus);
 }
Ejemplo n.º 4
0
 public ActionCallback select(
     @Nullable final String moduleToSelect,
     @Nullable String editorNameToSelect,
     final boolean requestFocus) {
   Place place = createModulesPlace();
   if (moduleToSelect != null) {
     final Module module = ModuleManager.getInstance(myProject).findModuleByName(moduleToSelect);
     assert module != null;
     place =
         place
             .putPath(ModuleStructureConfigurable.TREE_OBJECT, module)
             .putPath(ModuleEditor.SELECTED_EDITOR_NAME, editorNameToSelect);
   }
   return navigateTo(place, requestFocus);
 }
  public ActionCallback navigateTo(@Nullable final Place place, final boolean requestFocus) {
    if (place == null) return new ActionCallback.Done();

    final Object object = place.getPath(TREE_OBJECT);
    final String byName = (String) place.getPath(TREE_NAME);

    if (object == null && byName == null) return new ActionCallback.Done();

    final MyNode node = object == null ? null : findNodeByObject(myRoot, object);
    final MyNode nodeByName = byName == null ? null : findNodeByName(myRoot, byName);

    if (node == null && nodeByName == null) return new ActionCallback.Done();

    final NamedConfigurable config;
    if (node != null) {
      config = node.getConfigurable();
    } else {
      config = nodeByName.getConfigurable();
    }

    final ActionCallback result =
        new ActionCallback()
            .doWhenDone(
                new Runnable() {
                  public void run() {
                    myAutoScrollEnabled = true;
                  }
                });

    myAutoScrollEnabled = false;
    myAutoScrollHandler.cancelAllRequests();
    final MyNode nodeToSelect = node != null ? node : nodeByName;
    selectNodeInTree(nodeToSelect, requestFocus)
        .doWhenDone(
            new Runnable() {
              public void run() {
                setSelectedNode(nodeToSelect);
                Place.goFurther(config, place, requestFocus).notifyWhenDone(result);
              }
            });

    return result;
  }
 public void queryPlace(@NotNull final Place place) {
   if (myCurrentConfigurable != null) {
     place.putPath(TREE_OBJECT, myCurrentConfigurable.getEditableObject());
     Place.queryFurther(myCurrentConfigurable, place);
   }
 }
Ejemplo n.º 7
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;
  }
Ejemplo n.º 8
0
 public Place createProjectOrGlobalLibraryPlace(Library library) {
   Place place = createPlaceFor(getConfigurableFor(library));
   place.putPath(BaseStructureConfigurable.TREE_NAME, library.getName());
   return place;
 }
Ejemplo n.º 9
0
 public ActionCallback select(@NotNull Sdk sdk, final boolean requestFocus) {
   Place place = createPlaceFor(myJdkListConfig);
   place.putPath(BaseStructureConfigurable.TREE_NAME, sdk.getName());
   return navigateTo(place, requestFocus);
 }
Ejemplo n.º 10
0
 @Override
 public void queryPlace(@NotNull final Place place) {
   place.putPath(CATEGORY, mySelectedConfigurable);
   Place.queryFurther(mySelectedConfigurable, place);
 }