mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
allow any configurable to start dumb mode and cleanup their apply()-s (EA-71769 - Throwable: DumbServiceImpl.a)
This commit is contained in:
+35
-39
@@ -286,51 +286,47 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
|
||||
}
|
||||
|
||||
final Ref<ConfigurationException> exceptionRef = Ref.create();
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
for (final ModuleEditor moduleEditor : myModuleEditors.values()) {
|
||||
final ModifiableRootModel model = moduleEditor.apply();
|
||||
if (model != null) {
|
||||
if (!model.isSdkInherited()) {
|
||||
// make sure the sdk is set to original SDK stored in the JDK Table
|
||||
final Sdk modelSdk = model.getSdk();
|
||||
if (modelSdk != null) {
|
||||
final Sdk original = modifiedToOriginalMap.get(modelSdk);
|
||||
if (original != null) {
|
||||
model.setSdk(original);
|
||||
}
|
||||
}
|
||||
try {
|
||||
for (final ModuleEditor moduleEditor : myModuleEditors.values()) {
|
||||
final ModifiableRootModel model = moduleEditor.apply();
|
||||
if (model != null) {
|
||||
if (!model.isSdkInherited()) {
|
||||
// make sure the sdk is set to original SDK stored in the JDK Table
|
||||
final Sdk modelSdk = model.getSdk();
|
||||
if (modelSdk != null) {
|
||||
final Sdk original = modifiedToOriginalMap.get(modelSdk);
|
||||
if (original != null) {
|
||||
model.setSdk(original);
|
||||
}
|
||||
models.add(model);
|
||||
}
|
||||
}
|
||||
myFacetsConfigurator.applyEditors();
|
||||
}
|
||||
catch (ConfigurationException e) {
|
||||
exceptionRef.set(e);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final ModifiableRootModel[] rootModels = models.toArray(new ModifiableRootModel[models.size()]);
|
||||
ModifiableModelCommitter.multiCommit(rootModels, myModuleModel);
|
||||
myModuleModelCommitted = true;
|
||||
myFacetsConfigurator.commitFacets();
|
||||
|
||||
}
|
||||
finally {
|
||||
ModuleStructureConfigurable.getInstance(myProject).getFacetEditorFacade().clearMaps(false);
|
||||
|
||||
myFacetsConfigurator = createFacetsConfigurator();
|
||||
myModuleModel = ModuleManager.getInstance(myProject).getModifiableModel();
|
||||
myModuleModelCommitted = false;
|
||||
models.add(model);
|
||||
}
|
||||
}
|
||||
});
|
||||
myFacetsConfigurator.applyEditors();
|
||||
}
|
||||
catch (ConfigurationException e) {
|
||||
exceptionRef.set(e);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final ModifiableRootModel[] rootModels = models.toArray(new ModifiableRootModel[models.size()]);
|
||||
ModifiableModelCommitter.multiCommit(rootModels, myModuleModel);
|
||||
myModuleModelCommitted = true;
|
||||
myFacetsConfigurator.commitFacets();
|
||||
|
||||
}
|
||||
finally {
|
||||
ModuleStructureConfigurable.getInstance(myProject).getFacetEditorFacade().clearMaps(false);
|
||||
|
||||
myFacetsConfigurator = createFacetsConfigurator();
|
||||
myModuleModel = ModuleManager.getInstance(myProject).getModifiableModel();
|
||||
myModuleModelCommitted = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+27
-33
@@ -25,8 +25,6 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.DumbModePermission;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.project.ex.ProjectEx;
|
||||
@@ -226,39 +224,35 @@ public class ProjectConfigurable extends ProjectStructureElementConfigurable<Pro
|
||||
throw new ConfigurationException("Please, specify project name!");
|
||||
}
|
||||
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// set the output path first so that handlers of RootsChanged event sent after JDK is set
|
||||
// would see the updated path
|
||||
String canonicalPath = myProjectCompilerOutput.getText();
|
||||
if (canonicalPath != null && canonicalPath.length() > 0) {
|
||||
try {
|
||||
canonicalPath = FileUtil.resolveShortWindowsName(canonicalPath);
|
||||
}
|
||||
catch (IOException e) {
|
||||
//file doesn't exist yet
|
||||
}
|
||||
canonicalPath = FileUtil.toSystemIndependentName(canonicalPath);
|
||||
compilerProjectExtension.setCompilerOutputUrl(VfsUtilCore.pathToUrl(canonicalPath));
|
||||
}
|
||||
else {
|
||||
compilerProjectExtension.setCompilerOutputPointer(null);
|
||||
}
|
||||
|
||||
LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(myProject);
|
||||
extension.setLanguageLevel(myLanguageLevelCombo.getSelectedLevel());
|
||||
extension.setDefault(myLanguageLevelCombo.isDefault());
|
||||
myProjectJdkConfigurable.apply();
|
||||
|
||||
if (myProjectName != null) {
|
||||
((ProjectEx)myProject).setProjectName(myProjectName.getText().trim());
|
||||
if (myDetailsComponent != null) myDetailsComponent.setText(getBannerSlogan());
|
||||
}
|
||||
// set the output path first so that handlers of RootsChanged event sent after JDK is set
|
||||
// would see the updated path
|
||||
String canonicalPath = myProjectCompilerOutput.getText();
|
||||
if (canonicalPath != null && canonicalPath.length() > 0) {
|
||||
try {
|
||||
canonicalPath = FileUtil.resolveShortWindowsName(canonicalPath);
|
||||
}
|
||||
});
|
||||
catch (IOException e) {
|
||||
//file doesn't exist yet
|
||||
}
|
||||
canonicalPath = FileUtil.toSystemIndependentName(canonicalPath);
|
||||
compilerProjectExtension.setCompilerOutputUrl(VfsUtilCore.pathToUrl(canonicalPath));
|
||||
}
|
||||
else {
|
||||
compilerProjectExtension.setCompilerOutputPointer(null);
|
||||
}
|
||||
|
||||
LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(myProject);
|
||||
extension.setLanguageLevel(myLanguageLevelCombo.getSelectedLevel());
|
||||
extension.setDefault(myLanguageLevelCombo.isDefault());
|
||||
myProjectJdkConfigurable.apply();
|
||||
|
||||
if (myProjectName != null) {
|
||||
((ProjectEx)myProject).setProjectName(myProjectName.getText().trim());
|
||||
if (myDetailsComponent != null) myDetailsComponent.setText(getBannerSlogan());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+1
-6
@@ -155,12 +155,7 @@ public class ProjectJdkConfigurable implements UnnamedConfigurable {
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ProjectRootManager.getInstance(myProject).setProjectSdk(getSelectedProjectJdk());
|
||||
}
|
||||
});
|
||||
ProjectRootManager.getInstance(myProject).setProjectSdk(getSelectedProjectJdk());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+17
-23
@@ -25,8 +25,6 @@ package com.intellij.openapi.roots.ui.configuration;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.DumbModePermission;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
@@ -119,29 +117,25 @@ public class ProjectJdksConfigurable extends MasterDetailsComponent {
|
||||
@Override
|
||||
public void apply() throws ConfigurationException {
|
||||
final Ref<ConfigurationException> exceptionRef = Ref.create();
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
ProjectJdksConfigurable.super.apply();
|
||||
boolean modifiedJdks = false;
|
||||
for (int i = 0; i < myRoot.getChildCount(); i++) {
|
||||
final NamedConfigurable configurable = ((MyNode)myRoot.getChildAt(i)).getConfigurable();
|
||||
if (configurable.isModified()) {
|
||||
configurable.apply();
|
||||
modifiedJdks = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (myProjectJdksModel.isModified() || modifiedJdks) {
|
||||
myProjectJdksModel.apply(ProjectJdksConfigurable.this);
|
||||
}
|
||||
myProjectJdksModel.setProjectSdk(getSelectedJdk());
|
||||
}
|
||||
catch (ConfigurationException e) {
|
||||
exceptionRef.set(e);
|
||||
try {
|
||||
ProjectJdksConfigurable.super.apply();
|
||||
boolean modifiedJdks = false;
|
||||
for (int i = 0; i < myRoot.getChildCount(); i++) {
|
||||
final NamedConfigurable configurable = ((MyNode)myRoot.getChildAt(i)).getConfigurable();
|
||||
if (configurable.isModified()) {
|
||||
configurable.apply();
|
||||
modifiedJdks = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (myProjectJdksModel.isModified() || modifiedJdks) {
|
||||
myProjectJdksModel.apply(ProjectJdksConfigurable.this);
|
||||
}
|
||||
myProjectJdksModel.setProjectSdk(getSelectedJdk());
|
||||
}
|
||||
catch (ConfigurationException e) {
|
||||
exceptionRef.set(e);
|
||||
}
|
||||
if (!exceptionRef.isNull()) {
|
||||
throw exceptionRef.get();
|
||||
}
|
||||
|
||||
+8
-13
@@ -336,21 +336,16 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
|
||||
}
|
||||
}
|
||||
final Ref<ConfigurationException> exceptionRef = Ref.create();
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
for (Configurable each : myName2Config) {
|
||||
if (each.isModified()) {
|
||||
each.apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ConfigurationException e) {
|
||||
exceptionRef.set(e);
|
||||
try {
|
||||
for (Configurable each : myName2Config) {
|
||||
if (each.isModified()) {
|
||||
each.apply();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (ConfigurationException e) {
|
||||
exceptionRef.set(e);
|
||||
}
|
||||
|
||||
if (!exceptionRef.isNull()) {
|
||||
throw exceptionRef.get();
|
||||
|
||||
+11
-16
@@ -296,23 +296,18 @@ public class ArtifactsStructureConfigurable extends BaseStructureConfigurable {
|
||||
checkForEmptyAndDuplicatedNames("Artifact", CommonBundle.getErrorTitle(), ArtifactConfigurableBase.class);
|
||||
super.apply();
|
||||
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myPackagingEditorContext.getManifestFilesInfo().saveManifestFiles();
|
||||
final ModifiableArtifactModel modifiableModel = myPackagingEditorContext.getActualModifiableModel();
|
||||
if (modifiableModel != null) {
|
||||
new WriteAction() {
|
||||
@Override
|
||||
protected void run(@NotNull final Result result) {
|
||||
modifiableModel.commit();
|
||||
}
|
||||
}.execute();
|
||||
myPackagingEditorContext.resetModifiableModel();
|
||||
myPackagingEditorContext.getManifestFilesInfo().saveManifestFiles();
|
||||
final ModifiableArtifactModel modifiableModel = myPackagingEditorContext.getActualModifiableModel();
|
||||
if (modifiableModel != null) {
|
||||
new WriteAction() {
|
||||
@Override
|
||||
protected void run(@NotNull final Result result) {
|
||||
modifiableModel.commit();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}.execute();
|
||||
myPackagingEditorContext.resetModifiableModel();
|
||||
}
|
||||
|
||||
|
||||
reset(); // TODO: fix to not reset on apply!
|
||||
}
|
||||
|
||||
+9
-14
@@ -117,23 +117,18 @@ public class FileTypeConfigurable extends BaseConfigurable implements Searchable
|
||||
}
|
||||
myOriginalToEditedMap.clear();
|
||||
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!myManager.isIgnoredFilesListEqualToCurrent(myFileTypePanel.myIgnoreFilesField.getText())) {
|
||||
myManager.setIgnoredFilesList(myFileTypePanel.myIgnoreFilesField.getText());
|
||||
}
|
||||
myManager.setPatternsTable(myTempFileTypes, myTempPatternsTable);
|
||||
for (FileNameMatcher matcher : myReassigned.keySet()) {
|
||||
myManager.getRemovedMappings().put(matcher, Pair.create(myReassigned.get(matcher), true));
|
||||
}
|
||||
if (!myManager.isIgnoredFilesListEqualToCurrent(myFileTypePanel.myIgnoreFilesField.getText())) {
|
||||
myManager.setIgnoredFilesList(myFileTypePanel.myIgnoreFilesField.getText());
|
||||
}
|
||||
myManager.setPatternsTable(myTempFileTypes, myTempPatternsTable);
|
||||
for (FileNameMatcher matcher : myReassigned.keySet()) {
|
||||
myManager.getRemovedMappings().put(matcher, Pair.create(myReassigned.get(matcher), true));
|
||||
}
|
||||
|
||||
TemplateDataLanguagePatterns.getInstance().setAssocTable(myTempTemplateDataLanguages);
|
||||
}
|
||||
});
|
||||
TemplateDataLanguagePatterns.getInstance().setAssocTable(myTempTemplateDataLanguages);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -97,12 +97,7 @@ public abstract class LanguagePerFileConfigurable<T> implements SearchableConfig
|
||||
|
||||
@Override
|
||||
public void apply() throws ConfigurationException {
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myMappings.setMappings(myTreeView.getValues());
|
||||
}
|
||||
});
|
||||
myMappings.setMappings(myTreeView.getValues());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+46
-33
@@ -24,6 +24,8 @@ import com.intellij.openapi.help.HelpManager;
|
||||
import com.intellij.openapi.options.BaseConfigurable;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.DumbModePermission;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
@@ -171,24 +173,30 @@ public class SingleConfigurableEditor extends DialogWrapper {
|
||||
|
||||
@Override
|
||||
protected void doOKAction() {
|
||||
try {
|
||||
if (myConfigurable.isModified()) {
|
||||
myConfigurable.apply();
|
||||
mySaveAllOnClose = true;
|
||||
}
|
||||
}
|
||||
catch (ConfigurationException e) {
|
||||
if (e.getMessage() != null) {
|
||||
if (myProject != null) {
|
||||
Messages.showMessageDialog(myProject, e.getMessage(), e.getTitle(), Messages.getErrorIcon());
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (myConfigurable.isModified()) {
|
||||
myConfigurable.apply();
|
||||
mySaveAllOnClose = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Messages.showMessageDialog(getRootPane(), e.getMessage(), e.getTitle(), Messages.getErrorIcon());
|
||||
catch (ConfigurationException e) {
|
||||
if (e.getMessage() != null) {
|
||||
if (myProject != null) {
|
||||
Messages.showMessageDialog(myProject, e.getMessage(), e.getTitle(), Messages.getErrorIcon());
|
||||
}
|
||||
else {
|
||||
Messages.showMessageDialog(getRootPane(), e.getMessage(), e.getTitle(), Messages.getErrorIcon());
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
SingleConfigurableEditor.super.doOKAction();
|
||||
}
|
||||
return;
|
||||
}
|
||||
super.doOKAction();
|
||||
});
|
||||
}
|
||||
|
||||
protected static String createDimensionKey(Configurable configurable) {
|
||||
@@ -231,25 +239,30 @@ public class SingleConfigurableEditor extends DialogWrapper {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if (myPerformAction) return;
|
||||
try {
|
||||
myPerformAction = true;
|
||||
if (myConfigurable.isModified()) {
|
||||
myConfigurable.apply();
|
||||
mySaveAllOnClose = true;
|
||||
setCancelButtonText(CommonBundle.getCloseButtonText());
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
myPerformAction = true;
|
||||
if (myConfigurable.isModified()) {
|
||||
myConfigurable.apply();
|
||||
mySaveAllOnClose = true;
|
||||
setCancelButtonText(CommonBundle.getCloseButtonText());
|
||||
}
|
||||
}
|
||||
catch (ConfigurationException e) {
|
||||
if (myProject != null) {
|
||||
Messages.showMessageDialog(myProject, e.getMessage(), e.getTitle(), Messages.getErrorIcon());
|
||||
}
|
||||
else {
|
||||
Messages.showMessageDialog(getRootPane(), e.getMessage(), e.getTitle(),
|
||||
Messages.getErrorIcon());
|
||||
}
|
||||
} finally {
|
||||
myPerformAction = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ConfigurationException e) {
|
||||
if (myProject != null) {
|
||||
Messages.showMessageDialog(myProject, e.getMessage(), e.getTitle(), Messages.getErrorIcon());
|
||||
}
|
||||
else {
|
||||
Messages.showMessageDialog(getRootPane(), e.getMessage(), e.getTitle(),
|
||||
Messages.getErrorIcon());
|
||||
}
|
||||
} finally {
|
||||
myPerformAction = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-1
@@ -31,6 +31,8 @@ import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
import com.intellij.openapi.options.ex.ConfigurableCardPanel;
|
||||
import com.intellij.openapi.options.ex.ConfigurableExtensionPointUtil;
|
||||
import com.intellij.openapi.options.ex.ConfigurableVisitor;
|
||||
import com.intellij.openapi.project.DumbModePermission;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
@@ -73,7 +75,12 @@ class ConfigurableEditor extends AbstractEditor implements AnActionListener, AWT
|
||||
private final AbstractAction myApplyAction = new AbstractAction(CommonBundle.getApplyButtonText()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
apply();
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
apply();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
private final AbstractAction myResetAction = new AbstractAction(RESET_NAME) {
|
||||
|
||||
+19
-8
@@ -25,6 +25,8 @@ import com.intellij.openapi.options.ConfigurableGroup;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.options.ex.ConfigurableVisitor;
|
||||
import com.intellij.openapi.project.DumbModePermission;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
@@ -197,16 +199,20 @@ public class IdeSettingsDialog extends DialogWrapper implements DataProvider {
|
||||
public void doOKAction() {
|
||||
myEditor.flushModifications();
|
||||
|
||||
if (myEditor.canApply()) {
|
||||
myEditor.apply();
|
||||
if (!updateStatus()) return;
|
||||
}
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
public void run() {
|
||||
if (myEditor.canApply()) {
|
||||
myEditor.apply();
|
||||
if (!updateStatus()) return;
|
||||
}
|
||||
|
||||
saveCurrentConfigurable();
|
||||
saveCurrentConfigurable();
|
||||
|
||||
ApplicationManager.getApplication().saveAll();
|
||||
ApplicationManager.getApplication().saveAll();
|
||||
|
||||
super.doOKAction();
|
||||
IdeSettingsDialog.super.doOKAction();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -284,7 +290,12 @@ public class IdeSettingsDialog extends DialogWrapper implements DataProvider {
|
||||
}
|
||||
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
myEditor.apply();
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myEditor.apply();
|
||||
}
|
||||
});
|
||||
myEditor.revalidate();
|
||||
myEditor.repaint();
|
||||
updateStatus();
|
||||
|
||||
+19
-8
@@ -26,6 +26,8 @@ import com.intellij.openapi.options.ConfigurableGroup;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.options.ex.Settings;
|
||||
import com.intellij.openapi.project.DumbModePermission;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
@@ -170,16 +172,20 @@ public class OptionsEditorDialog extends DialogWrapper implements DataProvider{
|
||||
protected void doOKAction() {
|
||||
myEditor.flushModifications();
|
||||
|
||||
if (myEditor.canApply()) {
|
||||
myEditor.apply();
|
||||
if (!updateStatus()) return;
|
||||
}
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
public void run() {
|
||||
if (myEditor.canApply()) {
|
||||
myEditor.apply();
|
||||
if (!updateStatus()) return;
|
||||
}
|
||||
|
||||
saveCurrentConfigurable();
|
||||
saveCurrentConfigurable();
|
||||
|
||||
ApplicationManager.getApplication().saveAll();
|
||||
ApplicationManager.getApplication().saveAll();
|
||||
|
||||
super.doOKAction();
|
||||
OptionsEditorDialog.super.doOKAction();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -295,7 +301,12 @@ public class OptionsEditorDialog extends DialogWrapper implements DataProvider{
|
||||
}
|
||||
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
myEditor.apply();
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myEditor.apply();
|
||||
}
|
||||
});
|
||||
myEditor.revalidate();
|
||||
myEditor.repaint();
|
||||
}
|
||||
|
||||
+11
-4
@@ -21,6 +21,8 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.help.HelpManager;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurableGroup;
|
||||
import com.intellij.openapi.project.DumbModePermission;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -140,10 +142,15 @@ public class SettingsDialog extends DialogWrapper implements DataProvider {
|
||||
|
||||
@Override
|
||||
public void doOKAction() {
|
||||
if (myEditor.apply()) {
|
||||
ApplicationManager.getApplication().saveAll();
|
||||
super.doOKAction();
|
||||
}
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myEditor.apply()) {
|
||||
ApplicationManager.getApplication().saveAll();
|
||||
SettingsDialog.super.doOKAction();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,8 +24,6 @@ import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.UnnamedConfigurable;
|
||||
import com.intellij.openapi.project.DumbModePermission;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.SdkModel;
|
||||
@@ -317,21 +315,15 @@ public class PyActiveSdkConfigurable implements UnnamedConfigurable {
|
||||
}
|
||||
|
||||
private void setSdk(final Sdk item) {
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ProjectRootManager.getInstance(myProject).setProjectSdk(item);
|
||||
}
|
||||
});
|
||||
if (myModule != null) {
|
||||
ModuleRootModificationUtil.setModuleSdk(myModule, item);
|
||||
}
|
||||
ProjectRootManager.getInstance(myProject).setProjectSdk(item);
|
||||
}
|
||||
});
|
||||
|
||||
if (myModule != null) {
|
||||
ModuleRootModificationUtil.setModuleSdk(myModule, item);
|
||||
}
|
||||
}
|
||||
|
||||
public static void rehighlightStrings(final @NotNull Project project) {
|
||||
|
||||
+2
-10
@@ -22,7 +22,6 @@ import com.intellij.openapi.module.impl.ModuleConfigurationStateImpl;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider;
|
||||
@@ -35,8 +34,6 @@ import org.jetbrains.jps.model.java.JavaSourceRootType;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
import static com.intellij.openapi.project.DumbModePermission.MAY_START_BACKGROUND;
|
||||
|
||||
public class PyContentEntriesModuleConfigurable extends SearchableConfigurable.Parent.Abstract {
|
||||
private final Module myModule;
|
||||
private final JPanel myTopPanel = new JPanel(new BorderLayout());
|
||||
@@ -110,15 +107,10 @@ public class PyContentEntriesModuleConfigurable extends SearchableConfigurable.P
|
||||
final boolean editorWasModified = myEditor.isModified();
|
||||
myEditor.apply();
|
||||
if (editorWasModified) {
|
||||
DumbService.allowStartingDumbModeInside(MAY_START_BACKGROUND, new Runnable() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myModifiableModel.commit();
|
||||
}
|
||||
});
|
||||
myModifiableModel.commit();
|
||||
}
|
||||
});
|
||||
resetEditor();
|
||||
|
||||
Reference in New Issue
Block a user