RCP Start the product with Clear Workspace - java

So I've come across this weird bug in RCP Apps.
I've created a new RCP App with the Mail Template. I've added a new org.eclipse.ui.menus extension with a menuContribution with locationURI:toolbar:org.eclipse.ui.main.toolbar. To that, I've added a command with a little icon.
Now, if I start the app without Clear Workspace in the Debug Configurations, my action appears AFTER the Quick Access text widget. Not only that, but a few other bugs come along (e.g. views aren't closing, too many views are opening at once). This is not a one-time thing, i.e. I have to start the app with Clear Workspace each time.
This method of adding actions on the coolBar is non-deprecated. Why does it behave like a spoiled brat?
Without Clear Workspace:
With Clear Workspace:

There is a long discussion on the Eclipse forums about this here with a bug filed as a result here.
The bug is not scheduled to be fixed until Eclipse 4.4M5 but using one of the workarounds to remove the Quick Access control discussed here should help.

Related

View remote Tomcat logs in Eclipse Console

I am experimenting with a combination of Vagrant+VirtualBox+JRebel+Eclipse+Tomcat to develop a Java Servlet application. My Tomcat instance runs in a VirtualBox VM, which for Eclipse purposes means it is a remote server. I was able to get hot deploying (JRebel) and debug mode working.
I haven't yet found a good way to get the logs to show up in Eclipse, though. Ideally, I'd like something very similar to the Console view that Eclipse/WTP gives for local Tomcat instances. Some features I like:
Lines in stack traces are clickable, taking me right to the source file
Easily searchable
Highlighting (errors show up in red)
Shows up right in my IDE
Can be cleared when I'm sick of seeing too much
The first two features (clickable and searchable) are the most important to me. Does anyone know of a plugin or separate app that can accomplish this?
LogViewer appears to be abandoned (and possibly non-functional in current Eclipse versions), and JLV doesn't appear to have clickable source lines.
NTail might do the job. It hasn't been updated since 2010, but it seems to work on Eclipse Luna.

Play! framework. create a new view

I created a new project using the play console
now, by default I got in my views directory two files:
main.scala.html
index.scala.html
I want to add a new view file. I call it "forums.scala.html"
now, I know that in order to render a view you need to do this:
views.html.forums.render("Forums");
the problem is that the intellisense doesn't recognize "forums"
but index and main it does recognize.
I've noticed those files:
class_managed/views.html/index.class
class_managed/views.html/main.class
but there is no forums.class so I suspect this is the problem.
I tried to build the project, but it didn't help.
so, what is the solution?
thanks
Your new views are compiled to managed sources after next browser hit if you are using play run for starting Play in dev mode.
If you'll use play ~run it will try to compile it as soon at it will recognize change in the file.
Finally if you started your app in production mode ie. via play start you have to stop it with ctrl+c and run again. Anyway, developing application in production mode is just a bad idea :)
Depending on your IDE most probably you'll need to refresh file structure to allow it find freshly created managed sources.
right click on ther project and click refresh, that worked for me - found it in another thread.
Found the solution.
running "compile" command did the work.
I understood that intelliJ do it auto, so I will probably use it instead of eclipse.
cheers!
If you want to program in scala, my recommendation is to forget about intellisense. Eclipses scala-ide is quite buggy, dont know about netbeans. And because of nonstandard layout of play2 application, non std development tools (play console), it becames even more handy to use simple text redactor (like sublime or textmate) with good old open-folder-as-project feature.

Programmatically call menu item with Eclipse JDT, Plug-In Development

