Bug 127085 - Offer propertyTester for IJavaElements
Summary: Offer propertyTester for IJavaElements
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-09 10:49 EST by Martin Aeschlimann CLA
Modified: 2007-06-22 10:40 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2006-02-09 10:49:35 EST
20060209

Similar to core.resources on IResource, should java.core offer propertyTesters on IJavaElement

core resources offers:
   <extension
        point="org.eclipse.core.expressions.propertyTesters">
     <propertyTester
      id="org.eclipse.core.resources.resourcePropertyTester"
      class="org.eclipse.core.internal.propertytester.ResourcePropertyTester"
      namespace="org.eclipse.core.resources"
      properties="name,path,extension,readOnly,projectNature,
                  persistentProperty,projectPersistentProperty,sessionProperty,
                  projectSessionProperty"
           type="org.eclipse.core.resources.IResource"/>
   </extension>

Suggestions for properties to test on all IJavaElement:
'name', 'onBuildPath', 'inArchive', 'inSourceFolder', 'projectNatures', 'projectSetting' (= project.getOption, allows to test for source compliance)

This also could be split up on elements. But it is more convenient if you can also ask parent properties, e.g. ask a compilation unit on projectNatures

IMember
  isPublic isStatic

IType
   isClass isInterface isEnum isAnnotation isInner isLocal isAnonyomous
   qualifiedName
Comment 1 Martin Aeschlimann CLA 2006-02-09 10:53:11 EST
I volunteer to provide the implementation. It would be clean if the provider of the propertyTester is in the same plugin as where the elements are defined. But it would also be possible to implement this in core.manipulation.
Comment 2 Martin Aeschlimann CLA 2006-08-28 11:08:53 EDT
I released org.eclipse.jdt.internal.core.manipulation.JavaElementPropertyTester to jdt.core.manipulations.
For now it is offering the following properties:
- name
- isOnClasspath
- inSourceFolder
- inArchive
- inExternalArchive
- projectOption

I still think it would make sense to move this jdt.core, that's where users would look for it.
Comment 3 Martin Aeschlimann CLA 2006-08-30 05:22:01 EDT
Should be moved down to JavaElementPropertyTester as properties are not available when plugin is not loaded. org.eclipse.jdt.internal.core.manipulation isn't necessary loaded when Java elements are available -> better provide the properties in jdt.core.