]> git.argeo.org Git - lgpl/argeo-commons.git/blob - server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/editors/GenericJcrQueryEditor.java
remove typo in comments
[lgpl/argeo-commons.git] / server / plugins / org.argeo.jcr.ui.explorer / src / main / java / org / argeo / jcr / ui / explorer / editors / GenericJcrQueryEditor.java
1 /*
2 * Copyright (C) 2007-2012 Mathieu Baudier
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.jcr.ui.explorer.editors;
17
18 import org.argeo.eclipse.ui.jcr.editors.AbstractJcrQueryEditor;
19 import org.argeo.jcr.ui.explorer.JcrExplorerPlugin;
20 import org.eclipse.swt.SWT;
21 import org.eclipse.swt.layout.GridData;
22 import org.eclipse.swt.layout.GridLayout;
23 import org.eclipse.swt.widgets.Button;
24 import org.eclipse.swt.widgets.Composite;
25 import org.eclipse.swt.widgets.Event;
26 import org.eclipse.swt.widgets.Listener;
27 import org.eclipse.swt.widgets.Text;
28
29 /** Enables end user to type and execute any JCR query. */
30 public class GenericJcrQueryEditor extends AbstractJcrQueryEditor {
31 public final static String ID = JcrExplorerPlugin.ID + ".genericJcrQueryEditor";
32
33 private Text queryField;
34
35 @Override
36 public void createQueryForm(Composite parent) {
37 parent.setLayout(new GridLayout(1, false));
38
39 queryField = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP);
40 queryField.setText(initialQuery);
41 queryField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
42
43 Button execute = new Button(parent, SWT.PUSH);
44 execute.setText("Execute");
45
46 Listener executeListener = new Listener() {
47 public void handleEvent(Event event) {
48 executeQuery(queryField.getText());
49 }
50 };
51
52 execute.addListener(SWT.Selection, executeListener);
53 // queryField.addListener(SWT.DefaultSelection, executeListener);
54 }
55
56 @Override
57 public void setFocus() {
58 queryField.setFocus();
59 }
60 }