GVKun编程网logo

com.intellij.ui.ReferenceEditorWithBrowseButton的实例源码(源代码示例)

25

在本文中,我们将给您介绍关于com.intellij.ui.ReferenceEditorWithBrowseButton的实例源码的详细内容,并且为您解答源代码示例的相关问题,此外,我们还将为您提供

在本文中,我们将给您介绍关于com.intellij.ui.ReferenceEditorWithBrowseButton的实例源码的详细内容,并且为您解答源代码示例的相关问题,此外,我们还将为您提供关于android.content.SharedPreferences.Editor的实例源码、com.intellij.openapi.editor.CaretAction的实例源码、com.intellij.openapi.editor.colors.EditorFontType的实例源码、com.intellij.openapi.editor.colors.FontPreferences的实例源码的知识。

本文目录一览:

com.intellij.ui.ReferenceEditorWithBrowseButton的实例源码(源代码示例)

com.intellij.ui.ReferenceEditorWithBrowseButton的实例源码(源代码示例)

项目:consulo-java    文件:AdvancedSettingsUI.java   
/**
 * Adds textfield into placeholder panel and assigns a directly preceding label
 */
private void addField(JPanel panel,ReferenceEditorWithbrowseButton field)
{
    panel.add(field,BorderLayout.CENTER);

    final Component[] components = panel.getParent().getComponents();
    final int index = Arrays.asList(components).indexOf(panel);
    if(index > 0)
    {
        final Component component = components[index - 1];
        if(component instanceof JLabel)
        {
            ((JLabel) component).setLabelFor(field);
        }
    }
}
项目:intellij-ce-playground    文件:PsiTypeControl.java   
protected PsiTypePanel createMainComponent(PsiTypePanel boundedComponent,final Project project) {
  if (boundedComponent == null) {
    boundedComponent = new PsiTypePanel();
  }
  return PsiClassControl.initReferenceEditorWithbrowseButton(boundedComponent,new ReferenceEditorWithbrowseButton(null,project,new Function<String,Document>() {
                                                                public Document fun(final String s) {
                                                                  return JavaReferenceEditorUtil.createTypeDocument(s,project);
                                                                }
                                                              },""),this);
}
项目:intellij-ce-playground    文件:TextControl.java   
@Override
protected EditorTextField getEditorTextField(@NotNull final TextPanel panel) {
  final Component component = panel.getComponent(0);
  if (component instanceof ReferenceEditorWithbrowseButton) {
    return ((ReferenceEditorWithbrowseButton)component).getEditorTextField();
  }
  return (EditorTextField)component;
}
项目:intellij-ce-playground    文件:AdvancedSettingsUI.java   
/**
 * Adds textfield into placeholder panel and assigns a directly preceding label
 */
private void addField(JPanel panel,ReferenceEditorWithbrowseButton field) {
  panel.add(field,BorderLayout.CENTER);

  final Component[] components = panel.getParent().getComponents();
  final int index = Arrays.asList(components).indexOf(panel);
  if (index > 0) {
    final Component component = components[index - 1];
    if (component instanceof JLabel) {
      ((JLabel)component).setLabelFor(field);
    }
  }
}
项目:tools-idea    文件:PsiTypeControl.java   
protected PsiTypePanel createMainComponent(PsiTypePanel boundedComponent,this);
}
项目:tools-idea    文件:TextControl.java   
protected EditorTextField getEditorTextField(@NotNull final TextPanel panel) {
  final Component component = panel.getComponent(0);
  if (component instanceof ReferenceEditorWithbrowseButton) {
    return ((ReferenceEditorWithbrowseButton)component).getEditorTextField();
  }
  return (EditorTextField)component;
}
项目:tools-idea    文件:AdvancedSettingsUI.java   
/**
 * Adds textfield into placeholder panel and assigns a directly preceding label
 */
private static void addField(JPanel panel,BorderLayout.CENTER);

  final Component[] components = panel.getParent().getComponents();
  final int index = Arrays.asList(components).indexOf(panel);
  if (index > 0) {
    final Component component = components[index - 1];
    if (component instanceof JLabel) {
      ((JLabel)component).setLabelFor(field);
    }
  }
}
项目:consulo-xml    文件:TextControl.java   
@Override
protected EditorTextField getEditorTextField(@NotNull final TextPanel panel)
{
    final Component component = panel.getComponent(0);
    if(component instanceof ReferenceEditorWithbrowseButton)
    {
        return ((ReferenceEditorWithbrowseButton) component).getEditorTextField();
    }
    return (EditorTextField) component;
}
项目:consulo-java    文件:PsiTypeControl.java   
protected PsiTypePanel createMainComponent(PsiTypePanel boundedComponent,this);
}
项目:intellij-ce-playground    文件:PsiTypeControl.java   
protected EditorTextField getEditorTextField(@NotNull final PsiTypePanel component) {
  return ((ReferenceEditorWithbrowseButton)component.getComponent(0)).getEditorTextField();
}
项目:intellij-ce-playground    文件:PsiClassControl.java   
protected EditorTextField getEditorTextField(@NotNull final PsiClasspanel component) {
  return ((ReferenceEditorWithbrowseButton)component.getComponent(0)).getEditorTextField();
}
项目:intellij-ce-playground    文件:AdvancedSettingsUI.java   
private browseClassListener(Project project,ReferenceEditorWithbrowseButton annotationField) {
  myProject = project;
  myField = annotationField;
}
项目:tools-idea    文件:PsiTypeControl.java   
protected EditorTextField getEditorTextField(@NotNull final PsiTypePanel component) {
  return ((ReferenceEditorWithbrowseButton)component.getComponent(0)).getEditorTextField();
}
项目:tools-idea    文件:PsiClassControl.java   
protected EditorTextField getEditorTextField(@NotNull final PsiClasspanel component) {
  return ((ReferenceEditorWithbrowseButton)component.getComponent(0)).getEditorTextField();
}
项目:tools-idea    文件:AdvancedSettingsUI.java   
private browseClassListener(Project project,ReferenceEditorWithbrowseButton annotationField) {
  myProject = project;
  myField = annotationField;
}
项目:consulo-java    文件:PsiTypeControl.java   
protected EditorTextField getEditorTextField(@NotNull final PsiTypePanel component) {
  return ((ReferenceEditorWithbrowseButton)component.getComponent(0)).getEditorTextField();
}
项目:consulo-java    文件:PsiClassControl.java   
protected EditorTextField getEditorTextField(@NotNull final PsiClasspanel component) {
  return ((ReferenceEditorWithbrowseButton)component.getComponent(0)).getEditorTextField();
}
项目:consulo-java    文件:AdvancedSettingsUI.java   
private browseClassListener(Project project,ReferenceEditorWithbrowseButton annotationField)
{
    myProject = project;
    myField = annotationField;
}

android.content.SharedPreferences.Editor的实例源码

android.content.SharedPreferences.Editor的实例源码

项目:InstagramManager-Android    文件:InstagramSession.java   
public void reset() {
    Editor editor = mSharedPref.edit();

    editor.putString(ACCESS_TOKEN,"");
    editor.putString(USERID,"");
    editor.putString(USERNAME,"");
    editor.putString(FULLNAME,"");
    editor.putString(PROFILPIC,"");
    editor.putInt(FOLLOW,0);
    editor.putInt(FOLLOWED,0);

    editor.commit();

    CookieSyncManager.createInstance(mContext);

    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.removeAllCookie();
}
项目:GitHub    文件:HostListActivity.java   
protected void updateList() {
    if (prefs.getBoolean(PreferenceConstants.soRT_BY_COLOR,false) != sortedByColor) {
        Editor edit = prefs.edit();
        edit.putBoolean(PreferenceConstants.soRT_BY_COLOR,sortedByColor);
        edit.apply();
    }

    if (hostdb == null)
        hostdb = HostDatabase.get(this);

    hosts = hostdb.getHosts(sortedByColor);

    // Don't lose hosts that are connected via shortcuts but not in the database.
    if (bound != null) {
        for (TerminalBridge bridge : bound.getBridges()) {
            if (!hosts.contains(bridge.host))
                hosts.add(0,bridge.host);
        }
    }

    mAdapter = new HostAdapter(this,hosts,bound);
    mListView.setAdapter(mAdapter);
    adjustViewVisibility();
}
项目:keepass2android    文件:AccessManager.java   
public static void removeAccesstoken(Context ctx,String hostPackage,String accesstoken) {
    SharedPreferences prefs = getPrefsForHost(ctx,hostPackage);

    Log.d(_tag,"removing Accesstoken.");
    if (prefs.getString(PREF_KEY_TOKEN,"").equals(accesstoken))
    {
        Editor edit = prefs.edit();
        edit.clear();
        edit.commit();

    }

    SharedPreferences hostPrefs = ctx.getSharedPreferences("KP2A.PluginAccess.hosts",Context.MODE_PRIVATE);
    if (hostPrefs.contains(hostPackage))
    {
        hostPrefs.edit().remove(hostPackage).commit();
    }

}
项目:CSipSimple    文件:NightlyUpdater.java   
public UpdaterPopupLauncher getUpdaterPopup(boolean fallbackAlert) {
    UpdaterPopupLauncher popLauncher = null;
    Editor edt = prefs.edit();
    int onlineVersion = getLastOnlineVersion();
    // Reset ignore check value
    edt.putBoolean(IGnorE_NIGHTLY_CHECK,false);
    if(pinfo != null && pinfo.versionCode < onlineVersion) {
        popLauncher = new UpdaterPopupLauncher(context,onlineVersion);
    }else {
        // Set last check to Now :)
        edt.putLong(LAST_NIGHTLY_CHECK,System.currentTimeMillis());
        // And delete latest nightly from cache
        File cachedFile = getCachedFile();
        if(cachedFile.exists()) {
            cachedFile.delete();
        }
        if(fallbackAlert) {
            popLauncher = new UpdaterPopupLauncher(context,0);
        }
    }
    edt.commit();

    return popLauncher;
}
项目:CSipSimple    文件:CallHandlerPlugin.java   
/**
 * Retrieve internal id of call handler as saved in databases It should be
 * some negative < SipProfile.INVALID_ID number
 * 
 * @param ctxt Application context
 * @param packageName name of the call handler package
 * @return the id of this call handler in databases
 */
