Examples of IModelElement


Examples of org.apache.felix.sigil.common.model.IModelElement

        return buf.toString();
    }

    private synchronized void redraw()
    {
        final IModelElement element = current;
        if (job != null)
        {
            job.cancel();
        }
View Full Code Here

Examples of org.apache.felix.sigil.common.model.IModelElement

            public Object getParent(Object element)
            {
                if (element instanceof IModelElement)
                {
                    IModelElement model = (IModelElement) element;
                    return model.getParent();
                }

                return null;
            }

            public boolean hasChildren(Object element)
            {
                if (element instanceof ICompoundModelElement)
                {
                    ICompoundModelElement model = (ICompoundModelElement) element;
                    return model.children().length > 0;
                }
                return false;
            }

            public Object[] getElements(Object inputElement)
            {
                IBundleRepository rep = (IBundleRepository) inputElement;
                IRepositoryModel model = SigilCore.getRepositoryModel(rep);
                if ( model.getProblem() == null ) {
                    return getBundles(rep);
                }
                else {
                    return new Object[] { model.getProblem() };
                }
            }
        });

        treeViewer.setComparator(new ModelElementComparator());

        treeViewer.setLabelProvider(new ModelLabelProvider());

        treeViewer.addDragSupport(DND.DROP_LINK,
            new Transfer[] { LocalSelectionTransfer.getTransfer() },
            new DragSourceAdapter()
            {
                @Override
                public void dragFinished(DragSourceEvent event)
                {
                    // TODO Auto-generated method stub
                    super.dragFinished(event);
                }

                @Override
                public void dragSetData(DragSourceEvent event)
                {
                    // TODO Auto-generated method stub
                    super.dragSetData(event);
                }

                @SuppressWarnings("unchecked")
                @Override
                public void dragStart(DragSourceEvent event)
                {
                    if (treeViewer.getSelection().isEmpty())
                    {
                        IStructuredSelection sel = (IStructuredSelection) treeViewer.getSelection();
                        for (Iterator<IModelElement> i = sel.iterator(); i.hasNext();)
                        {
                            IModelElement e = i.next();
                            if (e instanceof ISigilBundle)
                            {
                                event.data = e;
                            }
                            else
View Full Code Here

Examples of org.eclipse.dltk.core.IModelElement

  public void apply(ICompletionReporter reporter) throws Exception {

    SuperclassMethodContext context = (SuperclassMethodContext) getContext();
    ISourceModule module = context.getSourceModule();

    IModelElement element = module.getElementAt(context.getOffset());

    if (!(element instanceof SourceType)) {
      while(element.getParent() != null) {
        element = element.getParent();
        if (element instanceof SourceType) {
          break;
        }
      }
    }
View Full Code Here

Examples of org.eclipse.dltk.core.IModelElement

      return false;
    }

    try {

      IModelElement elem = sourceModule.getElementAt(offset);

      if (elem instanceof SourceType) {
        SourceType type = (SourceType) elem;

        if (type.getSuperClasses().length > 0) {
View Full Code Here

Examples of org.eclipse.dltk.core.IModelElement

   *            <code>false</code> otherwise
   * @return the corresponding PHP element, or <code>null</code> if no such
   *         element exists
   */
  public static IModelElement handleToElement(final WorkingCopyOwner owner, final String project, final String handle, final boolean check) {
    IModelElement element = owner == null ? element = DLTKCore.create(handle) : DLTKCore.create(handle, owner);

    if (element == null && project != null) {
      final IScriptProject phpProject = DLTKCore.create(ResourcesPlugin.getWorkspace().getRoot()).getScriptProject(project);
      final String identifier = phpProject.getHandleIdentifier();
      element = owner == null ? DLTKCore.create(identifier + handle) : DLTKCore.create(identifier + handle, owner);
    }

    if (check && element instanceof IMethod) {
      /*
       * Resolve the method based on simple names of parameter types
       * (to accommodate for different qualifications when refactoring is e.g.
       * recorded in source but applied on binary method):
       */
      final IMethod method = (IMethod) element;
      final IMethod[] methods = method.getDeclaringType().findMethods(method);
      if (methods != null && methods.length > 0) {
        element = methods[0];
      }
    }

    if (element == null) {
      return null;
    } else {
      if (check) {
        if (element.exists()) {
          return element;
        } else {
          return null;
        }
      } else {
View Full Code Here

Examples of org.eclipse.dltk.core.IModelElement

                try {
                  moduleDeclaration.traverse(new PHPASTVisitor() {
                    @Override
                    public boolean visit(FullyQualifiedReference s) throws Exception {
                      if (s.sourceStart() == match.getOffset() && s.sourceEnd() == match.getOffset() + match.getLength()) {
                        IModelElement sourceElement = PDTModelUtils.getSourceElement(module, s.sourceStart(), s.matchLength());
                        if (sourceElement != null) {
                          IType sourceType = (IType) sourceElement.getAncestor(IModelElement.TYPE);
                          if (sourceType != null && new PHPType(sourceType).isInstanceOf((IType) modelElement)) {
                            int offset;
                            if (s.getNamespace() == null) {
                              offset = s.sourceStart();
                            } else {
View Full Code Here

Examples of org.eclipse.dltk.core.IModelElement

                    } catch (MalformedTreeException e) {
                      // conflicting update -> omit text match
                    }
                  }
                } else {
                  IModelElement sourceElement = PDTModelUtils.getSourceElement(module, expression.getCallName().sourceStart(), expression.getCallName().matchLength());
                  if (sourceElement != null && sourceElement.getElementType() == IModelElement.METHOD) {
                    IType declaringType = ((IMethod) sourceElement).getDeclaringType();
                    if (declaringType != null && new PHPType(declaringType).isInstanceOf(method.getDeclaringType())) {
                      try {
                        addTextEdit(
                          changeManager.get(module),
View Full Code Here

Examples of org.eclipse.dltk.core.IModelElement

      IProject project = null;
     
      if (receiver instanceof IImplForPhp) {
       
        IImplForPhp phpElement = (ElementImplForPhp) receiver;
        IModelElement element = phpElement.getModelElement();
       
        if (element == null) {
          return false;
        }
       
        project = element.getScriptProject().getProject();
      } else if (receiver instanceof ISourceModule) {
        ISourceModule source = (ISourceModule) receiver;
        project = source.getScriptProject().getProject();
      } else if (receiver instanceof IProject) {
        project = (IProject) receiver;
View Full Code Here

Examples of org.eclipse.dltk.core.IModelElement

    IDocument document = viewer.getDocument();
    PHPStructuredEditor textEditor = (PHPStructuredEditor) ((PHPStructuredTextViewer) viewer)
        .getTextEditor();

    if (textEditor instanceof PHPStructuredEditor) {
      IModelElement editorElement = ((PHPStructuredEditor) textEditor)
          .getModelElement();
      if (editorElement != null) {

        IModelElement input = EditorUtility.getEditorInputModelElement(textEditor, false);

        if (input instanceof ICodeAssist) {
         
          try {
           
            int repOffset = getReplacementOffset();
            int length = getReplacementLength();
            IDLTKSearchScope scope = SearchEngine.createSearchScope(input.getScriptProject());
            String type = document.get(repOffset, length);
            IType[] types = PhpModelAccess.getDefault().findTypes(null, type, MatchRule.EXACT, 0, 0, scope, new NullProgressMonitor());
           
            if (types.length == 1) {
              this.type = types[0];
View Full Code Here

Examples of org.eclipse.dltk.core.IModelElement

    IDocument document = viewer.getDocument();
    ITextEditor textEditor = ((PHPStructuredTextViewer) viewer)
        .getTextEditor();

    if (textEditor instanceof PHPStructuredEditor) {
      IModelElement editorElement = ((PHPStructuredEditor) textEditor)
          .getModelElement();
      if (editorElement != null) {
       
        ISourceModule sourceModule = ((ModelElement) editorElement)
            .getSourceModule();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.