Example usage for com.intellij.openapi.wm ToolWindowAnchor BOTTOM

List of usage examples for com.intellij.openapi.wm ToolWindowAnchor BOTTOM

Introduction

In this page you can find the example usage for com.intellij.openapi.wm ToolWindowAnchor BOTTOM.

Prototype

ToolWindowAnchor BOTTOM

To view the source code for com.intellij.openapi.wm ToolWindowAnchor BOTTOM.

Click Source Link

Usage

From source file:com.android.tools.idea.startup.AndroidStudioInitializer.java

License:Apache License

private static void setUpExperimentalFeatures() {
    if (System.getProperty(ProfilerState.ENABLE_EXPERIMENTAL_PROFILING) != null) {
        ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
            @Override// w  w w  . j av  a 2 s  . c  om
            public void projectOpened(final Project project) {
                StartupManager.getInstance(project).runWhenProjectIsInitialized(() -> {
                    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
                    ToolWindow toolWindow = toolWindowManager.registerToolWindow(
                            AndroidMonitorToolWindowFactory.ID, false, ToolWindowAnchor.BOTTOM, project, true);
                    toolWindow.setIcon(AndroidIcons.AndroidToolWindow);
                    new AndroidMonitorToolWindowFactory().createToolWindowContent(project, toolWindow);
                    toolWindow.show(null);
                });
            }
        });
    }
}

From source file:com.anecdote.ideaplugins.commitlog.CommitLogWindow.java

License:Apache License

private void initialize() {
    if (!_isInitialized) {
        _isInitialized = true;/*  ww  w . j a  v  a  2s.co m*/
        _isDisposed = false;
        ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(_project);
        ToolWindow toolWindow = toolWindowManager.registerToolWindow(COMMIT_LOGS_TOOLWINDOW_ID, true,
                ToolWindowAnchor.BOTTOM);
        toolWindow.setIcon(COMMIT_LOGS_SMALL_ICON);
        _contentManager = toolWindow.getContentManager();
        toolWindow.installWatcher(_contentManager);
        //      _contentManager = PeerFactory.getInstance().getContentFactory().createContentManager(true, _project);
        _contentManager.addContentManagerListener(new ContentManagerAdapter() {
            @Override
            public void contentRemoved(ContentManagerEvent event) {
                JComponent component = event.getContent().getComponent();
                JComponent removedComponent = (component instanceof CommitLogWindowComponent)
                        ? ((CommitLogWindowComponent) component).getComponent()
                        : component;
                //                    if (removedComponent == myErrorsView) {
                //                        myErrorsView.dispose();
                //                        myErrorsView = null;
                //                    } else
                for (Iterator iterator = _commitLogs.iterator(); iterator.hasNext();) {
                    Editor editor = (Editor) iterator.next();
                    if (removedComponent == editor.getComponent()) {
                        EditorFactory.getInstance().releaseEditor(editor);
                        iterator.remove();
                    }
                }
            }
        });
        //      final JComponent component = _contentManager.getComponent();
    }
}

From source file:com.atlassian.theplugin.idea.PluginToolWindow.java

License:Apache License

public void register(@NotNull ToolWindowManager toolWindowManager) {
    this.ideaToolWindow = toolWindowManager.registerToolWindow(TOOL_WINDOW_NAME, false,
            ToolWindowAnchor.BOTTOM);
}

From source file:com.bitbakery.arcwelder.repl.ReplToolWindow.java

License:Artistic License

private void initToolWindow() throws ExecutionException, IOException {
    // TODO _ Blech... fix me!
    Project[] projects = ProjectManager.getInstance().getOpenProjects();
    Project myProject = projects[0];//from w  w w. j  a v  a2  s  . c  o  m
    if (myProject != null) {
        tabbedPane = new JTabbedPane(JTabbedPane.BOTTOM);

        JPanel panel = new JPanel(new BorderLayout());
        panel.add(tabbedPane, BorderLayout.CENTER);

        /*
                    ActionManager am = ActionManager.getInstance();
                    ActionGroup group = (ActionGroup) am.getAction("ArcReplActionGroup");
                    ActionToolbar toolbar = am.createActionToolbar(str("repl.title"), group, false);
                    panel.add(toolbar.getComponent(), BorderLayout.WEST);
        */

        toolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(str("repl.title"), false,
                ToolWindowAnchor.BOTTOM);
        ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
        Content content = contentFactory.createContent(panel, null, true);
        toolWindow.getContentManager().addContent(content);
        toolWindow.setIcon(ArcIcons.REPL);
        // toolWindow.setToHideOnEmptyContent(true);

        /*
                    popup = am.createActionPopupMenu(str("repl.title"), group);
                    panel.setComponentPopupMenu(popup.getComponent());
                    toolWindow.getComponent().setComponentPopupMenu(popup.getComponent());
                    toolbar.getComponent().setComponentPopupMenu(popup.getComponent());
        */

        //createRepl();
    }
}

