}
private CSSNodeImpl insertUnknownImport(IStructuredDocumentRegion region) {
CSSModelCreationContext creationContext = getCreationContext();
CSSNodeImpl parent = creationContext.getTargetNode();
ICSSDocument sheet = parent.getOwnerDocument();
String text = region.getText();
Pattern pattern = Pattern.compile(" ");
String[] strs = pattern.split(text);
String hrefValue = null;
for (int i=0;i<strs.length;i++) {
String hrefStr = "file=\"";
if (strs[i].startsWith(hrefStr)){
int hrefStr_length = hrefStr.length();
// minus 1 to avoid quote?
int hrefValue_length = strs[i].length() - 1;
if (hrefValue_length > hrefStr_length) {
hrefValue = strs[i].substring(hrefStr_length, hrefValue_length);
}
else {
/*
* ISSUE: this handles cases where, e.g. "file=" has no
* subsequent 'value' ... and from code in insertStructuredDocumentRegion
* I believe should return null, rather than empty string, but, this may
* need some fine tuning eventually.
*/
hrefValue = null;
}
break;
}
}
if (hrefValue == null) {
return null;
}
JSPCSSImportRuleImpl rule = new JSPCSSImportRuleImpl();
rule.setOwnerDocument(sheet);
rule.appendChild((CSSNodeImpl)sheet.createMediaList());
rule.setRangeStructuredDocumentRegion(region, region);
if (!isUpdateContextActive()) {
rule.setHref(hrefValue);//Attribute(ICSSImportRule.HREF, hrefValue);