@Nullable public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected, final int row, final int column) { TreeTable treeTable = (TreeTable)table; WorkItemsTableModel model = (WorkItemsTableModel)treeTable.getTableModel(); WorkItem workItem = (WorkItem)((DefaultMutableTreeNode)treeTable.getTree().getPathForRow(row).getLastPathComponent()).getUserObject(); CheckinWorkItemAction action = model.getAction(workItem); if (action != null && workItem.isActionPossible(CheckinWorkItemAction.Resolve)) { myComboBox.setSelectedItem(action); return super.getTableCellEditorComponent(table, value, isSelected, row, column); } else { return null; } }
public TestRunResultsView(Project project) { this.model = new ListTreeTableModelOnColumns(null, COLUMNS.toArray(new ColumnInfo[COLUMNS.size()])); this.tree = new TreeTable(this.model); this.tree.getColumnModel().getColumn(0).setMinWidth(TestMeasureColumnInfo.MeasureProperty.GROUP.width * 2); for (TestMeasureColumnInfo.MeasureProperty prop : TestMeasureColumnInfo.MeasureProperty.values()) { //first column is name column which is not included in MeasureProperties, that's why we add 1. this.tree.getColumnModel().getColumn(prop.ordinal() + 1).setMinWidth(prop.width); } this.panel = JBUI.Panels.simplePanel().addToCenter(ScrollPaneFactory.createScrollPane(this.tree)); //set text when no tests were fetched yet this.setEmptyText(Messages.getMessage("execution.result.ui.loading")); //add rightclick dialog DefaultActionGroup dag = new DefaultActionGroup(); dag.add(new OpenInEditorAction(() -> { TestResultNode node = this.getSelectedNode(); if (node != null) { return node.getResult(); } return null; }, project)); PopupHandler.installUnknownPopupHandler(this.tree, dag, ActionManager.getInstance()); }
@Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { final DefaultMutableTreeNode defaultNode = (DefaultMutableTreeNode)((TreeTable)table).getTree(). getPathForRow(row).getLastPathComponent(); myCurrentEditor = null; myCurrentNode = null; if (defaultNode instanceof MyTreeNode) { MyTreeNode node = (MyTreeNode)defaultNode; myCurrentNode = node; if (node.getKey() instanceof BooleanOption) { myCurrentEditor = myBooleanEditor; myBooleanEditor.setSelected(node.getValue() == Boolean.TRUE); myBooleanEditor.setEnabled(node.isEnabled()); } else { myCurrentEditor = myOptionsEditor; myOptionsEditor.setCell(table, row, column); myOptionsEditor.setText(String.valueOf(node.getValue())); myOptionsEditor.setOptions(((SelectionOption)node.getKey()).options); myOptionsEditor.setDefaultValue(node.getValue()); } } myCurrentEditor.setBackground(table.getBackground()); return myCurrentEditor; }
@NotNull private JScrollPane createScrollPane(final JTable table) { if (table instanceof TreeTable) { TreeUtil.expandAll(((TreeTable)table).getTree()); } JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(table); scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); if (table.getSelectedRow() == -1) { table.getSelectionModel().setSelectionInterval(0, 0); } if (table.getRowCount() >= 20) { scrollPane.getViewport().setPreferredSize(new Dimension(table.getPreferredScrollableViewportSize().width, 300)); } else { scrollPane.getViewport().setPreferredSize(table.getPreferredSize()); } if (myAutoselectOnMouseMove) { table.addMouseMotionListener(new MouseMotionAdapter() { boolean myIsEngaged = false; public void mouseMoved(MouseEvent e) { if (myIsEngaged) { int index = table.rowAtPoint(e.getPoint()); table.getSelectionModel().setSelectionInterval(index, index); } else { myIsEngaged = true; } } }); } return scrollPane; }
public static void install(final TreeTable treeTable) { new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { if (ModalityState.current().dominates(ModalityState.NON_MODAL)) return false; if (treeTable.getTree().getPathForLocation(e.getX(), e.getY()) == null) return false; DataContext dataContext = DataManager.getInstance().getDataContext(treeTable); Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) return false; OpenSourceUtil.openSourcesFrom(dataContext, true); return true; } }.installOn(treeTable); }
public void actionPerformed(AnActionEvent e) { Object sourceComponent = getSourceComponent(e); if (sourceComponent instanceof JTree) { performOn((JTree)sourceComponent); } else if (sourceComponent instanceof TreeTable) { performOn(((TreeTable)sourceComponent).getTree()); } }
private static boolean enabledOn(Object sourceComponent) { if (sourceComponent instanceof JTree) { return true; } if (sourceComponent instanceof TreeTable) { return true; } return false; }
@Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { final DefaultMutableTreeNode defaultNode = (DefaultMutableTreeNode)((TreeTable)table).getTree(). getPathForRow(row).getLastPathComponent(); myCurrentEditor = null; myCurrentNode = null; if (defaultNode instanceof MyTreeNode) { MyTreeNode node = (MyTreeNode)defaultNode; myCurrentNode = node; if (node.getKey() instanceof BooleanOption) { myCurrentEditor = myBooleanEditor; myBooleanEditor.setSelected(node.getValue() == Boolean.TRUE); myBooleanEditor.setEnabled(node.isEnabled()); } else if (node.getKey() instanceof IntOption) { IntOption intOption = (IntOption)node.getKey(); myCurrentEditor = myIntOptionsEditor; myIntOptionsEditor.setText(intOption.isDefaultValue(node.getValue()) ? "" : node.getValue().toString()); myIntOptionsEditor.setMinValue(intOption.getMinValue()); myIntOptionsEditor.setMaxValue(intOption.getMaxValue()); myIntOptionsEditor.setDefaultValue(intOption.getDefaultValue()); } else { myCurrentEditor = myOptionsEditor; myOptionsEditor.setCell(table, row, column); myOptionsEditor.setText(String.valueOf(node.getValue())); myOptionsEditor.setOptions(((SelectionOption)node.getKey()).options); myOptionsEditor.setDefaultValue(node.getValue()); } } if (myCurrentEditor != null) { myCurrentEditor.setBackground(table.getBackground()); } return myCurrentEditor; }
public static void adjustTableColumnWidths(TreeTable table) { TableColumnModel columnModel = table.getColumnModel(); FontMetrics fm = table.getFontMetrics(table.getFont()); for (int i = 0; i < table.getColumnCount(); i++) { TableColumn column = columnModel.getColumn(i); column.setPreferredWidth(fm.stringWidth(getSampleTextForColumn(i))); } }
public static void setCellRenderers(TreeTable table) { TableCellRenderer headerRenderer = new TableHeaderCellRenderer(table); for (StatsTableColumn c: StatsTableColumn.values()) { getTableColumn(table, c).setHeaderRenderer(headerRenderer); } TableCellRenderer renderer = new ProfileTimeRenderer(); getTableColumn(table, StatsTableColumn.INVOCATION_COUNT).setCellRenderer(renderer); getTableColumn(table, StatsTableColumn.INCLUSIVE_TIME).setCellRenderer(renderer); getTableColumn(table, StatsTableColumn.EXCLUSIVE_TIME).setCellRenderer(renderer); }
public static void setSpeedSearch(TreeTable treeTable) { new TableSpeedSearch(treeTable) { @Override protected boolean isMatchingElement(Object element, String pattern) { String text = super.getElementText(element); // match search as long as some portion of the text matches the pattern return text != null && text.contains(pattern); } }; }
public static void enableSorting(final TreeTable treeTable, final VmStatsTreeTableModel vmStatsTreeTableModel) { JTableHeader header = treeTable.getTableHeader(); header.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { TableColumnModel columnModel = treeTable.getColumnModel(); int index = columnModel.getColumnIndexAtX(e.getX()); vmStatsTreeTableModel.sortByColumn(StatsTableColumn.fromColumnIndex(index)); } }); }
public static void install(final TreeTable treeTable) { new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { if (ModalityState.current().dominates(ModalityState.NON_MODAL)) return false; if (treeTable.getTree().getPathForLocation(e.getX(), e.getY()) == null) return false; DataContext dataContext = DataManager.getInstance().getDataContext(treeTable); Project project = PlatformDataKeys.PROJECT.getData(dataContext); if (project == null) return false; OpenSourceUtil.openSourcesFrom(dataContext, true); return true; } }.installOn(treeTable); }
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { boolean isEnabled = true; final DefaultMutableTreeNode node = (DefaultMutableTreeNode)((TreeTable)table).getTree(). getPathForRow(row).getLastPathComponent(); if (node instanceof MyTreeNode) { isEnabled = ((MyTreeNode)node).isEnabled(); } Color background = table.getBackground(); if (value instanceof Boolean) { myCheckBox.setSelected(((Boolean)value).booleanValue()); myCheckBox.setBackground(background); myCheckBox.setEnabled(isEnabled); return myCheckBox; } else if (value instanceof String) { /* myComboBox.removeAllItems(); myComboBox.addItem(value); */ myComboBox.setText((String)value); myComboBox.setBackground(background); myComboBox.setEnabled(isEnabled); return myComboBox; } myCheckBox.putClientProperty("JComponent.sizeVariant", "small"); myComboBox.putClientProperty("JComponent.sizeVariant", "small"); myEmptyLabel.setBackground(background); return myEmptyLabel; }
@Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { JTextField stringEditor = (JTextField) getComponent(); final NoSqlTreeNode jsonNode = (NoSqlTreeNode) ((TreeTable) table).getTree(). getPathForRow(row).getLastPathComponent(); stringEditor.setText(String.valueOf(jsonNode.getDescriptor().getValue())); return stringEditor; }
@Nonnull private JScrollPane createScrollPane(final JTable table) { if (table instanceof TreeTable) { TreeUtil.expandAll(((TreeTable)table).getTree()); } JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(table); scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); if (table.getSelectedRow() == -1) { table.getSelectionModel().setSelectionInterval(0, 0); } if (table.getRowCount() >= 20) { scrollPane.getViewport().setPreferredSize(new Dimension(table.getPreferredScrollableViewportSize().width, 300)); } else { scrollPane.getViewport().setPreferredSize(table.getPreferredSize()); } if (myAutoselectOnMouseMove) { table.addMouseMotionListener(new MouseMotionAdapter() { boolean myIsEngaged = false; public void mouseMoved(MouseEvent e) { if (myIsEngaged) { int index = table.rowAtPoint(e.getPoint()); table.getSelectionModel().setSelectionInterval(index, index); } else { myIsEngaged = true; } } }); } return scrollPane; }
public static void install(final TreeTable treeTable) { new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { if (ModalityState.current().dominates(ModalityState.NON_MODAL)) return false; if (treeTable.getTree().getPathForLocation(e.getX(), e.getY()) == null) return false; DataContext dataContext = DataManager.getInstance().getDataContext(treeTable); Project project = dataContext.getData(CommonDataKeys.PROJECT); if (project == null) return false; OpenSourceUtil.openSourcesFrom(dataContext, true); return true; } }.installOn(treeTable); }
@Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { final DefaultMutableTreeNode defaultNode = (DefaultMutableTreeNode)((TreeTable)table).getTree(). getPathForRow(row).getLastPathComponent(); myCurrentEditor = null; myCurrentNode = null; if (defaultNode instanceof MyTreeNode) { MyTreeNode node = (MyTreeNode)defaultNode; myCurrentNode = node; if (node.getKey() instanceof BooleanOption) { myCurrentEditor = myBooleanEditor; myBooleanEditor.setSelected(node.getValue() == Boolean.TRUE); myBooleanEditor.setEnabled(node.isEnabled()); } else if (node.getKey() instanceof IntOption) { IntOption intOption = (IntOption)node.getKey(); myCurrentEditor = myIntOptionsEditor; myIntOptionsEditor.setText(intOption.isDefaultText(node.getValue()) ? "" : node.getValue().toString()); myIntOptionsEditor.setMinValue(intOption.getMinValue()); myIntOptionsEditor.setMaxValue(intOption.getMaxValue()); myIntOptionsEditor.setDefaultValue(intOption.getDefaultValue()); myIntOptionsEditor.setDefaultValueText(intOption.getDefaultValueText()); } else { myCurrentEditor = myOptionsEditor; myOptionsEditor.setCell(table, row, column); myOptionsEditor.setText(String.valueOf(node.getValue())); myOptionsEditor.setOptions(((SelectionOption)node.getKey()).options); myOptionsEditor.setDefaultValue(node.getValue()); } } myCurrentEditor.setBackground(table.getBackground()); return myCurrentEditor; }
public TreeTableSpeedSearch(TreeTable tree, Convertor<TreePath, String> toStringConvertor) { super(tree); myToStringConvertor = toStringConvertor; }
public TreeTableSpeedSearch(TreeTable tree) { this(tree, TreeSpeedSearch.NODE_DESCRIPTOR_TOSTRING); }
@NotNull @Override public Component getTableCellRendererComponent(@NotNull JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { boolean isEnabled = true; final DefaultMutableTreeNode node = (DefaultMutableTreeNode)((TreeTable)table).getTree(). getPathForRow(row).getLastPathComponent(); Option key = null; if (node instanceof MyTreeNode) { isEnabled = ((MyTreeNode)node).isEnabled(); key = ((MyTreeNode)node).getKey(); } if (!table.isEnabled()) { isEnabled = false; } Color background = table.getBackground(); if (value instanceof Boolean) { myCheckBox.setSelected(((Boolean)value).booleanValue()); myCheckBox.setBackground(background); myCheckBox.setEnabled(isEnabled); return myCheckBox; } else if (value instanceof String) { /* myComboBox.removeAllItems(); myComboBox.addItem(value); */ myComboBox.setText((String)value); myComboBox.setBackground(background); myComboBox.setEnabled(isEnabled); return myComboBox; } else if (value instanceof Integer) { if (key instanceof IntOption && ((IntOption)key).isDefaultValue(value)) { myIntLabel.setText(((IntOption)key).getDefaultValueText()); } else { myIntLabel.setText(value.toString()); } return myIntLabel; } myCheckBox.putClientProperty("JComponent.sizeVariant", "small"); myComboBox.putClientProperty("JComponent.sizeVariant", "small"); myEmptyLabel.setBackground(background); return myEmptyLabel; }
private static TableColumn getTableColumn(TreeTable table, StatsTableColumn column) { return table.getColumnModel().getColumn(column.getColumnIndex()); }
public TableHeaderCellRenderer(TreeTable table) { myDefaultRenderer = table.getTableHeader().getDefaultRenderer(); if (myDefaultRenderer instanceof DefaultTableCellRenderer) { ((DefaultTableCellRenderer)myDefaultRenderer).setHorizontalAlignment(SwingConstants.CENTER); } }
private void createUIComponents() { MouseAdapter l = new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (e.getSource() == myCloseLabel) { closeSearchComponent(); } else if (e.getSource() == mySearchLabel) { showSearchComponent(); } else if (e.getSource() == myZoomFitLabel) { myTraceViewCanvas.zoomFit(); } } }; myDefaultHeaderPanel = new EditorHeaderComponent(); mySearchLabel = new JLabel(AllIcons.Actions.Search); mySearchLabel.addMouseListener(l); mySearchLabel.setToolTipText("Find (Ctrl + F)"); myZoomFitLabel = new JLabel(AndroidIcons.ZoomFit); myZoomFitLabel.setToolTipText("Zoom Fit"); myZoomFitLabel.addMouseListener(l); myFindPanel = new EditorHeaderComponent(); myFindFieldWrapper = new NonOpaquePanel(new BorderLayout()); mySearchField = createSearchField(); myFindFieldWrapper.add(mySearchField); myCloseLabel = new JLabel(AllIcons.Actions.Cross); myCloseLabel.addMouseListener(l); myVmStatsTreeTableModel = new VmStatsTreeTableModel(); myTreeTable = new TreeTable(myVmStatsTreeTableModel); myTraceViewCanvas = new TraceViewCanvasWrapper(); JBScrollPane scrollPane = new JBScrollPane(myTreeTable); mySplitter = new JBSplitter(true, 0.75f); mySplitter.setShowDividerControls(true); mySplitter.setShowDividerIcon(true); mySplitter.setFirstComponent(myTraceViewCanvas); mySplitter.setSecondComponent(scrollPane); }
@Override public void navigate(boolean requestFocus) { if (canNavigateToSource()) { super.navigate(requestFocus); return; } DynamicToolWindowWrapper.getInstance(myProject).getToolWindow().activate(new Runnable() { @Override public void run() { DynamicToolWindowWrapper toolWindowWrapper = DynamicToolWindowWrapper.getInstance(myProject); final TreeTable treeTable = toolWindowWrapper.getTreeTable(); final ListTreeTableModelOnColumns model = toolWindowWrapper.getTreeTableModel(); Object root = model.getRoot(); if (root == null || !(root instanceof DefaultMutableTreeNode)) return; DefaultMutableTreeNode treeRoot = ((DefaultMutableTreeNode) root); final PsiClass psiClass = getContainingClassElement(); if (psiClass == null) return; final DefaultMutableTreeNode desiredNode; DPropertyElement dynamicProperty = null; PsiClass trueSuper = null; for (PsiClass aSuper : PsiUtil.iterateSupers(psiClass, true)) { dynamicProperty = DynamicManager.getInstance(myProject).findConcreteDynamicProperty(aSuper.getQualifiedName(), getName()); if (dynamicProperty != null) { trueSuper = aSuper; break; } } if (trueSuper == null) return; final DefaultMutableTreeNode classNode = TreeUtil.findNodeWithObject(treeRoot, new DClassElement(myProject, trueSuper.getQualifiedName())); if (classNode == null) return; desiredNode = TreeUtil.findNodeWithObject(classNode, dynamicProperty); if (desiredNode == null) return; final TreePath path = TreeUtil.getPathFromRoot(desiredNode); treeTable.getTree().expandPath(path); treeTable.getTree().setSelectionPath(path); treeTable.getTree().fireTreeExpanded(path); ToolWindowManager.getInstance(myProject).getFocusManager().requestFocus(treeTable, true); treeTable.revalidate(); treeTable.repaint(); } }, true); }
@Override public void navigate(boolean requestFocus) { DynamicToolWindowWrapper.getInstance(getProject()).getToolWindow().activate(new Runnable() { @Override public void run() { DynamicToolWindowWrapper toolWindowWrapper = DynamicToolWindowWrapper.getInstance(getProject()); final TreeTable treeTable = toolWindowWrapper.getTreeTable(); final ListTreeTableModelOnColumns model = toolWindowWrapper.getTreeTableModel(); Object root = model.getRoot(); if (root == null || !(root instanceof DefaultMutableTreeNode)) return; DefaultMutableTreeNode treeRoot = ((DefaultMutableTreeNode) root); DefaultMutableTreeNode desiredNode; JavaPsiFacade facade = JavaPsiFacade.getInstance(getProject()); final PsiClassType fqClassName = facade.getElementFactory().createTypeByFQClassName(myContainingClassName, ProjectScope.getAllScope(getProject())); final PsiClass psiClass = fqClassName.resolve(); if (psiClass == null) return; PsiClass trueClass = null; DMethodElement methodElement = null; final GrParameter[] parameters = getParameters(); List<String> parameterTypes = new ArrayList<String>(); for (GrParameter parameter : parameters) { final String type = parameter.getType().getCanonicalText(); parameterTypes.add(type); } for (PsiClass aSuper : PsiUtil.iterateSupers(psiClass, true)) { methodElement = DynamicManager.getInstance(getProject()).findConcreteDynamicMethod(aSuper.getQualifiedName(), getName(), ArrayUtil.toStringArray(parameterTypes)); if (methodElement != null) { trueClass = aSuper; break; } } if (trueClass == null) return; final DefaultMutableTreeNode classNode = TreeUtil.findNodeWithObject(treeRoot, new DClassElement(getProject(), trueClass.getQualifiedName())); if (classNode == null) return; desiredNode = TreeUtil.findNodeWithObject(classNode, methodElement); if (desiredNode == null) return; final TreePath path = TreeUtil.getPathFromRoot(desiredNode); treeTable.getTree().expandPath(path); treeTable.getTree().setSelectionPath(path); treeTable.getTree().fireTreeExpanded(path); // ToolWindowManager.getInstance(myProject).getFocusManager().requestFocus(treeTable, true); treeTable.revalidate(); treeTable.repaint(); } }, true); }
public TreeTable getTreeTable() { getToolWindow(); return myTreeTable; }
public void navigate(boolean requestFocus) { if (canNavigateToSource()) { super.navigate(requestFocus); return; } DynamicToolWindowWrapper.getInstance(myProject).getToolWindow().activate(new Runnable() { public void run() { DynamicToolWindowWrapper toolWindowWrapper = DynamicToolWindowWrapper.getInstance(myProject); final TreeTable treeTable = toolWindowWrapper.getTreeTable(); final ListTreeTableModelOnColumns model = toolWindowWrapper.getTreeTableModel(); Object root = model.getRoot(); if (root == null || !(root instanceof DefaultMutableTreeNode)) return; DefaultMutableTreeNode treeRoot = ((DefaultMutableTreeNode) root); final PsiClass psiClass = getContainingClassElement(); if (psiClass == null) return; final DefaultMutableTreeNode desiredNode; DPropertyElement dynamicProperty = null; PsiClass trueSuper = null; for (PsiClass aSuper : PsiUtil.iterateSupers(psiClass, true)) { dynamicProperty = DynamicManager.getInstance(myProject).findConcreteDynamicProperty(aSuper.getQualifiedName(), getName()); if (dynamicProperty != null) { trueSuper = aSuper; break; } } if (trueSuper == null) return; final DefaultMutableTreeNode classNode = TreeUtil.findNodeWithObject(treeRoot, new DClassElement(myProject, trueSuper.getQualifiedName())); if (classNode == null) return; desiredNode = TreeUtil.findNodeWithObject(classNode, dynamicProperty); if (desiredNode == null) return; final TreePath path = TreeUtil.getPathFromRoot(desiredNode); treeTable.getTree().expandPath(path); treeTable.getTree().setSelectionPath(path); treeTable.getTree().fireTreeExpanded(path); ToolWindowManager.getInstance(myProject).getFocusManager().requestFocus(treeTable, true); treeTable.revalidate(); treeTable.repaint(); } }, true); }
public void navigate(boolean requestFocus) { DynamicToolWindowWrapper.getInstance(getProject()).getToolWindow().activate(new Runnable() { public void run() { DynamicToolWindowWrapper toolWindowWrapper = DynamicToolWindowWrapper.getInstance(getProject()); final TreeTable treeTable = toolWindowWrapper.getTreeTable(); final ListTreeTableModelOnColumns model = toolWindowWrapper.getTreeTableModel(); Object root = model.getRoot(); if (root == null || !(root instanceof DefaultMutableTreeNode)) return; DefaultMutableTreeNode treeRoot = ((DefaultMutableTreeNode) root); DefaultMutableTreeNode desiredNode; JavaPsiFacade facade = JavaPsiFacade.getInstance(getProject()); final PsiClassType fqClassName = facade.getElementFactory().createTypeByFQClassName(myContainingClassName, ProjectScope.getAllScope(getProject())); final PsiClass psiClass = fqClassName.resolve(); if (psiClass == null) return; PsiClass trueClass = null; DMethodElement methodElement = null; final GrParameter[] parameters = getParameters(); List<String> parameterTypes = new ArrayList<String>(); for (GrParameter parameter : parameters) { final String type = parameter.getType().getCanonicalText(); parameterTypes.add(type); } for (PsiClass aSuper : PsiUtil.iterateSupers(psiClass, true)) { methodElement = DynamicManager.getInstance(getProject()).findConcreteDynamicMethod(aSuper.getQualifiedName(), getName(), ArrayUtil.toStringArray(parameterTypes)); if (methodElement != null) { trueClass = aSuper; break; } } if (trueClass == null) return; final DefaultMutableTreeNode classNode = TreeUtil.findNodeWithObject(treeRoot, new DClassElement(getProject(), trueClass.getQualifiedName())); if (classNode == null) return; desiredNode = TreeUtil.findNodeWithObject(classNode, methodElement); if (desiredNode == null) return; final TreePath path = TreeUtil.getPathFromRoot(desiredNode); treeTable.getTree().expandPath(path); treeTable.getTree().setSelectionPath(path); treeTable.getTree().fireTreeExpanded(path); // ToolWindowManager.getInstance(myProject).getFocusManager().requestFocus(treeTable, true); treeTable.revalidate(); treeTable.repaint(); } }, true); }
@Nonnull @Override public Component getTableCellRendererComponent(@Nonnull JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { boolean isEnabled = true; final DefaultMutableTreeNode node = (DefaultMutableTreeNode)((TreeTable)table).getTree(). getPathForRow(row).getLastPathComponent(); if (node instanceof MyTreeNode) { isEnabled = ((MyTreeNode)node).isEnabled(); } if (!table.isEnabled()) { isEnabled = false; } Color background = table.getBackground(); if (value instanceof Boolean) { myCheckBox.setSelected(((Boolean)value).booleanValue()); myCheckBox.setBackground(background); myCheckBox.setEnabled(isEnabled); return myCheckBox; } else if (value instanceof String) { /* myComboBox.removeAllItems(); myComboBox.addItem(value); */ myComboBox.setText((String)value); myComboBox.setBackground(background); myComboBox.setEnabled(isEnabled); return myComboBox; } else if (value instanceof Integer) { myIntLabel.setText(value.toString()); return myIntLabel; } myCheckBox.putClientProperty("JComponent.sizeVariant", "small"); myComboBox.putClientProperty("JComponent.sizeVariant", "small"); myEmptyLabel.setBackground(background); return myEmptyLabel; }