]>
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
a73fd1da10360769111d4ad3e9c149d64202b4f4
2 * Copyright (C) 2007-2012 Mathieu Baudier
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org
.argeo
.jcr
.ui
.explorer
.editors
;
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
;
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";
33 private Text queryField
;
36 public void createQueryForm(Composite parent
) {
37 parent
.setLayout(new GridLayout(1, false));
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));
43 Button execute
= new Button(parent
, SWT
.PUSH
);
44 execute
.setText("Execute");
46 Listener executeListener
= new Listener() {
47 public void handleEvent(Event event
) {
48 executeQuery(queryField
.getText());
52 execute
.addListener(SWT
.Selection
, executeListener
);
53 // queryField.addListener(SWT.DefaultSelection, executeListener);
57 public void setFocus() {
58 queryField
.setFocus();