本文整理汇总了Java中com.intellij.codeInsight.CodeInsightSettings.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java CodeInsightSettings.getInstance方法的具体用法?Java CodeInsightSettings.getInstance怎么用?Java CodeInsightSettings.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInsight.CodeInsightSettings
的用法示例。
在下文中一共展示了CodeInsightSettings.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAutoImportAfterUncomment
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
public void testAutoImportAfterUncomment() throws Throwable {
@NonNls String text = "class S { /*ArrayList l; HashMap h; <caret>*/ }";
configureByText(StdFileTypes.JAVA, text);
boolean old = CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY;
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = true;
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true);
try {
doHighlighting();
assertEmpty(((PsiJavaFile)getFile()).getImportList().getAllImportStatements());
CommentByBlockCommentAction action = new CommentByBlockCommentAction();
action.actionPerformedImpl(getProject(), getEditor());
assertEmpty(highlightErrors());
assertNotSame(0, ((PsiJavaFile)getFile()).getImportList().getAllImportStatements().length);
}
finally {
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old;
}
}
示例2: reset
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
public void reset() {
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
DaemonCodeAnalyzerSettings daemonSettings = DaemonCodeAnalyzerSettings.getInstance();
switch (codeInsightSettings.ADD_IMPORTS_ON_PASTE) {
case CodeInsightSettings.YES:
mySmartPasteCombo.setSelectedItem(INSERT_IMPORTS_ALWAYS);
break;
case CodeInsightSettings.NO:
mySmartPasteCombo.setSelectedItem(INSERT_IMPORTS_NONE);
break;
case CodeInsightSettings.ASK:
mySmartPasteCombo.setSelectedItem(INSERT_IMPORTS_ASK);
break;
}
myCbShowImportPopup.setSelected(daemonSettings.isImportHintEnabled());
myCbOptimizeImports.setSelected(codeInsightSettings.OPTIMIZE_IMPORTS_ON_THE_FLY);
myCbAddUnambiguousImports.setSelected(codeInsightSettings.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY);
myExcludePackagesTable.reset();
}
示例3: doTest
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
private void doTest(final char c) {
boolean old = CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION;
if (c != Lookup.NORMAL_SELECT_CHAR) {
CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION = false;
}
try {
configureByTestName();
if (myItems != null) {
select(c);
}
checkResultByTestName();
}
finally {
if (c != Lookup.NORMAL_SELECT_CHAR) {
CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION = old;
}
}
}
示例4: apply
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
public void apply() {
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
codeInsightSettings.COMPLETION_CASE_SENSITIVE = getCaseSensitiveValue();
codeInsightSettings.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = myCbSelectByChars.isSelected();
codeInsightSettings.AUTOCOMPLETE_ON_CODE_COMPLETION = myCbOnCodeCompletion.isSelected();
codeInsightSettings.AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION = myCbOnSmartTypeCompletion.isSelected();
codeInsightSettings.SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO = myCbShowFullParameterSignatures.isSelected();
codeInsightSettings.AUTO_POPUP_PARAMETER_INFO = myCbParameterInfoPopup.isSelected();
codeInsightSettings.AUTO_POPUP_COMPLETION_LOOKUP = myCbAutocompletion.isSelected();
codeInsightSettings.AUTO_POPUP_JAVADOC_INFO = myCbAutopopupJavaDoc.isSelected();
codeInsightSettings.PARAMETER_INFO_DELAY = getIntegerValue(myParameterInfoDelayField.getText(), 0);
codeInsightSettings.JAVADOC_INFO_DELAY = getIntegerValue(myAutopopupJavaDocField.getText(), 0);
UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY = myCbSorting.isSelected();
final Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myPanel));
if (project != null){
DaemonCodeAnalyzer.getInstance(project).settingsChanged();
}
}
示例5: apply
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
public void apply() {
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
DaemonCodeAnalyzerSettings daemonSettings = DaemonCodeAnalyzerSettings.getInstance();
codeInsightSettings.ADD_IMPORTS_ON_PASTE = getSmartPasteValue();
codeInsightSettings.EXCLUDED_PACKAGES = getExcludedPackages();
daemonSettings.setImportHintEnabled(myCbShowImportPopup.isSelected());
codeInsightSettings.OPTIMIZE_IMPORTS_ON_THE_FLY = myCbOptimizeImports.isSelected();
codeInsightSettings.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = myCbAddUnambiguousImports.isSelected();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.getInstance(), false, true);
}
}
});
}
示例6: toLowerCase
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
private static String toLowerCase(String text) {
CodeInsightSettings settings = CodeInsightSettings.getInstance();
switch (settings.COMPLETION_CASE_SENSITIVE) {
case CodeInsightSettings.NONE:
return text.toLowerCase();
case CodeInsightSettings.FIRST_LETTER: {
StringBuffer buffer = new StringBuffer();
buffer.append(text.toLowerCase());
if (buffer.length() > 0) {
buffer.setCharAt(0, text.charAt(0));
}
return buffer.toString();
}
default:
return text;
}
}
示例7: timeToOptimizeImports
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
private static boolean timeToOptimizeImports(@NotNull PsiFile file)
{
if(!CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY)
{
return false;
}
DaemonCodeAnalyzerEx codeAnalyzer = DaemonCodeAnalyzerEx.getInstanceEx(file.getProject());
// dont optimize out imports in JSP since it can be included in other JSP
if(!codeAnalyzer.isHighlightingAvailable(file) || !(file instanceof PsiJavaFile) || file instanceof ServerPageFile)
{
return false;
}
if(!codeAnalyzer.isErrorAnalyzingFinished(file))
{
return false;
}
boolean errors = containsErrorsPreventingOptimize(file);
return !errors && DaemonListeners.canChangeFileSilently(file);
}
示例8: apply
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
@RequiredUIAccess
@Override
protected void apply(@Nonnull Panel panel) throws ConfigurationException {
EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
editorSettings.setSmartHome(panel.myCbSmartHome.getValue());
codeInsightSettings.SMART_END_ACTION = panel.myCbSmartEnd.getValue();
codeInsightSettings.SMART_INDENT_ON_ENTER = panel.myCbSmartIndentOnEnter.getValue();
codeInsightSettings.INSERT_BRACE_ON_ENTER = panel.myCbInsertPairCurlyBraceOnEnter.getValue();
codeInsightSettings.INDENT_TO_CARET_ON_PASTE = panel.mySmartIndentPastedLinesCheckBox.getValue();
codeInsightSettings.JAVADOC_STUB_ON_ENTER = panel.myCbInsertJavadocStubOnEnter.getValue();
codeInsightSettings.AUTOINSERT_PAIR_BRACKET = panel.myCbInsertPairBracket.getValue();
codeInsightSettings.AUTOINSERT_PAIR_QUOTE = panel.myCbInsertPairQuote.getValue();
codeInsightSettings.REFORMAT_BLOCK_ON_RBRACE = panel.myCbReformatBlockOnTypingRBrace.getValue();
codeInsightSettings.SURROUND_SELECTION_ON_QUOTE_TYPED = panel.myCbSurroundSelectionOnTyping.getValue();
editorSettings.setCamelWords(panel.myCbCamelWords.getValue());
codeInsightSettings.REFORMAT_ON_PASTE = panel.myReformatOnPasteCombo.getValue();
codeInsightSettings.setBackspaceMode(panel.myCbIndentingBackspace.getValue());
}
示例9: testDocEpytext
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
public void testDocEpytext() {
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
boolean oldStubOnEnter = codeInsightSettings.JAVADOC_STUB_ON_ENTER;
codeInsightSettings.JAVADOC_STUB_ON_ENTER = true;
PyDocumentationSettings documentationSettings = PyDocumentationSettings.getInstance(myFixture.getModule());
documentationSettings.setFormat(DocStringFormat.EPYTEXT);
try {
doTest();
}
finally {
documentationSettings.setFormat(DocStringFormat.PLAIN);
codeInsightSettings.JAVADOC_STUB_ON_ENTER = oldStubOnEnter;
}
}
示例10: BraceHighlightingHandler
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
private BraceHighlightingHandler(@NotNull Project project, @NotNull Editor editor, @NotNull Alarm alarm, PsiFile psiFile) {
myProject = project;
myEditor = editor;
myAlarm = alarm;
myDocument = (DocumentEx)myEditor.getDocument();
myPsiFile = psiFile;
myCodeInsightSettings = CodeInsightSettings.getInstance();
}
示例11: testSmartFinish2
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
public void testSmartFinish2() throws Throwable {
boolean old = CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION;
CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = false;
try {
doCompletionPopupTest(getTestName(false));
}
finally {
CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = old;
}
}
示例12: generateMemberPrototypes
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
@Override
@NotNull
protected List<? extends GenerationInfo> generateMemberPrototypes(PsiClass aClass, ClassMember[] originalMembers) throws IncorrectOperationException {
Project project = aClass.getProject();
final boolean useInstanceofToCheckParameterType = CodeInsightSettings.getInstance().USE_INSTANCEOF_ON_EQUALS_PARAMETER;
GroovyGenerateEqualsHelper helper = new GroovyGenerateEqualsHelper(project, aClass, myEqualsFields, myHashCodeFields, myNonNullFields, useInstanceofToCheckParameterType);
Collection<PsiMethod> methods = helper.generateMembers();
return ContainerUtil.map2List(methods, new Function<PsiMethod, PsiGenerationInfo<PsiMethod>>() {
@Override
public PsiGenerationInfo<PsiMethod> fun(final PsiMethod s) {
return new GroovyGenerationInfo<PsiMethod>(s);
}
});
}
示例13: testAutoImportWorksWhenITypeSpaceAfterClassName
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
public void testAutoImportWorksWhenITypeSpaceAfterClassName() throws Throwable {
@NonNls String text = "class S { ArrayList<caret> }";
configureByText(StdFileTypes.JAVA, text);
boolean old = CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY;
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = true;
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true);
try {
doHighlighting();
//caret is too close
assertEmpty(((PsiJavaFile)getFile()).getImportList().getAllImportStatements());
type(" ");
PsiJavaCodeReferenceElement element =
(PsiJavaCodeReferenceElement)getFile().findReferenceAt(getEditor().getCaretModel().getOffset() - 2);
ImportClassFix fix = new ImportClassFix(element);
ImportClassFixBase.Result result = fix.doFix(getEditor(), false, false);
assertEquals(ImportClassFixBase.Result.CLASS_AUTO_IMPORTED, result);
assertNotSame(0, ((PsiJavaFile)getFile()).getImportList().getAllImportStatements().length);
}
finally {
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old;
}
}
示例14: testAutoImportExpectedType
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
public void testAutoImportExpectedType() throws Throwable {
boolean old = CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY;
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = true;
try {
configureByTestName();
performAction();
myFixture.assertPreferredCompletionItems(1, "List", "ArrayList", "AbstractList");
}
finally {
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old;
}
}
示例15: reset
import com.intellij.codeInsight.CodeInsightSettings; //导入方法依赖的package包/类
public void reset() {
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
final String value;
switch(codeInsightSettings.COMPLETION_CASE_SENSITIVE){
case CodeInsightSettings.ALL:
value = CASE_SENSITIVE_ALL;
break;
case CodeInsightSettings.NONE:
value = CASE_SENSITIVE_NONE;
break;
default:
value = CASE_SENSITIVE_FIRST_LETTER;
break;
}
myCaseSensitiveCombo.setSelectedItem(value);
myCbSelectByChars.setSelected(codeInsightSettings.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS);
myCbOnCodeCompletion.setSelected(codeInsightSettings.AUTOCOMPLETE_ON_CODE_COMPLETION);
myCbOnSmartTypeCompletion.setSelected(codeInsightSettings.AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION);
myCbAutocompletion.setSelected(codeInsightSettings.AUTO_POPUP_COMPLETION_LOOKUP);
myCbAutopopupJavaDoc.setSelected(codeInsightSettings.AUTO_POPUP_JAVADOC_INFO);
myAutopopupJavaDocField.setEnabled(codeInsightSettings.AUTO_POPUP_JAVADOC_INFO);
myAutopopupJavaDocField.setText(String.valueOf(codeInsightSettings.JAVADOC_INFO_DELAY));
myCbParameterInfoPopup.setSelected(codeInsightSettings.AUTO_POPUP_PARAMETER_INFO);
myParameterInfoDelayField.setEnabled(codeInsightSettings.AUTO_POPUP_PARAMETER_INFO);
myParameterInfoDelayField.setText(String.valueOf(codeInsightSettings.PARAMETER_INFO_DELAY));
myCbShowFullParameterSignatures.setSelected(codeInsightSettings.SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO);
myCbAutocompletion.setSelected(codeInsightSettings.AUTO_POPUP_COMPLETION_LOOKUP);
myCbSorting.setSelected(UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY);
myCbAutocompletion.setText("Autopopup code completion" + (PowerSaveMode.isEnabled() ? " (not available in Power Save mode)" : ""));
}