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;
throw new ConfigurationException("Please, specify project name!");
}
- DumbService.getInstance(myProject).allowStartingDumbModeInside(DumbService.DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
+ DumbService.getInstance(myProject).allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
import com.intellij.openapi.application.Result;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.DumbModePermission;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager;
protected void doOKAction() {
final LibraryCompositionSettings settings = myPanel.apply();
if (settings != null && settings.downloadFiles(myPanel.getMainPanel())) {
- DumbService.getInstance(myModule.getProject()).allowStartingDumbModeInside(DumbService.DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
+ DumbService.getInstance(myModule.getProject()).allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
@Override
public void run() {
if (myModifiableRootModel == null) {
--- /dev/null
+/*
+ * Copyright 2000-2015 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.project;
+
+/**
+ * Permits the dumb mode to start at a specific moment, either modally or in background.
+ * @see DumbService#allowStartingDumbModeInside(DumbModePermission, Runnable)
+ */
+public enum DumbModePermission {
+ MAY_START_MODAL,
+ MAY_START_BACKGROUND
+}
*/
public abstract void allowStartingDumbModeInside(@NotNull DumbModePermission permission, @NotNull Runnable runnable);
- /**
- * Permits the dumb mode to start at a specific moment, either modally or in background.
- * @see #allowStartingDumbModeInside(DumbModePermission, Runnable)
- */
- public enum DumbModePermission {
- MAY_START_MODAL,
- MAY_START_BACKGROUND
- }
-
/**
* @see #DUMB_MODE
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.progress.EmptyProgressIndicator;
+import com.intellij.openapi.project.DumbModePermission;
import com.intellij.openapi.project.DumbModeTask;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.externalSystem.util.DisposeAwareProjectChange;
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
import com.intellij.openapi.externalSystem.util.ExternalSystemUiUtil;
+import com.intellij.openapi.project.DumbModePermission;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
@Override
public void execute() {
DumbService.getInstance(myProject).allowStartingDumbModeInside(
- DumbService.DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
+ DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
public void run() {
ProjectRootManagerEx.getInstanceEx(myProject).mergeRootsChangesDuring(new Runnable() {
@Override
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.command.CommandProcessor;
+import com.intellij.openapi.project.DumbModePermission;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
}
}, elements, dialog.isSearchInComments(), dialog.isSearchForTextOccurences(), true);
- DumbService.getInstance(project).allowStartingDumbModeInside(DumbService.DumbModePermission.MAY_START_BACKGROUND, processor);
+ DumbService.getInstance(project).allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, processor);
}
}) {
@Override
ModalityState modality = ModalityState.current();
final DumbModePermission permission = getDumbModePermission(modality);
if (permission == null) {
- LOG.error("Dumb mode not permitted in modal environment; see DumbService.allowStartingDumbModeInside documentation. Current modality: " + modality + ", all premissions: " + myPermissions, trace);
+ LOG.error("Dumb mode not permitted in modal environment; see DumbService.allowStartingDumbModeInside documentation." +
+ "\n Current modality: " + modality +
+ "\n all permissions: " + myPermissions, trace);
}
myProgresses.put(task, new ProgressIndicatorBase());