当前位置: 首页>>代码示例>>Java>>正文


Java RunContentDescriptor.getComponent方法代码示例

本文整理汇总了Java中com.intellij.execution.ui.RunContentDescriptor.getComponent方法的典型用法代码示例。如果您正苦于以下问题:Java RunContentDescriptor.getComponent方法的具体用法?Java RunContentDescriptor.getComponent怎么用?Java RunContentDescriptor.getComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.execution.ui.RunContentDescriptor的用法示例。


在下文中一共展示了RunContentDescriptor.getComponent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的package包/类
@NotNull
public static XDebugSessionTab create(@NotNull XDebugSessionImpl session,
                                      @Nullable Icon icon,
                                      @Nullable ExecutionEnvironment environment,
                                      @Nullable RunContentDescriptor contentToReuse) {
  if (contentToReuse != null && SystemProperties.getBooleanProperty("xdebugger.reuse.session.tab", false)) {
    JComponent component = contentToReuse.getComponent();
    if (component != null) {
      XDebugSessionTab oldTab = TAB_KEY.getData(DataManager.getInstance().getDataContext(component));
      if (oldTab != null) {
        oldTab.setSession(session, environment, icon);
        oldTab.attachToSession(session);
        return oldTab;
      }
    }
  }
  return new XDebugSessionTab(session, icon, environment);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:XDebugSessionTab.java

示例2: getAction

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的package包/类
private static boolean getAction(@NotNull AnActionEvent e, boolean execute) {
  Project project = e.getProject();
  if (project == null) {
    return false;
  }

  RunContentDescriptor contentDescriptor = ExecutionManager.getInstance(project).getContentManager().getSelectedContent();
  if (contentDescriptor == null) {
    return false;
  }

  JComponent component = contentDescriptor.getComponent();
  if (component == null) {
    return false;
  }

  ExecutionEnvironment environment = LangDataKeys.EXECUTION_ENVIRONMENT.getData(DataManager.getInstance().getDataContext(component));
  if (environment == null) {
    return false;
  }

  AnAction[] actions = contentDescriptor.getRestartActions();
  if (actions.length == 0) {
    return false;
  }

  for (AnAction action : actions) {
    if (action instanceof AbstractRerunFailedTestsAction) {
      if (execute) {
        ((AbstractRerunFailedTestsAction)action).execute(e, environment);
      }
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:RerunFailedTestsAction.java

示例3: getEnvironment

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的package包/类
@Nullable
protected ExecutionEnvironment getEnvironment(@NotNull AnActionEvent event) {
  ExecutionEnvironment environment = event.getData(LangDataKeys.EXECUTION_ENVIRONMENT);
  if (environment == null) {
    Project project = event.getProject();
    RunContentDescriptor contentDescriptor = project == null ? null : ExecutionManager.getInstance(project).getContentManager().getSelectedContent();
    if (contentDescriptor != null) {
      JComponent component = contentDescriptor.getComponent();
      if (component != null) {
        environment = LangDataKeys.EXECUTION_ENVIRONMENT.getData(DataManager.getInstance().getDataContext(component));
      }
    }
  }
  return environment;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:FakeRerunAction.java

示例4: createConsole

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的package包/类
@Nullable
public static GroovyConsole createConsole(@NotNull final Project project,
                                          @NotNull final VirtualFile contentFile,
                                          @NotNull Module module) {
  final ProcessHandler processHandler = createProcessHandler(module);
  if (processHandler == null) return null;

  final GroovyConsoleStateService consoleStateService = GroovyConsoleStateService.getInstance(project);
  consoleStateService.setFileModule(contentFile, module);
  final String title = consoleStateService.getSelectedModuleTitle(contentFile);

  final ConsoleViewImpl consoleView = new ConsoleViewImpl(project, true);
  final RunContentDescriptor descriptor = new RunContentDescriptor(consoleView, processHandler, new JPanel(new BorderLayout()), title);
  final GroovyConsole console = new GroovyConsole(project, descriptor, consoleView, processHandler);

  // must call getComponent before createConsoleActions()
  final JComponent consoleViewComponent = consoleView.getComponent();

  final DefaultActionGroup actionGroup = new DefaultActionGroup();
  actionGroup.add(new BuildAndRestartConsoleAction(module, project, defaultExecutor, descriptor, restarter(project, contentFile)));
  actionGroup.addSeparator();
  actionGroup.addAll(consoleView.createConsoleActions());
  actionGroup.add(new CloseAction(defaultExecutor, descriptor, project) {
    @Override
    public void actionPerformed(AnActionEvent e) {
      processHandler.destroyProcess(); // use force
      super.actionPerformed(e);
    }
  });

  final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actionGroup, false);
  toolbar.setTargetComponent(consoleViewComponent);

  final JComponent ui = descriptor.getComponent();
  ui.add(consoleViewComponent, BorderLayout.CENTER);
  ui.add(toolbar.getComponent(), BorderLayout.WEST);

  project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
    @Override
    public void fileClosed(@NotNull FileEditorManager source, @NotNull VirtualFile file) {
      if (file.equals(contentFile)) {
        // if file was closed then kill process and hide console content
        console.stop();
      }
    }
  });
  processHandler.addProcessListener(new ProcessAdapter() {
    @Override
    public void processTerminated(ProcessEvent event) {
      if (contentFile.getUserData(GROOVY_CONSOLE) == console) {
        // process terminated either by closing file or by close action
        contentFile.putUserData(GROOVY_CONSOLE, null);
      }
    }
  });

  contentFile.putUserData(GROOVY_CONSOLE, console);
  consoleView.attachToProcess(processHandler);
  processHandler.startNotify();

  ExecutionManager.getInstance(project).getContentManager().showRunContent(defaultExecutor, descriptor);
  return console;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:64,代码来源:GroovyConsole.java


注:本文中的com.intellij.execution.ui.RunContentDescriptor.getComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。