public static Long getAccountIdForCallHandler(Context ctxt,String packageName) {
    SharedPreferences prefs = ctxt.getSharedPreferences("handlerCache",Context.MODE_PRIVATE);

    long accountId = SipProfile.INVALID_ID;
    try {
        accountId = prefs.getLong(VIRTUAL_ACC_PREFIX + packageName,SipProfile.INVALID_ID);
    } catch (Exception e) {
        Log.e(THIS_FILE,"Can't retrieve call handler cache id - reset");
    }
    if (accountId == SipProfile.INVALID_ID) {
        // We never seen this one,add a new entry for account id
        int maxAcc = prefs.getInt(VIRTUAL_ACC_MAX_ENTRIES,0x0);
        int currentEntry = maxAcc + 1;
        accountId = SipProfile.INVALID_ID - (long) currentEntry;
        Editor edt = prefs.edit();
        edt.putLong(VIRTUAL_ACC_PREFIX + packageName,accountId);
        edt.putInt(VIRTUAL_ACC_MAX_ENTRIES,currentEntry);
        edt.commit();
    }
    return accountId;
}
项目:Accessibility    文件:SPUtils.java   
public static void put(String fileName,Context context,String key,Object object) {
    SharedPreferences sp = SharedPreferencesImpl.getSharedPreferences(context,getFileName(fileName),Context.MODE_PRIVATE);
    Editor editor = sp.edit();

    if (object instanceof String) {
        editor.putString(key,(String) object);
    } else if (object instanceof Integer) {
        editor.putInt(key,(Integer) object);
    } else if (object instanceof Boolean) {
        editor.putBoolean(key,(Boolean) object);
    } else if (object instanceof Float) {
        editor.putFloat(key,(Float) object);
    } else if (object instanceof Long) {
        editor.putLong(key,(Long) object);
    } else if (object instanceof Set) {
        editor.putStringSet(key,(Set) object);
    } else if(object == null) {
        editor.remove(key);
    }
    editor.apply();
}
项目:letv    文件:Uninstalledobserver.java   
private static String getUrlAddParamer(String url,Context context) {
    SharedPreferences setting = context.getSharedPreferences(TAG,0);
    if (!setting.getBoolean("isInit",false)) {
        try {
            Editor edit = setting.edit();
            edit.putString(VERSION_NAME,context.getPackageManager().getPackageInfo(context.getPackageName(),0).versionName);
            edit.putString(MODEL,Build.MODEL);
            edit.putString("version",VERSION.RELEASE);
            edit.putString("url",url);
            edit.putBoolean("isInit",true);
            edit.commit();
        } catch (Exception e) {
            e.printstacktrace();
        }
    }
    StringBuilder builder = new StringBuilder(url);
    builder.append("&model=" + setting.getString(MODEL,""));
    builder.append("&os=android" + setting.getString("version",""));
    builder.append("&version=" + setting.getString(VERSION_NAME,""));
    return builder.toString();
}
项目:CustomAndroidOnesheeld    文件:TwitterShield.java   
public void logoutFromTwitter() {
    stopListeningOnAKeyword();
    Editor e = mSharedPreferences.edit();
    e.remove(PREF_KEY_OAUTH_TOKEN);
    e.remove(PREF_KEY_OAUTH_SECRET);
    e.remove(PREF_KEY_TWITTER_LOGIN);
    e.remove(PREF_KEY_TWITTER_USERNAME);
    e.commit();
}
项目:boohee_v5.6    文件:Utils.java   
public static void setBind(Context context,boolean flag) {
    String flagStr = "not";
    if (flag) {
        flagStr = "ok";
    }
    Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit();
    editor.putString("bind_flag",flagStr);
    editor.commit();
}
项目:Treebolic    文件:Settings.java   
/**
 * Set providers default settings from provider data
 *
 * @param context locatorContext
 */
@SuppressLint({"CommitPrefEdits","ApplySharedPref"})
@SuppressWarnings("Boxing")
static public void setDefaults(@NonNull final Context context)
{
    // create providers
    final List<HashMap<String,Object>> providers = Providers.getProviders(context,false);

    // create prefs for built-in providers
    if (providers != null)
    {
        for (int i = 0; i < providers.size(); i++)
        {
            final HashMap<String,Object> provider = providers.get(i);
            if (provider.get(Providers.ISPLUGIN).equals(true))
            {
                continue;
            }

            // provider shared preferences
            final SharedPreferences providerSharedPrefs = context.getSharedPreferences(Settings.PREF_FILE_PREFIX + provider.get(Providers.NAME),Context.MODE_PRIVATE);

            // commit non existent values
            final Editor providerEditor = providerSharedPrefs.edit();
            final String[] keys = new String[]{TreebolicIface.PREF_SOURCE,TreebolicIface.PREF_BASE,TreebolicIface.PREF_IMAGEBASE,TreebolicIface.PREF_SETTINGS,Settings.PREF_PROVIDER};
            final String[] providerKeys = new String[]{Providers.soURCE,Providers.BASE,Providers.IMAGEBASE,Providers.SETTINGS,Providers.PROVIDER};
            for (int j = 0; j < keys.length; j++)
            {
                final String key = keys[j];
                if (!providerSharedPrefs.contains(key))
                {
                    final String value = (String) provider.get(providerKeys[j]);
                    providerEditor.putString(key,value).commit();
                }
            }
        }
    }
}
项目:q-mail    文件:QMail.java   
/**
 * Remember that all account databases are using the most recent database schema.
 *
 * @param save
 *         Whether or not to write the current database version to the
 *         {@code SharedPreferences} {@link #DATABASE_VERSION_CACHE}.
 *
 * @see #areDatabasesUpToDate()
 */
public static synchronized void setDatabasesUpToDate(boolean save) {
    sDatabasesUpToDate = true;

    if (save) {
        Editor editor = sDatabaseVersionCache.edit();
        editor.putInt(KEY_LAST_ACCOUNT_DATABASE_VERSION,LocalStore.DB_VERSION);
        editor.apply();
    }
}
项目:boohee_v5.6    文件:PlatformDb.java   
public void removeAccount() {
    ArrayList arrayList = new ArrayList();
    for (Entry key : this.db.getAll().entrySet()) {
        arrayList.add(key.getKey());
    }
    Editor edit = this.db.edit();
    Iterator it = arrayList.iterator();
    while (it.hasNext()) {
        edit.remove((String) it.next());
    }
    edit.commit();
}
项目:ShangHanLun    文件:SingletonData.java   
public void savePreferences() {
    SharedPreferences pref = MyApplication.getAppContext()
            .getSharedPreferences(preferenceKey,Context.MODE_PRIVATE);
    Editor editor = pref.edit();
    editor.putInt("showShanghan",showShanghan);
    editor.putInt("showJinkui",showJinkui);
    editor.commit();
}
项目:NoteBuddy    文件:keyvalueDB.java   
/**
 * Delete value method
 * @param context
 * @param key
 * @throws NoSuchAlgorithmException
 */
private static void deleteValue(@NonNull Context context,@NonNull String key) throws NoSuchAlgorithmException {
    SharedPreferences settings;
    Editor editor;

    settings = context.getSharedPreferences(PREFS_NAME,Context.MODE_PRIVATE);
    editor = settings.edit();

    editor.remove(key);
    editor.apply();
}
项目:Accessibility    文件:SPUtils.java   
public static void remove(String fileName,String key) {
    SharedPreferences sp = SharedPreferencesImpl.getSharedPreferences(context,Context.MODE_PRIVATE);
    Editor editor = sp.edit();
    editor.remove(key);
    editor.apply();
}
项目:react-native-udesk    文件:PreferenceHelper.java   
public static void write(Context context,String fileName,String k,String v) {
    SharedPreferences preference = context.getSharedPreferences(fileName,Context.MODE_PRIVATE);
    Editor editor = preference.edit();
    editor.putString(k,v);
    editor.apply();
}
项目:GitHub    文件:AccesstokenKeeper.java   
/**
 * 保存 Token 对象到 SharedPreferences。
 * 
 * @param context 应用程序上下文环境
 * @param token   Token 对象
 */
public static void writeAccesstoken(Context context,Oauth2Accesstoken token) {
    if (null == context || null == token) {
        return;
    }

    SharedPreferences pref = context.getSharedPreferences(PREFERENCES_NAME,Context.MODE_APPEND);
    Editor editor = pref.edit();
    editor.putString(KEY_UID,token.getUid());
    editor.putString(KEY_ACCESS_TOKEN,token.getToken());
    editor.putLong(KEY_EXPIRES_IN,token.getExpiresTime());
    editor.apply();
}
项目:AndroFish    文件:SimplePersistence.java   
public void commit() {
    Editor edt = editor;
    if (edt != null) {
        synchronized (edt) {
            edt.commit();
            if (edt == editor) {
                editor = null;
            }
        }
    }
}
项目:StopApp    文件:SharedPreferenceUtil.java   
/**
 * 移除某个key值已经对应的值
 *
 * @param context
 * @param key
 */
public static void remove(Context context,String key) {
    SharedPreferences sp = context.getSharedPreferences(FILL_NAME,Context.MODE_PRIVATE);
    Editor edit = sp.edit();
    edit.remove(key);
    SharedPreferencesCompat.EditorCompat.getInstance().apply(edit);
}
项目:Pluto-Android    文件:SharePreferenceUtils.java   
public void setBooleanPrefByPackage( String name,boolean value) {
    String pkg = context.getPackageName();// 用包名当作文件名
    SharedPreferences prefs = context.getSharedPreferences(pkg,Context.MODE_PRIVATE);
    Editor ed = prefs.edit();
    ed.putBoolean(name,value);
    ed.apply();
}
项目:Expert-Android-Programming    文件:SessionPreference.java   
public static boolean setUserParams(Context context,User user) {

        Editor editor = context.getSharedPreferences(KEY,Context.MODE_PRIVATE).edit();
        editor.putInt(ID,user.getId());
        editor.putString(NAME,user.getName());
        editor.putString(EMAIL,user.getEmail());
        editor.putString(IMAGE,user.getimage());
        editor.putString(UID,user.getUid());
        editor.putBoolean(IS_LOGGED_IN,true);
        return editor.commit();
    }
项目:mininoteview    文件:MainActivity.java   
private void saveConfig()
{
    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
    Editor editor = pref.edit();
    editor.putInt(getString(R.string.prefFileListOrderKey),mCurrentOrder);
    editor.apply();
}
项目:StopApp    文件:SharedPreferenceUtil.java   
/**
 * 清除所有内容
 *
 * @param context
 */
public static void clear(Context context) {
    SharedPreferences sp = context.getSharedPreferences(FILL_NAME,Context.MODE_PRIVATE);
    Editor edit = sp.edit();
    edit.clear();
    SharedPreferencesCompat.EditorCompat.getInstance().apply(edit);
}
项目:letv    文件:ServerSetting.java   
public void setEnvironment(Context context,int i) {
    if (context != null && (this.c == null || this.c.get() == null)) {
        this.c = new WeakReference(context.getSharedPreferences("ServerPrefs",0));
    }
    if (i == 0 || i == 1) {
        Editor edit;
        switch (i) {
            case 0:
                edit = ((SharedPreferences) this.c.get()).edit();
                edit.putInt("ServerType",0);
                edit.putString(KEY_OPEN_ENV,"formal");
                edit.putString(KEY_HOST_QZS_QQ,KEY_HOST_QZS_QQ);
                edit.putString(KEY_HOST_OPEN_MOBILE,KEY_HOST_OPEN_MOBILE);
                edit.commit();
                changeServer();
                Toast.makeText(context,"已切换到正式环境",0).show();
                return;
            case 1:
                edit = ((SharedPreferences) this.c.get()).edit();
                edit.putInt("ServerType",1);
                edit.putString(KEY_OPEN_ENV,"exp");
                edit.putString(KEY_HOST_QZS_QQ,"testmobile.qq.com");
                edit.putString(KEY_HOST_OPEN_MOBILE,"test.openmobile.qq.com");
                edit.commit();
                changeServer();
                Toast.makeText(context,"已切换到体验环境",0).show();
                return;
            default:
                return;
        }
    }
    f.e(a,"切换环境参数错误,正式环境为0,体验环境为1");
}
项目:letv    文件:af.java   
public static void a(Context context,String str,long j) {
    if (a(context)) {
        b(context);
        Editor edit = a.edit();
        edit.putLong(str,j);
        edit.apply();
        return;
    }
    z.d();
}
项目:OpenYOLO-Android    文件:UserRepository.java   
private void setCurrentUserEmail(@Nullable String email) {
    Editor editor = mSharedPrefs.edit();
    if (email == null) {
        editor.remove(KEY_CURRENT_USER);
    } else {
        editor.putString(KEY_CURRENT_USER,email);
    }
    editor.apply();
}
项目:dcs-sdk-java    文件:PreferenceUtil.java   
private static void editSubmit(Editor editor) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
        editor.apply();
    } else {
        editor.commit();
    }
}
项目:exciting-app    文件:ConfigParamsKeeper.java   
/***
 * 设置配置值
 *
 * param key   配置变量名
 * param value 配置数值
 */
