当前位置: 首页>>代码示例>>Java>>正文


Java CodeInsightSettings.getInstance方法代码示例

本文整理汇总了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;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ImportHelperTest.java

示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:JavaAutoImportOptions.java

示例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;
    }
  }

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:SmartTypeCompletionTest.java

示例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();
    }
  }
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:CodeCompletionPanel.java

示例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);
      }
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:JavaAutoImportOptions.java

示例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;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:CompletionUtil.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:QuickFixFactoryImpl.java

示例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());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:EditorSmartKeysConfigurable.java

示例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;

  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:PySmartEnterTest.java

示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:BraceHighlightingHandler.java

示例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;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:XmlSmartEnterTest.java

示例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);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:GroovyGenerateEqualsHandler.java

示例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;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:ImportHelperTest.java

示例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;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:SmartTypeCompletionTest.java

示例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)" : ""));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:CodeCompletionPanel.java


注:本文中的com.intellij.codeInsight.CodeInsightSettings.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。