private void setupUI() { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { cardLayoutDevices.createAndShowGUI(); } }); }
private void updateUi() { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { cardLayoutDevices.setDevices(androidWifiADB.getDevices()); cardLayoutDevices.updateUi(); } }); } }
public static void showNotification(final String message, final NotificationType type) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { Notification notification = NOTIFICATION_GROUP.createNotification(ANDROID_WIFI_ADB_TITLE, message, type, null); Notifications.Bus.notify(notification); } }); } }
private void close(@Nullable final KeyEvent e) { ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() { deactivate(true); final Project project = myEditor.getProject(); if (project != null && e != null && e.getKeyChar() != '\n') { final KeyStroke key = KeyStroke.getKeyStrokeForEvent(e); final List<KeyStroke> keys = new ArrayList<KeyStroke>(1); keys.add(key); VimPlugin.getMacro().playbackKeys(myEditor, new EditorDataContext(myEditor), project, keys, 0, 0, 1); } } }); }
public boolean execute(@NotNull Editor editor, @NotNull final DataContext context, @NotNull ExCommand cmd) throws ExException { // TODO: Check the command argument and jump to a specific symbol ApplicationManager.getApplication().invokeLater(() -> KeyHandler.executeAction("GotoSymbol", context)); return true; } }
public void editorCreated(@NotNull EditorFactoryEvent event) { final Editor editor = event.getEditor(); // This ridiculous code ensures that a lot of events are processed BEFORE we finally start listening // to visible area changes. The primary reason for this change is to fix the cursor position bug // using the gd and gD commands (Goto Declaration). This bug has been around since Idea 6.0.4? // Prior to this change the visible area code was moving the cursor around during file load and messing // with the cursor position of the Goto Declaration processing. ApplicationManager.getApplication().invokeLater( () -> ApplicationManager.getApplication().invokeLater( () -> ApplicationManager.getApplication().invokeLater( () -> { addEditorListener(editor); EditorData.setMotionGroup(editor, true); }) ) ); }
private void reparseFiles(@NotNull Project project) { ApplicationManager.getApplication().invokeLater(() -> { if (project.isDisposed()) { return; } FileContentUtil.reparseFiles(project, Collections.emptyList(), true); }); }
private void showNotification(@NotNull String message, NotificationType type) { ApplicationManager.getApplication().invokeLater(() -> { String title = getPresentableName(); Notifications.Bus.notify(GoConstants.GO_EXECUTION_NOTIFICATION_GROUP.createNotification(title, message, type, null), myProject); }); }
public boolean execute(@NotNull Editor editor, @NotNull final DataContext context, @NotNull ExCommand cmd) throws ExException { String arg = cmd.getArgument(); if (arg.length() > 0) { boolean res = VimPlugin.getFile().openFile(arg, context); if (res) { VimPlugin.getMark().saveJumpLocation(editor); } return res; } ApplicationManager.getApplication().invokeLater(() -> KeyHandler.executeAction("GotoFile", context)); return true; } }
public boolean execute(@NotNull Editor editor, @NotNull final DataContext context, @NotNull ExCommand cmd) throws ExException { String arg = cmd.getArgument(); if (arg.length() > 0) { boolean res = VimPlugin.getFile().openFile(arg + ".java", context); if (res) { VimPlugin.getMark().saveJumpLocation(editor); } return res; } ApplicationManager.getApplication().invokeLater(() -> KeyHandler.executeAction("GotoClass", context)); return true; } }
private void showNotification(@NotNull String message, NotificationType type) { ApplicationManager.getApplication().invokeLater(() -> { String title = getPresentableName(); Notifications.Bus.notify(BallerinaConstants.BALLERINA_EXECUTION_NOTIFICATION_GROUP .createNotification(title, message, type, null), myProject); }); }
private static void startTemplate(@NotNull Editor editor, @NotNull Template template, @NotNull Project project) { Runnable runnable = () -> { if (project.isDisposed() || editor.isDisposed()) return; CommandProcessor.getInstance().executeCommand(project, () -> TemplateManager.getInstance(project).startTemplate(editor, template, null), "Introduce function", null); }; if (ApplicationManager.getApplication().isUnitTestMode()) { runnable.run(); } else { ApplicationManager.getApplication().invokeLater(runnable); } }
public void postKey(@NotNull KeyStroke stroke, @NotNull Editor editor) { final Component component = SwingUtilities.getAncestorOfClass(Window.class, editor.getComponent()); final KeyEvent event = createKeyEvent(stroke, component); ApplicationManager.getApplication().invokeLater(() -> { if (logger.isDebugEnabled()) { logger.debug("posting " + event); } Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event); }); }
@Override public Result performLookupAction() { ApplicationManager.getApplication().invokeLater(() -> { GoAutoImportConfigurable configurable = new GoAutoImportConfigurable(myProject, true); ShowSettingsUtil.getInstance().editConfigurable(myProject, configurable, configurable::focusList); }); return Result.HIDE_LOOKUP; } }
private void scheduleUpdate(int delay) { myAlarm.cancelAllRequests(); UpdateRequest updateRequest = new UpdateRequest(); if (isTestingMode) { ApplicationManager.getApplication().invokeLater(updateRequest); } else { myAlarm.addRequest(updateRequest, delay); } }
private void scheduleUpdate(int delay) { myAlarm.cancelAllRequests(); UpdateRequest updateRequest = new UpdateRequest(); if (isTestingMode) { ApplicationManager.getApplication().invokeLater(updateRequest); } else { myAlarm.addRequest(updateRequest, delay); } }
@Override public void processTerminated(@NotNull ProcessEvent event) { super.processTerminated(event); boolean success = event.getExitCode() == 0 && myProcessOutput.getStderr().isEmpty(); boolean nothingToShow = myProcessOutput.getStdout().isEmpty() && myProcessOutput.getStderr().isEmpty(); boolean cancelledByUser = (event.getExitCode() == -1 || event.getExitCode() == 2) && nothingToShow; result.set(success); if (success) { if (myShowNotificationsOnSuccess) { showNotification("Finished successfully", NotificationType.INFORMATION); } } else if (cancelledByUser) { if (myShowNotificationsOnError) { showNotification("Interrupted", NotificationType.WARNING); } } else if (myShowOutputOnError) { ApplicationManager.getApplication().invokeLater(() -> showOutput(myProcessHandler, historyProcessListener)); } } };
@Override public void chooseAndSetSdk(@Nullable Module module) { Sdk projectSdk = ProjectSettingsService.getInstance(myProject).chooseAndSetSdk(); if (projectSdk == null && module != null) { ApplicationManager.getApplication().runWriteAction(() -> { if (!module.isDisposed()) { ModuleRootModificationUtil.setSdkInherited(module); } }); } // Need to prompt a restart action to clear and re initiate language server instance from the new SDK. // Todo - Figure out a way to apply language server changes without restarting. if (isBallerinaSdk(projectSdk)) { ApplicationManager.getApplication().invokeLater(this::showRestartDialog); } }
private void asyncUpdateSdkVersion(@NotNull String sdkPath) { ApplicationManager.getApplication().assertIsDispatchThread(); ((CardLayout)myVersionPanel.getLayout()).show(myVersionPanel, VERSION_GETTING); if (!myAlarm.isDisposed()) { myAlarm.cancelAllRequests(); myAlarm.addRequest(() -> { String version = GoSdkUtil.retrieveGoVersion(GoSdkUtil.adjustSdkPath(sdkPath)); ApplicationManager.getApplication().invokeLater(() -> { if (!Disposer.isDisposed(myDisposable)) { setVersion(version); } }, ModalityState.any()); }, 100); } }
private void asyncUpdateSdkVersion(@NotNull String sdkPath) { ApplicationManager.getApplication().assertIsDispatchThread(); ((CardLayout) myVersionPanel.getLayout()).show(myVersionPanel, VERSION_GETTING); if (!myAlarm.isDisposed()) { myAlarm.cancelAllRequests(); myAlarm.addRequest(() -> { String version = BallerinaSdkUtil.retrieveBallerinaVersion(BallerinaSdkUtil.adjustSdkPath(sdkPath)); ApplicationManager.getApplication().invokeLater(() -> { if (!Disposer.isDisposed(myDisposable)) { setVersion(version); } }, ModalityState.any()); }, 100); } }