diff --git a/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/AttachSourcesNotificationProvider.java b/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/AttachSourcesNotificationProvider.java index 74360a3b61f8..23a85aa41e57 100644 --- a/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/AttachSourcesNotificationProvider.java +++ b/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/AttachSourcesNotificationProvider.java @@ -254,7 +254,7 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi model.addRoot(root, OrderRootType.SOURCES); modelsToCommit.add(model); } - if (modelsToCommit.isEmpty()) return new ActionCallback.Rejected(); + if (modelsToCommit.isEmpty()) return ActionCallback.REJECTED; new WriteAction() { @Override protected void run(@NotNull final Result result) { @@ -264,7 +264,7 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi } }.execute(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Nullable @@ -307,7 +307,7 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi VirtualFile[] candidates = FileChooser.chooseFiles(descriptor, myProject, roots.length == 0 ? null : PathUtil.getLocalFile(roots[0])); final VirtualFile[] files = PathUIUtils.scanAndSelectDetectedJavaSourceRoots(myParentComponent, candidates); if (files.length == 0) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } final Map librariesToAppendSourcesTo = new HashMap(); @@ -350,7 +350,7 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi }).showCenteredInCurrentWindow(myProject); } - return new ActionCallback.Done(); + return ActionCallback.DONE; } private static void appendSources(final Library library, final VirtualFile[] files) { diff --git a/java/idea-ui/src/com/intellij/jarFinder/InternetAttachSourceProvider.java b/java/idea-ui/src/com/intellij/jarFinder/InternetAttachSourceProvider.java index be42dd7fbf8b..8ee9e96245c0 100644 --- a/java/idea-ui/src/com/intellij/jarFinder/InternetAttachSourceProvider.java +++ b/java/idea-ui/src/com/intellij/jarFinder/InternetAttachSourceProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -119,7 +119,7 @@ public class InternetAttachSourceProvider implements AttachSourcesProvider { @Override public ActionCallback perform(List orderEntriesContainingFile) { attachSourceJar(sourceFile, libraries); - return new ActionCallback.Done(); + return ActionCallback.DONE; } }); } @@ -191,7 +191,7 @@ public class InternetAttachSourceProvider implements AttachSourcesProvider { task.queue(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } }); } diff --git a/java/idea-ui/src/com/intellij/openapi/projectRoots/ui/SdkEditor.java b/java/idea-ui/src/com/intellij/openapi/projectRoots/ui/SdkEditor.java index ae544ea419ed..ce4a91952281 100644 --- a/java/idea-ui/src/com/intellij/openapi/projectRoots/ui/SdkEditor.java +++ b/java/idea-ui/src/com/intellij/openapi/projectRoots/ui/SdkEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -477,9 +477,9 @@ public class SdkEditor implements Configurable, Place.Navigator { @Override public ActionCallback navigateTo(@Nullable final Place place, final boolean requestFocus) { - if (place == null) return new ActionCallback.Done(); + if (place == null) return ActionCallback.DONE; myTabbedPane.setSelectedTitle((String)place.getPath(SDK_TAB)); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/TabbedModuleEditor.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/TabbedModuleEditor.java index 2763b597787d..b9612d69307e 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/TabbedModuleEditor.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/TabbedModuleEditor.java @@ -1,3 +1,18 @@ +/* + * 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.roots.ui.configuration; import com.intellij.ide.util.PropertiesComponent; @@ -70,7 +85,7 @@ public abstract class TabbedModuleEditor extends ModuleEditor { if (place != null) { selectEditor((String)place.getPath(SELECTED_EDITOR_NAME)); } - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseStructureConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseStructureConfigurable.java index a3b1db0dcf24..a0d32a3f4e11 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseStructureConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseStructureConfigurable.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -98,17 +98,17 @@ public abstract class BaseStructureConfigurable extends MasterDetailsComponent i @Override public ActionCallback navigateTo(@Nullable final Place place, final boolean requestFocus) { - if (place == null) return new ActionCallback.Done(); + if (place == null) return ActionCallback.DONE; final Object object = place.getPath(TREE_OBJECT); final String byName = (String)place.getPath(TREE_NAME); - if (object == null && byName == null) return new ActionCallback.Done(); + if (object == null && byName == null) return ActionCallback.DONE; final MyNode node = object == null ? null : findNodeByObject(myRoot, object); final MyNode nodeByName = byName == null ? null : findNodeByName(myRoot, byName); - if (node == null && nodeByName == null) return new ActionCallback.Done(); + if (node == null && nodeByName == null) return ActionCallback.DONE; final NamedConfigurable config; if (node != null) { diff --git a/platform/core-api/src/com/intellij/openapi/util/ActionCallback.java b/platform/core-api/src/com/intellij/openapi/util/ActionCallback.java index cc3810d90bb6..85e2a57adca4 100644 --- a/platform/core-api/src/com/intellij/openapi/util/ActionCallback.java +++ b/platform/core-api/src/com/intellij/openapi/util/ActionCallback.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -46,6 +46,12 @@ public class ActionCallback implements Disposable { myRejected = new ExecutionCallback(); } + private ActionCallback(ExecutionCallback done, ExecutionCallback rejected) { + myDone = done; + myRejected = rejected; + myName = null; + } + public ActionCallback(int countToDone) { this(null, countToDone); } @@ -54,10 +60,7 @@ public class ActionCallback implements Disposable { myName = name; assert countToDone >= 0 : "count=" + countToDone; - - int count = countToDone >= 1 ? countToDone : 1; - - myDone = new ExecutionCallback(count); + myDone = new ExecutionCallback(countToDone >= 1 ? countToDone : 1); myRejected = new ExecutionCallback(); if (countToDone < 1) { @@ -164,13 +167,52 @@ public class ActionCallback implements Disposable { public static class Done extends ActionCallback { public Done() { - setDone(); + super(new ExecutedExecutionCallback(), new IgnoreExecutionCallback()); } } public static class Rejected extends ActionCallback { public Rejected() { - setRejected(); + super(new IgnoreExecutionCallback(), new ExecutedExecutionCallback()); + } + } + + private static class ExecutedExecutionCallback extends ExecutionCallback { + public ExecutedExecutionCallback() { + super(0); + } + + @Override + void doWhenExecuted(@NotNull Runnable runnable) { + runnable.run(); + } + + @Override + boolean setExecuted() { + throw new IllegalStateException("Forbidden"); + } + + @SuppressWarnings("NonSynchronizedMethodOverridesSynchronizedMethod") + @Override + boolean isExecuted() { + return true; + } + } + + private static class IgnoreExecutionCallback extends ExecutionCallback { + @Override + void doWhenExecuted(@NotNull Runnable runnable) { + } + + @Override + boolean setExecuted() { + throw new IllegalStateException("Forbidden"); + } + + @SuppressWarnings("NonSynchronizedMethodOverridesSynchronizedMethod") + @Override + boolean isExecuted() { + return false; } } diff --git a/platform/core-api/src/com/intellij/openapi/util/BusyObject.java b/platform/core-api/src/com/intellij/openapi/util/BusyObject.java index 915bc15d7224..7bc3f69a2360 100644 --- a/platform/core-api/src/com/intellij/openapi/util/BusyObject.java +++ b/platform/core-api/src/com/intellij/openapi/util/BusyObject.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -65,7 +65,7 @@ public interface BusyObject { @NotNull public final ActionCallback getReady(@NotNull Object requestor) { if (isReady()) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } return addReadyCallback(requestor); } diff --git a/platform/core-api/src/com/intellij/openapi/util/ExecutionCallback.java b/platform/core-api/src/com/intellij/openapi/util/ExecutionCallback.java index 5c72eb06def3..03912c25763f 100644 --- a/platform/core-api/src/com/intellij/openapi/util/ExecutionCallback.java +++ b/platform/core-api/src/com/intellij/openapi/util/ExecutionCallback.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -34,7 +34,6 @@ class ExecutionCallback { ExecutionCallback(int executedCount) { myCountToExecution = executedCount; - assert executedCount >= 1 : executedCount; } /** @@ -74,7 +73,7 @@ class ExecutionCallback { } } - final void doWhenExecuted(@NotNull final Runnable runnable) { + void doWhenExecuted(@NotNull final Runnable runnable) { Runnable toRun; synchronized (this) { if (isExecuted()) { diff --git a/platform/lang-api/src/com/intellij/execution/ui/layout/CellTransform.java b/platform/lang-api/src/com/intellij/execution/ui/layout/CellTransform.java index 6ca574195417..1012a3380b0d 100644 --- a/platform/lang-api/src/com/intellij/execution/ui/layout/CellTransform.java +++ b/platform/lang-api/src/com/intellij/execution/ui/layout/CellTransform.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -37,7 +37,7 @@ public interface CellTransform { @Override public ActionCallback restoreInGrid() { myRestoringNow = true; - if (myActions.size() == 0) return new ActionCallback.Done(); + if (myActions.size() == 0) return ActionCallback.DONE; final ActionCallback topCallback = restore(0); return topCallback.doWhenDone(new Runnable() { @Override diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/GridCellImpl.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/GridCellImpl.java index dea14877f2eb..e380cc918be5 100644 --- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/GridCellImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/GridCellImpl.java @@ -282,7 +282,7 @@ public class GridCellImpl implements GridCell { public ActionCallback select(final Content content, final boolean requestFocus) { final TabInfo tabInfo = myContents.getValue(content); - return tabInfo != null ? myTabs.select(tabInfo, requestFocus) : new ActionCallback.Done(); + return tabInfo != null ? myTabs.select(tabInfo, requestFocus) : ActionCallback.DONE; } public void processAlert(final Content content, final boolean activate) { @@ -511,6 +511,6 @@ public class GridCellImpl implements GridCell { ActionCallback restore(Content content) { myMinimizedContents.remove(content); - return new ActionCallback.Done(); + return ActionCallback.DONE; } } diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/GridImpl.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/GridImpl.java index 323bf25cd436..be7cf867b1fe 100644 --- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/GridImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/GridImpl.java @@ -245,7 +245,7 @@ public class GridImpl extends Wrapper implements Grid, Disposable, DataProvider setContent(myContent); myContent = null; } - return new ActionCallback.Done(); + return ActionCallback.DONE; } }; } diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java index 36f02aa88577..b94f49eff259 100644 --- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java +++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java @@ -433,7 +433,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac location.translate(size.width / 2, size.height / 2); getDockManager().createNewDockContainerFor(content, new RelativePoint(location)); } - return new ActionCallback.Done(); + return ActionCallback.DONE; } private void storeDefaultIndices(@NotNull Content[] contents) { @@ -971,7 +971,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac } private ActionCallback restoreLastUiState() { - if (isStateBeingRestored()) return new ActionCallback.Rejected(); + if (isStateBeingRestored()) return ActionCallback.REJECTED; try { setStateIsBeingRestored(true, this); @@ -1569,7 +1569,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac saveUiState(); select(content, true); updateTabsUI(false); - return new ActionCallback.Done(); + return ActionCallback.DONE; } })); @@ -1617,11 +1617,11 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac @Override public ActionCallback select(final Content content, final boolean requestFocus) { final GridImpl grid = (GridImpl)findGridFor(content); - if (grid == null) return new ActionCallback.Done(); + if (grid == null) return ActionCallback.DONE; final TabInfo info = myTabs.findInfo(grid); - if (info == null) return new ActionCallback.Done(); + if (info == null) return ActionCallback.DONE; final ActionCallback result = new ActionCallback(); diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayoutUiImpl.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayoutUiImpl.java index 7475adbcab21..746cd1aa0189 100644 --- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayoutUiImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayoutUiImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -191,7 +191,7 @@ public class RunnerLayoutUiImpl implements Disposable.Parent, RunnerLayoutUi, La @NotNull @Override public ActionCallback selectAndFocus(@Nullable final Content content, boolean requestFocus, final boolean forced, boolean implicit) { - if (content == null) return new ActionCallback.Rejected(); + if (content == null) return ActionCallback.REJECTED; return getContentManager(content).setSelectedContent(content, requestFocus || shouldRequestFocus(), forced, implicit); } diff --git a/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesViewTreeBuilder.java b/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesViewTreeBuilder.java index 32cf92c011dc..729b3d1d079d 100644 --- a/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesViewTreeBuilder.java +++ b/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesViewTreeBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -143,7 +143,7 @@ public class FavoritesViewTreeBuilder extends BaseProjectTreeBuilder { @NotNull public ActionCallback updateFromRootCB() { getStructure().rootsChanged(); - if (isDisposed()) return new ActionCallback.Done(); + if (isDisposed()) return ActionCallback.DONE; getUpdater().cancelAllRequests(); return super.updateFromRootCB(); } diff --git a/platform/lang-impl/src/com/intellij/ide/impl/ProjectViewSelectInGroupTarget.java b/platform/lang-impl/src/com/intellij/ide/impl/ProjectViewSelectInGroupTarget.java index a0fb4f5d389d..62ebf41fb4e4 100644 --- a/platform/lang-impl/src/com/intellij/ide/impl/ProjectViewSelectInGroupTarget.java +++ b/platform/lang-impl/src/com/intellij/ide/impl/ProjectViewSelectInGroupTarget.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -72,7 +72,7 @@ public class ProjectViewSelectInGroupTarget implements CompositeSelectInTarget, @Override public ActionCallback run() { target.selectIn(context, requestFocus); - return new ActionCallback.Done(); + return ActionCallback.DONE; } }, true); } diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPSIPane.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPSIPane.java index 593d2576f370..d8d666d7e3ef 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPSIPane.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPSIPane.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -196,7 +196,7 @@ public abstract class AbstractProjectViewPSIPane extends AbstractProjectViewPane if (file != null) { return ((BaseProjectTreeBuilder)getTreeBuilder()).select(element, file, requestFocus); } - return new ActionCallback.Done(); + return ActionCallback.DONE; } @NotNull diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java index 9fd369978507..0ba8d9e193bf 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -706,7 +706,7 @@ public abstract class AbstractProjectViewPane implements DataProvider, Disposabl @NotNull @Override public ActionCallback getReady(@NotNull Object requestor) { - if (myTreeBuilder == null || myTreeBuilder.isDisposed()) return new ActionCallback.Rejected(); + if (myTreeBuilder == null || myTreeBuilder.isDisposed()) return ActionCallback.REJECTED; return myTreeBuilder.getUi().getReady(requestor); } } diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java index 5085a0487cdb..94a0db1b58f7 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java @@ -783,7 +783,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo return ((AbstractProjectViewPSIPane)viewPane).selectCB(element, file, requestFocus); } select(element, file, requestFocus); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override @@ -1535,7 +1535,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo return pane.updateFromRoot(false); } } - return new ActionCallback.Done(); + return ActionCallback.DONE; } private static boolean getPaneOptionValue(@NotNull Map optionsMap, String paneId, boolean defaultValue) { @@ -1906,6 +1906,6 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo if (pane == null) { pane = myId2Pane.get(myCurrentViewId); } - return pane != null ? pane.getReady(requestor) : new ActionCallback.Done(); + return pane != null ? pane.getReady(requestor) : ActionCallback.DONE; } } diff --git a/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java b/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java index 183ada37ec94..63958fb514a0 100644 --- a/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java +++ b/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -190,7 +190,7 @@ public class ScopeViewPane extends AbstractProjectViewPane { saveExpandedPaths(); myViewPanel.selectScope(NamedScopesHolder.getScope(myProject, getSubId())); restoreExpandedPaths(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override @@ -271,6 +271,6 @@ public class ScopeViewPane extends AbstractProjectViewPane { @Override public ActionCallback getReady(@NotNull Object requestor) { final ActionCallback callback = myViewPanel.getActionCallback(); - return callback == null ? new ActionCallback.Done() : callback; + return callback == null ? ActionCallback.DONE : callback; } } diff --git a/platform/lang-impl/src/com/intellij/ide/todo/TodoTreeBuilder.java b/platform/lang-impl/src/com/intellij/ide/todo/TodoTreeBuilder.java index 5f52f5ddfdf6..9f6129dee7a0 100644 --- a/platform/lang-impl/src/com/intellij/ide/todo/TodoTreeBuilder.java +++ b/platform/lang-impl/src/com/intellij/ide/todo/TodoTreeBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -203,7 +203,7 @@ public abstract class TodoTreeBuilder extends AbstractTreeBuilder { return callback; } - return new ActionCallback.Done(); + return ActionCallback.DONE; } }; } diff --git a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/TestEditorManagerImpl.java b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/TestEditorManagerImpl.java index 2234f72cdb97..ae711786dbe4 100644 --- a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/TestEditorManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/TestEditorManagerImpl.java @@ -113,7 +113,7 @@ public class TestEditorManagerImpl extends FileEditorManagerEx implements Projec @Override public ActionCallback notifyPublisher(@NotNull Runnable runnable) { runnable.run(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override @@ -494,7 +494,7 @@ public class TestEditorManagerImpl extends FileEditorManagerEx implements Projec @NotNull @Override public ActionCallback getReady(@NotNull Object requestor) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeBuilder.java b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeBuilder.java index f57a44485e69..21b2c64821b5 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeBuilder.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeBuilder.java @@ -298,7 +298,7 @@ public class AbstractTreeBuilder implements Disposable { @NotNull public ActionCallback queueUpdateFrom(final Object element, final boolean forceResort, final boolean updateStructure) { - if (getUi() == null) return new ActionCallback.Rejected(); + if (getUi() == null) return ActionCallback.REJECTED; final ActionCallback result = new ActionCallback(); @@ -487,14 +487,14 @@ public class AbstractTreeBuilder implements Disposable { @NotNull public final ActionCallback getInitialized() { if (isDisposed()) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } return myUi.getInitialized(); } @NotNull public final ActionCallback getReady(Object requestor) { - if (isDisposed()) return new ActionCallback.Rejected(); + if (isDisposed()) return ActionCallback.REJECTED; return myUi.getReady(requestor); } @@ -517,14 +517,14 @@ public class AbstractTreeBuilder implements Disposable { @NotNull public ActionCallback cancelUpdate() { - if (isDisposed()) return new ActionCallback.Rejected(); + if (isDisposed()) return ActionCallback.REJECTED; return getUi().cancelUpdate(); } @NotNull public ActionCallback batch(@NotNull Progressive progressive) { - if (isDisposed()) return new ActionCallback.Rejected(); + if (isDisposed()) return ActionCallback.REJECTED; return getUi().batch(progressive); } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java index ee52b27807ad..07f2d7f6629e 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -736,7 +736,7 @@ public class AbstractTreeUi { } ActionCallback callback; if (willUpdate) { - callback = new ActionCallback.Done(); + callback = ActionCallback.DONE; } else { callback = updateNodeChildren(getRootNode(), pass, null, false, false, false, true, true); @@ -1006,7 +1006,7 @@ public class AbstractTreeUi { try { AbstractTreeUpdater updater = getUpdater(); if (updater == null) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } final ActionCallback result = new ActionCallback(); @@ -1034,7 +1034,7 @@ public class AbstractTreeUi { return result; } catch (ProcessCanceledException e) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } } @@ -1567,7 +1567,7 @@ public class AbstractTreeUi { @Override public ActionCallback run() { expand(element, null); - return new ActionCallback.Done(); + return ActionCallback.DONE; } }, pass, node); } @@ -1695,8 +1695,8 @@ public class AbstractTreeUi { @NotNull @Override public ActionCallback run() { - if (pass.isExpired()) return new ActionCallback.Rejected(); - if (childNodes.isEmpty()) return new ActionCallback.Done(); + if (pass.isExpired()) return ActionCallback.REJECTED; + if (childNodes.isEmpty()) return ActionCallback.DONE; final ActionCallback result = new ActionCallback(childNodes.size()); @@ -1885,7 +1885,7 @@ public class AbstractTreeUi { @NotNull private ActionCallback resetToReadyNow() { - if (isReleased()) return new ActionCallback.Rejected(); + if (isReleased()) return ActionCallback.REJECTED; assertIsDispatchThread(); @@ -2408,7 +2408,7 @@ public class AbstractTreeUi { @NotNull public ActionCallback cancelUpdate() { - if (isReleased()) return new ActionCallback.Rejected(); + if (isReleased()) return ActionCallback.REJECTED; setCancelRequested(true); @@ -2503,7 +2503,7 @@ public class AbstractTreeUi { return callback; } finally { - if (isReleased()) return new ActionCallback.Rejected(); + if (isReleased()) return ActionCallback.REJECTED; _getReady().doWhenDone(new TreeRunnable("AbstractTreeUi.batch: finally") { @Override @@ -2991,17 +2991,17 @@ public class AbstractTreeUi { final boolean forceUpdate, @Nullable LoadedChildren parentPreloadedChildren) { if (pass.isExpired()) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } if (childDescriptor == null) { pass.expire(); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } final Object oldElement = getElementFromDescriptor(childDescriptor); if (oldElement == null) { pass.expire(); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } AsyncResult update = new AsyncResult(); @@ -3347,7 +3347,7 @@ public class AbstractTreeUi { @NotNull private ActionCallback queueToBackground(@NotNull final Runnable bgBuildAction, @Nullable final Runnable edtPostRunnable) { - if (!canInitiateNewActivity()) return new ActionCallback.Rejected(); + if (!canInitiateNewActivity()) return ActionCallback.REJECTED; final ActionCallback result = new ActionCallback(); final AtomicBoolean fail = new AtomicBoolean(); final Runnable finalizer = new TreeRunnable("AbstractTreeUi.queueToBackground: finalizer") { diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUpdater.java b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUpdater.java index fcf37784ba4b..3d07e15d4dfd 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUpdater.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * 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. @@ -299,7 +299,7 @@ public class AbstractTreeUpdater implements Disposable, Activatable { } protected ActionCallback beforeUpdate(TreeUpdatePass pass) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } /** diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeState.java b/platform/platform-api/src/com/intellij/ide/util/treeView/TreeState.java index 6b2101ff23dd..1411eaa4439e 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeState.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/TreeState.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -437,7 +437,7 @@ public class TreeState implements JDOMExternalizable { @Override public ActionCallback expand(DefaultMutableTreeNode node) { myTree.expandPath(new TreePath(node.getPath())); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override @@ -445,7 +445,7 @@ public class TreeState implements JDOMExternalizable { final WeakReference ref = (WeakReference)myTree.getClientProperty(CALLBACK); final ActionCallback callback = SoftReference.dereference(ref); if (callback != null) return callback; - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override @@ -475,7 +475,7 @@ public class TreeState implements JDOMExternalizable { @Override public ActionCallback expand(DefaultMutableTreeNode node) { final Object userObject = node.getUserObject(); - if (!(userObject instanceof NodeDescriptor)) return new ActionCallback.Rejected(); + if (!(userObject instanceof NodeDescriptor)) return ActionCallback.REJECTED; NodeDescriptor desc = (NodeDescriptor)userObject; diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/UpdaterTreeState.java b/platform/platform-api/src/com/intellij/ide/util/treeView/UpdaterTreeState.java index 783bd87f8d52..4e47eb39ef5b 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/UpdaterTreeState.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/UpdaterTreeState.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -299,7 +299,7 @@ public class UpdaterTreeState { } private ActionCallback processHangByParent(Set elements) { - if (elements.isEmpty()) return new ActionCallback.Done(); + if (elements.isEmpty()) return ActionCallback.DONE; ActionCallback result = new ActionCallback(elements.size()); for (Object hangElement : elements) { diff --git a/platform/platform-api/src/com/intellij/openapi/wm/FocusCommand.java b/platform/platform-api/src/com/intellij/openapi/wm/FocusCommand.java index 837dc540629d..304a534826df 100644 --- a/platform/platform-api/src/com/intellij/openapi/wm/FocusCommand.java +++ b/platform/platform-api/src/com/intellij/openapi/wm/FocusCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -212,7 +212,7 @@ public abstract class FocusCommand extends ActiveRunnable implements Expirable { } clear(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } private void clear() { diff --git a/platform/platform-api/src/com/intellij/openapi/wm/PassThroughIdeFocusManager.java b/platform/platform-api/src/com/intellij/openapi/wm/PassThroughIdeFocusManager.java index e7bcf55b81b3..f124c85a9f5a 100644 --- a/platform/platform-api/src/com/intellij/openapi/wm/PassThroughIdeFocusManager.java +++ b/platform/platform-api/src/com/intellij/openapi/wm/PassThroughIdeFocusManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -36,7 +36,7 @@ public class PassThroughIdeFocusManager extends IdeFocusManager { @NotNull public ActionCallback requestFocus(@NotNull Component c, boolean forced) { c.requestFocus(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @NotNull @@ -78,7 +78,7 @@ public class PassThroughIdeFocusManager extends IdeFocusManager { @NotNull public ActionCallback requestDefaultFocus(boolean forced) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override diff --git a/platform/platform-api/src/com/intellij/ui/AutoScrollToSourceHandler.java b/platform/platform-api/src/com/intellij/ui/AutoScrollToSourceHandler.java index d69c9cab72c8..0259031eb7c2 100644 --- a/platform/platform-api/src/com/intellij/ui/AutoScrollToSourceHandler.java +++ b/platform/platform-api/src/com/intellij/ui/AutoScrollToSourceHandler.java @@ -232,7 +232,7 @@ public abstract class AutoScrollToSourceHandler { private ActionCallback getReady(DataContext context) { ToolWindow toolWindow = PlatformDataKeys.TOOL_WINDOW.getData(context); - return toolWindow != null ? toolWindow.getReady(this) : new ActionCallback.Done(); + return toolWindow != null ? toolWindow.getReady(this) : ActionCallback.DONE; } } diff --git a/platform/platform-api/src/com/intellij/ui/navigation/Place.java b/platform/platform-api/src/com/intellij/ui/navigation/Place.java index 7cbd68572bd8..2dfe580f0f8e 100644 --- a/platform/platform-api/src/com/intellij/ui/navigation/Place.java +++ b/platform/platform-api/src/com/intellij/ui/navigation/Place.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -22,8 +22,8 @@ import com.intellij.util.ui.update.ComparableObjectCheck; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.LinkedHashMap; import java.util.Iterator; +import java.util.LinkedHashMap; public class Place implements ComparableObject { @@ -105,7 +105,7 @@ public class Place implements ComparableObject { if (object instanceof Navigator) { return ((Navigator)object).navigateTo(place, requestFocus); } - return new ActionCallback.Done(); + return ActionCallback.DONE; } public static void queryFurther(final Object object, final Place place) { diff --git a/platform/platform-api/src/com/intellij/ui/switcher/SwitchManager.java b/platform/platform-api/src/com/intellij/ui/switcher/SwitchManager.java index 29f88c6ba1dd..af2b4d529966 100644 --- a/platform/platform-api/src/com/intellij/ui/switcher/SwitchManager.java +++ b/platform/platform-api/src/com/intellij/ui/switcher/SwitchManager.java @@ -97,7 +97,7 @@ public class SwitchManager { private ActionCallback tryToInitSessionFromFocus(@Nullable SwitchTarget preselected, boolean showSpots) { if (isSessionActive()) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); @@ -106,7 +106,7 @@ public class SwitchManager { return initSession(new SwitchingSession(this, provider, myAutoInitSessionEvent, preselected, showSpots)); } - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } private void cancelWaitingForAutoInit() { @@ -150,7 +150,7 @@ public class SwitchManager { disposeCurrentSession(false); mySession = session; - return new ActionCallback.Done(); + return ActionCallback.DONE; } public void disposeCurrentSession(boolean fadeAway) { diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java index beab46c97e22..818e5db836b4 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java @@ -884,14 +884,14 @@ public class JBTabsImpl extends JComponent private ActionCallback executeSelectionChange(TabInfo info, boolean requestFocus) { if (mySelectedInfo != null && mySelectedInfo.equals(info)) { if (!requestFocus) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } else { Component owner = myFocusManager.getFocusOwner(); JComponent c = info.getComponent(); if (c != null && owner != null) { if (c == owner || SwingUtilities.isDescendingFrom(owner, c)) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } } return requestFocus(getToFocus()); @@ -984,11 +984,11 @@ public class JBTabsImpl extends JComponent @NotNull private ActionCallback requestFocus(final JComponent toFocus) { - if (toFocus == null) return new ActionCallback.Done(); + if (toFocus == null) return ActionCallback.DONE; if (myTestMode) { toFocus.requestFocus(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @@ -2533,7 +2533,7 @@ public class JBTabsImpl extends JComponent @NotNull private ActionCallback removeTab(TabInfo info, @Nullable TabInfo forcedSelectionTransfer, boolean transferFocus, boolean isDropTarget) { if (!isDropTarget) { - if (info == null || !getTabs().contains(info)) return new ActionCallback.Done(); + if (info == null || !getTabs().contains(info)) return ActionCallback.DONE; } if (isDropTarget && myLastLayoutPass != null) { diff --git a/platform/platform-api/src/com/intellij/util/ui/tree/TreeUtil.java b/platform/platform-api/src/com/intellij/util/ui/tree/TreeUtil.java index 9443bb559f96..0d947d45c440 100644 --- a/platform/platform-api/src/com/intellij/util/ui/tree/TreeUtil.java +++ b/platform/platform-api/src/com/intellij/util/ui/tree/TreeUtil.java @@ -395,7 +395,7 @@ public final class TreeUtil { row++; return showAndSelect(tree, row, row + 2, row, getSelectedRow(tree), false, true, true); } else { - return new ActionCallback.Done(); + return ActionCallback.DONE; } } @@ -406,7 +406,7 @@ public final class TreeUtil { row--; return showAndSelect(tree, row - 2, row, row, getSelectedRow(tree), false, true, true); } else { - return new ActionCallback.Done(); + return ActionCallback.DONE; } } @@ -485,12 +485,12 @@ public final class TreeUtil { public static ActionCallback showAndSelect(@NotNull final JTree tree, int top, int bottom, final int row, final int previous, final boolean addToSelection, final boolean scroll, final boolean resetSelection) { final TreePath path = tree.getPathForRow(row); - if (path == null) return new ActionCallback.Done(); + if (path == null) return ActionCallback.DONE; final int size = tree.getRowCount(); if (size == 0) { tree.clearSelection(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } if (top < 0){ top = 0; @@ -499,7 +499,7 @@ public final class TreeUtil { bottom = size - 1; } - if (row >= tree.getRowCount()) return new ActionCallback.Done(); + if (row >= tree.getRowCount()) return ActionCallback.DONE; boolean okToScroll = true; if (tree.isShowing()) { @@ -533,12 +533,12 @@ public final class TreeUtil { if (!okToScroll) { selectRunnable.run(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } final Rectangle rowBounds = tree.getRowBounds(row); - if (rowBounds == null) return new ActionCallback.Done(); + if (rowBounds == null) return ActionCallback.DONE; Rectangle topBounds = tree.getRowBounds(top); if (topBounds == null) { @@ -835,7 +835,7 @@ public final class TreeUtil { @NotNull public static ActionCallback selectInTree(@Nullable DefaultMutableTreeNode node, boolean requestFocus, @NotNull JTree tree, boolean center) { - if (node == null) return new ActionCallback.Done(); + if (node == null) return ActionCallback.DONE; final TreePath treePath = new TreePath(node.getPath()); tree.expandPath(treePath); @@ -847,7 +847,7 @@ public final class TreeUtil { @NotNull public static ActionCallback selectInTree(Project project, @Nullable DefaultMutableTreeNode node, boolean requestFocus, @NotNull JTree tree, boolean center) { - if (node == null) return new ActionCallback.Done(); + if (node == null) return ActionCallback.DONE; final TreePath treePath = new TreePath(node.getPath()); tree.expandPath(treePath); diff --git a/platform/platform-impl/src/com/intellij/ide/impl/ProjectUtil.java b/platform/platform-impl/src/com/intellij/ide/impl/ProjectUtil.java index 79da05f596cb..111a9323cad6 100644 --- a/platform/platform-impl/src/com/intellij/ide/impl/ProjectUtil.java +++ b/platform/platform-impl/src/com/intellij/ide/impl/ProjectUtil.java @@ -263,7 +263,7 @@ public class ProjectUtil { f.toFront(); //f.requestFocus(); } - return new ActionCallback.Done(); + return ActionCallback.DONE; } }; diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java index 4dfa9f7a8ee7..319ce8916256 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java @@ -1258,7 +1258,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar { @Override public ActionCallback switchTo(boolean requestFocus) { myButton.click(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java index eb3b31817269..3835787456b2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java @@ -183,7 +183,7 @@ public final class EditorTabbedContainer implements Disposable, CloseAction.Clos } public ActionCallback setSelectedIndex(final int indexToSelect, boolean focusEditor) { - if (indexToSelect >= myTabs.getTabCount()) return new ActionCallback.Rejected(); + if (indexToSelect >= myTabs.getTabCount()) return ActionCallback.REJECTED; return myTabs.select(myTabs.getTabAt(indexToSelect), focusEditor); } @@ -252,7 +252,7 @@ public final class EditorTabbedContainer implements Disposable, CloseAction.Clos toSelect = null; } final ActionCallback callback = myTabs.removeTab(info, toSelect, transferFocus); - return myProject.isOpen() ? callback : new ActionCallback.Done(); + return myProject.isOpen() ? callback : ActionCallback.DONE; } public ActionCallback removeTabAt(final int componentIndex, int indexToSelect) { diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ex/Settings.java b/platform/platform-impl/src/com/intellij/openapi/options/ex/Settings.java index a352c621af4c..0b27b1144952 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/ex/Settings.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/ex/Settings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -53,7 +53,7 @@ public abstract class Settings { public final ActionCallback select(Configurable configurable) { return configurable != null ? selectImpl(choose(configurable, myMap.get(configurable))) - : new ActionCallback.Rejected(); + : ActionCallback.REJECTED; } protected abstract ActionCallback selectImpl(Configurable configurable); diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/IdeSettingsDialog.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/IdeSettingsDialog.java index 5c720c413e00..68e67037b690 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/IdeSettingsDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/IdeSettingsDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -138,19 +138,19 @@ public class IdeSettingsDialog extends DialogWrapper implements DataProvider { @Override public ActionCallback onModifiedAdded(final Configurable configurable) { updateStatus(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override public ActionCallback onModifiedRemoved(final Configurable configurable) { updateStatus(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override public ActionCallback onErrorsChanged() { updateStatus(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } }); Disposer.register(myDisposable, myEditor); diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditor.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditor.java index d1ebb4063e1d..723953d1aca3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditor.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditor.java @@ -324,7 +324,7 @@ public class OptionsEditor extends JPanel implements DataProvider, Place.Navigat public ActionCallback select(Class configurableClass) { final Configurable configurable = findConfigurable(configurableClass); if (configurable == null) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } return select(configurable); } @@ -379,7 +379,7 @@ public class OptionsEditor extends JPanel implements DataProvider, Place.Navigat } private ActionCallback processSelected(final Configurable configurable, final Configurable oldConfigurable) { - if (isShowing(configurable)) return new ActionCallback.Done(); + if (isShowing(configurable)) return ActionCallback.DONE; final ActionCallback result = new ActionCallback(); @@ -452,7 +452,7 @@ public class OptionsEditor extends JPanel implements DataProvider, Place.Navigat assertIsDispatchThread(); if (myDisposed) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } final ActionCallback result = new ActionCallback(); @@ -931,9 +931,9 @@ public class OptionsEditor extends JPanel implements DataProvider, Place.Navigat updateDetails(); final ConfigurableContent content = myConfigurable2Content.get(configurable); content.updateBannerActions(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } else { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } } } diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorColleague.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorColleague.java index 62d473762002..9df60fc0f148 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorColleague.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorColleague.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -15,9 +15,9 @@ */ package com.intellij.openapi.options.newEditor; -import org.jetbrains.annotations.Nullable; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.util.ActionCallback; +import org.jetbrains.annotations.Nullable; interface OptionsEditorColleague { ActionCallback onSelected(@Nullable Configurable configurable, final Configurable oldConfigurable); @@ -30,19 +30,19 @@ interface OptionsEditorColleague { class Adapter implements OptionsEditorColleague { public ActionCallback onSelected(@Nullable final Configurable configurable, final Configurable oldConfigurable) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } public ActionCallback onModifiedAdded(final Configurable configurable) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } public ActionCallback onModifiedRemoved(final Configurable configurable) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } public ActionCallback onErrorsChanged() { - return new ActionCallback.Done(); + return ActionCallback.DONE; } } diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorContext.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorContext.java index 885c6287338a..ca6272d5cb8b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorContext.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -17,8 +17,8 @@ package com.intellij.openapi.options.newEditor; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.util.MultiValuesMap; import com.intellij.openapi.util.ActionCallback; +import com.intellij.openapi.util.MultiValuesMap; import com.intellij.ui.speedSearch.ElementFilter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -45,7 +45,7 @@ public class OptionsEditorContext { } ActionCallback fireSelected(@Nullable final Configurable configurable, @NotNull OptionsEditorColleague requestor) { - if (myCurrentConfigurable == configurable) return new ActionCallback.Rejected(); + if (myCurrentConfigurable == configurable) return ActionCallback.REJECTED; final Configurable old = myCurrentConfigurable; myCurrentConfigurable = configurable; @@ -59,7 +59,7 @@ public class OptionsEditorContext { } ActionCallback fireModifiedAdded(@NotNull final Configurable configurable, @Nullable OptionsEditorColleague requestor) { - if (myModified.contains(configurable)) return new ActionCallback.Rejected(); + if (myModified.contains(configurable)) return ActionCallback.REJECTED; myModified.add(configurable); @@ -72,7 +72,7 @@ public class OptionsEditorContext { } ActionCallback fireModifiedRemoved(@NotNull final Configurable configurable, @Nullable OptionsEditorColleague requestor) { - if (!myModified.contains(configurable)) return new ActionCallback.Rejected(); + if (!myModified.contains(configurable)) return ActionCallback.REJECTED; myModified.remove(configurable); @@ -84,7 +84,7 @@ public class OptionsEditorContext { } ActionCallback fireErrorsChanged(final Map errors, OptionsEditorColleague requestor) { - if (myErrors.equals(errors)) return new ActionCallback.Rejected(); + if (myErrors.equals(errors)) return ActionCallback.REJECTED; myErrors = errors != null ? errors : new HashMap(); diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorDialog.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorDialog.java index 6a9a953cfc9f..13ea327f7b86 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -112,19 +112,19 @@ public class OptionsEditorDialog extends DialogWrapper implements DataProvider{ @Override public ActionCallback onModifiedAdded(final Configurable configurable) { updateStatus(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override public ActionCallback onModifiedRemoved(final Configurable configurable) { updateStatus(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override public ActionCallback onErrorsChanged() { updateStatus(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } }); Disposer.register(myDisposable, myEditor); diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java index ce76b1f19d47..5579651fe705 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -151,7 +151,7 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl ActionCallback queueSelection(final Configurable configurable) { if (myBuilder.isSelectionBeingAdjusted()) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } final ActionCallback callback = new ActionCallback(); @@ -585,16 +585,16 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl public ActionCallback onModifiedAdded(final Configurable colleague) { myTree.repaint(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } public ActionCallback onModifiedRemoved(final Configurable configurable) { myTree.repaint(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } public ActionCallback onErrorsChanged() { - return new ActionCallback.Done(); + return ActionCallback.DONE; } public void processTextEvent(KeyEvent e) { diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsFilter.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsFilter.java index 0818cb6d176f..248eb2a42fdf 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsFilter.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -144,7 +144,7 @@ abstract class SettingsFilter extends ElementFilter.Active.Impl { private ActionCallback update(DocumentEvent.EventType type, boolean adjustSelection, boolean now) { if (myUpdateRejected) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } String text = getFilterText(); if (text.isEmpty()) { diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsTreeView.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsTreeView.java index 9f7b1bc70e4d..7148e6fa837f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsTreeView.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsTreeView.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -325,7 +325,7 @@ final class SettingsTreeView extends JComponent implements Disposable, OptionsEd ActionCallback select(@Nullable final Configurable configurable) { if (myBuilder.isSelectionBeingAdjusted()) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } final ActionCallback callback = new ActionCallback(); myQueuedConfigurable = configurable; @@ -392,18 +392,18 @@ final class SettingsTreeView extends JComponent implements Disposable, OptionsEd @Override public ActionCallback onModifiedAdded(Configurable configurable) { myTree.repaint(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override public ActionCallback onModifiedRemoved(Configurable configurable) { myTree.repaint(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override public ActionCallback onErrorsChanged() { - return new ActionCallback.Done(); + return ActionCallback.DONE; } private final class MyRoot extends CachingSimpleNode { diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/GlassPaneDialogWrapperPeer.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/GlassPaneDialogWrapperPeer.java index 156a44ef0dea..a0438ce43736 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/impl/GlassPaneDialogWrapperPeer.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/GlassPaneDialogWrapperPeer.java @@ -327,7 +327,7 @@ public class GlassPaneDialogWrapperPeer extends DialogWrapperPeer implements Foc myDialog.setVisible(true); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AbstractCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AbstractCommand.java index 270374ba6c3d..e393cd17508e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AbstractCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/AbstractCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -90,7 +90,7 @@ public abstract class AbstractCommand implements PlaybackCommand { } catch (Throwable e) { context.error(e.getMessage(), getLine()); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } } diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ActionCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ActionCommand.java index d45fe2c8b032..79ae07d343d3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ActionCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ActionCommand.java @@ -45,7 +45,7 @@ public class ActionCommand extends TypeCommand { final AnAction targetAction = am.getAction(actionName); if (targetAction == null) { dumpError(context, "Unknown action: " + actionName); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/CallCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/CallCommand.java index 910c44d8f9a1..1cb672fcfcd8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/CallCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/CallCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -45,13 +45,13 @@ public class CallCommand extends AbstractCommand { final int open = cmd.indexOf("("); if (open == -1) { context.error("( expected", getLine()); - return new ActionCallback.Done(); + return ActionCallback.DONE; } final int close = cmd.lastIndexOf(")"); if (close == -1) { context.error(") expected", getLine()); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @@ -69,14 +69,14 @@ public class CallCommand extends AbstractCommand { Pair methodClass = findMethod(context, methodName, types); if (methodClass == null) { context.error("No method \"" + methodName + "\" found in facade classes: " + context.getCallClasses(), getLine()); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } Method m = methodClass.getFirst(); if (!m.getReturnType().isAssignableFrom(AsyncResult.class)) { context.error("Method " + methodClass.getSecond() + ":" + methodName + " must return AsyncResult object", getLine()); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } Object[] actualArgs = noArgs ? new Object[1] : new Object[args.length + 1]; @@ -87,7 +87,7 @@ public class CallCommand extends AbstractCommand { AsyncResult result = (AsyncResult)m.invoke(null, actualArgs); if (result == null) { context.error("Method " + methodClass.getSecond() + ":" + methodName + " must return AsyncResult object, but was null", getLine()); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } result.doWhenDone(new Consumer() { diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/CdCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/CdCommand.java index 7f6e4177982b..76f974bab3f4 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/CdCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/CdCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * 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. @@ -43,7 +43,7 @@ public class CdCommand extends AbstractCommand { File file = context.getPathMacro().resolveFile(myDir, context.getBaseDir()); if (!file.exists()) { context.message("Cannot cd, directory doesn't exist: " + file.getAbsoluteFile(), getLine()); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } try { @@ -54,6 +54,6 @@ public class CdCommand extends AbstractCommand { } context.message("{base.dir} set to " + context.getBaseDir().getAbsolutePath(), getLine()); - return new ActionCallback.Done(); + return ActionCallback.DONE; } } diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/DelayCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/DelayCommand.java index ba773d4534ed..0c461b4190d6 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/DelayCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/DelayCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -34,9 +34,9 @@ public class DelayCommand extends AbstractCommand { } catch (NumberFormatException e) { dumpError(context, "Invalid delay value: " + s); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } - return new ActionCallback.Done(); + return ActionCallback.DONE; } } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/EmptyCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/EmptyCommand.java index b27654f19f04..e09fecbd5d1d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/EmptyCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/EmptyCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -24,6 +24,6 @@ public class EmptyCommand extends AbstractCommand { } public ActionCallback _execute(PlaybackContext context) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ErrorCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ErrorCommand.java index 93c1ee3292e5..6abaf117e486 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ErrorCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ErrorCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -26,6 +26,6 @@ public class ErrorCommand extends AbstractCommand { public ActionCallback _execute(PlaybackContext context) { dumpError(context, getText()); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyShortcutCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyShortcutCommand.java index 5031ec37d904..840bbc3ed219 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyShortcutCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyShortcutCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -31,11 +31,11 @@ public class KeyShortcutCommand extends TypeCommand { final String one = getText().substring(PREFIX.length()); if (!one.endsWith(POSTFIX)) { dumpError(context, "Expected " + "]"); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } type(context.getRobot(), getFromShortcut(one.substring(0, one.length() - 1).trim())); - return new ActionCallback.Done(); + return ActionCallback.DONE; } } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PopStage.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PopStage.java index 811480640cb3..fbec58a97163 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PopStage.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PopStage.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * 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. @@ -34,7 +34,7 @@ public class PopStage extends AbstractCommand { context.test("Test finished OK: " + stage.getName(), getLine()); context.addPassed(stage); } - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PrintCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PrintCommand.java index 68cf05a8bbfb..20ae38186c3b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PrintCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PrintCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * 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. @@ -37,6 +37,6 @@ public class PrintCommand extends AbstractCommand { @Override protected ActionCallback _execute(PlaybackContext context) { context.code(myText, getLine()); - return new ActionCallback.Done(); + return ActionCallback.DONE; } } diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PushStage.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PushStage.java index 5031ded8c3e1..a88f18c2612a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PushStage.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/PushStage.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * 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. @@ -32,7 +32,7 @@ public class PushStage extends AbstractCommand { String name = getText().substring(PREFIX.length()).trim(); context.test("Test started: " + name, getLine()); context.pushStage(new StageInfo(name)); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/RegistryValueCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/RegistryValueCommand.java index b4f7b2fbd1b0..b3354ab5c995 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/RegistryValueCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/RegistryValueCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -32,7 +32,7 @@ public class RegistryValueCommand extends AbstractCommand { final String[] keyValue = getText().substring(PREFIX.length()).trim().split("="); if (keyValue.length != 2) { context.error("Expected expresstion: " + PREFIX + " key=value", getLine()); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } final String key = keyValue[0]; @@ -42,6 +42,6 @@ public class RegistryValueCommand extends AbstractCommand { Registry.get(key).setValue(value); - return new ActionCallback.Done(); + return ActionCallback.DONE; } } diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/StopCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/StopCommand.java index 1d122fe47ebb..be03a3797889 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/StopCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/StopCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -28,7 +28,7 @@ public class StopCommand extends AbstractCommand { protected ActionCallback _execute(PlaybackContext context) { context.message("Stopped", getLine()); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ToggleActionCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ToggleActionCommand.java index 8f8e9e09b1ee..ba32a4d85742 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ToggleActionCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/ToggleActionCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * 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. @@ -50,7 +50,7 @@ public class ToggleActionCommand extends AbstractCommand { String syntaxText = "Syntax error, expected: " + PREFIX + " " + ON + "|" + OFF + " actionName"; if (args.length != 2) { context.error(syntaxText, getLine()); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } final boolean on; @@ -60,19 +60,19 @@ public class ToggleActionCommand extends AbstractCommand { on = false; } else { context.error(syntaxText, getLine()); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } String actionId = args[1]; final AnAction action = ActionManager.getInstance().getAction(actionId); if (action == null) { context.error("Unknown action id=" + actionId, getLine()); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } if (!(action instanceof ToggleAction)) { context.error("Action is not a toggle action id=" + actionId, getLine()); - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } final InputEvent inputEvent = ActionCommand.getInputEvent(actionId); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java index 7269997487e8..0bd7e313df41 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -1013,7 +1013,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable { @NotNull @Override public ActionCallback requestFocus(@NotNull Component c, boolean forced) { - final ActionCallback result = isExpired() ? new ActionCallback.Rejected() : myManager.requestFocus(c, forced); + final ActionCallback result = isExpired() ? ActionCallback.REJECTED : myManager.requestFocus(c, forced); result.doWhenProcessed(new Runnable() { @Override public void run() { @@ -1030,7 +1030,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable { @NotNull @Override public ActionCallback requestFocus(@NotNull FocusCommand command, boolean forced) { - return isExpired() ? new ActionCallback.Rejected() : myManager.requestFocus(command, forced); + return isExpired() ? ActionCallback.REJECTED : myManager.requestFocus(command, forced); } @Override @@ -1186,7 +1186,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable { } - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFocusManagerHeadless.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFocusManagerHeadless.java index 766cf95bd81b..7b545578bc10 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFocusManagerHeadless.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFocusManagerHeadless.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -36,13 +36,13 @@ public class IdeFocusManagerHeadless extends IdeFocusManager { @Override @NotNull public ActionCallback requestFocus(@NotNull final Component c, final boolean forced) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override @NotNull public ActionCallback requestFocus(@NotNull final FocusCommand command, final boolean forced) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override @@ -84,7 +84,7 @@ public class IdeFocusManagerHeadless extends IdeFocusManager { @Override @NotNull public ActionCallback requestDefaultFocus(boolean forced) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java index d8954bc4da89..6683ed0973ad 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -304,7 +304,7 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx { @NotNull @Override public ActionCallback getReady(@NotNull Object requestor) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override @@ -446,7 +446,7 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx { @Override public ActionCallback getActivation() { - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override @@ -497,7 +497,7 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx { @NotNull @Override public ActionCallback getReady(@NotNull Object requestor) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override @@ -666,7 +666,7 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx { @Override public ActionCallback removeContent(@NotNull Content content, boolean dispose, boolean trackFocus, boolean implicitFocus) { removeContent(content, dispose); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override @@ -682,12 +682,12 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx { @Override public ActionCallback selectNextContent() { - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override public ActionCallback selectPreviousContent() { - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override @@ -704,7 +704,7 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx { @Override public ActionCallback setSelectedContentCB(@NotNull Content content) { setSelectedContent(content); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override @@ -738,7 +738,7 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx { @NotNull @Override public ActionCallback requestFocus(@Nullable final Content content, final boolean forced) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java index 149470b60933..9833aabd12e7 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -74,7 +74,7 @@ public final class ToolWindowImpl implements ToolWindowEx { private ToolWindowFactory myContentFactory; @NotNull - private ActionCallback myActivation = new ActionCallback.Done(); + private ActionCallback myActivation = ActionCallback.DONE; private final BusyObject.Impl myShowing = new BusyObject.Impl() { @Override public boolean isReady() { diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java index 8a20d8b1897d..96fe52a91bb4 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java @@ -639,7 +639,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements @Override public ActionCallback run() { runnable.run(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } }.setExpirable(runnable), forced); } @@ -690,7 +690,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements activateToolWindow(myActiveStack.peek(), false, true); } } - return new ActionCallback.Done(); + return ActionCallback.DONE; } }, false); } @@ -1840,7 +1840,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements } private ActionCallback appendRequestFocusInEditorComponentCmd(List commandList, boolean forced) { - if (myProject.isDisposed()) return new ActionCallback.Done(); + if (myProject.isDisposed()) return ActionCallback.DONE; EditorsSplitters splitters = getSplittersToFocus(); CommandProcessor commandProcessor = myWindowManager.getCommandProcessor(); RequestFocusInEditorComponentCmd command = new RequestFocusInEditorComponentCmd(splitters, getFocusManager(), commandProcessor, forced); @@ -2480,7 +2480,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements activateToolWindow(activeId, forced, true); } - return new ActionCallback.Done(); + return ActionCallback.DONE; } Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); if (activeWindow != null) { @@ -2496,13 +2496,13 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements JComponent toFocus = IdeFocusTraversalPolicy.getPreferredFocusedComponent(root); if (toFocus != null) { if (DialogWrapper.findInstance(toFocus) != null) { - return new ActionCallback.Done(); //IDEA-80929 + return ActionCallback.DONE; //IDEA-80929 } return IdeFocusManager.findInstanceByComponent(toFocus).requestFocus(toFocus, forced); } } } - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/commands/RequestFocusInToolWindowCmd.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/commands/RequestFocusInToolWindowCmd.java index c8f542133149..62d6cc4978a8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/commands/RequestFocusInToolWindowCmd.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/commands/RequestFocusInToolWindowCmd.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -174,7 +174,7 @@ public final class RequestFocusInToolWindowCmd extends FinalizableCommand { @Override @NotNull public ActionCallback run() { - return new ActionCallback.Done(); + return ActionCallback.DONE; } }, myForced).doWhenProcessed(new Runnable() { @Override diff --git a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java index 2f60475e6b80..359c219fc72b 100644 --- a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java @@ -450,7 +450,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui { myFocusManager = IdeFocusManager.findInstanceByComponent(myLayeredPane); final Ref originalFocusOwner = new Ref(); final Ref focusRequestor = new Ref(); - final Ref proxyFocusRequest = new Ref(new ActionCallback.Done()); + final Ref proxyFocusRequest = new Ref(ActionCallback.DONE); boolean mnemonicsFix = myDialogMode && SystemInfo.isMac && Registry.is("ide.mac.inplaceDialogMnemonicsFix"); if (mnemonicsFix) { diff --git a/platform/platform-impl/src/com/intellij/ui/FocusTrackback.java b/platform/platform-impl/src/com/intellij/ui/FocusTrackback.java index 8905c88ed95a..b9bc4de59b62 100644 --- a/platform/platform-impl/src/com/intellij/ui/FocusTrackback.java +++ b/platform/platform-impl/src/com/intellij/ui/FocusTrackback.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -249,7 +249,7 @@ public class FocusTrackback { private ActionCallback _restoreFocus() { final List stack = getCleanStack(); - if (!stack.contains(this)) return new ActionCallback.Rejected(); + if (!stack.contains(this)) return ActionCallback.REJECTED; Component toFocus = queryToFocus(stack, this, true); diff --git a/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java b/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java index 11385f145ede..a6903fd03646 100644 --- a/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java @@ -117,9 +117,9 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene @Override public ActionCallback getReady(@NotNull Object requestor) { Content selected = getSelectedContent(); - if (selected == null) return new ActionCallback.Done(); + if (selected == null) return ActionCallback.DONE; BusyObject busyObject = selected.getBusyObject(); - return busyObject != null ? busyObject.getReady(requestor) : new ActionCallback.Done(); + return busyObject != null ? busyObject.getReady(requestor) : ActionCallback.DONE; } private class MyNonOpaquePanel extends NonOpaquePanel implements DataProvider { @@ -249,17 +249,17 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene private ActionCallback removeContent(@NotNull Content content, boolean trackSelection, boolean dispose) { ApplicationManager.getApplication().assertIsDispatchThread(); int indexToBeRemoved = getIndexOfContent(content); - if (indexToBeRemoved == -1) return new ActionCallback.Rejected(); + if (indexToBeRemoved == -1) return ActionCallback.REJECTED; try { Content selection = mySelection.isEmpty() ? null : mySelection.get(mySelection.size() - 1); int selectedIndex = selection != null ? myContents.indexOf(selection) : -1; if (!fireContentRemoveQuery(content, indexToBeRemoved, ContentManagerEvent.ContentOperation.undefined)) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } if (!content.isValid()) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } boolean wasSelected = isSelected(content); @@ -497,7 +497,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene } if (!checkSelectionChangeShouldBeProcessed(content, implicit)) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } if (!myContents.contains(content)) { throw new IllegalArgumentException("Cannot find content:" + content.getDisplayName()); @@ -511,7 +511,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene @NotNull @Override public ActionCallback run() { - if (myDisposed || getIndexOfContent(content) == -1) return new ActionCallback.Rejected(); + if (myDisposed || getIndexOfContent(content) == -1) return ActionCallback.REJECTED; for (Content each : old) { removeFromSelection(each); @@ -522,7 +522,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene if (requestFocus) { return requestFocus(content, forcedFocus); } - return new ActionCallback.Done(); + return ActionCallback.DONE; } }; @@ -636,7 +636,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene @Override public ActionCallback requestFocus(final Content content, final boolean forced) { final Content toSelect = content == null ? getSelectedContent() : content; - if (toSelect == null) return new ActionCallback.Rejected(); + if (toSelect == null) return ActionCallback.REJECTED; assert myContents.contains(toSelect); @@ -660,7 +660,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene toFocus.requestFocus(); } - return new ActionCallback.Done(); + return ActionCallback.DONE; } private static JComponent computeWillFocusComponent(Content toSelect) { diff --git a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java index 015a7e6c1bb5..f9846da94b4b 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java @@ -931,7 +931,7 @@ public class AbstractPopup implements JBPopup { public ActionCallback run() { if (isDisposed()) { removeActivity(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } _requestFocus(); @@ -961,14 +961,14 @@ public class AbstractPopup implements JBPopup { @Override public ActionCallback run() { if (isDisposed()) { - return new ActionCallback.Rejected(); + return ActionCallback.REJECTED; } _requestFocus(); afterShowRunnable.run(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } }, true).notify(result).doWhenProcessed(new Runnable() { @Override @@ -1181,7 +1181,7 @@ public class AbstractPopup implements JBPopup { @Override public ActionCallback run() { _requestFocus(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } }, true); diff --git a/platform/structure-view-api/src/com/intellij/ide/util/treeView/AbstractTreeStructure.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/AbstractTreeStructure.java index acd6548ff26d..262ab06fc625 100644 --- a/platform/structure-view-api/src/com/intellij/ide/util/treeView/AbstractTreeStructure.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/AbstractTreeStructure.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -37,10 +37,10 @@ public abstract class AbstractTreeStructure { @NotNull public static ActionCallback asyncCommitDocuments(@NotNull Project project) { - if (project.isDisposed()) return new ActionCallback.Done(); + if (project.isDisposed()) return ActionCallback.DONE; PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); if (!documentManager.hasUncommitedDocuments()) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } final ActionCallback callback = new ActionCallback(); documentManager.performWhenAllCommitted(callback.createSetDoneRunnable()); @@ -57,7 +57,7 @@ public abstract class AbstractTreeStructure { @NotNull public ActionCallback asyncCommit() { if (hasSomethingToCommit()) commit(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } public boolean isToBuildChildrenInBackground(Object element){ diff --git a/platform/testFramework/src/com/intellij/mock/Mock.java b/platform/testFramework/src/com/intellij/mock/Mock.java index cae264c57d41..7d8006932eeb 100644 --- a/platform/testFramework/src/com/intellij/mock/Mock.java +++ b/platform/testFramework/src/com/intellij/mock/Mock.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -28,7 +28,10 @@ import com.intellij.openapi.fileEditor.impl.EditorsSplitters; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.ui.popup.Balloon; -import com.intellij.openapi.util.*; +import com.intellij.openapi.util.ActionCallback; +import com.intellij.openapi.util.AsyncResult; +import com.intellij.openapi.util.Pair; +import com.intellij.openapi.util.UserDataHolderBase; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileSystem; import com.intellij.openapi.wm.IdeFocusManager; @@ -147,13 +150,13 @@ public class Mock { @Override public ActionCallback notifyPublisher(@NotNull Runnable runnable) { runnable.run(); - return new ActionCallback.Done(); + return ActionCallback.DONE; } @NotNull @Override public ActionCallback getReady(@NotNull Object requestor) { - return new ActionCallback.Done(); + return ActionCallback.DONE; } @NotNull diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenAttachSourcesProvider.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenAttachSourcesProvider.java index 83b7077273d0..17c4d2beacfa 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenAttachSourcesProvider.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenAttachSourcesProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * 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. @@ -66,12 +66,14 @@ public class MavenAttachSourcesProvider implements AttachSourcesProvider { public ActionCallback perform(List orderEntries) { // may have been changed by this time... Collection mavenProjects = getMavenProjects(psiFile); - if (mavenProjects.isEmpty()) return new ActionCallback.Rejected(); + if (mavenProjects.isEmpty()) { + return ActionCallback.REJECTED; + } MavenProjectsManager manager = MavenProjectsManager.getInstance(psiFile.getProject()); Collection artifacts = findArtifacts(mavenProjects, orderEntries); - if (artifacts.isEmpty()) return new ActionCallback.Rejected(); + if (artifacts.isEmpty()) return ActionCallback.REJECTED; final AsyncResult result = new AsyncResult(); manager.scheduleArtifactsDownloading(mavenProjects, artifacts, true, false, result);