Package org.eclipse.jst.jsf.metadataprocessors.features

Examples of org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues


  public CellEditor createCellEditor(Composite parent,
      IPropertyPageDescriptor attr, Element element) {
   
    String type = attr.getValueType();
   
    IPossibleValues pvs = (IPossibleValues)attr.getAdapter(IPossibleValues.class);
    IDefaultValue defaultValue = (IDefaultValue)attr.getAdapter(IDefaultValue.class);
//    ICellEditorValidator validator = (ICellEditorValidator)attr.getAdapter(ICellEditorValidator.class);
    CellEditor ed = null;
    if (IAttributeRuntimeValueType.RELATIVEPATH.equalsIgnoreCase(type)|| IAttributeRuntimeValueType.WEBPATH.equalsIgnoreCase(type)) {
      IProject project = getProject(element);
      if (project != null) {
//        String typeParam = TraitValueHelper.getValueAsString(TaglibDomainMetaDataQueryHelper.getTrait(attr.getMetaDataContext().getEntity(),"type-param"));
        ResourceDialogCellEditor cellEditor = new ResourceDialogCellEditor(
            parent);
        Trait fileExt = TaglibDomainMetaDataQueryHelper.getTrait(attr.getMetaDataContext().getEntity(), "file-extensions"); //$NON-NLS-1$
        Trait separator = TaglibDomainMetaDataQueryHelper.getTrait(attr.getMetaDataContext().getEntity(), "separator"); //$NON-NLS-1$
        String[] fileExts = null;
        if (fileExt != null){
          List exts = TraitValueHelper.getValueAsListOfStrings(fileExt);
          fileExts = (String[])exts.toArray(new String[exts.size()]);
        }
       
        String sep = null;
        if (separator != null)
          sep = TraitValueHelper.getValueAsString(separator);
       
        if (fileExts != null)
          cellEditor.setSuffixs(fileExts);
        if (sep != null)
          cellEditor.setSeparator(sep);

        cellEditor.setProject(project);
        cellEditor.setReferredFile(getFile(element));

        if (IAttributeRuntimeValueType.WEBPATH.equalsIgnoreCase(type)) {
          cellEditor.setWebPath(true);
        }

        if (IJSPCoreConstants.TAG_DIRECTIVE_INCLUDE.equals(element
            .getLocalName())
            || IJSPCoreConstants.TAG_INCLUDE.equals(element
                .getLocalName())) {
          cellEditor.setTransformJSPURL(false);
        }
        ed = cellEditor;
      }
    }
    else if (IAttributeRuntimeValueType.RESOURCEBUNDLE.equals(type)) {
      ed = new LoadbundleSelectionCellEditor(parent,
          getProject(element));
    }
    else if (IAttributeRuntimeValueType.CSSSTYLE.equalsIgnoreCase(type)) {
//        String param = getParamterValue(attr, "style");
////              .getParameterByName(IAttributeDescriptor.PARAMETER_STYLE);
//        if (!param.equalsIgnoreCase("STYLE")) {
//          return null;
//        }
        CSSDialogCellEditor cellEditor = new CSSDialogCellEditor(parent,
            (IDOMElement) element);
        ed = cellEditor;
    }
    else if (pvs != null && pvs.getPossibleValues().size() > 0) {
//      if (validator != null)
//        ed = LabeledStyleComboCellEditor.newInstance(parent, pvs,
//                  defaultValue, SWT.DROP_DOWN | SWT.READ_ONLY);
//      else
        ed = LabeledStyleComboCellEditor.newInstance(parent, pvs,
View Full Code Here


   */
  public DialogField createDialogField(IPropertyPageDescriptor attr) {

    String type = attr.getValueType();
   
    IPossibleValues pvs = (IPossibleValues)attr.getAdapter(IPossibleValues.class);
//    IDefaultValue defaultValue = (IDefaultValue)attr.getAdapter(IDefaultValue.class);
//    ICellEditorValidator validator = (ICellEditorValidator)attr.getAdapter(ICellEditorValidator.class);
   
   

    if (IAttributeRuntimeValueType.RELATIVEPATH.equals(type) ||
        IAttributeRuntimeValueType.WEBPATH.equals(type)) {
      Trait fileExt = TaglibDomainMetaDataQueryHelper.getTrait(attr.getMetaDataContext().getEntity(), "file-extensions"); //$NON-NLS-1$
      Trait seperator = TaglibDomainMetaDataQueryHelper.getTrait(attr.getMetaDataContext().getEntity(), "separator"); //$NON-NLS-1$
     
      String[] fileExts = null;
      if (fileExt != null){
        List exts = TraitValueHelper.getValueAsListOfStrings(fileExt);
        fileExts = (String[])exts.toArray(new String[exts.size()]);
      }
     
      String sep = null;
      if (seperator != null)
        sep = TraitValueHelper.getValueAsString(seperator);
   
      ContextableResourceButtonDialogField field = new ContextableResourceButtonDialogField();
      field.setLabelText(attr.getLabel());
      if (fileExts != null) {
        field.setSuffixs(fileExts);
      }
     
      if (sep != null) {
        field.setSeparator(sep);
      }
     
      if ("".equalsIgnoreCase(field.getSeparator())) { //$NON-NLS-1$
        field.setResourceDescription(ResourceBoundle
            .getString("FileCellEditor.Msg")); //$NON-NLS-1$
      } else {
        field.setResourceDescription(ResourceBoundle
            .getString("FileCellEditor.Msg1")); //$NON-NLS-1$
      }
      field.setWebPath(IAttributeRuntimeValueType.WEBPATH.equals(type));
      field.setRequired(attr.isRequired());
      field.setToolTip(attr.getDescription());
      return field;

    } else if (IAttributeRuntimeValueType.CLASSPATH_RESOURCE.equals(type) ||
        IAttributeRuntimeValueType.RESOURCEBUNDLE.equals(type)) {
      ClasspathResourceButtonDialogField field = new ClasspathResourceButtonDialogField();
      field.setRequired(attr.isRequired());
      field.setToolTip(attr.getDescription());
      field.setLabelText(attr.getLabel());
      return field;
    } else if (IAttributeRuntimeValueType.CSSSTYLE.equalsIgnoreCase(type)) {
//      String param = getParamterValue(attr, "style");
//      if (!"STYLE".equalsIgnoreCase(param)) {
//        return null;
//      }
      StyleButtonDialogField field = new StyleButtonDialogField();
      field.setRequired(attr.isRequired());
      field.setToolTip(attr.getDescription());
      field.setLabelText(attr.getLabel());
      return field;
   
//    // if there is no type or type unknown, then we just return null. and
//    // system will
//    // create default (text cell editor).
    } else if (pvs != null && pvs.getPossibleValues().size() > 0) {
      MDEnabledComboDialogField field = new MDEnabledComboDialogField(SWT.None);
      field.setLabelText(attr.getLabel());
      field.setToolTip(attr.getDescription());
      field.setRequired(attr.isRequired());
      return field;
View Full Code Here

  public void setElementContext(IDOMNode ancester, IDOMElement element) {
    IStructuredDocumentContext sdContext =IStructuredDocumentContextFactory.INSTANCE.getContext(element.getStructuredDocument(), element);
    IPropertyPageDescriptor ppd = (IPropertyPageDescriptor)getAttachedData("KEY_ATTR");//FIXME use constant //$NON-NLS-1$
    ppd.setStructuredDocumentContext(sdContext);
    IPossibleValues pvs = (IPossibleValues)ppd.getAdapter(IPossibleValues.class);
    IDefaultValue def = (IDefaultValue)ppd.getAdapter(IDefaultValue.class);
    if (def != null)
      setDefaultValue(def.getDefaultValue());
    if (pvs.getPossibleValues() != null)
      setEntryMap(getMapOfPossibleValues(pvs));
  }
View Full Code Here

  public CellEditor createCellEditor(Composite parent,
      IPropertyPageDescriptor attr, Element element) {
   
    String type = attr.getValueType();
   
    IPossibleValues pvs = (IPossibleValues)attr.getAdapter(IPossibleValues.class);
    IDefaultValue defaultValue = (IDefaultValue)attr.getAdapter(IDefaultValue.class);
//    ICellEditorValidator validator = (ICellEditorValidator)attr.getAdapter(ICellEditorValidator.class);
    CellEditor ed = null;
    if (IAttributeRuntimeValueType.RELATIVEPATH.equalsIgnoreCase(type)|| IAttributeRuntimeValueType.WEBPATH.equalsIgnoreCase(type)) {
      IProject project = getProject(element);
      final IFile file = getFile(element);
      if (project != null) {
//        String typeParam = TraitValueHelper.getValueAsString(TaglibDomainMetaDataQueryHelper.getTrait(attr.getMetaDataContext().getEntity(),"type-param"));
        ResourceDialogCellEditor cellEditor = new ResourceDialogCellEditor(
            parent);
       
        IMetaDataDomainContext context = null;
       
        if (file != null)
          context = MetaDataQueryContextFactory.getInstance().createTaglibDomainModelContext(file);
        else
          context = MetaDataQueryContextFactory.getInstance().createTaglibDomainModelContext(project);
       
        final ITaglibDomainMetaDataQuery query = MetaDataQueryFactory.getInstance().createQuery(context);
        Trait fileExt = query.findTrait(attr.getMetaDataContext().getEntity(), "file-extensions"); //$NON-NLS-1$
        Trait separator = query.findTrait(attr.getMetaDataContext().getEntity(), "separator"); //$NON-NLS-1$
        String[] fileExts = null;
        if (fileExt != null){
          List exts = TraitValueHelper.getValueAsListOfStrings(fileExt);
          fileExts = (String[])exts.toArray(new String[exts.size()]);
        }
       
        String sep = null;
        if (separator != null)
          sep = TraitValueHelper.getValueAsString(separator);
       
        if (fileExts != null)
          cellEditor.setSuffixs(fileExts);
        if (sep != null)
          cellEditor.setSeparator(sep);

        cellEditor.setProject(project);
        cellEditor.setReferredFile(file);

        if (IAttributeRuntimeValueType.WEBPATH.equalsIgnoreCase(type)) {
          cellEditor.setWebPath(true);
        }

        if (IJSPCoreConstants.TAG_DIRECTIVE_INCLUDE.equals(element
            .getLocalName())
            || IJSPCoreConstants.TAG_INCLUDE.equals(element
                .getLocalName())) {
          cellEditor.setTransformJSPURL(false);
        }
        ed = cellEditor;
      }
    }
    else if (IAttributeRuntimeValueType.RESOURCEBUNDLE.equals(type)) {
      ed = new LoadbundleSelectionCellEditor(parent,
          getProject(element));
    }
    else if (IAttributeRuntimeValueType.CSSSTYLE.equalsIgnoreCase(type)) {
//        String param = getParamterValue(attr, "style");
////              .getParameterByName(IAttributeDescriptor.PARAMETER_STYLE);
//        if (!param.equalsIgnoreCase("STYLE")) {
//          return null;
//        }
        CSSDialogCellEditor cellEditor = new CSSDialogCellEditor(parent, attr,
            (IDOMElement) element);
        ed = cellEditor;
    }
    else if (pvs != null && pvs.getPossibleValues().size() > 0) {
//      if (validator != null)
//        ed = LabeledStyleComboCellEditor.newInstance(parent, pvs,
//                  defaultValue, SWT.DROP_DOWN | SWT.READ_ONLY);
//      else
        ed = LabeledStyleComboCellEditor.newInstance(parent, pvs,
View Full Code Here

   */
  public DialogField createDialogField(IPropertyPageDescriptor attr) {

    String type = attr.getValueType();
   
    IPossibleValues pvs = (IPossibleValues)attr.getAdapter(IPossibleValues.class);
//    IDefaultValue defaultValue = (IDefaultValue)attr.getAdapter(IDefaultValue.class);
//    ICellEditorValidator validator = (ICellEditorValidator)attr.getAdapter(ICellEditorValidator.class);
   
   

    if (IAttributeRuntimeValueType.RELATIVEPATH.equals(type) ||
        IAttributeRuntimeValueType.WEBPATH.equals(type)) {
     
      //FIXME - should not be passing null project
      final IMetaDataDomainContext context = MetaDataQueryContextFactory.getInstance().createTaglibDomainModelContext((IProject)null);
      final ITaglibDomainMetaDataQuery query = MetaDataQueryFactory.getInstance().createQuery(context);
      Trait fileExt = query.findTrait(attr.getMetaDataContext().getEntity(), "file-extensions"); //$NON-NLS-1$
      Trait seperator = query.findTrait(attr.getMetaDataContext().getEntity(), "separator"); //$NON-NLS-1$
     
      String[] fileExts = null;
      if (fileExt != null){
        List exts = TraitValueHelper.getValueAsListOfStrings(fileExt);
        fileExts = (String[])exts.toArray(new String[exts.size()]);
      }
     
      String sep = null;
      if (seperator != null)
        sep = TraitValueHelper.getValueAsString(seperator);
   
      ContextableResourceButtonDialogField field = new ContextableResourceButtonDialogField();
      field.setLabelText(attr.getLabel());
      if (fileExts != null) {
        field.setSuffixs(fileExts);
      }
     
      if (sep != null) {
        field.setSeparator(sep);
      }
     
      if ("".equalsIgnoreCase(field.getSeparator())) { //$NON-NLS-1$
        field.setResourceDescription(ResourceBoundle
            .getString("FileCellEditor.Msg")); //$NON-NLS-1$
      } else {
        field.setResourceDescription(ResourceBoundle
            .getString("FileCellEditor.Msg1")); //$NON-NLS-1$
      }
      field.setWebPath(IAttributeRuntimeValueType.WEBPATH.equals(type));
      field.setRequired(attr.isRequired());
      field.setToolTip(attr.getDescription());
      return field;

    } else if (IAttributeRuntimeValueType.CLASSPATH_RESOURCE.equals(type) ||
        IAttributeRuntimeValueType.RESOURCEBUNDLE.equals(type)) {
      ClasspathResourceButtonDialogField field = new ClasspathResourceButtonDialogField();
      field.setRequired(attr.isRequired());
      field.setToolTip(attr.getDescription());
      field.setLabelText(attr.getLabel());
      return field;
    } else if (IAttributeRuntimeValueType.CSSSTYLE.equalsIgnoreCase(type)) {
//      String param = getParamterValue(attr, "style");
//      if (!"STYLE".equalsIgnoreCase(param)) {
//        return null;
//      }
      StyleButtonDialogField field = new StyleButtonDialogField();
      field.setRequired(attr.isRequired());
      field.setToolTip(attr.getDescription());
      field.setLabelText(attr.getLabel());
      return field;
   
//    // if there is no type or type unknown, then we just return null. and
//    // system will
//    // create default (text cell editor).
    } else if (pvs != null && pvs.getPossibleValues().size() > 0) {
      MDEnabledComboDialogField field = new MDEnabledComboDialogField(SWT.None);
      field.setLabelText(attr.getLabel());
      field.setToolTip(attr.getDescription());
      field.setRequired(attr.isRequired());
      return field;
View Full Code Here

TOP

Related Classes of org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.