• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CodeInsightSettings类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.codeInsight.CodeInsightSettings的典型用法代码示例。如果您正苦于以下问题:Java CodeInsightSettings类的具体用法?Java CodeInsightSettings怎么用?Java CodeInsightSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CodeInsightSettings类属于com.intellij.codeInsight包,在下文中一共展示了CodeInsightSettings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: insertClosingTagIfNecessary

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
/**
 * Checks if it's necessary to insert closing tag on typed character.
 * 
 * @param c         typed symbol
 * @param project   current project
 * @param editor    current editor
 * @param file      current file
 * @return          <code>true</code> if closing tag is inserted; <code>false</code> otherwise
 */
private static boolean insertClosingTagIfNecessary(char c, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
  if (c != CLOSE_TAG_SYMBOL || !CodeInsightSettings.getInstance().JAVADOC_GENERATE_CLOSING_TAG) {
    return false;
  }

  PsiDocumentManager.getInstance(project).commitAllDocuments();

  if (!isAppropriatePlace(editor, file)) {
    return false;
  }

  // Inspect symbols to the left of the current caret position, insert closing tag only if valid tag is just typed
  // (e.g. don't insert anything on single '>' symbol typing).
  int offset = editor.getCaretModel().getOffset();
  Document document = editor.getDocument();
  String tagName = getTagName(document.getText(), offset);
  if (tagName == null || HtmlUtil.isSingleHtmlTag(tagName) || tagName.startsWith(COMMENT_PREFIX)) {
    return false;
  }

  document.insertString(offset, String.valueOf(START_TAG_SYMBOL) + SLASH + tagName + CLOSE_TAG_SYMBOL);
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:JavadocTypedHandler.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:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SmartTypeCompletionTest.java


示例4: 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


示例5: testAutoOptimizeUnresolvedImports

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
public void testAutoOptimizeUnresolvedImports() throws Throwable {
  @NonNls String text = "import xxx.yyy; class S { } <caret> ";
  configureByText(StdFileTypes.JAVA, text);

  boolean old = CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY;
  CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY = true;
  DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true);

  try {
    List<HighlightInfo> errs = highlightErrors();

    assertEquals(1, errs.size());

    assertEquals(1, ((PsiJavaFile)getFile()).getImportList().getAllImportStatements().length);

    type("/* */");
    doHighlighting();
    UIUtil.dispatchAllInvocationEvents();

    assertEmpty(((PsiJavaFile)getFile()).getImportList().getAllImportStatements());
  }
  finally {
     CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY = old;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ImportHelperTest.java


示例6: testAutoInsertImportForInnerClass

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
public void testAutoInsertImportForInnerClass() throws Throwable {
  @NonNls String text = "package x; class S { void f(ReadLock r){} } <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 {
    List<HighlightInfo> errs = highlightErrors();
    assertEquals(1, errs.size());

    assertEmpty(((PsiJavaFile)getFile()).getImportList().getAllImportStatements());
    type("/* */");
    doHighlighting();
    UIUtil.dispatchAllInvocationEvents();
    assertEmpty(((PsiJavaFile)getFile()).getImportList().getAllImportStatements());
  }
  finally {
     CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ImportHelperTest.java


示例7: testAutoImportSkipsClassReferenceInMethodPosition

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
public void testAutoImportSkipsClassReferenceInMethodPosition() throws Throwable {
  @NonNls String text = "package x; import java.util.HashMap; class S { HashMap<String,String> f(){ return  Hash<caret>Map <String, String >();} }  ";
  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 {
    List<HighlightInfo> errs = highlightErrors();
    assertTrue(errs.size() > 1);

    PsiJavaFile javaFile = (PsiJavaFile)getFile();
    assertEquals(1, javaFile.getImportList().getAllImportStatements().length);

    PsiReference ref = javaFile.findReferenceAt(getEditor().getCaretModel().getOffset());
    ImportClassFix fix = new ImportClassFix((PsiJavaCodeReferenceElement)ref);
    assertFalse(fix.isAvailable(getProject(), getEditor(), getFile()));
  }
  finally {
     CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ImportHelperTest.java


示例8: testAutoImportDoNotBreakCode

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
public void testAutoImportDoNotBreakCode() throws Throwable {
  @NonNls String text = "package x; class S {{ S.<caret>\n Runnable r; }}";
  configureByText(StdFileTypes.JAVA, text);

  boolean old = CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY;
  boolean opt = CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY;
  CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = true;
  CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY = true;
  DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true);

  try {
    List<HighlightInfo> errs = highlightErrors();
    assertEquals(1, errs.size());
  }
  finally {
     CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = old;
     CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY = opt;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ImportHelperTest.java


示例9: doAction

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
@Override
protected void doAction(final String text, final boolean actionShouldBeAvailable, final String testFullPath, final String testName)
  throws Exception {
  boolean old = CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY;

  try {
    CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY = false;
    IntentionAction action = findActionWithText(text);
    if (action == null && actionShouldBeAvailable) {
      fail("Action with text '" + text + "' is not available in test " + testFullPath);
    }
    if (action != null && actionShouldBeAvailable) {
      action.invoke(getProject(), getEditor(), getFile());
      assertTrue(CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY);
    }
  }
  finally {
    CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY = old;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:EnableOptimizeImportsOnTheFlyTest.java


示例10: createMatcher

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
private MinusculeMatcher createMatcher(final boolean caseSensitive) {
  String prefix = applyMiddleMatching(myPrefix);

  if (!caseSensitive) {
    return NameUtil.buildMatcher(prefix, NameUtil.MatchingCaseSensitivity.NONE);
  }

  switch (CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE) {
    case CodeInsightSettings.NONE:
      return NameUtil.buildMatcher(prefix, NameUtil.MatchingCaseSensitivity.NONE);
    case CodeInsightSettings.FIRST_LETTER:
      return NameUtil.buildMatcher(prefix, NameUtil.MatchingCaseSensitivity.FIRST_LETTER);
    default:
      return NameUtil.buildMatcher(prefix, NameUtil.MatchingCaseSensitivity.ALL);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CamelHumpMatcher.java


示例11: acceptChar

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
@Override
public Result acceptChar(char c, int prefixLength, Lookup lookup) {
  LookupElement item = lookup.getCurrentItem();
  if (item instanceof LiveTemplateLookupElement && lookup.isCompletion()) {
    if (Character.isJavaIdentifierPart(c)) return Result.ADD_TO_PREFIX;

    if (c == ((LiveTemplateLookupElement)item).getTemplateShortcut()) {
      return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
    }
    return Result.HIDE_LOOKUP;
  }
  if (item instanceof TemplateExpressionLookupElement) {
    if (Character.isJavaIdentifierPart(c)) return Result.ADD_TO_PREFIX;
    if (CodeInsightSettings.getInstance().SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS) {
      return null;
    }
    return Result.HIDE_LOOKUP;
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:LiveTemplateCharFilter.java


示例12: apply

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
@Override
public void apply() throws ConfigurationException {
  EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
  CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();

  editorSettings.setSmartHome(myCbSmartHome.isSelected());
  codeInsightSettings.SMART_END_ACTION = myCbSmartEnd.isSelected();
  codeInsightSettings.SMART_INDENT_ON_ENTER = myCbSmartIndentOnEnter.isSelected();
  codeInsightSettings.INSERT_BRACE_ON_ENTER = myCbInsertPairCurlyBraceOnEnter.isSelected();
  codeInsightSettings.JAVADOC_STUB_ON_ENTER = myCbInsertJavadocStubOnEnter.isSelected();
  codeInsightSettings.AUTOINSERT_PAIR_BRACKET = myCbInsertPairBracket.isSelected();
  codeInsightSettings.AUTOINSERT_PAIR_QUOTE = myCbInsertPairQuote.isSelected();
  codeInsightSettings.REFORMAT_BLOCK_ON_RBRACE = myCbReformatBlockOnTypingRBrace.isSelected();
  codeInsightSettings.SURROUND_SELECTION_ON_QUOTE_TYPED = myCbSurroundSelectionOnTyping.isSelected();
  editorSettings.setCamelWords(myCbCamelWords.isSelected());
  codeInsightSettings.REFORMAT_ON_PASTE = getReformatPastedBlockValue();
  codeInsightSettings.setBackspaceMode(getSmartBackspaceModeValue());

  super.apply();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:EditorSmartKeysConfigurable.java


示例13: getReformatPastedBlockValue

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
private int getReformatPastedBlockValue(){
  Object selectedItem = myReformatOnPasteCombo.getSelectedItem();
  if (NO_REFORMAT.equals(selectedItem)){
    return CodeInsightSettings.NO_REFORMAT;
  }
  else if (INDENT_BLOCK.equals(selectedItem)){
    return CodeInsightSettings.INDENT_BLOCK;
  }
  else if (INDENT_EACH_LINE.equals(selectedItem)){
    return CodeInsightSettings.INDENT_EACH_LINE;
  }
  else if (REFORMAT_BLOCK.equals(selectedItem)){
    return CodeInsightSettings.REFORMAT_BLOCK;
  }
  else{
    LOG.assertTrue(false);
    return -1;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:EditorSmartKeysConfigurable.java


示例14: 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 = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myPanel));
    if (project != null){
      DaemonCodeAnalyzer.getInstance(project).settingsChanged();
    }
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:CodeCompletionPanel.java


示例15: testDocTypeRType

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
public void testDocTypeRType() {
  CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
  boolean oldStubOnEnter = codeInsightSettings.JAVADOC_STUB_ON_ENTER;
  codeInsightSettings.JAVADOC_STUB_ON_ENTER = true;
  PyCodeInsightSettings pyCodeInsightSettings = PyCodeInsightSettings.getInstance();
  boolean oldInsertType = pyCodeInsightSettings.INSERT_TYPE_DOCSTUB;
  pyCodeInsightSettings.INSERT_TYPE_DOCSTUB = true;
  PyDocumentationSettings documentationSettings = PyDocumentationSettings.getInstance(myFixture.getModule());
  documentationSettings.setFormat(DocStringFormat.EPYTEXT);
  try {
    doTest();
  }
  finally {
    documentationSettings.setFormat(DocStringFormat.PLAIN);
    codeInsightSettings.JAVADOC_STUB_ON_ENTER = oldStubOnEnter;
    pyCodeInsightSettings.INSERT_TYPE_DOCSTUB = oldInsertType;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:PySmartEnterTest.java


示例16: doTest

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
private void doTest(String prefix) {
  int oldReformat = CodeInsightSettings.getInstance().REFORMAT_ON_PASTE;
  try {
    CodeInsightSettings.getInstance().REFORMAT_ON_PASTE = CodeInsightSettings.NO_REFORMAT;
    String name = getTestName(false);

    myFixture.configureByFile("copyPaste/" + prefix + name + ".src.py");
    myFixture.performEditorAction(IdeActions.ACTION_EDITOR_COPY);
    myFixture.configureByFile("copyPaste/" + prefix + name + ".dst.py");
    myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PASTE);
    myFixture.checkResultByFile("copyPaste/" + prefix + name + ".after.py", true);
  }
  finally {
    CodeInsightSettings.getInstance().REFORMAT_ON_PASTE = oldReformat;
  }

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


示例17: testCasePreference

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
public void testCasePreference() throws Exception {
  final int old = CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE;
  CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE;

  String location = "30.dtd";
  try {

    addResource(location, location);
    configureByFiles("30.xml",
                     location);
    complete();

    assertOrderedEquals(myFixture.getLookupElementStrings(), "map", "Map");
  }
  finally {
    CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE = old;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:XmlCompletionTest.java


示例18: testCompleteWhenNoNsSchemaLocation

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
public void testCompleteWhenNoNsSchemaLocation() throws Exception {
  boolean old = CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION;
  CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = false;
  try {
    final String testName = getTestName(false);

    configureByFiles(testName + ".xml",
                     testName + ".xsd");
    complete();
    selectItem(myFixture.getLookupElements()[0], '\"');
    checkResultByFile(testName + "_after.xml");
  }
  finally {
    CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = old;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:XmlCompletionTest.java


示例19: timeToOptimizeImports

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
private boolean timeToOptimizeImports(GroovyFile myFile, Editor editor) {
  if (!CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY) return false;
  if (onTheFly && editor != null) {
    // if we stand inside import statements, do not optimize
    final VirtualFile vfile = myFile.getVirtualFile();
    if (vfile != null && ProjectRootManager.getInstance(myFile.getProject()).getFileIndex().isInSource(vfile)) {
      final GrImportStatement[] imports = myFile.getImportStatements();
      if (imports.length > 0) {
        final int offset = editor.getCaretModel().getOffset();
        if (imports[0].getTextRange().getStartOffset() <= offset && offset <= imports[imports.length - 1].getTextRange().getEndOffset()) {
          return false;
        }
      }
    }
  }

  DaemonCodeAnalyzerImpl codeAnalyzer = (DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(myFile.getProject());
  if (!codeAnalyzer.isHighlightingAvailable(myFile)) return false;

  if (!codeAnalyzer.isErrorAnalyzingFinished(myFile)) return false;
  Document myDocument = PsiDocumentManager.getInstance(myFile.getProject()).getDocument(myFile);
  boolean errors = containsErrorsPreventingOptimize(myFile, myDocument);

  return !errors && DaemonListeners.canChangeFileSilently(myFile);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:GroovyOptimizeImportsFix.java


示例20: testInsertPairQuoteOptionRespected

import com.intellij.codeInsight.CodeInsightSettings; //导入依赖的package包/类
@Test
public void testInsertPairQuoteOptionRespected() {
  boolean old = CodeInsightSettings.getInstance().AUTOINSERT_PAIR_QUOTE;
  try {
    CodeInsightSettings.getInstance().AUTOINSERT_PAIR_QUOTE = false;
    BuildFile file = createBuildFile(new WorkspacePath("java/BUILD"), "'//");
    Editor editor = editorTest.openFileInEditor(file);
    editorTest.setCaretPosition(editor, 0, "'//".length());

    assertThat(editorTest.completeIfUnique()).isTrue();
    assertFileContents(file, "'//java");

    CodeInsightSettings.getInstance().AUTOINSERT_PAIR_QUOTE = true;
    file = createBuildFile(new WorkspacePath("foo/BUILD"), "'//j");
    editor = editorTest.openFileInEditor(file);
    editorTest.setCaretPosition(editor, 0, "'//j".length());

    assertThat(editorTest.completeIfUnique()).isTrue();
    assertFileContents(file, "'//java'");
  } finally {
    CodeInsightSettings.getInstance().AUTOINSERT_PAIR_QUOTE = old;
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:24,代码来源:FilePathCompletionTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TimeZoneNameUtility类代码示例发布时间:2022-05-22
下一篇:
Java FileSystemRegistry类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap