Eclipse Plugin Project does not display Window added in Application Model - java

Looking into Eclipse 4 RCP.
Did the following:
Created an Eclipse Plugin Project (no Rich Client unchecked,
Actvator unchecked) so no classes under /src
Created a Product Configuration. Application selected is
E4Application
Created a Feature Project and include the plugin I created in step
1
In the .product file I checked the configuration to be based on
features. In the dependencies tab I added org.eclipse.e4.rcp and
the feature I created in step 3 (added required dependencies as
well)
Created Application Model with container to be the plugin project
of step 1 and added a New Trimmed Window
Saved all and tried to launch an Eclipse Application
No window is showing up and I don't see an error in console.
Any idea what am I missing here or how is this debugged?
Update:
I am following: 10. Tutorial: From Plug-in to Eclipse 4 application
The 10.6. Start application is the one that fails
Update 2:
I noticed that some directories have been created outside of my workspace with the name runtime-todo.product (i.e. the plugin name).
Going into runtime-todo.product\.metadata\.plugins\org.eclipse.e4.workbench and deleting the workbench the window showed up.
Why are these directories created outside my workspace and what was the problem here?

I followed all your steps and got the expected empty window after the application started, so something is strange here.
You can try to:
Look for an error log file in the .metadata folder of your runtime workspace
Delete the file .metadata\.plugins\org.eclipse.e4.workbench\workbench.xmi
Add -clean as a program argument to your product launch configuration
Try to start the application again.
If this doesn't help, you can set a break point at org.eclipse.e4.ui.internal.workbench.swt.E4Application.loadApplicationModel to see what happens when Eclipse tries to load your application model (see also Eclipse 4 Source). I hope this helps!
[Update]:
When you start your application, a runtime workspace is created. Here, all the meta data of your application is stored, like settings and resources. For example, in .metadata\.plugins\org.eclipse.e4.workbench\workbench.xmi the user settings of the Application Model are stored.
Sometimes during development, this workspace can become corrupted (e.g. by stopping the application while debugging before settings are saved etc.).
You can see the location of your runtime workspace when you look into the Run Configuration of your application. In the Main tab you can see (and change) the workspace data location. You should keep this runtime workspace separate from your development workspace.
[Update 2]:
Information about the role of the workbench.xmi file can be found here: Constructing the runtime application model. The web page of Lars Vogel offers a lot of useful Eclipse Tutorials at Eclipse Plugin and Eclipse RCP Tutorials.
The Eclipse Help page lets you browse the user and developer guides or search for specific topics. Information about the Eclipse launcher and thus the runtime can be found here in Plug-in Development Environment Guide > Reference > Launchers > Eclipse Application Launcher. Look under Main Tab for explanations about workspace data.
The Eclipse variables are explained in the run configuration dialog of your application. In the main tab, look for the Variables... button. When you select a variable, an explanation is given in the Variable Description field.

You can check the Clear flag in your run configuration or specify -clearPersistedState in your product definition ... as mentioned here in a Lars Vogel Tutorial (search for Problem "Application model changes are not reflected in the Eclipse 4 application" in Table2).

Related

what is the difference between refresh and update project in eclipse

