Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » DetailsPart and registered pages
DetailsPart and registered pages [message #327329] Tue, 15 April 2008 15:41 Go to next message
Jason Hocker is currently offline Jason HockerFriend
Messages: 43
Registered: July 2009
Member
I have a master/details page. I have objects in the master page. Some of
the items in the master like are like staff, manager, president... that all
extend Person. I want the selection to bring up the same page for all of
these selections.

detailsPart.registerPage(Person.class, new PersonDetailsPage());

but this doesn't work. I need to implement this for each class. Is that
correct?
Re: DetailsPart and registered pages [message #327340 is a reply to message #327329] Tue, 15 April 2008 19:56 Go to previous messageGo to next message
Steve Blass is currently offline Steve BlassFriend
Messages: 276
Registered: July 2009
Senior Member
Jay Simpson wrote:
> I have a master/details page. I have objects in the master page. Some of
> the items in the master like are like staff, manager, president... that all
> extend Person. I want the selection to bring up the same page for all of
> these selections.
>
> detailsPart.registerPage(Person.class, new PersonDetailsPage());
>
> but this doesn't work. I need to implement this for each class. Is that
> correct?
>
>

To use registered pages the answer is yes. It is also possible to use a
DetailsPageProvider and build pages that depend on the input class
without registering the pages ahead of time.
Re: DetailsPart and registered pages [message #327341 is a reply to message #327340] Tue, 15 April 2008 20:24 Go to previous messageGo to next message
Jason Hocker is currently offline Jason HockerFriend
Messages: 43
Registered: July 2009
Member
Is this a bug or the way its supposed to work by design? Is there a way to
have all the children use the same page without listing all the classes? We
would like to be able to extend this to unknown classes.


"Steve Blass" <sblass@acm.org> wrote in message
news:fu31ar$i75$1@build.eclipse.org...
> Jay Simpson wrote:
>> I have a master/details page. I have objects in the master page. Some
>> of the items in the master like are like staff, manager, president...
>> that all extend Person. I want the selection to bring up the same page
>> for all of these selections.
>>
>> detailsPart.registerPage(Person.class, new PersonDetailsPage());
>>
>> but this doesn't work. I need to implement this for each class. Is that
>> correct?
>
> To use registered pages the answer is yes. It is also possible to use a
> DetailsPageProvider and build pages that depend on the input class without
> registering the pages ahead of time.
Re: DetailsPart and registered pages [message #327369 is a reply to message #327341] Wed, 16 April 2008 16:38 Go to previous message
Steve Blass is currently offline Steve BlassFriend
Messages: 276
Registered: July 2009
Senior Member
To use the same page for all the children regardless of type and with
unknown classes the DetailsPageProvider approach is your friend.

in the MasterDetailsBlock declare something like

private IDetailsPageProvider myDetailsPageProvider;

then create the DetailsPageProvider in the M/D block constructor

myDetailsPageProvider=new DetailsPageProvider(...);

so that your registerPages method can say something like

void registerPages(DetailsPart detailsPart) {
detailsPart.setPageProvider(myDetailsPageProvider);

}

Now, DetailsPageProvider looks something like

public class DetailsPageProvider
implements IDetailsPageProvider {

public DetailsPageProvider(...) {

// TODO Auto-generated constructor stub
}

/* (non-Javadoc)
* @see
org.eclipse.ui.forms.IDetailsPageProvider#getPageKey(java.la ng.Object)
*/
public Object getPageKey(Object object) {
return object;
}

/* (non-Javadoc)
* @see org.eclipse.ui.forms.IDetailsPageProvider#getPage(java.lang. Object)
*/
public IDetailsPage getPage(Object key) {
return new ObjectDetailsPage(key);
}
}

And from there it is all about whatever you want ObjectDetailsPage to
put on the form -

public class ObjectDetailsPage
implements IDetailsPage {
...
public ObjectDetailsPage(Object key) {
...
}

/* (non-Javadoc)
* @see org.eclipse.ui.forms.
* IDetailsPage#createContents(org.eclipse.swt.widgets.Composit e)
*/
public void createContents(Composite parent) {
// here you get to create whatever form you
// want for the input object
...
// or you can use the same page for every object
}

HTH,

Steve



Jay Simpson wrote:
> Is this a bug or the way its supposed to work by design? Is there a way to
> have all the children use the same page without listing all the classes? We
> would like to be able to extend this to unknown classes.
>
>
> "Steve Blass" <sblass@acm.org> wrote in message
> news:fu31ar$i75$1@build.eclipse.org...
>> Jay Simpson wrote:
>>> I have a master/details page. I have objects in the master page. Some
>>> of the items in the master like are like staff, manager, president...
>>> that all extend Person. I want the selection to bring up the same page
>>> for all of these selections.
>>>
>>> detailsPart.registerPage(Person.class, new PersonDetailsPage());
>>>
>>> but this doesn't work. I need to implement this for each class. Is that
>>> correct?
>> To use registered pages the answer is yes. It is also possible to use a
>> DetailsPageProvider and build pages that depend on the input class without
>> registering the pages ahead of time.
>
>
Previous Topic:Compiling Eclipse Code
Next Topic:silly issue when using ITreeContentProvider
Goto Forum:
  


Current Time: Thu Aug 15 01:59:59 GMT 2024

Powered by FUDForum. Page generated in 0.03518 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top