Java Reference
In-Depth Information
data.left =
new
FormAttachment(0, 0);
data.right =
new
FormAttachment(100, 0);
data.top =
new
FormAttachment(0, 0);
data.bottom =
new
FormAttachment(100, 0);
data.height = 100;
data.width = 100;
text.setLayoutData(data);
if
(isReadOnly()) {
text.setEditable(
false
);
}
return
text;
}
@Override
protected
EObject unwrap(Object object) {
if
(object
instanceof
Requirement) {
return
(EObject) object;
}
if
(object
instanceof
EditPart) {
Object model = ((EditPart) object).getModel();
return
model
instanceof
View ? ((View) model).getElement() :
null
;
}
if
(object
instanceof
View) {
return
((View) object).getElement();
}
if
(object
instanceof
IAdaptable) {
View view = (View) ((IAdaptable) object).getAdapter(View.
class
);
if
(view !=
null
) {
return
view.getElement();
}
}
return
null;
}
}
Figure 4-26 shows the result. Although we still have some work to do, this
gets us started converting our table view to forms view properties. If you're inter-
ested in developing a model to define the property sheets and using custom tem-
plates to generate these form-based sheets, take a look at the GMF graphical
definition model editor. This editor provides WYSIWYG editing of figures when
developing diagrams, but it is still in the “experimental” SDK. It also supports the
definition and generation of forms-based property sheets and editors through the
use of a collection of models found in the
org.eclipse.gmf.formtk
plug-in.
Search WWH ::
Custom Search