org.eclipse.equinox.p2.query.QueryUtil Java Examples

The following examples show how to use org.eclipse.equinox.p2.query.QueryUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InstallationChecker.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
public boolean isFeatureInstalled(String featureId) {
	try {
		IProvisioningAgent agent = agentProvider.get();
		IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
		IProfile selfProfile = profileRegistry.getProfile(IProfileRegistry.SELF);
		if(selfProfile == null)
			return true;
		Set<IInstallableUnit> installed = selfProfile
				.available(QueryUtil.createIUQuery(featureId), new NullProgressMonitor()).toUnmodifiableSet();
		agent.stop();
		return !installed.isEmpty();
	} catch (ProvisionException e) {
		e.printStackTrace();
	}
	return false;
}
 
Example #2
Source File: ElexisCloudPolicy.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public void updateForPreferences(){
	
	IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
	setRepositoriesVisible(prefs.getBoolean(PreferenceConstants.REPOSITORIES_VISIBLE));
	setRestartPolicy(prefs.getInt(PreferenceConstants.RESTART_POLICY));
	setShowLatestVersionsOnly(prefs.getBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY));
	setGroupByCategory(prefs.getBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY));
	setShowDrilldownRequirements(prefs
		.getBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS));
	setFilterOnEnv(prefs.getBoolean(PreferenceConstants.FILTER_ON_ENV));
	setUpdateWizardStyle(prefs.getInt(PreferenceConstants.UPDATE_WIZARD_STYLE));
	int preferredWidth = prefs.getInt(PreferenceConstants.UPDATE_DETAILS_WIDTH);
	int preferredHeight = prefs.getInt(PreferenceConstants.UPDATE_DETAILS_HEIGHT);
	setUpdateDetailsPreferredSize(new Point(preferredWidth, preferredHeight));
	
	if (prefs.getBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES))
		setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS);
	else
		setVisibleAvailableIUQuery(QueryUtil.createIUGroupQuery());
	if (prefs.getBoolean(PreferenceConstants.INSTALLED_SHOW_ALL_BUNDLES))
		setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS);
	else
		setVisibleAvailableIUQuery(new UserVisibleRootQuery());
	setContactAllSites(false);
}
 
Example #3
Source File: Processor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private void processInternal ( final IProgressMonitor pm ) throws ProvisionException, Exception
{
    this.output.mkdirs ();

    System.out.println ( "Loading metadata..." );
    this.metaRepo = this.metaManager.loadRepository ( this.repositoryLocation, pm );
    System.out.println ( "Loading artifacts..." );
    this.artRepo = this.artManager.loadRepository ( this.repositoryLocation, pm );
    System.out.println ( "done!" );

    for ( final URI uri : this.validationRepositoryUris )
    {
        System.out.format ( "Loading validation repository: %s%n", uri );
        final IMetadataRepository repo = this.metaManager.loadRepository ( uri, pm );
        this.validationRepositories.put ( uri, repo );
        System.out.println ( "Done!" );
    }

    final IQuery<IInstallableUnit> query = QueryUtil.createIUAnyQuery ();
    final IQueryResult<IInstallableUnit> result = this.metaRepo.query ( query, pm );

    for ( final IInstallableUnit iu : result )
    {
        processUnit ( iu, pm );
    }

    writeUploadScript ();

    for ( final Map.Entry<MavenReference, Set<String>> entry : this.metadata.entrySet () )
    {
        writeMetaData ( entry.getKey (), entry.getValue () );
    }
}
 
Example #4
Source File: Processor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public void process ( final IProgressMonitor pm ) throws Exception
{
    this.output.mkdirs ();

    System.out.println ( "Loading metadata..." );
    this.metaRepo = this.metaManager.loadRepository ( this.repositoryLocation, pm );
    System.out.println ( "Loading artifacts..." );
    this.artRepo = this.artManager.loadRepository ( this.repositoryLocation, pm );
    System.out.println ( "done!" );

    for ( final URI uri : this.validationRepositoryUris )
    {
        System.out.format ( "Loading validation repository: %s%n", uri );
        final IMetadataRepository repo = this.metaManager.loadRepository ( uri, pm );
        this.validationRepositories.put ( uri, repo );
        System.out.println ( "Done!" );
    }

    final IQuery<IInstallableUnit> query = QueryUtil.createIUAnyQuery ();
    final IQueryResult<IInstallableUnit> result = this.metaRepo.query ( query, pm );

    for ( final IInstallableUnit iu : result )
    {
        processUnit ( iu, pm );
    }

    writeUploadScript ();

    for ( final Map.Entry<MavenReference, Set<String>> entry : this.metadata.entrySet () )
    {
        writeMetaData ( entry.getKey (), entry.getValue () );
    }

}