Search in sources :

Example 1 with JavaProjectsState

use of org.eclipse.xtext.ui.containers.JavaProjectsState in project xtext-eclipse by eclipse.

the class JavaProjectsStateTest method createProjectsState.

@Override
protected JavaProjectsState createProjectsState(IStorage2UriMapper mapper) {
    JavaProjectsState result = new JavaProjectsState();
    result.setMapper(mapper);
    result.setJdtHelper(new JdtHelper());
    JavaProjectsStateHelper javaProjectsStateHelper = new JavaProjectsStateHelper();
    javaProjectsStateHelper.setMapper(mapper);
    javaProjectsStateHelper.setUriMapperExtensions((IStorage2UriMapperJdtExtensions) ((Storage2UriMapperImpl) mapper).getContribution());
    javaProjectsStateHelper.setWorkspace(ResourcesPlugin.getWorkspace());
    result.setJavaProjectsHelper(javaProjectsStateHelper);
    WorkspaceProjectsStateHelper workspaceStateHelper = new WorkspaceProjectsStateHelper();
    workspaceStateHelper.setMapper(mapper);
    workspaceStateHelper.setWorkspace(ResourcesPlugin.getWorkspace());
    result.setProjectsHelper(workspaceStateHelper);
    return result;
}
Also used : JavaProjectsState(org.eclipse.xtext.ui.containers.JavaProjectsState) JavaProjectsStateHelper(org.eclipse.xtext.ui.containers.JavaProjectsStateHelper) Storage2UriMapperImpl(org.eclipse.xtext.ui.resource.Storage2UriMapperImpl) WorkspaceProjectsStateHelper(org.eclipse.xtext.ui.containers.WorkspaceProjectsStateHelper) JdtHelper(org.eclipse.xtext.ui.shared.JdtHelper)

Example 2 with JavaProjectsState

use of org.eclipse.xtext.ui.containers.JavaProjectsState in project xtext-eclipse by eclipse.

the class DeltaConverter method isDerived.

/**
 * @since 2.8
 */
protected boolean isDerived(String typeName, IJavaProject project) {
    QualifiedName qualifiedName = nameConverter.toQualifiedName(typeName);
    Iterable<IEObjectDescription> iterable = resourceDescriptions.getExportedObjects(TypesPackage.Literals.JVM_TYPE, qualifiedName, false);
    Iterator<IEObjectDescription> iterator = iterable.iterator();
    if (iterator.hasNext()) {
        if (project != null) {
            JavaProjectsState javaProjectsState = getJavaProjectsState();
            List<String> visibleContainers = javaProjectsState.getVisibleContainerHandles(project.getHandleIdentifier());
            while (iterator.hasNext()) {
                IEObjectDescription description = iterator.next();
                URI resourceURI = description.getEObjectURI().trimFragment();
                String handle = javaProjectsState.getContainerHandle(resourceURI);
                if (visibleContainers.contains(handle)) {
                    return true;
                }
            }
            return false;
        }
        return true;
    }
    return false;
}
Also used : JavaProjectsState(org.eclipse.xtext.ui.containers.JavaProjectsState) QualifiedName(org.eclipse.xtext.naming.QualifiedName) URI(org.eclipse.emf.common.util.URI) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription)

Aggregations

JavaProjectsState (org.eclipse.xtext.ui.containers.JavaProjectsState)2 URI (org.eclipse.emf.common.util.URI)1 QualifiedName (org.eclipse.xtext.naming.QualifiedName)1 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)1 JavaProjectsStateHelper (org.eclipse.xtext.ui.containers.JavaProjectsStateHelper)1 WorkspaceProjectsStateHelper (org.eclipse.xtext.ui.containers.WorkspaceProjectsStateHelper)1 Storage2UriMapperImpl (org.eclipse.xtext.ui.resource.Storage2UriMapperImpl)1 JdtHelper (org.eclipse.xtext.ui.shared.JdtHelper)1