private void validateFeatureID(Element element, Attr attr) { int severity = CompilerFlags.getFlag(fProject, CompilerFlags.F_UNRESOLVED_FEATURES); if (severity != CompilerFlags.IGNORE) { IFeatureModel[] models = PDECore.getDefault().getFeatureModelManager().findFeatureModels(attr.getValue()); if (models.length == 0) { report( NLS.bind(PDECoreMessages.Builders_Feature_freference, attr.getValue()), getLine(element, attr.getName()), severity, PDEMarkerFactory.CAT_OTHER); } } }
private void validateImports(Element parent) { NodeList list = getChildrenByName(parent, "import"); // $NON-NLS-1$ for (int i = 0; i < list.getLength(); i++) { if (fMonitor.isCanceled()) return; Element element = (Element) list.item(i); Attr plugin = element.getAttributeNode("plugin"); // $NON-NLS-1$ Attr feature = element.getAttributeNode("feature"); // $NON-NLS-1$ if (plugin == null && feature == null) { assertAttributeDefined(element, "plugin", CompilerFlags.ERROR); // $NON-NLS-1$ } else if (plugin != null && feature != null) { reportExclusiveAttributes( element, "plugin", "feature", CompilerFlags.ERROR); // $NON-NLS-1$//$NON-NLS-2$ } else if (plugin != null) { validatePluginID(element, plugin, false); } else if (feature != null) { validateFeatureID(element, feature); } NamedNodeMap attributes = element.getAttributes(); for (int j = 0; j < attributes.getLength(); j++) { Attr attr = (Attr) attributes.item(j); String name = attr.getName(); if (name.equals("version")) { // $NON-NLS-1$ validateVersionAttribute(element, attr); } else if (name.equals("match")) { // $NON-NLS-1$ if (element.getAttributeNode("patch") != null) { // $NON-NLS-1$ report( NLS.bind(PDECoreMessages.Builders_Feature_patchedMatch, attr.getValue()), getLine(element, attr.getValue()), CompilerFlags.ERROR, PDEMarkerFactory.CAT_FATAL); } else { validateMatch(element, attr); } } else if (name.equals("patch")) { // $NON-NLS-1$ if ("true".equalsIgnoreCase(attr.getValue()) && feature == null) { // $NON-NLS-1$ report( NLS.bind(PDECoreMessages.Builders_Feature_patchPlugin, attr.getValue()), getLine(element, attr.getValue()), CompilerFlags.ERROR, PDEMarkerFactory.CAT_FATAL); } else if ("true".equalsIgnoreCase(attr.getValue()) && element.getAttributeNode("version") == null) { // $NON-NLS-1$ //$NON-NLS-2$ report( NLS.bind(PDECoreMessages.Builders_Feature_patchedVersion, attr.getValue()), getLine(element, attr.getValue()), CompilerFlags.ERROR, PDEMarkerFactory.CAT_FATAL); } else { validateBoolean(element, attr); } } else if (!name.equals("plugin") && !name.equals("feature") && !name.equals("filter")) { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ reportUnknownAttribute(element, name, CompilerFlags.ERROR); } } } }
private void validatePluginID(Element element, Attr attr, boolean isFragment) { String id = attr.getValue(); if (!validatePluginID(element, attr)) { return; } int severity = CompilerFlags.getFlag(fProject, CompilerFlags.F_UNRESOLVED_PLUGINS); if (severity != CompilerFlags.IGNORE) { IPluginModelBase model = PluginRegistry.findModel(id); if (model == null || !model.isEnabled() || (isFragment && !model.isFragmentModel()) || (!isFragment && model.isFragmentModel())) { report( NLS.bind(PDECoreMessages.Builders_Feature_reference, id), getLine(element, attr.getName()), severity, PDEMarkerFactory.CAT_OTHER); } } }