private static Map<String, Object> getAttributes(ManifestElement element) throws BundleException { Enumeration<String> keys = element.getKeys(); Map<String, Object> attributes = new HashMap<String, Object>(); if (keys == null) return attributes; while (keys.hasMoreElements()) { String key = keys.nextElement(); String value = element.getAttribute(key); int colonIndex = key.indexOf(':'); String type = ATTR_TYPE_STRING; if (colonIndex > 0) { type = key.substring(colonIndex + 1).trim(); key = key.substring(0, colonIndex).trim(); } attributes.put(key, convertValue(type, value)); } return attributes; }
private static Map<String, Object> getAttributes(ManifestElement element) throws BundleException { Enumeration<String> keys = element.getKeys(); Map<String, Object> attributes = new HashMap<>(); if (keys == null) return attributes; while (keys.hasMoreElements()) { String key = keys.nextElement(); String value = element.getAttribute(key); int colonIndex = key.indexOf(':'); String type = ATTR_TYPE_STRING; if (colonIndex > 0) { type = key.substring(colonIndex + 1).trim(); key = key.substring(0, colonIndex).trim(); } attributes.put(key, convertValue(type, value)); } return attributes; }
private static Map<String, Object> getAttributes(ManifestElement element) throws BundleException { Enumeration<String> keys = element.getKeys(); Map<String, Object> attributes = new HashMap<String, Object>(); if (keys == null) return attributes; while (keys.hasMoreElements()) { String key = keys.nextElement(); String value = element.getAttribute(key); int colonIndex = key.indexOf(':'); String type = ATTR_TYPE_STRING; if (colonIndex > 0) { type = key.substring(colonIndex + 1).trim(); key = key.substring(0, colonIndex).trim(); } attributes.put(key, convertValue(type, value)); } return attributes; }
private static Map<String, Object> getAttributes(ManifestElement element) { Enumeration<String> keys = element.getKeys(); Map<String, Object> attributes = new HashMap<String, Object>(); if (keys == null) return attributes; while (keys.hasMoreElements()) { String key = keys.nextElement(); String value = element.getAttribute(key); int colonIndex = key.indexOf(':'); String type = ATTR_TYPE_STRING; if (colonIndex > 0) { type = key.substring(colonIndex + 1).trim(); key = key.substring(0, colonIndex).trim(); } attributes.put(key, convertValue(type, value)); } return attributes; }
private static Map<String, Object> getAttributes(ManifestElement element) throws BundleException { Enumeration<String> keys = element.getKeys(); Map<String, Object> attributes = new HashMap<>(); if (keys == null) return attributes; while (keys.hasMoreElements()) { String key = keys.nextElement(); String value = element.getAttribute(key); int colonIndex = key.indexOf(':'); String type = ATTR_TYPE_STRING; if (colonIndex > 0) { type = key.substring(colonIndex + 1).trim(); key = key.substring(0, colonIndex).trim(); } attributes.put(key, convertValue(type, value)); } return attributes; }
private static Map<String, Object> getAttributes(ManifestElement element) { Enumeration<String> keys = element.getKeys(); Map<String, Object> attributes = new HashMap<String, Object>(); if (keys == null) return attributes; while (keys.hasMoreElements()) { String key = keys.nextElement(); String value = element.getAttribute(key); int colonIndex = key.indexOf(':'); String type = ATTR_TYPE_STRING; if (colonIndex > 0) { type = key.substring(colonIndex + 1).trim(); key = key.substring(0, colonIndex).trim(); } attributes.put(key, convertValue(type, value)); } return attributes; }
public String toString() { Enumeration<String> attrKeys = getKeys(); Enumeration<String> directiveKeys = getDirectiveKeys(); if (attrKeys == null && directiveKeys == null) return mainValue; StringBuffer result = new StringBuffer(mainValue); if (attrKeys != null) { while (attrKeys.hasMoreElements()) { String key = attrKeys.nextElement(); addValues(false, key, getAttributes(key), result); } } if (directiveKeys != null) { while (directiveKeys.hasMoreElements()) { String key = directiveKeys.nextElement(); addValues(true, key, getDirectives(key), result); } } return result.toString(); }
public String toString() { Enumeration<String> attrKeys = getKeys(); Enumeration<String> directiveKeys = getDirectiveKeys(); if (attrKeys == null && directiveKeys == null) return mainValue; StringBuffer result = new StringBuffer(mainValue); if (attrKeys != null) { while (attrKeys.hasMoreElements()) { String key = attrKeys.nextElement(); addValues(false, key, getAttributes(key), result); } } if (directiveKeys != null) { while (directiveKeys.hasMoreElements()) { String key = directiveKeys.nextElement(); addValues(true, key, getDirectives(key), result); } } return result.toString(); }
public String toString() { Enumeration<String> attrKeys = getKeys(); Enumeration<String> directiveKeys = getDirectiveKeys(); if (attrKeys == null && directiveKeys == null) return mainValue; StringBuffer result = new StringBuffer(mainValue); if (attrKeys != null) { while (attrKeys.hasMoreElements()) { String key = attrKeys.nextElement(); addValues(false, key, getAttributes(key), result); } } if (directiveKeys != null) { while (directiveKeys.hasMoreElements()) { String key = directiveKeys.nextElement(); addValues(true, key, getDirectives(key), result); } } return result.toString(); }
public String toString() { Enumeration<String> attrKeys = getKeys(); Enumeration<String> directiveKeys = getDirectiveKeys(); if (attrKeys == null && directiveKeys == null) return mainValue; StringBuffer result = new StringBuffer(mainValue); if (attrKeys != null) { while (attrKeys.hasMoreElements()) { String key = attrKeys.nextElement(); addValues(false, key, getAttributes(key), result); } } if (directiveKeys != null) { while (directiveKeys.hasMoreElements()) { String key = directiveKeys.nextElement(); addValues(true, key, getDirectives(key), result); } } return result.toString(); }
private boolean exceptionsAttributesValid(IHeader header, ManifestElement[] elements) { if (elements == null || elements.length == 0) return true; int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_UNKNOWN_ATTRIBUTE); if (severity == CompilerFlags.IGNORE) return true; Enumeration keys = elements[0].getKeys(); if (keys != null && keys.hasMoreElements()) { String key = (String) keys.nextElement(); if ("exceptions".equals(key)) { //$NON-NLS-1$ String[] values = elements[0].getAttributes(key); for (int i = 0; i < values.length; i++) { StringTokenizer st = new StringTokenizer(values[i], ","); //$NON-NLS-1$ while (st.hasMoreTokens()) { String name = st.nextToken().trim(); if (!getExportedPackages().contains(name)) { String message = NLS.bind(PDECoreMessages.BundleErrorReporter_NotExistInProject, name); report(message, getLine(header, name), CompilerFlags.P_UNRESOLVED_IMPORTS, PDEMarkerFactory.CAT_OTHER); return false; } } } } } return true; }
public String toString() { Enumeration<String> attrKeys = getKeys(); Enumeration<String> directiveKeys = getDirectiveKeys(); if (attrKeys == null && directiveKeys == null) return mainValue; StringBuffer result = new StringBuffer(mainValue); if (attrKeys != null) { while (attrKeys.hasMoreElements()) { String key = attrKeys.nextElement(); addValues(false, key, getAttributes(key), result); } } if (directiveKeys != null) { while (directiveKeys.hasMoreElements()) { String key = directiveKeys.nextElement(); addValues(true, key, getDirectives(key), result); } } return result.toString(); }
public String toString() { Enumeration<String> attrKeys = getKeys(); Enumeration<String> directiveKeys = getDirectiveKeys(); if (attrKeys == null && directiveKeys == null) return mainValue; StringBuffer result = new StringBuffer(mainValue); if (attrKeys != null) { while (attrKeys.hasMoreElements()) { String key = attrKeys.nextElement(); addValues(false, key, getAttributes(key), result); } } if (directiveKeys != null) { while (directiveKeys.hasMoreElements()) { String key = directiveKeys.nextElement(); addValues(true, key, getDirectives(key), result); } } return result.toString(); }
public String toString() { Enumeration<String> attrKeys = getKeys(); Enumeration<String> directiveKeys = getDirectiveKeys(); if (attrKeys == null && directiveKeys == null) return mainValue; StringBuffer result = new StringBuffer(mainValue); if (attrKeys != null) { while (attrKeys.hasMoreElements()) { String key = attrKeys.nextElement(); addValues(false, key, getAttributes(key), result); } } if (directiveKeys != null) { while (directiveKeys.hasMoreElements()) { String key = directiveKeys.nextElement(); addValues(true, key, getDirectives(key), result); } } return result.toString(); }
public String toString() { Enumeration<String> attrKeys = getKeys(); Enumeration<String> directiveKeys = getDirectiveKeys(); if (attrKeys == null && directiveKeys == null) return mainValue; StringBuffer result = new StringBuffer(mainValue); if (attrKeys != null) { while (attrKeys.hasMoreElements()) { String key = attrKeys.nextElement(); addValues(false, key, getAttributes(key), result); } } if (directiveKeys != null) { while (directiveKeys.hasMoreElements()) { String key = directiveKeys.nextElement(); addValues(true, key, getDirectives(key), result); } } return result.toString(); }
private static void checkForDuplicateDirectivesAttributes(String headerKey, ManifestElement[] elements) throws BundleException { // check for duplicate directives for (int i = 0; i < elements.length; i++) { Enumeration<String> directiveKeys = elements[i].getDirectiveKeys(); if (directiveKeys != null) { while (directiveKeys.hasMoreElements()) { String key = directiveKeys.nextElement(); String[] directives = elements[i].getDirectives(key); if (directives.length > 1) { String message = NLS.bind(Msg.MANIFEST_INVALID_HEADER_EXCEPTION, headerKey, elements[i].toString()); throw new BundleException(NLS.bind(message + " : " + Msg.HEADER_DIRECTIVE_DUPLICATES, key), BundleException.MANIFEST_ERROR); //$NON-NLS-1$ } } } Enumeration<String> attrKeys = elements[i].getKeys(); if (attrKeys != null) { while (attrKeys.hasMoreElements()) { String key = attrKeys.nextElement(); String[] attrs = elements[i].getAttributes(key); if (attrs.length > 1) { String message = NLS.bind(Msg.MANIFEST_INVALID_HEADER_EXCEPTION, headerKey, elements[i].toString()); throw new BundleException(message + " : " + NLS.bind(Msg.HEADER_ATTRIBUTE_DUPLICATES, key), BundleException.MANIFEST_ERROR); //$NON-NLS-1$ } } } } }
private void init(ManifestElement manifestElement) { setValueComponents(manifestElement.getValueComponents()); Enumeration attKeys = manifestElement.getKeys(); if (attKeys != null) { while (attKeys.hasMoreElements()) { String attKey = (String)attKeys.nextElement(); String[] values = ManifestElement.getArrayFromList(manifestElement.getAttribute(attKey)); for (int i = 0; i < values.length; i++) addAttribute(attKey, values[i]); } } Enumeration dirKeys = manifestElement.getDirectiveKeys(); if (dirKeys != null) { while (dirKeys.hasMoreElements()) { String dirKey = (String)dirKeys.nextElement(); String[] values = ManifestElement.getArrayFromList(manifestElement.getDirective(dirKey)); for (int i = 0; i < values.length; i++) addDirective(dirKey, values[i]); } } }
private void init(ManifestElement manifestElement) { setValueComponents(manifestElement.getValueComponents()); Enumeration<?> attKeys = manifestElement.getKeys(); if (attKeys != null) { while (attKeys.hasMoreElements()) { String attKey = (String) attKeys.nextElement(); String[] values = ManifestElement.getArrayFromList(manifestElement.getAttribute(attKey)); //empty string in attribute, go with default behavior of attribute if (values == null) continue; for (int i = 0; i < values.length; i++) addAttribute(attKey, values[i]); } } Enumeration<?> dirKeys = manifestElement.getDirectiveKeys(); if (dirKeys != null) { while (dirKeys.hasMoreElements()) { String dirKey = (String) dirKeys.nextElement(); String[] values = ManifestElement.getArrayFromList(manifestElement.getDirective(dirKey)); for (int i = 0; i < values.length; i++) addDirective(dirKey, values[i]); } } }
protected int getPackageLine(IHeader header, ManifestElement element) { String packageName = element.getValue(); if (element.getDirectiveKeys() != null || element.getKeys() != null) return getLine(header, packageName + ";"); //$NON-NLS-1$ // check for this exact package on the last line try { IRegion lineRegion = fTextDocument.getLineInformation(header.getLineNumber() + header.getLinesSpan() - 1); String lineStr = fTextDocument.get(lineRegion.getOffset(), lineRegion.getLength()); if (lineStr.endsWith(packageName)) { return header.getLineNumber() + header.getLinesSpan(); } } catch (BadLocationException ble) { PDECore.logException(ble); } // search all except last line return getLine(header, packageName + ","); //$NON-NLS-1$ }
protected int getPackageLine(IHeader header, ManifestElement element) { String packageName = element.getValue(); if (element.getDirectiveKeys() != null || element.getKeys() != null) return getLine(header, packageName + ";"); //$NON-NLS-1$ // check for this exact package on the last line try { IRegion lineRegion = fTextDocument.getLineInformation(header .getLineNumber() + header.getLinesSpan() - 1); String lineStr = fTextDocument.get(lineRegion.getOffset(), lineRegion.getLength()); if (lineStr.endsWith(packageName)) { return header.getLineNumber() + header.getLinesSpan(); } } catch (BadLocationException ble) { PDECore.logException(ble); } // search all except last line return getLine(header, packageName + ","); //$NON-NLS-1$ }