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 EditURIAction 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 EditURIAction() {
18          super("Edit Document");
19  
20          putValue(SMALL_ICON, new ImageIcon(getClass().getResource("/org/xmlhammer/gui/icons/obj16/write_obj.gif")));
21          putValue(SHORT_DESCRIPTION, "Edit Document");
22      }
23      
24      public void setLocation(URI uri, int line, int column) {
25          setEnabled(uri != null);
26          
27          this.uri = uri;
28          
29          this.line = line;
30          this.column = column;
31      }
32      
33      @Override
34      public void run() {
35          ExternalApplicationLauncher.getInstance().edit(uri, line, column);
36      }
37  }