本文整理匯總了Java中com.intellij.util.ui.PositionTracker類的典型用法代碼示例。如果您正苦於以下問題:Java PositionTracker類的具體用法?Java PositionTracker怎麽用?Java PositionTracker使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PositionTracker類屬於com.intellij.util.ui包,在下文中一共展示了PositionTracker類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showBalloon
import com.intellij.util.ui.PositionTracker; //導入依賴的package包/類
private void showBalloon() {
if (myBalloon != null) {
Disposer.dispose(myBalloon);
return;
}
myBalloon = JBPopupFactory.getInstance().createBalloonBuilder(myBalloonComponent)
.setAnimationCycle(200)
.setCloseButtonEnabled(true)
.setHideOnAction(false)
.setHideOnClickOutside(false)
.setHideOnFrameResize(false)
.setHideOnKeyOutside(false)
.setSmallVariant(true)
.setShadow(true)
.createBalloon();
Disposer.register(myBalloon, new Disposable() {
@Override
public void dispose() {
myBalloon = null;
}
});
myBalloon.addListener(new JBPopupAdapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
if (myBalloon != null) {
Disposer.dispose(myBalloon);
}
}
});
myBalloon.show(new PositionTracker<Balloon>(myIcon) {
@Override
public RelativePoint recalculateLocation(Balloon object) {
return new RelativePoint(myIcon, new Point(myIcon.getSize().width / 2, 4));
}
}, Balloon.Position.above);
}
示例2: showBalloon
import com.intellij.util.ui.PositionTracker; //導入依賴的package包/類
protected void showBalloon() {
final JComponent component = getComponent();
if (component == null) return;
if (ApplicationManager.getApplication().isHeadlessEnvironment()) return;
final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(component, null).setSmallVariant(true);
myBalloon = balloonBuilder.createBalloon();
Disposer.register(myProject, myBalloon);
Disposer.register(myBalloon, new Disposable() {
@Override
public void dispose() {
releaseIfNotRestart();
}
});
final Editor topLevelEditor = InjectedLanguageUtil.getTopLevelEditor(myEditor);
topLevelEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
myBalloon.show(new PositionTracker<Balloon>(topLevelEditor.getContentComponent()) {
@Override
public RelativePoint recalculateLocation(Balloon object) {
if (myTarget != null && !popupFactory.isBestPopupLocationVisible(topLevelEditor)) {
return myTarget;
}
final RelativePoint target = popupFactory.guessBestPopupLocation(topLevelEditor);
if (target == null) return myTarget;
final Point screenPoint = target.getScreenPoint();
int y = screenPoint.y;
if (target.getPoint().getY() > topLevelEditor.getLineHeight() + myBalloon.getPreferredSize().getHeight()) {
y -= topLevelEditor.getLineHeight();
}
myTarget = new RelativePoint(new Point(screenPoint.x, y));
return myTarget;
}
}, Balloon.Position.above);
}
示例3: showBalloon
import com.intellij.util.ui.PositionTracker; //導入依賴的package包/類
private void showBalloon() {
if (myBalloon != null) {
Disposer.dispose(myBalloon);
return;
}
myBalloon =
JBPopupFactory.getInstance().createBalloonBuilder(myBalloonComponent).setAnimationCycle(200).setCloseButtonEnabled(true).setHideOnAction(false)
.setHideOnClickOutside(false).setHideOnFrameResize(false).setHideOnKeyOutside(false).setSmallVariant(true).setShadow(true)
.createBalloon();
Disposer.register(myBalloon, new Disposable() {
@Override
public void dispose() {
myBalloon = null;
}
});
myBalloon.addListener(new JBPopupAdapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
if (myBalloon != null) {
Disposer.dispose(myBalloon);
}
}
});
myBalloon.show(new PositionTracker<Balloon>(myIcon) {
@Override
public RelativePoint recalculateLocation(Balloon object) {
return new RelativePoint(myIcon, new Point(myIcon.getSize().width / 2, 4));
}
}, Balloon.Position.above);
}
示例4: showBalloon
import com.intellij.util.ui.PositionTracker; //導入依賴的package包/類
protected void showBalloon() {
final JComponent component = getComponent();
if (component == null) return;
if (ApplicationManager.getApplication().isHeadlessEnvironment()) return;
final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(component, null).setSmallVariant(true);
myBalloon = balloonBuilder.createBalloon();
final Editor topLevelEditor = InjectedLanguageUtil.getTopLevelEditor(myEditor);
Disposer.register(myProject, myBalloon);
Disposer.register(myBalloon, new Disposable() {
@Override
public void dispose() {
releaseIfNotRestart();
topLevelEditor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION, null);
}
});
topLevelEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
myBalloon.show(new PositionTracker<Balloon>(topLevelEditor.getContentComponent()) {
@Override
public RelativePoint recalculateLocation(Balloon object) {
if (myTarget != null && !popupFactory.isBestPopupLocationVisible(topLevelEditor)) {
return myTarget;
}
if (myCaretRangeMarker != null && myCaretRangeMarker.isValid()) {
topLevelEditor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION,
topLevelEditor.offsetToVisualPosition(myCaretRangeMarker.getStartOffset()));
}
final RelativePoint target = popupFactory.guessBestPopupLocation(topLevelEditor);
final Point screenPoint = target.getScreenPoint();
int y = screenPoint.y;
if (target.getPoint().getY() > topLevelEditor.getLineHeight() + myBalloon.getPreferredSize().getHeight()) {
y -= topLevelEditor.getLineHeight();
}
myTarget = new RelativePoint(new Point(screenPoint.x, y));
return myTarget;
}
}, Balloon.Position.above);
}
示例5: showBalloon
import com.intellij.util.ui.PositionTracker; //導入依賴的package包/類
protected void showBalloon() {
NonFocusableCheckBox checkBox = new NonFocusableCheckBox(RefactoringBundle.message("delegation.panel.delegate.via.overloading.method"));
checkBox.addActionListener(e -> {
myDelegate = checkBox.isSelected();
updateCurrentInfo();
});
JPanel content = new JPanel(new BorderLayout());
content.add(new JBLabel("Performed signature modifications:"), BorderLayout.NORTH);
content.add(myPreview.getComponent(), BorderLayout.CENTER);
updateMethodSignature(myStableChange);
content.add(checkBox, BorderLayout.SOUTH);
final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(content, null).setSmallVariant(true);
myBalloon = balloonBuilder.createBalloon();
myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
myBalloon.show(new PositionTracker<Balloon>(myEditor.getContentComponent()) {
@Override
public RelativePoint recalculateLocation(Balloon object) {
int offset = myStableChange.getMethod().getTextOffset();
VisualPosition visualPosition = myEditor.offsetToVisualPosition(offset);
Point point = myEditor.visualPositionToXY(new VisualPosition(visualPosition.line, visualPosition.column));
return new RelativePoint(myEditor.getContentComponent(), point);
}
}, Balloon.Position.above);
Disposer.register(myBalloon, () -> {
EditorFactory.getInstance().releaseEditor(myPreview);
myPreview = null;
});
}
示例6: revalidate
import com.intellij.util.ui.PositionTracker; //導入依賴的package包/類
protected void revalidate() {
myWholePanel.revalidate();
if (myTarget != null) {
myBalloon.revalidate(new PositionTracker.Static<Balloon>(myTarget));
}
}
示例7: show
import com.intellij.util.ui.PositionTracker; //導入依賴的package包/類
void show(PositionTracker<Balloon> tracker, Position preferredPosition);