Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » add a popup to table viewer
add a popup to table viewer [message #61193] Tue, 20 November 2007 12:13 Go to next message
Valer Roman is currently offline Valer RomanFriend
Messages: 36
Registered: July 2009
Member
Hi

I am willing to add a popup menu filled from the plugin extensions to
a table viewer.
I get a NPE when running in the file
org.eclipse.ui.internal.ObjectContributorManager in this piece of code :

// Optimization: if n==1 (or if all objects are of the same
class), then the common class is the object's class,
// and the common adapters are the adapters cached for that
class in the adapter manager
// See bug 177592 for more details.
if (allSameClass(objects)) {

Class clazz = objects.get(0).getClass();

commonAdapters.addAll(Arrays.asList(Platform.getAdapterManag er().computeAdapterTypes(clazz)));
List result = new ArrayList(1);
result.add(clazz);
return result;
}

the NPE comes from code objects.get(0) cause it has a null object at index 0

The menu was registered on the table viewer like this :

MenuManager ordersMenuManager = new MenuManager("#orders");
//$NON-NLS-1$
ordersMenuManager.setRemoveAllWhenShown(false);
ordersMenuManager.add(new
Separator(IWorkbenchActionConstants.MB_ADDITIONS));
Menu menu =
ordersMenuManager.createContextMenu(ordersViewer.getControl( ));
ordersViewer.getControl().setMenu(menu);
getSite().registerContextMenu(ordersMenuManager, ordersViewer);

ant in the plugin file I have the following popup extension :

<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
adaptable="false"
id="at.niwa.webhosting.db.mappings.TOrder"
objectClass="at.niwa.webhosting.db.mappings.TOrder">
<action

class=" at.niwa.webhosting.admintool.actions.ModifyOrderActionDelega te "
enablesFor="1"
icon="icons/sample.gif"

id=" at.niwa.webhosting.admintool.actions.ModifyOrderActionDelega te "
label="Modify"
menubarPath="additions"
tooltip="Modify tooltip">
</action>
</objectContribution>
</extension>

Hope the info is enough to help me

