本文整理汇总了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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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());
}
示例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;
}
示例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;
// }
// }
// });
}
示例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());
}
}
示例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
}
示例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);
}
}
示例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);
}
});
}
示例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();
}