Skip to content
Draft
Show file tree
Hide file tree
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 @@ -251,94 +251,86 @@ public static IApiBaseline newApiBaseline(String name, ExecutionEnvironmentDescr
public static IApiComponent[] addComponents(IApiBaseline baseline, String installLocation, IProgressMonitor monitor) throws CoreException {
SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.configuring_baseline, 50);
IApiComponent[] result = null;
try {
// Acquire the service
ITargetPlatformService service = null;
ApiPlugin plugin = ApiPlugin.getDefault();
if (plugin != null) {
service = ApiPlugin.getDefault().acquireService(ITargetPlatformService.class);
subMonitor.split(1);
ITargetLocation container = service.newProfileLocation(installLocation, null);
ITargetDefinition definition = service.newTarget();
subMonitor.subTask(Messages.resolving_target_definition);
container.resolve(definition, subMonitor.split(30));
subMonitor.split(1);
TargetBundle[] bundles = container.getBundles();
List<IApiComponent> components = new ArrayList<>();
if (bundles.length > 0) {
subMonitor.setWorkRemaining(bundles.length);
for (TargetBundle bundle : bundles) {
subMonitor.split(1);
if (!bundle.isSourceBundle()) {
IApiComponent component = ApiModelFactory.newApiComponent(baseline, URIUtil.toFile(bundle.getBundleInfo().getLocation()).getAbsolutePath());
if (component != null) {
subMonitor.subTask(NLS.bind(Messages.adding_component__0, component.getSymbolicName()));
components.add(component);
}
}
}
}
result = components.toArray(new IApiComponent[components.size()]);
} else {
// The target platform service is unavailable (OSGi isn't
// running), add components by searching the plug-ins directory
File dir = new File(installLocation);
if (dir.exists()) {
File[] files = dir.listFiles();
if (files == null) {
return NO_COMPONENTS;
}
List<IApiComponent> components = new ArrayList<>();
for (File bundle : files) {
IApiComponent component = ApiModelFactory.newApiComponent(baseline, bundle.getAbsolutePath());
// Acquire the service
ITargetPlatformService service = null;
ApiPlugin plugin = ApiPlugin.getDefault();
if (plugin != null) {
service = ApiPlugin.getDefault().acquireService(ITargetPlatformService.class);
subMonitor.split(1);
ITargetLocation container = service.newProfileLocation(installLocation, null);
ITargetDefinition definition = service.newTarget();
subMonitor.subTask(Messages.resolving_target_definition);
container.resolve(definition, subMonitor.split(30));
subMonitor.split(1);
TargetBundle[] bundles = container.getBundles();
List<IApiComponent> components = new ArrayList<>();
if (bundles.length > 0) {
subMonitor.setWorkRemaining(bundles.length);
for (TargetBundle bundle : bundles) {
subMonitor.split(1);
if (!bundle.isSourceBundle()) {
IApiComponent component = ApiModelFactory.newApiComponent(baseline, URIUtil.toFile(bundle.getBundleInfo().getLocation()).getAbsolutePath());
if (component != null) {
subMonitor.subTask(NLS.bind(Messages.adding_component__0, component.getSymbolicName()));
components.add(component);
}
}
result = components.toArray(new IApiComponent[components.size()]);
}
}
if (result != null) {
baseline.addApiComponents(result);
return result;
result = components.toArray(new IApiComponent[components.size()]);
} else {
// The target platform service is unavailable (OSGi isn't
// running), add components by searching the plug-ins directory
File dir = new File(installLocation);
if (dir.exists()) {
File[] files = dir.listFiles();
if (files == null) {
return NO_COMPONENTS;
}
List<IApiComponent> components = new ArrayList<>();
for (File bundle : files) {
IApiComponent component = ApiModelFactory.newApiComponent(baseline, bundle.getAbsolutePath());
if (component != null) {
components.add(component);
}
}
result = components.toArray(new IApiComponent[components.size()]);
}
return NO_COMPONENTS;
} finally {
subMonitor.done();
}
if (result != null) {
baseline.addApiComponents(result);
return result;
}
return NO_COMPONENTS;
}

public static IApiBaseline newApiBaselineFromTarget(String name, ITargetDefinition definition, IProgressMonitor monitor) throws CoreException {
IApiBaseline baseline = new ApiBaseline(name);

SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.configuring_baseline, 50);
try {
IStatus result = definition.resolve(subMonitor.split(30));
if (!result.isOK()) {
throw new CoreException(result);
}
subMonitor.split(1);
TargetBundle[] bundles = definition.getBundles();
List<IApiComponent> components = new ArrayList<>();
if (bundles.length > 0) {
subMonitor.setWorkRemaining(bundles.length);
for (TargetBundle bundle : bundles) {
subMonitor.split(1);
if (!bundle.isSourceBundle()) {
IApiComponent component = ApiModelFactory.newApiComponent(baseline, URIUtil.toFile(bundle.getBundleInfo().getLocation()).getAbsolutePath());
if (component != null) {
subMonitor.subTask(NLS.bind(Messages.adding_component__0, component.getSymbolicName()));
components.add(component);
}
IStatus result = definition.resolve(subMonitor.split(30));
if (!result.isOK()) {
throw new CoreException(result);
}
subMonitor.split(1);
TargetBundle[] bundles = definition.getBundles();
List<IApiComponent> components = new ArrayList<>();
if (bundles.length > 0) {
subMonitor.setWorkRemaining(bundles.length);
for (TargetBundle bundle : bundles) {
subMonitor.split(1);
if (!bundle.isSourceBundle()) {
IApiComponent component = ApiModelFactory.newApiComponent(baseline, URIUtil.toFile(bundle.getBundleInfo().getLocation()).getAbsolutePath());
if (component != null) {
subMonitor.subTask(NLS.bind(Messages.adding_component__0, component.getSymbolicName()));
components.add(component);
}
}
}
baseline.addApiComponents(components.toArray(new IApiComponent[components.size()]));
baseline.setLocation(generateTargetLocation(definition));
return baseline;
} finally {
subMonitor.done();
}
baseline.addApiComponents(components.toArray(new IApiComponent[components.size()]));
baseline.setLocation(generateTargetLocation(definition));
return baseline;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
progress.worked(1);
}
}
progress.done();
return Status.OK_STATUS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
if (refreshJob.needsToSchedule()) {
refreshJob.schedule();
}
progress.done();
return status;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ public final IStatus resolve(ITargetDefinition definition, IProgressMonitor moni
fFeatures = new TargetFeature[0];
fResolutionStatus = e.getStatus();
PDECore.log(e.getStatus());
} finally {
subMonitor.done();
if (monitor != null) {
monitor.done();
}
}
return fResolutionStatus;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ public IStatus resolve(IProgressMonitor monitor) {
} finally {
// keep a list of resolved targets with key as handle
TargetPlatformHelper.addTargetDefinitionMap(this);
subMonitor.done();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ public static void deleteContent(File fileToDelete, IProgressMonitor monitor) {
}
}
fileToDelete.delete();

subMon.done();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,6 @@ protected void clear(ILaunchConfiguration configuration, IProgressMonitor monito
if (configuration.getAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, false)) {
CoreUtility.deleteContent(getConfigurationDirectory(configuration), subMon.split(25));
}

subMon.done();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
Expand Down Expand Up @@ -318,15 +317,10 @@ public LoadDefaultTargetJob() {
public TargetDefinition defaultTarget;
@Override
public IStatus run(IProgressMonitor monitor) {
SubMonitor subMon = SubMonitor.convert(monitor);
ITargetPlatformService service = getTargetService();
if (service != null) {
defaultTarget = (TargetDefinition) service.newDefaultTarget();
}
subMon.done();
if (monitor != null) {
monitor.done();
}
return Status.OK_STATUS;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1208,8 +1208,6 @@ protected void clear(ILaunchConfiguration configuration, IProgressMonitor monito
if (configuration.getAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, false)) {
CoreUtility.deleteContent(getConfigurationDirectory(configuration), subMon.split(25));
}

subMon.done();
}

/**
Expand Down
Loading