use of org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentImpl in project webtools.sourceediting by eclipse.
the class JSPELCompletionProposalComputer method getFunctionProposals.
/**
* <p>Get the EL function proposals, ex: ${fn:| }</p>
* @param prefix
* @param viewer
* @param offset
* @return
*/
private List getFunctionProposals(String prefix, ITextViewer viewer, int offset) {
TLDCMDocumentManager docMgr = TaglibController.getTLDCMDocumentManager(viewer.getDocument());
ArrayList completionList = new ArrayList();
if (docMgr == null)
return null;
Iterator taglibs = docMgr.getCMDocumentTrackers(offset).iterator();
while (taglibs.hasNext()) {
TaglibTracker tracker = (TaglibTracker) taglibs.next();
if (tracker.getPrefix().equals(prefix)) {
CMDocumentImpl doc = (CMDocumentImpl) tracker.getDocument();
List functions = doc.getFunctions();
for (Iterator it = functions.iterator(); it.hasNext(); ) {
TLDFunction function = (TLDFunction) it.next();
CustomCompletionProposal proposal = new // $NON-NLS-1$
CustomCompletionProposal(// $NON-NLS-1$
function.getName() + "()", offset, 0, function.getName().length() + 1, null, function.getName() + " - " + function.getSignature(), null, null, // $NON-NLS-1$
1);
completionList.add(proposal);
}
}
}
return completionList;
}
use of org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentImpl in project webtools.sourceediting by eclipse.
the class JSPELContentAssistProcessor method getFunctionProposals.
protected List getFunctionProposals(String prefix, StructuredTextViewer viewer, int offset) {
TLDCMDocumentManager docMgr = TaglibController.getTLDCMDocumentManager(viewer.getDocument());
ArrayList completionList = new ArrayList();
if (docMgr == null)
return null;
Iterator taglibs = docMgr.getCMDocumentTrackers(offset).iterator();
while (taglibs.hasNext()) {
TaglibTracker tracker = (TaglibTracker) taglibs.next();
if (tracker.getPrefix().equals(prefix)) {
CMDocumentImpl doc = (CMDocumentImpl) tracker.getDocument();
List functions = doc.getFunctions();
for (Iterator it = functions.iterator(); it.hasNext(); ) {
TLDFunction function = (TLDFunction) it.next();
CustomCompletionProposal proposal = new // $NON-NLS-1$
CustomCompletionProposal(// $NON-NLS-1$
function.getName() + "()", offset, 0, function.getName().length() + 1, null, function.getName() + " - " + function.getSignature(), null, null, // $NON-NLS-1$
1);
completionList.add(proposal);
}
}
}
return completionList;
}
use of org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentImpl in project webtools.sourceediting by eclipse.
the class ELGeneratorVisitor method genFunction.
/**
* Generate a function invocation.
*
* @param fullFunctionName
* @return
*/
protected String genFunction(String fullFunctionName) {
TLDCMDocumentManager docMgr = TaglibController.getTLDCMDocumentManager(fDocument);
int colonIndex = fullFunctionName.indexOf(':');
String prefix = fullFunctionName.substring(0, colonIndex);
String functionName = fullFunctionName.substring(colonIndex + 1);
if (docMgr == null)
return null;
Iterator taglibs = docMgr.getCMDocumentTrackers(fCurrentNode.getStartOffset()).iterator();
while (taglibs.hasNext()) {
TaglibTracker tracker = (TaglibTracker) taglibs.next();
if (tracker.getPrefix().equals(prefix)) {
CMDocumentImpl doc = (CMDocumentImpl) tracker.getDocument();
List functions = doc.getFunctions();
for (Iterator it = functions.iterator(); it.hasNext(); ) {
TLDFunction function = (TLDFunction) it.next();
if (function.getName().equals(functionName)) {
String javaFuncName = getFunctionNameFromSignature(function.getSignature());
if (javaFuncName == null)
javaFuncName = functionName;
// $NON-NLS-1$
return function.getClassName() + "." + javaFuncName;
}
}
}
}
return null;
}
Aggregations