use of org.eclipse.core.resources.IWorkspaceRoot in project ow by vtst.
the class ResourceListField method get.
@Override
public List<T> get(IReadOnlyStore store) throws CoreException {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
List<String> list = store.get(name, Collections.<String>emptyList());
ArrayList<T> result = new ArrayList<T>(list.size());
for (String s : list) {
T resource = castResource(root.findMember(new Path(s)));
if (resource != null)
result.add(resource);
}
return result;
}
use of org.eclipse.core.resources.IWorkspaceRoot in project sling by apache.
the class ImportWizardPage method queryForLocation.
protected IPath queryForLocation(IProject initialSelection, String msg, String title) {
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getControl().getShell(), initialSelection, allowNewContainerName(), msg);
if (title != null) {
dialog.setTitle(title);
}
dialog.showClosedProjects(false);
dialog.setValidator(new ISelectionValidator() {
@Override
public String isValid(Object selection) {
if (!(selection instanceof IPath)) {
return "Please select a valid import location";
}
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IContainer container = (IContainer) root.findMember((IPath) selection);
if (container instanceof IProject) {
return "Please select a folder inside the project";
}
if (!ProjectHelper.isContentProject(container.getProject())) {
return "Project " + container.getProject().getName() + " is not a content project";
}
if (!ProjectUtil.isInsideContentSyncRoot(container)) {
return "Please select a folder inside the content sync root folder " + ProjectUtil.getSyncDirectory(container.getProject()).getProjectRelativePath();
}
return null;
}
});
dialog.open();
Object[] result = dialog.getResult();
if (result != null && result.length == 1) {
return (IPath) result[0];
}
return null;
}
use of org.eclipse.core.resources.IWorkspaceRoot in project sling by apache.
the class ImportWizardPage method handleContainerBrowseButtonPressed.
private void handleContainerBrowseButtonPressed() {
IPath result = queryForLocation(project, "Select a location to import data to", "Select location");
if (result != null) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
importRoot = (IFolder) root.findMember(result);
project = importRoot.getProject();
containerNameField.setText(importRoot.getFullPath().toPortableString());
repositoryCombo.setProject(project);
repositoryCombo.refreshRepositoryList(new NullProgressMonitor());
}
}
use of org.eclipse.core.resources.IWorkspaceRoot in project sling by apache.
the class TemporaryProject method before.
@Override
protected void before() throws Throwable {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
project = root.getProject("test-project-" + COUNTER.incrementAndGet());
project.create(new NullProgressMonitor());
project.open(new NullProgressMonitor());
}
use of org.eclipse.core.resources.IWorkspaceRoot in project bndtools by bndtools.
the class AdjustClasspathsForNewProjectJob method runInWorkspace.
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) {
List<Project> projects;
SubMonitor progress;
try {
projects = new ArrayList<Project>(Central.getWorkspace().getAllProjects());
progress = SubMonitor.convert(monitor, projects.size());
} catch (Exception e) {
return Status.CANCEL_STATUS;
}
IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
while (!projects.isEmpty()) {
Project project = projects.remove(0);
IProject eclipseProject = WorkspaceUtils.findOpenProject(wsroot, project);
if (eclipseProject != null && !eclipseProject.equals(addedProject)) {
try {
project.propertiesChanged();
IJavaProject javaProject = JavaCore.create(eclipseProject);
if (javaProject != null) {
BndContainerInitializer.requestClasspathContainerUpdate(javaProject);
}
} catch (CoreException e) {
logger.logStatus(e.getStatus());
return Status.CANCEL_STATUS;
}
progress.worked(1);
}
if (progress.isCanceled())
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
}
Aggregations