Package org.springframework.ide.eclipse.core.model

Examples of org.springframework.ide.eclipse.core.model.IModelElement


   * Returns the child of given parent element's subtree the specified element belongs to. If the given element does
   * not belong to the subtree of the specified parent element <code>null</code> is returned.
   */
  public static IModelElement getChildForElement(IModelElement parent, IModelElement element) {
    while (element != null) {
      IModelElement elementParent = element.getElementParent();
      if (parent.equals(elementParent)) {
        return element;
      }
      element = elementParent;
    }
View Full Code Here


   * @since 2.0.4
   */
  @SuppressWarnings("unchecked")
  public static <T> T getParentOfClass(IModelElement child, Class<T> parentType) {
    if (child != null) {
      IModelElement parent = child.getElementParent();
      while (parent != null) {
        if (parentType.isAssignableFrom(parent.getClass())) {
          return (T) parent;
        }
        parent = parent.getElementParent();
      }
    }
    return null;
  }
View Full Code Here

          IType type = JdtUtils.getJavaType(file.getProject(), className);
          if (type != null) {
            try {
              IBeansConfig config = BeansCorePlugin.getModel().getConfig(file);
              if (config != null && context.getParentNode() instanceof Element) {
                IModelElement element = BeansModelUtils.getModelElement((Element) context.getParentNode(), config);
                int argIndex = getArgumentIndex(context.getNode());
                if (argIndex >= 0) {
                  if (element instanceof IBean) {
                    IBean bean = (IBean) element;
                    int count = bean.getConstructorArguments().size();
View Full Code Here

  private void traverseNode(Node node) {
    int startOffset = ((IDOMNode) node).getStartOffset();
    int endOffset = ((IDOMNode) node).getEndOffset();
    int start = doc.getStructuredDocument().getLineOfOffset(startOffset);
    int end = doc.getStructuredDocument().getLineOfOffset(endOffset);
    IModelElement modelElement = BeansModelUtils.getMostSpecificModelElement(start, end, file, null);
    if (bean.equals(modelElement)) {
      cEditor.revealElement(node);
    }
    else if (node.hasChildNodes()) {
      NodeList children = node.getChildNodes();
View Full Code Here

  }
 
  public static Set<IModelElement> getActivationHistory() {
    Set<IModelElement> history = new LinkedHashSet<IModelElement>();
    for (String elementId : HISTORY) {
      IModelElement element = BeansCorePlugin.getModel().getElement(elementId);
      if (element != null) {
        history.add(element);
      }
    }
    return history;
View Full Code Here

  }

  public static List<IBean> getBeanActivationHistory() {
    List<IBean> history = new ArrayList<IBean>();
    for (String elementId : HISTORY) {
      IModelElement element = BeansCorePlugin.getModel().getElement(elementId);
      if (element instanceof IBean) {
        history.add((IBean) element);
      }
    }
    return history;
View Full Code Here

      if (config != null) {
        IEditorPart editor = SpringUIUtils.getActiveEditor();
        if (editor.getEditorInput() == input && editor.getSite() != null
            && editor.getSite().getSelectionProvider() != null) {
          ISelection selection = editor.getSite().getSelectionProvider().getSelection();
          IModelElement element = BeansUIUtils.getSelectedElement(selection, config);
          if (element != null) {
            return new TreeSelection(BeansUIUtils.createTreePath(element));
          }
        }
      }
View Full Code Here

      // The line number-based approach is the best approximation that we can currently do
      int startLine = document.getLineOfOffset(element.getStartOffset()) + 1;
      int endLine = document.getLineOfOffset(element.getEndOffset()) + 1;

      IModelElement modelElement = BeansModelUtils.getMostSpecificModelElement(startLine, endLine, resource,
          new NullProgressMonitor());
      if (modelElement != null) {
        return new TreeSelection(BeansUIUtils.createTreePath(modelElement));
      }
      return new StructuredSelection(resource);
View Full Code Here

  }

  @Override
  public synchronized void elementChanged(ModelChangeEvent event) {

    IModelElement element = event.getElement();
    if (element instanceof IBeansProject) {
      IProject project = ((IBeansProject) element).getProject();
      if (BeansUIPlugin.PROJECT_EXPLORER_CONTENT_PROVIDER_ID.equals(providerID)) {
        refreshViewerForElement(project);
        refreshViewerForElement(JdtUtils.getJavaProject(project));
View Full Code Here

  public boolean isEnabled(IStructuredSelection selection) {
    if (selection instanceof ITreeSelection) {
      ITreeSelection tSelection = (ITreeSelection) selection;
      if (tSelection.size() == 1) {
        Object tElement = tSelection.getFirstElement();
        IModelElement element = null;
        if (tElement instanceof IModelElement) {
          element = (IModelElement) tElement;
        }
        else if (tElement instanceof IFile) {
          if (BeansUIPlugin.SPRING_EXPLORER_CONTENT_PROVIDER_ID
View Full Code Here

TOP

Related Classes of org.springframework.ide.eclipse.core.model.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.