public void setValue(String key,boolean flag) {
    SharedPreferences preferences = context.getSharedPreferences(KEEPERNAME,Context.MODE_PRIVATE);
    Editor editor = preferences.edit();
    editor.putBoolean(key,flag);
    editor.apply();
}
项目:javaide    文件:PreferenceHelper.java   
/**
 * Record that we managed to get root in JellyBean.
 *
 * @param context
 * @return
 */
public static void setJellybeanRootRan(Context context) {
    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    Editor editor = sharedPrefs.edit();
    editor.putBoolean(context.getString(R.string.pref_ran_jellybean_su_update),true);
    editor.commit();
}
项目:aos-MediaLib    文件:Trakt.java   
public static void wipePreferences(SharedPreferences pref,boolean userChanged) {
    Editor editor = pref.edit();
    if (!userChanged) {
        editor.remove(Trakt.KEY_TRAKT_USER);
        editor.remove(Trakt.KEY_TRAKT_SHA1);
        editor.remove(Trakt.KEY_TRAKT_LIVE_SCROBBLING);
        editor.remove(Trakt.KEY_TRAKT_SYNC_COLLECTION);
    }
    editor.remove(Trakt.KEY_TRAKT_SYNC_FLAG);
    editor.remove(Trakt.KEY_TRAKT_LAST_TIME_MOVIE_WATCHED);
    editor.remove(Trakt.KEY_TRAKT_LAST_TIME_SHOW_WATCHED);

    editor.commit();
}
项目:CSipSimple    文件:PreferencesWrapper.java   
/**
 * Set a preference string value
 * @param key the preference key to set
 * @param value the value for this key
 */
public void setPreferenceStringValue(String key,String value) {
    if(sharedEditor == null) {
        Editor editor = prefs.edit();
        editor.putString(key,value);
        editor.commit();
    }else {
        sharedEditor.putString(key,value);
    }
}
项目:boohee_v5.6    文件:d.java   
protected final void b(String str) {
    synchronized (this) {
        Log.i("MID","write mid to sharedPreferences");
        Editor edit = PreferenceManager.getDefaultSharedPreferences(this.e).edit();
        edit.putString(h.f("4kU71lN96TJUomD1vOU9lgj9Tw=="),str);
        edit.commit();
    }
}
项目:exciting-app    文件:ConfigParamsKeeper.java   
/***
 * 设置配置值
 *
 * param key   配置变量名
 * param value 配置数值
 */
public void setValue(String key,int value) {
    SharedPreferences preferences = context.getSharedPreferences(KEEPERNAME,Context.MODE_PRIVATE);
    Editor editor = preferences.edit();
    editor.putInt(key,value);
    editor.apply();
}
项目:CSipSimple    文件:MediaManager.java   
/**
     * Restore the state of the audio
     */
    @SuppressWarnings("deprecation")
    private final synchronized void restoreAudioState() {
        if( !prefs.getBoolean("isSavedAudioState",false) ) {
            //If we have NEVER set,do not try to reset !
            return;
        }

        ContentResolver ctntResolver = service.getContentResolver();
        Compatibility.setWifiSleepPolicy(ctntResolver,prefs.getInt("savedWifiPolicy",Compatibility.getWifiSleepPolicyDefault()));
//      audioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,prefs.getInt("savedVibrateRing",AudioManager.VIBRATE_SETTING_ONLY_SILENT));
//      audioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,prefs.getInt("savedVibradeNotif",AudioManager.VIBRATE_SETTING_OFF));
//      audioManager.setRingerMode(prefs.getInt("savedRingerMode",AudioManager.RINGER_MODE_norMAL));

        int inCallStream = Compatibility.getInCallStream(userWantBluetooth);
        setStreamVolume(inCallStream,prefs.getInt("savedVolume",(int)(audioManager.getStreamMaxVolume(inCallStream)*0.8) ),0);

        int targetMode = getAudioTargetMode();
        if(service.getPrefs().useRoutingApi()) {
            audioManager.setRouting(targetMode,prefs.getInt("savedRoute",AudioManager.ROUTE_SPEAKER),AudioManager.ROUTE_ALL);
        }else {
            audioManager.setSpeakerphoneOn(prefs.getBoolean("savedSpeakerPhone",false));
        }
        audioManager.setMode(prefs.getInt("savedMode",AudioManager.MODE_norMAL));


        Editor ed = prefs.edit();
        ed.putBoolean("isSavedAudioState",false);
        ed.commit();
    }
项目:Treebolic    文件:Settings.java   
/**
 * Set active provider settings (copied into default preferences)
 *
 * @param context  locatorContext
 * @param provider active provider
 */
@SuppressLint({"CommitPrefEdits","ApplySharedPref"})
static public void setActivePrefs(@NonNull final Context context,@NonNull final HashMap<String,Object> provider)
{
    final SharedPreferences defaultSharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    final Editor defaultEditor = defaultSharedPrefs.edit();
    SharedPreferences providerSharedPrefs;

    final Boolean isPlugin = (Boolean) provider.get(Providers.ISPLUGIN);
    if (isPlugin)
    {
        final String pkg = (String) provider.get(Providers.PACKAGE);
        providerSharedPrefs = Utils.getPluginDefaultSharedPreferences(context,pkg);
        defaultEditor.putString(Settings.PREF_PROVIDER,(String) provider.get(Providers.PROVIDER));
    }
    else
    {
        providerSharedPrefs = context.getSharedPreferences(Settings.PREF_FILE_PREFIX + provider.get(Providers.NAME),Context.MODE_PRIVATE);
        final String providerClass = providerSharedPrefs.getString(Settings.PREF_PROVIDER,null);
        defaultEditor.putString(Settings.PREF_PROVIDER,providerClass);
    }
    if (providerSharedPrefs != null)
    {
        final String[] keys = new String[]{TreebolicIface.PREF_SOURCE,TreebolicIface.PREF_SETTINGS};
        for (final String key : keys)
        {
            final String value = providerSharedPrefs.getString(key,null);
            defaultEditor.putString(key,value);
        }
    }
    defaultEditor.commit();
}
项目:BilibiliClient    文件:PreferenceUtil.java   
public static void putBoolean(String key,boolean value) {

    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(
        BilibiliApp.getInstance());
    Editor editor = sharedPreferences.edit();
    editor.putBoolean(key,value);
    editor.apply();
  }
项目:GrowingProject    文件:SharedPreferenceUtils.java   
public static void setobject(Editor pEditor,String pKey,Object o) {
    String str = null;
    try {
        str = SharedPreferenceUtils.writeObject(o);
    } catch (Exception e) {
        e.printstacktrace();
    }
    pEditor.putString(pKey,str);
    pEditor.commit();
}
项目:boohee_v5.6    文件:a$a.java   
public void a(String str,String str2,String str3) {
    this.a = str;
    this.b = str2;
    this.g = str3;
    Editor edit = this.k.j().edit();
    edit.putString("appId",this.a);
    edit.putString("appToken",str2);
    edit.putString("regResource",str3);
    edit.commit();
}
项目:BilibiliClient    文件:PreferenceUtil.java   
private static void putString(String key,String value) {

    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(
        BilibiliApp.getInstance());
    Editor editor = sharedPreferences.edit();
    editor.putString(key,value);
    editor.apply();
  }
项目:Accessibility    文件:SPUtils.java   
/**
 * 清除所有数据
 */
public static void clear(Context context) {
    SharedPreferences sp = SharedPreferencesImpl.getSharedPreferences(context,getFileName(),Context.MODE_PRIVATE);
    Editor editor = sp.edit();
    editor.clear();
    editor.apply();
}

com.intellij.openapi.editor.CaretAction的实例源码

com.intellij.openapi.editor.CaretAction的实例源码

