本文整理匯總了Java中com.intellij.openapi.application.Application.invokeLater方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.invokeLater方法的具體用法?Java Application.invokeLater怎麽用?Java Application.invokeLater使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.application.Application
的用法示例。
在下文中一共展示了Application.invokeLater方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: beforeApplicationLoaded
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
public void beforeApplicationLoaded(@NotNull Application application, @NotNull String configPath) {
// Invoke later is necessary to make showWarning work.
// setFrameIcon is called to change icon of welcome screen and it is unclear
// if invoke later can be invoked to early (in the future) so setFrameIcon
// is called again on ClassicIcon#projectOpened just in case.
// Important here is only setDockIcon and this would work without invoke later also.
application.invokeLater(new Runnable() {
@Override
public void run() {
if (SystemInfo.isMac) {
setDockIcon();
} else {
ClassicIcon.setFrameIcon(null);
}
}
});
}
示例2: runOrInvokeLaterAboveProgress
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public static void runOrInvokeLaterAboveProgress(final Runnable command, @Nullable final ModalityState modalityState, @NotNull final Project project) {
final Application application = ApplicationManager.getApplication();
if (application.isDispatchThread()) {
command.run();
} else {
final ProgressIndicator pi = ProgressManager.getInstance().getProgressIndicator();
if (pi != null) {
execute(pi);
application.invokeLater(command, pi.getModalityState(), new Condition() {
@Override
public boolean value(Object o) {
return (! project.isOpen()) || project.isDisposed();
}
});
} else {
final ModalityState notNullModalityState = modalityState == null ? ModalityState.NON_MODAL : modalityState;
application.invokeLater(command, notNullModalityState, project.getDisposed());
}
}
}
示例3: doSetPresentation
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private static void doSetPresentation(@Nullable final Icon icon,
@NotNull final XValuePresentation presentation,
final boolean hasChildren,
final ConfigurableXValueNode node) {
Application application = ApplicationManager.getApplication();
if (application.isDispatchThread()) {
node.applyPresentation(icon, presentation, hasChildren);
}
else {
Runnable updater = new Runnable() {
@Override
public void run() {
node.applyPresentation(icon, presentation, hasChildren);
}
};
if (node instanceof XDebuggerTreeNode) {
((XDebuggerTreeNode)node).invokeNodeUpdate(updater);
}
else {
application.invokeLater(updater);
}
}
}
示例4: show
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private static void show(final Project project, final String message, final MessageType type, final boolean showOverChangesView,
@Nullable final NamedRunnable[] notificationListener) {
final Application application = ApplicationManager.getApplication();
if (application.isHeadlessEnvironment()) return;
final Runnable showErrorAction = new Runnable() {
public void run() {
new VcsBalloonProblemNotifier(project, message, type, showOverChangesView, notificationListener).run();
}
};
if (application.isDispatchThread()) {
showErrorAction.run();
}
else {
application.invokeLater(showErrorAction);
}
}
示例5: invokeListeners
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private void invokeListeners() {
Runnable invokeListenersTask = new Runnable() {
@Override
public void run() {
updateContents();
for (BuildVariantSelectionChangeListener listener : myBuildVariantSelectionChangeListeners) {
listener.buildVariantsConfigChanged();
}
}
};
Application application = ApplicationManager.getApplication();
if (application.isUnitTestMode()) {
invokeListenersTask.run();
}
else {
application.invokeLater(invokeListenersTask);
}
}
示例6: showBalloon
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public void showBalloon(@NotNull String title,
@NotNull String text,
@NotNull NotificationType type,
@NotNull NotificationGroup group,
@Nullable NotificationListener listener) {
final Notification notification = group.createNotification(title, text, type, listener);
Runnable notificationTask = new Runnable() {
@Override
public void run() {
if (!myProject.isDisposed() && myProject.isOpen()) {
Notification old = myNotification;
if (old != null) {
boolean similar = Objects.equal(notification.getContent(), old.getContent());
if (similar) {
old.expire();
}
}
myNotification = notification;
notification.notify(myProject);
}
}
};
Application application = ApplicationManager.getApplication();
if (application.isDispatchThread()) {
notificationTask.run();
}
else {
application.invokeLater(notificationTask);
}
}
示例7: executeOnEdt
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public static void executeOnEdt(boolean synchronous, @NotNull Runnable task) {
final Application app = ApplicationManager.getApplication();
if (app.isDispatchThread()) {
task.run();
return;
}
if (synchronous) {
app.invokeAndWait(task, ModalityState.defaultModalityState());
}
else {
app.invokeLater(task, ModalityState.defaultModalityState());
}
}
示例8: startProcessing
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private boolean startProcessing() {
LOG.assertTrue(Thread.holdsLock(myQueue));
if (isProcessing || !myStarted) {
return false;
}
isProcessing = true;
final T item = myQueue.removeFirst();
final Runnable runnable = new Runnable() {
@Override
public void run() {
if (myDeathCondition.value(null)) return;
runSafely(new Runnable() {
@Override
public void run() {
myProcessor.consume(item, myContinuationContext);
}
});
}
};
final Application application = ApplicationManager.getApplication();
if (myThreadToUse == ThreadToUse.AWT) {
final ModalityState state = myModalityState.remove(new MyOverrideEquals(item));
if (state != null) {
application.invokeLater(runnable, state);
}
else {
application.invokeLater(runnable);
}
}
else {
application.executeOnPooledThread(runnable);
}
return true;
}
示例9: runInDispatchedThread
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private static void runInDispatchedThread(@NotNull Runnable r, boolean blocking) {
Application application = ApplicationManager.getApplication();
if (application.isDispatchThread()) {
r.run();
}
else if (blocking) {
application.invokeAndWait(r, ModalityState.defaultModalityState());
}
else {
application.invokeLater(r);
}
}
示例10: invokeLaterIfNeeded
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private static void invokeLaterIfNeeded(Application application, DumbAwareRunnable runnable) {
if (application.isDispatchThread()) {
runnable.run();
}
else {
application.invokeLater(runnable, ModalityState.any());
}
}
示例11: run
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
public final void run(@NotNull ProgressIndicator indicator) {
execute(indicator);
if (myCallInAwtAfterExecution != null) {
Application application = ApplicationManager.getApplication();
if (application.isUnitTestMode()) {
myCallInAwtAfterExecution.run();
}
else {
application.invokeLater(myCallInAwtAfterExecution, application.getDefaultModalityState());
}
}
}
示例12: invokeOnEdt
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public static void invokeOnEdt(Runnable runnable, @Nullable Condition expired) {
Application application = ApplicationManager.getApplication();
if (application.isDispatchThread()) {
//noinspection unchecked
if (expired == null || !expired.value(null)) {
runnable.run();
}
}
else if (expired == null) {
application.invokeLater(runnable);
}
else {
application.invokeLater(runnable, expired);
}
}
示例13: invokeLaterIfNeededOnSyncPublisher
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public static <T> void invokeLaterIfNeededOnSyncPublisher(final Project project, final Topic<T> topic, final Consumer<T> listener) {
final Application application = ApplicationManager.getApplication();
final Runnable runnable = createPublisherRunnable(project, topic, listener);
if (application.isDispatchThread()) {
runnable.run();
} else {
application.invokeLater(runnable);
}
}
示例14: updatePanel
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public void updatePanel(@Nullable final String replacementContent, @Nullable final List<IpnbOutputCell> outputContent) {
final Application application = ApplicationManager.getApplication();
application.invokeLater(new Runnable() {
@Override
public void run() {
if (replacementContent != null) {
myCell.setSource(Arrays.asList(StringUtil.splitByLinesKeepSeparators(replacementContent)));
application.runWriteAction(new Runnable() {
@Override
public void run() {
myCodeSourcePanel.getEditor().getDocument().setText(replacementContent);
}
});
}
myCell.removeCellOutputs();
myViewPanel.removeAll();
final JPanel panel = new JPanel(new GridBagLayout());
panel.setBackground(IpnbEditorUtil.getBackground());
addPromptPanel(panel, myCell.getPromptNumber(), IpnbEditorUtil.PromptType.In, myCodeSourcePanel);
myViewPanel.add(panel);
isRunning = false;
if (outputContent != null) {
for (IpnbOutputCell output : outputContent) {
myCell.addCellOutput(output);
addOutputPanel(myViewPanel, output, true);
}
}
final IpnbFilePanel filePanel = myParent.getIpnbFilePanel();
filePanel.revalidate();
filePanel.repaint();
}
});
}
示例15: runNotUnderWriteAction
import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private static void runNotUnderWriteAction(@NotNull Project project, @NotNull Runnable runnable) {
Application application = ApplicationManager.getApplication();
if (application.isWriteAccessAllowed()) {
application.invokeLater(runnable, project.getDisposed());
}
else {
runnable.run();
}
}