How to add a toolbar with a button through e4xmi - eclipse-plugin

I have a task to redesign the toolbar of an eclipse-based application. The previous implementation is based on the e3 plugin.xml extension points.
I saw that the application uses an .e4xmi file to add extensions to the eclipse Menu, therefore I'd like to migrate all the toolbars and added buttons to be extended from the e4xmi file.
How can I create a toolbar and add a button to it from the e4xmi file?
I can't find a documentation for migrate a button from e3 to e4...

E4 uses more generic TrimBar "representing the trim along a Window's edge" to express ToolBar, StatusBar and so on.
Please have a look here to learn more https://www.vogella.com/tutorials/EclipseRCP/article.html#toolbars-toolcontrols-and-drop-down-tool-items
I would give E4 a chance, especially for new things.

Related

How to show a selected EObject of a JFace TreeViewer in the Eclipse properties view using an Eclipse E4 view

I added a TreeViewer to an Eclipse e4 PartDescriptor which contains multiple EMF EObjects. Now I'm having difficulties to show the attributes of the selected TreeItems in the Eclipse properties view.
I already tried the exercise 17 in the tutorial http://www.vogella.com/tutorials/EclipsePlugin/article.html#adapters_propertyview_example
but couldn't get it to run because the method getAdapter in the Class implementing the IAdapterFactory never gets called. Therefore nothing is displayed in the properties view when a TreeItem is selected. Even though I added the extension point to the plugin as explained in the tutorial.
Unfortunately, I couldn't find more resources which were using an eclipse e4 view.
Is there a way to use the eclipse properties view in an Eclipse e4 view and how is it done?

How to add buttons linked to your external tool in IntelliJ IDEA

I created some batch work and integrated it as ExternalTool to the IntelliJ IDEA. as described here: Configure Intellij IDEA to run batch file
But how can I add buttons to my toolbar that will activate the batch that defined as external tool?
It is quite easy.
Assuming that you already have an External Tool configured just right click on the menu bar and choose Customize Menus and Toolbars...:
Next step is to mark the last item (whatever that is in your setup) in Main Toolbar and select Add After...:
Now you can select your external tool from the Choose Actions To Add window (here you can also select an icon to use):
Action has been added:
And your button has been added to the toolbar:

Pop-up menu is not fully visible in IntelliJ IDEA

I am just evaluating IntelliJ IDEA. Installed it with default procedures.
I created a simple Spring project and when I right click on the project, not able to see the the bottom part of the pop up menu. The issue is because of my laptop screen's height is less and could not fit the entire set of pop-up menu items.
In eclipse there is a drop down arrow, so that I can scroll to the menu items, which do not fit in the screen. How can I get the similar eclipse functionality in IntelliJ?
Well, you are only missing one useful feature (Genereate Java code from wsdl). I would ignore it unless you need to generate such code.
If you want to run this generation you can do this with Ctrl + Shift + A (and start typing feature name)
//btw, it is better to make code generation in maven anyway

How to add a button to the main toolbar in Eclipse programmatically

I've a question. I cannot find the way, how to add buttons to main toolbar programmatically. My problem is, that I've the task to dynamically (based on XML configuration file) build menus and toolbar. I found how to add a menu item programmatically, but not toolbar button.
Tutorials mostly show how to create buttons and menus using plugin descriptor (plugin.xml), but not how to do it programatically. It seems, that it is out of bounds of Eclipse plugin philosophy.
I've just found this:
There might be layout problems with this approach. I also don't
believe the framework will try and re-create your dynamic item except
at random toolbarmanager updates. With Menus they can be updated on an
SWT.Show event, which is why CompoundContributionItem only applies to
Menus.
What shall I do? Can I say Sorry, there is no way to build toolbar dynamically. I can do it just for menus? Collegue says, that it must be possible, but he does neither know how.
The only way to be able to create main toolbar entries programmatically is in an RCP app, where you supply the ActionBarAdvisor for the workbench window. This isn't dynamic, however, just called on window creation.
Another way to do it would be to use org.eclipse.ui.menus and contribute org.eclipse.ui.menus.ExtensionContributionFactory. It also works only on workbench window creation (not really dynamic), but you could read your own XML and provide IContributionItems for the main menu or toolbar.
How dynamic are you trying to be? Most solutions work well on startup/window creation.
PW
Whenever you try to do something programmatically in Eclipse that is normally done through plugin definitions you are walking on thin ice. I've tried it on a few occasions and it rarely ended up being easy or good.
Instead, think of what it is that you only know at runtime and need to be able to change on the fly. Is it the name or icon of the button? That can be changed at runtime.
Take a look at runtime commands, they can be confusing to define properly, but with them you can for example create buttons that are only visible if a condition is active. That condition could be set at runtime.

Editor context Menu - Eclipse-RCP

I have an Eclipse RCP application. I have created an Editor. There are few context menu (default), when I right click on the Editor. I have not created these menus.
Please let me know, How to remove the context menu of the Editor?
It needs different approach by which editor you extends.
Let me know What you extends, than I can answer more efficient one.
In general way:
IWorkbenchParSite#registerContextMenu(...) will be used, So find where calls that, override it. It is not recommend. Because by doing this, Menu Extensions which is contributed for your editor will not work anymore.
If you mean the system menu that appears on editor tabs and view tabs, that menu is provided by the presentation (2.1, Classic, Default, etc). There is no tweak to simply modify it.
The 2 ways to remove it would be:
write your own presentation, using
the
org.eclipse.ui.presentations.StackPresentation
API and matching extension point.
Writing a presentation is a involved
undertaking.
Change the internal classes in the
org.eclipse.ui.workbench plugin
and patch that plugin in your RCP
app.
If you use Text or StyleText you will get the system default menu (cut,copy,paste, maybe something about encoding or input). If you are not going to supply your own menu, simply create an empty SWT Menu and set it:
Menu emptyMenu = new Menu(text);
text.setMenu(emptyMenu);
Eclipse also has a text editing framework, if you need more than a basic text box you should check it out. http://wiki.eclipse.org/The_Official_Eclipse_FAQs#Text_Editors