Skip to main content



      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 10:36 Go to next message
Eclipse UserFriend
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;
org.eclipse.swt.graphics.Rectangle 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 03:28 Go to previous message
Eclipse UserFriend
You've boxed yourself into asking the wrong question. If you want to create an image from a widget, look at the snippet example: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet95.java.

What is "Robot"?

[Updated on: Tue, 05 January 2016 03:31] by 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 Jul 08 20:56:41 EDT 2025

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

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

Back to the top