com.intellij.ui.components.JBTabbedPane Java Examples

The following examples show how to use com.intellij.ui.components.JBTabbedPane. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CmtFileEditor.java    From reasonml-idea-plugin with MIT License 6 votes vote down vote up
@NotNull
@Override
public JComponent getComponent() {
    m_rootTabbedPane = new JBTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);

    InsightManager insightManager = ServiceManager.getService(m_project, InsightManager.class);
    List<String> meta = insightManager.dumpMeta(m_file);
    String xmlSource = insightManager.dumpTree(m_file);
    List<String> types = insightManager.dumpInferredTypes(m_file);

    m_rootTabbedPane.addTab("Meta", AllIcons.Nodes.DataTables, new JBScrollPane(new Table(new MetaTableModel(meta))));
    m_rootTabbedPane.addTab("AST", AllIcons.FileTypes.Xml, new CmtXmlComponent(m_project, m_rootTabbedPane, xmlSource));
    m_rootTabbedPane.addTab("Inferred", AllIcons.Nodes.DataSchema, new JBScrollPane(new Table(new InferredTableModel(types))));

    return m_rootTabbedPane;
}
 
Example #2
Source File: PreviewPanel.java    From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private JTabbedPane createParseTreeAndProfileTabbedPanel() {
	JBTabbedPane tabbedPane = new JBTabbedPane();

	LOG.info("createParseTreePanel" + " " + project.getName());
	Pair<UberTreeViewer, JPanel> pair = createParseTreePanel();
	treeViewer = pair.a;
	setupContextMenu(treeViewer);
	tabbedPane.addTab("Parse tree", pair.b);

	hierarchyViewer = new HierarchyViewer(null, this);
	tabbedPane.addTab("Hierarchy", hierarchyViewer);

	profilerPanel = new ProfilerPanel(project, this);
	tabbedPane.addTab("Profiler", profilerPanel.getComponent());

	return tabbedPane;
}
 
Example #3
Source File: GlassPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
private Area getComponentArea(final JComponent surfaceComponent, final JComponent lightComponent) {
  if (!lightComponent.isShowing()) return null;

  final Point panelPoint = SwingUtilities.convertPoint(lightComponent, new Point(0, 0), surfaceComponent);
  final int x = panelPoint.x;
  final int y = panelPoint.y;

  Insets insetsToIgnore = lightComponent.getInsets();
  final boolean isWithBorder = Boolean.TRUE.equals(lightComponent.getClientProperty(SearchUtil.HIGHLIGHT_WITH_BORDER));
  final boolean isLabelFromTabbedPane = Boolean.TRUE.equals(lightComponent.getClientProperty(JBTabbedPane.LABEL_FROM_TABBED_PANE));

  if ((insetsToIgnore == null || (UIUtil.isUnderAquaLookAndFeel() && lightComponent instanceof JButton)) || isWithBorder) {
    insetsToIgnore = EMPTY_INSETS;
  }

  int hInset = isWithBorder ? 7 : isLabelFromTabbedPane ? 20 : 7;
  int vInset = isWithBorder ? 1 : isLabelFromTabbedPane ? 10 : 5;
  final Area area = new Area(new RoundRectangle2D.Double(x - hInset + insetsToIgnore.left,
                                                         y - vInset + insetsToIgnore.top,
                                                         lightComponent.getWidth() + hInset * 2 - insetsToIgnore.right - insetsToIgnore.left,
                                                         lightComponent.getHeight() + vInset * 2 - insetsToIgnore.top - insetsToIgnore.bottom,
                                                         6, 6));
  return area;
}
 
Example #4
Source File: RefactoringsPanel.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
/**
 * Adds a panel for each code smell to the main panel.
 *
 * @param project current project.
 */
private void addRefactoringPanels(Project project) {
    JTabbedPane jTabbedPane = new JBTabbedPane();
    jTabbedPane.add(IntelliJDeodorantBundle.message("feature.envy.smell.name"), new MoveMethodPanel(new AnalysisScope(project)));
    jTabbedPane.add(IntelliJDeodorantBundle.message("long.method.smell.name"), new ExtractMethodPanel(new AnalysisScope(project)));
    jTabbedPane.add(IntelliJDeodorantBundle.message("god.class.smell.name"), new GodClassPanel(new AnalysisScope(project)));
    jTabbedPane.add(IntelliJDeodorantBundle.message("type.state.checking.smell.name"), new TypeCheckingPanel(new AnalysisScope(project)));
    setContent(jTabbedPane);
}
 
Example #5
Source File: CmtXmlComponent.java    From reasonml-idea-plugin with MIT License 5 votes vote down vote up
@Override
public void stateChanged(ChangeEvent changeEvent) {
    Object source = changeEvent.getSource();
    if (source instanceof JBTabbedPane) {
        if (((JBTabbedPane) source).getSelectedComponent() == this) {
            ensureChildrenAdded();
        }
    }
}
 
