Java Code Examples for com.intellij.ui.AppUIUtil#invokeOnEdt()

The following examples show how to use com.intellij.ui.AppUIUtil#invokeOnEdt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BrowserLauncherImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected void doShowError(@Nullable final String error, @Nullable final WebBrowser browser, @Nullable final Project project, final String title, @Nullable final Runnable launchTask) {
  AppUIUtil.invokeOnEdt(new Runnable() {
    @Override
    public void run() {
      if (Messages.showYesNoDialog(project, StringUtil.notNullize(error, "Unknown error"), title == null ? IdeBundle.message("browser" + ".error") : title, Messages.OK_BUTTON,
                                   IdeBundle.message("button.fix"), null) == Messages.NO) {
        final BrowserSettings browserSettings = new BrowserSettings();

        AsyncResult<Void> result = ShowSettingsUtil.getInstance().editConfigurable(project, browserSettings, browser == null ? null : (Runnable)() -> browserSettings.selectBrowser(browser));
        result.doWhenDone(() -> {
          if (launchTask != null) {
            launchTask.run();
          }
        });
      }
    }
  }, project == null ? null : project.getDisposed());
}
 
Example 2
Source File: XJumpToSourceActionBase.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected void perform(final XValueNodeImpl node, @Nonnull final String nodeName, final AnActionEvent e) {
  XValue value = node.getValueContainer();
  XNavigatable navigatable = new XNavigatable() {
    public void setSourcePosition(@Nullable final XSourcePosition sourcePosition) {
      if (sourcePosition != null) {
        AppUIUtil.invokeOnEdt(new Runnable() {
          public void run() {
            Project project = node.getTree().getProject();
            if (project.isDisposed()) return;

            sourcePosition.createNavigatable(project).navigate(true);
          }
        });
      }
    }
  };
  startComputingSourcePosition(value, navigatable);
}
 
Example 3
Source File: RoboVmFileEditorManagerListener.java    From robovm-idea with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void fileOpened(FileEditorManager source, final VirtualFile file) {
    if(!"storyboard".equals(file.getExtension())) {
        return;
    }
    RoboVmPlugin.logInfo(project, "File opened: " + file.getCanonicalPath());
    Module module = null;
    for(Module m: ModuleManager.getInstance(project).getModules()) {
        if(ModuleRootManager.getInstance(m).getFileIndex().isInContent(file)) {
            module = m;
            break;
        }
    }
    if(module != null) {
        AppUIUtil.invokeOnEdt(new Runnable() {
            @Override
            public void run() {
                FileEditorManager.getInstance(project).closeFile(file);
            }
        });

        final Module foundModule = module;
        ApplicationManager.getApplication().invokeLater(new Runnable() {
            @Override
            public void run() {
                // this might be the first time someone opened a storyboard, do
                // at least one compilation if the target folder doesn't exist!
                final VirtualFile outputPath = CompilerPaths.getModuleOutputDirectory(foundModule, false);
                CompileScope scope = CompilerManager.getInstance(project).createModuleCompileScope(foundModule, true);
                CompilerManager.getInstance(project).compile(scope, new CompileStatusNotification() {
                    @Override
                    public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
                        IBIntegratorManager.getInstance().moduleChanged(foundModule);
                        openXCodeProject(foundModule, file);
                    }
                });
            }
        });
    }
}
 
Example 4
Source File: XDebugSessionImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void printMessage(final String message, final String hyperLinkText, @Nullable final HyperlinkInfo info) {
  AppUIUtil.invokeOnEdt(() -> {
    myConsoleView.print(message, ConsoleViewContentType.SYSTEM_OUTPUT);
    if (info != null) {
      myConsoleView.printHyperlink(hyperLinkText, info);
    }
    else if (hyperLinkText != null) {
      myConsoleView.print(hyperLinkText, ConsoleViewContentType.SYSTEM_OUTPUT);
    }
    myConsoleView.print("\n", ConsoleViewContentType.SYSTEM_OUTPUT);
  });
}
 
Example 5
Source File: DebuggerUIUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void evaluated(@Nonnull final String fullValue, @Nullable final Font font) {
  AppUIUtil.invokeOnEdt(() -> {
    myTextArea.setText(fullValue);
    if (font != null) {
      myTextArea.setFont(font);
    }
  });
}
 
Example 6
Source File: DebuggerUIUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void errorOccurred(@Nonnull final String errorMessage) {
  AppUIUtil.invokeOnEdt(() -> {
    myTextArea.setForeground(XDebuggerUIConstants.ERROR_MESSAGE_ATTRIBUTES.getFgColor());
    myTextArea.setText(errorMessage);
  });
}
 
Example 7
Source File: ExecutionPointHighlighter.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void hide() {
  AppUIUtil.invokeOnEdt(() -> {
    updateRequested.set(false);

    removeHighlighter();
    clearDescriptor();
    myEditor = null;
    myGutterIconRenderer = null;
  });
}
 
Example 8
Source File: ExecutionPointHighlighter.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void updateGutterIcon(@Nullable final GutterIconRenderer renderer) {
  AppUIUtil.invokeOnEdt(() -> {
    if (myRangeHighlighter != null && myGutterIconRenderer != null) {
      myRangeHighlighter.setGutterIconRenderer(renderer);
    }
  });
}
 
Example 9
Source File: RunContentManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public RunContentManagerImpl(@Nonnull Project project, @Nonnull DockManager dockManager) {
  myProject = project;
  DockableGridContainerFactory containerFactory = new DockableGridContainerFactory();
  dockManager.register(DockableGridContainerFactory.TYPE, containerFactory);
  Disposer.register(myProject, containerFactory);

  AppUIUtil.invokeOnEdt(this::init, myProject.getDisposed());
}
 
Example 10
Source File: XFetchValueActionBase.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void evaluationComplete(final int index, @Nonnull final String value) {
  AppUIUtil.invokeOnEdt(() -> {
    values.set(index, value);
    finish();
  });
}
 
Example 11
Source File: ChangeListTodosPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void defaultListChanged(final ChangeList oldDefaultList, final ChangeList newDefaultList) {
  rebuildWithAlarm(myAlarm);
  AppUIUtil.invokeOnEdt(() -> setDisplayName(IdeBundle.message("changelist.todo.title", newDefaultList.getName())));
}
 
Example 12
Source File: ChangeListTodosPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void changeListRenamed(final ChangeList list, final String oldName) {
  AppUIUtil.invokeOnEdt(() -> setDisplayName(IdeBundle.message("changelist.todo.title", list.getName())));
}