@Override public UsageView searchAndShowUsages(@NotNull final UsageTarget[] searchFor, @NotNull final Factory<UsageSearcher> searcherFactory, final boolean showPanelIfOnlyOneUsage, final boolean showNotFoundMessage, @NotNull final UsageViewPresentation presentation, @Nullable final UsageViewStateListener listener) { final AtomicReference<UsageViewImpl> usageView = new AtomicReference<UsageViewImpl>(); final FindUsagesProcessPresentation processPresentation = new FindUsagesProcessPresentation(); processPresentation.setShowNotFoundMessage(showNotFoundMessage); processPresentation.setShowPanelIfOnlyOneUsage(showPanelIfOnlyOneUsage); Task.Backgroundable task = new Task.Backgroundable(myProject, getProgressTitle(presentation), true, new SearchInBackgroundOption()) { @Override public void run(@NotNull final ProgressIndicator indicator) { new SearchForUsagesRunnable(UsageViewManagerImpl.this.myProject, usageView, presentation, searchFor, searcherFactory, processPresentation, listener).run(); } @Override public DumbModeAction getDumbModeAction() { return DumbModeAction.CANCEL; } @Override @Nullable public NotificationInfo getNotificationInfo() { String notification = usageView.get() != null ? usageView.get().getUsagesCount() + " Usage(s) Found" : "No Usages Found"; return new NotificationInfo("Find Usages", "Find Usages Finished", notification); } }; ProgressManager.getInstance().run(task); return usageView.get(); }
@Override public DumbModeAction getDumbModeAction() { return DumbModeAction.WAIT; }
/** * to remove in IDEA 16 */ @Deprecated @NotNull public DumbModeAction getDumbModeAction() { return DumbModeAction.NOTHING; }
@Override @NotNull public DumbModeAction getDumbModeAction() { return DumbModeAction.WAIT; }
public DumbModeAction getDumbModeAction() { return DumbModeAction.NOTHING; }
public void runBackgroundTask(final int Action, Project project) { final Task.Backgroundable task = new Task.Backgroundable(project, "Yii migrations", false) { @Override public String getProcessId() { return "Yii migrations"; } @Override public DumbModeAction getDumbModeAction() { return DumbModeAction.CANCEL; } public void run(@NotNull final ProgressIndicator indicator) { final Task.Backgroundable this_task = this; ((ProgressIndicatorEx) indicator).addStateDelegate(new ProgressIndicatorBase() { @Override public void cancel() { this_task.onCancel(); } }); switch (Action) { case MigrationsToolWindow.MIGRATE_DOWN_BACKGROUND_ACTION: indicator.setText("Migrating 1 down"); indicator.setFraction(0.1); MigrationsToolWindow.toolw.migrateDown(); indicator.setFraction(0.3); MigrationsToolWindow.toolw.updateNewMigrations(true); indicator.setFraction(0.5); indicator.setText("Updating migrations menu"); MigrationsToolWindow.toolw.fillActionMenu(); indicator.setFraction(0.8); break; case MigrationsToolWindow.ADD_MENUS_BACKGROUND_ACTION: indicator.setText("Updating migrations list"); indicator.setFraction(0.1); MigrationsToolWindow.toolw.updateNewMigrations(true); indicator.setFraction(0.5); MigrationsToolWindow.toolw.addMenus(); indicator.setFraction(0.8); break; case MigrationsToolWindow.UPDATE_MIGRAITIONS_MENUS_BACKGROUND_ACTION: indicator.setText("Updating migrations list"); indicator.setFraction(0.1); MigrationsToolWindow.toolw.updateNewMigrations(true); indicator.setFraction(0.5); indicator.setText("Updating migrations menu"); MigrationsToolWindow.toolw.fillActionMenu(); indicator.setFraction(0.8); break; case MigrationsToolWindow.APPLY_MIGRATIONS_BACKGROUND_ACTION: indicator.setText("Applying migrations list"); indicator.setFraction(0.1); MigrationsToolWindow.toolw.applyMigrations(); indicator.setFraction(0.3); MigrationsToolWindow.toolw.updateNewMigrations(false); indicator.setFraction(0.5); indicator.setText("Updating migrations menu"); MigrationsToolWindow.toolw.fillActionMenu(); indicator.setFraction(0.8); break; case MigrationsToolWindow.CREATE_MIGRATION_BACKGROUND_ACTION: indicator.setText("Creating migration: " + newMigrationDialog.getMigrationName()); indicator.setFraction(0.1); MigrationsToolWindow.toolw.createMigrationByName(newMigrationDialog.getMigrationName()); indicator.setFraction(0.3); MigrationsToolWindow.toolw.updateNewMigrations(false, true); indicator.setFraction(0.5); indicator.setText("Updating migrations menu"); MigrationsToolWindow.toolw.fillActionMenu(); indicator.setFraction(0.8); break; } indicator.stop(); } }; task.setCancelText("Stop processing").queue(); }
/** * to remove in IDEA 16 */ @SuppressWarnings("deprecation") @Deprecated public DumbModeAction getDumbModeAction() { return DumbModeAction.NOTHING; }