use of org.springsource.ide.eclipse.commons.configurator.ConfigurableExtension in project eclipse-integration-commons by spring-projects.
the class ConfiguratorPreferencesPage method updateSelection.
protected void updateSelection(ISelection selection) {
configureButton.setEnabled(!selection.isEmpty());
ConfigurableExtension extension = getSelectedExtension(selection);
installButton.setEnabled(extension != null && extension.isInstallable() && isInstallEnabled());
}
use of org.springsource.ide.eclipse.commons.configurator.ConfigurableExtension in project eclipse-integration-commons by spring-projects.
the class ConfiguratorPreferencesPage method updateElements.
private void updateElements() {
elements = new ArrayList<ConfigurableExtension>();
importer = new ConfiguratorImporter();
importer.setFirstMatchOnly(false);
try {
PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
elements.addAll(importer.detectExtensions(monitor));
}
});
} catch (InvocationTargetException e) {
StatusHandler.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "An error occurred loading configurable items", e));
} catch (InterruptedException e) {
// ignore
}
}
use of org.springsource.ide.eclipse.commons.configurator.ConfigurableExtension in project eclipse-integration-commons by spring-projects.
the class ConfiguratorImporterTest method testDetectExtensions.
@Test
public void testDetectExtensions() throws Exception {
Assume.assumeTrue(isStsDistribution());
ConfiguratorImporter importer = new ConfiguratorImporter();
List<ConfigurableExtension> extensions = importer.detectExtensions(new NullProgressMonitor());
// assertContains("grails-", extensions);
assertContains("apache-maven-", extensions);
assertContains("spring-roo-", extensions);
assertContains("vfabric-tc-server-developer-", extensions);
// assertContains("com.springsource.cloudfoundryserver.runtime.10",
// extensions);
}
use of org.springsource.ide.eclipse.commons.configurator.ConfigurableExtension in project eclipse-integration-commons by spring-projects.
the class ConfiguratorImporter method getInstalledBundles.
public Set<String> getInstalledBundles() {
final Set<String> installedBundles = new HashSet<String>();
Set<WorkspaceConfiguratorParticipant> participants = ParticipantExtensionPointReader.getParticipants();
for (final WorkspaceConfiguratorParticipant configurator : participants) {
SafeRunner.run(new ISafeRunnable() {
public void handleException(Throwable exception) {
// logged by super class
}
public void run() throws Exception {
List<ConfigurableExtension> extensions = configurator.detectExtensions(ConfiguratorImporter.this, new NullProgressMonitor());
for (ConfigurableExtension extension : extensions) {
if (extension.getBundleId() != null) {
installedBundles.add(extension.getBundleId() + ".feature.group");
}
}
}
});
}
return installedBundles;
}
use of org.springsource.ide.eclipse.commons.configurator.ConfigurableExtension in project eclipse-integration-commons by spring-projects.
the class ConfiguratorImporter method detectExtensions.
public List<ConfigurableExtension> detectExtensions(final IProgressMonitor monitor) {
final List<ConfigurableExtension> result = new ArrayList<ConfigurableExtension>();
Set<WorkspaceConfiguratorParticipant> participants = ParticipantExtensionPointReader.getParticipants();
for (final WorkspaceConfiguratorParticipant participant : participants) {
SafeRunner.run(new ISafeRunnable() {
public void handleException(Throwable exception) {
// logged by super class
}
public void run() throws Exception {
List<ConfigurableExtension> extensions = participant.detectExtensions(ConfiguratorImporter.this, monitor);
result.addAll(extensions);
}
});
}
Set<InstallableItem> installableItems = ParticipantExtensionPointReader.getInstallableItems();
for (final InstallableItem item : installableItems) {
boolean found = false;
for (ConfigurableExtension extension : result) {
if (extension.getId().equals(item.getId())) {
extension.setInstallableItem(item);
found = true;
}
}
if (!found) {
for (final WorkspaceConfiguratorParticipant participant : participants) {
if (participant.getId().equals(item.getConfiguratorId())) {
final AtomicBoolean added = new AtomicBoolean(false);
SafeRunner.run(new ISafeRunnable() {
public void handleException(Throwable exception) {
// logged by super class
}
public void run() throws Exception {
ConfigurableExtension extension = participant.createExtension(item, monitor);
if (extension != null) {
result.add(extension);
added.set(true);
}
}
});
if (added.get()) {
break;
}
}
}
}
}
return result;
}
Aggregations