0

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.

asked May 5, 2015 at 8:26

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

4 Comments

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??
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.
Yes i am creating a plugin .It will contain only .xlsx files,and i just want they should open externally.Am i misunderstanding?
I have revised the answer to include an editor definition and IEditorLauncher

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.