View Javadoc

1   package org.xmlhammer.gui.output.actions;
2   
3   import java.net.URI;
4   
5   import javax.swing.ImageIcon;
6   
7   import org.bounce.RunnableAction;
8   import org.xmlhammer.gui.util.ExternalApplicationLauncher;
9   
10  public class OpenURIAction extends RunnableAction {
11      private static final long serialVersionUID = -6546100768134624390L;
12  
13      private URI uri = null;
14      private int line = 0;
15      private int column = 0;
16  
17      public OpenURIAction() {
18          super("Open Document");
19          putValue(SMALL_ICON, new ImageIcon(getClass().getResource("/org/xmlhammer/gui/icons/obj16/file_obj.gif")));
20          putValue(SHORT_DESCRIPTION, "Open Document");
21      }
22      
23      public void setLocation(URI uri, int line, int column) {
24          setEnabled(uri != null);
25          this.uri = uri;
26          
27          this.line = line;
28          this.column = column;
29      }
30      
31      @Override
32      public void run() {
33          ExternalApplicationLauncher.getInstance().open(uri, line, column);
34      }
35  }