Package org.eclipse.dltk.core

Examples of org.eclipse.dltk.core.IModelElement


      selectedElements.add(selectedElement);
  }

  private void addResource(List selectedElements, IResource resource) {

    IModelElement je = DLTKCore.create(resource);
    if (je != null && je.exists()
        && je.getElementType() == IModelElement.SOURCE_MODULE)
      selectedElements.add(je);
    else
      selectedElements.add(resource);
  }
View Full Code Here


        String phpFileLocation = null;
        IProject project = null;
        Object obj = search[i];
        IResource res = null;
        if (obj instanceof IModelElement) {
          IModelElement elem = (IModelElement) obj;

          if (elem instanceof ISourceModule) {
            res = ((ISourceModule) elem).getCorrespondingResource();
          } else if (elem instanceof IType) {
            res = ((IType) elem).getUnderlyingResource();
View Full Code Here

   * @param adaptable
   *            adaptable object
   * @return containing resource or <code>null</code>
   */
  private IResource getLaunchableResource(IAdaptable adaptable) {
    IModelElement je = (IModelElement) adaptable
        .getAdapter(IModelElement.class);
    if (je != null) {
      return je.getResource();
    }
    return null;
  }
View Full Code Here

            .getCandidates(elements[i]);
        if (resolvedElements != null)
          candidates.addAll(Arrays.asList(resolvedElements));
      }
      if (candidates.isEmpty()) {
        IModelElement enclosingMethod = getEnclosingMethod(input,
            selection);
        if (enclosingMethod != null) {
          candidates.add(enclosingMethod);
        }
      }
View Full Code Here

    }
  }

  private IModelElement getEnclosingMethod(IModelElement input,
      ITextSelection selection) {
    IModelElement enclosingElement = null;
    try {
      switch (input.getElementType()) {
      // case IModelElement.CLASS_FILE :
      // IClassFile classFile= (IClassFile)
      // input.getAncestor(IModelElement.CLASS_FILE);
      // if (classFile != null) {
      // enclosingElement= classFile.getElementAt(selection.getOffset());
      // }
      // break;
      case IModelElement.SOURCE_MODULE:
        ISourceModule cu = (ISourceModule) input
            .getAncestor(IModelElement.SOURCE_MODULE);
        if (cu != null) {
          enclosingElement = cu.getElementAt(selection.getOffset());
        }
        break;
      }
      if (enclosingElement != null
          && enclosingElement.getElementType() == IModelElement.METHOD) {
        return enclosingElement;
      }
    } catch (ModelException e) {
      DLTKUIPlugin.log(e);
    }
View Full Code Here

   * @param sourceModule
   * @return The {@link IModelElement} or null.
   */
  protected IModelElement getSelectionModelElement(int offset, int length,
      ISourceModule sourceModule) {
    IModelElement element = null;
    try {
      Program ast = SharedASTProvider.getAST(sourceModule,
          SharedASTProvider.WAIT_NO, null);
      if (ast != null) {
        ASTNode selectedNode = NodeFinder.perform(ast, offset, length);
View Full Code Here

        IStatus status = createStatus(Messages.OpenCallHierarchyAction_0);
        ErrorDialog.openError(getShell(), getErrorDialogTitle(), "", //$NON-NLS-1$
            status);
        return;
      }
      IModelElement element = (IModelElement) input;
      if (!ActionUtil.isProcessable(getShell(), element))
        return;
      List result = new ArrayList(1);
      IStatus status = compileCandidates(result, element);
      if (status.isOK()) {
View Full Code Here

  private void updateActionsInPhpEditor() {
    if (fEditor == null)
      return;

    IModelElement element = SelectionConverter.getInput(fEditor);
    if (element == null)
      return;

    ITextSelection textSelection = (ITextSelection) fEditor
        .getSelectionProvider().getSelection();
View Full Code Here

      public void run() {
        PHPExplorerPart phpExplorer = getPhpExplorer();
        if (phpExplorer != null) {
          TreeViewer tree = phpExplorer.getTreeViewer();
          for (IFolder subfolder : subfolders) {
            IModelElement element = DLTKCore.create(subfolder);
            if (element != null) {
              tree.update(element, null);
            }
          }
        }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void selectionChanged(ModelTextSelection selection) {
    try {
      IModelElement resolveEnclosingElement;
      resolveEnclosingElement = selection.resolveEnclosingElement();
      Program astRoot = ASTProvider.getASTProvider().getAST(
          (ISourceModule) resolveEnclosingElement,
          SharedASTProvider.WAIT_YES, null);
      setEnabled(astRoot != null
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.