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 412592 | Differences between
and this patch

Collapse All | Expand All

(-)a/bundles/org.eclipse.emf.ecp.edit.swt/META-INF/MANIFEST.MF (-2 / +2 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: Edit SWT
3
Bundle-Name: %Bundle-Name
4
Bundle-SymbolicName: org.eclipse.emf.ecp.edit.swt;singleton:=true
4
Bundle-SymbolicName: org.eclipse.emf.ecp.edit.swt;singleton:=true
5
Bundle-Version: 1.0.1.qualifier
5
Bundle-Version: 1.0.1.qualifier
6
Bundle-Activator: org.eclipse.emf.ecp.edit.internal.swt.Activator
6
Bundle-Activator: org.eclipse.emf.ecp.edit.internal.swt.Activator
Lines 33-36 Export-Package: org.eclipse.emf.ecp.edit.internal.swt;version="1.0.0";x-internal Link Here
33
 org.eclipse.emf.ecp.edit.internal.swt.controls;version="1.0.0";x-friends:="org.eclipse.emf.ecp.ui.view.swt",
33
 org.eclipse.emf.ecp.edit.internal.swt.controls;version="1.0.0";x-friends:="org.eclipse.emf.ecp.ui.view.swt",
34
 org.eclipse.emf.ecp.edit.internal.swt.table;version="1.0.0";x-internal:=true,
34
 org.eclipse.emf.ecp.edit.internal.swt.table;version="1.0.0";x-internal:=true,
35
 org.eclipse.emf.ecp.edit.internal.swt.util;version="1.0.0";x-friends:="org.eclipse.emf.ecp.ui.view.swt"
35
 org.eclipse.emf.ecp.edit.internal.swt.util;version="1.0.0";x-friends:="org.eclipse.emf.ecp.ui.view.swt"
36
Bundle-Vendor: Eclipse Modeling Project
36
Bundle-Vendor: %Bundle-Vendor
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/OSGI-INF/l10n/bundle.properties (+18 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2013 EclipseSource.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#    EclipseSource - initial API and implementation
10
################################################################################
11
12
#Properties file for org.eclipse.emf.ecp.edit.swt
13
14
Bundle-Vendor = Eclipse Modeling Project
15
Bundle-Name = Edit SWT
16
17
extension-point.cell-editor = ECP SWT Table CellEditor
18
extension-point.dialog-wrapper = Dialog Wrapper
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/build.properties (-1 / +2 lines)
Lines 4-7 bin.includes = META-INF/,\ Link Here
4
               .,\
4
               .,\
5
               plugin.xml,\
5
               plugin.xml,\
6
               icons/,\
6
               icons/,\
7
               schema/
7
               schema/,\
8
               OSGI-INF/
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/plugin.xml (-2 / +2 lines)
Lines 1-8 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.4"?>
2
<?eclipse version="3.4"?>
3
<plugin>
3
<plugin>
4
   <extension-point id="cellEditor" name="ECP SWT Table CellEditor" schema="schema/cellEditor.exsd"/>
4
   <extension-point id="cellEditor" name="%extension-point.cell-editor" schema="schema/cellEditor.exsd"/>
5
   <extension-point id="dialogWrapper" name="Dialog Wrapper" schema="schema/dialogWrapper.exsd"/>
5
   <extension-point id="dialogWrapper" name="%extension-point.dialog-wrapper" schema="schema/dialogWrapper.exsd"/>
6
   <extension
6
   <extension
7
         point="org.eclipse.emf.ecp.edit.controls">
7
         point="org.eclipse.emf.ecp.edit.controls">
8
      <control
8
      <control
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/Activator.java (-3 / +3 lines)
Lines 108-118 public class Activator extends Plugin { Link Here
108
	}
108
	}
109
109
110
	public static Image getImage(URL url) {
110
	public static Image getImage(URL url) {
111
		if (!getDefault().imageRegistry.containsKey(url == null ? "NULL" : url.toExternalForm())) {
111
		if (!getDefault().imageRegistry.containsKey(url == null ? "NULL" : url.toExternalForm())) { //$NON-NLS-1$
112
			getDefault().imageRegistry.put(url == null ? "NULL" : url.toExternalForm(), new ImageDescriptorToImage(
112
			getDefault().imageRegistry.put(url == null ? "NULL" : url.toExternalForm(), new ImageDescriptorToImage( //$NON-NLS-1$
113
				ImageDescriptor.createFromURL(url)));
113
				ImageDescriptor.createFromURL(url)));
114
		}
114
		}
115
		return getDefault().imageRegistry.get(url == null ? "NULL" : url.toExternalForm()).getImage();
115
		return getDefault().imageRegistry.get(url == null ? "NULL" : url.toExternalForm()).getImage(); //$NON-NLS-1$
116
116
117
	}
117
	}
118
118
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/actions/ActionMessages.java (+40 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2013 EclipseSource.
3
 * 
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors:
10
 * EclipseSource - initial API and implementation
11
 *******************************************************************************/
12
package org.eclipse.emf.ecp.edit.internal.swt.actions;
13
14
import org.eclipse.osgi.util.NLS;
15
16
public class ActionMessages extends NLS {
17
18
	private static final String BUNDLE_NAME = "org.eclipse.emf.ecp.edit.internal.swt.actions.messages"; //$NON-NLS-1$
19
20
	public static String AddAttributeAction_AddEntry;
21
	public static String AddReferenceAction_Link;
22
23
	public static String DeleteReferenceAction_Confirmation;
24
	public static String DeleteReferenceAction_DeleteModelQuestion;
25
	public static String DeleteReferenceAction_DeleteReference;
26
	public static String DeleteReferenceAction_Yes;
27
	public static String DeleteReferenceAction_No;
28
	public static String DeleteReferenceAction_Questionmark;
29
30
	public static String NewReferenceAction_CreateAndLinkNew;
31
32
	private ActionMessages() {
33
	}
34
35
	static {
36
		// initialize resource bundle
37
		NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
38
	}
39
40
}
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/actions/AddAttributeAction.java (-2 / +2 lines)
Lines 38-45 public class AddAttributeAction extends ECPSWTAction { Link Here
38
		EStructuralFeature feature) {
38
		EStructuralFeature feature) {
39
		super(modelElementContext, itemPropertyDescriptor, feature);
39
		super(modelElementContext, itemPropertyDescriptor, feature);
40
		// TODO remove PlatformUI
40
		// TODO remove PlatformUI
41
		setImageDescriptor(Activator.getImageDescriptor("icons/add.png"));
41
		setImageDescriptor(Activator.getImageDescriptor("icons/add.png")); //$NON-NLS-1$
42
		setToolTipText("Add Entry"); //$NON-NLS-1$
42
		setToolTipText(ActionMessages.AddAttributeAction_AddEntry);
43
	}
43
	}
44
44
45
	@Override
45
	@Override
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/actions/AddReferenceAction.java (-2 / +1 lines)
Lines 77-84 public class AddReferenceAction extends ECPSWTAction { Link Here
77
		} else if (attribute.endsWith("s")) {//$NON-NLS-1$
77
		} else if (attribute.endsWith("s")) {//$NON-NLS-1$
78
			attribute = attribute.substring(0, attribute.length() - 1);
78
			attribute = attribute.substring(0, attribute.length() - 1);
79
		}
79
		}
80
		// TODO language dependent
80
		setToolTipText(ActionMessages.AddReferenceAction_Link + attribute);
81
		setToolTipText("Link " + attribute);//$NON-NLS-1$
82
	}
81
	}
