Eclipse IDE add new LaunchGroup mode as a developer - eclipse

Am trying to add new launch mode here:
For example I want new mode called "Load".
I found this extention point: org.eclipse.debug.ui.launchGroups, which eventually define the launchGroup interface.
I have 2 question:
I found this on internet:
<extension point="org.eclipse.debug.ui.launchGroups">
<launchGroup
id="com.example.ExampleLaunchGroupId"
mode="run"
label="Run"
image="icons\run.png"
bannerImage="icons\runBanner.png">
</launchGroup>
</extension>
"In the above example, the launch group will consist of all launch configurations with no category that support run mode. "
why this will make run mode will disappear?
I added this to my code
<extension point="org.eclipse.debug.ui.launchGroups">
<launchGroup
bannerImage="icons/ex.png"
id="com.ExampleLaunchGroupId"
image="icons/ex.png"
label="Load only"
mode="load">
</launchGroup>
</extension>
in a result the new mode "Load" is added to the "Launch mode" list but the run mode disappeared, why? and how to add the a new mode without delete another one?
thanks

Related

Set VS Code to always open a new window on launch

I am trying to automate some of my workflow using RPA (UiPath). I want to set my VS code so that it will consistently open to the new screen without a folder selected when I launch it, but I can't find how to do this in settings.
^^^ The screen I want to open each time ^^^
Does anyone know how to set this?
Add the following two settings into your vscode settings.json:
"workbench.startupEditor": "welcomePageInEmptyWorkbench",
"window.restoreWindows": "none",
^ Alternatively you can set the above settings from settings UI menu too.
This would ensure that you get the welcome page when opening an empty workbench. If in all cases you'd like to show welcome page then set it like so: "workbench.startupEditor": "welcomePage".
Important note
If you had opened a folder/workspace from command line in vscode, like say code ~/dev/myProj, then that session will always be persisted during restart of vscode. That's just how vscode works. So inorder to make the above settings work, you have to open the folder/file from vscode command palette(Ctrl+Shift+P) rather than from command line(or terminal).

Using eclipse for Prolog

I have to use eclipse (with ProDT) for running swi-prolog. I installed ProDT via help->install new software, opened the prolog perspective, made a new prolog project and a new file called HelloProlog.pl with the lines I was given:
% helloprolog.pl
hello :- write('Hello Prolog World!').
Then whenever I tried to run the file (by pressing the green play button) I got the message Unable to launch; The selection cannot be launched, and there are no recent launches.
I did check Windows->Preferences->Prolog->Interpreters and added the swipl.exe of the swi-prolog directory, but nothing changed.
I suspect the problem is that there are no Run configurations for Prolog (Prolog is not in that list), but I have now idea how to set those up.
Can anyone tell me what I'm doing wrong?
Perhaps you can try the following (taken from here):
Create or Select a Prolog Process
After opening the Prolog Perspective, create or select a Prolog process in the Prolog Console View .
Select: Click on the first icon in the Prolog Console's toolbar (“Process Switcher”) to see which Prolog processes are currently running. Select one of them.
Create: Click on the second icon in the toolbar (“Create Process”) and enter a name (any string).
The name of the selected or newly created process will appear in the top left corner of the Prolog Console. If the process was newly created, you will see the welcome message displayed below.
Now you can use the Prolog Console to run your Prolog queries.

How do I have my custom toolbar have its items updated via IElementUpdater

I've implemented a custom toolbar in my RCP application. I'm also using the org.eclipse.ui.menus extension to contribute commands to the custom toolbar.
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="toolbar:com.my.custom.toolbar.identifier.toolbar">
<command
commandId="com.my.command.id"
icon="icons/my_icon.png"
style="toggle"
tooltip="My Toggle Tooltip">
</command>
</menuContribution>
</extension>
I've written the code that finds these IConfigurationElements and turns them into CommandContributionItems which I use to add them to my custom toolbar.
I have some toolbar items that are of type toggle, and I need these to update their UI using the IElementUpdater interface that the command's handler implements.
I also contribute this command to a standard Eclipse menu... like "toolbar:org.eclipse.ui.main.toolbar" and its toggle state is updated via the IElementUpdater when appropriate.
I'm probably missing something in my custom toolbar that hooks it up to the IElementUpdater, but I have no idea where to start looking to make this work.
I've used the IElementUpdater, but not for cases to update the toggle state, as this should be done by the connection to the respective Command. There exist, however, some problems in Eclipse 4 which I have already started to point out in a blog article.
What Eclipse variant are you using? 3.x or 4.x? There exists a bug in 4.x concerning the synchronization of contributions and their command states.

