@Override public String getName() { if (fName == null && fExtension != null) { fName = fExtension.getLabel(); } return fName; }
public String getLabel() { return extension.getLabel(); }
public String getName() { return extension.getLabel(); }
public String getLabel() { return extension.getLabel(); }
public String getLabel() { return extension.getLabel(); }
/** * Initialize this descriptor based on the provided extension point. */ protected void readExtension(IExtension extension) throws CoreException { //read the extension String id = extension.getUniqueIdentifier(); // id not required IConfigurationElement[] elements = extension.getConfigurationElements(); int count = elements.length; for (int i = 0; i < count; i++) { IConfigurationElement element = elements[i]; configElement = element; String name = element.getName(); if (name.equalsIgnoreCase(TAG_TEAM_CONTENT_PROVIDER)) { modelProviderId = element.getAttribute(ATT_MODEL_PROVIDER_ID); contentExtensionId = element.getAttribute(ATT_CONTENT_EXTENSION_ID); String supportsFlatLayoutString = element.getAttribute(ATT_SUPPORTS_FLAT_LAYOUT); if (supportsFlatLayoutString != null) { supportsFlatLayout = Boolean.valueOf(supportsFlatLayoutString).booleanValue(); } contentProviderName = extension.getLabel(); } break; } if (modelProviderId == null) fail(NLS.bind(TeamUIMessages.TeamContentProviderDescriptor_1, new String[] { ATT_MODEL_PROVIDER_ID, TAG_TEAM_CONTENT_PROVIDER, id == null ? "" : id})); //$NON-NLS-1$ if (contentExtensionId == null) fail(NLS.bind(TeamUIMessages.TeamContentProviderDescriptor_1, new String[] { ATT_CONTENT_EXTENSION_ID, TAG_TEAM_CONTENT_PROVIDER, id == null ? "" : id})); //$NON-NLS-1$ }
/** * Load extensions */ private void initialize() { fConfigurations = new HashMap<>(); IExtensionPoint point= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), EXTENSION_POINT_STRING_VARIABLE_PRESENTATIONS); IConfigurationElement elements[]= point.getConfigurationElements(); for (int i = 0; i < elements.length; i++) { IConfigurationElement element = elements[i]; String name= element.getAttribute(ATTR_NAME); if (name == null) { DebugUIPlugin.logErrorMessage(MessageFormat.format("String variable presentation extension missing required 'variableName' attribute: {0}", new Object[] { element.getDeclaringExtension().getLabel() })); //$NON-NLS-1$ continue; } fConfigurations.put(name, element); } }
/** * Initialize this descriptor based on the provided extension point. */ protected void readExtension(IExtension extension) throws CoreException { //read the extension id = extension.getUniqueIdentifier(); if (id == null) fail(Messages.mapping_noIdentifier); label = extension.getLabel(); IConfigurationElement[] elements = extension.getConfigurationElements(); int count = elements.length; ArrayList<String> extendsList = new ArrayList<>(count); for (int i = 0; i < count; i++) { IConfigurationElement element = elements[i]; String name = element.getName(); if (name.equalsIgnoreCase("extends-model")) { //$NON-NLS-1$ String attribute = element.getAttribute("id"); //$NON-NLS-1$ if (attribute == null) fail(NLS.bind(Messages.mapping_invalidDef, id)); extendsList.add(attribute); } else if (name.equalsIgnoreCase(ExpressionTagNames.ENABLEMENT)) { enablementRule = ExpressionConverter.getDefault().perform(element); } } extendedModels = extendsList.toArray(new String[extendsList.size()]); }
/** * Initialize this descriptor based on the provided extension point. */ protected void readExtension(IExtension extension) throws CoreException { //read the extension id = extension.getUniqueIdentifier(); if (id == null) fail(Messages.mapping_noIdentifier); label = extension.getLabel(); IConfigurationElement[] elements = extension.getConfigurationElements(); int count = elements.length; ArrayList<String> extendsList = new ArrayList<>(count); for (int i = 0; i < count; i++) { IConfigurationElement element = elements[i]; String name = element.getName(); if (name.equalsIgnoreCase("extends-model")) { //$NON-NLS-1$ String attribute = element.getAttribute("id"); //$NON-NLS-1$ if (attribute == null) fail(NLS.bind(Messages.mapping_invalidDef, id)); extendsList.add(attribute); } else if (name.equalsIgnoreCase(ExpressionTagNames.ENABLEMENT)) { enablementRule = ExpressionConverter.getDefault().perform(element); } } extendedModels = extendsList.toArray(new String[extendsList.size()]); }
/** * Initialize this descriptor based on the provided extension point. */ protected void readExtension(IExtension extension) throws CoreException { //read the extension id = extension.getUniqueIdentifier(); if (id == null) fail(Messages.mapping_noIdentifier); label = extension.getLabel(); IConfigurationElement[] elements = extension.getConfigurationElements(); int count = elements.length; ArrayList<String> extendsList = new ArrayList<>(count); for (int i = 0; i < count; i++) { IConfigurationElement element = elements[i]; String name = element.getName(); if (name.equalsIgnoreCase("extends-model")) { //$NON-NLS-1$ String attribute = element.getAttribute("id"); //$NON-NLS-1$ if (attribute == null) fail(NLS.bind(Messages.mapping_invalidDef, id)); extendsList.add(attribute); } else if (name.equalsIgnoreCase(ExpressionTagNames.ENABLEMENT)) { enablementRule = ExpressionConverter.getDefault().perform(element); } } extendedModels = extendsList.toArray(new String[extendsList.size()]); }
/** * Loads contributed value variables. This is done before loading persisted values. */ private void loadContributedValueVariables() { IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(VariablesPlugin.PI_CORE_VARIABLES, EXTENSION_POINT_VALUE_VARIABLES); IConfigurationElement elements[]= point.getConfigurationElements(); for (int i = 0; i < elements.length; i++) { IConfigurationElement element = elements[i]; String name= element.getAttribute(ATTR_NAME); if (name == null) { VariablesPlugin.logMessage(NLS.bind("Variable extension missing required 'name' attribute: {0}", new String[] {element.getDeclaringExtension().getLabel()}), null); //$NON-NLS-1$ continue; } String description= element.getAttribute(ATTR_DESCRIPTION); boolean isReadOnly = TRUE_VALUE.equals(element.getAttribute(ATTR_READ_ONLY)); IValueVariable variable = new ContributedValueVariable(name, description, isReadOnly, element); Object old = fValueVariables.put(name, variable); if (old != null) { StringVariable oldVariable = (StringVariable)old; VariablesPlugin.logMessage(NLS.bind("Contributed variable extension from bundle ''{0}'' overrides existing extension variable ''{1}'' from bundle ''{2}''", //$NON-NLS-1$ new String[] {element.getDeclaringExtension().getContributor().getName(),oldVariable.getName(), oldVariable.getConfigurationElement().getDeclaringExtension().getContributor().getName()}), null); } } }
/** * Loads contributed value variables. This is done before loading persisted values. */ private void loadContributedValueVariables() { IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(VariablesPlugin.PI_CORE_VARIABLES, EXTENSION_POINT_VALUE_VARIABLES); IConfigurationElement elements[]= point.getConfigurationElements(); for (int i = 0; i < elements.length; i++) { IConfigurationElement element = elements[i]; String name= element.getAttribute(ATTR_NAME); if (name == null) { VariablesPlugin.logMessage(NLS.bind("Variable extension missing required 'name' attribute: {0}", new String[] {element.getDeclaringExtension().getLabel()}), null); //$NON-NLS-1$ continue; } String description= element.getAttribute(ATTR_DESCRIPTION); boolean isReadOnly = TRUE_VALUE.equals(element.getAttribute(ATTR_READ_ONLY)); IValueVariable variable = new ContributedValueVariable(name, description, isReadOnly, element); Object old = fValueVariables.put(name, variable); if (old != null) { StringVariable oldVariable = (StringVariable)old; VariablesPlugin.logMessage(NLS.bind("Contributed variable extension from bundle ''{0}'' overrides existing extension variable ''{1}'' from bundle ''{2}''", //$NON-NLS-1$ new String[] {element.getDeclaringExtension().getContributor().getName(),oldVariable.getName(), oldVariable.getConfigurationElement().getDeclaringExtension().getContributor().getName()}), null); } } }
CompletionProposalCategory(IConfigurationElement element, CompletionProposalComputerRegistry registry) { fElement= element; fRegistry= registry; IExtension parent= (IExtension) element.getParent(); fId= parent.getUniqueIdentifier(); checkNotNull(fId, "id"); //$NON-NLS-1$ String name= parent.getLabel(); if (name == null) fName= fId; else fName= name; String icon= element.getAttribute(ICON); ImageDescriptor img= null; if (icon != null) { Bundle bundle= getBundle(); if (bundle != null) { Path path= new Path(icon); URL url= FileLocator.find(bundle, path, null); img= ImageDescriptor.createFromURL(url); } } fImage= img; }
/** * Loads contributed dynamic variables */ private void loadDynamicVariables() { IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(VariablesPlugin.PI_CORE_VARIABLES, EXTENSION_POINT_DYNAMIC_VARIABLES); IConfigurationElement elements[]= point.getConfigurationElements(); for (int i = 0; i < elements.length; i++) { IConfigurationElement element = elements[i]; String name= element.getAttribute(ATTR_NAME); if (name == null) { VariablesPlugin.logMessage(NLS.bind("Variable extension missing required 'name' attribute: {0}", new String[] {element.getDeclaringExtension().getLabel()}), null); //$NON-NLS-1$ continue; } String description= element.getAttribute(ATTR_DESCRIPTION); DynamicVariable variable= new DynamicVariable(name, description, element); Object old = fDynamicVariables.put(variable.getName(), variable); if (old != null) { DynamicVariable oldVariable = (DynamicVariable)old; VariablesPlugin.logMessage(NLS.bind("Dynamic variable extension from bundle ''{0}'' overrides existing extension variable ''{1}'' from bundle ''{2}''", //$NON-NLS-1$ new String[] {element.getDeclaringExtension().getContributor().getName(),oldVariable.getName(), oldVariable.getConfigurationElement().getDeclaringExtension().getContributor().getName()}), null); } } }
/** * Loads contributed dynamic variables */ private void loadDynamicVariables() { IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(VariablesPlugin.PI_CORE_VARIABLES, EXTENSION_POINT_DYNAMIC_VARIABLES); IConfigurationElement elements[]= point.getConfigurationElements(); for (int i = 0; i < elements.length; i++) { IConfigurationElement element = elements[i]; String name= element.getAttribute(ATTR_NAME); if (name == null) { VariablesPlugin.logMessage(NLS.bind("Variable extension missing required 'name' attribute: {0}", new String[] {element.getDeclaringExtension().getLabel()}), null); //$NON-NLS-1$ continue; } String description= element.getAttribute(ATTR_DESCRIPTION); DynamicVariable variable= new DynamicVariable(name, description, element); Object old = fDynamicVariables.put(variable.getName(), variable); if (old != null) { DynamicVariable oldVariable = (DynamicVariable)old; VariablesPlugin.logMessage(NLS.bind("Dynamic variable extension from bundle ''{0}'' overrides existing extension variable ''{1}'' from bundle ''{2}''", //$NON-NLS-1$ new String[] {element.getDeclaringExtension().getContributor().getName(),oldVariable.getName(), oldVariable.getConfigurationElement().getDeclaringExtension().getContributor().getName()}), null); } } }
private static Map<String, Object> collectAttributes(final IConfigurationElement config) { final Map<String, Object> map = new HashMap<String, Object>(); try { final IExtension extension = config.getDeclaringExtension(); // use @ to avoid conflicting with attributes in the XML safePut(map, "@id", extension.getUniqueIdentifier()); safePut(map, "@label", extension.getLabel()); safePut(map, "@contributor", config.getContributor()); safePut(map, "@namespace", config.getNamespaceIdentifier()); safePut(map, "@point", extension.getExtensionPointUniqueIdentifier()); // similarly use () to avoid conflicts safePut(map, "name()", config.getName()); safePut(map, "text()", config.getValue()); // now load the actual attributes from the XML for (final String key : config.getAttributeNames()) { safePut(map, key, config.getAttribute(key)); } } catch (final InvalidRegistryObjectException re) { map.clear(); // invalid, so wipe slate clean } return unmodifiableMap(map); }
/** * Instantiates and returns the builder with the given name. If the builder, its plugin, or its nature * is missing, returns null. */ private IncrementalProjectBuilder instantiateBuilder(String builderName) throws CoreException { IExtension extension = Platform.getExtensionRegistry().getExtension(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PT_BUILDERS, builderName); if (extension == null) return null; IConfigurationElement[] configs = extension.getConfigurationElements(); if (configs.length == 0) return null; String natureId = null; if (getBooleanAttribute(configs[0], "hasNature")) { //$NON-NLS-1$ //find the nature that owns this builder String builderId = extension.getUniqueIdentifier(); natureId = workspace.getNatureManager().findNatureForBuilder(builderId); if (natureId == null) return null; } //The nature exists, or this builder doesn't specify a nature InternalBuilder builder = (InternalBuilder) configs[0].createExecutableExtension("run"); //$NON-NLS-1$ builder.setPluginId(extension.getContributor().getName()); builder.setLabel(extension.getLabel()); builder.setNatureId(natureId); builder.setCallOnEmptyDelta(getBooleanAttribute(configs[0], "callOnEmptyDelta")); //$NON-NLS-1$ return (IncrementalProjectBuilder) builder; }
/** * Instantiates and returns the builder with the given name. If the builder, its plugin, or its nature * is missing, returns null. */ private IncrementalProjectBuilder instantiateBuilder(String builderName) throws CoreException { IExtension extension = Platform.getExtensionRegistry().getExtension(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PT_BUILDERS, builderName); if (extension == null) return null; IConfigurationElement[] configs = extension.getConfigurationElements(); if (configs.length == 0) return null; String natureId = null; if (getBooleanAttribute(configs[0], "hasNature")) { //$NON-NLS-1$ //find the nature that owns this builder String builderId = extension.getUniqueIdentifier(); natureId = workspace.getNatureManager().findNatureForBuilder(builderId); if (natureId == null) return null; } //The nature exists, or this builder doesn't specify a nature InternalBuilder builder = (InternalBuilder) configs[0].createExecutableExtension("run"); //$NON-NLS-1$ builder.setPluginId(extension.getContributor().getName()); builder.setLabel(extension.getLabel()); builder.setNatureId(natureId); builder.setCallOnEmptyDelta(getBooleanAttribute(configs[0], "callOnEmptyDelta")); //$NON-NLS-1$ return (IncrementalProjectBuilder) builder; }
/** * Instantiates and returns the builder with the given name. If the builder, its plugin, or its nature * is missing, returns null. */ private IncrementalProjectBuilder instantiateBuilder(String builderName) throws CoreException { IExtension extension = Platform.getExtensionRegistry().getExtension(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PT_BUILDERS, builderName); if (extension == null) return null; IConfigurationElement[] configs = extension.getConfigurationElements(); if (configs.length == 0) return null; String natureId = null; if (getBooleanAttribute(configs[0], "hasNature")) { //$NON-NLS-1$ //find the nature that owns this builder String builderId = extension.getUniqueIdentifier(); natureId = workspace.getNatureManager().findNatureForBuilder(builderId); if (natureId == null) return null; } //The nature exists, or this builder doesn't specify a nature InternalBuilder builder = (InternalBuilder) configs[0].createExecutableExtension("run"); //$NON-NLS-1$ builder.setPluginId(extension.getContributor().getName()); builder.setLabel(extension.getLabel()); builder.setNatureId(natureId); builder.setCallOnEmptyDelta(getBooleanAttribute(configs[0], "callOnEmptyDelta")); //$NON-NLS-1$ return (IncrementalProjectBuilder) builder; }
private Extension createExtensionAdapter(IExtension extension) { Extension adapter = new Extension(); adapter.setNamespaceIdentifier(extension.getNamespaceIdentifier()); adapter.setLabel(extension.getLabel()); adapter.setExtensionPointUniqueIdentifier(extension.getExtensionPointUniqueIdentifier()); adapter.setContributor(getBundleId(extension.getContributor().getName())); IConfigurationElement[] elements = extension.getConfigurationElements(); if (elements.length > 0) { ConfigurationElement[] configurationElements = new ConfigurationElement[elements.length]; for (int i = 0; i < elements.length; i++) { configurationElements[i] = createConfigurationElement(elements[i]); } adapter.setConfigurationElements(configurationElements); } return adapter; }