本文整理汇总了Java中com.intellij.openapi.util.EmptyRunnable类的典型用法代码示例。如果您正苦于以下问题:Java EmptyRunnable类的具体用法?Java EmptyRunnable怎么用?Java EmptyRunnable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EmptyRunnable类属于com.intellij.openapi.util包,在下文中一共展示了EmptyRunnable类的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: replaceIdeEventQueueSafely
import com.intellij.openapi.util.EmptyRunnable; //导入依赖的package包/类
public static void replaceIdeEventQueueSafely() {
if (Toolkit.getDefaultToolkit().getSystemEventQueue() instanceof IdeEventQueue) {
return;
}
if (SwingUtilities.isEventDispatchThread()) {
throw new RuntimeException("must not call under EDT");
}
AWTAutoShutdown.getInstance().notifyThreadBusy(Thread.currentThread());
UIUtil.pump();
// in JDK 1.6 java.awt.EventQueue.push() causes slow painful death of current EDT
// so we have to wait through its agony to termination
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
IdeEventQueue.getInstance();
}
});
SwingUtilities.invokeAndWait(EmptyRunnable.getInstance());
SwingUtilities.invokeAndWait(EmptyRunnable.getInstance());
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
示例3: testWriteActionIsAllowedFromEDTOnly
import com.intellij.openapi.util.EmptyRunnable; //导入依赖的package包/类
public void testWriteActionIsAllowedFromEDTOnly() throws InterruptedException {
Thread thread = new Thread("test") {
@Override
public void run() {
try {
ApplicationManager.getApplication().runWriteAction(EmptyRunnable.getInstance());
}
catch (Throwable e) {
exception = e;
}
}
};
thread.start();
thread.join();
assertNotNull(exception);
}
示例4: startCommand
import com.intellij.openapi.util.EmptyRunnable; //导入依赖的package包/类
@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;
}
示例5: testVisibleProperty
import com.intellij.openapi.util.EmptyRunnable; //导入依赖的package包/类
@Test
public void testVisibleProperty() throws Exception {
JLabel label = new JLabel();
VisibleProperty visibleProperty = new VisibleProperty(label);
CountListener listener = new CountListener();
visibleProperty.addListener(listener);
assertThat(visibleProperty.get()).isTrue();
assertThat(listener.getCount()).isEqualTo(0);
label.setVisible(false);
// Swing enqueues the visibility changed event, so we need to wait for it
SwingUtilities.invokeAndWait(EmptyRunnable.INSTANCE);
assertThat(visibleProperty.get()).isFalse();
assertThat(listener.getCount()).isEqualTo(1);
visibleProperty.set(true);
assertThat(label.isVisible()).isTrue();
assertThat(listener.getCount()).isGreaterThan(1);
}
示例6: perform
import com.intellij.openapi.util.EmptyRunnable; //导入依赖的package包/类
public void perform(final Project project, MavenEmbeddersManager embeddersManager, MavenConsole console, MavenProgressIndicator indicator)
throws MavenProcessCanceledException {
MavenArtifactDownloader.DownloadResult result =
myTree.downloadSourcesAndJavadocs(project, myProjects, myArtifacts, myDownloadSources, myDownloadDocs, embeddersManager, console, indicator);
if (myCallbackResult != null) myCallbackResult.setDone(result);
// todo: hack to update all file pointers.
MavenUtil.invokeLater(project, new Runnable() {
public void run() {
AccessToken accessToken = WriteAction.start();
try {
ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.getInstance(), false, true);
}
finally {
accessToken.finish();
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MavenProjectsProcessorArtifactsDownloadingTask.java
示例7: apply
import com.intellij.openapi.util.EmptyRunnable; //导入依赖的package包/类
public void apply() {
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
DaemonCodeAnalyzerSettings daemonSettings = DaemonCodeAnalyzerSettings.getInstance();
codeInsightSettings.ADD_IMPORTS_ON_PASTE = getSmartPasteValue();
codeInsightSettings.EXCLUDED_PACKAGES = getExcludedPackages();
daemonSettings.setImportHintEnabled(myCbShowImportPopup.isSelected());
codeInsightSettings.OPTIMIZE_IMPORTS_ON_THE_FLY = myCbOptimizeImports.isSelected();
codeInsightSettings.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = myCbAddUnambiguousImports.isSelected();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.getInstance(), false, true);
}
}
});
}
示例8: fireRootsChanged
import com.intellij.openapi.util.EmptyRunnable; //导入依赖的package包/类
private static void fireRootsChanged(final Collection<VirtualFile> files, final boolean isAdded) {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.getInstance(), false, true);
ProjectPlainTextFileTypeManager projectPlainTextFileTypeManager = ProjectPlainTextFileTypeManager.getInstance(project);
for (VirtualFile file : files) {
if (projectPlainTextFileTypeManager.hasProjectContaining(file)) {
if (isAdded) {
projectPlainTextFileTypeManager.addFile(file);
}
else {
projectPlainTextFileTypeManager.removeFile(file);
}
}
}
}
}
});
}
示例9: 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));
}
示例10: 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();
}
if(vFile == null || !ProjectRootManager.getInstance(file.getProject()).getFileIndex().isInSourceContent(vFile))
{
return EmptyRunnable.INSTANCE;
}
return new Runnable()
{
@Override
public void run()
{
optimizeImports(file);
}
};
}
示例11: stop
import com.intellij.openapi.util.EmptyRunnable; //导入依赖的package包/类
@Override
public synchronized void stop() {
LOG.assertTrue(!myStoppedAlready);
super.stop();
UIUtil.invokeLaterIfNeeded(() -> {
boolean wasShowing = isDialogShowing();
if (myDialog != null) {
myDialog.hide();
}
synchronized (this) {
myStoppedAlready = true;
}
Disposer.dispose(this);
});
SwingUtilities.invokeLater(EmptyRunnable.INSTANCE); // Just to give blocking dispatching a chance to go out.
}
示例12: startCommand
import com.intellij.openapi.util.EmptyRunnable; //导入依赖的package包/类
@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;
}
示例13: startActivity
import com.intellij.openapi.util.EmptyRunnable; //导入依赖的package包/类
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");
}
};
}
示例14: dispose
import com.intellij.openapi.util.EmptyRunnable; //导入依赖的package包/类
@Override
public void dispose() {
// wait until all our submitted tasks are executed
try {
myExecutor.submit(EmptyRunnable.getInstance()).get();
}
catch (Exception ignored) {
}
}
示例15: changeLanguageLevel
import com.intellij.openapi.util.EmptyRunnable; //导入依赖的package包/类
@Override
public Promise<Void> changeLanguageLevel(@NotNull Module module, @NotNull LanguageLevel level) {
final LanguageLevel moduleLevel = LanguageLevelModuleExtensionImpl.getInstance(module).getLanguageLevel();
if (moduleLevel != null && JavaSdkUtil.isLanguageLevelAcceptable(myProject, module, level)) {
final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
rootModel.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(level);
rootModel.commit();
}
else {
LanguageLevelProjectExtension.getInstance(myProject).setLanguageLevel(level);
ProjectRootManagerEx.getInstanceEx(myProject).makeRootsChange(EmptyRunnable.INSTANCE, false, true);
}
return Promise.DONE;
}