@Override public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) { ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); Set<SelectedExchangeCurrencyPair> selectedExchangeCurrencyPairs = IdeaCurrencyConfig.getInstance().getSelectedExchangeCurrencyPairs(); if (IdeaCurrencyConfig.getInstance().getActive()) { List<TickerDto> data = IdeaCurrencyApp.getInstance().getTickers(selectedExchangeCurrencyPairs); fillData(data); } Content content = contentFactory.createContent(contentPane, "", false); toolWindow.getContentManager().addContent(content); MessageBus messageBus = project.getMessageBus(); messageBusConnection = messageBus.connect(); messageBusConnection.subscribe(ConfigChangeNotifier.CONFIG_TOPIC, active -> { if (active) { scheduleNextTask(); } }); }
/** * Create a terminal panel * * @param terminalRunner * @param toolWindow * @return */ private Content createTerminalInContentPanel(@NotNull AbstractTerminalRunner terminalRunner, @NotNull final ToolWindow toolWindow) { SimpleToolWindowPanel panel = new SimpleToolWindowPanel(true); Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false); content.setCloseable(true); myTerminalWidget = terminalRunner.createTerminalWidget(content); panel.setContent(myTerminalWidget.getComponent()); panel.addFocusListener(this); createToolbar(terminalRunner, myTerminalWidget, toolWindow, panel);// west toolbar ActionToolbar toolbar = createTopToolbar(terminalRunner, myTerminalWidget, toolWindow); toolbar.setTargetComponent(panel); panel.setToolbar(toolbar.getComponent(), false); content.setPreferredFocusableComponent(myTerminalWidget.getComponent()); return content; }
@Override public void createToolWindowContent(@NotNull final Project project, @NotNull ToolWindow toolWindow) { SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true); BsConsole console = new BsConsole(project); panel.setContent(console.getComponent()); ActionToolbar toolbar = console.createToolbar(); panel.setToolbar(toolbar.getComponent()); Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", true); toolWindow.getContentManager().addContent(content); // Start compiler BsCompiler bsc = BucklescriptProjectComponent.getInstance(project).getCompiler(); if (bsc != null) { bsc.addListener(new BsOutputListener(project)); ProcessHandler handler = bsc.getHandler(); if (handler == null) { console.print("Bsb not found, check the event logs.", ERROR_OUTPUT); } else { console.attachToProcess(handler); } bsc.startNotify(); } }
private void createChat(MMUserStatus user) throws IOException, URISyntaxException { Channel.ChannelData channel = client.createChat(user.userId()); if (channel == null) { Notifications.Bus.notify(new Notification("mattermost", "channel error", "no channel found for " + user.username(), NotificationType.ERROR)); return; } SwingUtilities.invokeLater(() -> { String name = user.username(); Chat chat = this.channelIdChatMap.computeIfAbsent(channel.getId(), k -> new Chat()); chat.channelId = channel.getId(); if (this.toolWindow.getContentManager().getContent(chat) == null) { Content messages = ContentFactory.SERVICE.getInstance().createContent(chat, name, false); messages.setIcon(TEAM); this.toolWindow.getContentManager().addContent(messages); this.toolWindow.getContentManager().setSelectedContent(messages); } else { Content c = this.toolWindow.getContentManager().getContent(chat); this.toolWindow.getContentManager().setSelectedContent(c); } SwingUtilities.invokeLater(chat.inputArea::grabFocus); }); }
@Override public void initFacet() { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { ToolWindowManager manager = ToolWindowManager.getInstance(MuleFacet.this.getModule().getProject()); List<String> ids = Arrays.asList(manager.getToolWindowIds()); if (manager.getToolWindow("Global Configs") == null && !ids.contains("Global Configs")) { try { ToolWindow toolWindow = manager.registerToolWindow("Global Configs", true, ToolWindowAnchor.LEFT, false); toolWindow.setIcon(MuleIcons.MuleIcon); GlobalConfigsToolWindowPanel toolWindowPanel = new GlobalConfigsToolWindowPanel(MuleFacet.this.getModule().getProject()); ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); Content content = contentFactory.createContent(toolWindowPanel, "", true); toolWindow.getContentManager().addContent(content); } catch (Exception e) { logger.error("Unable to initialize toolWindow: ", e); } } } }); }
public void createWindow(Project project) { jFXPanel = new JFXPanel(); ToolWindow toolWindow = ToolWindowManager.getInstance(project).registerToolWindow("Basis.js", false, ToolWindowAnchor.BOTTOM, false); toolWindow.setIcon(IconLoader.getIcon("/icons/basisjs.png")); ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); Content content = contentFactory.createContent(jFXPanel, "inspector", false); toolWindow.getContentManager().addContent(content); InspectorController sceneInspectorController = new InspectorController(); FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(getClass().getResource("/com/basisjs/ui/windows/tools/inspector/InspectorScene.fxml")); fxmlLoader.setController(sceneInspectorController); Platform.setImplicitExit(false); PlatformImpl.runLater(() -> { try { Scene scene = new Scene(fxmlLoader.load()); jFXPanel.setScene(scene); webView = sceneInspectorController.webView; webView.setContextMenuEnabled(false); } catch (IOException e) { e.printStackTrace(); } }); }
public SearchToolWindowGUI buildGUI(@NotNull ToolWindow toolWindow, Project project) { SearchToolWindowGUI windowGUI = null; JPanel jPanel; if(isJavaFXAvailable()) { windowGUI = new SearchToolWindowGUI.SearchToolWindowGUIBuilder() .setContent(content) .setProject(project) .setSearchModel(project.getComponent(UserTagStatComponent.class).getSearchModel()).build(); jPanel = windowGUI.getContentPanel(); } else { jPanel = getNoJavaFXFoundPanel(); } ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); Content windowContent = contentFactory.createContent(jPanel, "", false); toolWindow.getContentManager().addContent(windowContent); return windowGUI; }
public void analyze() { final CyclicDependenciesBuilder builder = new CyclicDependenciesBuilder(myProject, myScope); final Runnable process = new Runnable() { public void run() { builder.analyze(); } }; final Runnable successRunnable = new Runnable() { public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { CyclicDependenciesPanel panel = new CyclicDependenciesPanel(myProject, builder); Content content = ContentFactory.SERVICE.getInstance().createContent(panel, AnalysisScopeBundle.message( "action.analyzing.cyclic.dependencies.in.scope", builder.getScope().getDisplayName()), false); content.setDisposer(panel); panel.setContent(content); DependenciesToolWindow.getInstance(myProject).addContent(content); } }); } }; ProgressManager.getInstance() .runProcessWithProgressAsynchronously(myProject, AnalysisScopeBundle.message("package.dependencies.progress.title"), process, successRunnable, null, new PerformAnalysisInBackgroundOption(myProject)); }
private void createConsole(@NotNull final NetService netService) { TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(netService.getProject()); netService.configureConsole(consoleBuilder); console = consoleBuilder.getConsole(); ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { ActionGroup actionGroup = netService.getConsoleToolWindowActions(); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actionGroup, false); SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true); toolWindowPanel.setContent(console.getComponent()); toolWindowPanel.setToolbar(toolbar.getComponent()); ToolWindow toolWindow = ToolWindowManager.getInstance(netService.getProject()) .registerToolWindow(netService.getConsoleToolWindowId(), false, ToolWindowAnchor.BOTTOM, netService.getProject(), true); toolWindow.setIcon(netService.getConsoleToolWindowIcon()); Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel, "", false); Disposer.register(content, console); toolWindow.getContentManager().addContent(content); } }, netService.getProject().getDisposed()); }
public void openMessagesView(final VcsErrorViewPanel errorTreeView, final String tabDisplayName) { CommandProcessor commandProcessor = CommandProcessor.getInstance(); commandProcessor.executeCommand(myProject, new Runnable() { public void run() { final MessageView messageView = MessageView.SERVICE.getInstance(myProject); messageView.runWhenInitialized(new Runnable() { public void run() { final Content content = ContentFactory.SERVICE.getInstance().createContent(errorTreeView, tabDisplayName, true); messageView.getContentManager().addContent(content); Disposer.register(content, errorTreeView); messageView.getContentManager().setSelectedContent(content); removeContents(content, tabDisplayName); ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null); } }); } }, VcsBundle.message("command.name.open.error.message.view"), null); }
private static void openMessagesView(@NotNull final ErrorViewPanel errorTreeView, @NotNull final Project myProject, @NotNull final String tabDisplayName) { CommandProcessor commandProcessor = CommandProcessor.getInstance(); commandProcessor.executeCommand(myProject, new Runnable() { @Override public void run() { final MessageView messageView = ServiceManager.getService(myProject, MessageView.class); final Content content = ContentFactory.SERVICE.getInstance().createContent(errorTreeView, tabDisplayName, true); messageView.getContentManager().addContent(content); Disposer.register(content, errorTreeView); messageView.getContentManager().setSelectedContent(content); removeContents(content, myProject, tabDisplayName); } }, "Open message view", null); }
private void onSuccess(final List<DependenciesBuilder> builders) { //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (shouldShowDependenciesPanel(builders)) { final String displayName = getPanelDisplayName(builders.get(0).getScope()); DependenciesPanel panel = new DependenciesPanel(myProject, builders, myExcluded); Content content = ContentFactory.SERVICE.getInstance().createContent(panel, displayName, false); content.setDisposer(panel); panel.setContent(content); DependenciesToolWindow.getInstance(myProject).addContent(content); } } }); }
public void createToolWindowContent(@NotNull ToolWindow toolWindow) { //Create runner UI layout RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject); RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject); // Adding actions DefaultActionGroup group = new DefaultActionGroup(); layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN); Content console = layoutUi.createContent(GradleConsoleToolWindowFactory.ID, myConsoleView.getComponent(), "", null, null); AnAction[] consoleActions = myConsoleView.createConsoleActions(); for (AnAction action : consoleActions) { if (!shouldIgnoreAction(action)) { group.add(action); } } layoutUi.addContent(console, 0, PlaceInGrid.right, false); JComponent layoutComponent = layoutUi.getComponent(); myConsolePanel.add(layoutComponent, BorderLayout.CENTER); //noinspection ConstantConditions Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true); toolWindow.getContentManager().addContent(content); }
/** * Show skipped commits * * @param project the context project * @param skippedCommits the skipped commits */ public static void showSkipped(final Project project, final SortedMap<VirtualFile, List<GitRebaseUtils.CommitInfo>> skippedCommits) { UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { ContentManager contentManager = ProjectLevelVcsManagerEx.getInstanceEx(project).getContentManager(); if (contentManager == null) { return; } GitSkippedCommits skipped = new GitSkippedCommits(contentManager, project, skippedCommits); Content content = ContentFactory.SERVICE.getInstance().createContent(skipped, "Skipped Commits", true); ContentsUtil.addContent(contentManager, content, true); ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS).activate(null); } }); }
public void actionPerformed(AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) { RepositoryBrowserDialog dialog = new RepositoryBrowserDialog(ProjectManager.getInstance().getDefaultProject()); dialog.show(); } else { ToolWindowManager manager = ToolWindowManager.getInstance(project); ToolWindow w = manager.getToolWindow(REPOSITORY_BROWSER_TOOLWINDOW); if (w == null) { RepositoryToolWindowPanel component = new RepositoryToolWindowPanel(project); w = manager.registerToolWindow(REPOSITORY_BROWSER_TOOLWINDOW, true, ToolWindowAnchor.BOTTOM, project, true); final Content content = ContentFactory.SERVICE.getInstance().createContent(component, "", false); Disposer.register(content, component); w.getContentManager().addContent(content); } w.show(null); w.activate(null); } }
public void actionPerformed(final AnActionEvent e) { final Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) { return; } final CopiesPanel copiesPanel = new CopiesPanel(project); ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS); final ContentManager contentManager = toolWindow.getContentManager(); Content content = ContentFactory.SERVICE.getInstance().createContent(copiesPanel.getComponent(), SvnBundle.message("dialog.show.svn.map.title"), true); ContentsUtil.addOrReplaceContent(contentManager, content, true); toolWindow.activate(new Runnable() { public void run() { IdeFocusManager.getInstance(project).requestFocus(copiesPanel.getPreferredFocusedComponent(), true); } }); /*SwingUtilities.invokeLater(new Runnable() { public void run() { IdeFocusManager.getInstance(project).requestFocus(copiesPanel.getPrefferedFocusComponent(), true); } });*/ }
public static void showInVersionControlToolWindow(final Project project, final String title, final List<FilePath> filesToShow, final String prompt) { final IntersectingLocalChangesPanel component = new IntersectingLocalChangesPanel(project, filesToShow, prompt); ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS); final ContentManager contentManager = toolWindow.getContentManager(); Content content = ContentFactory .SERVICE.getInstance().createContent(component.getPanel(), title, true); ContentsUtil.addContent(contentManager, content, true); toolWindow.activate(new Runnable() { public void run() { IdeFocusManager.getInstance(project).requestFocus(component.getPrefferedFocusComponent(), true); } }); }
public static void showMe(final Project project, final SvnFileRevision revision, final VirtualFile file) { if (ModalityState.NON_MODAL.equals(ModalityState.current())) { ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS); final ContentManager contentManager = toolWindow.getContentManager(); final MyDialog dialog = new MyDialog(project, revision, file); // TODO: Temporary memory leak fix - rewrite this part not to create dialog if only createCenterPanel(), but not show() is invoked Disposer.register(project, dialog.getDisposable()); Content content = ContentFactory.SERVICE.getInstance().createContent(dialog.createCenterPanel(), SvnBundle.message("merge.source.details.title", (file == null) ? revision.getURL() : file.getName(), revision.getRevisionNumber().asString()), true); ContentsUtil.addOrReplaceContent(contentManager, content, true); toolWindow.activate(null); } else { new MyDialog(project, revision, file).show(); } }
private Content setUpToolWindow() { //Create runner UI layout final RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject); final RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject); // Adding actions DefaultActionGroup group = new DefaultActionGroup(); group.add(myKillAction); group.addSeparator(); layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN); final Content console = layoutUi.createContent(CONSOLE_ID, myConsole.getComponent(), "", null, null); layoutUi.addContent(console, 0, PlaceInGrid.right, false); final JComponent uiComponent = layoutUi.getComponent(); myPanel.add(uiComponent, BorderLayout.CENTER); final ContentManager manager = myToolWindow.getContentManager(); final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); final Content content = contentFactory.createContent(uiComponent, null, true); manager.addContent(content); return content; }
@Override public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) { myToolWindow = toolWindow; ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); DumbService.getInstance(project).smartInvokeLater(new Runnable() { @Override public void run() { initTree(); initStructure(project); Content treeContent = contentFactory.createContent(ScrollPaneFactory.createScrollPane(myTree), "", false); myToolWindow.getContentManager().addContent(treeContent); } }); }
/** * Creats the tool window content * @param toolWindow */ public void createToolWindowContent(@NotNull ToolWindow toolWindow) { //Create runner UI layout RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(project); RunnerLayoutUi layoutUi = factory.create("", "", "session", project); // Adding actions DefaultActionGroup group = new DefaultActionGroup(); layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN); Content console = layoutUi.createContent(EmbeddedLinuxJVMToolWindowFactory.ID, consoleView.getComponent(), "", null, null); AnAction[] consoleActions = consoleView.createConsoleActions(); for (AnAction action : consoleActions) { if (!shouldIgnoreAction(action)) { group.add(action); } } layoutUi.addContent(console, 0, PlaceInGrid.right, false); JComponent layoutComponent = layoutUi.getComponent(); myConsolePanel.add(layoutComponent, BorderLayout.CENTER); Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true); toolWindow.getContentManager().addContent(content); }
private void updateToolWindow(@NotNull Project project, @NotNull ToolWindow toolWindow) { ContentManager contentManager = toolWindow.getContentManager(); contentManager.removeAllContents(true); FileEditorManager fileEditorManager = FileEditorManager.getInstance(project); Editor selectedEditor = fileEditorManager.getSelectedTextEditor(); if (selectedEditor == null) return; PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(selectedEditor.getDocument()); if (psiFile == null || !psiFile.getLanguage().equals(PythonLanguage.INSTANCE)) { return; } FileEditor fileEditor = fileEditorManager.getSelectedEditor(psiFile.getVirtualFile()); StructureView structureView = new PTestStructureViewFactory().getStructureViewBuilder(psiFile).createStructureView(fileEditor, project); Content content = ContentFactory.SERVICE.getInstance().createContent(structureView.getComponent(), "", false); contentManager.addContent(content); }
@Override public void createToolWindowContent(@NotNull final Project project, @NotNull ToolWindow toolWindow) { final MCSettingsProvider settings = MCSettingsProvider.getInstance(project); final ContentManager contentManager = toolWindow.getContentManager(); final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); final String mayaLogPath = PathManager.getPluginTempPath() + String.format(MayaCommInterface.LOG_FILENAME_STRING, settings.getPort()); final MayaLogConsole console = new MayaLogConsole(project, new File(mayaLogPath), Charset.defaultCharset(), 0L, "MayaLog", false, GlobalSearchScope.allScope(project)); final Content content = contentFactory.createContent(console.getComponent(), "", false); contentManager.addContent(content); toolWindow.setAvailable(true, null); toolWindow.setToHideOnEmptyContent(true); toolWindow.activate(console::activate); }
@Override public void createToolWindowContent(Project project, ToolWindow toolWindow) { toolWindow.setToHideOnEmptyContent(true); ToolWindowPane panel = new ToolWindowPane(true, true); final Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false); content.setCloseable(true); ActionToolbar actionToolbar = createToolbar(); panel.setToolbar(actionToolbar.getComponent()); ColorTextPane textArea = new ColorTextPane(); panel.setOutputTextArea(textArea); toolWindow.getContentManager().addContent(content); toolWindow.activate(null); }
@Override public void createToolWindowContent(Project project, ToolWindow toolWindow) { final Document document = new PlainDocument(); final NetConsoleClient netConsole = new NetConsoleClient(document); final JXTextArea textArea = new JXTextArea(); textArea.setDocument(document); textArea.setEditable(false); final DefaultActionGroup actionGroup = new DefaultActionGroup(); actionGroup.addAction(new AutoScrollAction(netConsole, textArea)); actionGroup.addAction(new ClearAction(netConsole)); actionGroup.addAction(new DisableAction(netConsole, textArea)); final SimpleToolWindowPanel netConsolePanel = new SimpleToolWindowPanel(false, false); final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actionGroup, false); netConsolePanel.setToolbar(toolbar.getComponent()); netConsolePanel.setContent(new JBScrollPane(textArea)); final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); final Content content = contentFactory.createContent(netConsolePanel, "", true); toolWindow.getContentManager().addContent(content); }
public static void registerConsole(Project project) { // Create the toolWindow ToolWindow window = ToolWindowManager.getInstance(project).registerToolWindow( PantsConstants.PANTS_CONSOLE_NAME, true, ToolWindowAnchor.BOTTOM, project, true ); window.setIcon(PantsIcons.Icon); // Have the toolWindow contain the view panel. PantsConsoleViewPanel pantsConsoleViewPanel = new PantsConsoleViewPanel(project); final boolean isLockable = true; final String displayName = ""; Content pantsConsoleContent = ContentFactory.SERVICE.getInstance().createContent(pantsConsoleViewPanel, displayName, isLockable); window.getContentManager().addContent(pantsConsoleContent); }
/** * Add icon and evoke creation of tool window content * * @param project * @param toolWindow */ @Override public void createToolWindowContent(Project project, final com.intellij.openapi.wm.ToolWindow toolWindow) { final ToolWindow newToolWindow = new ToolWindow(); Content content = ContentFactory.SERVICE.getInstance().createContent(newToolWindow, "", false); toolWindow.setAvailable(true, null); toolWindow.setToHideOnEmptyContent(true); toolWindow.setTitle(StaticTexts.TITLE_TOOL_WINDOW); loadAndSetToolWindowIcon(toolWindow); toolWindow.getContentManager().addContent(content); toolWindow.activate(new Runnable() { @Override public void run() { } }); }
public FilesystemToolwindow(final VirtualFile root, Project project) { myRoot = root; myProject = project; myToolWindow = ToolWindowManager.getInstance(project).registerToolWindow("File System", false, ToolWindowAnchor.LEFT); myContent = new MyContent(); final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, true, false, true, true); descriptor.setRoots(myRoot); myFsTree = new FileSystemTreeImpl(project, descriptor); myContent.add(ScrollPaneFactory.createScrollPane(myFsTree.getTree()), BorderLayout.CENTER); EditSourceOnDoubleClickHandler.install(myFsTree.getTree()); EditSourceOnEnterKeyHandler.install(myFsTree.getTree()); final ContentFactory contentFactory = new ContentFactoryImpl(); final Content content = contentFactory.createContent(myContent, null, false); myToolWindow.getContentManager().addContent(content); }
@Override public void createToolWindowContent(final Project project, ToolWindow toolWindow) { final Editor editor = EventLog.getProjectComponent(project).getConsole().getConsoleEditor(); SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true) { @Override public Object getData(@NonNls String dataId) { return PlatformDataKeys.HELP_ID.is(dataId) ? EventLog.HELP_ID : super.getData(dataId); } }; panel.setContent(editor.getComponent()); panel.addAncestorListener(new LogShownTracker(project)); ActionToolbar toolbar = createToolbar(project, editor); toolbar.setTargetComponent(panel); panel.setToolbar(toolbar.getComponent()); final Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false); toolWindow.getContentManager().addContent(content); }
public void projectOpened() { final StartupManager manager = StartupManager.getInstance(myProject); manager.registerPostStartupActivity(new DumbAwareRunnable() { public void run() { ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject); if (toolWindowManager != null) { // Can be null in tests ToolWindow toolWindow = toolWindowManager.registerToolWindow(ToolWindowId.VCS, true, ToolWindowAnchor.BOTTOM, myProject, true); myContentManager = toolWindow.getContentManager(); toolWindow.setIcon(AllIcons.Toolwindows.VcsSmallTab); toolWindow.installWatcher(myContentManager); } else { myContentManager = ContentFactory.SERVICE.getInstance().createContentManager(true, myProject); } } }); }
public UpdateInfoTree showUpdateProjectInfo(UpdatedFiles updatedFiles, String displayActionName, ActionInfo actionInfo, boolean canceled) { if (! myProject.isOpen() || myProject.isDisposed()) return null; ContentManager contentManager = getContentManager(); if (contentManager == null) { return null; // content manager is made null during dispose; flag is set later } final UpdateInfoTree updateInfoTree = new UpdateInfoTree(contentManager, myProject, updatedFiles, displayActionName, actionInfo); Content content = ContentFactory.SERVICE.getInstance().createContent(updateInfoTree, canceled ? VcsBundle.message("toolwindow.title.update.action.canceled.info", displayActionName) : VcsBundle.message("toolwindow.title.update.action.info", displayActionName), true); Disposer.register(content, updateInfoTree); ContentsUtil.addContent(contentManager, content, true); ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.VCS).activate(null); updateInfoTree.expandRootChildren(); return updateInfoTree; }
private void recalculateWindows() { final GitVcs vcs = GitVcs.getInstance(myProject); final VirtualFile[] roots = myVcsManager.getRootsUnderVcs(vcs); final List<VirtualFile> fileList = Arrays.asList(roots); final ChangesViewContentI cvcm = ChangesViewContentManager.getInstance(myProject); final Content currContent = myCurrentContent.get(); if (currContent != null) { myLogRef.get().rootsChanged(fileList); return; } final GitLog gitLog = myLogFactoryService.createComponent(true); final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); final Content content = contentFactory.createContent(gitLog.getVisualComponent(), CONTENT_KEY, false); content.setCloseable(false); cvcm.addContent(content); Disposer.register(content, gitLog); myLogRef.set(gitLog); myCurrentContent.set(content); gitLog.rootsChanged(fileList); }
public void actionPerformed(AnActionEvent e) { Project project = e.getData(PlatformDataKeys.PROJECT); if (project == null) { RepositoryBrowserDialog dialog = new RepositoryBrowserDialog(ProjectManager.getInstance().getDefaultProject()); dialog.show(); } else { ToolWindowManager manager = ToolWindowManager.getInstance(project); ToolWindow w = manager.getToolWindow(REPOSITORY_BROWSER_TOOLWINDOW); if (w == null) { RepositoryToolWindowPanel component = new RepositoryToolWindowPanel(project); w = manager.registerToolWindow(REPOSITORY_BROWSER_TOOLWINDOW, true, ToolWindowAnchor.BOTTOM, project, true); final Content content = ContentFactory.SERVICE.getInstance().createContent(component, "", false); Disposer.register(content, component); w.getContentManager().addContent(content); } w.show(null); w.activate(null); } }
public void actionPerformed(final AnActionEvent e) { final Project project = e.getData(PlatformDataKeys.PROJECT); if (project == null) { return; } final CopiesPanel copiesPanel = new CopiesPanel(project); ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS); final ContentManager contentManager = toolWindow.getContentManager(); Content content = ContentFactory.SERVICE.getInstance().createContent(copiesPanel.getComponent(), SvnBundle.message("dialog.show.svn.map.title"), true); ContentsUtil.addOrReplaceContent(contentManager, content, true); toolWindow.activate(new Runnable() { public void run() { IdeFocusManager.getInstance(project).requestFocus(copiesPanel.getPreferredFocusedComponent(), true); } }); /*SwingUtilities.invokeLater(new Runnable() { public void run() { IdeFocusManager.getInstance(project).requestFocus(copiesPanel.getPrefferedFocusComponent(), true); } });*/ }