Make a view not interfere with PropertySheet [message #1081427] |
Wed, 07 August 2013 08:07 |
Leonid Ripeynih 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 #1084867 is a reply to message #1081527] |
Mon, 12 August 2013 06:51 |
Leonid Ripeynih Messages: 150 Registered: February 2012 |
Senior Member |
|
|
Ed Merks wrote on Wed, 07 August 2013 06:33Leonid,
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 |
Ed Merks 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/
|
|
|
Powered by
FUDForum. Page generated in 0.04034 seconds