83
82
84
	/**
83
	/**
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/actions/DeleteReferenceAction.java (-7 / +7 lines)
Lines 48-56 public class DeleteReferenceAction extends ECPSWTAction { Link Here
48
		super(modelElementContext, itemPropertyDescriptor, feature);
48
		super(modelElementContext, itemPropertyDescriptor, feature);
49
		// TODO remove PlatformUI
49
		// TODO remove PlatformUI
50
50
51
		setImageDescriptor(Activator.getImageDescriptor("icons/delete.png"));
51
		setImageDescriptor(Activator.getImageDescriptor("icons/delete.png")); //$NON-NLS-1$
52
		// TODO language
52
		setToolTipText(ActionMessages.DeleteReferenceAction_DeleteReference);
53
		setToolTipText("Delete Reference"); //$NON-NLS-1$
54
	}
53
	}
55
54
56
	@Override
55
	@Override
Lines 92-104 public class DeleteReferenceAction extends ECPSWTAction { Link Here
92
		AdapterFactoryItemDelegator adapterFactoryItemDelegator = new AdapterFactoryItemDelegator(adapterFactory);
91
		AdapterFactoryItemDelegator adapterFactoryItemDelegator = new AdapterFactoryItemDelegator(adapterFactory);
93
		// AdapterFactoryLabelProvider adapterFactoryLabelProvider = new AdapterFactoryLabelProvider(adapterFactory);
92
		// AdapterFactoryLabelProvider adapterFactoryLabelProvider = new AdapterFactoryLabelProvider(adapterFactory);
94
		String modelElementName = adapterFactoryItemDelegator.getText(toBeDeleted);
93
		String modelElementName = adapterFactoryItemDelegator.getText(toBeDeleted);
95
		// TODO language
94
		question = ActionMessages.DeleteReferenceAction_DeleteModelQuestion + modelElementName
96
		question = "Do you really want to delete the model element " + modelElementName + "?";//$NON-NLS-1$ //$NON-NLS-2$
95
			+ ActionMessages.DeleteReferenceAction_Questionmark;
97
		// } else {
96
		// } else {
98
		// question = "Do you really want to delete these " + toBeDeleted.size() + " model elements?";
97
		// question = "Do you really want to delete these " + toBeDeleted.size() + " model elements?";
99
		// }
98
		// }
100
		MessageDialog dialog = new MessageDialog(null, "Confirmation", null, question, MessageDialog.QUESTION,//$NON-NLS-1$
99
		MessageDialog dialog = new MessageDialog(null, ActionMessages.DeleteReferenceAction_Confirmation, null,
101
			new String[] { "Yes", "No" }, 0);//$NON-NLS-1$//$NON-NLS-2$
100
			question, MessageDialog.QUESTION, new String[] { ActionMessages.DeleteReferenceAction_Yes,
101
				ActionMessages.DeleteReferenceAction_No }, 0);
102
102
103
		boolean confirm = false;
103
		boolean confirm = false;
104
		if (dialog.open() == Window.OK) {
104
		if (dialog.open() == Window.OK) {
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/actions/NewReferenceAction.java (-6 / +6 lines)
Lines 75-81 public class NewReferenceAction extends ECPSWTAction { Link Here
75
		} else if (attribute.endsWith("s")) {//$NON-NLS-1$
75
		} else if (attribute.endsWith("s")) {//$NON-NLS-1$
76
			attribute = attribute.substring(0, attribute.length() - 1);
76
			attribute = attribute.substring(0, attribute.length() - 1);
77
		}
77
		}
78
		setToolTipText("Create and link new " + attribute);//$NON-NLS-1$
78
		setToolTipText(ActionMessages.NewReferenceAction_CreateAndLinkNew + attribute);
79
	}
79
	}
80
80
81
	/**
81
	/**
Lines 106-112 public class NewReferenceAction extends ECPSWTAction { Link Here
106
	// }
106
	// }
107
	// Image image = labelProvider.getImage(obj);
107
	// Image image = labelProvider.getImage(obj);
108
	//
108
	//
109
	// ImageDescriptor addOverlay = Activator.getImageDescriptor("icons/add_overlay.png");
109
	// ImageDescriptor addOverlay = Activator.getImageDescriptor("icons/add_overlay.png");//$NON-NLS-1$
110
	// OverlayImageDescriptor imageDescriptor = new OverlayImageDescriptor(image, addOverlay,
110
	// OverlayImageDescriptor imageDescriptor = new OverlayImageDescriptor(image, addOverlay,
111
	// OverlayImageDescriptor.LOWER_RIGHT);
111
	// OverlayImageDescriptor.LOWER_RIGHT);
112
	// setImageDescriptor(imageDescriptor);
112
	// setImageDescriptor(imageDescriptor);
Lines 114-125 public class NewReferenceAction extends ECPSWTAction { Link Here
114
	// String attribute = descriptor.getDisplayName(eReference);
114
	// String attribute = descriptor.getDisplayName(eReference);
115
	//
115
	//
116
	// // make singular attribute labels
116
	// // make singular attribute labels
117
	// if (attribute.endsWith("ies")) {
117
	// if (attribute.endsWith("ies")) {//$NON-NLS-1$
118
	// attribute = attribute.substring(0, attribute.length() - 3) + "y";
118
	// attribute = attribute.substring(0, attribute.length() - 3) + "y";//$NON-NLS-1$
119
	// } else if (attribute.endsWith("s")) {
119
	// } else if (attribute.endsWith("s")) {//$NON-NLS-1$
120
	// attribute = attribute.substring(0, attribute.length() - 1);
120
	// attribute = attribute.substring(0, attribute.length() - 1);
121
	// }
121
	// }
122
	// setToolTipText("Create and link new " + attribute);
122
	// setToolTipText(ActionMessages.NewReferenceAction_CreateAndLinkNew + attribute);
123
	//
123
	//
124
	// }
124
	// }
125
125
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/actions/messages.properties (+23 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2013 EclipseSource.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#    EclipseSource - initial API and implementation
10
################################################################################
11
12
AddAttributeAction_AddEntry=Add Entry
13
14
AddReferenceAction_Link=Link 
15
16
DeleteReferenceAction_Confirmation=Confirmation
17
DeleteReferenceAction_DeleteModelQuestion=Do you really want to delete the model element 
18
DeleteReferenceAction_DeleteReference=Delete Reference
19
DeleteReferenceAction_Yes=Yes
20
DeleteReferenceAction_No=No
21
DeleteReferenceAction_Questionmark=?
22
23
NewReferenceAction_CreateAndLinkNew=Create and link new 
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/AbstractTextControl.java (-5 / +4 lines)
Lines 75-82 public abstract class AbstractTextControl extends SingleControl { Link Here
75
	private void addControlDecoration(Composite composite) {
75
	private void addControlDecoration(Composite composite) {
76
		controlDecoration = new ControlDecoration(text, SWT.LEFT | SWT.TOP, composite);
76
		controlDecoration = new ControlDecoration(text, SWT.LEFT | SWT.TOP, composite);
77
		controlDecoration.hide();
77
		controlDecoration.hide();
78
		// TODO language
78
		controlDecoration.setDescriptionText(ControlMessages.AbstractTextControl_InvalidInput);
79
		controlDecoration.setDescriptionText("Invalid input");//$NON-NLS-1$
80
		controlDecoration.setShowHover(true);
79
		controlDecoration.setShowHover(true);
81
		FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
80
		FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
82
			FieldDecorationRegistry.DEC_ERROR);
81
			FieldDecorationRegistry.DEC_ERROR);
Lines 87-93 public abstract class AbstractTextControl extends SingleControl { Link Here
87
		text = new Text(composite, getTextWidgetStyle());
86
		text = new Text(composite, getTextWidgetStyle());
88
		text.setLayoutData(getTextWidgetLayoutData());
87
		text.setLayoutData(getTextWidgetLayoutData());
89
		if (getStructuralFeature().isUnsettable()) {
88
		if (getStructuralFeature().isUnsettable()) {
90
			text.setMessage("<unset>");
89
			text.setMessage(ControlMessages.AbstractTextControl_Unset);
91
		}
90
		}
92
		text.setData(CUSTOM_VARIANT, getTextVariantID());
91
		text.setData(CUSTOM_VARIANT, getTextVariantID());
93
		customizeText(text);
92
		customizeText(text);
Lines 241-247 public abstract class AbstractTextControl extends SingleControl { Link Here
241
240
242
				controlDecoration.hide();
241
				controlDecoration.hide();
243
				updateValidationColor(null);
242
				updateValidationColor(null);
244
				if ("".equals(value)) {
243
				if ("".equals(value)) { //$NON-NLS-1$
245
					value = null;
244
					value = null;
246
				}
245
				}
247
				if (value == null && getStructuralFeature().isUnsettable()) {
246
				if (value == null && getStructuralFeature().isUnsettable()) {
Lines 255-261 public abstract class AbstractTextControl extends SingleControl { Link Here
255
			} catch (IllegalArgumentException e) {
254
			} catch (IllegalArgumentException e) {
256
				controlDecoration.show();
255
				controlDecoration.show();
257
				updateValidationColor(getText().getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
256
				updateValidationColor(getText().getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
258
				controlDecoration.setDescriptionText("Invalid input " + e.getLocalizedMessage());
257
				controlDecoration.setDescriptionText(ControlMessages.AbstractTextControl_InvalidInputSpace + e.getLocalizedMessage());
259
				throw e;
258
				throw e;
260
			}
259
			}
261
		}
260
		}
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/AttributeMultiControl.java (-2 / +2 lines)
Lines 62-68 public class AttributeMultiControl extends MultiControl { Link Here
62
	 */
62
	 */
63
	@Override
63
	@Override
64
	protected String getUnsetLabelText() {
64
	protected String getUnsetLabelText() {
65
		return "Not set. Click to set!";
65
		return ControlMessages.AttributeMultiControl_NotSetClickToSet;
66
	}
66
	}
67
67
68
	/*
68
	/*
Lines 71-77 public class AttributeMultiControl extends MultiControl { Link Here
71
	 */
71
	 */
72
	@Override
72
	@Override
73
	protected String getUnsetButtonTooltip() {
73
	protected String getUnsetButtonTooltip() {
74
		return "Unset";
74
		return ControlMessages.AttributeMultiControl_Unset;
75
	}
75
	}
76
76
77
}
77
}
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/BooleanControl.java (-4 / +3 lines)
Lines 52-58 public class BooleanControl extends SingleControl { Link Here
52
	@Override
52
	@Override
53
	protected void fillControlComposite(Composite composite) {
53
	protected void fillControlComposite(Composite composite) {
54
		check = new Button(composite, SWT.CHECK);
54
		check = new Button(composite, SWT.CHECK);
55
		check.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_boolean");
55
		check.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_boolean"); //$NON-NLS-1$
56
	}
56
	}
57
57
58
	/**
58
	/**
Lines 80-87 public class BooleanControl extends SingleControl { Link Here
80
	 */
80
	 */
81
	@Override
81
	@Override
82
	protected String getUnsetLabelText() {
82
	protected String getUnsetLabelText() {
83
		// TODO language
83
		return ControlMessages.BooleanControl_NoBooleanSetClickToSetBoolean;
84
		return "No boolean set! Click to set boolean."; //$NON-NLS-1$
85
	}
84
	}
86
85
87
	/*
86
	/*
Lines 90-96 public class BooleanControl extends SingleControl { Link Here
90
	 */
89
	 */
91
	@Override
90
	@Override
92
	protected String getUnsetButtonTooltip() {
91
	protected String getUnsetButtonTooltip() {
93
		return "Unset boolean";
92
		return ControlMessages.BooleanControl_UnsetBoolean;
94
	}
93
	}
95
94
96
	/*
95
	/*
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/ControlMessages.java (+74 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2013 EclipseSource.
3
 * 
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors:
10
 * EclipseSource - initial API and implementation
11
 *******************************************************************************/
12
package org.eclipse.emf.ecp.edit.internal.swt.controls;
13
14
import org.eclipse.osgi.util.NLS;
15
16
public class ControlMessages extends NLS {
17
18
	private static final String BUNDLE_NAME = "org.eclipse.emf.ecp.edit.internal.swt.controls.messages"; //$NON-NLS-1$
19
20
	public static String AbstractTextControl_InvalidInput;
21
	public static String AbstractTextControl_InvalidInputSpace;
22
	public static String AbstractTextControl_Unset;
23
24
	public static String AttributeMultiControl_NotSetClickToSet;
25
	public static String AttributeMultiControl_Unset;
26
27
	public static String BooleanControl_NoBooleanSetClickToSetBoolean;
28
	public static String BooleanControl_UnsetBoolean;
29
30
	public static String DateTimeControl_NoDateSetClickToSetDate;
31
	public static String DateTimeControl_UnsetDate;
32
33
	public static String EEnumControl_NoValueSetClickToSetValue;
34
	public static String EEnumControl_UnsetValue;
35
36
	public static String LinkControl_NoLinkSetClickToSetLink;
37
	public static String LinkControl_NotSet;
38
	public static String LinkControl_UnsetLink;
39
40
	public static String NumericalControl_FormatNumerical;
41
	public static String NumericalControl_FormatNumericalDecimal;
42
	public static String NumericalControl_InvalidNumber;
43
	public static String NumericalControl_InvalidNumberWillBeUnset;
44
	public static String NumericalControl_NoNumberClickToSetNumber;
45
	public static String NumericalControl_UnsetNumber;
46
47
	public static String ReferenceMultiControl_NotSetClickToSet;
48
	public static String ReferenceMultiControl_Unset;
49
50
	public static String StringControl_NoTextSetClickToSetText;
51
	public static String StringControl_UnsetText;
52
53
	public static String TableControl_AddInstanceOf;
54
	public static String TableControl_Delete;
55
	public static String TableControl_DeleteAreYouSure;
56
	public static String TableControl_NotSetClickToSet;
57
	public static String TableControl_RemoveSelected;
58
	public static String TableControl_Unset;
59
60
	public static String XmlDateControlText_InvalidNumber;
61
	public static String XmlDateControlText_NoDateSetClickToSetDate;
62
	public static String XmlDateControlText_NumberInvalidValueWillBeUnset;
63
	public static String XmlDateControlText_SelectDate;
64
	public static String XmlDateControlText_UnsetDate;
65
66
	private ControlMessages() {
67
	}
68
69
	static {
70
		// initialize resource bundle
71
		NLS.initializeMessages(BUNDLE_NAME, ControlMessages.class);
72
	}
73
74
}
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/DateTimeControl.java (-5 / +4 lines)
Lines 75-85 public class DateTimeControl extends SingleControl { Link Here
75
75
76
		dateWidget = new DateTime(composite, SWT.DATE | SWT.BORDER);
76
		dateWidget = new DateTime(composite, SWT.DATE | SWT.BORDER);
77
		dateWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
77
		dateWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
78
		dateWidget.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_dateTime_date");
78
		dateWidget.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_dateTime_date"); //$NON-NLS-1$
79
79
80
		timeWidget = new DateTime(composite, SWT.TIME | SWT.SHORT | SWT.BORDER);
80
		timeWidget = new DateTime(composite, SWT.TIME | SWT.SHORT | SWT.BORDER);
81
		timeWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
81
		timeWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
82
		timeWidget.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_dateTime_time");
82
		timeWidget.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_dateTime_time"); //$NON-NLS-1$
83
	}
83
	}
84
84
85
	/**
85
	/**
Lines 105-112 public class DateTimeControl extends SingleControl { Link Here
105
	 */
105
	 */
106
	@Override
106
	@Override
107
	protected String getUnsetLabelText() {
107
	protected String getUnsetLabelText() {
108
		// TODO language
108
		return ControlMessages.DateTimeControl_NoDateSetClickToSetDate;
109
		return "No date set! Click to set date."; //$NON-NLS-1$
110
	}
109
	}
111
110
112
	/*
111
	/*
Lines 115-121 public class DateTimeControl extends SingleControl { Link Here
115
	 */
114
	 */
116
	@Override
115
	@Override
