01 package ideExtensions.customProject;
02
03 import com.bea.ide.document.DefaultDocumentHandler;
04 import com.bea.ide.document.IDocument;
05 import com.bea.ide.lang.java.JavaDocument;
06 import com.bea.ide.lang.java.JavaDocumentFactory;
07
08 import java.net.URI;
09
10 /**
11 * A simple handler for a PHP document. A document handler
12 * is responsible for relatively high-level functions, such as
13 * validating the name of a file that corresponds to the document,
14 * providing the file's extension, and so on. In contrast, the document
15 * implementation (represented in this sample by PhpDocumentImpl)
16 * is responsible for lower-level functions, such as providing
17 * views of the document's contents.
18 *
19 * Note that a "document" (represented by an IDocument instance)
20 * is an abstraction that the IDE uses to provide special
21 * handling of certain files. For example, a JWS file provides
22 * its graphical Design View because its IDocument provides one.
23 */
24 public class PhpDocument extends DefaultDocumentHandler
25 {
26 /**
27 * Constructs a new instance of this handler by calling
28 * its super with the extension to use for files
29 * corresponding to the document type: .php
30 */
31 public PhpDocument()
32 {
33 super("php");
34 }
35
36 /**
37 * Called by the IDE to retrieve the IDocument instance that will
38 * be used to represent a PHP document. This method returns an instance
39 * of PhpDocumentImpl, which extends TextDocument, which in turn
40 * implements IDocument. That instance is responsible for low-level
41 * document tasks such as rendering a view of its contents, managing
42 * edits, and so on.
43 *
44 * @param uriFile A URI pointing at the file that corresponds to this
45 * document.
46 * @return A PhpDocumentImpl instance representing the document.
47 */
48 public IDocument createDocumentObject(URI uriFile) throws java.io.IOException
49 {
50 IDocument ret = new PhpDocumentImpl(this.getClass(), uriFile);
51 return ret;
52 }
53 }
|