/** * Creates an instance of <code>TemplateVariableResolver</code>. * * @param type the name of the type * @param description the description for the type */ protected TemplateVariableResolver(String type, String description) { setType(type); setDescription(description); }
/** * Creates an instance of <code>TemplateVariableResolver</code>. * * @param type the name of the type * @param description the description for the type */ protected TemplateVariableResolver(String type, String description) { setType(type); setDescription(description); }
private static TemplateVariableResolver createResolver(IConfigurationElement element) throws CoreException { try { String type= element.getAttribute(TYPE); if (type != null) { TemplateVariableResolver resolver= (TemplateVariableResolver) element.createExecutableExtension(CLASS); resolver.setType(type); String desc= element.getAttribute(DESCRIPTION); resolver.setDescription(desc == null ? "" : desc); //$NON-NLS-1$ return resolver; } } catch (ClassCastException e) { throw new CoreException(new Status(IStatus.ERROR, EditorsUI.PLUGIN_ID, IStatus.OK, "extension does not implement " + TemplateVariableResolver.class.getName(), e)); //$NON-NLS-1$ } return null; } }
private static TemplateVariableResolver createResolver(IConfigurationElement element) throws CoreException { try { String type= element.getAttribute(TYPE); if (type != null) { TemplateVariableResolver resolver= (TemplateVariableResolver) element.createExecutableExtension(CLASS); if (resolver.getType() != null) { throw new CoreException(new Status(IStatus.ERROR, EditorsUI.PLUGIN_ID, IStatus.OK, resolver.getClass() + "() must call super() and not set the variable's type", null)); //$NON-NLS-1$ } resolver.setType(type); if (resolver.getDescription() != null) { throw new CoreException(new Status(IStatus.ERROR, EditorsUI.PLUGIN_ID, IStatus.OK, resolver.getClass() + "() must call super() and not set the variable's description", null)); //$NON-NLS-1$ } String desc= element.getAttribute(DESCRIPTION); resolver.setDescription(desc == null ? "" : desc); //$NON-NLS-1$ return resolver; } } catch (ClassCastException e) { throw new CoreException(new Status(IStatus.ERROR, EditorsUI.PLUGIN_ID, IStatus.OK, "extension does not implement " + TemplateVariableResolver.class.getName(), e)); //$NON-NLS-1$ } return null; } }