use of org.hibernate.eclipse.mapper.extractor.HBMInfoHandler in project jbosstools-hibernate by jbosstools.
the class HBMXMLContentAssistProcessor method getAttributeValueProposals.
public List getAttributeValueProposals(String attributeName, String start, int offset, ContentAssistRequest contentAssistRequest) {
Node node = contentAssistRequest.getNode();
List proposals = new ArrayList();
// $NON-NLS-1$
String path = node.getNodeName() + ">" + attributeName;
HBMInfoHandler handler = sourceLocator.getAttributeHandler(path);
if (handler != null) {
proposals.addAll(Arrays.asList(handler.attributeCompletionProposals(getJavaProject(contentAssistRequest), node, attributeName, start, offset)));
}
if (DEBUG) {
String string = contentAssistRequest.getDocumentRegion().getText();
string = string.replace('<', '[');
string = string.replace('>', ']');
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
CompletionProposal completionProposal = new CompletionProposal("[" + start + "],[" + path + "],[" + offset + "]", offset, 1, 4, null, null, null, string);
proposals.add(completionProposal);
}
return proposals;
}
use of org.hibernate.eclipse.mapper.extractor.HBMInfoHandler in project jbosstools-hibernate by jbosstools.
the class HBMXMLHyperlinkDetector method detectHyperlinks.
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
if (region == null || textViewer == null) {
return null;
}
IJavaProject jp = StructuredTextViewerConfigurationUtil.findJavaProject(textViewer);
if (jp == null)
return new IHyperlink[0];
IDocument document = textViewer.getDocument();
Node currentNode = getCurrentNode(document, region.getOffset());
if (currentNode != null) {
short nodeType = currentNode.getNodeType();
if (nodeType == Node.ATTRIBUTE_NODE) {
} else if (nodeType == Node.ELEMENT_NODE) {
Attr currentAttrNode = getCurrentAttrNode(currentNode, region.getOffset());
if (currentAttrNode != null) {
// $NON-NLS-1$
String path = currentNode.getNodeName() + ">" + currentAttrNode.getName();
HBMInfoHandler handler = infoExtractor.getAttributeHandler(path);
if (handler != null) {
IJavaProject project = StructuredTextViewerConfigurationUtil.findJavaProject(document);
IJavaElement element = handler.getJavaElement(project, currentNode, currentAttrNode);
if (element != null) {
return new IHyperlink[] { new HBMXMLHyperlink(getHyperlinkRegion(currentAttrNode), element) };
} else {
return null;
}
}
}
}
}
return null;
}
Aggregations