Source code: org/aspectj/tools/ajde/jbuilder/AJFileNode.java
1
2 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 *
4 * This file is part of the IDE support for the AspectJ(tm)
5 * programming language; see http://aspectj.org
6 *
7 * The contents of this file are subject to the Mozilla Public License
8 * Version 1.1 (the "License"); you may not use this file except in
9 * compliance with the License. You may obtain a copy of the License at
10 * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
11 *
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
15 * License.
16 *
17 * The Original Code is AspectJ.
18 *
19 * The Initial Developer of the Original Code is Xerox Corporation. Portions
20 * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
21 * All Rights Reserved.
22 *
23 * Contributor(s):
24 */
25
26 package org.aspectj.tools.ajde.jbuilder;
27
28 import com.borland.primetime.PrimeTime;
29 import com.borland.primetime.editor.*;
30 import com.borland.primetime.node.*;
31 import com.borland.jbuilder.node.*;
32 import com.borland.primetime.ide.*;
33 import com.borland.primetime.viewer.*;
34 import com.borland.primetime.vfs.Url;
35
36 /**
37 * @author Mik Kersten
38 */
39
40 public class AJFileNode extends JavaFileNode {
41
42 private static final String EXTENSION = "aj";
43
44 public static void initOpenTool(byte majorVersion, byte minorVersion) {
45 if (minorVersion > 0) {
46 registerFileNodeClass(EXTENSION, "AspectJ Source File", AJFileNode.class, BrowserIcons.ICON_FILEJAVA);
47 }
48 }
49
50 public AJFileNode(Project project, Node parent, Url url) throws DuplicateNodeException {
51 super(project, parent, url);
52 }
53
54 public Class getEditorKitClass() {
55 return super.getEditorKitClass();
56 }
57
58 public Class getTextStructureClass() {
59 return super.getTextStructureClass();
60 }
61
62 // static final NodeViewerFactory NODE_FACTORY = new NodeViewerFactory() {
63 //
64 // public NodeViewer createNodeViewer(Context context) {
65 // if(context.getNode() instanceof AJFileNode) {
66 // return new AJNodeViewer(context);
67 // } else {
68 // return null;
69 // }
70 // }
71 //
72 // public boolean canDisplayNode(Node node) {
73 // return (node instanceof AJNode);
74 // }
75 // };
76 }
77
78 class AJEditorKit extends TextEditorKit {
79
80 public Scanner createScanner() {
81 return super.createScanner();
82 }
83
84 public String getContentType() {
85 return "text/AspectJ";
86 }
87
88 public Object clone() {
89 AJEditorKit kit = new AJEditorKit();
90 return kit;
91 }
92 }
93
94