Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Properties view -- again.
Properties view -- again. [message #442613] Wed, 18 January 2006 02:38 Go to next message
Eclipse UserFriend
Hi,

All the views in my RCP application publish selection events using
getSite().setSelectionProvider(viewer);

Only certain objects in certain views should show properties. The
properties view will render a selected object if the selected object
implements IAdaptable that returns an IPropertySource. If the selected
view does not implement IAdaptable and/or return an IPropertySource,
then the Properties view shows blank.

So my question is: How do I make the properties view render the
properties of only those objects that implement IAdaptable which return
an IPropertySource ?

--
Ketan Padegaonkar
Re: Properties view -- again. [message #442877 is a reply to message #442613] Fri, 20 January 2006 16:01 Go to previous messageGo to next message
Eclipse UserFriend
> If the selected view does not implement IAdaptable and/or return an
IPropertySource,
> then the Properties view shows blank

I think you meant:
> If the selected object does not implement...

With this correction, what you wrote is an accurate description of how
the Properties view works (at least for the default property sheet page
-- it's possible for the view/editor to provide a custom property sheet
page by handling getAdapter(IPropertySheetPage.class)).

I'm unclear on what the problem is. Are you saying you don't want the
Properties view to get blanked out if you select an object that does not
provide an IPropertySource?

Nick

Ketan Padegaonkar wrote:
> Hi,
>
> All the views in my RCP application publish selection events using
> getSite().setSelectionProvider(viewer);
>
> Only certain objects in certain views should show properties. The
> properties view will render a selected object if the selected object
> implements IAdaptable that returns an IPropertySource. If the selected
> view does not implement IAdaptable and/or return an IPropertySource,
> then the Properties view shows blank.
>
> So my question is: How do I make the properties view render the
> properties of only those objects that implement IAdaptable which return
> an IPropertySource ?
>
> --
> Ketan Padegaonkar
Re: Properties view -- again. [message #443082 is a reply to message #442877] Mon, 23 January 2006 06:09 Go to previous messageGo to next message
Eclipse UserFriend
Nick Edgar wrote:
> > If the selected view does not implement IAdaptable and/or return an
> IPropertySource,
> > then the Properties view shows blank
>
> I think you meant:
> > If the selected object does not implement...
>
> With this correction, what you wrote is an accurate description of how
> the Properties view works (at least for the default property sheet page
> -- it's possible for the view/editor to provide a custom property sheet
> page by handling getAdapter(IPropertySheetPage.class)).
>
> I'm unclear on what the problem is. Are you saying you don't want the
> Properties view to get blanked out if you select an object that does not
> provide an IPropertySource?

The above corrections and your interpretation of my problem is correct:
I do not want the Properties view to get blanked if I select an object
that does not provide an IPropertySource.

--
Ketan Padegaonkar



> Nick
>
> Ketan Padegaonkar wrote:
>
>> Hi,
>>
>> All the views in my RCP application publish selection events using
>> getSite().setSelectionProvider(viewer);
>>
>> Only certain objects in certain views should show properties. The
>> properties view will render a selected object if the selected object
>> implements IAdaptable that returns an IPropertySource. If the selected
>> view does not implement IAdaptable and/or return an IPropertySource,
>> then the Properties view shows blank.
>>
>> So my question is: How do I make the properties view render the
>> properties of only those objects that implement IAdaptable which
>> return an IPropertySource ?
>>
>> --
>> Ketan Padegaonkar
Re: Properties view -- again. [message #443104 is a reply to message #442613] Mon, 23 January 2006 16:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

you could try this:

Whenever an Object answers with an IPropertySource, store this IPropertySource inside your application and resend it, when an IAdaptable implementing Object doesn't provide an own IPropertySource.

Alternativly - you could extend PropertyView / PropertySheet etc. and modify the methods, that are responsible for showing the empty table, whenever an IAdaptable doesn's provide a IPropertySource.

hope it helps (didn't test it ;) )

Andreas Dolk
Re: Properties view -- again. [message #445016 is a reply to message #443082] Sun, 26 February 2006 07:19 Go to previous message
Eclipse UserFriend
Hi,

i lately had the same Problem. What i basically did to solved it, was to
override the Default Properties view and write my own selection Changed
listener which in case there is no PropertySource available for the
current selection uses the last shown selection. I did this like this:

public class MyPropertySheet extends PropertySheet
{

private static ISelection lastSelection = null;

@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection)
{
/* First we check if the current selection Provides an
* IPropertySource if so we provide it as current selection
*/
if (selection instanceof IStructuredSelection){
IStructuredSelection sel = (IStructuredSelection)selection;
if (sel.getFirstElement() instanceof IAdaptable)
{
IAdaptable adapter = (IAdaptable)sel.getFirstElement();
if (adapter.getAdapter(IPropertySource.class) != null)
{
super.selectionChanged(part, selection);
lastSelection = selection;
return;
}
}
}

super.selectionChanged(part, lastSelection);
}

}

For this new View i used the same id used for the original Property
Sheet view. By doing this the original view is replaced by my new view.

Regards
Andreas




Ketan Padegaonkar schrieb:
>
>
> Nick Edgar wrote:
>> > If the selected view does not implement IAdaptable and/or return an
>> IPropertySource,
>> > then the Properties view shows blank
>>
>> I think you meant:
>> > If the selected object does not implement...
>>
>> With this correction, what you wrote is an accurate description of how
>> the Properties view works (at least for the default property sheet
>> page -- it's possible for the view/editor to provide a custom property
>> sheet page by handling getAdapter(IPropertySheetPage.class)).
>>
>> I'm unclear on what the problem is. Are you saying you don't want the
>> Properties view to get blanked out if you select an object that does
>> not provide an IPropertySource?
>
> The above corrections and your interpretation of my problem is correct:
> I do not want the Properties view to get blanked if I select an object
> that does not provide an IPropertySource.
>
Previous Topic:ApplicationActionBar in RCP product
Next Topic:ViewPart toolbar extensions
Goto Forum:
  


Current Time: Mon Aug 25 13:55:50 EDT 2025

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

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

Back to the top