本文整理汇总了Java中org.eclipse.equinox.p2.engine.IProfileRegistry.getProfile方法的典型用法代码示例。如果您正苦于以下问题:Java IProfileRegistry.getProfile方法的具体用法?Java IProfileRegistry.getProfile怎么用?Java IProfileRegistry.getProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.equinox.p2.engine.IProfileRegistry
的用法示例。
在下文中一共展示了IProfileRegistry.getProfile方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkIfInstalled
import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入方法依赖的package包/类
/**
* Checks if a specific {@link IInstallableUnit} (IU) is installed
*
* @param installableUnitID The ID of the IU of interest
* @return true if the IU is installed
*/
public boolean checkIfInstalled(String installableUnitID) {
// --- Query the p2 profile for the InstallableUnit of interest -----------
IProfileRegistry profileRegistry = (IProfileRegistry) this.getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME);
IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(installableUnitID);
IQueryResult<IInstallableUnit> queryResult = profile.query(query, this.getProgressMonitor());
return !(queryResult.isEmpty());
}
示例2: getInstalledFeatures
import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入方法依赖的package包/类
/**
* Returns the installed features.
*
* @return the installed features
* @throws Exception the exception
*/
public List<IInstallableUnit> getInstalledFeatures() throws Exception {
if (this.iuList==null) {
IProfileRegistry profileRegistry = (IProfileRegistry) this.getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME);
IProfile profile = null;
if (this.isDevelopmentMode==true) {
if (profileRegistry.getProfiles().length>0) {
profile = profileRegistry.getProfiles()[0];
}
} else {
profile = profileRegistry.getProfile(IProfileRegistry.SELF);
}
if (profile==null) {
throw new Exception("Unable to access p2 profile - This is not possible when starting the application from the IDE!");
}
// --- Create the IU list -------------------------------
this.iuList = new ArrayList<IInstallableUnit>();
IQuery<IInstallableUnit> query = QueryUtil.createIUGroupQuery();
IQueryResult<IInstallableUnit> queryResult = profile.query(query, null);
for (IInstallableUnit feature : queryResult) {
if (QueryUtil.isProduct(feature) == false) {
iuList.add(feature);
}
}
}
return iuList;
}
示例3: listInstalledSoftware
import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入方法依赖的package包/类
@Override
public List<IInstallableUnit> listInstalledSoftware(
IProvisioningAgent agen, int i) {
this.agent = agen;
IProfileRegistry service = (IProfileRegistry) agen
.getService(IProfileRegistry.SERVICE_NAME);
IQueryable<IInstallableUnit> queryable = service.getProfile("_SELF_");
if(queryable==null){
return null;
}
NullProgressMonitor monitor = new NullProgressMonitor();
IQuery<IInstallableUnit> createIU = null;
if (i == GROUP) {
createIU = QueryUtil.createIUGroupQuery();
} else if (i == CATEGORY) {
createIU = QueryUtil.createIUCategoryQuery();
} else if (i == ANY) {
createIU = QueryUtil.createIUAnyQuery();
}
IQueryResult<IInstallableUnit> query = queryable.query(createIU,
monitor);
List<IInstallableUnit> list = org.ramo.klevis.p2.core.util.Utils
.toList(query);
return list;
}
示例4: execute
import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入方法依赖的package包/类
/**
* Execute the command.
*/
public Object execute(ExecutionEvent event) {
// Look for a profile. We may not immediately need it in the
// handler, but if we don't have one, whatever we are trying to do
// will ultimately fail in a more subtle/low-level way. So determine
// up front if the system is configured properly.
String profileId = getProvisioningUI().getProfileId();
IProvisioningAgent agent = getProvisioningUI().getSession().getProvisioningAgent();
IProfile profile = null;
if (agent != null) {
IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
if (registry != null) {
profile = registry.getProfile(profileId);
}
}
if (profile == null) {
// Inform the user nicely
MessageDialog.openInformation(null, Messages.PreloadingRepositoryHandler_SoftwareUpdatesTitle, Messages.PreloadingRepositoryHandler_ErrorMessage);
// Log the detailed message
StatusManager.getManager().handle(
new Status(IStatus.WARNING, Activator.PLUGIN_ID, Messages.PreloadingRepositoryHandler_ErrorStatusMessage));
} else {
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
public void run() {
doExecuteAndLoad();
}
});
}
return null;
}
示例5: execute
import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入方法依赖的package包/类
/**
* Execute the command.
*/
public Object execute(ExecutionEvent event) {
// Look for a profile. We may not immediately need it in the
// handler, but if we don't have one, whatever we are trying to do
// will ultimately fail in a more subtle/low-level way. So determine
// up front if the system is configured properly.
String profileId = getProvisioningUI().getProfileId();
IProvisioningAgent agent = getProvisioningUI().getSession().getProvisioningAgent();
IProfile profile = null;
if (agent != null) {
IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
if (registry != null) {
profile = registry.getProfile(profileId);
}
}
if (profile == null) {
// Inform the user nicely
MessageDialog.openInformation(null, ProvSDKMessages.Handler_SDKUpdateUIMessageTitle, ProvSDKMessages.Handler_CannotLaunchUI);
// Log the detailed message
StatusManager.getManager().handle(P2_Activator.getNoSelfProfileStatus());
} else {
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
public void run() {
doExecuteAndLoad();
}
});
}
return null;
}
示例6: createProfile
import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入方法依赖的package包/类
/**
* Creates a profile.
*
* @param profileId Profile identifier
* @return Profile
* @throws ProvisionException on failure
*/
public IProfile createProfile(String profileId) throws ProvisionException {
IProfileRegistry profileRegistry = (IProfileRegistry)getAgent().getService(IProfileRegistry.SERVICE_NAME);
IProfile profile = profileRegistry.getProfile(profileId);
// Note: On uninstall, the profile will always be available
if (profile == null) {
Map<String, String> properties = new HashMap<String, String>();
// Install location - this is where the p2 directory will be located
properties.put(IProfile.PROP_INSTALL_FOLDER, getInstallLocation().toString());
// Environment
EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Installer.getDefault().getContext(), EnvironmentInfo.class.getName());
String env = "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
properties.put(IProfile.PROP_ENVIRONMENTS, env);
// Profile identifier
properties.put(IProfile.PROP_NAME, profileId);
// Cache location - this is where features and plugins will be deployed
properties.put(IProfile.PROP_CACHE, getInstallLocation().toOSString());
// Set roaming. This will put a path relative to the OSGi configuration area in the config.ini
// so that the installation can be moved. Without roaming, absolute paths will be written
// to the config.ini and Software Update will not work correctly for a moved installation.
properties.put(IProfile.PROP_ROAMING, Boolean.TRUE.toString());
// Profile properties specified in install description
if (Installer.getDefault().getInstallManager().getInstallDescription().getProfileProperties() != null)
properties.putAll(Installer.getDefault().getInstallManager().getInstallDescription().getProfileProperties());
profile = profileRegistry.addProfile(profileId, properties);
}
return profile;
}
示例7: getProfile
import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入方法依赖的package包/类
/**
* Returns a profile.
*
* @param profileId Profile identifier
* @return Profile or <code>null</code> if the profile does not exist.
*/
public IProfile getProfile(String profileId) {
if (profileId == null)
return null;
IProfileRegistry profileRegistry = (IProfileRegistry)getAgent().getService(IProfileRegistry.SERVICE_NAME);
return profileRegistry.getProfile(profileId);
}
示例8: execute
import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入方法依赖的package包/类
/**
* Execute the command.
*/
public Object execute(ExecutionEvent event) {
// Look for a profile. We may not immediately need it in the
// handler, but if we don't have one, whatever we are trying to do
// will ultimately fail in a more subtle/low-level way. So determine
// up front if the system is configured properly.
String profileId = getProvisioningUI().getProfileId();
IProvisioningAgent agent = getProvisioningUI().getSession().getProvisioningAgent();
IProfile profile = null;
if (agent != null) {
IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
if (registry != null) {
profile = registry.getProfile(profileId);
}
}
if (profile == null) {
// Inform the user nicely
P2UpdateUtil.openConnectErrorInfoDialog(getShell(), P2UpdateUtil.INFO_TYPE_CHECK);
return null;
} else {
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
public void run() {
doExecuteAndLoad();
}
});
}
return null;
}
示例9: execute
import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入方法依赖的package包/类
/**
* Execute the command.
*/
public Object execute(ExecutionEvent event) {
// SystemResourceUtil.load();
// String tshelp = System.getProperties().getProperty("TSHelp");
// String tsstate = System.getProperties().getProperty("TSState");
// if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) {
// LoggerFactory.getLogger(PreloadingRepositoryHandler.class).error("Exception:key hs008 is lost.(Can't find the key)");
// System.exit(0);
// }
// Look for a profile. We may not immediately need it in the
// handler, but if we don't have one, whatever we are trying to do
// will ultimately fail in a more subtle/low-level way. So determine
// up front if the system is configured properly.
String profileId = getProvisioningUI().getProfileId();
IProvisioningAgent agent = getProvisioningUI().getSession().getProvisioningAgent();
IProfile profile = null;
if (agent != null) {
IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
if (registry != null) {
profile = registry.getProfile(profileId);
}
}
if (profile == null) {
// Inform the user nicely
P2UpdateUtil.openConnectErrorInfoDialog(getShell(), P2UpdateUtil.INFO_TYPE_CHECK);
return null;
} else {
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
public void run() {
doExecuteAndLoad();
}
});
}
return null;
}
示例10: getBundleInfo
import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入方法依赖的package包/类
/**
* Gathers a list of all the IInstallableUnits currently running in the application during runtime.
*/
public void getBundleInfo(){
ProvisioningUI provisioningUI = ProvisioningUI.getDefaultUI();
String profileId = provisioningUI.getProfileId();
ProvisioningSession provisioningSession = provisioningUI.getSession();
IProfileRegistry profileReg = (IProfileRegistry)provisioningSession.getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME);
IQueryable<IInstallableUnit> queryable = profileReg.getProfile(profileId);
IQuery<IInstallableUnit> query = QueryUtil.createIUAnyQuery();
IQueryResult<IInstallableUnit> result = queryable.query(query, new NullProgressMonitor());
for (final IInstallableUnit iu : result)
{
installedBundles.add(iu);
}
Collections.sort(installedBundles);
}
示例11: checkForUpdates
import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入方法依赖的package包/类
public void checkForUpdates() throws OperationCanceledException {
// 检查 propfile
String profileId = getProvisioningUI().getProfileId();
IProvisioningAgent agent = getProvisioningUI().getSession().getProvisioningAgent();
IProfile profile = null;
if (agent != null) {
IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
if (registry != null) {
profile = registry.getProfile(profileId);
}
}
if (profile == null) {
// Inform the user nicely
P2UpdateUtil.openConnectErrorInfoDialog(getShell(), P2UpdateUtil.INFO_TYPE_AUTO_CHECK);
return;
}
// 开始检查前先确定是否有repository
RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker();
if (repoMan.getKnownRepositories(getProvisioningUI().getSession()).length == 0) {
P2UpdateUtil.openConnectErrorInfoDialog(getShell(), P2UpdateUtil.INFO_TYPE_AUTO_CHECK);
return;
}
final IStatus[] checkStatus = new IStatus[1];
Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY);
final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI()) {
public IStatus runModal(IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor, P2UpdateUtil.CHECK_UPDATE_TASK_NAME, 1000);
// load repository
IStatus status = super.runModal(sub.newChild(500));
if (status.getSeverity() == IStatus.CANCEL) {
return status;
}
if (status.getSeverity() != Status.OK) {
// load repository error
checkStatus[0] = status;
}
operation = getProvisioningUI().getUpdateOperation(null, null);
// check for updates
IStatus resolveStatus = operation.resolveModal(sub.newChild(500));
if (resolveStatus.getSeverity() == IStatus.CANCEL) {
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
}
};
loadJob.setName(P2UpdateUtil.ATUO_CHECK_UPDATE_JOB_NAME);
loadJob.setProperty(LoadMetadataRepositoryJob.ACCUMULATE_LOAD_ERRORS, Boolean.toString(true));
loadJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (PlatformUI.isWorkbenchRunning())
if (event.getResult().isOK()) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
if (checkStatus[0] != null) {
// 提示连接异常
P2UpdateUtil.openConnectErrorInfoDialog(getShell(),
P2UpdateUtil.INFO_TYPE_AUTO_CHECK);
return;
}
doUpdate();
}
});
}
}
});
loadJob.setUser(true);
loadJob.schedule();
}
示例12: shouldUpdate
import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入方法依赖的package包/类
public boolean shouldUpdate() {
try {
IProvisioningAgentProvider agentProvider= Activator.getDefault().getProvisioningAgentProvider();
if (agentProvider == null) {
Activator.getDefault().logErrorStatus("Could not find a provisioning agent provider.", new RuntimeException());
return false;
}
final IProvisioningAgent agent= agentProvider.createAgent(null);
IMetadataRepositoryManager metadataRepositoryManager= (IMetadataRepositoryManager)agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
if (metadataRepositoryManager == null) {
Activator.getDefault().logErrorStatus("Could not find the meta data repository manager.", new RuntimeException());
return false;
}
IArtifactRepositoryManager artifactRepositoryManager= (IArtifactRepositoryManager)agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
if (artifactRepositoryManager == null) {
Activator.getDefault().logErrorStatus("Could not find the artifact repository manager.", new RuntimeException());
return false;
}
metadataRepositoryManager.addRepository(getUpdateSiteURI(updateSite));
artifactRepositoryManager.addRepository(getUpdateSiteURI(updateSite));
metadataRepositoryManager.loadRepository(getUpdateSiteURI(updateSite), new NullProgressMonitor());
final IProfileRegistry registry= (IProfileRegistry)agent.getService(IProfileRegistry.SERVICE_NAME);
if (registry == null) {
Activator.getDefault().logErrorStatus("Could not find the profile registry.", new RuntimeException());
return false;
}
final IProfile profile= registry.getProfile(IProfileRegistry.SELF);
if (profile == null) {
Activator.getDefault().logErrorStatus("Could not find the profile.", new RuntimeException());
return false;
}
IQuery<IInstallableUnit> query= QueryUtil.createIUQuery(pluginID);
Collection<IInstallableUnit> iusToUpdate= profile.query(query, null).toUnmodifiableSet();
ProvisioningSession provisioningSession= new ProvisioningSession(agent);
final UpdateOperation updateOperation= new UpdateOperation(provisioningSession, iusToUpdate);
IStatus modalResolution= updateOperation.resolveModal(new NullProgressMonitor());
if (modalResolution.isOK())
return true;
} catch (ProvisionException e) {
Activator.getDefault().logErrorStatus("A provisioning exception occured while checking for updates.", e);
}
return false;
}