0

I have a eclipse plugin project, in this project i have to change perspective java to web and web to java. at the time web to java accordingly, i want to open this file in editor directly. For .java file i have no issue to open by this code,

openEditor(projectFile,"org.eclipse.jdt.ui.CompilationUnitEditor",page, filePath);

But when i want to open .xml, maximum time i was failed to open this file and got message "this file does not exist in path", but file has present already.

So, is there is any need or reference for change .xml file "org.eclipse.jdt.ui.CompilationUnitEditor" on this command. please help. Advance Thanks.

Biswabir
  • 19
  • 8
  • `org.eclipse.jdt.ui.CompilationUnitEditor` only opens Java source and class files. You need to use some other editor for XML. – greg-449 Jun 08 '17 at 17:06
  • ok,thanks for your reply. can you suggest which unitEditor require for .xml file – Biswabir Jun 09 '17 at 08:03
  • You should generally not specify an editor id when opening a file, let Eclipse work out the best editor to use. – greg-449 Jun 09 '17 at 08:36
  • In past, I have used this code for open editor id editorID = workbench.getEditorRegistry().getDefaultEditor(file.getFullPath().toString()).getId(); but every time get exception worksapce is closed for that i am getting ID null all time. thats the reason i have used specific ID. those all thinks happen after export a jar and that jar used on another platform like eclipse. – Biswabir Jun 09 '17 at 10:50
  • If you have better suggession to recover this issue please help. – Biswabir Jun 09 '17 at 10:53

0 Answers0