當前位置: 首頁>>代碼示例>>Java>>正文


Java ToolWindowManager.getInstance方法代碼示例

本文整理匯總了Java中com.intellij.openapi.wm.ToolWindowManager.getInstance方法的典型用法代碼示例。如果您正苦於以下問題:Java ToolWindowManager.getInstance方法的具體用法?Java ToolWindowManager.getInstance怎麽用?Java ToolWindowManager.getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.wm.ToolWindowManager的用法示例。


在下文中一共展示了ToolWindowManager.getInstance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: TelemetryToolWindow

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
private TelemetryToolWindow(Project project) {
    ToolWindowManager manager = ToolWindowManager.getInstance(project);

    if (window == null) {
        textPane = new JTextPane();
        textPane.setEditable(false);

        JBScrollPane scrollPane = new JBScrollPane(textPane);
        DefaultCaret caret = (DefaultCaret) textPane.getCaret();
        caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);

        textPane.setContentType("text/html");
        initHtmlComposer();

        window = manager.registerToolWindow(WINDOW_ID, scrollPane, ToolWindowAnchor.BOTTOM);
        window.show(EMPTY_TASK);
    }
}
 
開發者ID:andreyfomenkov,項目名稱:green-cat,代碼行數:19,代碼來源:TelemetryToolWindow.java

示例2: actionPerformed

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent event)
{
    project = event.getProject();
    if (project == null)
    {
        return;
    }
    ToolWindowManager toolWindowMgr = ToolWindowManager.getInstance(project);
    ToolWindow tw = toolWindowMgr.getToolWindow(TOOL_WINDOW_ID);
    if (tw == null)
    {
        tw = toolWindowMgr.registerToolWindow(TOOL_WINDOW_ID, true, ToolWindowAnchor.BOTTOM, true);
    }
    final ToolWindow toolWindow = tw;
    toolWindow.activate(() -> updateContent(toolWindow, project.getName()), true);
}
 
開發者ID:miche-atucha,項目名稱:deps-checker,代碼行數:18,代碼來源:CheckVersionAction.java

示例3: notifyByBallon

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
@Override
public void notifyByBallon(String message, MessageType type)
{
    ToolWindowManager toolWindowMgr = ToolWindowManager.getInstance(project);
    toolWindowMgr.notifyByBalloon(TOOL_WINDOW_ID, type, message);
    if (MessageType.ERROR.equals(type))
    {
        LOG.error(message);
    }
    else if (MessageType.WARNING.equals(type))
    {
        LOG.warn(message);
    }
    else if (MessageType.INFO.equals(type))
    {
        LOG.info(message);
    }
}
 
開發者ID:miche-atucha,項目名稱:deps-checker,代碼行數:19,代碼來源:CheckVersionAction.java

