本文整理汇总了Java中com.intellij.ui.awt.RelativePoint类的典型用法代码示例。如果您正苦于以下问题:Java RelativePoint类的具体用法?Java RelativePoint怎么用?Java RelativePoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RelativePoint类属于com.intellij.ui.awt包,在下文中一共展示了RelativePoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleBadRequest
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
private void handleBadRequest(final HybrisHttpResult httpResult, final Project project) {
if (httpResult.getStatusCode() != SC_OK) {
final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
if (httpResult.getStatusCode() == SC_NOT_FOUND || httpResult.getStatusCode() == SC_MOVED_TEMPORARILY) {
JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(
"Hybris Host URL '" + httpResult.getErrorMessage() + "' was incorrect. Please, check your settings.",
MessageType.ERROR,
null
).setFadeoutTime(FADEOUT_TIME)
.createBalloon().show(
RelativePoint.getCenterOf(statusBar.getComponent()),
Balloon.Position.atRight
);
}
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:18,代码来源:ExecuteHybrisConsole.java
示例2: StudyStepicUserWidget
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
public StudyStepicUserWidget() {
StepicUser user = StudySettings.getInstance().getUser();
Icon icon = user == null ? EducationalCoreIcons.StepikOff : EducationalCoreIcons.Stepik;
myComponent = new JLabel(icon);
new ClickListener() {
@Override
public boolean onClick(@NotNull MouseEvent e, int clickCount) {
Point point = new Point(0, 0);
StepicUserComponent component = new StepicUserComponent(StudySettings.getInstance().getUser());
final Dimension dimension = component.getPreferredSize();
point = new Point(point.x - dimension.width, point.y - dimension.height);
component.showComponent(new RelativePoint(e.getComponent(), point));
return true;
}
}.installOn(myComponent);
}
示例3: showComponent
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
public void showComponent(RelativePoint point) {
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(this, this)
.setRequestFocus(true)
.setCancelOnOtherWindowOpen(true)
.setCancelOnClickOutside(true)
.setShowBorder(true)
.createPopup();
Disposer.register(ApplicationManager.getApplication(), new Disposable() {
@Override
public void dispose() {
Disposer.dispose(myPopup);
}
});
myPopup.show(point);
}
示例4: createNotificationPanel
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
if (!CCUtils.isCourseCreator(myProject)) {
return null;
}
boolean isTestFile = CCUtils.isTestsFile(myProject, file);
if (!isTestFile && StudyUtils.getTaskFile(myProject, file) == null) {
return null;
}
Task task = StudyUtils.getTaskForFile(myProject, file);
if (task instanceof TaskWithSubtasks) {
final TaskWithSubtasks withSubtasks = (TaskWithSubtasks)task;
EditorNotificationPanel panel = new EditorNotificationPanel(EditorColors.GUTTER_BACKGROUND);
String header = (isTestFile ? "test" : "task") + " file";
int activeSubtaskIndex = withSubtasks.getActiveSubtaskIndex() + 1;
int subtaskSize = withSubtasks.getLastSubtaskIndex() + 1;
panel.setText("This is a " + header + " for " + EduNames.SUBTASK + " " + activeSubtaskIndex + "/" + subtaskSize);
panel
.createActionLabel(SWITCH_SUBTASK, () -> createPopup(withSubtasks, myProject).show(RelativePoint.getSouthEastOf(panel)));
return panel;
}
return null;
}
示例5: generateProject
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
@Override
public void generateProject(@NotNull Project project, @NotNull VirtualFile baseDir, @NotNull GravProjectSettings settings, @NotNull Module module) {
StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
VirtualFile vf = LocalFileSystem.getInstance().findFileByIoFile(new File(settings.gravInstallationPath));
if (vf == null || !GravSdkType.isValidGravSDK(vf)) {
JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder("Project couldn't be created because Grav Installation isn't valid", MessageType.ERROR, null)
.setFadeoutTime(3500)
.createBalloon()
.show(RelativePoint.getSouthEastOf(statusBar.getComponent()), Balloon.Position.above);
} else {
storage.setDefaultGravDownloadPath(settings.gravInstallationPath);
PropertiesComponent.getInstance().setValue(LAST_USED_GRAV_HOME, new File(settings.gravInstallationPath).getAbsolutePath());
GravProjectGeneratorUtil projectGenerator = new GravProjectGeneratorUtil();
projectGenerator.generateProject(project, baseDir, settings, module);
try {
List<String> includePath = new ArrayList<>();
includePath.add(baseDir.getPath());
PhpIncludePathManager.getInstance(project).setIncludePath(includePath);
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例6: moduleCreated
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
@Override
public void moduleCreated(@NotNull Module module) {
StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
String msg = String.format("Please wait while module for project %s is created", project.getName());
settings = GravProjectSettings.getInstance(project);
JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder(msg, MessageType.WARNING, null)
.setFadeoutTime(4000)
.createBalloon()
.show(RelativePoint.getSouthEastOf(statusBar.getComponent()), Balloon.Position.above);
VirtualFile[] roots1 = ModuleRootManager.getInstance(module).getContentRoots();
if (roots1.length != 0) {
final VirtualFile src = roots1[0];
settings.withSrcDirectory = withSrcDirectory;
settings.gravInstallationPath = getGravInstallPath().getPath();
// settings.withSrcDirectory =
GravProjectGeneratorUtil generatorUtil = new GravProjectGeneratorUtil();
generatorUtil.generateProject(project, src, settings, module);
}
}
示例7: showMessage
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
private static void showMessage(final Project project, final MessageType messageType, final String format, final Object[] args) {
StatusBar statusBar = windowManager.getStatusBar(project);
if(statusBar == null || statusBar.getComponent() == null){
return;
}
String message = String.format(format, args);
jbPopupFactory.createHtmlTextBalloonBuilder(message, messageType, null)
.setFadeoutTime(7500)
.createBalloon()
.show(RelativePoint.getNorthEastOf(statusBar.getComponent()), Balloon.Position.atRight);
if(messageType == MessageType.INFO){
log.info(message);
}
else if(messageType == MessageType.WARNING) {
log.warn(message);
}
else{
log.debug(message);
}
}
示例8: displayUploadResultBalloonMessage
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
private void displayUploadResultBalloonMessage(String fileName, Boolean isSuccess) {
String message = fileName + " Uploaded Successfully";
MessageType messageType = MessageType.INFO;
if (!isSuccess) {
message = fileName + " Failed to Upload";
messageType = MessageType.ERROR;
}
JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder("<h3>" + message + "</h3>", messageType, null)
.setFadeoutTime(3000)
.createBalloon()
.show(RelativePoint.getNorthEastOf(WindowManager.getInstance().getIdeFrame(project).getComponent()),
Balloon.Position.above);
}
示例9: showIncomingChatInvitation
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
public void showIncomingChatInvitation(@NotNull ChatInvitation chatInvitation, @NotNull IncomingChatInvitationNotification notification) {
IncomingChatInvitationPopup.Model popupModel = IdeaSamebugPlugin.getInstance().conversionService.convertIncomingChatInvitationPopup(chatInvitation);
IncomingChatInvitationPopup popup = new IncomingChatInvitationPopup(popupModel);
IncomingChatInvitationPopupListener incomingChatInvitationPopupListener = new IncomingChatInvitationPopupListener(this, chatInvitation);
ListenerService.putListenerToComponent(popup, IIncomingChatInvitationPopup.Listener.class, incomingChatInvitationPopupListener);
BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(popup);
balloonBuilder.setFillColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setContentInsets(new Insets(40, 0, 40, 0));
balloonBuilder.setBorderInsets(new Insets(0, 0, 0, 0));
balloonBuilder.setBorderColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setShadow(true);
IdeFrame window = (IdeFrame) NotificationsManagerImpl.findWindowForBalloon(myProject);
RelativePoint pointToShowPopup = null;
if (window != null) pointToShowPopup = RelativePoint.getSouthEastOf(window.getComponent());
Balloon balloon = balloonBuilder.createBalloon();
balloon.show(pointToShowPopup, Balloon.Position.atLeft);
TrackingService.trace(SwingRawEvent.notificationShow(popup));
}
示例10: showIncomingHelpRequest
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
public void showIncomingHelpRequest(@NotNull IncomingHelpRequest helpRequest, @NotNull IncomingHelpRequestNotification notification) {
IHelpRequestPopup.Model popupModel = IdeaSamebugPlugin.getInstance().conversionService.convertHelpRequestPopup(helpRequest);
HelpRequestPopup popup = new HelpRequestPopup(popupModel);
DataService.putData(popup, TrackingKeys.Location, new Locations.HelpRequestNotification(helpRequest.getMatch().getHelpRequest().getId()));
DataService.putData(popup, TrackingKeys.WriteTipTransaction, Funnels.newTransactionId());
HelpRequestPopupListener helpRequestPopupListener = new HelpRequestPopupListener(this);
ListenerService.putListenerToComponent(popup, IHelpRequestPopup.Listener.class, helpRequestPopupListener);
BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(popup);
balloonBuilder.setFillColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setContentInsets(new Insets(40, 0, 40, 0));
balloonBuilder.setBorderInsets(new Insets(0, 0, 0, 0));
balloonBuilder.setBorderColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setShadow(true);
IdeFrame window = (IdeFrame) NotificationsManagerImpl.findWindowForBalloon(myProject);
RelativePoint pointToShowPopup = null;
if (window != null) pointToShowPopup = RelativePoint.getSouthEastOf(window.getComponent());
Balloon balloon = balloonBuilder.createBalloon();
data.put(popup, helpRequest);
notifications.put(popup, notification);
balloons.put(popup, balloon);
balloon.show(pointToShowPopup, Balloon.Position.atLeft);
TrackingService.trace(SwingRawEvent.notificationShow(popup));
}
示例11: queueRevalidate
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
private void queueRevalidate(@Nullable final Runnable after) {
queue(new AfterModelUpdate(ID.REVALIDATE) {
@Override
protected void after() {
final LightweightHint hint = myPanel.getHint();
if (hint != null) {
myPanel.getHintContainerShowPoint().doWhenDone(new Consumer<RelativePoint>() {
@Override
public void consume(final RelativePoint relativePoint) {
hint.setSize(myPanel.getPreferredSize());
hint.setLocation(relativePoint);
if (after != null) {
after.run();
}
}
});
}
else {
if (after != null) {
after.run();
}
}
}
});
}
示例12: fix
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
@Override
public void fix(final JComponent contextComponent, RelativePoint relativePoint) {
JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<ConfigurationErrorQuickFix>(null, myDescription.getFixes()) {
@NotNull
@Override
public String getTextFor(ConfigurationErrorQuickFix value) {
return value.getActionName();
}
@Override
public PopupStep onChosen(final ConfigurationErrorQuickFix selectedValue, boolean finalChoice) {
return doFinalStep(new Runnable() {
@Override
public void run() {
selectedValue.performFix();
}
});
}
}).show(relativePoint);
}
示例13: reportException
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
private void reportException(final String htmlContent) {
Runnable balloonShower = new Runnable() {
@Override
public void run() {
Balloon balloon = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(htmlContent, MessageType.WARNING, null).
setShowCallout(false).setHideOnClickOutside(true).setHideOnAction(true).setHideOnFrameResize(true).setHideOnKeyOutside(true).
createBalloon();
final Rectangle rect = myPanel.getPanel().getBounds();
final Point p = new Point(rect.x + rect.width - 100, rect.y + 50);
final RelativePoint point = new RelativePoint(myPanel.getPanel(), p);
balloon.show(point, Balloon.Position.below);
Disposer.register(myProject != null ? myProject : ApplicationManager.getApplication(), balloon);
}
};
ApplicationManager.getApplication().invokeLater(balloonShower, new Condition() {
@Override
public boolean value(Object o) {
return !(myProject == null || myProject.isDefault()) && ((!myProject.isOpen()) || myProject.isDisposed());
}
}
);
}
示例14: actionPerformed
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final DataContext dataContext = e.getDataContext();
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
List<String> fileNames = findTestDataFiles(dataContext);
if (fileNames == null || fileNames.isEmpty()) {
String testData = guessTestData(dataContext);
if (testData == null) {
String message = "Cannot find testdata files for class";
final Notification notification = new Notification("testdata", "Found no testdata files", message, NotificationType.INFORMATION);
Notifications.Bus.notify(notification, project);
return;
}
fileNames = Collections.singletonList(testData);
}
final Editor editor = e.getData(CommonDataKeys.EDITOR);
final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
final RelativePoint point = editor != null ? popupFactory.guessBestPopupLocation(editor) : popupFactory.guessBestPopupLocation(dataContext);
TestDataNavigationHandler.navigate(point, fileNames, project);
}
示例15: showBalloonForComponent
import com.intellij.ui.awt.RelativePoint; //导入依赖的package包/类
public static void showBalloonForComponent(@NotNull Component component, @NotNull final String message, final MessageType type,
final boolean atTop, @Nullable final Disposable disposable) {
final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
if (popupFactory == null) return;
BalloonBuilder balloonBuilder = popupFactory.createHtmlTextBalloonBuilder(message, type, null);
balloonBuilder.setDisposable(disposable == null ? ApplicationManager.getApplication() : disposable);
Balloon balloon = balloonBuilder.createBalloon();
Dimension size = component.getSize();
Balloon.Position position;
int x;
int y;
if (size == null) {
x = y = 0;
position = Balloon.Position.above;
}
else {
x = Math.min(10, size.width / 2);
y = size.height;
position = Balloon.Position.below;
}
balloon.show(new RelativePoint(component, new Point(x, y)), position);
}