117
	protected String getUnsetButtonTooltip() {
116
	protected String getUnsetButtonTooltip() {
118
		return "Unset Date";
117
		return ControlMessages.DateTimeControl_UnsetDate;
119
	}
118
	}
120
119
121
	/*
120
	/*
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/EEnumControl.java (-4 / +3 lines)
Lines 67-73 public class EEnumControl extends SingleControl { Link Here
67
67
68
		});
68
		});
69
		combo.setInput(getStructuralFeature().getEType().getInstanceClass().getEnumConstants());
69
		combo.setInput(getStructuralFeature().getEType().getInstanceClass().getEnumConstants());
70
		combo.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_enum");
70
		combo.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_enum"); //$NON-NLS-1$
71
	}
71
	}
72
72
73
	/**
73
	/**
Lines 89-96 public class EEnumControl extends SingleControl { Link Here
89
	 */
89
	 */
90
	@Override
90
	@Override
91
	protected String getUnsetLabelText() {
91
	protected String getUnsetLabelText() {
92
		// TODO language
92
		return ControlMessages.EEnumControl_NoValueSetClickToSetValue;
93
		return "No value set! Click to set value."; //$NON-NLS-1$
94
	}
93
	}
95
94
96
	/*
95
	/*
Lines 99-105 public class EEnumControl extends SingleControl { Link Here
99
	 */
98
	 */
100
	@Override
99
	@Override
101
	protected String getUnsetButtonTooltip() {
100
	protected String getUnsetButtonTooltip() {
102
		return "Unset value";
101
		return ControlMessages.EEnumControl_UnsetValue;
103
	}
102
	}
104
103
105
	/*
104
	/*
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/LinkControl.java (-8 / +6 lines)
Lines 112-119 public class LinkControl extends SingleControl { Link Here
112
		mainComposite.setLayout(stackLayout);
112
		mainComposite.setLayout(stackLayout);
113
113
114
		unsetLabel = new Label(mainComposite, SWT.NONE);
114
		unsetLabel = new Label(mainComposite, SWT.NONE);
115
		// TODO language
115
		unsetLabel.setText(ControlMessages.LinkControl_NotSet);
116
		unsetLabel.setText("(Not Set)");//$NON-NLS-1$
117
		unsetLabel.setBackground(composite.getBackground());
116
		unsetLabel.setBackground(composite.getBackground());
118
		unsetLabel.setForeground(composite.getShell().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
117
		unsetLabel.setForeground(composite.getShell().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
119
		unsetLabel.setAlignment(SWT.CENTER);
118
		unsetLabel.setAlignment(SWT.CENTER);
Lines 161-167 public class LinkControl extends SingleControl { Link Here
161
		imageHyperlink.setBackground(linkComposite.getBackground());
160
		imageHyperlink.setBackground(linkComposite.getBackground());
162
161
163
		hyperlink = new Link(linkComposite, SWT.NONE);
162
		hyperlink = new Link(linkComposite, SWT.NONE);
164
		hyperlink.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_reference");
163
		hyperlink.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_reference"); //$NON-NLS-1$
165
		hyperlink.setBackground(linkComposite.getBackground());
164
		hyperlink.setBackground(linkComposite.getBackground());
166
		hyperlink.addSelectionListener(new SelectionAdapter() {
165
		hyperlink.addSelectionListener(new SelectionAdapter() {
167
166
Lines 219-225 public class LinkControl extends SingleControl { Link Here
219
			@Override
218
			@Override
220
			public Object convert(Object value) {
219
			public Object convert(Object value) {
221
				updateChangeListener((EObject) value);
220
				updateChangeListener((EObject) value);
222
				return "<a>" + getLinkText(value) + "</a>";
221
				return "<a>" + getLinkText(value) + "</a>"; //$NON-NLS-1$ //$NON-NLS-2$
223
			}
222
			}
224
		});
223
		});
225
		IObservableValue tooltipValue = SWTObservables.observeTooltipText(hyperlink);
224
		IObservableValue tooltipValue = SWTObservables.observeTooltipText(hyperlink);
Lines 259-265 public class LinkControl extends SingleControl { Link Here
259
258
260
	protected Object getLinkText(Object value) {
259
	protected Object getLinkText(Object value) {
261
		String linkName = adapterFactoryItemDelegator.getText(value);
260
		String linkName = adapterFactoryItemDelegator.getText(value);
262
		return linkName == null ? "" : linkName;
261
		return linkName == null ? "" : linkName; //$NON-NLS-1$
263
	}
262
	}
264
263
265
	private void updateChangeListener(final EObject value) {
264
	private void updateChangeListener(final EObject value) {
Lines 321-328 public class LinkControl extends SingleControl { Link Here
321
	 */
320
	 */
322
	@Override
321
	@Override
323
	protected String getUnsetLabelText() {
322
	protected String getUnsetLabelText() {
324
		// TODO language
323
		return ControlMessages.LinkControl_NoLinkSetClickToSetLink;
325
		return "No link set! Click to set link."; //$NON-NLS-1$
326
	}
324
	}
327
325
328
	/*
326
	/*
Lines 331-337 public class LinkControl extends SingleControl { Link Here
331
	 */
329
	 */
332
	@Override
330
	@Override
333
	protected String getUnsetButtonTooltip() {
331
	protected String getUnsetButtonTooltip() {
334
		return "Unset Link";
332
		return ControlMessages.LinkControl_UnsetLink;
335
	}
333
	}
336
334
337
	/*
335
	/*
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/MultiControl.java (-1 / +1 lines)
Lines 350-356 public abstract class MultiControl extends SWTControl { Link Here
350
		 */
350
		 */
