當前位置: 首頁>>代碼示例>>Java>>正文


Java RelativePoint類代碼示例

本文整理匯總了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);
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:18,代碼來源:StudyStepicUserWidget.java

示例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);
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:18,代碼來源:StudyStepicUserWidget.java

示例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;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:25,代碼來源:CCSubtaskEditorNotificationProvider.java

示例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();
        }
    }
}
 
開發者ID:PioBeat,項目名稱:GravSupport,代碼行數:25,代碼來源:GravProjectGenerator.java

示例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);
        }
    }
 
開發者ID:PioBeat,項目名稱:GravSupport,代碼行數:23,代碼來源:GravModuleBuilder.java

示例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);
    }
}
 
開發者ID:satr,項目名稱:intellij-idea-plugin-connector-for-aws-lambda,代碼行數:22,代碼來源:MessageHelper.java

示例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);
}
 
開發者ID:Topher84,項目名稱:NetSuite-Tools-For-WebStorm,代碼行數:17,代碼來源:UploadTask.java

示例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));
}
 
開發者ID:samebug,項目名稱:samebug-idea-plugin,代碼行數:21,代碼來源:IncomingChatInvitationPopupController.java

示例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));
}
 
開發者ID:samebug,項目名稱:samebug-idea-plugin,代碼行數:26,代碼來源:HelpRequestPopupController.java

示例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();
        }
      }
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:NavBarUpdateQueue.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:ProjectConfigurationProblem.java

示例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());
    }
  }
  );
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:DirDiffTableModel.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:NavigateToTestDataAction.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:PopupUtil.java


注:本文中的com.intellij.ui.awt.RelativePoint類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。