本文整理汇总了Java中com.intellij.execution.ui.RunContentDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java RunContentDescriptor类的具体用法?Java RunContentDescriptor怎么用?Java RunContentDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RunContentDescriptor类属于com.intellij.execution.ui包,在下文中一共展示了RunContentDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showHelperProcessRunContent
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
public static final ConsoleView showHelperProcessRunContent(String header, OSProcessHandler runHandler, Project project, Executor defaultExecutor) {
ProcessTerminatedListener.attach(runHandler);
ConsoleViewImpl consoleView = new ConsoleViewImpl(project, true);
DefaultActionGroup toolbarActions = new DefaultActionGroup();
JPanel panel = new JPanel((LayoutManager) new BorderLayout());
panel.add((Component) consoleView.getComponent(), "Center");
ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("unknown", (ActionGroup) toolbarActions, false);
toolbar.setTargetComponent(consoleView.getComponent());
panel.add((Component) toolbar.getComponent(), "West");
RunContentDescriptor runDescriptor = new RunContentDescriptor((ExecutionConsole) consoleView,
(ProcessHandler) runHandler, (JComponent) panel, header, AllIcons.RunConfigurations.Application);
AnAction[]
consoleActions = consoleView.createConsoleActions();
toolbarActions.addAll((AnAction[]) Arrays.copyOf(consoleActions, consoleActions.length));
toolbarActions.add((AnAction) new StopProcessAction("Stop process", "Stop process", (ProcessHandler) runHandler));
toolbarActions.add((AnAction) new CloseAction(defaultExecutor, runDescriptor, project));
consoleView.attachToProcess((ProcessHandler) runHandler);
// ExecutionManager.getInstance(environment.getProject()).getContentManager().showRunContent(environment.getExecutor(), runDescriptor);
showConsole(project, defaultExecutor, runDescriptor);
return (ConsoleView) consoleView;
}
示例2: showRerunNotification
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
public static void showRerunNotification(@Nullable RunContentDescriptor contentToReuse,
@NotNull final ExecutionConsole executionConsole) {
if (contentToReuse == null) {
return;
}
String lastActionId = ActionManagerEx.getInstanceEx().getPrevPreformedActionId();
boolean showNotification = !RerunTestsAction.ID.equals(lastActionId);
if (showNotification && !PropertiesComponent.getInstance().isTrueValue(KEY)) {
UiNotifyConnector.doWhenFirstShown(executionConsole.getComponent(), new Runnable() {
@Override
public void run() {
doShow(executionConsole);
}
});
}
}
示例3: initConsoleUi
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
protected ConsoleView initConsoleUi() {
ConsoleView consoleView = createConsoleView();
consoleView.print(myCommandLine.getCommandLineString() + '\n', ConsoleViewContentType.USER_INPUT);
consoleView.attachToProcess(myProcessHandler);
JPanel panel = new JPanel(new BorderLayout());
DefaultActionGroup toolbarActions = new DefaultActionGroup();
ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false);
panel.add(actionToolbar.getComponent(), BorderLayout.WEST);
panel.add(consoleView.getComponent(), BorderLayout.CENTER);
actionToolbar.setTargetComponent(panel);
toolbarActions.addAll(consoleView.createConsoleActions());
fillToolBarActions(toolbarActions);
panel.updateUI();
Executor defaultExecutor = DefaultRunExecutor.getRunExecutorInstance();
final RunContentDescriptor contentDescriptor = new RunContentDescriptor(consoleView, myProcessHandler, panel, myTitle);
showConsole(defaultExecutor, contentDescriptor);
myProcessHandler.addProcessListener(new ConsoleListener(myProject, defaultExecutor, myProcessHandler));
myProcessHandler.startNotify();
return consoleView;
}
示例4: addConsole
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
private static RunContentDescriptor addConsole(final Project project, final List<ThreadState> threadDump, String unscrambledTrace) {
Icon icon = null;
String message = IdeBundle.message("unscramble.unscrambled.stacktrace.tab");
if (!threadDump.isEmpty()) {
message = IdeBundle.message("unscramble.unscrambled.threaddump.tab");
icon = AllIcons.Debugger.ThreadStates.Threaddump;
}
else {
String name = getExceptionName(unscrambledTrace);
if (name != null) {
message = name;
icon = AllIcons.Debugger.ThreadStates.Exception;
}
}
if (ContainerUtil.find(threadDump, DEADLOCK_CONDITION) != null) {
message = IdeBundle.message("unscramble.unscrambled.deadlock.tab");
icon = AllIcons.Debugger.KillProcess;
}
return AnalyzeStacktraceUtil.addConsole(project, threadDump.size() > 1 ? new ThreadDumpConsoleFactory(project, threadDump) : null, message, unscrambledTrace, icon);
}
示例5: restartRunProfile
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
@Override
public void restartRunProfile(@NotNull Project project,
@NotNull Executor executor,
@NotNull ExecutionTarget target,
@Nullable RunnerAndConfigurationSettings configuration,
@Nullable ProcessHandler processHandler) {
ExecutionEnvironmentBuilder builder = createEnvironmentBuilder(project, executor, configuration);
if (processHandler != null) {
for (RunContentDescriptor descriptor : getContentManager().getAllDescriptors()) {
if (descriptor.getProcessHandler() == processHandler) {
builder.contentToReuse(descriptor);
break;
}
}
}
restartRunProfile(builder.target(target).build());
}
示例6: isAutoTestEnabledForDescriptor
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
private static boolean isAutoTestEnabledForDescriptor(@NotNull RunContentDescriptor descriptor) {
Content content = descriptor.getAttachedContent();
if (content != null) {
ExecutionEnvironment watched = EXECUTION_ENVIRONMENT_KEY.get(content);
if (watched != null) {
ExecutionEnvironment current = getCurrentEnvironment(content);
boolean result = current != null && equals(current, watched);
if (!result) {
// let GC do its work
EXECUTION_ENVIRONMENT_KEY.set(content, null);
}
return result;
}
}
return false;
}
示例7: getRunningProcesses
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
@NotNull
@Override
public ProcessHandler[] getRunningProcesses() {
if (myContentManager == null) return EMPTY_PROCESS_HANDLERS;
List<ProcessHandler> handlers = null;
for (RunContentDescriptor descriptor : getContentManager().getAllDescriptors()) {
ProcessHandler processHandler = descriptor.getProcessHandler();
if (processHandler != null) {
if (handlers == null) {
handlers = new SmartList<ProcessHandler>();
}
handlers.add(processHandler);
}
}
return handlers == null ? EMPTY_PROCESS_HANDLERS : handlers.toArray(new ProcessHandler[handlers.size()]);
}
示例8: init
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
public XDebugSessionTab init(@NotNull XDebugProcess process, @NotNull XDebugSessionData sessionData, @Nullable RunContentDescriptor contentToReuse) {
LOG.assertTrue(myDebugProcess == null);
myDebugProcess = process;
mySessionData = sessionData;
if (myDebugProcess.checkCanInitBreakpoints()) {
initBreakpoints();
}
myDebugProcess.getProcessHandler().addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(final ProcessEvent event) {
stopImpl();
myDebugProcess.getProcessHandler().removeProcessListener(this);
}
});
//todo[nik] make 'createConsole()' method return ConsoleView
myConsoleView = (ConsoleView)myDebugProcess.createConsole();
if (!myShowTabOnSuspend.get()) {
initSessionTab(contentToReuse);
}
return mySessionTab;
}
示例9: setSession
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
private void setSession(@NotNull XDebugSessionImpl session, @Nullable ExecutionEnvironment environment, @Nullable Icon icon) {
myEnvironment = environment;
mySession = session;
mySessionData = session.getSessionData();
myConsole = session.getConsoleView();
AnAction[] restartActions;
List<AnAction> restartActionsList = session.getRestartActions();
if (ContainerUtil.isEmpty(restartActionsList)) {
restartActions = AnAction.EMPTY_ARRAY;
}
else {
restartActions = restartActionsList.toArray(new AnAction[restartActionsList.size()]);
}
myRunContentDescriptor = new RunContentDescriptor(myConsole, session.getDebugProcess().getProcessHandler(),
myUi.getComponent(), session.getSessionName(), icon, myRebuildWatchesRunnable, restartActions);
Disposer.register(myRunContentDescriptor, this);
Disposer.register(myProject, myRunContentDescriptor);
}
示例10: startSessionAndShowTab
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
@NotNull
@Override
public XDebugSession startSessionAndShowTab(@NotNull String sessionName,
Icon icon,
@Nullable RunContentDescriptor contentToReuse,
boolean showToolWindowOnSuspendOnly,
@NotNull XDebugProcessStarter starter) throws ExecutionException {
XDebugSessionImpl session = startSession(contentToReuse, starter, new XDebugSessionImpl(null, this, sessionName,
icon, showToolWindowOnSuspendOnly));
if (!showToolWindowOnSuspendOnly) {
session.showSessionTab();
}
ProcessHandler handler = session.getDebugProcess().getProcessHandler();
handler.startNotify();
return session;
}
示例11: removeSession
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
public void removeSession(@NotNull final XDebugSessionImpl session) {
XDebugSessionTab sessionTab = session.getSessionTab();
mySessions.remove(session.getDebugProcess().getProcessHandler());
if (sessionTab != null) {
RunContentDescriptor descriptor = sessionTab.getRunContentDescriptor();
if (descriptor != null) {
// in test-mode RunContentWithExecutorListener.contentRemoved events are not sent (see RunContentManagerImpl.showRunContent)
// so we make sure the mySessions and mySessionData are cleared correctly when session is disposed
Disposer.register(descriptor, new Disposable() {
@Override
public void dispose() {
mySessions.remove(session.getDebugProcess().getProcessHandler());
}
});
}
if (!myProject.isDisposed() && !ApplicationManager.getApplication().isUnitTestMode() && XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().isHideDebuggerOnProcessTermination()) {
ExecutionManager.getInstance(myProject).getContentManager().hideRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), descriptor);
}
}
if (myActiveSession.compareAndSet(session, null)) {
onActiveSessionChanged();
}
}
示例12: testSuppressToolwindowActivation
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
public void testSuppressToolwindowActivation() throws Exception {
RunnerAndConfigurationSettings settings = new RunnerAndConfigurationSettingsImpl(
new MyRunManagerImpl(), new MyModuleBasedConfiguration("my-name", getProject(), getModule()), false
);
settings.setActivateToolWindowBeforeRun(true);
MockProgramRunner programRunner = new MockProgramRunner();
ExecutionEnvironment env = new ExecutionEnvironmentBuilder(getProject(), DefaultRunExecutor.getRunExecutorInstance())
.runnerAndSettings(programRunner, settings)
.build();
RunContentDescriptor descriptorToReuse = new RunContentDescriptor(null, null, new JPanel(), "name");
descriptorToReuse.setActivateToolWindowWhenAdded(false);
descriptorToReuse.setReuseToolWindowActivation(true);
env.setContentToReuse(descriptorToReuse);
env.getRunner().execute(env);
RunContentDescriptor lastDescriptor = programRunner.getLastDescriptor();
assertNotNull(lastDescriptor);
assertFalse(lastDescriptor.isActivateToolWindowWhenAdded());
Disposer.dispose(descriptorToReuse);
}
示例13: setConfigurationIcon
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
private static void setConfigurationIcon(final Presentation presentation,
final RunnerAndConfigurationSettings settings,
final Project project) {
try {
Icon icon = RunManagerEx.getInstanceEx(project).getConfigurationIcon(settings);
ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstance(project);
List<RunContentDescriptor> runningDescriptors = executionManager.getRunningDescriptors(new Condition<RunnerAndConfigurationSettings>() {
@Override
public boolean value(RunnerAndConfigurationSettings s) {
return s == settings;
}
});
if (runningDescriptors.size() == 1) {
icon = ExecutionUtil.getLiveIndicator(icon);
}
if (runningDescriptors.size() > 1) {
icon = IconUtil.addText(icon, String.valueOf(runningDescriptors.size()));
}
presentation.setIcon(icon);
}
catch (IndexNotReadyException ignored) {
}
}
示例14: stop
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
private static void stop(@Nullable RunContentDescriptor descriptor) {
ProcessHandler processHandler = descriptor != null ? descriptor.getProcessHandler() : null;
if (processHandler == null) {
return;
}
if (processHandler instanceof KillableProcess && processHandler.isProcessTerminating()) {
((KillableProcess)processHandler).killProcess();
return;
}
if (!processHandler.isProcessTerminated()) {
if (processHandler.detachIsDefault()) {
processHandler.detachProcess();
}
else {
processHandler.destroyProcess();
}
}
}
示例15: executeQuery
import com.intellij.execution.ui.RunContentDescriptor; //导入依赖的package包/类
private static void executeQuery(@NotNull Project project,
@NotNull VirtualFile file,
@NotNull Editor editor,
@NotNull IdeScriptEngine engine) {
String command = getCommand(editor);
String profile = getProfile(file);
RunContentDescriptor descriptor = getConsoleView(project, file);
ConsoleViewImpl consoleView = (ConsoleViewImpl)descriptor.getExecutionConsole();
prepareEngine(project, engine, descriptor);
try {
//myHistoryController.getModel().addToHistory(command);
consoleView.print("> " + command, ConsoleViewContentType.USER_INPUT);
consoleView.print("\n", ConsoleViewContentType.USER_INPUT);
Object o = engine.eval(profile == null ? command : profile + "\n" + command);
consoleView.print("=> " + o, ConsoleViewContentType.NORMAL_OUTPUT);
consoleView.print("\n", ConsoleViewContentType.NORMAL_OUTPUT);
}
catch (Throwable e) {
//noinspection ThrowableResultOfMethodCallIgnored
Throwable ex = ExceptionUtil.getRootCause(e);
consoleView.print(ex.getClass().getSimpleName() + ": " + ex.getMessage(), ConsoleViewContentType.ERROR_OUTPUT);
consoleView.print("\n", ConsoleViewContentType.ERROR_OUTPUT);
}
selectContent(descriptor);
}