Eclipse e4 Extending a Perspective - eclipse

I am starting a new eclipse plug-in project and trying to evaluate what is the best approach.
What is the goal: I want to create a plug-in that adds a View/Editor stacked on the Editor of the C/C++ perspective from the CDT plug-in. Similar to XML editors that have highlighted text editor view and a view that contains a form to be filled and automatically creates xml code.
The best way would probably be to extend the existing C/C++ perspective from the CDT plug-in. How this is done wtih the 3.X API is explained here [1,2]. Basically you use the org.eclipse.ui.perspectiveExtensions extension point to add views realtive to the views in the perspective.
But how can this be done with the e4 API and the model fragment? Is this possible with compatibility layer?
I think another possibility would be to add views contained in the C/C++ perspective through the combability layer to my own perspective like the package explorer. This has the adavantage that already existing 3.X views (like the package explorer) can be used but also have the advantages of the e4 API.
Or would it even be the best to create a pure 3.X plug-in because my plug-in is mainly based on another perspective/plug-in?
Hope somebody can help me here :)

I don't think it is possible to extend a 3.x perspective using e4 model fragments. It is certainly easier to stick to the 3.x style.
You can use e4 style views by using the e4view style view on the org.eclipse.ui.views extension point.

Related

Is it possible to create graphs in a custom eclipse view?

I am creating a custom view in eclipse for a project and I need to be able to bring in data from an outside source and graph it in a custom view. What is the best way to go about doing this? Thanks!
You'l want to look at the Graphical Modeling Project (GMP). That's where you'll find the base classes to build a custom graphical editor from scratch. There are also GMP sub-projects that generate graphical editor implementations from EMF models.

Adding Xtext template proposals to the standard Templates View

We use a DSL generated with Xtext. We added template proposals to our editor as described in the documentation , it works great - templates are available on 'Ctrl+space' and on the preferences page. However, they are NOT visible in the templates view - a standard view in Eclipse where the template proposals are usually displayed.
Normally, Eclipse templates are added by use of the org.eclipse.ui.editors.templates extension point, but it is not used in our plugin.xml generated by Xtext.
Is it possible to display Xtext templates in the standard templates view and if yes, how can we do it?
UPD:
As pointed by Zoltán in his comment, even though the templates view is placed inside the "Generic" group, it heavily depends on the JDT. That's a limitation of this view. An alternative approach to display all templates in a view next to the editor is described in another post
If you are talking about the General/*Templates* view from the Show view dialog, as opposed to its category, is JDT-specific - at least according to the Plug-in spy it is contributed by the
org.eclipse.jdt.ui plug-in, and it only displays Java related templates (I have other template-supported languages available in my setup, and none of them are displayed in the view).
In other words, even if it is possible to extend this list by the Xtext templates (but I think, it is not), you are to be very careful about it, as it might introduce potentitally unwanted JDT UI dependencies for your project.

e4 Toolbar at Top Position invisible

I have a question regarding e4 rcp applications.
I am creating an Eclipse e4 RCP project which uses the compatibilty layer.
Basically I created an 3.x RCP project, a product and an Application.e4xmi to use e4 features in my 3.x RCP project. I did this to be able to use the compatibilty layer for stuff like the project explorer, the console etc....
I started with that tutorial: http://dirksmetric.wordpress.com/2012/08/01/tutorial-eclipse-rcp-e4-with-3-x-views-like-project-explorer-properties-etc/
and now I'm migrating my own plugins from 3.x to e4.
Till now that worked out pretty well. I can still use a multiparteditor from 3.x but also dependency injection for some parts. Now I'm facing a rather odd problem.
My Application has a Trimmed Window with a Main menu some parts and then there are the TrimBars...my problem.
The toolbar I create there is not shown if I choose the 'top' side...every other side is working.
In a pure e4 Application that is working fine. I'm not sure why...maybe you have an idea.
Thx.
After you have created your RCP application, you should have class ApplicationWorkbenchWindowAdvisor (extends WorkbenchWindowAdvisor) created for you. It has preWindowOpen() method overridden with IWorkbenchWindowConfigurer.setShowCoolBar(false). Change it to true:
public void preWindowOpen() {
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
configurer.setInitialSize(new Point(400, 300));
configurer.setShowCoolBar(true);
configurer.setShowStatusLine(false);
configurer.setTitle("RCP Application");
}
Make sure that your XMI file defines the 'TOP' TrimBar with the id 'org.eclipse.ui.main.menu', there's currently some dependency on the handling code that requires this (i.e. it finds the trim bar by ID rather than position).

What is this Eclipse view and how to implement it in other Eclipse-based products?

In Flash Builder 4.6's code assist, there is this extra box on the right of the classes, outlined in red, (image: http://oi42.tinypic.com/rqyuqq.jpg) that pops up when using the default Flex SDK. What is it called?
I find this feature very useful and wondering where I can get more information to implement a similar one in another Eclipsed-based IDE that I'm using.
this window is called JavaDoc View
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fviews%2Fref-view-javadoc.htm
any developer that uses the eclipse IDE knows this windows, it's shown the javadoc content of selected element,
it's part of Eclipse Java development tools (JDT)

Eclipse look & feel customization

I need to customize the look & feel of my RCP application.
I took a look at Eclipse Presentation API and I suppose it allows to customize everything in workbench except controls.
So is there any solution to customize controls?
I made some research work and implemented some ad-hoc SWT cunstomization using control canvas drawning. May be there are better solutions?
In Swing you can use Synth theme. It would be great if some 'skin' framework exists for SWT.
One way of customizing an RCP app is by using a plugin_customization.ini file. Like this:
Create a new file called "plugin_customization.ini" in the root of your project.
If you have not already done so, create a product configuration and define a Product.
In your plugin's manifest editor, on the "Extensions" tab, locate the "org.eclipse.core.runtime.products" extension, expand the node, right click on your product node and select "New > property" from the context menu.
Enter "preferenceCustomization" in the "name" field and "plugin_customization.ini" in the "value" field.
Select "File > Save" from the main menu.
You can then customize a lot of things simply by editing plugin_customization.ini file. For example, adding the following line
org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false
will give you rounded tabs on your views and editors (similar to those that Eclipse IDE has) instead of the default ones.
You can find other constants that you can use in IWorkbenchPreferenceConstants javadoc.
Also, check out the Eclipse skins project, if you haven't already.
There is also the possibility to use CSS to change the look & feel of your app, but that is still in development and can be buggy
As for customizing the SWT controls themselves, the only way to do that (apart from small customizations such as changing the background colour of a control etc.) is by creating your own custom controls by extending Canvas or Composite, but you already know that. Keep in mind that the point of SWT is to use native controls, so if you desire the ability to completely customize your controls, perhaps using Swing would be a better option. However, if you're going to use Swing, it may be better to use another RCP entirely - namely, NetBeans RCP. I haven't tried it out yet, but I know that whereas Eclipse RCP uses SWT as a widget toolkit, NetBeans RCP relies on Swing, so that may save you from some headaches regarding compatibility problems and so on.
The new Eclipse 4 work contains plugins that allow the L&F to be customized using CSS. These plugins can be run in a 3.7 Eclipse environment. See Kai's blog for a presentation on the subject: http://www.toedter.com/blog/?p=477
The Eclipse 4 Styling Tutorial has a slide (p.66) on where to get an 3.7 based RCP example.