本文整理汇总了Java中com.intellij.util.Alarm类的典型用法代码示例。如果您正苦于以下问题:Java Alarm类的具体用法?Java Alarm怎么用?Java Alarm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Alarm类属于com.intellij.util包,在下文中一共展示了Alarm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PhpNewClassDialog
import com.intellij.util.Alarm; //导入依赖的package包/类
public PhpNewClassDialog(@NotNull Project project, @Nullable PsiDirectory directory) {
super(project);
this.myAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
Disposer.register(this.getDisposable(), new Disposable() {
public void dispose() {
PhpNewClassDialog.this.myAlarm.cancelAllRequests();
PhpNewClassDialog.this.myDisposed = true;
}
});
this.myProperties = new Properties();
this.myProject = project;
this.myDirectory = directory;
init();
}
示例2: ContentChooser
import com.intellij.util.Alarm; //导入依赖的package包/类
public ContentChooser(Project project, String title, boolean useIdeaEditor, boolean allowMultipleSelections) {
super(project, true);
myProject = project;
myUseIdeaEditor = useIdeaEditor;
myAllowMultipleSelections = allowMultipleSelections;
myUpdateAlarm = new Alarm(getDisposable());
mySplitter = new JBSplitter(true, 0.3f);
mySplitter.setSplitterProportionKey(getDimensionServiceKey() + ".splitter");
myList = new JBList(new CollectionListModel<Item>());
myList.setExpandableItemsEnabled(false);
setOKButtonText(CommonBundle.getOkButtonText());
setTitle(title);
init();
}
示例3: waitProcess
import com.intellij.util.Alarm; //导入依赖的package包/类
public void waitProcess(final ProcessHandler processHandler) {
Alarm alarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD, getTestRootDisposable());
final boolean[] isRunning = {true};
alarm.addRequest(new Runnable() {
@Override
public void run() {
boolean b;
synchronized (isRunning) {
b = isRunning[0];
}
if (b) {
processHandler.destroyProcess();
LOG.error("process was running over " + myTimeout / 1000 + " seconds. Interrupted. ");
}
}
}, myTimeout);
processHandler.waitFor();
synchronized (isRunning) {
isRunning[0] = false;
}
alarm.dispose();
}
示例4: waitFor
import com.intellij.util.Alarm; //导入依赖的package包/类
public void waitFor(Runnable r) {
Alarm alarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD, getTestRootDisposable());
final Thread thread = Thread.currentThread();
final boolean[] isRunning = {true};
alarm.addRequest(new Runnable() {
@Override
public void run() {
boolean b;
synchronized (isRunning) {
b = isRunning[0];
}
if (b) {
thread.interrupt();
LOG.error("test was running over " + myTimeout / 1000 + " seconds. Interrupted. ");
}
}
}, myTimeout);
r.run();
synchronized (isRunning) {
isRunning[0] = false;
}
Thread.interrupted();
}
示例5: applicationActivated
import com.intellij.util.Alarm; //导入依赖的package包/类
@Override
public void applicationActivated(final IdeFrame ideFrame) {
final Runnable processClipboard = new Runnable() {
@Override
public void run() {
final String clipboard = AnalyzeStacktraceUtil.getTextInClipboard();
if (clipboard != null && clipboard.length() < MAX_STACKTRACE_SIZE && !clipboard.equals(stacktrace)) {
stacktrace = clipboard;
final Project project = ideFrame.getProject();
if (project != null && isStacktrace(stacktrace)) {
final UnscrambleDialog dialog = new UnscrambleDialog(project);
dialog.createNormalizeTextAction().actionPerformed(null);
dialog.doOKAction();
}
}
}
};
if (Patches.SLOW_GETTING_CLIPBOARD_CONTENTS) {
//IDEA's clipboard is synchronized with the system clipboard on frame activation so we need to postpone clipboard processing
new Alarm().addRequest(processClipboard, 300);
}
else {
processClipboard.run();
}
}
示例6: pollDeployments
import com.intellij.util.Alarm; //导入依赖的package包/类
private static void pollDeployments(final ServerConnection connection) {
connection.computeDeployments(new Runnable() {
@Override
public void run() {
new Alarm().addRequest(new Runnable() {
@Override
public void run() {
if (connection == ServerConnectionManager.getInstance().getConnection(connection.getServer())) {
pollDeployments(connection);
}
}
}, POLL_DEPLOYMENTS_DELAY, ModalityState.any());
}
});
}
示例7: AbstractTreeUpdater
import com.intellij.util.Alarm; //导入依赖的package包/类
public AbstractTreeUpdater(@NotNull AbstractTreeBuilder treeBuilder) {
myTreeBuilder = treeBuilder;
final JTree tree = myTreeBuilder.getTree();
final JComponent component = tree instanceof TreeTableTree ? ((TreeTableTree)tree).getTreeTable() : tree;
myUpdateQueue = new MergingUpdateQueue("UpdateQueue", 300, component.isShowing(), component) {
@Override
protected Alarm createAlarm(@NotNull Alarm.ThreadToUse thread, Disposable parent) {
return new Alarm(thread, parent) {
@Override
protected boolean isEdt() {
return AbstractTreeUpdater.this.isEdt();
}
};
}
};
myUpdateQueue.setRestartTimerOnAdd(false);
final UiNotifyConnector uiNotifyConnector = new UiNotifyConnector(component, myUpdateQueue);
Disposer.register(this, myUpdateQueue);
Disposer.register(this, uiNotifyConnector);
}
示例8: addNotify
import com.intellij.util.Alarm; //导入依赖的package包/类
@Override
public void addNotify() {
super.addNotify();
final String key = "toolwindow.stripes.buttons.info.shown";
if (UISettings.getInstance().HIDE_TOOL_STRIPES && !PropertiesComponent.getInstance().isTrueValue(key)) {
PropertiesComponent.getInstance().setValue(key, String.valueOf(true));
final Alarm alarm = new Alarm();
alarm.addRequest(new Runnable() {
@Override
public void run() {
GotItMessage.createMessage(UIBundle.message("tool.window.quick.access.title"), UIBundle.message(
"tool.window.quick.access.message"))
.setDisposable(ToolWindowsWidget.this)
.show(new RelativePoint(ToolWindowsWidget.this, new Point(10, 0)), Balloon.Position.above);
Disposer.dispose(alarm);
}
}, 20000);
}
}
示例9: updateStatus
import com.intellij.util.Alarm; //导入依赖的package包/类
void updateStatus(Configurable configurable) {
myFilter.updateSpotlight(configurable == null);
if (myBanner != null) {
myBanner.setProject(myTreeView.findConfigurableProject(configurable));
myBanner.setText(myTreeView.getPathNames(configurable));
}
if (myEditor != null) {
ConfigurationException exception = myFilter.myContext.getErrors().get(configurable);
myEditor.getApplyAction().setEnabled(!myFilter.myContext.getModified().isEmpty());
myEditor.getResetAction().setEnabled(myFilter.myContext.isModified(configurable) || exception != null);
myEditor.setError(exception);
myEditor.revalidate();
}
if (configurable != null) {
new Alarm().addRequest(new Runnable() {
@Override
public void run() {
if (!myDisposed && mySpotlightPainter != null) {
mySpotlightPainter.updateNow();
}
}
}, 300);
}
}
示例10: ControlledCycle
import com.intellij.util.Alarm; //导入依赖的package包/类
public ControlledCycle(final Project project, final Getter<Boolean> callback, @NotNull final String name, final int refreshInterval) {
myRefreshInterval = (refreshInterval <= 0) ? ourRefreshInterval : refreshInterval;
myActive = new AtomicBoolean(false);
myRunnable = new Runnable() {
boolean shouldBeContinued = true;
public void run() {
if (! myActive.get() || project.isDisposed()) return;
try {
shouldBeContinued = callback.get();
} catch (ProcessCanceledException e) {
return;
} catch (RuntimeException e) {
LOG.info(e);
}
if (! shouldBeContinued) {
myActive.set(false);
} else {
mySimpleAlarm.addRequest(myRunnable, myRefreshInterval);
}
}
};
mySimpleAlarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, project);
}
示例11: VcsAnnotationLocalChangesListenerImpl
import com.intellij.util.Alarm; //导入依赖的package包/类
public VcsAnnotationLocalChangesListenerImpl(Project project, final ProjectLevelVcsManager vcsManager) {
myLock = new Object();
myUpdateStuff = createUpdateStuff();
myUpdater = new ZipperUpdater(ApplicationManager.getApplication().isUnitTestMode() ? 10 : 300, Alarm.ThreadToUse.POOLED_THREAD, project);
myConnection = project.getMessageBus().connect();
myLocalFileSystem = LocalFileSystem.getInstance();
VcsAnnotationRefresher handler = createHandler();
myDirtyPaths = new HashSet<String>();
myDirtyChanges = new HashMap<String, VcsRevisionNumber>();
myDirtyFiles = new HashSet<VirtualFile>();
myFileAnnotationMap = MultiMap.createSet();
myVcsManager = vcsManager;
myVcsKeySet = new HashSet<VcsKey>();
myConnection.subscribe(VcsAnnotationRefresher.LOCAL_CHANGES_CHANGED, handler);
}
示例12: addItemToLookup
import com.intellij.util.Alarm; //导入依赖的package包/类
private void addItemToLookup(CompletionResult item) {
if (!myLookup.addItem(item.getLookupElement(), item.getPrefixMatcher())) {
return;
}
myCount++;
if (myCount == 1) {
new Alarm(Alarm.ThreadToUse.SHARED_THREAD, this).addRequest(new Runnable() {
@Override
public void run() {
myFreezeSemaphore.up();
}
}, 300);
}
myQueue.queue(myUpdate);
}
示例13: fixMouseCheaters
import com.intellij.util.Alarm; //导入依赖的package包/类
private void fixMouseCheaters() {
myLookup.getComponent().addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
final ActionCallback done = IdeFocusManager.getInstance(myProject).requestFocus(myLookup.getEditor().getContentComponent(), true);
IdeFocusManager.getInstance(myProject).typeAheadUntil(done);
new Alarm(myLookup).addRequest(new Runnable() {
@Override
public void run() {
if (!done.isDone()) {
done.setDone();
}
}
}, 300, myModalityState);
}
});
}
示例14: setCalculating
import com.intellij.util.Alarm; //导入依赖的package包/类
void setCalculating(final boolean calculating) {
Runnable setVisible = new Runnable() {
@Override
public void run() {
myIconPanel.setVisible(myLookup.isCalculating());
}
};
if (myLookup.isCalculating()) {
new Alarm(myLookup).addRequest(setVisible, 100, myModalityState);
} else {
setVisible.run();
}
if (calculating) {
myProcessIcon.resume();
} else {
myProcessIcon.suspend();
}
}
示例15: ProjectListBuilder
import com.intellij.util.Alarm; //导入依赖的package包/类
public ProjectListBuilder(final Project project,
final CommanderPanel panel,
final AbstractTreeStructure treeStructure,
final Comparator comparator,
final boolean showRoot) {
super(project, panel.getList(), panel.getModel(), treeStructure, comparator, showRoot);
myList.setCellRenderer(new ColoredCommanderRenderer(panel));
myUpdateAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, myProject);
myPsiTreeChangeListener = new MyPsiTreeChangeListener();
PsiManager.getInstance(myProject).addPsiTreeChangeListener(myPsiTreeChangeListener);
myFileStatusListener = new MyFileStatusListener();
FileStatusManager.getInstance(myProject).addFileStatusListener(myFileStatusListener);
myCopyPasteListener = new MyCopyPasteListener();
CopyPasteManager.getInstance().addContentChangedListener(myCopyPasteListener);
buildRoot();
}