Placeholders for parts doesn't honor the closeable flag? - eclipse-rcp

I'm running into a strange issue in an application I'm developing using the Eclipse RCP platform.
In my model, I'm attempting to use Shared Elements in order to reuse parts between perspectives. I created a Label part and ensured that the Closeable flag was off.
I created a placeholder for this part and ensured that the same Closeable flag was also off for the placeholder..
However, when I run my RCP application (with persisted state cleared, of course), my part has the close icon on it and can indeed be closed.
On the other hand, if I place the part directly within my part stack as follows,
and leave the Closeable flag off, the part displays correctly without the close icon.
How can I get the placeholders to honor the closeable flag? Or is this the intended behavior...?

This is supposed to work but doesn't. This is reported in Eclipse bug 400771.
This is currently still open. The target for a fix is Eclipse 4.7 but I guess it has missed that as the first release candidate for 4.7 is already available without it.

Related

eclipse e4 restore perspective on startup automatically

We all know that by default eclipse saves application state in workbench.xmi and then recreates perspective only if this file is absent. However, I've got a project on e4 which ignores this file even though it exists and -clearPersistentState is NOT specified in arguments. I think there should be some piece of code somewhere responsible for this but the project is too big I don't know how to track it down. My goal is to make this app to use workbench.xmi once again to restore perspective.
To investigate why this happens I want to know which eclipse method is responsible for perspective restoration so I could make sure that this project at least launches this method. That's the main question.
The less main and the less clear question is how this default restoration behavior can be avoided? I mean where should I look for the possible source of this problem? Could there be some option in some .xml which makes the project forget about workbench.xmi? Could it be some sort of startup handler which manually restores default perspective? Maybe some hint about which methods are possibly should be involved in this so I could search for them. Any help is appreciated. Thanks in advance.
-UPDATE-
So it turned out that the problem arises because the project UI is defined in fragments rather than in main Application.e4xmi and eclipse has a bug due to which fragments UI merge with main application after previous state restoration thus replacing restored settings with predefined ones. This bug is discussed in this thread.
This useful article describes how one can manually save and load various application components. Another useful source of inspiration is the source code of ResourceHandler itself.
The main E4Application class controls loading and saving the application model.
E4Application calls a class implementing IModelResourceHandler to load and save the model and the persisted state. It is possible for an application to use its own version of IModelResourceHandler but normally the default org.eclipse.e4.ui.internal.workbench.ResourceHandler is used.
ResourceHandler uses the clearPersistedState, persistState and the deprecated deltaRestore options to control loading the persisted state. These values can be set by command line options.
Add apply="initial" to fragment tag in your plugin.xml to restore stored perspective from workbench.xmi
Example:
<fragment
uri="fragment.e4xmi"
apply="initial">
</fragment>

How do I prevent superDevMode from appearing in my arguments?

I'm using Eclipse (Kepler) for a GWT application and for some reason, superDevMode keeps appearing in my arguments. We are stuck with GWT 2.4 which does not know what superDevMode is. I remove the argument, hit Apply and Debug to start the app, but when I look at the arguments again, -superDevMode is in there again. I am assuming there is some property that belongs to 2.6 (the version that was installed with the Eclipse plugin), but I can't seem to find it.
Update: Below, Adam recommended that I go to the GWT tab and take it out of superdevmode. Here is a screenshot of that tab:
There isn't a way to do that. The large area at the top of the tab (above the Super Dev Mode group) suggested that something was supposed to be there, so I set the project's GWT to 2.6. Sure enough, there was a Super/Classic dev mode selection. I set it to classic, saved the settings, and then put the project back to 2.4. The GWT tab looked exactly as it does above and the arguments now has "-nosuperDevMode" in it, which is also not recognized by 2.4.
Any help would be appreciated.
Thanks,
CC
I found a temporary workaround that comes with a caveat: I made the Eclipse Run Configuration file read-only.
Example path:
<YOUR_WORKSPACE>\.metadata\.plugins\org.eclipse.debug.core\.launches\<YOUR_RUN_CONFIG_NAME>.launch
Then whenever you bring up the Dev Mode Run Configuration in Eclipse it still shows the -superDevMode flag, but when you click the Close button it now asks you if you want to save and you can press No.
The big caveat: if you actually do want to change the Run Configuration Eclipse will ask if you want to save, you press Yes, the dialog closes, but it didn't actually save.
Easiest fix is to shutdown Eclipse, manually edit the .launch file to remove -superDevMode, make the file read-only, then start Eclipse again.
Here's the bug report.
Go to GWT tab (3rd from left) and switch from Super Development Mode to Classic Development Mode

Eclipse auto refresh (after custom builder) does not discover new files

