Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Close a graphical editor
Close a graphical editor [message #16441] Wed, 21 January 2009 12:23 Go to next message
Brice Laurel is currently offline Brice LaurelFriend
Messages: 72
Registered: July 2009
Member
Hello,

I use package net.sf.swtbot.eclipse.gef. I want to close my graphical
editor.

I write code

IWorkspace workspace = ResourcesPlugin.getWorkspace();
IFile file = workspace.getRoot().getFileForLocation(
new Path("/home/MyName/Bureau/MyEditor.extension");
GraphicalEditor editor = new GraphicalEditor(file);
editor.close();

File "MyEditor.extension" exists on my File System but when I debug my
code, the "file" is null.


Someone know another way to have an instance of "IFile"? I need this to
instantiate MyGraphicalEditor.

Thanks for your help.
Re: Close a graphical editor [message #16530 is a reply to message #16441] Thu, 22 January 2009 01:31 Go to previous messageGo to next message
Ketan Patel is currently offline Ketan PatelFriend
Messages: 68
Registered: July 2009
Member
There is no really way to map java.io.File to IFile. You can try
following but it will only work for file loaded into workspace:

IWorkspace workspace= ResourcesPlugin.getWorkspace();
IPath location= Path.fromOSString(file.getAbsolutePath());
IFile file= workspace.getRoot().getFilesForLocation(location);

The easy solution might be to add a new constructor to GraphicalEditor
which take a tab title as argument.
Re: Close a graphical editor [message #16614 is a reply to message #16530] Thu, 22 January 2009 11:16 Go to previous message
Brice Laurel is currently offline Brice LaurelFriend
Messages: 72
Registered: July 2009
Member
Thanks Ketan Patel,

I use constructor GraphicalEditor(String name).

Now I select an element on palette, and click on the editor. When I select
the second element,it position on the first element. I want to choice the
position where I click on a editor. I see class Point on javadoc
http://swtbot.sourceforge.net/artifacts/1.2.0/apidocs/. But I don't how I
can choose the position which I want to click.

Thanks in advance
Previous Topic:Not found Junit Test Case
Next Topic:Move position of an element on a graphical editor
Goto Forum:
  


Current Time: Fri Mar 29 15:51:13 GMT 2024

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

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

Back to the top