Java Reference
In-Depth Information
Figure 4-26
Requirement description Properties tab
One thing about the
Properties
view that we notice in our generated GMF
diagrams is that the
Properties
view cannot handle the selection of multiple dia-
gram elements. For example, try selecting multiple topics in our Mindmap
diagram or selecting multiple requirements in our Requirement diagram. The
Core
tab of the
Properties
view goes blank. To resolve this, open the
RequirementsPropertySection
class in our requirements diagram. It's
located in the
org.eclipse.requirements.diagram.sheet
package. To
enable multiselection, we need to have the
getPropertySource()
method
return an instance of
EMFCompositePropertySource
instead of the generated
PropertySource
default. This is the method showing the change:
/**
*
Modified to allow for multiselection
* @generated
NOT
*/
public IPropertySource getPropertySource(Object object) {
if (object instanceof IPropertySource) {
return (IPropertySource) object;
}
AdapterFactory af = getAdapterFactory(object);
if (af != null) {
IItemPropertySource ips = (IItemPropertySource) af.adapt(object,
IItemPropertySource.class);
if (ips != null) {
return new
EMFCompositePropertySource
(object, ips
,
"Requirements"
);
}
}
if (object instanceof IAdaptable) {
return (IPropertySource) ((IAdaptable)
Search WWH ::
Custom Search