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);
}
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;
}
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;
}
};
}
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);
}
Aggregations