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

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


  public boolean isChildBean() {
    return definition.getParentName() != null;
  }

  public boolean isInnerBean() {
    IModelElement parent = getElementParent();
    return !(parent instanceof IBeansConfig || parent instanceof IBeansComponent);
  }
View Full Code Here


                node.getStartOffset()) + 1;
        int endLine = ((IDOMDocument) node.getOwnerDocument())
            .getStructuredDocument().getLineOfOffset(
                node.getEndOffset()) + 1;

        IModelElement mostspecificElement = BeansModelUtils
            .getMostSpecificModelElement(startLine, endLine, file,
                null);
        if (mostspecificElement != null) {
          this.lastSelection = mostspecificElement;
        }
View Full Code Here

              .getFullPath().toString();
    } else if (element instanceof IBeansConfigSet) {
      for (IBeansConfig config : ((IBeansConfigSet) element).getConfigs()) {
        addAnnotationsForConfig(newAnnotations, config);
      }
      IModelElement parent = ((IBeansConfigSet) element)
          .getElementParent();
      contentDescription = Messages.RequestMappingView_PREFIX_CONFIG_SET
          + parent.getElementName() + "/" + element.getElementName(); //$NON-NLS-1$
    } else if (element instanceof IBeansProject) {
      for (IBeansConfig config : ((IBeansProject) element).getConfigs()) {
        addAnnotationsForConfig(newAnnotations, config);
      }
      contentDescription = Messages.RequestMappingView_PREFIX_PROJECT
View Full Code Here

      int startOffset = ((IDOMNode) node).getStartOffset();
      int endOffset = ((IDOMNode) node).getEndOffset();
      int start = document.getLineOfOffset(startOffset) + 1;
      int end = document.getLineOfOffset(endOffset) + 1;
      IFile file = BeansEditorUtils.getFile(document);
      IModelElement element = BeansModelUtils.getMostSpecificModelElement(start, end, file, null);
     
      if (element instanceof IBeansImport) {
        for (IBeansConfig config : ((IBeansImport) element).getImportedBeansConfigs()) {
          hyperlinks.add(new WorkspaceFileHyperlink(hyperlinkRegion, (IFile) config.getElementResource()));
        }
View Full Code Here

      IBean modelBean = bean.getBean();
      String  propertyName  = getName();
      IBean innerBean = null;
      for (IBean iBean : BeansModelUtils.getInnerBeans(modelBean)) {
        if (iBean.getElementName().equals(beanName)) {
          IModelElement parent = iBean.getElementParent();
          if (parent instanceof IBeanProperty
              && parent.getElementName().equals(propertyName)) {
            innerBean = iBean;
            break;
          }
        }
      }
View Full Code Here

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

    public void elementChanged(ModelChangeEvent event) {
      final GraphEditorInput beansInput = (GraphEditorInput) getEditorInput();
      boolean refresh = false;

      IModelElement changedElement = event.getElement();
      IModelElement originalInputElement = BeansCorePlugin.getModel().getElement(beansInput.getElementId());
      IModelElement originalContextElement = BeansCorePlugin.getModel().getElement(beansInput.getContextId());

      // check if changes appeared in a spring config file
      if (changedElement instanceof IBeansConfig) {
        IResource changedResource = ((IBeansConfig) changedElement).getElementResource();
        refresh = checkForRefresh(changedResource, originalInputElement)
View Full Code Here

  public String getHyperlinkText() {
    if (modelElement != null) {
      StringBuilder str = new StringBuilder();
      str.append("Navigate to ");
      str.append(modelElement.getElementName());
      IModelElement parent = modelElement.getElementParent();
      if (parent instanceof ProfileAwareBeansComponent) {
        ProfileAwareBeansComponent beans = (ProfileAwareBeansComponent) parent;
        Set<String> profiles = beans.getProfiles();

        str.append(" in profile");
View Full Code Here

    this.elementId = elementId;
    this.contextId = contextId;
  }

  protected void init() {
    IModelElement element = BeansCorePlugin.getModel().getElement(elementId);
    IModelElement context = BeansCorePlugin.getModel().getElement(contextId);

    // Prepare name and tooltip for given element and context
    if (element instanceof IBeansConfig) {
      String toolTipPrefix = BeansGraphPlugin.getResourceString("ShowGraphAction.name.config");
      IBeansConfig config = (IBeansConfig) element;
      IResource resource = config.getElementResource();
      if (resource != null) {
        if (config.isElementArchived()) {
          ZipEntryStorage storage = new ZipEntryStorage(config);
          name = storage.getName();
          toolTip = toolTipPrefix + storage.getFile().getProjectRelativePath().toString() + " - "
              + storage.getFullPath().toString();
        }
        else {
          name = resource.getName();
          toolTip = toolTipPrefix + resource.getFullPath().toString();
        }
      }
      else {
        name = BeansGraphPlugin.getResourceString("ShowGraphAction.name.undefined");
        toolTip = BeansGraphPlugin.getResourceString("ShowGraphAction.name.config") + name;
      }
    }
    else if (element instanceof IBeansConfigSet) {
      IModelElement parent = ((IBeansConfigSet) element).getElementParent();
      name = element.getElementName();
      toolTip = BeansGraphPlugin.getResourceString("ShowGraphAction.name.configSet") + parent.getElementName()
          + '/' + element.getElementName();
    }
    else if (element instanceof IBeansComponent || element instanceof IBean) {
      name = element.getElementName();
      StringBuffer buffer = new StringBuffer();
View Full Code Here

    }
    return element;
  }

  private static String getContext(String elementId) {
    IModelElement element = BeansCorePlugin.getModel().getElement(elementId);
    return getContext(element).getElementID();
  }
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.