当前位置: 首页>>代码示例>>Java>>正文


Java IProfileRegistry类代码示例

本文整理汇总了Java中org.eclipse.equinox.p2.engine.IProfileRegistry的典型用法代码示例。如果您正苦于以下问题:Java IProfileRegistry类的具体用法?Java IProfileRegistry怎么用?Java IProfileRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IProfileRegistry类属于org.eclipse.equinox.p2.engine包,在下文中一共展示了IProfileRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: migratePreferences

import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入依赖的package包/类
public static void migratePreferences() {

		Preferences pref = new ProfileScope(getDefaultAgentLocation(), IProfileRegistry.SELF).getNode(P2_Activator.PLUGIN_ID);

		try {
			if (pref.keys().length == 0) {
				// migrate preferences from instance scope to profile scope
				Preferences oldPref = new InstanceScope().getNode(P2_Activator.PLUGIN_ID);
				// don't migrate everything.  Some of the preferences moved to
				// another bundle.
				pref.put(PreferenceConstants.PREF_OPEN_WIZARD_ON_ERROR_PLAN, oldPref.get(PreferenceConstants.PREF_OPEN_WIZARD_ON_ERROR_PLAN, MessageDialogWithToggle.PROMPT));
				pref.putBoolean(PreferenceConstants.PREF_SHOW_LATEST_VERSION, oldPref.getBoolean(PreferenceConstants.PREF_SHOW_LATEST_VERSION, true));
				pref.flush();
			}
		} catch (BackingStoreException e) {
			StatusManager.getManager().handle(new Status(IStatus.ERROR, P2_Activator.PLUGIN_ID, 0, ProvSDKMessages.PreferenceInitializer_Error, e), StatusManager.LOG);
		}
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:19,代码来源:PreferenceInitializer.java

示例2: 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());
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:17,代码来源:P2OperationsHandler.java

示例3: 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;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:38,代码来源:P2OperationsHandler.java

示例4: 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;

}
 
开发者ID:cplutte,项目名称:bts,代码行数:33,代码来源:UninstallSoftwareService.java

示例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, 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;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:33,代码来源:PreloadingRepositoryHandler.java

示例6: 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;
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:32,代码来源:PreloadingRepositoryHandler.java

示例7: 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;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:37,代码来源:RepositoryManager.java

示例8: 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);
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:14,代码来源:RepositoryManager.java

示例9: 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;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:31,代码来源:PreloadingRepositoryHandler.java

示例10: 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;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:38,代码来源:PreloadingRepositoryHandler.java

示例11: 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);
}
 
开发者ID:Pro-Nouns,项目名称:LinGUIne,代码行数:18,代码来源:AboutWizardPage.java

示例12: SimpleLicenseManager

import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入依赖的package包/类
public SimpleLicenseManager() {
	this(IProfileRegistry.SELF);
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:4,代码来源:SimpleLicenseManager.java

示例13: createAgent

import org.eclipse.equinox.p2.engine.IProfileRegistry; //导入依赖的package包/类
/**
 * Creates the P2 provisioning agent.
 * 
 * @param installLocation Install location or <code>null</code> to use installer agent
 * @param monitor Progress monitor or <code>null</code>
 * @return Provisioning agent or <code>null</code>
 */
public IProvisioningAgent createAgent(IPath installLocation, IProgressMonitor monitor) throws CoreException {
	try {
		boolean locationChanged = false;
		if ((installLocation != null) && !installLocation.equals(getInstallLocation())) {
			locationChanged = true;
		}
		
		// Agent not created or install location has changed
		if ((agent == null) || locationChanged) {
			this.installLocation = installLocation;

			if (monitor == null)
				monitor = new NullProgressMonitor();
			
			// Clear plan cache
			planCache.clear();
			
			// Start P2 agent
			agent = startAgent(getAgentLocation());
			// Setup certificate handling
			agent.registerService(UIServices.SERVICE_NAME, AuthenticationService.getDefault());
			// Meta-data repository manager
			metadataRepoMan = (IMetadataRepositoryManager)agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
			// Artifact repository manager
			artifactRepoMan = (IArtifactRepositoryManager)agent.getService(IArtifactRepositoryManager.SERVICE_NAME);

			IInstallDescription installDescription = Installer.getDefault().getInstallManager().getInstallDescription();
			
			if (installDescription != null) {
				// Initialize the profile identifier
				profileId = Installer.getDefault().getInstallManager().getInstallDescription().getProfileName();
				// If no profile specified, use the first installed profile
				if (profileId == null) {
					IProfileRegistry profileRegistry = (IProfileRegistry)getAgent().getService(IProfileRegistry.SERVICE_NAME);
					IProfile[] profiles = profileRegistry.getProfiles();
					if (profiles.length > 0) {
						profileId = profiles[0].getProfileId();
					}
				}

				// Initialize product repository if required
				if (productRepository != null) {
					productRepository.dispose();
				}
				if (installDescription.getProductRoot()) {
					productRepository = new ProductRepository(agent);
					productRepository.createRepository();
				}
			}
		}
	}
	catch (Exception e) {
		Installer.fail(e.getLocalizedMessage());
	}
	
	return agent;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:65,代码来源:RepositoryManager.java

示例14: 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();
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:71,代码来源:AutomaticUpdate.java

示例15: 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;
}
 
开发者ID:ChangeOrientedProgrammingEnvironment,项目名称:eclipseRecorder,代码行数:60,代码来源:BundleUpdater.java


注:本文中的org.eclipse.equinox.p2.engine.IProfileRegistry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。