Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] Adding attributes in .classpath file


Keeping CPentries read-only makes sense to me. I'm not a fan of the Map though. This is not so common in Eclipse APIs.
I would suggest to introduce a new IClasspathEntryAttribute type:

  IClasspathEntryAttribute
      getName() : String
      getValue(): Object

  JavaCore.newXY(IPath path, boolean isExported, IClasspathEntryAttribute[] attributes)

IClasspathEntryAttributes can be created using factory methods on JavaCore

  JavaCore.newSourceAttachmentPathAttribute(IPath sourceAttachPath)
  JavaCore.newJavadocLocationAttribute(URL javadocLocation)
  JavaCore.newExlusionFilterAttribute(IPath[] explusionPath)
  ...

Custom attributes are created with:

  JavaCore.newCustomAttribute(String name, Object value, boolean isPersisted)

I added the idea of persistent and not persistent custom attributes here. Only persistent attibutes would go the .classpath file.
This is just an idea, there isn't a concrete use case for that yet.

  IClasspathEntry
      getAttributes() : IClasspathEntryAttribute[]

Advantage of this is:
    - it makes it clear that CPentries are read-only
    - Factories for attributes make sure that (at least the built-in) attribute values are of correct type

Martin



Philippe P Mulet/France/IBM@IBMFR
Sent by: jdt-core-dev-admin@xxxxxxxxxxx

02/08/2005 02:57 PM

Please respond to
jdt-core-dev@xxxxxxxxxxx

To
jdt-core-dev@xxxxxxxxxxx
cc
Subject
Re: [jdt-core-dev] Adding attributes in .classpath file





Remember that CPentries are read-only objects. So this would vote against
setAttribute methods.




                                                                         
            Darin Wright                                                  
            <Darin_Wright@ca.                                            
            ibm.com>                                                   To
            Sent by:                  jdt-core-dev@xxxxxxxxxxx            
            jdt-core-dev-admi                                          cc
            n@xxxxxxxxxxx                                                
                                                                  Subject
                                      Re: [jdt-core-dev] Adding          
            02/08/2005 02:49          attributes in .classpath file      
            PM                                                            
                                                                         
                                                                         
            Please respond to                                            
              jdt-core-dev                                                
                                                                         
                                                                         




The attribtues need to be mutable after creation of the classpath entry.
So, an optional map on creation is fine, but we would still need
set/getAttribute.

Darin




Jerome Lanneluc <jerome_lanneluc@xxxxxxxxxx>
Sent by: jdt-core-dev-admin@xxxxxxxxxxx
02/07/2005 06:30 AM
Please respond to
jdt-core-dev


To
jdt-core-dev@xxxxxxxxxxx
cc

Subject
[jdt-core-dev] Adding attributes in .classpath file






Bug 22969 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=22969) asks for
storing the javadoc attribute in the .classpath file. We want to support
this and maybe other attributes. So we're asking for your feedback on the
best way to add a new API for this.

Currently the way you create a new IClasspathEntry is using the
JavaCore#new*Entry(*) methods. One way to support the new attributes would
be to pass an extra argument of type Map. The key in the Map would be the
name of the extra attribute, and the value would be a String representing
the value of this attribute.

Has anyone a better idea for this API ?

Thanks,
Jerome

_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/jdt-core-dev


_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/jdt-core-dev


_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/jdt-core-dev


Back to the top