Example #6
Source File: ColumnEditorFrame.java    From CodeGen with MIT License 5 votes vote down vote up
private void init(IdeaContext ideaContext, List<Table> tables){
    setLayout(new BorderLayout());
    JBTabbedPane tabbedPane = new JBTabbedPane();

    for (Table table: tables) {
        TablePanel tablePanel = new TablePanel(table);
        tabbedPane.add(tablePanel.getRootComponent(), table.getTableName());
        panels.add(tablePanel);
    }

    List<CodeRoot> codeRoots =  SETTING_MANAGER.getTemplates().getRoots();
    SelectGroupPanel selectGroupPanel = new SelectGroupPanel(codeRoots, ideaContext.getProject());
    generateAction = it -> {
        if(selectGroupPanel.hasSelected()) {
            List<CodeContext> contexts = new ArrayList<>();

            for (TablePanel panel: panels) {
                String modelName = panel.getModelTextField().getText().trim();
                String tableName = panel.getTableTextField().getText().trim();
                String comment = panel.getCommentTextField().getText().trim();
                // 组装数据
                CodeContext context = new CodeContext(modelName, tableName, comment, panel.getFields());
                contexts.add(context);
            }
            GuiUtil.generateFile(ideaContext, contexts, selectGroupPanel.getGroupPathMap());
            dispose();
        }
    };

    add(tabbedPane, BorderLayout.CENTER);
    selectGroupPanel.getRootPanel().setBorder(BorderFactory.createEmptyBorder(0, 15, 10, 15));
    add(selectGroupPanel.getRootPanel(), BorderLayout.SOUTH);
}
 
Example #7
Source File: LibraryDialog.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
public void buildView() {
    setTitle(Localizer.get("title.LibraryDialog"));
    panel.setBackground(JBColor.BLUE);

    tabbedPane = new JBTabbedPane();
    panel.add(tabbedPane, new CC().push().grow());

    initBinaryFilesTab();
    initSecondTab();
}
 
Example #8
Source File: BlazeAndroidBinaryRunConfigurationStateEditor.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public JComponent createComponent() {
  // old
  // return UiUtil.createBox(commonStateEditor.createComponent(), mainContainer);
  JBTabbedPane tabbedPane = new JBTabbedPane();
  JComponent generalPanel = UiUtil.createBox(commonStateEditor.createComponent(), mainContainer);
  generalPanel.setOpaque(true);
  tabbedPane.addTab("General", generalPanel);
  if (profilersPanelCompat.getPanel() != null) {
    tabbedPane.addTab("Profiler", profilersPanelCompat.getPanel().getComponent());
  }
  return UiUtil.createBox(tabbedPane);
}
 
Example #9
Source File: SlingPluginToolWindowFactory.java    From aem-ide-tooling-4-intellij with Apache License 2.0 5 votes vote down vote up
public void createToolWindowContent(final Project project, final ToolWindow toolWindow) {
    // Plugin is now placed into a Tabbed Pane to add additional views to it
    JBTabbedPane master = new JBTabbedPane(SwingConstants.BOTTOM);
    SlingPluginExplorer explorer = new SlingPluginExplorer(project);
    LOGGER.debug("CTWC: Explorer: '" + explorer + "'");
    master.insertTab("Plugin", null, explorer, "Plugin Windows", 0);

    WebContentFXPanel info = new WebContentFXPanel();
    master.insertTab("Info", null, info, "Plugin Info", 1);

    final AemdcPanel aemdcPanel = ComponentProvider.getComponent(project, AemdcPanel.class);
    LOGGER.debug("AEMDC Panel found: '{}'", aemdcPanel);
    aemdcPanel.setContainer(master);

    final ContentManager contentManager = toolWindow.getContentManager();
    final Content content = contentManager.getFactory().createContent(master, null, false);
    contentManager.addContent(content);
    Disposer.register(project, explorer);

    final ToolWindowManagerAdapter listener = new ToolWindowManagerAdapter() {
        boolean wasVisible = false;

        @Override
        public void stateChanged() {
            if (toolWindow.isDisposed()) {
                return;
            }
            boolean visible = toolWindow.isVisible();
            // If the Plugin became visible then we let the AEMDC Panel know to recrate the JFX Panel
            // to avoid the double buffering
            if(!wasVisible && visible) {
                aemdcPanel.reset();
            }
            wasVisible = visible;
        }
    };
    final ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(project);
    manager.addToolWindowManagerListener(listener, project);
}
 
Example #10
Source File: CmtXmlComponent.java    From reasonml-idea-plugin with MIT License 4 votes vote down vote up
public CmtXmlComponent(@NotNull Project project, @NotNull JBTabbedPane rootTabbedPane, @NotNull String xmlDump) {
    m_project = project;
    m_xmlDump = xmlDump;
    rootTabbedPane.addChangeListener(this);
}
 
