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

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


          throw new OperationCanceledException();
        }

        IValidationElementLifecycleManager callback = initValidationElementCallback(resource, kind);

        IResourceModelElement rootElement = callback.getRootElement();

        // Check if resource model element is external to the workspace -> if so, do not validate the resource
        if (rootElement != null && rootElement.isExternal()) {
          monitor.worked(1);
          break;
        }

        Set<ValidationRuleDefinition> ruleDefinitions = getRuleDefinitions(resource);
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();
        IResourceModelElement rElement = null;
        if (tElement instanceof IResourceModelElement) {
          if (tElement instanceof IBeansConfig || tElement instanceof IBeansConfigSet
              || tElement instanceof IBeansComponent || tElement instanceof IBean) {
            rElement = (IResourceModelElement) tElement;
          }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  protected StringBuilder decorateErrorMessage(StringBuilder builder) {
    IResourceModelElement context = getContextElement();
    if (context != null && context.getElementResource() != null) {
      String projectName = context.getElementResource().getProject().getName();
     
      // Only decorate the context if the context element is a config set as otherwise the context
      // should be clear from the marker/problems view -> it is the file being displayed
      if (context instanceof IBeansConfigSet) {
        builder.append(String.format(" [config set: %s/%s]", projectName, context.getElementName()));
      }
    }
    return builder;
  }
View Full Code Here

  /**
   * Returns the beans config for a given ZIP file entry.
   */
  public static IBeansConfig getConfig(ZipEntryStorage storage) {
    IResourceModelElement parent = (IResourceModelElement) storage.getAdapter(IResourceModelElement.class);
    if (parent instanceof IBeansConfig) {
      return (IBeansConfig) parent;
    }

    IBeansProject project = BeansCorePlugin.getModel().getProject(storage.getFile().getProject());
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();
        IResourceModelElement rElement = null;
        if (tElement instanceof IResourceModelElement) {
          if (tElement instanceof IBeansConfig || tElement instanceof IBeansConfigSet
              || tElement instanceof IBeansComponent || tElement instanceof IBean) {
            rElement = (IResourceModelElement) tElement;
          }
View Full Code Here

  }

  public boolean isEnabled(IStructuredSelection selection) {
    if (selection.size() == 1) {
      Object sElement = selection.getFirstElement();
      IResourceModelElement rElement = null;
      if (sElement instanceof IResourceModelElement) {
        rElement = ((IResourceModelElement) selection.getFirstElement());
      }
      else if (sElement instanceof IFile) {
        if (BeansUIPlugin.SPRING_EXPLORER_CONTENT_PROVIDER_ID.equals(getActionSite()
View Full Code Here

      if (config != null) {
        return config.getComponents().toArray();
      }
    }
    else if (parentElement instanceof ZipEntryStorage) {
      IResourceModelElement parent = (IResourceModelElement) ((ZipEntryStorage) parentElement)
          .getAdapter(IResourceModelElement.class);
      if (parent instanceof IBeansConfig) {
        return new Object[] { parent };
      }
    }
View Full Code Here

  /**
   * Opens given {@link IResourceModelElement} in associated editor.
   */
  public static IEditorPart openInEditor(IResourceModelElement element,
      boolean activate) {
    IResourceModelElement sourceElement;
    IResource resource = null;
    ZipEntryStorage zipEntryStorage = null;
    int line;
    if (element instanceof ISourceModelElement) {
      ISourceModelElement source = (ISourceModelElement) element;
      sourceElement = source.getElementSourceElement();
      line = source.getElementStartLine();
      Resource res = source.getElementSourceLocation().getResource();
      if (res instanceof IAdaptable) {
        resource = (IResource) ((IAdaptable) res)
            .getAdapter(IResource.class);
        zipEntryStorage = (ZipEntryStorage) ((IAdaptable) res)
            .getAdapter(ZipEntryStorage.class);
      }
      else {
        resource = sourceElement.getElementResource();
      }
    }
    else if (element instanceof AbstractBeansConfig) {
      sourceElement = element;
      line = ((AbstractBeansConfig) element).getElementStartLine();
      resource = sourceElement.getElementResource();
    }
    else {
      return null;
    }

    if (resource instanceof IFile) {

      // add to history
      BeansUIActivationHistory.addToHistory(element);

      IFile file = (IFile) resource;
      if (sourceElement.isElementArchived()) {
        try {
          ZipEntryStorage storage = new ZipEntryStorage(sourceElement);
          return openZipEntryStorage(line, file, storage);
        }
        catch (CoreException e) {
View Full Code Here

        + getElementStartLine() + ")";
  }

  public IResource getElementResource() {
    IResource resource = null;
    IResourceModelElement parent = (IResourceModelElement) getElementParent();
    while (resource == null && parent != null) {
      resource = parent.getElementResource();
      parent = (IResourceModelElement) getElementParent();
    }
    return resource;
  }
View Full Code Here

TOP

Related Classes of org.springframework.ide.eclipse.core.model.IResourceModelElement

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.