use of javax.swing.KeyStroke in project fql by CategoricalData.
the class FQLPPCodeEditor method doTemplates.
@Override
protected void doTemplates() {
CompletionProvider provider = createCompletionProvider();
AutoCompletion ac = new AutoCompletion(provider);
KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.META_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK);
ac.setTriggerKey(key);
ac.install(topArea);
}
use of javax.swing.KeyStroke in project fql by CategoricalData.
the class GUI method makesToolsMenu.
private static Menu makesToolsMenu() {
Menu toolsMenu = new Menu("Tools");
MenuItem runItem = new MenuItem("Run");
toolsMenu.add(runItem);
runItem.addActionListener(e -> {
CodeEditor<?, ?, ?> ed = getSelectedEditor();
if (ed != null) {
ed.runAction();
}
});
KeyStroke ctrlR = KeyStroke.getKeyStroke(KeyEvent.VK_R, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
MenuShortcut q2 = new MenuShortcut(ctrlR.getKeyCode());
runItem.setShortcut(q2);
MenuItem abortItem = new MenuItem("Abort");
toolsMenu.add(abortItem);
abortItem.addActionListener(e -> abortAction());
MenuItem optionsItem = new MenuItem("Options");
toolsMenu.add(optionsItem);
optionsItem.addActionListener(e -> IdeOptions.showOptions());
MenuItem optionsItem2 = new MenuItem("Legacy options");
toolsMenu.add(optionsItem2);
optionsItem2.addActionListener(e -> DefunctGlobalOptions.showOptions());
MenuItem chaseItem = new MenuItem("ED Chaser");
toolsMenu.add(chaseItem);
chaseItem.addActionListener(x -> Chase.dostuff());
MenuItem sqlLoaderItem = new MenuItem("SQL Loader");
toolsMenu.add(sqlLoaderItem);
sqlLoaderItem.addActionListener(x -> SqlLoader.showLoader());
MenuItem sqlMapperItem = new MenuItem("SQL Mapper");
toolsMenu.add(sqlMapperItem);
sqlMapperItem.addActionListener(x -> SqlMapper.showGuesser());
MenuItem sqlCheckItem = new MenuItem("SQL Checker");
toolsMenu.add(sqlCheckItem);
sqlCheckItem.addActionListener(x -> new SqlChecker());
MenuItem shredItem = new MenuItem("NR Shredder");
toolsMenu.add(shredItem);
shredItem.addActionListener(x -> new NraViewer());
MenuItem easikItem = new MenuItem("EASIK");
toolsMenu.add(easikItem);
easikItem.addActionListener(x -> easik.Easik.main(new String[0]));
return toolsMenu;
}
use of javax.swing.KeyStroke in project fql by CategoricalData.
the class GUI method makeFileMenu.
private static Menu makeFileMenu() {
Menu fileMenu = new Menu("File");
MenuItem openItem = new MenuItem("Open");
MenuItem saveItem = new MenuItem("Save");
MenuItem saveAsItem = new MenuItem("Save As");
MenuItem saveAllItem = new MenuItem("Save All");
MenuItem closeItem = new MenuItem("Close");
MenuItem exitItem = new MenuItem("Quit");
Map<Language, MenuItem> newItems = new HashMap<>();
for (Language l : Language.values0()) {
MenuItem newItem = new MenuItem("New " + l);
fileMenu.add(newItem);
newItems.put(l, newItem);
newItem.addActionListener((ActionEvent e) -> newAction(null, "", l));
}
fileMenu.add(openItem);
// fileMenu.add(openItem2);
fileMenu.add(saveItem);
fileMenu.add(saveAsItem);
fileMenu.add(saveAllItem);
fileMenu.add(closeItem);
fileMenu.add(exitItem);
closeItem.addActionListener(e -> closeAction());
saveAsItem.addActionListener(e -> saveAsActionAlternate(getSelectedEditor()));
KeyStroke ctrlS = KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
MenuShortcut s = new MenuShortcut(ctrlS.getKeyCode());
saveItem.setShortcut(s);
// TODO aql why doesn't shift mask work? order?
MenuShortcut sA = new MenuShortcut(ctrlS.getKeyCode(), true);
saveAllItem.setShortcut(sA);
saveAllItem.addActionListener(e -> saveAllAction());
KeyStroke ctrlQ = KeyStroke.getKeyStroke(KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
MenuShortcut q = new MenuShortcut(ctrlQ.getKeyCode());
exitItem.setShortcut(q);
KeyStroke ctrlW = KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
// KeyStroke commandW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.META_MASK);
MenuShortcut c = new MenuShortcut(ctrlW.getKeyCode());
closeItem.setShortcut(c);
openItem.addActionListener(e -> openActionAlternate());
saveItem.addActionListener(e -> saveAction());
exitItem.addActionListener(e -> exitAction());
KeyStroke ctrlN = KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
MenuShortcut n = new MenuShortcut(ctrlN.getKeyCode());
newItems.get(Language.getDefault()).setShortcut(n);
KeyStroke ctrlO = KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
MenuShortcut o = new MenuShortcut(ctrlO.getKeyCode());
openItem.setShortcut(o);
return fileMenu;
}
use of javax.swing.KeyStroke in project fql by CategoricalData.
the class MplDisplay method display.
// private final Map<String, String> indices = new HashMap<>();
private void display(String s, @SuppressWarnings("unused") List<String> order) {
frame = new JFrame();
// name = s;
Vector<String> ooo = new Vector<>();
// int index = 0;
for (Pair<String, JComponent> p : frames) {
x.add(p.second, p.first);
ooo.add(p.first);
// indices.put(order.get(index++), p.first);
}
x.add(new JPanel(), "blank");
cl.show(x, "blank");
yyy.setListData(ooo);
JPanel temp1 = new JPanel(new GridLayout(1, 1));
temp1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Select:"));
JScrollPane yyy1 = new JScrollPane(yyy);
temp1.add(yyy1);
// temp1.setMinimumSize(new Dimension(200, 600));
// yyy.setPreferredSize(new Dimension(200, 600));
yyy.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
yyy.addListSelectionListener((ListSelectionEvent e) -> {
int i = yyy.getSelectedIndex();
if (i == -1) {
cl.show(x, "blank");
} else {
cl.show(x, ooo.get(i));
}
});
JPanel north = new JPanel(new GridLayout(1, 1));
// JButton saveButton = new JButton("Save GUI");
// north.add(saveButton);
// saveButton.setMinimumSize(new Dimension(10,10));
// saveButton.addActionListener(x -> GUI.save2(env));
JSplitPane px = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
// px.setResizeWeight(.8);
px.setDividerLocation(200);
// FQLSplit px = new FQLSplit(.5, JSplitPane.HORIZONTAL_SPLIT);
px.setDividerSize(4);
frame = new JFrame(/* "Viewer for " + */
s);
JSplitPane temp2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
temp2.setResizeWeight(1);
temp2.setDividerSize(0);
temp2.setBorder(BorderFactory.createEmptyBorder());
temp2.add(temp1);
temp2.add(north);
// px.add(temp1);
px.add(temp2);
px.add(x);
// JPanel bd = new JPanel(new BorderLayout());
// bd.add(px, BorderLayout.CENTER);
// bd.add(north, BorderLayout.NORTH);
// frame.setContentPane(bd);
frame.setContentPane(px);
frame.setSize(900, 600);
ActionListener escListener = (ActionEvent e) -> frame.dispose();
frame.getRootPane().registerKeyboardAction(escListener, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
KeyStroke ctrlW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK);
KeyStroke commandW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.META_MASK);
frame.getRootPane().registerKeyboardAction(escListener, ctrlW, JComponent.WHEN_IN_FOCUSED_WINDOW);
frame.getRootPane().registerKeyboardAction(escListener, commandW, JComponent.WHEN_IN_FOCUSED_WINDOW);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
use of javax.swing.KeyStroke in project fql by CategoricalData.
the class OplCodeEditor method doTemplates.
@Override
protected void doTemplates() {
CompletionProvider provider = createCompletionProvider();
AutoCompletion ac = new AutoCompletion(provider);
KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.META_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK);
ac.setTriggerKey(key);
ac.install(topArea);
}
Aggregations