View | Details | Raw Unified | Return to bug 266922
Collapse All | Expand All

(-)src/org/eclipse/pde/internal/ds/tests/DSComponentTestCase.java (-21 / +20 lines)
Lines 21-27 Link Here
21
import org.eclipse.pde.internal.ds.core.IDSService;
21
import org.eclipse.pde.internal.ds.core.IDSService;
22
22
23
public class DSComponentTestCase extends AbstractDSModelTestCase {
23
public class DSComponentTestCase extends AbstractDSModelTestCase {
24
	
24
25
	public void testAddDefaultComponent() {
25
	public void testAddDefaultComponent() {
26
		StringBuffer buffer = new StringBuffer();
26
		StringBuffer buffer = new StringBuffer();
27
		setXMLContents(buffer, LF);
27
		setXMLContents(buffer, LF);
Lines 29-39 Link Here
29
29
30
		IDSComponent component = fModel.getDSComponent();
30
		IDSComponent component = fModel.getDSComponent();
31
		assertNotNull(component);
31
		assertNotNull(component);
32
		
32
33
		assertEquals(component.getName(), COMPONENT_NAME);
33
		assertEquals(component.getName(), COMPONENT_NAME);
34
		assertEquals(component.getActivateMethod(), null);
34
		assertEquals(component.getActivateMethod(), null);
35
		assertEquals(component.getDeactivateMethod(), null);
35
		assertEquals(component.getDeactivateMethod(), null);
36
		
36
		assertEquals(component.getModifiedMethod(), null);
37
37
		assertTrue(component.getEnabled());
38
		assertTrue(component.getEnabled());
38
	}
39
	}
39
40
Lines 44-50 Link Here
44
45
45
		IDSComponent component = fModel.getDSComponent();
46
		IDSComponent component = fModel.getDSComponent();
46
		assertNotNull(component);
47
		assertNotNull(component);
47
		
48
48
		assertEquals(component.getName(), COMPONENT_NAME);
49
		assertEquals(component.getName(), COMPONENT_NAME);
49
		component.setEnabled(false);
50
		component.setEnabled(false);
50
		component.setAttributeName("NewName");
51
		component.setAttributeName("NewName");
Lines 52-66 Link Here
52
		component.setImmediate(true);
53
		component.setImmediate(true);
53
		component.setActivateMethod("start");
54
		component.setActivateMethod("start");
54
		component.setDeactivateMethod("stop");
55
		component.setDeactivateMethod("stop");
55
		
56
		component.setModifiedeMethod("modified");
57
56
		assertFalse(component.getEnabled());
58
		assertFalse(component.getEnabled());
57
		assertEquals(component.getAttributeName(), "NewName");
59
		assertEquals(component.getAttributeName(), "NewName");
58
		assertEquals(component.getFactory(), "NewFactory");
60
		assertEquals(component.getFactory(), "NewFactory");
59
		assertTrue(component.getImmediate());
61
		assertTrue(component.getImmediate());
60
		assertEquals(component.getActivateMethod(), "start");
62
		assertEquals(component.getActivateMethod(), "start");
61
		assertEquals(component.getDeactivateMethod(), "stop");
63
		assertEquals(component.getDeactivateMethod(), "stop");
64
		assertEquals(component.getModifiedMethod(), "modified");
62
	}
65
	}
63
	
