I am doing application using Eclipse 4 rcp. I general it is single perspective UI with layout based on Part View's, what allows me to drag, and reorder layout. Problem is that it is automatically persisted.
Is it possible to handle that process? I would like to create handler which would reset my layout to stock.
I saw tutorial here: Eclipse 4 Model Persistence - Tutorial but did not catch that point:
-Should I really override ResourceHandler.
-What is required to write hadlers like in example. Because line:
E4XMIResourceFactory e4xmiResourceFactory = new E4XMIResourceFactory();
Resource resource = e4xmiResourceFactory.createResource(null);
throws compile time exception:
The type org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl cannot be resolved. It is indirectly referenced from required .class files.
I maybe someone can explain or give a simple example, how to handle basic persistence of layout. Or at least hot to revert it to such, which was programmed
Include the plugin org.eclipse.emf.ecore.xmi in your plug-in's dependencies to resolve XMIResourceFactoryImpl (and org.eclipse.emf.ecore for Resource)
The author of this tutorial is one of the main Eclipse developers and his tutorials are usually accurate.
If you just want your application to always start with the original layout you can specify the -clearPersistedState option in the program arguments in your xxx.product file. You can also use -persistState false to stop the persistence of the model altogether.
Related
I have an Eclipse (4.4.1) working set consisting of ~60 projects (the number may be relevant, as it takes more time to refresh the workspace). Occasionally, I encounter build failures because Eclipse is unable to clean the output folder before build:
It turned out that the process which locks the file is Eclipse itself:
It also turned out that files being locked are always of XML content. Particularly, if I define resources with *.foo extension as XML files (via Preferences -> General -> Content Types), there's a good chance they will be locked, too, once they're copied to the output path.
I thought the problem was caused by all XML resources being validated automatically:
-- so I added exclusion filters 1st and even disabled XML/XSD validation entirely. The problem stopped occurring that often, but still emerges from time to time. Refreshing or closing-reopening a project isn't helpful.
The only remedy is restarting Eclipse or running Unlocker every 1/2 hour, which is not very convenient.
Any ideas how to solve or at least further diagnose this?
Just my 2 cents.
Perhaps you can fix this issue by following this steps:
Project -> Properties -> Builders -> New -> Program
Define a custom "Cleaner"-Program, for example Unlocker or your own Java- or CMD-script
Move your custom Builder-Program up. It should be the first Builder in the list
P.S. some times i have similar problems caused by Avira Antivirus Scanner...
Disable third-party version control daemons. (Like TGitCache).
They only lock resources for a short while and are not visible in Process Explorer, but are the most frequent cause of such failures.
Assuming that XML Validation is the main cause of your problem, I suggest you extend your search for validation points in your projects' configuration, to set off all of them:
General preferences/Validation
General preferences/XML/XML files/Validation (the "honour all schema locations" option might be causing delay at validating)
Project preferences/Validation (check them; might be overriding the general preferences)
Project preferences/Builders/Validator
Hope it helps.
I have experienced similar issues. Yes, the number of projects is probably the cause. Close the projects not in use. If that cleans things up moving groups of related project into separate work spaces should help you out.
i.e File-> Close project
I'm not familiar with the problem, but I would tackle the problem this way:
download File Leak Detector
add the agentpath to your eclipse.ini (e.g.,
-javaagent:path/to/file-leak-detector.jar=http=19999, see documentation of File Leak Detector)
when the problem happens again, see which (eclipse) class is responsible for holding a handle of the file
Find out what is the purpose of the class that holds the handle
This way, you are maybe able to pin down the Eclipse feature that causes your problem.
I'm creating my first Vaadin Project and I have lots of problems understanding how it works. I created a new widget, that uses GWT Graphics and I drew some objects on the screen. However sometimes, instead of displaying the DrawingArea, my browser shows me this error
Widgetset 'com.example.jtpwebapp.JtpwebappWidgetset' does not contain implementation for com.example.jtpwebapp.MyComponent. Check its component connector's #Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.
The other components are just fine. For example, this error shows up if I simply create a new Thread
new Thread() {
public void run() {}
}.start();
The widgetset re-compilation gives me no errors. I'm not changing the #Connect mapping nor editing the module file.
There is really not much code to share, I created a new Vaadin widget using the Eclipse plugin and edited only in a few places.
I get this error also, when I try to make my widget implement a ClickHandler.
GWT only contains an emulated subset of the Java runtime environment. Thread is one of the classes that's not included; JavaScript doesn't support threading so there's no way for the GWT compiler to generate the code for it. The full reference of what's supported is available here.
Now, missing emulation does unfortunately not show up at compile-time, but GWT does perform checks against the JRE emulation library. You just have to run your app in developer mode. The Debugging Client-Side Code section in Book of Vaadin does a pretty good job at explaining how to achieve that with Vaadin.
I'd like to add a custom warning message (i.e. add an entry to the Warnings section of the Problems tab) for .java files in Eclipse.
While I've found information (here and elsewhere) on creating plugins and using markers, I haven't yet found anything which talks about extending the "problem-finding" process. Most of the articles I've found don't discuss when to create markers, only how, and those that do assume that I'm interested in attaching them to a custom build step or custom editor, neither of which seems appropriate for what I'm trying to do.
How can I create a warning which functions like those available via Window > Preferences > Java > Compiler > Errors/Warnings?
I think that a builder might be appropriate for what you want to do. There's a template in the new plugin wizard that creates everything you need for a builder (ex. business logic). Since the builder runs every time the file is modified, you can clear the old warning (code generated for you) and add a new warning (code generated for you) if applicable. This also applies when the file is first created.
You could even look through the code and find hard-coded strings and flag them with warnings if you want.
As for the comments marking translation keys in the code today, those are there to guide NLS tools (you probably already knew that). The idea was to write the code first and then go back later and translate. If a change is made to the code later, the tools can run again and only act on new strings added by the delta.
I am working on an Eclipse plugin which uses custom textmarker annotations. There are plenty of examples out there which explain how to create and delete such markers and I have this all working fine from my own event handlers (when the user clicks a 'refresh' menu item).
However, I cannot work out how to hook the Java editor such that I can do this automatically. I would like all open Java editors to call my code at the same time that it invokes the Java compiler / spell checker / etc. so that I can add and update my annotations then.
How do I do this, and can it be done without creating my own builder? I'd prefer that the user does not have to add a new builder themselves.
Thanks very much
-Ian
The easiest way to this is probably to add a new JDT Compilation Participant - see the extension point org.eclipse.jdt.core.compilationParticipant.
I have created an application and now I want it to make a plugin ready. I have decided to use Apache Felix and after reading tutorial, I am not sure, whether it was a choice that I wanted to.
I want to change my application, so that it loads at the beginning Bundles from /plugins folder and adds every Bundle as a JMenuItem to JMenu. I could have done it using ClassLoader, but I thought OSGi was exactly what I wanted, but then I encountered some problems:
there is a command line for OSGi, but I need it to be implemented in my application, without any user interaction, hard code its default behaviour in code.
there is behaviour of a Bundle ( start() and stop() methods inherited from org.osgi.framework.BundleActivator) that Bundle invokes at the beginning, but I actually want my application, to do something with a Bundle, not a Bundle to do something with an application.
So could you tell me, whether it is possible to make it using OSGi (etc. Apache Felix) or should I implement it using ClassLoader and then explicitly convert a .jar plugin's Main Class to JMenuItem and add it to my JMenu (it is worse, because it doesn't support dynamic change of application and doesn't give me a chance to learn OSGi).
EDIT: I am thinking about sth like: http://karussell.wordpress.com/2009/09/16/plugable-swing-a-hello-world-osgi-example/ , but I cannot find any tutorial.
Why would you create a menu item for every bundle that exists in the view? That doesn't really make sense.
You /could/ do it by creating your GUI app, and then in the start() method, persist the context and then use that to query a list of all bundles in the system. You would probably want to do that on demand when your menu was shown (so you see a current list).
However, you're really thinking in the wrong direction. What you want to do is look for /services/. When a service comes in, you use that service to populate your menu item. That way, you can have multiple services per bundle and the services can have some form of interaction.
Neil Bartlett and myself did a talk on exactly this approach for a Swing-based application (though using registered Action objects). The demo and presentation are still available from this location:
http://www.eclipsezone.com/files/jsig/
Note that this was done at the time of OSGi v4, so you might find the install fails with a mismatched version of the import framework. If so, crack open the file and ensure that it doesn't say Import-Package: org.osgi.framework;version="[1.3.0,1.4.0)" or some such - get rid of the version numbers and it should still run fine today.