List of usage examples for com.intellij.openapi.wm ToolWindowId DEBUG
String DEBUG
To view the source code for com.intellij.openapi.wm ToolWindowId DEBUG.
Click Source Link
From source file:com.headwire.aem.tooling.intellij.communication.ServerConnectionManager.java
License:Apache License
public void connectInDebugMode(RunManagerEx runManager) { ServerConfiguration serverConfiguration = selectionHandler.getCurrentConfiguration(); // Create Remote Connection to Server using the IntelliJ Run / Debug Connection //AS TODO: It is working but the configuration is listed and made persistent. That is not too bad because //AS TODO: after changes a reconnect will update the configuration. RemoteConfigurationType remoteConfigurationType = new RemoteConfigurationType(); RunConfiguration runConfiguration = remoteConfigurationType.getFactory() .createTemplateConfiguration(myProject); RemoteConfiguration remoteConfiguration = (RemoteConfiguration) runConfiguration; // Server means if you are listening. If not you are attaching. remoteConfiguration.SERVER_MODE = false; remoteConfiguration.USE_SOCKET_TRANSPORT = true; remoteConfiguration.HOST = serverConfiguration.getHost(); remoteConfiguration.PORT = serverConfiguration.getConnectionDebugPort() + ""; // Set a Name of the Configuration so that it is properly listed. remoteConfiguration.setName(serverConfiguration.getName()); RunnerAndConfigurationSettings configuration = new RunnerAndConfigurationSettingsImpl( (RunManagerImpl) runManager, runConfiguration, false); runManager.setTemporaryConfiguration(configuration); //AS TODO: Make sure that this is the proper way to obtain the DEBUG Executor Executor executor = ExecutorRegistry.getInstance().getExecutorById(ToolWindowId.DEBUG); ExecutionUtil.runConfiguration(configuration, executor); // Update the Modules with the Remote Sling Server OsgiClient osgiClient = obtainSGiClient(); if (osgiClient != null) { BundleStatus status = checkAndUpdateSupportBundle(false); if (status != BundleStatus.failed) { checkModules(osgiClient);/* w ww . ja va2s.c o m*/ } } }
From source file:com.intellij.debugger.engine.DebugProcessImpl.java
License:Apache License
private void createVirtualMachine(final String sessionName, final boolean pollConnection) { final Semaphore semaphore = new Semaphore(); semaphore.down();/*from w w w .ja va2 s.c om*/ final Ref<Boolean> connectorIsReady = Ref.create(false); myDebugProcessDispatcher.addListener(new DebugProcessAdapter() { @Override public void connectorIsReady() { connectorIsReady.set(true); semaphore.up(); myDebugProcessDispatcher.removeListener(this); } }); // reload to make sure that source positions are initialized DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager().reloadBreakpoints(); getManagerThread().schedule(new DebuggerCommandImpl() { @Override protected void action() { VirtualMachine vm = null; try { final long time = System.currentTimeMillis(); while (System.currentTimeMillis() - time < LOCAL_START_TIMEOUT) { try { vm = createVirtualMachineInt(); break; } catch (final ExecutionException e) { if (pollConnection && !myConnection.isServerMode() && e.getCause() instanceof IOException) { synchronized (this) { try { wait(500); } catch (InterruptedException ignored) { break; } } } else { fail(); if (myExecutionResult != null || !connectorIsReady.get()) { // propagate exception only in case we succeeded to obtain execution result, // otherwise if the error is induced by the fact that there is nothing to debug, and there is no need to show // this problem to the user SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ExecutionUtil.handleExecutionError(myProject, ToolWindowId.DEBUG, sessionName, e); } }); } break; } } } } finally { semaphore.up(); } if (vm != null) { final VirtualMachine vm1 = vm; afterProcessStarted(new Runnable() { @Override public void run() { getManagerThread().schedule(new DebuggerCommandImpl() { @Override protected void action() throws Exception { commitVM(vm1); } }); } }); } } @Override protected void commandCancelled() { try { super.commandCancelled(); } finally { semaphore.up(); } } }); semaphore.waitFor(); }
From source file:com.intellij.execution.actions.ChooseRunConfigurationPopupAction.java
License:Apache License
protected Executor getAlternativeExecutor() { return ExecutorRegistry.getInstance().getExecutorById(ToolWindowId.DEBUG); }
From source file:com.intellij.execution.executors.DefaultDebugExecutor.java
License:Apache License
@Override public String getToolWindowId() { return ToolWindowId.DEBUG; }
From source file:com.intellij.execution.junit.TestPackage.java
License:Apache License
@Override protected void notifyByBalloon(JUnitRunningModel model, boolean started, final JUnitConsoleProperties consoleProperties) { if (myFoundTests) { super.notifyByBalloon(model, started, consoleProperties); } else {/*from w ww .j av a 2s . co m*/ final String packageName = myConfiguration.getPackage(); if (packageName == null) return; final Project project = myConfiguration.getProject(); final PsiPackage aPackage = JavaPsiFacade.getInstance(project).findPackage(packageName); if (aPackage == null) return; final Module module = myConfiguration.getConfigurationModule().getModule(); if (module == null) return; final Set<Module> modulesWithPackage = new HashSet<Module>(); final PsiDirectory[] directories = aPackage.getDirectories(); for (PsiDirectory directory : directories) { final Module currentModule = ModuleUtil.findModuleForFile(directory.getVirtualFile(), project); if (module != currentModule && currentModule != null) { modulesWithPackage.add(currentModule); } } if (!modulesWithPackage.isEmpty()) { final String testRunDebugId = consoleProperties.isDebug() ? ToolWindowId.DEBUG : ToolWindowId.RUN; final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); final Function<Module, String> moduleNameRef = new Function<Module, String>() { @Override public String fun(Module module) { final String moduleName = module.getName(); return "<a href=\"" + moduleName + "\">" + moduleName + "</a>"; } }; String message = "Tests were not found in module \"" + module.getName() + "\".\n" + "Use "; if (modulesWithPackage.size() == 1) { message += "module \"" + moduleNameRef.fun(modulesWithPackage.iterator().next()) + "\" "; } else { message += "one of\n" + StringUtil.join(modulesWithPackage, moduleNameRef, "\n") + "\n"; } message += "instead"; toolWindowManager.notifyByBalloon(testRunDebugId, MessageType.WARNING, message, null, new ResetConfigurationModuleAdapter(project, consoleProperties, toolWindowManager, testRunDebugId)); } } }
From source file:com.intellij.execution.testframework.ResetConfigurationModuleAdapter.java
License:Apache License
public static <T extends ModuleBasedConfiguration<JavaRunConfigurationModule> & CommonJavaRunConfigurationParameters> boolean tryWithAnotherModule( T configuration, boolean isDebug) { final String packageName = configuration.getPackage(); if (packageName == null) return false; final Project project = configuration.getProject(); final PsiPackage aPackage = JavaPsiFacade.getInstance(project).findPackage(packageName); if (aPackage == null) return false; final Module module = configuration.getConfigurationModule().getModule(); if (module == null) return false; final Set<Module> modulesWithPackage = new HashSet<Module>(); final PsiDirectory[] directories = aPackage.getDirectories(); for (PsiDirectory directory : directories) { final Module currentModule = ModuleUtilCore.findModuleForFile(directory.getVirtualFile(), project); if (module != currentModule && currentModule != null) { modulesWithPackage.add(currentModule); }//from w w w. ja v a 2s.c om } if (!modulesWithPackage.isEmpty()) { final String testRunDebugId = isDebug ? ToolWindowId.DEBUG : ToolWindowId.RUN; final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); final Function<Module, String> moduleNameRef = module1 -> { final String moduleName = module1.getName(); return "<a href=\"" + moduleName + "\">" + moduleName + "</a>"; }; String message = "Tests were not found in module \"" + module.getName() + "\".\n" + "Use "; if (modulesWithPackage.size() == 1) { message += "module \"" + moduleNameRef.fun(modulesWithPackage.iterator().next()) + "\" "; } else { message += "one of\n" + StringUtil.join(modulesWithPackage, moduleNameRef, "\n") + "\n"; } message += "instead"; toolWindowManager.notifyByBalloon(testRunDebugId, MessageType.WARNING, message, null, new ResetConfigurationModuleAdapter(configuration, project, isDebug, toolWindowManager, testRunDebugId)); return true; } return false; }
From source file:com.intellij.execution.testframework.sm.runner.ui.SMTRunnerNotificationsHandler.java
License:Apache License
private void notify(final String msg, final MessageType type, final SMTestProxy.SMRootTestProxy testsRoot) { SwingUtilities.invokeLater(new Runnable() { public void run() { final Project project = myConsoleProperties.getProject(); if (project.isDisposed()) { return; }/*from w w w .j a va2s.co m*/ if (myConsoleProperties == null) { return; } final String testRunDebugId = myConsoleProperties.isDebug() ? ToolWindowId.DEBUG : ToolWindowId.RUN; final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); if (!Comparing.strEqual(toolWindowManager.getActiveToolWindowId(), testRunDebugId)) { toolWindowManager.notifyByBalloon(testRunDebugId, type, msg, null, null); } TestsUIUtil.NOTIFICATION_GROUP.createNotification(msg, type).notify(project); SystemNotifications.getInstance().notify("TestRunner", msg, TestsUIUtil.getTestShortSummary(testsRoot)); } }); }
From source file:com.intellij.execution.testframework.TestsUIUtil.java
License:Apache License
public static void notifyByBalloon(@NotNull final Project project, boolean started, final AbstractTestProxy root, final TestConsoleProperties properties, @Nullable final String comment) { if (project.isDisposed()) return;/*from w ww . j a va 2 s.c om*/ if (properties == null) return; final String testRunDebugId = properties.isDebug() ? ToolWindowId.DEBUG : ToolWindowId.RUN; final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); String title; String text; String balloonText; MessageType type; TestResultPresentation testResultPresentation = new TestResultPresentation(root, started, comment) .getPresentation(); type = testResultPresentation.getType(); balloonText = testResultPresentation.getBalloonText(); title = testResultPresentation.getTitle(); text = testResultPresentation.getText(); if (!Comparing.strEqual(toolWindowManager.getActiveToolWindowId(), testRunDebugId)) { toolWindowManager.notifyByBalloon(testRunDebugId, type, balloonText, null, null); } NOTIFICATION_GROUP.createNotification(balloonText, type).notify(project); SystemNotifications.getInstance().notify("TestRunner", title, text); }
From source file:com.intellij.ide.actions.SearchEverywhereAction.java
License:Apache License
private void doNavigate(final int index) { final Project project = CommonDataKeys.PROJECT .getData(DataManager.getInstance().getDataContext(getField().getTextEditor())); final Executor executor = ourShiftIsPressed.get() ? DefaultRunExecutor.getRunExecutorInstance() : ExecutorRegistry.getInstance().getExecutorById(ToolWindowId.DEBUG); assert project != null; final SearchListModel model = getModel(); if (isMoreItem(index)) { final String pattern = myPopupField.getText(); WidgetID wid = null;/* w w w .ja va 2 s. co m*/ if (index == model.moreIndex.classes) wid = WidgetID.CLASSES; else if (index == model.moreIndex.files) wid = WidgetID.FILES; else if (index == model.moreIndex.settings) wid = WidgetID.SETTINGS; else if (index == model.moreIndex.actions) wid = WidgetID.ACTIONS; else if (index == model.moreIndex.symbols) wid = WidgetID.SYMBOLS; else if (index == model.moreIndex.runConfigurations) wid = WidgetID.RUN_CONFIGURATIONS; if (wid != null) { final WidgetID widgetID = wid; myCurrentWorker.doWhenProcessed(new Runnable() { @Override public void run() { myCalcThread = new CalcThread(project, pattern, true); myPopupActualWidth = 0; myCurrentWorker = myCalcThread.insert(index, widgetID); } }); return; } } final String pattern = getField().getText(); final Object value = myList.getSelectedValue(); saveHistory(project, pattern, value); IdeFocusManager focusManager = IdeFocusManager.findInstanceByComponent(getField().getTextEditor()); if (myPopup != null && myPopup.isVisible()) { myPopup.cancel(); } if (value instanceof BooleanOptionDescription) { final BooleanOptionDescription option = (BooleanOptionDescription) value; option.setOptionState(!option.isOptionEnabled()); myList.revalidate(); myList.repaint(); getField().requestFocus(); return; } if (value instanceof OptionsTopHitProvider) { //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override public void run() { getField().setText("#" + ((OptionsTopHitProvider) value).getId() + " "); } }); return; } Runnable onDone = null; AccessToken token = ApplicationManager.getApplication().acquireReadActionLock(); try { if (value instanceof PsiElement) { onDone = new Runnable() { @Override public void run() { NavigationUtil.activateFileWithPsiElement((PsiElement) value, true); } }; return; } else if (isVirtualFile(value)) { onDone = new Runnable() { @Override public void run() { OpenSourceUtil.navigate(true, new OpenFileDescriptor(project, (VirtualFile) value)); } }; return; } else if (isActionValue(value) || isSetting(value) || isRunConfiguration(value)) { focusManager.requestDefaultFocus(true); final Component comp = myContextComponent; final AnActionEvent event = myActionEvent; IdeFocusManager.getInstance(project).doWhenFocusSettlesDown(new Runnable() { @Override public void run() { Component c = comp; if (c == null) { c = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); } if (isRunConfiguration(value)) { ((ChooseRunConfigurationPopup.ItemWrapper) value).perform(project, executor, DataManager.getInstance().getDataContext(c)); } else { GotoActionAction.openOptionOrPerformAction(value, pattern, project, c, event); if (isToolWindowAction(value)) return; } } }); return; } else if (value instanceof Navigatable) { onDone = new Runnable() { @Override public void run() { OpenSourceUtil.navigate(true, (Navigatable) value); } }; return; } } finally { token.finish(); final ActionCallback callback = onFocusLost(); if (onDone != null) { callback.doWhenDone(onDone); } } focusManager.requestDefaultFocus(true); }
From source file:com.intellij.ide.actions.SearchEverywhereAction.java
License:Apache License
public Executor getExecutor() { return ourShiftIsPressed.get() ? DefaultRunExecutor.getRunExecutorInstance() : ExecutorRegistry.getInstance().getExecutorById(ToolWindowId.DEBUG); }