archit jain
archit jain

Reputation: 83

Eclipse plugin development:How to open a file in external editor programmatically in eclipse plugin development

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.

Upvotes: 0

Views: 1293

Answers (1)

greg-449
greg-449

Reputation: 111218

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);
  }
}

Upvotes: 1

Related Questions