static void removeProfile(IProvisioningAgent agent, String profileId) { IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); if (profileRegistry == null) return; profileRegistry.removeProfile(profileId); }
/** * Deletes the profile associated with this target handle, if any. Returns * <code>true</code> if a profile existed and was deleted, otherwise <code>false</code>. * * @throws CoreException if unable to delete the profile */ public static void deleteProfile(ITargetHandle handle) throws CoreException { IProfileRegistry registry = getProfileRegistry(); if (registry != null) { IProfile profile = registry.getProfile(getProfileId(handle)); if (profile != null) { String location = profile.getProperty(IProfile.PROP_INSTALL_FOLDER); registry.removeProfile(getProfileId(handle)); if (location != null && location.length() > 0) { File folder = new File(location); if (folder.exists()) { delete(folder); } } } } }
registry.removeProfile(profileID);
registry.removeProfile(profileId);
private void cleanupProfileRegistry() { IProfileRegistry registry = (IProfileRegistry) ProvisioningUI.getDefaultUI().getSession().getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME); long[] history = registry.listProfileTimestamps(toImportFrom.getProfileId()); for (int i = 0; i < history.length; i++) { if (history[i] < toImportFrom.getTimestamp()) try { registry.removeProfile(toImportFrom.getProfileId(), history[i]); } catch (ProvisionException e) { //Can't happen } } }
void deleteSelectedSnapshots() { IStructuredSelection selection = (IStructuredSelection) configsViewer.getSelection(); if (selection.isEmpty()) return; String title = selection.size() == 1 ? ProvUIMessages.RevertProfilePage_DeleteSingleConfigurationTitle : ProvUIMessages.RevertProfilePage_DeleteMultipleConfigurationsTitle; String confirmMessage = selection.size() == 1 ? ProvUIMessages.RevertProfilePage_ConfirmDeleteSingleConfig : ProvUIMessages.RevertProfilePage_ConfirmDeleteMultipleConfigs; if (MessageDialog.openConfirm(configsViewer.getControl().getShell(), title, confirmMessage)) { Iterator<?> iter = selection.iterator(); while (iter.hasNext()) { Object selected = iter.next(); // If it is a recognized element and it is not the current profile, then it can be deleted. if (selected instanceof RollbackProfileElement && !((RollbackProfileElement) selected).isCurrentProfile()) { RollbackProfileElement snapshot = (RollbackProfileElement) selected; IProfileRegistry registry = ProvUI.getProfileRegistry(getSession()); if (registry != null) { try { registry.removeProfile(profileId, snapshot.getTimestamp()); } catch (ProvisionException e) { ProvUI.handleException(e, null, StatusManager.SHOW | StatusManager.LOG); } } } } configsViewer.refresh(); } }
getProfileRegistry().removeProfile(fProfile.getProfileId(), oldTimestamp);
getProfileRegistry().removeProfile(fProfile.getProfileId(), fProfile.getTimestamp()); throw e;