use of org.eclipse.sapphire.PropertyEvent in project liferay-ide by liferay.
the class CreateDirectoryActionHandler method init.
@Override
public void init(SapphireAction action, ActionHandlerDef def) {
super.init(action, def);
Element element = getModelElement();
ValueProperty property = (ValueProperty) property().definition();
Listener listener = new FilteredListener<PropertyEvent>() {
@Override
public void handleTypedEvent(PropertyEvent event) {
refreshEnablementState();
}
};
element.attach(listener, property.name());
attach(new Listener() {
@Override
public void handle(Event event) {
if (event instanceof DisposeEvent) {
element.detach(listener, property.name());
}
}
});
}
use of org.eclipse.sapphire.PropertyEvent in project liferay-ide by liferay.
the class CustomJspsEnablementService method initEnablementService.
@Override
protected void initEnablementService() {
Listener listener = new FilteredListener<PropertyEvent>() {
protected void handleTypedEvent(PropertyEvent event) {
refresh();
}
};
ElementHandle<Element> element = _hook().property(Hook.PROP_CUSTOM_JSP_DIR);
element.attach(listener, CustomJspDir.PROP_VALUE.name());
}
use of org.eclipse.sapphire.PropertyEvent in project liferay-ide by liferay.
the class ColumnImageService method initImageService.
@Override
protected void initImageService() {
_listener = new FilteredListener<PropertyEvent>() {
@Override
protected void handleTypedEvent(PropertyEvent event) {
refresh();
}
};
context(Element.class).attach(_listener, Column.PROP_PRIMARY.name());
attach(new Listener() {
@Override
public void handle(Event event) {
if (event instanceof DisposeEvent) {
context(Element.class).detach(_listener, Column.PROP_PRIMARY.name());
}
}
});
}
use of org.eclipse.sapphire.PropertyEvent in project liferay-ide by liferay.
the class ActionsDiagramNodeEditHandlerFactory method create.
@Override
public List<SapphireActionHandler> create() {
ListFactory<SapphireActionHandler> factory = ListFactory.start();
Element element = getElement();
if (element == null) {
return factory.result();
}
ElementList<Action> actions = getActions();
if (_listener == null) {
_listener = new FilteredListener<PropertyEvent>() {
@Override
public void handleTypedEvent(PropertyEvent event) {
broadcast(new Event());
}
};
}
element.attach(_listener, getListPropertyName());
for (Action action : actions) {
action.getName().attach(_listener);
factory.add(new ScriptableOpenActionHandler() {
@Override
public void init(SapphireAction sapphireAction, ActionHandlerDef def) {
super.init(sapphireAction, def);
String name = action.getName().content(true);
setLabel(empty(name) ? "<null>" : name);
addImage(Action.TYPE.image());
}
@Override
protected Scriptable scriptable(Presentation context) {
return action;
}
});
}
return factory.result();
}
use of org.eclipse.sapphire.PropertyEvent in project liferay-ide by liferay.
the class NotificationsDiagramNodeEditHandlerFactory method create.
@Override
public List<SapphireActionHandler> create() {
ListFactory<SapphireActionHandler> factory = ListFactory.start();
Element element = getElement();
if (element == null) {
return factory.result();
}
List<ActionNotification> notifications = getNotifications();
if (_listener == null) {
_listener = new FilteredListener<PropertyEvent>() {
@Override
public void handleTypedEvent(PropertyEvent event) {
broadcast(new Event());
}
};
}
element.attach(_listener, getListPropertyName());
for (Notification notification : notifications) {
notification.getName().attach(_listener);
factory.add(new TemplateOpenActionHandler() {
@Override
public void init(SapphireAction sapphireAction, ActionHandlerDef def) {
super.init(sapphireAction, def);
String name = notification.getName().content(true);
setLabel(empty(name) ? "<null>" : name);
addImage(ActionNotification.TYPE.image());
}
@Override
protected Notification notification(Presentation context) {
return notification;
}
});
}
return factory.result();
}
Aggregations