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


Java IEclipsePreferences类代码示例

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


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

示例1: save

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
@Override
public IStatus save() {
	try {
		final IEclipsePreferences node = InstanceScope.INSTANCE.getNode(QUALIFIER);
		for (final Entry<Binary, URI> entry : getOrCreateState().entrySet()) {
			final URI path = entry.getValue();
			if (null != path) {
				final File file = new File(path);
				if (file.isDirectory()) {
					node.put(entry.getKey().getId(), file.getAbsolutePath());
				}
			} else {
				// Set to default.
				node.put(entry.getKey().getId(), "");
			}
		}
		node.flush();
		return OK_STATUS;
	} catch (final BackingStoreException e) {
		final String message = "Unexpected error when trying to persist binary preferences.";
		LOGGER.error(message, e);
		return statusHelper.createError(message, e);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:25,代码来源:OsgiBinariesPreferenceStore.java

示例2: getChangeListener

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
/**
 * return the listener for preferences changes.
 * @return the change listener
 */
private IEclipsePreferences.IPreferenceChangeListener getChangeListener() {
	if (changeListener==null) {
		changeListener = new IEclipsePreferences.IPreferenceChangeListener() {
			@Override
			public void preferenceChange(PreferenceChangeEvent pce) {
				
				if (debug==true) System.out.println("Property '" + pce.getKey() + "' changed from " + pce.getOldValue() + " to "+ pce.getNewValue());
				
				switch(pce.getKey()) {
				case DEF_RUNAS:
					boolean changedExecutionMode = (pce.getOldValue()!=null && pce.getNewValue()!=pce.getOldValue());
					if (changedExecutionMode==true) {
						if (debug==true) System.out.println("Changed Execution Mode: changed from " + pce.getOldValue() + " to "+ pce.getNewValue());
						//TODO if the preference dialog was set to SWT!
					}
				}
			}
		};
	}
	return changeListener;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:26,代码来源:BundleProperties.java

示例3: build

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
@Override
protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args,
		IProgressMonitor monitor) throws CoreException {
	ProjectScope projectScope = new ProjectScope(getProject());
	IEclipsePreferences prefs = projectScope.getNode(BUILDER_ID);
	if (kind == FULL_BUILD) {
		fullBuild(prefs, monitor);
	} else {
		IResourceDelta delta = getDelta(getProject());
		if (delta == null) {
			fullBuild(prefs, monitor);
		} else {
			incrementalBuild(delta, prefs, monitor);
		}
	}
	return null;
}
 
开发者ID:mnlipp,项目名称:EclipseMinifyBuilder,代码行数:18,代码来源:MinifyBuilder.java

示例4: GccMinifier

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
public GccMinifier(MinifyBuilder builder, IFile srcFile, IFile destFile, 
		OutputStream out, IEclipsePreferences prefs)
	throws IOException, CoreException {
	super(builder);
	this.srcFile = srcFile;
	this.out = out;
	this.outCharset = destFile.exists() ? destFile.getCharset() : "ascii";
	console = builder.minifierConsole();

	String optLevel = prefs.get(PrefsAccess.preferenceKey(
			srcFile, MinifyBuilder.GCC_OPTIMIZATION),
			MinifyBuilder.GCC_OPT_WHITESPACE_ONLY);
	switch (optLevel) {
	case MinifyBuilder.GCC_OPT_ADVANCED:
		compilationLevel = CompilationLevel.ADVANCED_OPTIMIZATIONS;
		break;
	case MinifyBuilder.GCC_OPT_SIMPLE:
		compilationLevel = CompilationLevel.SIMPLE_OPTIMIZATIONS;
		break;
	default:
		compilationLevel = CompilationLevel.WHITESPACE_ONLY;
	}
}
 
开发者ID:mnlipp,项目名称:EclipseMinifyBuilder,代码行数:24,代码来源:GccMinifier.java

示例5: loadInternal

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
@Override
protected PgDatabase loadInternal(SubMonitor monitor)
        throws IOException, InterruptedException, CoreException {
    String charset = proj.getProjectCharset();
    monitor.subTask(Messages.dbSource_loading_tree);
    IProject project = proj.getProject();

    int filesCount = PgUIDumpLoader.countFiles(project);
    monitor.setWorkRemaining(filesCount);

    IEclipsePreferences pref = proj.getPrefs();
    return PgUIDumpLoader.loadDatabaseSchemaFromIProject(
            project.getProject(),
            getPgDiffArgs(charset, pref.getBoolean(PROJ_PREF.FORCE_UNIX_NEWLINES, true)),
            monitor, null, errors);
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:17,代码来源:DbSource.java

示例6: getCurrentDb

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
public DbInfo getCurrentDb() {
    if (currentDB != null) {
        return currentDB;
    }

    IResource res = ResourceUtil.getResource(getEditorInput());
    if (res != null) {
        IEclipsePreferences prefs = PgDbProject.getPrefs(res.getProject());
        if (prefs != null) {
            List<DbInfo> lastStore = DbInfo.preferenceToStore(
                    prefs.get(PROJ_PREF.LAST_DB_STORE_EDITOR, "")); //$NON-NLS-1$
            if (!lastStore.isEmpty()) {
                return lastStore.get(0);
            }
        }
    }
    return null;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:19,代码来源:SQLEditor.java

示例7: getViewDataPreferencesFromPreferenceFile

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
/**
 * 
 * Get data viewer preferences from preference file
 * 
 * @return {@link ViewDataPreferencesVO}
 */
public ViewDataPreferencesVO getViewDataPreferencesFromPreferenceFile() {
	boolean includeHeaderValue = false;
	IEclipsePreferences eclipsePreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
	String delimiter = eclipsePreferences.get(DELIMITER, DEFAULT);
	String quoteCharactor = eclipsePreferences.get(QUOTE_CHARACTOR, DEFAULT);
	String includeHeader = eclipsePreferences.get(INCLUDE_HEADERS, DEFAULT);
	String fileSize = eclipsePreferences.get(FILE_SIZE, DEFAULT);
	String pageSize = eclipsePreferences.get(PAGE_SIZE, DEFAULT);
	delimiter = delimiter.equalsIgnoreCase(DEFAULT) ? DEFAULT_DELIMITER : delimiter;
	quoteCharactor = quoteCharactor.equalsIgnoreCase(DEFAULT) ? DEFAULT_QUOTE_CHARACTOR : quoteCharactor;
	includeHeaderValue = includeHeader.equalsIgnoreCase(DEFAULT) ? true : false;
	fileSize = fileSize.equalsIgnoreCase(DEFAULT) ? DEFAULT_FILE_SIZE : fileSize;
	pageSize = pageSize.equalsIgnoreCase(DEFAULT) ? DEFAULT_PAGE_SIZE : pageSize;
	ViewDataPreferencesVO viewDataPreferencesVO = new ViewDataPreferencesVO(delimiter, quoteCharactor,
			includeHeaderValue, Integer.parseInt(fileSize), Integer.parseInt(pageSize));
	return viewDataPreferencesVO;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:24,代码来源:DebugDataViewer.java

示例8: loadThemesFromPreferences

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
/**
 * Load TextMate Themes from preferences.
 */
private void loadThemesFromPreferences() {
	// Load Theme definitions from the
	// "${workspace_loc}/metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.tm4e.ui.prefs"
	IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(TMUIPlugin.PLUGIN_ID);
	String json = prefs.get(PreferenceConstants.THEMES, null);
	if (json != null) {
		ITheme[] themes = PreferenceHelper.loadThemes(json);
		for (ITheme theme : themes) {
			super.registerTheme(theme);
		}
	}

	json = prefs.get(PreferenceConstants.THEME_ASSOCIATIONS, null);
	if (json != null) {
		IThemeAssociation[] themeAssociations = PreferenceHelper.loadThemeAssociations(json);
		for (IThemeAssociation association : themeAssociations) {
			super.registerThemeAssociation(association);
		}
	}
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:24,代码来源:ThemeManager.java

示例9: save

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
@Override
public void save() throws BackingStoreException {
	// Save Themes in the
	// "${workspace_loc}/metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.tm4e.ui.prefs"
	String json = PreferenceHelper.toJsonThemes(
			Arrays.stream(getThemes()).filter(t -> t.getPluginId() == null).collect(Collectors.toList()));
	IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(TMUIPlugin.PLUGIN_ID);
	prefs.put(PreferenceConstants.THEMES, json);

	// Save Theme associations in the
	// "${workspace_loc}/metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.tm4e.ui.prefs"
	json = PreferenceHelper.toJsonThemeAssociations(Arrays.stream(getAllThemeAssociations())
			.filter(t -> t.getPluginId() == null).collect(Collectors.toList()));
	prefs.put(PreferenceConstants.THEME_ASSOCIATIONS, json);

	// Save preferences
	prefs.flush();
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:19,代码来源:ThemeManager.java

示例10: updateConfigurationFromSettings

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
private static boolean updateConfigurationFromSettings(AsciidocConfiguration configuration, IProject project) {
	final IScopeContext projectScope = new ProjectScope(project);
	IEclipsePreferences preferences = projectScope.getNode(Activator.PLUGIN_ID);
	try {
		createSettings(project, BACKEND_DEFAULT, RESOURCESPATH_DEFAULT, SOURCESPATH_DEFAULT, STYLESHEETPATH_DEFAULT, TARGETPATH_DEFAULT);
		configuration.setBackend(preferences.get(BACKEND_PROPERTY, BACKEND_DEFAULT));
		configuration.setResourcesPath(preferences.get(RESOURCESPATH_PROPERTY, RESOURCESPATH_DEFAULT));
		configuration.setSourcesPath(preferences.get(SOURCESPATH_PROPERTY, SOURCESPATH_DEFAULT));
		configuration.setStylesheetPath(preferences.get(STYLESHEETPATH_PROPERTY, STYLESHEETPATH_DEFAULT));
		configuration.setTargetPath(preferences.get(TARGETPATH_PROPERTY, TARGETPATH_DEFAULT));
	} catch (BackingStoreException e) {
		Activator.getDefault().getLog().log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, e.getMessage(), e));
		return false;
	}
	configuration.source = AsciidocConfigurationSource.SETTINGS;
	return true;
}
 
开发者ID:awltech,项目名称:eclipse-asciidoctools,代码行数:18,代码来源:AsciidocConfiguration.java

示例11: added

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
public void added(NodeChangeEvent event) {
  synchronized (lock) {
    // It's possible that we've stopped recording, but the listeners have
    // not yet been removed.
    // Ensure that we're still recording before writing new data
    if (currState != State.RECORDING) {
      return;
    }

    IEclipsePreferences childPrefs = (IEclipsePreferences) event.getChild();
    addListener(childPrefs);

    changeLog.add(new NodeChanged(true, new Path(event.getParent().absolutePath()), 
        event.getChild().name()));
  }
}
 
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:17,代码来源:PreferenceRecorder.java

示例12: testCompositeReconcilerReconciles

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
public void testCompositeReconcilerReconciles() throws Exception {

    IEclipsePreferences root = mock(IEclipsePreferences.class);
    IEclipsePreferences wee = mock(IEclipsePreferences.class);

    when(root.node(WEE.getPath()))
        .thenReturn(wee);

    // should return an incorrect value
    when(wee.get(WEE.getKey(), null))
        .thenReturn(HAA.getValue());

    // It's a weird idiom, but we have to call this method before the
    // replay so that easy-mock will be aware of the fact that we will
    // be calling it after the replay. Else we get an exception.
    wee.put(WEE.getKey(), WEE.getValue());

    // needs reconciliation
    Reconciler reconciler = new CompositeReconciler(root, HAA,
        new EqualsMatcher(WEE), new SimpleResolver(WEE));

    assertFalse(reconciler.isReconciled());
    reconciler.reconcile(); // causes wee.put to be called.

    verify(wee).flush();
  }
 
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:27,代码来源:PreferenceReconcilerTaskTest.java

示例13: testProjectSavedInPreferencesSelected

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
@Test
public void testProjectSavedInPreferencesSelected()
    throws ProjectRepositoryException, InterruptedException, BackingStoreException {
  IEclipsePreferences node =
      new ProjectScope(project).getNode(DeployPreferences.PREFERENCE_STORE_QUALIFIER);
  try {
    node.put("project.id", "projectId1");
    node.put("account.email", EMAIL_1);
    model = new DeployPreferences(project);

    initializeProjectRepository();
    when(loginService.getAccounts()).thenReturn(twoAccountSet);
    deployPanel = createPanel(true /* requireValues */);
    deployPanel.latestGcpProjectQueryJob.join();

    ProjectSelector projectSelector = getProjectSelector();
    IStructuredSelection selection = projectSelector.getViewer().getStructuredSelection();
    assertThat(selection.size(), is(1));
    assertThat(((GcpProject) selection.getFirstElement()).getId(), is("projectId1"));
  } finally {
    node.clear();
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:24,代码来源:AppEngineDeployPreferencesPanelTest.java

示例14: getConfigEclipse

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
private  Map<ConfigTypes, String> getConfigEclipse(IEclipsePreferences pref ) {
    Map<ConfigTypes, String> ret = new HashMap<ConfigTypes, String>();
    for (ConfigTypes k:ConfigTypes.values()){
        if (defaults.containsKey(k))
            ret.put(k,defaults.get(k));
        else
            ret.put(k,"");
    }

    try {
        for (String configKey : pref.keys()) {
            for (ConfigTypes c : configKeys.keySet()) {
                if (configKey.equals(configKeys.get(c))){
                    ret.put(c, pref.get(configKey, ""));
                }
            }
        }
    } catch (BackingStoreException e) {
    }


    return ret;
}
 
开发者ID:Ericsson,项目名称:CodeCheckerEclipsePlugin,代码行数:24,代码来源:CcConfiguration.java

示例15: getDefault

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入依赖的package包/类
/**
 * Does its best at determining the default value for the given key. Checks
 * the given object's type and then looks in the list of defaults to see if
 * a value exists. If not or if there is a problem converting the value, the
 * default default value for that type is returned.
 *
 * @param key
 *          the key to search
 * @param object
 *          the object who default we are looking for
 * @return Object or <code>null</code>
 */
Object getDefault(final String key, final Object object) {
  final IEclipsePreferences defaults = getDefaultPreferences();
  if (object instanceof String) {
    return defaults.get(key, STRING_DEFAULT_DEFAULT);
  } else if (object instanceof Integer) {
    return Integer.valueOf(defaults.getInt(key, INT_DEFAULT_DEFAULT));
  } else if (object instanceof Double) {
    return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT));
  } else if (object instanceof Float) {
    return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT));
  } else if (object instanceof Long) {
    return Long.valueOf(defaults.getLong(key, LONG_DEFAULT_DEFAULT));
  } else if (object instanceof Boolean) {
    return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE;
  } else {
    return null;
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:31,代码来源:ValidPreferenceStore.java


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