This is not another of many "how do I have Eclipse auto refresh" questions. My problem is that it does but not entirely.
In a workspace with multiple projects the compilation of one causes source code to be generated in other(s) (that exist purely for this purpose - no manually written source code there). Source code is generated during the main compilation itself (i.e. not a custom builder, but a plugin for the Scala compiler, but that should be irrelevant).
What I've done so far is:
Add a dummy custom (ant) builder AFTER the standard one and set it to "refresh selected resources" - the source folder of those generated projects.
Also add a dummy custom (ant) builder BEFORE the standard (Java) builder of generated projects that refresh the same thing. Actually I tried various versions - just the source folder, the entire project, or the entire workspace with the same outcome. Note that those generated projects are set to depend on the project whose compilation generates their source code.
In Window -> Preferences -> General -> Workspace enabled "Refresh using native hooks or polling" in addition to "Refresh on access". I also tried disabling "Refresh on access" (leaving only the other one). Same outcome.
Tried with Eclipse Indigo (3.7 SR2 20120216-1857) and Juno (4.2.2 M20130204-1200), both 64-bit Windows versions. Additional plugins are installed, most notably Scala IDE (multiple different versions both for Scala 2.9 and 2.10 ending with Scala IDE 3.0.0). Same outcome.
... and that outcome is that Eclipse does indeed notice the files that have been modified. In whatever was the best combination of settings of the above (forgot) I was even able to get it to notice that some files that used to be generated no longer are and have them disappear (although I still had to collapse the tree and re-expand it, but no F5 was needed).
However, I never got to have it automatically discover that a brand new file that did not exist before was created. In my case that also yields compilation errors (since the modified files that it does discover have changed refer to the code in new files it does not notice).
Simple F5 solves the problem, but it is killing me, as I am trying to roll this environment to other developers and I'd hate having to tell them "You know, you have to (keep) push(ing) F5 every time you...".
Is it possible that this is still impossible in Eclipse? Does anyone know of a plugin (if not a direct solution) that can help?
As I noted in comments, discovering new folders (Java packages) also does not seem to be a problem. Just new files in existing folders.
Thanks!
UPDATE
With all the refresh things I did in place I noticed something I did not before.
I make the change in the project that causes code generation (was trying to test if it is the re-appearance of previously disappearing file is an issue or otherwise). This time I was just renaming one method which caused a name of the generated source file (Java class) to be changed as well.
As "Build automatically" is enabled, Eclipse begins the build. Very quickly it discovers an error and complains about it - one generated class that was modified now refers to a class Eclipse does not see yet (because refresh is incomplete - saw the modified file, but still believed that the file that no longer exists is there and did not see the new file).
Build actually continues. Progress goes up and down, appears and disappears a number of times, building other dependent projects. All the time the error is listed and marked in the Package Explorer on the modified class.
After the build seemingly completes (with that error in it, some minutes later), the refresh completes (!!!). Package Explorer is updated, the old file disappears, the new file appears, the error disappears, etc. I initially attributed this to me switching windows and triggering the refresh that way but I made sure I touched nothing the last time - just made the change and pushed Ctrl+S to save it.
This may mean that the 'condition' is not so bad (one just has to be very patient and have nerves of steel). Investigating further. Thanks to all who are or may be doing the same! The question is still why are there two refreshes with the first one being incomplete?

Eclipse IDE debugging with code change

I am using Eclipse IDE for Java Developers
Version: Helios Service Release 1
Build id: 20100917-0705
In remote debugging Web app with tomcat 7.0.37, when I make some changes, even a line, the changes can not be made into the runtime, so I need to recompile and re-deploy the war application. Wast a lot of time. The message:
Hot code replace failed - Delete method not implemented
I do not understand the message.
Anyone know the secret on how to auto reflect the code change in debug mode? Thanks.
I've found that for hot code replacement to work the code being modified/replaced must be in the execution stack. So you can hot replace changes made to a method you've stopped in, but you can't hot replace changes to that method once you step out of that method... unless you first stop back in the method on a successive call to the method.
With the standard JVM (Oracle's), you can only modify existing methods. Both adding and deleting methods, and changing structure of class (moving methods, fields) are NOT supported. For that, go to JRebel!
One thing to notice is that changes to seemingly "normal code" inside some method will actually need for the java compiler to add or delete methods - and hence it will fail. This happens e.g. if you in an inner class accesses private fields in the outer class - the java compiler will need to add synthetic accessor-methods to the outer class to let the inner class access those fields - which hence will fail to Hot Code Replace. Also, if you remove some code accessing such fields, the java compiler wants to remove the corresponding synthetic accessor-method, which also will fail.
I think there is no way to reflect the code change in debug mode
Debug mode is to trace program flow and find if any issues or errors at particular piece of code....
it just points to line of code in eclipse, which is running in your tomcat, ie. code in eclipse is not used to run application the code u have installed or put in tomcat runs
hence your changes made in eclipse cant reflect in tomcat code

Is it possible to clear the Netbeans output window from my application or temporarily disable all outputs?

Some background:
I've created a Swing application which uses the Substance LaF (Thanks again, Kirill!)
Unfortunately Swing creates a panel somewhere outside the EDT thus leading to an exception message from Substance every time I start my application. By itself this exception is great, I already saved me from creating nasty multithread GUI bugs, but I often miss important outputs because the output window is already cluttered when my application does any real work.
The easiest way would be to patch the Substance source for my personal needs, but I'd rather leave it untouched. That's why I want to know...
Is it possible to clear the output window programmatically, either by calling a method from my application or something like a delayed Ant task?
Alternatively, can I temporarily disable any outputs from my application, including exceptions messages?
Here you are trying to tweak the default behavior of the Output Window which is a part of the NetBeans IDE. You will need to use the relevant NetBeans APIs. Please take a look at OutputWriter and OutputEvent
HTH.