private SchemaRegistry getSchemaRegistry() { if (fSchemaRegistry == null) fSchemaRegistry = PDECore.getDefault().getSchemaRegistry(); return fSchemaRegistry; }
@Override public Object getSchema() { if (schema == null) { SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); schema = registry.getSchema(fPoint); } else if (schema.isDisposed()) { schema = null; } return schema; }
private static ISchema getSchema(IPluginExtension extension) { String point = extension.getPoint(); SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); return registry.getSchema(point); }
public Object getSchema() { if (schema == null) { SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); schema = registry.getSchema(fPoint); } else if (schema.isDisposed()) { schema = null; } return schema; }
public String getTranslatedName() { String name = getName(); if (name != null && name.trim().length() > 0) return getResourceString(name); String point = getPoint(); ISchema schema = PDECore.getDefault().getSchemaRegistry().getSchema(point); return schema == null ? "" : schema.getName(); //$NON-NLS-1$ } /* (non-Javadoc)
@Override public String getTranslatedName() { String name = getName(); if (name != null && name.trim().length() > 0) return getResourceString(name); String point = getPoint(); ISchema schema = PDECore.getDefault().getSchemaRegistry().getSchema(point); return schema == null ? "" : schema.getName(); //$NON-NLS-1$ }
public Object getSchema() { if (fSchema == null) { SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); fSchema = registry.getSchema(getPoint()); } else if (fSchema.isDisposed()) { fSchema = null; } return fSchema; }
@Override public Object getSchema() { if (fSchema == null) { SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); fSchema = registry.getSchema(getPoint()); } else if (fSchema.isDisposed()) { fSchema = null; } return fSchema; }
public ISchema getIncludedSchema() { ISchemaDescriptor descriptor = getSchema().getSchemaDescriptor(); if (fAbbreviated) { SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); fIncludedSchema = registry.getIncludedSchema(descriptor, fLocation); } else if (fIncludedSchema == null){ fIncludedSchema = createInternalSchema(descriptor, fLocation); } return fIncludedSchema; }
private ISchema getExtensionSchema(IPluginObject object) { IPluginObject extension = object; if (object instanceof IDocumentAttributeNode) extension = (IPluginObject) ((IDocumentAttributeNode) object).getEnclosingElement(); while (extension != null && !(extension instanceof IPluginExtension)) extension = extension.getParent(); if (extension == null) // started off outside of an extension element return null; String point = ((IPluginExtension) extension).getPoint(); return PDECore.getDefault().getSchemaRegistry().getSchema(point); }
@Override public ISchema getIncludedSchema() { if (fIncludedSchema != null) { return fIncludedSchema; } ISchemaDescriptor descriptor = getSchema().getSchemaDescriptor(); if (fAbbreviated) { SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); fIncludedSchema = registry.getIncludedSchema(descriptor, fLocation); } else if (fIncludedSchema == null) { fIncludedSchema = createInternalSchema(descriptor, fLocation); } return fIncludedSchema; }
protected void validateExtension(Element element) { if (!assertAttributeDefined(element, "point", CompilerFlags.ERROR)) //$NON-NLS-1$ return; String pointID = element.getAttribute("point"); //$NON-NLS-1$ IPluginExtensionPoint point = PDEStateHelper.findExtensionPoint(pointID); if (point == null) { int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_UNRESOLVED_EX_POINTS); if (severity != CompilerFlags.IGNORE) { report(NLS.bind(PDECoreMessages.Builders_Manifest_ex_point, pointID), getLine(element, "point"), severity, PDEMarkerFactory.CAT_OTHER); //$NON-NLS-1$ } } else { SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); ISchema schema = registry.getSchema(pointID); if (schema != null) { validateElement(element, schema, true); } } }
extensionPoint = ((IPluginExtension) obj).getPoint(); ISchema schema = PDECore.getDefault().getSchemaRegistry().getSchema(extensionPoint); if (schema == null) return null;
protected void validateExtension(Element element) { if (!assertAttributeDefined(element, "point", CompilerFlags.ERROR)) //$NON-NLS-1$ return; String pointID = element.getAttribute("point"); //$NON-NLS-1$ if (!PDECore.getDefault().getExtensionsRegistry().hasExtensionPoint(pointID)) { int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_UNRESOLVED_EX_POINTS); if (severity != CompilerFlags.IGNORE) { report(NLS.bind(PDECoreMessages.Builders_Manifest_ex_point, pointID), getLine(element, "point"), severity, PDEMarkerFactory.CAT_OTHER); //$NON-NLS-1$ } } else { SchemaRegistry reg = PDECore.getDefault().getSchemaRegistry(); ISchema schema = reg.getSchema(pointID); if (schema != null) { validateElement(element, schema, true); } } }
@Override protected void fillContentProvider(AbstractContentProvider contentProvider, ItemsFilter itemsFilter, IProgressMonitor progressMonitor) throws CoreException { IPluginModelBase[] models = PluginRegistry.getActiveModels(); SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); // cycle through all active plug-ins and their extension points progressMonitor.beginTask(PDEUIMessages.FilteredSchemaAttributeSelectionDialog_searching, models.length); for (IPluginModelBase model : models) { IPluginExtensionPoint[] points = model.getPluginBase().getExtensionPoints(); for (IPluginExtensionPoint point : points) { String pointID = IdUtil.getFullId(point, model); ISchema schema = registry.getSchema(pointID); if (schema == null) // if we don't find a schema continue; ISchemaElement[] elements = schema.getElements(); for (ISchemaElement element : elements) { ISchemaAttribute[] attributes = element.getAttributes(); for (ISchemaAttribute attribute : attributes) { // only add attributes of the string kind and isn't translatable if (attribute.getKind() == IMetaAttribute.STRING && ISchemaAttribute.TYPES[ISchemaAttribute.STR_IND].equals(attribute.getType().getName()) && !attribute.isTranslatable()) contentProvider.add(attribute, itemsFilter); } } } progressMonitor.worked(1); } progressMonitor.done(); }
/** * Finds all resource paths ending with a valid icon file extension and creates * a text edit operation in <code>multiEdit</code> for each one that is not prefixed by an * $nl$ segment. * * @param model - */ public static void prefixIconPaths(IPluginModelBase model) { if (model == null) return; SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); IPluginExtension[] extensions = model.getPluginBase().getExtensions(); for (IPluginExtension extension : extensions) { ISchema schema = registry.getSchema(extension.getPoint()); if (schema != null) inspectElementsIconPaths(schema, extension); } }
@Override protected void modifyModel(IBaseModel model, IProgressMonitor monitor) throws CoreException { if (model instanceof IBundlePluginModelBase) { IBundleModel bmodel = ((IBundlePluginModelBase) model).getBundleModel(); inspectBundle(bmodel.getBundle()); model = ((IBundlePluginModelBase) model).getExtensionsModel(); } if (model instanceof IPluginModelBase) { IFile file = (IFile) ((IPluginModelBase) model).getUnderlyingResource(); SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); IPluginBase pbase = ((IPluginModelBase) model).getPluginBase(); IPluginExtension[] extensions = pbase.getExtensions(); for (IPluginExtension extension : extensions) { ISchema schema = registry.getSchema(extension.getPoint()); if (schema != null && !monitor.isCanceled()) inspectExtension(schema, extension, file); } } } };
private Image getObjectImage(IPluginElement obj) { int flags = 0; IPluginObject parent = obj.getParent(); while (parent != null && !(parent instanceof IPluginExtension)) { parent = parent.getParent(); } if (parent != null) { String point = ((IPluginExtension) parent).getPoint(); SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); ISchema schema = registry.getSchema(point); if (schema != null) { ISchemaElement schemaElement = schema.findElement(obj.getName()); // Only label an element if either the element is deprecated or it actually specifies a deprecated attribute; // We don't want to mislabel non-deprecated elements with no deprecated attributes. if (schemaElement != null && (schemaElement.isDeprecated() || hasDeprecatedAttributes(obj, schemaElement))) flags |= F_WARNING; } } return get(getRequiredPluginImageDescriptor(obj), flags); }
private ISchemaAttribute getAttribute(PluginAttribute attr) { SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry(); IDocumentElementNode element = attr.getEnclosingElement(); IPluginExtension extension = null; while (element.getParentNode() != null) { if (element instanceof IPluginExtension) { extension = (IPluginExtension) element; break; } element = element.getParentNode(); } if (extension == null) return null; ISchema schema = registry.getSchema(extension.getPoint()); ISchemaElement schemaElement = schema.findElement(attr.getEnclosingElement().getXMLTagName()); if (schemaElement == null) return null; return schemaElement.getAttribute(attr.getName()); }
@Override public Image getColumnImage(Object obj, int index) { IPluginExtensionPoint exp = (IPluginExtensionPoint) obj; if (((TemplateContentProvider) fTemplateViewer.getContentProvider()).getElements(exp).length > 0) { return PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_NEWEXP_WIZ_TOOL, 0); } // If the schema is deprecated add a warning flag int flags = 0; SchemaRegistry reg = PDECore.getDefault().getSchemaRegistry(); ISchema schema = reg.getSchema(exp.getFullId()); if (schema != null && schema.isDeperecated()) { PDEPlugin.getDefault().getLabelProvider(); flags = SharedLabelProvider.F_WARNING; } return PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_EXT_POINT_OBJ, flags); } }