private void handleTemporaryBreakpointHit(final DebugProcessImpl debugProcess) { // need to delete the request immediately, see IDEA-133978 debugProcess.getRequestsManager().deleteRequest(this); debugProcess.addDebugProcessListener(new DebugProcessAdapter() { @Override public void resumed(SuspendContext suspendContext) { removeBreakpoint(); } @Override public void processDetached(DebugProcess process, boolean closedByUser) { removeBreakpoint(); } private void removeBreakpoint() { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager().removeBreakpoint(Breakpoint.this); } }); debugProcess.removeDebugProcessListener(this); } }); }
@Override protected void perform(final XValueNodeImpl node, @NotNull final String nodeName, final AnActionEvent e) { XValue value = node.getValueContainer(); final XDebuggerEvaluationDialog dialog = e.getData(XDebuggerEvaluationDialog.KEY); XNavigatable navigatable = new XNavigatable() { @Override public void setSourcePosition(@Nullable final XSourcePosition sourcePosition) { if (sourcePosition != null) { final Project project = node.getTree().getProject(); AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { sourcePosition.createNavigatable(project).navigate(true); if (dialog != null && Registry.is("debugger.close.dialog.on.navigate")) { dialog.close(DialogWrapper.CANCEL_EXIT_CODE); } } }, project.getDisposed()); } } }; startComputingSourcePosition(value, navigatable); }
public static void show(final XValueNodeImpl node, @NotNull final String nodeName) { final SetValueInplaceEditor editor = new SetValueInplaceEditor(node, nodeName); if (editor.myModifier != null) { editor.myModifier.calculateInitialValueEditorText(new XValueModifier.XInitialValueCallback() { @Override public void setValue(final String initialValue) { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { if (editor.getTree().isShowing()) { editor.show(initialValue); } } }); } }); } else { editor.show(null); } }
public void show(final @NotNull XSourcePosition position, final boolean notTopFrame, @Nullable final GutterIconRenderer gutterIconRenderer) { updateRequested.set(false); AppUIUtil.invokeLaterIfProjectAlive(myProject, new Runnable() { @Override public void run() { updateRequested.set(false); mySourcePosition = position; clearDescriptor(); myOpenFileDescriptor = XSourcePositionImpl.createOpenFileDescriptor(myProject, position); if (!XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().isScrollToCenter()) { myOpenFileDescriptor.setScrollType(notTopFrame ? ScrollType.CENTER : ScrollType.MAKE_VISIBLE); } //see IDEA-125645 and IDEA-63459 //myOpenFileDescriptor.setUseCurrentWindow(true); myGutterIconRenderer = gutterIconRenderer; myNotTopFrame = notTopFrame; doShow(true); } }); }
private void handleTemporaryBreakpointHit(final DebugProcessImpl debugProcess) { debugProcess.addDebugProcessListener(new DebugProcessAdapter() { @Override public void resumed(SuspendContext suspendContext) { removeBreakpoint(); } @Override public void processDetached(DebugProcess process, boolean closedByUser) { removeBreakpoint(); } private void removeBreakpoint() { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager().removeBreakpoint(Breakpoint.this); } }); debugProcess.removeDebugProcessListener(this); } }); }
public WelcomeFrame() { JRootPane rootPane = getRootPane(); final WelcomeScreen screen = createScreen(rootPane); final IdeGlassPaneImpl glassPane = new IdeGlassPaneImpl(rootPane); setGlassPane(glassPane); glassPane.setVisible(false); setContentPane(screen.getWelcomePanel()); setTitle(ApplicationNamesInfo.getInstance().getFullProductName()); AppUIUtil.updateWindowIcon(this); ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() { @Override public void projectOpened(Project project) { dispose(); } }); myBalloonLayout = new BalloonLayoutImpl(rootPane.getLayeredPane(), new Insets(8, 8, 8, 8)); myScreen = screen; setupCloseAction(); new MnemonicHelper().register(this); myScreen.setupFrame(this); }
public static void importConfigsTo(String newConfigPath) { ConfigImportSettings settings = getConfigImportSettings(); File oldConfigDir = findOldConfigDir(newConfigPath, settings.getCustomPathsSelector()); do { ImportOldConfigsPanel dialog = new ImportOldConfigsPanel(oldConfigDir, settings); dialog.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL); AppUIUtil.updateWindowIcon(dialog); dialog.setVisible(true); if (dialog.isImportEnabled()) { File instHome = dialog.getSelectedFile(); oldConfigDir = getOldConfigDir(instHome, settings); if (!validateOldConfigDir(instHome, oldConfigDir, settings)) continue; doImport(newConfigPath, oldConfigDir); settings.importFinished(newConfigPath); System.setProperty(CONFIG_IMPORTED_IN_CURRENT_SESSION_KEY, Boolean.TRUE.toString()); } break; } while (true); }
protected void perform(final XValueNodeImpl node, @NotNull final String nodeName, final AnActionEvent e) { XValue value = node.getValueContainer(); value.computeSourcePosition(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); } }); } } }); }
private static File prepare() throws IOException { File distributionDirectory = PathManager.getAppHomeDirectory(); String name = ApplicationNamesInfo.getInstance().getFullProductName(); final String iconPath = AppUIUtil.findIcon(distributionDirectory.getPath()); if (iconPath == null) { throw new RuntimeException(ApplicationBundle.message("desktop.entry.icon.missing", distributionDirectory.getPath())); } final File execPath = new File(distributionDirectory, "consulo.sh"); if (!execPath.exists()) { throw new RuntimeException(ApplicationBundle.message("desktop.entry.script.missing", distributionDirectory.getPath())); } final String wmClass = AppUIUtil.getFrameClass(); final String content = ExecUtil.loadTemplate(CreateDesktopEntryAction.class.getClassLoader(), "entry.desktop", ContainerUtil .newHashMap(Arrays.asList("$NAME$", "$SCRIPT$", "$ICON$", "$WM_CLASS$"), Arrays.asList(name, execPath.getPath(), iconPath, wmClass))); final String entryName = wmClass + ".desktop"; final File entryFile = new File(FileUtil.getTempDirectory(), entryName); FileUtil.writeToFile(entryFile, content); entryFile.deleteOnExit(); return entryFile; }
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); }
public void show(final @Nonnull XSourcePosition position, final boolean notTopFrame, @Nullable final GutterIconRenderer gutterIconRenderer) { updateRequested.set(false); AppUIUtil.invokeLaterIfProjectAlive(myProject, new Runnable() { @Override @RequiredDispatchThread public void run() { updateRequested.set(false); mySourcePosition = position; ExecutionPointHighlighter.this.clearDescriptor(); myOpenFileDescriptor = XSourcePositionImpl.createOpenFileDescriptor(myProject, position); if (!XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isScrollToCenter()) { myOpenFileDescriptor.setScrollType(notTopFrame ? ScrollType.CENTER : ScrollType.MAKE_VISIBLE); } //see IDEA-125645 and IDEA-63459 //myOpenFileDescriptor.setUseCurrentWindow(true); myGutterIconRenderer = gutterIconRenderer; myNotTopFrame = notTopFrame; ExecutionPointHighlighter.this.doShow(true); } }); }
private void handleTemporaryBreakpointHit(final DebugProcessImpl debugProcess) { // need to delete the request immediately, see IDEA-133978 debugProcess.getRequestsManager().deleteRequest(this); debugProcess.addDebugProcessListener(new DebugProcessListener() { @Override public void resumed(SuspendContext suspendContext) { removeBreakpoint(); } @Override public void processDetached(DebugProcess process, boolean closedByUser) { removeBreakpoint(); } private void removeBreakpoint() { AppUIUtil.invokeOnEdt(() -> DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager().removeBreakpoint(Breakpoint.this)); debugProcess.removeDebugProcessListener(this); } }); }
public WelcomeFrame() { JRootPane rootPane = getRootPane(); final WelcomeScreen screen = createScreen(rootPane); final IdeGlassPaneImpl glassPane = new IdeGlassPaneImpl(rootPane); setGlassPane(glassPane); glassPane.setVisible(false); setContentPane(screen.getWelcomePanel()); setTitle(ApplicationNamesInfo.getInstance().getFullProductName()); AppUIUtil.updateWindowIcon(this); ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() { @Override public void projectOpened(Project project) { dispose(); } }); myBalloonLayout = new BalloonLayoutImpl(rootPane, new Insets(8, 8, 8, 8)); myScreen = screen; setupCloseAction(this); MnemonicHelper.init(this); myScreen.setupFrame(this); Disposer.register(ApplicationManager.getApplication(), new Disposable() { @Override public void dispose() { WelcomeFrame.this.dispose(); } }); }
private void switchEditor() { LOG.debug("Switching editor..."); AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { TextEditor textEditor = (TextEditor)TextEditorProvider.getInstance().createEditor(myProject, myVirtualFile); textEditor.addPropertyChangeListener(myPropertyChangeListener); myEditorPanel.removeAll(); myEditorPanel.add(textEditor.getComponent(), BorderLayout.CENTER); myFileEditor = textEditor; showCard(EDITOR_CARD); LOG.debug("Editor for downloaded file opened."); } }, myProject.getDisposed()); }
public static void notifyUnknownMacros(@NotNull final IComponentStore store, @NotNull final Project project, @NotNull final String componentName) { final TrackingPathMacroSubstitutor substitutor = store.getStateStorageManager().getMacroSubstitutor(); if (substitutor == null) { return; } Set<String> immutableMacros = substitutor.getUnknownMacros(componentName); if (immutableMacros.isEmpty()) { return; } final Set<String> macros = new LinkedHashSet<String>(immutableMacros); AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { List<String> notified = null; NotificationsManager manager = NotificationsManager.getNotificationsManager(); for (UnknownMacroNotification notification : manager.getNotificationsOfType(UnknownMacroNotification.class, project)) { if (notified == null) { notified = new SmartList<String>(); } notified.addAll(notification.getMacros()); } if (!ContainerUtil.isEmpty(notified)) { macros.removeAll(notified); } if (macros.isEmpty()) { return; } LOG.debug("Reporting unknown path macros " + macros + " in component " + componentName); doNotify(macros, project, Collections.singletonMap(substitutor, store)); } }, project.getDisposed()); }
static void prepareAndStart(String[] args, AppStarter appStarter) { boolean newConfigFolder = false; if (!Main.isHeadless()) { AppUIUtil.updateFrameClass(); newConfigFolder = !new File(PathManager.getConfigPath()).exists(); } if (!checkJdkVersion()) { System.exit(Main.JDK_CHECK_FAILED); } // note: uses config folder! if (!checkSystemFolders()) { System.exit(Main.DIR_CHECK_FAILED); } if (!lockSystemFolders(args)) { System.exit(Main.INSTANCE_CHECK_FAILED); } if (newConfigFolder) { ConfigImportHelper.importConfigsTo(PathManager.getConfigPath()); } Logger.setFactory(LoggerFactory.class); Logger log = Logger.getInstance(Main.class); startLogging(log); loadSystemLibraries(log); fixProcessEnvironment(log); if (!Main.isHeadless()) { AppUIUtil.updateWindowIcon(JOptionPane.getRootFrame()); AppUIUtil.registerBundledFonts(); } appStarter.start(newConfigFolder); }
private void printMessage(final String message, final String hyperLinkText, @Nullable final HyperlinkInfo info) { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { 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); } }); }
public void evaluationComplete(final int index, @NotNull final String value) { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { values.set(index, value); finish(); } }); }
public void rebuildViews() { AppUIUtil.invokeLaterIfProjectAlive(myProject, new Runnable() { @Override public void run() { for (XDebugView view : myViews) { view.processSessionEvent(XDebugView.SessionEvent.SETTINGS_CHANGED); } } }); }
@Override public void evaluated(@NotNull final String fullValue, @Nullable final Font font) { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { myTextArea.setText(fullValue); if (font != null) { myTextArea.setFont(font); } } }); }
@Override public void errorOccurred(@NotNull final String errorMessage) { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { myTextArea.setForeground(XDebuggerUIConstants.ERROR_MESSAGE_ATTRIBUTES.getFgColor()); myTextArea.setText(errorMessage); } }); }
public void hide() { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { updateRequested.set(false); removeHighlighter(); clearDescriptor(); myEditor = null; myGutterIconRenderer = null; } }); }
public void updateGutterIcon(@Nullable final GutterIconRenderer renderer) { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { if (myRangeHighlighter != null && myGutterIconRenderer != null) { myRangeHighlighter.setGutterIconRenderer(renderer); } } }); }
public void rebuildView() { AppUIUtil.invokeLaterIfProjectAlive(getTree().getProject(), new Runnable() { @Override public void run() { saveCurrentTreeState(myStackFrame); buildTreeAndRestoreState(myStackFrame); } }); }
private void cancel() { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { cancelEditing(); } }); }
private void onSessionEvent(final @NotNull XDebugView.SessionEvent event) { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { myDebugView.processSessionEvent(event); } }); }
public RunContentManagerImpl(@NotNull Project project, @NotNull DockManager dockManager) { myProject = project; DockableGridContainerFactory containerFactory = new DockableGridContainerFactory(); dockManager.register(DockableGridContainerFactory.TYPE, containerFactory); Disposer.register(myProject, containerFactory); AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { init(); } }, myProject.getDisposed()); }
@Override public void defaultListChanged(final ChangeList oldDefaultList, final ChangeList newDefaultList) { rebuildWithAlarm(myAlarm); AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { setDisplayName(IdeBundle.message("changelist.todo.title", newDefaultList.getName())); } }); }
@Override public void changeListRenamed(final ChangeList list, final String oldName) { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { setDisplayName(IdeBundle.message("changelist.todo.title", list.getName())); } }); }
@Override protected void showError(@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(); if (ShowSettingsUtil.getInstance().editConfigurable(project, browserSettings, browser == null ? null : new Runnable() { @Override public void run() { browserSettings.selectBrowser(browser); } })) { if (launchTask != null) { launchTask.run(); } } } } }, project == null ? null : project.getDisposed()); }
public void showBalloon(@NotNull final String title, @NotNull final String message, @NotNull final NotificationType type, @Nullable final NotificationListener listener) { AppUIUtil.invokeLaterIfProjectAlive(myProject, new Runnable() { @Override public void run() { NOTIFICATION_GROUP.createNotification(title, message, type, listener).notify(myProject); } }); }
public void showBalloon(@NotNull final String title, @NotNull final String message, @NotNull final NotificationGroup group, @NotNull final NotificationType type, @Nullable final NotificationListener listener) { AppUIUtil.invokeLaterIfProjectAlive(myProject, new Runnable() { @Override public void run() { group.createNotification(title, message, type, listener).notify(myProject); } }); }
@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); } }); } }); } }
static void prepareAndStart(String[] args, AppStarter appStarter) { boolean newConfigFolder = false; if (!Main.isHeadless()) { AppUIUtil.updateFrameClass(); newConfigFolder = PathManager.ensureConfigFolderExists(true); if (newConfigFolder) { ConfigImportHelper.importConfigsTo(PathManager.getConfigPath()); } } boolean canStart = checkJdkVersion() && checkSystemFolders() && lockSystemFolders(args); // note: uses config folder! if (!canStart) { System.exit(Main.STARTUP_IMPOSSIBLE); } Logger.setFactory(LoggerFactory.getInstance()); Logger log = Logger.getInstance(Main.class); startLogging(log); fixProcessEnvironment(log); loadSystemLibraries(log); if (!Main.isHeadless()) { AppUIUtil.updateWindowIcon(JOptionPane.getRootFrame()); AppUIUtil.registerBundledFonts(); } appStarter.start(newConfigFolder); }
private void setPresentation(@NonNls final String name, @Nullable final Icon icon, @NonNls @Nullable final String type, @NonNls @NotNull final String separator, @NonNls @Nullable final String value, @Nullable final XValuePresenter valuePresenter, final boolean hasChildren, final boolean expand) { AppUIUtil.invokeOnEdt(new Runnable() { public void run() { setIcon(icon); if (name != null) { myName = name; } myValue = value; mySeparator = separator; myType = type; myValuePresenter = valuePresenter != null ? valuePresenter : DEFAULT_VALUE_PRESENTER; updateText(); setLeaf(!hasChildren); fireNodeChanged(); myTree.nodeLoaded(XValueNodeImpl.this, myName, value); if (expand) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { if (!isObsolete()) { myTree.expandPath(getPath()); } } }); } } }); }
public void setFullValueEvaluator(@NotNull final XFullValueEvaluator fullValueEvaluator) { AppUIUtil.invokeOnEdt(new Runnable() { public void run() { myFullValueEvaluator = fullValueEvaluator; fireNodeChanged(); } }); }
public void doOKAction() { if (myModifier == null) return; myExpressionEditor.saveTextInHistory(); final XDebuggerTreeState treeState = XDebuggerTreeState.saveState(myTree); myValueNode.setValueModificationStarted(); myModifier.setValue(myExpressionEditor.getText(), new XValueModifier.XModificationCallback() { public void valueModified() { AppUIUtil.invokeOnEdt(new Runnable() { public void run() { myTree.rebuildAndRestore(treeState); } }); } public void errorOccurred(@NotNull final String errorMessage) { AppUIUtil.invokeOnEdt(new Runnable() { public void run() { myTree.rebuildAndRestore(treeState); Editor editor = myExpressionEditor.getEditor(); if (editor != null) { HintManager.getInstance().showErrorHint(editor, errorMessage); } else { Messages.showErrorDialog(myTree, errorMessage); } } }); } }); super.doOKAction(); }
@Override public void evaluated(@NotNull final String fullValue, @Nullable final Font font) { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { myTextArea.setText(fullValue); if (font != null) { myTextArea.setFont(font); } myTextArea.setCaretPosition(0); } }); }