64
66
65
	public void testAddMoveRemoveChildrens() {
67
	public void testAddMoveRemoveChildrens() {
66
		StringBuffer buffer = new StringBuffer();
68
		StringBuffer buffer = new StringBuffer();
Lines 69-116 Link Here
69
71
70
		IDSComponent component = fModel.getDSComponent();
72
		IDSComponent component = fModel.getDSComponent();
71
		assertNotNull(component);
73
		assertNotNull(component);
72
		
74
73
		IDSDocumentFactory factory = fModel.getFactory();
75
		IDSDocumentFactory factory = fModel.getFactory();
74
		
76
75
		IDSImplementation implementation = factory.createImplementation();
77
		IDSImplementation implementation = factory.createImplementation();
76
		implementation.setClassName("ImplementationClassName");
78
		implementation.setClassName("ImplementationClassName");
77
		component.setImplementation(implementation);
79
		component.setImplementation(implementation);
78
		
80
79
		IDSProperties properties = factory.createProperties();
81
		IDSProperties properties = factory.createProperties();
80
		properties.setEntry("PropertiesEntry");
82
		properties.setEntry("PropertiesEntry");
81
		component.addPropertiesElement(properties);
83
		component.addPropertiesElement(properties);
82
		
84
83
		IDSProperty property = factory.createProperty();
85
		IDSProperty property = factory.createProperty();
84
		property.setPropertyElemBody("Body Values");
86
		property.setPropertyElemBody("Body Values");
85
		property.setPropertyType("java.lang.String");
87
		property.setPropertyType("java.lang.String");
86
		component.addPropertyElement(property);
88
		component.addPropertyElement(property);
87
		
89
88
		IDSService service = factory.createService();
90
		IDSService service = factory.createService();
89
		service.setServiceFactory(true);
91
		service.setServiceFactory(true);
90
		component.setService(service);
92
		component.setService(service);
91
		
93
92
		IDSReference reference = factory.createReference();
94
		IDSReference reference = factory.createReference();
93
		reference.setReferenceBind("methodBind");
95
		reference.setReferenceBind("methodBind");
94
		reference.setReferenceUnbind("methodUnBind");
96
		reference.setReferenceUnbind("methodUnBind");
95
		reference.setReferenceInterface("ReferenceInterface");
97
		reference.setReferenceInterface("ReferenceInterface");
96
		reference.setReferenceName("ReferenceName");
98
		reference.setReferenceName("ReferenceName");
97
		component.addReference(reference);
99
		component.addReference(reference);
98
		
100
99
		IDocumentElementNode childAt4 = component.getChildAt(4);
101
		IDocumentElementNode childAt4 = component.getChildAt(4);
100
		component.moveChildNode(reference, -1, true);
102
		component.moveChildNode(reference, -1, true);
101
		
103
102
		IDocumentElementNode childAt3 = component.getChildAt(3);
104
		IDocumentElementNode childAt3 = component.getChildAt(3);
103
		
105
104
		assertEquals(childAt4, childAt3);
106
		assertEquals(childAt4, childAt3);
105
		
107
106
		
107
		assertTrue(component.getChildCount() == 5);
108
		assertTrue(component.getChildCount() == 5);
108
		assertTrue(component.getImplementation() != null);
109
		assertTrue(component.getImplementation() != null);
109
		assertTrue(component.getPropertyElements().length == 1);
110
		assertTrue(component.getPropertyElements().length == 1);
110
		assertTrue(component.getPropertiesElements().length == 1);
111
		assertTrue(component.getPropertiesElements().length == 1);
111
		assertTrue(component.getService() != null);
112
		assertTrue(component.getService() != null);
112
		assertTrue(component.getReferences().length == 1);
113
		assertTrue(component.getReferences().length == 1);
113
		
114
114
		component.removeReference(reference);
115
		component.removeReference(reference);
115
		assertTrue(component.getChildCount() == 4);
116
		assertTrue(component.getChildCount() == 4);
116
		assertTrue(component.getImplementation() != null);
117
		assertTrue(component.getImplementation() != null);
Lines 118-124 Link Here
118
		assertTrue(component.getPropertiesElements().length == 1);
119
		assertTrue(component.getPropertiesElements().length == 1);
119
		assertTrue(component.getService() != null);
120
		assertTrue(component.getService() != null);
120
		assertTrue(component.getReferences().length == 0);
121
		assertTrue(component.getReferences().length == 0);
121
		
122
122
123
		component.removeService(service);
123
		component.removeService(service);
124
		component.removePropertiesElement(properties);
124
		component.removePropertiesElement(properties);
Lines 128-134 Link Here
128
		assertTrue(component.getPropertiesElements().length == 0);
128
		assertTrue(component.getPropertiesElements().length == 0);
129
		assertTrue(component.getService() == null);
129
		assertTrue(component.getService() == null);
130
		assertTrue(component.getReferences().length == 0);
130
		assertTrue(component.getReferences().length == 0);
131
		
132
131
133
		component.removeChildNode(implementation);
132
		component.removeChildNode(implementation);
134
		component.removePropertyElement(property);
133
		component.removePropertyElement(property);
Lines 138-144 Link Here
138
		assertTrue(component.getPropertiesElements().length == 0);
137
		assertTrue(component.getPropertiesElements().length == 0);
139
		assertTrue(component.getService() == null);
138
		assertTrue(component.getService() == null);
140
		assertTrue(component.getReferences().length == 0);
139
		assertTrue(component.getReferences().length == 0);
141
		
140
142
	}
141
	}
143
142
144
}
143
}
(-)src/org/eclipse/pde/internal/ds/core/IDSConstants.java (+1 lines)
Lines 38-43 Link Here
38
	public static final String ATTRIBUTE_COMPONENT_CONFIGURATION_POLICY = "configuration-policy"; //$NON-NLS-1$
38
	public static final String ATTRIBUTE_COMPONENT_CONFIGURATION_POLICY = "configuration-policy"; //$NON-NLS-1$
