KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > jdic > desktop > internal > LaunchService


1 /*
2  * Copyright (C) 2004 Sun Microsystems, Inc. All rights reserved. Use is
3  * subject to license terms.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the Lesser GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  */

20  
21 package org.jdesktop.jdic.desktop.internal;
22
23 import java.io.File JavaDoc;
24
25
26 /**
27  * The <code>LaunchService</code> interface provides opening, editing or printing the given file
28  * by launching the associated application.
29  */

30 public interface LaunchService {
31     /**
32      * Opens the given file by launching the associated application.
33      *
34      * @param file the given file.
35      * @throws LaunchFailedException if the given file has no associated application,
36      * or the associated application fails to be launched.
37      */

38     public void open(File JavaDoc file) throws LaunchFailedException;
39   
40     /**
41      * Checks if the given file is editable.
42      *
43      * @param file the given file.
44      * @return <code>true</code> if the given file has no associated editor; <code>
45      * false</code> otherwise.
46      */

47     public boolean isEditable(File JavaDoc file);
48     
49     /**
50      * Launches the associated editor to edit the given file.
51      *
52      * @param file the given file.
53      * @throws LaunchFailedException if the given file has no associated editor,
54      * or the associated editor fails to be launched.
55      */

56     public void edit(File JavaDoc file) throws LaunchFailedException;
57
58     /**
59      * Checks if the given file is printable.
60      *
61      * @param file the given file.
62      * @return <code>true</code> if the given file is printable; <code>false</code> otherwise.
63      */

64     public boolean isPrintable(File JavaDoc file);
65
66     /**
67      * Prints the given file.
68      *
69      * @param file the given file.
70      * @throws LaunchFailedException if the given file is not printable, or fails to be printed.
71      */

72     public void print(File JavaDoc file) throws LaunchFailedException;
73     
74     /**
75      * Resolves the link file if the given file is a link file or symbol file.
76      * <p>
77      * This method will get the target/referenced file path if the given file is a link/shortcut
78      * file; or get the absolute path if the given file is in a relative path.
79      *
80      * @param file the given file.
81      * @return the resolved file.
82      */

83     public File JavaDoc resolveLinkFile(File JavaDoc file);
84 }
85
Popular Tags