Search in sources :

Example 1 with AqlCodeEditor

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);
}
Also used : AqlCodeEditor(catdata.aql.gui.AqlCodeEditor) Pair(catdata.Pair)

Example 2 with AqlCodeEditor

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);
    }
}
Also used : AqlCodeEditor(catdata.aql.gui.AqlCodeEditor) Point(java.awt.Point)

Example 3 with AqlCodeEditor

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();
}
Also used : AqlCodeEditor(catdata.aql.gui.AqlCodeEditor)

Example 4 with AqlCodeEditor

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;
}
Also used : MenuItem(java.awt.MenuItem) Menu(java.awt.Menu) AqlCodeEditor(catdata.aql.gui.AqlCodeEditor)

Aggregations

AqlCodeEditor (catdata.aql.gui.AqlCodeEditor)4 Pair (catdata.Pair)1 Menu (java.awt.Menu)1 MenuItem (java.awt.MenuItem)1 Point (java.awt.Point)1