use of org.eclipse.che.ide.ext.java.shared.dto.model.PackageFragmentRoot in project che by eclipse.
the class JavaProjectNode method getChildrenImpl.
@Override
protected Promise<List<Node>> getChildrenImpl() {
return createFromAsyncRequest(callback -> {
final List<Node> childrenNodes = new ArrayList<>();
for (PackageFragmentRoot packageFragmentRoot : project.getPackageFragmentRoots()) {
final List<PackageFragment> packageFragments = packageFragmentRoot.getPackageFragments();
final List<Node> nodes = packageFragments.stream().map(packageFragment -> nodeFactory.create(packageFragment, matches, packageFragmentRoot)).collect(Collectors.toList());
childrenNodes.addAll(nodes);
}
callback.onSuccess(childrenNodes);
});
}
use of org.eclipse.che.ide.ext.java.shared.dto.model.PackageFragmentRoot in project che by eclipse.
the class JavaElementToDtoConverter method getPackageFragmentRoots.
private List<PackageFragmentRoot> getPackageFragmentRoots(Object parent, String projectPath) throws JavaModelException {
List<PackageFragmentRoot> result = new ArrayList<>();
Set<Object> objects = childrens.get(parent);
if (objects == null) {
return result;
}
for (Object object : objects) {
if (object instanceof IPackageFragmentRoot) {
PackageFragmentRoot root = DtoFactory.newDto(PackageFragmentRoot.class);
IPackageFragmentRoot fragmentRoot = (IPackageFragmentRoot) object;
root.setProjectPath(projectPath);
root.setKind(fragmentRoot.getKind());
root.setPath(fragmentRoot.getPath().toOSString());
root.setElementName(fragmentRoot.getElementName());
root.setHandleIdentifier(fragmentRoot.getHandleIdentifier());
root.setPackageFragments(getPackageFragments(fragmentRoot, projectPath));
result.add(root);
}
}
return result;
}
use of org.eclipse.che.ide.ext.java.shared.dto.model.PackageFragmentRoot in project che by eclipse.
the class JarNavigationTest method testAllProjectsWithoutPackages.
@Test
public void testAllProjectsWithoutPackages() throws Exception {
List<JavaProject> packages = navigation.getAllProjectsAndPackages(false);
assertThat(packages).isNotNull().isNotEmpty();
JavaProject project = packages.get(0);
assertThat(project.getPackageFragmentRoots()).isNotNull().isNotEmpty();
PackageFragmentRoot fragmentRoot = project.getPackageFragmentRoots().get(0);
assertThat(fragmentRoot.getPackageFragments()).isNullOrEmpty();
}
use of org.eclipse.che.ide.ext.java.shared.dto.model.PackageFragmentRoot in project che by eclipse.
the class JarNavigationTest method testAllProjectsAndPackages.
@Test
public void testAllProjectsAndPackages() throws Exception {
List<JavaProject> packages = navigation.getAllProjectsAndPackages(true);
assertThat(packages).isNotNull().isNotEmpty();
JavaProject project = packages.get(0);
assertThat(packages.get(0).getPackageFragmentRoots()).isNotNull().isNotEmpty();
assertThat(project.getPackageFragmentRoots()).isNotNull().isNotEmpty();
PackageFragmentRoot fragmentRoot = project.getPackageFragmentRoots().get(0);
assertThat(fragmentRoot.getPackageFragments()).isNotEmpty();
}
use of org.eclipse.che.ide.ext.java.shared.dto.model.PackageFragmentRoot in project che by eclipse.
the class MoveViewImpl method setTreeOfDestinations.
/** {@inheritDoc} */
@Override
public void setTreeOfDestinations(List<JavaProject> projects) {
final SingleSelectionModel<Object> selectionModel = new SingleSelectionModel<>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
Object object = selectionModel.getSelectedObject();
if (object instanceof JavaProject) {
JavaProject project = (JavaProject) object;
delegate.setMoveDestinationPath(project.getPath(), project.getPath());
}
if (object instanceof PackageFragmentRoot) {
PackageFragmentRoot fragmentRoot = (PackageFragmentRoot) object;
delegate.setMoveDestinationPath(fragmentRoot.getPath(), fragmentRoot.getProjectPath());
}
if (object instanceof PackageFragment) {
PackageFragment fragment = (PackageFragment) object;
delegate.setMoveDestinationPath(fragment.getPath(), fragment.getProjectPath());
}
}
});
CellTree tree = new CellTree(new ProjectsAndPackagesModel(projects, selectionModel, resources), null, cellTreeResources);
tree.setAnimationEnabled(true);
treePanel.clear();
treePanel.add(tree);
}
Aggregations