I am opening a .xlsx file in eclipse .It opens internally in MS excel which again contain my excel plugin.Which do not work properly when eclipse open excel internally.
So how can i set ,eclipse always open .xlsx file externally.
1 Answer 1
You can define an editor for xlsx in your plugin using the org.eclipse.ui.editors extension point:
<extension
point="org.eclipse.ui.editors">
<editor
extensions="xlsx"
id="myeditor.id"
icon="icon path"
launcher="myeditor.Launcher"
name="XLSX editor">
</editor>
</extension>
This is using the launcher attribute to specify that a class to launch an external editor is to be used.
The Launcher class would be something like:
public class Launcher implements IEditorLauncher
{
public void open(IPath file)
{
File file = file.toFile();
java.awt.Desktop.getDesktop().open(file);
}
}
answered May 6, 2015 at 8:41
greg-449
112k235 gold badges112 silver badges164 bronze badges
Sign up to request clarification or add additional context in comments.
4 Comments
archit jain
Where should i write this code ,means when i select a .xlsx file in project explorer and open it ,at that point this code should be called. So either their is some event called when we open a file or i have to override editor or something??
greg-449
This code is only of use if it is your plugin that is opening the file. For project explorer I don't think there is a way to force just xlsx to open externally.
archit jain
Yes i am creating a plugin .It will contain only .xlsx files,and i just want they should open externally.Am i misunderstanding?
greg-449
I have revised the answer to include an editor definition and IEditorLauncher