Source code: de/hunsicker/jalopy/plugin/ProjectFile.java
1 /*
2 * Copyright (c) 2001-2002, Marco Hunsicker. All rights reserved.
3 *
4 * This software is distributable under the BSD license. See the terms of the
5 * BSD license in the documentation provided with this software.
6 */
7 package de.hunsicker.jalopy.plugin;
8
9 import java.io.File;
10
11
12 /**
13 * Represents a Java source file that is part of a project.
14 *
15 * @author <a href="http://jalopy.sf.net/contact.html">Marco Hunsicker</a>
16 * @version $Revision: 1.2 $
17 */
18 public interface ProjectFile
19 {
20 //~ Methods --------------------------------------------------------------------------
21
22 /**
23 * Returns an editor view to modify the file. One may check if the file is actually
24 * opened in the editor prior to call this method:
25 * <pre class="snippet">
26 * if (projectFile.isOpened())
27 * {
28 * return projectFile.getEditor();
29 * }
30 * else
31 * {
32 * // do whatever you want ...
33 * }
34 * </pre>
35 *
36 * @return the editor to modify the contents of the file. Returns <code>null</code>
37 * if the file is currently closed.
38 *
39 * @see #isOpened
40 */
41 public Editor getEditor();
42
43
44 /**
45 * Returns the encoding used to read and write this file.
46 *
47 * @return A Java encoding name. May be <code>null</code> to indicate the platform's
48 * default encoding.
49 */
50 public String getEncoding();
51
52
53 /**
54 * Returns the underlying physical file. Note that if the application uses virtual
55 * files this method should create an intermediate representation but never return
56 * <code>null</code>.
57 *
58 * @return the physical file.
59 */
60 public File getFile();
61
62
63 /**
64 * Returns the name of the file.
65 *
66 * @return the file name.
67 */
68 public String getName();
69
70
71 /**
72 * Determines whether the file is currently opened. That means an editor view exists.
73 *
74 * @return <code>true</code> if the file is currently opened, i.e. has an editor to
75 * modify its contents.
76 *
77 * @see #getEditor
78 */
79 public boolean isOpened();
80
81
82 /**
83 * Returns the project this file is attached to.
84 *
85 * @return the containing project.
86 */
87 public Project getProject();
88
89
90 /**
91 * Determines whether the file can be changed.
92 *
93 * @return <code>true</code> if the file can be changed by the user.
94 */
95 public boolean isReadOnly();
96 }