Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » iTextEditor position coordinates on the screen(I want to get the coordinates of the text editor part of the IDE)
iTextEditor position coordinates on the screen [message #1719033] Mon, 04 January 2016 15:36 Go to next message
Samidha Paroha is currently offline Samidha ParohaFriend
Messages: 1
Registered: January 2016
Junior Member
Hello all,

I am building a plugin in Eclipse where I need to extract the textEditor part of the workbench as an image. For that I need to get the coordinates of the text editor part of the PlatformUI. I tried getting the same by textViewer. getTextWidget().getBounds() But I got the wrong coordinates and rectangle size. and hence, the wrong image.

I looked through the documentation but couldn't get a solution.

Right now, I am doing this -
IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();

ITextOperationTarget target = iTextOperationTarget)editorPart.getAdapter(ITextOperationTarget.class);

if (target instanceof ITextViewer) {
ITextViewer textViewer = (ITextViewer)target; r = TextViewer.getTextWidget().getBounds();

And then I am using Robot to extract the image through a screenshot.
Any suggestions on the present approach are welcome.
Re: iTextEditor position coordinates on the screen [message #1719093 is a reply to message #1719033] Tue, 05 January 2016 08:28 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3523
Registered: July 2009
Senior Member

You've boxed yourself into asking the wrong question. If you want to create an image from a widget, look at the snippet example:

What is "Robot"?

Nitin Dahyabhai
Eclipse Web Tools Platform

[Updated on: Tue, 05 January 2016 08:31]

Report message to a moderator

Previous Topic:Eclipse install process has me completely stymied
Next Topic:Luna on RHEL 6: unable to read repository at ~/.eclipse
Goto Forum:

Current Time: Tue Nov 12 18:49:58 GMT 2019

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

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

Back to the top