Search in sources :

Example 1 with FileExtensions

use of org.eclipse.sapphire.modeling.annotations.FileExtensions in project liferay-ide by liferay.

the class LiferayScriptPossibleValuesService method compute.

@Override
protected void compute(Set<String> values) {
    Element modeElement = context(Element.class);
    List<FileExtensions> exts = modeElement.parent().definition().getAnnotations(FileExtensions.class);
    if ((exts != null) && (exts.size() > 0)) {
        this.type = exts.get(0).expr();
        IProject project = modeElement.adapt(IProject.class);
        if (project != null) {
            IFolder webappRoot = CoreUtil.getDefaultDocrootFolder(project);
            if (webappRoot != null) {
                IPath location = webappRoot.getLocation();
                if (location != null) {
                    if (location.toFile().exists()) {
                        values.addAll(new PropertiesVisitor().visitScriptFiles(webappRoot, type, values));
                    }
                }
            }
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Element(org.eclipse.sapphire.Element) FileExtensions(org.eclipse.sapphire.modeling.annotations.FileExtensions) IProject(org.eclipse.core.resources.IProject) IFolder(org.eclipse.core.resources.IFolder)

Aggregations

IFolder (org.eclipse.core.resources.IFolder)1 IProject (org.eclipse.core.resources.IProject)1 IPath (org.eclipse.core.runtime.IPath)1 Element (org.eclipse.sapphire.Element)1 FileExtensions (org.eclipse.sapphire.modeling.annotations.FileExtensions)1