Search in sources :

Example 6 with CompilerOptionInfo

use of com.intellij.flex.model.bc.CompilerOptionInfo in project intellij-plugins by JetBrains.

the class CompilerOptionsConfigurable method updateTreeTable.

private void updateTreeTable() {
    final TreeTableTree tree = myTreeTable.getTree();
    final TreePath selectionPath = tree.getSelectionPath();
    final List<TreePath> expandedPaths = TreeUtil.collectExpandedPaths(tree);
    final DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel();
    final DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) treeModel.getRoot();
    final CompilerOptionInfo[] optionInfos = CompilerOptionInfo.getRootInfos();
    final boolean showAll = myShowAllOptionsCheckBox.isSelected();
    updateChildNodes(rootNode, optionInfos, showAll);
    treeModel.reload(rootNode);
    TreeUtil.restoreExpandedPaths(tree, expandedPaths);
    tree.setSelectionPath(selectionPath);
}
Also used : TreePath(javax.swing.tree.TreePath) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CompilerOptionInfo(com.intellij.flex.model.bc.CompilerOptionInfo) TreeTableTree(com.intellij.ui.treeStructure.treetable.TreeTableTree) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 7 with CompilerOptionInfo

use of com.intellij.flex.model.bc.CompilerOptionInfo in project intellij-plugins by JetBrains.

the class CompilerOptionsConfigurable method navigateTo.

public ActionCallback navigateTo(@Nullable final Place place, final boolean requestFocus) {
    if (place != null) {
        final Object location = place.getPath(FlexBCConfigurable.LOCATION_ON_TAB);
        if (location instanceof Location) {
            switch((Location) location) {
                case AdditionalConfigFile:
                    return IdeFocusManager.findInstance().requestFocus(myConfigFileTextWithBrowse.getChildComponent(), true);
                case FilesToIncludeInSwc:
                    return IdeFocusManager.findInstance().requestFocus(myIncludeInSWCField.getChildComponent(), true);
                case ConditionalCompilerDefinition:
                    final DefaultMutableTreeNode root = (DefaultMutableTreeNode) myTreeTable.getTree().getModel().getRoot();
                    final CompilerOptionInfo info = CompilerOptionInfo.getOptionInfo("compiler.define");
                    final DefaultMutableTreeNode node = findChildNodeWithInfo(root, info);
                    if (node != null) {
                        myTreeTable.clearSelection();
                        myTreeTable.addSelectedPath(TreeUtil.getPath(root, node));
                        final Object ccdName = place.getPath(CONDITIONAL_COMPILER_DEFINITION_NAME);
                        if (ccdName instanceof String) {
                            TableUtil.editCellAt(myTreeTable, myTreeTable.getSelectedRow(), 1);
                            final Component editor = myTreeTable.getEditorComponent();
                            if (editor instanceof RepeatableValueEditor) {
                                ((RepeatableValueEditor) editor).setAutoAddConditionalCompilerDefinition((String) ccdName);
                                ((RepeatableValueEditor) editor).getButton().doClick();
                            }
                        }
                    }
                    break;
            }
        }
    }
    return ActionCallback.DONE;
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CompilerOptionInfo(com.intellij.flex.model.bc.CompilerOptionInfo)

Example 8 with CompilerOptionInfo

use of com.intellij.flex.model.bc.CompilerOptionInfo in project intellij-plugins by JetBrains.

the class CompilerOptionsConfigurable method createTreeCellRenderer.

private TreeCellRenderer createTreeCellRenderer() {
    return new TreeCellRenderer() {

        private final JLabel myLabel = new JLabel();

        public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
            final Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
            if (!(userObject instanceof CompilerOptionInfo)) {
                // invisible root node
                return myLabel;
            }
            final CompilerOptionInfo info = (CompilerOptionInfo) userObject;
            myLabel.setText(info.DISPLAY_NAME);
            final ValueSource valueSource = getValueAndSource(info).second;
            renderAccordingToSource(myLabel, valueSource, selected);
            myLabel.setForeground(selected ? UIUtil.getTableSelectionForeground() : UIUtil.getTableForeground());
            return myLabel;
        }
    };
}
Also used : TreeCellRenderer(javax.swing.tree.TreeCellRenderer) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CompilerOptionInfo(com.intellij.flex.model.bc.CompilerOptionInfo) ValueSource(com.intellij.flex.model.bc.ValueSource)

Example 9 with CompilerOptionInfo

use of com.intellij.flex.model.bc.CompilerOptionInfo in project intellij-plugins by JetBrains.

the class CompilerOptionsConfigurable method reloadNodeOrGroup.

private static void reloadNodeOrGroup(final JTree tree, final DefaultMutableTreeNode treeNode) {
    DefaultMutableTreeNode nodeToRefresh = treeNode;
    DefaultMutableTreeNode parent;
    while ((parent = ((DefaultMutableTreeNode) nodeToRefresh.getParent())).getUserObject() instanceof CompilerOptionInfo) {
        nodeToRefresh = parent;
    }
    ((DefaultTreeModel) tree.getModel()).reload(nodeToRefresh);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CompilerOptionInfo(com.intellij.flex.model.bc.CompilerOptionInfo) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Aggregations

CompilerOptionInfo (com.intellij.flex.model.bc.CompilerOptionInfo)9 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)7 ValueSource (com.intellij.flex.model.bc.ValueSource)4 Sdk (com.intellij.openapi.projectRoots.Sdk)2 ComponentWithBrowseButton (com.intellij.openapi.ui.ComponentWithBrowseButton)2 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)2 ListTreeTableModel (com.intellij.ui.treeStructure.treetable.ListTreeTableModel)2 TreeTableModel (com.intellij.ui.treeStructure.treetable.TreeTableModel)2 AbstractTableCellEditor (com.intellij.util.ui.AbstractTableCellEditor)2 ColumnInfo (com.intellij.util.ui.ColumnInfo)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 TableCellRenderer (javax.swing.table.TableCellRenderer)2 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)2 CompilerUIConfigurable (com.intellij.compiler.options.CompilerUIConfigurable)1 BuildConfigurationNature (com.intellij.flex.model.bc.BuildConfigurationNature)1 FlexBundle (com.intellij.lang.javascript.flex.FlexBundle)1 FlexUtils (com.intellij.lang.javascript.flex.FlexUtils)1 FlexProjectLevelCompilerOptionsHolder (com.intellij.lang.javascript.flex.projectStructure.FlexProjectLevelCompilerOptionsHolder)1 CompilerOptions (com.intellij.lang.javascript.flex.projectStructure.model.CompilerOptions)1