项目:intellij-ce-playground    文件:CutAction.java   
@Override
public void executeWriteAction(final Editor editor,DataContext dataContext) {
  if(!editor.getSelectionModel().hasSelection(true)) {
    if (Registry.is(copyAction.SKIP_copY_AND_CUT_FOR_EMPTY_SELECTION_KEY)) {
      return;
    }
    editor.getCaretModel().runForEachCaret(new CaretAction() {
      @Override
      public void perform(Caret caret) {
        editor.getSelectionModel().selectLineAtCaret();
      }
    });
  }
  editor.getSelectionModel().copySelectionToClipboard();
  EditorModificationUtil.deleteSelectedTextForAllCarets(editor);
}
项目:intellij-ce-playground    文件:copyAction.java   
@Override
public void execute(final Editor editor,DataContext dataContext) {
  if (!editor.getSelectionModel().hasSelection(true)) {
    if (Registry.is(SKIP_copY_AND_CUT_FOR_EMPTY_SELECTION_KEY)) {
      return;
    }
    editor.getCaretModel().runForEachCaret(new CaretAction() {
      @Override
      public void perform(Caret caret) {
        editor.getSelectionModel().selectLineAtCaret();
        EditorActionUtil.moveCaretToLinestartIgnoringSoftWraps(editor);
      }
    });
  }
  editor.getSelectionModel().copySelectionToClipboard();
}
项目:intellij-ce-playground    文件:MultiCaretCodeInsightAction.java   
private static void iterateOverCarets(@NotNull final Project project,@NotNull final Editor hostEditor,@NotNull final MultiCaretCodeInsightActionHandler handler) {
  PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
  final PsiFile psiFile = documentManager.getCachedPsiFile(hostEditor.getDocument());
  documentManager.commitAllDocuments();

  hostEditor.getCaretModel().runForEachCaret(new CaretAction() {
    @Override
    public void perform(Caret caret) {
      Editor editor = hostEditor;
      if (psiFile != null) {
        Caret injectedCaret = InjectedLanguageUtil.getCaretForInjectedLanguageNoCommit(caret,psiFile);
        if (injectedCaret != null) {
          caret = injectedCaret;
          editor = caret.getEditor();
        }
      }
      final PsiFile file = PsiUtilBase.getPsiFileInEditor(caret,project);
      if (file != null) {
        handler.invoke(project,editor,caret,file);
      }
    }
  });
}
项目:consulo    文件:CutAction.java   
@requiredWriteAction
@Override
public void executeWriteAction(final Editor editor,DataContext dataContext) {
  if(!editor.getSelectionModel().hasSelection(true)) {
    if (Registry.is(copyAction.SKIP_copY_AND_CUT_FOR_EMPTY_SELECTION_KEY)) {
      return;
    }
    editor.getCaretModel().runForEachCaret(new CaretAction() {
      @Override
      public void perform(Caret caret) {
        editor.getSelectionModel().selectLineAtCaret();
      }
    });
  }
  editor.getSelectionModel().copySelectionToClipboard();
  EditorModificationUtil.deleteSelectedTextForAllCarets(editor);
}
项目:consulo    文件:MultiCaretCodeInsightAction.java   
private static void iterateOverCarets(@Nonnull final Project project,@Nonnull final Editor hostEditor,@Nonnull final MultiCaretCodeInsightActionHandler handler) {
  PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
  final PsiFile psiFile = documentManager.getCachedPsiFile(hostEditor.getDocument());
  documentManager.commitAllDocuments();

  hostEditor.getCaretModel().runForEachCaret(new CaretAction() {
    @Override
    public void perform(Caret caret) {
      Editor editor = hostEditor;
      if (psiFile != null) {
        Caret injectedCaret = InjectedLanguageUtil.getCaretForInjectedLanguageNoCommit(caret,file);
      }
    }
  });
}
项目:intellij-ce-playground    文件:InvokeTemplateAction.java   
public void perform() {
  final Document document = myEditor.getDocument();
  final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
  if (file != null) {
    ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(file);
  }

  CommandProcessor.getInstance().executeCommand(myProject,new Runnable() {
    public void run() {
      myEditor.getCaretModel().runForEachCaret(new CaretAction() {
        public void perform(Caret caret) {
          // adjust the selection so that it starts with a non-whitespace character (to make sure that the template is inserted
          // at a meaningful position rather than at indent 0)
          if (myEditor.getSelectionModel().hasSelection() && myTemplate.isToReformat()) {
            int offset = myEditor.getSelectionModel().getSelectionStart();
            int selectionEnd = myEditor.getSelectionModel().getSelectionEnd();
            int lineEnd = document.getLineEndOffset(document.getLineNumber(offset));
            while (offset < lineEnd && offset < selectionEnd &&
                   (document.getChaRSSequence().charat(offset) == ' ' || document.getChaRSSequence().charat(offset) == '\t')) {
              offset++;
            }
            // avoid extra line break after $SELECTION$ in case when selection ends with a complete line
            if (selectionEnd == document.getLinestartOffset(document.getLineNumber(selectionEnd))) {
              selectionEnd--;
            }
            if (offset < lineEnd && offset < selectionEnd) {  // found non-WS character in first line of selection
              myEditor.getSelectionModel().setSelection(offset,selectionEnd);
            }
          }
          String selectionString = myEditor.getSelectionModel().getSelectedText();
          TemplateManager.getInstance(myProject).startTemplate(myEditor,selectionString,myTemplate);
        }
      });
    }
  },"Wrap with template","Wrap with template " + myTemplate.getKey());
}
项目:StringManipulation    文件:AbstractStringManipAction.java   
protected void executeMyWriteAction(Editor editor,final DataContext dataContext,final T additionalParam) {
    editor.getCaretModel().runForEachCaret(new CaretAction() {
        @Override
        public void perform(Caret caret) {
            executeMyWriteActionPerCaret(caret.getEditor(),dataContext,additionalParam);
        }
    });
}
项目:consulo    文件:ToggleCaseAction.java   
private static void runForCaret(Editor editor,Caret caret,CaretAction action) {
  if (caret == null) {
    editor.getCaretModel().runForEachCaret(action);
  }
  else {
    action.perform(caret);
  }
}
项目:consulo    文件:InvokeTemplateAction.java   
public void perform() {
  final Document document = myEditor.getDocument();
  final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
  if (file != null) {
    ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(file);
  }

  CommandProcessor.getInstance().executeCommand(myProject,new Runnable() {
    @Override
    public void run() {
      myEditor.getCaretModel().runForEachCaret(new CaretAction() {
        @Override
        public void perform(Caret caret) {
          // adjust the selection so that it starts with a non-whitespace character (to make sure that the template is inserted
          // at a meaningful position rather than at indent 0)
          if (myEditor.getSelectionModel().hasSelection() && myTemplate.isToReformat()) {
            int offset = myEditor.getSelectionModel().getSelectionStart();
            int selectionEnd = myEditor.getSelectionModel().getSelectionEnd();
            int lineEnd = document.getLineEndOffset(document.getLineNumber(offset));
            while (offset < lineEnd && offset < selectionEnd &&
                   (document.getChaRSSequence().charat(offset) == ' ' || document.getChaRSSequence().charat(offset) == '\t')) {
              offset++;
            }
            // avoid extra line break after $SELECTION$ in case when selection ends with a complete line
            if (selectionEnd == document.getLinestartOffset(document.getLineNumber(selectionEnd))) {
              selectionEnd--;
            }
            if (offset < lineEnd && offset < selectionEnd) {  // found non-WS character in first line of selection
              myEditor.getSelectionModel().setSelection(offset,"Wrap with template " + myTemplate.getKey());
}
项目:consulo    文件:LookupActionHandler.java   
@Override
protected void executeInLookup(LookupImpl lookup,DataContext context,final Caret caret) {
  final Editor editor = lookup.getEditor();
  final int offset = editor.getCaretModel().getoffset();
  final CharSequence seq = editor.getDocument().getChaRSSequence();
  if (seq.length() <= offset || !lookup.isCompletion()) {
    myOriginalHandler.execute(editor,context);
    return;
  }

  char c = seq.charat(offset);
  CharFilter.Result lookupAction = LookupTypedHandler.getLookupAction(c,lookup);

  if (lookupAction != CharFilter.Result.ADD_TO_PREFIX || Character.isWhitespace(c)) {
    myOriginalHandler.execute(editor,context);
    return;
  }

  if (!lookup.performGuardedChange(() -> {
    CaretAction action = new CaretAction() {
      @Override
      public void perform(Caret caret1) {
        caret1.removeSelection();
        int caretoffset = caret1.getoffset();
        if (caretoffset < seq.length()) {
          caret1.movetoOffset(caretoffset + 1);
        }
      }
    };
    if (caret == null) {
      editor.getCaretModel().runForEachCaret(action);
    }
    else {
      action.perform(caret);
    }
  })) {
    return;
  }

  lookup.appendPrefix(c);
  final CompletionProgressIndicator completion = CompletionServiceImpl.getCompletionService().getCurrentCompletion();
  if (completion != null) {
    completion.prefixUpdated();
  }
}

com.intellij.openapi.editor.colors.EditorFontType的实例源码

com.intellij.openapi.editor.colors.EditorFontType的实例源码

项目:intellij-ce-playground    文件:DetailsPanel.java   
private void update() {
  if (myMainText == null) {
    setText("");
  }
  else {
    setText("<html><head>" +
            UIUtil.getCssFontDeclaration(EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN)) +
            "</head><body>" +
            myMainText +
            "<br/>" +
            "<br/>" +
            getBranchesText() +
            "</body></html>");
  }
  revalidate();
  repaint();
}
项目:intellij-ce-playground    文件:EditorView.java   
public int getLineHeight() {
  synchronized (myLock) {
    if (myLineHeight < 0) {
      EditorColoRSScheme coloRSScheme = myEditor.getColoRSScheme();
      FontMetrics fm = myEditor.getContentComponent().getFontMetrics(coloRSScheme.getFont(EditorFontType.PLAIN));
      int fontMetricsHeight = FontLayoutService.getInstance().getHeight(fm);
      myLineHeight = (int)(fontMetricsHeight * (myEditor.isOneLineMode() ? 1 : coloRSScheme.getLinespacing()));
      if (myLineHeight <= 0) {
        myLineHeight = fontMetricsHeight;
        if (myLineHeight <= 0) {
          myLineHeight = 12;
        }
      }
    }
    return myLineHeight;
  }
}
项目:intellij-ce-playground    文件:EditorPainter.java   
private boolean paintPlaceholderText(Graphics2D g) {
  CharSequence hintText = myEditor.getPlaceholder();
  EditorComponentImpl editorComponent = myEditor.getContentComponent();
  if (myDocument.getTextLength() > 0 || hintText == null || hintText.length() == 0 ||
      KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == editorComponent &&
      !myEditor.getShowPlaceholderWhenFocused()) {
    return false;
  }

  hintText = SwingUtilities.layoutCompoundLabel(g.getFontMetrics(),hintText.toString(),null,editorComponent.getBounds(),new Rectangle(),0);
  g.setColor(myEditor.getFoldingModel().getPlaceholderAttributes().getForegroundColor());
  g.setFont(myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN));
  g.drawString(hintText.toString(),myView.getAscent());
  return true;
}
项目:consulo    文件:EditorView.java   
private void initMetricsIfNeeded() {
  if (myPlainSpaceWidth >= 0) return;

  FontMetrics fm = myEditor.getContentComponent().getFontMetrics(myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN));

  int width = FontLayoutService.getInstance().charWidth(fm,' ');
  myPlainSpaceWidth = width > 0 ? width : 1;

  myCharHeight = FontLayoutService.getInstance().charWidth(fm,'a');

  float verticalScalingFactor = getVerticalScalingFactor();

  int fontMetricsHeight = FontLayoutService.getInstance().getHeight(fm);
  myLineHeight = (int)Math.ceil(fontMetricsHeight * verticalScalingFactor);

  int descent = FontLayoutService.getInstance().getDescent(fm);
  myDescent = (int)Math.floor(descent * verticalScalingFactor);
  myTopOverhang = fontMetricsHeight - myLineHeight + myDescent - descent;
  myBottomOverhang = descent - myDescent;

  // assuming that bold italic 'W' gives a good approximation of font's widest character
  FontMetrics fmBI = myEditor.getContentComponent().getFontMetrics(myEditor.getColoRSScheme().getFont(EditorFontType.BOLD_ITALIC));
  myMaxCharWidth = FontLayoutService.getInstance().charWidth(fmBI,'W');
}
项目:consulo    文件:LookupCellRenderer.java   
public LookupCellRenderer(LookupImpl lookup) {
  EditorColoRSScheme scheme = lookup.getTopLevelEditor().getColoRSScheme();
  mynormalFont = scheme.getFont(EditorFontType.PLAIN);
  myBoldFont = scheme.getFont(EditorFontType.BOLD);

  myLookup = lookup;
  myNameComponent = new MySimpleColoredComponent();
  myNameComponent.setIpad(JBUI.insetsLeft(2));
  myNameComponent.setMyBorder(null);

  myTailComponent = new MySimpleColoredComponent();
  myTailComponent.setIpad(JBUI.emptyInsets());
  myTailComponent.setBorder(JBUI.Borders.emptyRight(10));

  myTypeLabel = new MySimpleColoredComponent();
  myTypeLabel.setIpad(JBUI.emptyInsets());
  myTypeLabel.setBorder(JBUI.Borders.emptyRight(6));

  myPanel = new LookupPanel();
  myPanel.add(myNameComponent,BorderLayout.WEST);
  myPanel.add(myTailComponent,BorderLayout.CENTER);
  myPanel.add(myTypeLabel,BorderLayout.EAST);

  mynormalMetrics = myLookup.getTopLevelEditor().getComponent().getFontMetrics(mynormalFont);
  myBoldMetrics = myLookup.getTopLevelEditor().getComponent().getFontMetrics(myBoldFont);
}
项目:intellij-ce-playground    文件:FragmentNumberGutterIconRenderer.java   
public FragmentNumberGutterIconRenderer(String presentation,final TextAttributesKey key,final Component component,EditorEx editor) {
  myPresentation = presentation;
  final EditorColoRSScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
  final Color color = globalScheme.getAttributes(key).getBackgroundColor();

  myIcon = new CaptionIcon(color,editor.getColoRSScheme().getFont(EditorFontType.PLAIN),presentation,component,CaptionIcon.Form.ROUNDED,false,false);
}
项目:intellij-ce-playground    文件:EditorView.java   
int getPlainSpaceWidth() {
  if (myPlainSpaceWidth < 0) {
    FontMetrics fm = myEditor.getContentComponent().getFontMetrics(myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN));
    int width = FontLayoutService.getInstance().charWidth(fm,' ');
    myPlainSpaceWidth = width > 0 ? width : 1;
  }
  return myPlainSpaceWidth;
}
项目:intellij-ce-playground    文件:EditorView.java   
public int getCharHeight() {
  synchronized (myLock) {
    if (myCharHeight < 0) {
      FontMetrics fm = myEditor.getContentComponent().getFontMetrics(myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN));
      myCharHeight = FontLayoutService.getInstance().charWidth(fm,'a');
    }
    return myCharHeight;
  }
}
项目:intellij-ce-playground    文件:EditorView.java   
int getMaxCharWidth() {
  synchronized (myLock) {
    if (myMaxCharWidth < 0) {
      // assuming that bold italic 'W' gives a good approximation of font's widest character
      FontMetrics fm = myEditor.getContentComponent().getFontMetrics(myEditor.getColoRSScheme().getFont(EditorFontType.BOLD_ITALIC));
      myMaxCharWidth = FontLayoutService.getInstance().charWidth(fm,'W'); 
    }
    return myMaxCharWidth;
  }
}
项目:intellij-ce-playground    文件:EditorView.java   
public int getDescent() {
  synchronized (myLock) {
    if (myDescent < 0) {
      FontMetrics fm = myEditor.getContentComponent().getFontMetrics(myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN));
      myDescent = FontLayoutService.getInstance().getDescent(fm);
    }
    return myDescent;
  }
}
项目:intellij-ce-playground    文件:JBListTable.java   
public static JComponent createEditorTextFieldPresentation(final Project project,final FileType type,final String text,boolean selected,boolean focused) {
  final JPanel panel = new JPanel(new BorderLayout());
  final EditorTextField field = new EditorTextField(text,project,type) {
    @Override
    protected boolean shouldHaveBorder() {
      return false;
    }
  };

  Font font = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN);
  font = new Font(font.getFontName(),font.getStyle(),12);
  field.setFont(font);
  field.addSettingsProvider(EditorSettingsProvider.NO_WHITESPACE);

  if (selected && focused) {
    panel.setBackground(UIUtil.getTableSelectionBackground());
    field.setAsRendererWithSelection(UIUtil.getTableSelectionBackground(),UIUtil.getTableSelectionForeground());
  } else {
    panel.setBackground(UIUtil.getTableBackground());
    if (selected) {
      panel.setBorder(new DottedBorder(UIUtil.getTableForeground()));
    }
  }
  panel.add(field,BorderLayout.WEST);
  return panel;
}
项目:intellij-ce-playground    文件:LookupCellRenderer.java   
public LookupCellRenderer(LookupImpl lookup) {
  EditorColoRSScheme scheme = lookup.getEditor().getColoRSScheme();
  mynormalFont = scheme.getFont(EditorFontType.PLAIN);
  myBoldFont = scheme.getFont(EditorFontType.BOLD);

  myLookup = lookup;
  myNameComponent = new MySimpleColoredComponent();
  myNameComponent.setIpad(JBUI.insetsLeft(2));
  myNameComponent.setMyBorder(null);

  myTailComponent = new MySimpleColoredComponent();
  myTailComponent.setIpad(new Insets(0,0));

  myTypeLabel = new MySimpleColoredComponent();
  myTypeLabel.setIpad(new Insets(0,0));

  myPanel = new LookupPanel();
  myPanel.add(myNameComponent,BorderLayout.CENTER);
  myTailComponent.setBorder(new EmptyBorder(0,AFTER_TAIL));

  myPanel.add(myTypeLabel,BorderLayout.EAST);
  myTypeLabel.setBorder(new EmptyBorder(0,AFTER_TYPE));

  mynormalMetrics = myLookup.getEditor().getComponent().getFontMetrics(mynormalFont);
  myBoldMetrics = myLookup.getEditor().getComponent().getFontMetrics(myBoldFont);
}
项目:intellij-ce-playground    文件:VariantsCompletionAction.java   
@Override
public void actionPerformed(final AnActionEvent e) {
  final Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
  if (editor == null) return;
  final String prefix = myTextField.getText().substring(0,myTextField.getcaretposition());
  if (StringUtil.isEmpty(prefix)) return;

    final String[] array = calcWords(prefix,editor);
    if (array.length == 0) {
      return;
    }

    FeatureUsageTracker.getInstance().triggerFeatureUsed("find.completion");
    final JList list = new JBList(array) {
      @Override
      protected void paintComponent(final Graphics g) {
        GraphicsUtil.setupAntialiasing(g);
        super.paintComponent(g);
      }
    };
    list.setBackground(new JBColor(new Color(235,244,254),new Color(0x4C4F51)));
    list.setFont(editor.getColoRSScheme().getFont(EditorFontType.PLAIN));

    Utils.showCompletionPopup(
      e.getInputEvent() instanceof MouseEvent ? myTextField: null,list,myTextField,null);
}
项目:intellij-ce-playground    文件:GenerateXmlTagAction.java   
public MyListCellRenderer() {
  myPanel = new JPanel(new BorderLayout());
  myPanel.setBorder(BorderFactory.createEmptyBorder(0,2,0));
  myNameLabel = new JLabel();

  myPanel.add(myNameLabel,BorderLayout.WEST);
  myPanel.add(new JLabel("     "));
  myNSLabel = new JLabel();
  myPanel.add(myNSLabel,BorderLayout.EAST);

  EditorColoRSScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
  Font font = scheme.getFont(EditorFontType.PLAIN);
  myNameLabel.setFont(font);
  myNSLabel.setFont(font);
}
项目:intellij-ce-playground    文件:BreadcrumbsXmlWrapper.java   
private void updateCrumbs() {
  if (myComponent != null && myEditor != null && !myEditor.isdisposed()) {
    final Font editorFont = myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN);
    myComponent.setFont(editorFont.deriveFont(Font.PLAIN,editorFont.getSize2D()));
    updateCrumbs(myEditor.getCaretModel().getLogicalPosition());
  }
}
项目:intellij-ce-playground    文件:AddGradleDslPluginActionHandler.java   
public MyListCellRenderer() {
  myPanel = new JPanel(new BorderLayout());
  myPanel.setBorder(BorderFactory.createEmptyBorder(0,BorderLayout.WEST);
  myPanel.add(new JLabel("     "));
  myDescLabel = new JLabel();
  myPanel.add(myDescLabel,BorderLayout.EAST);

  EditorColoRSScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
  Font font = scheme.getFont(EditorFontType.PLAIN);
  myNameLabel.setFont(font);
  myDescLabel.setFont(font);
}
项目:tools-idea    文件:FragmentNumberGutterIconRenderer.java   
public FragmentNumberGutterIconRenderer(String presentation,false);
}
项目:tools-idea    文件:JBListTable.java   
public static JComponent createEditorTextFieldPresentation(final Project project,BorderLayout.WEST);
  return panel;
}
项目:tools-idea    文件:LookupCellRenderer.java   
public LookupCellRenderer(LookupImpl lookup) {
  EditorColoRSScheme scheme = lookup.getEditor().getColoRSScheme();
  mynormalFont = scheme.getFont(EditorFontType.PLAIN);
  myBoldFont = scheme.getFont(EditorFontType.BOLD);

  myLookup = lookup;
  myNameComponent = new MySimpleColoredComponent();
  myNameComponent.setIpad(new Insets(0,0));

  myTailComponent = new MySimpleColoredComponent();
  myTailComponent.setIpad(new Insets(0,0));
  myTailComponent.setFont(mynormalFont);

  myTypeLabel = new MySimpleColoredComponent();
  myTypeLabel.setIpad(new Insets(0,0));
  myTypeLabel.setFont(mynormalFont);

  myPanel = new LookupPanel();
  myPanel.add(myNameComponent,AFTER_TYPE));

  mynormalMetrics = myLookup.getEditor().getComponent().getFontMetrics(mynormalFont);
  myBoldMetrics = myLookup.getEditor().getComponent().getFontMetrics(myBoldFont);
}
项目:tools-idea    文件:VariantsCompletionAction.java   
@Override
public void actionPerformed(final AnActionEvent e) {
  final String prefix = getPrefix();
  if (StringUtil.isEmpty(prefix)) return;

  Editor editor = getEditorSearchComponent().getEditor();
  if (editor != null) {
    final String[] array = calcWords(prefix,editor);
    if (array.length == 0) {
      return;
    }

    FeatureUsageTracker.getInstance().triggerFeatureUsed("find.completion");
    final JList list = new JBList(array) {
      @Override
      protected void paintComponent(final Graphics g) {
        GraphicsUtil.setupAntialiasing(g);
        super.paintComponent(g);
      }
    };
    list.setBackground(EditorSearchComponent.COMPLETION_BACKGROUND_COLOR);
    list.setFont(editor.getColoRSScheme().getFont(EditorFontType.PLAIN));

    Utils.showCompletionPopup(
      e.getInputEvent() instanceof MouseEvent ? getEditorSearchComponent().getToolbarComponent() : null,getTextField(),null);
  }
}
项目:tools-idea    文件:GenerateXmlTagAction.java   
public MyListCellRenderer() {
  myPanel = new JPanel(new BorderLayout());
  myPanel.setBorder(BorderFactory.createEmptyBorder(0,BorderLayout.EAST);

  EditorColoRSScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
  Font font = scheme.getFont(EditorFontType.PLAIN);
  myNameLabel.setFont(font);
  myNSLabel.setFont(font);
}
项目:tools-idea    文件:BreadcrumbsXmlWrapper.java   
private void updateCrumbs() {
  if (myComponent != null && myEditor != null) {
    final Font editorFont = myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN);
    myComponent.setFont(editorFont.deriveFont(Font.PLAIN,editorFont.getSize2D()));
    updateCrumbs(myEditor.getCaretModel().getLogicalPosition());
  }
}
项目:tools-idea    文件:copyrightConfigurable.java   
public JComponent createOptionsPanel() {
  mycopyrightPane.setFont(EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN));
  myValidateButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      try {
        VeLocityHelper.verify(mycopyrightPane.getText());
        Messages.showInfoMessage(myProject,"VeLocity template is valid.","Validation");
      }
      catch (Exception e1) {
        Messages.showInfoMessage(myProject,"VeLocity template contains error:\n" + e1.getMessage(),"Validation");
      }
    }
  });
  return myWholePanel;
}
项目:consulo-csharp    文件:CSharpChangeSignatureDialog.java   
private int getColumnWidth(int index)
{
    int letters = getTypesMaxLength() + (index == 0 ? 1 : getNamesMaxLength() + 2);
    Font font = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN);
    font = new Font(font.getFontName(),12);
    return letters * Toolkit.getDefaultToolkit().getFontMetrics(font).stringWidth("W");
}
项目:ali-idea-plugin    文件:DevMotiveAnnotationGutter.java   
@Override
public EditorFontType getStyle(int line,Editor editor) {
    VcsRevisionNumber revisionNumber = annotation.getLineRevisionNumber(line);
    if (revisionNumber != null && revisionNumber.equals(annotation.getCurrentRevision())) {
        return EditorFontType.BOLD_ITALIC;
    } else {
        return EditorFontType.ITALIC;
    }
}
项目:consulo    文件:FragmentNumberGutterIconRenderer.java   
public FragmentNumberGutterIconRenderer(String presentation,false);
}
项目:consulo    文件:EditorPainter.java   
private boolean paintPlaceholderText(Graphics2D g) {
  CharSequence hintText = myEditor.getPlaceholder();
  EditorComponentImpl editorComponent = myEditor.getContentComponent();
  if (myDocument.getTextLength() > 0 || hintText == null || hintText.length() == 0 ||
      KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == editorComponent &&
      !myEditor.getShowPlaceholderWhenFocused()) {
    return false;
  }

  hintText = SwingUtilities.layoutCompoundLabel(g.getFontMetrics(),SwingUtilities.calculateInnerArea(editorComponent,null),// account for insets
                                                new Rectangle(),0);
  EditorFontType fontType = EditorFontType.PLAIN;
  Color color = myEditor.getFoldingModel().getPlaceholderAttributes().getForegroundColor();
  TextAttributes attributes = myEditor.getPlaceholderAttributes();
  if (attributes != null) {
    int type = attributes.getFontType();
    if (type == Font.ITALIC) fontType = EditorFontType.ITALIC;
    else if (type == Font.BOLD) fontType = EditorFontType.BOLD;
    else if (type == (Font.ITALIC | Font.BOLD)) fontType = EditorFontType.BOLD_ITALIC;

    Color attColor = attributes.getForegroundColor();
    if (attColor != null) color = attColor;
  }
  g.setColor(color);
  g.setFont(myEditor.getColoRSScheme().getFont(fontType));
  Insets insets = myView.getInsets();
  g.drawString(hintText.toString(),insets.left,insets.top + myView.getAscent());
  return true;
}
项目:consulo    文件:EditorPainter.java   
private void paintTextEffect(Graphics2D g,float xFrom,float xTo,int y,Color effectColor,EffectType effectType,boolean allowBorder) {
  g.setColor(effectColor);
  int xStart = (int)xFrom;
  int xEnd = (int)xTo;
  if (effectType == EffectType.LINE_UNDERscore) {
    EffectPainter.LINE_UNDERscore.paint(g,xStart,y,xEnd - xStart,myView.getDescent(),myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN));
  }
  else if (effectType == EffectType.BOLD_LINE_UNDERscore) {
    EffectPainter.BOLD_LINE_UNDERscore.paint(g,myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN));
  }
  else if (effectType == EffectType.STRIKEOUT) {
    EffectPainter.STRIKE_THROUGH.paint(g,myView.getCharHeight(),myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN));
  }
  else if (effectType == EffectType.WAVE_UNDERscore) {
    EffectPainter.WAVE_UNDERscore.paint(g,myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN));
  }
  else if (effectType == EffectType.BOLD_DottED_LINE) {
    EffectPainter.BOLD_DottED_UNDERscore.paint(g,myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN));
  }
  else if (allowBorder && (effectType == EffectType.BoxED || effectType == EffectType.ROUNDED_Box)) {
    drawSimpleBorder(g,xFrom,xTo,y - myView.getAscent(),effectType == EffectType.ROUNDED_Box);
  }
}
项目:consulo    文件:JBListTable.java   
public static JComponent createEditorTextFieldPresentation(final Project project,UIUtil.getTableSelectionForeground());
  }
  else {
    panel.setBackground(UIUtil.getTableBackground());
    if (selected) {
      panel.setBorder(new DottedBorder(UIUtil.getTableForeground()));
    }
  }
  panel.add(field,BorderLayout.WEST);
  return panel;
}
项目:consulo    文件:VariantsCompletionAction.java   
@requireddispatchThread
@Override
public void actionPerformed(@Nonnull final AnActionEvent e) {
  final Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
  if (editor == null) return;
  final String prefix = myTextField.getText().substring(0,myTextField.getcaretposition());
  if (StringUtil.isEmpty(prefix)) return;

  final String[] array = calcWords(prefix,editor);
  if (array.length == 0) {
    return;
  }

  FeatureUsageTracker.getInstance().triggerFeatureUsed("find.completion");
  final JList list = new JBList(array) {
    @Override
    protected void paintComponent(final Graphics g) {
      GraphicsUtil.setupAntialiasing(g);
      super.paintComponent(g);
    }
  };
  list.setBackground(new JBColor(new Color(235,new Color(0x4C4F51)));
  list.setFont(editor.getColoRSScheme().getFont(EditorFontType.PLAIN));

  Utils.showCompletionPopup(
          e.getInputEvent() instanceof MouseEvent ? myTextField: null,null);
}
项目:consulo-xml    文件:GenerateXmlTagAction.java   
public MyListCellRenderer() {
  myPanel = new JPanel(new BorderLayout());
  myPanel.setBorder(BorderFactory.createEmptyBorder(0,BorderLayout.EAST);

  EditorColoRSScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
  Font font = scheme.getFont(EditorFontType.PLAIN);
  myNameLabel.setFont(font);
  myNSLabel.setFont(font);
}
项目:consulo-java    文件:JavaChangeSignatureDialog.java   
private int getColumnWidth(int index)
{
    int letters = getTypesMaxLength() + (index == 0 ? 1 : getNamesMaxLength() + 2);
    Font font = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN);
    font = new Font(font.getFontName(),12);
    return letters * Toolkit.getDefaultToolkit().getFontMetrics(font).stringWidth("W");
}
项目:intellij-ce-playground    文件:JavaFoldingBuilder.java   
@NotNull
public static String getRightArrow() {
  Font font = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN);
  return FontUtil.rightArrow(font);
}
项目:intellij-ce-playground    文件:JavaChangeSignatureDialog.java   
private int getColumnWidth(int index) {
  int letters = getTypesMaxLength() + (index == 0 ? 1 : getNamesMaxLength() + 2);
  Font font = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN);
  font = new Font(font.getFontName(),12);
  return  letters * Toolkit.getDefaultToolkit().getFontMetrics(font).stringWidth("W");
}
项目:intellij-ce-playground    文件:DefaultColoRSScheme.java   
@Override
public void setFont(EditorFontType key,Font font) {
}
项目:intellij-ce-playground    文件:FragmentNumberGutterIconRenderer.java   
public void resetFont(final Editor editor) {
  myIcon.setFont(editor.getColoRSScheme().getFont(EditorFontType.PLAIN));
}
项目:intellij-ce-playground    文件:EditorGutterComponentImpl.java   
private void paintAnnotations(Graphics2D g,Rectangle clip) {
  int x = getAnnotationsAreaOffset();
  int w = getAnnotationsAreaWidthEx();

  if (w == 0) return;

  AffineTransform old = g.getTransform();
  g.setTransform(getMirrorTransform(old,x,w));
  try {
    Color color = myEditor.getColoRSScheme().getColor(EditorColors.ANNOTATIONS_COLOR);
    g.setColor(color != null ? color : JBColor.blue);
    g.setFont(myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN));

    for (int i = 0; i < myTextAnnotationGutters.size(); i++) {
      TextAnnotationGutterProvider gutterProvider = myTextAnnotationGutters.get(i);

      int lineHeight = myEditor.getLineHeight();
      int startLineNumber = clip.y / lineHeight;
      int endLineNumber = (clip.y + clip.height) / lineHeight + 1;
      int lastLine = myEditor.logicalToVisualPosition(
        new LogicalPosition(endLineNumber(),0))
        .line;
      endLineNumber = Math.min(endLineNumber,lastLine + 1);
      if (startLineNumber >= endLineNumber) {
        break;
      }

      int annotationSize = myTextAnnotationGutterSizes.get(i);
      for (int j = startLineNumber; j < endLineNumber; j++) {
        int logLine = myEditor.visualToLogicalPosition(new VisualPosition(j,0)).line;
        String s = gutterProvider.getLineText(logLine,myEditor);
        final EditorFontType style = gutterProvider.getStyle(logLine,myEditor);
        final Color bg = gutterProvider.getBgColor(logLine,myEditor);
        if (bg != null) {
          g.setColor(bg);
          g.fillRect(x,j * lineHeight,annotationSize,lineHeight);
        }
        g.setColor(myEditor.getColoRSScheme().getColor(gutterProvider.getColor(logLine,myEditor)));
        g.setFont(myEditor.getColoRSScheme().getFont(style));
        if (s != null) {
          g.drawString(s,(j + 1) * lineHeight - myEditor.getDescent());
        }
      }

      x += annotationSize;
    }

  }
  finally {
    g.setTransform(old);
  }
}
项目:intellij-ce-playground    文件:EditorGutterComponentImpl.java   
private void doPaintLineNumbers(Graphics2D g,Rectangle clip,int offset,@NotNull TIntFunction convertor) {
  if (!isLineNumbeRSShown()) {
    return;
  }
  int lineHeight = myEditor.getLineHeight();
  int startLineNumber = clip.y / lineHeight;
  int endLineNumber = (clip.y + clip.height) / lineHeight + 1;
  int lastLine = myEditor.logicalToVisualPosition(
    new LogicalPosition(endLineNumber(),0))
    .line;
  endLineNumber = Math.min(endLineNumber,lastLine + 1);
  if (startLineNumber >= endLineNumber) {
    return;
  }

  Color color = myEditor.getColoRSScheme().getColor(EditorColors.LINE_NUMBERS_COLOR);
  g.setColor(color != null ? color : JBColor.blue);
  g.setFont(myEditor.getColoRSScheme().getFont(EditorFontType.PLAIN));

  AffineTransform old = g.getTransform();
  g.setTransform(getMirrorTransform(old,getLineNumberAreaOffset(),getLineNumberAreaWidth()));
  try {
    for (int i = startLineNumber; i < endLineNumber; i++) {
      LogicalPosition logicalPosition = myEditor.visualToLogicalPosition(new VisualPosition(i,0));
      if (EditorUtil.getSoftWrapCountAfterLinestart(myEditor,logicalPosition) > 0) {
        continue;
      }
      int logLine = convertor.execute(logicalPosition.line);
      if (logLine >= 0) {
        String s = String.valueOf(logLine + 1);
        int startY = (i + 1) * lineHeight;
        if (myEditor.isIndistractionFreeMode()) {
          Color fgColor = myTextFgColors.get(i);
          g.setColor(fgColor != null ? fgColor : color != null ? color : JBColor.blue);
        }

        int textOffset = isMirrored() ?
                         offset - getLineNumberAreaWidth() - 1:
                         offset - myEditor.getFontMetrics(Font.PLAIN).stringWidth(s);

        g.drawString(s,textOffset,startY - myEditor.getDescent());
      }
    }
  }
  finally {
    g.setTransform(old);
  }
}
项目:intellij-ce-playground    文件:AnnotationFieldGutter.java   
public EditorFontType getStyle(final int line,final Editor editor) {
  return myPresentation.getFontType(line);
}
项目:intellij-ce-playground    文件:AnnotationPresentation.java   
public EditorFontType getFontType(final int line) {
  VcsRevisionNumber revision = myFileAnnotation.originalRevision(line);
  VcsRevisionNumber currentRevision = myFileAnnotation.getCurrentRevision();
  return currentRevision != null && currentRevision.equals(revision) ? EditorFontType.BOLD : EditorFontType.PLAIN;
}

