Eclipse neon: different behavior for context menus ? Possible bug in eclipse v4.6.0? - eclipse-rcp

JMSToolBox is an eclipse-rcp v4.5.2 based application.
I tried to upgraded to eclipse v4.6.0 but found a problem with popups menu as follows:
A part is defined in the e4 model as a Part Descriptor (PD). A popup menu is defined inside that PD
On a certain action, the PD descriptor is instanciated and the part is added and displayed in a Part Stack. The body of this part is a TabFolder with multiple tabs corresponding to a JMS Q browsed. Each tab body is basically composed of a TableViewer/Table to display JMS messages.
Each time a new tab is created, a new TableViewer/Table is created and the popupmenu is registered on the Table of the TableViewer with the following line of code:
menuService.registerContextMenu(table,<id of the popup menu in the part>);
This works perfectly with eclipse v4.5.2 (Mars) but not with v4.6.0 (Neon) !
With neon, the popup is working only for the first tab: the context menu is visible and #CanExecute methods associated to the handlers/commands of the menu items are called . For subsequent tabs created, no popup is displayed and #CanExecute methods for the menu items are not called
If I register a different menu with a different Id (previously added to the PD) for each tab, it works! So I suspect this may be due to the fact that a menu with the same element id is added to multiple TableViever/Table even if it is coming from a different instance of a PD...
Is it a bug in neon? a regression? or do I benefit of a bug in mars that makes the application is working Ok with this version?
For now I have to downgrade (or not upgrade) to eclipse v4.5.2..

For reference, I pushed some code to correct the problem. It will be in eclipse v4.6.1+ bug #496695

Related

how to remove google sign in button in eclipse

I'm facing a wierd problem. My eclipse, has a google signin button which is occupying some of the space which I do not want to happen. Initially it had "Sign-in to Google" text along with it. I've followed some blog post and set accordingly to show just the icon (I don't remember that blog post link).
But now, the icon is getting replicating .. it is being shown 12 times. It is actually creating childs :P
I've gone through all the options present in Customize Perspective menu, none of them had this button listed. Can someone help me in removing that google sign button from my perspective? One possible suspect is- my eclipse crashes when I suspend and wakeup my machine.
You can use the Window > Reset Perspective... menu command to reset the perspective to its default state, which might eliminate that toolbar and buttons. If that fails, I would create a new workspace and import the projects into it using File > Import > Existing Projects into Workspace.
If you want to try to salvage your existing workspace, it's possible to do so my manually editing Eclipse's internal file that stores your Workbench layout, but it's a bit tricky. Here are the steps I've followed to eliminate a similar repeated toolbar item:
Exit Eclipse.
Find the Workbench layout file, it's path is <workbench>\.metadata\.plugins\org.eclipse.e4.workbench\workbench.xmi. Make a backup of this file before you touch it - this is essential because it's easy to corrupt the file if you change the wrong things.
Open the file in your favorite XML-aware editor - most packages of Eclipse include the XML editor that works just fine1, but be aware that if you use Eclipse to edit the file you can't have Eclipse open on the workspace that contains the workbench.xmi you want to edit.
Find the section of <trimBars> nodes in the XML; from there you have to determine which <trimBars> node you need to edit. In your case it looks like a vertical one, probably with a side="Right" attribute.
Under the correct <trimBars> node you'll find multiple <chlidren> nodes, each with an elementId attribute that should help you identify it; you're looking for <children> nodes that are identified as something related to the Google plugin.
Delete the <children> nodes that seem related to the unwanted toolbar buttons. In your case, it appears that there is an entire toolbar that you might want to eliminate, so you might want to delete the entire containing <trimBars> node.
Save the file and start Eclipse on that workspace.
1Some packages of Eclipse include EMF tools that will open it in a special XMI editor that does not provide a view of the source, only a structural tree view. Depending on how you like to work with XML, this might be easier than editing raw XML.
This is not a perspective but a view. You can hover over that bar with the buttons and click Alt+Shift+F1 to check where this View comes from. Then you can either disable/uninstall the contributing feature (Help -> Installation Details) or check where the feature came from.
If it comes from the IDE, you can open a bug for it. If it is contributed from a third party plugin, contact the developers of that plugin.
There is an eclipse bug concerning duplicate view toolbar buttons in Luna that has recently closed as well. Maybe this solves your problem as well.
Edit: Taken from this bug:
root cause is that in Luna 4.4M5 WorkbenchWindowControlContribution.createControl is called twice, the
first time with a null value for
WorkbenchWindowControlContribution.getWorkbenchWindow() while it is
still being created. This is related to what has been reported here
https://bugs.eclipse.org/bugs/show_bug.cgi?id=427452
second cause is that my createControl(Composite parent) method was calling PlatformUI.getWorkbench().getActiveWorkbenchWindow() instead
of WorkbenchWindowControlContribution.getWorkbenchWindow(). This
resulted in an attempt to create a new Workbench Window, which
recursively calls createControl() again. This has already been
reported here https://bugs.eclipse.org/bugs/show_bug.cgi?id=366708

PyDev: project not visible

I was using PyDEV without issue but recently when I create a project in Eclipse the project is not visible in the PyDev perspective but is visible in the Java perspective. My project is a python project. It seems that the perspectives are a little mixed up.
Is there a way to fix this?
My solution was:
Going to PyDev Package Explorer
Click View Menu button (arrow pointing down, top left area of the Package Explorer panel)
Top Level Elements
Click Projects
Maybe you added some filter which is hiding it in the PyDev package explorer?
I.e.: have you tried going to the PyDev package explorer filters (in PyDev package explorer > Ctrl+F10 > Customize View).
Or maybe you set the top-level to working sets and don't have a working set on PyDev? (i.e.: Ctrl+F10 > top level elements)
Or maybe you selected a working set which has nothing? (i.e.: Ctrl+F10 > select working set)
I know this is an old question, but I've had to deal with this specific problem in Eclipse 4 Luna, and I have an idea for what's wrong.
Use Package Explorer instead of PyDev Package Explorer.
The native Package Explorer, when in working set view, appears to automatically create and populate the working set "Other Projects." PyDev's explorer does not appear to do this, at least not on my default Luna installation. As well, PyDev's assignment of projects to working sets appears broken on Eclipse 4 Luna, so users of PyDev Package Explorer may have trouble finding their projects between views.
Enable Package Explorer:
- Window -> Show View -> Package Explorer
If Package Explorer not in menu:
Window -> Customize Perspective
Click the Menu Visibility tab.
Expand Window
Expand Show View
Find Package Explorer and put a check in it.
OK
Click Window then Show View, choose Package Explorer and rejoice.
I hope this helps at least one of you. I'm terribly new to Eclipse, and it is probably the single most unfriendly thing I've ever had to use. Good luck!
I had the same problem. Newly created projects did not show up. This is what brought me to this question. While looking at the answer provided by #alecor_Dev, which does not answer to the question, at least in my case, I managed to solve mine.
If you have a working set created and selected new projects will not show up. The easiest way to test is to go to:
PyDev Package Explore->View Menu button (pointing down)-> Deselect Working Set.
If you has a working set but more projects in that workspace more projects will show up.
If you want to keep the view clean you can go back to your working set but add the new project by editing the working set:
PyDev Package Explore->View Menu button (pointing down)-> Edit Active Woking Set.
And click on the project you want to add or remove.
I hope that this will help other with similar issues. While working set are a convenient way to declutter the view, can add to confusion.
I Suggest to #Fabio Zadrozny to add some visible way of marking that we are working inside a working set.
I hope that #medPhys-pl can confirm this although he moved to LiClipse. Obviously, there can be other causes that can create this kind of behaviour, but the initial description of the problem seems very similar to mine and I hope that it will solve other people's issues.

How to remove toolbar created by eclipse 4 application wizard (RCP)

When i create an eclipse 4 application using the wizard it automatically creates these default toolbar and menus.
It seems that whatever i do they just stay there.
I cannot modify them and the only thing that works is modifying the handler's code.
The reason is that the workspace is not updated for some reason so what i did is marked the "clear workspace data" checkbox on the launch config and it is solved

Activate the activator class

I am using eclipse 3.6. I created one sample plugin application. It is neither a eclipse rcp nor workbench. Now when I run the eclipse I want that plugin also to be loaded. But I dont want to use IStartUp. Because what I have found out is
IStartup will be called after the workbench is loaded. I want to refresh some menu. So Is there any way to activate my plugin while the eclipse loaded?
I tried to use Bundle Activation policy. But that is also not activating my Activator class. I just put one System.out. println("Inside start()"). So that is not called. Now can I make it activate my activator?
EDIT:
what my exact requirement is, I have created one workbench application.It is not eclipse rcp application. Now I want to remove the following menu and menu items from the eclipse before the eclipe is loaded.
1. File Menu
2.) Search Menu
3.)Run Menu
4.)Help->search,Dynamic Help,Key assist,Tips and trick,Report Bug,Cheat Sheet.
These menus are inbuilt menu of eclipse. So that is the reason I have to do in this way.
So I already implemented by using startup extension point. But the early startup is called after the eclipse is started.So I need to do some refreshment on the workbench.Then only the menu item will get removed.So I thought I need startup extension point will not satisfy my requirement as it doesnot refresh the workbench.I need to activate the my plugin and refresh the workbench before it is loaded.
Thanks
Bhanu
You can set the needed start level for your plugin using touch point instruction.
You are just a plugin that expects to run in the Eclipse IDE?
Then the answer is, you cannot do what you want.
If you start before the workbench has finished initializing, most of the services that could be used won't work: The workbench itself, menu service, command service, etc.
For most plugins in eclipse, the plugin.xml should be used to add menus, views, editors, etc to eclipse. When necessary, the framework will instantiate them.
org.eclipse.ui.IStartup is available and as you mentioned it will be called after the workbench has been initialized, but before any windows have been shown. It's not to be used lightly, and not by plugins contributing to the UI as it allows all extension from that plugin to be loaded.
EDIT:
If you are an RCP app, you control the main menu. As an RCP app, you have access to the ActionBarAdvisor, WorkbenchAdvisor, WorkbenchWindowAdvisor, which all have lifecycle methods.
If you are an an eclipse plugin, you can add to the main menu ... you cannot easily remove from the main menu. This is by design. Start levels and org.eclipse.ui.startup are 2 mechanisms that won't do what you want.
You still need to answer these questions:
There might still be a way. The crux of your problem is: "I want to refresh some menu"
What kind of menu (popup, main menu,
compound list of menu items in a
menu, etc)?
Where is the menu contribution coming from?
Which specific menu item is it?
Please edit your question (do not comment) and include the information from the above 3 questions, please.

