use of org.eclipse.core.runtime.Platform in project n4js by eclipse.
the class ExternalLibrariesActivator method getExternalLibraries.
private static BiMap<URI, String> getExternalLibraries() {
final Bundle bundle = context.getBundle();
checkNotNull(bundle, "Bundle was null. Does the platform running?");
final Iterable<Pair<URI, String>> uriNamePairs = from(EXTERNAL_LIBRARY_FOLDER_NAMES).transform(name -> bundle.getResource(name)).filter(notNull()).transform(URL_TO_FILE_URL_FUNC).transform(URL_TO_URI_FUNC).filter(notNull()).transform(uri -> new File(uri)).transform(FILE_TO_CANONICAL_FILE).transform(file -> file.toURI()).transform(uri -> pair(uri, new File(uri).getName()));
final Map<URI, String> uriMappings = newLinkedHashMap();
// npm packages first to be able to shadow runtime libraries and Mangelhaft from npm packages.
final File targetPlatformInstallLocation = N4_NPM_FOLDER_SUPPLIER.get();
final File nodeModulesFolder = new File(targetPlatformInstallLocation, NPM_CATEGORY);
uriMappings.put(nodeModulesFolder.toURI(), NPM_CATEGORY);
for (final Pair<URI, String> pair : uriNamePairs) {
uriMappings.put(pair.getFirst(), pair.getSecond());
}
return ImmutableBiMap.copyOf(uriMappings);
}
use of org.eclipse.core.runtime.Platform in project n4js by eclipse.
the class RebuildWorkspaceProjectsScheduler method scheduleBuildIfNecessary.
/**
* Schedules a build with the given projects. Does nothing if the {@link Platform platform} is not running, or the
* iterable of projects is empty.
*
* @param toUpdate
* an iterable of projects to build.
*/
public void scheduleBuildIfNecessary(final Iterable<IProject> toUpdate) {
if (Platform.isRunning() && !Iterables.isEmpty(toUpdate)) {
final Workspace workspace = (Workspace) ResourcesPlugin.getWorkspace();
final IBuildConfiguration[] projectsToReBuild = from(asList(workspace.getBuildOrder())).filter(config -> Iterables.contains(toUpdate, config.getProject())).toArray(IBuildConfiguration.class);
if (!Arrays2.isEmpty(projectsToReBuild)) {
new RebuildWorkspaceProjectsJob(projectsToReBuild).schedule();
}
}
}
Aggregations