Package org.osgi.service.prefs

Examples of org.osgi.service.prefs.Preferences


    /**
     * Gets the preferences for a user/location/customer/name combination.
     */
    private Preferences getUserPrefs(User user, URL location, String customer, String name) {
        Preferences userPrefs = m_preferences.getUserPreferences(user.getName());
        Preferences userAdminPrefs = userPrefs.node(REPOSITORY_USER_ADMIN_PREFS);
        Preferences repoPref = userAdminPrefs.node(location.getAuthority() + location.getPath());
        Preferences customerPref = repoPref.node(customer);
        return customerPref.node(name);
    }
View Full Code Here


    public SelectionToolPreferenceInitializer() {
    }

    @Override
    public void initializeDefaultPreferences() {
        Preferences node = DefaultScope.INSTANCE.getNode(SelectPlugin.ID);       
        node.putBoolean(SelectionToolPreferencePage.NAVIGATE_SELECTION,true);
    }
View Full Code Here

     * </p>
     */
    public String marshalConnectionParameters() {
        try {
            List<IGeoResource> resources = layer.getGeoResources();
            Preferences toSave = Platform.getPreferencesService().getRootNode().node(
                    ProjectPlugin.ID).node(layerIDToString());
            if (resources != LayerImpl.NULL) {
                connectionParams.clear();

                ServiceParameterPersister persister = new LayerCatalogRefPersister(
                        connectionParams, getMapFile());

                persister.store(ProgressManager.instance().get(), toSave, resources);
            }

            ByteArrayOutputStream out = new ByteArrayOutputStream();
            Platform.getPreferencesService().exportPreferences((IEclipsePreferences) toSave, out,
                    null);
            toSave.clear();

            return URLEncoder.encode(out.toString(), ENCODING);
        } catch (Throwable t) {
            ProjectPlugin
                    .log(
View Full Code Here

    private Preferences findParameterNode( IExportedPreferences paramsNode )
            throws BackingStoreException {
        String[] name = paramsNode.childrenNames();

        Preferences plugin = paramsNode.node(name[0]);
        name = plugin.childrenNames();

        return plugin.node(name[0]);
    }
View Full Code Here

            FileInputStream input = new FileInputStream(catalogLocation);
            IPreferencesService preferencesService = Platform.getPreferencesService();
            IExportedPreferences paramsNode = preferencesService.readPreferences(input);

            ServiceParameterPersister persister = new ServiceParameterPersister(this, factory, catalogLocation);
            Preferences parameterNode = findParameterNode(paramsNode);
           
            persister.restore(parameterNode);
        } catch (Throwable e) {
            CatalogPlugin.trace("Unable to restore catalog:"+e, e); //$NON-NLS-1$
            try {
View Full Code Here

     * @param e
     */
    public void loadFromFileOld(IServiceFactory factory, Throwable e) {
        IPreferencesService prefs = Platform.getPreferencesService();
        IEclipsePreferences root = prefs.getRootNode();
        Preferences node = root.node(InstanceScope.SCOPE).node(
                CatalogPlugin.ID + ".services"); //$NON-NLS-1$
        ServiceParameterPersister persister = new ServiceParameterPersister(this, factory);
        persister.restore(node);
    }
View Full Code Here

    private Preferences findParameterNode( IExportedPreferences paramsNode )
            throws BackingStoreException {
        String[] name = paramsNode.childrenNames();

        Preferences plugin = paramsNode.node(name[0]);
        name = plugin.childrenNames();

        return plugin.node(name[0]);
    }
View Full Code Here

     * @param factory
     * @param monitor
     */
    public void saveToFile( File catalogLocation, IServiceFactory factory, IProgressMonitor monitor ) {
        try {
            Preferences toSave = Platform.getPreferencesService().getRootNode().node(
                    CatalogPlugin.ID).node("LOCAL_CATALOG_SERVICES"); //$NON-NLS-1$
            if (services != null) {
                ServiceParameterPersister persister = new ServiceParameterPersister(this, factory,
                        catalogLocation.getParentFile());

                persister.store(monitor, toSave, services);
            }

            FileOutputStream out = new FileOutputStream(catalogLocation);
            Platform.getPreferencesService().exportPreferences((IEclipsePreferences) toSave, out,
                    null);
            toSave.clear();

        } catch (Throwable t) {
            CatalogPlugin.log("Error saving services for the local catalog", t); //$NON-NLS-1$
        }
    }
View Full Code Here

                             */
                            wkt = selectedCRS.toString();
                            wktText.setEditable(false);
                        }
                        wktText.setText(wkt);
                        Preferences node = findNode(matcher.group(1));
                        if( node!=null ){
                            Preferences kn = node.node(ALIASES_ID);
                            try {
                                String[] keywords=kn.keys();
                                if( keywords.length>0 ){
                                    StringBuffer buffer=new StringBuffer();
                                    for( String string : keywords ) {
                                        buffer.append(", "); //$NON-NLS-1$
                                        buffer.append(string);
View Full Code Here

        }
    }

    private Set<String> filterCustomCRSs( Set<String> descriptions, String[] searchParms ) {
        try {
            Preferences root = UiPlugin.getUserPreferences();
            Preferences node = root.node(InstanceScope.SCOPE).node(CUSTOM_ID);

            for( String id : node.childrenNames() ) {
                Preferences child = node.node(id);
                String string = child.get(NAME_ID, null);
                if (string != null && matchesFilter(string.toUpperCase(), searchParms)) {
                    descriptions.add(string);
                    continue;
                }

                Preferences aliases = child.node(ALIASES_ID);
                for( String alias : aliases.keys() ) {
                    if (matchesFilter(alias.toUpperCase(), searchParms)) {
                        descriptions.add(string);
                        continue;
                    }
                }
View Full Code Here

TOP

Related Classes of org.osgi.service.prefs.Preferences

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.