Thanks,
Val
Re: add a popup to table viewer [message #62004 is a reply to message #61193] Thu, 22 November 2007 11:23 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 237
Registered: July 2009
Senior Member
Hi Val,

it would be great if you can file a bug for this issue with a little
snippet the reproduce. I think the best way is to get the demo
application, change it to reproduce the NPE and attach the diff to the
according bugzilla entry.

Thanks!

Greets
Benny

Val wrote:
> Hi
>
> I am willing to add a popup menu filled from the plugin extensions to
> a table viewer.
> I get a NPE when running in the file
> org.eclipse.ui.internal.ObjectContributorManager in this piece of code :
>
> // Optimization: if n==1 (or if all objects are of the same
> class), then the common class is the object's class,
> // and the common adapters are the adapters cached for that
> class in the adapter manager
> // See bug 177592 for more details.
> if (allSameClass(objects)) {
>
> Class clazz = objects.get(0).getClass();
>
> commonAdapters.addAll(Arrays.asList(Platform.getAdapterManag er().computeAdapterTypes(clazz)));
> List result = new ArrayList(1);
> result.add(clazz);
> return result;
> }
>
> the NPE comes from code objects.get(0) cause it has a null object at index 0
>
> The menu was registered on the table viewer like this :
>
> MenuManager ordersMenuManager = new MenuManager("#orders");
> //$NON-NLS-1$
> ordersMenuManager.setRemoveAllWhenShown(false);
> ordersMenuManager.add(new
> Separator(IWorkbenchActionConstants.MB_ADDITIONS));
> Menu menu =
> ordersMenuManager.createContextMenu(ordersViewer.getControl( ));
> ordersViewer.getControl().setMenu(menu);
> getSite().registerContextMenu(ordersMenuManager, ordersViewer);
>
> ant in the plugin file I have the following popup extension :
>
> <extension
> point="org.eclipse.ui.popupMenus">
> <objectContribution
> adaptable="false"
> id="at.niwa.webhosting.db.mappings.TOrder"
> objectClass="at.niwa.webhosting.db.mappings.TOrder">
> <action
>
> class=" at.niwa.webhosting.admintool.actions.ModifyOrderActionDelega te "
> enablesFor="1"
> icon="icons/sample.gif"
>
> id=" at.niwa.webhosting.admintool.actions.ModifyOrderActionDelega te "
> label="Modify"
> menubarPath="additions"
> tooltip="Modify tooltip">
> </action>
> </objectContribution>
> </extension>
>
> Hope the info is enough to help me
>
> Thanks,
> Val
Re: add a popup to table viewer [message #62262 is a reply to message #62004] Thu, 22 November 2007 15:43 Go to previous messageGo to next message
Valer Roman is currently offline Valer RomanFriend
Messages: 36
Registered: July 2009
Member
Hi

ok I will take your advice and report the bug with the needed
informations. Will let u know when is done.

Cheers,
Val

Benjamin Muskalla wrote:
> Hi Val,
>
> it would be great if you can file a bug for this issue with a little
> snippet the reproduce. I think the best way is to get the demo
> application, change it to reproduce the NPE and attach the diff to the
> according bugzilla entry.
>
> Thanks!
>
> Greets
> Benny
>
> Val wrote:
>> Hi
>>
>> I am willing to add a popup menu filled from the plugin extensions to
>> a table viewer.
>> I get a NPE when running in the file
>> org.eclipse.ui.internal.ObjectContributorManager in this piece of code :
>>
>> // Optimization: if n==1 (or if all objects are of the same
>> class), then the common class is the object's class,
>> // and the common adapters are the adapters cached for that
>> class in the adapter manager
>> // See bug 177592 for more details.
>> if (allSameClass(objects)) {
>>
>> Class clazz = objects.get(0).getClass();
>>
>> commonAdapters.addAll(Arrays.asList(Platform.getAdapterManag er().computeAdapterTypes(clazz)));
>>
>> List result = new ArrayList(1);
>> result.add(clazz);
>> return result;
>> }
>>
>> the NPE comes from code objects.get(0) cause it has a null object at
>> index 0
>>
>> The menu was registered on the table viewer like this :
>>
>> MenuManager ordersMenuManager = new MenuManager("#orders");
>> //$NON-NLS-1$
>> ordersMenuManager.setRemoveAllWhenShown(false);
>> ordersMenuManager.add(new
>> Separator(IWorkbenchActionConstants.MB_ADDITIONS));
>> Menu menu =
>> ordersMenuManager.createContextMenu(ordersViewer.getControl( ));
>> ordersViewer.getControl().setMenu(menu);
>> getSite().registerContextMenu(ordersMenuManager, ordersViewer);
>>
>> ant in the plugin file I have the following popup extension :
>>
>> <extension
>> point="org.eclipse.ui.popupMenus">
>> <objectContribution
>> adaptable="false"
>> id="at.niwa.webhosting.db.mappings.TOrder"
>> objectClass="at.niwa.webhosting.db.mappings.TOrder">
>> <action
>>
>> class=" at.niwa.webhosting.admintool.actions.ModifyOrderActionDelega te "
>> enablesFor="1"
>> icon="icons/sample.gif"
>>
>> id=" at.niwa.webhosting.admintool.actions.ModifyOrderActionDelega te "
>> label="Modify"
>> menubarPath="additions"
>> tooltip="Modify tooltip">
>> </action>
>> </objectContribution>
>> </extension>
>>
>> Hope the info is enough to help me
>>
>> Thanks,
>> Val
Re: add a popup to table viewer [message #62334 is a reply to message #62004] Thu, 22 November 2007 18:49 Go to previous messageGo to next message
Valer Roman is currently offline Valer RomanFriend
Messages: 36
Registered: July 2009
Member
I have added bug 210693 to reproduce the error on demo application

Benjamin Muskalla wrote:
> Hi Val,
>
> it would be great if you can file a bug for this issue with a little
> snippet the reproduce. I think the best way is to get the demo
> application, change it to reproduce the NPE and attach the diff to the
> according bugzilla entry.
>
> Thanks!
>
> Greets
> Benny
>
> Val wrote:
>> Hi
>>
>> I am willing to add a popup menu filled from the plugin extensions to
>> a table viewer.
>> I get a NPE when running in the file
>> org.eclipse.ui.internal.ObjectContributorManager in this piece of code :
>>
>> // Optimization: if n==1 (or if all objects are of the same
>> class), then the common class is the object's class,
>> // and the common adapters are the adapters cached for that
>> class in the adapter manager
>> // See bug 177592 for more details.
>> if (allSameClass(objects)) {
>>
>> Class clazz = objects.get(0).getClass();
>>
>> commonAdapters.addAll(Arrays.asList(Platform.getAdapterManag er().computeAdapterTypes(clazz)));
>>
>> List result = new ArrayList(1);
>> result.add(clazz);
>> return result;
>> }
>>
>> the NPE comes from code objects.get(0) cause it has a null object at
>> index 0
>>
>> The menu was registered on the table viewer like this :
>>
>> MenuManager ordersMenuManager = new MenuManager("#orders");
>> //$NON-NLS-1$
>> ordersMenuManager.setRemoveAllWhenShown(false);
>> ordersMenuManager.add(new
>> Separator(IWorkbenchActionConstants.MB_ADDITIONS));
>> Menu menu =
>> ordersMenuManager.createContextMenu(ordersViewer.getControl( ));
>> ordersViewer.getControl().setMenu(menu);
>> getSite().registerContextMenu(ordersMenuManager, ordersViewer);
>>
>> ant in the plugin file I have the following popup extension :
>>
>> <extension
>> point="org.eclipse.ui.popupMenus">
>> <objectContribution
>> adaptable="false"
>> id="at.niwa.webhosting.db.mappings.TOrder"
>> objectClass="at.niwa.webhosting.db.mappings.TOrder">
>> <action
>>
>> class=" at.niwa.webhosting.admintool.actions.ModifyOrderActionDelega te "
>> enablesFor="1"
>> icon="icons/sample.gif"
>>
>> id=" at.niwa.webhosting.admintool.actions.ModifyOrderActionDelega te "
>> label="Modify"
>> menubarPath="additions"
>> tooltip="Modify tooltip">
>> </action>
>> </objectContribution>
>> </extension>
>>
>> Hope the info is enough to help me
>>
>> Thanks,
>> Val
Re: add a popup to table viewer [message #62768 is a reply to message #62334] Sun, 25 November 2007 10:26 Go to previous message
Valer Roman is currently offline Valer RomanFriend
Messages: 36
Registered: July 2009
Member
Hi

I just found out my problem is, I use the table viewer on an editor
part which has no input attached. After I have stored the input on the
editor setInput(input) the popup showed and no NPE.
May I close the bug I created for this? I do not know if this behavior
is the right one, to have a NPE on an open popup when u do not set the
input of the editor (but still u must not have an editor wich have no
inputEditor saved :) )
It would be much easier to not have an editor showed when the input is
null, like this we would not get to such peculiar behaviour.

