Skip to main content



      Home
Home » Eclipse Projects » SWTBot » Close a graphical editor
Close a graphical editor [message #16441] Wed, 21 January 2009 07:23 Go to next message
Eclipse UserFriend
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] Wed, 21 January 2009 20:31 Go to previous messageGo to next message
Eclipse UserFriend
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 06:16 Go to previous message
Eclipse UserFriend
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 Jul 04 14:36:35 EDT 2025

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

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

Back to the top