Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » XML editor embedded in a MultiPageEditor(How to specify a type of editor inside a MultiPageEditor ?)
XML editor embedded in a MultiPageEditor [message #1730843] Fri, 29 April 2016 07:40 Go to next message
Mehdi Alouache is currently offline Mehdi AlouacheFriend
Messages: 9
Registered: April 2016
Location: France
Junior Member
Hello,

I'm working on a plugin designed to assist the user when he's editing XML files. The current project works """fine""" but I'm using a "StructuredTextEditor" as main component. It implies two things :


  1. Opening a new file implies opening a new editor every time
  2. I can't get notified properly when the user activates another page (here, an other instance of the editor)


Moreover, I'm applying listeners on the editor. And as I can't get notified when the user activates another page, I cannot remove my listeners from all the open editors ===> Each action on an editor triggers an event on ALL editors. This makes the plugin really slow to work.

I saw an object called "MultiPageEditorPart", with a method "addPageChangedListener". I think this could be the key to solve my issue, but I cannot integrate it correctly.

If you already faced that kind of problem, if you know how a MPE works or if you see another solution to my problem, I would be glad to read your responses.

Thanks for reading.

[Updated on: Fri, 29 April 2016 12:51]

Report message to a moderator

Re: XML editor embedded in a MultiPageEditor [message #1730879 is a reply to message #1730843] Fri, 29 April 2016 12:50 Go to previous message
Mehdi Alouache is currently offline Mehdi AlouacheFriend
Messages: 9
Registered: April 2016
Location: France
Junior Member
I found an alternative solution. It's a bit "dirty", but it works fine. I post it here for those who could face the same problem one day :

I have an XML editor called TestCaseEditor (extends StructuredTextEditor)

I created a class (TestCaseEditorManager), with a static attribute and a static method. Here is its source code :

public class TestCaseEditorManager{

	private static TestCaseEditor oldTestCaseEditor;

	public static void create(TestCaseEditor tce) {
		if (oldTestCaseEditor != null){
			oldTestCaseEditor.removeListener();
			System.out.println("listeners removed from : " + oldTestCaseEditor.getPartName());
		}

		oldTestCaseEditor = tce;
	}

}


My TestCaseEditor has its listeners as attributes, and calls the following method in its constructor :
TestCaseEditorManager.create(this);


There is also a method called by TestCaseEditorManager inside TestCaseEditor, which is
public void removeListener(){
		window.getPartService().removePartListener(listener);
		window.getActivePage().removePostSelectionListener(selectionListener);
	}


If you are facing the problem but find the solution unclear, feel free to contact me.
Previous Topic:Export 3.x product wizard problems
Next Topic:Eclipse 3.x Radio Menue
Goto Forum:
  


Current Time: Wed Dec 02 13:23:15 GMT 2020

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

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

Back to the top