Cheers,
Val

Val wrote:
> I have added bug 210693 to reproduce the error on demo application
>
> Benjamin Muskalla wrote:
>> Hi Val,
>>
>> it would be great if you can file a bug for this issue with a little
>> snippet the reproduce. I think the best way is to get the demo
>> application, change it to reproduce the NPE and attach the diff to the
>> according bugzilla entry.
>>
>> Thanks!
>>
>> Greets
>> Benny
>>
>> Val wrote:
>>> Hi
>>>
>>> I am willing to add a popup menu filled from the plugin extensions to
>>> a table viewer.
>>> I get a NPE when running in the file
>>> org.eclipse.ui.internal.ObjectContributorManager in this piece of code :
>>>
>>> // Optimization: if n==1 (or if all objects are of the same
>>> class), then the common class is the object's class,
>>> // and the common adapters are the adapters cached for that
>>> class in the adapter manager
>>> // See bug 177592 for more details.
>>> if (allSameClass(objects)) {
>>>
>>> Class clazz = objects.get(0).getClass();
>>>
>>> commonAdapters.addAll(Arrays.asList(Platform.getAdapterManag er().computeAdapterTypes(clazz)));
>>>
>>> List result = new ArrayList(1);
>>> result.add(clazz);
>>> return result;
>>> }
>>>
>>> the NPE comes from code objects.get(0) cause it has a null object at
>>> index 0
>>>
>>> The menu was registered on the table viewer like this :
>>>
>>> MenuManager ordersMenuManager = new MenuManager("#orders");
>>> //$NON-NLS-1$
>>> ordersMenuManager.setRemoveAllWhenShown(false);
>>> ordersMenuManager.add(new
>>> Separator(IWorkbenchActionConstants.MB_ADDITIONS));
>>> Menu menu =
>>> ordersMenuManager.createContextMenu(ordersViewer.getControl( ));
>>> ordersViewer.getControl().setMenu(menu);
>>> getSite().registerContextMenu(ordersMenuManager, ordersViewer);
>>>
>>> ant in the plugin file I have the following popup extension :
>>>
>>> <extension
>>> point="org.eclipse.ui.popupMenus">
>>> <objectContribution
>>> adaptable="false"
>>> id="at.niwa.webhosting.db.mappings.TOrder"
>>> objectClass="at.niwa.webhosting.db.mappings.TOrder">
>>> <action
>>>
>>> class=" at.niwa.webhosting.admintool.actions.ModifyOrderActionDelega te "
>>> enablesFor="1"
>>> icon="icons/sample.gif"
>>>
>>> id=" at.niwa.webhosting.admintool.actions.ModifyOrderActionDelega te "
>>> label="Modify"
>>> menubarPath="additions"
>>> tooltip="Modify tooltip">
>>> </action>
>>> </objectContribution>
>>> </extension>
>>>
>>> Hope the info is enough to help me
>>>
>>> Thanks,
>>> Val
Previous Topic:Help with org.eclipse.rap.demo.feature project
Next Topic:Re: [EMF] Generate RAP instead of RCP
Goto Forum:
  


Current Time: Fri Apr 19 23:01:26 GMT 2024

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

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

Back to the top