Skip to content

Commit

Permalink
Merge pull request #283 from parrt/fix-277
Browse files Browse the repository at this point in the history
Fixes #277.
  • Loading branch information
parrt authored Nov 5, 2016
2 parents a23ae8b + 61b17c9 commit 266da90
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@ public ConfigANTLRPerGrammar(final Project project, String qualFileName) {
}

public static String getOutputDirName(Project project, String qualFileName, VirtualFile contentRoot, String package_) {
String outputDirName = contentRoot.getPath()+File.separator+RunANTLROnGrammarFile.OUTPUT_DIR_NAME;
outputDirName = getProp(project, qualFileName, PROP_OUTPUT_DIR, outputDirName);
String outputDirName = getProp(project, qualFileName,
PROP_OUTPUT_DIR,
RunANTLROnGrammarFile.OUTPUT_DIR_NAME);
File f = new File(outputDirName);
if ( !f.isAbsolute() ) { // if not absolute file spec, it's relative to project root
outputDirName = contentRoot.getPath()+File.separator+outputDirName;
}
// add package if any
if ( package_!=RunANTLROnGrammarFile.MISSING ) {
outputDirName += File.separator+package_.replace('.', File.separatorChar);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,14 @@ public static Map<String,String> getANTLRArgs(Project project, VirtualFile vfile
String outputDirName = ConfigANTLRPerGrammar.getOutputDirName(project, qualFileName, contentRoot, package_);
args.put("-o", outputDirName);

String libDir = ConfigANTLRPerGrammar.getProp(project, qualFileName, ConfigANTLRPerGrammar.PROP_LIB_DIR, sourcePath);
String libDir = ConfigANTLRPerGrammar.getProp(project,
qualFileName,
ConfigANTLRPerGrammar.PROP_LIB_DIR,
sourcePath);
File f = new File(libDir);
if ( !f.isAbsolute() ) { // if not absolute file spec, it's relative to project root
libDir = contentRoot.getPath()+File.separator+libDir;
}
args.put("-lib", libDir);

String encoding = ConfigANTLRPerGrammar.getProp(project, qualFileName, ConfigANTLRPerGrammar.PROP_ENCODING, MISSING);
Expand Down
48 changes: 17 additions & 31 deletions src/java/org/antlr/intellij/plugin/preview/InputPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -869,53 +869,39 @@ public static String getErrorDisplayString(SyntaxError e) {
* @noinspection ALL
*/
private void $$$setupUI$$$() {
outerMostPanel = new JPanel();
outerMostPanel.setLayout(new BorderLayout(0, 0));
outerMostPanel.setMinimumSize(new Dimension(100, 70));
outerMostPanel.setPreferredSize(new Dimension(200, 100));
startRuleAndInputPanel = new JPanel();
startRuleAndInputPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0));
startRuleAndInputPanel.setMinimumSize(new Dimension(233, 60));
outerMostPanel = new javax.swing.JPanel();
outerMostPanel.setLayout(new java.awt.BorderLayout(0, 0));
startRuleAndInputPanel = new javax.swing.JPanel();
startRuleAndInputPanel.setLayout(new java.awt.FlowLayout(FlowLayout.CENTER, 5, 0));
outerMostPanel.add(startRuleAndInputPanel, BorderLayout.NORTH);
startRuleAndInputPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null));
startRuleLabel = new JLabel();
startRuleLabel.setText("Label");
startRuleAndInputPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), null));
startRuleLabel = new javax.swing.JLabel();
startRuleAndInputPanel.add(startRuleLabel);
radioButtonPanel = new JPanel();
radioButtonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
radioButtonPanel = new javax.swing.JPanel();
radioButtonPanel.setLayout(new java.awt.FlowLayout(FlowLayout.CENTER, 5, 5));
startRuleAndInputPanel.add(radioButtonPanel);
inputRadioButton = new JRadioButton();
inputRadioButton.setSelected(true);
inputRadioButton.setText("Input");
inputRadioButton = new javax.swing.JRadioButton();
radioButtonPanel.add(inputRadioButton);
fileRadioButton = new JRadioButton();
fileRadioButton.setText("File");
fileRadioButton = new javax.swing.JRadioButton();
radioButtonPanel.add(fileRadioButton);
fileChooser = new TextFieldWithBrowseButton();
fileChooser = new com.intellij.openapi.ui.TextFieldWithBrowseButton();
radioButtonPanel.add(fileChooser);
placeHolder = new JTextArea();
placeHolder.setBackground(Color.lightGray);
placeHolder.setEditable(false);
placeHolder.setEnabled(true);
placeHolder.setText("");
placeHolder = new javax.swing.JTextArea();
outerMostPanel.add(placeHolder, BorderLayout.WEST);
final JScrollPane scrollPane1 = new JScrollPane();
final javax.swing.JScrollPane scrollPane1 = new javax.swing.JScrollPane();
outerMostPanel.add(scrollPane1, BorderLayout.SOUTH);
errorConsole = new JTextArea();
errorConsole.setEditable(false);
errorConsole.setLineWrap(true);
errorConsole.setRows(3);
errorConsole = new javax.swing.JTextArea();
scrollPane1.setViewportView(errorConsole);
ButtonGroup buttonGroup;
buttonGroup = new ButtonGroup();
javax.swing.ButtonGroup buttonGroup;
buttonGroup = new javax.swing.ButtonGroup();
buttonGroup.add(fileRadioButton);
buttonGroup.add(inputRadioButton);
}

