How to reopen ViewPart? - eclipse-plugin

I am working to make an Eclipse Plugin. I used a plugin project template that generated a View class which extends ViewPart. I think that it is part of SWT.
My problem is that the View is like a window inside of the main Frame which has buttons for close, minimize. I clicked on the X button of the View by mistake. Now I cannot make it visible again even if I relaunch the Eclipse Application.
Now, my Eclipse application looks like this:
It had some panels and buttons before. But I cannot make the View visible again. How should I make to bring it back? I have tried to delete the plugin project from Eclipse and import it again. But it did not work.
I bet that there it is an easy way to make the View visible again but I do not know how. Is there any setting through MANIFEST file? Or other file?

Specify the -clearPersistedState argument when you run the RCP (this assumes you are using Eclipse 4.x).

1) quick solution
restart workbench with clear workspace option checked under run configuration ..
2) Full Solution
you should add a menu in menu bar to open your view so that you can open your view when ever you want
create a command say openMyMenu
create a handler for it and call below code from handler execute method.
add that command to main menu bar..
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(<view ID>);

Related

JavaFX exe wont run

I have recently finished building a mini-app using IntelliJ IDEA in javaFx. It is my first time using this ide and language, so I am having difficulties manufacturing an exe file. I watched all sorts of youtube videos and different methods.
It does generate an exe file but when I click it, nothing happens.
Any idea?
I do know that with IntelliJ Ultimate edition you can build down with an EXE file.
There are a couple things you need to double check.
First, is that in your project structure under artifacts, you have the "Type:" set to JavaFx Application(which is on the top right of the window).
Secondly, switch to the Java FX tab and make sure Application class is set to your main class.
Thirdly, Select "all" under Native bundle: which is located towards the bottom of the window.
Lastly, Select the Output Layout tab and move all your available elements to output root then click on the module of your application and look at the settings that appear at the bottom. "Make sure that main class setting is in fact the main class to your application.
Side note: make sure you delete your artifacts build folder just to start from a clean slate. Also make sure your Environment variables are set to the system path correctly.

Add additional behaviour to existing Eclipse button?

I would like to add additional behaviour to an existing button in the Eclipse ide with a plugin.
To have an example, I would like to print to standard out each time the "Remove Launch" button in the console view gets pressed (see image).
Should I find and override/extend the corresponding, existing Handler with my logic?
Should I work with the these extensions?
ConsoleView extension locationURI="toolbar:org.eclipse.ui.console.ConsoleView"
Commands extension: "org.eclipse.ui.commands"
There isn't a general way to hook in to existing actions.
For Remove Launch you can set up a listener to be notified of removed launches by using the ILaunchManager:
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
launchManager.addLaunchListener(listener);
The listener is an ILaunchesListener which has a launchesRemoved method that will be called when a launch is removed.

How to use the GtkHeaderBar in glade 3.20?

I tried to do a GtkHeaderBar application with glade 3.20, but I have the oldschool bar on top every time, when creating my python app.
In glade 3.19, checking the client-side decoration property created a line on top, in which I could put the GtkHeaderBar. This is not the case in the latest version.
I tried to check/uncheck every property, I could not find the way to do this. That is very surprising, since this should be the default way to do a Gnome application.
I looked on the internet, but there is dramatically no documentation on gladeā€¦
After searching, it seems that I must add a GtkHeaderBar as child in the main window. But how, that is the mystery.
Create the window, set the "Client side window decorations" property to True. Next, get the HeaderBar widget from the toolbox and drop it on the top part of the window that just appeared:
And here you are, the header bar:
Ok, I found by myself a workaround:
We need to create the GtkHeaderBar apart, and after activating the client side decoration property, we close the project. Then, by editing the XML file, we put the header bar section into the titlebar section, instead of the placeholder xml tag. When we reopen the glade project, that's ok, the header bar is in the window.

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:

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.