KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ejbcore > hints > EjbHintsProvider


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.ejbcore.hints;
21
22 import org.openide.ErrorManager;
23
24 /**
25  *
26  * @author Pavel Buzek
27  */

28
29 //TODO: RETOUCHE
30

31 public class EjbHintsProvider /*extends HintsProvider */{
32     
33     private static ErrorManager ERR = ErrorManager.getDefault().getInstance("org.netbeans.modules.j2ee.ejbcore"); // NOI18N
34

35     /** Creates a new instance of EjbHintsProvider */
36     public EjbHintsProvider() {
37     }
38
39 // public List getHints(Document doc, int offset) {
40
// if (doc instanceof BaseDocument) {
41
// BaseDocument baseDoc = (BaseDocument) doc;
42
// org.netbeans.modules.j2ee.common.JMIUtils.beginJmiTransaction();
43
// JMIUtils utils = null;
44
// Resource resource = null;
45
// try {
46
// utils = JMIUtils.get(baseDoc);
47
// resource = utils.getResource();
48
// FileObject fo = JavaModel.getFileObject(resource);
49
// if (fo == null || EjbJar.getEjbJar(fo) == null) {
50
// return Collections.EMPTY_LIST;
51
// }
52
// } finally {
53
// org.netbeans.modules.j2ee.common.JMIUtils.endJmiTransaction();
54
// }
55
// try {
56
// int realStart = Utilities.getFirstNonWhiteFwd(baseDoc, Utilities.getRowStart(baseDoc, offset));
57
// int realEnd = Utilities.getFirstNonWhiteBwd(baseDoc, Utilities.getRowEnd(baseDoc, offset));
58
// if (realStart > realEnd) {
59
// return Collections.EMPTY_LIST;
60
// }
61
// offset = Math.min(Math.max(offset, realStart), realEnd);
62
//
63
// List result = new ArrayList();
64
// Set/*<String>*/ handledDescriptions = new HashSet/*<String>*/();
65
//
66
// JavaModel.getJavaRepository().beginTrans(false);
67
//
68
// try {
69
// if (resource == null)
70
// return result;
71
// JavaModel.setClassPath(resource);
72
// if (ERR.isLoggable(ErrorManager.INFORMATIONAL)) {
73
// Element el = resource.getElementByOffset(offset);
74
//
75
// ERR.log("el=" + el); // NOI18N
76
// }
77
// Element e = resource.getElementByOffset(offset);
78
// while (e != null && !(e instanceof Feature || e instanceof StatementBlock || e instanceof Resource)) {
79
// e = (Element) e.refImmediateComposite();
80
// }
81
// if (e instanceof CallableFeature) {
82
// CallableFeature feature = (CallableFeature) e;
83
//
84
// if (feature != null) {
85
// PositionBounds bounds = JavaMetamodel.getManager().getElementPosition(feature);
86
// if (feature instanceof Method &&
87
// bounds.getBegin().getOffset() <= offset &&
88
// bounds.getEnd().getOffset() >= offset) {
89
// for (int i = 0; i < methodHintCreators.length; i++) {
90
// methodHintCreators[i].createHint(utils, resource, doc, (Method) feature, offset, result);
91
// }
92
// }
93
// }
94
// }
95
// } finally {
96
// JavaModel.getJavaRepository().endTrans();
97
// }
98
// return result;
99
// } catch (BadLocationException e) {
100
// // see issue 64283
101
// //in case that the document is about to be closed
102
// //the BLE can be throws from some editor utility classes
103
// //so we can swallow it in this case
104
// }
105
// }
106
//
107
// return Collections.EMPTY_LIST;
108
// }
109
//
110
// private static abstract class MethodHintCreator {
111
// public abstract void createHint(JMIUtils utils, Resource resource, Document doc, Method method, int offset, List result);
112
// }
113
//
114
// private static class ExposeInLocalHintCreator extends MethodHintCreator {
115
// public void createHint(JMIUtils utils, Resource resource, Document doc, Method method, int offset, List result) {
116
// if (Utils.canExposeInLocal(method)) {
117
// result.add(new ExposeMethodHint(method, ExposeMethodHint.LOCAL));
118
// }
119
// }
120
// }
121
//
122
// private static class ExposeInRemoteHintCreator extends MethodHintCreator {
123
// public void createHint(JMIUtils utils, Resource resource, Document doc, Method method, int offset, List result) {
124
// if (Utils.canExposeInRemote(method)) {
125
// result.add(new ExposeMethodHint(method, ExposeMethodHint.REMOTE));
126
// }
127
// }
128
// }
129
// private static MethodHintCreator[] methodHintCreators = new MethodHintCreator[] {
130
// new ExposeInLocalHintCreator(),
131
// new ExposeInRemoteHintCreator(),
132
// };
133
}
134
Popular Tags