Example usage for org.springframework.ide.eclipse.beans.core.model IBeansConfig CONFIG_FILE_TAG

List of usage examples for org.springframework.ide.eclipse.beans.core.model IBeansConfig CONFIG_FILE_TAG

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.beans.core.model IBeansConfig CONFIG_FILE_TAG.

Prototype

QualifiedName CONFIG_FILE_TAG

To view the source code for org.springframework.ide.eclipse.beans.core.model IBeansConfig CONFIG_FILE_TAG.

Click Source Link

Usage

From source file:org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig.java

public BeansJavaConfig(IBeansProject project, IType configClass, String configClassName, Type type) {
    super(project, BeansConfigFactory.JAVA_CONFIG_TYPE + configClassName, type);

    this.configClass = configClass;
    this.configClassName = configClassName;

    modificationTimestamp = IResource.NULL_STAMP;

    if (this.configClass != null) {
        IResource resource = this.configClass.getResource();
        if (resource != null && resource instanceof IFile) {
            file = (IFile) resource;//from www . j  a  va2  s .co m
        } else {
            IClassFile classFile = configClass.getClassFile();

            PackageFragment pkg = (PackageFragment) configClass.getPackageFragment();
            IPackageFragmentRoot root = (IPackageFragmentRoot) pkg.getParent();

            if (root.isArchive()) {
                IPath zipPath = root.getPath();

                String classFileName = classFile.getElementName();
                String path = Util.concatWith(pkg.names, classFileName, '/');
                file = new ExternalFile(zipPath.toFile(), path, project.getProject());
            }
        }
    }

    if (file == null || !file.exists()) {
        modificationTimestamp = IResource.NULL_STAMP;
        String msg = "Beans Java config class '" + configClassName + "' not accessible";
        problems = new CopyOnWriteArraySet<ValidationProblem>();
        problems.add(new ValidationProblem(IMarker.SEVERITY_ERROR, msg, file, -1));
    } else {
        modificationTimestamp = file.getModificationStamp();
        try {
            file.setSessionProperty(IBeansConfig.CONFIG_FILE_TAG, IBeansConfig.CONFIG_FILE_TAG_VALUE);
        } catch (CoreException e) {
            BeansCorePlugin.log(new Status(IStatus.WARNING, BeansCorePlugin.PLUGIN_ID,
                    String.format("Error occured while tagging config file '%s'", file.getFullPath()), e));
        }
    }

}