Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 337930 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jpt/common/ui/WidgetFactory.java (-3 / +13 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008 Oracle. All rights reserved.
2
 * Copyright (c) 2008, 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
Lines 10-15 Link Here
10
package org.eclipse.jpt.common.ui;
10
package org.eclipse.jpt.common.ui;
11
11
12
import org.eclipse.swt.custom.CCombo;
12
import org.eclipse.swt.custom.CCombo;
13
import org.eclipse.swt.custom.StyledText;
13
import org.eclipse.swt.widgets.Button;
14
import org.eclipse.swt.widgets.Button;
14
import org.eclipse.swt.widgets.Combo;
15
import org.eclipse.swt.widgets.Combo;
15
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.swt.widgets.Composite;
Lines 35-42 Link Here
35
 * adopters on the understanding that any code that uses this API will almost
36
 * adopters on the understanding that any code that uses this API will almost
36
 * certainly be broken (repeatedly) as the API evolves.
37
 * certainly be broken (repeatedly) as the API evolves.
37
 *
38
 *
38
 * @version 2.0
39
 * @version 3.0
39
 * @since 2.0
40
 * @since 3.0
40
 */
41
 */
41
public interface WidgetFactory {
42
public interface WidgetFactory {
42
43
Lines 163-168 Link Here
163
	 *
164
	 *
164
	 * @param parent The parent container
165
	 * @param parent The parent container
165
	 * @param parent The number of lines the text area should display
166
	 * @param parent The number of lines the text area should display
167
	 * @return A new <code>StyledText</code>
168
	 */
169
	StyledText createMultiLineStyledText(Composite parent);
170
171
	/**
172
	 * Creates a new editable text area.
173
	 *
174
	 * @param parent The parent container
175
	 * @param parent The number of lines the text area should display
166
	 * @return A new <code>Text</code>
176
	 * @return A new <code>Text</code>
167
	 */
177
	 */
168
	Text createMultiLineText(Composite parent);
178
	Text createMultiLineText(Composite parent);
(-)src/org/eclipse/jpt/common/ui/internal/utility/swt/SWTTools.java (-1 / +9 lines)
Lines 10-16 Link Here
10
package org.eclipse.jpt.common.ui.internal.utility.swt;
10
package org.eclipse.jpt.common.ui.internal.utility.swt;
11
11
12
import java.util.Arrays;
12
import java.util.Arrays;
13
14
import org.eclipse.jpt.common.utility.internal.BitTools;
13
import org.eclipse.jpt.common.utility.internal.BitTools;
15
import org.eclipse.jpt.common.utility.internal.StringConverter;
14
import org.eclipse.jpt.common.utility.internal.StringConverter;
16
import org.eclipse.jpt.common.utility.internal.model.value.StaticCollectionValueModel;
15
import org.eclipse.jpt.common.utility.internal.model.value.StaticCollectionValueModel;
Lines 21-26 Link Here
21
import org.eclipse.jpt.common.utility.model.value.WritableCollectionValueModel;
20
import org.eclipse.jpt.common.utility.model.value.WritableCollectionValueModel;
22
import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel;
21
import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel;
23
import org.eclipse.swt.SWT;
22
import org.eclipse.swt.SWT;
23
import org.eclipse.swt.custom.StyledText;
24
import org.eclipse.swt.widgets.Button;
24
import org.eclipse.swt.widgets.Button;
25
import org.eclipse.swt.widgets.Combo;
25
import org.eclipse.swt.widgets.Combo;
26
import org.eclipse.swt.widgets.Control;
26
import org.eclipse.swt.widgets.Control;
Lines 68-73 Link Here
68
		new TextFieldModelBinding(textModel, textField);
68
		new TextFieldModelBinding(textModel, textField);
69
	}
69
	}
70
70
71
	/**
72
	 * Bind the specified text model to the specified text field.
73
	 */
74
	public static <E> void bind(WritablePropertyValueModel<String> textModel, StyledText textField) {
75
		// the new binding will add itself as a listener to the text model and the text field
76
		new StyledTextFieldModelBinding(textModel, textField);
77
	}
78
71
79
72
	// ********** list box **********
80
	// ********** list box **********
73
81
(-)src/org/eclipse/jpt/common/ui/internal/utility/swt/StyledTextFieldModelBinding.java (+196 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
6
 * 
7
 * Contributors:
8
 *     Oracle - initial API and implementation
9
 ******************************************************************************/
10
package org.eclipse.jpt.common.ui.internal.utility.swt;
11
12
import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
13
import org.eclipse.jpt.common.utility.internal.StringTools;
14
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
15
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
16
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
17
import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel;
18
import org.eclipse.swt.custom.StyledText;
19
import org.eclipse.swt.events.DisposeEvent;
20
import org.eclipse.swt.events.DisposeListener;
21
import org.eclipse.swt.events.ModifyEvent;
22
import org.eclipse.swt.events.ModifyListener;
23
24
/**
25
 * This binding can be used to keep a styled text field
26
 * synchronized with a model text/string.
27
 * 
28
 * @see WritablePropertyValueModel
29
 * @see StyledText
30
 */
31
@SuppressWarnings("nls")
32
class StyledTextFieldModelBinding {
33
34
	/**
35
	 * The text model we keep synchronized with the text field.
36
	 */
37
	private final WritablePropertyValueModel<String> textModel;
38
39
	/**
40
	 * A listener that allows us to synchronize the text field's contents with
41
	 * the text model.
42
	 */
43
	private final PropertyChangeListener textModelChangeListener;
44
45
	/**
46
	 * The text field we keep synchronized with the text model.
47
	 */
48
	private final StyledText textField;
49
50
	/**
51
	 * A listener that allows us to synchronize our text model
52
	 * with the text field's contents.
53
	 */
54
	private final ModifyListener textFieldModifyListener;
55
56
	/**
57
	 * A listener that allows us to stop listening to stuff when the text field
58
	 * is disposed.
59
	 */
60
	private final DisposeListener textFieldDisposeListener;
61
62
	/**
63
	 * Hmm...
64
	 */
65
	private boolean settingTextFieldText = false;
66
67
68
	// ********** constructor **********
69
70
	/**
71
	 * Constructor - the text model and text field are required.
72
	 */
73
	StyledTextFieldModelBinding(WritablePropertyValueModel<String> textModel, StyledText textField) {
74
		super();
75
		if ((textModel == null) || (textField == null)) {
76
			throw new NullPointerException();
77
		}
78
		this.textModel = textModel;
79
		this.textField = textField;
80
81
		this.textModelChangeListener = this.buildTextModelChangeListener();
82
		this.textModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.textModelChangeListener);
83
84
		this.textFieldModifyListener = this.buildTextFieldModifyListener();
85
		this.textField.addModifyListener(this.textFieldModifyListener);
86
87
		this.textFieldDisposeListener = this.buildTextFieldDisposeListener();
88
		this.textField.addDisposeListener(this.textFieldDisposeListener);
89
90
		this.setTextFieldText(textModel.getValue());
91
	}
92
93
94
	// ********** initialization **********
95
96
	private PropertyChangeListener buildTextModelChangeListener() {
97
		return new SWTPropertyChangeListenerWrapper(this.buildTextModelChangeListener_());
98
	}
99
100
	private PropertyChangeListener buildTextModelChangeListener_() {
101
		return new PropertyChangeListener() {
102
			public void propertyChanged(PropertyChangeEvent event) {
103
				StyledTextFieldModelBinding.this.textModelChanged(event);
104
			}
105
			@Override
106
			public String toString() {
107
				return "text listener";
108
			}
109
		};
110
	}
111
112
	private ModifyListener buildTextFieldModifyListener() {
113
		return new ModifyListener() {
114
			public void modifyText(ModifyEvent event) {
115
				StyledTextFieldModelBinding.this.textFieldModified();
116
			}
117
			@Override
118
			public String toString() {
119
				return "text field modify listener";
120
			}
121
		};
122
	}
123
124
	private DisposeListener buildTextFieldDisposeListener() {
125
		return new DisposeListener() {
126
			public void widgetDisposed(DisposeEvent event) {
127
				StyledTextFieldModelBinding.this.textFieldDisposed();
128
			}
129
			@Override
130
			public String toString() {
131
				return "text field dispose listener";
132
			}
133
		};
134
	}
135
136
137
	// ********** text model events **********
138
139
	/* CU private */ void textModelChanged(PropertyChangeEvent event) {
140
		if ( ! this.textField.isDisposed()) {  // ???
141
			this.setTextFieldText((String) event.getNewValue());
142
		}
143
	}
144
145
	private void setTextFieldText(String text) {
146
		// the text model can be null, but the text field cannot
147
		this.setTextFieldText_((text == null) ? "" : text);
148
	}
149
150
	private void setTextFieldText_(String text) {
151
		if ( ! text.equals(this.textField.getText())) {  // ???
152
			this.setTextFieldText__(text);
153
		}
154
	}
155
156
	private void setTextFieldText__(String text) {
157
		this.settingTextFieldText = true;
158
		try {
159
			this.textField.setText(text);
160
		} finally {
161
			this.settingTextFieldText = false;
162
		}
163
	}
164
165
166
	// ********** text field events **********
167
168
	/* CU private */ void textFieldModified() {
169
		if ( ! this.settingTextFieldText) {
170
			this.setTextModelText(this.textField.getText());
171
		}
172
	}
173
174
	private void setTextModelText(String text) {
175
		if ( ! text.equals(this.textModel.getValue())) {  // ???
176
			this.textModel.setValue(text);
177
		}
178
	}
179
180
	/* CU private */ void textFieldDisposed() {
181
		// the text field is not yet "disposed" when we receive this event
182
		// so we can still remove our listeners
183
		this.textField.removeDisposeListener(this.textFieldDisposeListener);
184
		this.textField.removeModifyListener(this.textFieldModifyListener);
185
		this.textModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.textModelChangeListener);
186
	}
187
188
189
	// ********** standard methods **********
190
191
	@Override
192
	public String toString() {
193
		return StringTools.buildToStringFor(this, this.textModel);
194
	}
195
196
}
(-)src/org/eclipse/jpt/common/ui/internal/widgets/DefaultWidgetFactory.java (-4 / +12 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2010 Oracle. All rights reserved.
2
 * Copyright (c) 2008, 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
Lines 12-17 Link Here
12
import org.eclipse.jpt.common.ui.WidgetFactory;
12
import org.eclipse.jpt.common.ui.WidgetFactory;
13
import org.eclipse.swt.SWT;
13
import org.eclipse.swt.SWT;
14
import org.eclipse.swt.custom.CCombo;
14
import org.eclipse.swt.custom.CCombo;
15
import org.eclipse.swt.custom.StyledText;
15
import org.eclipse.swt.layout.GridData;
16
import org.eclipse.swt.layout.GridData;
16
import org.eclipse.swt.widgets.Button;
17
import org.eclipse.swt.widgets.Button;
17
import org.eclipse.swt.widgets.Combo;
18
import org.eclipse.swt.widgets.Combo;
Lines 33-40 Link Here
33
/**
34
/**
34
 * This <code>WidgetFactory</code> simply creates plain SWT widgets.
35
 * This <code>WidgetFactory</code> simply creates plain SWT widgets.
35
 *
36
 *
36
 * @version 2.0
37
 * @version 2.3
37
 * @since 2.0
38
 * @since 2.3
38
 */
39
 */
39
public class DefaultWidgetFactory implements WidgetFactory {
40
public class DefaultWidgetFactory implements WidgetFactory {
40
41
Lines 109-115 Link Here
109
	public Composite createComposite(Composite parent) {
110
	public Composite createComposite(Composite parent) {
110
		return new Composite(parent, SWT.NULL);
111
		return new Composite(parent, SWT.NULL);
111
	}
112
	}
112
	
113
113
	/**
114
	/**
114
	 * {@inheritDoc}
115
	 * {@inheritDoc}
115
	 */
116
	 */
Lines 197-202 Link Here
197
	/**
198
	/**
198
	 * {@inheritDoc}
199
	 * {@inheritDoc}
199
	 */
200
	 */
201
	public StyledText createMultiLineStyledText(Composite parent) {
202
		return new StyledText(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
203
	}
204
205
	/**
206
	 * {@inheritDoc}
207
	 */
200
	public Text createMultiLineText(Composite parent) {
208
	public Text createMultiLineText(Composite parent) {
201
		return new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
209
		return new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
202
	}
210
	}
(-)src/org/eclipse/jpt/common/ui/internal/widgets/FormWidgetFactory.java (-5 / +19 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2010 Oracle. All rights reserved.
2
 * Copyright (c) 2008, 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
Lines 13-18 Link Here
13
import org.eclipse.jpt.common.ui.WidgetFactory;
13
import org.eclipse.jpt.common.ui.WidgetFactory;
14
import org.eclipse.swt.SWT;
14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.custom.CCombo;
15
import org.eclipse.swt.custom.CCombo;
16
import org.eclipse.swt.custom.StyledText;
16
import org.eclipse.swt.layout.GridData;
17
import org.eclipse.swt.layout.GridData;
17
import org.eclipse.swt.layout.GridLayout;
18
import org.eclipse.swt.layout.GridLayout;
18
import org.eclipse.swt.widgets.Button;
19
import org.eclipse.swt.widgets.Button;
Lines 39-46 Link Here
39
 *
40
 *
40
 * @see FormToolkit
41
 * @see FormToolkit
41
 *
42
 *
42
 * @version 2.0
43
 * @version 2.3
43
 * @since 2.0
44
 * @since 2.3
44
 */
45
 */
45
@SuppressWarnings("nls")
46
@SuppressWarnings("nls")
46
public class FormWidgetFactory implements WidgetFactory {
47
public class FormWidgetFactory implements WidgetFactory {
Lines 76-82 Link Here
76
	protected Composite createBorderContainer(Composite container) {
77
	protected Composite createBorderContainer(Composite container) {
77
		return createBorderContainer(container, 2, 1);
78
		return createBorderContainer(container, 2, 1);
78
	}
79
	}
79
	
80
80
	protected Composite createBorderContainer(Composite container, int marginHeight, int marginWidth) {
81
	protected Composite createBorderContainer(Composite container, int marginHeight, int marginWidth) {
81
82
82
		GridLayout layout = new GridLayout(1, false);
83
		GridLayout layout = new GridLayout(1, false);
Lines 93-99 Link Here
93
94
94
		return container;
95
		return container;
95
	}
96
	}
96
	
97
97
	/**
98
	/**
98
	 * {@inheritDoc}
99
	 * {@inheritDoc}
99
	 */
100
	 */
Lines 254-259 Link Here
254
	/**
255
	/**
255
	 * {@inheritDoc}
256
	 * {@inheritDoc}
256
	 */
257
	 */
258
	public StyledText createMultiLineStyledText(Composite parent) {
259
		return createStyledText(parent, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
260
	}
261
262
	/**
263
	 * {@inheritDoc}
264
	 */
257
	public Text createMultiLineText(Composite parent) {
265
	public Text createMultiLineText(Composite parent) {
258
		return createText(parent, SWT.MULTI | SWT.V_SCROLL);
266
		return createText(parent, SWT.MULTI | SWT.V_SCROLL);
259
	}
267
	}
Lines 315-320 Link Here
315
		return createText(parent, SWT.NONE);
323
		return createText(parent, SWT.NONE);
316
	}
324
	}
317
325
326
	protected StyledText createStyledText(Composite parent, int style) {
327
		StyledText text = new StyledText(parent, SWT.BORDER | SWT.FLAT | style);
328
		widgetFactory.adapt(text, true, false);
329
		return text;
330
	}
331
318
	protected Text createText(Composite parent, int style) {
332
	protected Text createText(Composite parent, int style) {
319
		return widgetFactory.createText(parent, null, SWT.BORDER | SWT.FLAT | style);
333
		return widgetFactory.createText(parent, null, SWT.BORDER | SWT.FLAT | style);
320
	}
334
	}
(-)src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java (-27 / +150 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2010 Oracle. All rights reserved.
2
 * Copyright (c) 2008, 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
Lines 41-46 Link Here
41
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
41
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
42
import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel;
42
import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel;
43
import org.eclipse.swt.SWT;
43
import org.eclipse.swt.SWT;
44
import org.eclipse.swt.custom.StyledText;
44
import org.eclipse.swt.events.ModifyListener;
45
import org.eclipse.swt.events.ModifyListener;
45
import org.eclipse.swt.events.MouseAdapter;
46
import org.eclipse.swt.events.MouseAdapter;
46
import org.eclipse.swt.events.MouseEvent;
47
import org.eclipse.swt.events.MouseEvent;
Lines 87-94 Link Here
87
 * @see FormPane
88
 * @see FormPane
88
 * @see DialogPane
89
 * @see DialogPane
89
 *
90
 *
90
 * @version 2.0
91
 * @version 2.3
91
 * @since 2.0
92
 * @since 2.3
92
 */
93
 */
93
@SuppressWarnings("nls")
94
@SuppressWarnings("nls")
94
public abstract class Pane<T extends Model>
95
public abstract class Pane<T extends Model>
Lines 1687-1693 Link Here
1687
	 * @param stringConverter The converter responsible to transform each item
1688
	 * @param stringConverter The converter responsible to transform each item
1688
	 * into a string representation
1689
	 * into a string representation
1689
	 * @param helpId The topic help ID to be registered for the given center
1690
	 * @param helpId The topic help ID to be registered for the given center
1690
	 * compositer
1691
	 * composite
1691
	 * @return The newly created <code>Combo</code>
1692
	 * @return The newly created <code>Combo</code>
1692
	 *
1693
	 *
1693
	 * @category Layout
1694
	 * @category Layout
Lines 1711-1716 Link Here
1711
	}
1712
	}
1712
1713
1713
	/**
1714
	/**
1715
	 * Adjusts the layout of the given container so that the text control has the correct amount of
1716
	 * lines by default.
1717
	 */
1718
	private void adjustMultiLineTextLayout(Composite container,
1719
	                                       int lineCount,
1720
	                                       Control text,
1721
	                                       int lineHeight) {
1722
1723
		int textHeight = text.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
1724
1725
		// Specify the number of lines the text area should display
1726
		GridData gridData = (GridData) text.getLayoutData();
1727
		gridData.heightHint = lineHeight * lineCount;
1728
1729
		// Move the label to the top of its cell
1730
		Control label = container.getChildren()[0];
1731
		int labelHeight = label.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
1732
1733
		gridData = (GridData) label.getLayoutData();
1734
		gridData.verticalAlignment = SWT.TOP;
1735
		gridData.verticalIndent   += (Math.abs(textHeight - labelHeight) / 2);
1736
	}
1737
1738
	/**
1714
	 * Creates a new container that will have a text field as the center control
1739
	 * Creates a new container that will have a text field as the center control
1715
	 * labeled with the given label.
1740
	 * labeled with the given label.
1716
	 *
1741
	 *
Lines 1724-1733 Link Here
1724
	 * @category Layout
1749
	 * @category Layout
1725
	 */
1750
	 */
1726
	protected final Text addLabeledMultiLineText(Composite container,
1751
	protected final Text addLabeledMultiLineText(Composite container,
1727
	                                               String labelText,
1752
	                                             String labelText,
1728
	                                               WritablePropertyValueModel<String> textHolder,
1753
	                                             WritablePropertyValueModel<String> textHolder,
1729
	                                               int lineCount,
1754
	                                             int lineCount,
1730
	                                               String helpId) {
1755
	                                             String helpId) {
1731
1756
1732
		Text text = this.addMultiLineText(container, textHolder, lineCount);
1757
		Text text = this.addMultiLineText(container, textHolder, lineCount);
1733
1758
Lines 1738-1756 Link Here
1738
			helpId
1763
			helpId
1739
		);
1764
		);
1740
1765
1741
		int textHeight = text.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
1766
		adjustMultiLineTextLayout(container, lineCount, text, text.getLineHeight());
1742
1767
1743
		// Specify the number of lines the text area should display
1768
		return text;
1744
		GridData gridData = (GridData) text.getLayoutData();
1769
	}
1745
		gridData.heightHint = text.getLineHeight() * lineCount;
1746
1770
1747
		// Move the label to the top of its cell
1771
	/**
1748
		Control label = container.getChildren()[0];
1772
	 * Creates a new container that will have a text field as the center control
1749
		int labelHeight = label.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
1773
	 * labeled with the given label.
1774
	 *
1775
	 * @param container The parent container
1776
	 * @param labelText The text area's label
1777
	 * @param textHolder The holder of the text field's input
1778
	 * @param lineCount The number of lines the text area should display
1779
	 * @param helpId The topic help ID to be registered for the text field
1780
	 * @return The newly created <code>StyledText</code>
1781
	 *
1782
	 * @category Layout
1783
	 */
1784
	protected final StyledText addLabeledMultiLineStyledText(Composite container,
1785
	                                                         String labelText,
1786
	                                                         WritablePropertyValueModel<String> textHolder,
1787
	                                                         int lineCount,
1788
	                                                         String helpId) {
1750
1789
1751
		gridData = (GridData) label.getLayoutData();
1790
		StyledText text = this.addMultiLineStyledText(container, textHolder, lineCount);
1752
		gridData.verticalAlignment = SWT.TOP;
1791
1753
		gridData.verticalIndent   += (Math.abs(textHeight - labelHeight) / 2);
1792
		container = this.addLabeledComposite(
1793
			container,
1794
			labelText,
1795
			text,
1796
			helpId
1797
		);
1798
1799
		adjustMultiLineTextLayout(container, lineCount, text, text.getLineHeight());
1754
1800
1755
		return text;
1801
		return text;
1756
	}
1802
	}
Lines 2268-2283 Link Here
2268
	}
2314
	}
2269
2315
2270
	/**
2316
	/**
2271
	 * Creates a new lable expanding on multiple lines.
2317
	 * Creates a new label expanding on multiple lines.
2272
	 *
2318
	 *
2273
	 * @param parent The parent container
2319
	 * @param parent The parent container
2274
	 * @param labelText The label's text
2320
	 * @param labelText The label's text
2275
	 *
2321
	 *
2276
	 * @category Layout
2322
	 * @category Layout
2277
	 */
2323
	 */
2278
	protected final FormText addMultiLineLabel(Composite container,
2324
	protected final FormText addMultiLineLabel(Composite container, String labelText) {
2279
	                                         String labelText) {
2280
2281
		FormText label = this.widgetFactory.createMultiLineLabel(container, labelText);
2325
		FormText label = this.widgetFactory.createMultiLineLabel(container, labelText);
2282
		manageWidget(label);
2326
		manageWidget(label);
2283
		return label;
2327
		return label;
Lines 2300-2305 Link Here
2300
	}
2344
	}
2301
	
2345
	
2302
	/**
2346
	/**
2347
	 * Creates a new <code>StyledText</code> widget that has multiple lines.
2348
	 *
2349
	 * @param container The parent container
2350
	 * @return The newly created <code>StyledText</code> widget
2351
	 */
2352
	protected final StyledText addMultiLineStyledText(Composite container) {
2353
2354
		StyledText text = this.widgetFactory.createMultiLineStyledText(container);
2355
		text.setLayoutData(getFieldGridData());
2356
		this.manageWidget(text);
2357
2358
		return text;
2359
	}
2360
2361
	/**
2303
	 * Creates a new <code>Text</code> widget that has multiple lines.
2362
	 * Creates a new <code>Text</code> widget that has multiple lines.
2304
	 *
2363
	 *
2305
	 * @param container The parent container
2364
	 * @param container The parent container
Lines 2327-2332 Link Here
2327
	}
2386
	}
2328
2387
2329
	/**
2388
	/**
2389
	 * Creates a new <code>StyledText</code> widget that has multiple lines.
2390
	 *
2391
	 * @param container The parent container
2392
	 * @param lineCount The number of lines the text area should display
2393
	 * @param helpId The topic help ID to be registered for the new text
2394
	 * @return The newly created <code>StyledText</code> widget
2395
	 *
2396
	 * @category Layout
2397
	 */
2398
	protected final StyledText addMultiLineStyledText(Composite container,
2399
	                                                  int lineCount,
2400
	                                                  String helpId) {
2401
2402
		StyledText text = this.addMultiLineStyledText(container);
2403
2404
		GridData gridData   = getFieldGridData();
2405
		gridData.heightHint = text.getLineHeight() * lineCount;
2406
		text.setLayoutData(gridData);
2407
2408
		if (helpId != null) {
2409
			getHelpSystem().setHelp(text, helpId);
2410
		}
2411
2412
		return text;
2413
	}
2414
2415
	/**
2330
	 * Creates a new <code>Text</code> widget that has multiple lines.
2416
	 * Creates a new <code>Text</code> widget that has multiple lines.
2331
	 *
2417
	 *
2332
	 * @param container The parent container
2418
	 * @param container The parent container
Lines 2337-2349 Link Here
2337
	 * @category Layout
2423
	 * @category Layout
2338
	 */
2424
	 */
2339
	protected final Text addMultiLineText(Composite container,
2425
	protected final Text addMultiLineText(Composite container,
2340
	                                        WritablePropertyValueModel<String> textHolder,
2426
	                                      WritablePropertyValueModel<String> textHolder,
2341
	                                        int lineCount) {
2427
	                                      int lineCount) {
2342
2428
2343
		return this.addMultiLineText(container, textHolder, lineCount, null);
2429
		return this.addMultiLineText(container, textHolder, lineCount, null);
2344
	}
2430
	}
2345
2431
2346
	/**
2432
	/**
2433
	 * Creates a new <code>StyledText</code> widget that has multiple lines.
2434
	 *
2435
	 * @param container The parent container
2436
	 * @param textHolder The holder of the text field's input
2437
	 * @param lineCount The number of lines the text area should display
2438
	 * @return The newly created <code>StyledText</code> widget
2439
	 *
2440
	 * @category Layout
2441
	 */
2442
	protected final StyledText addMultiLineStyledText(Composite container,
2443
	                                                  WritablePropertyValueModel<String> textHolder,
2444
	                                                  int lineCount) {
2445
2446
		return this.addMultiLineStyledText(container, textHolder, lineCount, null);
2447
	}
2448
2449
	/**
2347
	 * Creates a new <code>Text</code> widget that has multiple lines.
2450
	 * Creates a new <code>Text</code> widget that has multiple lines.
2348
	 *
2451
	 *
2349
	 * @param container The parent container
2452
	 * @param container The parent container
Lines 2354-2362 Link Here
2354
	 * @category Layout
2457
	 * @category Layout
2355
	 */
2458
	 */
2356
	protected final Text addMultiLineText(Composite container,
2459
	protected final Text addMultiLineText(Composite container,
2357
	                                        WritablePropertyValueModel<String> textHolder,
2460
	                                      WritablePropertyValueModel<String> textHolder,
2358
	                                        int lineCount,
2461
	                                      int lineCount,
2359
	                                        String helpId) {
2462
	                                      String helpId) {
2360
2463
2361
		Text text = this.addMultiLineText(container, lineCount, helpId);
2464
		Text text = this.addMultiLineText(container, lineCount, helpId);
2362
		SWTTools.bind(textHolder, text);
2465
		SWTTools.bind(textHolder, text);
Lines 2364-2369 Link Here
2364
	}
2467
	}
2365
2468
2366
	/**
2469
	/**
2470
	 * Creates a new <code>StyledText</code> widget that has multiple lines.
2471
	 *
2472
	 * @param container The parent container
2473
	 * @param textHolder The holder of the text field's input
2474
	 * @param helpId The topic help ID to be registered for the new text
2475
	 * @return The newly created <code>StyledText</code> widget
2476
	 *
2477
	 * @category Layout
2478
	 */
2479
	protected final StyledText addMultiLineStyledText(Composite container,
2480
	                                                  WritablePropertyValueModel<String> textHolder,
2481
	                                                  int lineCount,
2482
	                                                  String helpId) {
2483
2484
		StyledText text = this.addMultiLineStyledText(container, lineCount, helpId);
2485
		SWTTools.bind(textHolder, text);
2486
		return text;
2487
	}
2488
2489
	/**
2367
	 * Creates a new <code>PageBook</code> and set the proper layout and layout
2490
	 * Creates a new <code>PageBook</code> and set the proper layout and layout
2368
	 * data.
2491
	 * data.
2369
	 *
2492
	 *
(-)META-INF/MANIFEST.MF (+2 lines)
Lines 25-30 Link Here
25
 org.eclipse.jst.common.project.facet.core;bundle-version="[1.3.100,2.0.0)",
25
 org.eclipse.jst.common.project.facet.core;bundle-version="[1.3.100,2.0.0)",
26
 org.eclipse.jst.j2ee;bundle-version="[1.1.200,2.0.0)",
26
 org.eclipse.jst.j2ee;bundle-version="[1.1.200,2.0.0)",
27
 org.eclipse.jst.j2ee.core;bundle-version="[1.1.200,2.0.0)",
27
 org.eclipse.jst.j2ee.core;bundle-version="[1.1.200,2.0.0)",
28
 org.eclipse.persistence.jpa.jpql;bundle-version="1.0.0",
28
 org.eclipse.wst.common.emf;bundle-version="[1.1.200,2.0.0)",
29
 org.eclipse.wst.common.emf;bundle-version="[1.1.200,2.0.0)",
29
 org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.1.200,2.0.0)",
30
 org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.1.200,2.0.0)",
30
 org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)",
31
 org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)",
Lines 62-67 Link Here
62
 org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;x-internal:=true,
63
 org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;x-internal:=true,
63
 org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;x-internal:=true,
64
 org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;x-internal:=true,
64
 org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;x-internal:=true,
65
 org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;x-internal:=true,
66
 org.eclipse.jpt.jpa.core.internal.jpql;x-friends:="org.eclipse.jpt.jpa.ui",
65
 org.eclipse.jpt.jpa.core.internal.libprov;x-internal:=true,
67
 org.eclipse.jpt.jpa.core.internal.libprov;x-internal:=true,
66
 org.eclipse.jpt.jpa.core.internal.libval;x-internal:=true,
68
 org.eclipse.jpt.jpa.core.internal.libval;x-internal:=true,
67
 org.eclipse.jpt.jpa.core.internal.operations;x-internal:=true,
69
 org.eclipse.jpt.jpa.core.internal.operations;x-internal:=true,
(-)property_files/jpa_jpql_validation.properties (+481 lines)
Added Link Here
1
################################################################################
2
# Copyright (c) 2011 Oracle. All rights reserved.
3
# This program and the accompanying materials are made available under the
4
# terms of the Eclipse Public License v1.0, which accompanies this distribution
5
# and is available at http:#www.eclipse.org/legal/epl-v10.html.
6
# 
7
# Contributors:
8
#     Oracle - initial API and implementation
9
################################################################################
10
11
# AbsExpression - Grammar
12
ABS_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
13
ABS_EXPRESSION_MISSING_EXPRESSION = The encapsulated expression must be provided for an ABS expression.
14
ABS_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the ABS expression.
15
ABS_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the ABS expression.
16
# AbsExpression - Semantic
17
ABS_EXPRESSION_INVALID_NUMERIC_EXPRESSION = The encapsulated expression is not a valid numeric expression.
18
19
# AbstractFromClause - Grammar
20
ABSTRACT_FROM_CLAUSE_IDENTIFICATION_VARIABLE_DECLARATION_ENDS_WITH_COMMA = The FROM clause cannot end with a comma.
21
ABSTRACT_FROM_CLAUSE_IDENTIFICATION_VARIABLE_DECLARATION_IS_MISSING_COMMA = The FROM clause has ''{0}'' and ''{1}'' that are not separated by a comma.
22
ABSTRACT_FROM_CLAUSE_MISSING_IDENTIFICATION_VARIABLE_DECLARATION = The FROM clause must defined at least one identification variable declaration.
23
ABSTRACT_FROM_CLAUSE_WRONG_ORDER_OF_IDENTIFICATION_VARIABLE_DECLARATION = The identification variable ''{0}'' is declared after its usage. Identification variables are evaluated from left to right.
24
25
# AbstractPathExpression - Grammar
26
ABSTRACT_PATH_EXPRESSION_CANNOT_END_WITH_COMMA = A path expression cannot end with a comma.
27
ABSTRACT_PATH_EXPRESSION_MISSING_IDENTIFICATION_VARIABLE = A path expression must start with an identification variable.
28
29
# AbstractSchemaName - Grammar
30
ABSTRACT_SCHEMA_NAME_INVALID = The abstract schema type ''{0}'' is unknown.
31
ABSTRACT_SCHEMA_NAME_NOT_RESOLVABLE = ''{0}'' cannot be resolved to a type.
32
# AbstractSchemaName - Semantic
33
PATH_EXPRESSION_NOT_RELATIONSHIP_MAPPING = The derived path ''{0}'' does not represent an association field.
34
35
# AbstractSelectClause - Grammar
36
ABSTRACT_SELECT_CLAUSE_SELECT_EXPRESSION_ENDS_WITH_COMMA = The select expression cannot end with a comma.
37
ABSTRACT_SELECT_CLAUSE_SELECT_EXPRESSION_IS_MISSING_COMMA = The SELECT clause has ''{0}'' and ''{1}'' that are not separated by a comma.
38
ABSTRACT_SELECT_CLAUSE_SELECT_EXPRESSION_MALFORMED = The select expression is malformed.
39
ABSTRACT_SELECT_CLAUSE_SELECT_MISSING_EXPRESSION = The select expression is missing from the SELECT clause.
40
41
# AbstractSelectStatement - Grammar
42
ABSTRACT_SELECT_STATEMENT_FROM_CLAUSE_MSSING = A select statement must have a FROM clause.
43
44
# AdditionExpression - Semantic
45
ADDITION_EXPRESSION_LEFT_EXPRESSION_WRONG_TYPE = The left side of the addition is not a valid arithmetic expression.
46
ADDITION_EXPRESSION_RIGHT_EXPRESSION_WRONG_TYPE = The right side of the addition is not a valid arithmetic expression.
47
48
# AllOrAnyExpression - Grammar
49
ALL_OR_ANY_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
50
ALL_OR_ANY_EXPRESSION_MISSING_EXPRESSION = The subquery must be provided for an {0} expression.
51
ALL_OR_ANY_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the {0} expression.
52
ALL_OR_ANY_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the {0} expression.
53
ALL_OR_ANY_EXPRESSION_NOT_PART_OF_COMPARISON_EXPRESSION = The {0} expression must be part of a comparison expression.
54
55
# ArithmeticFactor - Grammar
56
ARITHMETIC_FACTOR_MISSING_EXPRESSION = An arithmetic factor must be followed by an expression.
57
# ArithmeticFactor - Semantic
58
ARITHMETIC_FACTOR_INVALID_EXPRESSION = The expression must be an arithmetic expression.
59
60
# ArithmeticExpression - Grammar
61
ARITHMETIC_EXPRESSION_INVALID_LEFT_EXPRESSION = The left expression is not an arithmetic expression.
62
ARITHMETIC_EXPRESSION_INVALID_RIGHT_EXPRESSION = The right expression is not an arithmetic expression.
63
ARITHMETIC_EXPRESSION_MISSING_LEFT_EXPRESSION = The left expression is missing from the arithmetic expression.
64
ARITHMETIC_EXPRESSION_MISSING_RIGHT_EXPRESSION = The right expression is missing from the arithmetic expression.
65
66
# AvgFunction - Grammar
67
AVG_FUNCTION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
68
AVG_FUNCTION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the AVG expression.
69
AVG_FUNCTION_MISSING_EXPRESSION = The encapsulated expression must be provided for an AVG expression.
70
AVG_FUNCTION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the AVG expression.
71
# AvgFunction - Semantic
72
AVG_FUNCTION_INVALID_NUMERIC_EXPRESSION = The encapsulated expression is not a valid numeric expression.
73
74
# BetweenExpression - Grammar
75
BETWEEN_EXPRESSION_MISSING_EXPRESSION = The result expression is missing from the BETWEEN expression.
76
BETWEEN_EXPRESSION_MISSING_LOWER_BOUND_EXPRESSION = The lower bound expression is missing from the BETWEEN expression.
77
BETWEEN_EXPRESSION_MISSING_AND = The identifier AND is missing from the BETWEEN expression.
78
BETWEEN_EXPRESSION_MISSING_UPPER_BOUND_EXPRESSION = The upper bound expression is missing from the BETWEEN expression.
79
# BetweenExpression - Semantic
80
BETWEEN_EXPRESSION_WRONG_TYPE = The expression's type and the lower and upper bound expressions' type have to be the same type.
81
82
# CaseExpression - Grammar
83
CASE_EXPRESSION_MISSING_ELSE_EXPRESSION = A CASE expression must have an ELSE expression.
84
CASE_EXPRESSION_MISSING_ELSE_IDENTIFIER = The identifier ELSE is missing from the CASE expression.
85
CASE_EXPRESSION_MISSING_END_IDENTIFIER = The identifier END is missing from the CASE expression.
86
CASE_EXPRESSION_MISSING_WHEN_CLAUSE = A CASE expression must define at least one WHEN clause.
87
CASE_EXPRESSION_WHEN_CLAUSES_END_WITH_COMMA = The WHEN clauses cannot end with a comma.
88
CASE_EXPRESSION_WHEN_CLAUSES_HAS_COMMA = Two WHEN clauses cannot be separated by a comma.
89
90
# CoalesceExpression - Grammar
91
COALESCE_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
92
COALESCE_EXPRESSION_MISSING_EXPRESSION = The encapsulated expressions must be provided for a COALESCE expression.
93
COALESCE_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the COALESCE expression.
94
COALESCE_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the COALESCE expression.
95
96
# CollectionMemberExpression - Grammar
97
COLLECTION_MEMBER_EXPRESSION_MISSING_ENTITY_EXPRESSION = A collection member expression must define an entity expression.
98
COLLECTION_MEMBER_EXPRESSION_MISSING_COLLECTION_VALUED_PATH_EXPRESSION = A collection member expression must define a collection valued path expression.
99
# CollectionMemberExpression - Semantic
100
COLLECTION_MEMBER_EXPRESSION_EMBEDDABLE = An embeddable type is not supported.
101
102
# CollectionMemberDeclaration - Grammar
103
COLLECTION_MEMBER_DECLARATION_MISSING_COLLECTION_VALUED_PATH_EXPRESSION = The collection-valued path expression is missing from the collection member declaration.
104
COLLECTION_MEMBER_DECLARATION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the collection member declaration.
105
COLLECTION_MEMBER_DECLARATION_MISSING_IDENTIFICATION_VARIABLE = An identification variable must be specified for a collection member declaration.
106
COLLECTION_MEMBER_DECLARATION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the collection member declaration.
107
108
# CollectionValuedPathExpression - Semantic
109
COLLECTION_VALUED_PATH_EXPRESSION_NOT_RESOLVABLE" ,     "The collection-valued path ''{0}'' cannot be resolved to a valid association field.
110
COLLECTION_VALUED_PATH_EXPRESSION_NOT_COLLECTION_TYPE = The collection-valued path ''{0}'' must resolve to an association field.
111
112
# ComparisonExpression - Grammar
113
COMPARISON_EXPRESSION_MISSING_LEFT_EXPRESSION = A comparison expression must define the left side of the comparison.
114
COMPARISON_EXPRESSION_MISSING_RIGHT_EXPRESSION = A comparison expression must define the right side of the comparison.
115
# ComparisonExpression - Semantic
116
COMPARISON_EXPRESSION_WRONG_COMPARISON_TYPE = The left and right expressions' type must be of the same type.
117
118
# ConcatExpression - Grammar
119
CONCAT_EXPRESSION_INVALID_EXPRESSION = The expression ''{0}'' is not valid expression.
120
CONCAT_EXPRESSION_MISSING_EXPRESSION = The encapsulated expression is missing from the CONCAT expression.
121
CONCAT_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the CONCAT expression.
122
CONCAT_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the CONCAT expression.
123
# ConcatExpression - Semantic
124
CONCAT_EXPRESSION_EXPRESSION_WRONG_TYPE = The expression ''{0}'' is not a String.
125
126
# ConstructorExpression - Grammar
127
CONSTRUCTOR_EXPRESSION_CONSTRUCTOR_ITEM_ENDS_WITH_COMMA = The constructor items cannot end with a comma.
128
CONSTRUCTOR_EXPRESSION_CONSTRUCTOR_ITEM_IS_MISSING_COMMA = The constructor expression has two constructor items (''{0}'' and ''{1}'') that are not separated by a comma.
129
CONSTRUCTOR_EXPRESSION_MISSING_CONSTRUCTOR_ITEM = A constructor expression must define at least one constructor item.
130
CONSTRUCTOR_EXPRESSION_MISSING_CONSTRUCTOR_NAME = The fully qualified class name must be specified.
131
CONSTRUCTOR_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the constructor expression.
132
CONSTRUCTOR_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the constructor expression.
133
# ConstructorExpression - Semantic
134
CONSTRUCTOR_EXPRESSION_MISMATCHED_PARAMETER_TYPES = No constructors can be found that match the argument types.
135
CONSTRUCTOR_EXPRESSION_UNKNOWN_TYPE = ''{0}'' cannot be resolved to a type.
136
137
# CountFunction - Grammar
138
COUNT_FUNCTION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
139
COUNT_FUNCTION_MISSING_EXPRESSION = The encapsulated expression must be provided for a COUNT expression.
140
COUNT_FUNCTION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the COUNT expression.
141
COUNT_FUNCTION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the COUNT expression.
142
# CountFunction - Semantic
143
COUNT_FUNCTION_DISTINCT_EMBEDDABLE = The use of DISTINCT is not supported for arguments of embeddable types.
144
145
# DateTime - Grammar
146
DATE_TIME_JDBC_ESCAPE_FORMAT_INVALID_SPECIFICATION = The JDBC escape format does not start with either 'd', 't' or 'ts'.
147
DATE_TIME_JDBC_ESCAPE_FORMAT_MISSING_CLOSE_QUOTE = The JDBC escape format is missing the close quote.
148
DATE_TIME_JDBC_ESCAPE_FORMAT_MISSING_OPEN_QUOTE = The JDBC escape format is missing the open quote.
149
DATE_TIME_JDBC_ESCAPE_FORMAT_MISSING_RIGHT_CURLY_BRACE = The JDBC escape format is missing the right curly brace.
150
151
# DeleteClause - Grammar
152
DELETE_CLAUSE_FROM_MISSING = The identifier FROM is missing from the DELETE FROM clause.
153
DELETE_CLAUSE_MULTIPLE_RANGE_VARIABLE_DECLARATION = Only one entity abstract schema type can be defined.
154
DELETE_CLAUSE_RANGE_VARIABLE_DECLARATION_MALFORMED = The entity abstract schema type declaration is malformed.
155
DELETE_CLAUSE_RANGE_VARIABLE_DECLARATION_MISSING = A DELETE clause must define an entity abstract schema type.
156
157
# DivisionExpression - Semantic
158
DIVISION_EXPRESSION_LEFT_EXPRESSION_WRONG_TYPE = The left side of the division is not a valid arithmetic expression.
159
DIVISION_EXPRESSION_RIGHT_EXPRESSION_WRONG_TYPE = The right side of the division is not a valid arithmetic expression.
160
161
# EclipseLinkQueryBuilder - Validation
162
ECLIPSE_LINK_QUERY_BUILDER_GRAMMAR_VALIDATOR_ERROR_MESSAGE = Syntax error parsing the query [{0}]. {1}
163
ECLIPSE_LINK_QUERY_BUILDER_SEMANTIC_VALIDATOR_ERROR_MESSAGE = Problem compiling the query [{0}]. {1}
164
165
# EncapsulatedIdentificationVariableExpression - Semantic
166
ENCAPSULATED_IDENTIFICATION_VARIABLE_EXPRESSION_NOT_MAP_VALUED = The {0} operator may only be applied to identification variables that correspond to map-valued associations or map-valued element collections.
167
168
# EmptyCollectionComparisonExpression - Grammar
169
EMPTY_COLLECTION_COMPARISON_EXPRESSION_MISSING_EXPRESSION = The collection valued path expression must be defined.
170
171
# EntityTypeLiteral - Semantic
172
ENTITY_TYPE_LITERAL_NOT_RESOLVABLE = ''{0}'' cannot be resolved to a type.
173
174
# EntryExpression - Grammar
175
ENTRY_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
176
ENTRY_EXPRESSION_MISSING_EXPRESSION = An identification variable must be provided for an ENTRY expression.
177
ENTRY_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the ENTRY expression.
178
ENTRY_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the ENTRY expression.
179
180
# ExistsExpression - Grammar
181
EXISTS_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
182
EXISTS_EXPRESSION_MISSING_EXPRESSION = A subquery must be provided for an EXISTS expression.
183
EXISTS_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the EXISTS expression.
184
EXISTS_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the EXISTS expression.
185
186
# FuncExpression - Grammar
187
FUNC_EXPRESSION_MISSING_FUNCTION_NAME = The SQL function name must be specified.
188
FUNC_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the FUNC expression.
189
FUNC_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the FUNC expression.
190
191
# GroupByClause - Grammar
192
GROUP_BY_CLAUSE_GROUP_BY_ITEM_ENDS_WITH_COMMA = The select expression cannot end with a comma.
193
GROUP_BY_CLAUSE_GROUP_BY_ITEM_IS_MISSING_COMMA = The GROUP BY clause has ''{0}'' and ''{1}'' that are not separated by a comma.
194
GROUP_BY_CLAUSE_GROUP_BY_ITEM_MISSING = The grouping item is missing from the GROUP BY clause.
195
196
# HavingClause - Grammar
197
HAVING_CLAUSE_INVALID_CONDITIONAL_EXPRESSION = The expression is not a valid conditional expression.
198
HAVING_CLAUSE_MISSING_CONDITIONAL_EXPRESSION = The conditional expression is missing from the HAVING clause.
199
200
# IdentificationVariable - Grammar
201
IDENTIFICATION_VARIABLE_INVALID_DUPLICATE = The identification variable ''{0}'' cannot be declared more than once.
202
IDENTIFICATION_VARIABLE_INVALID_JAVA_IDENTIFIER = The identification variable ''{0}'' is not following the rules for a Java identifier.
203
IDENTIFICATION_VARIABLE_INVALID_RESERVED_WORD = The identification variable ''{0}'' cannot be a reserved word.
204
# IdentificationVariable - Semantic
205
IDENTIFICATION_VARIABLE_ENTITY_NAME = An identification variable must not have the same name as any entity in the same persistence unit.
206
IDENTIFICATION_VARIABLE_INVALID_NOT_DECLARED = The identification variable ''{0}'' is not defined in the FROM clause.
207
208
# IdentificationVariableDeclaration - Grammar
209
IDENTIFICATION_VARIABLE_DECLARATION_MISSING_RANGE_VARIABLE_DECLARATION = The range variable declaration must be specified.
210
211
# IndexExpression - Grammar
212
INDEX_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
213
INDEX_EXPRESSION_MISSING_EXPRESSION = An identification variable must be provided for an INDEX expression.
214
INDEX_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the INDEX expression.
215
INDEX_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the INDEX expression.
216
# IndexExpression - Semantic
217
INDEX_EXPRESSION_WRONG_VARIABLE = The identification variable ''{0}'' does not represent an association or element collection.
218
219
# InExpression - Grammar
220
IN_EXPRESSION_IN_ITEM_ENDS_WITH_COMMA = The items cannot end with a comma.
221
IN_EXPRESSION_IN_ITEM_IS_MISSING_COMMA = The IN expression has ''{0}'' and ''{1}'' that are not separated by a comma.
222
IN_EXPRESSION_MALFORMED_EXPRESSION = The IN expression does not have a valid state field path expression or TYPE expession.
223
IN_EXPRESSION_MISSING_IN_ITEMS = A least one item must be defined for the IN expression.
224
IN_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the IN expression.
225
IN_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the IN expression.
226
IN_EXPRESSION_MISSING_EXPRESSION = A state field path expression or TYPE expression must be defined.
227
228
# InputParameter - Grammar
229
INPUT_PARAMETER_JAVA_IDENTIFIER = The named input parameter ''{0}'' is not following the rules for a Java identifier.
230
INPUT_PARAMETER_MISSING_PARAMETER = The parameter value is missing from the input parameter.
231
INPUT_PARAMETER_MIXTURE = Named and positional input parameters must not be mixed in a single query.
232
INPUT_PARAMETER_NOT_INTEGER = The positional input parameter ''{0}'' cannot use non-Integer characters.
233
INPUT_PARAMETER_SMALLER_THAN_ONE = The number used for the positional input parameter ''{0}'' must be greater than 0.
234
INPUT_PARAMETER_WRONG_CLAUSE_DECLARATION = Input parameters can only be used in the WHERE clause or HAVING clause of a query.
235
236
# Join - Grammar
237
JOIN_MISSING_IDENTIFICATION_VARIABLE = An identification variable must be defined for a JOIN expression.
238
JOIN_MISSING_JOIN_ASSOCIATION_PATH = The join association path is missing from the JOIN expression.
239
240
# JoinFetch - Grammar
241
JOIN_FETCH_MISSING_JOIN_ASSOCIATION_PATH = The join association path is missing from the JOIN FETCH expression.
242
JOIN_FETCH_WRONG_CLAUSE_DECLARATION = JOIN FETCH expressions cannot be used in a FROM clause of a subquery.
243
244
# JPQLExpression - Grammar
245
JPQL_EXPRESSION_INVALID_QUERY = The query does not start with a valid identifier, has to be either SELECT, UPDATE or DELETE FROM.
246
JPQL_EXPRESSION_UNKNOWN_ENDING = The query contains a malformed ending.
247
248
# KeyExpression - Grammar
249
KEY_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
250
KEY_EXPRESSION_MISSING_EXPRESSION = The identification variable must be provided for an ABS expression.
251
KEY_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the ABS expression.
252
KEY_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the ABS expression.
253
254
# LengthExpression - Grammar
255
LENGTH_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
256
LENGTH_EXPRESSION_MISSING_EXPRESSION = An expression must be provided for a LENGTH expression.
257
LENGTH_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the LENGTH expression.
258
LENGTH_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the LENGTH expression.
259
# LikeExpression - Semantic
260
LENGTH_EXPRESSION_WRONG_TYPE = The encapsulated expression is not of string type.
261
262
# LikeExpression - Grammar
263
LIKE_EXPRESSION_INVALID_ESCAPE_CHARACTER = {0} is not a valid escape character.
264
LIKE_EXPRESSION_MISSING_ESCAPE_CHARACTER = The escape character is missing from the LIKE expression.
265
LIKE_EXPRESSION_MISSING_PATTERN_VALUE = The pattern value is missing from the LIKE expression.
266
LIKE_EXPRESSION_MISSING_STRING_EXPRESSION = The string expression is missing from the LIKE expression.
267
268
# LocateExpression - Grammar
269
LOCATE_EXPRESSION_INVALID_FIRST_EXPRESSION = The first argument is not a valid expression.
270
LOCATE_EXPRESSION_INVALID_SECOND_EXPRESSION = The second argument is not a valid expression.
271
LOCATE_EXPRESSION_INVALID_THIRD_EXPRESSION = The third argument is not a valid expression.
272
LOCATE_EXPRESSION_MISSING_FIRST_EXPRESSION = The first argument is missing from the LOCATE expression.
273
LOCATE_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the LOCATE expression.
274
LOCATE_EXPRESSION_MISSING_FIRST_COMMA = The first comma is missing from the LOCATE expression.
275
LOCATE_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the LOCATE expression.
276
LOCATE_EXPRESSION_MISSING_SECOND_COMMA = The second comma is missing from the LOCATE expression.
277
LOCATE_EXPRESSION_MISSING_SECOND_EXPRESSION = The second argument is missing from the LOCATE expression.
278
LOCATE_EXPRESSION_MISSING_THIRD_EXPRESSION = The third argument is missing from the LOCATE expression.
279
# LocateExpression - Semantic
280
LOCATE_EXPRESSION_FIRST_EXPRESSION_WRONG_TYPE = The first expression is not of string type.
281
LOCATE_EXPRESSION_SECOND_EXPRESSION_WRONG_TYPE = The second expression is not of string type.
282
LOCATE_EXPRESSION_THIRD_EXPRESSION_WRONG_TYPE = The third encapsulated expression is not of numeric type.
283
284
# LogicalExpression - Grammar
285
LOGICAL_EXPRESSION_INVALID_LEFT_EXPRESSION = The left expression is missing from the logical expression.
286
LOGICAL_EXPRESSION_INVALID_RIGHT_EXPRESSION = The right expression is missing from the logical expression.
287
LOGICAL_EXPRESSION_MISSING_LEFT_EXPRESSION = The left expression is not a valid expression.
288
LOGICAL_EXPRESSION_MISSING_RIGHT_EXPRESSION = The right expression is not a valid expression.
289
290
# LowerExpression - Grammar
291
LOWER_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
292
LOWER_EXPRESSION_MISSING_EXPRESSION = An expression must be provided for a LOWER expression.
293
LOWER_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the LOWER expression.
294
LOWER_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the LOWER expression.
295
# UpperExpression - Semantic
296
LOWER_EXPRESSION_WRONG_TYPE = The expression is not a String.
297
298
# MaxFunction - Grammar
299
MAX_FUNCTION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
300
MAX_FUNCTION_MISSING_EXPRESSION = The encapsulated expression must be provided for a MAX expression.
301
MAX_FUNCTION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the MAX expression.
302
MAX_FUNCTION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the MAX expression.
303
304
# MinFunction - Grammar
305
MIN_FUNCTION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
306
MIN_FUNCTION_MISSING_EXPRESSION = The encapsulated expression must be provided for a MIN expression.
307
MIN_FUNCTION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the MIN expression.
308
MIN_FUNCTION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the MIN expression.
309
310
# ModExpression - Grammar
311
MOD_EXPRESSION_INVALID_FIRST_EXPRESSION = The first argument is not a valid expression.
312
MOD_EXPRESSION_INVALID_SECOND_PARENTHESIS = The second argument is not a valid expression.
313
MOD_EXPRESSION_MISSING_COMMA = The comma is missing from the MOD expression.
314
MOD_EXPRESSION_MISSING_FIRST_EXPRESSION = The first argument is missing from the MOD expression.
315
MOD_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the MOD expression.
316
MOD_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the MOD expression.
317
MOD_EXPRESSION_MISSING_SECOND_EXPRESSION = The second argument is missing from the MOD expression.
318
# ModExpression - Semantic
319
MOD_EXPRESSION_FIRST_EXPRESSION_WRONG_TYPE = The first expression is not an Integer.
320
MOD_EXPRESSION_SECOND_EXPRESSION_WRONG_TYPE = The second expression is not an Integer.
321
322
# MultiplicationExpression - Semantic
323
MULTIPLICATION_EXPRESSION_LEFT_EXPRESSION_WRONG_TYPE = The left side of the multiplication is not a valid arithmetic expression.
324
MULTIPLICATION_EXPRESSION_RIGHT_EXPRESSION_WRONG_TYPE = The right side of the multiplication is not a valid arithmetic expression.
325
326
# NotExpression - Grammar
327
NOT_EXPRESSION_MISSING_EXPRESSION = The expression is missing after the identifier NOT.
328
# NotExpression - Semantic
329
NOT_EXPRESSION_WRONG_TYPE = The expression is not of boolean type.
330
331
# NullComparisonExpression - Grammar
332
NULL_COMPARISON_EXPRESSION_MISSING_EXPRESSION = The expression is missing from the null comparison expression.
333
# NullComparisonExpression - Semantic
334
NULL_COMPARISON_EXPRESSION_INVALID_TYPE = ''{0}'' cannot be resolved to an embeddable.
335
336
# NullIfExpression - Grammar
337
NULL_IF_EXPRESSION_INVALID_FIRST_EXPRESSION = The first argument is not a valid expression.
338
NULL_IF_EXPRESSION_INVALID_SECOND_EXPRESSION = The second argument is not a valid expression.
339
NULL_IF_EXPRESSION_MISSING_COMMA = The comma is missing from the NULLIF expression.
340
NULL_IF_EXPRESSION_MISSING_FIRST_EXPRESSION = The first argument is missing from the NULLIF expression.
341
NULL_IF_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the NULLIF expression.
342
NULL_IF_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the NULLIF expression.
343
NULL_IF_EXPRESSION_MISSING_SECOND_EXPRESSION = The second argument is missing from the NULLIF expression.
344
345
# NumericLiteral - Grammar
346
NUMERIC_LITERAL_INVALID = ''{0}'' is not a valid numeric value.
347
348
# ObjectByItem - Grammar
349
ORDER_BY_ITEM_INVALID_PATH = ''{0}'' is not a valid state field path expression.
350
ORDER_BY_ITEM_MISSING_STATE_FIELD_PATH_EXPRESSION = A state field path expression must be specified.
351
352
# ObjectExpression - Grammar
353
OBJECT_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
354
OBJECT_EXPRESSION_MISSING_EXPRESSION = An identification variable must be provided for an OBJECT expression.
355
OBJECT_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the OBJECT expression.
356
OBJECT_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the OBJECT expression.
357
358
# OrderByClause - Grammar
359
ORDER_BY_CLAUSE_ORDER_BY_ITEM_ENDS_WITH_COMMA = The select expression cannot end with a comma.
360
ORDER_BY_CLAUSE_ORDER_BY_ITEM_IS_MISSING_COMMA = The ORDER BY clause has ''{0}'' and ''{1}'' that are not separated by a comma.
361
ORDER_BY_CLAUSE_ORDER_BY_ITEM_MISSING = The ordering item is missing from the ORDER BY clause.
362
363
# RangeVariableDeclaration - Grammar
364
RANGE_VARIABLE_DECLARATION_MISSING_ABSTRACT_SCHEMA_NAME = An abstract schema name must be specified.
365
RANGE_VARIABLE_DECLARATION_MISSING_IDENTIFICATION_VARIABLE = An identification variable must be provider for a range variable declaration.
366
367
# ResultVariable - Grammar
368
RESULT_VARIABLE_MISSING_SELECT_EXPRESSION = The select item is missing from the result variable declaration.
369
RESULT_VARIABLE_MISSING_RESULT_VARIABLE = The result variable is missing from the select item declaration.
370
371
# SelectStatement - Semantic
372
SELECT_STATEMENT_SELECT_CLAUSE_HAS_NON_AGGREGATE_FUNCTIONS = The select list can only consist of aggregate functions because there is no GROUP BY clause and the HAVING clause is used.
373
374
# SimpleSelectClause - Grammar
375
SIMPLE_SELECT_CLAUSE_NOT_SINGLE_EXPRESSION = Only one expression can be declared in a SELECT clause of a subquery.
376
377
# SizeExpression - Grammar
378
SIZE_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
379
SIZE_EXPRESSION_MISSING_EXPRESSION = A collection-valued path expression must be provided for a SIZE expression.
380
SIZE_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the SIZE expression.
381
SIZE_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the SIZE expression.
382
383
# SqrtExpression - Grammar
384
SQRT_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
385
SQRT_EXPRESSION_MISSING_EXPRESSION = An expression must be provided for a SQRT expression.
386
SQRT_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the SQRT expression.
387
SQRT_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the SQRT expression.
388
# SqrtExpression - Semantic
389
SQRT_EXPRESSION_WRONG_TYPE = The expression is not a numeric type.
390
391
# StateFieldPathExpression - Semantic
392
STATE_FIELD_PATH_EXPRESSION_ASSOCIATION_FIELD = The association field ''{0}'' cannot be used as a state field path.
393
STATE_FIELD_PATH_EXPRESSION_COLLECTION_TYPE = The state field path ''{0}'' cannot be resolved to a collection type.
394
STATE_FIELD_PATH_EXPRESSION_INVALID_ENUM_CONSTANT = ''{0}'' cannot be resolved to an Enum constant.
395
STATE_FIELD_PATH_EXPRESSION_NO_MAPPING = No mapping is associated with the state field path ''{0}''.
396
STATE_FIELD_PATH_EXPRESSION_NOT_RESOLVABLE = The state field path ''{0}'' cannot be resolved to a valid type.
397
398
# SubExpression - Grammar
399
SUB_EXPRESSION_MISSING_EXPRESSION = The encapsulated expression is missing.
400
SUB_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the sub-expression.
401
402
# SubstractionExpression - Semantic
403
SUBTRACTION_EXPRESSION_LEFT_EXPRESSION_WRONG_TYPE = The left side of the subtraction is not a valid arithmetic expression.
404
SUBTRACTION_EXPRESSION_RIGHT_EXPRESSION_WRONG_TYPE = The right side of the subtraction is not a valid arithmetic expression.
405
406
# SubstringExpression - Grammar
407
SUBSTRING_EXPRESSION_INVALID_FIRST_EXPRESSION = The first argument is not a valid expression.
408
SUBSTRING_EXPRESSION_INVALID_SECOND_EXPRESSION = The second argument is not a valid expression.
409
SUBSTRING_EXPRESSION_INVALID_THIRD_EXPRESSION = The third argument is not a valid expression.
410
SUBSTRING_EXPRESSION_MISSING_FIRST_COMMA = The first comma is missing from the SUBSTRING expression.
411
SUBSTRING_EXPRESSION_MISSING_FIRST_EXPRESSION = The first argument is missing from the SUBSTRING expression.
412
SUBSTRING_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the SUBSTRING expression.
413
SUBSTRING_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the SUBSTRING expression.
414
SUBSTRING_EXPRESSION_MISSING_SECOND_COMMA = The second comma is missing from the SUBSTRING expression.
415
SUBSTRING_EXPRESSION_MISSING_SECOND_EXPRESSION = The second argument is missing from the SUBSTRING expression.
416
SUBSTRING_EXPRESSION_MISSING_THIRD_EXPRESSION = The third argument is missing from the SUBSTRING expression.
417
# SubstringExpression - Semantic
418
SUBSTRING_EXPRESSION_FIRST_EXPRESSION_WRONG_TYPE = The first argument is not a String value.
419
SUBSTRING_EXPRESSION_SECOND_EXPRESSION_WRONG_TYPE = The first argument is not an integer value.
420
SUBSTRING_EXPRESSION_THIRD_EXPRESSION_WRONG_TYPE = The first argument is not an integer value.
421
422
# SumFunction - Grammar
423
SUM_FUNCTION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
424
SUM_FUNCTION_MISSING_EXPRESSION = The encapsulated expression must be provided for a SUM expression.
425
SUM_FUNCTION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the SUM expression.
426
SUM_FUNCTION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the SUM expression.
427
# SumFunction - Semantic
428
SUM_FUNCTION_WRONG_TYPE = The argument must be numeric.
429
430
# TrimExpression - Grammar
431
TRIM_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
432
TRIM_EXPRESSION_INVALID_TRIM_CHARACTER = The trim character should be a single-character string literal or a character-valued input parameter (i.e., char or Character).
433
TRIM_EXPRESSION_MISSING_EXPRESSION = An expression must be provided for a TRIM expression.
434
TRIM_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the TRIM expression.
435
TRIM_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the TRIM expression.
436
TRIM_EXPRESSION_NOT_SINGLE_STRING_LITERAL = The trim character should be a single-character string literal.
437
438
# TypeExpression - Grammar
439
TYPE_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
440
TYPE_EXPRESSION_MISSING_EXPRESSION = An identification variable or a path expression must be provided for a TYPE expression.
441
TYPE_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the TYPE expression.
442
TYPE_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the TYPE expression.
443
# TypeExpression - Semantic
444
445
# UpdateClause - Grammar
446
UPDATE_CLAUSE_MISSING_RANGE_VARIABLE_DECLARATION = The range variable declaration is missing from the UPDATE clause.
447
UPDATE_CLAUSE_MISSING_SET = The SET identifier is missing from the UPDATE clause.
448
UPDATE_CLAUSE_MISSING_UPDATE_ITEMS = At least one update item must be specified for an UPDATE clause.
449
UPDATE_CLAUSE_UPDATE_ITEM_ENDS_WITH_COMMA = The update item cannot end with a comma.
450
UPDATE_CLAUSE_UPDATE_ITEM_IS_MISSING_COMMA = The UPDATE clause has ''{0}'' and ''{1}'' that are not separated by a comma.
451
452
# UpdateItem - Grammar
453
UPDATE_ITEM_MISSING_EQUAL_SIGN = The equal sign must be specified.
454
UPDATE_ITEM_MISSING_NEW_VALUE = The new value must be specified.
455
UPDATE_ITEM_MISSING_STATE_FIELD_PATH_EXPRESSION = The state field path expression is missing.
456
# UpdateItem - Semantic
457
UPDATE_ITEM_NOT_ASSIGNABLE = Type mismatch: cannot convert from {0} to {1}.
458
UPDATE_ITEM_NOT_RESOLVABLE = The state field cannot be resolved.
459
460
# UpperExpression - Grammar
461
UPPER_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
462
UPPER_EXPRESSION_MISSING_EXPRESSION = An expression must be provided for a UPPER expression.
463
UPPER_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the UPPER expression.
464
UPPER_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the UPPER expression.
465
# UpperExpression - Semantic
466
UPPER_EXPRESSION_WRONG_TYPE = The expression is not a String.
467
468
# ValueExpression - Grammar
469
VALUE_EXPRESSION_INVALID_EXPRESSION = The encapsulated expression is not a valid expression.
470
VALUE_EXPRESSION_MISSING_EXPRESSION = An identification variable must be provided for a VALUE expression.
471
VALUE_EXPRESSION_MISSING_LEFT_PARENTHESIS = The left parenthesis is missing from the VALUE expression.
472
VALUE_EXPRESSION_MISSING_RIGHT_PARENTHESIS = The right parenthesis is missing from the VALUE expression.
473
474
# WhenClause - Grammar
475
WHEN_CLAUSE_MISSING_THEN_EXPRESSION = A conditional expression must be provider for a WHEN clause.
476
WHEN_CLAUSE_MISSING_THEN_IDENTIFIER = The identifier THEN is missing from the WHEN clause.
477
WHEN_CLAUSE_MISSING_WHEN_EXPRESSION = A WHEN expression must be provided for a WHEN clause.
478
479
# WhereClause - Grammar
480
WHERE_CLAUSE_INVALID_CONDITIONAL_EXPRESSION = The expression is not a valid conditional expression.
481
WHERE_CLAUSE_MISSING_CONDITIONAL_EXPRESSION = The conditional expression is missing from the WHERE clause.
(-)src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java (-2 / +3 lines)
Lines 21-27 Link Here
21
 * stability. It is available at this early stage to solicit feedback from
21
 * stability. It is available at this early stage to solicit feedback from
22
 * pioneering adopters on the understanding that any code that uses this API
22
 * pioneering adopters on the understanding that any code that uses this API
23
 * will almost certainly be broken (repeatedly) as the API evolves.
23
 * will almost certainly be broken (repeatedly) as the API evolves.
24
 * 
24
 *
25
 * @version 2.1
25
 * @version 2.1
26
 * @since 2.0
26
 * @since 2.0
27
 */
27
 */
Lines 32-35 Link Here
32
32
33
	// required to resolve ambiguity
33
	// required to resolve ambiguity
34
	ListIterable<OrmQueryHint> getHints();
34
	ListIterable<OrmQueryHint> getHints();
35
}
35
36
}
(-)src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java (-2 / +4 lines)
Lines 3-9 Link Here
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
6
 * 
6
 *
7
 * Contributors:
7
 * Contributors:
8
 *     Oracle - initial API and implementation
8
 *     Oracle - initial API and implementation
9
 ******************************************************************************/
9
 ******************************************************************************/
Lines 23-29 Link Here
23
 * stability. It is available at this early stage to solicit feedback from
23
 * stability. It is available at this early stage to solicit feedback from
24
 * pioneering adopters on the understanding that any code that uses this API
24
 * pioneering adopters on the understanding that any code that uses this API
25
 * will almost certainly be broken (repeatedly) as the API evolves.
25
 * will almost certainly be broken (repeatedly) as the API evolves.
26
 * 
26
 *
27
 * @version 2.1
27
 * @version 2.1
28
 * @since 2.0
28
 * @since 2.0
29
 */
29
 */
Lines 46-49 Link Here
46
	// ********** validation **********
46
	// ********** validation **********
47
47
48
	TextRange getNameTextRange();
48
	TextRange getNameTextRange();
49
50
	TextRange getQueryTextRange();
49
}
51
}
(-)src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java (-2 / +5 lines)
Lines 10-16 Link Here
10
package org.eclipse.jpt.jpa.core.internal.context.orm;
10
package org.eclipse.jpt.jpa.core.internal.context.orm;
11
11
12
import java.util.Vector;
12
import java.util.Vector;
13
14
import org.eclipse.jpt.common.core.utility.TextRange;
13
import org.eclipse.jpt.common.core.utility.TextRange;
15
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
14
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
16
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
15
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
Lines 55-61 Link Here
55
	// ********** synchronize/update **********
54
	// ********** synchronize/update **********
56
55
57
	@Override
56
	@Override
58
	public void synchronizeWithResourceModel() { 
57
	public void synchronizeWithResourceModel() {
59
		super.synchronizeWithResourceModel();
58
		super.synchronizeWithResourceModel();
60
		this.setName_(this.xmlQuery.getName());
59
		this.setName_(this.xmlQuery.getName());
61
		this.setQuery_(this.xmlQuery.getQuery());
60
		this.setQuery_(this.xmlQuery.getQuery());
Lines 231-236 Link Here
231
		return this.xmlQuery.getNameTextRange();
230
		return this.xmlQuery.getNameTextRange();
232
	}
231
	}
233
232
233
	public TextRange getQueryTextRange() {
234
		return this.xmlQuery.getQueryTextRange();
235
	}
236
234
	@Override
237
	@Override
235
	public void toString(StringBuilder sb) {
238
	public void toString(StringBuilder sb) {
236
		sb.append(this.name);
239
		sb.append(this.name);
(-)src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java (-3 / +40 lines)
Lines 1-18 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2010 Oracle. All rights reserved.
2
 * Copyright (c) 2007, 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
6
 * 
6
 *
7
 * Contributors:
7
 * Contributors:
8
 *     Oracle - initial API and implementation
8
 *     Oracle - initial API and implementation
9
 ******************************************************************************/
9
 ******************************************************************************/
10
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
10
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
11
11
12
import java.util.List;
13
import org.eclipse.jdt.core.dom.CompilationUnit;
14
import org.eclipse.jpt.common.core.utility.TextRange;
12
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
15
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
13
import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
16
import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
14
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery;
17
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery;
18
import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
19
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
20
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationPreferences;
15
import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
21
import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
22
import org.eclipse.persistence.jpa.jpql.JPQLQueryProblem;
23
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
24
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
16
25
17
/**
26
/**
18
 * Java named query
27
 * Java named query
Lines 24-27 Link Here
24
	public GenericJavaNamedQuery(JavaJpaContextNode parent, NamedQueryAnnotation queryAnnotation) {
33
	public GenericJavaNamedQuery(JavaJpaContextNode parent, NamedQueryAnnotation queryAnnotation) {
25
		super(parent, queryAnnotation);
34
		super(parent, queryAnnotation);
26
	}
35
	}
27
}
36
37
38
	// ********** validation **********
39
40
	private boolean shouldValidate() {
41
		return JpaValidationPreferences.getProblemSeverityPreference(this, JpaValidationMessages.JPQL_QUERY_VALIDATION) == -1;
42
	}
43
44
	/**
45
	 * {@inheritDoc}
46
	 */
47
	@Override
48
	public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
49
		super.validate(messages, reporter, astRoot);
50
51
		// Make this quick check so we don't validate the query, which is time consuming
52
		if (shouldValidate()) {
53
			JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper(this);
54
			String parsedJpqlQuery = helper.getParsedJPQLQuery();
55
			String actualQuery = getQuery();
56
57
			for (JPQLQueryProblem problem : helper.validate()) {
58
				TextRange textRange = this.getQueryAnnotation().getQueryTextRange(astRoot);
59
				IMessage message = helper.buildProblem(this, textRange, problem, parsedJpqlQuery, actualQuery, 1);
60
				messages.add(message);
61
			}
62
		}
63
	}
64
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java (-2 / +5 lines)
Lines 308-317 Link Here
308
	@Override
308
	@Override
309
	public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
309
	public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
310
		super.validate(messages, reporter, astRoot);
310
		super.validate(messages, reporter, astRoot);
311
		this.validateQueries(messages, astRoot);
311
		this.validateQueries(messages, reporter, astRoot);
312
	}
312
	}
313
313
314
	protected void validateQueries(List<IMessage> messages, CompilationUnit astRoot) {
314
	protected void validateQueries(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
315
		for (Iterator<JavaQuery> localQueries = this.queries(); localQueries.hasNext(); ) {
315
		for (Iterator<JavaQuery> localQueries = this.queries(); localQueries.hasNext(); ) {
316
			JavaQuery localQuery = localQueries.next();
316
			JavaQuery localQuery = localQueries.next();
317
			String name = localQuery.getName();
317
			String name = localQuery.getName();
Lines 354-359 Link Here
354
						)
354
						)
355
				);
355
				);
356
			}
356
			}
357
			else {
358
				localQuery.validate(messages, reporter, astRoot);
359
			}
357
		}
360
		}
358
	}
361
	}
359
362
(-)src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java (-3 / +38 lines)
Lines 1-18 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2010 Oracle. All rights reserved.
2
 * Copyright (c) 2007, 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
6
 * 
6
 *
7
 * Contributors:
7
 * Contributors:
8
 *     Oracle - initial API and implementation
8
 *     Oracle - initial API and implementation
9
 ******************************************************************************/
9
 ******************************************************************************/
10
package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
10
package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
11
11
12
import java.util.List;
13
import org.eclipse.jpt.common.core.utility.TextRange;
12
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
14
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
13
import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
15
import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
14
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
16
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
17
import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
18
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
19
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationPreferences;
15
import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
20
import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
21
import org.eclipse.persistence.jpa.jpql.JPQLQueryProblem;
22
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
23
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
16
24
17
/**
25
/**
18
 * <code>orm.xml</code> named query
26
 * <code>orm.xml</code> named query
Lines 24-27 Link Here
24
	public GenericOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) {
32
	public GenericOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) {
25
		super(parent, resourceNamedQuery);
33
		super(parent, resourceNamedQuery);
26
	}
34
	}
27
}
35
36
	// ********** validation **********
37
38
	private boolean shouldValidate() {
39
		return JpaValidationPreferences.getProblemSeverityPreference(this, JpaValidationMessages.JPQL_QUERY_VALIDATION) == -1;
40
	}
41
42
	/**
43
	 * {@inheritDoc}
44
	 */
45
	@Override
46
	public void validate(List<IMessage> messages, IReporter reporter) {
47
		super.validate(messages, reporter);
48
49
		// Make this quick check so we don't validate the query, which is time consuming
50
		if (shouldValidate()) {
51
			JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper(this);
52
			String parsedJpqlQuery = helper.getParsedJPQLQuery();
53
			String actualQuery = getQuery();
54
55
			for (JPQLQueryProblem problem : helper.validate()) {
56
				TextRange textRange = this.getQueryTextRange();
57
				IMessage message = helper.buildProblem(this, textRange, problem, parsedJpqlQuery, actualQuery, 0);
58
				messages.add(message);
59
			}
60
		}
61
	}
62
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java (-3 / +5 lines)
Lines 14-20 Link Here
14
import java.util.List;
14
import java.util.List;
15
import java.util.ListIterator;
15
import java.util.ListIterator;
16
import java.util.Vector;
16
import java.util.Vector;
17
18
import org.eclipse.jpt.common.core.utility.TextRange;
17
import org.eclipse.jpt.common.core.utility.TextRange;
19
import org.eclipse.jpt.common.utility.internal.StringTools;
18
import org.eclipse.jpt.common.utility.internal.StringTools;
20
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
19
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
Lines 300-309 Link Here
300
	@Override
299
	@Override
301
	public void validate(List<IMessage> messages, IReporter reporter) {
300
	public void validate(List<IMessage> messages, IReporter reporter) {
302
		super.validate(messages, reporter);
301
		super.validate(messages, reporter);
303
		this.validateQueries(messages);
302
		this.validateQueries(messages, reporter);
304
	}
303
	}
305
304
306
	protected void validateQueries(List<IMessage> messages) {
305
	protected void validateQueries(List<IMessage> messages, IReporter reporter) {
307
		for (OrmQuery localQuery : this.getQueries()) {
306
		for (OrmQuery localQuery : this.getQueries()) {
308
			String name = localQuery.getName();
307
			String name = localQuery.getName();
309
			if (StringTools.stringIsEmpty(name)){
308
			if (StringTools.stringIsEmpty(name)){
Lines 345-350 Link Here
345
						)
344
						)
346
				);
345
				);
347
			}
346
			}
347
			else {
348
				localQuery.validate(messages, reporter);
349
			}
348
		}
350
		}
349
	}
351
	}
350
352
(-)src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java (-2 / +38 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
* Copyright (c) 2009, 2010 Oracle. All rights reserved.
2
* Copyright (c) 2009, 2011 Oracle. All rights reserved.
3
* This program and the accompanying materials are made available under the
3
* This program and the accompanying materials are made available under the
4
* terms of the Eclipse Public License v1.0, which accompanies this distribution
4
* terms of the Eclipse Public License v1.0, which accompanies this distribution
5
* and is available at http://www.eclipse.org/legal/epl-v10.html.
5
* and is available at http://www.eclipse.org/legal/epl-v10.html.
Lines 9-19 Link Here
9
*******************************************************************************/
9
*******************************************************************************/
10
package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
10
package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
11
11
12
import java.util.List;
13
import org.eclipse.jdt.core.dom.CompilationUnit;
14
import org.eclipse.jpt.common.core.utility.TextRange;
12
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
15
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
13
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery;
16
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery;
17
import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
18
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
19
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationPreferences;
14
import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0;
20
import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0;
15
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaNamedQuery2_0;
21
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaNamedQuery2_0;
16
import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
22
import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
23
import org.eclipse.persistence.jpa.jpql.JPQLQueryProblem;
24
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
25
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
17
26
18
/**
27
/**
19
 * JPA 2.0
28
 * JPA 2.0
Lines 87-90 Link Here
87
		return LockModeType2_0.NONE;
96
		return LockModeType2_0.NONE;
88
	}
97
	}
89
98
90
}
99
100
	// ********** validation **********
101
102
	private boolean shouldValidate() {
103
		return JpaValidationPreferences.getProblemSeverityPreference(this, JpaValidationMessages.JPQL_QUERY_VALIDATION) == -1;
104
	}
105
106
	/**
107
	 * {@inheritDoc}
108
	 */
109
	@Override
110
	public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
111
		super.validate(messages, reporter, astRoot);
112
113
		// Make this quick check so we don't validate the query, which is time consuming
114
		if (shouldValidate()) {
115
			JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper(this);
116
			String parsedJpqlQuery = helper.getParsedJPQLQuery();
117
			String actualQuery = getQuery();
118
119
			for (JPQLQueryProblem problem : helper.validate()) {
120
				TextRange textRange = this.getQueryAnnotation().getQueryTextRange(astRoot);
121
				IMessage message = helper.buildProblem(this, textRange, problem, parsedJpqlQuery, actualQuery, 1);
122
				messages.add(message);
123
			}
124
		}
125
	}
126
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java (-3 / +37 lines)
Lines 1-19 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2010 Oracle. All rights reserved.
2
 * Copyright (c) 2007, 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
6
 * 
6
 *
7
 * Contributors:
7
 * Contributors:
8
 *     Oracle - initial API and implementation
8
 *     Oracle - initial API and implementation
9
 ******************************************************************************/
9
 ******************************************************************************/
10
package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
10
package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
11
11
12
import java.util.List;
13
import org.eclipse.jpt.common.core.utility.TextRange;
12
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
14
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
13
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
15
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
16
import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
17
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
18
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationPreferences;
14
import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0;
19
import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0;
15
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmNamedQuery2_0;
20
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmNamedQuery2_0;
16
import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
21
import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
22
import org.eclipse.persistence.jpa.jpql.JPQLQueryProblem;
23
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
24
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
17
25
18
/**
26
/**
19
 * JPA 2.0
27
 * JPA 2.0
Lines 87-90 Link Here
87
		return LockModeType2_0.NONE;
95
		return LockModeType2_0.NONE;
88
	}
96
	}
89
97
90
}
98
	// ********** validation **********
99
100
	private boolean shouldValidate() {
101
		return JpaValidationPreferences.getProblemSeverityPreference(this, JpaValidationMessages.JPQL_QUERY_VALIDATION) == -1;
102
	}
103
104
	/**
105
	 * {@inheritDoc}
106
	 */
107
	@Override
108
	public void validate(List<IMessage> messages, IReporter reporter) {
109
		super.validate(messages, reporter);
110
111
		// Make this quick check so we don't validate the query, which is time consuming
112
		if (shouldValidate()) {
113
			JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper(this);
114
			String parsedJpqlQuery = helper.getParsedJPQLQuery();
115
			String actualQuery = getQuery();
116
117
			for (JPQLQueryProblem problem : helper.validate()) {
118
				TextRange textRange = this.getQueryTextRange();
119
				IMessage message = helper.buildProblem(this, textRange, problem, parsedJpqlQuery, actualQuery, 0);
120
				messages.add(message);
121
			}
122
		}
123
	}
124
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaConstructor.java (+102 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import org.eclipse.jdt.core.dom.IMethodBinding;
17
import org.eclipse.jdt.core.dom.ITypeBinding;
18
import org.eclipse.jdt.core.dom.MethodDeclaration;
19
import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
20
import org.eclipse.persistence.jpa.jpql.spi.IType;
21
import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
22
23
/**
24
 * The concrete implementation of {@link IConstructor} that is wrapping the design-time
25
 * representation of a Java constructor.
26
 *
27
 * @version 3.0
28
 * @since 3.0
29
 * @author Pascal Filion
30
 */
31
final class JpaConstructor implements IConstructor {
32
33
	/**
34
	 * The design-time representation of a Java constructor.
35
	 */
36
	private final MethodDeclaration method;
37
38
	/**
39
	 * The cached {@link ITypeDeclaration ITypeDeclarations} representing each of the constructor's
40
	 * parameter types.
41
	 */
42
	private ITypeDeclaration[] typeDeclarations;
43
44
	/**
45
	 * The repository of Java types.
46
	 */
47
	private final JpaTypeRepository typeRepository;
48
49
	/**
50
	 * Creates a new <code>JpaConstructor</code>.
51
	 *
52
	 * @param typeRepository The repository of Java types
53
	 * @param method The design-time representation of a Java constructor
54
	 */
55
	JpaConstructor(JpaTypeRepository typeRepository, MethodDeclaration method) {
56
		super();
57
		this.method         = method;
58
		this.typeRepository = typeRepository;
59
	}
60
61
	private ITypeDeclaration buildTypeDeclaration(ITypeBinding parameterType) {
62
63
		boolean array = parameterType.isArray();
64
		String typeName = array ? parameterType.getComponentType().getBinaryName() : parameterType.getBinaryName();
65
66
		// Retrieve the fully qualified name of the type
67
		ITypeBinding[] typeArguments = parameterType.getTypeArguments();
68
		ITypeDeclaration[] genericTypes = new ITypeDeclaration[typeArguments.length];
69
		int index = 0;
70
71
		for (ITypeBinding typeArgument : typeArguments) {
72
			String genericTypeName = typeArgument.getErasure().getBinaryName();
73
			IType genericType = typeRepository.getType(genericTypeName);
74
			genericTypes[index++] = genericType.getTypeDeclaration();
75
		}
76
77
		return new JpaTypeDeclaration(typeRepository.getType(typeName), genericTypes, array);
78
	}
79
80
	private ITypeDeclaration[] buildTypeDeclarations() {
81
82
		IMethodBinding binding = method.resolveBinding();
83
		ITypeBinding[] parameterTypes = binding.getParameterTypes();
84
		ITypeDeclaration[] declarations = new ITypeDeclaration[parameterTypes.length];
85
86
		for (int index = declarations.length; --index >= 0; ) {
87
			declarations[index] = buildTypeDeclaration(parameterTypes[index]);
88
		}
89
90
		return declarations;
91
	}
92
93
	/**
94
	 * {@inheritDoc}
95
	 */
96
	public ITypeDeclaration[] getParameterTypes() {
97
		if (typeDeclarations == null) {
98
			typeDeclarations = buildTypeDeclarations();
99
		}
100
		return typeDeclarations;
101
	}
102
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEmbeddable.java (+55 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import org.eclipse.jpt.jpa.core.context.Embeddable;
17
import org.eclipse.persistence.jpa.jpql.spi.IEmbeddable;
18
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
19
20
/**
21
 * The concrete implementation of {@link IEmbeddable} that is wrapping the design-time
22
 * representation of a JPA embeddable.
23
 *
24
 * @version 3.0
25
 * @since 3.0
26
 * @author Pascal Filion
27
 */
28
final class JpaEmbeddable extends JpaManagedType
29
                          implements IEmbeddable {
30
31
	/**
32
	 * Creates a new <code>JpaEmbeddable</code>.
33
	 *
34
	 * @param provider The provider of JPA managed types
35
	 * @param embeddable The design-time model object wrapped by this class
36
	 */
37
	JpaEmbeddable(JpaManagedTypeProvider provider, Embeddable embeddable) {
38
		super(provider, embeddable);
39
	}
40
41
	/**
42
	 * {@inheritDoc}
43
	 */
44
	public void accept(IManagedTypeVisitor visitor) {
45
		visitor.visit(this);
46
	}
47
48
	/**
49
	 * {@inheritDoc}
50
	 */
51
	@Override
52
	Embeddable getManagedType() {
53
		return (Embeddable) super.getManagedType();
54
	}
55
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java (+103 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import java.util.HashMap;
17
import java.util.ListIterator;
18
import java.util.Map;
19
import org.eclipse.jpt.jpa.core.context.Entity;
20
import org.eclipse.jpt.jpa.core.context.NamedQuery;
21
import org.eclipse.persistence.jpa.jpql.spi.IEntity;
22
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
23
import org.eclipse.persistence.jpa.jpql.spi.IQuery;
24
25
/**
26
 * The concrete implementation of {@link IEntity} that is wrapping the design-time representation
27
 * of a JPA entity.
28
 *
29
 * @version 3.0
30
 * @since 3.0
31
 * @author Pascal Filion
32
 */
33
abstract class JpaEntity extends JpaManagedType
34
                         implements IEntity {
35
36
	/**
37
	 * The cached used to quickly retrieve any queries that have been cached.
38
	 */
39
	private Map<String, IQuery> queries;
40
41
	/**
42
	 * Creates a new <code>JpaEntity</code>.
43
	 *
44
	 * @param provider The provider of JPA managed types
45
	 * @param entity The design-time model object wrapped by this class
46
	 */
47
	JpaEntity(JpaManagedTypeProvider provider, Entity entity) {
48
		super(provider, entity);
49
	}
50
51
	/**
52
	 * {@inheritDoc}
53
	 */
54
	public void accept(IManagedTypeVisitor visitor) {
55
		visitor.visit(this);
56
	}
57
58
	final IQuery buildQuery(JpaManagedTypeProvider provider, NamedQuery namedQuery) {
59
		return new JpaQuery(provider, namedQuery);
60
	}
61
62
	/**
63
	 * {@inheritDoc}
64
	 */
65
	@Override
66
	Entity getManagedType() {
67
		return (Entity) super.getManagedType();
68
	}
69
70
	/**
71
	 * {@inheritDoc}
72
	 */
73
	public final String getName() {
74
		return getManagedType().getName();
75
	}
76
77
	/**
78
	 * {@inheritDoc}
79
	 */
80
	public IQuery getNamedQuery(String queryName) {
81
		initializeQueries();
82
		return queries.get(queryName);
83
	}
84
85
	private void initializeQueries() {
86
		if (queries == null) {
87
			queries = new HashMap<String, IQuery>();
88
			initializeQueries(queries);
89
		}
90
	}
91
92
	void initializeQueries(Map<String, IQuery> queries) {
93
		JpaManagedTypeProvider provider = getProvider();
94
		for (ListIterator<NamedQuery> iter = namedQueries(); iter.hasNext(); ) {
95
			NamedQuery namedQuery = iter.next();
96
			queries.put(namedQuery.getName(), buildQuery(provider, namedQuery));
97
		}
98
	}
99
100
	private ListIterator<NamedQuery> namedQueries() {
101
		return getManagedType().getQueryContainer().namedQueries();
102
	}
103
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaJpqlQueryHelper.java (+209 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
5
 * which accompanies this distribution.
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import org.eclipse.jpt.common.core.internal.utility.SimpleTextRange;
17
import org.eclipse.jpt.common.core.utility.TextRange;
18
import org.eclipse.jpt.jpa.core.context.NamedQuery;
19
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
20
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
21
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationPreferences;
22
import org.eclipse.persistence.jpa.jpql.ExpressionTools;
23
import org.eclipse.persistence.jpa.jpql.JPQLQueryHelper;
24
import org.eclipse.persistence.jpa.jpql.JPQLQueryProblem;
25
import org.eclipse.persistence.jpa.jpql.spi.IQuery;
26
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
27
28
/**
29
 * This helper can perform the following operations over a JPQL query:
30
 * <ul>
31
 * <li>Calculates the result type of a query: {@link #getResultType()};</li>
32
 * <li>Calculates the type of an input parameter: {@link #getParameterType(String)}.</li>
33
 * <li>Calculates the possible choices to complete the query from a given
34
 *     position (used for content assist): {@link #buildContentAssistItems(int)}.</li>
35
 * <li>Validates the query by introspecting its grammar and semantic:
36
 *     <ul>
37
 *     <li>{@link #validate()},</li>
38
 *     <li>{@link #validateGrammar()},</li>
39
 *     <li>{@link #validateSemantic()}.</li>
40
 *     </ul></li>
41
 *
42
 * @version 3.0
43
 * @since 3.0
44
 * @author Pascal Filion
45
 */
46
@SuppressWarnings("nls")
47
public final class JpaJpqlQueryHelper extends JPQLQueryHelper<NamedQuery> {
48
49
	/**
50
	 * The actual JPQL query, which can differ from the one owned by the model object, which happens
51
	 * when the model is out of sync because it has not been updated yet.
52
	 */
53
	private final String actualQuery;
54
55
	/**
56
	 * The external form of the JPQL query that was already created before this helper, which happens
57
	 * during the execution of the unit-tests.
58
	 */
59
	private IQuery localQuery;
60
61
	/**
62
	 * Creates a new <code>JpaJpqlQueryHelper</code>. This constructor is used only by the unit-tests.
63
	 *
64
	 * @param query The external form that is already wrapping the {@link MWNamedQuery}
65
	 * @exception NullPointerException If the query is <code>null</code>
66
	 */
67
	public JpaJpqlQueryHelper(IQuery query) {
68
		this(((JpaQuery) query).getQuery());
69
		this.localQuery = query;
70
	}
71
72
	/**
73
	 * Creates a new <code>JpaJpqlQueryHelper</code>.
74
	 *
75
	 * @param query The model object where the JPQL query is stored
76
	 * @exception NullPointerException If the given {@link NamedQuery} is <code>null</code>
77
	 */
78
	public JpaJpqlQueryHelper(NamedQuery query) {
79
		this(query, query.getQuery());
80
	}
81
82
	/**
83
	 * Creates a new <code>JpaQueryHelper</code>.
84
	 *
85
	 * @param query The model object where the JPQL query is stored
86
	 * @param actualQuery The actual JPQL query, which can differ from the one owned by the model
87
	 * object, which happens when the model is out of sync because it has not been updated yet
88
	 * @exception NullPointerException If the given {@link NamedQuery} is <code>null</code>
89
	 */
90
	public JpaJpqlQueryHelper(NamedQuery query, String actualQuery) {
91
		super(query);
92
		this.actualQuery = actualQuery;
93
	}
94
95
	/**
96
	 * Calculates the start and end positions by adjusting to the given <em>jpqlQuery</em>, which may
97
	 * differ from the string representation of the parsed tree since the parsed tree does not keep
98
	 * track of multiple whitespace but only one. It also increase the length when the start and end
99
	 * positions are the same.
100
	 *
101
	 * @param problem The {@link JPQLQueryProblem problem} that was found in the JPQL query, which is
102
	 * either a grammatical or semantic problem
103
	 * @param parsedJpqlQuery The string representation of the parsed tree representation of the JPQL
104
	 * query, which may differ from the actual JPQL query since it does not keep more than one
105
	 * whitespace
106
	 * @param actualQuery The actual JPQL query that was parsed and validated
107
	 * @return The start and end positions, which may have been adjusted
108
	 */
109
	public int[] buildPositions(JPQLQueryProblem problem, String parsedJpqlQuery, String actualQuery) {
110
111
		int startPosition = problem.getStartPosition();
112
		int endPosition   = problem.getEndPosition();
113
114
		// If the start and end positions are the same, then expand the text range
115
		if (startPosition == endPosition) {
116
			startPosition = Math.max(startPosition - 1, 0);
117
		}
118
119
		// Reposition the cursor so it's correctly positioned in the actual query, which is the
120
		// since it may contains more than one whitespace for a single whitespace
121
		int newStartPosition = ExpressionTools.repositionCursor(parsedJpqlQuery, startPosition, actualQuery);
122
123
		if (newStartPosition != startPosition) {
124
			endPosition  += (newStartPosition - startPosition);
125
			startPosition = newStartPosition;
126
		}
127
128
		return new int[] { startPosition, endPosition };
129
	}
130
131
	/**
132
	 * Creates a new {@link IMessage} for the given {@link JPQLQueryProblem}.
133
	 *
134
	 * @param targetObject The object for which a new {@link IMessage} is creating describing the
135
	 * problem
136
	 * @param problem The {@link JPQLQueryProblem problem} that was found in the JPQL query, which is
137
	 * either a grammatical or semantic problem
138
	 * @param textRange The range of the JPQL query in the Java source file
139
	 * @param parsedJpqlQuery The string representation of the parsed tree representation of the JPQL
140
	 * query, which may differ from the actual JPQL query since it does not keep more than one
141
	 * whitespace
142
	 * @param actualQuery The actual JPQL query that was parsed and validated
143
	 * @param offset This offset is used to move the start position
144
	 * @return A new {@link IMessage} that has the required information to display the problem
145
	 * underline and the error message in the Problems view
146
	 */
147
	public IMessage buildProblem(Object targetObject,
148
	                             TextRange textRange,
149
	                             JPQLQueryProblem problem,
150
	                             String parsedJpqlQuery,
151
	                             String actualQuery,
152
	                             int offset) {
153
154
		int[] positions = buildPositions(problem, parsedJpqlQuery, actualQuery);
155
156
		// Create the text range of the problem
157
		textRange = new SimpleTextRange(
158
			textRange.getOffset() + positions[0] + offset,
159
			positions[1] - positions[0],
160
			textRange.getLineNumber()
161
		);
162
163
		// Now create the message
164
		IMessage message = DefaultJpaValidationMessages.buildMessage(
165
			severity(targetObject),
166
			problem.getMessageKey(),
167
			problem.getMessageArguments(),
168
			targetObject,
169
			textRange
170
		);
171
		message.setBundleName("jpa_jpql_validation");
172
		return message;
173
	}
174
175
	private JpaManagedTypeProvider buildProvider(NamedQuery query) {
176
		try {
177
			return new JpaPersistenceUnit(query.getJpaProject(), query.getPersistenceUnit());
178
		}
179
		catch (Exception e) {
180
			return new JpaMappingFile(query.getJpaProject(), query.getMappingFileRoot().getParent());
181
		}
182
	}
183
184
	/**
185
	 * {@inheritDoc}
186
	 */
187
	@Override
188
	protected IQuery buildQuery(NamedQuery query) {
189
		if (localQuery == null) {
190
			localQuery = new JpaQuery(buildProvider(query), query, actualQuery);
191
		}
192
		return localQuery;
193
	}
194
195
	/**
196
	 * Retrieve the severity that is associated to JPQL query validation, which cannot be retrieved
197
	 * using the JPQL problem message key.
198
199
	 * @param targetObject The object for which a new {@link IMessage} is creating describing the
200
	 * problem
201
	 * @return The global severity for validating JPQL queries
202
	 */
203
	private int severity(Object targetObject) {
204
		return JpaValidationPreferences.getProblemSeverityPreference(
205
			targetObject,
206
			JpaValidationMessages.JPQL_QUERY_VALIDATION
207
		);
208
	}
209
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedType.java (+135 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import java.util.Collections;
17
import java.util.HashMap;
18
import java.util.Iterator;
19
import java.util.Map;
20
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
21
import org.eclipse.jpt.jpa.core.context.TypeMapping;
22
import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
23
import org.eclipse.persistence.jpa.jpql.spi.IMapping;
24
25
/**
26
 * The abstract definition of {@link IManagedType} defined for wrapping the design-time mapped class
27
 * object.
28
 *
29
 * @version 3.0
30
 * @since 3.0
31
 * @author Pascal Filion
32
 */
33
abstract class JpaManagedType implements IManagedType {
34
35
	/**
36
	 * The design-time model object wrapped by this class.
37
	 */
38
	private final TypeMapping managedType;
39
40
	/**
41
	 * The cached collection of {@link IMapping mappings} that prevent rebuilding them every time one
42
	 * is requested.
43
	 */
44
	private Map<String, IMapping> mappings;
45
46
	/**
47
	 * The provider of JPA managed types.
48
	 */
49
	private final JpaManagedTypeProvider provider;
50
51
	/**
52
	 * The cached wrapper over {@link TODO}.
53
	 */
54
	private JpaType type;
55
56
	/**
57
	 * Creates a new <code>JDeveloperManagedType</code>.
58
	 *
59
	 * @param managedType The provider of JPA managed types
60
	 * @param mappedClass The design-time model object wrapped by this class
61
	 */
62
	JpaManagedType(JpaManagedTypeProvider provider, TypeMapping managedType) {
63
		super();
64
		this.provider    = provider;
65
		this.managedType = managedType;
66
	}
67
68
	private IMapping buildMapping(AttributeMapping mapping) {
69
		return new JpaMapping(this, mapping);
70
	}
71
72
	private Map<String, IMapping> buildMappings() {
73
		Map<String, IMapping> mappings = new HashMap<String, IMapping>();
74
		for (Iterator<AttributeMapping> iter = managedType.allAttributeMappings(); iter.hasNext(); ) {
75
			AttributeMapping mapping = iter.next();
76
			mappings.put(mapping.getName(), buildMapping(mapping));
77
		}
78
		return mappings;
79
	}
80
81
	/**
82
	 * {@inheritDoc}
83
	 */
84
	public int compareTo(IManagedType managedType) {
85
		return getType().getName().compareTo(managedType.getType().getName());
86
	}
87
88
	/**
89
	 * Returns the encapsulated model object.
90
	 *
91
	 * @return The managed type wrapped by this external form
92
	 */
93
	TypeMapping getManagedType() {
94
		return managedType;
95
	}
96
97
	/**
98
	 * {@inheritDoc}
99
	 */
100
	public final IMapping getMappingNamed(String name) {
101
		initializeMappings();
102
		return mappings.get(name);
103
	}
104
105
	/**
106
	 * {@inheritDoc}
107
	 */
108
	public final JpaManagedTypeProvider getProvider() {
109
		return provider;
110
	}
111
112
	/**
113
	 * {@inheritDoc}
114
	 */
115
	public final JpaType getType() {
116
		if (type == null) {
117
			type = provider.getTypeRepository().getType(managedType.getPersistentType().getName());
118
		}
119
		return type;
120
	}
121
122
	private void initializeMappings() {
123
		if (mappings == null) {
124
			mappings = buildMappings();
125
		}
126
	}
127
128
	/**
129
	 * {@inheritDoc}
130
	 */
131
	public final Iterable<IMapping> mappings() {
132
		initializeMappings();
133
		return Collections.unmodifiableCollection(mappings.values());
134
	}
135
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java (+276 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import java.util.ArrayList;
17
import java.util.Collection;
18
import java.util.Collections;
19
import java.util.HashMap;
20
import java.util.Iterator;
21
import java.util.Map;
22
import org.eclipse.jpt.jpa.core.JpaFacet;
23
import org.eclipse.jpt.jpa.core.JpaPlatform;
24
import org.eclipse.jpt.jpa.core.JpaProject;
25
import org.eclipse.jpt.jpa.core.context.Embeddable;
26
import org.eclipse.jpt.jpa.core.context.Entity;
27
import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
28
import org.eclipse.jpt.jpa.core.context.PersistentType;
29
import org.eclipse.jpt.jpa.core.context.TypeMapping;
30
import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer;
31
import org.eclipse.persistence.jpa.jpql.spi.IEmbeddable;
32
import org.eclipse.persistence.jpa.jpql.spi.IEntity;
33
import org.eclipse.persistence.jpa.jpql.spi.IJPAVersion;
34
import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
35
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeProvider;
36
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
37
import org.eclipse.persistence.jpa.jpql.spi.IMappedSuperclass;
38
import org.eclipse.persistence.jpa.jpql.spi.IPlatform;
39
import org.eclipse.persistence.jpa.jpql.spi.IType;
40
41
/**
42
 * The abstract implementation of {@link IManagedTypeProvider} that is wrapping the design-time
43
 * representation of a provider of managed types.
44
 *
45
 * @version 3.0
46
 * @since 3.0
47
 * @author Pascal Filion
48
 */
49
abstract class JpaManagedTypeProvider implements IManagedTypeProvider {
50
51
	/**
52
	 * The filtered collection of managed types that are the abstract schema types.
53
	 */
54
	private Collection<IEntity> abstractSchemaTypes;
55
56
	/**
57
	 * The project that gives access to the application's metadata.
58
	 */
59
	private final JpaProject jpaProject;
60
61
	/**
62
	 * The cached {@link IManagedType managed types}.
63
	 */
64
	private Map<String, IManagedType> managedTypes;
65
66
	/**
67
	 * The design-time provider of managed types.
68
	 */
69
	private final PersistentTypeContainer persistentTypeContainer;
70
71
	/**
72
	 * The external form of a type repository.
73
	 */
74
	private JpaTypeRepository typeRepository;
75
76
	/**
77
	 * The version of the Java Persistence this entity for which it was defined.
78
	 */
79
	private IJPAVersion version;
80
81
	/**
82
	 * Creates a new <code>JpaManagedTypeProvider</code>.
83
	 * 
84
	 * @param jpaProject The project that gives access to the application's metadata
85
	 * @param persistentTypeContainer The design-time provider of managed types
86
	 */
87
	JpaManagedTypeProvider(JpaProject jpaProject, PersistentTypeContainer persistentTypeContainer) {
88
89
		super();
90
		this.jpaProject = jpaProject;
91
		this.persistentTypeContainer = persistentTypeContainer;
92
	}
93
94
	/**
95
	 * {@inheritDoc}
96
	 */
97
	public Iterable<IEntity> abstractSchemaTypes() {
98
		if (abstractSchemaTypes == null) {
99
			initializeManagedTypes();
100
			EntityCollector visitor = new EntityCollector();
101
			for (IManagedType managedType : managedTypes.values()) {
102
				managedType.accept(visitor);
103
			}
104
			abstractSchemaTypes = visitor.entities;
105
		}
106
		return Collections.unmodifiableCollection(abstractSchemaTypes);
107
	}
108
109
	abstract JpaEntity buildEntity(TypeMapping mappedClass);
110
111
	private IManagedType buildManagedType(PersistentType persistentType) {
112
113
		TypeMapping mappedClass = persistentType.getMapping();
114
115
		if (mappedClass instanceof Entity) {
116
			return buildEntity(mappedClass);
117
		}
118
119
		if (mappedClass instanceof MappedSuperclass) {
120
			return new JpaMappedSuperclass(this, (MappedSuperclass) mappedClass);
121
		}
122
123
		if (mappedClass instanceof Embeddable) {
124
			return new JpaEmbeddable(this, (Embeddable) mappedClass);
125
		}
126
127
		return new JpaNullManagedType(this, mappedClass);
128
	}
129
130
	private Map<String, IManagedType> buildManagedTypes() {
131
		Map<String, IManagedType> managedTypes = new HashMap<String, IManagedType>();
132
		for (Iterator<? extends PersistentType> iter = persistenceTypes(); iter.hasNext(); ) {
133
			PersistentType persistentType = iter.next();
134
			managedTypes.put(persistentType.getMapping().getName(), buildManagedType(persistentType));
135
		}
136
		return managedTypes;
137
	}
138
139
	private IJPAVersion convert(JpaPlatform.Version version) {
140
141
		String jpaVersion = version.getJpaVersion();
142
143
		if (JpaFacet.VERSION_1_0.getVersionString().equals(jpaVersion)) {
144
			return IJPAVersion.VERSION_1_0;
145
		}
146
147
		return IJPAVersion.VERSION_2_0;
148
	}
149
150
	/**
151
	 * {@inheritDoc}
152
	 */
153
	public IManagedType getManagedType(IType type) {
154
155
		initializeManagedTypes();
156
157
		for (IManagedType managedType : managedTypes.values()) {
158
			if (managedType.getType() == type) {
159
				return managedType;
160
			}
161
		}
162
163
		return null;
164
	}
165
166
	/**
167
	 * {@inheritDoc}
168
	 */
169
	public IManagedType getManagedType(String abstractSchemaName) {
170
		initializeManagedTypes();
171
		return managedTypes.get(abstractSchemaName);
172
	}
173
174
	/**
175
	 * Returns the container of managed types.
176
	 *
177
	 * @return The container of managed types
178
	 */
179
	PersistentTypeContainer getPersistentTypeContainer() {
180
		return persistentTypeContainer;
181
	}
182
183
	/**
184
	 * {@inheritDoc}
185
	 */
186
	public IPlatform getPlatform() {
187
		return IPlatform.JAVA;
188
		// TODO
189
//		return (jpaProject instanceof EclipseLinkJpaProject) ? IPlatform.ECLIPSE_LINK : IPlatform.JAVA;
190
	}
191
192
	/**
193
	 * Returns the encapsulated {@link PersistentType}, which is the actual object.
194
	 *
195
	 * @return The design-time representation of a managed type provider
196
	 */
197
	PersistentTypeContainer getProvider() {
198
		return persistentTypeContainer;
199
	}
200
201
	/**
202
	 * {@inheritDoc}
203
	 */
204
	public JpaTypeRepository getTypeRepository() {
205
		if (typeRepository == null) {
206
			typeRepository = new JpaTypeRepository(jpaProject.getJavaProject());
207
		}
208
		return typeRepository;
209
	}
210
211
	/**
212
	 * {@inheritDoc}
213
	 */
214
	public IJPAVersion getVersion() {
215
		if (version == null) {
216
			version = convert(jpaProject.getJpaPlatform().getJpaVersion());
217
		}
218
		return version;
219
	}
220
221
	private void initializeManagedTypes() {
222
		if (managedTypes == null) {
223
			managedTypes = buildManagedTypes();
224
		}
225
	}
226
227
	/**
228
	 * {@inheritDoc}
229
	 */
230
	public Iterable<IManagedType> managedTypes() {
231
		initializeManagedTypes();
232
		return Collections.unmodifiableCollection(managedTypes.values());
233
	}
234
235
	/**
236
	 * Retrieves the managed types from the design-time provider.
237
	 *
238
	 * @return The managed types that are defined only in the provider
239
	 */
240
	abstract Iterator<? extends PersistentType> persistenceTypes();
241
242
	private static class EntityCollector implements IManagedTypeVisitor {
243
244
		/**
245
		 * The collection of {@link IEntity entities} that got visited.
246
		 */
247
		private final Collection<IEntity> entities;
248
249
		/**
250
		 * Creates a new <code>EntityCollector</code>.
251
		 */
252
		EntityCollector() {
253
			super();
254
			entities = new ArrayList<IEntity>();
255
		}
256
257
		/**
258
		 * {@inheritDoc}
259
		 */
260
		public void visit(IEmbeddable embeddable) {
261
		}
262
263
		/**
264
		 * {@inheritDoc}
265
		 */
266
		public void visit(IEntity entity) {
267
			entities.add(entity);
268
		}
269
270
		/**
271
		 * {@inheritDoc}
272
		 */
273
		public void visit(IMappedSuperclass mappedSuperclass) {
274
		}
275
	}
276
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappedSuperclass.java (+55 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
17
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
18
import org.eclipse.persistence.jpa.jpql.spi.IMappedSuperclass;
19
20
/**
21
 * The concrete implementation of {@link IMappedSuperclass} that is wrapping the design-time
22
 * representation of a JPA mapped superclass.
23
 *
24
 * @version 3.0
25
 * @since 3.0
26
 * @author Pascal Filion
27
 */
28
final class JpaMappedSuperclass extends JpaManagedType
29
                                implements IMappedSuperclass {
30
31
	/**
32
	 * Creates a new <code>JpaMappedSuperclass</code>.
33
	 *
34
	 * @param provider The provider of JPA managed types
35
	 * @param mappedSuperclass The design-time model object wrapped by this class
36
	 */
37
	JpaMappedSuperclass(JpaManagedTypeProvider provider, MappedSuperclass mappedSuperclass) {
38
		super(provider, mappedSuperclass);
39
	}
40
41
	/**
42
	 * {@inheritDoc}
43
	 */
44
	public void accept(IManagedTypeVisitor visitor) {
45
		visitor.visit(this);
46
	}
47
48
	/**
49
	 * {@inheritDoc}
50
	 */
51
	@Override
52
	MappedSuperclass getManagedType() {
53
		return (MappedSuperclass) super.getManagedType();
54
	}
55
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java (+252 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import java.lang.annotation.Annotation;
17
import java.util.Iterator;
18
import java.util.List;
19
import org.eclipse.jpt.common.utility.internal.CollectionTools;
20
import org.eclipse.jpt.common.utility.internal.StringTools;
21
import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
22
import org.eclipse.jpt.jpa.core.MappingKeys;
23
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
24
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
25
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
26
import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
27
import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
28
import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
29
import org.eclipse.persistence.jpa.jpql.spi.IMapping;
30
import org.eclipse.persistence.jpa.jpql.spi.IMappingType;
31
import org.eclipse.persistence.jpa.jpql.spi.IType;
32
import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
33
34
/**
35
 * The concrete implementation of {@link IMapping} that is wrapping the design-time representation
36
 * of a mapping.
37
 *
38
 * @version 3.0
39
 * @since 3.0
40
 * @author Pascal Filion
41
 */
42
@SuppressWarnings("nls")
43
final class JpaMapping implements IMapping {
44
45
	/**
46
	 * The design-time {@link AttributeMapping} wrapped by this class.
47
	 */
48
	private final AttributeMapping mapping;
49
50
	/**
51
	 * The type of the actual mapping.
52
	 */
53
	private IMappingType mappingType;
54
55
	/**
56
	 * The parent of this mapping.
57
	 */
58
	private final JpaManagedType parent;
59
60
	/**
61
	 * The type declaration of the property represented by the mapping.
62
	 */
63
	private ITypeDeclaration typeDeclaration;
64
65
	/**
66
	 * Creates a new <code>JpaMapping</code>.
67
	 *
68
	 * @param parent The parent of this mapping
69
	 * @param mapping The design-time {@link AttributeMapping} wrapped by this class
70
	 */
71
	JpaMapping(JpaManagedType parent, AttributeMapping mapping) {
72
		super();
73
		this.parent  = parent;
74
		this.mapping = mapping;
75
	}
76
77
	private ITypeDeclaration[] buildGenericTypeDeclarations() {
78
		JavaPersistentAttribute javaPersistentAttribute = mapping.getPersistentAttribute().getJavaPersistentAttribute();
79
		JavaResourcePersistentAttribute resource = javaPersistentAttribute.getResourcePersistentAttribute();
80
		List<ITypeDeclaration> declarations = CollectionTools.list(buildGenericTypeDeclarations(resource));
81
		return declarations.toArray(new ITypeDeclaration[declarations.size()]);
82
	}
83
84
	private Iterator<ITypeDeclaration> buildGenericTypeDeclarations(JavaResourcePersistentAttribute resource) {
85
		return new TransformationIterator<String, ITypeDeclaration>(resource.typeTypeArgumentNames()) {
86
			@Override
87
			protected ITypeDeclaration transform(String next) {
88
				return getTypeRepository().getType(next).getTypeDeclaration();
89
			}
90
		};
91
	}
92
93
	private ITypeDeclaration buildTypeDeclaration() {
94
		return new JpaTypeDeclaration(
95
			getTypeRepository().getType(mapping.getPersistentAttribute().getTypeName()),
96
			buildGenericTypeDeclarations(),
97
			false /*TODO*/
98
		);
99
	}
100
101
	/**
102
	 * {@inheritDoc}
103
	 */
104
	public int compareTo(IMapping mapping) {
105
		return getName().compareTo(mapping.getName());
106
	}
107
108
	/**
109
	 * {@inheritDoc}
110
	 */
111
	public IMappingType getMappingType() {
112
		if (mappingType == null) {
113
			mappingType = mappingType();
114
		}
115
		return mappingType;
116
	}
117
118
	/**
119
	 * {@inheritDoc}
120
	 */
121
	public String getName() {
122
		return mapping.getName();
123
	}
124
125
	/**
126
	 * {@inheritDoc}
127
	 */
128
	public IManagedType getParent() {
129
		return parent;
130
	}
131
132
	/**
133
	 * {@inheritDoc}
134
	 */
135
	public IType getType() {
136
		PersistentAttribute property = mapping.getPersistentAttribute();
137
		return getTypeRepository().getType(property.getTypeName());
138
	}
139
140
	/**
141
	 * {@inheritDoc}
142
	 */
143
	public ITypeDeclaration getTypeDeclaration() {
144
		if (typeDeclaration == null) {
145
			typeDeclaration = buildTypeDeclaration();
146
		}
147
		return typeDeclaration;
148
	}
149
150
	private JpaTypeRepository getTypeRepository() {
151
		return parent.getType().getTypeRepository();
152
	}
153
154
	/**
155
	 * {@inheritDoc}
156
	 */
157
	public boolean hasAnnotation(Class<? extends Annotation> annotationType) {
158
		JavaResourcePersistentAttribute attribute = mapping.getPersistentAttribute().getJavaPersistentAttribute().getResourcePersistentAttribute();
159
		return attribute.getAnnotation(annotationType.getName()) != null;
160
	}
161
162
	private IMappingType mappingType() {
163
164
		String type = mapping.getKey();
165
166
		// Basic
167
		if (type == MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY) {
168
			return IMappingType.BASIC;
169
		}
170
171
		// Embedded
172
		if (type == MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY) {
173
			return IMappingType.EMBEDDED;
174
		}
175
176
		// Embedded Id
177
		if (type == MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY) {
178
			return IMappingType.EMBEDDED_ID;
179
		}
180
181
		// Id
182
		if (type == MappingKeys.ID_ATTRIBUTE_MAPPING_KEY) {
183
			return IMappingType.ID;
184
		}
185
186
		// M:M
187
		if (type == MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
188
			return IMappingType.MANY_TO_MANY;
189
		}
190
191
		// 1:M
192
		if (type == MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
193
			return IMappingType.ONE_TO_MANY;
194
		}
195
196
		// M:1
197
		if (type == MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
198
			return IMappingType.MANY_TO_ONE;
199
		}
200
201
		// 1:1
202
		if (type == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
203
			return IMappingType.ONE_TO_ONE;
204
		}
205
206
		// Version
207
		if (type == MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY) {
208
			return IMappingType.VERSION;
209
		}
210
211
		// Element Collection
212
		if (type == MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY) {
213
			return IMappingType.ELEMENT_COLLECTION;
214
		}
215
216
		// Basic Collection
217
//		if (type == EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY) {
218
//			return IMappingType.BASIC_COLLECTION;
219
//		}
220
//
221
//		// Basic Map
222
//		if (type == EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY) {
223
//			return IMappingType.BASIC_MAP;
224
//		}
225
//
226
//		// Transformation
227
//		if (type == EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY) {
228
//			return IMappingType.TRANSFORMATION;
229
//		}
230
//
231
//		// Variable 1:1
232
//		if (type == EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
233
//			return IMappingType.VARIABLE_ONE_TO_ONE;
234
//		}
235
236
		return IMappingType.TRANSIENT;
237
	}
238
239
	/**
240
	 * {@inheritDoc}
241
	 */
242
	@Override
243
	public String toString() {
244
		StringBuilder sb = new StringBuilder();
245
		StringTools.buildSimpleToStringOn(this, sb);
246
		sb.append("name=");
247
		sb.append(getName());
248
		sb.append(", mappingType=");
249
		sb.append(getMappingType());
250
		return sb.toString();
251
	}
252
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappingFile.java (+65 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import java.util.Iterator;
17
import org.eclipse.jpt.jpa.core.JpaProject;
18
import org.eclipse.jpt.jpa.core.context.Entity;
19
import org.eclipse.jpt.jpa.core.context.MappingFile;
20
import org.eclipse.jpt.jpa.core.context.PersistentType;
21
import org.eclipse.jpt.jpa.core.context.TypeMapping;
22
23
/**
24
 * The concrete implementation that is wrapping the design-time representation of a mapping file.
25
 *
26
 * @version 3.0
27
 * @since 3.0
28
 * @author Pascal Filion
29
 */
30
public class JpaMappingFile extends JpaManagedTypeProvider {
31
32
	/**
33
	 * Creates a new <code>JpaMappingFile</code>.
34
	 * 
35
	 * @param jpaProject The project that gives access to the application's metadata
36
	 * @param persistentTypeContainer The design-time provider of managed types
37
	 */
38
	public JpaMappingFile(JpaProject jpaProject, MappingFile persistentTypeContainer) {
39
		super(jpaProject, persistentTypeContainer);
40
	}
41
42
	/**
43
	 * {@inheritDoc}
44
	 */
45
	@Override
46
	JpaEntity buildEntity(TypeMapping mappedClass) {
47
		return new JpaOrmEntity(this, (Entity) mappedClass);
48
	}
49
50
	/**
51
	 * {@inheritDoc}
52
	 */
53
	@Override
54
	protected MappingFile getPersistentTypeContainer() {
55
		return (MappingFile) super.getPersistentTypeContainer();
56
	}
57
58
	/**
59
	 * {@inheritDoc}
60
	 */
61
	@Override
62
	protected Iterator<? extends PersistentType> persistenceTypes() {
63
		return getPersistentTypeContainer().getPersistentTypes().iterator();
64
	}
65
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaNullManagedType.java (+104 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
17
import org.eclipse.jpt.jpa.core.context.TypeMapping;
18
import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
19
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeProvider;
20
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
21
import org.eclipse.persistence.jpa.jpql.spi.IMapping;
22
import org.eclipse.persistence.jpa.jpql.spi.IType;
23
24
/**
25
 * The concrete implementation of {@link IManagedType} that is wrapping the design-time
26
 * representation a "null" managed type.
27
 *
28
 * @version 3.0
29
 * @since 3.0
30
 * @author Pascal Filion
31
 */
32
final class JpaNullManagedType implements IManagedType {
33
34
	/**
35
	 * The provider of JPA managed types.
36
	 */
37
	private final JpaManagedTypeProvider provider;
38
39
	/**
40
	 * The cached {@link IType} of this "null" managed type.
41
	 */
42
	private IType type;
43
44
	/**
45
	 * The design-time model object wrapped by this class.
46
	 */
47
	private final TypeMapping typeMapping;
48
49
	/**
50
	 * Creates a new <code>JpaNullManagedType</code>.
51
	 *
52
	 * @param managedType The provider of JPA managed types
53
	 * @param typeMapping The design-time model object wrapped by this class
54
	 */
55
	JpaNullManagedType(JpaManagedTypeProvider provider, TypeMapping typeMapping) {
56
		super();
57
		this.provider    = provider;
58
		this.typeMapping = typeMapping;
59
	}
60
61
	/**
62
	 * {@inheritDoc}
63
	 */
64
	public void accept(IManagedTypeVisitor visitor) {
65
	}
66
67
	/**
68
	 * {@inheritDoc}
69
	 */
70
	public int compareTo(IManagedType managedType) {
71
		return getType().getName().compareTo(managedType.getType().getName());
72
	}
73
74
	/**
75
	 * {@inheritDoc}
76
	 */
77
	public IMapping getMappingNamed(String name) {
78
		return null;
79
	}
80
81
	/**
82
	 * {@inheritDoc}
83
	 */
84
	public IManagedTypeProvider getProvider() {
85
		return provider;
86
	}
87
88
	/**
89
	 * {@inheritDoc}
90
	 */
91
	public IType getType() {
92
		if (type == null) {
93
			type = provider.getTypeRepository().getType(typeMapping.getPersistentType().getName());
94
		}
95
		return type;
96
	}
97
98
	/**
99
	 * {@inheritDoc}
100
	 */
101
	public Iterable<IMapping> mappings() {
102
		return EmptyIterable.instance();
103
	}
104
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaOrmEntity.java (+59 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
6
 *
7
 * Contributors:
8
 *     Oracle - initial API and implementation
9
 *******************************************************************************/
10
package org.eclipse.jpt.jpa.core.internal.jpql;
11
12
import java.util.ListIterator;
13
import java.util.Map;
14
import org.eclipse.jpt.jpa.core.context.Entity;
15
import org.eclipse.jpt.jpa.core.context.NamedQuery;
16
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
17
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
18
import org.eclipse.persistence.jpa.jpql.spi.IQuery;
19
20
/**
21
 * The concrete implementation of {@link IEntity} that is wrapping the design-time representation
22
 * of a JPA entity defined in an ORM configuration.
23
 *
24
 * @version 3.0
25
 * @since 3.0
26
 * @author Pascal Filion
27
 */
28
final class JpaOrmEntity extends JpaEntity {
29
30
	/**
31
	 * Creates a new <code>JpaOrmEntity</code>.
32
	 *
33
	 * @param provider The provider of JPA managed types
34
	 * @param entity The design-time model object wrapped by this class
35
	 */
36
	JpaOrmEntity(JpaMappingFile provider, Entity entity) {
37
		super(provider, entity);
38
	}
39
40
	/**
41
	 * {@inheritDoc}
42
	 */
43
	@Override
44
	void initializeQueries(Map<String, IQuery> queries) {
45
		super.initializeQueries(queries);
46
47
		JpaManagedTypeProvider provider = getProvider();
48
		OrmPersistentType type = (OrmPersistentType) getManagedType().getPersistentType();
49
		JavaTypeMapping mapping = type.getJavaPersistentType().getMapping();
50
51
		if (mapping instanceof Entity) {
52
			Entity entity = (Entity) mapping;
53
			for (ListIterator<NamedQuery> iter = entity.getQueryContainer().namedQueries(); iter.hasNext(); ) {
54
				NamedQuery namedQuery = iter.next();
55
				queries.put(namedQuery.getName(), buildQuery(provider, namedQuery));
56
			}
57
		}
58
	}
59
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java (+81 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import java.util.Iterator;
17
import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
18
import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
19
import org.eclipse.jpt.jpa.core.JpaProject;
20
import org.eclipse.jpt.jpa.core.context.Entity;
21
import org.eclipse.jpt.jpa.core.context.PersistentType;
22
import org.eclipse.jpt.jpa.core.context.TypeMapping;
23
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
24
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
25
26
/**
27
 * The concrete implementation that is wrapping the design-time representation of a persistence unit.
28
 *
29
 * @version 3.0
30
 * @since 3.0
31
 * @author Pascal Filion
32
 */
33
public final class JpaPersistenceUnit extends JpaManagedTypeProvider {
34
35
	/**
36
	 * Creates a new <code>JpaPersistenceUnit</code>.
37
	 *
38
	 * @param jpaProject The project that gives access to the application's metadata
39
	 * @param persistentUnit The design-time persistence unit
40
	 */
41
	public JpaPersistenceUnit(JpaProject jpaProject, PersistenceUnit persistentUnit) {
42
		super(jpaProject, persistentUnit);
43
	}
44
45
	/**
46
	 * {@inheritDoc}
47
	 */
48
	@Override
49
	JpaEntity buildEntity(TypeMapping mappedClass) {
50
		return new JpaPersistenceUnitEntity(this, (Entity) mappedClass);
51
	}
52
53
	/**
54
	 * {@inheritDoc}
55
	 */
56
	@Override
57
	PersistenceUnit getPersistentTypeContainer() {
58
		return (PersistenceUnit) super.getPersistentTypeContainer();
59
	}
60
61
	@SuppressWarnings("unchecked")
62
	private Iterator<ClassRef> javaClassRefs() {
63
		return new CompositeIterator<ClassRef>(
64
			getPersistentTypeContainer().specifiedClassRefs(),
65
			getPersistentTypeContainer().impliedClassRefs()
66
		);
67
	}
68
69
	/**
70
	 * {@inheritDoc}
71
	 */
72
	@Override
73
	Iterator<? extends PersistentType> persistenceTypes() {
74
		return new TransformationIterator<ClassRef, PersistentType>(javaClassRefs()) {
75
			@Override
76
			protected PersistentType transform(ClassRef classRef) {
77
				return classRef.getJavaPersistentType();
78
			}
79
		};
80
	}
81
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnitEntity.java (+33 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
6
 * 
7
 * Contributors:
8
 *     Oracle - initial API and implementation
9
 *******************************************************************************/
10
package org.eclipse.jpt.jpa.core.internal.jpql;
11
12
import org.eclipse.jpt.jpa.core.context.Entity;
13
14
/**
15
 * The concrete implementation of {@link IEntity} that is wrapping the design-time representation
16
 * of a JPA entity defined in a persistence unit.
17
 *
18
 * @version 3.0
19
 * @since 3.0
20
 * @author Pascal Filion
21
 */
22
final class JpaPersistenceUnitEntity extends JpaEntity {
23
24
	/**
25
	 * Creates a new <code>JpaPersistenceUnitEntity</code>.
26
	 *
27
	 * @param provider The provider of JPA managed types
28
	 * @param entity The design-time model object wrapped by this class
29
	 */
30
	JpaPersistenceUnitEntity(JpaManagedTypeProvider provider, Entity entity) {
31
		super(provider, entity);
32
	}
33
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaQuery.java (+115 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import org.eclipse.jpt.common.utility.internal.StringTools;
17
import org.eclipse.jpt.jpa.core.context.NamedQuery;
18
import org.eclipse.persistence.jpa.jpql.spi.IQuery;
19
20
/**
21
 * The concrete implementation of {@link IQuery} that is wrapping the design-time representation
22
 * of a JPQL query.
23
 *
24
 * @version 3.0
25
 * @since 3.0
26
 * @author Pascal Filion
27
 */
28
@SuppressWarnings("nls")
29
public final class JpaQuery implements IQuery {
30
31
	/**
32
	 * The actual JPQL query, which can differ from the one owned by the model object, which happens
33
	 * when the model is out of sync because it has not been updated yet.
34
	 */
35
	private String actualQuery;
36
37
	/**
38
	 *  The provider of managed types.
39
	 */
40
	private JpaManagedTypeProvider provider;
41
42
	/**
43
	 * The model object holding onto the JPQL query.
44
	 */
45
	private NamedQuery query;
46
47
	/**
48
	 * Creates a new <code>JpaQuery</code>.
49
	 *
50
	 * @param provider The provider of managed types
51
	 * @param query The model object of the JPQL query
52
	 */
53
	public JpaQuery(JpaManagedTypeProvider provider, NamedQuery query) {
54
		this(provider, query, query.getQuery());
55
	}
56
57
	/**
58
	 * Creates a new <code>JpaQuery</code>.
59
	 *
60
	 * @param provider The provider of managed types
61
	 * @param query The model object of the JPQL query
62
	 * @param actualQuery The actual JPQL query, which can differ from the one owned by the model
63
	 * object, which happens when the model is out of sync because it has not been updated yet
64
	 */
65
	JpaQuery(JpaManagedTypeProvider provider, NamedQuery query, String actualQuery) {
66
		super();
67
		initialize(provider, query, actualQuery);
68
	}
69
70
	/**
71
	 * {@inheritDoc}
72
	 */
73
	public String getExpression() {
74
		return actualQuery;
75
	}
76
77
	/**
78
	 * {@inheritDoc}
79
	 */
80
	public JpaManagedTypeProvider getProvider() {
81
		return provider;
82
	}
83
84
	/**
85
	 * Returns the encapsulated {@link NamedQuery}, which is the actual object.
86
	 *
87
	 * @return The design-time representation of a JPQL query
88
	 */
89
	NamedQuery getQuery() {
90
		return query;
91
	}
92
93
	private void initialize(JpaManagedTypeProvider provider, NamedQuery query, String actualQuery) {
94
95
		this.query       = query;
96
		this.provider    = provider;
97
		this.actualQuery = actualQuery;
98
99
		if (this.actualQuery == null) {
100
			this.actualQuery = StringTools.EMPTY_STRING;
101
		}
102
	}
103
104
	/**
105
	 * {@inheritDoc}
106
	 */
107
	@Override
108
	public String toString() {
109
		StringBuilder sb = new StringBuilder();
110
		sb.append(super.toString());
111
		sb.append(", query=");
112
		sb.append(getExpression());
113
		return sb.toString();
114
	}
115
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaType.java (+361 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
5
 * which accompanies this distribution.
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import java.lang.annotation.Annotation;
17
import java.util.ArrayList;
18
import java.util.Collection;
19
import java.util.Collections;
20
import java.util.List;
21
import org.eclipse.core.runtime.NullProgressMonitor;
22
import org.eclipse.jdt.core.IField;
23
import org.eclipse.jdt.core.IJavaElement;
24
import org.eclipse.jdt.core.IType;
25
import org.eclipse.jdt.core.ITypeHierarchy;
26
import org.eclipse.jdt.core.dom.AST;
27
import org.eclipse.jdt.core.dom.ASTNode;
28
import org.eclipse.jdt.core.dom.ASTParser;
29
import org.eclipse.jdt.core.dom.ASTVisitor;
30
import org.eclipse.jdt.core.dom.MethodDeclaration;
31
import org.eclipse.jpt.common.utility.internal.StringTools;
32
import org.eclipse.persistence.jpa.jpql.ExpressionTools;
33
import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
34
import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
35
36
/**
37
 * The concrete implementation of {@link org.eclipse.persistence.jpa.query.spi.IType IType} that is
38
 * wrapping the design-time representation of a Java type.
39
 *
40
 * @version 3.0
41
 * @since 3.0
42
 * @author Pascal Filion
43
 */
44
final class JpaType implements org.eclipse.persistence.jpa.jpql.spi.IType {
45
46
	/**
47
	 * The cached collection of {@link IConstructor constructors}.
48
	 */
49
	private Collection<IConstructor> constructors;
50
51
	/**
52
	 * The list of names for the {@link Enum}'s constants otherwise an empty array.
53
	 */
54
	private String[] enumConstants;
55
56
	/**
57
	 * The actual Java type.
58
	 */
59
	private Class<?> javaType;
60
61
	/**
62
	 * The design-time representation of a Java type.
63
	 */
64
	private IType type;
65
66
	/**
67
	 * Caches the type hierarchy of the {@link IType} in order to prevent rebuilding it each time.
68
	 */
69
	private ITypeDeclaration typeDeclaration;
70
71
	/**
72
	 * Caches the type hierarchy of the {@link IType} in order to prevent rebuilding it each time
73
	 * {@link #isAssignableTo(org.eclipse.persistence.jpa.query.spi.IType)} is called.
74
	 */
75
	private ITypeHierarchy typeHierarchy;
76
77
	/**
78
	 * The fully qualified name of the Java type.
79
	 */
80
	private final String typeName;
81
82
	/**
83
	 * The external form of a type repository.
84
	 */
85
	private final JpaTypeRepository typeRepository;
86
87
	/**
88
	 * Creates a new <code>JpaType</code>.
89
	 *
90
	 * @param typeRepository The external form of a type repository
91
	 * @param javaType The actual Java type
92
	 */
93
	JpaType(JpaTypeRepository typeRepository, Class<?> javaType) {
94
		this(typeRepository, javaType.getName());
95
		this.javaType = javaType;
96
	}
97
98
	/**
99
	 * Creates a new <code>JpaType</code>.
100
	 *
101
	 * @param typeRepository The external form of a type repository
102
	 * @param type The design-time representation of a Java type
103
	 */
104
	JpaType(JpaTypeRepository typeRepository, IType type) {
105
		this(typeRepository, type.getFullyQualifiedName());
106
		this.type = type;
107
	}
108
109
	/**
110
	 * Creates a new <code>JpaType</code>.
111
	 *
112
	 * @param typeRepository The external form of a type repository
113
	 * @param typeName The fully qualified name of the Java type
114
	 */
115
	JpaType(JpaTypeRepository typeRepository, String typeName) {
116
		super();
117
		this.typeName       = typeName;
118
		this.typeRepository = typeRepository;
119
	}
120
121
	private ASTNode buildASTNode() {
122
123
		ASTParser parser = ASTParser.newParser(AST.JLS3);
124
125
		if (type.getElementType() == IJavaElement.CLASS_FILE) {
126
			parser.setSource(type.getClassFile());
127
		}
128
		else {
129
			parser.setSource(type.getTypeRoot());
130
		}
131
132
		parser.setIgnoreMethodBodies(true); // we don't need method bodies
133
		parser.setResolveBindings(true);
134
		parser.setBindingsRecovery(true); // see bugs 196200, 222735
135
136
		return parser.createAST(new NullProgressMonitor());
137
	}
138
139
	private IConstructor buildConstructor(MethodDeclaration method) {
140
		return new JpaConstructor(typeRepository, method);
141
	}
142
143
	private Collection<IConstructor> buildConstructors() {
144
145
		if (type == null) {
146
			return Collections.emptyList();
147
		}
148
149
		final Collection<IConstructor> constructors = new ArrayList<IConstructor>();
150
		ASTNode astNode = buildASTNode();
151
152
		astNode.accept(new ASTVisitor() {
153
			@Override
154
			public boolean visit(MethodDeclaration node) {
155
				if (node.isConstructor()) {
156
					constructors.add(buildConstructor(node));
157
				}
158
				return true;
159
			}
160
		});
161
162
		return constructors;
163
	}
164
165
	private String[] buildEnumConstants() {
166
167
		try {
168
			if ((type != null) && type.isEnum()) {
169
170
				List<String> names = new ArrayList<String>();
171
172
				for (IField field : type.getFields()) {
173
					if (field.isEnumConstant()) {
174
						names.add(field.getElementName());
175
					}
176
				}
177
178
				return names.toArray(new String[names.size()]);
179
			}
180
		}
181
		catch (Exception e) {
182
			// Just ignore and return an empty array
183
		}
184
185
		return ExpressionTools.EMPTY_STRING_ARRAY;
186
	}
187
188
	private ITypeDeclaration buildTypeDeclaration() {
189
		return new JpaTypeDeclaration(this, new ITypeDeclaration[0], false);
190
	}
191
192
	/**
193
	 * {@inheritDoc}
194
	 */
195
	public Iterable<IConstructor> constructors() {
196
		if (constructors == null) {
197
			constructors = buildConstructors();
198
		}
199
		return Collections.unmodifiableCollection(constructors);
200
	}
201
202
	/**
203
	 * {@inheritDoc}
204
	 */
205
	@Override
206
	public boolean equals(Object object) {
207
		return (this == object) || equals((org.eclipse.persistence.jpa.jpql.spi.IType) object);
208
	}
209
210
	/**
211
	 * {@inheritDoc}
212
	 */
213
	public boolean equals(org.eclipse.persistence.jpa.jpql.spi.IType type) {
214
		return (this == type) || typeName.equals(type.getName());
215
	}
216
217
	/**
218
	 * {@inheritDoc}
219
	 */
220
	public String[] getEnumConstants() {
221
		if (enumConstants == null) {
222
			enumConstants = buildEnumConstants();
223
		}
224
		return enumConstants;
225
	}
226
227
	/**
228
	 * Returns the encapsulated Java {@link Class}, which is the actual type.
229
	 *
230
	 * @return The actual Java type
231
	 */
232
	Class<?> getJavaType() {
233
		return javaType;
234
	}
235
236
	/**
237
	 * {@inheritDoc}
238
	 */
239
	public String getName() {
240
		return typeName;
241
	}
242
243
	/**
244
	 * Returns the encapsulated {@link Type}, which is the actual type.
245
	 *
246
	 * @return The design-time representation of a Java type
247
	 */
248
	IType getType() {
249
		return type;
250
	}
251
252
	/**
253
	 * {@inheritDoc}
254
	 */
255
	public ITypeDeclaration getTypeDeclaration() {
256
		if (typeDeclaration == null) {
257
			typeDeclaration = buildTypeDeclaration();
258
		}
259
		return typeDeclaration;
260
	}
261
262
	/**
263
	 * Returns the repository that gives access to the application's classes.
264
	 *
265
	 * @return The external form of the type repository
266
	 */
267
	JpaTypeRepository getTypeRepository() {
268
		return typeRepository;
269
	}
270
271
	/**
272
	 * {@inheritDoc}
273
	 */
274
	public boolean hasAnnotation(Class<? extends Annotation> annotationType) {
275
276
		if (type != null) {
277
			return type.getAnnotation(annotationType.getName()) != null;
278
		}
279
280
		if (javaType != null) {
281
			return javaType.isAnnotationPresent(annotationType);
282
		}
283
284
		return false;
285
	}
286
287
	/**
288
	 * {@inheritDoc}
289
	 */
290
	@Override
291
	public int hashCode() {
292
		return typeName.hashCode();
293
	}
294
295
	/**
296
	 * {@inheritDoc}
297
	 */
298
	public boolean isAssignableTo(org.eclipse.persistence.jpa.jpql.spi.IType type) {
299
300
		if (this == type) {
301
			return true;
302
		}
303
304
		JpaType jpaType = (JpaType) type;
305
306
		// Dealing with two IType
307
		if ((this.type != null) && (jpaType.type != null)) {
308
			try {
309
				// TODO: Use ASTTools.typeIsSubTypeOf() instead
310
				if (typeHierarchy == null) {
311
					typeHierarchy = this.type.newTypeHierarchy(new NullProgressMonitor());
312
				}
313
				return typeHierarchy.contains(jpaType.type);
314
			}
315
			catch (Exception e) {
316
				return false;
317
			}
318
		}
319
320
		// Dealing with two Class<?>
321
		if ((javaType != null) && (jpaType.javaType != null)) {
322
			return jpaType.javaType.isAssignableFrom(javaType);
323
		}
324
325
		// Anything else is always false
326
		return false;
327
	}
328
329
	/**
330
	 * {@inheritDoc}
331
	 */
332
	public boolean isEnum() {
333
334
		if (javaType != null) {
335
			return javaType.isEnum();
336
		}
337
338
		try {
339
			return (type != null) ? type.isEnum() : false;
340
		}
341
		catch (Exception e) {
342
			// Simply ignore and return no
343
			return false;
344
		}
345
	}
346
347
	/**
348
	 * {@inheritDoc}
349
	 */
350
	public boolean isResolvable() {
351
		return (type != null) || (javaType != null);
352
	}
353
354
	/**
355
	 * {@inheritDoc}
356
	 */
357
	@Override
358
	public String toString() {
359
		return StringTools.buildToStringFor(this, typeName);
360
	}
361
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeDeclaration.java (+94 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import org.eclipse.persistence.jpa.jpql.spi.IType;
17
import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
18
19
/**
20
 * The concrete implementation of {@link ITypeDeclaration} that is wrapping the design-time
21
 * representation of the declaration description of a type.
22
 *
23
 * @version 3.0
24
 * @since 3.0
25
 * @author Pascal Filion
26
 */
27
final class JpaTypeDeclaration implements ITypeDeclaration {
28
29
	/**
30
	 * Determines whether this type represents an array or not.
31
	 */
32
	private boolean array;
33
34
	/**
35
	 * The generics of the given type or an empty list if the type is not parameterized.
36
	 */
37
	private final ITypeDeclaration[] genericTypes;
38
39
	/**
40
	 * The external form of the Java type.
41
	 */
42
	private final IType type;
43
44
	/**
45
	 * Creates a new <code>JpaTypeDeclaration</code>.
46
	 *
47
	 * @param type The external form of the Java type
48
	 * @param genericTypes The generics of the given type or an empty list if the type is not
49
	 * parameterized
50
	 * @param array Determines whether this type represents an array or not
51
	 */
52
	JpaTypeDeclaration(IType type, ITypeDeclaration[] genericTypes, boolean array) {
53
		super();
54
		this.type         = type;
55
		this.genericTypes = genericTypes;
56
		this.array        = array;
57
	}
58
59
	/**
60
	 * {@inheritDoc}
61
	 */
62
	public int getDimensionality() {
63
		return array ? 1 : 0; // TODO
64
	}
65
66
	/**
67
	 * {@inheritDoc}
68
	 */
69
	public IType getType() {
70
		return type;
71
	}
72
73
	/**
74
	 * {@inheritDoc}
75
	 */
76
	public ITypeDeclaration[] getTypeParameters() {
77
		return genericTypes;
78
	}
79
80
	/**
81
	 * {@inheritDoc}
82
	 */
83
	public boolean isArray() {
84
		return array;
85
	}
86
87
	/**
88
	 * {@inheritDoc}
89
	 */
90
	@Override
91
	public String toString() {
92
		return type.getName();
93
	}
94
}
(-)src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeRepository.java (+309 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
5
 * which accompanies this distribution.
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.internal.jpql;
15
16
import java.util.HashMap;
17
import java.util.Map;
18
import org.eclipse.core.resources.IResource;
19
import org.eclipse.core.runtime.IPath;
20
import org.eclipse.jdt.core.IJavaProject;
21
import org.eclipse.jdt.core.JavaModelException;
22
import org.eclipse.persistence.jpa.jpql.TypeHelper;
23
import org.eclipse.persistence.jpa.jpql.spi.IType;
24
import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
25
26
/**
27
 * The concrete implementation of {@link ITypeRepository} that is wrapping the design-time
28
 * representation of a type repository.
29
 *
30
 * @version 3.0
31
 * @since 3.0
32
 * @author Pascal Filion
33
 */
34
@SuppressWarnings("nls")
35
final class JpaTypeRepository implements ITypeRepository {
36
37
	/**
38
	 * The Java project that gives access the design-time objects representing the Java types.
39
	 */
40
	private final IJavaProject javaProject;
41
42
	/**
43
	 * Keeps a map of the primitives for fast access.
44
	 */
45
	private Map<String, Class<?>> primitives;
46
47
	/**
48
	 * The cached helper that is using this repository for retrieving {@link IType types}.
49
	 */
50
	private TypeHelper typeHelper;
51
52
	/**
53
	 * The types that have been cached for faster access.
54
	 */
55
	private final Map<String, JpaType> types;
56
57
	/**
58
	 * The {@link IType} that represents a unresolvable or simply an unknown type, which is created
59
	 * when {@link #getType(String)} is invoked with {@link IType#UNRESOLVABLE_TYPE}.
60
	 */
61
	private JpaType unresolvableType;
62
63
	/**
64
	 * Creates a new <code>JpaTypeRepository</code>.
65
	 *
66
	 * @param javaProject The Java project that gives access the design-time objects representing
67
	 * the Java types
68
	 */
69
	JpaTypeRepository(IJavaProject javaProject) {
70
		super();
71
		this.javaProject = javaProject;
72
		this.types       = new HashMap<String, JpaType>();
73
	}
74
75
	private Map<String, Class<?>> buildPrimitives() {
76
		Map<String, Class<?>> primitives = new HashMap<String, Class<?>>();
77
		primitives.put(Byte     .TYPE.getName(), Byte     .TYPE);
78
		primitives.put(Short    .TYPE.getName(), Short    .TYPE);
79
		primitives.put(Character.TYPE.getName(), Character.TYPE);
80
		primitives.put(Integer  .TYPE.getName(), Integer  .TYPE);
81
		primitives.put(Long     .TYPE.getName(), Long     .TYPE);
82
		primitives.put(Float    .TYPE.getName(), Float    .TYPE);
83
		primitives.put(Double   .TYPE.getName(), Double   .TYPE);
84
		primitives.put(Boolean  .TYPE.getName(), Boolean  .TYPE);
85
		return primitives;
86
	}
87
88
	private JpaType buildType(Class<?> javaType) {
89
		JpaType jpaType = new JpaType(this, javaType);
90
		types.put(jpaType.getName(), jpaType);
91
		return jpaType;
92
	}
93
94
	private JpaType buildType(org.eclipse.jdt.core.IType type) {
95
		JpaType jpaType = new JpaType(this, type);
96
		types.put(jpaType.getName(), jpaType);
97
		return jpaType;
98
	}
99
100
	private JpaType buildType(String typeName) {
101
		return new JpaType(this, typeName);
102
	}
103
104
	private Class<?> findPrimitive(String typeName) {
105
		if (primitives == null) {
106
			primitives = buildPrimitives();
107
		}
108
		return primitives.get(typeName);
109
	}
110
111
	/**
112
	 * Retrieves the design-time Java type for the given type name, which has to be the fully
113
	 * qualified type name.
114
	 *
115
	 * @param typeName The fully qualified type name
116
	 * @return The design-time Java type if it could be retrieved; <code>null</code> otherwise
117
	 */
118
	private org.eclipse.jdt.core.IType findType(String typeName) {
119
		try {
120
			return javaProject.findType(typeName);
121
		}
122
		catch (JavaModelException e) {
123
			return null;
124
		}
125
	}
126
127
	/**
128
	 * {@inheritDoc}
129
	 */
130
	public JpaType getEnumType(String enumTypeName) {
131
132
		// Get the position of the last dot so we can remove the constant
133
		int lastDotIndex = enumTypeName.lastIndexOf(".");
134
135
		if (lastDotIndex == -1) {
136
			return null;
137
		}
138
139
		// Retrieve the fully qualified enum type name
140
		String typeName = enumTypeName.substring(0, lastDotIndex);
141
142
		// Attempt to load the enum type
143
		JpaType type = getType(typeName);
144
		return type.isEnum() ? type: null;
145
	}
146
147
	/**
148
	 * Returns
149
	 *
150
	 * @return
151
	 */
152
	IJavaProject getJavaProject() {
153
		return javaProject;
154
	}
155
156
	/**
157
	 * {@inheritDoc}
158
	 */
159
	public JpaType getType(Class<?> javaClass) {
160
		return getType(javaClass.getName());
161
	}
162
163
	/**
164
	 * Retrieves the {@link org.eclipse.jdt.core.IType IType} for the given {@link IResource}.
165
	 *
166
	 * @param resource The workspace location of the {@link org.eclipse.jdt.core.IType IType} to
167
	 * retrieve
168
	 * @return The design-time representation of a Java type
169
	 */
170
	org.eclipse.jdt.core.IType getType(IResource resource) {
171
		try {
172
			return (org.eclipse.jdt.core.IType) javaProject.findElement((IPath) resource);
173
		}
174
		catch (Exception e) {
175
			return null;
176
		}
177
	}
178
179
	/**
180
	 * Retrieves the {@link org.eclipse.jdt.core.IType IType} for the given {@link IResource}.
181
	 *
182
	 * @param resource The workspace location of the {@link org.eclipse.jdt.core.IType IType} to
183
	 * retrieve
184
	 * @return The design-time representation of a Java type
185
	 */
186
	IType getType(org.eclipse.jdt.core.IType type) {
187
		try {
188
			IType jpaType = types.get(type.getFullyQualifiedName());
189
			if (jpaType == null) {
190
				jpaType = buildType(type);
191
			}
192
			return jpaType;
193
		}
194
		catch (Exception e) {
195
			return null;
196
		}
197
	}
198
199
	/**
200
	 * {@inheritDoc}
201
	 */
202
	public JpaType getType(String typeName) {
203
204
		if (IType.UNRESOLVABLE_TYPE == typeName) {
205
			return unresolvableType();
206
		}
207
208
		if (typeName.charAt(0) == '[') {
209
			return loadArrayType(typeName);
210
		}
211
212
		return loadTypeImp(typeName);
213
	}
214
215
	/**
216
	 * {@inheritDoc}
217
	 */
218
	public TypeHelper getTypeHelper() {
219
		if (typeHelper == null) {
220
			typeHelper = new TypeHelper(this);
221
		}
222
		return typeHelper;
223
	}
224
225
	private JpaType loadArrayType(String typeName) {
226
227
		JpaType type = types.get(typeName);
228
229
		if (type == null) {
230
			try {
231
				// Try to see if the type is a JDK class, otherwise, just use the type name
232
				// since IType doesn't support array types
233
				type = buildType(Class.forName(typeName));
234
			}
235
			catch (Exception e) {
236
				type = buildType(typeName);
237
			}
238
239
			types.put(typeName, type);
240
		}
241
242
		return type;
243
	}
244
245
	private JpaType loadInnerType(String typeName) {
246
247
		int index = typeName.lastIndexOf(".");
248
249
		if (index == -1) {
250
			return null;
251
		}
252
253
		StringBuilder sb = new StringBuilder();
254
		sb.append(typeName.substring(0, index));
255
		sb.append("$");
256
		sb.append(typeName.substring(index + 1, typeName.length()));
257
		typeName = sb.toString();
258
259
		JpaType type = types.get(typeName);
260
261
		if (type == null) {
262
			type = loadTypeImp(typeName);
263
		}
264
265
		return type;
266
	}
267
268
	private JpaType loadTypeImp(String typeName) {
269
270
		JpaType type = types.get(typeName);
271
272
		// The type was already cached, simply return it
273
		if (type != null) {
274
			return type;
275
		}
276
277
		// First check for primitive, they don't have a corresponding IType
278
		Class<?> primitive = findPrimitive(typeName);
279
280
		if (primitive != null) {
281
			return buildType(primitive);
282
		}
283
284
		// Attempt to load the Java type
285
		org.eclipse.jdt.core.IType iType = findType(typeName);
286
287
		// A Java type exists, return it
288
		if (iType != null) {
289
			return buildType(iType);
290
		}
291
292
		// Now try with a possible inner enum type
293
		type = loadInnerType(typeName);
294
295
		// No Java type exists, create a "null" IType
296
		if (type == null) {
297
			type = buildType(typeName);
298
		}
299
300
		return type;
301
	}
302
303
	private JpaType unresolvableType() {
304
		if (unresolvableType == null) {
305
			unresolvableType = new JpaType(this, IType.UNRESOLVABLE_TYPE);
306
		}
307
		return unresolvableType;
308
	}
309
}
(-)src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java (-7 / +7 lines)
Lines 3-9 Link Here
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
6
 * 
6
 *
7
 * Contributors:
7
 * Contributors:
8
 *     Oracle - initial API and implementation
8
 *     Oracle - initial API and implementation
9
 ******************************************************************************/
9
 ******************************************************************************/
Lines 13-19 Link Here
13
public interface JpaValidationMessages {
13
public interface JpaValidationMessages {
14
14
15
	public static final String BUNDLE_NAME = "jpa_validation";
15
	public static final String BUNDLE_NAME = "jpa_validation";
16
	
16
17
	public static final String PROJECT_INVALID_LIBRARY_PROVIDER = "PROJECT_INVALID_LIBRARY_PROVIDER";
17
	public static final String PROJECT_INVALID_LIBRARY_PROVIDER = "PROJECT_INVALID_LIBRARY_PROVIDER";
18
	public static final String PROJECT_NO_CONNECTION = "PROJECT_NO_CONNECTION";
18
	public static final String PROJECT_NO_CONNECTION = "PROJECT_NO_CONNECTION";
19
	public static final String PROJECT_INVALID_CONNECTION = "PROJECT_INVALID_CONNECTION";
19
	public static final String PROJECT_INVALID_CONNECTION = "PROJECT_INVALID_CONNECTION";
Lines 43-48 Link Here
43
	public static final String GENERATOR_NAME_UNDEFINED = "GENERATOR_NAME_UNDEFINED";
43
	public static final String GENERATOR_NAME_UNDEFINED = "GENERATOR_NAME_UNDEFINED";
44
	public static final String QUERY_DUPLICATE_NAME = "QUERY_DUPLICATE_NAME";
44
	public static final String QUERY_DUPLICATE_NAME = "QUERY_DUPLICATE_NAME";
45
	public static final String QUERY_NAME_UNDEFINED = "QUERY_NAME_UNDEFINED";
45
	public static final String QUERY_NAME_UNDEFINED = "QUERY_NAME_UNDEFINED";
46
	public static final String JPQL_QUERY_VALIDATION = "JPQL_QUERY_VALIDATION";
46
	public static final String QUERY_STATEMENT_UNDEFINED = "QUERY_STATEMENT_UNDEFINED";
47
	public static final String QUERY_STATEMENT_UNDEFINED = "QUERY_STATEMENT_UNDEFINED";
47
	public static final String MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA = "MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA";
48
	public static final String MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA = "MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA";
48
	public static final String PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT = "PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT";
49
	public static final String PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT = "PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT";
Lines 158-164 Link Here
158
	public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_NAME";
159
	public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_NAME";
159
	public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_CATALOG = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_CATALOG";
160
	public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_CATALOG = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_CATALOG";
160
	public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA";
161
	public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA";
161
	
162
162
	public static final String GENERATED_VALUE_UNRESOLVED_GENERATOR = "GENERATED_VALUE_UNRESOLVED_GENERATOR";
163
	public static final String GENERATED_VALUE_UNRESOLVED_GENERATOR = "GENERATED_VALUE_UNRESOLVED_GENERATOR";
163
	public static final String PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME = "PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME";
164
	public static final String PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME = "PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME";
164
	public static final String PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
165
	public static final String PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
Lines 176-182 Link Here
176
	public static final String VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
177
	public static final String VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
177
	public static final String VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
178
	public static final String VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
178
	public static final String VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
179
	public static final String VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS = "VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS";
179
	
180
180
	public static final String NO_JPA_PROJECT = "NO_JPA_PROJECT";
181
	public static final String NO_JPA_PROJECT = "NO_JPA_PROJECT";
181
	public static final String TARGET_ENTITY_NOT_DEFINED = "TARGET_ENTITY_NOT_DEFINED";
182
	public static final String TARGET_ENTITY_NOT_DEFINED = "TARGET_ENTITY_NOT_DEFINED";
182
	public static final String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED = "VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED";
183
	public static final String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED = "VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED";
Lines 186-192 Link Here
186
	public static final String ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM = "ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM";
187
	public static final String ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM = "ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM";
187
	public static final String ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM = "ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM";
188
	public static final String ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM = "ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM";
188
	public static final String TARGET_NOT_AN_EMBEDDABLE = "TARGET_NOT_AN_EMBEDDABLE";
189
	public static final String TARGET_NOT_AN_EMBEDDABLE = "TARGET_NOT_AN_EMBEDDABLE";
189
	
190
190
	public static final String COLUMN_TABLE_NOT_VALID="COLUMN_TABLE_NOT_VALID";
191
	public static final String COLUMN_TABLE_NOT_VALID="COLUMN_TABLE_NOT_VALID";
191
	public static final String VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID";
192
	public static final String VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID";
192
	public static final String VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID";
193
	public static final String VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID";
Lines 228-232 Link Here
228
	public static final String VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID";
229
	public static final String VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID";
229
	public static final String MAP_KEY_COLUMN_TABLE_NOT_VALID="MAP_KEY_COLUMN_TABLE_NOT_VALID";
230
	public static final String MAP_KEY_COLUMN_TABLE_NOT_VALID="MAP_KEY_COLUMN_TABLE_NOT_VALID";
230
	public static final String VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID";
231
	public static final String VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID";
231
232
}
232
}
(-)src/org/eclipse/jpt/jpa/core/resource/orm/XmlNamedNativeQuery.java (-9 / +13 lines)
Lines 3-9 Link Here
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
6
 * 
6
 *
7
 * Contributors:
7
 * Contributors:
8
 *     Oracle - initial API and implementation
8
 *     Oracle - initial API and implementation
9
 ******************************************************************************/
9
 ******************************************************************************/
Lines 29-35 Link Here
29
/**
29
/**
30
 * <!-- begin-user-doc -->
30
 * <!-- begin-user-doc -->
31
 * A representation of the model object '<em><b>Named Native Query</b></em>'.
31
 * A representation of the model object '<em><b>Named Native Query</b></em>'.
32
 * 
32
 *
33
 * Provisional API: This interface is part of an interim API that is still
33
 * Provisional API: This interface is part of an interim API that is still
34
 * under development and expected to change significantly before reaching
34
 * under development and expected to change significantly before reaching
35
 * stability. It is available at this early stage to solicit feedback from
35
 * stability. It is available at this early stage to solicit feedback from
Lines 538-548 Link Here
538
		result.append(')');
538
		result.append(')');
539
		return result.toString();
539
		return result.toString();
540
	}
540
	}
541
	
541
542
	public TextRange getNameTextRange() {
542
	public TextRange getNameTextRange() {
543
		return getAttributeTextRange(JPA.NAME);
543
		return getAttributeTextRange(JPA.NAME);
544
	}
544
	}
545
	
545
546
	public TextRange getQueryTextRange() {
547
		return getAttributeTextRange(JPA.QUERY);
548
	}
549
546
	// ********** translators **********
550
	// ********** translators **********
547
551
548
	public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
552
	public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
Lines 563-585 Link Here
563
	protected static Translator buildNameTranslator() {
567
	protected static Translator buildNameTranslator() {
564
		return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getXmlQuery_Name(), Translator.DOM_ATTRIBUTE);
568
		return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getXmlQuery_Name(), Translator.DOM_ATTRIBUTE);
565
	}
569
	}
566
	
570
567
	protected static Translator buildResultClassTranslator() {
571
	protected static Translator buildResultClassTranslator() {
568
		return new Translator(JPA.RESULT_CLASS, OrmPackage.eINSTANCE.getXmlNamedNativeQuery_ResultClass(), Translator.DOM_ATTRIBUTE);
572
		return new Translator(JPA.RESULT_CLASS, OrmPackage.eINSTANCE.getXmlNamedNativeQuery_ResultClass(), Translator.DOM_ATTRIBUTE);
569
	}
573
	}
570
	
574
571
	protected static Translator buildResultSetMappingTranslator() {
575
	protected static Translator buildResultSetMappingTranslator() {
572
		return new Translator(JPA.RESULT_SET_MAPPING, OrmPackage.eINSTANCE.getXmlNamedNativeQuery_ResultSetMapping(), Translator.DOM_ATTRIBUTE);
576
		return new Translator(JPA.RESULT_SET_MAPPING, OrmPackage.eINSTANCE.getXmlNamedNativeQuery_ResultSetMapping(), Translator.DOM_ATTRIBUTE);
573
	}
577
	}
574
	
578
575
	protected static Translator buildDescriptionTranslator() {
579
	protected static Translator buildDescriptionTranslator() {
576
		return new Translator(JPA2_0.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlQuery_2_0_Description());
580
		return new Translator(JPA2_0.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlQuery_2_0_Description());
577
	}
581
	}
578
	
582
579
	protected static Translator buildQueryTranslator() {
583
	protected static Translator buildQueryTranslator() {
580
		return new Translator(JPA.QUERY, OrmPackage.eINSTANCE.getXmlQuery_Query());
584
		return new Translator(JPA.QUERY, OrmPackage.eINSTANCE.getXmlQuery_Query());
581
	}
585
	}
582
	
586
583
	protected static Translator buildHintTranslator() {
587
	protected static Translator buildHintTranslator() {
584
		return XmlQueryHint.buildTranslator(JPA.HINT, OrmPackage.eINSTANCE.getXmlQuery_Hints());
588
		return XmlQueryHint.buildTranslator(JPA.HINT, OrmPackage.eINSTANCE.getXmlQuery_Hints());
585
	}
589
	}
(-)src/org/eclipse/jpt/jpa/core/resource/orm/XmlNamedQuery.java (-7 / +29 lines)
Lines 3-9 Link Here
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
6
 * 
6
 *
7
 * Contributors:
7
 * Contributors:
8
 *     Oracle - initial API and implementation
8
 *     Oracle - initial API and implementation
9
 ******************************************************************************/
9
 ******************************************************************************/
Lines 19-24 Link Here
19
import org.eclipse.emf.ecore.impl.ENotificationImpl;
19
import org.eclipse.emf.ecore.impl.ENotificationImpl;
20
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
20
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
21
import org.eclipse.emf.ecore.util.InternalEList;
21
import org.eclipse.emf.ecore.util.InternalEList;
22
import org.eclipse.jpt.common.core.internal.utility.SimpleTextRange;
22
import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
23
import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
23
import org.eclipse.jpt.common.core.utility.TextRange;
24
import org.eclipse.jpt.common.core.utility.TextRange;
24
import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
25
import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
Lines 27-37 Link Here
27
import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlNamedQuery_2_0;
28
import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlNamedQuery_2_0;
28
import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
29
import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject;
29
import org.eclipse.wst.common.internal.emf.resource.Translator;
30
import org.eclipse.wst.common.internal.emf.resource.Translator;
31
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
30
32
31
/**
33
/**
32
 * <!-- begin-user-doc -->
34
 * <!-- begin-user-doc -->
33
 * A representation of the model object '<em><b>Named Query</b></em>'.
35
 * A representation of the model object '<em><b>Named Query</b></em>'.
34
 * 
36
 *
35
 * Provisional API: This interface is part of an interim API that is still
37
 * Provisional API: This interface is part of an interim API that is still
36
 * under development and expected to change significantly before reaching
38
 * under development and expected to change significantly before reaching
37
 * stability. It is available at this early stage to solicit feedback from
39
 * stability. It is available at this early stage to solicit feedback from
Lines 503-513 Link Here
503
		result.append(')');
505
		result.append(')');
504
		return result.toString();
506
		return result.toString();
505
	}
507
	}
506
	
508
507
	public TextRange getNameTextRange() {
509
	public TextRange getNameTextRange() {
508
		return getAttributeTextRange(JPA.NAME);
510
		return getAttributeTextRange(JPA.NAME);
509
	}
511
	}
510
	
512
513
	public TextRange getQueryTextRange() {
514
		// <named-query>
515
		IDOMNode node = getElementNode(JPA.QUERY);
516
		if (node != null) {
517
			// The query element has text
518
			if (node.hasChildNodes()) {
519
				return buildTextRange((IDOMNode) node.getFirstChild());
520
			}
521
			// The query element does not have text
522
			TextRange textRange = buildTextRange(node);
523
			return new SimpleTextRange(
524
				node.getEndStructuredDocumentRegion().getStartOffset(),
525
				0,
526
				textRange.getLineNumber()
527
			);
528
		}
529
530
		return this.getValidationTextRange();
531
	}
532
511
	// ********** translators **********
533
	// ********** translators **********
512
534
513
	public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
535
	public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
Lines 527-541 Link Here
527
	protected static Translator buildNameTranslator() {
549
	protected static Translator buildNameTranslator() {
528
		return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getXmlQuery_Name(), Translator.DOM_ATTRIBUTE);
550
		return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getXmlQuery_Name(), Translator.DOM_ATTRIBUTE);
529
	}
551
	}
530
	
552
531
	protected static Translator buildDescriptionTranslator() {
553
	protected static Translator buildDescriptionTranslator() {
532
		return new Translator(JPA2_0.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlQuery_2_0_Description());
554
		return new Translator(JPA2_0.DESCRIPTION, OrmV2_0Package.eINSTANCE.getXmlQuery_2_0_Description());
533
	}
555
	}
534
	
556
535
	protected static Translator buildQueryTranslator() {
557
	protected static Translator buildQueryTranslator() {
536
		return new Translator(JPA.QUERY, OrmPackage.eINSTANCE.getXmlQuery_Query());
558
		return new Translator(JPA.QUERY, OrmPackage.eINSTANCE.getXmlQuery_Query());
537
	}
559
	}
538
	
560
539
	protected static Translator buildLockModeTranslator() {
561
	protected static Translator buildLockModeTranslator() {
540
		return new Translator(JPA2_0.NAMED_QUERY__LOCK_MODE, OrmV2_0Package.eINSTANCE.getXmlNamedQuery_2_0_LockMode());
562
		return new Translator(JPA2_0.NAMED_QUERY__LOCK_MODE, OrmV2_0Package.eINSTANCE.getXmlNamedQuery_2_0_LockMode());
541
	}
563
	}
(-)src/org/eclipse/jpt/jpa/core/resource/orm/XmlQuery.java (-4 / +6 lines)
Lines 3-9 Link Here
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
6
 * 
6
 *
7
 * Contributors:
7
 * Contributors:
8
 *     Oracle - initial API and implementation
8
 *     Oracle - initial API and implementation
9
 ******************************************************************************/
9
 ******************************************************************************/
Lines 16-22 Link Here
16
/**
16
/**
17
 * <!-- begin-user-doc -->
17
 * <!-- begin-user-doc -->
18
 * A representation of the model object '<em><b>Query</b></em>'.
18
 * A representation of the model object '<em><b>Query</b></em>'.
19
 * 
19
 *
20
 * Provisional API: This interface is part of an interim API that is still
20
 * Provisional API: This interface is part of an interim API that is still
21
 * under development and expected to change significantly before reaching
21
 * under development and expected to change significantly before reaching
22
 * stability. It is available at this early stage to solicit feedback from
22
 * stability. It is available at this early stage to solicit feedback from
Lines 106-111 Link Here
106
	 * @generated
106
	 * @generated
107
	 */
107
	 */
108
	EList<XmlQueryHint> getHints();
108
	EList<XmlQueryHint> getHints();
109
	
109
110
	public TextRange getNameTextRange();
110
	TextRange getNameTextRange();
111
112
	TextRange getQueryTextRange();
111
}
113
}
(-).classpath (+1 lines)
Lines 11-15 Link Here
11
			<accessrule kind="accessible" pattern="org/eclipse/wst/**"/>
11
			<accessrule kind="accessible" pattern="org/eclipse/wst/**"/>
12
		</accessrules>
12
		</accessrules>
13
	</classpathentry>
13
	</classpathentry>
14
	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.persistence.jpa.jpql.test"/>
14
	<classpathentry kind="output" path="bin"/>
15
	<classpathentry kind="output" path="bin"/>
15
</classpath>
16
</classpath>
(-)AllJPQLQueryTests.launch (+313 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
3
<setAttribute key="additional_plugins"/>
4
<booleanAttribute key="append.args" value="true"/>
5
<booleanAttribute key="askclear" value="false"/>
6
<booleanAttribute key="automaticAdd" value="true"/>
7
<booleanAttribute key="automaticValidate" value="false"/>
8
<stringAttribute key="bootstrap" value=""/>
9
<stringAttribute key="checked" value="[NONE]"/>
10
<booleanAttribute key="clearConfig" value="true"/>
11
<booleanAttribute key="clearws" value="true"/>
12
<booleanAttribute key="clearwslog" value="false"/>
13
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
14
<booleanAttribute key="default" value="true"/>
15
<stringAttribute key="featureDefaultLocation" value="workspace"/>
16
<stringAttribute key="featurePluginResolution" value="workspace"/>
17
<booleanAttribute key="includeOptional" value="true"/>
18
<stringAttribute key="location" value="${workspace_loc}/jpql-junit-workspace"/>
19
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
20
<listEntry value="/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpql/AllJPQLQueryTests.java"/>
21
</listAttribute>
22
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
23
<listEntry value="1"/>
24
</listAttribute>
25
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
26
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
27
</listAttribute>
28
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
29
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
30
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
31
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
32
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
33
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.jpt.jpa.core.tests.internal.jpql.AllJPQLQueryTests"/>
34
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
35
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jpt.jpa.core.tests"/>
36
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
37
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m&#13;&#10;-Xmx1024m&#13;&#10;-XX:PermSize=64M&#13;&#10;-XX:MaxPermSize=128M &#13;&#10;-Dorg.eclipse.jpt.jpa.jar=${workspace_loc:/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/lib/persistence.jar}&#13;&#10;-Dorg.eclipse.jpt.eclipselink.jar=${workspace_loc:/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/lib/eclipselink.jar}&#13;&#10;-Dtest.query.jpql.resource.source=${workspace_loc:/org.eclipse.persistence.jpa.jpql.test/resource/source}"/>
38
<stringAttribute key="pde.version" value="3.3"/>
39
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
40
<booleanAttribute key="run_in_ui_thread" value="true"/>
41
<setAttribute key="selected_features">
42
<setEntry value="com.collabnet.subversion.merge.feature:default"/>
43
<setEntry value="com.sun.jna:default"/>
44
<setEntry value="org.eclipse.cvs.source:default"/>
45
<setEntry value="org.eclipse.cvs:default"/>
46
<setEntry value="org.eclipse.datatools.common.doc.user:default"/>
47
<setEntry value="org.eclipse.datatools.connectivity.doc.user:default"/>
48
<setEntry value="org.eclipse.datatools.connectivity.feature.source:default"/>
49
<setEntry value="org.eclipse.datatools.connectivity.feature:default"/>
50
<setEntry value="org.eclipse.datatools.connectivity.oda.designer.core.feature.source:default"/>
51
<setEntry value="org.eclipse.datatools.connectivity.oda.designer.core.feature:default"/>
52
<setEntry value="org.eclipse.datatools.connectivity.oda.designer.feature.source:default"/>
53
<setEntry value="org.eclipse.datatools.connectivity.oda.designer.feature:default"/>
54
<setEntry value="org.eclipse.datatools.connectivity.oda.feature.source:default"/>
55
<setEntry value="org.eclipse.datatools.connectivity.oda.feature:default"/>
56
<setEntry value="org.eclipse.datatools.doc.user:default"/>
57
<setEntry value="org.eclipse.datatools.enablement.apache.derby.feature.source:default"/>
58
<setEntry value="org.eclipse.datatools.enablement.apache.derby.feature:default"/>
59
<setEntry value="org.eclipse.datatools.enablement.feature.source:default"/>
60
<setEntry value="org.eclipse.datatools.enablement.feature:default"/>
61
<setEntry value="org.eclipse.datatools.enablement.hsqldb.feature.source:default"/>
62
<setEntry value="org.eclipse.datatools.enablement.hsqldb.feature:default"/>
63
<setEntry value="org.eclipse.datatools.enablement.ibm.feature.source:default"/>
64
<setEntry value="org.eclipse.datatools.enablement.ibm.feature:default"/>
65
<setEntry value="org.eclipse.datatools.enablement.ingres.feature.source:default"/>
66
<setEntry value="org.eclipse.datatools.enablement.ingres.feature:default"/>
67
<setEntry value="org.eclipse.datatools.enablement.jdbc.feature.source:default"/>
68
<setEntry value="org.eclipse.datatools.enablement.jdbc.feature:default"/>
69
<setEntry value="org.eclipse.datatools.enablement.jdt.feature.source:default"/>
70
<setEntry value="org.eclipse.datatools.enablement.jdt.feature:default"/>
71
<setEntry value="org.eclipse.datatools.enablement.msft.feature.source:default"/>
72
<setEntry value="org.eclipse.datatools.enablement.msft.feature:default"/>
73
<setEntry value="org.eclipse.datatools.enablement.mysql.feature.source:default"/>
74
<setEntry value="org.eclipse.datatools.enablement.mysql.feature:default"/>
75
<setEntry value="org.eclipse.datatools.enablement.oda.designer.feature.source:default"/>
76
<setEntry value="org.eclipse.datatools.enablement.oda.designer.feature:default"/>
77
<setEntry value="org.eclipse.datatools.enablement.oda.feature.source:default"/>
78
<setEntry value="org.eclipse.datatools.enablement.oda.feature:default"/>
79
<setEntry value="org.eclipse.datatools.enablement.oracle.feature.source:default"/>
80
<setEntry value="org.eclipse.datatools.enablement.oracle.feature:default"/>
81
<setEntry value="org.eclipse.datatools.enablement.postgresql.feature.source:default"/>
82
<setEntry value="org.eclipse.datatools.enablement.postgresql.feature:default"/>
83
<setEntry value="org.eclipse.datatools.enablement.sap.feature.source:default"/>
84
<setEntry value="org.eclipse.datatools.enablement.sap.feature:default"/>
85
<setEntry value="org.eclipse.datatools.enablement.sdk.feature:default"/>
86
<setEntry value="org.eclipse.datatools.enablement.sqlite.feature.source:default"/>
87
<setEntry value="org.eclipse.datatools.enablement.sqlite.feature:default"/>
88
<setEntry value="org.eclipse.datatools.enablement.sybase.feature.source:default"/>
89
<setEntry value="org.eclipse.datatools.enablement.sybase.feature:default"/>
90
<setEntry value="org.eclipse.datatools.intro:default"/>
91
<setEntry value="org.eclipse.datatools.modelbase.feature.source:default"/>
92
<setEntry value="org.eclipse.datatools.modelbase.feature:default"/>
93
<setEntry value="org.eclipse.datatools.sdk.feature:default"/>
94
<setEntry value="org.eclipse.datatools.sqldevtools.data.feature.source:default"/>
95
<setEntry value="org.eclipse.datatools.sqldevtools.data.feature:default"/>
96
<setEntry value="org.eclipse.datatools.sqldevtools.ddl.feature.source:default"/>
97
<setEntry value="org.eclipse.datatools.sqldevtools.ddl.feature:default"/>
98
<setEntry value="org.eclipse.datatools.sqldevtools.ddlgen.feature.source:default"/>
99
<setEntry value="org.eclipse.datatools.sqldevtools.ddlgen.feature:default"/>
100
<setEntry value="org.eclipse.datatools.sqldevtools.feature.source:default"/>
101
<setEntry value="org.eclipse.datatools.sqldevtools.feature:default"/>
102
<setEntry value="org.eclipse.datatools.sqldevtools.parsers.feature.source:default"/>
103
<setEntry value="org.eclipse.datatools.sqldevtools.parsers.feature:default"/>
104
<setEntry value="org.eclipse.datatools.sqldevtools.results.feature.source:default"/>
105
<setEntry value="org.eclipse.datatools.sqldevtools.results.feature:default"/>
106
<setEntry value="org.eclipse.datatools.sqldevtools.schemaobjecteditor.feature:default"/>
107
<setEntry value="org.eclipse.datatools.sqldevtools.sqlbuilder.feature.source:default"/>
108
<setEntry value="org.eclipse.datatools.sqldevtools.sqlbuilder.feature:default"/>
109
<setEntry value="org.eclipse.datatools.sqltools.doc.user:default"/>
110
<setEntry value="org.eclipse.draw2d.sdk:default"/>
111
<setEntry value="org.eclipse.draw2d.source:default"/>
112
<setEntry value="org.eclipse.draw2d:default"/>
113
<setEntry value="org.eclipse.emf.base.source:default"/>
114
<setEntry value="org.eclipse.emf.base:default"/>
115
<setEntry value="org.eclipse.emf.codegen.ecore.source:default"/>
116
<setEntry value="org.eclipse.emf.codegen.ecore.ui.source:default"/>
117
<setEntry value="org.eclipse.emf.codegen.ecore.ui:default"/>
118
<setEntry value="org.eclipse.emf.codegen.ecore:default"/>
119
<setEntry value="org.eclipse.emf.codegen.source:default"/>
120
<setEntry value="org.eclipse.emf.codegen.ui.source:default"/>
121
<setEntry value="org.eclipse.emf.codegen.ui:default"/>
122
<setEntry value="org.eclipse.emf.codegen:default"/>
123
<setEntry value="org.eclipse.emf.common.source:default"/>
124
<setEntry value="org.eclipse.emf.common.ui.source:default"/>
125
<setEntry value="org.eclipse.emf.common.ui:default"/>
126
<setEntry value="org.eclipse.emf.common:default"/>
127
<setEntry value="org.eclipse.emf.converter.source:default"/>
128
<setEntry value="org.eclipse.emf.converter:default"/>
129
<setEntry value="org.eclipse.emf.databinding.edit.source:default"/>
130
<setEntry value="org.eclipse.emf.databinding.edit:default"/>
131
<setEntry value="org.eclipse.emf.databinding.source:default"/>
132
<setEntry value="org.eclipse.emf.databinding:default"/>
133
<setEntry value="org.eclipse.emf.doc.source:default"/>
134
<setEntry value="org.eclipse.emf.doc:default"/>
135
<setEntry value="org.eclipse.emf.ecore.edit.source:default"/>
136
<setEntry value="org.eclipse.emf.ecore.edit:default"/>
137
<setEntry value="org.eclipse.emf.ecore.editor.source:default"/>
138
<setEntry value="org.eclipse.emf.ecore.editor:default"/>
139
<setEntry value="org.eclipse.emf.ecore.source:default"/>
140
<setEntry value="org.eclipse.emf.ecore:default"/>
141
<setEntry value="org.eclipse.emf.edit.source:default"/>
142
<setEntry value="org.eclipse.emf.edit.ui.source:default"/>
143
<setEntry value="org.eclipse.emf.edit.ui:default"/>
144
<setEntry value="org.eclipse.emf.edit:default"/>
145
<setEntry value="org.eclipse.emf.mapping.ecore.editor.source:default"/>
146
<setEntry value="org.eclipse.emf.mapping.ecore.editor:default"/>
147
<setEntry value="org.eclipse.emf.mapping.ecore.source:default"/>
148
<setEntry value="org.eclipse.emf.mapping.ecore:default"/>
149
<setEntry value="org.eclipse.emf.mapping.source:default"/>
150
<setEntry value="org.eclipse.emf.mapping.ui.source:default"/>
151
<setEntry value="org.eclipse.emf.mapping.ui:default"/>
152
<setEntry value="org.eclipse.emf.mapping:default"/>
153
<setEntry value="org.eclipse.emf.sdk:default"/>
154
<setEntry value="org.eclipse.emf.source:default"/>
155
<setEntry value="org.eclipse.emf:default"/>
156
<setEntry value="org.eclipse.equinox.p2.user.ui.source:default"/>
157
<setEntry value="org.eclipse.equinox.p2.user.ui:default"/>
158
<setEntry value="org.eclipse.gef.sdk:default"/>
159
<setEntry value="org.eclipse.gef.source:default"/>
160
<setEntry value="org.eclipse.gef:default"/>
161
<setEntry value="org.eclipse.help.source:default"/>
162
<setEntry value="org.eclipse.help:default"/>
163
<setEntry value="org.eclipse.jdt.source:default"/>
164
<setEntry value="org.eclipse.jdt:default"/>
165
<setEntry value="org.eclipse.jpt.eclipselink.feature.source:default"/>
166
<setEntry value="org.eclipse.jpt.eclipselink.feature:default"/>
167
<setEntry value="org.eclipse.jpt.eclipselink_sdk.feature:default"/>
168
<setEntry value="org.eclipse.jpt.feature.source:default"/>
169
<setEntry value="org.eclipse.jpt.feature:default"/>
170
<setEntry value="org.eclipse.jpt.jaxb.eclipselink.feature.source:default"/>
171
<setEntry value="org.eclipse.jpt.jaxb.eclipselink.feature:default"/>
172
<setEntry value="org.eclipse.jpt.jaxb.eclipselink_sdk.feature:default"/>
173
<setEntry value="org.eclipse.jpt.jaxb.feature.source:default"/>
174
<setEntry value="org.eclipse.jpt.jaxb.feature:default"/>
175
<setEntry value="org.eclipse.jpt.jaxb.tests.feature:default"/>
176
<setEntry value="org.eclipse.jpt.jaxb_sdk.feature:default"/>
177
<setEntry value="org.eclipse.jpt.sdk:default"/>
178
<setEntry value="org.eclipse.jpt.tests.feature:default"/>
179
<setEntry value="org.eclipse.jpt.tests:default"/>
180
<setEntry value="org.eclipse.jpt_sdk.feature:default"/>
181
<setEntry value="org.eclipse.jsf.feature.source:default"/>
182
<setEntry value="org.eclipse.jsf.feature:default"/>
183
<setEntry value="org.eclipse.jsf_sdk.feature:default"/>
184
<setEntry value="org.eclipse.jst.common.fproj.enablement.jdt.sdk:default"/>
185
<setEntry value="org.eclipse.jst.common.fproj.enablement.jdt:default"/>
186
<setEntry value="org.eclipse.jst.enterprise_core.feature.source:default"/>
187
<setEntry value="org.eclipse.jst.enterprise_core.feature:default"/>
188
<setEntry value="org.eclipse.jst.enterprise_sdk.feature:default"/>
189
<setEntry value="org.eclipse.jst.enterprise_ui.feature.source:default"/>
190
<setEntry value="org.eclipse.jst.enterprise_ui.feature:default"/>
191
<setEntry value="org.eclipse.jst.enterprise_userdoc.feature:default"/>
192
<setEntry value="org.eclipse.jst.jsf.apache.trinidad.tagsupport.feature.source:default"/>
193
<setEntry value="org.eclipse.jst.jsf.apache.trinidad.tagsupport.feature:default"/>
194
<setEntry value="org.eclipse.jst.jsf.apache.trinidad.tagsupport_sdk.feature:default"/>
195
<setEntry value="org.eclipse.jst.server_adapters.ext.feature.source:default"/>
196
<setEntry value="org.eclipse.jst.server_adapters.ext.feature:default"/>
197
<setEntry value="org.eclipse.jst.server_adapters.ext.sdk.feature:default"/>
198
<setEntry value="org.eclipse.jst.server_adapters.feature.source:default"/>
199
<setEntry value="org.eclipse.jst.server_adapters.feature:default"/>
200
<setEntry value="org.eclipse.jst.server_adapters.sdk.feature:default"/>
201
<setEntry value="org.eclipse.jst.server_core.feature.source:default"/>
202
<setEntry value="org.eclipse.jst.server_core.feature:default"/>
203
<setEntry value="org.eclipse.jst.server_sdk.feature:default"/>
204
<setEntry value="org.eclipse.jst.server_ui.feature.source:default"/>
205
<setEntry value="org.eclipse.jst.server_ui.feature:default"/>
206
<setEntry value="org.eclipse.jst.server_userdoc.feature:default"/>
207
<setEntry value="org.eclipse.jst.web_core.feature.source:default"/>
208
<setEntry value="org.eclipse.jst.web_core.feature:default"/>
209
<setEntry value="org.eclipse.jst.web_sdk.feature:default"/>
210
<setEntry value="org.eclipse.jst.web_ui.feature.source:default"/>
211
<setEntry value="org.eclipse.jst.web_ui.feature:default"/>
212
<setEntry value="org.eclipse.jst.web_userdoc.feature:default"/>
213
<setEntry value="org.eclipse.jst.webpageeditor.feature.source:default"/>
214
<setEntry value="org.eclipse.jst.webpageeditor.feature:default"/>
215
<setEntry value="org.eclipse.jst.webpageeditor_sdk.feature:default"/>
216
<setEntry value="org.eclipse.jst.ws.axis2tools.feature.source:default"/>
217
<setEntry value="org.eclipse.jst.ws.axis2tools.feature:default"/>
218
<setEntry value="org.eclipse.jst.ws.axis2tools_sdk.feature:default"/>
219
<setEntry value="org.eclipse.jst.ws.cxf.feature.source:default"/>
220
<setEntry value="org.eclipse.jst.ws.cxf.feature:default"/>
221
<setEntry value="org.eclipse.jst.ws.cxf_sdk.feature:default"/>
222
<setEntry value="org.eclipse.jst.ws.jaxws.dom.feature.source:default"/>
223
<setEntry value="org.eclipse.jst.ws.jaxws.dom.feature:default"/>
224
<setEntry value="org.eclipse.jst.ws.jaxws.dom_sdk.feature:default"/>
225
<setEntry value="org.eclipse.jst.ws.jaxws.feature.source:default"/>
226
<setEntry value="org.eclipse.jst.ws.jaxws.feature:default"/>
227
<setEntry value="org.eclipse.jst.ws.jaxws_sdk.feature:default"/>
228
<setEntry value="org.eclipse.jst.ws.jaxws_userdoc.feature:default"/>
229
<setEntry value="org.eclipse.pde.source:default"/>
230
<setEntry value="org.eclipse.pde:default"/>
231
<setEntry value="org.eclipse.platform.source:default"/>
232
<setEntry value="org.eclipse.platform:default"/>
233
<setEntry value="org.eclipse.rcp.source:default"/>
234
<setEntry value="org.eclipse.rcp:default"/>
235
<setEntry value="org.eclipse.sdk:default"/>
236
<setEntry value="org.eclipse.wst.common.fproj.sdk:default"/>
237
<setEntry value="org.eclipse.wst.common.fproj:default"/>
238
<setEntry value="org.eclipse.wst.common_core.feature.source:default"/>
239
<setEntry value="org.eclipse.wst.common_core.feature:default"/>
240
<setEntry value="org.eclipse.wst.common_sdk.feature:default"/>
241
<setEntry value="org.eclipse.wst.common_ui.feature.source:default"/>
242
<setEntry value="org.eclipse.wst.common_ui.feature:default"/>
243
<setEntry value="org.eclipse.wst.jsdt.feature.source:default"/>
244
<setEntry value="org.eclipse.wst.jsdt.feature:default"/>
245
<setEntry value="org.eclipse.wst.jsdt_sdk.feature:default"/>
246
<setEntry value="org.eclipse.wst.server_adapters.feature.source:default"/>
247
<setEntry value="org.eclipse.wst.server_adapters.feature:default"/>
248
<setEntry value="org.eclipse.wst.server_adapters.sdk.feature:default"/>
249
<setEntry value="org.eclipse.wst.server_core.feature.source:default"/>
250
<setEntry value="org.eclipse.wst.server_core.feature:default"/>
251
<setEntry value="org.eclipse.wst.server_sdk.feature:default"/>
252
<setEntry value="org.eclipse.wst.server_ui.feature.source:default"/>
253
<setEntry value="org.eclipse.wst.server_ui.feature:default"/>
254
<setEntry value="org.eclipse.wst.server_userdoc.feature:default"/>
255
<setEntry value="org.eclipse.wst.web_core.feature.source:default"/>
256
<setEntry value="org.eclipse.wst.web_core.feature:default"/>
257
<setEntry value="org.eclipse.wst.web_sdk.feature:default"/>
258
<setEntry value="org.eclipse.wst.web_ui.feature.source:default"/>
259
<setEntry value="org.eclipse.wst.web_ui.feature:default"/>
260
<setEntry value="org.eclipse.wst.web_userdoc.feature:default"/>
261
<setEntry value="org.eclipse.wst.ws_core.feature.source:default"/>
262
<setEntry value="org.eclipse.wst.ws_core.feature:default"/>
263
<setEntry value="org.eclipse.wst.ws_sdk.feature:default"/>
264
<setEntry value="org.eclipse.wst.ws_ui.feature.source:default"/>
265
<setEntry value="org.eclipse.wst.ws_ui.feature:default"/>
266
<setEntry value="org.eclipse.wst.ws_userdoc.feature:default"/>
267
<setEntry value="org.eclipse.wst.ws_wsdl15.feature:default"/>
268
<setEntry value="org.eclipse.wst.xml.security.feature.source:default"/>
269
<setEntry value="org.eclipse.wst.xml.security.feature:default"/>
270
<setEntry value="org.eclipse.wst.xml.security_sdk.feature:default"/>
271
<setEntry value="org.eclipse.wst.xml.xpath2.processor.feature:default"/>
272
<setEntry value="org.eclipse.wst.xml_core.feature.source:default"/>
273
<setEntry value="org.eclipse.wst.xml_core.feature:default"/>
274
<setEntry value="org.eclipse.wst.xml_sdk.feature:default"/>
275
<setEntry value="org.eclipse.wst.xml_ui.feature.source:default"/>
276
<setEntry value="org.eclipse.wst.xml_ui.feature:default"/>
277
<setEntry value="org.eclipse.wst.xml_userdoc.feature:default"/>
278
<setEntry value="org.eclipse.wst.xsl.feature.source:default"/>
279
<setEntry value="org.eclipse.wst.xsl.feature:default"/>
280
<setEntry value="org.eclipse.wst.xsl_sdk.feature:default"/>
281
<setEntry value="org.eclipse.xsd.doc.source:default"/>
282
<setEntry value="org.eclipse.xsd.doc:default"/>
283
<setEntry value="org.eclipse.xsd.ecore.converter.source:default"/>
284
<setEntry value="org.eclipse.xsd.ecore.converter:default"/>
285
<setEntry value="org.eclipse.xsd.edit.source:default"/>
286
<setEntry value="org.eclipse.xsd.edit:default"/>
287
<setEntry value="org.eclipse.xsd.editor.source:default"/>
288
<setEntry value="org.eclipse.xsd.editor:default"/>
289
<setEntry value="org.eclipse.xsd.mapping.editor.source:default"/>
290
<setEntry value="org.eclipse.xsd.mapping.editor:default"/>
291
<setEntry value="org.eclipse.xsd.mapping.source:default"/>
292
<setEntry value="org.eclipse.xsd.mapping:default"/>
293
<setEntry value="org.eclipse.xsd.sdk:default"/>
294
<setEntry value="org.eclipse.xsd.source:default"/>
295
<setEntry value="org.eclipse.xsd:default"/>
296
<setEntry value="org.tigris.subversion.clientadapter.feature:default"/>
297
<setEntry value="org.tigris.subversion.clientadapter.javahl.feature:default"/>
298
<setEntry value="org.tigris.subversion.clientadapter.svnkit.feature:default"/>
299
<setEntry value="org.tigris.subversion.subclipse.graph.feature:default"/>
300
<setEntry value="org.tigris.subversion.subclipse.mylyn:default"/>
301
<setEntry value="org.tigris.subversion.subclipse:default"/>
302
<setEntry value="org.tmatesoft.svnkit:default"/>
303
</setAttribute>
304
<stringAttribute key="selected_target_plugins" value="org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.jpt.core@default:default,org.eclipse.wst.web.ui@default:default,org.eclipse.datatools.enablement.mysql.dbdefinition@default:default,org.eclipse.wst.xsl@default:default,org.eclipse.wst.css.ui@default:default,org.apache.commons.logging@default:default,org.eclipse.emf.databinding.edit@default:default,org.eclipse.jst.ws.creation.ui@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.jst.jsf.doc.user@default:default,org.eclipse.emf.codegen.ecore.ui@default:default,org.eclipse.gef.doc.isv@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.help.webapp@default:default,org.eclipse.jst.j2ee.ejb.annotations.xdoclet@default:default,org.eclipse.wst.xml.ui.infopop@default:default,org.eclipse.wst.ws.parser@default:default,com.jcraft.jsch@default:default,org.eclipse.wst.common.infopop@default:default,org.eclipse.xsd.doc@default:default,org.eclipse.jst.ws.cxf.doc.user@default:default,org.eclipse.datatools.enablement.mysql.ui@default:default,org.eclipse.datatools.enablement.ibm.db2.zseries@default:default,org.eclipse.debug.ui@default:default,org.eclipse.wst.command.env.ui@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.eclipse.jst.pagedesigner@default:default,org.eclipse.wst.dtdeditor.doc.user@default:default,org.eclipse.jst.jsf.facelet.core@default:default,org.mozilla.javascript@default:default,org.eclipse.jst.ws.cxf.ui@default:default,org.eclipse.jst.ws.consumption@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.jst.j2ee.ui@default:default,org.eclipse.wst.sse.ui@default:default,org.eclipse.wst.server.core@default:default,org.eclipse.jst.ws.jaxws.doc.user@default:default,org.eclipse.core.filesystem.win32.x86_64@default:false,org.eclipse.datatools.sqltools.db.generic@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.jst.j2ee.ejb.annotation.model@default:default,org.eclipse.datatools.connectivity.apache.derby.ui@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.equinox.http.registry@default:default,org.sat4j.core@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.datatools.enablement.oda.xml@default:default,org.eclipse.jst.j2ee.jca.ui@default:default,org.apache.ant@default:default,org.eclipse.jpt.jaxb.eclipselink.branding@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.jst.j2ee.webservice@default:default,org.eclipse.datatools.connectivity.oda@default:default,org.eclipse.wst.server.http.ui@default:default,org.eclipse.core.jobs@default:default,org.eclipse.jst.jsf.ui@default:default,org.eclipse.update.configurator@3:true,org.eclipse.datatools.modelbase.sql.xml.query@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.jst.ws.ui@default:default,org.eclipse.jst.common.frameworks@default:default,org.eclipse.datatools.enablement.sybase.ase@default:default,org.eclipse.datatools.enablement.hsqldb.ui@default:default,org.eclipse.wst.jsdt.core@default:default,org.eclipse.pde.ds.ui@default:default,org.eclipse.jst.ws.cxf.creation.core@default:default,org.eclipse.jst.jsp.ui@default:default,org.eclipse.osgi.services@default:default,org.eclipse.equinox.p2.director.app@default:default,org.eclipse.xsd.editor@default:default,org.eclipse.datatools.sqltools.debugger.core.ui@default:default,org.eclipse.xsd.ecore.converter@default:default,org.eclipse.emf.converter@default:default,org.eclipse.cvs@default:default,org.eclipse.pde.ui.templates@default:default,org.eclipse.datatools.connectivity.doc.user.contexts@default:default,org.eclipse.wst.doc.user@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.datatools.enablement.msft.sqlserver.ui@default:default,org.eclipse.wst.ws.explorer@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.wst.common.frameworks.ui@default:default,org.eclipse.datatools.sqltools.parsers.sql@default:default,org.eclipse.jst.ws.jaxws.ui@default:default,org.eclipse.jst.server.ui.infopop@default:default,org.eclipse.jst.server.ui@default:default,org.eclipse.search@default:default,org.eclipse.swt@default:default,org.eclipse.wst.internet.monitor.core@default:default,org.eclipse.datatools.sdk@default:default,org.eclipse.debug.core@default:default,org.eclipse.datatools.enablement.mysql@default:default,org.eclipse.datatools.enablement.sybase.ui@default:default,org.eclipse.ui.forms@default:default,org.eclipse.jst.ejb.ui.infopop@default:default,org.eclipse.wst.jsdt.debug.rhino.ui@default:default,org.eclipse.datatools.sqltools.routineeditor@default:default,org.junit*3.8.2.v3_8_2_v20100427-1100@default:default,org.sat4j.pb@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.jpt.db.ui@default:default,org.eclipse.jpt.eclipselink.core.ddlgen@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.jst.ws.jaxrs.ui@default:default,org.eclipse.jpt.jaxb.eclipselink.core.schemagen@default:default,org.eclipse.datatools.enablement.ibm.db2.iseries.dbdefinition@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,org.eclipse.wst.jsdt.manipulation@default:default,org.eclipse.datatools.enablement.finfo@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.jst.ws.cxf.consumption.ui@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.datatools.connectivity.sqm.core.ui@default:default,org.eclipse.jst.j2ee.web@default:default,org.eclipse.jem.util@default:default,org.eclipse.datatools.enablement.sap.maxdb.dbdefinition@default:default,org.eclipse.wst.internet.monitor.ui@default:default,org.eclipse.jst.common.fproj.enablement.jdt.sdk@default:default,org.eclipse.datatools.sqltools.schemaobjecteditor@default:default,org.eclipse.datatools.sqltools.schemaobjecteditor.ui@default:default,org.eclipse.wst.xsl.sdk.documentation@default:default,org.eclipse.datatools.enablement.sybase.asa.models@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.pde.api.tools@default:default,org.eclipse.pde.ua.ui@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.jst.jsf.facesconfig.ui@default:default,org.eclipse.datatools.enablement.sqlite.dbdefinition@default:default,org.eclipse.jpt.jaxb.ui@default:default,org.eclipse.wst.jsdt.web.ui@default:default,org.eclipse.jst.j2ee.ejb.annotations.ui@default:default,org.eclipse.datatools.connectivity.sqm.server.ui@default:default,org.eclipse.jdt.ui@default:default,javax.xml.bind@default:default,org.eclipse.wst.xsdeditor.doc.user@default:default,org.eclipse.wst.xmleditor.doc.user@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.jface.text@default:default,org.eclipse.jdt.apt.core@default:default,org.eclipse.wst.xsl.exslt.core@default:default,org.eclipse.jst.ws.jaxrs.core@default:default,org.eclipse.jst.jsf.common.runtime@default:default,org.apache.xml.resolver@default:default,org.eclipse.wst.wsi@default:default,org.eclipse.jpt.jaxb.core.schemagen@default:default,org.eclipse.wst.xsl.doc@default:default,org.eclipse.wst.jsdt.ui@default:default,org.apache.jasper@default:default,org.eclipse.equinox.common@2:true,org.eclipse.wst.validation@default:default,org.eclipse.wst.command.env.infopop@default:default,org.eclipse.datatools.connectivity.sqm.core@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.datatools.doc.isv@default:default,org.eclipse.equinox.launcher.win32.win32.x86_64@default:false,org.eclipse.jdt.launching@default:default,org.eclipse.wst.xml.xpath2.processor@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.datatools.enablement.sybase.asa@default:default,org.eclipse.osgi@-1:true,org.eclipse.datatools.doc.user@default:default,org.eclipse.ui.ide@default:default,org.eclipse.datatools.enablement.sybase.ase.models@default:default,org.eclipse.datatools.connectivity.console.profile@default:default,org.eclipse.jem.beaninfo.vm.common@default:default,org.eclipse.jst.ws.jaxws.utils@default:default,org.eclipse.ant.optional.junit@default:false,org.eclipse.team.cvs.ui@default:default,org.eclipse.datatools.sqltools.data.core@default:default,org.eclipse.datatools.enablement.ibm.ui@default:default,org.eclipse.xsd.mapping.editor@default:default,org.eclipse.wst.server.ui.doc.user@default:default,org.eclipse.core.commands@default:default,org.eclipse.datatools.modelbase.dbdefinition@default:default,org.eclipse.wst.xsl.xalan@default:default,org.eclipse.wst.server.discovery@default:default,org.eclipse.pde@default:default,org.eclipse.jst.ws.axis2.core@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.datatools.enablement.ingres.dbdefinition@default:default,org.eclipse.wst.xsl.jaxp.debug@default:default,org.apache.wsil4j@default:default,org.eclipse.compare.core@default:default,org.eclipse.wst.ws.infopop@default:default,org.eclipse.jst.j2ee.infopop@default:default,javax.xml.stream@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.jst.ws.jaxws.core@default:default,org.apache.commons.el@default:default,org.eclipse.jst.j2ee@default:default,org.eclipse.wst.xsl.exslt.ui@default:default,org.eclipse.jst.common.annotations.controller@default:default,org.eclipse.datatools.sqltools.doc.user.contexts@default:default,org.eclipse.jst.server.tomcat.core@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,org.eclipse.jst.jsf.common@default:default,org.eclipse.datatools.connectivity.ui.dse@default:default,org.eclipse.wst.sse.doc.user@default:default,org.eclipse.datatools.connectivity.apache.derby.dbdefinition@default:default,org.eclipse.emf.ecore.editor@default:default,org.eclipse.wst.command.env@default:default,org.eclipse.draw2d.doc.isv@default:default,org.eclipse.wst.common.snippets@default:default,org.eclipse.core.boot@default:default,org.eclipse.core.net.win32.x86_64@default:false,org.eclipse.jem.workbench@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.update.core.win32@default:false,org.eclipse.jpt.utility@default:default,org.eclipse.datatools.enablement.ibm.db2.iseries@default:default,org.eclipse.wst.jsdt.debug.rhino.debugger@default:default,org.eclipse.datatools.connectivity.doc.user@default:default,org.eclipse.jst.j2ee.ejb.annotations.emitter@default:default,org.eclipse.datatools.sqltools.editor.core.ui@default:default,org.eclipse.jst.server.core@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.equinox.p2.ui@default:default,org.eclipse.wst.common.project.facet.ui@default:default,org.eclipse.datatools.connectivity@default:default,org.eclipse.wst.xsl.saxon@default:default,org.eclipse.update.ui@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.wst.common.ui@default:default,org.eclipse.datatools.enablement.postgresql.ui@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.jst.common.project.facet.core@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.datatools.enablement.sap.maxdb@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.jst.common.annotations.ui@default:default,javax.jws@default:default,org.eclipse.wst.validation.infopop@default:default,org.eclipse.gef@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.pde.ua.core@default:default,org.eclipse.datatools.enablement.ibm.informix.dbdefinition@default:default,org.eclipse.core.expressions@default:default,org.eclipse.jst.server.generic.jboss@default:default,org.eclipse.jpt.ui@default:default,org.apache.commons.discovery@default:default,javax.xml.rpc@default:default,org.eclipse.datatools.sqltools.editor.core@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,org.eclipse.team.core@default:default,org.eclipse.datatools.sqltools.routineeditor.ui@default:default,org.eclipse.jst.server.tomcat.ui@default:default,org.eclipse.equinox.security@default:default,org.eclipse.jst.j2ee.webservice.ui@default:default,org.eclipse.wst.ws.api.doc@default:default,org.eclipse.datatools.sqltools.db.generic.ui@default:default,org.eclipse.wst.ws.ui@default:default,org.eclipse.jst.ws.cxf.core@default:default,org.eclipse.wst.internet.cache@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.wst.dtd.ui@default:default,org.apache.xalan@default:default,org.eclipse.datatools.enablement.ibm.informix@default:default,org.eclipse.wst.server.http.core@default:default,org.eclipse.wst.validation.ui@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui@default:default,org.eclipse.emf.ant@default:default,org.eclipse.jst.ws.axis.consumption.core@default:default,org.eclipse.datatools.enablement.ingres.ui@default:default,org.eclipse.update.core@default:default,javax.mail@default:default,org.apache.bcel@default:default,javax.wsdl*1.5.1.v201012040544@default:default,org.eclipse.wst.common.modulecore.ui@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.jdt@default:default,org.eclipse.wst.xsl.jaxp.launching@default:default,org.eclipse.wst.web.ui.infopop@default:default,org.eclipse.wst.dtd.ui.infopop@default:default,org.eclipse.datatools.enablement.msft.sqlserver@default:default,org.eclipse.emf.common@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.wst.xsl.launching@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.datatools.enablement.sybase.asa.ui@default:default,org.eclipse.ant.core@default:default,org.eclipse.ecf@default:default,org.eclipse.jst.server.generic.oc4j@default:default,org.apache.commons.lang@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.datatools.enablement.ibm.db2.zseries.ui@default:default,org.eclipse.wst.wsdl.ui.doc.user@default:default,org.eclipse.jst.jsf.core@default:default,org.eclipse.core.resources@default:default,org.eclipse.jsf.branding@default:default,org.eclipse.jst.common.project.facet.ui@default:default,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.jst.ws.jaxws.dom.integration@default:default,org.eclipse.datatools.enablement.sybase.models@default:default,org.eclipse.datatools.sqltools.schemaobjecteditor.ui.pages@default:default,org.eclipse.wst.xsl.jaxp.debug.ui@default:default,org.eclipse.wst.xsl.ui@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.datatools.sqltools.sqlscrapbook@default:default,org.eclipse.datatools.connectivity.ui@default:default,org.eclipse.datatools.sqltools.plan@default:default,org.eclipse.datatools.modelbase.sql.edit@default:default,org.eclipse.datatools.enablement.sqlite.ui@default:default,org.eclipse.jst.j2ee.jca@default:default,net.sourceforge.lpg.lpgjavaruntime@default:default,org.eclipse.wst.html.core@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.pde.doc.user@default:default,org.apache.lucene@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.datatools.sqltools.doc.user@default:default,org.eclipse.ui.win32@default:false,org.eclipse.datatools.connectivity.db.generic@default:default,org.uddi4j@default:default,org.eclipse.wst.html.ui@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.emf.importer.java@default:default,org.eclipse.jst.j2ee.ejb@default:default,org.eclipse.datatools.enablement.ibm.db2.luw@default:default,org.eclipse.jst.ws.axis2.consumption.ui@default:default,org.eclipse.equinox.http.jetty@default:default,org.mortbay.jetty.util@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.jst.ws@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.jst.ws.consumption.ui.doc.user@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.jpt.doc.isv@default:default,org.eclipse.datatools.sqltools.parsers.sql.lexer@default:default,org.eclipse.jface@default:default,org.eclipse.core.net@default:default,org.eclipse.pde.runtime@default:default,org.eclipse.jst.ws.uddiregistry@default:default,org.eclipse.jst.ws.annotations.core@default:default,org.eclipse.datatools.enablement.sap.maxdb.ui@default:default,org.apache.xml.serializer@default:default,org.eclipse.emf.doc@default:default,org.eclipse.wst.server.preview@default:default,org.eclipse.datatools.enablement.oracle@default:default,javax.xml@default:default,org.eclipse.datatools.connectivity.ui.templates@default:default,org.eclipse.jdt.junit.core@default:default,org.eclipse.datatools.sqltools.db.derby@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.datatools.enablement.sybase.asa.schemaobjecteditor.examples@default:default,org.eclipse.datatools.oda.cshelp@default:default,org.eclipse.wst.server.ui.infopop@default:default,org.eclipse.pde.launching@default:default,org.eclipse.wst.jsdt.support.ie@default:default,org.eclipse.datatools.sqltools.db.derby.ui@default:default,org.eclipse.datatools.enablement.ingres@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.jpt.eclipselink.ui@default:default,org.eclipse.ui.console@default:default,org.eclipse.jpt.doc.user@default:default,org.eclipse.wst.common.emf@default:default,org.eclipse.datatools.connectivity.dbdefinition.genericJDBC@default:default,org.eclipse.ui.intro@default:default,org.eclipse.text@default:default,org.eclipse.datatools.enablement.jdt.classpath@default:default,org.eclipse.jsch.core@default:default,org.eclipse.datatools.enablement.sybase.ase.ui@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.datatools.enablement.oda.ws.ui@default:default,org.eclipse.wst.jsdt.web.support.jsp@default:default,org.eclipse.jst.ws.axis.consumption.ui@default:default,org.eclipse.pde.ds.core@default:default,org.eclipse.emf.importer@default:default,org.eclipse.jst.server.generic.core@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.datatools.enablement.postgresql.dbdefinition@default:default,org.eclipse.test@default:default,org.eclipse.jst.ws.axis2.ui.doc.user@default:default,org.eclipse.datatools.enablement.sqlite@default:default,org.eclipse.datatools.sqltools.result@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.jst.ws.infopop@default:default,org.eclipse.jst.jee.ui@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.jst.ws.axis2.creation.core@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.emf.mapping.ecore2xml@default:default,org.eclipse.jst.jsf.facesconfig@default:default,org.eclipse.wst.html.ui.infopop@default:default,org.eclipse.jst.ws.cxf.consumption.core@default:default,org.eclipse.datatools.connectivity.oda.flatfile@default:default,org.eclipse.jst.ws.doc.user@default:default,org.eclipse.jst.jsf.common.ui@default:default,org.apache.lucene.analysis@default:default,org.eclipse.jpt.jaxb.core@default:default,org.eclipse.team.ui@default:default,org.eclipse.datatools.connectivity.db.generic.ui@default:default,org.eclipse.emf.edit.ui@default:default,org.eclipse.pde.junit.runtime@default:default,org.eclipse.wst.jsdt.debug.core@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.wst.jsdt.doc@default:default,org.eclipse.draw2d@default:default,org.eclipse.jdt.apt.pluggable.core@default:default,org.eclipse.datatools.enablement.sybase.asa.dbdefinition@default:default,org.eclipse.jst.ws.jaxws.dom.runtime@default:default,org.eclipse.wst.xsl.debug.ui@default:default,org.eclipse.jst.ws.axis2.creation.ui@default:default,org.eclipse.jem.beaninfo.vm@default:default,org.apache.commons.collections@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.wst.standard.schemas@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.wst.wsdl.doc.isv@default:default,org.eclipse.wst.xml.xpath2.processor.doc.user@default:default,org.eclipse.datatools.modelbase.sql.query.edit@default:default,org.eclipse.core.runtime@default:true,org.eclipse.jst.server.preview.adapter@default:default,javax.servlet@default:default,org.eclipse.jst.server.websphere.core@default:default,org.eclipse.jst.ejb.doc.user@default:default,org.eclipse.datatools.connectivity.apache.derby@default:default,org.eclipse.emf.codegen.ecore@default:default,org.eclipse.jst.ejb.ui@default:default,org.eclipse.datatools.enablement.oda.xml.ui@default:default,org.eclipse.jst.jsf.apache.trinidad.tagsupport@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.wst.server.ui@default:default,org.eclipse.jpt.branding@default:default,org.eclipse.wst.wsdl.ui@default:default,org.eclipse.datatools.sqltools.sqleditor@default:default,org.eclipse.equinox.app@default:default,org.eclipse.wst.ws@default:default,org.eclipse.emf.exporter@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.wst.common.api.doc@default:default,org.eclipse.jst.servlet.ui.infopop@default:default,org.eclipse.datatools.connectivity.oda.design@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.jst.jsf.facelet.ui@default:default,javax.wsdl*1.6.2.v201012040545@default:default,org.junit4@default:default,org.eclipse.xsd.ecore.exporter@default:default,org.eclipse.jst.j2ee.navigator.ui@default:default,org.eclipse.datatools.enablement.ibm.db2.zseries.dbdefinition@default:default,org.eclipse.core.externaltools@default:default,org.eclipse.jst.ws.consumption.ui@default:default,org.eclipse.jdt.junit4.runtime@default:default,org.eclipse.gef.examples.ui.pde@default:default,org.eclipse.emf.mapping.xsd2ecore@default:default,org.eclipse.datatools.sqltools.debugger.core@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.datatools.enablement.ibm.db2.luw.ui@default:default,org.eclipse.datatools.enablement.hsqldb.dbdefinition@default:default,org.eclipse.emf.cheatsheets@default:default,org.eclipse.jdt.junit@default:default,org.eclipse.emf.edit@default:default,org.eclipse.emf.mapping.ecore2xml.ui@default:default,org.eclipse.emf.mapping.ecore.editor@default:default,org.eclipse.help.ui@default:default,org.eclipse.emf.codegen@default:default,org.eclipse.datatools.enablement.oracle.ui@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.wst.jsdt.debug.rhino@default:default,org.hamcrest.core@default:default,org.eclipse.pde.core@default:default,org.apache.oro@default:default,org.eclipse.datatools.enablement.msft.sqlserver.dbdefinition@default:default,org.eclipse.ui.cheatsheets@default:default,org.apache.axis@default:default,org.eclipse.wst.common.project.facet.doc.api@default:default,org.eclipse.wst.common.fproj.sdk@default:default,org.eclipse.wst.xsd.core@default:default,org.eclipse.pde.api.tools.ui@default:default,org.eclipse.datatools.connectivity.oda.flatfile.ui@default:default,org.eclipse.jst.jee.ejb@default:default,org.eclipse.wst.xsd.ui@default:default,org.eclipse.pde.ui@default:default,org.eclipse.jst.jsp.ui.infopop@default:default,org.apache.commons.codec@default:default,org.eclipse.jdt.junit.runtime@default:default,org.eclipse.xsd.mapping@default:default,org.eclipse.xsd.edit@default:default,org.apache.lucene.core@default:default,org.eclipse.datatools.sqltools.sql@default:default,org.eclipse.jst.ws.jaxws.dom.ui@default:default,org.eclipse.datatools.enablement.oda.ws@default:default,org.eclipse.datatools.connectivity.oda.consumer@default:default,org.eclipse.jst.common.ui@default:default,org.eclipse.swt.win32.win32.x86_64@default:false,org.eclipse.jst.ws.jaxws.dom.doc.isv@default:default,org.eclipse.jem.beaninfo@default:default,org.eclipse.jst.jsp.core@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.emf.codegen.ui@default:default,java_cup.runtime@default:default,org.eclipse.jpt.eclipselink.core@default:default,org.mortbay.jetty.server@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.wst.xml.xpath.core@default:default,org.eclipse.wst.wsi.ui@default:default,org.eclipse.datatools.enablement.ibm.db2.iseries.ui@default:default,org.eclipse.wst.jsdt.web.core@default:default,org.eclipse.jst.j2ee.xdoclet.runtime@default:default,org.eclipse.test.performance@default:default,org.eclipse.datatools.help@default:default,org.eclipse.ant.launching@default:default,org.eclipse.datatools.enablement.postgresql@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.jdt.doc.isv@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.jst.ws.consumption.infopop@default:default,org.eclipse.jdt.core@default:default,org.eclipse.datatools.enablement.sybase@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.jst.server.ui.doc.user@default:default,org.eclipse.emf.mapping.ecore2ecore.editor@default:default,org.eclipse.wst.wsdl@default:default,org.eclipse.datatools.sqltools.common.ui@default:default,org.eclipse.wst.server.preview.adapter@default:default,org.eclipse.datatools.common.doc.user@default:default,org.eclipse.jst.common.annotations.core@default:default,javax.activation@default:default,org.eclipse.wst.command.env.core@default:default,org.eclipse.emf@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.jst.standard.schemas@default:default,org.eclipse.jst.ws.jaxb.core@default:default,org.eclipse.datatools.enablement.ibm.db2.luw.dbdefinition@default:default,org.apache.velocity@default:default,org.eclipse.jpt.jaxb.branding@default:default,javax.servlet.jsp@default:default,org.eclipse.servertools.doc.isv@default:default,org.eclipse.datatools.enablement.hsqldb@default:default,org.eclipse.jst.ws.axis.ui.doc.user@default:default,org.eclipse.help.base@default:default,org.eclipse.help.appserver@default:default,org.eclipse.test.performance.win32@default:false,org.eclipse.datatools.sqltools.parsers.sql.xml.query@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.jst.j2ee.core@default:default,org.eclipse.wst.xml.ui@default:default,org.eclipse.wst.jsdt.debug.transport@default:default,org.eclipse.jst.ws.axis.infopop@default:default,org.eclipse.jdt.doc.user@default:default,org.eclipse.emf.example.installer@default:default,org.eclipse.ui.net@default:default,org.eclipse.wst.xsl.core@default:default,org.eclipse.wst.css.core@default:default,org.eclipse.wst.ws.service.policy.ui@default:default,org.eclipse.wst.jsdt.support.firefox@default:default,org.eclipse.jst.pagedesigner.jsf.ui@default:default,org.eclipse.wst.dtd.core@default:default,org.eclipse.equinox.p2.ql@default:default,org.eclipse.wst.jsdt.debug.ui@default:default,org.eclipse.sdk@default:default,org.eclipse.datatools.modelbase.sql.query@default:default,org.eclipse.wst.xml.xpath2@default:default,org.eclipse.jst.j2ee.doc.user@default:default,org.eclipse.jst.servlet.ui@default:default,org.objectweb.asm@default:default,org.eclipse.datatools.modelbase.derby@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.wst.xml.xpath.ui@default:default,org.eclipse.xsd@default:default,org.eclipse.jdt.apt.ui@default:default,org.eclipse.wst.wsdl.validation@default:default,org.eclipse.emf.mapping.ecore@default:default,org.eclipse.jem.proxy@default:default,org.eclipse.datatools.connectivity.oda.template.ui@default:default,org.eclipse.jst.server.generic.jonas@default:default,org.eclipse.wst.ws.service.policy@default:default,org.jdom*1.0.0.v201005080400@default:default,org.eclipse.jst.ws.axis.creation.ui@default:default,org.eclipse.jpt.eclipselink.branding@default:default,org.eclipse.datatools.modelbase.sql@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.jst.jsf.standard.tagsupport@default:default,org.eclipse.datatools.enablement.ibm.informix.ui@default:default,org.eclipse.jst.jsf.doc.dev@default:default,org.eclipse.jst.jee.web@default:default,org.eclipse.wst.validation.doc.isv@default:default,org.eclipse.datatools.sqltools.ddlgen.ui@default:default,org.eclipse.wst.webtools.doc.user@default:default,org.eclipse.compare.win32@default:default,org.eclipse.emf.databinding@default:default,org.eclipse.emf.ecore.change.edit@default:default,org.eclipse.jst.jee@default:default,org.eclipse.rcp@default:default,org.eclipse.jpt.db@default:default,org.eclipse.datatools.sqltools.sql.ui@default:default,org.eclipse.wst.common.modulecore@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.jst.ws.axis2.consumption.core@default:default,org.eclipse.xsd.ecore.importer@default:default,org.eclipse.jst.server.generic.ui@default:default,org.eclipse.datatools.enablement.oracle.dbdefinition@default:default,org.eclipse.wst.sse.ui.infopop@default:default,org.eclipse.jst.ws.axis2.ui@default:default,org.eclipse.xsd.example.installer@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.emf.importer.ecore@default:default,org.eclipse.emf.mapping.xsd2ecore.editor@default:default,org.eclipse.jst.ws.creation.ejb.ui@default:default,org.eclipse.ant.ui@default:default,org.eclipse.datatools.sqltools.parsers.sql.query@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.variables@default:default,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.eclipse.jst.ws.cxf.creation.ui@default:default,org.eclipse.compare@default:default,org.eclipse.wst.wsi.ui.doc.user@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.jst.pagedesigner.jsp.core@default:default,org.apache.log4j@default:default,org.easymock@default:default,org.eclipse.equinox.ds@1:true,javax.xml.ws@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.platform@default:default,org.eclipse.datatools.intro@default:default,org.eclipse.equinox.event@default:default,org.eclipse.datatools.connectivity.oda.profile@default:default,org.eclipse.wst.web@default:default,org.eclipse.emf.mapping.ecore2ecore@default:default,javax.xml.soap@default:default,org.eclipse.platform.doc.isv@default:default,org.eclipse.jst.ws.jaxws.doc.isv@default:default,org.eclipse.jpt.gen@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.emf.mapping.ui@default:default,org.eclipse.emf.importer.rose@default:default,org.eclipse.pde.build@default:default,org.eclipse.datatools.connectivity.oda.design.ui@default:default,org.eclipse.help@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.datatools.enablement.sybase.ase.dbdefinition@default:default,org.apache.commons.httpclient@default:default,org.eclipse.equinox.util@default:default,org.jdom*1.1.1.v201101151400@default:default,com.ibm.icu@default:default,org.eclipse.ui.browser@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.ui.editors@default:default,org.eclipse.emf.mapping@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.osgi.util@default:default,org.eclipse.jem@default:default,org.eclipse.xsd.cheatsheets@default:default,org.eclipse.wst.command.env.doc.user@default:default"/>
305
<stringAttribute key="selected_workspace_plugins" value="org.eclipse.jpt.utility.tests@default:default,org.eclipse.jpt.core.tests@default:default,org.eclipse.jpt.eclipselink.ui@default:default,org.eclipse.jpt.ui.tests@default:default,org.eclipse.jpt.db.tests@default:default,org.eclipse.jpt.utility@default:default,org.eclipse.jpt.jpa.core.tests@default:false,org.eclipse.persistence.jpa.query.test@default:default,org.eclipse.jpt.core@default:default,org.eclipse.jpt.db@default:default,org.eclipse.jpt.gen@default:default,org.eclipse.jpt.core.tests.extension.resource@default:default,org.eclipse.jpt.db.ui@default:default,org.eclipse.jpt.eclipselink.core.tests@default:default,org.eclipse.jpt@default:default,org.eclipse.jpt.ui@default:default,org.eclipse.jpt.jpa.jpql@default:default,org.eclipse.persistence.jpa.query@default:default,org.eclipse.jpt.eclipselink.core@default:default,org.eclipse.jpt.doc.user@default:default,org.eclipse.persistence.jpa@default:default"/>
306
<booleanAttribute key="show_selected_only" value="false"/>
307
<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
308
<booleanAttribute key="tracing" value="false"/>
309
<booleanAttribute key="useCustomFeatures" value="false"/>
310
<booleanAttribute key="useDefaultConfig" value="true"/>
311
<booleanAttribute key="useDefaultConfigArea" value="false"/>
312
<booleanAttribute key="useProduct" value="true"/>
313
</launchConfiguration>
(-)META-INF/MANIFEST.MF (+2 lines)
Lines 19-24 Link Here
19
 org.eclipse.jpt.jpa.db;bundle-version="[2.0.0,3.0.0)",
19
 org.eclipse.jpt.jpa.db;bundle-version="[2.0.0,3.0.0)",
20
 org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)",
20
 org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)",
21
 org.eclipse.jpt.common.utility.tests;bundle-version="[2.0.0,3.0.0)",
21
 org.eclipse.jpt.common.utility.tests;bundle-version="[2.0.0,3.0.0)",
22
 org.eclipse.jst.common.project.facet.core;bundle-version="1.4.200",
23
 org.eclipse.persistence.jpa.jpql;bundle-version="2.3.0",
22
 org.eclipse.wst.common.emf;bundle-version="[1.1.200,2.0.0)",
24
 org.eclipse.wst.common.emf;bundle-version="[1.1.200,2.0.0)",
23
 org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.1.200,2.0.0)",
25
 org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.1.200,2.0.0)",
24
 org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)",
26
 org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)",
(-)src/org/eclipse/jpt/jpa/core/tests/internal/jpql/AllJPQLQueryTests.java (+78 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
5
 * which accompanies this distribution.
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.tests.internal.jpql;
15
16
import junit.extensions.TestSetup;
17
import junit.framework.JUnit4TestAdapter;
18
import junit.framework.Test;
19
import junit.framework.TestSuite;
20
import org.eclipse.persistence.jpa.jpql.AbstractJPQLQueryTest;
21
import org.eclipse.persistence.jpa.jpql.ContentAssistTest;
22
import org.eclipse.persistence.jpa.jpql.GrammarValidatorTest;
23
import org.eclipse.persistence.jpa.jpql.ORMEntityJPQLQueryHelperTest;
24
import org.eclipse.persistence.jpa.jpql.ORMJPQLQueryHelperTest;
25
import org.eclipse.persistence.jpa.jpql.PersistenceUnitEntityJPQLQueryHelperTest;
26
import org.eclipse.persistence.jpa.jpql.SemanticValidatorTest;
27
28
/**
29
 * The test suite for the JPQL parsing system.
30
 *
31
 * @version 3.0
32
 * @since 3.0
33
 * @author Pascal Filion
34
 */
35
@SuppressWarnings("nls")
36
public final class AllJPQLQueryTests {
37
38
	public AllJPQLQueryTests() {
39
		super();
40
	}
41
42
	public static Test buildAllTests() {
43
44
		TestSuite suite = new TestSuite("JPQL Query Tests");
45
46
		// JPQLQueryHelper tests
47
		suite.addTest(new JUnit4TestAdapter(ORMEntityJPQLQueryHelperTest.class));
48
		suite.addTest(new JUnit4TestAdapter(ORMJPQLQueryHelperTest.class));
49
		suite.addTest(new JUnit4TestAdapter(PersistenceUnitEntityJPQLQueryHelperTest.class));
50
51
		// Validation
52
		suite.addTest(new JUnit4TestAdapter(GrammarValidatorTest.class));
53
		suite.addTest(new JUnit4TestAdapter(SemanticValidatorTest.class));
54
55
		// Content Assist
56
		suite.addTest(new JUnit4TestAdapter(ContentAssistTest.class));
57
58
		return buildBatchTestSuite(suite);
59
	}
60
61
	private static TestSetup buildBatchTestSuite(Test test) {
62
		return new TestSetup(test) {
63
			@Override
64
			protected void setUp() throws Exception {
65
				AbstractJPQLQueryTest.setUpClass();
66
			}
67
			@Override
68
			protected void tearDown() throws Exception {
69
				AbstractJPQLQueryTest.tearDownClass();
70
			}
71
		};
72
	}
73
74
	public static Test suite() {
75
		AbstractJPQLQueryTest.setJPQLQueryTestHelper(new JpaJpqlQueryTestHelper());
76
		return buildAllTests();
77
	}
78
}
(-)src/org/eclipse/jpt/jpa/core/tests/internal/jpql/JpaJpqlQueryTestHelper.java (+282 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
5
 * which accompanies this distribution.
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.core.tests.internal.jpql;
15
16
import java.util.HashMap;
17
import java.util.Iterator;
18
import java.util.ListIterator;
19
import java.util.Map;
20
import org.eclipse.core.resources.IFolder;
21
import org.eclipse.core.resources.IProject;
22
import org.eclipse.core.resources.IResource;
23
import org.eclipse.core.resources.IWorkspaceRoot;
24
import org.eclipse.core.runtime.IPath;
25
import org.eclipse.core.runtime.NullProgressMonitor;
26
import org.eclipse.core.runtime.Path;
27
import org.eclipse.jdt.core.IClasspathEntry;
28
import org.eclipse.jdt.core.IJavaProject;
29
import org.eclipse.jdt.core.JavaCore;
30
import org.eclipse.jdt.core.JavaModelException;
31
import org.eclipse.jpt.common.core.tests.internal.projects.TestFacetedProject;
32
import org.eclipse.jpt.common.utility.internal.ArrayTools;
33
import org.eclipse.jpt.jpa.core.JpaFacet;
34
import org.eclipse.jpt.jpa.core.JpaProject;
35
import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
36
import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
37
import org.eclipse.jpt.jpa.core.context.MappingFile;
38
import org.eclipse.jpt.jpa.core.context.NamedQuery;
39
import org.eclipse.jpt.jpa.core.context.PersistentType;
40
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
41
import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
42
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
43
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
44
import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
45
import org.eclipse.jpt.jpa.core.internal.jpql.JpaMappingFile;
46
import org.eclipse.jpt.jpa.core.internal.jpql.JpaPersistenceUnit;
47
import org.eclipse.jpt.jpa.core.internal.jpql.JpaQuery;
48
import org.eclipse.jpt.jpa.core.tests.internal.projects.TestJpaProject;
49
import org.eclipse.jst.common.project.facet.core.JavaFacet;
50
import org.eclipse.persistence.jpa.internal.jpql.VirtualQuery;
51
import org.eclipse.persistence.jpa.jpql.IORMConfiguration;
52
import org.eclipse.persistence.jpa.jpql.JPQLQueryHelper;
53
import org.eclipse.persistence.jpa.jpql.JPQLQueryTestHelper;
54
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeProvider;
55
import org.eclipse.persistence.jpa.jpql.spi.IQuery;
56
57
/**
58
 * This helper gives to the unit-tests the access to the application metadata through JPT API.
59
 *
60
 * @version 3.0
61
 * @since 3.0
62
 * @author Pascal Filion
63
 */
64
@SuppressWarnings("nls")
65
public final class JpaJpqlQueryTestHelper implements JPQLQueryTestHelper {
66
67
	/**
68
	 * Flag used to prevent the project metadata to be created more than once.
69
	 */
70
	private boolean initialized;
71
72
	/**
73
	 * The JPA project used to test the JPQL query API.
74
	 */
75
	private JpaProject jpaProject;
76
77
	/**
78
	 *
79
	 */
80
	private Map<String, IORMConfiguration> ormConfigurations;
81
82
	/**
83
	 *
84
	 */
85
	private IManagedTypeProvider persistenceUnit;
86
87
	/**
88
	 * The VM argument used to locate the source folder defined in the JPQL Query Unit-Tests.
89
	 */
90
	private static final String RESOURCE_LOCATION = "test.query.jpql.resource.source";
91
92
	private void addClasspathEntry(IJavaProject javaProject, IClasspathEntry entry) throws JavaModelException {
93
		javaProject.setRawClasspath(ArrayTools.add(javaProject.getRawClasspath(), entry), null);
94
	}
95
96
	private void addJar(IJavaProject javaProject, String jarPath) throws JavaModelException {
97
		this.addClasspathEntry(javaProject, JavaCore.newLibraryEntry(new Path(jarPath), null, null));
98
	}
99
100
	/**
101
	 * {@inheritDoc}
102
	 */
103
//	@Override
104
	public JPQLQueryHelper<?> buildJPQLQueryHelper(IQuery query) {
105
		return new JpaJpqlQueryHelper(query);
106
	}
107
108
	/**
109
	 * {@inheritDoc}
110
	 */
111
//	@Override
112
	public IQuery buildNamedQuery(String query) throws Exception {
113
		return new VirtualQuery(getPersistenceUnit(), query);
114
	}
115
116
	private IORMConfiguration buildORMConfiguration(String ormXmlFileName) {
117
		return new JpaORMConfiguration(jpaProject, getMappingFile(ormXmlFileName));
118
	}
119
120
	private PersistenceUnit getJpaPersistenceUnit() {
121
		return getRootContextNode().getPersistenceXml().getPersistence().persistenceUnits().next();
122
	}
123
124
	private MappingFile getMappingFile(String ormXmlFileName) {
125
		for (Iterator<MappingFileRef> iter = getJpaPersistenceUnit().mappingFileRefs(); iter.hasNext(); ) {
126
			MappingFileRef mappingFileRef = iter.next();
127
			if (mappingFileRef.getFileName().equals("META-INF/" + ormXmlFileName)) {
128
				mappingFileRef.update();
129
				return mappingFileRef.getMappingFile();
130
			}
131
		}
132
		return null;
133
	}
134
135
	/**
136
	 * {@inheritDoc}
137
	 */
138
	public IORMConfiguration getORMConfiguration(String ormXmlFileName) throws Exception {
139
140
		if (ormConfigurations == null) {
141
			ormConfigurations = new HashMap<String, IORMConfiguration>();
142
		}
143
144
		IORMConfiguration ormConfiguration = ormConfigurations.get(ormXmlFileName);
145
146
		if (ormConfiguration == null) {
147
			ormConfiguration = buildORMConfiguration(ormXmlFileName);
148
			ormConfigurations.put(ormXmlFileName, ormConfiguration);
149
		}
150
151
		return ormConfiguration;
152
	}
153
154
	/**
155
	 * {@inheritDoc}
156
	 */
157
	public IManagedTypeProvider getPersistenceUnit() throws Exception {
158
		if (persistenceUnit == null) {
159
			persistenceUnit = new JpaPersistenceUnit(jpaProject, getJpaPersistenceUnit());
160
		}
161
		return persistenceUnit;
162
	}
163
164
	private JpaRootContextNode getRootContextNode() {
165
		return jpaProject.getRootContextNode();
166
	}
167
168
	/**
169
	 * {@inheritDoc}
170
	 */
171
	public void setUp() throws Exception {
172
	}
173
174
	/**
175
	 * {@inheritDoc}
176
	 */
177
	public void setUpBefore() throws Exception {
178
		if (!initialized) {
179
			initialized = true;
180
			setUpProject();
181
		}
182
	}
183
184
	private void setUpProject() throws Exception {
185
186
		// Create the projects
187
		TestFacetedProject facetedProject = TestFacetedProject.buildFacetedProject("JPQL Query Tests", false);
188
		facetedProject.getFacetedProject().installProjectFacet(JavaFacet.VERSION_1_6, null, new NullProgressMonitor());
189
		facetedProject.installFacet("jst.utility", "1.0");
190
191
		IProject project = facetedProject.getProject();
192
		IJavaProject javaProject = JavaCore.create(project);
193
		IWorkspaceRoot workspaceRoot = project.getWorkspace().getRoot();
194
195
		// Create the location so the Eclipse project can see the unit-tests files
196
		IPath sourcePath = project.getFullPath().append("src");
197
		IFolder sourceFolder = workspaceRoot.getFolder(sourcePath);
198
		sourceFolder.delete(true, new NullProgressMonitor());
199
200
		// Create the symbolic link to the actual location
201
		IPath unitTestSourcePath = new Path(System.getProperty(RESOURCE_LOCATION));
202
		sourceFolder.createLink(unitTestSourcePath, IResource.ALLOW_MISSING_LOCAL, new NullProgressMonitor());
203
204
		addJar(javaProject, TestJpaProject.jpaJarName());
205
		addJar(javaProject, TestJpaProject.eclipseLinkJarName());
206
207
		// Now create the JPA project
208
		facetedProject.getFacetedProject().installProjectFacet(JpaFacet.VERSION_2_0, null, new NullProgressMonitor());
209
		jpaProject = JptJpaCorePlugin.getJpaProject(project);
210
		jpaProject.setDiscoversAnnotatedClasses(true);
211
	}
212
213
	/**
214
	 * {@inheritDoc}
215
	 */
216
	public void tearDown() throws Exception {
217
	}
218
219
	/**
220
	 * {@inheritDoc}
221
	 */
222
	public void tearDownAfter() throws Exception {
223
		initialized = false;
224
		ormConfigurations = null;
225
		persistenceUnit = null;
226
		jpaProject.getProject().delete(true, new NullProgressMonitor());
227
		jpaProject = null;
228
	}
229
230
	private class JpaORMConfiguration extends JpaMappingFile
231
	                                  implements IORMConfiguration {
232
233
		/**
234
		 * The cached used to quickly retrieve any queries that have been cached.
235
		 */
236
		private Map<String, IQuery> queries;
237
238
		JpaORMConfiguration(JpaProject jpaProject, MappingFile mappingFile) {
239
			super(jpaProject, mappingFile);
240
		}
241
242
		private IQuery buildQuery(NamedQuery namedQuery) {
243
			return new JpaQuery(this, namedQuery);
244
		}
245
246
		private EntityMappings getEntityMappings() {
247
			return (EntityMappings) getPersistentTypeContainer().getRoot();
248
		}
249
250
		/**
251
		 * {@inheritDoc}
252
		 */
253
		public IQuery getNamedQuery(String queryName) {
254
			initializeQueries();
255
			return queries.get(queryName);
256
		}
257
258
		private void initializeQueries() {
259
260
			if (queries == null) {
261
				queries = new HashMap<String, IQuery>();
262
263
				for (ListIterator<OrmNamedQuery> iter = namedQueries(); iter.hasNext(); ) {
264
					OrmNamedQuery namedQuery = iter.next();
265
					queries.put(namedQuery.getName(), buildQuery(namedQuery));
266
				}
267
			}
268
		}
269
270
		private ListIterator<OrmNamedQuery> namedQueries() {
271
			return getEntityMappings().getQueryContainer().namedQueries();
272
		}
273
274
		/**
275
		 * {@inheritDoc}
276
		 */
277
		@Override
278
		protected Iterator<? extends PersistentType> persistenceTypes() {
279
			return getPersistentTypeContainer().getPersistentTypes().iterator();
280
		}
281
	}
282
}
(-)META-INF/MANIFEST.MF (+2 lines)
Lines 32-37 Link Here
32
 org.eclipse.jst.common.project.facet.ui;bundle-version="[1.3.100,2.0.0)",
32
 org.eclipse.jst.common.project.facet.ui;bundle-version="[1.3.100,2.0.0)",
33
 org.eclipse.jst.j2ee;bundle-version="[1.1.200,2.0.0)",
33
 org.eclipse.jst.j2ee;bundle-version="[1.1.200,2.0.0)",
34
 org.eclipse.jst.j2ee.ui;bundle-version="[1.1.200,2.0.0)",
34
 org.eclipse.jst.j2ee.ui;bundle-version="[1.1.200,2.0.0)",
35
 org.eclipse.persistence.jpa.jpql;bundle-version="1.0.0",
35
 org.eclipse.ui.ide;bundle-version="[3.4.0,4.0.0)",
36
 org.eclipse.ui.ide;bundle-version="[3.4.0,4.0.0)",
36
 org.eclipse.ui.views.properties.tabbed;bundle-version="[3.4.0,4.0.0)",
37
 org.eclipse.ui.views.properties.tabbed;bundle-version="[3.4.0,4.0.0)",
37
 org.eclipse.ui.navigator;bundle-version="[3.3.100,4.0.0)",
38
 org.eclipse.ui.navigator;bundle-version="[3.3.100,4.0.0)",
Lines 64-69 Link Here
64
 org.eclipse.jpt.jpa.ui.internal.jpa2.persistence.connection;x-internal:=true,
65
 org.eclipse.jpt.jpa.ui.internal.jpa2.persistence.connection;x-internal:=true,
65
 org.eclipse.jpt.jpa.ui.internal.jpa2.persistence.options;x-internal:=true,
66
 org.eclipse.jpt.jpa.ui.internal.jpa2.persistence.options;x-internal:=true,
66
 org.eclipse.jpt.jpa.ui.internal.jpa2.platform.generic;x-internal:=true,
67
 org.eclipse.jpt.jpa.ui.internal.jpa2.platform.generic;x-internal:=true,
68
 org.eclipse.jpt.jpa.ui.internal.jpql;x-internal:=true,
67
 org.eclipse.jpt.jpa.ui.internal.listeners;x-internal:=true,
69
 org.eclipse.jpt.jpa.ui.internal.listeners;x-internal:=true,
68
 org.eclipse.jpt.jpa.ui.internal.menus;x-internal:=true,
70
 org.eclipse.jpt.jpa.ui.internal.menus;x-internal:=true,
69
 org.eclipse.jpt.jpa.ui.internal.navigator;x-internal:=true,
71
 org.eclipse.jpt.jpa.ui.internal.navigator;x-internal:=true,
(-)plugin.xml (-7 / +34 lines)
Lines 1-7 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.2"?>
2
<?eclipse version="3.2"?>
3
<!--
3
<!--
4
  Copyright (c) 2007, 2010 Oracle. All rights reserved.
4
  Copyright (c) 2007, 2011 Oracle. All rights reserved.
5
  This program and the accompanying materials are made available under the
5
  This program and the accompanying materials are made available under the
6
  terms of the Eclipse Public License v1.0, which accompanies this distribution
6
  terms of the Eclipse Public License v1.0, which accompanies this distribution
7
  and is available at http://www.eclipse.org/legal/epl-v10.html.
7
  and is available at http://www.eclipse.org/legal/epl-v10.html.
Lines 69-78 Link Here
69
			<partition type="__dftl_partition_content_type"/>
69
			<partition type="__dftl_partition_content_type"/>
70
			<partition type="__java_string"/>
70
			<partition type="__java_string"/>
71
		</javaCompletionProposalComputer>
71
		</javaCompletionProposalComputer>
72
		
72
73
	</extension>
73
	</extension>
74
	
74
75
	
76
	<extension
75
	<extension
77
		point="org.eclipse.jdt.ui.javaCompletionProposalComputer"
76
		point="org.eclipse.jdt.ui.javaCompletionProposalComputer"
78
		id="jpaProposalCategory"
77
		id="jpaProposalCategory"
Lines 80-87 Link Here
80
		<proposalCategory
79
		<proposalCategory
81
			icon="$nl$/icons/full/eview16/jpa_perspective.gif"/>
80
			icon="$nl$/icons/full/eview16/jpa_perspective.gif"/>
82
	</extension>
81
	</extension>
83
	
82
84
	
83
	<extension
84
		point="org.eclipse.jdt.ui.javaCompletionProposalComputer"
85
		id="JpaJpqlCompletionProposalComputer">
86
87
		<javaCompletionProposalComputer
88
        activate="true"
89
        categoryId="org.eclipse.jpt.jpa.ui.jpaProposalCategory"
90
        class="org.eclipse.jpt.jpa.ui.internal.jpql.JpaJpqlJavaCompletionProposalComputer">
91
			<partition type="__dftl_partition_content_type"/>
92
			<partition type="__java_string"/>
93
		</javaCompletionProposalComputer>
94
		
95
	</extension>
96
97
	 <extension
98
	       id="JpaJpqlSseCompletionProposal"
99
	       point="org.eclipse.wst.sse.ui.completionProposal">
100
	    <proposalComputer
101
	          activate="true"
102
	          categoryId="org.eclipse.wst.xml.ui.proposalCategory.xmlTags"
103
	          class="org.eclipse.jpt.jpa.ui.internal.jpql.JpaJpqlSseCompletionProposalComputer"
104
	          id="org.eclipse.jpt.jpa.ui.internal.jpql.JpaJpqlSseCompletionProposalComputer">
105
	       <contentType
106
	             id="org.eclipse.jpt.jpa.core.content.orm">
107
	       </contentType>
108
	    </proposalComputer>
109
	 </extension>	
110
111
85
	<extension
112
	<extension
86
		point="org.eclipse.jpt.jpa.ui.jpaPlatformUis">
113
		point="org.eclipse.jpt.jpa.ui.jpaPlatformUis">
87
		
114
		
Lines 94-100 Link Here
94
			id="generic2_0.ui"
121
			id="generic2_0.ui"
95
			jpaPlatform="generic2_0"
122
			jpaPlatform="generic2_0"
96
			factoryClass="org.eclipse.jpt.jpa.ui.internal.jpa2.platform.generic.Generic2_0JpaPlatformUiFactory"/>
123
			factoryClass="org.eclipse.jpt.jpa.ui.internal.jpa2.platform.generic.Generic2_0JpaPlatformUiFactory"/>
97
		
124
	
98
	</extension>
125
	</extension>
99
  	
126
  	
100
	
127
	
(-)property_files/jpt_ui.properties (+4 lines)
Lines 126-131 Link Here
126
JpaProblemSeveritiesPage_Info=Info
126
JpaProblemSeveritiesPage_Info=Info
127
JpaProblemSeveritiesPage_Warning=Warning
127
JpaProblemSeveritiesPage_Warning=Warning
128
128
129
JpqlContentProposalProvider_Description=Content Assist Available ({0})
130
JpaJpqlJavaCompletionProposalComputer_Error=Can't retrieve JPQL proposals due to an internal error.
131
JpaJpqlSseCompletionProposalComputer_Error=Can't retrieve JPQL proposals due to an internal error.
132
129
MappingFileWizard_title=New Mapping File
133
MappingFileWizard_title=New Mapping File
130
MappingFileWizardPage_newFile_title=Mapping file
134
MappingFileWizardPage_newFile_title=Mapping file
131
MappingFileWizardPage_newFile_desc=Specify mapping file name and location
135
MappingFileWizardPage_newFile_desc=Specify mapping file name and location
(-)property_files/jpt_ui_jpql_identifiers.properties (+83 lines)
Added Link Here
1
################################################################################
2
# Copyright (c) 2011 Oracle. All rights reserved.
3
# This program and the accompanying materials are made available under the
4
# terms of the Eclipse Public License v1.0, which accompanies this distribution
5
# and is available at http://www.eclipse.org/legal/epl-v10.html.
6
# 
7
# Contributors:
8
#     Oracle - initial API and implementation
9
################################################################################
10
11
# JPA 1.0 identifiers
12
ABS=The <b>ABS</b> function removes the minus sign from a specified numeric argument and returns the absolute value (integer, float, or double) of the same type as the argument to the function, which is always a positive number or zero.
13
ALL=<ul><li>An <b>ALL</b> conditional expression is a predicate that is <code>true</code> if the comparison operation is <code>true</code> for all values in the result of the subquery or the result of the subquery is empty.</li><li>An <b>ALL</b> conditional expression is <code>false</code> if the result of the comparison is <code>false</code> for at least one row, and is unknown if neither <code>true</code> nor <code>false</code>.</ul><p><p>The comparison operators used with <b>ALL</b> conditional expressions are =, <, <=, >, >=, <>.<p><p>The result of the subquery must be like that of the other argument to the comparison operator in type.
14
#AND
15
ANY=<ul><li>An <b>ANY</b> conditional expression is a predicate that is <code>true</code> if the comparison operation is <code>true</code> for some value in the result of the subquery.</li><li>An <b>ANY</b> conditional expression is <code>false</code> if the result of the subquery is empty or if the comparison operation is <code>false</code> for every value in the result of the subquery,</li><li>and is unknown if neither <code>true</code> nor <code>false</code>.</li></ul><p><p>The comparison operators used with <b>ANY</b> conditional expressions are =, <, <=, >, >=, <>.<p><p>The result of the subquery must be like that of the other argument to the comparison operator in type.
16
ASC=The keyword <b>ASC</b> specifies that ascending ordering be used for the associated order by item.
17
AVG=One of the aggregate functions. The arguments must be numeric. <b>AVG</b> returns <code>Double</code>.<p><p><b>BNF:</b> <code>expression ::= AVG([DISTINCT] state_field_path_expression)</code>
18
BETWEEN=Used in conditional expression to determine whether the result of an expression falls within an inclusive range of values. Numeric, string and date expression can be evaluated in this way.
19
BOTH=Trim from both ends.
20
CONCAT=The <b>CONCAT</b> function returns a string that is a concatenation of its arguments.
21
COUNT=One of the aggregate functions. The return type of this function is a <code>Long</code>.
22
CURRENT_DATE=This function returns the value of current date on the database server.
23
CURRENT_TIME=This function returns the value of current time on the database server.
24
CURRENT_TIMESTAMP=This function returns the value of current timestamp on the database
25
DELETE_FROM=A delete statement provide bulk operations over sets of entities.
26
DESC=The keyword <b>DESC</b> specifies that descending ordering be used. Ascending ordering is the default.
27
DISTINCT=The <b>DISTINCT</b> keyword is used to specify that duplicate values must be eliminated from the query result. If <b>DISTINCT</b> is not specified, duplicate values are not eliminated.
28
ESCAPE=The optional <code>escape character</code> is a single-character string literal or a character-valued input parameter (i.e., char or Character) and is used to escape the special meaning of the underscore and percent characters in <code>pattern value</code>.
29
EXISTS=An <b>EXISTS</b> expression is a predicate that is <code>true</code> only if the result of the subquery consists of one or more values and that is <code>false</code> otherwise.
30
FROM=The <b>FROM</b> clause of a query defines the domain of the query by declaring identification variables. An identification variable is an identifier declared in the <b>FROM</b> clause of a query. The domain of the query may be constrained by path expressions. Identification variables designate instances of a particular entity abstract schema type. The <b>FROM</b> clause can contain multiple identification variable declarations separated by a comma (,).
31
GROUP_BY=The <b>GROUP BY</b> construct enables the aggregation of values according to the properties of an entity class.
32
HAVING=The <b>HAVING</b> construct enables conditions to be specified that further restrict the query result as restrictions upon the groups.
33
IN=An identification variable declared by a collection member declaration ranges over values of a collection obtained by navigation using a path expression. Such a path expression represents a navigation involving the association-fields of an entity abstract schema type. Because a path expression can be based on another path expression, the navigation can use the association-fields of related entities. An identification variable of a collection member declaration is declared using a special operator, the reserved identifier <b>IN</b>. The argument to the <b>IN</b> operator is a collection-valued path expression. The path expression evaluates to a collection type specified as a result of navigation to a collection-valued association-field of an entity abstract schema type.
34
IS_EMPTY=An <b>EMPTY</b> expression tests whether or not the collection designated by the collection-valued path expression is empty (i.e, has no elements).
35
IS_NULL=A null comparison tests whether or not the single-valued path expression or input parameter is a <b>NULL</b> value.
36
JOIN=A <b>JOIN</b> enables the fetching of an association as a side effect of the execution of a query. A <b>JOIN</b> is specified over an entity and its related entities.
37
JOIN_FETCH=A <b>JOIN FETCH</b> enables the fetching of an association as a side effect of the execution of a query. A <b>JOIN FETCH</b> is specified over an entity and its related entities.
38
LEADING=Trim from leading end.
39
LENGTH=The <b>LENGTH</b> function returns the length of the string in characters as an integer.
40
LIKE=The <b>LIKE</b> condition is used to specify a search for a pattern.<p><p>The <code>string_expression</code> must have a string value. The <code>pattern_value</code> is a string literal or a string-valued input parameter in which an underscore (_) stands for any single character, a percent (%) character stands for any sequence of characters (including the empty sequence), and all other characters stand for themselves. The optional <code>escape_character</code> is a single-character string literal or a character-valued input parameter (i.e., char or Character) and is used to escape the special meaning of the underscore and percent characters in <code>pattern_value</code>.
41
LOCATE=The <b>LOCATE</b> function returns the position of a given string within a string, starting the search at a specified position. It returns the first position at which the string was found as an integer. The first argument is the string to be located; the second argument is the string to be searched; the optional third argument is an integer that represents the string position at which the search is started (by default, the beginning of the string to be searched). The first position in a string is denoted by 1. If the string is not found, 0 is returned. The <b>LENGTH</b> function returns the length of the string in characters as an integer.
42
LOWER=The <b>LOWER</b> function converts a string to lower case and it returns a string.
43
MAX=One of the aggregate functions. The arguments must correspond to orderable state-field types (i.e., numeric types, string types, character types, or date types). The return type of this function is based on the state-field's type.
44
MEMBER=This expression tests whether the designated value is a member of the collection specified by the collection-valued path expression. If the collection-valued path expression designates an empty collection, the value of the <b>MEMBER OF</b> expression is <b>FALSE</b> and the value of the <b>NOT MEMBER OF</b> expression is <b>TRUE</b>. Otherwise, if the value of the collection-valued path expression or single-valued association-field path expression in the collection member expression is <b>NULL</b> or unknown, the value of the collection member expression is unknown.
45
MIN= One of the aggregate functions. The arguments must correspond to orderable state-field types (i.e., numeric types, string types, character types, or date types). The return type of this function is based on the state-field's type.
46
MOD=The modulo operation finds the remainder of division of one number by another. It takes two integer arguments and returns an integer.
47
NEW=In the <b>SELECT</b> clause a constructor may be used in the <b>SELECT</b> list to return one or more Java instances. The specified class is not required to be an entity or to be mapped to the database. The constructor name must be fully qualified.
48
OBJECT=Stand-alone identification variables in the <b>SELECT</b> clause may optionally be qualified by the <b>OBJECT</b> operator. The <b>SELECT</b> clause must not use the <b>OBJECT</b> operator to qualify path expressions.
49
#OR
50
ORDER_BY=The <b>ORDER BY</b> clause allows the objects or values that are returned by the query to be ordered.
51
SELECT=The <b>SELECT</b> clause determines the type of the objects or values to be selected.
52
SIZE=The <b>SIZE</b> function returns an integer value, the number of elements of the collection. If the collection is empty, the <b>SIZE</b> function evaluates to zero.
53
SOME=<ul><li>An <b>SOME</b> conditional expression is a predicate that is <code>true</code> if the comparison operation is <code>true</code> for some value in the result of the subquery.</li><li>A <b>SOME</b> conditional expression is <code>false</code> if the result of the subquery is empty or if the comparison operation is <code>false</code> for every value in the result of the subquery,</li><li>and is unknown if neither <code>true</code> nor <code>false</code>.</li></ul><p><p>The comparison operators used with <b>SOME</b> conditional expressions are =, <, <=, >, >=, <>.<p><p>The result of the subquery must be like that of the other argument to the comparison operator in type.
54
SQRT=The <b>SQRT</b> function takes a numeric argument and returns a double.
55
SUBSTRING=The second and third arguments of the <b>SUBSTRING</b> function denote the starting position and length of the substring to be returned. These arguments are integers. The first position of a string is denoted by 1. The <b>SUBSTRING</b> function returns a string.
56
SUM= One of the aggregate functions. The arguments must be numeric. The <b>SUM</b> function returns <code>Long</code> when applied to state-fields of integral types (other than <code>BigInteger</code>); <code>Double</code> when applied to state-fields of floating point types; <code>BigInteger</code> when applied to state-fields of type <code>BigInteger</code>; and <code>BigDecimal</code> when applied to state-fields of type <code>BigDecimal</code>. If <b>SUM</b>, <b>AVG</b>, <b>MAX</b>, or <b>MIN</b> is used, and there are no values to which the aggregate function can be applied, the result of the aggregate function is <code>NULL</code>. If <code>COUNT</code> is used, and there are no values to which <b>COUNT</b> can be applied, the result of the aggregate function is 0.
57
TRAILING=Trim from trailing end.
58
TRIM=The <b>TRIM</b> function trims the specified character from a string. If the character to be trimmed is not specified, it is assumed to be space (or blank). The optional <code>trim_character</code> is a single-character string literal or a character-valued input parameter (i.e., char or Character). If a trim specification is not provided, <b>BOTH</b> is assumed. The <b>TRIM</b> function returns the trimmed string.
59
UPDATE=An update statement provide bulk operations over sets of entities.
60
UPPER=The <b>UPPER</b> function converts a string to upper case and it returns a string.
61
WHERE=The <b>WHERE</b> clause of a query consists of a conditional expression used to select objects or values that satisfy the expression. The <b>WHERE</b> clause restricts the result of a select statement or the scope of an update or delete operation.
62
63
# JPA 2.0 identifiers
64
#CASE=
65
COALESCE=A <b>COALESCE</b> expression returns <code>null</code> if all its arguments evaluate to <code>null</code>, and the value of the first non-<code>null</code> argument otherwise.<p><p>The return type is the type returned by the arguments if they are all of the same type, otherwise it is undetermined.
66
#ENTRY=
67
INDEX=The <b>INDEX</b> function returns an integer value corresponding to the position of its argument in an ordered list. The <b>INDEX</b> function can only be applied to identification variables denoting types for which an order column has been specified.
68
#KEY=
69
NULLIF=<b>NULLIF</b> returns the first expression if the two expressions are not equal. If the expressions are equal, <b>NULLIF</b> returns a null value of the type of the first expression.<p><p><b>NULLIF</b> is equivalent to a searched <b>CASE</b> expression in which the two expressions are equal and the resulting expression is <b>NULL</b>.<p><p>Returns the same type as the first expression.
70
TYPE=An entity type expression can be used to restrict query polymorphism. The <b>TYPE</b> operator returns the exact type of the argument.
71
#VALUE=
72
73
# EclipseLink identifiers
74
#FUNC=
75
#TREAT=
76
77
# Reserved JPQL identifiers
78
BIT_LENGTH=The identifier <b>BIT_LENGTH</b> is not currently used: it is reserved for future use.
79
CHAR_LENGTH=The identifier <b>CHAR_LENGTH</b> is not currently used: it is reserved for future use.
80
CHARACTER_LENGTH=The identifier <b>CHARACTER_LENGTH</b> is not currently used: it is reserved for future use.
81
CLASS=The identifier <b>CLASS</b> is not currently used: it is reserved for future use.
82
POSITION=The identifier <b>POSITION</b> is not currently used: it is reserved for future use.
83
UNKNOWN=The identifier <b>UNKNOWN</b> is not currently used: it is reserved for future use.
(-)property_files/jpt_ui_validation_preferences.properties (+1 lines)
Lines 209-211 Link Here
209
ID_MAPPING_UNRESOLVED_GENERATOR_NAME=Unresolved generator name:
209
ID_MAPPING_UNRESOLVED_GENERATOR_NAME=Unresolved generator name:
210
GENERATED_VALUE_UNRESOLVED_GENERATOR=Generator is not defined in the persistence unit:
210
GENERATED_VALUE_UNRESOLVED_GENERATOR=Generator is not defined in the persistence unit:
211
QUERY_DUPLICATE_NAME=Duplicate query defined:
211
QUERY_DUPLICATE_NAME=Duplicate query defined:
212
JPQL_QUERY_VALIDATION=Invalid or incomplete JPQL queries:
(-)src/org/eclipse/jpt/jpa/ui/internal/JptUiIcons.java (-1 / +10 lines)
Lines 124-127 Link Here
124
	public static final String TRANSIENT = "full/obj16/transient";
124
	public static final String TRANSIENT = "full/obj16/transient";
125
	
125
	
126
	public static final String NULL_ATTRIBUTE_MAPPING = "full/obj16/null-attribute-mapping";
126
	public static final String NULL_ATTRIBUTE_MAPPING = "full/obj16/null-attribute-mapping";
127
}
127
128
129
	// **************** Content Assist icons **********************************
130
131
	public static final String JPQL_FUNCTION = "full/obj16/jpql.function";
132
133
	public static final String JPQL_IDENTIFIER = "full/obj16/jpql.identifier";
134
135
	public static final String JPQL_VARIABLE = "full/obj16/jpql.variable";
136
}
(-)src/org/eclipse/jpt/jpa/ui/internal/JptUiMessages.java (-1 / +4 lines)
Lines 92-97 Link Here
92
	public static String JpaFacetWizardPage_title;
92
	public static String JpaFacetWizardPage_title;
93
	public static String JpaFacetWizardPage_userLibsLink;
93
	public static String JpaFacetWizardPage_userLibsLink;
94
	public static String JpaFacetWizardPage_userServerLibLabel;
94
	public static String JpaFacetWizardPage_userServerLibLabel;
95
	public static String JpaJpqlJavaCompletionProposalComputer_Error;
96
	public static String JpaJpqlSseCompletionProposalComputer_Error;
95
	public static String JpaLibraryProviderInstallPanel_includeLibraries;
97
	public static String JpaLibraryProviderInstallPanel_includeLibraries;
96
	public static String JpaMakePersistentWizardPage_title;
98
	public static String JpaMakePersistentWizardPage_title;
97
	public static String JpaMakePersistentWizardPage_message;
99
	public static String JpaMakePersistentWizardPage_message;
Lines 110-115 Link Here
110
	public static String JpaStructureView_linkWithEditorTooltip;
112
	public static String JpaStructureView_linkWithEditorTooltip;
111
	public static String JpaStructureView_structureNotAvailable;
113
	public static String JpaStructureView_structureNotAvailable;
112
	public static String JpaStructureView_numItemsSelected;
114
	public static String JpaStructureView_numItemsSelected;
115
	public static String JpqlContentProposalProvider_Description;
113
	public static String MappingFileWizard_title;
116
	public static String MappingFileWizard_title;
114
	public static String MappingFileWizardPage_newFile_title;
117
	public static String MappingFileWizardPage_newFile_title;
115
	public static String MappingFileWizardPage_newFile_desc;
118
	public static String MappingFileWizardPage_newFile_desc;
Lines 140-146 Link Here
140
	public static String JpaProblemSeveritiesPage_Warning;
143
	public static String JpaProblemSeveritiesPage_Warning;
141
	public static String SelectJpaOrmMappingFileDialog_newButton;
144
	public static String SelectJpaOrmMappingFileDialog_newButton;
142
145
143
	
146
144
	private static final String BUNDLE_NAME = "jpt_ui"; //$NON-NLS-1$
147
	private static final String BUNDLE_NAME = "jpt_ui"; //$NON-NLS-1$
145
	private static final Class<?> BUNDLE_CLASS = JptUiMessages.class;
148
	private static final Class<?> BUNDLE_CLASS = JptUiMessages.class;
146
	static {
149
	static {
(-)src/org/eclipse/jpt/jpa/ui/internal/JptUiValidationPreferenceMessages.java (-12 / +11 lines)
Lines 1-9 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2009, 2010 Oracle. All rights reserved.
2
 * Copyright (c) 2009, 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
6
 * 
6
 *
7
 * Contributors:
7
 * Contributors:
8
 *     Oracle - initial API and implementation
8
 *     Oracle - initial API and implementation
9
 ******************************************************************************/
9
 ******************************************************************************/
Lines 19-27 Link Here
19
	public static String PROJECT_INVALID_CONNECTION;
19
	public static String PROJECT_INVALID_CONNECTION;
20
	public static String PROJECT_INACTIVE_CONNECTION;
20
	public static String PROJECT_INACTIVE_CONNECTION;
21
	public static String PROJECT_NO_PERSISTENCE_XML;
21
	public static String PROJECT_NO_PERSISTENCE_XML;
22
	
22
23
	public static String XML_VERSION_NOT_LATEST;
23
	public static String XML_VERSION_NOT_LATEST;
24
	
24
25
	public static String PROJECT_MULTIPLE_PERSISTENCE_XML;
25
	public static String PROJECT_MULTIPLE_PERSISTENCE_XML;
26
	public static String PERSISTENCE_NO_PERSISTENCE_UNIT;
26
	public static String PERSISTENCE_NO_PERSISTENCE_UNIT;
27
	public static String PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS;
27
	public static String PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS;
Lines 82-94 Link Here
82
	public static String ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED;
82
	public static String ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED;
83
	public static String ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE;
83
	public static String ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE;
84
	public static String ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED;
84
	public static String ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED;
85
	
85
86
	public static String DATABASE_CATEGORY;
86
	public static String DATABASE_CATEGORY;
87
	public static String TABLE_CATEGORY;
87
	public static String TABLE_CATEGORY;
88
	public static String COLUMN_CATEGORY;
88
	public static String COLUMN_CATEGORY;
89
	public static String OVERRIDES_CATEGORY;
89
	public static String OVERRIDES_CATEGORY;
90
	public static String IMPLIED_ATTRIBUTE_LEVEL_CATEGORY;
90
	public static String IMPLIED_ATTRIBUTE_LEVEL_CATEGORY;
91
	
91
92
	public static String TABLE_UNRESOLVED_CATALOG;
92
	public static String TABLE_UNRESOLVED_CATALOG;
93
	public static String TABLE_UNRESOLVED_SCHEMA;
93
	public static String TABLE_UNRESOLVED_SCHEMA;
94
	public static String TABLE_UNRESOLVED_NAME;
94
	public static String TABLE_UNRESOLVED_NAME;
Lines 125-136 Link Here
125
	public static String VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
125
	public static String VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
126
	public static String MAP_KEY_COLUMN_TABLE_NOT_VALID;
126
	public static String MAP_KEY_COLUMN_TABLE_NOT_VALID;
127
	public static String VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
127
	public static String VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
128
	
128
129
	public static String COLLECTION_TABLE_UNRESOLVED_CATALOG;
129
	public static String COLLECTION_TABLE_UNRESOLVED_CATALOG;
130
	public static String COLLECTION_TABLE_UNRESOLVED_SCHEMA;
130
	public static String COLLECTION_TABLE_UNRESOLVED_SCHEMA;
131
	public static String COLLECTION_TABLE_UNRESOLVED_NAME;
131
	public static String COLLECTION_TABLE_UNRESOLVED_NAME;
132
	public static String ORDER_COLUMN_UNRESOLVED_NAME;
132
	public static String ORDER_COLUMN_UNRESOLVED_NAME;
133
	
133
134
	public static String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG;
134
	public static String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG;
135
	public static String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA;
135
	public static String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA;
136
	public static String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME;
136
	public static String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME;
Lines 170-176 Link Here
170
	public static String VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
170
	public static String VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
171
	public static String VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID;
171
	public static String VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID;
172
	public static String VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
172
	public static String VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
173
	
173
174
	public static String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_CATALOG;
174
	public static String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_CATALOG;
175
	public static String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA;
175
	public static String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA;
176
	public static String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_NAME;
176
	public static String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_NAME;
Lines 205-210 Link Here
205
	public static String ID_MAPPING_UNRESOLVED_GENERATOR_NAME;
205
	public static String ID_MAPPING_UNRESOLVED_GENERATOR_NAME;
206
	public static String GENERATED_VALUE_UNRESOLVED_GENERATOR;
206
	public static String GENERATED_VALUE_UNRESOLVED_GENERATOR;
207
	public static String QUERY_DUPLICATE_NAME;
207
	public static String QUERY_DUPLICATE_NAME;
208
	public static String JPQL_QUERY_VALIDATION;
208
209
209
	private static final String BUNDLE_NAME = "jpt_ui_validation_preferences"; //$NON-NLS-1$
210
	private static final String BUNDLE_NAME = "jpt_ui_validation_preferences"; //$NON-NLS-1$
210
	private static final Class<?> BUNDLE_CLASS = JptUiValidationPreferenceMessages.class;
211
	private static final Class<?> BUNDLE_CLASS = JptUiValidationPreferenceMessages.class;
Lines 215-220 Link Here
215
	private JptUiValidationPreferenceMessages() {
216
	private JptUiValidationPreferenceMessages() {
216
		throw new UnsupportedOperationException();
217
		throw new UnsupportedOperationException();
217
	}
218
	}
218
219
}
219
220
}
(-)src/org/eclipse/jpt/jpa/ui/internal/details/NamedQueryPropertyComposite.java (-28 / +35 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 Oracle. All rights reserved.
2
 * Copyright (c) 2008, 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
4
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
Lines 15-24 Link Here
15
import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel;
15
import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel;
16
import org.eclipse.jpt.jpa.core.context.NamedQuery;
16
import org.eclipse.jpt.jpa.core.context.NamedQuery;
17
import org.eclipse.jpt.jpa.core.context.Query;
17
import org.eclipse.jpt.jpa.core.context.Query;
18
import org.eclipse.jpt.jpa.ui.internal.jpql.JpaJpqlContentProposalProvider;
19
import org.eclipse.swt.custom.StyledText;
18
import org.eclipse.swt.widgets.Composite;
20
import org.eclipse.swt.widgets.Composite;
19
21
20
/**
22
/**
21
 * Here the layout of this pane:
23
 * Here's the layout of this pane:
22
 * <pre>
24
 * <pre>
23
 * -----------------------------------------------------------------------------
25
 * -----------------------------------------------------------------------------
24
 * |        ------------------------------------------------------------------ |
26
 * |        ------------------------------------------------------------------ |
Lines 40-50 Link Here
40
 * @see NamedQueriesComposite - The parent container
42
 * @see NamedQueriesComposite - The parent container
41
 * @see QueryHintsComposite
43
 * @see QueryHintsComposite
42
 *
44
 *
43
 * @version 2.0
45
 * @version 2.3
44
 * @since 2.0
46
 * @since 2.3
45
 */
47
 */
46
public class NamedQueryPropertyComposite<T extends NamedQuery> extends Pane<T>
48
public class NamedQueryPropertyComposite<T extends NamedQuery> extends Pane<T> {
47
{
49
48
	/**
50
	/**
49
	 * Creates a new <code>NamedQueryPropertyComposite</code>.
51
	 * Creates a new <code>NamedQueryPropertyComposite</code>.
50
	 *
52
	 *
Lines 59-64 Link Here
59
		super(parentPane, subjectHolder, parent);
61
		super(parentPane, subjectHolder, parent);
60
	}
62
	}
61
63
64
	protected WritablePropertyValueModel<String> buildNameTextHolder() {
65
		return new PropertyAspectAdapter<NamedQuery, String>(
66
				getSubjectHolder(), Query.NAME_PROPERTY) {
67
			@Override
68
			protected String buildValue_() {
69
				return this.subject.getName();
70
			}
71
72
			@Override
73
			protected void setValue_(String value) {
74
				if (value.length() == 0) {
75
					value = null;
76
				}
77
				this.subject.setName(value);
78
			}
79
		};
80
	}
81
62
	protected WritablePropertyValueModel<String> buildQueryHolder() {
82
	protected WritablePropertyValueModel<String> buildQueryHolder() {
63
		return new PropertyAspectAdapter<NamedQuery, String>(getSubjectHolder(), Query.QUERY_PROPERTY) {
83
		return new PropertyAspectAdapter<NamedQuery, String>(getSubjectHolder(), Query.QUERY_PROPERTY) {
64
			@Override
84
			@Override
Lines 73-88 Link Here
73
		};
93
		};
74
	}
94
	}
75
95
96
	/**
97
	 * {@inheritDoc}
98
	 */
76
	@Override
99
	@Override
77
	protected void initializeLayout(Composite container) {
100
	protected void initializeLayout(Composite container) {
78
		
101
79
		addLabeledText(
102
		addLabeledText(
80
			container, 
103
			container,
81
			JptUiDetailsMessages.NamedQueryComposite_nameTextLabel, 
104
			JptUiDetailsMessages.NamedQueryComposite_nameTextLabel,
82
			buildNameTextHolder());
105
			buildNameTextHolder());
83
106
84
		// Query text area
107
		// Query text area
85
		addLabeledMultiLineText(
108
		StyledText text = addLabeledMultiLineStyledText(
86
			container,
109
			container,
87
			JptUiDetailsMessages.NamedQueryPropertyComposite_query,
110
			JptUiDetailsMessages.NamedQueryPropertyComposite_query,
88
			buildQueryHolder(),
111
			buildQueryHolder(),
Lines 90-95 Link Here
90
			null
113
			null
91
		);
114
		);
92
115
116
		new JpaJpqlContentProposalProvider(getSubjectHolder(), text);
117
93
		// Query Hints pane
118
		// Query Hints pane
94
		container = addTitledGroup(
119
		container = addTitledGroup(
95
			addSubPane(container, 5),
120
			addSubPane(container, 5),
Lines 98-119 Link Here
98
123
99
		new QueryHintsComposite(this, container);
124
		new QueryHintsComposite(this, container);
100
	}
125
	}
101
		
102
	protected WritablePropertyValueModel<String> buildNameTextHolder() {
103
		return new PropertyAspectAdapter<NamedQuery, String>(
104
				getSubjectHolder(), Query.NAME_PROPERTY) {
105
			@Override
106
			protected String buildValue_() {
107
				return this.subject.getName();
108
			}
109
		
110
			@Override
111
			protected void setValue_(String value) {
112
				if (value.length() == 0) {
113
					value = null;
114
				}
115
				this.subject.setName(value);
116
			}
117
		};
118
	}
119
}
126
}
(-)src/org/eclipse/jpt/jpa/ui/internal/details/QueriesComposite.java (-3 / +3 lines)
Lines 17-24 Link Here
17
import org.eclipse.jface.window.Window;
17
import org.eclipse.jface.window.Window;
18
import org.eclipse.jpt.common.ui.internal.util.ControlSwitcher;
18
import org.eclipse.jpt.common.ui.internal.util.ControlSwitcher;
19
import org.eclipse.jpt.common.ui.internal.widgets.AddRemoveListPane;
19
import org.eclipse.jpt.common.ui.internal.widgets.AddRemoveListPane;
20
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
21
import org.eclipse.jpt.common.ui.internal.widgets.AddRemovePane.Adapter;
20
import org.eclipse.jpt.common.ui.internal.widgets.AddRemovePane.Adapter;
21
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
22
import org.eclipse.jpt.common.utility.internal.CollectionTools;
22
import org.eclipse.jpt.common.utility.internal.CollectionTools;
23
import org.eclipse.jpt.common.utility.internal.Transformer;
23
import org.eclipse.jpt.common.utility.internal.Transformer;
24
import org.eclipse.jpt.common.utility.internal.model.value.CompositeListValueModel;
24
import org.eclipse.jpt.common.utility.internal.model.value.CompositeListValueModel;
Lines 75-81 Link Here
75
{
75
{
76
	private AddRemoveListPane<QueryContainer> listPane;
76
	private AddRemoveListPane<QueryContainer> listPane;
77
	NamedNativeQueryPropertyComposite namedNativeQueryPane;
77
	NamedNativeQueryPropertyComposite namedNativeQueryPane;
78
	NamedQueryPropertyComposite<? extends NamedQuery> namedQueryPane;
78
	Pane<? extends NamedQuery> namedQueryPane;
79
	private WritablePropertyValueModel<Query> queryHolder;
79
	private WritablePropertyValueModel<Query> queryHolder;
80
80
81
81
Lines 295-301 Link Here
295
		installPaneSwitcher(pageBook);
295
		installPaneSwitcher(pageBook);
296
	}
296
	}
297
	
297
	
298
	protected NamedQueryPropertyComposite<? extends NamedQuery> buildNamedQueryPropertyComposite(PageBook pageBook) {
298
	protected Pane<? extends NamedQuery> buildNamedQueryPropertyComposite(PageBook pageBook) {
299
		return new NamedQueryPropertyComposite<NamedQuery>(
299
		return new NamedQueryPropertyComposite<NamedQuery>(
300
			this,
300
			this,
301
			this.buildNamedQueryHolder(),
301
			this.buildNamedQueryHolder(),
(-)src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/NamedQueryProperty2_0Composite.java (-15 / +82 lines)
Lines 1-27 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
* Copyright (c) 2009 Oracle. All rights reserved.
2
* Copyright (c) 2009, 2011 Oracle. All rights reserved.
3
* This program and the accompanying materials are made available under the
3
* This program and the accompanying materials are made available under the
4
* terms of the Eclipse Public License v1.0, which accompanies this distribution
4
* terms of the Eclipse Public License v1.0, which accompanies this distribution
5
* and is available at http://www.eclipse.org/legal/epl-v10.html.
5
* and is available at http://www.eclipse.org/legal/epl-v10.html.
6
* 
6
*
7
* Contributors:
7
* Contributors:
8
*     Oracle - initial API and implementation
8
*     Oracle - initial API and implementation
9
*******************************************************************************/
9
*******************************************************************************/
10
package org.eclipse.jpt.jpa.ui.internal.jpa2.details;
10
package org.eclipse.jpt.jpa.ui.internal.jpa2.details;
11
11
12
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
12
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
13
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
13
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
14
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
15
import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel;
16
import org.eclipse.jpt.jpa.core.context.Query;
14
import org.eclipse.jpt.jpa.core.jpa2.context.NamedQuery2_0;
17
import org.eclipse.jpt.jpa.core.jpa2.context.NamedQuery2_0;
15
import org.eclipse.jpt.jpa.ui.internal.details.JptUiDetailsMessages;
18
import org.eclipse.jpt.jpa.ui.internal.details.JptUiDetailsMessages;
16
import org.eclipse.jpt.jpa.ui.internal.details.NamedQueryPropertyComposite;
17
import org.eclipse.jpt.jpa.ui.internal.details.QueryHintsComposite;
19
import org.eclipse.jpt.jpa.ui.internal.details.QueryHintsComposite;
20
import org.eclipse.jpt.jpa.ui.internal.jpql.JpaJpqlContentProposalProvider;
21
import org.eclipse.swt.custom.StyledText;
18
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Composite;
19
23
20
/**
24
/**
21
 *  NamedQueryProperty2_0Composite
25
 * Here's the layout of this pane:
26
 * <pre>
27
 * -----------------------------------------------------------------------------
28
 * |            -------------------------------------------------------------- |
29
 * | Query:     | I                                                          | |
30
 * |            |                                                            | |
31
 * |            |                                                            | |
32
 * |            -------------------------------------------------------------- |
33
 * |            -------------------------------------------------------------- |
34
 * | Lock Mode: |                                                          |v| |
35
 * |            -------------------------------------------------------------- |
36
 * |                                                                           |
37
 * | - Query Hints ----------------------------------------------------------- |
38
 * | | --------------------------------------------------------------------- | |
39
 * | | |                                                                   | | |
40
 * | | | QueryHintsComposite                                               | | |
41
 * | | |                                                                   | | |
42
 * | | --------------------------------------------------------------------- | |
43
 * | ------------------------------------------------------------------------- |
44
 * -----------------------------------------------------------------------------</pre>
45
 *
46
 *
47
 * @see NamedQuery2_0
48
 * @see NamedQueriesComposite - The parent container
49
 * @see QueryHintsComposite
50
 *
51
 * @version 2.0
52
 * @since 2.0
22
 */
53
 */
23
public class NamedQueryProperty2_0Composite extends NamedQueryPropertyComposite<NamedQuery2_0>
54
public class NamedQueryProperty2_0Composite extends Pane<NamedQuery2_0> {
24
{
55
25
	/**
56
	/**
26
	 * Creates a new <code>NamedQueryProperty2_0Composite</code>.
57
	 * Creates a new <code>NamedQueryProperty2_0Composite</code>.
27
	 *
58
	 *
Lines 30-51 Link Here
30
	 * @param parent The parent container
61
	 * @param parent The parent container
31
	 */
62
	 */
32
	public NamedQueryProperty2_0Composite(Pane<?> parentPane,
63
	public NamedQueryProperty2_0Composite(Pane<?> parentPane,
33
	                                   PropertyValueModel<NamedQuery2_0> subjectHolder,
64
	                                      PropertyValueModel<NamedQuery2_0> subjectHolder,
34
	                                   Composite parent) {
65
	                                      Composite parent) {
35
66
36
		super(parentPane, subjectHolder, parent);
67
		super(parentPane, subjectHolder, parent);
37
	}
68
	}
38
69
70
	protected WritablePropertyValueModel<String> buildNameTextHolder() {
71
		return new PropertyAspectAdapter<NamedQuery2_0, String>(getSubjectHolder(), Query.NAME_PROPERTY) {
72
			@Override
73
			protected String buildValue_() {
74
				return this.subject.getName();
75
			}
76
77
			@Override
78
			protected void setValue_(String value) {
79
				if (value.length() == 0) {
80
					value = null;
81
				}
82
				this.subject.setName(value);
83
			}
84
		};
85
	}
86
87
	protected WritablePropertyValueModel<String> buildQueryHolder() {
88
		return new PropertyAspectAdapter<NamedQuery2_0, String>(getSubjectHolder(), Query.QUERY_PROPERTY) {
89
			@Override
90
			protected String buildValue_() {
91
				return this.subject.getQuery();
92
			}
93
94
			@Override
95
			protected void setValue_(String value) {
96
				this.subject.setQuery(value);
97
			}
98
		};
99
	}
100
101
	/**
102
	 * {@inheritDoc}
103
	 */
39
	@Override
104
	@Override
40
	protected void initializeLayout(Composite container) {
105
	protected void initializeLayout(Composite container) {
41
		
106
42
		this.addLabeledText(
107
		this.addLabeledText(
43
			container, 
108
			container,
44
			JptUiDetailsMessages.NamedQueryComposite_nameTextLabel, 
109
			JptUiDetailsMessages.NamedQueryComposite_nameTextLabel,
45
			this.buildNameTextHolder());
110
			this.buildNameTextHolder());
46
111
47
		// Query text area
112
		// Query text area
48
		this.addLabeledMultiLineText(
113
		StyledText text = this.addLabeledMultiLineStyledText(
49
			container,
114
			container,
50
			JptUiDetailsMessages.NamedQueryPropertyComposite_query,
115
			JptUiDetailsMessages.NamedQueryPropertyComposite_query,
51
			this.buildQueryHolder(),
116
			this.buildQueryHolder(),
Lines 53-60 Link Here
53
			null
118
			null
54
		);
119
		);
55
120
121
		new JpaJpqlContentProposalProvider(getSubjectHolder(), text);
122
123
		// Lock Mode type
56
		new LockModeComposite(this, container);
124
		new LockModeComposite(this, container);
57
			
125
58
		// Query Hints pane
126
		// Query Hints pane
59
		container = this.addTitledGroup(
127
		container = this.addTitledGroup(
60
			this.addSubPane(container, 5),
128
			this.addSubPane(container, 5),
Lines 63-67 Link Here
63
131
64
		new QueryHintsComposite(this, container);
132
		new QueryHintsComposite(this, container);
65
	}
133
	}
66
	
134
}
67
}
(-)src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/Queries2_0Composite.java (-4 / +2 lines)
Lines 15-21 Link Here
15
import org.eclipse.jpt.jpa.core.context.Query;
15
import org.eclipse.jpt.jpa.core.context.Query;
16
import org.eclipse.jpt.jpa.core.context.QueryContainer;
16
import org.eclipse.jpt.jpa.core.context.QueryContainer;
17
import org.eclipse.jpt.jpa.core.jpa2.context.NamedQuery2_0;
17
import org.eclipse.jpt.jpa.core.jpa2.context.NamedQuery2_0;
18
import org.eclipse.jpt.jpa.ui.internal.details.NamedQueryPropertyComposite;
19
import org.eclipse.jpt.jpa.ui.internal.details.QueriesComposite;
18
import org.eclipse.jpt.jpa.ui.internal.details.QueriesComposite;
20
import org.eclipse.swt.widgets.Composite;
19
import org.eclipse.swt.widgets.Composite;
21
import org.eclipse.ui.part.PageBook;
20
import org.eclipse.ui.part.PageBook;
Lines 34-42 Link Here
34
		super(parentPane, subjectHolder, parent);
33
		super(parentPane, subjectHolder, parent);
35
	}
34
	}
36
	
35
	
37
	
38
	@Override
36
	@Override
39
	protected NamedQueryPropertyComposite<NamedQuery2_0> buildNamedQueryPropertyComposite(PageBook pageBook) {
37
	protected Pane<NamedQuery2_0> buildNamedQueryPropertyComposite(PageBook pageBook) {
40
		return new NamedQueryProperty2_0Composite(
38
		return new NamedQueryProperty2_0Composite(
41
			this,
39
			this,
42
			this.buildNamedQuery2_0Holder(),
40
			this.buildNamedQuery2_0Holder(),
Lines 51-54 Link Here
51
			}
49
			}
52
		};
50
		};
53
	}
51
	}
54
}
52
}
(-)src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java (+679 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
5
 * which accompanies this distribution.
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.ui.internal.jpql;
15
16
import java.text.MessageFormat;
17
import java.util.ArrayList;
18
import java.util.Arrays;
19
import java.util.Collections;
20
import java.util.Comparator;
21
import java.util.List;
22
import java.util.Locale;
23
import java.util.ResourceBundle;
24
import org.eclipse.core.commands.AbstractHandler;
25
import org.eclipse.core.commands.ExecutionEvent;
26
import org.eclipse.core.commands.ExecutionException;
27
import org.eclipse.core.commands.IHandler;
28
import org.eclipse.core.commands.ParameterizedCommand;
29
import org.eclipse.core.expressions.EvaluationResult;
30
import org.eclipse.core.expressions.Expression;
31
import org.eclipse.core.expressions.ExpressionInfo;
32
import org.eclipse.core.expressions.IEvaluationContext;
33
import org.eclipse.jface.bindings.Binding;
34
import org.eclipse.jface.bindings.Trigger;
35
import org.eclipse.jface.bindings.keys.KeyStroke;
36
import org.eclipse.jface.bindings.keys.SWTKeySupport;
37
import org.eclipse.jface.fieldassist.ControlDecoration;
38
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
39
import org.eclipse.jface.text.DefaultTextHover;
40
import org.eclipse.jface.text.Document;
41
import org.eclipse.jface.text.IDocument;
42
import org.eclipse.jface.text.ITextHover;
43
import org.eclipse.jface.text.ITextViewer;
44
import org.eclipse.jface.text.Position;
45
import org.eclipse.jface.text.contentassist.ContentAssistant;
46
import org.eclipse.jface.text.contentassist.ICompletionProposal;
47
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
48
import org.eclipse.jface.text.contentassist.IContentAssistant;
49
import org.eclipse.jface.text.contentassist.IContextInformation;
50
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
51
import org.eclipse.jface.text.source.Annotation;
52
import org.eclipse.jface.text.source.AnnotationModel;
53
import org.eclipse.jface.text.source.DefaultAnnotationHover;
54
import org.eclipse.jface.text.source.IAnnotationHover;
55
import org.eclipse.jface.text.source.ISourceViewer;
56
import org.eclipse.jface.text.source.SourceViewer;
57
import org.eclipse.jface.text.source.SourceViewerConfiguration;
58
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
59
import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
60
import org.eclipse.jpt.jpa.core.context.NamedQuery;
61
import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
62
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
63
import org.eclipse.osgi.util.NLS;
64
import org.eclipse.persistence.jpa.jpql.JPQLQueryProblem;
65
import org.eclipse.swt.SWT;
66
import org.eclipse.swt.custom.StyleRange;
67
import org.eclipse.swt.custom.StyledText;
68
import org.eclipse.swt.events.DisposeEvent;
69
import org.eclipse.swt.events.DisposeListener;
70
import org.eclipse.swt.events.ModifyEvent;
71
import org.eclipse.swt.events.ModifyListener;
72
import org.eclipse.swt.graphics.Color;
73
import org.eclipse.swt.graphics.Image;
74
import org.eclipse.swt.widgets.Composite;
75
import org.eclipse.ui.ISources;
76
import org.eclipse.ui.IWorkbench;
77
import org.eclipse.ui.PlatformUI;
78
import org.eclipse.ui.actions.ActionFactory;
79
import org.eclipse.ui.handlers.IHandlerActivation;
80
import org.eclipse.ui.handlers.IHandlerService;
81
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
82
import org.eclipse.ui.keys.IBindingService;
83
import org.eclipse.ui.swt.IFocusService;
84
import org.eclipse.ui.texteditor.AnnotationPreference;
85
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
86
87
/**
88
 * This provider installs content assist support on a {@link StyledText} widget in order to give
89
 * choices at any given position within a JPQL query.
90
 * <p>
91
 * NOTE 1: Add a timer before validating.
92
 * <p>
93
 * NOTE 2. I think it's possible to install error highlight into the SourceViewer rather than doing
94
 *         it manually.
95
 * <p>
96
 * NOTE 3. Add syntax highlight for the JPQL identifiers.
97
 *
98
 * @version 3.0
99
 * @since 3.0
100
 * @author Pascal Filion
101
 */
102
@SuppressWarnings({"nls", "restriction"})
103
public final class JpaJpqlContentProposalProvider extends JpqlCompletionProposalComputer<ICompletionProposal> {
104
105
	/**
106
	 * This model holds onto the {@link Annotation annotations} that have been created for each
107
	 * {@link JPQLQueryProblem}
108
	 */
109
	private AnnotationModel annotationModel;
110
111
	/**
112
	 * The {@link Color} of the highlight.
113
	 */
114
	private Color errorColor;
115
116
	/**
117
	 * This handler will trigger an event that will be used to notify the {@link SourceViewer} to
118
	 * invoke the content assist.
119
	 */
120
	private IHandlerActivation handlerActivation;
121
122
	/**
123
	 * The position within the JPQL query.
124
	 */
125
	private int position;
126
127
	/**
128
	 * The holder of the named query.
129
	 */
130
	private PropertyValueModel<? extends NamedQuery> queryHolder;
131
132
	/**
133
	 * This manager is responsible to only keep the union of the ranges that were created by
134
	 * validating the JPQL query.
135
	 */
136
	private RangeManager rangeManager;
137
138
	/**
139
	 * The {@link ResourceBundle} that contains the JPQL problems.
140
	 */
141
	private ResourceBundle resourceBundle;
142
143
	/**
144
	 * This viewer is used to install various functionality over the {@link StyledText}.
145
	 */
146
	private SourceViewer sourceViewer;
147
148
	/**
149
	 * The widget used to display the JPQL query.
150
	 */
151
	private StyledText styledText;
152
153
	/**
154
	 * The unique identifier - appended by hashCode() - used to register the widget with the focus
155
	 * handler.
156
	 */
157
	private static final String CONTROL_ID = "jpql.focus.control";
158
159
	/**
160
	 * The unique identifier used to mark an {@link Annotation} as a JPQL problem.
161
	 */
162
	private static final String ERROR_TYPE = "jpql.error";
163
164
	/**
165
	 * Creates a new <code>JpaJpqlContentProposalProvider</code>.
166
	 *
167
	 * @param queryHolder The holder of the named query
168
	 * @param styledText The {@link StyledText} widget that shows the JPQL query
169
	 */
170
	public JpaJpqlContentProposalProvider(PropertyValueModel<? extends NamedQuery> queryHolder,
171
	                                      StyledText styledText) {
172
173
		super();
174
		initialize(queryHolder, styledText);
175
	}
176
177
	private void activateHandler() {
178
179
		IWorkbench workbench = PlatformUI.getWorkbench();
180
		IFocusService focusService = (IFocusService) workbench.getService(IFocusService.class);
181
		IHandlerService handlerService = (IHandlerService) workbench.getService(IHandlerService.class);
182
183
		if ((focusService != null) && (handlerService != null)) {
184
185
			focusService.addFocusTracker(styledText, CONTROL_ID + hashCode());
186
187
			Expression expression = buildExpression();
188
			IHandler handler = buildHandler();
189
190
			handlerActivation = handlerService.activateHandler(
191
				ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS,
192
				handler,
193
				expression
194
			);
195
196
			handlerActivation = handlerService.activateHandler(
197
				ActionFactory.UNDO.getCommandId(),
198
				handler,
199
				expression
200
			);
201
202
			handlerActivation = handlerService.activateHandler(
203
				ActionFactory.REDO.getCommandId(),
204
				handler,
205
				expression
206
			);
207
		}
208
	}
209
210
	private DisposeListener buildDisposeListener() {
211
		return new DisposeListener() {
212
			public void widgetDisposed(DisposeEvent e) {
213
				dispose();
214
			}
215
		};
216
	}
217
218
	private Expression buildExpression() {
219
		return new Expression() {
220
			@Override
221
			public void collectExpressionInfo(ExpressionInfo info) {
222
				info.addVariableNameAccess(ISources.ACTIVE_FOCUS_CONTROL_NAME);
223
			}
224
			@Override
225
			public EvaluationResult evaluate(IEvaluationContext context) {
226
				Object variable = context.getVariable(ISources.ACTIVE_FOCUS_CONTROL_NAME);
227
				return (variable == styledText) ? EvaluationResult.TRUE : EvaluationResult.FALSE;
228
			}
229
		};
230
	}
231
232
	private IHandler buildHandler() {
233
		return new AbstractHandler() {
234
			public Object execute(ExecutionEvent event) throws ExecutionException {
235
				String commandId = event.getCommand().getId();
236
237
				// Content Assist
238
				if (ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS.equals(commandId)) {
239
					sourceViewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
240
				}
241
				// Undo
242
				else if (ActionFactory.UNDO.getCommandId().equals(commandId)) {
243
					if (sourceViewer.getUndoManager().undoable()) {
244
						sourceViewer.getUndoManager().undo();
245
					}
246
				}
247
				// Redo
248
				else if (ActionFactory.REDO.getCommandId().equals(commandId)) {
249
					if (sourceViewer.getUndoManager().redoable()) {
250
						sourceViewer.getUndoManager().redo();
251
					}
252
				}
253
254
				return null;
255
			}
256
		};
257
	}
258
259
	private String buildMessage(JPQLQueryProblem problem) {
260
		String message = resourceBundle().getString(problem.getMessageKey());
261
		message = MessageFormat.format(message, (Object[]) problem.getMessageArguments());
262
		return message;
263
	}
264
265
	private ModifyListener buildModifyListener() {
266
		return new ModifyListener() {
267
			public void modifyText(ModifyEvent e) {
268
				validate();
269
			}
270
		};
271
	}
272
273
	private Comparator<JPQLQueryProblem> buildProblemComparator() {
274
		return new Comparator<JPQLQueryProblem>() {
275
			public int compare(JPQLQueryProblem problem1, JPQLQueryProblem problem2) {
276
				int result = problem1.getStartPosition() - problem2.getStartPosition();
277
				if (result == 0) {
278
					result = problem1.getEndPosition() - problem2.getEndPosition();
279
				}
280
				return result;
281
			}
282
		};
283
	}
284
285
	/**
286
	 * {@inheritDoc}
287
	 */
288
	@Override
289
	ICompletionProposal buildProposal(String proposal,
290
	                                  String displayString,
291
	                                  String additionalInfo,
292
	                                  Image image,
293
	                                  int cursorOffset) {
294
295
		return new JpqlCompletionProposal(
296
			contentAssistItems,
297
			proposal,
298
			displayString,
299
			additionalInfo,
300
			image,
301
			namedQuery,
302
			actualQuery,
303
			jpqlQuery,
304
			offset,
305
			position,
306
			cursorOffset,
307
			false
308
		);
309
	}
310
311
	private SourceViewer buildSourceViewer() {
312
		return new SourceViewer(styledText.getParent(), null, styledText.getStyle()) {
313
			@Override
314
			protected StyledText createTextWidget(Composite parent, int styles) {
315
				return styledText;
316
			}
317
		};
318
	}
319
320
	private Image contentAssistImage() {
321
		FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
322
		return registry.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage();
323
	}
324
325
	/**
326
	 * Makes sure the {@link Color} used to paint the underlying problem is disposed when the
327
	 * {@link StyledText} widget is disposed.
328
	 */
329
	private void dispose() {
330
331
		if (errorColor != null) {
332
			errorColor.dispose();
333
			errorColor = null;
334
		}
335
336
		IWorkbench workbench = PlatformUI.getWorkbench();
337
		IHandlerService handlerService = (IHandlerService) workbench.getService(IHandlerService.class);
338
		handlerService.deactivateHandler(handlerActivation);
339
	}
340
341
	private Color errorColor() {
342
		// TODO: Support the color changing
343
		if (errorColor == null) {
344
			// TODO: Is there a better way to do this?
345
			for (Object object : EditorsPlugin.getDefault().getMarkerAnnotationPreferences().getAnnotationPreferences()) {
346
				AnnotationPreference preference = (AnnotationPreference) object;
347
				if ("org.eclipse.ui.workbench.texteditor.error".equals(preference.getAnnotationType())) {
348
					errorColor = new Color(styledText.getDisplay(), preference.getColorPreferenceValue());
349
					break;
350
				}
351
			}
352
			if (errorColor == null) {
353
				errorColor = new Color(styledText.getDisplay(), 255, 0, 0);
354
			}
355
		}
356
		return errorColor;
357
	}
358
359
	private KeyStroke findContentAssistTrigger() {
360
361
		IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
362
363
		// Dig through the list of available bindings to find the one for content assist
364
		for (Binding binding : bindingService.getBindings()) {
365
			if (isContentAssistBinding(binding)) {
366
				Trigger[] triggers = binding.getTriggerSequence().getTriggers();
367
				if ((triggers != null) && (triggers.length > 0)) {
368
					return (KeyStroke) triggers[0];
369
				}
370
			}
371
		}
372
373
		// The default trigger was not found, use the default
374
		return KeyStroke.getInstance(SWT.CTRL, ' ');
375
	}
376
377
	private void initialize(PropertyValueModel<? extends NamedQuery> queryHolder,
378
	                        StyledText styledText) {
379
380
		this.styledText      = styledText;
381
		this.queryHolder     = queryHolder;
382
		this.rangeManager    = new RangeManager();
383
		this.annotationModel = new AnnotationModel();
384
		this.styledText.addModifyListener (buildModifyListener());
385
		this.styledText.addDisposeListener(buildDisposeListener());
386
387
		// Add the content assist image at the top left corner
388
		installControlDecoration();
389
390
		// Create the SourceViewer, which is responsible for everything: content assist, tool tip
391
		// hovering over the annotation (problems), etc
392
		sourceViewer = buildSourceViewer();
393
		sourceViewer.configure(new JpqlSourceViewerConfiguration());
394
		sourceViewer.setDocument(new Document(), annotationModel);
395
396
		// Bind the content assist key trigger with the handler service
397
		activateHandler();
398
399
		// Install a custom context menu to the widget
400
		TextTransferHandler.installContextMenu(styledText, sourceViewer.getUndoManager());
401
	}
402
403
	private void installControlDecoration() {
404
405
		// Retrieve the content assist trigger
406
		KeyStroke contentAssistTrigger = findContentAssistTrigger();
407
		String key = SWTKeySupport.getKeyFormatterForPlatform().format(contentAssistTrigger);
408
409
		// Add the context assist icon at the top left corner of the StyledText
410
		ControlDecoration decoration = new ControlDecoration(styledText, SWT.LEFT | SWT.TOP);
411
		decoration.setDescriptionText(NLS.bind(JptUiMessages.JpqlContentProposalProvider_Description, key));
412
		decoration.setImage(contentAssistImage());
413
		decoration.setShowOnlyOnFocus(true);
414
	}
415
416
	private boolean isContentAssistBinding(Binding binding) {
417
418
		ParameterizedCommand command = binding.getParameterizedCommand();
419
420
		return command != null &&
421
		       command.getCommand() != null &&
422
		       command.getCommand().getId().equals(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
423
	}
424
425
	private NamedQuery query() {
426
		return queryHolder.getValue();
427
	}
428
429
	private ResourceBundle resourceBundle() {
430
		if (resourceBundle == null) {
431
			resourceBundle = ResourceBundle.getBundle(
432
				"jpa_jpql_validation",
433
				Locale.getDefault(),
434
				JptJpaCorePlugin.class.getClassLoader()
435
			);
436
		}
437
		return resourceBundle;
438
	}
439
440
	private List<JPQLQueryProblem> sortProblems(List<JPQLQueryProblem> problems) {
441
		Collections.sort(problems, buildProblemComparator());
442
		return problems;
443
	}
444
445
	/**
446
	 * Validates the given JPQL query and add highlights where problems have been found.
447
	 */
448
	private void validate() {
449
450
		NamedQuery query = query();
451
452
		if ((query != null) && !styledText.isDisposed()) {
453
454
			String jpqlQuery = styledText.getText();
455
			rangeManager.clear();
456
457
			JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper(query, jpqlQuery);
458
			String parsedJpqlQuery = helper.getParsedJPQLQuery();
459
460
			for (JPQLQueryProblem problem : sortProblems(helper.validate())) {
461
462
				// Create the range
463
				int[] positions = helper.buildPositions(problem, parsedJpqlQuery, jpqlQuery);
464
				rangeManager.addRange(positions);
465
466
				// Add the problem to the tool tip
467
				Annotation annotation = new Annotation(ERROR_TYPE, true, buildMessage(problem));
468
				annotationModel.addAnnotation(annotation, new Position(positions[0], positions[1] - positions[0]));
469
			}
470
471
			// Update the widget
472
			styledText.setStyleRanges(rangeManager.buildStyleRanges());
473
		}
474
	}
475
476
	/**
477
	 * This processor is responsible to create the list of {@link ICompletionProposal proposals}
478
	 * based on the position of the cursor within the query.
479
	 */
480
	private class ContentAssistProcessor implements IContentAssistProcessor {
481
482
		/**
483
		 * {@inheritDoc}
484
		 */
485
		public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
486
487
			JpaJpqlContentProposalProvider.this.position = offset;
488
489
			String jpqlQuery = viewer.getDocument().get();
490
			List<ICompletionProposal> proposals = buildProposals(query(), jpqlQuery, 0, position);
491
			return proposals.toArray(new ICompletionProposal[proposals.size()]);
492
		}
493
494
		/**
495
		 * {@inheritDoc}
496
		 */
497
		public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
498
			return null;
499
		}
500
501
		/**
502
		 * {@inheritDoc}
503
		 */
504
		public char[] getCompletionProposalAutoActivationCharacters() {
505
			return null;
506
		}
507
508
		/**
509
		 * {@inheritDoc}
510
		 */
511
		public char[] getContextInformationAutoActivationCharacters() {
512
			return null;
513
		}
514
515
		/**
516
		 * {@inheritDoc}
517
		 */
518
		public IContextInformationValidator getContextInformationValidator() {
519
			return null;
520
		}
521
522
		/**
523
		 * {@inheritDoc}
524
		 */
525
		public String getErrorMessage() {
526
			return null;
527
		}
528
	}
529
530
	private class JpqlSourceViewerConfiguration extends SourceViewerConfiguration {
531
532
		/**
533
		 * {@inheritDoc}
534
		 */
535
		@Override
536
		public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
537
			return new DefaultAnnotationHover();
538
		}
539
540
		/**
541
		 * {@inheritDoc}
542
		 */
543
		@Override
544
		public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
545
			ContentAssistant assistant = new ContentAssistant();
546
			assistant.setContentAssistProcessor(new ContentAssistProcessor(), IDocument.DEFAULT_CONTENT_TYPE);
547
			return assistant;
548
		}
549
550
		/**
551
		 * {@inheritDoc}
552
		 */
553
		@Override
554
		public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
555
			return new DefaultTextHover(sourceViewer);
556
		}
557
558
		/**
559
		 * {@inheritDoc}
560
		 */
561
		@Override
562
		public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
563
			return new DefaultTextHover(sourceViewer);
564
		}
565
	}
566
567
	/**
568
	 * This manager is responsible to only keep the union of the ranges that were created by
569
	 * validating the JPQL query.
570
	 */
571
	private class RangeManager {
572
573
		/**
574
		 * The {@link StyleRange ranges} that will will be used to paint the highlight under the JPQL
575
		 * query where the query is grammatically and/or semantically invalid
576
		 */
577
		List<int[]> ranges;
578
579
		/**
580
		 * Creates a new <code>RangeManager</code>.
581
		 */
582
		RangeManager() {
583
			super();
584
			ranges = new ArrayList<int[]>();
585
		}
586
587
		/**
588
		 * Adds the given range (start and end positions) to this manager and if an existing range is
589
		 * within the given one, then they will be merged to make the union of the two ranges.
590
		 *
591
		 * @param range The start and end position of the problem
592
		 */
593
		void addRange(int[] range) {
594
			ranges.add(range);
595
			if (ranges.size() > 1) {
596
				mergeRanges();
597
			}
598
		}
599
600
		private Comparator<StyleRange> buildComparator() {
601
			return new Comparator<StyleRange>() {
602
				public int compare(StyleRange range1, StyleRange range2) {
603
					return range1.start - range2.start;
604
				}
605
			};
606
		}
607
608
		/**
609
		 * Creates the list of {@link StyleRange ranges} that will will be used to paint the highlight
610
		 * under the JPQL query where the query is grammatically and/or semantically invalid.
611
		 *
612
		 * @return The list of {@link StyleRange ranges}
613
		 */
614
		StyleRange[] buildStyleRanges() {
615
616
			StyleRange[] styleRanges = new StyleRange[ranges.size()];
617
618
			for (int index = ranges.size(); --index >= 0; ) {
619
				int[] positions = ranges.get(index);
620
621
				StyleRange styleRange = new StyleRange();
622
				styleRange.start          = positions[0];
623
				styleRange.length         = positions[1] - positions[0];
624
				styleRange.underline      = true;
625
				styleRange.underlineColor = errorColor();
626
				styleRange.underlineStyle = SWT.UNDERLINE_ERROR;
627
				styleRanges[index]        = styleRange;
628
			}
629
630
			Arrays.sort(styleRanges, buildComparator());
631
			return styleRanges;
632
		}
633
634
		/**
635
		 * Clears the registered ranges.
636
		 */
637
		void clear() {
638
			ranges.clear();
639
		}
640
641
		private void mergeRanges() {
642
643
			for (int firstIndex = 0, count = ranges.size(); firstIndex < count; firstIndex++) {
644
				int[] firstRange = ranges.get(firstIndex);
645
646
				for (int secondIndex = firstIndex + 1; secondIndex < count; secondIndex++) {
647
					int[] secondRange = ranges.get(secondIndex);
648
					boolean merged = false;
649
650
					// range  └───┘
651
					// to add   └──────┘
652
					// become └────────┘
653
					if (firstRange[0] <= secondRange[0] &&
654
					    firstRange[1] >= secondRange[0]) {
655
656
						firstRange[1] = Math.max(firstRange[1], secondRange[1]);
657
						merged = true;
658
					}
659
					// range       └───┘
660
					// to add └──────┘
661
					// become └────────┘
662
					else if (firstRange[1] >= secondRange[1] &&
663
					         firstRange[0] <= secondRange[1]) {
664
665
						firstRange[0] = Math.min(firstRange[0], secondRange[0]);
666
						merged = true;
667
					}
668
669
					if (merged) {
670
						merged = false;
671
						ranges.remove(secondIndex);
672
						secondIndex--;
673
						count--;
674
					}
675
				}
676
			}
677
		}
678
	}
679
}
(-)src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlJavaCompletionProposalComputer.java (+320 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
5
 * which accompanies this distribution.
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.ui.internal.jpql;
15
16
import java.util.Collections;
17
import java.util.Iterator;
18
import java.util.List;
19
import org.eclipse.core.resources.IFile;
20
import org.eclipse.core.runtime.IProgressMonitor;
21
import org.eclipse.core.runtime.IStatus;
22
import org.eclipse.core.runtime.Status;
23
import org.eclipse.jdt.core.CompletionContext;
24
import org.eclipse.jdt.core.ICompilationUnit;
25
import org.eclipse.jdt.core.JavaModelException;
26
import org.eclipse.jdt.core.dom.ASTNode;
27
import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
28
import org.eclipse.jdt.core.dom.Annotation;
29
import org.eclipse.jdt.core.dom.ArrayInitializer;
30
import org.eclipse.jdt.core.dom.CompilationUnit;
31
import org.eclipse.jdt.core.dom.IExtendedModifier;
32
import org.eclipse.jdt.core.dom.MemberValuePair;
33
import org.eclipse.jdt.core.dom.NormalAnnotation;
34
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
35
import org.eclipse.jdt.core.dom.StringLiteral;
36
import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
37
import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer;
38
import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
39
import org.eclipse.jface.text.contentassist.ICompletionProposal;
40
import org.eclipse.jface.text.contentassist.IContextInformation;
41
import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
42
import org.eclipse.jpt.common.core.utility.TextRange;
43
import org.eclipse.jpt.common.utility.internal.StringTools;
44
import org.eclipse.jpt.jpa.core.JpaFile;
45
import org.eclipse.jpt.jpa.core.JpaStructureNode;
46
import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
47
import org.eclipse.jpt.jpa.core.context.NamedQuery;
48
import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
49
import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
50
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
51
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
52
import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
53
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
54
import org.eclipse.persistence.jpa.jpql.ExpressionTools;
55
import org.eclipse.swt.graphics.Image;
56
57
/**
58
 * This computer adds content assist support when it is invoked inside the query element of {@link
59
 * javax.persistence.NamedQuery &#64;NamedQuery}.
60
 *
61
 * @version 3.0
62
 * @since 3.0
63
 * @author Pascal Filion
64
 */
65
@SuppressWarnings("restriction")
66
public final class JpaJpqlJavaCompletionProposalComputer extends JpqlCompletionProposalComputer<ICompletionProposal>
67
                                                         implements IJavaCompletionProposalComputer {
68
69
	/**
70
	 * Creates a new <code>JpaJpqlJavaCompletionProposalComputer</code>.
71
	 */
72
	public JpaJpqlJavaCompletionProposalComputer() {
73
		super();
74
	}
75
76
	/**
77
	 * {@inheritDoc}
78
	 */
79
	@Override
80
	ICompletionProposal buildProposal(String proposal,
81
	                                  String displayString,
82
	                                  String additionalInfo,
83
	                                  Image image,
84
	                                  int cursorOffset) {
85
86
		return new JpqlCompletionProposal(
87
			contentAssistItems,
88
			proposal,
89
			displayString,
90
			additionalInfo,
91
			image,
92
			namedQuery,
93
			actualQuery,
94
			jpqlQuery,
95
			offset + 1, // +1 is to skip the opening "
96
			position,
97
			cursorOffset,
98
			true
99
		);
100
	}
101
102
	/**
103
	 * {@inheritDoc}
104
	 */
105
	public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context,
106
	                                                            IProgressMonitor monitor) {
107
108
		if (context instanceof JavaContentAssistInvocationContext) {
109
			monitor.beginTask(null, 100);
110
			try {
111
				return computeCompletionProposals((JavaContentAssistInvocationContext) context, monitor);
112
			}
113
			catch (Exception e) {
114
				Status status = new Status(IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID, JptUiMessages.JpaJpqlJavaCompletionProposalComputer_Error, e);
115
				JptJpaCorePlugin.log(status);
116
			}
117
			finally {
118
				monitor.done();
119
			}
120
		}
121
122
		return Collections.emptyList();
123
	}
124
125
	private List<ICompletionProposal> computeCompletionProposals(JavaContentAssistInvocationContext context,
126
	                                                             IProgressMonitor monitor) throws Exception {
127
128
		CompletionContext completionContext = context.getCoreContext();
129
130
		// The token "start" is the offset of the token's first character within the document.
131
		// A token start of -1 can means:
132
		// - It is inside the string representation of a unicode character, \\u0|0E9 where | is the
133
		//   cursor, then -1 is returned;
134
		// - The string is not valid (it has some invalid characters)
135
		int tokenStart = completionContext.getTokenStart();
136
		if (tokenStart == -1) return Collections.emptyList();
137
138
		int[] position = { completionContext.getOffset() - tokenStart - 1 };
139
		if (position[0] < 0) return Collections.emptyList();
140
141
		ICompilationUnit compilationUnit = context.getCompilationUnit();
142
		if (compilationUnit == null) return Collections.emptyList();
143
		CompilationUnit astRoot = ASTTools.buildASTRoot(compilationUnit);
144
145
		IFile file = getCorrespondingResource(compilationUnit);
146
		if (file == null) return Collections.emptyList();
147
148
		JpaFile jpaFile = JptJpaCorePlugin.getJpaFile(file);
149
		if (jpaFile == null) return Collections.emptyList();
150
151
		monitor.worked(80);
152
		checkCanceled(monitor);
153
154
		// Retrieve the JPA's model object
155
		NamedQuery namedQuery = namedQuery(astRoot, jpaFile, tokenStart);
156
		if (namedQuery == null) return Collections.emptyList();
157
158
		// Retrieve the actual value of the element "query" since the content assist can be
159
		// invoked before the model received the new content
160
		String jpqlQuery = jpqlQuery(astRoot, tokenStart, completionContext.getTokenEnd(), position);
161
162
		// Now create the proposals
163
		return buildProposals(namedQuery, jpqlQuery, tokenStart, position[0]);
164
	}
165
166
	/**
167
	 * {@inheritDoc}
168
	 */
169
	public List<IContextInformation> computeContextInformation(ContentAssistInvocationContext context,
170
	                                                           IProgressMonitor monitor) {
171
172
		return Collections.emptyList();
173
	}
174
175
	private NamedQuery findNamedQuery(JpaStructureNode structureNode,
176
	                                  CompilationUnit astRoot,
177
	                                  int tokenStart) {
178
179
		if (structureNode instanceof JavaPersistentType) {
180
			JavaPersistentType persistentType = (JavaPersistentType) structureNode;
181
			JavaTypeMapping typeMapping = persistentType.getMapping();
182
183
			if (typeMapping instanceof JavaEntity) {
184
				JavaEntity entity = (JavaEntity) typeMapping;
185
186
				for (Iterator<JavaNamedQuery> queries = entity.getQueryContainer().namedQueries(); queries.hasNext(); ) {
187
					JavaNamedQuery namedQuery = queries.next();
188
					TextRange textRange = namedQuery.getQueryAnnotation().getQueryTextRange(astRoot);
189
190
					if ((textRange != null) && textRange.includes(tokenStart)) {
191
						return namedQuery;
192
					}
193
				}
194
			}
195
		}
196
197
		return null;
198
	}
199
200
	private IFile getCorrespondingResource(ICompilationUnit compilationUnit) {
201
		try {
202
			return (IFile) compilationUnit.getCorrespondingResource();
203
		}
204
		catch (JavaModelException ex) {
205
			JptJpaCorePlugin.log(ex);
206
			return null;
207
		}
208
	}
209
210
	private boolean isInsideNode(ASTNode node, int tokenStart, int tokenEnd) {
211
		int startPosition = node.getStartPosition();
212
		return startPosition <= tokenStart &&
213
		       startPosition + node.getLength() >= tokenEnd;
214
	}
215
216
	private String jpqlQuery(CompilationUnit astRoot, int tokenStart, int tokenEnd, int[] position) {
217
218
		String jpqlQuery = retrieveQuery(astRoot, tokenStart, tokenEnd);
219
220
		if (jpqlQuery == null) {
221
			jpqlQuery = StringTools.EMPTY_STRING;
222
		}
223
		else if (StringTools.stringIsQuoted(jpqlQuery)) {
224
			jpqlQuery = jpqlQuery.substring(1, jpqlQuery.length() - 1);
225
		}
226
227
		return jpqlQuery;
228
	}
229
230
	/**
231
	 * {@inheritDoc}
232
	 */
233
	@Override
234
	String modifyJpqlQuery(String jpqlQuery, int[] position) {
235
		return ExpressionTools.unescape(jpqlQuery, position);
236
	}
237
238
	private NamedQuery namedQuery(CompilationUnit astRoot, JpaFile jpaFile, int tokenStart) {
239
240
		for (JpaStructureNode node : jpaFile.getRootStructureNodes()) {
241
			NamedQuery namedQuery = findNamedQuery(node, astRoot, tokenStart);
242
			if (namedQuery != null) {
243
				return namedQuery;
244
			}
245
		}
246
247
		return null;
248
	}
249
250
	/**
251
	 * This twisted code is meant to retrieve the real string value that is not escaped and to also
252
	 * retrieve the position within the non-escaped string. The query could have escape characters,
253
	 * such as \r, \n etc being written as \\r, \\n, the position is based on that escaped string,
254
	 * the conversion will convert them into \r and \r and adjust the position accordingly.
255
	 *
256
	 * @param astRoot The parsed tree representation of the Java source file
257
	 * @param tokenStart The beginning of the query expression of the {@link javax.persistence.NamedQuery
258
	 * &#64;NamedQuery}'s query member within the source file
259
	 * @param tokenEnd The end of the query member within the source file
260
	 * @param position The position of the cursor within the query expression
261
	 * @return The actual value retrieved from the query element
262
	 */
263
	@SuppressWarnings("unchecked")
264
	private String retrieveQuery(CompilationUnit astRoot, int tokenStart, int tokenEnd) {
265
266
		// Dig into the TypeDeclarations
267
		for (AbstractTypeDeclaration type : (List<AbstractTypeDeclaration>) astRoot.types()) {
268
269
			if (isInsideNode(type, tokenStart, tokenEnd)) {
270
271
				// Dig inside its modifiers and annotations
272
				for (IExtendedModifier modifier : (List<IExtendedModifier>) type.modifiers()) {
273
274
					if (!modifier.isAnnotation()) {
275
						continue;
276
					}
277
278
					Annotation annotation = (Annotation) modifier;
279
280
					// Dig inside the annotation
281
					if (isInsideNode(annotation, tokenStart, tokenEnd)) {
282
283
						// @NamedQueries({...})
284
						if (annotation.isSingleMemberAnnotation()) {
285
							SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation) annotation;
286
							ArrayInitializer array = (ArrayInitializer) singleMemberAnnotation.getValue();
287
288
							for (org.eclipse.jdt.core.dom.Expression expression : (List<org.eclipse.jdt.core.dom.Expression>) array.expressions()) {
289
								if (isInsideNode(expression, tokenStart, tokenEnd)) {
290
									return retrieveQuery((NormalAnnotation) expression, tokenStart, tokenEnd);
291
								}
292
							}
293
						}
294
						// @NamedQuery()
295
						else if (annotation.isNormalAnnotation()) {
296
							return retrieveQuery((NormalAnnotation) annotation, tokenStart, tokenEnd);
297
						}
298
					}
299
				}
300
			}
301
		}
302
303
		return null;
304
	}
305
306
	@SuppressWarnings("unchecked")
307
	private String retrieveQuery(NormalAnnotation annotation, int tokenStart, int tokenEnd) {
308
309
		for (MemberValuePair pair : (List<MemberValuePair>) annotation.values()) {
310
			org.eclipse.jdt.core.dom.Expression expression = pair.getValue();
311
312
			if (isInsideNode(expression, tokenStart, tokenEnd)) {
313
				StringLiteral literal = (StringLiteral) pair.getValue();
314
				return literal.getEscapedValue();
315
			}
316
		}
317
318
		return null;
319
	}
320
}
(-)src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlSseCompletionProposalComputer.java (+229 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
5
 * which accompanies this distribution.
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.ui.internal.jpql;
15
16
import java.util.Collections;
17
import java.util.Iterator;
18
import java.util.List;
19
import org.eclipse.core.filebuffers.FileBuffers;
20
import org.eclipse.core.filebuffers.ITextFileBuffer;
21
import org.eclipse.core.filebuffers.ITextFileBufferManager;
22
import org.eclipse.core.resources.IFile;
23
import org.eclipse.core.resources.IWorkspaceRoot;
24
import org.eclipse.core.resources.ResourcesPlugin;
25
import org.eclipse.core.runtime.IProgressMonitor;
26
import org.eclipse.core.runtime.IStatus;
27
import org.eclipse.core.runtime.Status;
28
import org.eclipse.jface.text.contentassist.ICompletionProposal;
29
import org.eclipse.jface.text.contentassist.IContextInformation;
30
import org.eclipse.jpt.common.core.utility.TextRange;
31
import org.eclipse.jpt.common.utility.internal.StringTools;
32
import org.eclipse.jpt.jpa.core.JpaFile;
33
import org.eclipse.jpt.jpa.core.JpaStructureNode;
34
import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
35
import org.eclipse.jpt.jpa.core.context.NamedQuery;
36
import org.eclipse.jpt.jpa.core.context.PersistentType;
37
import org.eclipse.jpt.jpa.core.context.QueryContainer;
38
import org.eclipse.jpt.jpa.core.context.TypeMapping;
39
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
40
import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
41
import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
42
import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
43
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
44
import org.eclipse.persistence.jpa.jpql.ExpressionTools;
45
import org.eclipse.swt.graphics.Image;
46
import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
47
import org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer;
48
49
/**
50
 * This computer adds content assist support when it is invoked inside the &lt;query&gt; element
51
 * defined in a mapping file (ORM Configuration).
52
 *
53
 * @version 3.0
54
 * @since 3.0
55
 * @author Pascal Filion
56
 */
57
public final class JpaJpqlSseCompletionProposalComputer extends JpqlCompletionProposalComputer<ICompletionProposal>
58
                                                        implements ICompletionProposalComputer {
59
60
	/**
61
	 * Creates a new <code>JpaJpqlSseCompletionProposalComputer</code>.
62
	 */
63
	public JpaJpqlSseCompletionProposalComputer() {
64
		super();
65
	}
66
67
	/**
68
	 * {@inheritDoc}
69
	 */
70
	@Override
71
	ICompletionProposal buildProposal(String proposal,
72
	                                  String displayString,
73
	                                  String additionalInfo,
74
	                                  Image image,
75
	                                  int cursorOffset) {
76
77
		return new JpqlCompletionProposal(
78
			contentAssistItems,
79
			proposal,
80
			displayString,
81
			additionalInfo,
82
			image,
83
			namedQuery,
84
			actualQuery,
85
			jpqlQuery,
86
			offset,
87
			position,
88
			cursorOffset,
89
			true
90
		);
91
	}
92
93
	/**
94
	 * {@inheritDoc}
95
	 */
96
	public List<ICompletionProposal> computeCompletionProposals(CompletionProposalInvocationContext context,
97
	                                                            IProgressMonitor monitor) {
98
99
		monitor.beginTask(null, 100);
100
101
		try {
102
			int offset = context.getInvocationOffset();
103
			if (offset == -1) return Collections.emptyList();
104
105
			ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
106
			ITextFileBuffer buffer = manager.getTextFileBuffer(context.getDocument());
107
			if (buffer == null) return Collections.emptyList();
108
109
			IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
110
			IFile file = root.getFile(buffer.getLocation());
111
112
			JpaFile jpaFile = JptJpaCorePlugin.getJpaFile(file);
113
			if (jpaFile == null) return Collections.emptyList();
114
115
			monitor.worked(80);
116
			checkCanceled(monitor);
117
118
			// Retrieve the JPA's model object
119
			int[] position = new int[1];
120
			NamedQuery namedQuery = namedQuery(jpaFile, offset, position);
121
			if (namedQuery == null) return Collections.emptyList();
122
123
			// Keep track of the beginning of the text since the entire string is always replaced
124
			int tokenStart = offset - position[0];
125
126
			// Now create the proposals
127
			String jpqlQuery = jpqlQuery(namedQuery, position[0]);
128
			return buildProposals(namedQuery, jpqlQuery, tokenStart, position[0]);
129
		}
130
		catch (Exception e) {
131
			Status status = new Status(IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID, JptUiMessages.JpaJpqlSseCompletionProposalComputer_Error, e);
132
			JptJpaCorePlugin.log(status);
133
		}
134
		finally {
135
			monitor.done();
136
		}
137
138
		return Collections.emptyList();
139
	}
140
141
	/**
142
	 * {@inheritDoc}
143
	 */
144
	public List<IContextInformation> computeContextInformation(CompletionProposalInvocationContext context,
145
	                                                           IProgressMonitor monitor) {
146
147
		return Collections.emptyList();
148
	}
149
150
	private NamedQuery findNamedQuery(JpaStructureNode structureNode, int offset, int[] position) {
151
152
		if (structureNode instanceof EntityMappings) {
153
			EntityMappings entityMappings = (EntityMappings) structureNode;
154
155
			// First look into the global queries
156
			NamedQuery query = findNamedQuery(entityMappings.getQueryContainer(), offset, position);
157
158
			// Now traverse each entity
159
			if (query != null) {
160
				return query;
161
			}
162
163
			for (PersistentType persistentType : entityMappings.getPersistentTypes()) {
164
				TypeMapping typeMapping = persistentType.getMapping();
165
166
				if (typeMapping instanceof OrmEntity) {
167
					query = findNamedQuery(((OrmEntity) typeMapping).getQueryContainer(), offset, position);
168
169
					if (query != null) {
170
						return query;
171
					}
172
				}
173
			}
174
		}
175
176
		return null;
177
	}
178
179
	private NamedQuery findNamedQuery(QueryContainer container, int offset, int[] position) {
180
181
		for (Iterator<OrmNamedQuery> queries = container.namedQueries(); queries.hasNext(); ) {
182
			OrmNamedQuery namedQuery = queries.next();
183
			TextRange textRange = namedQuery.getQueryTextRange();
184
185
			if (textRange.touches(offset)) {
186
				position[0] = offset - textRange.getOffset();
187
				return namedQuery;
188
			}
189
		}
190
191
		return null;
192
	}
193
194
	private String jpqlQuery(NamedQuery namedQuery, int position) {
195
196
		String query = namedQuery.getQuery();
197
198
		if (query == null) {
199
			query = StringTools.EMPTY_STRING;
200
		}
201
202
		// The NamedQuery's query does not have the trailing whitespace, add them
203
		if (query.length() < position) {
204
			query = StringTools.pad(query, position, ' ');
205
		}
206
207
		return query;
208
	}
209
210
	/**
211
	 * {@inheritDoc}
212
	 */
213
	@Override
214
	String modifyJpqlQuery(String jpqlQuery, int[] position) {
215
		return ExpressionTools.unescape(jpqlQuery, position);
216
	}
217
218
	private NamedQuery namedQuery(JpaFile jpaFile, int offset, int[] position) {
219
220
		for (JpaStructureNode node : jpaFile.getRootStructureNodes()) {
221
			NamedQuery namedQuery = findNamedQuery(node, offset, position);
222
			if (namedQuery != null) {
223
				return namedQuery;
224
			}
225
		}
226
227
		return null;
228
	}
229
}
(-)src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposal.java (+158 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
5
 * which accompanies this distribution.
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.ui.internal.jpql;
15
16
import org.eclipse.jdt.core.IJavaProject;
17
import org.eclipse.jdt.ui.PreferenceConstants;
18
import org.eclipse.jface.text.BadLocationException;
19
import org.eclipse.jface.text.IDocument;
20
import org.eclipse.jface.text.contentassist.ICompletionProposal;
21
import org.eclipse.jface.text.contentassist.IContextInformation;
22
import org.eclipse.jpt.jpa.core.context.NamedQuery;
23
import org.eclipse.persistence.jpa.jpql.ContentAssistItems;
24
import org.eclipse.persistence.jpa.jpql.ResultQuery;
25
import org.eclipse.swt.graphics.Image;
26
import org.eclipse.swt.graphics.Point;
27
28
/**
29
 * The concrete implementation of a {@link org.eclipse.jface.text.contentassist.ICompletionProposal
30
 * ICompletionProposal} that adds relevance and toggling the completion insertion property behavior.
31
 *
32
 * @version 3.0
33
 * @since 3.0
34
 * @author Pascal Filion
35
 */
36
final class JpqlCompletionProposal implements ICompletionProposal {
37
38
	private String actualQuery;
39
	private String additionalInfo;
40
	private ContentAssistItems contentAssistItems;
41
	private int cursorOffset;
42
	private String displayString;
43
	private boolean escapeCharacters;
44
	private Image image;
45
	private String jpqlQuery;
46
	private NamedQuery namedQuery;
47
	private int offset;
48
	private int position;
49
	private String proposal;
50
	private ResultQuery result;
51
	private boolean toggleCompletion;
52
53
	JpqlCompletionProposal(ContentAssistItems contentAssistItems,
54
	                       String proposal,
55
	                       String displayString,
56
	                       String additionalInfo,
57
	                       Image image,
58
	                       NamedQuery namedQuery,
59
	                       String actualQuery,
60
	                       String jpqlQuery,
61
	                       int offset,
62
	                       int position,
63
	                       int cursorOffset,
64
	                       boolean escapeCharacters) {
65
66
		super();
67
68
		this.image              = image;
69
		this.offset             = offset;
70
		this.position           = position;
71
		this.proposal           = proposal;
72
		this.jpqlQuery          = jpqlQuery;
73
		this.namedQuery         = namedQuery;
74
		this.actualQuery        = actualQuery;
75
		this.cursorOffset       = cursorOffset;
76
		this.displayString      = displayString;
77
		this.additionalInfo     = additionalInfo;
78
		this.escapeCharacters   = escapeCharacters;
79
		this.contentAssistItems = contentAssistItems;
80
	}
81
82
	/**
83
	 * {@inheritDoc}
84
	 */
85
	public void apply(IDocument document) {
86
		try {
87
			ResultQuery result = buildResult();
88
			document.replace(offset, actualQuery.length(), result.getQuery());
89
		}
90
		catch (BadLocationException e) {
91
			// Ignore
92
		}
93
	}
94
95
	private ResultQuery buildResult() {
96
		if (result == null) {
97
			if (escapeCharacters) {
98
				result = contentAssistItems.buildEscapedQuery(
99
					jpqlQuery,
100
					proposal,
101
					position,
102
					isCompletionInserts() ^ toggleCompletion
103
				);
104
			}
105
			else {
106
				result = contentAssistItems.buildQuery(
107
					jpqlQuery,
108
					proposal,
109
					position,
110
					isCompletionInserts() ^ toggleCompletion
111
				);
112
			}
113
		}
114
		return result;
115
	}
116
117
	/**
118
	 * {@inheritDoc}
119
	 */
120
	public String getAdditionalProposalInfo() {
121
		return additionalInfo;
122
	}
123
124
	/**
125
	 * {@inheritDoc}
126
	 */
127
	public IContextInformation getContextInformation() {
128
		return null; // Not needed, this is legacy API
129
	}
130
131
	/**
132
	 * {@inheritDoc}
133
	 */
134
	public String getDisplayString() {
135
		return displayString;
136
	}
137
138
	/**
139
	 * {@inheritDoc}
140
	 */
141
	public Image getImage() {
142
		return image;
143
	}
144
145
	/**
146
	 * {@inheritDoc}
147
	 */
148
	public Point getSelection(IDocument document) {
149
		ResultQuery result = buildResult();
150
		return new Point(offset + result.getPosition() + cursorOffset, 0);
151
	}
152
153
	private boolean isCompletionInserts() {
154
		IJavaProject javaProject = namedQuery.getJpaProject().getJavaProject();
155
		String value = PreferenceConstants.getPreference(PreferenceConstants.CODEASSIST_INSERT_COMPLETION, javaProject);
156
		return Boolean.valueOf(value);
157
	}
158
}
(-)src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java (+392 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
5
 * which accompanies this distribution.
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.ui.internal.jpql;
15
16
import java.util.ArrayList;
17
import java.util.Comparator;
18
import java.util.List;
19
import org.eclipse.core.runtime.IProgressMonitor;
20
import org.eclipse.jface.resource.ImageDescriptor;
21
import org.eclipse.jface.resource.ImageRegistry;
22
import org.eclipse.jpt.common.utility.internal.CollectionTools;
23
import org.eclipse.jpt.jpa.core.context.NamedQuery;
24
import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
25
import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
26
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
27
import org.eclipse.persistence.jpa.internal.jpql.parser.Expression;
28
import org.eclipse.persistence.jpa.internal.jpql.parser.IdentifierRole;
29
import org.eclipse.persistence.jpa.internal.jpql.parser.JPQLExpression;
30
import org.eclipse.persistence.jpa.jpql.ContentAssistItems;
31
import org.eclipse.persistence.jpa.jpql.spi.IEntity;
32
import org.eclipse.persistence.jpa.jpql.spi.IMapping;
33
import org.eclipse.swt.graphics.Image;
34
import org.eclipse.swt.widgets.Display;
35
36
import static org.eclipse.jpt.common.utility.internal.CollectionTools.*;
37
38
/**
39
 * The abstract definition of JPQL content assist support.
40
 *
41
 * @version 3.0
42
 * @since 3.0
43
 * @author Pascal Filion
44
 */
45
@SuppressWarnings({"nls", "restriction"})
46
abstract class JpqlCompletionProposalComputer<T> {
47
48
	/**
49
	 * The current value of the query element.
50
	 */
51
	String actualQuery;
52
53
	/**
54
	 * The provider of content assist items based on the position of the cursor within the JPQL query.
55
	 */
56
	ContentAssistItems contentAssistItems;
57
58
	/**
59
	 * The local registry containing the images used to display the possible proposals. The registry is
60
	 * disposed when the session ended.
61
	 */
62
	private ImageRegistry imageRegistry;
63
64
	/**
65
	 * The same value as {@link #actualQuery} or the modified query that was used by the Hermes parser.
66
	 */
67
	String jpqlQuery;
68
69
	/**
70
	 * The JPA model object that is used to access the Java project.
71
	 */
72
	NamedQuery namedQuery;
73
74
	/**
75
	 * The start position of the query within the document.
76
	 */
77
	int offset;
78
79
	/**
80
	 * The position of the cursor within {@link #actualQuery}.
81
	 */
82
	int position;
83
84
	/**
85
	 * This helper is responsible to retrieve the possible proposals to complete or to add more
86
	 * information to a JPQL based on the position of the cursor.
87
	 */
88
	JpaJpqlQueryHelper queryHelper;
89
90
	/**
91
	 * Creates a new <code>JpqlCompletionProposalComputer</code>.
92
	 */
93
	public JpqlCompletionProposalComputer() {
94
		super();
95
	}
96
97
	/**
98
	 * Adds completion proposals for the abstract schema names that are possible proposals.
99
	 *
100
	 * @param proposals The list used to store the new completion proposals
101
	 */
102
	private void addAbstractSchemaNames(List<T> proposals) {
103
		for (IEntity abstractSchemaType : sortByNames(contentAssistItems.abstractSchemaTypes())) {
104
			proposals.add(buildAbstractSchemaNameProposal(abstractSchemaType));
105
		}
106
	}
107
108
	/**
109
	 * Adds completion proposals for the identification variables that are possible proposals.
110
	 *
111
	 * @param proposals The list used to store the new completion proposals
112
	 */
113
	private void addIdentificationVariables(List<T> proposals) {
114
		for (String variable : sort(contentAssistItems.identificationVariables())) {
115
			proposals.add(buildIdentificationVariableProposal(variable));
116
		}
117
	}
118
119
	/**
120
	 * Adds completion proposals for the JPQL identifiers that are possible proposals.
121
	 *
122
	 * @param proposals The list used to store the new completion proposals
123
	 */
124
	private void addIdentifiers(List<T> proposals) {
125
		for (String identifier : sort(contentAssistItems.identifiers())) {
126
			proposals.add(buildIdentifierProposal(identifier));
127
		}
128
	}
129
130
	private String additionalInfo(String proposal) {
131
		return JpqlIdentifierMessages.localizedMessage(proposal);
132
	}
133
134
	/**
135
	 * Adds completion proposals for the state fields and association fields that are possible proposals.
136
	 *
137
	 * @param proposals The list used to store the new completion proposals
138
	 */
139
	private void addMappings(List<T> proposals) {
140
		for (IMapping mapping : sort(contentAssistItems.mappings())) {
141
			proposals.add(buildMappingProposal(mapping));
142
		}
143
	}
144
145
	private T buildAbstractSchemaNameProposal(IEntity abstractSchemaType) {
146
		String proposal = abstractSchemaType.getName();
147
		return buildProposal(proposal, proposal, entityImage());
148
	}
149
150
	private Comparator<IEntity> buildEntityNameComparator() {
151
		return new Comparator<IEntity>() {
152
			public int compare(IEntity entity1, IEntity entity2) {
153
				return entity1.getName().compareTo(entity2.getName());
154
			}
155
		};
156
	}
157
158
	private String buildIdentificationVariableDisplayString(String identificationVariable) {
159
160
		IEntity abstractSchemaType = contentAssistItems.getAbstractSchemaType(identificationVariable);
161
162
		if (abstractSchemaType != null) {
163
			StringBuilder sb = new StringBuilder();
164
			sb.append(identificationVariable);
165
			sb.append(" : ");
166
			sb.append(abstractSchemaType.getName());
167
			identificationVariable = sb.toString();
168
		}
169
170
		return identificationVariable;
171
	}
172
173
	private T buildIdentificationVariableProposal(String proposal) {
174
		return buildProposal(
175
			proposal,
176
			buildIdentificationVariableDisplayString(proposal),
177
			identificationVariableImage()
178
		);
179
	}
180
181
	private T buildIdentifierProposal(String proposal) {
182
183
		String additionalInfo = additionalInfo(proposal);
184
		IdentifierRole role = JPQLExpression.identifierRole(proposal);
185
		boolean realFunction = (role == IdentifierRole.FUNCTION) && isRealFunction(proposal);
186
		int cursorOffset = 0;
187
188
		// For JPQL function, we add () to the display string, example: AVG()
189
		// But for TRUE, FALSE, etc, we don't add ()
190
		if (realFunction) {
191
			proposal += "()";
192
			cursorOffset--;
193
		}
194
195
		return buildProposal(
196
			proposal,
197
			proposal,
198
			additionalInfo,
199
			identifierImage(realFunction),
200
			cursorOffset
201
		);
202
	}
203
204
	private T buildMappingProposal(IMapping mapping) {
205
		String proposal = mapping.getName();
206
		return buildProposal(proposal, proposal, mappingImage(mapping));
207
	}
208
209
	private T buildProposal(String proposal, String displayString, Image image) {
210
		return buildProposal(proposal, displayString, null, image, 0);
211
	}
212
213
	/**
214
	 * Creates a new completion proposal for the given proposal.
215
	 *
216
	 * @param proposal A valid proposal that can be inserted into the query
217
	 * @param displayString The human readable string of the proposal
218
	 * @param additionalInfo Optional additional information about the proposal. The additional
219
	 * information will be presented to assist the user in deciding if the selected proposal is the
220
	 * desired choice
221
	 * @param image The image that represents the proposal
222
	 * @param cursorOffset An offset that moves the cursor backward or forward after it is adjusted
223
	 * based on the given proposal
224
	 * @return The completion proposal
225
	 */
226
	abstract T buildProposal(String proposal,
227
	                         String displayString,
228
	                         String additionalInfo,
229
	                         Image image,
230
	                         int cursorOffset);
231
232
	/**
233
	 * Creates the list of completion proposals based on the current content of the JPQL query and at
234
	 * the specified position.
235
	 *
236
	 * @param namedQuery The model object used to access the application metadata information
237
	 * @param actualQuery The model object may sometimes be out of sync with the actual content, the
238
	 * actual query is required for proper content assist
239
	 * @param offset The beginning of the string within the document
240
	 * @param position The position of the cursor within the query, which starts at the beginning of
241
	 * that query and not the document
242
	 * @return The list of completion proposals
243
	 */
244
	final List<T> buildProposals(NamedQuery namedQuery, String actualQuery, int offset, int position) {
245
246
		this.offset      = offset;
247
		this.actualQuery = actualQuery;
248
		this.namedQuery  = namedQuery;
249
250
		// It's possible the string has literal representation of the escape characters, if required,
251
		// convert them into actual escape characters and adjust the position accordingly
252
		int[] positions = { position };
253
		this.jpqlQuery  = modifyJpqlQuery(actualQuery, positions);
254
		this.position   = positions[0];
255
256
		// Gather the possible proposals
257
		this.queryHelper        = new JpaJpqlQueryHelper(namedQuery, jpqlQuery);
258
		this.contentAssistItems = queryHelper.buildContentAssistItems(positions[0]);
259
260
		// Create the proposals for those proposals
261
		List<T> proposals = new ArrayList<T>();
262
		addAbstractSchemaNames    (proposals);
263
		addIdentificationVariables(proposals);
264
		addIdentifiers            (proposals);
265
		addMappings               (proposals);
266
267
		return proposals;
268
	}
269
270
	final void checkCanceled(IProgressMonitor monitor) throws InterruptedException {
271
		if (monitor.isCanceled()) {
272
			throw new InterruptedException();
273
		}
274
	}
275
276
	private Image entityImage() {
277
		return getImage(JptUiIcons.ENTITY);
278
	}
279
280
	/**
281
	 * Returns the reason why this computer was unable to produce any completion proposals or
282
	 * context information.
283
	 *
284
	 * @return An error message or <code>null</code> if no error occurred
285
	 */
286
	public String getErrorMessage() {
287
		return null;
288
	}
289
290
	private Image getImage(String key) {
291
		ImageRegistry imageRegistry = getImageRegistry();
292
		Image image = imageRegistry.get(key);
293
		if (image == null) {
294
			imageRegistry.put(key, getImageDescriptor(key));
295
			image = imageRegistry.get(key);
296
		}
297
		return image;
298
	}
299
300
	private ImageDescriptor getImageDescriptor(String key) {
301
		return JptJpaUiPlugin.getImageDescriptor(key);
302
	}
303
304
	private ImageRegistry getImageRegistry() {
305
		if (imageRegistry == null) {
306
			imageRegistry = new ImageRegistry(Display.getCurrent());
307
		}
308
		return imageRegistry;
309
	}
310
311
	private Image identificationVariableImage() {
312
		return getImage(JptUiIcons.JPQL_VARIABLE);
313
	}
314
315
	private Image identifierImage(boolean function) {
316
317
		if (function) {
318
			return getImage(JptUiIcons.JPQL_FUNCTION);
319
		}
320
321
		return getImage(JptUiIcons.JPQL_IDENTIFIER);
322
	}
323
324
	private boolean isRealFunction(String identifier) {
325
		return identifier != Expression.TRUE         &&
326
		       identifier != Expression.FALSE        &&
327
		       identifier != Expression.NULL         &&
328
		       identifier != Expression.CURRENT_DATE &&
329
		       identifier != Expression.CURRENT_TIME &&
330
		       identifier != Expression.CURRENT_TIMESTAMP;
331
	}
332
333
	private Image mappingImage(IMapping mapping) {
334
		switch (mapping.getMappingType()) {
335
			case BASIC:               return getImage(JptUiIcons.BASIC);
336
			case BASIC_COLLECTION:    return getImage(JptUiIcons.ELEMENT_COLLECTION);
337
			case BASIC_MAP:           return getImage(JptUiIcons.ELEMENT_COLLECTION);
338
			case ELEMENT_COLLECTION:  return getImage(JptUiIcons.ELEMENT_COLLECTION);
339
			case EMBEDDED:            return getImage(JptUiIcons.EMBEDDED);
340
			case EMBEDDED_ID:         return getImage(JptUiIcons.EMBEDDED_ID);
341
			case ID:                  return getImage(JptUiIcons.ID);
342
			case MANY_TO_MANY:        return getImage(JptUiIcons.MANY_TO_MANY);
343
			case MANY_TO_ONE:         return getImage(JptUiIcons.MANY_TO_ONE);
344
			case ONE_TO_MANY:         return getImage(JptUiIcons.ONE_TO_MANY);
345
			case ONE_TO_ONE:          return getImage(JptUiIcons.ONE_TO_ONE);
346
			case TRANSFORMATION:      return getImage(JptUiIcons.BASIC);      // TODO
347
			case VARIABLE_ONE_TO_ONE: return getImage(JptUiIcons.ONE_TO_ONE); // TODO
348
			case VERSION:             return getImage(JptUiIcons.VERSION);
349
			default:                  return getImage(JptUiIcons.TRANSIENT);
350
		}
351
	}
352
353
	/**
354
	 * In some context, the given JPQL query needs to be modified before it is parsed.
355
	 *
356
	 * @param jpqlQuery The JPQL query to keep unchanged or to modify before parsing it
357
	 * @param position The position of the cursor within the JPQL query, which needs to be updated if
358
	 * the query is modified
359
	 * @return The given JPQL query or a modified version that will be parsed
360
	 */
361
	String modifyJpqlQuery(String jpqlQuery, int[] position) {
362
		return jpqlQuery;
363
	}
364
365
	/**
366
	 * Informs the computer that a content assist session has ended.
367
	 */
368
	public void sessionEnded() {
369
370
		offset             = -1;
371
		position           = -1;
372
		namedQuery         = null;
373
		actualQuery        = null;
374
		queryHelper        = null;
375
		contentAssistItems = null;
376
377
		if (imageRegistry != null) {
378
			imageRegistry.dispose();
379
		}
380
	}
381
382
	/**
383
	 * Informs the computer that a content assist session has started.
384
	 */
385
	public void sessionStarted() {
386
		// Nothing to do
387
	}
388
389
	private Iterable<IEntity> sortByNames(Iterable<IEntity> abstractSchemaTypes) {
390
		return CollectionTools.sort(abstractSchemaTypes, buildEntityNameComparator());
391
	}
392
}
(-)src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlIdentifierMessages.java (+186 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
5
 * which accompanies this distribution.
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.ui.internal.jpql;
15
16
import java.lang.reflect.Field;
17
import java.util.HashMap;
18
import java.util.Map;
19
import org.eclipse.osgi.util.NLS;
20
import org.eclipse.persistence.jpa.internal.jpql.parser.Expression;
21
22
/**
23
 * The localized messages describing the JPQL identifiers.
24
 *
25
 * @version 3.0
26
 * @since 3.0
27
 * @author Pascal Filion
28
 */
29
@SuppressWarnings({"nls", "restriction"})
30
final class JpqlIdentifierMessages extends NLS {
31
32
	// JPA 1.0 identifiers
33
	public static String ABS;
34
	public static String ALL;
35
	public static String ANY;
36
	public static String ASC;
37
	public static String AVG;
38
	public static String BETWEEN;
39
	public static String BOTH;
40
	public static String CONCAT;
41
	public static String COUNT;
42
	public static String CURRENT_DATE;
43
	public static String CURRENT_TIME;
44
	public static String CURRENT_TIMESTAMP;
45
	public static String DELETE_FROM;
46
	public static String DESC;
47
	public static String DISTINCT;
48
	public static String ESCAPE;
49
	public static String EXISTS;
50
	public static String FROM;
51
	public static String GROUP_BY;
52
	public static String HAVING;
53
	public static String IN;
54
	public static String IS_EMPTY;
55
	public static String IS_NULL;
56
	public static String JOIN;
57
	public static String JOIN_FETCH;
58
	public static String LEADING;
59
	public static String LENGTH;
60
	public static String LIKE;
61
	public static String LOCATE;
62
	public static String LOWER;
63
	public static String MAX;
64
	public static String MEMBER;
65
	public static String MIN;
66
	public static String MOD;
67
	public static String NEW;
68
	public static String OBJECT;
69
	public static String ORDER_BY;
70
	public static String SELECT;
71
	public static String SIZE;
72
	public static String SOME;
73
	public static String SQRT;
74
	public static String SUBSTRING;
75
	public static String SUM;
76
	public static String TRAILING;
77
	public static String TRIM;
78
	public static String UPDATE;
79
	public static String UPPER;
80
	public static String WHERE;
81
82
	// JPA 2.0 identifiers
83
//	public static String CASE;
84
	public static String COALESCE;
85
//	public static String ENTRY;
86
	public static String INDEX;
87
//	public static String KEY;
88
	public static String NULLIF;
89
	public static String TYPE;
90
//	public static String VALUE;
91
92
	// EclipseLink identifiers
93
//	public static String FUNC;
94
//	public static String TREAT;
95
96
	// Reserved JPQL identifiers
97
	public static String BIT_LENGTH;
98
	public static String CHAR_LENGTH;
99
	public static String CHARACTER_LENGTH;
100
	public static String CLASS;
101
	public static String POSITION;
102
	public static String UNKNOWN;
103
104
	static {
105
		NLS.initializeMessages("jpt_ui_jpql_identifiers", JpqlIdentifierMessages.class);
106
	}
107
108
	JpqlIdentifierMessages() {
109
		super();
110
		throw new UnsupportedOperationException();
111
	}
112
113
	private static Map<String, String> registeredIdentifers;
114
115
	private static Map<String, String> buildRegisteredIdentifers() {
116
117
		Map<String, String> identifiers = new HashMap<String, String>();
118
119
		identifiers.put(Expression.IS_NOT_EMPTY,  Expression.IS_EMPTY);
120
		identifiers.put(Expression.IS_NOT_NULL,   Expression.IS_NULL);
121
		identifiers.put(Expression.MEMBER_OF,     Expression.MEMBER);
122
		identifiers.put(Expression.NOT_IN,        Expression.IN);
123
		identifiers.put(Expression.NOT_BETWEEN,   Expression.BETWEEN);
124
		identifiers.put(Expression.NOT_MEMBER,    Expression.MEMBER);
125
		identifiers.put(Expression.NOT_MEMBER_OF, Expression.MEMBER);
126
127
		identifiers.put(Expression.INNER_JOIN,      Expression.JOIN);
128
		identifiers.put(Expression.LEFT_JOIN,       Expression.JOIN);
129
		identifiers.put(Expression.LEFT_OUTER_JOIN, Expression.JOIN);
130
131
		identifiers.put(Expression.INNER_JOIN_FETCH,      Expression.JOIN_FETCH);
132
		identifiers.put(Expression.LEFT_JOIN_FETCH,       Expression.JOIN_FETCH);
133
		identifiers.put(Expression.LEFT_OUTER_JOIN_FETCH, Expression.JOIN_FETCH);
134
135
		return identifiers;
136
	}
137
138
	/**
139
	 * Converts the given JPQL identifier to the shortest form that is used to map the localized
140
	 * message. If the identifier is <b>NOT MEMBER</b> for instance, then it needs to be converted
141
	 * to <b>MEMBER</b> since that's the identifier used to map the localize message.
142
	 *
143
	 * @param identifier The JPQL identifier to convert, if needed
144
	 * @return Either the given JPQL identifier or its counterpart that is used to map the localized
145
	 * message
146
	 */
147
	private static String convertIdentifier(String identifier) {
148
		identifier = registeredIdentifer(identifier);
149
		identifier = identifier.replace(" ", "_");
150
		return identifier;
151
	}
152
153
	/**
154
	 * Retrieves the localized message for the given string value, if it's a JPQL identifier.
155
	 *
156
	 * @param identifier The JPQL identifier for which its localized description is needed
157
	 * @return The localized message describing the given JPQL identifier or <code>null</code> if the
158
	 * given choice is not an identifier
159
	 */
160
	static String localizedMessage(String identifier) {
161
		try {
162
			identifier = convertIdentifier(identifier);
163
			Field constant = JpqlIdentifierMessages.class.getField(identifier);
164
			return (String) constant.get(null);
165
		}
166
		catch (Exception e) {
167
			// The choice is not a JPQL identifier
168
			return null;
169
		}
170
	}
171
172
	private static String registeredIdentifer(String identifier) {
173
		String another = registeredIdentifers().get(identifier);
174
		if (another != null) {
175
			return another;
176
		}
177
		return identifier;
178
	}
179
180
	private static Map<String, String> registeredIdentifers() {
181
		if (registeredIdentifers == null) {
182
			registeredIdentifers = buildRegisteredIdentifers();
183
		}
184
		return registeredIdentifers;
185
	}
186
}
(-)src/org/eclipse/jpt/jpa/ui/internal/jpql/TextTransferHandler.java (+228 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
5
 * which accompanies this distribution.
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation
12
 *
13
 ******************************************************************************/
14
package org.eclipse.jpt.jpa.ui.internal.jpql;
15
16
import org.eclipse.jface.text.IUndoManager;
17
import org.eclipse.jpt.common.utility.internal.StringTools;
18
import org.eclipse.swt.SWT;
19
import org.eclipse.swt.custom.StyledText;
20
import org.eclipse.swt.dnd.Clipboard;
21
import org.eclipse.swt.dnd.TextTransfer;
22
import org.eclipse.swt.dnd.TransferData;
23
import org.eclipse.swt.events.MenuEvent;
24
import org.eclipse.swt.events.MenuListener;
25
import org.eclipse.swt.events.SelectionAdapter;
26
import org.eclipse.swt.events.SelectionEvent;
27
import org.eclipse.swt.events.SelectionListener;
28
import org.eclipse.swt.graphics.Point;
29
import org.eclipse.swt.widgets.Menu;
30
import org.eclipse.swt.widgets.MenuItem;
31
import org.eclipse.ui.internal.WorkbenchMessages;
32
33
/**
34
 * This handler adds a context menu onto a {@link StyledText} which have the default actions dealing
35
 * with text editing: Undo | Cut, Copy, Paste, Delete | Select All.
36
 *
37
 * @version 3.0
38
 * @since 3.0
39
 * @author Pascal Filion
40
 */
41
@SuppressWarnings("restriction")
42
public final class TextTransferHandler {
43
44
	private MenuItem copyMenuItem;
45
	private MenuItem cutMenuItem;
46
	private MenuItem deleteMenuItem;
47
	private MenuItem pasteMenuItem;
48
	private Menu popup;
49
	private MenuItem selectAllMenuItem;
50
	private StyledText styledText;
51
	private IUndoManager undoManager;
52
	private MenuItem undoMenuItem;
53
54
	private TextTransferHandler(StyledText styledText, IUndoManager undoManager) {
55
		super();
56
		this.styledText  = styledText;
57
		this.undoManager = undoManager;
58
	}
59
60
	/**
61
	 * Installs a context menu onto the given {@link StyledText} which have the default actions
62
	 * dealing with text editing: Undo | Cut, Copy, Paste, Delete | Select All.
63
	 *
64
	 * @param styledText The widget for which a context menu will be added
65
	 * @param undoManager The manager to undo keystrokes
66
	 */
67
	public static void installContextMenu(StyledText styledText, IUndoManager undoManager) {
68
		TextTransferHandler handler = new TextTransferHandler(styledText, undoManager);
69
		handler.installPopup();
70
	}
71
72
	private SelectionAdapter buildCopySelectionListener() {
73
		return new SelectionAdapter() {
74
			@Override
75
			public void widgetSelected(SelectionEvent e) {
76
				styledText.copy();
77
			}
78
		};
79
	}
80
81
	private SelectionListener buildCutSelectionListener() {
82
		return new SelectionAdapter() {
83
			@Override
84
			public void widgetSelected(SelectionEvent e) {
85
				styledText.cut();
86
			}
87
		};
88
	}
89
90
	private SelectionListener buildDeleteSelectionListener() {
91
		return new SelectionAdapter() {
92
			@Override
93
			public void widgetSelected(SelectionEvent e) {
94
				Point selection = styledText.getSelection();
95
				styledText.replaceTextRange(selection.x, selection.y - selection.x, StringTools.EMPTY_STRING);
96
			}
97
		};
98
	}
99
100
	private MenuListener buildMenuListener() {
101
		return new MenuListener() {
102
			public void menuHidden(MenuEvent e) {
103
			}
104
			public void menuShown(MenuEvent e) {
105
				update();
106
			}
107
		};
108
	}
109
110
	private SelectionListener buildPasteSelectionListener() {
111
		return new SelectionAdapter() {
112
			@Override
113
			public void widgetSelected(SelectionEvent e) {
114
				styledText.paste();
115
			}
116
		};
117
	}
118
119
	private SelectionListener buildSelectAllSelectionListener() {
120
		return new SelectionAdapter() {
121
			@Override
122
			public void widgetSelected(SelectionEvent e) {
123
				styledText.selectAll();
124
			}
125
		};
126
	}
127
128
	private SelectionListener buildUndoSelectionListener() {
129
		return new SelectionAdapter() {
130
			@Override
131
			public void widgetSelected(SelectionEvent e) {
132
				undoManager.undo();
133
			}
134
		};
135
	}
136
137
	private boolean canCopy() {
138
		Point selection = styledText.getSelection();
139
		return selection.x != selection.y;
140
	}
141
142
	private boolean canCut() {
143
		Point selection = styledText.getSelection();
144
		return selection.x != selection.y;
145
	}
146
147
	private boolean canDelete() {
148
		Point selection = styledText.getSelection();
149
		return selection.x != selection.y;
150
	}
151
152
	private boolean canPaste() {
153
154
		Clipboard clipboard = new Clipboard(styledText.getDisplay());
155
		boolean canPaste = false;
156
157
		for (TransferData data : clipboard.getAvailableTypes()) {
158
			if (TextTransfer.getInstance().isSupportedType(data)) {
159
				canPaste = true;
160
				break;
161
			}
162
		}
163
164
		clipboard.dispose();
165
		return canPaste;
166
	}
167
168
	private boolean canSelectAll() {
169
		Point selection = styledText.getSelection();
170
		String text = styledText.getText();
171
		return (selection.y - selection.x) != text.length();
172
	}
173
174
	private void installPopup() {
175
176
		popup = new Menu(styledText.getShell(), SWT.POP_UP);
177
		popup.addMenuListener(buildMenuListener());
178
		styledText.setMenu(popup);
179
180
		populatePopup();
181
	}
182
183
	private void populatePopup() {
184
185
		// Undo
186
		undoMenuItem = new MenuItem(popup, SWT.PUSH);
187
		undoMenuItem.setText(WorkbenchMessages.Workbench_undo);
188
		undoMenuItem.addSelectionListener(buildUndoSelectionListener());
189
190
		new MenuItem(popup, SWT.SEPARATOR);
191
192
		// Cut
193
		cutMenuItem = new MenuItem(popup, SWT.PUSH);
194
		cutMenuItem.setText(WorkbenchMessages.Workbench_cut);
195
		cutMenuItem.addSelectionListener(buildCutSelectionListener());
196
197
		// Copy
198
		copyMenuItem = new MenuItem(popup, SWT.PUSH);
199
		copyMenuItem.setText(WorkbenchMessages.Workbench_copy);
200
		copyMenuItem.addSelectionListener(buildCopySelectionListener());
201
202
		// Paste
203
		pasteMenuItem = new MenuItem(popup, SWT.PUSH);
204
		pasteMenuItem.setText(WorkbenchMessages.Workbench_paste);
205
		pasteMenuItem.addSelectionListener(buildPasteSelectionListener());
206
207
		// Delete
208
		deleteMenuItem = new MenuItem(popup, SWT.PUSH);
209
		deleteMenuItem.setText(WorkbenchMessages.Workbench_delete);
210
		deleteMenuItem.addSelectionListener(buildDeleteSelectionListener());
211
212
		new MenuItem(popup, SWT.SEPARATOR);
213
214
		// Select All
215
		selectAllMenuItem = new MenuItem(popup, SWT.PUSH);
216
		selectAllMenuItem.setText(WorkbenchMessages.Workbench_selectAll);
217
		selectAllMenuItem.addSelectionListener(buildSelectAllSelectionListener());
218
	}
219
220
	private void update() {
221
		deleteMenuItem   .setEnabled(canDelete());
222
		copyMenuItem     .setEnabled(canCopy());
223
		cutMenuItem      .setEnabled(canCut());
224
		pasteMenuItem    .setEnabled(canPaste());
225
		selectAllMenuItem.setEnabled(canSelectAll());
226
		undoMenuItem     .setEnabled(undoManager.undoable());
227
	}
228
}
(-)src/org/eclipse/jpt/jpa/ui/internal/preferences/JpaProblemSeveritiesPage.java (-21 / +22 lines)
Lines 73-85 Link Here
73
73
74
	/**
74
	/**
75
	 * Default severity levels are stored here,  ERROR is the default default so only need
75
	 * Default severity levels are stored here,  ERROR is the default default so only need
76
	 * to include WARNING, INFO, IGNORE in this Map. These will be displayed if neither the project 
76
	 * to include WARNING, INFO, IGNORE in this Map. These will be displayed if neither the project
77
	 * or workspace preference applies.
77
	 * or workspace preference applies.
78
	 * <br> key is the preferenceKey which is also the validation message key @see JpaValidationMessages.
78
	 * <br> key is the preferenceKey which is also the validation message key @see JpaValidationMessages.
79
	 * <br> value is a severity level - @see JpaValidationPreferences#ERROR WARNING INFO IGNORE
79
	 * <br> value is a severity level - @see JpaValidationPreferences#ERROR WARNING INFO IGNORE
80
	 */
80
	 */
81
	private Map<String, String> defaultSeverities;
81
	private Map<String, String> defaultSeverities;
82
	
82
83
	/**
83
	/**
84
	 * The list of <code>Combo</code>s is cached in order to perform a revert of
84
	 * The list of <code>Combo</code>s is cached in order to perform a revert of
85
	 * the properties.
85
	 * the properties.
Lines 335-341 Link Here
335
	private void addAttributeLevelCategory(Composite parent) {
335
	private void addAttributeLevelCategory(Composite parent) {
336
336
337
		parent = addExpandableSection(parent, JptUiValidationPreferenceMessages.ATTRIBUTE_LEVEL_CATEGORY);
337
		parent = addExpandableSection(parent, JptUiValidationPreferenceMessages.ATTRIBUTE_LEVEL_CATEGORY);
338
		
338
339
		addLabeledCombo(
339
		addLabeledCombo(
340
			parent, JptUiValidationPreferenceMessages.PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME,
340
			parent, JptUiValidationPreferenceMessages.PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME,
341
			JpaValidationMessages.PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME);
341
			JpaValidationMessages.PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME);
Lines 395-401 Link Here
395
			JpaValidationMessages.ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED);
395
			JpaValidationMessages.ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED);
396
396
397
		parent = addSubExpandableSection(parent, JptUiValidationPreferenceMessages.IMPLIED_ATTRIBUTE_LEVEL_CATEGORY);
397
		parent = addSubExpandableSection(parent, JptUiValidationPreferenceMessages.IMPLIED_ATTRIBUTE_LEVEL_CATEGORY);
398
		
398
399
		addLabeledCombo(
399
		addLabeledCombo(
400
			parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY,
400
			parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY,
401
			JpaValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY);
401
			JpaValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY);
Lines 410-416 Link Here
410
			JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE);
410
			JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE);
411
		addLabeledCombo(
411
		addLabeledCombo(
412
			parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED,
412
			parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED,
413
			JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED);	
413
			JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED);
414
	}
414
	}
415
415
416
	private void addDatabaseCategory(Composite parent) {
416
	private void addDatabaseCategory(Composite parent) {
Lines 423-431 Link Here
423
	}
423
	}
424
424
425
	private void addTableCategory(Composite parent) {
425
	private void addTableCategory(Composite parent) {
426
		
426
427
		parent = addExpandableSection(parent, JptUiValidationPreferenceMessages.TABLE_CATEGORY);
427
		parent = addExpandableSection(parent, JptUiValidationPreferenceMessages.TABLE_CATEGORY);
428
		
428
429
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.TABLE_UNRESOLVED_CATALOG,                                            					JpaValidationMessages.TABLE_UNRESOLVED_CATALOG);
429
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.TABLE_UNRESOLVED_CATALOG,                                            					JpaValidationMessages.TABLE_UNRESOLVED_CATALOG);
430
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.TABLE_UNRESOLVED_SCHEMA,                                             					JpaValidationMessages.TABLE_UNRESOLVED_SCHEMA);
430
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.TABLE_UNRESOLVED_SCHEMA,                                             					JpaValidationMessages.TABLE_UNRESOLVED_SCHEMA);
431
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.TABLE_UNRESOLVED_NAME,                                               					JpaValidationMessages.TABLE_UNRESOLVED_NAME);
431
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.TABLE_UNRESOLVED_NAME,                                               					JpaValidationMessages.TABLE_UNRESOLVED_NAME);
Lines 452-461 Link Here
452
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_SCHEMA,                                 JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_SCHEMA);
452
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_SCHEMA,                                 JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_SCHEMA);
453
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_NAME,                                   JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_NAME);
453
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_NAME,                                   JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_NAME);
454
	}
454
	}
455
	
455
456
	private void addColumnCategory(Composite parent) {	
456
	private void addColumnCategory(Composite parent) {
457
		parent = addExpandableSection(parent, JptUiValidationPreferenceMessages.COLUMN_CATEGORY);
457
		parent = addExpandableSection(parent, JptUiValidationPreferenceMessages.COLUMN_CATEGORY);
458
		
458
459
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.COLUMN_TABLE_NOT_VALID,                                      							JpaValidationMessages.COLUMN_TABLE_NOT_VALID);
459
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.COLUMN_TABLE_NOT_VALID,                                      							JpaValidationMessages.COLUMN_TABLE_NOT_VALID);
460
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.COLUMN_UNRESOLVED_TABLE,                                             					JpaValidationMessages.COLUMN_UNRESOLVED_TABLE);
460
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.COLUMN_UNRESOLVED_TABLE,                                             					JpaValidationMessages.COLUMN_UNRESOLVED_TABLE);
461
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.COLUMN_UNRESOLVED_NAME,                                              					JpaValidationMessages.COLUMN_UNRESOLVED_NAME);
461
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.COLUMN_UNRESOLVED_NAME,                                              					JpaValidationMessages.COLUMN_UNRESOLVED_NAME);
Lines 503-509 Link Here
503
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID, 													JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID);
503
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID, 													JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID);
504
	}
504
	}
505
505
506
	private void addOverridesCategory(Composite parent) {	
506
	private void addOverridesCategory(Composite parent) {
507
507
508
		parent = addExpandableSection(parent, JptUiValidationPreferenceMessages.OVERRIDES_CATEGORY);
508
		parent = addExpandableSection(parent, JptUiValidationPreferenceMessages.OVERRIDES_CATEGORY);
509
509
Lines 529-535 Link Here
529
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS, 				JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS);
529
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS, 				JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS);
530
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS, JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS);
530
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS, JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS);
531
531
532
		
532
533
		parent = addSubExpandableSection(parent, JptUiValidationPreferenceMessages.IMPLIED_ATTRIBUTE_LEVEL_CATEGORY);
533
		parent = addSubExpandableSection(parent, JptUiValidationPreferenceMessages.IMPLIED_ATTRIBUTE_LEVEL_CATEGORY);
534
534
535
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_INVALID_NAME,                  									JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_INVALID_NAME);
535
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_INVALID_NAME,                  									JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_INVALID_NAME);
Lines 591-602 Link Here
591
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.ID_MAPPING_UNRESOLVED_GENERATOR_NAME, JpaValidationMessages.ID_MAPPING_UNRESOLVED_GENERATOR_NAME);
591
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.ID_MAPPING_UNRESOLVED_GENERATOR_NAME, JpaValidationMessages.ID_MAPPING_UNRESOLVED_GENERATOR_NAME);
592
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.GENERATED_VALUE_UNRESOLVED_GENERATOR, JpaValidationMessages.GENERATED_VALUE_UNRESOLVED_GENERATOR);
592
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.GENERATED_VALUE_UNRESOLVED_GENERATOR, JpaValidationMessages.GENERATED_VALUE_UNRESOLVED_GENERATOR);
593
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.QUERY_DUPLICATE_NAME,                 JpaValidationMessages.QUERY_DUPLICATE_NAME);
593
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.QUERY_DUPLICATE_NAME,                 JpaValidationMessages.QUERY_DUPLICATE_NAME);
594
		addLabeledCombo(parent, JptUiValidationPreferenceMessages.JPQL_QUERY_VALIDATION,                JpaValidationMessages.JPQL_QUERY_VALIDATION);
594
	}
595
	}
595
	
596
596
	private Composite addExpandableSection(Composite parent, String text) {
597
	private Composite addExpandableSection(Composite parent, String text) {
597
		return addExpandableSection(parent, text, new GridData(GridData.FILL, GridData.FILL, true, false));
598
		return addExpandableSection(parent, text, new GridData(GridData.FILL, GridData.FILL, true, false));
598
	}
599
	}
599
	
600
600
	private Composite addSubExpandableSection(Composite parent, String text) {
601
	private Composite addSubExpandableSection(Composite parent, String text) {
601
		return addExpandableSection(parent, text, new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
602
		return addExpandableSection(parent, text, new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
602
	}
603
	}
Lines 714-720 Link Here
714
		String preference = this.defaultSeverities.get(preferenceKey);
715
		String preference = this.defaultSeverities.get(preferenceKey);
715
		return preference == null ? JpaValidationPreferences.ERROR : preference;
716
		return preference == null ? JpaValidationPreferences.ERROR : preference;
716
	}
717
	}
717
	
718
718
	protected int convertPreferenceValueToComboIndex(String preferenceValue) {
719
	protected int convertPreferenceValueToComboIndex(String preferenceValue) {
719
		if (JpaValidationPreferences.ERROR.equals(preferenceValue)) {
720
		if (JpaValidationPreferences.ERROR.equals(preferenceValue)) {
720
			return ERROR_INDEX;
721
			return ERROR_INDEX;
Lines 778-784 Link Here
778
			revertToDefault();
779
			revertToDefault();
779
		}
780
		}
780
	}
781
	}
781
	
782
782
	@Override
783
	@Override
783
	protected void enableProjectSpecificSettings(boolean useProjectSpecificSettings) {
784
	protected void enableProjectSpecificSettings(boolean useProjectSpecificSettings) {
784
		super.enableProjectSpecificSettings(useProjectSpecificSettings);
785
		super.enableProjectSpecificSettings(useProjectSpecificSettings);
Lines 787-795 Link Here
787
			//      "otherwise the 'enable project specific settings' checkbox is being pressed")
788
			//      "otherwise the 'enable project specific settings' checkbox is being pressed")
788
			return;
789
			return;
789
		}
790
		}
790
		
791
791
		this.hasProjectSpecificPreferences = Boolean.valueOf(useProjectSpecificSettings);
792
		this.hasProjectSpecificPreferences = Boolean.valueOf(useProjectSpecificSettings);
792
		
793
793
		//set all specified workspace preferences in the project preferences
794
		//set all specified workspace preferences in the project preferences
794
		if (useProjectSpecificSettings){
795
		if (useProjectSpecificSettings){
795
			this.overrideWorkspacePreferences();
796
			this.overrideWorkspacePreferences();
Lines 812-818 Link Here
812
				preference = getDefaultPreferenceValue(preferenceKey);
813
				preference = getDefaultPreferenceValue(preferenceKey);
813
			}
814
			}
814
			combo.select(convertPreferenceValueToComboIndex(preference));
815
			combo.select(convertPreferenceValueToComboIndex(preference));
815
			//UI will show the defaults from the workspace, but set all preferences 
816
			//UI will show the defaults from the workspace, but set all preferences
816
			//to null so they will be deleted from project preferences
817
			//to null so they will be deleted from project preferences
817
			this.severityLevels.put(preferenceKey, null);
818
			this.severityLevels.put(preferenceKey, null);
818
		}
819
		}
Lines 833-839 Link Here
833
			}
834
			}
834
		}
835
		}
835
	}
836
	}
836
	
837
837
	// ********** OK/Revert/Apply behavior **********
838
	// ********** OK/Revert/Apply behavior **********
838
839
839
	@Override
840
	@Override
Lines 858-864 Link Here
858
		}
859
		}
859
		catch (InterruptedException ex) {
860
		catch (InterruptedException ex) {
860
			return false;
861
			return false;
861
		} 
862
		}
862
		catch (InvocationTargetException ex) {
863
		catch (InvocationTargetException ex) {
863
			throw new RuntimeException(ex.getTargetException());
864
			throw new RuntimeException(ex.getTargetException());
864
		}
865
		}

Return to bug 337930