Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » One editor for many files(How do not to open editor twice?)
icon4.gif  One editor for many files [message #492584] Tue, 20 October 2009 20:58 Go to next message
No real name is currently offline No real nameFriend
Messages: 6
Registered: October 2009
Junior Member
Hello, all!

I am developing an editor for some type of files (for example .xxx) and my editor allows user to edit all files of some package in one editor tab.

When user opens the second .xxx file in the same package Eclipse creates a new editor for it. But I need not to open new tab, but set focus on existing one.

How may I do it?
Re: One editor for many files [message #492659 is a reply to message #492584] Wed, 21 October 2009 09:50 Go to previous messageGo to next message
Rahul Yadav is currently offline Rahul YadavFriend
Messages: 65
Registered: July 2009
Member
If u wish to use the already opened editor...try IWorkbenchPage openEditor() method
Re: One editor for many files [message #492676 is a reply to message #492659] Wed, 21 October 2009 11:01 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 6
Registered: October 2009
Junior Member
Rahul Yadav wrote on Wed, 21 October 2009 05:50
If u wish to use the already opened editor...try IWorkbenchPage openEditor() method


I tried to do it in init() method but it does not works.

Also I tried to do like this:

Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(this, false)


in methods init() or createPartControl(): tab closes, but I Eclipse catches an exception and sets focus on the rightest tab in the list.

java.lang.RuntimeException: WARNING: Blocked recursive attempt to close part com.doksoft.propeditor.PropEditorForEclipse while still in the middle of activating it
	at org.eclipse.ui.internal.WorkbenchPage.closeEditors(WorkbenchPage.java:1282)
	at org.eclipse.ui.internal.WorkbenchPage.closeEditor(WorkbenchPage.java:1411)
...


Can you write full openEditor() call and tell me in what method am I to insert it, please?
Re: One editor for many files [message #492855 is a reply to message #492676] Thu, 22 October 2009 06:02 Go to previous messageGo to next message
Rahul Yadav is currently offline Rahul YadavFriend
Messages: 65
Registered: July 2009
Member
You will have to extend AbstractTextSearchViewPage and override
showMatch(Match match, int offset, int length, boolean activate) method.

use extension point "org.eclipse.search.searchResultViewPages" in plugin.xml.
Re: One editor for many files [message #493215 is a reply to message #492584] Fri, 23 October 2009 15:47 Go to previous message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 242
Registered: July 2009
Senior Member
chesscoder@mail.ru wrote:
> I am developing an editor for some type of files (for example .xxx) and
> my editor allows user to edit all files of some package in one editor tab.
>
> When user opens the second .xxx file in the same package Eclipse creates
> a new editor for it. But I need not to open new tab, but set focus on
> existing one.

My guess is that you'll have to specify a matchingStrategy to your
editor extension.

http://help.eclipse.org/galileo/topic/org.eclipse.platform.d oc.isv/reference/extension-points/org_eclipse_ui_editors.htm l

Brian.
Re: One editor for many files [message #602770 is a reply to message #492676] Thu, 22 October 2009 06:03 Go to previous message
Rahul Yadav is currently offline Rahul YadavFriend
Messages: 65
Registered: July 2009
Member
You will have to extend AbstractTextSearchViewPage and override
showMatch(Match match, int offset, int length, boolean activate) method.

use extension point "org.eclipse.search.searchResultViewPages" in plugin.xml.
Previous Topic:Hiding incompatible features in update site?
Next Topic:One editor for many files
Goto Forum:
  


Current Time: Fri Apr 19 04:20:48 GMT 2024

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

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

Back to the top