39
	public static final String ATTRIBUTE_COMPONENT_ACTIVATE = "activate"; //$NON-NLS-1$
39
	public static final String ATTRIBUTE_COMPONENT_ACTIVATE = "activate"; //$NON-NLS-1$
40
	public static final String ATTRIBUTE_COMPONENT_DEACTIVATE = "deactivate"; //$NON-NLS-1$
40
	public static final String ATTRIBUTE_COMPONENT_DEACTIVATE = "deactivate"; //$NON-NLS-1$
41
	public static final String ATTRIBUTE_COMPONENT_MODIFIED = "modified"; //$NON-NLS-1$
41
	
42
	
42
	//Implementation Attributes
43
	//Implementation Attributes
43
	public static final String ATTRIBUTE_IMPLEMENTATION_CLASS = "class"; //$NON-NLS-1$
44
	public static final String ATTRIBUTE_IMPLEMENTATION_CLASS = "class"; //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/ds/core/IDSComponent.java (+15 lines)
Lines 110-115 Link Here
110
	public String getDeactivateMethod();
110
	public String getDeactivateMethod();
111
111
112
	/**
112
	/**
113
	 * Sets the value of the modified method signature name
114
	 * 
115
	 * @param name
116
	 *            String value of the modified method signature name
117
	 */
118
	public void setModifiedeMethod(String name);
119
120
	/**
121
	 * Returns the value of the modified method signature name
122
	 * 
123
	 * @return String value of the modified method signature name
124
	 */
125
	public String getModifiedMethod();
