Search in sources :

Example 1 with JavaTypeConstraint

use of org.eclipse.sapphire.java.JavaTypeConstraint 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 2 with JavaTypeConstraint

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

the class HierarchyBrowseActionHandler method _getClassReferenceType.

private String _getClassReferenceType(Property property) {
    JavaTypeConstraint typeConstraint = property.definition().getAnnotation(JavaTypeConstraint.class);
    String retval = Arrays.toString(typeConstraint.type()).replaceAll("[\\[\\]\\s,]", "");
    return retval;
}
Also used : JavaTypeConstraint(org.eclipse.sapphire.java.JavaTypeConstraint)

Aggregations

JavaTypeConstraint (org.eclipse.sapphire.java.JavaTypeConstraint)2 ServiceWrapper (com.liferay.ide.hook.core.model.ServiceWrapper)1 FilteredListener (org.eclipse.sapphire.FilteredListener)1 Listener (org.eclipse.sapphire.Listener)1 Property (org.eclipse.sapphire.Property)1 PropertyContentEvent (org.eclipse.sapphire.PropertyContentEvent)1 JavaTypeKind (org.eclipse.sapphire.java.JavaTypeKind)1