Package org.eclipse.dltk.core

Examples of org.eclipse.dltk.core.IModelElement


        .getAdapter(IResource.class);
    if (elementResource != null)
      elementPath = elementResource.getFullPath();

    if (elementPath == null) {
      IModelElement scriptElement = (IModelElement) element
          .getAdapter(IModelElement.class);
      if (scriptElement != null)
        elementPath = scriptElement.getPath();
    }

    if (elementPath == null && element instanceof IStorage)
      elementPath = ((IStorage) element).getFullPath();
View Full Code Here


   * @param container
   * @param target
   * @return
   */
  protected boolean isContained(IModelElement container, IType type) {
    IModelElement parent = type;
    while (parent != null) {
      if (parent.equals(container)) {
        return true;
      }
      parent = parent.getParent();
    }
    return false;
  }
View Full Code Here

   * @param container
   * @param target
   * @return
   */
  protected boolean isContained(IModelElement container, IType type) {
    IModelElement parent = type;
    while (parent != null) {
      if (parent.equals(container)) {
        return true;
      }
      parent = parent.getParent();
    }
    return false;
  }
View Full Code Here

*/
public class AddDescriptionHandler extends SelectionHandler implements IHandler {

  public Object execute(ExecutionEvent event) throws ExecutionException {

    final IModelElement element = getCurrentModelElement(event);
    if (element != null) {
      final AddDescriptionAction addDescriptionAction = new AddDescriptionAction();
      addDescriptionAction
          .setModelElement(new IModelElement[] { element });
      addDescriptionAction.run(null);
View Full Code Here

    }
    return result;
  }

  private static ImageDescriptor getFolderBaseImage(IResource resource) {
    IModelElement modelElement = DLTKCore.create(resource);

    if (null != modelElement) {
      if (modelElement instanceof IScriptFolder) {
        LibraryFolderManager lfm = LibraryFolderManager.getInstance();
        if (lfm.isInLibraryFolder(modelElement.getResource()))
          return PHPPluginImages.DESC_OBJS_PHP_LIBFOLDER;
        else
          return PHPPluginImages.DESC_OBJS_PHPFOLDER_ROOT;
      }
    } else {
View Full Code Here

        }

      } else if (input instanceof IStorageEditorInput) {
        IStorage storage = ((IStorageEditorInput) input).getStorage();
        if (storage instanceof IModelElement) {
          IModelElement element = (IModelElement) storage;
          secondaryId = EnvironmentPathUtils.getFile(element)
              .getFullPath().toPortableString();
        }
      }
View Full Code Here

    // workaround for GlobalTypesStrategy.getReplacementRange()
    if (instertCompletion && toggleEating) {
      setReplacementLength(getReplacementLength() + 1);
    }

    IModelElement modelElement = getModelElement();

    boolean activateCodeAssist = false;
    String replacementString = getReplacementString();
    if (modelElement instanceof IScriptProject
        && replacementString
View Full Code Here

    }
    return false;
  }

  private IResource getResource(IAdaptable obj) {
    IModelElement modelElement = (IModelElement) ((IAdaptable) obj)
        .getAdapter(IModelElement.class);
    if (modelElement != null) {
      return modelElement.getResource();
    } else {
      return (IResource) ((IAdaptable) obj).getAdapter(IResource.class);
    }
  }
View Full Code Here

    if (proposals.length == expectedProposals.length) {
      for (ExpectedProposal expectedProposal : pdttFile
          .getExpectedProposals()) {
        boolean found = false;
        for (CompletionProposal proposal : proposals) {
          IModelElement modelElement = proposal.getModelElement();
          if (modelElement == null) {
            if (new String(proposal.getName())
                .equalsIgnoreCase(expectedProposal.name)) { // keyword
              found = true;
              break;
            }
          } else if (modelElement.getElementType() == expectedProposal.type) {
            if (modelElement instanceof AliasType) {
              if (((AliasType) modelElement).getAlias().equals(
                  expectedProposal.name)) {

                found = true;
                break;
              }

            } else if ((modelElement instanceof FakeConstructor)
                && (modelElement.getParent() instanceof AliasType)) {
              if (((AliasType) modelElement.getParent())
                  .getAlias().equals(expectedProposal.name)) {

                found = true;
                break;
              }

            } else {
              if (modelElement.getElementName().equalsIgnoreCase(
                  expectedProposal.name)) {
                found = true;
                break;
              }
            }
          } else if (modelElement.getElementType() == expectedProposal.type
              && new String(proposal.getName())
                  .equalsIgnoreCase(expectedProposal.name)) {
            // for phar include
            found = true;
            break;
          }
        }
        if (!found) {
          proposalsEqual = false;
          break;
        }
      }
    } else {
      proposalsEqual = false;
    }

    if (!proposalsEqual) {
      StringBuilder errorBuf = new StringBuilder();
      errorBuf.append("\nEXPECTED COMPLETIONS LIST:\n-----------------------------\n");
      errorBuf.append(pdttFile.getExpected());
      errorBuf.append("\nACTUAL COMPLETIONS LIST:\n-----------------------------\n");
      for (CompletionProposal p : proposals) {
        IModelElement modelElement = p.getModelElement();
        if (modelElement == null
            || modelElement.getElementName() == null) {
          errorBuf.append("keyword(").append(p.getName())
              .append(")\n");
        } else {
          switch (modelElement.getElementType()) {
          case IModelElement.FIELD:
            errorBuf.append("field");
            break;
          case IModelElement.METHOD:
            errorBuf.append("method");
            break;
          case IModelElement.TYPE:
            errorBuf.append("type");
            break;
          }
          if (modelElement instanceof AliasType) {
            errorBuf.append('(')
                .append(((AliasType) modelElement).getAlias())
                .append(")\n");
          } else {
            errorBuf.append('(')
                .append(modelElement.getElementName())
                .append(")\n");
          }
        }
      }
      fail(errorBuf.toString());
View Full Code Here

      // If element is a field or method and it's parent is not a class or
      // interface
      // then we can avoid time consuming flag checking
      // (public/protected/private flags)
      IModelElement parent = element.getParent();
      if (parent != null && parent.getElementType() != IModelElement.TYPE) {
        if (element.getElementType() == IModelElement.FIELD) {
          return DLTKPluginImages.DESC_FIELD_PUBLIC;
        }
        if (element.getElementType() == IModelElement.METHOD) {
          return DLTKPluginImages.DESC_METHOD_PUBLIC;
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.core.IModelElement

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.