<br>The basic question I asked paulweb515 is as follows:<br><br>You&#39;re writing an extension point. You want an id and a label, as well as lots of other stuff / methods. So you make an interface for it that others must implement. 
<br><br>public interface IPackageType {<br>&nbsp;&nbsp;&nbsp; public String getId();<br>&nbsp;&nbsp;&nbsp; public String getLabel();<br>&nbsp;&nbsp;&nbsp; public IPackage createDefaultConfiguration(IProject project, IProgressMonitor monitor);<br>&nbsp;&nbsp;&nbsp; public int getSupportFor (IProject project);
<br>}<br><br><br>In your extension point, you require a class, but you also want to require the id and label. What is the best way to do it? <br><br>paulweb515 had 3 suggestions: <br><span style="font-style: italic;">&lt;paulweb515&gt; rawblem: I&#39;ve seen 3 common usages
</span><br style="font-style: italic;"><span style="font-style: italic;">
&lt;paulweb515&gt; rawblem: 1) Tell you users to implement IPackageType
that has setId(*) as well as getId(*) ... then you can set your user&#39;s
data when you create the executable extension</span><br style="font-style: italic;">
<br>If you just let the extender implement IChef, he&#39;ll be filling in id and label twice, once in the extension point, and once in API. <br>So paulweb suggests setters, but that&#39;s not a great idea because then anyone who gets a reference to your object can 
<br>change the ID and label. Obviously that&#39;s a glaring error. <br><br><span style="font-style: italic;">&lt;paulweb515&gt; rawblem: 2) Like ViewPart, create an abstract base class that they must use instead of just an interface.&nbsp; ViewPart uses setInitializationData(*) to store the config element for the client to use in a protected&nbsp; method, and extracts id, label etc into the base abstract class ... but they&#39;re private, and it only provides public final String getId() so they can&#39;t change it
</span><br style="font-style: italic;"><br>This sounds like the best way, I&#39;ll look at it momentarily.<br><br style="font-style: italic;"><span style="font-style: italic;">&lt;paulweb515&gt; or 3) don&#39;t store the ID in the object, have that ID be part of an association that your extension point knows.
<br></span><br>Not exactly the best way, because then given an IChef, you cannot get his id or label. <br><br><br>Things I&#39;ve done in the past: <br>&nbsp;&nbsp; Let the user extend AbstractPackageDelegate, then when loading the extension points, do as follows:
<br>&nbsp;&nbsp; <br>public class AbstractPackageDelegate {<br>&nbsp;&nbsp;&nbsp; public abstract IPackage createDefaultConfiguration(IProject project, IProgressMonitor monitor);<br>
&nbsp;&nbsp;&nbsp; public abstract int getSupportFor (IProject project);<br>
}<br><br>public class PackageTypeWrapper implements IPackageType {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private AbstractPackageDelegate delegate;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private IConfigurationElement element;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public PackageTypeWrapper(IConfigurationElement element) {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.element = element;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delegate = element.createExecutableExtension(&quot;class&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public String getId() { return element.getAttribute(&quot;id&quot;); }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public String getLabel() { return element.getAttribute(&quot;label&quot;); }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; public IPackage createDefaultConfiguration(IProject project, IProgressMonitor monitor) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return delegate.createDefaultConfiguration(project, monitor);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public int getSupportFor (IProject project) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return delegate.getSupportFor(project);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
}<br><br>The problem with this example, in this specific IPackageType example, is that in JarPackageType, marshall uses the following code: <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; jar.setPackageType(this);<br><br>In the above example, &quot;this&quot;, isnt an IPackageType. It&#39;s an incomplete piece of an IPackageType that will need to be wrapped. 
<br>A possible fix is: <br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; public IPackage createDefaultConfiguration(IProject project, IProgressMonitor monitor) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IPackage obj = delegate.createDefaultConfiguration(project, monitor);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; obj.setPackageType(this);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return obj;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
... but clearly that&#39;s not ideal or intuitive. <br><br><br>//***** Paulweb&#39;s option 2 *********//<br>public abstract class AbstractPackageType implements IPackageType {<br>&nbsp;&nbsp;&nbsp; private String id;<br>&nbsp;&nbsp;&nbsp; private String label;
<br>&nbsp;&nbsp;&nbsp; private boolean initailized = false;<br>&nbsp;&nbsp;&nbsp; public void setInitializationData(IConfigurationElement el) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( !initialized) {<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; id = el.getAttribute(&quot;id&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; label = 
el.getAttribute(&quot;label&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; public String getId() { return id; }<br>&nbsp;&nbsp;&nbsp; public String getLabel() { return label; }<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; public abstract int getSupportFor (IProject project);
<br>&nbsp;&nbsp;&nbsp; public abstract IPackage createDefaultConfiguration(IProject project, IProgressMonitor monitor);<br>}<br><br>// creation<br>AbstractPackageType extender = (AbstractPackageType)configElement.createExecutableExtension(&quot;class&quot;);
<br>extender.setInitializationData(configElement);<br><br>In this way, all users who get a reference to the IPackageType can get the id and label, but no users can change it arbitrarily. <br>Someone could still theoretically write their extension of AbstractPackageType to override the setInitializationData and make it 
<br>easy to change, but at least then it&#39;s the extender willfully allowing it to happen, instead of our abstract class having a public setter for all to use. <br><br><br>All are welcome to give forth their suggestions or other best practices they use WRT extension points ;)&nbsp; 
<br>I&#39;ll probably be using a methodology similar to the one paulweb515 suggested. <br><br>- Rob<br><br>