/** * Validates that the version of the given plug-in is available in the registry. Adds a warning if * the plug-in could not be found. * * @param plugin xml element describing the plug-in to look for in the registry * @param attr set of element attributes */ private void validateVersion(Element plugin, Attr attr) { String id = plugin.getAttribute("id"); // $NON-NLS-1$ String version = plugin.getAttribute("version"); // $NON-NLS-1$ if (id.trim().length() == 0 || version.trim().length() == 0 || version.equals("0.0.0")) // $NON-NLS-1$ return; ModelEntry entry = MonitorRegistry.findEntry(id); if (entry != null) { IMonitorModelBase[] allModels = entry.getActiveModels(); for (int i = 0; i < allModels.length; i++) { IMonitorModelBase availablePlugin = allModels[i]; if (id.equals(availablePlugin.getMonitorBase().getId())) { if (version.equals(availablePlugin.getMonitorBase().getVersion())) { return; } } } } report( NLS.bind( MDECoreMessages.Builders_Feature_mismatchPluginVersion, new String[] {version, id}), getLine(plugin, attr.getName()), CompilerFlags.WARNING, MDEMarkerFactory.CAT_OTHER); }
private void validateInternalExtensionAttribute(Element element, ISchemaElement schemaElement) { int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_INTERNAL); if (severity == CompilerFlags.IGNORE) return; if (schemaElement instanceof ISchemaRootElement) { ISchemaRootElement rootElement = (ISchemaRootElement) schemaElement; String epid = schemaElement.getSchema().getPluginId(); String pid = fModel.getMonitorBase().getId(); if (epid == null || pid == null) return; if (rootElement.isInternal() && !epid.equals(pid)) { String point = element.getAttribute("point"); // $NON-NLS-1$ if (point == null) return; // should never come to this... report( NLS.bind(MDECoreMessages.Builders_Manifest_internal_rootElement, point), getLine(element, "point"), severity, MDEMarkerFactory.CAT_DEPRECATION); // $NON-NLS-1$ } } }