From source file:com.bitbakery.clojet.repl.ReplToolWindow.java

License:Artistic License

private void initToolWindow() throws ExecutionException, IOException {
    if (myProject != null) {
        tabbedPane = new JTabbedPane(JTabbedPane.BOTTOM);

        JPanel panel = new JPanel(new BorderLayout());
        panel.add(tabbedPane, BorderLayout.CENTER);

        ActionManager am = ActionManager.getInstance();
        ActionGroup group = (ActionGroup) am.getAction("ClojureReplActionGroup");
        ActionToolbar toolbar = am.createActionToolbar(message("repl.toolWindowName"), group, false);
        panel.add(toolbar.getComponent(), BorderLayout.WEST);

        toolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(message("repl.toolWindowName"),
                false, ToolWindowAnchor.BOTTOM);
        ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
        Content content = contentFactory.createContent(panel, null, true);
        toolWindow.getContentManager().addContent(content);
        toolWindow.setIcon(CloJetIcons.CLOJURE_REPL_ICON);
        // toolWindow.setToHideOnEmptyContent(true);

        popup = am.createActionPopupMenu(message("repl.toolWindowName"), group);
        panel.setComponentPopupMenu(popup.getComponent());
        toolWindow.getComponent().setComponentPopupMenu(popup.getComponent());
        toolbar.getComponent().setComponentPopupMenu(popup.getComponent());

        createRepl();//ww w .j  av  a  2s  .c o m
    }
}

From source file:com.bitbakery.plugin.arc.repl.ReplToolWindow.java

License:Artistic License

private void initToolWindow() throws ExecutionException, IOException {
    if (myProject != null) {
        tabbedPane = new JTabbedPane(JTabbedPane.BOTTOM);

        JPanel panel = new JPanel(new BorderLayout());
        panel.add(tabbedPane, BorderLayout.CENTER);

        ActionManager am = ActionManager.getInstance();
        ActionGroup group = (ActionGroup) am.getAction("ArcReplActionGroup");
        ActionToolbar toolbar = am.createActionToolbar(message("repl.title"), group, false);
        panel.add(toolbar.getComponent(), BorderLayout.WEST);

        toolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(message("repl.title"), false,
                ToolWindowAnchor.BOTTOM);
        ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
        Content content = contentFactory.createContent(panel, null, true);
        toolWindow.getContentManager().addContent(content);
        toolWindow.setIcon(ArcIcons.ARC_REPL_ICON);
        // toolWindow.setToHideOnEmptyContent(true);

        popup = am.createActionPopupMenu(message("repl.title"), group);
        panel.setComponentPopupMenu(popup.getComponent());
        toolWindow.getComponent().setComponentPopupMenu(popup.getComponent());
        toolbar.getComponent().setComponentPopupMenu(popup.getComponent());

        createRepl();//from  ww w  .j a  v a  2  s  .c  o m
    }
}

From source file:com.boxysystems.libraryfinder.view.intellij.IntelliJLibraryFinderView.java

License:Apache License

private void initToolWindow() {
    if (toolWindow == null) {
        ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(plugin.getProject());
        resultsPanel = new ResultsPanel(plugin);
        toolWindow = toolWindowManager.registerToolWindow(Constants.PLUGIN_ID, resultsPanel,
                ToolWindowAnchor.BOTTOM);
    }//from  ww w.  ja va2 s .  c o m
}

From source file:com.cleverCloud.cleverIdea.toolWindow.CcLogsToolWindow.java

License:Open Source License

public CcLogsToolWindow(@NotNull Project project) {
    ToolWindow toolWindow = ToolWindowManager.getInstance(project).registerToolWindow("Logs Clever Cloud",
            false, ToolWindowAnchor.BOTTOM);
    ContentManager contentManager = toolWindow.getContentManager();
    ProjectSettings projectSettings = ServiceManager.getService(project, ProjectSettings.class);
    ArrayList<Application> applications = projectSettings.applications;

    for (Application application : applications) {
        TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
        ConsoleView console = builder.getConsole();

        Content logs = contentManager.getFactory().createContent(console.getComponent(), application.name,
                false);//from  w ww .  j a  v a2 s.  c  o m
        contentManager.addContent(logs);

        writeLogs(project, application, console);
        String oldLogs = CcApi.getInstance(project).logRequest(application);

        if (oldLogs != null && !oldLogs.isEmpty()) {
            WebSocketCore.printSocket(console, oldLogs);
        } else if (oldLogs != null && oldLogs.isEmpty()) {
            WebSocketCore.printSocket(console, "No logs available.\n");
        }
    }
}

