I have a project for an elementary classroom and I'm trying to use Eclipse to access a MySQL database. I have a class called Student and I want to show a properties view for the students.
I'm new to Eclipse and I'm having a hard time figuring out the IAdaptable interface. I've made Student implement IAdaptable and included a getAdapter() method.
public Object getAdapter(Class adapter) {
return Platform.getAdapterManager().getAdapter(this,adapter);
}
I have also an AdapterFactory: The StudentPropertySource(Student) has the methods to return the necessary information to the properties view.
public Object getAdapter(Object adaptableObject, Class adapterType) {
System.out.println(">adaptableObject= "+adaptableObject.getClass()+". adapterType= "+adapterType.getName());
System.out.println(">adapterType==IPropertySource = "+(adapterType == IPropertySource.class));
if (adapterType == IPropertySource.class) {
return new StudentPropertySource((Student) adaptableObject);
}
return null;
}
But, when I run this, I get the following:
>adaptableObject= class madmin.Student. adapterType= org.eclipse.ui.views.properties.IPropertySource
>adapterType == IPropertySource = false
I'm showing that the adapterType is IPropertySource, but the == operator returns false. using equals() does the same. What gives?
Roy
I'm new to Eclipse and I'm having a hard time figuring out the IAdaptable interface. I've made Student implement IAdaptable and included a getAdapter() method.
public Object getAdapter(Class adapter) {
return Platform.getAdapterManager().getAdapter(this,adapter);
}
I have also an AdapterFactory: The StudentPropertySource(Student) has the methods to return the necessary information to the properties view.
public Object getAdapter(Object adaptableObject, Class adapterType) {
System.out.println(">adaptableObject= "+adaptableObject.getClass()+". adapterType= "+adapterType.getName());
System.out.println(">adapterType==IPropertySource = "+(adapterType == IPropertySource.class));
if (adapterType == IPropertySource.class) {
return new StudentPropertySource((Student) adaptableObject);
}
return null;
}
But, when I run this, I get the following:
>adaptableObject= class madmin.Student. adapterType= org.eclipse.ui.views.properties.IPropertySource
>adapterType == IPropertySource = false
I'm showing that the adapterType is IPropertySource, but the == operator returns false. using equals() does the same. What gives?
Roy