use of org.eclipse.che.ide.ext.java.shared.dto.model.JavaProject in project che by eclipse.
the class MovePresenter method showProjectsAndPackages.
private void showProjectsAndPackages() {
Promise<List<JavaProject>> projectsPromise = navigationService.getProjectsAndPackages(true);
projectsPromise.then(new Operation<List<JavaProject>>() {
@Override
public void apply(List<JavaProject> projects) throws OperationException {
List<JavaProject> currentProject = new ArrayList<>();
for (JavaProject project : projects) {
currentProject.add(project);
}
view.setTreeOfDestinations(currentProject);
view.show(refactorInfo);
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
notificationManager.notify(locale.showPackagesError(), error.getMessage(), Status.FAIL, FLOAT_MODE);
}
});
}
use of org.eclipse.che.ide.ext.java.shared.dto.model.JavaProject 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);
}
use of org.eclipse.che.ide.ext.java.shared.dto.model.JavaProject in project che by eclipse.
the class JavaElementToDtoConverter method getProjects.
public List<JavaProject> getProjects() throws JavaModelException {
Set<Object> objects = childrens.get(result);
List<JavaProject> result = new ArrayList<>();
if (objects == null) {
return result;
}
for (Object object : objects) {
JavaProject javaProject = DtoFactory.newDto(JavaProject.class);
IJavaProject project = (IJavaProject) object;
javaProject.setName(project.getElementName());
String path = project.getPath().toOSString();
javaProject.setPath(path);
javaProject.setPackageFragmentRoots(getPackageFragmentRoots(object, path));
result.add(javaProject);
}
return result;
}
Aggregations