示例4: update

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
@Override
public final void update(AnActionEvent e) {
  super.update(e);
  Presentation presentation = e.getPresentation();
  Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  ToolWindowManager mgr=ToolWindowManager.getInstance(project);
  String id=mgr.getActiveToolWindowId();

  if (id == null) {
    presentation.setEnabled(false);
    return;
  }

  ToolWindow window = mgr.getToolWindow(id);

  if (window == null) {
    presentation.setEnabled(false);
    return;
  }

  update(window, presentation);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:BaseToolWindowToggleAction.java

示例5: ensureToolWindowInitialized

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
public static void ensureToolWindowInitialized(@NotNull Project project, @NotNull ProjectSystemId externalSystemId) {
  try {
    ToolWindowManager manager = ToolWindowManager.getInstance(project);
    if (!(manager instanceof ToolWindowManagerEx)) {
      return;
    }
    ToolWindowManagerEx managerEx = (ToolWindowManagerEx)manager;
    String id = externalSystemId.getReadableName();
    ToolWindow window = manager.getToolWindow(id);
    if (window != null) {
      return;
    }
    ToolWindowEP[] beans = Extensions.getExtensions(ToolWindowEP.EP_NAME);
    for (final ToolWindowEP bean : beans) {
      if (id.equals(bean.id)) {
        managerEx.initToolWindow(bean);
      }
    }
  }
  catch (Exception e) {
    LOG.error(String.format("Unable to initialize %s tool window", externalSystemId.getReadableName()), e);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:ExternalSystemUtil.java

示例6: actionPerformed

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
public void actionPerformed(AnActionEvent e) {
  DataContext dataContext = e.getDataContext();
  Project project = CommonDataKeys.PROJECT.getData(dataContext);
  if (project == null) {
    return;
  }

  ToolWindowManager windowManager = ToolWindowManager.getInstance(project);

  if (windowManager.isEditorComponentActive()) {
    doNavigate(dataContext, project);
    return;
  }

  ContentManager contentManager = PlatformDataKeys.NONEMPTY_CONTENT_MANAGER.getData(dataContext);
  if (contentManager == null) return;
  doNavigate(contentManager);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:TabNavigationActionBase.java

示例7: update

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
public void update(AnActionEvent event){
  Presentation presentation = event.getPresentation();
  DataContext dataContext = event.getDataContext();
  Project project = CommonDataKeys.PROJECT.getData(dataContext);
  presentation.setEnabled(false);
  if (project == null) {
    return;
  }
  final ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
  if (windowManager.isEditorComponentActive()) {
    final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(project);
    EditorWindow currentWindow = EditorWindow.DATA_KEY.getData(dataContext);
    if (currentWindow == null){
      editorManager.getCurrentWindow ();
    }
    if (currentWindow != null) {
      final VirtualFile[] files = currentWindow.getFiles();
      presentation.setEnabled(files.length > 1);
    }
    return;
  }

  ContentManager contentManager = PlatformDataKeys.NONEMPTY_CONTENT_MANAGER.getData(dataContext);
  presentation.setEnabled(contentManager != null && contentManager.getContentCount() > 1 && contentManager.isSingleSelection());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:TabNavigationActionBase.java

示例8: getWindow

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
@Nullable
private ToolWindow getWindow(AnActionEvent event) {
  if (myWindow != null) return myWindow;

  Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
  if (project == null) return null;

  ToolWindowManager manager = ToolWindowManager.getInstance(project);

  final ToolWindow window = manager.getToolWindow(manager.getActiveToolWindowId());
  if (window == null) return null;

  final Component context = PlatformDataKeys.CONTEXT_COMPONENT.getData(event.getDataContext());
  if (context == null) return null;

  return SwingUtilities.isDescendingFrom(window.getComponent(), context) ? window : null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:ShowContentAction.java

示例9: createToolWindowContent

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
@Override
    public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
        instance = this;
        this.project = project;
        toolWindow.setToHideOnEmptyContent(true);
        createContents(project, toolWindow);
        ToolWindowManager manager = ToolWindowManager.getInstance(project);
        if (manager instanceof ToolWindowManagerEx) {
            ToolWindowManagerEx managerEx = ((ToolWindowManagerEx) manager);
            managerEx.addToolWindowManagerListener(new ToolWindowManagerListener() {
                @Override
                public void toolWindowRegistered(@NotNull String id) {
                }

                @Override
                public void stateChanged() {
                    ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(IMWindowFactory.TOOL_WINDOW_ID);
                    if (window != null) {
                        boolean visible = window.isVisible();
                        if (visible && toolWindow.getContentManager().getContentCount() == 0) {
                            createContents(project, window);
                        }
                    }
                }
            });
        }

//        Disposer.register(project, new Disposable() {
//            @Override
//            public void dispose() {
//                if (panel != null && panel.isEnabled()) {
//                    panel.setEnabled(false);
//                    panel = null;
//                }
//            }
//        });
    }
 
開發者ID:Jamling,項目名稱:SmartQQ4IntelliJ,代碼行數:38,代碼來源:IMWindowFactory.java

示例10: callProtractor

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
private void callProtractor() {
    try {
        Config config = Config.getInstance(project);

        if (config == null) {
            return;
        }

        GeneralCommandLine command = getProtractorRunCommand(config);
        Process p = command.createProcess();

        if (project != null) {
            ToolWindowManager manager = ToolWindowManager.getInstance(project);
            String id = "Gherkin Runner";
            TextConsoleBuilderFactory factory = TextConsoleBuilderFactory.getInstance();
            TextConsoleBuilder builder = factory.createBuilder(project);
            ConsoleView view = builder.getConsole();

            ColoredProcessHandler handler = new ColoredProcessHandler(p, command.getPreparedCommandLine());
            handler.startNotify();
            view.attachToProcess(handler);

            ToolWindow window = manager.getToolWindow(id);
            Icon cucumberIcon = IconLoader.findIcon("/resources/icons/cucumber.png");

            if (window == null) {
                window = manager.registerToolWindow(id, true, ToolWindowAnchor.BOTTOM);
                window.setIcon(cucumberIcon);
            }

            ContentFactory cf = window.getContentManager().getFactory();
            Content c = cf.createContent(view.getComponent(), "Run " + (window.getContentManager().getContentCount() + 1), true);

            window.getContentManager().addContent(c);
        }
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
}
 
開發者ID:KariiO,項目名稱:Gherkin-TS-Runner,代碼行數:40,代碼來源:GherkinIconRenderer.java

示例11: projectOpened

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
@Override
public void projectOpened() {
    ToolWindowManager twm = ToolWindowManager.getInstance(this.project);
    this.cipherForm = new CipherForm();
    ToolWindow cipherToolWindow = twm.registerToolWindow(getComponentName(), false, ToolWindowAnchor.BOTTOM);
    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    Content content = contentFactory.createContent(this.cipherForm, "", false);
    cipherToolWindow.getContentManager().addContent(content);
    // called when project is opened
}
 
開發者ID:jiurongzhao,項目名稱:Idea-Plugin-Cipher-tools,代碼行數:11,代碼來源:CipherTools.java

示例12: configure

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
@Override
public void configure(
    @NotNull HybrisProjectDescriptor hybrisProjectDescriptor,
    @NotNull final List<HybrisModuleDescriptor> allModules,
    @NotNull final Project project
) {
    this.hybrisProjectDescriptor = hybrisProjectDescriptor;
    parseModules(allModules);
    if (platformDescriptor == null) {
        return;
    }
    final File platformDir = platformDescriptor.getRootDirectory();
    createAntInstallation(platformDir);
    if (antInstallation == null) {
        return;
    }
    createAntClassPath(platformDir);
    AntConfigurationBase.getInstance(project).setFilterTargets(true);
    antConfiguration = AntConfigurationBase.getInstance(project);
    final AntBuildFileBase buildFile = registerAntInstallation(platformDir, platformDir, desirablePlatformTargets);
    customHybrisModuleDescriptorList.forEach(
        e -> registerAntInstallation(platformDir, e.getRootDirectory(), desirableCustomTargets)
    );
    saveAntInstallation(antInstallation);
    removeMake(project);
    createMetaTargets(buildFile);

    final ToolWindowManager manager = ToolWindowManager.getInstance(project);
    final ToolWindow window = manager.getToolWindow("Ant Build");
    window.show(null);
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:32,代碼來源:DefaultAntConfigurator.java

示例13: projectOpened

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
@Override
public void projectOpened() {
    Icon icon = IconLoader.getIcon(ICON_NYANDROID);
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow toolWindow = toolWindowManager.getToolWindow("Logcat");
    if (toolWindow != null) {
        toolWindow.setIcon(icon);
    }
}
 
開發者ID:evant,項目名稱:NyandroidRestorer,代碼行數:10,代碼來源:NyandroidProject.java

示例14: activateConsoleToolWindow

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
private static void activateConsoleToolWindow(@NotNull Project project) {
    final ToolWindowManager manager = ToolWindowManager.getInstance(project);


    ToolWindow toolWindow = manager.getToolWindow(toolWindowId);
    if (toolWindow != null) {
        return;
    }

    toolWindow = manager.registerToolWindow(toolWindowId, true, ToolWindowAnchor.BOTTOM);
    final ConsoleView console = new ConsoleViewImpl(project, false);
    project.putUserData(CONSOLE_VIEW_KEY, console);
    toolWindow.getContentManager().addContent(new ContentImpl(console.getComponent(), "", false));

    final ToolWindowManagerListener listener = new ToolWindowManagerListener() {
        @Override
        public void toolWindowRegistered(@NotNull String id) {
        }

        @Override
        public void stateChanged() {
            ToolWindow window = manager.getToolWindow(toolWindowId);
            if (window != null && !window.isVisible()) {
                manager.unregisterToolWindow(toolWindowId);
                ((ToolWindowManagerEx) manager).removeToolWindowManagerListener(this);
            }
        }
    };

    toolWindow.show(new Runnable() {
        @Override
        public void run() {
            ((ToolWindowManagerEx) manager).addToolWindowManagerListener(listener);
        }
    });
}
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:37,代碼來源:LuaSystemUtil.java

示例15: isSelected

import com.intellij.openapi.wm.ToolWindowManager; //導入方法依賴的package包/類
public boolean isSelected(AnActionEvent event){
  Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
  if (project == null) {
    return false;
  }
  ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
  String id=windowManager.getActiveToolWindowId();
  if(id==null){
    return false;
  }
  return ToolWindowType.DOCKED==windowManager.getToolWindow(id).getType();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:ToggleDockModeAction.java


注:本文中的com.intellij.openapi.wm.ToolWindowManager.getInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。