Search in sources :

Example 1 with MasterDetailsComponent

use of com.intellij.openapi.ui.MasterDetailsComponent in project intellij-community by JetBrains.

the class ProjectStructureConfigurable method reset.

@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
    AccessToken token = HeavyProcessLatch.INSTANCE.processStarted("Resetting Project Structure");
    try {
        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 {
        token.finish();
    }
}
Also used : AccessToken(com.intellij.openapi.application.AccessToken) MasterDetailsComponent(com.intellij.openapi.ui.MasterDetailsComponent) Configurable(com.intellij.openapi.options.Configurable) BaseConfigurable(com.intellij.openapi.options.BaseConfigurable) ArtifactsStructureConfigurable(com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable)

Example 2 with MasterDetailsComponent

use of com.intellij.openapi.ui.MasterDetailsComponent in project intellij-community by JetBrains.

the class ProjectStructureConfigurable method navigateTo.

@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;
}
Also used : DetailsComponent(com.intellij.openapi.ui.DetailsComponent) MasterDetailsComponent(com.intellij.openapi.ui.MasterDetailsComponent) ActionCallback(com.intellij.openapi.util.ActionCallback) MasterDetailsComponent(com.intellij.openapi.ui.MasterDetailsComponent) Configurable(com.intellij.openapi.options.Configurable) BaseConfigurable(com.intellij.openapi.options.BaseConfigurable) ArtifactsStructureConfigurable(com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable)

Example 3 with MasterDetailsComponent

use of com.intellij.openapi.ui.MasterDetailsComponent in project android by JetBrains.

the class ProjectStructureConfigurable method navigateTo.

@Override
@NotNull
public ActionCallback navigateTo(@Nullable Place place, boolean requestFocus) {
    if (place == null) {
        return ActionCallback.DONE;
    }
    Configurable toSelect;
    Object displayName = place.getPath(CATEGORY_NAME);
    if (displayName instanceof String) {
        toSelect = findConfigurable((String) displayName);
    } else {
        toSelect = (Configurable) place.getPath(CATEGORY);
    }
    JComponent detailsContent = myDetails.getTargetComponent();
    if (mySelectedConfigurable != toSelect) {
        saveSideProportion();
        removeSelected();
    }
    if (toSelect != null) {
        detailsContent = toSelect.createComponent();
        myDetails.setContent(detailsContent);
    }
    mySelectedConfigurable = toSelect;
    if (mySelectedConfigurable != null) {
        myUiState.lastEditedConfigurable = mySelectedConfigurable.getDisplayName();
    }
    if (toSelect instanceof MasterDetailsComponent) {
        MasterDetailsComponent masterDetails = (MasterDetailsComponent) toSelect;
        if (myUiState.sideProportion > 0) {
            masterDetails.getSplitter().setProportion(myUiState.sideProportion);
        }
        masterDetails.setHistory(myHistory);
    } else if (toSelect == mySdksConfigurable) {
        mySdksConfigurable.setHistory(myHistory);
    }
    if (toSelect != null) {
        mySidePanel.select(createPlaceFor(toSelect));
    }
    JComponent toFocus = null;
    if (mySelectedConfigurable instanceof BaseConfigurable) {
        BaseConfigurable configurable = (BaseConfigurable) mySelectedConfigurable;
        toFocus = configurable.getPreferredFocusedComponent();
    } else if (mySelectedConfigurable instanceof MasterDetailsComponent) {
        MasterDetailsComponent configurable = (MasterDetailsComponent) mySelectedConfigurable;
        toFocus = configurable.getMaster();
    }
    if (toFocus == null && detailsContent != null) {
        toFocus = IdeFocusTraversalPolicy.getPreferredFocusedComponent(detailsContent);
        if (toFocus == null) {
            toFocus = detailsContent;
        }
    }
    myToFocus = toFocus;
    if (myToFocus != null) {
        requestFocus(myToFocus);
    }
    ActionCallback result = new ActionCallback();
    goFurther(toSelect, place, requestFocus).notifyWhenDone(result);
    myDetails.revalidate();
    myDetails.repaint();
    if (!myHistory.isNavigatingNow() && mySelectedConfigurable != null) {
        myHistory.pushQueryPlace();
    }
    return result;
}
Also used : ActionCallback(com.intellij.openapi.util.ActionCallback) MasterDetailsComponent(com.intellij.openapi.ui.MasterDetailsComponent) IdeSdksConfigurable(com.android.tools.idea.gradle.structure.IdeSdksConfigurable) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with MasterDetailsComponent

use of com.intellij.openapi.ui.MasterDetailsComponent in project android by JetBrains.

the class ProjectStructureConfigurable method reset.

@Override
public void reset() {
    AccessToken token = HeavyProcessLatch.INSTANCE.processStarted("Resetting Project Structure");
    try {
        mySdksConfigurable.reset();
        Configurable toSelect = null;
        for (Configurable each : myConfigurables) {
            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 && !myConfigurables.isEmpty()) {
            toSelect = myConfigurables.get(0);
        }
        removeSelected();
        navigateTo(toSelect != null ? createPlaceFor(toSelect) : null, false);
        if (myUiState.proportion > 0) {
            mySplitter.setProportion(myUiState.proportion);
        }
    } finally {
        token.finish();
    }
}
Also used : AccessToken(com.intellij.openapi.application.AccessToken) MasterDetailsComponent(com.intellij.openapi.ui.MasterDetailsComponent) IdeSdksConfigurable(com.android.tools.idea.gradle.structure.IdeSdksConfigurable)

Aggregations

MasterDetailsComponent (com.intellij.openapi.ui.MasterDetailsComponent)4 IdeSdksConfigurable (com.android.tools.idea.gradle.structure.IdeSdksConfigurable)2 AccessToken (com.intellij.openapi.application.AccessToken)2 BaseConfigurable (com.intellij.openapi.options.BaseConfigurable)2 Configurable (com.intellij.openapi.options.Configurable)2 SearchableConfigurable (com.intellij.openapi.options.SearchableConfigurable)2 ArtifactsStructureConfigurable (com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurable)2 ActionCallback (com.intellij.openapi.util.ActionCallback)2 DetailsComponent (com.intellij.openapi.ui.DetailsComponent)1 NotNull (org.jetbrains.annotations.NotNull)1