Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Ruler Action via menus extension point(Plugin.xml question)
Ruler Action via menus extension point [message #638510] Thu, 11 November 2010 14:35 Go to next message
Nadav is currently offline NadavFriend
Messages: 29
Registered: July 2009
Junior Member
I'm trying to add commands to the left-hand ruler of an AbstractTextEditor. How do I do that via org.eclipse.ui.menus extension point? (all the examples I've found show how to add commands to various other locations)
Re: Ruler Action via menus extension point [message #638543 is a reply to message #638510] Thu, 11 November 2010 15:13 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Nadav wrote:
> I'm trying to add commands to the left-hand ruler of an
> AbstractTextEditor. How do I do that via org.eclipse.ui.menus
> extension point? (all the examples I've found show how to add commands
> to various other locations)
Here's an example:

+ <extension point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI=" popup:#AbstractTextEditorRulerContext?after=QuickDiff.Toggle ">
+ <command
+ commandId="org.eclipse.team.cvs.ui.showAnnotation"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with variable="activeEditorInput">
+ <test
+ property="org.eclipse.team.internal.ccvs.ui.isManaged"
+ value="true">
+ </test>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>


Dani
Re: Ruler Action via menus extension point [message #638610 is a reply to message #638543] Thu, 11 November 2010 19:02 Go to previous messageGo to next message
Nadav is currently offline NadavFriend
Messages: 29
Registered: July 2009
Junior Member
That worked like a charm, thanks!

Now can you tell me how to get at the IVerticalRulerInfo? Specifically I'm looking for the line-number where the ruler was clicked when selecting the action.

I can get the line number of the text selected in the editor by getting the editor from the context variables, but I don't see how to get the ruler or its line of last activity...
final AbstractTextEditor editor=(AbstractTextEditor)event.getApplicationContext.getVa riable( "activeEditor");
editor.getSelectionProvider();
Re: Ruler Action via menus extension point [message #639102 is a reply to message #638510] Mon, 15 November 2010 10:11 Go to previous message
Nadav is currently offline NadavFriend
Messages: 29
Registered: July 2009
Junior Member
OK, found it:

private Integer getRulerLine(ExecutionEvent event)
{
if(event.getApplicationContext() instanceof EvaluationContext)
{
final EvaluationContext context=(EvaluationContext)event.getApplicationContext();
final IEditorPart editor=(IEditorPart)context.getVariable("activeEditor");
final IVerticalRulerInfo verticalRulerInfo=(IVerticalRulerInfo)editor.getAdapter(IVer ticalRulerInfo.class);
if(verticalRulerInfo!=null)
{
return verticalRulerInfo.getLineOfLastMouseButtonActivity();
}
}
return null;
}
Previous Topic:HELP! Had eclipse working, installed JDK (instead of using JRE) now does not start
Next Topic:.eclipseproduct is not generated
Goto Forum:
  


Current Time: Sat Apr 20 03:48:58 GMT 2024

Powered by FUDForum. Page generated in 0.03007 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top