Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*******************************************************************************/
package org.eclipse.pde.internal.ui.wizards.tools;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.resources.IFile;
Expand Down Expand Up @@ -42,10 +43,15 @@ public static Job scheduleFor(List<IPluginModelBase> models, boolean user) {
WorkspaceJob job = new WorkspaceJob(PDEUIMessages.UpdateClasspathJob_title) {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
List<IProject> toUpdate = new ArrayList<>();
SubMonitor mon = SubMonitor.convert(monitor, PDEUIMessages.UpdateClasspathJob_task, models.size());
for (IPluginModelBase model : models) {
updateClasspath(model, mon.split(1));
IProject project = updateClasspath(model, mon.split(1));
if (project != null) {
toUpdate.add(project);
}
}
ClasspathComputer.requestClasspathUpdate(toUpdate);
return Status.OK_STATUS;
}
};
Expand All @@ -55,7 +61,7 @@ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
return job;
}

private static void updateClasspath(IPluginModelBase model, SubMonitor monitor) throws CoreException {
private static IProject updateClasspath(IPluginModelBase model, SubMonitor monitor) throws CoreException {
try {
monitor.subTask(model.getPluginBase().getId());
// no reason to compile classpath for a non-Java model
Expand All @@ -70,13 +76,15 @@ private static void updateClasspath(IPluginModelBase model, SubMonitor monitor)
file.deleteMarkers(PDEMarkerFactory.MARKER_ID, true, IResource.DEPTH_ZERO);
}
ClasspathComputer.setClasspath(project, model);
return project;
}
}
} catch (CoreException e) {
String message = PDEUIMessages.UpdateClasspathJob_error_message;
PDEPlugin.logException(e, PDEUIMessages.UpdateClasspathJob_error_title, message);
throw new CoreException(Status.error(message, e));
}
return null;
}

}
Loading