Reusing Eclipse Run menu in Eclipse RCP application - java

I want to create an eclipse RCP application for a custom language. A programs which is written using the cutom language should be run and show it's output when the user click on the Run button.
Is it possible to integrate eclipse Run menu in eclipse RCP application with it's default features as we create NEW menu item by using ActionFactory? If it is possible how to do that?
Thanks in advance.

If you "just" want the Run menu along with the default entries, just include a dependency to org.eclipse.debug.ui.
You will then need to add launch configuration types for your specific language using the various extension point from the plugins org.eclipse.debug.core and org.eclipse.debug.ui.
As always, when it comes to the more advanced functionality of Eclipse, the easiest way to get access to the functionality is via resources and examples. Although it is a bit dated, the article "We Have Lift-off" (http://www.eclipse.org/articles/Article-Launch-Framework/launch.html) is the best starting point for this. Have a look at the various references to org.eclipse.debug.core.launchConfigurationTypes to find the best example to use asa starting point - in particular the ANT Build stuff as this is pretty simple...
In general you can find the plug-in that contributes a specific entry using the PDE Menu Spy (Alt-Shift-F2 on MacOS)...

Related

Is there API of IDEA communicating with JCEF's webview when developing IDEA's plugin?

I am currently preparing for developing an IDEA plugin involving webview containing some information. Since I have developed a VSCode extension of similar functionalities and it uses many webviews, I plan to migrate those HTML to IDEA's plugin by JECF.
However, the functionalities require some interaction with the extension/plugin, as in VSCode I could click some elements of the webview and insert some texts into the editor by acquireVsCodeApi provided by VSCode itself. And I am not quite sure if such communication could be performed by using JCEF in the plugin of IDEA? (I am quite new to Jetbrain's plugin development and JAVA)
Great thanks for any suggestions.
Yes, this is possible. One way to do this is to separate your plugin into three separate modules:
A module containing the IDE-side plugin code.
A module that contains the JCEF browser code.
A module that acts as a message passing interface. This module will enable communication between the first two modules.
See the IntelliJ PDF Viewer plugin for a good example, in particular the kotlinjs-migrate branch. Another good place to start - and to keep an eye on while you figure out how the pdf viewer plugin works - is the IntelliJ documentation page about JCEF. The section about the JBCefClient might especially be of interest to you, though it is rather minimal.

Simply restricting an Eclipse RCP application to only run in English

I got a fairly simple question, but I cannot find anything that helps.
I am building an Eclipse RCP application which does NOT have to be localized in different languages. In fact: I want it to just offer an English UI.
So, all my views, editors, menus are nicely only displayed in English the way I want it.
BUT: I use property views and other stuff coming from given Eclipse plugins - and all of them are using my system's language (which is German). My UI now looks totally awkward with mixed languages that I simply don't want.
So, my question is not how to properly internationalize an application, but rather NOT to have it display anything but English, no matter what the system is it's running on.
Should be, easy, shouldn't it?
I tried setting default locale with this:
Locale.setDefault(Locale.ENGLISH);
in the Application class start method, but that does not help at all. Why? Where does it get the language from?
Thanks for your help!
you can look at following runtime options to configure eclipse platform.
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html
osgi.nl is an option to run platform with desired locale.
Go to your .product file in the launching tab. In the 'launching arguments' part put in the 'All platforms tab' :
-nl en
Don't forget to export the product before testing. If you want to launch your app using Eclipse, put the previous line to your 'Run configuration' in the 'Arguments' tab

Embedding a web application inside Eclipse/IntelliJ

I have a couple of questions regarding Eclipse and IntelliJ IDEA support for building a plugin that can...
show (and accept user input to) an interactive web application (with drag-and-drop diagram editing functionalities similar to Visio/OmniGrapffle/Inkscape) inside the main workspace (the biggest space to the right:)) of the IDE.
interaction with the web application (e.g. clicking on a box in the diagram) will trigger some action in the IDE (e.g. show a corresponding source file, or opening a dialog to create a new class).
In other words, I plan to let the web application manage most of the GUI aspects to overcome the limitations of Eclipse and IDEA in terms of animation, or flexibility in terms of showing nice graphics.
To this end, the web application needs to be able to communicate with the services/other plugins provided inside the IDE.
Browsing the web and StackOverflow revealed to me that Eclipse supports an OSGI architecture that might enable me to write an webservice that can be accessed from a web application. But I'm not sure where to start with. Also no relevant information concerning building my plugin for IntelliJ IDEA can be found.
It would be great if you can provide me some pointers. Thank you very much.
PS: I was considering building a normal plugin, (e.g. using the Eclipse's Graphiti project) but the user experience (button's shape, dialogs, properties windows, etd.) using only Eclipse platform support seems limited, as opposed to full HTML/CSS/JavaScript/etc/ supported by a web application. I might be wrong with my approach though so any help would greatly be appreciated.

Programmatically call menu item with Eclipse JDT, Plug-In Development

I've been trying to figure out for a while now how to call an Eclipse menu item from within a plug-in that I'm developing. Say, for the sake of this posting, I want to call the eclipse "Format" menu item in the Right Click Menu to format a source, how would I go about doing this by calling that item (i.e. not just mimicking that menu item's effect, actually calling it)?
I'm not looking for how to format code, just simply the idea of calling a menu item.
I was leaning towards the APIs info on IWorkbench, Shell, ToolBar, ToolItem, etc., but I don't really know. I haven't been able to find anything on this topic in the APIs or anywhere else online. Is there a better approach to doing this rather than programmatically?
Eclipse JDT - http://help.eclipse.org/indigo/index.jsp?nav=%2F3
EDIT:
String commandId = "org.eclipse.jdt.ui.edit.text.java.format";
IHandlerService handlerService = (IHandlerService)(IHandlerService ) PlatformUI.getWorkbench().getService(IHandlerService.class);
handlerService.executeCommand(commandId, null);
Simple as that. The hardest part is finding the commandId, which can be easily searched for, as rlegendi mentioned. This is exactly what I wanted. It accesses that plugin via ID, then executes it. Simple and effective. Thanks everyone!
I'm not sure but probably what you want to read about is the Command/Delegate framework.
BTW if you install the Eclipse Platform SDK plugin (available by default), you can actually take a look on the source code of any plugin that is the part of your current Eclipse product (try Ctrl+Shift+T and typing ISourceViewer for instance, there you find the FORMAT it, for which you can do a search with Ctrl+Shift+G), and you can import any of those plugin projects to your own workspace to examine.

eclipse plug-in development in java: how to run a run configuration from another running one?

I have created two views for eclipse. Each of this views is launched using a different run configuration (meaning a different one for each view).
What I want to do:
In the first view I have a list of elements. When I double click one element I want to start the other view (maybe from its run configuration) and only then to start all the bundles.
Any clue of how to do this?
Besides, I would like to send some parameters from the first view to the second one when launching.
I hope anyone can help.
The Eclipse run configuration is list of complex settings including Main class, VM arguments, JRE paths, and Classpath. The Eclipse view, in your words, is the perspective which contains various window panes; I think that's what you mean. The 2 concepts of run configuration and perspective/view are separate implementations of Eclipse, and not related.
So…what you’re asking seems impossible for Eclipse to do and not fitting to its design.
I propose you include your source folders into the Package Explorer workspace, which is basically just a file system. Afterwards, open/close the project folder when you want to change the views, using your words. I myself switch between 2 rather different projects between pure Java and Swing, and both contain their own Main function, for testing code in StackOverflow. I think this is similar to your goal.
I am not sure what you meant by “list of elements” in Eclipse. And I may not understand your exact problem.

Categories

Resources