本文整理匯總了Java中com.intellij.util.ui.UIUtil.createNamedTimer方法的典型用法代碼示例。如果您正苦於以下問題:Java UIUtil.createNamedTimer方法的具體用法?Java UIUtil.createNamedTimer怎麽用?Java UIUtil.createNamedTimer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.util.ui.UIUtil
的用法示例。
在下文中一共展示了UIUtil.createNamedTimer方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: reset
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public void reset() {
myModel.removeAll();
myModel.add(MavenRepositoryServicesManager.getInstance().getUrls());
myIndicesTable.setModel(new MyTableModel(myManager.getIndices()));
myIndicesTable.getColumnModel().getColumn(0).setPreferredWidth(400);
myIndicesTable.getColumnModel().getColumn(1).setPreferredWidth(50);
myIndicesTable.getColumnModel().getColumn(2).setPreferredWidth(50);
myIndicesTable.getColumnModel().getColumn(3).setPreferredWidth(20);
myUpdatingIcon = new AsyncProcessIcon(IndicesBundle.message("maven.indices.updating"));
myUpdatingIcon.resume();
myTimerListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
myIndicesTable.repaint();
}
};
myRepaintTimer = UIUtil.createNamedTimer("Maven repaint",AsyncProcessIcon.CYCLE_LENGTH / AsyncProcessIcon.COUNT, myTimerListener);
myRepaintTimer.start();
}
示例2: prepareShowDialog
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
protected void prepareShowDialog() {
// We know at least about one use-case that requires special treatment here: many short (in terms of time) progress tasks are
// executed in a small amount of time. Problem: UI blinks and looks ugly if we show progress dialog that disappears shortly
// for each of them. Solution is to postpone the tasks of showing progress dialog. Hence, it will not be shown at all
// if the task is already finished when the time comes.
Timer timer = UIUtil.createNamedTimer("Progress window timer",myDelayInMillis, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (isRunning()) {
if (myDialog != null) {
final DialogWrapper popup = myDialog.myPopup;
if (popup != null) {
myFocusTrackback.registerFocusComponent(new FocusTrackback.ComponentQuery() {
@Override
public Component getComponent() {
return popup.getPreferredFocusedComponent();
}
});
if (popup.isShowing()) {
myDialog.myWasShown = true;
}
}
}
showDialog();
}
else {
Disposer.dispose(ProgressWindow.this);
}
}
}, getModalityState());
}
});
timer.setRepeats(false);
timer.start();
}
示例3: scheduleHide
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private void scheduleHide() {
if (myTimer != null && myTimer.isRunning()) {
myTimer.stop();
}
myTimer = UIUtil.createNamedTimer("Hide context menu", 1500, new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
if (myDisposed) return;
if (myComponent.isVisible()) {
final PointerInfo pointerInfo = MouseInfo.getPointerInfo();
if (pointerInfo != null) {
final Point location = pointerInfo.getLocation();
SwingUtilities.convertPointFromScreen(location, myComponent);
if (!myComponent.getBounds().contains(location)) {
toggleContextToolbar(false);
}
else {
scheduleHide();
}
}
}
}
});
myTimer.setRepeats(false);
myTimer.start();
}
示例4: FramelessNotificationPopup
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public FramelessNotificationPopup(final JComponent owner, final JComponent content, Color backgroud, boolean useDefaultPreferredSize, final ActionListener listener) {
myBackgroud = backgroud;
myUseDefaultPreferredSize = useDefaultPreferredSize;
myContent = new ContentComponent(content);
myActionListener = listener;
myFadeInTimer = UIUtil.createNamedTimer("Frameless fade in",10, myFadeTracker);
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(myContent, null)
.setRequestFocus(false)
.setResizable(false)
.setMovable(true)
.setLocateWithinScreenBounds(false)
.setAlpha(0.2f).addListener(new JBPopupAdapter() {
public void onClosed(LightweightWindowEvent event) {
if (myFadeInTimer.isRunning()) {
myFadeInTimer.stop();
}
myFadeInTimer.removeActionListener(myFadeTracker);
}
})
.createPopup();
final Point p = RelativePoint.getSouthEastOf(owner).getScreenPoint();
Rectangle screen = ScreenUtil.getScreenRectangle(p.x, p.y);
final Point initial = new Point(screen.x + screen.width - myContent.getPreferredSize().width - 50,
screen.y + screen.height - 5);
myPopup.showInScreenCoordinates(owner, initial);
myFadeInTimer.setRepeats(true);
myFadeInTimer.start();
}
示例5: initComponent
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public void initComponent() {
if (!ApplicationManager.getApplication().isUnitTestMode()) {
myCacheRefreshTimer = UIUtil.createNamedTimer("TaskManager refresh", myConfig.updateInterval * 60 * 1000, new ActionListener() {
public void actionPerformed(@NotNull ActionEvent e) {
if (myConfig.updateEnabled && !myUpdating) {
LOG.info("Updating issues cache (every " + myConfig.updateInterval + " min)");
updateIssues(null);
}
}
});
myCacheRefreshTimer.setInitialDelay(0);
StartupManager.getInstance(myProject).registerPostStartupActivity(new Runnable() {
public void run() {
myCacheRefreshTimer.start();
}
});
}
// make sure that the default task is exist
LocalTask defaultTask = findTask(LocalTaskImpl.DEFAULT_TASK_ID);
if (defaultTask == null) {
defaultTask = createDefaultTask();
addTask(defaultTask);
}
// search for active task
LocalTask activeTask = null;
final List<LocalTask> tasks = getLocalTasks();
Collections.sort(tasks, TASK_UPDATE_COMPARATOR);
for (LocalTask task : tasks) {
if (activeTask == null) {
if (task.isActive()) {
activeTask = task;
}
}
else {
task.setActive(false);
}
}
if (activeTask == null) {
activeTask = defaultTask;
}
myActiveTask = activeTask;
doActivate(myActiveTask, false);
myDispatcher.getMulticaster().taskActivated(myActiveTask);
}