本文整理汇总了Java中com.intellij.openapi.util.EmptyRunnable.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java EmptyRunnable.getInstance方法的具体用法?Java EmptyRunnable.getInstance怎么用?Java EmptyRunnable.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.EmptyRunnable
的用法示例。
在下文中一共展示了EmptyRunnable.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUIComponents
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
private void createUIComponents() {
myLanguageLevelCombo = new LanguageLevelCombo(JavaCoreBundle.message("default.language.level.description")) {
@Override
protected LanguageLevel getDefaultLevel() {
Sdk sdk = myProjectJdkConfigurable.getSelectedProjectJdk();
if (sdk == null) return null;
JavaSdkVersion version = JavaSdk.getInstance().getVersion(sdk);
return version == null ? null : version.getMaxLanguageLevel();
}
};
final JTextField textField = new JTextField();
final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
outputPathsChooserDescriptor.setHideIgnored(false);
BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);
}
示例2: impl
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
private void impl(RootsHolder rootsHolder, GitLogFilters filters) {
final GitCommitsSequentialIndex commitsSequentially = new GitCommitsSequentialIndex();
final MediatorImpl mediator = new MediatorImpl(myProject, commitsSequentially);
final LoadController controller = new LoadController(myProject, mediator, null, commitsSequentially);
mediator.setLoader(controller);
final BigTableTableModel tableModel = new BigTableTableModel(Collections.<ColumnInfo>emptyList(), EmptyRunnable.getInstance());
mediator.setTableModel(tableModel);
tableModel.setRootsHolder(rootsHolder);
final Semaphore semaphore = new Semaphore();
final MyUIRefresh refresh = new MyUIRefresh(semaphore);
mediator.setUIRefresh(refresh);
final long start = System.currentTimeMillis();
semaphore.down();
mediator.reload(rootsHolder, Collections.<String>emptyList(), Collections.<String>emptyList(), filters, true);
semaphore.waitFor(300000);
refresh.assertMe();
final long end = System.currentTimeMillis();
System.out.println("Time: " + (end - start));
}
示例3: actionPerformed
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final List<PackagingSourceItem> items = mySourceItemsTree.getSelectedItems();
ParentElementsInfo parentsInfo = findParentAndGrandParent(myArtifactEditor.getArtifact());
if (parentsInfo == null) {
return;
}
final Artifact artifact = parentsInfo.getGrandparentArtifact();
final ArtifactEditorContext context = myArtifactEditor.getContext();
//todo[nik] improve
final Runnable emptyRunnable = EmptyRunnable.getInstance();
context.editLayout(artifact, emptyRunnable);
context.editLayout(parentsInfo.getParentArtifact(), emptyRunnable);
parentsInfo = findParentAndGrandParent(myArtifactEditor.getArtifact());//find elements under modifiable root
if (parentsInfo == null) {
return;
}
final CompositePackagingElement<?> grandParent = parentsInfo.getGrandparentElement();
final List<String> classpath = new ArrayList<String>();
context.editLayout(artifact, new Runnable() {
@Override
public void run() {
for (PackagingSourceItem item : items) {
final List<? extends PackagingElement<?>> elements = item.createElements(context);
grandParent.addOrFindChildren(elements);
classpath.addAll(ManifestFileUtil.getClasspathForElements(elements, context, artifact.getArtifactType()));
}
}
});
final ArtifactEditor parentArtifactEditor = context.getOrCreateEditor(parentsInfo.getParentArtifact());
parentArtifactEditor.addToClasspath(parentsInfo.getParentElement(), classpath);
((ArtifactEditorImpl)context.getOrCreateEditor(parentsInfo.getGrandparentArtifact())).rebuildTries();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:PutSourceItemIntoParentAndLinkViaManifestAction.java
示例4: retrieveAndStoreNotificationInfo
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
private void retrieveAndStoreNotificationInfo(@NotNull Runnable runnable) {
if (runnable instanceof ImportOptimizer.CollectingInfoRunnable) {
String optimizerMessage = ((ImportOptimizer.CollectingInfoRunnable)runnable).getUserNotificationInfo();
myOptimizerNotifications.add(optimizerMessage != null ? new NotificationInfo(optimizerMessage) : NOTHING_CHANGED_NOTIFICATION);
}
else if (runnable == EmptyRunnable.getInstance()) {
myOptimizerNotifications.add(NOTHING_CHANGED_NOTIFICATION);
}
else {
myOptimizerNotifications.add(SOMETHING_CHANGED_WITHOUT_MESSAGE_NOTIFICATION);
}
}
示例5: createUIComponents
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
private void createUIComponents() {
myLanguageLevelCombo = new LanguageLevelCombo();
final JTextField textField = new JTextField();
final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
outputPathsChooserDescriptor.setHideIgnored(false);
BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);
}
示例6: testTwoReposStart
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
public void testTwoReposStart() throws Exception {
final BigTableTableModel model = new BigTableTableModel(Collections.<ColumnInfo>emptyList(), EmptyRunnable.getInstance());
model.setCommitIdxInterval(2);
model.setNumEventsInGroup(2);
final VirtualFile[] arr = new VirtualFile[] {new MyVf(), new MyVf()};
model.setRootsHolder(new RootsHolder(Arrays.asList(arr)));
model.clear(true, true);
final List<List<AbstractHash>> parentsOne = new ArrayList<List<AbstractHash>>();
final List<List<AbstractHash>> parentsTwo = new ArrayList<List<AbstractHash>>();
final List<CommitI> one = new ArrayList<CommitI>(2);
final List<CommitI> two = new ArrayList<CommitI>(2);
CommitI first = new MultipleRepositoryCommitDecorator(new Commit("1", 1, new Ref<Integer>(-1)), 0);
one.add(first);
CommitI second = new MultipleRepositoryCommitDecorator(new Commit("0", 2, new Ref<Integer>(-1)), 1);
two.add(second);
parentsOne.add(Collections.singletonList(AbstractHash.create("2")));
parentsTwo.add(Collections.singletonList(AbstractHash.create("1")));
model.setStrategy(new CommitGroupingStrategy() {
@Override
public String getGroupName(CommitI commit) {
if ("1".equals(commit.getHash().toString())) return "Header 1";
return "Header 2";
}
@Override
public void beforeStart() {
}
});
model.appendData(one, parentsOne);
model.appendData(two, parentsTwo);
System.out.println("2");
}
示例7: retrieveAndStoreNotificationInfo
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
private void retrieveAndStoreNotificationInfo(@Nonnull Runnable runnable) {
if (runnable instanceof ImportOptimizer.CollectingInfoRunnable) {
String optimizerMessage = ((ImportOptimizer.CollectingInfoRunnable)runnable).getUserNotificationInfo();
myOptimizerNotifications.add(optimizerMessage != null ? new NotificationInfo(optimizerMessage) : NOTHING_CHANGED_NOTIFICATION);
}
else if (runnable == EmptyRunnable.getInstance()) {
myOptimizerNotifications.add(NOTHING_CHANGED_NOTIFICATION);
}
else {
myOptimizerNotifications.add(SOMETHING_CHANGED_WITHOUT_MESSAGE_NOTIFICATION);
}
}
示例8: processFile
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
@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: preprocessFile
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
protected Runnable preprocessFile(final PsiFile file, final boolean allowReplacement) throws IncorrectOperationException
{
VirtualFile vfile = file.getVirtualFile();
if (vfile == null) return EmptyRunnable.getInstance();
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
if (progressIndicator != null) {
progressIndicator.setText2(vfile.getPresentableUrl());
}
Module mod = module;
if (module == null)
{
mod = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(vfile);
}
if (mod == null) return EmptyRunnable.getInstance();
CopyrightProfile opts = CopyrightManager.getInstance(project).getCopyrightOptions(file);
if (opts != null && FileTypeUtil.isSupportedFile(file))
{
logger.debug("process " + file);
final UpdateCopyright update = UpdateCopyrightFactory.createUpdateCopyright(project, mod, file, opts);
if (update == null) return EmptyRunnable.getInstance();
update.prepare();
if (update instanceof UpdatePsiFileCopyright && !((UpdatePsiFileCopyright)update).hasUpdates()) return EmptyRunnable.getInstance();
return new Runnable() {
public void run()
{
try
{
if (update instanceof UpdatePsiFileCopyright) {
((UpdatePsiFileCopyright)update).complete(allowReplacement);
} else {
update.complete();
}
}
catch (Exception e)
{
logger.error(e);
}
}
};
}
else
{
return EmptyRunnable.getInstance();
}
}
示例10: preprocessFile
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
protected Runnable preprocessFile(final PsiFile file) throws IncorrectOperationException
{
VirtualFile vfile = file.getVirtualFile();
if (vfile == null) return EmptyRunnable.getInstance();
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
if (progressIndicator != null) {
progressIndicator.setText2(vfile.getPresentableUrl());
}
Module mod = module;
if (module == null)
{
mod = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(vfile);
}
if (mod == null) return EmptyRunnable.getInstance();
CopyrightProfile opts = CopyrightManager.getInstance(project).getCopyrightOptions(file);
if (opts != null && FileTypeUtil.isSupportedFile(file))
{
logger.debug("process " + file);
final UpdateCopyright update = UpdateCopyrightFactory.createUpdateCopyright(project, mod, file, opts);
if (update == null) return EmptyRunnable.getInstance();
update.prepare();
return new Runnable() {
public void run()
{
try
{
update.complete();
}
catch (Exception e)
{
logger.error(e);
}
}
};
}
else
{
return EmptyRunnable.getInstance();
}
}
示例11: processFile
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
@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());
}
}
};
}
示例12: preprocessFile
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
@Override
protected Runnable preprocessFile(final PsiFile file) throws IncorrectOperationException {
VirtualFile vfile = file.getVirtualFile();
if (vfile == null) {
return EmptyRunnable.getInstance();
}
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
if (progressIndicator != null) {
progressIndicator.setText2(vfile.getPresentableUrl());
}
Module mod = module;
if (module == null) {
mod = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(vfile);
}
if (mod == null) {
return EmptyRunnable.getInstance();
}
UpdateCopyrightsProvider updateCopyrightsProvider = CopyrightUpdaters.INSTANCE.forFileType(file.getFileType());
if(updateCopyrightsProvider == null) {
return EmptyRunnable.getInstance();
}
CopyrightProfile copyrightProfile = CopyrightManager.getInstance(project).getCopyrightOptions(file);
if (copyrightProfile != null && CopyrightUpdaters.hasExtension(file)) {
logger.debug("process " + file);
final UpdatePsiFileCopyright<?> updateCopyright = updateCopyrightsProvider.createInstance(file, copyrightProfile);
return new Runnable() {
@Override
public void run() {
try {
updateCopyright.process();
}
catch (Exception e) {
logger.error(e);
}
}
};
}
else {
return EmptyRunnable.getInstance();
}
}
示例13: init
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
private void init() {
myPanel = new JPanel(new VerticalFlowLayout(true, false));
final JPanel namePanel = new JPanel(new BorderLayout());
final JLabel label = new JLabel("<html><body><b>Project name:</b></body></html>", SwingConstants.LEFT);
namePanel.add(label, BorderLayout.NORTH);
myProjectName = new JTextField();
myProjectName.setColumns(40);
final JPanel nameFieldPanel = new JPanel();
nameFieldPanel.setLayout(new BoxLayout(nameFieldPanel, BoxLayout.X_AXIS));
nameFieldPanel.add(Box.createHorizontalStrut(4));
nameFieldPanel.add(myProjectName);
namePanel.add(nameFieldPanel, BorderLayout.CENTER);
final JPanel wrapper = new JPanel(new FlowLayout(FlowLayout.LEFT));
wrapper.add(namePanel);
wrapper.setAlignmentX(0);
myPanel.add(wrapper);
myPanel.add(new JLabel(ProjectBundle.message("project.compiler.output")));
final JTextField textField = new JTextField();
final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
outputPathsChooserDescriptor.setHideIgnored(false);
BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);
myProjectCompilerOutput.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
if (myFreeze) return;
myModulesConfigurator.processModuleCompilerOutputChanged(getCompilerOutputUrl());
}
});
myPanel.add(myProjectCompilerOutput);
myPanel.add(ScrollPaneFactory.createScrollPane(myErrorsComponent, true));
}
示例14: processFile
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
@Override
@NotNull
public Runnable processFile(final PsiFile file)
{
if(!(file instanceof PsiJavaFile))
{
return EmptyRunnable.getInstance();
}
Project project = file.getProject();
final PsiImportList newImportList = JavaCodeStyleManager.getInstance(project).prepareOptimizeImportsResult((PsiJavaFile) file);
if(newImportList == null)
{
return EmptyRunnable.getInstance();
}
return new CollectingInfoRunnable()
{
private int myImportListLengthDiff;
@Override
public void run()
{
try
{
final PsiDocumentManager manager = PsiDocumentManager.getInstance(file.getProject());
final Document document = manager.getDocument(file);
if(document != null)
{
manager.commitDocument(document);
}
final PsiImportList oldImportList = ((PsiJavaFile) file).getImportList();
if(oldImportList == null)
{
return;
}
int importsBefore = oldImportList.getAllImportStatements().length;
oldImportList.replace(newImportList);
myImportListLengthDiff = importsBefore - newImportList.getAllImportStatements().length;
}
catch(IncorrectOperationException e)
{
LOG.error(e);
}
}
@Nullable
@Override
public String getUserNotificationInfo()
{
if(myImportListLengthDiff > 0)
{
return "removed " + myImportListLengthDiff + " import" + (myImportListLengthDiff > 1 ? "s" : "");
}
return null;
}
};
}
示例15: actionPerformed
import com.intellij.openapi.util.EmptyRunnable; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e)
{
final List<PackagingSourceItem> items = mySourceItemsTree.getSelectedItems();
ParentElementsInfo parentsInfo = findParentAndGrandParent(myArtifactEditor.getArtifact());
if(parentsInfo == null)
{
return;
}
final Artifact artifact = parentsInfo.getGrandparentArtifact();
final ArtifactEditorContext context = myArtifactEditor.getContext();
//todo[nik] improve
final Runnable emptyRunnable = EmptyRunnable.getInstance();
context.editLayout(artifact, emptyRunnable);
context.editLayout(parentsInfo.getParentArtifact(), emptyRunnable);
parentsInfo = findParentAndGrandParent(myArtifactEditor.getArtifact());//find elements under modifiable root
if(parentsInfo == null)
{
return;
}
final CompositePackagingElement<?> grandParent = parentsInfo.getGrandparentElement();
final List<String> classpath = new ArrayList<String>();
context.editLayout(artifact, new Runnable()
{
@Override
public void run()
{
for(PackagingSourceItem item : items)
{
final List<? extends PackagingElement<?>> elements = item.createElements(context);
grandParent.addOrFindChildren(elements);
classpath.addAll(ManifestFileUtil.getClasspathForElements(elements, context, artifact.getArtifactType()));
}
}
});
final ArtifactEditor parentArtifactEditor = context.getOrCreateEditor(parentsInfo.getParentArtifact());
//parentArtifactEditor.addToClasspath(parentsInfo.getParentElement(), classpath);
((ArtifactEditorImpl) context.getOrCreateEditor(parentsInfo.getGrandparentArtifact())).rebuildTries();
}