different editors for different perspectives in Eclipse [duplicate]

I'm developing tow eclipse plugin, I have the next problem:
I have two perspective that manages the same files. I would like to make an association between file extension - editor - perspective.
I mean if I open the file extension .XXX in perspective 1 it uses the editor A, but if I open the same file extension .XXX in perspective 2, it uses the editor B.
is it possible? Since now, I used the launcher but now I need more differentiation.
Thanks.
(Sorry, this is one of those "don't do that!" non-answers. :))
As mentioned in the comments, I'd recommend against opening a different editor depending on the current perspective. I think that goes against the expectations of the user, and has some unintuitive consequences, e.g. when I create my own perspectives.
I'd recommend going the path of Eclipse' XML/Plug-in manifest editors, for example. Tabs at the bottom allow the user to choose between the different views, independent of any perspective choice or configuration.
While I agree that this seems a little strange to have the default editor be different for the same file based on the open perspective, here is how you could do it.
Create two new Content Type extensions
Register your first editor as default editor for 1st new Content Type
Register your 2nd editor as the default editor for the 2nd new Content Type
For each content type, you have a 'content type describer'. In these describer classes, have it check the active workbench page for the current perspective ID and if it matches the expected value, then VALID, if perspective id doesn't match, return INVALID.
For both editors you need to associate those editors with a content-type instead of a file-extension or filename
Now only one content type will match at a time depending on which perspective is open. Make sure that one of the content types is the 'default' so that it will always match if the user has some other perspective open.
Update #1 added some examples
There are some online tutorials for this. But here is some example code to make it easier to see what work is required. Here is how you declare your content types (you would need two of them)
<plugin>
<extension
point="org.eclipse.core.contenttype.contentTypes">
<content-type
base-type="org.eclipse.core.runtime.xml"
describer="com.liferay.ide.core.FirstContentTypeDescriber"
id="com.liferay.ide.core.contentType1"
name="First Content Type"
priority="normal">
</content-type>
</extension>
</plugin>
Then in the Describer class you would do your matching logic. Then in the editor extension point you reference a content type instead of a file-name or extension like this:
<extension
point="org.eclipse.ui.editors">
<editor
class="com.liferay.ide.ui.FirstEditor"
default="false"
id="com.liferay.ide.ui.editor1"
name="My First Editor">
<contentTypeBinding
contentTypeId="com.liferay.ide.core.firstContentType">
</contentTypeBinding>
</editor>
</extension>
I would recommend to rethink your approach, and take some cues from WindowBuilder: have one editor associated with the file type which opens a tabbed editor; if a second plugin is added, have it create a separate tab on the same editor.
Other option may be programmatically change file type association with Java code shown in
Eclipse RCP: programmatically associate file type with Editor?
Then there is only a question how to execute that code on perspective change event.

How to use Eclipse RCP command framework Save command with the default save action?

The Eclipse RCP command framework is intended to replace the action framework as the mechanism for allowing plugins to contribute UI commands to the workbench. As well as defining new commands, plugins may provide handlers for default RCP commands such as "org.eclipse.ui.file.save" (full list of default commands here: http://svn2.assembla.com/svn/eclipsecommands/trunk/EclipseCommands/contents/article.html).
Using default commands brings the advantages of standard key bindings and icons, and in some cases the ability to use the built-in Eclipse actions.
For example the default editor save command can be added to the File menu with the following snippet in plugin.xml:
<extension point="org.eclipse.ui.menus">
<menuContribution locationURI="menu:file">
<command commandId="org.eclipse.ui.file.save"
style="push">
</command>
</menuContribution>
</extension>
A handler can then be defined for this command by adding a handler definition in the handlers extension point in plugin.xml. If, however, the editors being contributed implement IEditorPart, it should be possible to simply use the built-in Eclipse save action (which takes care of tracking the active editor and dirty property updates) instead of defining a new handler.
What further steps are necessary to use the built-in save action?
It is necessary to call ActionBarAdvisor.register() to make the save action available. For example:
public class MyActionBarAdvisor extends ActionBarAdvisor {
public MyActionBarAdvisor(IActionBarConfigurer configurer) {
super(configurer);
}
protected void makeActions(final IWorkbenchWindow window) {
register(ActionFactory.SAVE.create(window));
}
}
Given the addition to plugin.xml in the question, the built-in save handler will now be invoked for any active editor.