Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Integrate XML Editor
Integrate XML Editor [message #518235] Wed, 03 March 2010 14:57 Go to next message
mohamed  is currently offline mohamed Friend
Messages: 2
Registered: March 2010
Junior Member

Please how can i use rcp xml editor in my rcp?
How can i open an xml file with the editor

[Updated on: Wed, 03 March 2010 14:58]

Report message to a moderator

Re: Integrate XML Editor [message #523430 is a reply to message #518235] Fri, 26 March 2010 13:27 Go to previous message
Zied is currently offline ZiedFriend
Messages: 26
Registered: February 2010
Junior Member
Hi mohamed,
to integrate eclipse's default xml Editor in your RCP application you should
extend a new Class from XMLMultipageEditorPart and override the createPage method to add new pages.
it 's simple.

public class PersFlowChartEditor extends XMLMultiPageEditorPart implements
		IResourceChangeListener {

	/** The text editor used in page 0. */
	private FlowchartDiagramEditor editor = new FlowchartDiagramEditor();

	public PersFlowChartEditor() {
	protected void createPages() {


	public void createDiagramPage(){
		File file = new File("D:/PFE_WORKSPACE/FlowChart.diagram/wrkspc/hkl/defaultx.flowchart_diagram");
		IFile iFile = null;

		if (file.exists() && file.isFile() ) {
			IWorkspace workspace= ResourcesPlugin.getWorkspace();
			IPath location= Path.fromOSString(file.getAbsolutePath());
			iFile= workspace.getRoot().getFileForLocation(location); 
		} else {
		    //Do something if the file does not exist
		IEditorInput editorInput = new FileEditorInput(iFile);
		try {	
			int index = addPage(editor, editorInput);
			setPageText(index, "Diagram Editor");
		} catch (PartInitException e) {
			// TODO Auto-generated catch block

	public void doSave(IProgressMonitor monitor) {
		// TODO Auto-generated method stub
		//save the opened diagram file
		// ici il faut aussi sauvgarder le fichier xml

	public boolean isSaveOnCloseNeeded() {
		// TODO Auto-generated method stub
		System.out.println("exit the editor"); 
		return super.isSaveOnCloseNeeded() || editor.isSaveOnCloseNeeded();
	public void resourceChanged(IResourceChangeEvent event) {
		// TODO Auto-generated method stub


[Updated on: Fri, 26 March 2010 14:22]

Report message to a moderator

Previous Topic:Embed native app
Next Topic:customise the content of the OutlineView
Goto Forum:

Current Time: Mon May 21 07:35:37 GMT 2018

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

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

Back to the top