com.intellij.openapi.editor.colors.FontPreferences的实例源码

com.intellij.openapi.editor.colors.FontPreferences的实例源码

项目:intellij-ce-playground    文件:FontOptions.java   
private void syncFontFamilies() {
  if (myIsInSchemeChange) {
    return;
  }
  FontPreferences fontPreferences = getFontPreferences();
  fontPreferences.clearFonts();
  String primaryFontFamily = (String)myPrimaryCombo.getSelectedItem();
  String secondaryFontFamily = mySecondaryCombo.isEnabled() ? (String)mySecondaryCombo.getSelectedItem() : null;
  int fontSize = getFontSizefromField();
  if (primaryFontFamily != null ) {
    if (!FontPreferences.DEFAULT_FONT_NAME.equals(primaryFontFamily)) {
      fontPreferences.addFontFamily(primaryFontFamily);
    }
    fontPreferences.register(primaryFontFamily,JBUI.scale(fontSize));
  }
  if (secondaryFontFamily != null) {
    if (!FontPreferences.DEFAULT_FONT_NAME.equals(secondaryFontFamily)){
      fontPreferences.addFontFamily(secondaryFontFamily);
    }
    fontPreferences.register(secondaryFontFamily,JBUI.scale(fontSize));
  }
  updateDescription(true);
}
项目:intellij-ce-playground    文件:FontOptions.java   
@Override
public void updateOptionsList() {
  myIsInSchemeChange = true;

  myLinespacingField.setText(Float.toString(getLinespacing()));
  FontPreferences fontPreferences = getFontPreferences();
  List<String> fontFamilies = fontPreferences.getEffectiveFontFamilies();
  myPrimaryCombo.setSelectedItem(fontPreferences.getFontFamily());
  boolean isThereSecondaryFont = fontFamilies.size() > 1;
  myUseSecondaryFontCheckBox.setSelected(isThereSecondaryFont);
  mySecondaryCombo.setSelectedItem(isThereSecondaryFont ? fontFamilies.get(1) : null);
  myEditorFontSizefield.setText(String.valueOf(fontPreferences.getSize(fontPreferences.getFontFamily())));

  boolean readOnly = ColorAndFontOptions.isReadOnly(myOptions.getSelectedScheme());
  myPrimaryCombo.setEnabled(!readOnly);
  mySecondaryCombo.setEnabled(isThereSecondaryFont && !readOnly);
  myOnlyMonospacedCheckBox.setEnabled(!readOnly);
  myLinespacingField.setEnabled(!readOnly);
  myEditorFontSizefield.setEditable(!readOnly);
  myUseSecondaryFontCheckBox.setEnabled(!readOnly);

  myIsInSchemeChange = false;
}
项目:intellij-ce-playground    文件:FontOptions.java   
private void updateModel() {
  if (myFontNames == null || myMonospacedFontNames == null) return;

  if (myMonospacedOnly == null || myMonospacedOnly.booleanValue() != EditorColorsManager.getInstance().isUSEOnlyMonospacedFonts()) {
    myMonospacedOnly = EditorColorsManager.getInstance().isUSEOnlyMonospacedFonts();

    Object tmp = getSelectedItem();
    myModel.removeAllElements();
    List toAdd = myMonospacedOnly ? myMonospacedFontNames : myFontNames;
    for (Object o : toAdd) {
      myModel.addElement(o);
    }
    if (myModel.getIndexOf(tmp) != -1) {
      setSelectedItem(tmp);
    } else {
      setSelectedItem(FontPreferences.DEFAULT_FONT_NAME);
    }

    fireActionEvent();
    revalidate();
    repaint();
  }
}
项目:tools-idea    文件:ComplementaryFontsRegistry.java   
@NotNull
public static FontInfo getFontAbletodisplay(char c,@JdkConstants.FontStyle int style,@NotNull FontPreferences preferences) {
  boolean tryDefaultFont = true;
  List<String> fontFamilies = preferences.getEffectiveFontFamilies();
  FontInfo result;
  for (String fontFamily : fontFamilies) {
    result = doGetFontAbletodisplay(c,preferences.getSize(fontFamily),style,fontFamily);
    if (result != null) {
      return result;
    }
    tryDefaultFont &= !FontPreferences.DEFAULT_FONT_NAME.equals(fontFamily);
  }
  int size = FontPreferences.DEFAULT_FONT_SIZE;
  if (!fontFamilies.isEmpty()) {
    size = preferences.getSize(fontFamilies.get(0));
  }
  if (tryDefaultFont) {
    result = doGetFontAbletodisplay(c,size,FontPreferences.DEFAULT_FONT_NAME);
    if (result != null) {
      return result;
    }
  }
  return doGetFontAbletodisplay(c,style);
}
项目:consulo    文件:FontPreferencesImpl.java   
@Override
public void copyTo(@Nonnull final FontPreferences preferences) {
  if (preferences instanceof ModifiableFontPreferences) {
    ModifiableFontPreferences modifiablePreferences = (ModifiableFontPreferences)preferences;
    modifiablePreferences.setEffectiveFontFamilies(myEffectiveFontFamilies);
    modifiablePreferences.setRealFontFamilies(myRealFontFamilies);
    modifiablePreferences.setTemplateFontSize(myTemplateFontSize);
    modifiablePreferences.resetFontSizes();
    for (String fontFamily : myRealFontFamilies) {
      if (myFontSizes.containsKey(fontFamily)) {
        modifiablePreferences.setFontSize(fontFamily,myFontSizes.get(fontFamily));
      }
    }
    modifiablePreferences.setUseligatures(myUseligatures);
    modifiablePreferences.setLinespacing(myLinespacing);
  }
}
项目:consulo    文件:LookupCellRenderer.java   
@Nullable
Font getFontAbletodisplay(LookupElementPresentation p) {
  String sampleString = p.getItemText() + p.getTailText() + p.getTypeText();

  // assume a single font can display all lookup item chars
  Set<Font> fonts = ContainerUtil.newHashSet();
  FontPreferences fontPreferences = myLookup.getFontPreferences();
  for (int i = 0; i < sampleString.length(); i++) {
    fonts.add(ComplementaryFontsRegistry.getFontAbletodisplay(sampleString.charat(i),Font.PLAIN,fontPreferences,null).getFont());
  }

  eachFont: for (Font font : fonts) {
    if (font.equals(mynormalFont)) continue;

    for (int i = 0; i < sampleString.length(); i++) {
      if (!font.candisplay(sampleString.charat(i))) {
        continue eachFont;
      }
    }
    return font;
  }
  return null;
}
项目:consulo    文件:FontOptions.java   
private void syncFontFamilies() {
  if (myIsInSchemeChange) {
    return;
  }
  ModifiableFontPreferences fontPreferences = getFontPreferences();
  fontPreferences.clearFonts();
  String primaryFontFamily = myPrimaryCombo.getFontName();
  String secondaryFontFamily = mySecondaryCombo.isEnabled() ? mySecondaryCombo.getFontName() : null;
  int fontSize = getFontSizefromField();
  if (primaryFontFamily != null ) {
    if (!FontPreferences.DEFAULT_FONT_NAME.equals(primaryFontFamily)) {
      fontPreferences.addFontFamily(primaryFontFamily);
    }
    fontPreferences.register(primaryFontFamily,JBUI.scale(fontSize));
  }
  updateDescription(true);
}
项目:intellij-ce-playground    文件:LineLayout.java   
private static List<BidiRun> createFragments(@NotNull EditorView view,@NotNull CharSequence text,@JdkConstants.FontStyle int fontStyle) {
  if (text.length() == 0) return Collections.emptyList();
  EditorImpl editor = view.getEditor();
  FontRenderContext fontRenderContext = view.getFontRenderContext();
  FontPreferences fontPreferences = editor.getColoRSScheme().getFontPreferences();
  char[] chars = ChararrayUtil.fromSequence(text);
  List<BidiRun> runs = createRuns(editor,chars,-1);
  for (BidiRun run : runs) {
    for (Chunk chunk : run.getChunks()) {
      addFragments(run,chunk,chunk.startOffset,chunk.endOffset,fontStyle,fontRenderContext,null);
    }
  }
  return runs;
}
项目:intellij-ce-playground    文件:LineLayout.java   
private static void addFragments(BidiRun run,Chunk chunk,char[] text,int start,int end,int fontStyle,FontPreferences fontPreferences,FontRenderContext fontRenderContext,@Nullable TabFragment tabFragment) {
  assert start < end;
  Font currentFont = null;
  int currentIndex = start;
  for(int i = start; i < end; i++) {
    char c = text[i];
    if (c == '\t' && tabFragment != null) {
      assert run.level == 0;
      addTextFragmentIfNeeded(chunk,text,currentIndex,i,currentFont,false);
      chunk.fragments.add(tabFragment);
      currentFont = null;
      currentIndex = i + 1;
    }
    else {
      Font font = ComplementaryFontsRegistry.getFontAbletodisplay(c,fontPreferences).getFont();
      if (!font.equals(currentFont)) {
        addTextFragmentIfNeeded(chunk,run.isRtl());
        currentFont = font;
        currentIndex = i;
      }
    }
  }
  addTextFragmentIfNeeded(chunk,end,run.isRtl());
  assert !chunk.fragments.isEmpty();
}
项目:intellij-ce-playground    文件:EditorColoRSSchemeDelegateTest.java   
public void testSecondaryFontIsAvailable() throws Exception {
  FontPreferences globalPrefs = myTestScheme.getFontPreferences();
  globalPrefs.register("DummyFont",globalPrefs.getSize(globalPrefs.getFontFamily()));
  assertEquals(2,globalPrefs.getRealFontFamilies().size());

  init("blah",TestFileType.TEXT);

  FontPreferences editorPrefs = myEditor.getColoRSScheme().getFontPreferences();
  assertEquals(2,editorPrefs.getRealFontFamilies().size());
  assertEquals("DummyFont",editorPrefs.getRealFontFamilies().get(1));
}
项目:intellij-ce-playground    文件:FontUtil.java   
@NotNull
public static Font getFontAbletodisplay(@NotNull String s,@NotNull Font defaultFont) {
  if (SystemInfo.isMac          // On Macs,all fonts can display all the characters because the system renders using fallback fonts.
      || isExtendedAscii(s)) {  // Assume that default font can handle ASCII
    return defaultFont;
  }

  Set<Font> fonts = Sets.newHashSetWithExpectedSize(10);

  FontPreferences fontPreferences = EditorColorsManager.getInstance().getGlobalScheme().getFontPreferences();
  for (int i = 0; i < s.length(); i++) {
    if (s.charat(i) > 255) {
      fonts.add(ComplementaryFontsRegistry.getFontAbletodisplay(s.charat(i),fontPreferences).getFont());
    }
  }

  if (fonts.isEmpty()) {
    return defaultFont;
  }

  // find the font the can handle the most # of characters
  Font bestFont = defaultFont;
  int max = 0;
  for (Font f : fonts) {
    int supportedChars = 0;
    for (int i = 0; i < s.length(); i++) {
      if (f.candisplay(s.charat(i))) {
        supportedChars++;
      }
    }

    if (supportedChars > max) {
      max = supportedChars;
      bestFont = f;
    }
  }

  return bestFont;
}
项目:consulo    文件:FontPreferencesImpl.java   
@Override
public void register(@Nonnull String fontFamily,int size) {
  String fallbackFontFamily = FontPreferences.getFallbackName(fontFamily,null);
  if (!myRealFontFamilies.contains(fontFamily)) {
    myRealFontFamilies.add(fontFamily);
  }
  String effectiveFontFamily = fallbackFontFamily == null ? fontFamily : fallbackFontFamily;
  if (!myEffectiveFontFamilies.contains(effectiveFontFamily)) {
    myEffectiveFontFamilies.add(effectiveFontFamily);
  }
  setSize(fontFamily,size);
}
项目:consulo    文件:FontPreferencesImpl.java   
@Override
public void addFontFamily(@Nonnull String fontFamily) {
  String fallbackFontFamily = FontPreferences.getFallbackName(fontFamily,DEFAULT_FONT_SIZE,null);
  if (!myRealFontFamilies.contains(fontFamily)) {
    myRealFontFamilies.add(fontFamily);
  }
  String effectiveFontFamily = fallbackFontFamily == null ? fontFamily : fallbackFontFamily;
  if (!myEffectiveFontFamilies.contains(effectiveFontFamily)) {
    myEffectiveFontFamilies.add(effectiveFontFamily);
  }
  if (mychangelistener != null) {
    mychangelistener.run();
  }
}
项目:consulo    文件:LineLayout.java   
private static List<BidiRun> createFragments(@Nonnull EditorView view,@Nonnull CharSequence text,@JdkConstants.FontStyle int fontStyle) {
  if (text.length() == 0) return Collections.emptyList();
  FontRenderContext fontRenderContext = view.getFontRenderContext();
  FontPreferences fontPreferences = view.getEditor().getColoRSScheme().getFontPreferences();
  char[] chars = ChararrayUtil.fromSequence(text);
  List<BidiRun> runs = createRuns(view,-1);
  for (BidiRun run : runs) {
    for (Chunk chunk : run.getChunks(text,0)) {
      chunk.fragments = new ArrayList<>();
      addFragments(run,null);
    }
  }
  return runs;
}
项目:consulo    文件:LineLayout.java   
@SuppressWarnings("AssignmentToForLoopParameter")
private static void addFragments(BidiRun run,@Nullable TabFragment tabFragment) {
  assert start < end;
  FontInfo currentFontInfo = null;
  int currentIndex = start;
  for(int i = start; i < end; i++) {
    char c = text[i];
    if (c == '\t' && tabFragment != null) {
      assert run.level == 0;
      addTextFragmentIfNeeded(chunk,currentFontInfo,false);
      chunk.fragments.add(tabFragment);
      currentFontInfo = null;
      currentIndex = i + 1;
    }
    else {
      boolean surrogatePair = false;
      int codePoint = c;
      if (Character.isHighSurrogate(c) && (i + 1 < end)) {
        char nextChar = text[i + 1];
        if (Character.isLowSurrogate(nextChar)) {
          codePoint = Character.toCodePoint(c,nextChar);
          surrogatePair = true;
        }
      }
      FontInfo fontInfo = ComplementaryFontsRegistry.getFontAbletodisplay(codePoint,fontRenderContext);
      if (!fontInfo.equals(currentFontInfo)) {
        addTextFragmentIfNeeded(chunk,run.isRtl());
        currentFontInfo = fontInfo;
        currentIndex = i;
      }
      if (surrogatePair) i++;
    }
  }
  addTextFragmentIfNeeded(chunk,run.isRtl());
  assert !chunk.fragments.isEmpty();
}
项目:consulo    文件:XDebuggerInlayUtil.java   
private static FontInfo getFontInfo(@Nonnull Editor editor) {
  EditorColoRSScheme coloRSScheme = editor.getColoRSScheme();
  FontPreferences fontPreferences = coloRSScheme.getFontPreferences();
  TextAttributes attributes = editor.getColoRSScheme().getAttributes(DebuggerColors.INLINED_VALUES_EXECUTION_LINE);
  int fontStyle = attributes == null ? Font.PLAIN : attributes.getFontType();
  return ComplementaryFontsRegistry.getFontAbletodisplay('a',FontInfo.getFontRenderContext(editor.getContentComponent()));
}
项目:consulo    文件:FontOptions.java   
@Override
public void updateOptionsList() {
  myIsInSchemeChange = true;

  myLinespacingField.setText(Float.toString(getLinespacing()));
  FontPreferences fontPreferences = getFontPreferences();
  List<String> fontFamilies = fontPreferences.getEffectiveFontFamilies();
  myPrimaryCombo.setFontName(fontPreferences.getFontFamily());
  boolean isThereSecondaryFont = fontFamilies.size() > 1;
  myUseSecondaryFontCheckBox.setSelected(isThereSecondaryFont);
  mySecondaryCombo.setFontName(isThereSecondaryFont ? fontFamilies.get(1) : null);
  myEditorFontSizefield.setText(String.valueOf(fontPreferences.getSize(fontPreferences.getFontFamily())));

  boolean readOnly = ColorAndFontOptions.isReadOnly(myOptions.getSelectedScheme());
  myPrimaryCombo.setEnabled(!readOnly);
  mySecondaryCombo.setEnabled(isThereSecondaryFont && !readOnly);
  myOnlyMonospacedCheckBox.setEnabled(!readOnly);
  myLinespacingField.setEnabled(!readOnly);
  myEditorFontSizefield.setEnabled(!readOnly);
  myUseSecondaryFontCheckBox.setEnabled(!readOnly);

  myEnableligaturesCheckBox.setEnabled(!readOnly);
  myligaturesInfoLinkLabel.setEnabled(!readOnly);
  myEnableligaturesCheckBox.setSelected(fontPreferences.useligatures());

  myIsInSchemeChange = false;
}
项目:intellij-ce-playground    文件:FontOptions.java   
@NotNull
protected FontPreferences getFontPreferences() {
  return getCurrentScheme().getFontPreferences();
}
项目:intellij-ce-playground    文件:ConsoleFontOptions.java   
@NotNull
@Override
protected FontPreferences getFontPreferences() {
  return getCurrentScheme().getConsoleFontPreferences();
}
项目:intellij-ce-playground    文件:TextWithMarkupProcessor.java   
private SegmentIterator(CharSequence charSequence,FontPreferences fontPreferences) {
  myCharSequence = charSequence;
  myFontPreferences = fontPreferences;
}
项目:tools-idea    文件:ConsoleViewUtil.java   
public static DelegateColorScheme updateConsoleColorScheme(EditorColoRSScheme scheme) {
  return new DelegateColorScheme(scheme) {
    @NotNull
    @Override
    public Color getDefaultBackground() {
      final Color color = getColor(ConsoleViewContentType.CONSOLE_BACKGROUND_KEY);
      return color == null ? super.getDefaultBackground() : color;
    }

    @NotNull
    @Override
    public FontPreferences getFontPreferences() {
      return getConsoleFontPreferences();
    }

    @Override
    public int getEditorFontSize() {
      return getConsoleFontSize();
    }

    @Override
    public String getEditorFontName() {
      return getConsoleFontName();
    }

    @Override
    public float getLinespacing() {
      return getConsoleLinespacing();
    }

    @Override
    public Font getFont(EditorFontType key) {
      return super.getFont(EditorFontType.getConsoleType(key));
    }

    @Override
    public void setEditorFontSize(int fontSize) {
      setConsoleFontSize(fontSize);
    }
  };
}
项目:tools-idea    文件:FontOptions.java   
@Override
public void updateOptionsList() {
  myIsInSchemeChange = true;

  myLinespacingField.setText(Float.toString(getLinespacing()));
  mySelectedFontsModel.clear();
  FontPreferences fontPreferences = getFontPreferences();
  List<String> fontFamilies = fontPreferences.getEffectiveFontFamilies();
  Set<String> selectedFonts = ContainerUtilRt.newHashSet();
  Object selectedValue = mySelectedFontsList.getSelectedValue();
  mySelectedFontsModel.clear();
  if (fontFamilies.isEmpty()) {
    // Add default font.
    mySelectedFontsModel.addElement(fontPreferences.getFontFamily());
    selectedFonts.add(fontPreferences.getFontFamily());
  }
  else {
    for (String fontFamily : fontFamilies) {
      mySelectedFontsModel.addElement(fontFamily);
      selectedFonts.add(fontFamily);
    }
  }

  int newSelectionIndex = 0;
  if (selectedValue != null) {
    newSelectionIndex = Math.max(0,mySelectedFontsModel.indexOf(selectedValue));
  }
  mySelectedFontsList.setSelectedindex(newSelectionIndex);

  for (int i = myAllFontsModel.size() - 1; i >= 0; i--) {
    if (selectedFonts.contains(myAllFontsModel.getElementAt(i))) {
      myAllFontsModel.remove(i);
    }
  }
  myEditorFontSizefield.setText(String.valueOf(fontPreferences.getSize(fontPreferences.getFontFamily())));

  boolean enabled = !ColorAndFontOptions.isReadOnly(myOptions.getSelectedScheme());
  myOnlyMonospacedCheckBox.setEnabled(enabled);
  myLinespacingField.setEnabled(enabled);
  myEditorFontSizefield.setEditable(enabled);
  myFontsControl.setEnabled(enabled);

  myIsInSchemeChange = false;
}
项目:tools-idea    文件:FontOptions.java   
@NotNull
protected FontPreferences getFontPreferences() {
  return getCurrentScheme().getFontPreferences();
}
项目:tools-idea    文件:ConsoleFontOptions.java   
@NotNull
@Override
protected FontPreferences getFontPreferences() {
  return getCurrentScheme().getConsoleFontPreferences();
}
项目:intellij-xquery    文件:InitializationTest.java   
@Test
public void shouldInitializefontPreferencesBeforeAllOtherTestsSoThatItDoesNotthrowExceptionsInTravis() {
    new FontPreferences();
}
项目:consulo    文件:ComplementaryFontsRegistry.java   
/**
 * @deprecated Use {{@link #getFontAbletodisplay(int,int,FontPreferences,FontRenderContext)}} instead.
 */
@Nonnull
public static FontInfo getFontAbletodisplay(int codePoint,@Nonnull FontPreferences preferences) {
  return getFontAbletodisplay(codePoint,preferences,null);
}
项目:consulo    文件:LookupImpl.java   
FontPreferences getFontPreferences() {
  return myFontPreferences;
}
项目:consulo    文件:TextWithMarkupProcessor.java   
private SegmentIterator(CharSequence charSequence,FontPreferences fontPreferences) {
  myCharSequence = charSequence;
  myFontPreferences = fontPreferences;
}

关于com.intellij.ui.ReferenceEditorWithBrowseButton的实例源码源代码示例的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于android.content.SharedPreferences.Editor的实例源码、com.intellij.openapi.editor.CaretAction的实例源码、com.intellij.openapi.editor.colors.EditorFontType的实例源码、com.intellij.openapi.editor.colors.FontPreferences的实例源码的相关信息,请在本站寻找。

本文标签: