本文整理汇总了Java中com.intellij.openapi.vfs.CharsetToolkit.getAvailableCharsets方法的典型用法代码示例。如果您正苦于以下问题:Java CharsetToolkit.getAvailableCharsets方法的具体用法?Java CharsetToolkit.getAvailableCharsets怎么用?Java CharsetToolkit.getAvailableCharsets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vfs.CharsetToolkit
的用法示例。
在下文中一共展示了CharsetToolkit.getAvailableCharsets方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reset
import com.intellij.openapi.vfs.CharsetToolkit; //导入方法依赖的package包/类
@Override
public void reset() {
final DefaultComboBoxModel encodingsModel = new DefaultComboBoxModel(CharsetToolkit.getAvailableCharsets());
encodingsModel.insertElementAt(SYSTEM_DEFAULT, 0);
myPanel.myIDEEncodingComboBox.setModel(encodingsModel);
final String name = EncodingManager.getInstance().getDefaultCharsetName();
if (StringUtil.isEmpty(name)) {
myPanel.myIDEEncodingComboBox.setSelectedItem(SYSTEM_DEFAULT);
}
else {
myPanel.myIDEEncodingComboBox.setSelectedItem(EncodingManager.getInstance().getDefaultCharset());
}
}
示例2: initEncodings
import com.intellij.openapi.vfs.CharsetToolkit; //导入方法依赖的package包/类
private void initEncodings() {
Charset[] availableCharsets = CharsetToolkit.getAvailableCharsets();
myEncoding.setModel(new DefaultComboBoxModel(availableCharsets));
int defaultIndex = Arrays.asList(availableCharsets).indexOf(CharsetToolkit.getDefaultSystemCharset());
myEncoding.setSelectedIndex(defaultIndex);
myEncoding.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
refreshText();
}
}
});
}
示例3: initEncodingCombo
import com.intellij.openapi.vfs.CharsetToolkit; //导入方法依赖的package包/类
private void initEncodingCombo() {
final DefaultComboBoxModel encodingsModel = new DefaultComboBoxModel(CharsetToolkit.getAvailableCharsets());
encodingsModel.insertElementAt(SYSTEM_DEFAULT, 0);
myEncoding.setModel(encodingsModel);
final String name = EncodingProjectManager.getInstance(myProject).getDefaultCharsetName();
if (StringUtil.isEmpty(name)) {
myEncoding.setSelectedItem(SYSTEM_DEFAULT);
}
else {
myEncoding.setSelectedItem(EncodingProjectManager.getInstance(myProject).getDefaultCharset());
}
}
示例4: getVariants
import com.intellij.openapi.vfs.CharsetToolkit; //导入方法依赖的package包/类
@Override
@NotNull
public Object[] getVariants() {
Charset[] charsets = CharsetToolkit.getAvailableCharsets();
List<LookupElement> suggestions = new ArrayList<LookupElement>(charsets.length);
for (Charset charset : charsets) {
suggestions.add(LookupElementBuilder.create(charset.name()).withCaseSensitivity(false));
}
return suggestions.toArray(new LookupElement[suggestions.size()]);
}
示例5: getVariants
import com.intellij.openapi.vfs.CharsetToolkit; //导入方法依赖的package包/类
@Override
protected Object[] getVariants(@NotNull PsiReferenceBase reference) {
Charset[] charsets = CharsetToolkit.getAvailableCharsets();
LookupElement[] res = new LookupElement[charsets.length];
for (int i = 0; i < charsets.length; i++) {
res[i] = LookupElementBuilder.create(charsets[i].name()).withCaseSensitivity(false);
}
return res;
}
示例6: encodingExists
import com.intellij.openapi.vfs.CharsetToolkit; //导入方法依赖的package包/类
private static boolean encodingExists(String encoding) {
final Charset[] availableCharsets = CharsetToolkit.getAvailableCharsets();
for (Charset availableCharset : availableCharsets) {
if (availableCharset.name().equals(encoding)) {
return true;
}
}
return false;
}
示例7: GlobalCvsSettingsPanel
import com.intellij.openapi.vfs.CharsetToolkit; //导入方法依赖的package包/类
public GlobalCvsSettingsPanel(Project project) {
myPServerPanel.setLayout(new BorderLayout());
myPServerSettingsPanel = new PServerSettingsPanel(project);
myPServerPanel.add(myPServerSettingsPanel.getPanel(), BorderLayout.CENTER);
myCharset.addItem(CvsApplicationLevelConfiguration.DEFAULT);
final Charset[] availableCharsets = CharsetToolkit.getAvailableCharsets();
for (Charset charset : availableCharsets) {
myCharset.addItem(charset.name());
}
}
示例8: addSpecificCompletions
import com.intellij.openapi.vfs.CharsetToolkit; //导入方法依赖的package包/类
@Override
@Nullable
@NonNls
protected String[] addSpecificCompletions(final XmlAttribute attribute) {
@NonNls String name = attribute.getName();
final XmlTag tag = attribute.getParent();
if (tag == null) return null;
@NonNls String tagName = tag.getName();
if (!myCaseSensitive) {
name = name.toLowerCase();
tagName = tagName.toLowerCase();
}
final String namespace = tag.getNamespace();
if (XmlUtil.XHTML_URI.equals(namespace) || XmlUtil.HTML_URI.equals(namespace)) {
if ("target".equals(name)) {
return new String[]{"_blank", "_top", "_self", "_parent"};
}
else if ("enctype".equals(name)) {
return new String[]{"multipart/form-data", "application/x-www-form-urlencoded"};
}
else if ("rel".equals(name) || "rev".equals(name)) {
return new String[]{"alternate", "author", "bookmark", "help", "icon", "license", "next", "nofollow",
"noreferrer", "prefetch", "prev", "search", "stylesheet", "tag", "start", "contents", "index",
"glossary", "copyright", "chapter", "section", "subsection", "appendix", "script", "import",
"apple-touch-icon", "apple-touch-icon-precomposed", "apple-touch-startup-image"};
}
else if ("media".equals(name)) {
return new String[]{ "all", "braille", "embossed", "handheld", "print", "projection", "screen", "speech", "tty", "tv" };
}
else if ("language".equals(name)) {
return new String[]{"JavaScript", "VBScript", "JScript", "JavaScript1.2", "JavaScript1.3", "JavaScript1.4", "JavaScript1.5"};
}
else if ("type".equals(name) && "link".equals(tagName)) {
return new String[]{"text/css", "text/html", "text/plain", "text/xml"};
}
else if ("http-equiv".equals(name) && "meta".equals(tagName)) {
return HtmlUtil.RFC2616_HEADERS;
}
else if("content".equals(name) && "meta".equals(tagName) && getAttribute(tag, "name") == null) {
return HtmlUtil.CONTENT_TYPES;
}
else if ("accept".equals(name) && "input".equals(tagName)) {
return HtmlUtil.CONTENT_TYPES;
}
else if("accept-charset".equals(name) || "charset".equals(name)) {
Charset[] charSets = CharsetToolkit.getAvailableCharsets();
String[] names = new String[charSets.length];
for (int i = 0; i < names.length; i++) {
names[i] = charSets[i].toString();
}
return names;
}
}
return null;
}