126
127
	/**
113
	 * Sets the value of the attribute immediate
128
	 * Sets the value of the attribute immediate
114
	 * 
129
	 * 
115
	 * @param bool
130
	 * @param bool
(-)src/org/eclipse/pde/internal/ds/core/text/DSComponent.java (-1 / +10 lines)
Lines 329-335 Link Here
329
				IDSConstants.ATTRIBUTE_COMPONENT_NAME,
329
				IDSConstants.ATTRIBUTE_COMPONENT_NAME,
330
				IDSConstants.ATTRIBUTE_COMPONENT_CONFIGURATION_POLICY,
330
				IDSConstants.ATTRIBUTE_COMPONENT_CONFIGURATION_POLICY,
331
				IDSConstants.ATTRIBUTE_COMPONENT_ACTIVATE,
331
				IDSConstants.ATTRIBUTE_COMPONENT_ACTIVATE,
332
				IDSConstants.ATTRIBUTE_COMPONENT_DEACTIVATE };
332
				IDSConstants.ATTRIBUTE_COMPONENT_DEACTIVATE,
333
				IDSConstants.ATTRIBUTE_COMPONENT_MODIFIED };
333
	}
334
	}
334
335
335
	public String getConfigurationPolicy() {
336
	public String getConfigurationPolicy() {
Lines 356-359 Link Here
356
		setXMLAttribute(ATTRIBUTE_COMPONENT_DEACTIVATE, name);
357
		setXMLAttribute(ATTRIBUTE_COMPONENT_DEACTIVATE, name);
357
	}
358
	}
358
359
360
	public String getModifiedMethod() {
361
		return getXMLAttributeValue(ATTRIBUTE_COMPONENT_MODIFIED);
362
	}
363
364
	public void setModifiedeMethod(String name) {
365
		setXMLAttribute(ATTRIBUTE_COMPONENT_MODIFIED, name);
366
	}
367
359
}
368
}
(-)src/org/eclipse/pde/internal/ds/ui/Messages.java (+2 lines)
Lines 30-35 Link Here
30
	public static String DSComponentDetails_activateTooltip;
30
	public static String DSComponentDetails_activateTooltip;
31
	public static String DSComponentDetails_deactivateEntry;
31
	public static String DSComponentDetails_deactivateEntry;
32
	public static String DSComponentDetails_deactivateTooltip;
32
	public static String DSComponentDetails_deactivateTooltip;
33
	public static String DSComponentDetails_modifiedEntry;
34
	public static String DSComponentDetails_modifiedTooltip;
33
	public static String DSComponentDetails_factoryEntry;
35
	public static String DSComponentDetails_factoryEntry;
34
	public static String DSComponentDetails_configurationPolicy;
36
	public static String DSComponentDetails_configurationPolicy;
35
	public static String DSComponentDetails_enabledLabel;
37
	public static String DSComponentDetails_enabledLabel;
(-)src/org/eclipse/pde/internal/ds/ui/messages.properties (+3 lines)
Lines 7-12 Link Here
7
#
7
#
8
# Contributors:
8
# Contributors:
9
#     IBM Corporation - initial API and implementation
9
#     IBM Corporation - initial API and implementation
10
#	  EclipseSource Corporation - ongoing enhancements
10
###############################################################################
11
###############################################################################
11
12
12
13
Lines 23-28 Link Here
23
DSComponentDetails_activateTooltip=The activate method name
24
DSComponentDetails_activateTooltip=The activate method name
24
DSComponentDetails_deactivateEntry=Deactivate:
25
DSComponentDetails_deactivateEntry=Deactivate:
25
DSComponentDetails_deactivateTooltip=The deactivate method name
26
DSComponentDetails_deactivateTooltip=The deactivate method name
27
DSComponentDetails_modifiedEntry=Modified:
28
DSComponentDetails_modifiedTooltip=The modified method name
26
DSComponentDetails_factoryEntry=Factory ID:
29
DSComponentDetails_factoryEntry=Factory ID:
27
DSComponentDetails_configurationPolicy=Configuration Policy:
30
DSComponentDetails_configurationPolicy=Configuration Policy:
28
DSComponentDetails_enabledLabel=Enabled:
31
DSComponentDetails_enabledLabel=Enabled:
(-)src/org/eclipse/pde/internal/ds/ui/editor/sections/DSComponentSection.java (-1 / +24 lines)
Lines 56-61 Link Here
56
	private FormEntry fNameEntry;
56
	private FormEntry fNameEntry;
57
	private FormEntry fActivateEntry;
57
	private FormEntry fActivateEntry;
58
	private FormEntry fDeactivateEntry;
58
	private FormEntry fDeactivateEntry;
59
	private FormEntry fModifiedEntry;
59
	private IDSModel fModel;
60
	private IDSModel fModel;
60
61
61
	public DSComponentSection(PDEFormPage page, Composite parent) {
62
	public DSComponentSection(PDEFormPage page, Composite parent) {
Lines 98-103 Link Here
98
				Messages.DSComponentDetails_deactivateEntry, SWT.NONE);
99
				Messages.DSComponentDetails_deactivateEntry, SWT.NONE);
99
		fDeactivateEntry.getLabel().setToolTipText(
100
		fDeactivateEntry.getLabel().setToolTipText(
100
				Messages.DSComponentDetails_deactivateTooltip);
101
				Messages.DSComponentDetails_deactivateTooltip);
102
		
103
		// Attribute: modified
104
		fModifiedEntry = new FormEntry(client, toolkit,
105
				Messages.DSComponentDetails_deactivateEntry, SWT.NONE);
106
		fModifiedEntry.getLabel().setToolTipText(
107
				Messages.DSComponentDetails_deactivateTooltip);
101
108
102
		setListeners();
109
		setListeners();
103
		updateUIFields();
110
		updateUIFields();
Lines 122-127 Link Here
122
		fNameEntry.commit();
129
		fNameEntry.commit();
123
		fActivateEntry.commit();
130
		fActivateEntry.commit();
124
		fDeactivateEntry.commit();
131
		fDeactivateEntry.commit();
132
		fModifiedEntry.commit();
125
		super.commit(onSave);
133
		super.commit(onSave);
126
	}
134
	}
127
135
Lines 170-177 Link Here
170
				fDeactivateEntry.setValue(fComponent.getDeactivateMethod(),
178
				fDeactivateEntry.setValue(fComponent.getDeactivateMethod(),
171
						true);
179
						true);
172
			}
180
			}
173
174
			fDeactivateEntry.setEditable(isEditable());
181
			fDeactivateEntry.setEditable(isEditable());
182
183
			if (fComponent.getModifiedMethod() == null) {
184
				fModifiedEntry.setValue("", true); //$NON-NLS-1$
185
			} else {
186
				fModifiedEntry.setValue(fComponent.getModifiedMethod(), true);
187
			}
188
			fModifiedEntry.setEditable(isEditable());
175
		}
189
		}
176
190
177
		// Ensure data object is defined
191
		// Ensure data object is defined
Lines 217-222 Link Here
217
				fComponent.setDeactivateMethod(fDeactivateEntry.getValue());
231
				fComponent.setDeactivateMethod(fDeactivateEntry.getValue());
218
			}
232
			}
219
		});
233
		});
234
		fModifiedEntry.setFormEntryListener(new FormEntryAdapter(this) {
235
			public void textValueChanged(FormEntry entry) {
236
				// Ensure data object is defined
237
				if (fComponent == null) {
238
					return;
239
				}
240
				fComponent.setModifiedeMethod(fModifiedEntry.getValue());
241
			}
242
		});
220
243
221
		IActionBars actionBars = this.getPage().getEditor().getEditorSite()
244
		IActionBars actionBars = this.getPage().getEditor().getEditorSite()
222
				.getActionBars();
245
				.getActionBars();

Return to bug 266922