use of catdata.aql.gui.AqlCodeEditor in project fql by CategoricalData.
the class GUI method getCurrent.
public static Pair<AqlEnv, String> getCurrent() {
CodeEditor<?, ?, ?> c = getSelectedEditor();
if (c == null || c.lang() != Language.AQL) {
return null;
}
AqlCodeEditor e = (AqlCodeEditor) c;
return new Pair<>(e.last_env, e.title);
}
use of catdata.aql.gui.AqlCodeEditor in project fql by CategoricalData.
the class GUI method infer.
private static void infer(Kind k) {
int i = editors.getSelectedIndex();
Object o = editors.getComponentAt(i);
if (o instanceof AqlCodeEditor) {
AqlCodeEditor a = (AqlCodeEditor) o;
a.infer(k);
}
}
use of catdata.aql.gui.AqlCodeEditor in project fql by CategoricalData.
the class GUI method formatActionAql.
private static void formatActionAql() {
CodeEditor<?, ?, ?> c = getSelectedEditor();
if (c == null || !c.lang().equals(Language.AQL)) {
return;
}
AqlCodeEditor cc = (AqlCodeEditor) c;
cc.format();
}
use of catdata.aql.gui.AqlCodeEditor in project fql by CategoricalData.
the class GUI method populateAql.
private static Menu populateAql() {
Menu menu = new Menu("AQL");
MenuItem st = new MenuItem("Self-Test");
st.addActionListener(x -> AqlTester.doSelfTests());
menu.add(st);
MenuItem im = new MenuItem("Infer Mapping (using last compiled)");
im.addActionListener(x -> infer(Kind.MAPPING));
menu.add(im);
MenuItem iq = new MenuItem("Infer Query (using last compiled)");
iq.addActionListener(x -> infer(Kind.QUERY));
menu.add(iq);
MenuItem it = new MenuItem("Infer Transform (using last compiled)");
it.addActionListener(x -> infer(Kind.TRANSFORM));
menu.add(it);
MenuItem ii = new MenuItem("Infer Instance (using last compiled)");
it.addActionListener(x -> infer(Kind.INSTANCE));
menu.add(ii);
MenuItem ih = new MenuItem("Emit HTML (using last compiled)");
ih.addActionListener(x -> {
CodeEditor<?, ?, ?> c = getSelectedEditor();
if (c == null) {
// TODO aql refact these actions that depend on selected editor
return;
}
if (c instanceof AqlCodeEditor) {
AqlCodeEditor a = (AqlCodeEditor) c;
a.emitDoc();
}
});
menu.add(ih);
MenuItem formatItem = new MenuItem("Code Format");
menu.add(formatItem);
formatItem.addActionListener(x -> formatActionAql());
return menu;
}
Aggregations