Package org.objectstyle.wolips.bindings.wod

Examples of org.objectstyle.wolips.bindings.wod.IWodModel


        WodDocumentUtils.applyEdits(htmlDocument, htmlEdits);
      }

      IDocument wodDocument = _cache.getWodEntry().getDocument();
      if (wodDocument != null) {
        IWodModel wodModel = _cache.getWodEntry().getModel();
        List<TextEdit> wodEdits = new LinkedList<TextEdit>();
        MultiTextEdit multiEdit = new MultiTextEdit();
        for (ElementRename rename : _renames) {
          IWodElement wodElement = wodModel.getElementNamed(rename.getOldName());
          wodEdits.add(new ReplaceEdit(wodElement.getElementNamePosition().getOffset(), wodElement.getElementNamePosition().getLength(), rename.getNewName()));
        }
        WodDocumentUtils.applyEdits(wodDocument, wodEdits);
      }
    }
View Full Code Here


      attributeValues = attributeValuesList.toArray(new AssistInfo[attributeValuesList.size()]);
    }
    else if ("name".equals(attrInfo.getAttributeName()) && WodHtmlUtils.isWOTag(tagName)) {
      List<AssistInfo> attributeValuesList = new LinkedList<AssistInfo>();
      try {
        IWodModel wodModel = _cache.getWodEntry().getModel();
        if (wodModel != null) {
          for (IWodElement wodElement : wodModel.getElements()) {
            String wodElementName = wodElement.getElementName();
            if (wodElementName.toLowerCase().startsWith(value.toLowerCase())) {
              AssistInfo assist = new AssistInfo(wodElementName);
              attributeValuesList.add(assist);
            }
View Full Code Here

            if (commentText.toLowerCase().startsWith("inherit ")) {
              String componentName = commentText.substring("inherit ".length()).trim();
              try {
                WodParserCache inheritCache = WodParserCache.parser(_wodFile.getProject(), componentName);
                WodCacheEntry wodCacheEntry = inheritCache.getWodEntry();
                IWodModel parentWodModel = wodCacheEntry.getModel();
                for (IWodElement parentWodElement : parentWodModel.getElements()) {
                  SimpleWodElement inheritedWodElement = new SimpleWodElement(parentWodElement);
                  inheritedWodElement.setInherited(true);
                  addElement(inheritedWodElement);
                }
              }
View Full Code Here

    return modelOffset;
  }

  public IWodModel getWodModel(boolean refreshModel) throws Exception {
    WodParserCache cache = getParserCache();
    IWodModel model;
    if (refreshModel || isDirty()) {
      model = WodModelUtils.createWodModel(cache.getWodEntry().getFile(), cache.getWodEntry().getDocument());
      cache.getWodEntry().setModel(model);
    } else {
      model = cache.getWodEntry().getModel();
View Full Code Here

    try {
      IFileEditorInput input = (IFileEditorInput) _editor.getEditorInput();
      if (input != null) {
        IFile file = input.getFile();
        WodParserCache cache = WodParserCache.parser(file);
        IWodModel model = cache.getWodEntry().getModel();
        if (model != null) {
          List<IWodElement> wodElements = model.getElements();
          if (wodElements != null) {
            for (IWodElement element : wodElements) {
              if (element.isWithin(region)) {
                if (element.isTypeWithin(region)) {
                  WodElementTypeHyperlink typeHyperlink = WodElementTypeHyperlink.toElementTypeHyperlink(element, cache);
View Full Code Here

      if (validate) {
        HtmlCacheEntry htmlCacheEntry = _cache.getHtmlEntry();
        htmlCacheEntry.getHtmlElementCache().clearCache();
        WodCacheEntry wodCacheEntry = _cache.getWodEntry();
        IFile wodFile = wodCacheEntry.getFile();
        IWodModel wodModel = wodCacheEntry.getModel();
        for (FuzzyXMLElement woElement : _woElements) {
          String woElementName = woElement.getAttributeValue("name");
          int startOffset = woElement.getOffset() + woElement.getNameOffset() + 1;
          int endOffset = startOffset + woElement.getNameLength() - 1;
          HtmlElementName elementName = new HtmlElementName(htmlCacheEntry.getFile(), woElementName, startOffset, endOffset);
          htmlCacheEntry.getHtmlElementCache().addHtmlElement(elementName);

          if (wodModel != null) {
            IWodElement wodElement = wodModel.getElementNamed(woElementName);
            if (wodElement == null) {
              WodProblem undefinedElement = new WodBindingValueProblem(wodElement, new SimpleWodBinding(null, "name", null), "name", "The element '" + woElementName + "' is not defined in " + wodFile.getName(), null, -1, false);
              inlineProblems.add(new InlineWodProblem(woElement, undefinedElement, _cache));
            }
          }
View Full Code Here

import org.objectstyle.wolips.wodclipse.core.completion.WodParserCache;
import org.objectstyle.wolips.wodclipse.core.util.WodHtmlUtils;

public class QuickRenameRefactoring {
  public static void renameWodSelection(int offset, ITextViewer htmlViewer, ITextViewer wodViewer, WodParserCache cache) throws Exception {
    IWodModel wodModel = cache.getWodEntry().getModel();
    if (wodModel != null) {
      IWodUnit wodUnit = wodModel.getWodUnitAtIndex(offset);
      if (wodUnit != null && wodUnit instanceof IWodElement) {
        IWodElement wodElement = (IWodElement) wodUnit;
        Position elementNamePosition = wodElement.getElementNamePosition();
        if (elementNamePosition != null && elementNamePosition.includes(offset)) {
          String elementName = wodElement.getElementName();
View Full Code Here

    return sequence;
  }

  protected static int linkWod(String woElementName, IDocument wodDocument, LinkedPositionGroup linkedGroup, WodParserCache cache, int sequence) throws Exception {
    LinkedModeModel.closeAllModels(wodDocument);
    IWodModel wodModel = cache.getWodEntry().getModel();
    IWodElement wodElement = wodModel.getElementNamed(woElementName);
    if (wodElement != null) {
      Position namePosition = wodElement.getElementNamePosition();
      if (namePosition != null) {
        linkedGroup.addPosition(new LinkedPosition(wodDocument, namePosition.getOffset(), namePosition.getLength(), sequence++));
      }
View Full Code Here

      IFile wodFile = locateResult.getFirstWodFile();
      if (wodFile != null) {
        WodModelUtils.deleteProblems(wodFile);

        IJavaProject javaProject = JavaCore.create(wodFile.getProject());
        IWodModel wodModel = WodModelUtils.createWodModel(wodFile, wodDocument);
        List<WodProblem> problems = wodModel.getProblems(javaProject, locateResult.getDotJavaType(), typeCache, htmlCache);
        for (WodProblem problem : problems) {
          WodModelUtils.createMarker(wodFile, problem);
        }
      }
    }
View Full Code Here

  public void run(IProgressMonitor monitor) throws InvocationTargetException {
    try {
      FuzzyXMLDocument htmlModel = _cache.getHtmlEntry().getModel();
      FuzzyXMLElement element = htmlModel.getElementByOffset(_offset);
      if (element != null) {
        IWodModel wodModel = _cache.getWodEntry().getModel();
        String tagName = element.getName();
        if (WodHtmlUtils.isInline(tagName)) {
          SimpleWodElement wodElement = new FuzzyXMLWodElement(element, _buildProperties);
          ElementRename elementRename = ElementRename.newUniqueName(wodModel, wodElement, true);
          wodElement.setElementName(elementRename.getNewName());
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.bindings.wod.IWodModel

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.