From source file:com.demonwav.mcdev.platform.mixin.actions.FindMixinsAction.java

License:Open Source License

@Override
public void actionPerformed(AnActionEvent e) {
    if (e.getProject() == null) {
        return;/* w ww  .j  a  v  a  2s  .  com*/
    }
    final Project project = e.getProject();

    final PsiFile file = e.getData(CommonDataKeys.PSI_FILE);
    if (file == null) {
        return;
    }

    final Caret caret = e.getData(CommonDataKeys.CARET);
    if (caret == null) {
        return;
    }

    final Editor editor = e.getData(CommonDataKeys.EDITOR);
    if (editor == null) {
        return;
    }

    final PsiElement element = file.findElementAt(caret.getOffset());
    final PsiClass classOfElement = McPsiUtil.getClassOfElement(element);

    if (classOfElement == null) {
        return;
    }

    // Get on the main thread
    ApplicationManager.getApplication().invokeLater(() -> {
        // Get off the main thread
        ProgressManager.getInstance().run(new Task.Backgroundable(project, "Searching for Mixins", true, null) {
            @Override
            public boolean shouldStartInBackground() {
                return false;
            }

            @Override
            public void run(@NotNull ProgressIndicator indicator) {
                final Set<PsiClass> classes = new HashSet<>();
                // Get permission
                try (final AccessToken ignored = ApplicationManager.getApplication().acquireReadActionLock()) {
                    indicator.setIndeterminate(true);

                    final AllClassesSearchExecutor executor = new AllClassesSearchExecutor();
                    executor.execute(new AllClassesSearch.SearchParameters(
                            GlobalSearchScope.projectScope(project), project), psiClass -> {
                                indicator.setText("Checking " + psiClass.getName() + "...");

                                final Map<PsiElement, PsiClass> allMixedClasses = MixinUtils
                                        .getAllMixedClasses(psiClass);

                                if (allMixedClasses.values().stream().anyMatch(c -> c.getQualifiedName() != null
                                        && c.getQualifiedName().equals(classOfElement.getQualifiedName()))) {
                                    classes.add(psiClass);
                                }
                                return true;
                            });
                }

                ApplicationManager.getApplication().invokeLater(() -> {
                    if (classes.size() == 1) {
                        McEditorUtil.gotoTargetElement(classes.iterator().next(), editor, file);
                    } else {
                        ToolWindowManager.getInstance(project).unregisterToolWindow(TOOL_WINDOW_ID);
                        final ToolWindow window = ToolWindowManager.getInstance(project)
                                .registerToolWindow(TOOL_WINDOW_ID, true, ToolWindowAnchor.BOTTOM);
                        window.setIcon(MixinAssets.MIXIN_CLASS_ICON);

                        // Sort the results so it appears nicer
                        final List<PsiClass> classesList = new ArrayList<>(classes);
                        Collections.sort(classesList, (c1, c2) -> {
                            final Pair<String, PsiClass> pair1 = McPsiUtil.getNameOfClass(c1);
                            final Pair<String, PsiClass> pair2 = McPsiUtil.getNameOfClass(c2);

                            if (pair1 == null && pair2 == null) {
                                return 0;
                            } else if (pair1 == null) {
                                return -1;
                            } else if (pair2 == null) {
                                return 1;
                            }

                            final String name1 = pair1.getSecond().getName() + pair1.getFirst();
                            final String name2 = pair2.getSecond().getName() + pair2.getFirst();

                            return name1.compareTo(name2);
                        });

                        final FindMixinsComponent component = new FindMixinsComponent(classesList);

                        final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
                        final Content content = contentFactory.createContent(component.getPanel(), null, false);
                        window.getContentManager().addContent(content);

                        window.activate(null);
                    }
                });
            }
        });
    });
}

From source file:com.eightbitmage.moonscript.util.MoonSystemUtil.java

License:Apache License

private static void activateConsoleToolWindow(@NotNull Project project) {
    final ToolWindowManager manager = ToolWindowManager.getInstance(project);

    ToolWindow toolWindow = manager.getToolWindow(toolWindowId);
    if (toolWindow != null) {
        return;//from www  .j  a v a  2s.c  om
    }

    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);
        }
    });
}