Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Make a view not interfere with PropertySheet(How to?)
Make a view not interfere with PropertySheet [message #1081427] Wed, 07 August 2013 08:07 Go to next message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
Hi all!

I have the following problem:
An editor, tabbed properties view (works fine with editor), and another view, displaying some editor-related information.

An 'ASCII-Art' below is showing perspective layout.

+-----------+
|   Editor  |
+----+------+
|Prop|MyView|
+----+------+


When I'm activating that another view, PropertiesView becomes blank. How to work around this?

[Updated on: Wed, 07 August 2013 08:08]

Report message to a moderator

Re: Make a view not interfere with PropertySheet [message #1081435 is a reply to message #1081427] Wed, 07 August 2013 08:17 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
Leonid,

Is your view an ISelectionProvider?

On 07/08/2013 10:07 AM, Leonid Ripeynih wrote:
> Hi all!
>
> I have the following problem:
> An editor, tabbed properties view (works fine with editor), and
> another view, displaying some editor-related information.
>
> An 'ASCII-Art' below is showing perspective layout.
>
> +-----------+
> | Editor |
> +----+------+
> |Prop|MyView|
> +----+------+
>
> When I'm activating that another view, PropertiesView becomes blank.
> How to work around this?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Make a view not interfere with PropertySheet [message #1081483 is a reply to message #1081435] Wed, 07 August 2013 09:30 Go to previous messageGo to next message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
Ed Merks wrote on Wed, 07 August 2013 04:17
Leonid,
Is your view an ISelectionProvider?


No, It's only listening to selection.
Re: Make a view not interfere with PropertySheet [message #1081527 is a reply to message #1081483] Wed, 07 August 2013 10:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
Leonid,

When that view has focus, the properties view will show properties for
the selection in that view (like the outline view does) or you might
even have to implement property sheet support specifically for that view...


On 07/08/2013 11:30 AM, Leonid Ripeynih wrote:
> Ed Merks wrote on Wed, 07 August 2013 04:17
>> Leonid,
>> Is your view an ISelectionProvider?
>
>
> No, It's only listening to selection.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Make a view not interfere with PropertySheet [message #1084867 is a reply to message #1081527] Mon, 12 August 2013 06:51 Go to previous messageGo to next message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
Ed Merks wrote on Wed, 07 August 2013 06:33
Leonid,
When that view has focus, the properties view will show properties for
the selection in that view (like the outline view does) or you might
even have to implement property sheet support specifically for that view...


Ed,
I have implemented getContributorId() and getAdapter(Class adapter) methods in my view part to delegate to active editor:

@Override
public String getContributorId() {
  IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
  if (activeEditor instanceof ITabbedPropertySheetPageContributor) {
    return ((ITabbedPropertySheetPageContributor) activeEditor).getContributorId();
  }
  return null;
}

@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
  if (adapter.equals(IPropertySheetPage.class)) {
    IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    return activeEditor.getAdapter(adapter);
  } 
  return super.getAdapter(adapter);
}


And tabbed property sheet is not going empty anymore. However, when I switch tabs, in my tabbed property sections, in refresh() method, getSelection() is always returning null, thus every refresh ends in NPE. Is there anything else I should do?
Re: Make a view not interfere with PropertySheet [message #1084896 is a reply to message #1084867] Mon, 12 August 2013 07:33 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
Leonid,

I don't know the answer. You'll have to use the debugger to see how it's
getting the selection to see why that's null.

On 12/08/2013 8:51 AM, Leonid Ripeynih wrote:
> Ed Merks wrote on Wed, 07 August 2013 06:33
>> Leonid,
>> When that view has focus, the properties view will show properties
>> for the selection in that view (like the outline view does) or you
>> might even have to implement property sheet support specifically for
>> that view...
>
>
> Ed,
> I have implemented getContributorId() and getAdapter(Class adapter)
> methods in my view part to delegate to active editor:
>
>
> @Override
> public String getContributorId() {
> IEditorPart activeEditor =
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
> if (activeEditor instanceof ITabbedPropertySheetPageContributor) {
> return ((ITabbedPropertySheetPageContributor)
> activeEditor).getContributorId();
> }
> return null;
> }
>
> @Override
> public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
> if (adapter.equals(IPropertySheetPage.class)) {
> IEditorPart activeEditor =
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
> return activeEditor.getAdapter(adapter);
> } return super.getAdapter(adapter);
> }
>
>
> And tabbed property sheet is not going empty anymore. However, when I
> switch tabs, in my tabbed property sections, in refresh() method,
> getSelection() is always returning null, thus every refresh ends in
> NPE. Is there anything else I should do?


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Eclipse Plugin: SWT dialog appears without window border
Next Topic:Search Dialog check the Selected Resource Option by default.
Goto Forum:
  


Current Time: Mon Sep 23 16:57:13 GMT 2024

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

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

Back to the top