use of org.eclipse.sapphire.PropertyDef in project liferay-ide by liferay.
the class LiferayVersionDefaultValueService method initDefaultValueService.
@Override
protected void initDefaultValueService() {
super.initDefaultValueService();
PropertyDef def = context().find(PropertyDef.class);
Property property = context(Element.class).property(def);
PossibleValuesService possibleValuesService = property.service(PossibleValuesService.class);
possibleValuesService.attach(new Listener() {
@Override
public void handle(Event event) {
_possibleValues = possibleValuesService.values();
refresh();
}
});
NewLiferayProfile profile = context(NewLiferayProfile.class);
profile.property(NewLiferayProfile.PROP_RUNTIME_NAME).attach(new FilteredListener<PropertyContentEvent>() {
@Override
protected void handleTypedEvent(PropertyContentEvent event) {
_possibleValues = possibleValuesService.values();
_runtimeVersion = null;
refresh();
}
});
_possibleValues = possibleValuesService.values();
}
use of org.eclipse.sapphire.PropertyDef in project liferay-ide by liferay.
the class CreatePortletAppResourceBundleActionHandler method init.
/**
* (non-Javadoc)
*
* @see
* org.eclipse.sapphire.ui.SapphirePropertyEditorActionHandler#init(org.eclipse.
* sapphire.ui.SapphireAction, ActionHandlerDef)
*/
@Override
public void init(SapphireAction action, ActionHandlerDef def) {
super.init(action, def);
Element element = getModelElement();
Property property = property();
listener = new FilteredListener<PropertyEvent>() {
@Override
protected void handleTypedEvent(PropertyEvent event) {
refreshEnablementState();
}
};
element.attach(listener, property.definition().name());
Listener listen = new Listener() {
@Override
public void handle(Event event) {
if (event instanceof DisposeEvent) {
PropertyDef definition = property().definition();
getModelElement().detach(listener, definition.name());
}
}
};
attach(listen);
}
use of org.eclipse.sapphire.PropertyDef in project liferay-ide by liferay.
the class LabelPositionResource method createBinding.
@Override
protected PropertyBinding createBinding(Property property) {
PropertyBinding binding = null;
PropertyDef def = property.definition();
if (Position.PROP_X.equals(def) || Position.PROP_Y.equals(def)) {
binding = new ValuePropertyBinding() {
@Override
public String read() {
String retval = null;
if (LabelPositionResource.this._point != null) {
if (Position.PROP_X.equals(def)) {
retval = Integer.toString(LabelPositionResource.this._point.getX());
} else if (Position.PROP_Y.equals(def)) {
retval = Integer.toString(LabelPositionResource.this._point.getY());
}
}
return retval;
}
@Override
public void write(String value) {
if (LabelPositionResource.this._point == null) {
LabelPositionResource.this._point = new Point();
}
if (Position.PROP_X.equals(def)) {
LabelPositionResource.this._point.setX(Integer.parseInt(value));
} else if (Position.PROP_Y.equals(def)) {
LabelPositionResource.this._point.setY(Integer.parseInt(value));
}
/*
* if (Position.PROP_X.equals( def ) ||
* Position.PROP_Y.equals( def )) {
* WorkflowNodeMetadataObject parentMetadata =
* parent().adapt( WorkflowNodeMetadataResource.class
* ).getMetadata(); parentMetadata.setNodeLocation(
* LabelPositionResource.this.point ); }
*/
WorkflowNodeMetadataResource metadataResource = parent().adapt(WorkflowNodeMetadataResource.class);
metadataResource.saveMetadata();
}
};
}
if (binding != null) {
binding.init(property);
}
return binding;
}
Aggregations