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


Java LocalTimeCounter类代码示例

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


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

示例1: _testContentChanged_reloadChangedDocumentOnSave

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
@SuppressWarnings("UnusedDeclaration")
public void _testContentChanged_reloadChangedDocumentOnSave() throws Exception {
  final MockVirtualFile file = new MockVirtualFile("test.txt", "test\rtest") {
    @Override
    public void refresh(boolean asynchronous, boolean recursive, Runnable postRunnable) {
      long oldStamp = getModificationStamp();
      setModificationStamp(LocalTimeCounter.currentTime());
      myDocumentManager.contentsChanged(new VirtualFileEvent(null, this, null, oldStamp, getModificationStamp()));
    }
  };
  Document document = myDocumentManager.getDocument(file);
  assertNotNull(file.toString(), document);
  document.insertString(0, "zzz");
  file.setContent(null, "xxx", false);

  myReloadFromDisk = Boolean.TRUE;
  myDocumentManager.saveAllDocuments();
  long fileStamp = file.getModificationStamp();

  assertEquals("xxx", document.getText());
  assertEquals(file.getModificationStamp(), document.getModificationStamp());
  assertEquals(file.getModificationStamp(), fileStamp);
  assertEquals(0, myDocumentManager.getUnsavedDocuments().length);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:FileDocumentManagerImplTest.java

示例2: createPatternTree

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
@NotNull
@Override
public PsiElement[] createPatternTree(@NotNull String text,
                                      @NotNull PatternTreeContext context,
                                      @NotNull FileType fileType,
                                      @Nullable Language language,
                                      String contextName, @Nullable String extension,
                                      @NotNull Project project,
                                      boolean physical) {
  final String ext = extension != null ? extension : fileType.getDefaultExtension();
  String text1 = context == PatternTreeContext.File ? text : "<QQQ>" + text + "</QQQ>";
  final PsiFile fileFromText = PsiFileFactory.getInstance(project)
    .createFileFromText("dummy." + ext, fileType, text1, LocalTimeCounter.currentTime(), physical, true);

  final XmlDocument document = HtmlUtil.getRealXmlDocument(((XmlFile)fileFromText).getDocument());
  if (context == PatternTreeContext.File) {
    return new PsiElement[]{document};
  }

  return document.getRootTag().getValue().getChildren();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:XmlStructuralSearchProfile.java

示例3: createPatternTree

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
@NotNull
public PsiElement[] createPatternTree(@NotNull String text,
                                      @NotNull PatternTreeContext context,
                                      @NotNull FileType fileType,
                                      @Nullable Language language,
                                      @Nullable String contextName,
                                      @Nullable String extension,
                                      @NotNull Project project,
                                      boolean physical) {
  final String ext = extension != null ? extension : fileType.getDefaultExtension();
  final String name = "__dummy." + ext;
  final PsiFileFactory factory = PsiFileFactory.getInstance(project);

  final PsiFile file = language == null
                       ? factory.createFileFromText(name, fileType, text, LocalTimeCounter.currentTime(), physical, true)
                       : factory.createFileFromText(name, language, text, physical, true);

  return file != null ? file.getChildren() : PsiElement.EMPTY_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:StructuralSearchProfile.java

示例4: createFromText

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
protected PsiFile createFromText(final Language language, CharSequence text, PsiManager manager) {
  @NonNls
  final LightVirtualFile virtualFile = new LightVirtualFile("foo", createTemplateFakeFileType(language), text, LocalTimeCounter.currentTime());

  FileViewProvider viewProvider = new SingleRootFileViewProvider(manager, virtualFile, false) {
    @Override
    @NotNull
    public Language getBaseLanguage() {
      return language;
    }
  };

  // Since we're already inside a template language PSI that was built regardless of the file size (for whatever reason), 
  // there should also be no file size checks for template data files.
  SingleRootFileViewProvider.doNotCheckFileSizeLimit(virtualFile);

  return viewProvider.getPsi(language);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:TemplateDataElementType.java

示例5: gotoChild

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
private static int gotoChild(Project project, CharSequence text, int offset, int start, int end) {
  PsiFile file = PsiFileFactory.getInstance(project)
    .createFileFromText("dummy.xml", StdFileTypes.XML, text, LocalTimeCounter.currentTime(), false);

  PsiElement element = file.findElementAt(offset);
  if (offset < end && element instanceof XmlToken && ((XmlToken)element).getTokenType() == XmlTokenType.XML_END_TAG_START) {
    return offset;
  }

  int newOffset = -1;
  XmlTag tag = PsiTreeUtil.findElementOfClassAtRange(file, start, end, XmlTag.class);
  if (tag != null) {
    for (PsiElement child : tag.getChildren()) {
      if (child instanceof XmlToken && ((XmlToken)child).getTokenType() == XmlTokenType.XML_END_TAG_START) {
        newOffset = child.getTextOffset();
      }
    }
  }

  if (newOffset >= 0) {
    return newOffset;
  }

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

示例6: parseXmlFileInTemplate

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
@NotNull
private static XmlFile parseXmlFileInTemplate(@NotNull TemplateImpl template, @NotNull CustomTemplateCallback callback,
                                              @NotNull Map<String, String> attributes) {
  XmlTag dummyRootTag = null;
  String templateString = template.getString();
  final PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(callback.getProject());
  if (!containsAttrsVar(template)) {
    XmlFile dummyFile = (XmlFile)psiFileFactory.createFileFromText("dummy.html", HTMLLanguage.INSTANCE, templateString, false, true);
    dummyRootTag = dummyFile.getRootTag();
    if (dummyRootTag != null) {
      addMissingAttributes(dummyRootTag, attributes);
    }
  }

  templateString = dummyRootTag != null ? dummyRootTag.getContainingFile().getText() : templateString;
  XmlFile xmlFile =
    (XmlFile)psiFileFactory.createFileFromText("dummy.xml", StdFileTypes.XML, templateString, LocalTimeCounter.currentTime(), true);
  VirtualFile vFile = xmlFile.getVirtualFile();
  if (vFile != null) {
    vFile.putUserData(UndoConstants.DONT_RECORD_UNDO, Boolean.TRUE);
  }
  return xmlFile;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:TemplateToken.java

示例7: insertString

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
@Override
public void insertString(int offset, @NotNull CharSequence s) {
  if (offset < 0) throw new IndexOutOfBoundsException("Wrong offset: " + offset);
  if (offset > getTextLength()) {
    throw new IndexOutOfBoundsException(
      "Wrong offset: " + offset + "; documentLength: " + getTextLength() + "; " + s.subSequence(Math.max(0, s.length() - 20), s.length())
    );
  }
  assertValidSeparators(s);

  if (!isWritable()) throw new ReadOnlyModificationException(this);
  if (s.length() == 0) return;

  updateText(myText.insert(offset, ImmutableText.valueOf(s)), offset, null, s, false, LocalTimeCounter.currentTime());
  trimToSize();
}
 
开发者ID:eddysystems,项目名称:eddy,代码行数:17,代码来源:LightDocument.java

示例8: setText

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
@Override
public void setText(@NotNull final CharSequence text) {
  Runnable runnable = new Runnable() {
    @Override
    public void run() {
      replaceString(0, getTextLength(), text, LocalTimeCounter.currentTime(), true);
    }
  };
  if (CommandProcessor.getInstance().isUndoTransparentActionInProgress()) {
    runnable.run();
  }
  else {
    CommandProcessor.getInstance().executeCommand(null, runnable, "", DocCommandGroupId.noneGroupId(this));
  }

  clearLineModificationFlags();
}
 
开发者ID:eddysystems,项目名称:eddy,代码行数:18,代码来源:LightDocument.java

示例9: VirtualFileSystemEntry

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
public VirtualFileSystemEntry(@NotNull String name, VirtualDirectoryImpl parent, int id, @PersistentFS.Attributes int attributes) {
  myParent = parent;
  myId = id;

  storeName(name);

  if (parent != null && parent != VirtualDirectoryImpl.NULL_VIRTUAL_FILE) {
    setFlagInt(IS_SYMLINK_FLAG, PersistentFS.isSymLink(attributes));
    setFlagInt(IS_SPECIAL_FLAG, PersistentFS.isSpecialFile(attributes));
    updateLinkStatus();
  }

  setFlagInt(IS_WRITABLE_FLAG, PersistentFS.isWritable(attributes));
  setFlagInt(IS_HIDDEN_FLAG, PersistentFS.isHidden(attributes));

  setModificationStamp(LocalTimeCounter.currentTime());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:VirtualFileSystemEntry.java

示例10: init

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
private void init(int size) {
  myArray = new CharArray(size, new char[0], 0) {
    @NotNull
    @Override
    protected DocumentEvent beforeChangedUpdate(int offset, CharSequence oldString, CharSequence newString,
                                                boolean wholeTextReplaced) {
      return new DocumentEventImpl(myDocument, offset, oldString, newString, LocalTimeCounter.currentTime(), wholeTextReplaced);
    }

    @Override
    protected void afterChangedUpdate(@NotNull DocumentEvent event, long newModificationStamp) {
    }

    @Override
    protected void assertWriteAccess() {
    }

    @Override
    protected void assertReadAccess() {
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:CharArrayTest.java

示例11: parseXmlFileInTemplate

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
@NotNull
private static XmlFile parseXmlFileInTemplate(TemplateImpl template,
                                              CustomTemplateCallback callback,
                                              List<Pair<String, String>> attributes) {
  XmlTag dummyRootTag = null;
  String templateString = template.getString();
  final PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(callback.getProject());
  if (!containsAttrsVar(template)) {
    XmlFile dummyFile = (XmlFile)psiFileFactory.createFileFromText("dummy.xml", StdFileTypes.XML, templateString);
    dummyRootTag = dummyFile.getRootTag();
    if (dummyRootTag != null) {
      addMissingAttributes(dummyRootTag, attributes);
    }
  }

  templateString = dummyRootTag != null ? dummyRootTag.getContainingFile().getText() : templateString;
  XmlFile xmlFile = (XmlFile)psiFileFactory.createFileFromText("dummy.xml", StdFileTypes.XML, templateString, LocalTimeCounter.currentTime(), true);
  VirtualFile vFile = xmlFile.getVirtualFile();
  if (vFile != null) {
    vFile.putUserData(UndoConstants.DONT_RECORD_UNDO, Boolean.TRUE);
  }
  return xmlFile;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:TemplateToken.java

示例12: createPsiFileFromSource

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
protected PsiFile createPsiFileFromSource(final Language language, CharSequence sourceCode, PsiManager manager) {
  @NonNls final LightVirtualFile virtualFile = new LightVirtualFile("foo", createTemplateFakeFileType(language), sourceCode, LocalTimeCounter.currentTime());

  FileViewProvider viewProvider = new SingleRootFileViewProvider(manager, virtualFile, false) {
    @Override
    @Nonnull
    public Language getBaseLanguage() {
      return language;
    }
  };

  // Since we're already inside a template language PSI that was built regardless of the file size (for whatever reason),
  // there should also be no file size checks for template data files.
  SingleRootFileViewProvider.doNotCheckFileSizeLimit(virtualFile);

  return viewProvider.getPsi(language);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:TemplateDataElementType.java

示例13: createDocument

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
@NotNull
@Override
public Document createDocument(@NotNull Project project, @NotNull String text, @Nullable XSourcePosition xSourcePosition, @NotNull EvaluationMode evaluationMode)
{

    final PsiFile psiFile = PsiFileFactory.getInstance(project)
                                          .createFileFromText("muleExpr." + getFileType().getDefaultExtension(), getFileType(), text, LocalTimeCounter.currentTime(), true);
    return PsiDocumentManager.getInstance(project).getDocument(psiFile);
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:10,代码来源:MuleDebuggerEditorsProvider.java

示例14: createDocument

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
@NotNull
@Override
public Document createDocument(@NotNull Project project, @NotNull String text, @Nullable XSourcePosition xSourcePosition, @NotNull EvaluationMode evaluationMode) {

    final PsiFile psiFile = PsiFileFactory.getInstance(project)
            .createFileFromText("muleExpr." + getFileType().getDefaultExtension(), getFileType(), text, LocalTimeCounter.currentTime(), true);
    return PsiDocumentManager.getInstance(project).getDocument(psiFile);
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:9,代码来源:WeaveDebuggerEditorsProvider.java

示例15: createPseudoPhysicalFile

import com.intellij.util.LocalTimeCounter; //导入依赖的package包/类
public static PsiFile createPseudoPhysicalFile(final Project project,
                                               final String fileName,
                                               final String text) throws IncorrectOperationException {
  return PsiFileFactory.getInstance(project)
      .createFileFromText(fileName, FileTypeManager.getInstance().getFileTypeByFileName(fileName), text,
          LocalTimeCounter.currentTime(), true);
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:8,代码来源:TestUtils.java


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