本文整理汇总了Java中com.intellij.openapi.util.EmptyRunnable.INSTANCE属性的典型用法代码示例。如果您正苦于以下问题:Java EmptyRunnable.INSTANCE属性的具体用法?Java EmptyRunnable.INSTANCE怎么用?Java EmptyRunnable.INSTANCE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.openapi.util.EmptyRunnable
的用法示例。
在下文中一共展示了EmptyRunnable.INSTANCE属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startCommand
@Override
@Nullable
public Object startCommand(final Project project,
@Nls final String name,
final Object groupId,
final UndoConfirmationPolicy undoConfirmationPolicy) {
ApplicationManager.getApplication().assertIsDispatchThread();
if (project != null && project.isDisposed()) return null;
if (CommandLog.LOG.isDebugEnabled()) {
CommandLog.LOG.debug("startCommand: name = " + name + ", groupId = " + groupId);
}
if (myCurrentCommand != null) {
return null;
}
Document document = groupId instanceof Ref && ((Ref)groupId).get() instanceof Document ? (Document)((Ref)groupId).get() : null;
myCurrentCommand = new CommandDescriptor(EmptyRunnable.INSTANCE, project, name, groupId, undoConfirmationPolicy, document);
fireCommandStarted();
return myCurrentCommand;
}
示例2: processFile
@NotNull
@Override
public Runnable processFile(final PsiFile file)
{
VirtualFile vFile = file.getVirtualFile();
if(vFile instanceof VirtualFileWindow)
{
vFile = ((VirtualFileWindow) vFile).getDelegate();
}
if(vFile == null || !ProjectRootManager.getInstance(file.getProject()).getFileIndex().isInSourceContent(vFile))
{
return EmptyRunnable.INSTANCE;
}
return new Runnable()
{
@Override
public void run()
{
optimizeImports(file);
}
};
}
示例3: startCommand
@Override
@Nullable
public Object startCommand(@Nonnull final Project project,
@Nls final String name,
final Object groupId,
@Nonnull final UndoConfirmationPolicy undoConfirmationPolicy) {
ApplicationManager.getApplication().assertIsDispatchThread();
if (project.isDisposed()) return null;
if (CommandLog.LOG.isDebugEnabled()) {
CommandLog.LOG.debug("startCommand: name = " + name + ", groupId = " + groupId);
}
if (myCurrentCommand != null) {
return null;
}
Document document = groupId instanceof Ref && ((Ref)groupId).get() instanceof Document ? (Document)((Ref)groupId).get() : null;
myCurrentCommand = new CommandDescriptor(EmptyRunnable.INSTANCE, project, name, groupId, undoConfirmationPolicy, true, document);
fireCommandStarted();
return myCurrentCommand;
}
示例4: startActivity
public static Runnable startActivity(final String name) {
if (!LOG.isDebugEnabled()) {
return EmptyRunnable.INSTANCE;
}
final long start = System.currentTimeMillis();
return new Runnable() {
@Override
public void run() {
LOG.debug(name + " in " + (System.currentTimeMillis() - start) + "ms");
}
};
}
示例5: processFile
@NotNull
@Override
public Runnable processFile(final PsiFile file) {
VirtualFile vFile = file.getVirtualFile();
if (vFile instanceof VirtualFileWindow) vFile = ((VirtualFileWindow)vFile).getDelegate();
if (vFile == null || !ProjectRootManager.getInstance(file.getProject()).getFileIndex().isInSourceContent(vFile)) {
return EmptyRunnable.INSTANCE;
}
return () -> optimizeImports(file);
}
示例6: createSilent
@Nonnull
private static CallbackData createSilent(@Nonnull Project project, @Nonnull InvokeAfterUpdateMode mode, @Nonnull Runnable afterUpdate) {
Consumer<Runnable> callbackCaller = mode.isCallbackOnAwt()
? ApplicationManager.getApplication()::invokeLater
: ApplicationManager.getApplication()::executeOnPooledThread;
Runnable callback = () -> {
logUpdateFinished(project, mode);
if (!project.isDisposed()) afterUpdate.run();
};
return new CallbackData(() -> callbackCaller.accept(callback), EmptyRunnable.INSTANCE);
}
示例7: performRediff
@Override
@NotNull
protected Runnable performRediff(@NotNull final ProgressIndicator indicator) {
return EmptyRunnable.INSTANCE;
}
示例8: processFile
@NotNull
@Override
public Runnable processFile(final PsiFile file) {
VirtualFile vFile = file.getVirtualFile();
if (vFile instanceof VirtualFileWindow) vFile = ((VirtualFileWindow)vFile).getDelegate();
final Project project = file.getProject();
if (vFile == null || !ProjectRootManager.getInstance(project).getFileIndex().isInSourceContent(vFile)) {
return EmptyRunnable.INSTANCE;
}
final List<Pair<String, Boolean>> names = new ArrayList<Pair<String, Boolean>>();
collectNamesToImport(names, (XmlFile)file);
Collections.sort(names, new Comparator<Pair<String, Boolean>>() {
@Override
public int compare(Pair<String, Boolean> o1, Pair<String, Boolean> o2) {
return StringUtil.compare(o1.first, o2.first, true);
}
});
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project);
final List<Pair<String, Boolean>> sortedNames = ImportHelper.sortItemsAccordingToSettings(names, settings);
final HashSet<String> onDemand = new HashSet<String>();
ImportHelper.collectOnDemandImports(sortedNames, onDemand, settings);
final Set<String> imported = new HashSet<String>();
final List<String> imports = new ArrayList<String>();
for (Pair<String, Boolean> pair : sortedNames) {
final String qName = pair.first;
final String packageName = StringUtil.getPackageName(qName);
if (imported.contains(packageName) || imported.contains(qName)) {
continue;
}
if (onDemand.contains(packageName)) {
imported.add(packageName);
imports.add("<?import " + packageName + ".*?>");
} else {
imported.add(qName);
imports.add("<?import " + qName + "?>");
}
}
final PsiFileFactory factory = PsiFileFactory.getInstance(file.getProject());
final XmlFile dummyFile = (XmlFile)factory.createFileFromText("_Dummy_.fxml", StdFileTypes.XML, StringUtil.join(imports, "\n"));
final XmlDocument document = dummyFile.getDocument();
final XmlProlog newImportList = document.getProlog();
if (newImportList == null) return EmptyRunnable.getInstance();
return new Runnable() {
@Override
public void run() {
final XmlDocument xmlDocument = ((XmlFile)file).getDocument();
final XmlProlog prolog = xmlDocument.getProlog();
if (prolog != null) {
final Collection<XmlProcessingInstruction> instructions = PsiTreeUtil.findChildrenOfType(prolog, XmlProcessingInstruction.class);
for (final XmlProcessingInstruction instruction : instructions) {
final ASTNode node = instruction.getNode();
final ASTNode nameNode = node.findChildByType(XmlTokenType.XML_NAME);
if (nameNode != null && nameNode.getText().equals("import")) {
instruction.delete();
}
}
prolog.add(newImportList);
} else {
document.addBefore(newImportList, document.getRootTag());
}
}
};
}
示例9: processFile
@NotNull
@Override
public Runnable processFile(final PsiFile file) {
VirtualFile vFile = file.getVirtualFile();
if (vFile instanceof VirtualFileWindow) vFile = ((VirtualFileWindow)vFile).getDelegate();
final Project project = file.getProject();
if (vFile == null || !ProjectRootManager.getInstance(project).getFileIndex().isInSourceContent(vFile)) {
return EmptyRunnable.INSTANCE;
}
final List<Pair<String, Boolean>> names = new ArrayList<Pair<String, Boolean>>();
collectNamesToImport(names, (XmlFile)file);
Collections.sort(names, new Comparator<Pair<String, Boolean>>() {
@Override
public int compare(Pair<String, Boolean> o1, Pair<String, Boolean> o2) {
return StringUtil.compare(o1.first, o2.first, true);
}
});
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project);
final List<Pair<String, Boolean>> sortedNames = ImportHelper.sortItemsAccordingToSettings(names, settings);
final HashSet<String> onDemand = new HashSet<String>();
ImportHelper.collectOnDemandImports(sortedNames, onDemand, settings);
final Set<String> imported = new HashSet<String>();
final List<String> imports = new ArrayList<String>();
for (Pair<String, Boolean> pair : sortedNames) {
final String qName = pair.first;
final String packageName = StringUtil.getPackageName(qName);
if (imported.contains(packageName) || imported.contains(qName)) {
continue;
}
if (onDemand.contains(packageName)) {
imported.add(packageName);
imports.add("<?import " + packageName + ".*?>");
} else {
imported.add(qName);
imports.add("<?import " + qName + "?>");
}
}
final PsiFileFactory factory = PsiFileFactory.getInstance(file.getProject());
final XmlFile dummyFile = (XmlFile)factory.createFileFromText("_Dummy_.fxml", XmlFileType.INSTANCE, StringUtil.join(imports, "\n"));
final XmlDocument document = dummyFile.getDocument();
final XmlProlog newImportList = document.getProlog();
if (newImportList == null) return EmptyRunnable.getInstance();
return new Runnable() {
@Override
public void run() {
final XmlDocument xmlDocument = ((XmlFile)file).getDocument();
final XmlProlog prolog = xmlDocument.getProlog();
if (prolog != null) {
final Collection<XmlProcessingInstruction> instructions = PsiTreeUtil.findChildrenOfType(prolog, XmlProcessingInstruction.class);
for (final XmlProcessingInstruction instruction : instructions) {
final ASTNode node = instruction.getNode();
final ASTNode nameNode = node.findChildByType(XmlTokenType.XML_NAME);
if (nameNode != null && nameNode.getText().equals("import")) {
instruction.delete();
}
}
prolog.add(newImportList);
} else {
document.addBefore(newImportList, document.getRootTag());
}
}
};
}
示例10: performRediff
@Override
@Nonnull
protected Runnable performRediff(@Nonnull final ProgressIndicator indicator) {
return EmptyRunnable.INSTANCE;
}