how to access package explorer element in eclipse plugin

i am making an eclipse plugin which make a ui on right clicking a project in eclipse workspce . the ui contains text fields , package explorer for the current project and directory explorer for current project.
i have successfully made a ui which appears on clicking a menu item on right clicking the project but it seems i can't make any jface or swt ui since they are not visible when we are using eclipse command hadlers .so in order to overcome it i made dialog pages but they have limited dialog like directorty dialog and file dialog and that too for entire window directory..... but i want package explorer and directory explorer for the project i just chose like it happens when u try making a new class in a project the browse buttons just show packages and directory struture w.r.t to current selection
am i doin things wrong or is there a way out please suggest .....
It seems a bit unclear to me, what the 'UI' is about. If you plan to embed the package and directory views inside a dialog next to each other, then I think you have to build similar lists on your own, since they are views with their own event logic. But if you plan to use them via the browse buttons as describes, take a look at this page. It gives a good overview of the available selection dialogs in eclipse.
It is also always a good practice to search for code in eclipse that does nearly the same you want to do.
As an example, take a look at the new class wizard from the jdt.ui plug-in (This is the wizard you mentioned in your question): Press Cmd-Shift-T and begin typing 'newclass' and open NewClassWizardPage from org.eclipse.jdt.ui.wizards. This works as expected if you imported all jdt plug-ins as (binary) projects.
Take a look at the createControl method and dive into the createXXXControls methods via F3 and try to find out how JDT is doing the job.
As an alternative, open the desired selection dialog class (again with Cmd-Shift-T) and open the call hierarchy of that class...