IDEA-142839 ActionCallback.REJECTED.doWhenProcessed results in memory leaks

This commit is contained in:
Vladimir Krivosheev
2015-07-20 19:38:54 +02:00
parent 776e00b899
commit c9cd727dfc
73 changed files with 308 additions and 247 deletions
@@ -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<Library, LibraryOrderEntry> librariesToAppendSourcesTo = new HashMap<Library, LibraryOrderEntry>();
@@ -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) {
@@ -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<LibraryOrderEntry> 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;
}
});
}
@@ -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
@@ -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
@@ -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) {
@@ -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;
}
}
@@ -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);
}
@@ -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()) {
@@ -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
@@ -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;
}
}
@@ -245,7 +245,7 @@ public class GridImpl extends Wrapper implements Grid, Disposable, DataProvider
setContent(myContent);
myContent = null;
}
return new ActionCallback.Done();
return ActionCallback.DONE;
}
};
}
@@ -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();
@@ -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);
}
@@ -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();
}
@@ -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);
}
@@ -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
@@ -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);
}
}
@@ -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<String, Boolean> 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;
}
}
@@ -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;
}
}
@@ -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;
}
};
}
@@ -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
@@ -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);
}
@@ -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<Boolean> update = new AsyncResult<Boolean>();
@@ -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") {
@@ -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;
}
/**
@@ -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<ActionCallback> ref = (WeakReference<ActionCallback>)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;
@@ -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<Object> elements) {
if (elements.isEmpty()) return new ActionCallback.Done();
if (elements.isEmpty()) return ActionCallback.DONE;
ActionCallback result = new ActionCallback(elements.size());
for (Object hangElement : elements) {
@@ -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() {
@@ -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
@@ -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;
}
}
@@ -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) {
@@ -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) {
@@ -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) {
@@ -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);
@@ -263,7 +263,7 @@ public class ProjectUtil {
f.toFront();
//f.requestFocus();
}
return new ActionCallback.Done();
return ActionCallback.DONE;
}
};
@@ -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
@@ -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) {
@@ -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);
@@ -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);
@@ -324,7 +324,7 @@ public class OptionsEditor extends JPanel implements DataProvider, Place.Navigat
public ActionCallback select(Class<? extends Configurable> 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;
}
}
}
@@ -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;
}
}
@@ -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<Configurable, ConfigurationException> errors, OptionsEditorColleague requestor) {
if (myErrors.equals(errors)) return new ActionCallback.Rejected();
if (myErrors.equals(errors)) return ActionCallback.REJECTED;
myErrors = errors != null ? errors : new HashMap<Configurable, ConfigurationException>();
@@ -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);
@@ -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) {
@@ -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<SimpleNode> {
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()) {
@@ -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 {
@@ -327,7 +327,7 @@ public class GlassPaneDialogWrapperPeer extends DialogWrapperPeer implements Foc
myDialog.setVisible(true);
return new ActionCallback.Done();
return ActionCallback.DONE;
}
@Override
@@ -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;
}
}
@@ -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;
}
@@ -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<Method, Class> 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<String>)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<String>() {
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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
@@ -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;
}
}
@@ -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
@@ -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;
}
}
@@ -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
@@ -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);
@@ -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
@@ -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
@@ -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
@@ -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() {
@@ -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<FinalizableCommand> 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;
}
@@ -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
@@ -450,7 +450,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui {
myFocusManager = IdeFocusManager.findInstanceByComponent(myLayeredPane);
final Ref<Component> originalFocusOwner = new Ref<Component>();
final Ref<FocusRequestor> focusRequestor = new Ref<FocusRequestor>();
final Ref<ActionCallback> proxyFocusRequest = new Ref<ActionCallback>(new ActionCallback.Done());
final Ref<ActionCallback> proxyFocusRequest = new Ref<ActionCallback>(ActionCallback.DONE);
boolean mnemonicsFix = myDialogMode && SystemInfo.isMac && Registry.is("ide.mac.inplaceDialogMnemonicsFix");
if (mnemonicsFix) {
@@ -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<FocusTrackback> stack = getCleanStack();
if (!stack.contains(this)) return new ActionCallback.Rejected();
if (!stack.contains(this)) return ActionCallback.REJECTED;
Component toFocus = queryToFocus(stack, this, true);
@@ -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) {
@@ -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);
@@ -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){
@@ -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
@@ -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<LibraryOrderEntry> orderEntries) {
// may have been changed by this time...
Collection<MavenProject> mavenProjects = getMavenProjects(psiFile);
if (mavenProjects.isEmpty()) return new ActionCallback.Rejected();
if (mavenProjects.isEmpty()) {
return ActionCallback.REJECTED;
}
MavenProjectsManager manager = MavenProjectsManager.getInstance(psiFile.getProject());
Collection<MavenArtifact> artifacts = findArtifacts(mavenProjects, orderEntries);
if (artifacts.isEmpty()) return new ActionCallback.Rejected();
if (artifacts.isEmpty()) return ActionCallback.REJECTED;
final AsyncResult<MavenArtifactDownloader.DownloadResult> result = new AsyncResult<MavenArtifactDownloader.DownloadResult>();
manager.scheduleArtifactsDownloading(mavenProjects, artifacts, true, false, result);