Search in sources :

Example 1 with DisposeEvent

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

Example 2 with DisposeEvent

use of org.eclipse.sapphire.DisposeEvent 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());
            }
        }
    });
}
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 3 with DisposeEvent

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

the class AddFilesFromOSGiBundleAction method init.

@Override
public void init(SapphireAction action, ActionHandlerDef def) {
    super.init(action, def);
    final Element element = getModelElement();
    final Listener listener = new FilteredListener<PropertyContentEvent>() {

        @Override
        protected void handleTypedEvent(PropertyContentEvent event) {
            refreshEnablementState();
        }
    };
    element.attach(listener, NewModuleFragmentOp.PROP_HOST_OSGI_BUNDLE.name());
    attach(new Listener() {

        @Override
        public void handle(final Event event) {
            if (event instanceof DisposeEvent) {
                element.detach(listener, NewModuleFragmentOp.PROP_HOST_OSGI_BUNDLE.name());
            }
        }
    });
}
Also used : FilteredListener(org.eclipse.sapphire.FilteredListener) PropertyContentEvent(org.eclipse.sapphire.PropertyContentEvent) FilteredListener(org.eclipse.sapphire.FilteredListener) Listener(org.eclipse.sapphire.Listener) Element(org.eclipse.sapphire.Element) PropertyContentEvent(org.eclipse.sapphire.PropertyContentEvent) Event(org.eclipse.sapphire.Event) DisposeEvent(org.eclipse.sapphire.DisposeEvent) DisposeEvent(org.eclipse.sapphire.DisposeEvent)

Example 4 with DisposeEvent

use of org.eclipse.sapphire.DisposeEvent 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 5 with DisposeEvent

use of org.eclipse.sapphire.DisposeEvent 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)

Aggregations

DisposeEvent (org.eclipse.sapphire.DisposeEvent)5 Element (org.eclipse.sapphire.Element)5 Event (org.eclipse.sapphire.Event)5 FilteredListener (org.eclipse.sapphire.FilteredListener)5 Listener (org.eclipse.sapphire.Listener)5 PropertyEvent (org.eclipse.sapphire.PropertyEvent)4 ValueProperty (org.eclipse.sapphire.ValueProperty)2 Property (org.eclipse.sapphire.Property)1 PropertyContentEvent (org.eclipse.sapphire.PropertyContentEvent)1 PropertyDef (org.eclipse.sapphire.PropertyDef)1