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();
}
}
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;
}
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;
}
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();
}
}
Aggregations