]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/jcr/GenericJcrQueryEditor.java
2 * Copyright (C) 2007-2012 Argeo GmbH
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
.cms
.ui
.workbench
.jcr
;
18 import org
.argeo
.cms
.ui
.workbench
.WorkbenchUiPlugin
;
19 import org
.argeo
.cms
.ui
.workbench
.internal
.jcr
.parts
.AbstractJcrQueryEditor
;
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
= WorkbenchUiPlugin
.PLUGIN_ID
32 + ".genericJcrQueryEditor";
34 private Text queryField
;
37 public void createQueryForm(Composite parent
) {
38 parent
.setLayout(new GridLayout(1, false));
40 queryField
= new Text(parent
, SWT
.BORDER
| SWT
.MULTI
| SWT
.WRAP
);
41 queryField
.setText(initialQuery
);
42 queryField
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
44 Button execute
= new Button(parent
, SWT
.PUSH
);
45 execute
.setText("Execute");
47 Listener executeListener
= new Listener() {
48 private static final long serialVersionUID
= -918256291554301699L;
50 public void handleEvent(Event event
) {
51 executeQuery(queryField
.getText());
55 execute
.addListener(SWT
.Selection
, executeListener
);
56 // queryField.addListener(SWT.DefaultSelection, executeListener);
60 public void setFocus() {
61 queryField
.setFocus();