Search in sources :

Example 16 with Listener

use of org.eclipse.sapphire.Listener in project liferay-ide by liferay.

the class HookXmlEditor method adaptModel.

@Override
protected void adaptModel(Element model) {
    super.adaptModel(model);
    Listener listener = new FilteredListener<PropertyContentEvent>() {

        @Override
        public void handleTypedEvent(PropertyContentEvent event) {
            handleCustomJspsPropertyChangedEvent(event);
        }
    };
    _ignoreCustomModelChanges = true;
    // $NON-NLS-1$
    model.attach(listener, Hook.PROP_CUSTOM_JSPS.name() + "/*");
    _ignoreCustomModelChanges = false;
}
Also used : FilteredListener(org.eclipse.sapphire.FilteredListener) PropertyContentEvent(org.eclipse.sapphire.PropertyContentEvent) FilteredListener(org.eclipse.sapphire.FilteredListener) Listener(org.eclipse.sapphire.Listener)

Example 17 with Listener

use of org.eclipse.sapphire.Listener in project liferay-ide by liferay.

the class ServiceImplJavaTypeConstraintService method initJavaTypeConstraintService.

@Override
protected void initJavaTypeConstraintService() {
    super.initJavaTypeConstraintService();
    Property property = context().find(Property.class);
    JavaTypeConstraint javaTypeConstraintAnnotation = property.definition().getAnnotation(JavaTypeConstraint.class);
    Set<JavaTypeKind> kind = EnumSet.noneOf(JavaTypeKind.class);
    for (JavaTypeKind k : javaTypeConstraintAnnotation.kind()) {
        kind.add(k);
    }
    _kinds = kind;
    _behavior = javaTypeConstraintAnnotation.behavior();
    _service = context(ServiceWrapper.class);
    Listener listener = new FilteredListener<PropertyContentEvent>() {

        @Override
        public void handleTypedEvent(PropertyContentEvent event) {
            refresh();
        }
    };
    _service.attach(listener, "ServiceType");
}
Also used : JavaTypeKind(org.eclipse.sapphire.java.JavaTypeKind) FilteredListener(org.eclipse.sapphire.FilteredListener) PropertyContentEvent(org.eclipse.sapphire.PropertyContentEvent) JavaTypeConstraint(org.eclipse.sapphire.java.JavaTypeConstraint) ServiceWrapper(com.liferay.ide.hook.core.model.ServiceWrapper) FilteredListener(org.eclipse.sapphire.FilteredListener) Listener(org.eclipse.sapphire.Listener) Property(org.eclipse.sapphire.Property)

Example 18 with Listener

use of org.eclipse.sapphire.Listener 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);
}
Also used : FilteredListener(org.eclipse.sapphire.FilteredListener) Listener(org.eclipse.sapphire.Listener) PropertyDef(org.eclipse.sapphire.PropertyDef) Element(org.eclipse.sapphire.Element) Event(org.eclipse.sapphire.Event) DisposeEvent(org.eclipse.sapphire.DisposeEvent) PropertyEvent(org.eclipse.sapphire.PropertyEvent) PropertyEvent(org.eclipse.sapphire.PropertyEvent) DisposeEvent(org.eclipse.sapphire.DisposeEvent) ValueProperty(org.eclipse.sapphire.ValueProperty) Property(org.eclipse.sapphire.Property)

Example 19 with Listener

use of org.eclipse.sapphire.Listener in project liferay-ide by liferay.

the class CreatePortletResourceBundleActionHandler 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();
    listener = new FilteredListener<PropertyEvent>() {

        @Override
        protected void handleTypedEvent(PropertyEvent event) {
            refreshEnablementState();
        }
    };
    element.attach(listener, property().name());
    element.attach(listener, Portlet.PROP_SUPPORTED_LOCALES.name());
    element.attach(listener, Portlet.PROP_SUPPORTED_LOCALES.name() + "/" + SupportedLocales.PROP_SUPPORTED_LOCALE.name());
    Listener listen = new Listener() {

        public void handle(Event event) {
            if (event instanceof DisposeEvent) {
                getModelElement().detach(listener, property().name());
                getModelElement().detach(listener, Portlet.PROP_SUPPORTED_LOCALES.name());
                getModelElement().detach(listener, Portlet.PROP_SUPPORTED_LOCALES.name() + "/" + SupportedLocales.PROP_SUPPORTED_LOCALE.name());
            }
        }
    };
    attach(listen);
}
Also used : FilteredListener(org.eclipse.sapphire.FilteredListener) Listener(org.eclipse.sapphire.Listener) Element(org.eclipse.sapphire.Element) Event(org.eclipse.sapphire.Event) DisposeEvent(org.eclipse.sapphire.DisposeEvent) PropertyEvent(org.eclipse.sapphire.PropertyEvent) PropertyEvent(org.eclipse.sapphire.PropertyEvent) DisposeEvent(org.eclipse.sapphire.DisposeEvent)

Example 20 with Listener

use of org.eclipse.sapphire.Listener in project liferay-ide by liferay.

the class WindowStatesPossibleValueService method initPossibleValuesService.

@Override
protected void initPossibleValuesService() {
    super.initPossibleValuesService();
    PortletApp portletApp = context(PortletApp.class);
    Listener listener = new FilteredListener<PropertyContentEvent>() {

        @Override
        protected void handleTypedEvent(PropertyContentEvent event) {
            refreshValues();
        }
    };
    portletApp.attach(listener, PortletApp.PROP_CUSTOM_WINDOW_STATES.name());
    refreshValues();
    portletApp.attach(new FilteredListener<ElementDisposeEvent>() {

        @Override
        protected void handleTypedEvent(ElementDisposeEvent event) {
            portletApp.detach(listener, PortletApp.PROP_CUSTOM_WINDOW_STATES.name());
        }
    });
    this.initialized = true;
}
Also used : FilteredListener(org.eclipse.sapphire.FilteredListener) PropertyContentEvent(org.eclipse.sapphire.PropertyContentEvent) FilteredListener(org.eclipse.sapphire.FilteredListener) Listener(org.eclipse.sapphire.Listener) ElementDisposeEvent(org.eclipse.sapphire.modeling.ElementDisposeEvent) PortletApp(com.liferay.ide.portlet.core.model.PortletApp)

Aggregations

Listener (org.eclipse.sapphire.Listener)23 FilteredListener (org.eclipse.sapphire.FilteredListener)20 PropertyContentEvent (org.eclipse.sapphire.PropertyContentEvent)14 Event (org.eclipse.sapphire.Event)10 Element (org.eclipse.sapphire.Element)7 PropertyEvent (org.eclipse.sapphire.PropertyEvent)6 DisposeEvent (org.eclipse.sapphire.DisposeEvent)5 NewLiferayPluginProjectOp (com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)3 Property (org.eclipse.sapphire.Property)3 NewLiferayProfile (com.liferay.ide.project.core.model.NewLiferayProfile)2 PropertyDef (org.eclipse.sapphire.PropertyDef)2 ValueProperty (org.eclipse.sapphire.ValueProperty)2 ServiceWrapper (com.liferay.ide.hook.core.model.ServiceWrapper)1 Assignable (com.liferay.ide.kaleo.core.model.Assignable)1 Scriptable (com.liferay.ide.kaleo.core.model.Scriptable)1 Task (com.liferay.ide.kaleo.core.model.Task)1 LayoutTplElement (com.liferay.ide.layouttpl.core.model.LayoutTplElement)1 PortletApp (com.liferay.ide.portlet.core.model.PortletApp)1 IFile (org.eclipse.core.resources.IFile)1 ImageData (org.eclipse.sapphire.ImageData)1