Project: JDT
Bug 123198 add parameterized commands to open/show java elements
Reported: 2006-01-10 01:42:49 | Status: resolved fixed

Some recent work on the commands infrastructure (org.eclipse.core.commands) allows commands and their parameters to be serialized to a string so they can be stored and later retrieved and executed. User Assistance wants to use this functionality to store commands in help, cheatsheets and intro content. UA would like to have commands to surface java elements (i.e. open them in editors and show them in views). As an example use case, an intro topic might install a sample with code. The documentation for this intro topic could have text with links like "open class X" or "show class Y in Package Explorer" where clicking the link would run the command described in the text. I'm going to attach a patch which defines 3 such commands: - open java element in editor - show java element in package view - show java element in type hierarchy The java element to perform on is identified by its handle identifier for the purposes of serializing the commands. So this patch also includes a subclass of AbstractParameterValueConverter which is used by the command framework to convert between IJavaElement and its handle identifier (this allows the command framework to do these conversions without having dependencies on JDT). This patch depends on command framework code that has been committed to HEAD after I20060103-0800, but will be in this week's I-build.

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/commands/JavaElementReferenceConverter.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/commands/OpenElementInEditorHandler.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/commands/ShowElementInPackageViewHandler.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/commands/ShowElementInTypeHierarchyViewHandler.java