use of com.intellij.openapi.options.Configurable in project intellij-community by JetBrains.
the class ProjectStructureConfigurable method disposeUIResources.
@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));
myUiState.proportion = mySplitter.getProportion();
saveSideProportion();
myContext.getDaemonAnalyzer().stop();
for (Configurable each : myName2Config) {
each.disposeUIResources();
}
myContext.clear();
myName2Config.clear();
myModuleConfigurator.getFacetsConfigurator().clearMaps();
myUiInitialized = false;
}
use of com.intellij.openapi.options.Configurable 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.options.Configurable 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.options.Configurable in project intellij-community by JetBrains.
the class ProjectStructureConfigurable method apply.
@Override
public void apply() throws ConfigurationException {
LOG.assertTrue(TransactionGuard.getInstance().getContextTransaction() != null, "Project Structure should be shown in a transaction, see AnAction#startInTransaction");
for (Configurable each : myName2Config) {
if (each instanceof BaseStructureConfigurable && each.isModified()) {
((BaseStructureConfigurable) each).checkCanApply();
}
}
final Ref<ConfigurationException> exceptionRef = Ref.create();
try {
for (Configurable each : myName2Config) {
if (each.isModified()) {
each.apply();
}
}
} catch (ConfigurationException e) {
exceptionRef.set(e);
}
if (!exceptionRef.isNull()) {
throw exceptionRef.get();
}
myContext.getDaemonAnalyzer().clearCaches();
BuildManager.getInstance().scheduleAutoMake();
}
use of com.intellij.openapi.options.Configurable in project intellij-community by JetBrains.
the class OpenGradleSettingsCallback method hyperlinkActivated.
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID);
assert manager instanceof GradleManager;
GradleManager gradleManager = (GradleManager) manager;
final Configurable configurable = gradleManager.getConfigurable(myProject);
ShowSettingsUtil.getInstance().editConfigurable(myProject, configurable);
}
Aggregations