/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
public javax.swing.JComponent $$$getRootComponent$$$() {
return outerMostPanel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBList;
import com.intellij.ui.components.JBPanel;
import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
import com.intellij.util.containers.Predicate;
import org.antlr.intellij.plugin.Utils;
import org.antlr.intellij.plugin.parsing.ParsingUtils;
Expand Down Expand Up @@ -449,38 +446,32 @@ private void onOK() {
* @noinspection ALL
*/
private void $$$setupUI$$$() {
contentPane = new JPanel();
contentPane.setLayout(new GridLayoutManager(3, 1, new Insets(10, 10, 10, 10), -1, -1));
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(1, 4, new Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK|GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false));
final Spacer spacer1 = new Spacer();
panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JPanel panel2 = new JPanel();
panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
panel1.add(panel2, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK|GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK|GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
buttonOK = new JButton();
buttonOK.setText("OK");
panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK|GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
ambigPhraseLabel = new JLabel();
ambigPhraseLabel.setFont(new Font(ambigPhraseLabel.getFont().getName(), Font.BOLD, ambigPhraseLabel.getFont().getSize()));
ambigPhraseLabel.setText("ambiguity");
panel1.add(ambigPhraseLabel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer2 = new Spacer();
panel1.add(spacer2, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
treeScrollPane = new JScrollPane();
contentPane.add(treeScrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK|GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK|GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
treeSizeSlider = new JSlider();
treeSizeSlider.setMaximum(1000);
treeSizeSlider.setMinimum(-400);
treeSizeSlider.setValue(0);
contentPane.add(treeSizeSlider, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
contentPane = new javax.swing.JPanel();
contentPane.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(3, 1, new java.awt.Insets(10, 10, 10, 10), -1, -1));
final javax.swing.JPanel panel1 = new javax.swing.JPanel();
panel1.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 4, new java.awt.Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel1, new com.intellij.uiDesigner.core.GridConstraints(2, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK|com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false));
final com.intellij.uiDesigner.core.Spacer spacer1 = new com.intellij.uiDesigner.core.Spacer();
panel1.add(spacer1, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final javax.swing.JPanel panel2 = new javax.swing.JPanel();
panel2.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 1, new java.awt.Insets(0, 0, 0, 0), -1, -1));
panel1.add(panel2, new com.intellij.uiDesigner.core.GridConstraints(0, 3, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK|com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK|com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
buttonOK = new javax.swing.JButton();
panel2.add(buttonOK, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK|com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
ambigPhraseLabel = new javax.swing.JLabel();
panel1.add(ambigPhraseLabel, new com.intellij.uiDesigner.core.GridConstraints(0, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final com.intellij.uiDesigner.core.Spacer spacer2 = new com.intellij.uiDesigner.core.Spacer();
panel1.add(spacer2, new com.intellij.uiDesigner.core.GridConstraints(0, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
treeScrollPane = new javax.swing.JScrollPane();
contentPane.add(treeScrollPane, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK|com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK|com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
treeSizeSlider = new javax.swing.JSlider();
contentPane.add(treeSizeSlider, new com.intellij.uiDesigner.core.GridConstraints(1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}

/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
public javax.swing.JComponent $$$getRootComponent$$$() {
return contentPane;
}
}
Loading

0 comments on commit 266da90

Please sign in to comment.