351
		private void createDeleteButton(Composite composite) {
351
		private void createDeleteButton(Composite composite) {
352
			Button delB = new Button(composite, SWT.PUSH);
352
			Button delB = new Button(composite, SWT.PUSH);
353
			delB.setImage(Activator.getImage("icons/delete.png"));
353
			delB.setImage(Activator.getImage("icons/delete.png")); //$NON-NLS-1$
354
			delB.addSelectionListener(new SelectionAdapter() {
354
			delB.addSelectionListener(new SelectionAdapter() {
355
355
356
				/*
356
				/*
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/NumericalControl.java (-18 / +18 lines)
Lines 68-74 public class NumericalControl extends AbstractTextControl { Link Here
68
	 */
68
	 */
69
	@Override
69
	@Override
70
	protected String getTextVariantID() {
70
	protected String getTextVariantID() {
71
		return "org_eclipse_emf_ecp_control_numerical";
71
		return "org_eclipse_emf_ecp_control_numerical"; //$NON-NLS-1$
72
	}
72
	}
73
73
74
	/*
74
	/*
Lines 77-84 public class NumericalControl extends AbstractTextControl { Link Here
77
	 */
77
	 */
78
	@Override
78
	@Override
79
	protected String getUnsetLabelText() {
79
	protected String getUnsetLabelText() {
80
		// TODO language
80
		return ControlMessages.NumericalControl_NoNumberClickToSetNumber;
81
		return "No number set! Click to set number."; //$NON-NLS-1$
82
	}
81
	}
83
82
84
	/*
83
	/*
Lines 87-93 public class NumericalControl extends AbstractTextControl { Link Here
87
	 */
86
	 */
88
	@Override
87
	@Override
89
	protected String getUnsetButtonTooltip() {
88
	protected String getUnsetButtonTooltip() {
90
		return "Unset number";
89
		return ControlMessages.NumericalControl_UnsetNumber;
91
	}
90
	}
92
91
93
	@Override
92
	@Override
Lines 138-149 public class NumericalControl extends AbstractTextControl { Link Here
138
	private String getFormatText() {
137
	private String getFormatText() {
139
138
140
		if (NumericalHelper.isInteger(getInstanceClass())) {
139
		if (NumericalHelper.isInteger(getInstanceClass())) {
141
			return "The format is '#'.";
140
			return ControlMessages.NumericalControl_FormatNumerical;
142
		} else if (NumericalHelper.isDouble(getInstanceClass())) {
141
		} else if (NumericalHelper.isDouble(getInstanceClass())) {
143
			return "The format is '#.#'.";
142
			return ControlMessages.NumericalControl_FormatNumericalDecimal;
144
		}
143
		}
145
144
146
		return "";
145
		return ""; //$NON-NLS-1$
147
	}
146
	}
148
147
149
	// TODO: Remarks EM:
148
	// TODO: Remarks EM:
Lines 187-202 public class NumericalControl extends AbstractTextControl { Link Here
187
					if (NumericalHelper.isInteger(getInstanceClass())) {
186
					if (NumericalHelper.isInteger(getInstanceClass())) {
188
						boolean maxValue = false;
187
						boolean maxValue = false;
189
						Class<?> instanceClass = getInstanceClass();
188
						Class<?> instanceClass = getInstanceClass();
190
						String formatedValue = "";
189
						String formatedValue = ""; //$NON-NLS-1$
191
						try {
190
						try {
192
							if (Integer.class.isAssignableFrom(instanceClass)
191
							if (Integer.class.isAssignableFrom(instanceClass)
193
								|| Integer.class.getField("TYPE").get(null).equals(instanceClass)) {
192
								|| Integer.class.getField("TYPE").get(null).equals(instanceClass)) { //$NON-NLS-1$
194
								if (Integer.MAX_VALUE == number.intValue()) {
193
								if (Integer.MAX_VALUE == number.intValue()) {
195
									maxValue = true;
194
									maxValue = true;
196
									formatedValue = format.format(Integer.MAX_VALUE);
195
									formatedValue = format.format(Integer.MAX_VALUE);
197
								}
196
								}
198
							} else if (Long.class.isAssignableFrom(instanceClass)
197
							} else if (Long.class.isAssignableFrom(instanceClass)
199
								|| Long.class.getField("TYPE").get(null).equals(instanceClass)) {
198
								|| Long.class.getField("TYPE").get(null).equals(instanceClass)) { //$NON-NLS-1$
200
								if (Long.MAX_VALUE == number.longValue()) {
199
								if (Long.MAX_VALUE == number.longValue()) {
201
									maxValue = true;
200
									maxValue = true;
202
									formatedValue = format.format(Long.MAX_VALUE);
201
									formatedValue = format.format(Long.MAX_VALUE);
Lines 218-230 public class NumericalControl extends AbstractTextControl { Link Here
218
						}
217
						}
219
					}
218
					}
220
				}
219
				}
221
				String formatedNumber = "";
220
				String formatedNumber = ""; //$NON-NLS-1$
222
				if (number != null) {
221
				if (number != null) {
223
					formatedNumber = format.format(number);
222
					formatedNumber = format.format(number);
224
				}
223
				}
225
				// if (number.toString().contains("E")
224
				// if (number.toString().contains("E") //$NON-NLS-1$
226
				// || ((String) value).matches("0*" + formatedNumber + "\\"
225
				// || ((String) value).matches("0*" + formatedNumber + "\\"  //$NON-NLS-1$  //$NON-NLS-2$
227
				// + format.getDecimalFormatSymbols().getDecimalSeparator() + "?0*")) {
226
				// + format.getDecimalFormatSymbols().getDecimalSeparator() + "?0*")) {  //$NON-NLS-1$
228
				//
227
				//
229
				// }
228
				// }
230
				// return revertToOldValue(value);
229
				// return revertToOldValue(value);
Lines 240-253 public class NumericalControl extends AbstractTextControl { Link Here
240
239
241
		private Object revertToOldValue(final Object value) {
240
		private Object revertToOldValue(final Object value) {
242
241
243
			if (getStructuralFeature().getDefaultValue() == null && (value == null || value.equals(""))) {
242
			if (getStructuralFeature().getDefaultValue() == null && (value == null || value.equals(""))) { //$NON-NLS-1$
244
				return null;
243
				return null;
245
			}
244
			}
246
245
247
			Object result = getModelValue().getValue();
246
			Object result = getModelValue().getValue();
248
247
249
			MessageDialog messageDialog = new MessageDialog(getText().getShell(), "Invalid Number", null,
248
			MessageDialog messageDialog = new MessageDialog(getText().getShell(),
250
				"The Number you have entered is invalid. The value will be unset.", MessageDialog.ERROR,
249
				ControlMessages.NumericalControl_InvalidNumber, null,
250
				ControlMessages.NumericalControl_InvalidNumberWillBeUnset, MessageDialog.ERROR,
251
				new String[] { JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY) }, 0);
251
				new String[] { JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY) }, 0);
252
252
253
			new ECPDialogExecutor(messageDialog) {
253
			new ECPDialogExecutor(messageDialog) {
Lines 258-264 public class NumericalControl extends AbstractTextControl { Link Here
258
			}.execute();
258
			}.execute();
259
259
260
			if (result == null) {
260
			if (result == null) {
261
				getText().setText("");
261
				getText().setText(""); //$NON-NLS-1$
262
			} else {
262
			} else {
263
				getText().setText(format.format(result));
263
				getText().setText(format.format(result));
264
			}
264
			}
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/NumericalHelper.java (-15 / +15 lines)
Lines 32-41 public class NumericalHelper { Link Here
32
		format.setGroupingUsed(false);
32
		format.setGroupingUsed(false);
33
33
34
		// EAnnotation annotation = getStructuralFeature().getEType().getEAnnotation(
34
		// EAnnotation annotation = getStructuralFeature().getEType().getEAnnotation(
35
		// "http:///org/eclipse/emf/ecore/util/ExtendedMetaData");
35
		// "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"); //$NON-NLS-1$
36
		// String stringTotalDigits = annotation.getDetails().get("totalDigits");
36
		// String stringTotalDigits = annotation.getDetails().get("totalDigits"); //$NON-NLS-1$
37
		// if (stringTotalDigits != null) {
37
		// if (stringTotalDigits != null) {
38
		// String stringFractionDigits = annotation.getDetails().get("fractionDigits");
38
		// String stringFractionDigits = annotation.getDetails().get("fractionDigits"); //$NON-NLS-1$
39
		// int fractionalDigits = 0;
39
		// int fractionalDigits = 0;
40
		// if (stringFractionDigits != null) {
40
		// if (stringFractionDigits != null) {
41
		// fractionalDigits = Integer.valueOf(stringFractionDigits);
41
		// fractionalDigits = Integer.valueOf(stringFractionDigits);
Lines 57-66 public class NumericalHelper { Link Here
57
	public static Number getDefaultValue(Class<?> instanceClass) {
57
	public static Number getDefaultValue(Class<?> instanceClass) {
58
		if (instanceClass.isPrimitive()) {
58
		if (instanceClass.isPrimitive()) {
59
			try {
59
			try {
60
				if (Double.class.getField("TYPE").get(null).equals(instanceClass)
60
				if (Double.class.getField("TYPE").get(null).equals(instanceClass) //$NON-NLS-1$
61
					|| Float.class.getField("TYPE").get(null).equals(instanceClass)
61
					|| Float.class.getField("TYPE").get(null).equals(instanceClass) //$NON-NLS-1$
62
					|| Integer.class.getField("TYPE").get(null).equals(instanceClass)
62
					|| Integer.class.getField("TYPE").get(null).equals(instanceClass) //$NON-NLS-1$
63
					|| Long.class.getField("TYPE").get(null).equals(instanceClass)) {
63
					|| Long.class.getField("TYPE").get(null).equals(instanceClass)) { //$NON-NLS-1$
64
					return 0;
64
					return 0;
65
				}
65
				}
66
			} catch (IllegalArgumentException ex) {
66
			} catch (IllegalArgumentException ex) {
Lines 91-98 public class NumericalHelper { Link Here
91
	public static boolean isDouble(Class<?> instanceClass) {
91
	public static boolean isDouble(Class<?> instanceClass) {
92
		if (instanceClass.isPrimitive()) {
92
		if (instanceClass.isPrimitive()) {
93
			try {
93
			try {
94
				return Double.class.getField("TYPE").get(null).equals(instanceClass)
94
				return Double.class.getField("TYPE").get(null).equals(instanceClass) //$NON-NLS-1$
95
					|| Float.class.getField("TYPE").get(null).equals(instanceClass);
95
					|| Float.class.getField("TYPE").get(null).equals(instanceClass); //$NON-NLS-1$
96
			} catch (IllegalArgumentException ex) {
96
			} catch (IllegalArgumentException ex) {
97
				Activator.logException(ex);
97
				Activator.logException(ex);
98
			} catch (SecurityException ex) {
98
			} catch (SecurityException ex) {
Lines 116-123 public class NumericalHelper { Link Here
116
	public static boolean isInteger(Class<?> instanceClass) {
116
	public static boolean isInteger(Class<?> instanceClass) {
117
		if (instanceClass.isPrimitive()) {
117
		if (instanceClass.isPrimitive()) {
118
			try {
118
			try {
119
				return Integer.class.getField("TYPE").get(null).equals(instanceClass)
119
				return Integer.class.getField("TYPE").get(null).equals(instanceClass) //$NON-NLS-1$
120
					|| Long.class.getField("TYPE").get(null).equals(instanceClass);
120
					|| Long.class.getField("TYPE").get(null).equals(instanceClass); //$NON-NLS-1$
121
			} catch (IllegalArgumentException ex) {
121
			} catch (IllegalArgumentException ex) {
122
				Activator.logException(ex);
122
				Activator.logException(ex);
123
			} catch (SecurityException ex) {
123
			} catch (SecurityException ex) {
Lines 145-157 public class NumericalHelper { Link Here
145
	public static Object numberToInstanceClass(Number number, Class<?> instanceClass) {
145
	public static Object numberToInstanceClass(Number number, Class<?> instanceClass) {
146
		if (instanceClass.isPrimitive()) {
146
		if (instanceClass.isPrimitive()) {
147
			try {
147
			try {
148
				if (Double.class.getField("TYPE").get(null).equals(instanceClass)) {
148
				if (Double.class.getField("TYPE").get(null).equals(instanceClass)) { //$NON-NLS-1$
149
					return number.doubleValue();
149
					return number.doubleValue();
150
				} else if (Integer.class.getField("TYPE").get(null).equals(instanceClass)) {
150
				} else if (Integer.class.getField("TYPE").get(null).equals(instanceClass)) { //$NON-NLS-1$
151
					return number.intValue();
151
					return number.intValue();
152
				} else if (Long.class.getField("TYPE").get(null).equals(instanceClass)) {
152
				} else if (Long.class.getField("TYPE").get(null).equals(instanceClass)) { //$NON-NLS-1$
153
					return number.longValue();
153
					return number.longValue();
154
				} else if (Float.class.getField("TYPE").get(null).equals(instanceClass)) {
154
				} else if (Float.class.getField("TYPE").get(null).equals(instanceClass)) { //$NON-NLS-1$
155
					return number.floatValue();
155
					return number.floatValue();
156
				}
156
				}
157
			} catch (IllegalArgumentException ex) {
157
			} catch (IllegalArgumentException ex) {
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/ReferenceMultiControl.java (-2 / +2 lines)
Lines 64-70 public class ReferenceMultiControl extends MultiControl { Link Here
64
	 */
64
	 */
65
	@Override
65
	@Override
66
	protected String getUnsetLabelText() {
66
	protected String getUnsetLabelText() {
67
		return "Not set. Click to set!";
67
		return ControlMessages.ReferenceMultiControl_NotSetClickToSet;
68
	}
68
	}
69
69
70
	/*
70
	/*
Lines 73-78 public class ReferenceMultiControl extends MultiControl { Link Here
73
	 */
73
	 */
74
	@Override
74
	@Override
75
	protected String getUnsetButtonTooltip() {
75
	protected String getUnsetButtonTooltip() {
76
		return "Unset";
76
		return ControlMessages.ReferenceMultiControl_Unset;
77
	}
77
	}
78
}
78
}
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/SingleControl.java (-1 / +1 lines)
Lines 85-91 public abstract class SingleControl extends SWTControl { Link Here
85
			return;
85
			return;
86
		}
86
		}
87
		validationLabel.setImage(null);
87
		validationLabel.setImage(null);
88
		validationLabel.setToolTipText("");
88
		validationLabel.setToolTipText(""); //$NON-NLS-1$
89
		updateValidationColor(null);
89
		updateValidationColor(null);
90
	}
90
	}
91
91
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/StringControl.java (-4 / +3 lines)
Lines 72-78 public class StringControl extends AbstractTextControl { Link Here
72
	 */
72
	 */
73
	@Override
73
	@Override
74
	protected String getTextVariantID() {
74
	protected String getTextVariantID() {
75
		return "org_eclipse_emf_ecp_control_string";
75
		return "org_eclipse_emf_ecp_control_string"; //$NON-NLS-1$
76
	}
76
	}
77
77
78
	/*
78
	/*
Lines 81-88 public class StringControl extends AbstractTextControl { Link Here
81
	 */
81
	 */
82
	@Override
82
	@Override
83
	protected String getUnsetLabelText() {
83
	protected String getUnsetLabelText() {
84
		// TODO language
84
		return ControlMessages.StringControl_NoTextSetClickToSetText;
85
		return "No text set! Click to set text."; //$NON-NLS-1$
86
	}
85
	}
87
86
88
	/*
87
	/*
Lines 91-97 public class StringControl extends AbstractTextControl { Link Here
91
	 */
90
	 */
92
	@Override
91
	@Override
93
	protected String getUnsetButtonTooltip() {
92
	protected String getUnsetButtonTooltip() {
94
		return "Unset text";
93
		return ControlMessages.StringControl_UnsetText;
95
	}
94
	}
96
95
97
	@Override
96
	@Override
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/TableControl.java (-12 / +12 lines)
Lines 208-214 public class TableControl extends SWTControl { Link Here
208
		tableViewer = new TableViewer(composite, SWT.MULTI | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
208
		tableViewer = new TableViewer(composite, SWT.MULTI | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
209
		// GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).hint(SWT.DEFAULT, SWT.DEFAULT)
209
		// GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).hint(SWT.DEFAULT, SWT.DEFAULT)
210
		// .applyTo(tableViewer.getTable());
210
		// .applyTo(tableViewer.getTable());
211
		tableViewer.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_table");
211
		tableViewer.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_table"); //$NON-NLS-1$
212
		tableViewer.getTable().setHeaderVisible(true);
212
		tableViewer.getTable().setHeaderVisible(true);
213
		tableViewer.getTable().setLinesVisible(true);
213
		tableViewer.getTable().setLinesVisible(true);
214
214
Lines 260-268 public class TableControl extends SWTControl { Link Here
260
			final TableViewerColumn column = new TableViewerColumn(tableViewer, cellEditor.getStyle());
260
			final TableViewerColumn column = new TableViewerColumn(tableViewer, cellEditor.getStyle());
261
261
262
			if (ECPCellEditor.class.isInstance(cellEditor)) {
262
			if (ECPCellEditor.class.isInstance(cellEditor)) {
263
				column.getColumn().setData("width", ((ECPCellEditor) cellEditor).getColumnWidthWeight());
263
				column.getColumn().setData("width", ((ECPCellEditor) cellEditor).getColumnWidthWeight()); //$NON-NLS-1$
264
			} else {
264
			} else {
265
				column.getColumn().setData("width", 100);
265
				column.getColumn().setData("width", 100); //$NON-NLS-1$
266
			}
266
			}
267
267
268
			// determine the attribute that should be observed
268
			// determine the attribute that should be observed
Lines 281-292 public class TableControl extends SWTControl { Link Here
281
					if (ECPCellEditor.class.isInstance(cellEditor)) {
281
					if (ECPCellEditor.class.isInstance(cellEditor)) {
282
						ECPCellEditor ecpCellEditor = (ECPCellEditor) cellEditor;
282
						ECPCellEditor ecpCellEditor = (ECPCellEditor) cellEditor;
283
						String text = ecpCellEditor.getFormatedString(value);
283
						String text = ecpCellEditor.getFormatedString(value);
284
						cell.setText(text == null ? "" : text);
284
						cell.setText(text == null ? "" : text); //$NON-NLS-1$
285
285
286
					} else {
286
					} else {
287
287
288
						cell.setText(value == null ? "" : value.toString()); //$NON-NLS-1$
288
						cell.setText(value == null ? "" : value.toString()); //$NON-NLS-1$
289
						cell.getControl().setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_edit_cellEditor_string");
289
						cell.getControl().setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_edit_cellEditor_string"); //$NON-NLS-1$
290
					}
290
					}
291
291
292
					// if (featureErrorMap.containsKey(element)
292
					// if (featureErrorMap.containsKey(element)
Lines 469-475 public class TableControl extends SWTControl { Link Here
469
		TableColumnLayout layout = new TableColumnLayout();
469
		TableColumnLayout layout = new TableColumnLayout();
470
		composite.setLayout(layout);
470
		composite.setLayout(layout);
471
		for (int i = 0; i < tableViewer.getTable().getColumns().length; i++) {
471
		for (int i = 0; i < tableViewer.getTable().getColumns().length; i++) {
472
			Integer storedValue = (Integer) tableViewer.getTable().getColumns()[i].getData("width");
472
			Integer storedValue = (Integer) tableViewer.getTable().getColumns()[i].getData("width"); //$NON-NLS-1$
473
			layout.setColumnData(tableViewer.getTable().getColumns()[i], new ColumnWeightData(storedValue == null ? 50
473
			layout.setColumnData(tableViewer.getTable().getColumns()[i], new ColumnWeightData(storedValue == null ? 50
474
				: storedValue));
474
				: storedValue));
475
		}
475
		}
Lines 501-507 public class TableControl extends SWTControl { Link Here
501
		removeButton = new Button(buttonComposite, SWT.None);
501
		removeButton = new Button(buttonComposite, SWT.None);
502
		Image image = Activator.getImage("icons/delete.png"); //$NON-NLS-1$
502
		Image image = Activator.getImage("icons/delete.png"); //$NON-NLS-1$
503
		removeButton.setImage(image);
503
		removeButton.setImage(image);
504
		removeButton.setToolTipText("Remove the selected " + clazz.getInstanceClass().getSimpleName());
504
		removeButton.setToolTipText(ControlMessages.TableControl_RemoveSelected + clazz.getInstanceClass().getSimpleName());
505
		removeButton.addSelectionListener(new SelectionAdapter() {
505
		removeButton.addSelectionListener(new SelectionAdapter() {
506
			/*
506
			/*
507
			 * (non-Javadoc)
507
			 * (non-Javadoc)
Lines 522-529 public class TableControl extends SWTControl { Link Here
522
					deletionList.add((EObject) iterator.next());
522
					deletionList.add((EObject) iterator.next());
523
				}
523
				}
524
524
525
				MessageDialog dialog = new MessageDialog(tableViewer.getTable().getShell(), "Delete?", null,
525
				MessageDialog dialog = new MessageDialog(tableViewer.getTable().getShell(), ControlMessages.TableControl_Delete, null,
526
					"Are you sure you want to delete the selected Elements?", MessageDialog.CONFIRM, new String[] {
526
					ControlMessages.TableControl_DeleteAreYouSure, MessageDialog.CONFIRM, new String[] {
527
						JFaceResources.getString(IDialogLabelKeys.YES_LABEL_KEY),
527
						JFaceResources.getString(IDialogLabelKeys.YES_LABEL_KEY),
528
						JFaceResources.getString(IDialogLabelKeys.NO_LABEL_KEY) }, 0);
528
						JFaceResources.getString(IDialogLabelKeys.NO_LABEL_KEY) }, 0);
529
529
Lines 565-571 public class TableControl extends SWTControl { Link Here
565
		addButton = new Button(buttonComposite, SWT.None);
565
		addButton = new Button(buttonComposite, SWT.None);
566
		Image image = Activator.getImage("icons/add.png"); //$NON-NLS-1$
566
		Image image = Activator.getImage("icons/add.png"); //$NON-NLS-1$
567
		addButton.setImage(image);
567
		addButton.setImage(image);
568
		addButton.setToolTipText("Add an instance of " + clazz.getInstanceClass().getSimpleName());
568
		addButton.setToolTipText(ControlMessages.TableControl_AddInstanceOf + clazz.getInstanceClass().getSimpleName());
569
		addButton.addSelectionListener(new SelectionAdapter() {
569
		addButton.addSelectionListener(new SelectionAdapter() {
570
			/*
570
			/*
571
			 * (non-Javadoc)
571
			 * (non-Javadoc)
Lines 721-727 public class TableControl extends SWTControl { Link Here
721
	 */
721
	 */
722
	@Override
722
	@Override
723
	protected String getUnsetLabelText() {
723
	protected String getUnsetLabelText() {
724
		return "Not set. Click to set!";
724
		return ControlMessages.TableControl_NotSetClickToSet;
725
	}
725
	}
726
726
727
	/*
727
	/*
Lines 730-736 public class TableControl extends SWTControl { Link Here
730
	 */
730
	 */
731
	@Override
731
	@Override
732
	protected String getUnsetButtonTooltip() {
732
	protected String getUnsetButtonTooltip() {
733
		return "Unset";
733
		return ControlMessages.TableControl_Unset;
734
	}
734
	}
735
735
736
	/*
736
	/*
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/XmlDateControlText.java (-9 / +9 lines)
Lines 72-89 public class XmlDateControlText extends AbstractTextControl { Link Here
72
72
73
	@Override
73
	@Override
74
	protected String getTextVariantID() {
74
	protected String getTextVariantID() {
75
		return "org_eclipse_emf_ecp_control_xmldate";
75
		return "org_eclipse_emf_ecp_control_xmldate"; //$NON-NLS-1$
76
	}
76
	}
77
77
78
	@Override
78
	@Override
79
	protected String getUnsetLabelText() {
79
	protected String getUnsetLabelText() {
80
		// TODO language
80
		return ControlMessages.XmlDateControlText_NoDateSetClickToSetDate;
81
		return "No date set! Click to set date."; //$NON-NLS-1$
82
	}
81
	}
83
82
84
	@Override
83
	@Override
85
	protected String getUnsetButtonTooltip() {
84
	protected String getUnsetButtonTooltip() {
86
		return "Unset date";
85
		return ControlMessages.XmlDateControlText_UnsetDate;
87
	}
86
	}
88
87
89
	@Override
88
	@Override
Lines 97-103 public class XmlDateControlText extends AbstractTextControl { Link Here
97
		super.fillControlComposite(composite);
96
		super.fillControlComposite(composite);
98
		((GridLayout) composite.getLayout()).numColumns = 2;
97
		((GridLayout) composite.getLayout()).numColumns = 2;
99
		final Button button = new Button(composite, SWT.PUSH);
98
		final Button button = new Button(composite, SWT.PUSH);
100
		button.setText("Datum wählen");
99
		button.setText(ControlMessages.XmlDateControlText_SelectDate);
101
		button.addSelectionListener(new SelectionAdapter() {
100
		button.addSelectionListener(new SelectionAdapter() {
102
101
103
			@Override
102
			@Override
Lines 221-234 public class XmlDateControlText extends AbstractTextControl { Link Here
221
220
222
		private Object revertToOldValue(final Object value) {
221
		private Object revertToOldValue(final Object value) {
223
222
224
			if (getStructuralFeature().getDefaultValue() == null && (value == null || value.equals(""))) {
223
			if (getStructuralFeature().getDefaultValue() == null && (value == null || value.equals(""))) { //$NON-NLS-1$
225
				return null;
224
				return null;
226
			}
225
			}
227
226
228
			Object result = getModelValue().getValue();
227
			Object result = getModelValue().getValue();
229
228
230
			MessageDialog messageDialog = new MessageDialog(getText().getShell(), "Invalid Number", null,
229
			MessageDialog messageDialog = new MessageDialog(getText().getShell(),
231
				"The Number you have entered is invalid. The value will be unset.", MessageDialog.ERROR,
230
				ControlMessages.XmlDateControlText_InvalidNumber, null,
231
				ControlMessages.XmlDateControlText_NumberInvalidValueWillBeUnset, MessageDialog.ERROR,
232
				new String[] { JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY) }, 0);
232
				new String[] { JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY) }, 0);
233
233
234
			new ECPDialogExecutor(messageDialog) {
234
			new ECPDialogExecutor(messageDialog) {
Lines 239-245 public class XmlDateControlText extends AbstractTextControl { Link Here
239
			}.execute();
239
			}.execute();
240
240
241
			if (result == null) {
241
			if (result == null) {
242
				getText().setText("");
242
				getText().setText(""); //$NON-NLS-1$
243
			} else {
243
			} else {
244
				XMLGregorianCalendar gregorianCalendar = (XMLGregorianCalendar) result;
244
				XMLGregorianCalendar gregorianCalendar = (XMLGregorianCalendar) result;
245
				Date date = gregorianCalendar.toGregorianCalendar().getTime();
245
				Date date = gregorianCalendar.toGregorianCalendar().getTime();
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/messages.properties (+56 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2013 EclipseSource.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#    EclipseSource - initial API and implementation
10
################################################################################
11
12
AbstractTextControl_InvalidInput=Invalid input
13
AbstractTextControl_InvalidInputSpace=Invalid input 
14
AbstractTextControl_Unset=<unset>
15
16
AttributeMultiControl_NotSetClickToSet=Not set. Click to set\!
17
AttributeMultiControl_Unset=Unset
18
19
BooleanControl_NoBooleanSetClickToSetBoolean=No boolean set\! Click to set boolean.
20
BooleanControl_UnsetBoolean=Unset boolean
21
22
DateTimeControl_NoDateSetClickToSetDate=No date set\! Click to set date.
23
DateTimeControl_UnsetDate=Unset Date
24
25
EEnumControl_NoValueSetClickToSetValue=No value set\! Click to set value.
26
EEnumControl_UnsetValue=Unset value
27
28
LinkControl_NoLinkSetClickToSetLink=No link set\! Click to set link.
29
LinkControl_NotSet=(Not Set)
30
LinkControl_UnsetLink=Unset Link
31
32
NumericalControl_FormatNumerical=The format is '\#'.
33
NumericalControl_FormatNumericalDecimal=The format is '\#.\#'.
34
NumericalControl_InvalidNumber=Invalid Number
35
NumericalControl_InvalidNumberWillBeUnset=The Number you have entered is invalid. The value will be unset.
36
NumericalControl_NoNumberClickToSetNumber=No number set\! Click to set number.
37
NumericalControl_UnsetNumber=Unset number
38
39
ReferenceMultiControl_NotSetClickToSet=Not set. Click to set\!
40
ReferenceMultiControl_Unset=Unset
41
42
StringControl_NoTextSetClickToSetText=No text set\! Click to set text.
43
StringControl_UnsetText=Unset text
44
45
TableControl_AddInstanceOf=Add an instance of 
46
TableControl_Delete=Delete?
47
TableControl_DeleteAreYouSure=Are you sure you want to delete the selected Elements?
48
TableControl_NotSetClickToSet=Not set. Click to set\!
49
TableControl_RemoveSelected=Remove the selected 
50
TableControl_Unset=Unset
51
52
XmlDateControlText_InvalidNumber=Invalid Number
53
XmlDateControlText_NoDateSetClickToSetDate=No date set\! Click to set date.
54
XmlDateControlText_NumberInvalidValueWillBeUnset=The Number you have entered is invalid. The value will be unset.
55
XmlDateControlText_SelectDate=Select Date
56
XmlDateControlText_UnsetDate=Unset date
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/DateCellEditor.java (-3 / +3 lines)
Lines 93-101 public class DateCellEditor extends CellEditor implements ECPCellEditor { Link Here
93
	protected Control createControl(Composite parent) {
93
	protected Control createControl(Composite parent) {
94
		// Composite composite = new Composite(parent, SWT.NONE);
94
		// Composite composite = new Composite(parent, SWT.NONE);
95
		dateWidget = new DateTime(parent, SWT.DATE);
95
		dateWidget = new DateTime(parent, SWT.DATE);
96
		dateWidget.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_edit_cellEditor_date");
96
		dateWidget.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_edit_cellEditor_date"); //$NON-NLS-1$
97
		// timeWidget = new DateTime(composite, SWT.TIME);
97
		// timeWidget = new DateTime(composite, SWT.TIME);
98
		// timeWidget.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_edit_swt_cellEditor_time");
98
		// timeWidget.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_edit_swt_cellEditor_time"); //$NON-NLS-1$
99
99
100
		dateWidget.addKeyListener(new KeyAdapter() {
100
		dateWidget.addKeyListener(new KeyAdapter() {
101
			// hook key pressed - see PR 14201
101
			// hook key pressed - see PR 14201
Lines 205-211 public class DateCellEditor extends CellEditor implements ECPCellEditor { Link Here
205
	public String getFormatedString(Object value) {
205
	public String getFormatedString(Object value) {
206
		Date cal = (Date) value;
206
		Date cal = (Date) value;
207
		if (value == null) {
207
		if (value == null) {
208
			return "";
208
			return ""; //$NON-NLS-1$
209
		}
209
		}
210
		return dateFormat.format(cal);
210
		return dateFormat.format(cal);
211
	}
211
	}
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/LinkCellEditor.java (-2 / +2 lines)
Lines 94-100 public class LinkCellEditor extends CellEditor implements ECPCellEditor { Link Here
94
94
95
		adapterFactoryItemDelegator = new AdapterFactoryItemDelegator(composedAdapterFactory);
95
		adapterFactoryItemDelegator = new AdapterFactoryItemDelegator(composedAdapterFactory);
96
		link = new Link(parent, SWT.NONE);
96
		link = new Link(parent, SWT.NONE);
97
		link.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_edit_cellEditor_reference");
97
		link.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_edit_cellEditor_reference"); //$NON-NLS-1$
98
		link.addSelectionListener(new SelectionAdapter() {
98
		link.addSelectionListener(new SelectionAdapter() {
99
99
100
			@Override
100
			@Override
Lines 134-140 public class LinkCellEditor extends CellEditor implements ECPCellEditor { Link Here
134
	@Override
134
	@Override
135
	protected void doSetValue(Object value) {
135
	protected void doSetValue(Object value) {
136
		String linkName = adapterFactoryItemDelegator.getText(value);
136
		String linkName = adapterFactoryItemDelegator.getText(value);
137
		link.setText("<a>" + linkName + "</a>");
137
		link.setText("<a>" + linkName + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
138
	}
138
	}
139
139
140
	/*
140
	/*
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/NumberCellEditor.java (-12 / +12 lines)
Lines 56-62 public class NumberCellEditor extends TextCellEditor implements ECPCellEditor { Link Here
56
	public void instantiate(IItemPropertyDescriptor descriptor, ECPControlContext ecpControlContext) {
56
	public void instantiate(IItemPropertyDescriptor descriptor, ECPControlContext ecpControlContext) {
57
		this.descriptor = descriptor;
57
		this.descriptor = descriptor;
58
		this.ecpControlContext = ecpControlContext;
58
		this.ecpControlContext = ecpControlContext;
59
		getControl().setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_edit_cellEditor_numberical");
59
		getControl().setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_edit_cellEditor_numberical"); //$NON-NLS-1$
60
		// do nothing
60
		// do nothing
61
	}
61
	}
62
62
Lines 66-73 public class NumberCellEditor extends TextCellEditor implements ECPCellEditor { Link Here
66
	 */
66
	 */
67
	public String getFormatedString(Object value) {
67
	public String getFormatedString(Object value) {
68
		if (value == null) {
68
		if (value == null) {
69
			setErrorMessage("Value is null");
69
			setErrorMessage(TableMessages.NumberCellEditor_ValueIsNull);
70
			return "";
70
			return ""; //$NON-NLS-1$
71
		}
71
		}
72
72
73
		DecimalFormat format = NumericalHelper.setupFormat(ecpControlContext.getLocale(), getInstanceClass());
73
		DecimalFormat format = NumericalHelper.setupFormat(ecpControlContext.getLocale(), getInstanceClass());
Lines 112-127 public class NumberCellEditor extends TextCellEditor implements ECPCellEditor { Link Here
112
						if (NumericalHelper.isInteger(getInstanceClass())) {
112
						if (NumericalHelper.isInteger(getInstanceClass())) {
113
							boolean maxValue = false;
113
							boolean maxValue = false;
114
							Class<?> instanceClass = getInstanceClass();
114
							Class<?> instanceClass = getInstanceClass();
115
							String formatedValue = "";
115
							String formatedValue = ""; //$NON-NLS-1$
116
							try {
116
							try {
117
								if (Integer.class.isAssignableFrom(instanceClass)
117
								if (Integer.class.isAssignableFrom(instanceClass)
118
									|| Integer.class.getField("TYPE").get(null).equals(instanceClass)) {
118
									|| Integer.class.getField("TYPE").get(null).equals(instanceClass)) { //$NON-NLS-1$
119
									if (Integer.MAX_VALUE == number.intValue()) {
119
									if (Integer.MAX_VALUE == number.intValue()) {
120
										maxValue = true;
120
										maxValue = true;
121
										formatedValue = format.format(Integer.MAX_VALUE);
121
										formatedValue = format.format(Integer.MAX_VALUE);
122
									}
122
									}
123
								} else if (Long.class.isAssignableFrom(instanceClass)
123
								} else if (Long.class.isAssignableFrom(instanceClass)
124
									|| Long.class.getField("TYPE").get(null).equals(instanceClass)) {
124
									|| Long.class.getField("TYPE").get(null).equals(instanceClass)) { //$NON-NLS-1$
125
									if (Long.MAX_VALUE == number.longValue()) {
125
									if (Long.MAX_VALUE == number.longValue()) {
126
										maxValue = true;
126
										maxValue = true;
127
										formatedValue = format.format(Long.MAX_VALUE);
127
										formatedValue = format.format(Long.MAX_VALUE);
Lines 143-149 public class NumberCellEditor extends TextCellEditor implements ECPCellEditor { Link Here
143
							}
143
							}
144
						}
144
						}
145
					}
145
					}
146
					String formatedNumber = "";
146
					String formatedNumber = ""; //$NON-NLS-1$
147
					if (number != null) {
147
					if (number != null) {
148
						formatedNumber = format.format(number);
148
						formatedNumber = format.format(number);
149
					}
149
					}
Lines 165-179 public class NumberCellEditor extends TextCellEditor implements ECPCellEditor { Link Here
165
165
166
			private Object revertToOldValue(final Object value) {
166
			private Object revertToOldValue(final Object value) {
167
167
168
				if (getStructuralFeature().getDefaultValue() == null && (value == null || value.equals(""))) {
168
				if (getStructuralFeature().getDefaultValue() == null && (value == null || value.equals(""))) { //$NON-NLS-1$
169
					return null;
169
					return null;
170
				}
170
				}
171
171
172
				// Object result = getModelValue().getValue();
172
				// Object result = getModelValue().getValue();
173
				Object result = null;
173
				Object result = null;
174
174
175
				MessageDialog messageDialog = new MessageDialog(getText().getShell(), "Invalid Number", null,
175
				MessageDialog messageDialog = new MessageDialog(getText().getShell(), TableMessages.NumberCellEditor_InvalidNumber, null,
176
					"The Number you have entered is invalid. The value will be unset.", MessageDialog.ERROR,
176
					TableMessages.NumberCellEditor_NumberYouEnteredIsInvalid, MessageDialog.ERROR,
177
					new String[] { JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY) }, 0);
177
					new String[] { JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY) }, 0);
178
178
179
				new ECPDialogExecutor(messageDialog) {
179
				new ECPDialogExecutor(messageDialog) {
Lines 184-190 public class NumberCellEditor extends TextCellEditor implements ECPCellEditor { Link Here
184
				}.execute();
184
				}.execute();
185
185
186
				if (result == null) {
186
				if (result == null) {
187
					getText().setText("");
187
					getText().setText(""); //$NON-NLS-1$
188
				} else {
188
				} else {
189
					DecimalFormat format = format = NumericalHelper.setupFormat(ecpControlContext.getLocale(),
189
					DecimalFormat format = format = NumericalHelper.setupFormat(ecpControlContext.getLocale(),
190
						getInstanceClass());
190
						getInstanceClass());
Lines 209-215 public class NumberCellEditor extends TextCellEditor implements ECPCellEditor { Link Here
209
			@Override
209
			@Override
210
			public Object convert(Object value) {
210
			public Object convert(Object value) {
211
				if (value == null) {
211
				if (value == null) {
212
					return "";
212
					return ""; //$NON-NLS-1$
213
				}
213
				}
214
				final DecimalFormat format = NumericalHelper.setupFormat(ecpControlContext.getLocale(),
214
				final DecimalFormat format = NumericalHelper.setupFormat(ecpControlContext.getLocale(),
215
					getInstanceClass());
215
					getInstanceClass());
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/TableMessages.java (+32 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2013 EclipseSource.
3
 * 
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors:
10
 * EclipseSource - initial API and implementation
11
 *******************************************************************************/
12
package org.eclipse.emf.ecp.edit.internal.swt.table;
13
14
import org.eclipse.osgi.util.NLS;
15
16
public class TableMessages extends NLS {
17
18
	private static final String BUNDLE_NAME = "org.eclipse.emf.ecp.edit.internal.swt.table.messages"; //$NON-NLS-1$
19
20
	public static String NumberCellEditor_InvalidNumber;
21
	public static String NumberCellEditor_NumberYouEnteredIsInvalid;
22
	public static String NumberCellEditor_ValueIsNull;
23
24
	private TableMessages() {
25
	}
26
27
	static {
28
		// initialize resource bundle
29
		NLS.initializeMessages(BUNDLE_NAME, TableMessages.class);
30
	}
31
32
}
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/XmlDateCellEditor.java (-2 / +2 lines)
Lines 93-99 public class XmlDateCellEditor extends CellEditor implements ECPCellEditor { Link Here
93
	@Override
93
	@Override
94
	protected Control createControl(Composite parent) {
94
	protected Control createControl(Composite parent) {
95
		dateWidget = new DateTime(parent, SWT.DATE | SWT.DROP_DOWN);
95
		dateWidget = new DateTime(parent, SWT.DATE | SWT.DROP_DOWN);
96
		dateWidget.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_edit_cellEditor_xmlDate");
96
		dateWidget.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_edit_cellEditor_xmlDate"); //$NON-NLS-1$
97
		dateWidget.addKeyListener(new KeyAdapter() {
97
		dateWidget.addKeyListener(new KeyAdapter() {
98
			// hook key pressed - see PR 14201
98
			// hook key pressed - see PR 14201
99
			@Override
99
			@Override
Lines 198-204 public class XmlDateCellEditor extends CellEditor implements ECPCellEditor { Link Here
198
	public String getFormatedString(Object value) {
198
	public String getFormatedString(Object value) {
199
		XMLGregorianCalendar cal = (XMLGregorianCalendar) value;
199
		XMLGregorianCalendar cal = (XMLGregorianCalendar) value;
200
		if (value == null) {
200
		if (value == null) {
201
			return "";
201
			return ""; //$NON-NLS-1$
202
		}
202
		}
203
		return dateFormat.format(cal.toGregorianCalendar().getTime());
203
		return dateFormat.format(cal.toGregorianCalendar().getTime());
204
	}
204
	}
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/messages.properties (+16 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2013 EclipseSource.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#    EclipseSource - initial API and implementation
10
################################################################################
11
12
NumberCellEditor_InvalidNumber=Invalid Number
13
14
NumberCellEditor_NumberYouEnteredIsInvalid=The Number you have entered is invalid. The value will be unset.
15
16
NumberCellEditor_ValueIsNull=Value is null
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/CellEditorFactory.java (-3 / +2 lines)
Lines 69-77 public final class CellEditorFactory { Link Here
69
	private static <T> Class<T> loadClass(String bundleName, String clazz) throws ClassNotFoundException {
69
	private static <T> Class<T> loadClass(String bundleName, String clazz) throws ClassNotFoundException {
70
		Bundle bundle = Platform.getBundle(bundleName);
70
		Bundle bundle = Platform.getBundle(bundleName);
71
		if (bundle == null) {
71
		if (bundle == null) {
72
			// TODO externalize strings
72
			throw new ClassNotFoundException(clazz + UtilMessages.CellEditorFactory_CannotBeLoadedBecauseBundle + bundleName
73
			throw new ClassNotFoundException(clazz + " cannot be loaded because bundle " + bundleName //$NON-NLS-1$
73
				+ UtilMessages.CellEditorFactory_CannotBeResolved);
74
				+ " cannot be resolved"); //$NON-NLS-1$
75
		}
74
		}
76
		return (Class<T>) bundle.loadClass(clazz);
75
		return (Class<T>) bundle.loadClass(clazz);
77
76
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/DialogOpener.java (-2 / +2 lines)
Lines 28-37 public class DialogOpener { Link Here
28
	public static void openDialog(Dialog dialog, ECPDialogExecutor callBack) {
28
	public static void openDialog(Dialog dialog, ECPDialogExecutor callBack) {
29
		DialogWrapper wrapper = null;
29
		DialogWrapper wrapper = null;
30
		IConfigurationElement[] controls = Platform.getExtensionRegistry().getConfigurationElementsFor(
30
		IConfigurationElement[] controls = Platform.getExtensionRegistry().getConfigurationElementsFor(
31
			"org.eclipse.emf.ecp.edit.swt.dialogWrapper");
31
			"org.eclipse.emf.ecp.edit.swt.dialogWrapper"); //$NON-NLS-1$
32
		for (IConfigurationElement e : controls) {
32
		for (IConfigurationElement e : controls) {
33
			try {
33
			try {
34
				wrapper = (DialogWrapper) e.createExecutableExtension("class");
34
				wrapper = (DialogWrapper) e.createExecutableExtension("class"); //$NON-NLS-1$
35
				break;
35
				break;
36
			} catch (CoreException e1) {
36
			} catch (CoreException e1) {
37
				Activator.logException(e1);
37
				Activator.logException(e1);
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/ECPCellEditor.java (-1 / +1 lines)
Lines 28-34 public interface ECPCellEditor { Link Here
28
	/**
28
	/**
29
	 * RAP theming variable.
29
	 * RAP theming variable.
30
	 */
30
	 */
31
	String CUSTOM_VARIANT = "org.eclipse.rap.rwt.customVariant";
31
	String CUSTOM_VARIANT = "org.eclipse.rap.rwt.customVariant"; //$NON-NLS-1$
32
32
33
	IValueProperty getValueProperty();
33
	IValueProperty getValueProperty();
34
34
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/SWTControl.java (-5 / +5 lines)
Lines 51-57 public abstract class SWTControl extends ECPAbstractControl { Link Here
51
	/**
51
	/**
52
	 * RAP theming variable to set.
52
	 * RAP theming variable to set.
53
	 */
53
	 */
54
	protected static final String CUSTOM_VARIANT = "org.eclipse.rap.rwt.customVariant";
54
	protected static final String CUSTOM_VARIANT = "org.eclipse.rap.rwt.customVariant";//$NON-NLS-1$
55
55
56
	protected static final String VALIDATION_ERROR_ICON = "icons/validation_error.png";//$NON-NLS-1$
56
	protected static final String VALIDATION_ERROR_ICON = "icons/validation_error.png";//$NON-NLS-1$
57
57
Lines 123-135 public abstract class SWTControl extends ECPAbstractControl { Link Here
123
		if (getModelElementContext().isRunningAsWebApplication() && getHelpText() != null
123
		if (getModelElementContext().isRunningAsWebApplication() && getHelpText() != null
124
			&& getHelpText().length() != 0) {
124
			&& getHelpText().length() != 0) {
125
			Label l = new Label(composite, SWT.PUSH);
125
			Label l = new Label(composite, SWT.PUSH);
126
			l.setImage(Activator.getImage("icons/help.png"));
126
			l.setImage(Activator.getImage("icons/help.png")); //$NON-NLS-1$
127
			l.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_help");
127
			l.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_help"); //$NON-NLS-1$
128
			l.setBackground(parent.getBackground());
128
			l.setBackground(parent.getBackground());
129
			l.addMouseListener(new MouseListener() {
129
			l.addMouseListener(new MouseListener() {
130
130
131
				public void mouseUp(MouseEvent e) {
131
				public void mouseUp(MouseEvent e) {
132
					MessageDialog dialog = new MessageDialog(parent.getShell(), "Help", null, getHelpText(),
132
					MessageDialog dialog = new MessageDialog(parent.getShell(), UtilMessages.SWTControl_Help, null, getHelpText(),
133
						MessageDialog.INFORMATION, new String[] { JFaceResources
133
						MessageDialog.INFORMATION, new String[] { JFaceResources
134
							.getString(IDialogLabelKeys.OK_LABEL_KEY) }, 0);
134
							.getString(IDialogLabelKeys.OK_LABEL_KEY) }, 0);
135
					new ECPDialogExecutor(dialog) {
135
					new ECPDialogExecutor(dialog) {
Lines 255-261 public abstract class SWTControl extends ECPAbstractControl { Link Here
255
					showUnsetLabel();
255
					showUnsetLabel();
256
				}
256
				}
257
			});
257
			});
258
			unsetButton.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_unset");
258
			unsetButton.setData(CUSTOM_VARIANT, "org_eclipse_emf_ecp_control_unset"); //$NON-NLS-1$
259
		}
259
		}
260
260
261
		if (!getStructuralFeature().isUnsettable()
261
		if (!getStructuralFeature().isUnsettable()
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/UtilMessages.java (+33 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2013 EclipseSource.
3
 * 
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors:
10
 * EclipseSource - initial API and implementation
11
 *******************************************************************************/
12
package org.eclipse.emf.ecp.edit.internal.swt.util;
13
14
import org.eclipse.osgi.util.NLS;
15
16
public class UtilMessages extends NLS {
17
18
	private static final String BUNDLE_NAME = "org.eclipse.emf.ecp.edit.internal.swt.util.messages"; //$NON-NLS-1$
19
20
	public static String CellEditorFactory_CannotBeLoadedBecauseBundle;
21
	public static String CellEditorFactory_CannotBeResolved;
22
23
	public static String SWTControl_Help;
24
25
	private UtilMessages() {
26
	}
27
28
	static {
29
		// initialize resource bundle
30
		NLS.initializeMessages(BUNDLE_NAME, UtilMessages.class);
31
	}
32
33
}
(-)a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/messages.properties (+15 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2013 EclipseSource.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#    EclipseSource - initial API and implementation
10
################################################################################
11
12
CellEditorFactory_CannotBeLoadedBecauseBundle=\ cannot be loaded because bundle 
13
CellEditorFactory_CannotBeResolved=\ cannot be resolved
14
15
SWTControl_Help=Help
(-)a/bundles/org.eclipse.emf.ecp.edit/META-INF/MANIFEST.MF (-2 / +2 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: ECP Edit
3
Bundle-Name: %Bundle-Name
4
Bundle-SymbolicName: org.eclipse.emf.ecp.edit;singleton:=true
4
Bundle-SymbolicName: org.eclipse.emf.ecp.edit;singleton:=true
5
Bundle-Version: 1.0.1.qualifier
5
Bundle-Version: 1.0.1.qualifier
6
Bundle-Activator: org.eclipse.emf.ecp.internal.edit.Activator
6
Bundle-Activator: org.eclipse.emf.ecp.internal.edit.Activator
Lines 15-18 Export-Package: org.eclipse.emf.ecp.edit;version="1.0.0", Link Here
15
 org.eclipse.emf.ecp.edit.util;version="1.0.0",
15
 org.eclipse.emf.ecp.edit.util;version="1.0.0",
16
 org.eclipse.emf.ecp.internal.edit;version="1.0.0";x-internal:=true
16
 org.eclipse.emf.ecp.internal.edit;version="1.0.0";x-internal:=true
17
Service-Component: OSGI-INF/ecpControlFactory.xml
17
Service-Component: OSGI-INF/ecpControlFactory.xml
18
Bundle-Vendor: Eclipse Modeling Project
18
Bundle-Vendor: %Bundle-Vendor
(-)a/bundles/org.eclipse.emf.ecp.edit/OSGI-INF/l10n/bundle.properties (+17 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2013 EclipseSource.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#    EclipseSource - initial API and implementation
10
################################################################################
11
12
#Properties file for org.eclipse.emf.ecp.edit
13
14
Bundle-Vendor = Eclipse Modeling Project
15
Bundle-Name = ECP Edit
16
17
extension-point.controls = ECP Controls
(-)a/bundles/org.eclipse.emf.ecp.edit/plugin.xml (-1 / +1 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.4"?>
2
<?eclipse version="3.4"?>
3
<plugin>
3
<plugin>
4
<extension-point id="controls" name="ECP Controls" schema="schema/controls.exsd"/>
4
<extension-point id="controls" name="%extension-point.controls" schema="schema/controls.exsd"/>
5
<extension
5
<extension
6
      point="org.eclipse.equinox.preferences.preferences">
6
      point="org.eclipse.equinox.preferences.preferences">
7
</extension>
7
</extension>
(-)a/bundles/org.eclipse.emf.ecp.edit/src/org/eclipse/emf/ecp/internal/edit/ControlFactoryImpl.java (-28 / +24 lines)
Lines 1-11 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2011-2013 EclipseSource Muenchen GmbH and others.
2
 * Copyright (c) 2011-2013 EclipseSource Muenchen GmbH and others.
3
 * 
3
 *
4
 * All rights reserved. This program and the accompanying materials
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
8
 *
9
 * Contributors:
9
 * Contributors:
10
 * Eugen Neufeld - initial API and implementation
10
 * Eugen Neufeld - initial API and implementation
11
 ******************************************************************************/
11
 ******************************************************************************/
Lines 32-62 import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; Link Here
32
import org.osgi.framework.Bundle;
32
import org.osgi.framework.Bundle;
33
33
34
/**
34
/**
35
 * The ControlFactoryImpl is a Singelton which reads the org.eclipse.emf.ecp.editor.widgets ExtensionPoint and provides a
35
 * The ControlFactoryImpl is a Singleton which reads the org.eclipse.emf.ecp.editor.widgets ExtensionPoint and provides
36
 * method ({@link #createControl(T, IItemPropertyDescriptor, ECPControlContext)}) for creating a suitable
36
 * a method ({@link #createControl(T, IItemPropertyDescriptor, ECPControlContext)}) for creating a suitable
37
 * control for with the known widgets.
37
 * control for with the known widgets.
38
 * 
38
 *
39
 * @author Eugen Neufeld
39
 * @author Eugen Neufeld
40
 * 
40
 *
41
 */
41
 */
42
public final class ControlFactoryImpl implements ECPControlFactory{
42
public final class ControlFactoryImpl implements ECPControlFactory{
43
43
44
	private static final String CONTROL_EXTENSION = "org.eclipse.emf.ecp.edit.controls"; //$NON-NLS-1$
44
	private static final String CONTROL_EXTENSION = "org.eclipse.emf.ecp.edit.controls"; //$NON-NLS-1$
45
	
45
46
	private static final String CLASS_ATTRIBUTE = "class";//$NON-NLS-1$
46
	private static final String CLASS_ATTRIBUTE = "class";//$NON-NLS-1$
47
	private static final String CONTROL_ID = "id";//$NON-NLS-1$
47
	private static final String CONTROL_ID = "id";//$NON-NLS-1$
48
	private static final String LABEL_ATTRIBUTE = "showLabel";//$NON-NLS-1$
48
	private static final String LABEL_ATTRIBUTE = "showLabel";//$NON-NLS-1$
49
	
49
50
	private static final String TEST_DYNAMIC = "dynamicTest";//$NON-NLS-1$
50
	private static final String TEST_DYNAMIC = "dynamicTest";//$NON-NLS-1$
51
	private static final String CONTROL_TESTER = "testClass";//$NON-NLS-1$
51
	private static final String CONTROL_TESTER = "testClass";//$NON-NLS-1$
52
	
52
53
	private static final String TEST_STATIC = "staticTest";//$NON-NLS-1$
53
	private static final String TEST_STATIC = "staticTest";//$NON-NLS-1$
54
	private static final String TESTER_PRIORITY = "priority";//$NON-NLS-1$
54
	private static final String TESTER_PRIORITY = "priority";//$NON-NLS-1$
55
	private static final String TESTER_CLASSTYPE = "supportedClassType";//$NON-NLS-1$
55
	private static final String TESTER_CLASSTYPE = "supportedClassType";//$NON-NLS-1$
56
	private static final String TESTER_EOBJECT = "supportedEObject";//$NON-NLS-1$
56
	private static final String TESTER_EOBJECT = "supportedEObject";//$NON-NLS-1$
57
	private static final String TESTER_FEATURE = "supportedFeature";//$NON-NLS-1$
57
	private static final String TESTER_FEATURE = "supportedFeature";//$NON-NLS-1$
58
	private static final String TESTER_SINGLEVALUE = "singleValue";//$NON-NLS-1$
58
	private static final String TESTER_SINGLEVALUE = "singleValue";//$NON-NLS-1$
59
	
59
60
	private Set<ECPControlDescription> controlDescriptors = new HashSet<ECPControlDescription>();
60
	private Set<ECPControlDescription> controlDescriptors = new HashSet<ECPControlDescription>();
61
61
62
	/**
62
	/**
Lines 77-83 public final class ControlFactoryImpl implements ECPControlFactory{ Link Here
77
				String clazz = e.getAttribute(CLASS_ATTRIBUTE);
77
				String clazz = e.getAttribute(CLASS_ATTRIBUTE);
78
				Class<? extends ECPAbstractControl> resolvedClass = loadClass(e.getContributor().getName(), clazz);
78
				Class<? extends ECPAbstractControl> resolvedClass = loadClass(e.getContributor().getName(), clazz);
79
				boolean showLabel = Boolean.parseBoolean(e.getAttribute(LABEL_ATTRIBUTE));
79
				boolean showLabel = Boolean.parseBoolean(e.getAttribute(LABEL_ATTRIBUTE));
80
				
80
81
//				ECPApplicableTester tester=null;
81
//				ECPApplicableTester tester=null;
82
				Set<ECPApplicableTester> tester=new HashSet<ECPApplicableTester>();
82
				Set<ECPApplicableTester> tester=new HashSet<ECPApplicableTester>();
83
				for(IConfigurationElement testerExtension: e.getChildren()){
83
				for(IConfigurationElement testerExtension: e.getChildren()){
Lines 87-105 public final class ControlFactoryImpl implements ECPControlFactory{ Link Here
87
					else if(TEST_STATIC.equals(testerExtension.getName())){
87
					else if(TEST_STATIC.equals(testerExtension.getName())){
88
						boolean singleValue = Boolean.parseBoolean(testerExtension.getAttribute(TESTER_SINGLEVALUE));
88
						boolean singleValue = Boolean.parseBoolean(testerExtension.getAttribute(TESTER_SINGLEVALUE));
89
						int priority = Integer.parseInt(testerExtension.getAttribute(TESTER_PRIORITY));
89
						int priority = Integer.parseInt(testerExtension.getAttribute(TESTER_PRIORITY));
90
						
90
91
						String type = testerExtension.getAttribute(TESTER_CLASSTYPE);
91
						String type = testerExtension.getAttribute(TESTER_CLASSTYPE);
92
						Class<?> supportedClassType = loadClass(testerExtension.getContributor().getName(), type);
92
						Class<?> supportedClassType = loadClass(testerExtension.getContributor().getName(), type);
93
						//Class.forName(type);
93
						//Class.forName(type);
94
						
94
95
						String eObject = testerExtension.getAttribute(TESTER_EOBJECT);
95
						String eObject = testerExtension.getAttribute(TESTER_EOBJECT);
96
						if (eObject == null) {
96
						if (eObject == null) {
97
							eObject = "org.eclipse.emf.ecore.EObject";//$NON-NLS-1$
97
							eObject = "org.eclipse.emf.ecore.EObject";//$NON-NLS-1$
98
						}
98
						}
99
						Class<? extends EObject> supportedEObject = loadClass(testerExtension.getContributor().getName(), eObject);
99
						Class<? extends EObject> supportedEObject = loadClass(testerExtension.getContributor().getName(), eObject);
100
						
100
101
						String supportedFeature = testerExtension.getAttribute(TESTER_FEATURE);
101
						String supportedFeature = testerExtension.getAttribute(TESTER_FEATURE);
102
						
102
103
						tester.add(new ECPStaticApplicableTester(singleValue, priority, supportedClassType, supportedEObject, supportedFeature));
103
						tester.add(new ECPStaticApplicableTester(singleValue, priority, supportedClassType, supportedEObject, supportedFeature));
104
					}
104
					}
105
				}
105
				}
Lines 117-125 public final class ControlFactoryImpl implements ECPControlFactory{ Link Here
117
	private static <T> Class<T> loadClass(String bundleName, String clazz) throws ClassNotFoundException {
117
	private static <T> Class<T> loadClass(String bundleName, String clazz) throws ClassNotFoundException {
118
		Bundle bundle = Platform.getBundle(bundleName);
118
		Bundle bundle = Platform.getBundle(bundleName);
119
		if (bundle == null) {
119
		if (bundle == null) {
120
			//TODO externalize strings
120
			throw new ClassNotFoundException(clazz + EditMessages.ControlFactoryImpl_CannotBeLoadedBecauseBundle + bundleName
121
			throw new ClassNotFoundException(clazz + " cannot be loaded because bundle " + bundleName //$NON-NLS-1$
121
				+ EditMessages.ControlFactoryImpl_CannotBeResolved);
122
				+ " cannot be resolved"); //$NON-NLS-1$
123
		}
122
		}
124
		return (Class<T>) bundle.loadClass(clazz);
123
		return (Class<T>) bundle.loadClass(clazz);
125
124
Lines 137-151 public final class ControlFactoryImpl implements ECPControlFactory{ Link Here
137
		}
136
		}
138
		T control = getControlInstance(controlDescription,itemPropertyDescriptor,context);
137
		T control = getControlInstance(controlDescription,itemPropertyDescriptor,context);
139
138
140
		
141
		return control;
139
		return control;
142
	}
140
	}
141
143
	/**
142
	/**
144
	 * {@inheritDoc}
143
	 * {@inheritDoc}
145
	 */
144
	 */
146
	public <T extends ECPControl> T createControl(IItemPropertyDescriptor itemPropertyDescriptor,
145
	public <T extends ECPControl> T createControl(IItemPropertyDescriptor itemPropertyDescriptor,
147
		ECPControlContext context, String controlId) {
146
		ECPControlContext context, String controlId) {
148
		
147
149
		ECPControlDescription controlDescription = null;
148
		ECPControlDescription controlDescription = null;
150
		for(ECPControlDescription desc:controlDescriptors){
149
		for(ECPControlDescription desc:controlDescriptors){
151
			if(desc.getId().equals(controlId)){
150
			if(desc.getId().equals(controlId)){
Lines 158-164 public final class ControlFactoryImpl implements ECPControlFactory{ Link Here
158
		}
157
		}
159
		T control = getControlInstance(controlDescription,itemPropertyDescriptor,context);
158
		T control = getControlInstance(controlDescription,itemPropertyDescriptor,context);
160
159
161
		
160
162
		return control;
161
		return control;
163
	}
162
	}
164
163
Lines 198-217 public final class ControlFactoryImpl implements ECPControlFactory{ Link Here
198
		int highestPriority = -1;
197
		int highestPriority = -1;
199
		ECPControlDescription bestCandidate = null;
198
		ECPControlDescription bestCandidate = null;
200
		for (ECPControlDescription description : controlDescriptors) {
199
		for (ECPControlDescription description : controlDescriptors) {
201
			
200
202
			if(!controlClass.isAssignableFrom(description.getControlClass())){
201
			if(!controlClass.isAssignableFrom(description.getControlClass())){
203
				continue;
202
				continue;
204
			}
203
			}
205
			int currentPriority=-1;
204
			int currentPriority=-1;
206
			
205
207
			for(ECPApplicableTester tester:description.getTester()){
206
			for(ECPApplicableTester tester:description.getTester()){
208
				int testerPriority=tester.isApplicable(itemPropertyDescriptor, modelElement);
207
				int testerPriority=tester.isApplicable(itemPropertyDescriptor, modelElement);
209
				if(testerPriority>currentPriority){
208
				if(testerPriority>currentPriority){
210
					currentPriority=testerPriority;
209
					currentPriority=testerPriority;
211
				}
210
				}
212
				
211
213
			}
212
			}
214
			
213
215
			if(currentPriority>highestPriority){
214
			if(currentPriority>highestPriority){
216
				highestPriority=currentPriority;
215
				highestPriority=currentPriority;
217
				bestCandidate=description;
216
				bestCandidate=description;
Lines 220-226 public final class ControlFactoryImpl implements ECPControlFactory{ Link Here
220
		return bestCandidate;
219
		return bestCandidate;
221
	}
220
	}
222
221
223
	
224
	
225
226
}
222
}
(-)a/bundles/org.eclipse.emf.ecp.edit/src/org/eclipse/emf/ecp/internal/edit/EditMessages.java (+32 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2013 EclipseSource.
3
 *
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 *
9
 * Contributors:
10
 * EclipseSource - initial API and implementation
11
 *
12
 *******************************************************************************/
13
package org.eclipse.emf.ecp.internal.edit;
14
15
import org.eclipse.osgi.util.NLS;
16
17
public class EditMessages extends NLS {
18
19
	private static final String BUNDLE_NAME = "org.eclipse.emf.ecp.internal.edit.messages"; //$NON-NLS-1$
20
21
	public static String ControlFactoryImpl_CannotBeLoadedBecauseBundle;
22
	public static String ControlFactoryImpl_CannotBeResolved;
23
24
	private EditMessages() {
25
	}
26
27
	static {
28
		// initialize resource bundle
29
		NLS.initializeMessages(BUNDLE_NAME, EditMessages.class);
30
	}
31
32
}
(-)a/bundles/org.eclipse.emf.ecp.edit/src/org/eclipse/emf/ecp/internal/edit/messages.properties (-1 / +13 lines)
Added Link Here
0
- 
1
###############################################################################
2
# Copyright (c) 2013 EclipseSource.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#    EclipseSource - initial API and implementation
10
################################################################################
11
12
ControlFactoryImpl_CannotBeLoadedBecauseBundle=\ cannot be loaded because bundle 
13
ControlFactoryImpl_CannotBeResolved=\ cannot be resolved

Return to bug 412592