org.eclipse.core.runtime.Platform.getPreferencesService()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(191)

本文整理了Java中org.eclipse.core.runtime.Platform.getPreferencesService()方法的一些代码示例,展示了Platform.getPreferencesService()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Platform.getPreferencesService()方法的具体详情如下:
包路径:org.eclipse.core.runtime.Platform
类名称:Platform
方法名:getPreferencesService

Platform.getPreferencesService介绍

[英]Return the interface into the preference mechanism. The returned object can be used for such operations as searching for preference values across multiple scopes and preference import/export.

Clients are also able to acquire the IPreferencesService service via OSGi mechanisms and use it for preference functions.
[中]将接口返回到首选项机制中。返回的对象可用于跨多个作用域搜索首选项值和首选项导入/导出等操作。
客户端还可以通过OSGi机制获取IPReferenceService服务,并将其用于首选功能。

代码示例

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

public static String getDefaultLineDelimiter() {
    return Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null,
        null);
  }
}

代码示例来源:origin: org.eclipse.xtext/ui

protected String getLineSeparatorPreference(IScopeContext scopeContext) {
    String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME,
        Platform.PREF_LINE_SEPARATOR, null, new IScopeContext[] { scopeContext });
    return lineDelimiter;
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jsch.core

public static String getSelectedSSHAgent(){
 IPreferencesService service = Platform.getPreferencesService();
 return service.getString(JSchCorePlugin.ID,
   IConstants.PREF_PREFERRED_SSHAGENT, "", null); //$NON-NLS-1$
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

public static boolean isEnabled() {
  IPreferencesService preferenceService = Platform.getPreferencesService();
  if (preferenceService == null) {
    return true;
  }
  return preferenceService.getBoolean(JavaCore.PLUGIN_ID, ENABLE_NEW_JAVA_INDEX, ENABLE_NEW_JAVA_INDEX_DEFAULT,
      null);
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

/**
 * Amount of time (milliseconds) unreferenced files are allowed to sit in the index before they are discarded.
 * Making this too short will cause some operations (classpath modifications, closing/reopening projects, etc.)
 * to become more expensive. Making this too long will waste space in the database.
 * <p>
 * The value of this is stored in the JDT core preference called "garbageCleanupTimeoutMs". The default value
 * is 3 days.
 */
private static long getGarbageCleanupTimeout() {
  return Platform.getPreferencesService().getLong(JavaCore.PLUGIN_ID, "garbageCleanupTimeoutMs", //$NON-NLS-1$
      1000 * 60 * 60 * 24 * 3,
      null);
}

代码示例来源:origin: org.eclipse.neoscada.utils/org.eclipse.scada.ui.localization

public static TimeZone getTimeZone ()
  {
    final IScopeContext[] scopeContext = new IScopeContext[] { ConfigurationScope.INSTANCE };
    final String tzId = Platform.getPreferencesService ().getString ( PLUGIN_ID, TIME_ZONE_KEY, TimeZone.getDefault ().getID (), scopeContext );
    if ( Arrays.asList ( TimeZone.getAvailableIDs () ).contains ( tzId ) )
    {
      return TimeZone.getTimeZone ( tzId );
    }
    return TimeZone.getDefault ();
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jsch.core

boolean isUseProxy(){
 IPreferencesService ps=Platform.getPreferencesService();
 String value=ps.get(IConstants.PREF_USE_PROXY,
   "false", getProxyPreferenceStore()); //$NON-NLS-1$
 return value==null ? false : !value.equals("false"); //$NON-NLS-1$
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

public TextSearchVisitor(TextSearchRequestor collector, Pattern searchPattern) {
  fCollector= collector;
  fStatus = new MultiStatus(IConstants.PLUGIN_ID, IStatus.OK, "Problems encountered during text search.", null);
  fSearchPattern= searchPattern;
  fIsLightweightAutoRefresh= Platform.getPreferencesService().getBoolean(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, false, null);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jsch.core

public static String getMethodsOrder(){
 IPreferencesService service = Platform.getPreferencesService();
 return service.getString(JSchCorePlugin.ID,
   IConstants.PREF_PREFERRED_AUTHENTICATION_METHODS_ORDER, getDefaultAuthMethods(), null);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.trace

/**
 * Is tracing enabled in the preferences store
 *
 * @return <code>true</code> if tracing is enabled in the preferences; Otherwise, <code>false</code> is returned.
 */
public static boolean isTracingEnabled() {
  final IScopeContext[] lookupOrder = new IScopeContext[] { InstanceScope.INSTANCE };
  IPreferencesService prefService = Platform.getPreferencesService();
  prefService.setDefaultLookupOrder(TracingConstants.BUNDLE_ID, null, new String[] {InstanceScope.SCOPE});
  return prefService.getBoolean(TracingConstants.BUNDLE_ID, TracingConstants.PREFERENCE_ENABLEMENT_IDENTIFIER, false, lookupOrder);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.trace

/**
 * Accessor for the output to standard output stream selection in the preference store
 *
 * @return The output to standard output stream selection in the preference store or the default value if it's not defined.
 */
public static String getOutputToStandardStream() {
  final IScopeContext[] lookupOrder = new IScopeContext[] { InstanceScope.INSTANCE };
  IPreferencesService prefService = Platform.getPreferencesService();
  prefService.setDefaultLookupOrder(TracingConstants.BUNDLE_ID, null, new String[] {InstanceScope.SCOPE});
  return prefService.getString(TracingConstants.BUNDLE_ID, TracingConstants.PREFERENCE_OUTPUT_STANDARD_STREAM, "false", lookupOrder); //$NON-NLS-1$
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jsch.core

public static String getEnabledPreferredKEXMethods(){
 IPreferencesService service = Platform.getPreferencesService();
 return service.getString(JSchCorePlugin.ID,
   IConstants.PREF_PREFERRED_KEYEXCHANGE_METHODS, getDefaultKEXMethods(), null);
}

代码示例来源:origin: org.eclipse.ui/trace

/**
 * Accessor for the maximum file count in the preference store
 * 
 * @return The maximum file count in the preference store or the value 10 if it's not defined.
 */
public static int getMaxFileCount() {
  final IScopeContext[] lookupOrder = new IScopeContext[] {new InstanceScope()};
  IPreferencesService prefService = Platform.getPreferencesService();
  prefService.setDefaultLookupOrder(TracingConstants.BUNDLE_ID, null, new String[] {InstanceScope.SCOPE});
  return prefService.getInt(TracingConstants.BUNDLE_ID, TracingConstants.PREFERENCE_MAX_FILE_COUNT_IDENTIFIER, 10, lookupOrder);
}

代码示例来源:origin: org.eclipse.ui/trace

/**
 * Accessor for the maximum file size in the preference store
 * 
 * @return The maximum file size in the preference store or the value 1000 if it's not defined.
 */
public static int getMaxFileSize() {
  final IScopeContext[] lookupOrder = new IScopeContext[] {new InstanceScope()};
  IPreferencesService prefService = Platform.getPreferencesService();
  prefService.setDefaultLookupOrder(TracingConstants.BUNDLE_ID, null, new String[] {InstanceScope.SCOPE});
  return prefService.getInt(TracingConstants.BUNDLE_ID, TracingConstants.PREFERENCE_MAX_FILE_SIZE_IDENTIFIER, 1000, lookupOrder);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

private String getDefaultValue() {
  String value = null;
  if (project != null) {
    value = getStoredValue(getPreferences(null));
  }
  if (value == null) {
    value = getStoredValue(Platform.getPreferencesService().getRootNode().node(DefaultScope.SCOPE));
  }
  return value != null ? value : System.getProperty(Platform.PREF_LINE_SEPARATOR);
}

代码示例来源:origin: org.eclipse.ui/trace

/**
 * Accessor for the file path in the preference store
 * 
 * @return The file path in the preference store or the default value if it's not defined.
 */
public static String getFilePath() {
  final IScopeContext[] lookupOrder = new IScopeContext[] {new InstanceScope()};
  IPreferencesService prefService = Platform.getPreferencesService();
  prefService.setDefaultLookupOrder(TracingConstants.BUNDLE_ID, null, new String[] {InstanceScope.SCOPE});
  return prefService.getString(TracingConstants.BUNDLE_ID, TracingConstants.PREFERENCE_FILE_PATH, DebugOptionsHandler.getDebugOptions().getFile().getAbsolutePath(), lookupOrder);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui

private void loadOrientation() {
  fViewOrientation = Platform.getPreferencesService().getInt(DebugUIPlugin.getUniqueIdentifier(), getOrientationPrefId(), HORIZONTAL_VIEW_ORIENTATION, null);
  for (int i = 0; i < fOrientationActions.length; i++) {
    if (fOrientationActions[i].getOrientation() == fViewOrientation) {
      fOrientationActions[i].run();
    }
  }
  updateOrientationActions();
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.editors

@Override
protected void handleEditorInputChanged() {
  final IDocumentProvider provider= getDocumentProvider();
  IEditorInput input= getEditorInput();
  if (provider != null && input != null) {
    if (!isDirty() && input.getAdapter(IFile.class) != null) {
      if (Platform.getPreferencesService().getBoolean(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, false, null))
        return;
    }
  }
  super.handleEditorInputChanged();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jsch.core

public static void setEnabledPreferredAuthMethods(String methods, String order){
 IPreferencesService service=Platform.getPreferencesService();
 service.getRootNode().node(InstanceScope.SCOPE).node(JSchCorePlugin.ID).put(
   IConstants.PREF_PREFERRED_AUTHENTICATION_METHODS, methods);
 service.getRootNode().node(InstanceScope.SCOPE).node(JSchCorePlugin.ID).put(
   IConstants.PREF_PREFERRED_AUTHENTICATION_METHODS_ORDER, order);}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jsch.core

public static void setEnabledPreferredMACMethods(String methods, String order){
  IPreferencesService service=Platform.getPreferencesService();
  service.getRootNode().node(InstanceScope.SCOPE).node(JSchCorePlugin.ID).put(
    IConstants.PREF_PREFERRED_MAC_METHODS, methods);
  service.getRootNode().node(InstanceScope.SCOPE).node(JSchCorePlugin.ID).put(
    IConstants.PREF_PREFERRED_MAC_METHODS_ORDER, order);
 }
}

相关文章