use of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion in project webtools.sourceediting by eclipse.
the class CSSContentAssistContext method isTargetPosAfterOf.
/**
*/
boolean isTargetPosAfterOf(String regionType) {
int start = ((IndexedRegion) fTargetNode).getStartOffset();
if (start < 0 || ((IndexedRegion) fTargetNode).getEndOffset() <= 0) {
return false;
}
RegionIterator iRegion = new RegionIterator(fStructuredDocument, start);
while (iRegion.hasNext()) {
ITextRegion region = iRegion.next();
if (fTargetPos < iRegion.getStructuredDocumentRegion().getTextEndOffset(region)) {
break;
}
if (region.getType() == regionType) {
return true;
}
}
return false;
}
use of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion in project webtools.sourceediting by eclipse.
the class CSSContentAssistContext method isSpecialDelimiterRegion.
/**
*/
private boolean isSpecialDelimiterRegion(int pos) {
ITextRegion region = getRegionByOffset(pos);
String type = null;
if (region != null) {
type = region.getType();
}
return (type != null) && ((type == CSSRegionContexts.CSS_LBRACE || type == CSSRegionContexts.CSS_RBRACE || type == CSSRegionContexts.CSS_DELIMITER || type == CSSRegionContexts.CSS_DECLARATION_SEPARATOR || type == CSSRegionContexts.CSS_DECLARATION_DELIMITER || type == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR || type == CSSRegionContexts.CSS_S));
}
use of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion in project webtools.sourceediting by eclipse.
the class CSSContentAssistContext method targetHas.
/**
*/
boolean targetHas(String regionType) {
int end = ((IndexedRegion) fTargetNode).getEndOffset();
if (getTargetPos() < 0 || end <= 0) {
return false;
}
RegionIterator iRegion = new RegionIterator(fStructuredDocument, getTargetPos());
while (iRegion.hasNext()) {
ITextRegion region = iRegion.next();
if (end <= iRegion.getStructuredDocumentRegion().getStartOffset(region)) {
break;
}
if (region.getType() == regionType) {
return true;
}
}
return false;
}
use of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion in project webtools.sourceediting by eclipse.
the class CSSProposalArranger method isFirstRegion.
private boolean isFirstRegion() {
if (fContext.getCursorPos() == 0)
return true;
ITextRegion region = fContext.getTargetRegion();
ITextRegion currRegion = fContext.getRegionByOffset(fContext.getCursorPos());
String type = null;
String crType = null;
if (region != null) {
type = region.getType();
}
if (currRegion != null) {
crType = currRegion.getType();
}
if (type == null || crType == null || (crType == type))
return true;
else
return false;
}
use of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion in project webtools.sourceediting by eclipse.
the class CSSProposalGeneratorForAtmarkRule method getCandidates.
/**
* getCandidates method comment.
*/
protected Iterator getCandidates() {
List candidates = new ArrayList();
ITextRegion region = fContext.getTargetRegionPrevious();
// ITextRegion region = fContext.getSignificantTargetRegion();
if (region != null) {
String type = region.getType();
if (type != CSSRegionContexts.CSS_RBRACE && type != CSSRegionContexts.CSS_DELIMITER) {
return candidates.iterator();
}
}
CSSCACandidate item;
if ((item = getCandidateImportRule()) != null) {
candidates.add(item);
}
if ((item = getCandidateCharsetRule()) != null) {
candidates.add(item);
}
if ((item = getCandidateMediaRule()) != null) {
candidates.add(item);
}
if ((item = getCandidatePageRule()) != null) {
candidates.add(item);
}
if ((item = getCandidateFontFaceRule()) != null) {
candidates.add(item);
}
return candidates.iterator();
}
Aggregations