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


Java EmptyRunnable.INSTANCE属性代码示例

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

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

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

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

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

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

示例7: performRediff

@Override
@NotNull
protected Runnable performRediff(@NotNull final ProgressIndicator indicator) {
  return EmptyRunnable.INSTANCE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ThreesideBinaryDiffViewer.java

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

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

示例10: performRediff

@Override
@Nonnull
protected Runnable performRediff(@Nonnull final ProgressIndicator indicator) {
  return EmptyRunnable.INSTANCE;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:ThreesideBinaryDiffViewer.java


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