I use eclipse with maven integration for my java web application project. When you right click the project you can "refresh" the project. You can also use "maven -> update project". What is the difference between refresh and update?
Sometimes I got a red-x sign in my pom file (I don't think there is any error). When I use the "refresh", the red-x sign disappears. Any idea?
Another question is that when I update the project, in the property -> deployment assembly, the maven dependencies was removed (I manually added them when I created the project). How can I fix this?
Thanks
A quick google search yielded this result: What does Maven Update Project do in Eclipse?
The correct answer states:
It syncs the Eclipse project settings with that of the pom. If you for example change important plugin settings, such as the output java version, you will find that Eclipse will ask you to update the project and afterwards the configured Java runtime in the project will have changed to reflect what your Maven pom indicates. That is an important thing to keep in mind: the Maven pom is the lead in this kind of project setup. If you want settings to change, try to do that through the pom and not through Eclipse project settings directly or doing a project update might revert what you have changed. There are usually some things I have to correct myself anyway though, such as build path exclusions that m2eclipse likes to put in and strange deployment assembly configurations.
So in short,
Updating your project through maven synchronizes the settings with that of pom and keeps all the settings synchronized between the pom and the project.
Refreshing your project through eclipse will reload the project - that is reload all the files and apply any external changes from the files to the project.
Note that a maven update will cause a refresh of the project in eclipse.
FYI, here's what the official documentation states:
Refresh command
The official Eclipse Oxygen documentation has two distinct (yet similar) definitions:
In Workbench User Guide > Reference > User interface information > Workbench menus > File menu it reads
Refresh (F5)
Refreshes the resource with the contents in the file system.
In Java development user guide > Reference > Menus and Actions > File actions it reads
Refresh
Refreshes the content of the selected element with the local file system. When launched from no specific selection, this command refreshes all projects.
F5
Update Project command
Unfortunately, the only documented occurrence I have found in m2e documentation (see m2e 1.5 release notes) is utterly insufficient and barely related:
The Update Maven Project dialog (launched via Right-click project menu:Maven[Update Project…] or via kbd:[Alt-F5]), now shows a dirty overlay on projects which need updating.
Additionally, an “Add out-of-date” button adds all out-of-date (OOD) projects to the current selection. If an OOD project has not been selected, a warning is shown underneath the selection table with a link equivalent to “Add out-of-date”. Warning text and “Add out-of-date” button tooltip show a count of unselected OOD projects.
Related questions on the 'Update Project' command (or the 'Update Maven Project' dialog):
(Which, alas, however insightful the best answers are, still provide no official statement from m2e developers.)
https://stackoverflow.com/a/20547404/4883320
https://stackoverflow.com/a/42562054/4883320

Error while trying to export eclipse product using wizard

I am getting an error using the eclipse product export wizard. I attached a screen shot the error. The application itself runs out of eclipse with no problems. I know I have the dependency in the proper location. If it helps my company uses Eclipse Indigo. Additionally, a side thing I have noticed is if I add the osgi plugin to the start levels on the configuration tab the product builds. However after I build and install the program it won't run because of an illegal argument exception.
Any info would be appreciated..
I want to give you 2 suggestions:
Check your PATH environment variable and make sure it's pointing to
the right JDK. that was the issue. Hope this will help.
Secondly you can download the related jar file and keep it in related folder. There is a good example is given here: Eclipse - Cannot complete the install because one or more required items could not be found (org.apache.httpcomponents.httpclient)

Eclipse rcp show different layout in Launch and exported file

I'm using Eclipse Luna for creating RCP Application. I set product configuration file for plug-in project. When I run application by click Launch button (Launch an Eclipse application) from Overview page, (1) it keep show old code, not changed one.
So, I exported my application. The first time works find and then second time this one also doesn't show changed codes. I have to remove folder every time for checking updated codes.
Please, someone help me to figure out these issues. It's really bugging me.
Keep showing old code from Launch an Eclipse application & Eclipse Product export wizard
Launch and exported file show different layout
From Launch
From exported file.
I found to run with updated source after exported files. Do uncheck "Generate p2 repository" & "Allow for binary cycles in target platform" when opened Export dialog. After unchecked it them I could get updated files. It looks it happened for application version managing (P2 Folder).

Eclipse plugin not working properly

I developed an Eclipse plugin that compiles and runs java code in German. The technique I am using is that I translate the code to English and pass it to Java Compiler and get the results back and print it in the console.
The problem is that the plugin works when I run the plugin from Inside Eclipse but when I install the plugin in Eclipse so that when I open Eclipse it already exists there and start to test if a real user uses my plugin and creates a new Java project and try to the compile button in my plugin it says [The chosen operation is not currently available] ![Here is the the way I run and it opens a new Eclipse application with the installed plugin ]
Any help please
the way you installed your plugin sounds a little weird to me. So at first please try to export your plugin via the Export Wizard.
(Select Export -> Deployable plugins and features from your projects context menu)
Export your project as jar file and copy it to the 'plugin' folder of your eclipse instance.
After that it might be helpful to debug your plugin on OSGI-Level as there might be a problem loading your plugin (at least the error description you have posted indicates that).
Run eclipse with -console -noExit -consoleLog flags to open an OSGI console for debugging. After that try running ss <your-plugin-name> to see what the state of your plugin is.
The output gives you the ID of your plugin and the state it currently has. If the state of your plugin is not ACTIVE try running start <your-plugin-id> to see whether it starts correctly. If there is a problem starting your plugin you should get a respective log message. Feel free to post it here in case you need further help.
Otherwise there are plenty of options what might cause your problems, so maybe its better to try the steps I have described above before getting into details.
If you want to run eclipse plug-in withput using Eclipse Application , then you need to make a Feature project.
Now if your algorithm has something to do with system Path , you must
check Unpack plug-in and you should read the resource accordingly.
Like PLatformUI.getWorkBC() etc..
No other eclipse plug-in (jar) should be inside plugins directory of eclipse of same name of your plug-in. Ensure for this.

Java source code not shown in Eclipse debug view

I am doing remote debugging of a Java application and using the debug view of Eclipse. The basic debugging process is working fine and I can see the method stack traces in debug view at the relevant breakpoints. However, I am not seeing the corresponding source code in the tab below and it is saying:
Source not found
The source files are already in my Eclipse project and I can see them in the Java view. I have edited the source look up paths and added the *.java files to it. But even then I am not seeing the source code in the debug view where the execution halts. Any clues on this would be appreciated.
For the Run/Debug configuration that you have been using to Remote Debug, have you followed these steps :
“Run -> Debug configurations…”
Choose the remote config from the tree on the left
Click on the “Source” tab
Click on the “Add…” button
Follow the wizard (add the Project containing the source which is being debugged).
If so, can you post a snapshot of the Run Configuration ?
What I have usually done with a Remote Debug run configuration is Add Source as Java Projects to the Source tab on the Run/Debug configuration. Thus to add a project called so, I would proceed as follows :
And when choosing the project, select the two checkboxes :
To end up with this finally :
I have done the below steps and it worked for me:
Run > Run Configurations
Java Application > Click on Source Tab
Include the project by selecting the option "File System Directory"
Debugging started showing the source code.
You are probably using JRebel which is automatically recompiling and reloading classes. Unfortunately Eclipse Debugger doesn't work with class realoaded in this way. In order to make sure that Eclipse will work fine with the class after changes you have to restart your web application container.

Categories