MCPcopy Create free account
hub / github.com/BaseXdb/basex / execute

Method execute

basex-core/src/main/java/org/basex/gui/GUI.java:313–337  ·  view source on GitHub ↗

Executes the input of the GUIInput bar.

()

Source from the content-addressed store, hash-verified

311 * Executes the input of the {@link GUIInput} bar.
312 */
313 void execute() {
314 final String in = input.getText().trim();
315 final boolean cmd = mode.getSelectedIndex() == 2;
316 // run as command: command mode or exclamation mark as first character
317 final boolean exc = Strings.startsWith(in, '!');
318 if(cmd || exc) {
319 try {
320 // parse and execute all commands
321 final CommandParser cp = CommandParser.get(in.substring(exc ? 1 : 0), context);
322 if(pwReader == null) pwReader = () -> {
323 final DialogPass dp = new DialogPass(this);
324 return dp.ok() ? dp.password() : "";
325 };
326 cp.pwReader(pwReader);
327 execute(cp.parse());
328 } catch(final QueryException ex) {
329 if(!info.visible()) GUIMenuCmd.C_SHOW_INFO.execute(this);
330 info.setInfo(Util.message(ex), null, false, true);
331 }
332 } else if(gopts.get(GUIOptions.SEARCHMODE) == 1 || Strings.startsWith(in, '/')) {
333 simpleQuery(in);
334 } else {
335 execute(new Find(in));
336 }
337 }
338
339 /**
340 * Launches a simple single-line query. Adds the default namespace if available.

Callers 2

GUIMethod · 0.95
simpleQueryMethod · 0.95

Calls 15

startsWithMethod · 0.95
getMethod · 0.95
passwordMethod · 0.95
pwReaderMethod · 0.95
parseMethod · 0.95
messageMethod · 0.95
simpleQueryMethod · 0.95
stopMethod · 0.95
sleepMethod · 0.95
cursorMethod · 0.95
isEmptyMethod · 0.95
equalsMethod · 0.95

Tested by

no test coverage detected