I am devoloping an application with eclipse RCP. This application should alwaysshow a certain perspective when started. But the application saves it workbench state and when restarted it shows the same perspective it had when it was closed. I tried to add
public void initialize(IWorkbenchConfigurer configurer){
configurer.setSaveAndRestore(false);
}
to my ApplicationWorkbenchAdvisor class, but it did'nt work. I also thought of selection the right perspective, but I don't know where to add such a piece of code.
How can my application always show the same perspective on startup?
Too late for you but maybe usefull for other people.
As #Aiden says, we add -clearPersistedState to the program arguments in run configurations.
It worked for us in e4 with Eclipse Neon 4.6.
I found out that if you always want the same start perspective, you can set the default perspective during startup.
public class Application implements IApplication {
public Object start(IApplicationContext content){
PlatformUI.getWorkbench().getPerspectiveRegistry().setDefaultPerspective("youperspective here");
//other code...
}
//other code...
}
UPDATE:
This only works if you enable "Clear workspace" in your run configurations. My current solution is to delete the workbench file during program startup.
Related
I recently installed IntelliJ IDEA by Jetbrains community edition on my linux device. But to run my first program I need to add configuration (I don't have much idea about Java but I have used PyCharm in the past and add configuration panel is quite similar to add interpreter thing there). I don't know any configuration setting, I think it is supposed to automatically load configuration settings, a default one for the first time, but it doesn't. If I have to create a main class first then I don't what code to write in that. In every installation guide, they just assume that a configuration is already there. In documentations etc. they tell how to edit those fields and the way main class decides what to find in any program to execute. But I couldn't add a configuration to start executing any program.
I need help with the highlighted fields in the following screenshot
This guide from jetbrains.com didn't help:
I'm not sure but I get that first I have to create something like main.java and then add it in the main class field but I'm completely clueless about program arguments. Environment variables are optional I guess.
Please help. Thank You
Edit: Here's the file which I'm trying to use for main class field in the configuration.
public class Lbasic1 {
public static void main (String args[]) {
System.out.println("I make mistakes");
}
}
Edit 2: I don't get any option as Run Lbasic1.main() anywhere. Here is the screenshot of IDE
I have an RCP app built with PYDEV in it, and every time I launch it, if there is one or more interpreters cnfigured, PyDev throws a NullPointerException while running the Sync System PYTHONPATH job. It will do this if I manually check the synchronization by clicking the button on the PyDev/Interpreters preference page, or if PyDev does the automatic sync check within one minute of starting.
It does this if I configure any interpreter. When I configure the same interpreter in the Eclipse IDE itself, I don't get the NPE. So something in my RCP app is causing PyDev to throw this error, but I don't have any idea what else I need to do to use PyDev in the app.
The NPE occurs at SynchSystemModulesManager lie 391, using PyDev 4.2.0
The builder that was supposed to be contributed via an extension point was null. This led me to realize that I was missing some required plugins in the eclipse run config and in the Maven build. The problem was solved by making sure that all dependencies of org.python.pydev were included in the product.
Another solution is to implement the required extension, it does not have to do anything.
Add the extension to your plugin.xml:
<extension
point="org.python.pydev.pydev_interpreter_info_builder">
<interpreter_info_builder_participant
class="org.example.InterpreterInfoBuilderParticipant">
</interpreter_info_builder_participant>
Then add the class:
public class InterpreterInfoBuilderParticipant implements IInterpreterInfoBuilder {
#Override
public BuilderResult syncInfoToPythonPath(IProgressMonitor arg0, InterpreterInfo arg1) {
// Do nothing
return null;
}
}
Iam trying to use the matlabcontrol library in vaadin. I basically want use vaadin as a GUI for better configuration of the variables.
I have a test GUI running, everything works fine, until I try to add matlabcontrol specific variables or calls. I did add the library and the matlab interface works great when testing.
I will show you an abstract example:
public class UI_Matlab extends CustomComponent {
public UI_Matlab{
Label matlabRox = new Label("Matlab rocks!");
setCompositionRoot(matlabRox);
}
}
This works fine as expected!
But when I change it too:
public class UI_Matlab extends CustomComponent {
public UI_Matlab{
MatlabProxyFactory factory = new MatlabProxyFactory();
Label matlabRox = new Label("Matlab rocks!");
setCompositionRoot(matlabRox);
}
}
I already get:
"HTTP Status 500 - com.vaadin.server.ServiceException: java.lang.NoClassDefFoundError: matlabcontrol/MatlabProxyFactory"
Additional Information:
Vaadin 7.0
Tomcat v7.0
Eclipse Kepler
matlabcontrol 4.1.0 (edited)
The widget is trying to load additional classes it is depending on (MatlabProxyFactory) and cannot find them (NoClassDefFoundError is like a ClassNotFoundException, but one level "deeper", like a field or return type of the class you are loading cannot be found).
--> Check your build path or whether what you are deploying is complete wrt. dependencies.
I found the answere in another post:
External project dependency in Vaadin
They describe it a little different, so I will add what I did.
What "hiergiltdiestfu" probably meant worked out well, but I accidently was checking the project classpath.
The solution is to add the libraries to the server classpath, which means you have to add it to the tomcat classpath in my case.
Open the following in eclipse:
Run > Run Configurations > Apache Tomcat > (your Tomcat instance) > Classpath
Then add to user entries the library of your need.
I am trying to follow an OSGi bundle tutorial (http://www.vogella.de/articles/OSGi/article.html). It includes this method in the Activator class:
public void start(BundleContext context) throws Exception {
System.out.println("Starting de.vogella.osgi.firstbundle");
}
public void stop(BundleContext context) throws Exception {
System.out.println("Stopping de.vogella.osgi.firstbundle");
}
Unfortunately, the println statements don't print even though the tutorial writer expects them to print. I am obviously new to OSGi and Eclipse, so I am quite lost. Can someone help me along?
Well, I said I was confused. The tutorial mentioned above runs the first demo in Eclipse, but quickly shifts to a standalone container. I got that to work, but broke off for the night and when I came back in the morning started using the built-in OSGi console to follow the standalone instructions. This doesn't work very well and results in the odd behavior described above. When I went back to the standalone container as directed in the tutorial it works better.
I'd assume your plugin isn't even started, or eclipse has no reasons to load your plugin (eclipse does lazy loading of plugins so activate a view of your plugin or something).
If it's the first problem make sure that under Run Configurations->Plugins "Launch with all workspace and enabled Plugins" is selected (that's the easiest to make sure that the plugin and its dependencies are all loaded).
I have several launch configurations in Eclipse each launching the same Java program but with different parameters.
Now is it possible to run all of these at once (with one mouse click) instead of selecting each of it separately and launching it?
EDIT: According to this answer since Eclipse Oxygen (4.7.0) you can use a run configuration of the type Launch Group for that.
Just install "C/C++ Development Tools" from the CDT (see eclipse.org/cdt/downloads.php ) - this single package is enough, no other CDT packages are needed. This won't disturb your Java environment ;-) Then you have "Launch Groups", for any kind of project, including Java projects. See the following screenshot:
You can run or debug the projects (also mixed mode), define delay times and so on. Have fun!
I found this post on the Eclipse trackers: Start multiple debug configurations at once
While it talks about multi-launching debug configurations, I think it is just as applicable to run configurations.
You may want to right click a run configuration in group launch and configure it.
Since Eclipse Oxygen (4.7.0) you can use a run configuration of the type Launch Group for that.
This short video shows how to use a Launch Group.
There are two more options listed in Launch an Eclipse Run Configuration from ANT.
You could group them in Ant and then call them using Ant4Eclipse. Or call multiple launch configs from a command script using eclipse remote control.
You can create a separate class that calls your program with different arguments, and run it instead.
public class YourClass {
public static void main(String arg){
System.out.println(arg);
}
}
public class YourClassTester {
public static void main(String[] args){
YourClass.main("SomeArg1");
YourClass.main("SomeArg2");
YourClass.main("SomeArg3");
}
}
You don't need any plugin:
Create all Run Configurations in eclipse
Select Organize Favorites...
Add you favorites, done