Example #11
Source File: AemdcPanel.java    From aem-ide-tooling-4-intellij with Apache License 2.0 4 votes vote down vote up
public void setContainer(JBTabbedPane container) {
    this.container = container;
}
 
Example #12
Source File: MainWindowBase.java    From KodeBeagle with Apache License 2.0 4 votes vote down vote up
@Override
public final void createToolWindowContent(final Project project, final ToolWindow toolWindow) {

    initSystemInfo();
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(PROJECTS);
    JTree jTree = new Tree(root);
    jTree.setRootVisible(false);
    jTree.setAutoscrolls(true);

    if (!propertiesComponent.isValueSet(Identity.BEAGLE_ID)) {
        windowObjects.setBeagleId(UUID.randomUUID().toString());
        propertiesComponent.setValue(Identity.BEAGLE_ID,
                windowObjects.getBeagleId());
    } else {
        windowObjects.setBeagleId(propertiesComponent.getValue(Identity.BEAGLE_ID));
    }

    Document document = new DocumentImpl("", true, false);
    Editor windowEditor =
            EditorFactory.getInstance().createEditor(
                    document, project, FileTypeManager.getInstance()
                            .getFileTypeByExtension(JAVA),
                    false);
    //Dispose the editor once it's no longer needed
    windowEditorOps.releaseEditor(project, windowEditor);
    windowObjects.setTree(jTree);
    windowObjects.setWindowEditor(windowEditor);

    final JComponent toolBar = setUpToolBar();

    JBScrollPane jTreeScrollPane = new JBScrollPane();
    jTreeScrollPane.getViewport().setBackground(JBColor.white);
    jTreeScrollPane.setAutoscrolls(true);
    jTreeScrollPane.setBackground(JBColor.white);
    windowObjects.setJTreeScrollPane(jTreeScrollPane);

    final JSplitPane jSplitPane = new JSplitPane(
            JSplitPane.VERTICAL_SPLIT, jTreeScrollPane, windowEditor.getComponent());
    jSplitPane.setResizeWeight(DIVIDER_LOCATION);

    JPanel editorPanel = new JPanel();
    editorPanel.setOpaque(true);
    editorPanel.setBackground(JBColor.white);
    editorPanel.setLayout(new BoxLayout(editorPanel, BoxLayout.Y_AXIS));

    final JBScrollPane editorScrollPane = new JBScrollPane();
    editorScrollPane.getViewport().setBackground(JBColor.white);
    editorScrollPane.setViewportView(editorPanel);
    editorScrollPane.setPreferredSize(new Dimension(EDITOR_SCROLL_PANE_WIDTH,
            EDITOR_SCROLL_PANE_HEIGHT));
    editorScrollPane.getVerticalScrollBar().setUnitIncrement(UNIT_INCREMENT);
    editorScrollPane.setHorizontalScrollBarPolicy(JBScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    windowObjects.setPanel(editorPanel);

    final JTabbedPane jTabbedPane = new JBTabbedPane();
    jTabbedPane.add(SPOTLIGHT_TAB, editorScrollPane);
    jTabbedPane.add(ALL_TAB, jSplitPane);
    windowObjects.setjTabbedPane(jTabbedPane);
    final Editor projectEditor = FileEditorManager.getInstance(project).getSelectedTextEditor();
    // Display initial help information here.
    if (projectEditor != null) {
        uiUtils.showHelpInfo(RefreshActionBase.HELP_MESSAGE_NO_SELECTED_CODE);
    } else {
        uiUtils.showHelpInfo(RefreshActionBase.EDITOR_ERROR);
    }
    final JPanel mainPanel = new JPanel();
    mainPanel.setLayout((new BoxLayout(mainPanel, BoxLayout.Y_AXIS)));
    mainPanel.add(toolBar);
    mainPanel.add(jTabbedPane);

    if (!LegalNotice.isLegalNoticeAccepted()) {
        new LegalNotice(project).showLegalNotice();
    }
    toolWindow.getComponent().getParent().add(mainPanel);
}
 
Example #13
Source File: TabbedRefreshablePanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
public TabbedRefreshablePanel() {
  myPanels = new ArrayList<RefreshablePanel>();
  myPane = new JBTabbedPane();
  myPanel = new JPanel(new BorderLayout());
  myPanel.add(myPane, BorderLayout.CENTER);
}
 
Example #14
Source File: SelectLocalReferencePointRepresentationPage.java    From saros with GNU General Public License v2.0 3 votes vote down vote up
public SelectLocalReferencePointRepresentationPage(
    String id, PageActionListener pageActionListener, Set<String> referencePointNames) {

  super(id, pageActionListener);

  tabbedBasePane = new JBTabbedPane();
  referencePointTabs = new HashMap<>();
  referencePointTabStateListener = new ReferencePointTabStateListener();

  referencePointNames.forEach(this::addReferencePointTab);

  add(tabbedBasePane);
}