use of org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr in project webtools.sourceediting by eclipse.
the class SelectAttributeContentAssist method getCompletionProposals.
/**
* (non-Javadoc)
*
* @see org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest#getCompletionProposals()
*/
@Override
public ArrayList<ICompletionProposal> getCompletionProposals() {
proposals.clear();
adjustXPathStart(SELECT_ATTRIBUTE);
int offset = getReplacementBeginPosition();
IDOMAttr attrNode = getAttribute(SELECT_ATTRIBUTE);
this.matchString = extractXPathMatchString(attrNode, getRegion(), getReplacementBeginPosition());
addSelectProposals((Element) getNode().getParentNode(), offset);
return getAllCompletionProposals();
}
use of org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr in project webtools.sourceediting by eclipse.
the class XMLComponentRenameParticipant method createChange.
// private RefactoringStatus createRenameChanges(final IProgressMonitor monitor) throws CoreException {
// Assert.isNotNull(monitor);
// final RefactoringStatus status= new RefactoringStatus();
// try {
// monitor.beginTask("RefactoringMessages.RenameComponentRefactoring_searching", 1);
// createRenameChanges(new SubProgressMonitor(monitor, 1));
// //updateChangeManager(new SubProgressMonitor(monitor, 1), status);
// } finally {
// monitor.done();
// }
// return status;
// }
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
for (Iterator iter = matches.iterator(); iter.hasNext(); ) {
SearchMatch match = (SearchMatch) iter.next();
TextChange textChange = getChangeManager().get(match.getFile());
String newName = getArguments().getNewName();
String qualifier = "";
if (getArguments() instanceof ComponentRenameArguments) {
qualifier = ((ComponentRenameArguments) getArguments()).getQualifier();
}
if (match.getObject() instanceof Node) {
Node node = (Node) match.getObject();
if (node instanceof IDOMAttr) {
IDOMAttr attr = (IDOMAttr) node;
IDOMElement element = (IDOMElement) attr.getOwnerElement();
newName = getNewQName(element, qualifier, newName);
}
newName = RenameComponentProcessor.quoteString(newName);
}
ReplaceEdit replaceEdit = new ReplaceEdit(match.getOffset(), match.getLength(), newName);
String editName = RefactoringMessages.getString("RenameComponentProcessor.Component_Refactoring_update_reference");
TextChangeCompatibility.addTextEdit(textChange, editName, replaceEdit);
}
// don't create any change now, all the changes are in changeManger variable and will be combined in RenameComponentProcessor.postCreateChange method
return null;
}
use of org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr in project liferay-ide by liferay.
the class LiferayJspValidator method validateReferenceToJava.
@Override
protected void validateReferenceToJava(IXMLReferenceTo referenceTo, IDOMNode node, IFile file, IValidator validator, IReporter reporter, boolean batchMode) {
if (node instanceof AttrImpl) {
AttrImpl attrNode = (AttrImpl) node;
Node parentNode = attrNode.getOwnerElement();
if (_isSupportedTag(parentNode.getNodeName())) {
IDOMAttr nameAttr = DOMUtils.getAttr((IDOMElement) parentNode, "name");
if ((nameAttr != null) && (nameAttr.getNodeValue().contains(_action_request_action_name) || nameAttr.getNodeValue().contains(_javax_portlet_action))) {
super.validateReferenceToJava(referenceTo, attrNode, file, validator, reporter, batchMode);
}
}
}
}
use of org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr in project jbosstools-hibernate by jbosstools.
the class BaseXMLHyperlinkSupport method getHyperlinkRegion.
protected IRegion getHyperlinkRegion(Node node) {
IRegion hyperRegion = null;
if (node != null) {
short nodeType = node.getNodeType();
if (nodeType == Node.DOCUMENT_TYPE_NODE) {
// handle doc type node
IDOMNode docNode = (IDOMNode) node;
hyperRegion = new Region(docNode.getStartOffset(), docNode.getEndOffset() - docNode.getStartOffset());
} else if (nodeType == Node.ATTRIBUTE_NODE) {
// handle attribute nodes
IDOMAttr att = (IDOMAttr) node;
// do not include quotes in attribute value region
int regOffset = att.getValueRegionStartOffset();
int regLength = att.getValueRegion().getTextLength();
String attValue = att.getValueRegionText();
if (org.eclipse.wst.sse.core.utils.StringUtils.isQuoted(attValue)) {
++regOffset;
regLength = regLength - 2;
}
hyperRegion = new Region(regOffset, regLength);
}
}
return hyperRegion;
}
Aggregations