コード例 #1
0
 private CSSPrimitiveValueImpl createStringValue(String text, String type) {
   short valueType = getStringValueType(text, type);
   CSSPrimitiveValueImpl value = getCSSPrimitiveValue(valueType);
   if (value != null) {
     if (valueType == CSSPrimitiveValue.CSS_URI) {
       text = CSSUtil.extractUriContents(text);
     } else if (valueType == CSSPrimitiveValue.CSS_STRING) {
       text = CSSUtil.extractStringContents(text);
     }
     value.setValue(text);
   }
   return value;
 }
コード例 #2
0
  private CSSPrimitiveValueImpl createLocalValue(ITextRegionList regions) {
    String funcName = getFunctionName(regions);
    if (funcName == null || !funcName.toLowerCase().equals("local")) { // $NON-NLS-1$
      return null;
    }
    String accepts[] = {CSSRegionContexts.CSS_DECLARATION_VALUE_STRING};
    ITextRegionList valueRegions = getFunctionParameters(regions, accepts);
    if (valueRegions.size() != 1) {
      return null;
    }

    CSSPrimitiveValueImpl value = getCSSPrimitiveValue(ICSSPrimitiveValue.CSS_LOCAL);
    if (value == null) {
      return null;
    }

    ITextRegion region = valueRegions.get(0);
    value.setValue(CSSUtil.extractStringContents(getText(region)));

    return value;
  }