Obsolete method usages replaced

This commit is contained in:
Roman Shevchenko
2013-02-07 19:57:05 +01:00
parent b649bcb600
commit 0b6fb18849
5 changed files with 13 additions and 23 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -384,17 +384,9 @@ public class GuiUtils {
}
}
/**
* Runs the runnable, if called from the dispatch thread.
* Otherwise calls {@link Application#invokeAndWait(Runnable, com.intellij.openapi.application.ModalityState)}
*/
/** @deprecated call {@link Application#invokeAndWait(Runnable, ModalityState)} directly (to remove in IDEA 13). */
@SuppressWarnings("UnusedDeclaration")
public static void invokeAndWaitIfNeeded(@NotNull Runnable runnable, @NotNull ModalityState modalityState) {
Application application = ApplicationManager.getApplication();
if (application.isDispatchThread()) {
runnable.run();
}
else {
application.invokeAndWait(runnable, modalityState);
}
ApplicationManager.getApplication().invokeAndWait(runnable, modalityState);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2013 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,7 +26,6 @@ import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.ui.GuiUtils;
import org.jetbrains.annotations.Nullable;
import java.io.UnsupportedEncodingException;
@@ -184,7 +183,7 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider {
}
if (key.get() == null) {
final Ref<PasswordSafeException> ex = new Ref<PasswordSafeException>();
GuiUtils.invokeAndWaitIfNeeded(new Runnable() {
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
public void run() {
if (key.get() == null) {
try {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -19,12 +19,12 @@ import com.intellij.ide.passwordSafe.PasswordSafe;
import com.intellij.ide.passwordSafe.PasswordSafeException;
import com.intellij.ide.passwordSafe.config.PasswordSafeSettings;
import com.intellij.ide.passwordSafe.impl.PasswordSafeImpl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.ui.GuiUtils;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nullable;
@@ -199,7 +199,7 @@ public class PasswordSafePromptDialog extends DialogWrapper {
}
}
final AtomicReference<String> pw = new AtomicReference<String>(null);
GuiUtils.invokeAndWaitIfNeeded(new Runnable() {
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
public void run() {
final PasswordSafePromptDialog d = new PasswordSafePromptDialog(project, ps, title, message);
if (promptLabel != null) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -27,7 +27,6 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.ui.GuiUtils;
import git4idea.GitVcs;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -133,7 +132,7 @@ public class GitTask {
completed.set(true);
}
};
GuiUtils.invokeAndWaitIfNeeded(new Runnable() {
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
@Override
public void run() {
ProgressManager.getInstance().run(task);
@@ -12,13 +12,13 @@
// limitations under the License.
package org.zmlx.hg4idea.provider.update;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.AbstractVcsHelper;
import com.intellij.openapi.vcs.update.FileGroup;
import com.intellij.openapi.vcs.update.UpdatedFiles;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.GuiUtils;
import com.intellij.vcsUtil.VcsUtil;
import org.jetbrains.annotations.NotNull;
import org.zmlx.hg4idea.HgFile;
@@ -75,7 +75,7 @@ public final class HgConflictResolver {
final HgVcs vcs = HgVcs.getInstance(myProject);
if (vcs == null) { return; }
GuiUtils.invokeAndWaitIfNeeded(new Runnable() {
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
public void run() {
AbstractVcsHelper.getInstance(myProject).showMergeDialog(conflicts, vcs.getMergeProvider());
}