本文整理汇总了Java中org.eclipse.core.runtime.preferences.IEclipsePreferences.get方法的典型用法代码示例。如果您正苦于以下问题:Java IEclipsePreferences.get方法的具体用法?Java IEclipsePreferences.get怎么用?Java IEclipsePreferences.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.preferences.IEclipsePreferences
的用法示例。
在下文中一共展示了IEclipsePreferences.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
示例2: 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;
}
示例3: 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);
}
}
}
示例4: 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;
}
}
示例5: readProjectRootFile
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
* Retrieves project root file name
* @param project
* @return
*/
public static IFile readProjectRootFile(IProject project) {
final IEclipsePreferences projectPrefs = getProjectPreferences(project);
if (projectPrefs != null) {
String rootFileName = projectPrefs.get(IPreferenceConstants.P_PROJECT_ROOT_FILE,
IPreferenceConstants.DEFAULT_NOT_SET);
if (!IPreferenceConstants.DEFAULT_NOT_SET.equals(rootFileName)) {
final IPath path = new Path(rootFileName);
if (path.isAbsolute()) {
// Convert a legacy (absolute) path to the new relative one
// with the magic PARENT_PROJECT_LOC prefix.
rootFileName = ResourceHelper.PARENT_ONE_PROJECT_LOC + path.lastSegment();
convertAbsoluteToRelative(projectPrefs, rootFileName);
}
final IFile linkedFile = ResourceHelper.getLinkedFile(project, rootFileName);
Activator.getDefault().logDebug(
"footFileName = " + (linkedFile != null ? linkedFile.getLocation().toOSString() : null));
return linkedFile;
}
} else {
Activator.getDefault().logInfo("projectPrefs is null");
}
return null;
}
示例6: computeOneXmlIndentString
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
private String computeOneXmlIndentString() {
char indentChar = ' ';
IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(XMLCorePlugin.DEFAULT_CATALOG_ID);
String indentCharPref = prefs.get(XMLCorePreferenceNames.INDENTATION_CHAR, null);
if (XMLCorePreferenceNames.TAB.equals(indentCharPref)) {
indentChar = '\t';
}
int indentationWidth = prefs.getInt(XMLCorePreferenceNames.INDENTATION_SIZE, 0);
StringBuilder indent = new StringBuilder();
for (int i = 0; i < indentationWidth; i++) {
indent.append(indentChar);
}
return indent.toString();
}
示例7: performDefaults
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Override
protected void performDefaults() {
IEclipsePreferences preferences = getPreferences(false);
String defPath = preferences.get(ProjectProperties.KEY_DEFAULT_DESTINATION, "");
IPath projectPath = project.getLocation();
IPath path = pathVariableHelper.resolveVariable(defPath, projectPath);
if (path == null) {
destPathDialogField.setText("");
} else {
destPathDialogField.setText(path.toOSString());
}
IPath variables = readVariablesPath(preferences);
if (path == null) {
variablesDialogField.setText("");
} else {
variablesDialogField.setText(variables.toPortableString());
}
}
示例8: start
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
final IEclipsePreferences node = getPreferencesRootNode();
repoSvc = new WorkflowRepositoryServiceImpl(node.get(REPOSITORY_LOCATION_PREFNAME, REPOSITORY_LOCATION_DEFVALUE));
preferenceChangeListener = new IPreferenceChangeListener() {
@Override
public void preferenceChange(PreferenceChangeEvent event) {
if(REPOSITORY_LOCATION_PREFNAME.equals(event.getKey()) && (repoSvc != null)) {
// it seems that when you Restore Defaults for preferences, this gives a new value null i.o. the default value!
String newValue = (event.getNewValue()!=null)? (String) event.getNewValue() : REPOSITORY_LOCATION_DEFVALUE;
repoSvc.setRootFolder(new File(newValue));
}
}
};
node.addPreferenceChangeListener(preferenceChangeListener);
Hashtable<String, String> svcProps = new Hashtable<>();
svcProps.put("type", "FILE");
repoSvcReg = context.registerService(WorkflowRepositoryService.class, repoSvc, svcProps);
}
示例9: setProjectProps
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public void setProjectProps(ProjectProperties props) throws IllegalArgumentException {
projectProps = props;
mappings = props.getMappings();
if (mappings == null || mappings.length == 0) {
throw new IllegalArgumentException("FileSync mapping is missing."
+ " Don't panic, simply call your project owner.");
}
IEclipsePreferences preferences = props.getPreferences(false);
String root = preferences.get(ProjectProperties.KEY_DEFAULT_DESTINATION, "");
PathVariableHelper pvh = new PathVariableHelper();
IPath projectPath = props.getProject().getLocation();
rootPath = pvh.resolveVariable(root, projectPath);
if ((rootPath == null || rootPath.isEmpty()) && usesDefaultOutputFolder()) {
throw new IllegalArgumentException("Default target folder is required"
+ " by one of mappings but not specified in properties!");
}
setDeleteDestinationOnCleanBuild(preferences.getBoolean(
ProjectProperties.KEY_CLEAN_ON_CLEAN_BUILD, false));
useCurrentDateForDestinationFiles = preferences.getBoolean(
ProjectProperties.KEY_USE_CURRENT_DATE, false);
}
示例10: setNodePreferences
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
* Read and setup node rendering preferences.
* Most are now ViewDoc preferences.
*/
private void setNodePreferences() {
IEclipsePreferences node = PreferencesIds.getInstanceNode();
NodeColorPlugin nodeColor = getNodeColor();
// set color mode color
String label = node.get(NodePreferencesIds.NODE_COLOR, null);
try {
NodeColorMode mode =
ViewExtensionRegistry.getRegistryGetNodeColorMode(label);
nodeColor.setNodeColorMode(mode);
} catch (IllegalArgumentException ex) {
// bad node rendering option. ignore.
System.err.println("Bad node rendering option (color) in preferences.");
}
}
示例11: loadSettings
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public T loadSettings(final Class<?> settingsTypeClass) {
IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(prefereneceId);
Gson gson = new Gson();
String keyValue = preferences.get(preferenceKey, null);
if (keyValue != null) {
return (T) gson.fromJson(keyValue, settingsTypeClass );
}
return null;
}
示例12: getValues
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
* Return the the preference values for the passed project and key
*
* @param project
* @param key
* @return
*/
public static String[] getValues(IProject project, String key, boolean projectScoped) {
IEclipsePreferences projectPreferences = null;
if (projectScoped) {
projectPreferences = getProjectPreference(project);
} else {
projectPreferences = getGlobalPreference();
}
String values = projectPreferences.get(key, "");
if ((values == null) || (values.trim().length() == 0) && projectScoped) {
IEclipsePreferences globalPreferences = getGlobalPreference();
values = globalPreferences.get(key, "");
final String gloablValues = values;
Job job = new WorkspaceJob("GW4E Configure Project Preference Job") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
SubMonitor subMonitor = SubMonitor.convert(monitor, 60);
try {
putValues(project, key, fromString(gloablValues), projectScoped);
return Status.OK_STATUS;
} catch (Exception e) {
ResourceManager.logException(e);
return Status.CANCEL_STATUS;
} finally {
subMonitor.done();
}
}
};
job.setRule(project);
job.setUser(true);
job.schedule();
}
String[] ret = fromString(values);
return ret;
}
示例13: testRemove
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Test
public void testRemove() throws Exception {
IJavaProject pj = ProjectHelper.getOrCreateSimpleGW4EProject(PROJECT_NAME, false, false);
String[] values = new String[] { PreferenceManager.SUFFIX_PREFERENCE_FOR_TEST_IMPLEMENTATION };
SettingsManager.remove(pj.getProject(), values);
IScopeContext context = new ProjectScope(pj.getProject());
IEclipsePreferences projectPreferences = context.getNode(Activator.PLUGIN_ID);
String val = projectPreferences.get(PreferenceManager.SUFFIX_PREFERENCE_FOR_TEST_IMPLEMENTATION, "");
assertEquals("", val);
}
示例14: diff
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public void diff() {
Log.log(Log.LOG_INFO, "Started DB update"); //$NON-NLS-1$
if (warnCheckedElements() < 1 ||
!OpenProjectUtils.checkVersionAndWarn(proj.getProject(), parent.getShell(), true)) {
return;
}
IEclipsePreferences pref = proj.getPrefs();
final Differ differ = new Differ(dbRemote.getDbObject(),
dbProject.getDbObject(), diffTree.getRevertedCopy(), false,
pref.get(PROJ_PREF.TIMEZONE, ApgdiffConsts.UTC));
differ.setAdditionalDepciesSource(manualDepciesSource);
differ.setAdditionalDepciesTarget(manualDepciesTarget);
Job job = differ.getDifferJob();
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
Log.log(Log.LOG_INFO, "Differ job finished with status " + //$NON-NLS-1$
event.getResult().getSeverity());
if (event.getResult().isOK()) {
UiSync.exec(parent, () -> {
if (!parent.isDisposed()) {
try {
showEditor(differ);
} catch (PartInitException ex) {
ExceptionNotifier.notifyDefault(
Messages.ProjectEditorDiffer_error_opening_script_editor, ex);
}
}
});
}
}
});
job.setUser(true);
job.schedule();
}
示例15: readExportDataDefaultPathFromFile
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
private String readExportDataDefaultPathFromFile() {
IScopeContext context = InstanceScope.INSTANCE;
IEclipsePreferences eclipsePreferences = context.getNode(Activator.PLUGIN_ID);
String exportDataDefaultpath = eclipsePreferences.get(EXPORT_DATA_DEFAULT_PATH, DEFAULT);
exportDataDefaultpath = exportDataDefaultpath.equalsIgnoreCase(DEFAULT) ? " " : exportDataDefaultpath;
return exportDataDefaultpath;
}