I've been trying to figure out for a while now how to call an Eclipse menu item from within a plug-in that I'm developing. Say, for the sake of this posting, I want to call the eclipse "Format" menu item in the Right Click Menu to format a source, how would I go about doing this by calling that item (i.e. not just mimicking that menu item's effect, actually calling it)?
I'm not looking for how to format code, just simply the idea of calling a menu item.
I was leaning towards the APIs info on IWorkbench, Shell, ToolBar, ToolItem, etc., but I don't really know. I haven't been able to find anything on this topic in the APIs or anywhere else online. Is there a better approach to doing this rather than programmatically?
Eclipse JDT - http://help.eclipse.org/indigo/index.jsp?nav=%2F3
EDIT:
String commandId = "org.eclipse.jdt.ui.edit.text.java.format";
IHandlerService handlerService = (IHandlerService)(IHandlerService ) PlatformUI.getWorkbench().getService(IHandlerService.class);
handlerService.executeCommand(commandId, null);
Simple as that. The hardest part is finding the commandId, which can be easily searched for, as rlegendi mentioned. This is exactly what I wanted. It accesses that plugin via ID, then executes it. Simple and effective. Thanks everyone!
I'm not sure but probably what you want to read about is the Command/Delegate framework.
BTW if you install the Eclipse Platform SDK plugin (available by default), you can actually take a look on the source code of any plugin that is the part of your current Eclipse product (try Ctrl+Shift+T and typing ISourceViewer for instance, there you find the FORMAT it, for which you can do a search with Ctrl+Shift+G), and you can import any of those plugin projects to your own workspace to examine.

IntelliJ productivity tips running tomcat

I'm developing using IntelliJ 11u on a spring mvc application using tomcat.
I tried the maven jetty plugin, but after a few builds I keep getting java permGen issues and then it just hangs. I was told this was because spring uses log4j and it has some sort of leaks?
Anyhow, I'm asking for tips to help fire up a server, tomcat, with my updated code so I can make quick updates and have tomcat reloaded.
Here are my current annoyances with tomcat:
Only code changes seem to get auto-reloaded, if I make changes to my view pages things don't get updated unless I redeploy. The maven jetty plugin seems to map to my view pages directly and I saw updates to my view pages instantly w/o it even redeploying.
if I have more than 1 thing running in intelliJ, like say I have a main program that I run, or a unit test, IntelliJ seems to re-order what gets run in the run drop down menu and also the shortcut keys get changed to the last thing I ran.
I use google chrome, for some reason when I start tomcat it brings firefox to the forefront and opens a new tab each and every time.
If someone can address any or all of the above issues that would be great as I hate this dance I have to go through just to update/redeploy my application. I wish it could just be a consitant method, using shortcuts or automatically without me having to close the tab created in firefox, and then minimizie it, or redploy for a simple view change etc.
You should configure IDEA to update classes and resources and enable a checkbox in the Run configuration to do it automatically on frame deactivation.
Browser can be changed in IDEA settings and you can disable opening browser at all in Tomcat Run/Debug configuration.
As for the Run panel tabs order, you can pin tabs using the tab right click menu, in this case they will remain in the Run or Debug panel in the order they were created.
Look at JRebel if you want an even more productive environment (It costs, but I find it is worth it). As you can see here, http://zeroturnaround.com/jrebel/features/, it increases the types of changes you can hot-swap (no waiting for a build). I am currently evaluating it myself and will probably pick up a full license.
BTW, if you develop in scala (it looks like you're not, but just in case) the plugin is free.

Eclipse RCP: Why is the view missing when running as a Product?

I'm brushing up my Eclipse RCP skill by trying to enhance my one-year-old side RCP application. This application has one perspective, and this perspective has 3 views, and I'm adding another view into the same perspective. To add this new view, I added it in the MANIFEST.MF file under Extensions tab and created the Java file for it.
When I run it as an Application, it works. I see all 4 views in the application. But, when I run it as a Product, that new view is missing. It almost seems like the new view is not registered in the Product. There's no error in the console log either. I think I must be missing a step here, but I can't seem figure out here... pretty frustrating!
Note: The views are added into the perspective programmatically (in Java code), not through MANIFEST.MF file. I just realized that even when I change the existing view's layout (ex: size, or location), it doesn't get reflected when running as a Product either, but it works when running as an Application... sigh!
Note: I commented out all the code in my perspective class, in another word, all the views are removed from the perspective. When I launch the Product, I'm still seeing 3 views in the application. I'm thinking there's something to do with caching, but I'm just bummed now.
Any helps are greatly appreciated here! Thanks much,
Okay, after aimlessly clicking around, I figured out the solution. The workspace data needs to be cleared to pick up changes from the perspective.
To do so...
Right click the product file
Choose "Run Configurations..."
Under "Main" tab, check "Clear" checkbox and "workspace" radio button.
Run it.
Hope this will save some of you from troubles.
I've been bitten by this a couple of times until I figured out the easiest workaround: it's sufficient to reset the perspective. There are two ways to achieve this:
Right-click on your perspective in the perspective selector bar at the top right and click on Reset.
Switch to your perspective and then go to Window | Reset perspective....
After that, the changes to your perspective should be picked up.

Categories

Resources