@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 JPanel createIssuesViewTab(boolean supported) { ActionToolbar toolbar = ComponentUtils.createActionToolbar(issuesComponentsTree); IssueFilterMenu issueFilterMenu = new IssueFilterMenu(project); JPanel filterButton = new FilterButton(issueFilterMenu, "Severity", "Select severities to show"); SimpleToolWindowPanel filterPanel = new SimpleToolWindowPanel(false); filterPanel.setToolbar(toolbar.getComponent()); filterPanel.setContent(filterButton); issuesPanel = createComponentsIssueDetailView(); issuesRightHorizontalSplit = new OnePixelSplitter(true, 0.55f); issuesRightHorizontalSplit.setFirstComponent(createComponentsDetailsView(supported)); issuesRightHorizontalSplit.setSecondComponent(issuesPanel); OnePixelSplitter centralVerticalSplit = new OnePixelSplitter(false, 0.33f); centralVerticalSplit.setFirstComponent(createIssuesComponentsTreeView()); centralVerticalSplit.setSecondComponent(issuesRightHorizontalSplit); OnePixelSplitter issuesViewTab = new OnePixelSplitter(true, 0f); issuesViewTab.setResizeEnabled(false); issuesViewTab.setFirstComponent(filterPanel); issuesViewTab.setSecondComponent(centralVerticalSplit); return issuesViewTab; }
private JPanel createLicenseInfoTab(boolean supported) { ActionToolbar toolbar = ComponentUtils.createActionToolbar(licensesComponentsTree); licenseFilterMenu = new LicenseFilterMenu(project); FilterButton licensesFilterButton = new FilterButton(licenseFilterMenu, "License", "Select licenses to show"); licensesFilterButton.setAlignmentX(Component.LEFT_ALIGNMENT); SimpleToolWindowPanel filterPanel = new SimpleToolWindowPanel(false); filterPanel.setToolbar(toolbar.getComponent()); filterPanel.setContent(licensesFilterButton); JPanel licenseTab = new JBPanel(new BorderLayout()); licensesCentralVerticalSplit = new OnePixelSplitter(false, 0.3f); licensesCentralVerticalSplit.setFirstComponent(createLicensesComponentsTreeView()); licensesCentralVerticalSplit.setSecondComponent(createLicenseDetailsView(supported)); licenseTab.add(filterPanel, BorderLayout.NORTH); licenseTab.add(licensesCentralVerticalSplit, BorderLayout.CENTER); return licenseTab; }
private void createUIComponents() { simpleToolWindowPanel1 = new SimpleToolWindowPanel(true, true); mFormData = new JBDebuggerTable(); mUrlencoded = new JBDebuggerTable(); typeBody = new ButtonGroup(); // DefaultButtonModel buttonModel = new DefaultButtonModel(); // buttonModel.setActionCommand("FormData"); // typeBody.setSelected(buttonModel, true); ActionGroup group = new DefaultActionGroup( new JBRadioAction("form-data", "FormData", typeBody, previewTypeListener, true), new JBRadioAction("x-www-urlencoded", "XWwwFormUrlencoded", typeBody, previewTypeListener), new JBRadioAction("raw", "Raw", typeBody, previewTypeListener), new JBRadioAction("binary", "Binary", typeBody, previewTypeListener) ); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true); simpleToolWindowPanel1.setToolbar(toolbar.getComponent()); simpleToolWindowPanel1.setContent(new JPanel(new BorderLayout())); }
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()); }
private JPanel buildBigPanel() { myBigPanel = new SimpleToolWindowPanel(true); myBigPanel.setBackground(UIUtil.getFieldForegroundColor()); final JPanel panel = new JPanel(new BorderLayout()); myBigPanel.add(panel, BorderLayout.CENTER); myTreeTablePanel = new JPanel(new BorderLayout()); rebuildTreePanel(); panel.add(myTreeTablePanel); myBigPanel.setPreferredSize(new Dimension(200, myBigPanel.getHeight())); final ActionManager actionManager = ActionManager.getInstance(); final ActionGroup actionGroup = (ActionGroup)actionManager.getAction("Groovy.Dynamic.Toolbar"); ActionToolbar actionToolbar = actionManager.createActionToolbar("Groovy.Dynamic.Toolbar", actionGroup, true); myBigPanel.setToolbar(actionToolbar.getComponent()); myBigPanel.revalidate(); return myBigPanel; }
@Override public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) { logger.info("Initializing Pastes ToolWindow"); toolWindow.setStripeTitle("Ultimate PasteBin"); toolWindow.setTitle("Ultimate PasteBin"); ContentManager contentManager = toolWindow.getContentManager(); Content content = contentManager.getFactory().createContent(toolWindow.getComponent(), null, false); ToolWindowService service = ServiceManager.getService(ToolWindowService.class); // Panel with toolbar SimpleToolWindowPanel simpleToolWindowPanel = new SimpleToolWindowPanel(true); // Scrolable panel JBScrollPane jbScrollPane = new JBScrollPane(service.getTree()); simpleToolWindowPanel.add(jbScrollPane); simpleToolWindowPanel.setToolbar(createToolbar()); content.setComponent(simpleToolWindowPanel); contentManager.addContent(content); toolWindow.activate(this::firstTimeOpen); }
@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); }
@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); }
private JPanel buildBigPanel() { myBigPanel = new SimpleToolWindowPanel(true); final ActionManager actionManager = ActionManager.getInstance(); final ActionGroup actionGroup = (ActionGroup)actionManager.getAction("Groovy.Dynamic.Toolbar"); ActionToolbar actionToolbar = actionManager.createActionToolbar("Groovy.Dynamic.Toolbar", actionGroup, true); myBigPanel.setToolbar(actionToolbar.getComponent()); myBigPanel.setBackground(UIUtil.getFieldForegroundColor()); final JPanel panel = new JPanel(new BorderLayout()); myBigPanel.add(panel, BorderLayout.CENTER); myTreeTablePanel = new JPanel(new BorderLayout()); rebuildTreePanel(); panel.add(myTreeTablePanel); myBigPanel.setPreferredSize(new Dimension(200, myBigPanel.getHeight())); myBigPanel.revalidate(); return myBigPanel; }
private Content createToolWindowContentPanel(@Nullable LocalTerminalDirectRunner terminalRunner, TerminalWidget terminalWidget) { 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); } }; if (terminalWidget != null) { panel.setContent(terminalWidget.getComponent()); panel.addFocusListener(createFocusListener()); } ActionToolbar toolbar = createToolbar(terminalRunner, terminalWidget); toolbar.getComponent().addFocusListener(createFocusListener()); toolbar.setTargetComponent(panel); panel.setToolbar(toolbar.getComponent()); final Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false); if (getComponentToFocus() != null) { content.setPreferredFocusableComponent(getComponentToFocus()); } return content; }
private void setupMetadataPanel(Project project, SimpleToolWindowPanel metadataPanel) { RestClientService restClientService = ServiceManager.getService(project, RestClientService.class); SimpleNode metadataRootNode = new MetadataExplorerRootNode(project, restClientService, "Metadata"); SimpleTree metadataTree = new SimpleTree(); SimpleTreeBuilder metadataTreeBuilder = new SimpleTreeBuilder(metadataTree, (DefaultTreeModel)metadataTree.getModel(), new ExplorerTreeStructure(metadataRootNode), null); Disposer.register(project, metadataTreeBuilder); metadataTree.addTreeExpansionListener(new ExplorerTreeExpansionListener(metadataTreeBuilder)); metadataTree.setCellRenderer(new ExplorerCellRenderer()); ActionToolbar toolbar = createToolbar(metadataRootNode, metadataTreeBuilder); toolbar.setTargetComponent(metadataPanel); metadataPanel.setToolbar(toolbar.getComponent()); metadataPanel.setContent(ScrollPaneFactory.createScrollPane(metadataTree)); metadataTree.setShowsRootHandles(true); }
private void setupToolingMetadataPanel(Project project, SimpleToolWindowPanel toolingMetadataPanel) { ToolingRestClientService toolingRestClientService = ServiceManager.getService(project, ToolingRestClientService.class); SimpleNode toolingMetadataRootNode = new MetadataExplorerRootNode(project, toolingRestClientService, " Tooling Metadata"); SimpleTree toolingMetadataTree = new SimpleTree(); SimpleTreeBuilder toolingMetadataTreeBuilder = new SimpleTreeBuilder(toolingMetadataTree, (DefaultTreeModel)toolingMetadataTree.getModel(), new ExplorerTreeStructure(toolingMetadataRootNode), null); Disposer.register(project, toolingMetadataTreeBuilder); toolingMetadataTree.addTreeExpansionListener(new ExplorerTreeExpansionListener(toolingMetadataTreeBuilder)); toolingMetadataTree.setCellRenderer(new ExplorerCellRenderer()); ActionToolbar toolbar = createToolbar(toolingMetadataRootNode, toolingMetadataTreeBuilder); toolbar.setTargetComponent(toolingMetadataPanel); toolingMetadataPanel.setToolbar(toolbar.getComponent()); toolingMetadataPanel.setContent(ScrollPaneFactory.createScrollPane(toolingMetadataTree)); toolingMetadataTree.setShowsRootHandles(true); }
@Override public void createToolWindowContent(Project project, ToolWindow toolWindow) { RestClientService restClientService = ServiceManager.getService(project, RestClientService.class); Map<LimitsResult.LimitType, LimitResult> limits = restClientService.getLimits(); LimitResult limitResult = limits.get(LimitsResult.LimitType.DailyApiRequests); apiRequestsMax.setText(String.format("%d", limitResult.getMax())); apiRequestsRemaining.setText(String.format("%d", limitResult.getRemaining())); limitResult = limits.get(LimitsResult.LimitType.DailyAsyncApexExecutions); apexExecutionsMax.setText(String.format("%d", limitResult.getMax())); apexExecutionsRemaining.setText(String.format("%d", limitResult.getRemaining())); limitResult = limits.get(LimitsResult.LimitType.DailyBulkApiRequests); bulkApiRequestsMax.setText(String.format("%d", limitResult.getMax())); bulkApiRequestsRemaining.setText(String.format("%d", limitResult.getRemaining())); limitResult = limits.get(LimitsResult.LimitType.StreamingApiConcurrentClients); streamingApiClientsMax.setText(String.format("%d", limitResult.getMax())); streamingApiClientsRemaining.setText(String.format("%d", limitResult.getRemaining())); final SimpleToolWindowPanel panel = new SimpleToolWindowPanel(true, true); final Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false); toolWindow.getContentManager().addContent(content); panel.setContent(limitsPanel); }
private BsConsole getBsbConsole() { BsConsole console = null; ToolWindow window = ToolWindowManager.getInstance(m_project).getToolWindow("Bucklescript"); Content windowContent = window.getContentManager().getContent(0); if (windowContent != null) { SimpleToolWindowPanel component = (SimpleToolWindowPanel) windowContent.getComponent(); JComponent panelComponent = component.getComponent(); if (panelComponent != null) { console = (BsConsole) panelComponent.getComponent(0); } } return console; }
@Override public void initComponent() { model = new DateTimeTableModel(); final KeyStroke shortcutPaste = KeymapUtil.getKeyStroke(CommonShortcuts.getPaste()); final DateTimeColumnModel columns = new DateTimeColumnModel("Unix timestamp (ms)", "Datetime", "Format"); final ComboBox defaultPatterns = new ComboBox(DateTimePattern.getPatterns()); defaultPatterns.setEditable(true); columns.getColumn(2).setCellEditor(new DefaultCellEditor(defaultPatterns)); final JBTable table = new JBTable(model, columns); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setAutoCreateRowSorter(true); table.registerKeyboardAction(e -> model.addRows(DateTimeUtil.getClipboardDateTimes()), shortcutPaste, JComponent.WHEN_FOCUSED); final JBScrollPane scrollPane = new JBScrollPane(table); final DefaultActionGroup group = new DefaultActionGroup(); group.add(new AddRowAction(model)); group.add(new DeleteRowAction(model, table)); final SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false); final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("datetimeconverterbar", group, false); toolbar.setTargetComponent(panel); panel.add(scrollPane); panel.setToolbar(toolbar.getComponent()); component = panel; }
/** * 创建Terminal panel * * @param terminalRunner * @param toolWindow * @return */ private Content createTerminalInContentPanel(@NotNull AbstractTerminalRunner terminalRunner, @NotNull final ToolWindow toolWindow) { SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true); Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false); content.setCloseable(true); myTerminalWidget = terminalRunner.createTerminalWidget(content); panel.setContent(myTerminalWidget.getComponent()); panel.addFocusListener(this); ActionToolbar toolbar = createToolbar(terminalRunner, myTerminalWidget, toolWindow); toolbar.setTargetComponent(panel); panel.setToolbar(toolbar.getComponent()); content.setPreferredFocusableComponent(myTerminalWidget.getComponent()); return content; }
static void createContent(Project project, ToolWindow toolWindow, EventLogConsole console, String title) { // update default Event Log tab title ContentManager contentManager = toolWindow.getContentManager(); Content generalContent = contentManager.getContent(0); if (generalContent != null && contentManager.getContentCount() == 1) { generalContent.setDisplayName("General"); } final Editor editor = console.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, console); toolbar.setTargetComponent(editor.getContentComponent()); panel.setToolbar(toolbar.getComponent()); Content content = ContentFactory.SERVICE.getInstance().createContent(panel, title, false); contentManager.addContent(content); contentManager.setSelectedContent(content); }
private static void setContent(ToolWindow toolWindow, RunContentDescriptor contentDescriptor) { toolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true"); Content content = toolWindow.getContentManager().findContent(contentDescriptor.getDisplayName()); if (content == null) { content = createContent(contentDescriptor); toolWindow.getContentManager().addContent(content); } else { SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true); resetContent(contentDescriptor, panel, content); } toolWindow.getContentManager().setSelectedContent(content); }
private static void resetContent(RunContentDescriptor contentDescriptor, SimpleToolWindowPanel panel, Content content) { RunContentDescriptor oldDescriptor = content.getDisposer() instanceof RunContentDescriptor ? (RunContentDescriptor)content.getDisposer() : null; if (oldDescriptor != null) Disposer.dispose(oldDescriptor); panel.setContent(contentDescriptor.getComponent()); content.setComponent(panel); content.setDisposer(contentDescriptor); content.setPreferredFocusableComponent(contentDescriptor.getComponent()); content.putUserData(CONTENT_DESCRIPTOR, contentDescriptor); }
private Content createTerminalInContentPanel(@NotNull AbstractTerminalRunner terminalRunner, final @NotNull ToolWindow toolWindow) { SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true); final Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false); content.setCloseable(true); myTerminalWidget = terminalRunner.createTerminalWidget(content); myTerminalWidget.addTabListener(new TabbedTerminalWidget.TabListener() { @Override public void tabClosed(JediTermWidget terminal) { UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { if (myTerminalWidget != null) { hideIfNoActiveSessions(toolWindow, myTerminalWidget); } } }); } }); panel.setContent(myTerminalWidget.getComponent()); panel.addFocusListener(createFocusListener()); ActionToolbar toolbar = createToolbar(terminalRunner, myTerminalWidget, toolWindow); toolbar.getComponent().addFocusListener(createFocusListener()); toolbar.setTargetComponent(panel); panel.setToolbar(toolbar.getComponent()); content.setPreferredFocusableComponent(myTerminalWidget.getComponent()); return content; }
static void createContent(Project project, ToolWindow toolWindow, ConsoleLogConsole console, String title) { // update default Event Log tab title ContentManager contentManager = toolWindow.getContentManager(); Content generalContent = contentManager.getContent(0); if (generalContent != null && contentManager.getContentCount() == 1) { generalContent.setDisplayName("General"); } final Editor editor = console.getConsoleEditor(); SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true) { @Override public Object getData(@NonNls String dataId) { return PlatformDataKeys.HELP_ID.is(dataId) ? ConsoleLog.HELP_ID : super.getData(dataId); } }; panel.setContent(editor.getComponent()); panel.addAncestorListener(new LogShownTracker(project)); ActionToolbar toolbar = createToolbar(project, editor, console); toolbar.setTargetComponent(editor.getContentComponent()); panel.setToolbar(toolbar.getComponent()); Content content = ContentFactory.SERVICE.getInstance().createContent(panel, title, false); contentManager.addContent(content); contentManager.setSelectedContent(content); }
@Override public void createToolWindowContent(Project project, ToolWindow toolWindow) { JTabbedPane tabbedPane = new JTabbedPane(); final Content content = ContentFactory.SERVICE.getInstance().createContent(tabbedPane, "", false); toolWindow.getContentManager().addContent(content); SimpleToolWindowPanel metadataPanel = new SimpleToolWindowPanel(true, true); setupMetadataPanel(project, metadataPanel); tabbedPane.add("Metadata", metadataPanel); SimpleToolWindowPanel toolingMetadataPanel = new SimpleToolWindowPanel(true, true); setupToolingMetadataPanel(project, toolingMetadataPanel); tabbedPane.add("Tooling Metadata", toolingMetadataPanel); }
@Override public void createToolWindowContent(Project project, ToolWindow toolWindow) { SimpleToolWindowPanel panel = new SimpleToolWindowPanel(true, true); Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false); toolWindow.getContentManager().addContent(content); panel.setContent(dataExplorerPanel); setupDataSplitPane(project); setupToolingDataSplitPane(project); }
private void setupDataSplitPane(Project project) { RestClientService restClientService = ServiceManager.getService(project, RestClientService.class); SimpleNode dataRootNode = new DataExplorerRootNode(project, restClientService, "sObjects"); SimpleTree dataTree = new SimpleTree(); dataTree.setShowsRootHandles(true); SimpleTreeBuilder dataTreeBuilder = new SimpleTreeBuilder(dataTree, (DefaultTreeModel) dataTree.getModel(), new ExplorerTreeStructure(dataRootNode), null); Disposer.register(project, dataTreeBuilder); dataTree.addTreeExpansionListener(new ExplorerTreeExpansionListener(dataTreeBuilder)); dataTree.setCellRenderer(new ExplorerCellRenderer()); JBTable dataTable = new JBTable(); dataTable.setStriped(true); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); // Setup left panel which will display all the available sObjects SimpleToolWindowPanel treePanel = new SimpleToolWindowPanel(true, true); ActionToolbar treeToolbar = createTreeToolbar(dataRootNode, dataTreeBuilder); treeToolbar.setTargetComponent(treePanel); treePanel.setToolbar(treeToolbar.getComponent()); treePanel.setContent(ScrollPaneFactory.createScrollPane(dataTree)); dataSplitPane.add(treePanel, JSplitPane.LEFT); // Setup right panel which will display the data in the selected sObject SimpleToolWindowPanel dataPanel = new SimpleToolWindowPanel(true, true); ActionToolbar dataToolbar = createDataToolbar(dataTable); dataToolbar.setTargetComponent(dataPanel); dataPanel.setToolbar(dataToolbar.getComponent()); dataPanel.setContent(ScrollPaneFactory.createScrollPane(dataTable)); dataSplitPane.add(dataPanel, JSplitPane.RIGHT); dataSplitPane.getLeftComponent().setPreferredSize(new Dimension(250, 0)); dataSplitPane.getRightComponent().setPreferredSize(new Dimension(0, 0)); dataTree.addMouseListener(new DataExplorerMouseListener(dataTable, dataTree)); }
private void setupToolingDataSplitPane(Project project) { ToolingRestClientService toolingRestClientService = ServiceManager.getService(project, ToolingRestClientService.class); SimpleNode toolingDataRootNode = new DataExplorerRootNode(project, toolingRestClientService, "Tooling sObjects"); SimpleTree toolingDataTree = new SimpleTree(); toolingDataTree.setShowsRootHandles(true); SimpleTreeBuilder toolingDataTreeBuilder = new SimpleTreeBuilder(toolingDataTree, (DefaultTreeModel) toolingDataTree.getModel(), new ExplorerTreeStructure(toolingDataRootNode), null); Disposer.register(project, toolingDataTreeBuilder); toolingDataTree.addTreeExpansionListener(new ExplorerTreeExpansionListener(toolingDataTreeBuilder)); toolingDataTree.setCellRenderer(new ExplorerCellRenderer()); JBTable toolingDataTable = new JBTable(); toolingDataTable.setStriped(true); toolingDataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); // Setup left panel which will display all the available sObjects SimpleToolWindowPanel treePanel = new SimpleToolWindowPanel(true, true); ActionToolbar treeToolbar = createTreeToolbar(toolingDataRootNode, toolingDataTreeBuilder); treeToolbar.setTargetComponent(treePanel); treePanel.setToolbar(treeToolbar.getComponent()); treePanel.setContent(ScrollPaneFactory.createScrollPane(toolingDataTree)); toolingDataSplitPane.add(treePanel, JSplitPane.LEFT); // Setup right panel which will display the data in the selected sObject SimpleToolWindowPanel dataPanel = new SimpleToolWindowPanel(true, true); ActionToolbar dataToolbar = createDataToolbar(toolingDataTable); dataToolbar.setTargetComponent(dataPanel); dataPanel.setToolbar(dataToolbar.getComponent()); dataPanel.setContent(ScrollPaneFactory.createScrollPane(toolingDataTable)); toolingDataSplitPane.add(dataPanel, JSplitPane.RIGHT); toolingDataSplitPane.getLeftComponent().setPreferredSize(new Dimension(250, 0)); toolingDataSplitPane.getRightComponent().setPreferredSize(new Dimension(0, 0)); toolingDataTree.addMouseListener(new DataExplorerMouseListener(toolingDataTable, toolingDataTree)); }
static void createContent(Project project, ToolWindow toolWindow, EventLogConsole console, String title) { // update default Event Log tab title ContentManager contentManager = toolWindow.getContentManager(); Content generalContent = contentManager.getContent(0); if (generalContent != null && contentManager.getContentCount() == 1) { generalContent.setDisplayName("General"); } final Editor editor = console.getConsoleEditor(); SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true) { @Override public Object getData(@Nonnull @NonNls Key dataId) { return PlatformDataKeys.HELP_ID == dataId ? EventLog.HELP_ID : super.getData(dataId); } }; panel.setContent(editor.getComponent()); panel.addAncestorListener(new LogShownTracker(project)); ActionToolbar toolbar = createToolbar(project, editor, console); toolbar.setTargetComponent(editor.getContentComponent()); panel.setToolbar(toolbar.getComponent()); Content content = ContentFactory.getInstance().createContent(panel, title, false); contentManager.addContent(content); contentManager.setSelectedContent(content); }
private JComponent createChangeViewComponent() { SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true); DefaultActionGroup group = (DefaultActionGroup) ActionManager.getInstance().getAction("ChangesViewToolbar"); EmptyAction.registerWithShortcutSet("ChangesView.Refresh", CommonShortcuts.getRerun(), panel); EmptyAction.registerWithShortcutSet("ChangesView.NewChangeList", CommonShortcuts.getNew(), panel); EmptyAction.registerWithShortcutSet("ChangesView.RemoveChangeList", CommonShortcuts.getDelete(), panel); EmptyAction.registerWithShortcutSet(IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST, CommonShortcuts.getMove(), panel); EmptyAction.registerWithShortcutSet("ChangesView.Rename",CommonShortcuts.getRename() , panel); EmptyAction.registerWithShortcutSet("ChangesView.SetDefault", new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_U, KeyEvent.ALT_DOWN_MASK | ctrlMask())), panel); EmptyAction.registerWithShortcutSet("ChangesView.Diff", CommonShortcuts.getDiff(), panel); JPanel toolbarPanel = new JPanel(new BorderLayout()); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.CHANGES_VIEW_TOOLBAR, group, false); toolbar.setTargetComponent(myView); JComponent toolbarComponent = toolbar.getComponent(); toolbarPanel.add(toolbarComponent, BorderLayout.WEST); DefaultActionGroup visualActionsGroup = new DefaultActionGroup(); final Expander expander = new Expander(); visualActionsGroup.add(CommonActionsManager.getInstance().createExpandAllAction(expander, panel)); visualActionsGroup.add(CommonActionsManager.getInstance().createCollapseAllAction(expander, panel)); ToggleShowFlattenAction showFlattenAction = new ToggleShowFlattenAction(); showFlattenAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_P, ctrlMask())), panel); visualActionsGroup.add(showFlattenAction); visualActionsGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_COPY)); visualActionsGroup.add(new ToggleShowIgnoredAction()); visualActionsGroup.add(new IgnoredSettingsAction()); myToggleDetailsAction = new ToggleDetailsAction(); visualActionsGroup.add(myToggleDetailsAction); visualActionsGroup.add(new ContextHelpAction(ChangesListView.ourHelpId)); toolbarPanel.add( ActionManager.getInstance().createActionToolbar(ActionPlaces.CHANGES_VIEW_TOOLBAR, visualActionsGroup, false).getComponent(), BorderLayout.CENTER); DefaultActionGroup menuGroup = (DefaultActionGroup) ActionManager.getInstance().getAction("ChangesViewPopupMenu"); myView.setMenuActions(menuGroup); myView.setShowFlatten(SHOW_FLATTEN_MODE); myProgressLabel = new JPanel(new BorderLayout()); panel.setToolbar(toolbarPanel); final JPanel content = new JPanel(new BorderLayout()); String value = PropertiesComponent.getInstance().getValue(DETAILS_SPLITTER_PROPORTION); float f = 0.5f; if (! StringUtil.isEmptyOrSpaces(value)) { try { f = Float.parseFloat(value); } catch (NumberFormatException e) { // } } mySplitter = new Splitter(false, f); mySplitter.setHonorComponentsMinimumSize(false); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myView); final JPanel wrapper = new JPanel(new BorderLayout()); wrapper.add(scrollPane, BorderLayout.CENTER); mySplitter.setFirstComponent(wrapper); content.add(mySplitter, BorderLayout.CENTER); content.add(myProgressLabel, BorderLayout.SOUTH); panel.setContent(content); myView.installDndSupport(ChangeListManagerImpl.getInstanceImpl(myProject)); myView.addTreeSelectionListener(myTsl); return panel; }
private void constructUi() { myViewContentPanel = new JPanel(); myPanel = new SimpleToolWindowPanel(true).setProvideQuickActions(false); myPanel.setContent(myViewContentPanel); }
private JComponent createChangeViewComponent() { SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true); DefaultActionGroup group = (DefaultActionGroup) ActionManager.getInstance().getAction("ChangesViewToolbar"); ActionManager.getInstance().getAction("ChangesView.Refresh").registerCustomShortcutSet(CommonShortcuts.getRerun(), panel); ActionManager.getInstance().getAction("ChangesView.NewChangeList").registerCustomShortcutSet(CommonShortcuts.getNew(), panel); ActionManager.getInstance().getAction("ChangesView.RemoveChangeList").registerCustomShortcutSet(CommonShortcuts.DELETE, panel); ActionManager.getInstance().getAction(IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST).registerCustomShortcutSet(CommonShortcuts.getMove(), panel); ActionManager.getInstance().getAction("ChangesView.Rename").registerCustomShortcutSet(CommonShortcuts.getRename(), panel); ActionManager.getInstance().getAction("ChangesView.SetDefault").registerCustomShortcutSet( new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_U, KeyEvent.ALT_DOWN_MASK | ctrlMask())), panel); final CustomShortcutSet diffShortcut = new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_D, ctrlMask())); ActionManager.getInstance().getAction("ChangesView.Diff").registerCustomShortcutSet(diffShortcut, panel); JPanel toolbarPanel = new JPanel(new BorderLayout()); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.CHANGES_VIEW_TOOLBAR, group, false); toolbar.setTargetComponent(myView); JComponent toolbarComponent = toolbar.getComponent(); toolbarPanel.add(toolbarComponent, BorderLayout.WEST); DefaultActionGroup visualActionsGroup = new DefaultActionGroup(); final Expander expander = new Expander(); visualActionsGroup.add(CommonActionsManager.getInstance().createExpandAllAction(expander, panel)); visualActionsGroup.add(CommonActionsManager.getInstance().createCollapseAllAction(expander, panel)); ToggleShowFlattenAction showFlattenAction = new ToggleShowFlattenAction(); showFlattenAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_P, ctrlMask())), panel); visualActionsGroup.add(showFlattenAction); visualActionsGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_COPY)); visualActionsGroup.add(new ToggleShowIgnoredAction()); visualActionsGroup.add(new IgnoredSettingsAction()); myToggleDetailsAction = new ToggleDetailsAction(); visualActionsGroup.add(myToggleDetailsAction); visualActionsGroup.add(new ContextHelpAction(ChangesListView.ourHelpId)); toolbarPanel.add( ActionManager.getInstance().createActionToolbar(ActionPlaces.CHANGES_VIEW_TOOLBAR, visualActionsGroup, false).getComponent(), BorderLayout.CENTER); DefaultActionGroup menuGroup = (DefaultActionGroup) ActionManager.getInstance().getAction("ChangesViewPopupMenu"); myView.setMenuActions(menuGroup); myView.setShowFlatten(SHOW_FLATTEN_MODE); myProgressLabel = new JPanel(new BorderLayout()); panel.setToolbar(toolbarPanel); final JPanel content = new JPanel(new BorderLayout()); String value = PropertiesComponent.getInstance().getValue(DETAILS_SPLITTER_PROPORTION); float f = 0.5f; if (! StringUtil.isEmptyOrSpaces(value)) { try { f = Float.parseFloat(value); } catch (NumberFormatException e) { // } } mySplitter = new Splitter(false, f); mySplitter.setHonorComponentsMinimumSize(false); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myView); final JPanel wrapper = new JPanel(new BorderLayout()); wrapper.add(scrollPane, BorderLayout.CENTER); mySplitter.setFirstComponent(wrapper); content.add(mySplitter, BorderLayout.CENTER); content.add(myProgressLabel, BorderLayout.SOUTH); panel.setContent(content); myDiffDetails.getPanel(); myView.installDndSupport(ChangeListManagerImpl.getInstanceImpl(myProject)); myView.addTreeSelectionListener(myTsl); return panel; }
private Content createTerminalInContentPanel(@Nullable LocalTerminalDirectRunner terminalRunner, final @NotNull ToolWindow toolWindow) { SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true) { @Override public Object getData(@NotNull Key<?> dataId) { return PlatformDataKeys.HELP_ID == dataId ? EventLog.HELP_ID : super.getData(dataId); } }; final Content content = ContentFactory.getInstance().createContent(panel, "", false); content.setCloseable(true); myTerminalWidget = terminalRunner.createTerminalWidget(content); myTerminalWidget.addTabListener(new TabbedTerminalWidget.TabListener() { @Override public void tabClosed(JediTermWidget terminal) { UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { if(myTerminalWidget != null) { hideIfNoActiveSessions(toolWindow, myTerminalWidget); } } }); } }); panel.setContent(myTerminalWidget.getComponent()); panel.addFocusListener(createFocusListener()); ActionToolbar toolbar = createToolbar(terminalRunner, myTerminalWidget, toolWindow); toolbar.getComponent().addFocusListener(createFocusListener()); toolbar.setTargetComponent(panel); panel.setToolbar(toolbar.getComponent()); content.setPreferredFocusableComponent(myTerminalWidget.getComponent()); return content; }
private JComponent createChangeViewComponent() { SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true); EmptyAction.registerWithShortcutSet("ChangesView.Refresh", CommonShortcuts.getRerun(), panel); EmptyAction.registerWithShortcutSet("ChangesView.NewChangeList", CommonShortcuts.getNew(), panel); EmptyAction.registerWithShortcutSet("ChangesView.RemoveChangeList", CommonShortcuts.getDelete(), panel); EmptyAction.registerWithShortcutSet(IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST, CommonShortcuts.getMove(), panel); EmptyAction.registerWithShortcutSet("ChangesView.Rename", CommonShortcuts.getRename(), panel); EmptyAction.registerWithShortcutSet("ChangesView.SetDefault", new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.ALT_DOWN_MASK | ctrlMask())), panel); EmptyAction.registerWithShortcutSet("ChangesView.Diff", CommonShortcuts.getDiff(), panel); DefaultActionGroup group = (DefaultActionGroup)ActionManager.getInstance().getAction("ChangesViewToolbar"); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.CHANGES_VIEW_TOOLBAR, group, false); toolbar.setTargetComponent(myView); JComponent toolbarComponent = toolbar.getComponent(); JPanel toolbarPanel = new JPanel(new BorderLayout()); toolbarPanel.add(toolbarComponent, BorderLayout.WEST); DefaultActionGroup visualActionsGroup = new DefaultActionGroup(); final Expander expander = new Expander(); visualActionsGroup.add(CommonActionsManager.getInstance().createExpandAllAction(expander, panel)); visualActionsGroup.add(CommonActionsManager.getInstance().createCollapseAllAction(expander, panel)); ToggleShowFlattenAction showFlattenAction = new ToggleShowFlattenAction(); showFlattenAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_P, ctrlMask())), panel); visualActionsGroup.add(showFlattenAction); visualActionsGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_COPY)); visualActionsGroup.add(new ToggleShowIgnoredAction()); visualActionsGroup.add(new IgnoredSettingsAction()); visualActionsGroup.add(new ToggleDetailsAction()); visualActionsGroup.add(new ContextHelpAction(ChangesListView.HELP_ID)); toolbarPanel.add(ActionManager.getInstance().createActionToolbar(ActionPlaces.CHANGES_VIEW_TOOLBAR, visualActionsGroup, false).getComponent(), BorderLayout.CENTER); myView.setMenuActions((DefaultActionGroup)ActionManager.getInstance().getAction("ChangesViewPopupMenu")); myView.setShowFlatten(myState.myShowFlatten); myProgressLabel = new JPanel(new BorderLayout()); panel.setToolbar(toolbarPanel); final JPanel content = new JPanel(new BorderLayout()); mySplitter = new JBSplitter(false, "ChangesViewManager.DETAILS_SPLITTER_PROPORTION", 0.5f); mySplitter.setHonorComponentsMinimumSize(false); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myView); final JPanel wrapper = new JPanel(new BorderLayout()); wrapper.add(scrollPane, BorderLayout.CENTER); mySplitter.setFirstComponent(wrapper); content.add(mySplitter, BorderLayout.CENTER); content.add(myProgressLabel, BorderLayout.SOUTH); panel.setContent(content); ChangesDnDSupport.install(myProject, myView); myView.addTreeSelectionListener(myTsl); return panel; }
private static Content createContent(final @NotNull RunContentDescriptor contentDescriptor) { SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true); Content content = ContentFactory.SERVICE.getInstance().createContent(panel, contentDescriptor.getDisplayName(), false); content.setCloseable(true); resetContent(contentDescriptor, panel, content); return content; }