Package at.ssw.coco.lib.model.atgmodel

Examples of at.ssw.coco.lib.model.atgmodel.ATGModel


  public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
    return detectHyperlinks(textViewer, new CocoRegion(region.getOffset(), region.getLength()), canShowMultipleHyperlinks);
  }
 
  public IHyperlink[] detectHyperlinks(ITextViewer textViewer, ICocoRegion region, boolean canShowMultipleHyperlinks) {
    ATGModel fATGModel = modelProvider.getATGModel();
    if (region == null || fATGModel == null || !(textViewer instanceof ISourceViewer)) {
      return null;
    }

    int offset = region.getOffset();
    try { // check the partition type
      String contentType = textViewer.getDocument().getPartition(offset).getType();
      if (!contains(ALLOWED_PARTITIONS, contentType)) return null;
    } catch (BadLocationException e) {
      // should not happen
    }

    WordFinderAdaptor wordFinder = new WordFinderAdaptor(textViewer.getDocument(), fIdentDetector);
    ICocoRegion cocoWordRegion = wordFinder.findWord(offset);
    String word = wordFinder.extractWord(cocoWordRegion);
    if (word == null) {
      return null;
    }

    ATGSegment segment = fATGModel.find(word);
    Region wordRegion = new Region(cocoWordRegion.getOffset(), cocoWordRegion.getLength());
    if (segment != null) {
      return new IHyperlink[] { new ATGHyperlink(wordRegion, new Region(segment.getRegion().getOffset(), segment.getRegion().getLength()))};
    }
View Full Code Here


    declEnd = 0;
    productionsBegin = 0;
    productionsEnd = 0;

    String declarations = null, imports = null, productions = null;
    ATGModel m = fEditor.getATGModelProvider().getATGModel();
    if (m != null) {
      importsSegment = m.getImports();
      declSegment = m.getDeclarations();
      productionsSegments = m.getProductions();
    } else {
      importsSegment = null;
      declSegment = null;
      productionsSegments = null;
    }
View Full Code Here

    return seg.hasChildren();
  }
 
  public Object[] getElements(Object inputElement) {
    if (inputElement instanceof ATGModel) {
      ATGModel atg = (ATGModel)inputElement;
      return atg.getElements();
    } else {
      return getChildren(inputElement);
    }
  }
View Full Code Here

TOP

Related Classes of at.ssw.coco.lib.model.atgmodel.ATGModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.