Issue #45 Unicode character cannot save

Code formatting
This commit is contained in:
Jindra Pet��k
2013-03-30 16:43:26 +01:00
parent d3bd9b641d
commit be106cc34b
772 changed files with 84378 additions and 84353 deletions
@@ -34,93 +34,93 @@ import jsyntaxpane.syntaxkits.Flasm3MethodInfoSyntaxKit;
*/
public class MethodInfoPanel extends JPanel {
public LineMarkedEditorPane paramEditor;
public JEditorPane returnTypeEditor;
private MethodInfo methodInfo;
private ABC abc;
public LineMarkedEditorPane paramEditor;
public JEditorPane returnTypeEditor;
private MethodInfo methodInfo;
private ABC abc;
public MethodInfoPanel() {
returnTypeEditor = new JEditorPane();
paramEditor = new LineMarkedEditorPane();
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
add(new JLabel("Parameters:"));
add(new JScrollPane(paramEditor));
add(new JLabel("Return value type:"));
JScrollPane jsp = new JScrollPane(returnTypeEditor);
add(jsp);
paramEditor.setContentType("text/flasm3_methodinfo");
returnTypeEditor.setContentType("text/flasm3_methodinfo");
paramEditor.setFont(new Font("Monospaced", Font.PLAIN, paramEditor.getFont().getSize()));
returnTypeEditor.setFont(new Font("Monospaced", Font.PLAIN, returnTypeEditor.getFont().getSize()));
public MethodInfoPanel() {
returnTypeEditor = new JEditorPane();
paramEditor = new LineMarkedEditorPane();
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
add(new JLabel("Parameters:"));
add(new JScrollPane(paramEditor));
add(new JLabel("Return value type:"));
JScrollPane jsp = new JScrollPane(returnTypeEditor);
add(jsp);
paramEditor.setContentType("text/flasm3_methodinfo");
returnTypeEditor.setContentType("text/flasm3_methodinfo");
paramEditor.setFont(new Font("Monospaced", Font.PLAIN, paramEditor.getFont().getSize()));
returnTypeEditor.setFont(new Font("Monospaced", Font.PLAIN, returnTypeEditor.getFont().getSize()));
jsp.setMaximumSize(new Dimension(1024, 25));
Flasm3MethodInfoSyntaxKit sk = (Flasm3MethodInfoSyntaxKit) returnTypeEditor.getEditorKit();
sk.deinstallComponent(returnTypeEditor, "jsyntaxpane.components.LineNumbersRuler");
}
jsp.setMaximumSize(new Dimension(1024, 25));
Flasm3MethodInfoSyntaxKit sk = (Flasm3MethodInfoSyntaxKit) returnTypeEditor.getEditorKit();
sk.deinstallComponent(returnTypeEditor, "jsyntaxpane.components.LineNumbersRuler");
}
public void load(int methodInfoIndex, ABC abc) {
this.abc = abc;
if (methodInfoIndex <= 0) {
paramEditor.setText("");
}
this.methodInfo = abc.method_info[methodInfoIndex];
int p = 0;
String ret = "";
int optParPos = 0;
if (methodInfo.flagHas_optional()) {
optParPos = methodInfo.param_types.length - methodInfo.optional.length;
}
for (int ptype : methodInfo.param_types) {
if (p > 0) {
ret += ",\n";
}
if (methodInfo.flagHas_paramnames() && Main.PARAM_NAMES_ENABLE) {
ret = ret + abc.constants.constant_string[methodInfo.paramNames[p]];
} else {
ret = ret + "param" + (p + 1);
}
ret += ":";
if (ptype == 0) {
ret += "*";
} else {
ret += "m[" + ptype + "]\"" + Helper.escapeString(abc.constants.constant_multiname[ptype].toString(abc.constants, new ArrayList<String>())) + "\"";
}
if (methodInfo.flagHas_optional()) {
if (p >= optParPos) {
ret += "=" + methodInfo.optional[p - optParPos].toString(abc.constants);
public void load(int methodInfoIndex, ABC abc) {
this.abc = abc;
if (methodInfoIndex <= 0) {
paramEditor.setText("");
}
this.methodInfo = abc.method_info[methodInfoIndex];
int p = 0;
String ret = "";
int optParPos = 0;
if (methodInfo.flagHas_optional()) {
optParPos = methodInfo.param_types.length - methodInfo.optional.length;
}
for (int ptype : methodInfo.param_types) {
if (p > 0) {
ret += ",\n";
}
}
p++;
}
if (methodInfo.flagNeed_rest()) {
ret += ",\n... rest";
}
paramEditor.setText(ret);
if (methodInfo.ret_type == 0) {
returnTypeEditor.setText("*");
} else {
returnTypeEditor.setText("m[" + methodInfo.ret_type + "]\"" + Helper.escapeString(abc.constants.constant_multiname[methodInfo.ret_type].toString(abc.constants, new ArrayList<String>())) + "\"");
}
}
if (methodInfo.flagHas_paramnames() && Main.PARAM_NAMES_ENABLE) {
ret = ret + abc.constants.constant_string[methodInfo.paramNames[p]];
} else {
ret = ret + "param" + (p + 1);
}
ret += ":";
if (ptype == 0) {
ret += "*";
} else {
ret += "m[" + ptype + "]\"" + Helper.escapeString(abc.constants.constant_multiname[ptype].toString(abc.constants, new ArrayList<String>())) + "\"";
}
if (methodInfo.flagHas_optional()) {
if (p >= optParPos) {
ret += "=" + methodInfo.optional[p - optParPos].toString(abc.constants);
}
}
p++;
}
if (methodInfo.flagNeed_rest()) {
ret += ",\n... rest";
}
paramEditor.setText(ret);
if (methodInfo.ret_type == 0) {
returnTypeEditor.setText("*");
} else {
returnTypeEditor.setText("m[" + methodInfo.ret_type + "]\"" + Helper.escapeString(abc.constants.constant_multiname[methodInfo.ret_type].toString(abc.constants, new ArrayList<String>())) + "\"");
}
}
public boolean save() {
try {
MethodInfoParser.parseParams(paramEditor.getText(), methodInfo, abc);
} catch (ParseException ex) {
JOptionPane.showMessageDialog(paramEditor, ex.text, "MethodInfo Params Error", JOptionPane.ERROR_MESSAGE);
return false;
}
try {
MethodInfoParser.parseReturnType(returnTypeEditor.getText(), methodInfo);
} catch (ParseException ex) {
JOptionPane.showMessageDialog(returnTypeEditor, ex.text, "MethodInfo Return type Error", JOptionPane.ERROR_MESSAGE);
return false;
}
return true;
}
public boolean save() {
try {
MethodInfoParser.parseParams(paramEditor.getText(), methodInfo, abc);
} catch (ParseException ex) {
JOptionPane.showMessageDialog(paramEditor, ex.text, "MethodInfo Params Error", JOptionPane.ERROR_MESSAGE);
return false;
}
try {
MethodInfoParser.parseReturnType(returnTypeEditor.getText(), methodInfo);
} catch (ParseException ex) {
JOptionPane.showMessageDialog(returnTypeEditor, ex.text, "MethodInfo Return type Error", JOptionPane.ERROR_MESSAGE);
return false;
}
return true;
}
public void setEditMode(boolean val) {
returnTypeEditor.setEditable(val);
paramEditor.setEditable(val);
}
public void setEditMode(boolean val) {
returnTypeEditor.setEditable(val);
paramEditor.setEditable(val);
}
}