• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PopupFactoryImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.ui.popup.PopupFactoryImpl的典型用法代码示例。如果您正苦于以下问题:Java PopupFactoryImpl类的具体用法?Java PopupFactoryImpl怎么用?Java PopupFactoryImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PopupFactoryImpl类属于com.intellij.ui.popup包,在下文中一共展示了PopupFactoryImpl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: showPopup

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
protected void showPopup(DataContext context, ListPopup popup, JComponent contextComponent) {
  Component focusedComponent = contextComponent != null ? contextComponent : PlatformDataKeys.CONTEXT_COMPONENT.getData(context);
  if (focusedComponent != null) {
    if (popup instanceof PopupFactoryImpl.ActionGroupPopup && focusedComponent instanceof JLabel) {
      ((PopupFactoryImpl.ActionGroupPopup)popup).showUnderneathOfLabel((JLabel)focusedComponent);
    } else {
      popup.showUnderneathOf(focusedComponent);
    }
  }
  else {
    Rectangle r;
    int x;
    int y;
    focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent((Project)null);
    r = WindowManagerEx.getInstanceEx().getScreenBounds();
    x = r.x + r.width / 2;
    y = r.y + r.height / 2;
    Point point = new Point(x, y);
    SwingUtilities.convertPointToScreen(point, focusedComponent.getParent());

    popup.showInScreenCoordinates(focusedComponent.getParent(), point);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:WelcomePopupAction.java


示例2: createActionLink

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
private JComponent createActionLink(final String text, final String groupId, Icon icon, boolean focusListOnLeft) {
  final Ref<ActionLink> ref = new Ref<ActionLink>(null);
  AnAction action = new AnAction() {
    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      ActionGroup configureGroup = (ActionGroup)ActionManager.getInstance().getAction(groupId);
      final PopupFactoryImpl.ActionGroupPopup popup = (PopupFactoryImpl.ActionGroupPopup)JBPopupFactory.getInstance()
        .createActionGroupPopup(null, new IconsFreeActionGroup(configureGroup), e.getDataContext(), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false,
                                ActionPlaces.WELCOME_SCREEN);
      popup.showUnderneathOfLabel(ref.get());
      UsageTrigger.trigger("welcome.screen." + groupId);
    }
  };
  ref.set(new ActionLink(text, icon, action));
  ref.get().setPaintUnderline(false);
  ref.get().setNormalColor(getLinkNormalColor());
  NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout());
  panel.setBorder(JBUI.Borders.empty(4, 6, 4, 6));
  panel.add(ref.get());
  panel.add(createArrow(ref.get()), BorderLayout.EAST);
  installFocusable(panel, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, focusListOnLeft);
  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:FlatWelcomeFrame.java


示例3: selectItemByText

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
private static void selectItemByText(@NotNull final JList list, @NotNull final String text) {
  final Integer appIndex = execute(new GuiQuery<Integer>() {
    @Override
    protected Integer executeInEDT() throws Throwable {
      ListPopupModel popupModel = (ListPopupModel)list.getModel();
      for (int i = 0; i < popupModel.getSize(); ++i) {
        PopupFactoryImpl.ActionItem actionItem = (PopupFactoryImpl.ActionItem)popupModel.get(i);
        assertNotNull(actionItem);
        if (text.equals(actionItem.getText())) {
          return i;
        }
      }
      return -1;
    }
  });
  //noinspection ConstantConditions
  assertTrue(appIndex >= 0);

  execute(new GuiTask() {
    @Override
    protected void executeInEDT() throws Throwable {
      list.setSelectedIndex(appIndex);
    }
  });
  assertEquals(text, ((PopupFactoryImpl.ActionItem)list.getSelectedValue()).getText());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ComboBoxActionFixture.java


示例4: preselectedIndex

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
private int preselectedIndex(Iterator items) {
    for( int index = 0; items.hasNext(); index++ ) {
        Object item = items.next();
        GuardPopupAction<?> action = null;
        if ( item instanceof GuardPopupAction ) {
            action = (GuardPopupAction)item;
        }
        else if ( item instanceof PopupFactoryImpl.ActionItem && ((PopupFactoryImpl.ActionItem)item).getAction() instanceof GuardPopupAction ) {
            action= (GuardPopupAction)((PopupFactoryImpl.ActionItem)item).getAction();
        }
        if ( action == null ) {
            continue;
        }
        if ( action.getSelectionKey() != null && action.getSelectionKey().isSelectableBy(selection) ) {
            return index;
        }
    }
    return -1;
}
 
开发者ID:Abnaxos,项目名称:guards,代码行数:20,代码来源:GuardPopupController.java


示例5: actionPerformed

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
@SuppressWarnings("SuspiciousMethodCalls")
@Override
public void actionPerformed(@NotNull AnActionEvent event) {
    AnAction perform = whenSelected.get(list.getSelectedValue());
    if ( perform != null) {
        PopupFactoryImpl.ActionItem selected = (PopupFactoryImpl.ActionItem)list.getSelectedValue();
        if ( selected.isEnabled() && selected.equals(list.getSelectedValue()) ) {
            Presentation presentation = perform.getTemplatePresentation().clone();
            perform.update(event);
            perform.beforeActionPerformedUpdate(event);
            event = new AnActionEvent(
                    event.getInputEvent(), event.getDataContext(), event.getPlace(),
                    presentation, ActionManager.getInstance(), event.getModifiers());
            if ( presentation.isEnabled() ) {
                perform.actionPerformed(event);
            }
        }
    }
    else if ( selectItem != null ) {
        if ( selectItem.isEnabled() ) {
            list.setSelectedValue(selectItem, true);
            popup.handleSelect(selectHandleFinalChoices);
        }
    }
}
 
开发者ID:Abnaxos,项目名称:guards,代码行数:26,代码来源:ExtendedKeyboardActionDispatcher.java


示例6: registerActions

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
private void registerActions(final ListPopupImpl popup) {
	popup.registerAction("delete", KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), new AbstractAction() {
		public void actionPerformed(ActionEvent e) {
			JList list = popup.getList();
			int selectedIndex = list.getSelectedIndex();
			ListPopupModel model = (ListPopupModel) list.getModel();
			PopupFactoryImpl.ActionItem selectedItem = (PopupFactoryImpl.ActionItem) model.get(selectedIndex);

			if (selectedItem != null && selectedItem.getAction() instanceof RunGoalAction) {
				RunGoalAction action = (RunGoalAction) selectedItem.getAction();
				boolean deleted = ApplicationComponent.getInstance().getState().removeGoal(action.getGoal());

				if (deleted) {
					model.deleteItem(selectedItem);
					if (selectedIndex == list.getModel().getSize()) { // is last
						list.setSelectedIndex(selectedIndex - 1);
					} else {
						list.setSelectedIndex(selectedIndex);
					}
				}
			}
		}
	});
}
 
开发者ID:krasa,项目名称:MavenHelper,代码行数:25,代码来源:QuickRunMavenGoalAction.java


示例7: showPopup

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
protected void showPopup(DataContext context, ListPopup popup, JComponent contextComponent) {
  Component focusedComponent = contextComponent != null ? contextComponent : context.getData(PlatformDataKeys.CONTEXT_COMPONENT);
  if (focusedComponent != null) {
    if (popup instanceof PopupFactoryImpl.ActionGroupPopup && focusedComponent instanceof JLabel) {
      ((PopupFactoryImpl.ActionGroupPopup)popup).showUnderneathOfLabel((JLabel)focusedComponent);
    } else {
      popup.showUnderneathOf(focusedComponent);
    }
  }
  else {
    Rectangle r;
    int x;
    int y;
    focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent((Project)null);
    r = WindowManagerEx.getInstanceEx().getScreenBounds();
    x = r.x + r.width / 2;
    y = r.y + r.height / 2;
    Point point = new Point(x, y);
    SwingUtilities.convertPointToScreen(point, focusedComponent.getParent());

    popup.showInScreenCoordinates(focusedComponent.getParent(), point);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:WelcomePopupAction.java


示例8: createActionLink

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
private JComponent createActionLink(final String text, final String groupId, Icon icon, boolean focusListOnLeft) {
  final Ref<ActionLink> ref = new Ref<>(null);
  AnAction action = new AnAction() {
    @RequiredDispatchThread
    @Override
    public void actionPerformed(@Nonnull AnActionEvent e) {
      ActionGroup configureGroup = (ActionGroup)ActionManager.getInstance().getAction(groupId);
      final PopupFactoryImpl.ActionGroupPopup popup = (PopupFactoryImpl.ActionGroupPopup)JBPopupFactory.getInstance()
              .createActionGroupPopup(null, new IconsFreeActionGroup(configureGroup), e.getDataContext(), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false, ActionPlaces.WELCOME_SCREEN);
      popup.showUnderneathOfLabel(ref.get());
      UsageTrigger.trigger("welcome.screen." + groupId);
    }
  };
  JComponent panel = createActionLink(text, icon, ref, action);
  installFocusable(panel, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, focusListOnLeft);
  return panel;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:FlatWelcomePanel.java


示例9: showPopupBalloon

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
private void showPopupBalloon(final String result) {
    ApplicationManager.getApplication().invokeLater(() -> {
        mEditor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION, null);//解决因为TranslationPlugin而导致的泡泡显示错位问题
        JBPopupFactory factory = JBPopupFactory.getInstance();
        factory.createHtmlTextBalloonBuilder(result, null, new JBColor(Gray._242, Gray._0), null)
                .createBalloon()
                .show(factory.guessBestPopupLocation(mEditor), Balloon.Position.below);
    });
}
 
开发者ID:a483210,项目名称:GoogleTranslation,代码行数:10,代码来源:RequestRunnable.java


示例10: getRootAction

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
@Nullable
private static RootAction getRootAction(Object value) {
  if (value instanceof PopupFactoryImpl.ActionItem) {
    AnAction action = ((PopupFactoryImpl.ActionItem)value).getAction();
    if (action instanceof RootAction) {
      return (RootAction)action;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:BranchActionGroupPopup.java


示例11: run

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
@Override
public void run() {
  myAlarm.cancelAllRequests();

  // Skip the request if it's outdated (the mouse is moved other another element).
  DelayedQuickDocInfo info = myDelayedQuickDocInfo;
  if (info == null || !info.targetElement.equals(myActiveElements.get(info.editor))) {
    return;
  }

  // Skip the request if there is a control shown as a result of explicit 'show quick doc' (Ctrl + Q) invocation.
  if (info.docManager.getDocInfoHint() != null && !info.docManager.isCloseOnSneeze()) {
    return;
  }
  
  // We don't want to show a quick doc control if there is an active hint (e.g. the mouse is under an invalid element
  // and corresponding error info is shown).
  if (!info.docManager.hasActiveDockedDocWindow() && myHintManager.hasShownHintsThatWillHideByOtherHint(false)) {
    myAlarm.addRequest(this, EditorSettingsExternalizable.getInstance().getQuickDocOnMouseOverElementDelayMillis());
    return;
  }
  
  info.editor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION,
                          info.editor.offsetToVisualPosition(info.originalElement.getTextRange().getStartOffset()));
  try {
    info.docManager.showJavaDocInfo(info.editor, info.targetElement, info.originalElement, myHintCloseCallback, true);
    myDocumentationManager = new WeakReference<DocumentationManager>(info.docManager);
  }
  finally {
    info.editor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION, null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:QuickDocOnMouseOverManager.java


示例12: getRunConfigList

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
@NotNull
private JList getRunConfigList() {
  final JList runConfigList = robot.finder().findByType(JBListWithHintProvider.class);

  pause(new Condition("Wait until the list is populated.") {
    @Override
    public boolean test() {
      //noinspection ConstantConditions
      return execute(new GuiQuery<Boolean>() {
        @Override
        protected Boolean executeInEDT() throws Throwable {
          return runConfigList.getComponentCount() >= 2; // At least 2, since there is always one option present (the option to edit).
        }
      });
    }
  }, SHORT_TIMEOUT);

  Object selectedValue = execute(new GuiQuery<Object>() {
    @Override
    protected Object executeInEDT() throws Throwable {
      return runConfigList.getSelectedValue();
    }
  });
  assertThat(selectedValue).isInstanceOf(PopupFactoryImpl.ActionItem.class);

  return runConfigList;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:ComboBoxActionFixture.java


示例13: run

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
@Override
public void run() {
  myAlarm.cancelAllRequests();
  
  // Skip the request if it's outdated (the mouse is moved other another element).
  DelayedQuickDocInfo info = myDelayedQuickDocInfo;
  if (info == null || !info.targetElement.equals(myActiveElements.get(info.editor))) {
    return;
  }

  // Skip the request if there is a control shown as a result of explicit 'show quick doc' (Ctrl + Q) invocation.
  if (info.docManager.getDocInfoHint() != null && !info.docManager.isCloseOnSneeze()) {
    return;
  }
  
  // We don't want to show a quick doc control if there is an active hint (e.g. the mouse is under an invalid element
  // and corresponding error info is shown).
  if (!info.docManager.hasActiveDockedDocWindow() && myHintManager.hasShownHintsThatWillHideByOtherHint(false)) {
    myAlarm.addRequest(this, EditorSettingsExternalizable.getInstance().getQuickDocOnMouseOverElementDelayMillis());
    return;
  }
  
  info.editor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION,
                          info.editor.offsetToVisualPosition(info.originalElement.getTextRange().getStartOffset()));
  try {
    info.docManager.showJavaDocInfo(info.editor, info.targetElement, info.originalElement, myHintCloseCallback, true, true);
    myDocumentationManager = new WeakReference<DocumentationManager>(info.docManager);
    myDocumentationManager = new WeakReference<DocumentationManager>(info.docManager);
  }
  finally {
    info.editor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION, null);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:34,代码来源:QuickDocOnMouseOverManager.java


示例14: preselect

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
private void preselect(final ListPopup popup) {
    Iterator items = popup.getListStep().getValues().iterator();
    int index = preselectedIndex(items);
    if ( index >= 0 ) {
        findJList(popup).setSelectedIndex(index);
        AnAction action = ((PopupFactoryImpl.ActionItem)popup.getListStep().getValues().get(index)).getAction();
        if ( action instanceof ActionGroup ) {
            if ( preselectedIndex(Arrays.asList(((ActionGroup)action).getChildren(null)).iterator()) >= 0 ) {
                // ensure that the next sub-menu gets activated
                Window window = (Window)SwingUtilities.getRoot(popup.getContent());
                if ( window.isVisible() ) {
                    popup.handleSelect(false);
                }
                else {
                    window.addWindowListener(
                            new WindowAdapter() {
                                @Override
                                public void windowOpened(WindowEvent e) {
                                    popup.handleSelect(false);
                                    e.getWindow().removeWindowListener(this);
                                }
                            });
                }
            }
        }
    }
}
 
开发者ID:Abnaxos,项目名称:guards,代码行数:28,代码来源:GuardPopupController.java


示例15: install

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
void install(JComponent component) {
    for( Object item : popup.getListStep().getValues() ) {
        if ( item instanceof PopupFactoryImpl.ActionItem ) {
            if ( ((PopupFactoryImpl.ActionItem)item).getAction() instanceof GuardPopupAction ) {
                ((GuardPopupAction)((PopupFactoryImpl.ActionItem)item).getAction())
                        .extendKeyboardActions(new Extender((PopupFactoryImpl.ActionItem)item));
            }
        }
    }
    for( Map.Entry<KeyStroke, Mapping> mapping : mappings.entrySet() ) {
        mapping.getValue().registerCustomShortcutSet(new CustomShortcutSet(mapping.getKey()), component);
    }
}
 
开发者ID:Abnaxos,项目名称:guards,代码行数:14,代码来源:ExtendedKeyboardActionDispatcher.java


示例16: getSpecificAction

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
private static <T> T getSpecificAction(Object value, @Nonnull Class<T> clazz) {
  if (value instanceof PopupFactoryImpl.ActionItem) {
    AnAction action = ((PopupFactoryImpl.ActionItem)value).getAction();
    if (clazz.isInstance(action)) {
      return clazz.cast(action);
    }
    else if (action instanceof EmptyAction.MyDelegatingActionGroup) {
      ActionGroup group = ((EmptyAction.MyDelegatingActionGroup)action).getDelegate();
      return clazz.isInstance(group) ? clazz.cast(group) : null;
    }
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:BranchActionGroupPopup.java


示例17: showBalloon

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:39,代码来源:InplaceRefactoring.java


示例18: Extender

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
private Extender(PopupFactoryImpl.ActionItem actionItem) {
    this.actionItem = actionItem;
}
 
开发者ID:Abnaxos,项目名称:guards,代码行数:4,代码来源:ExtendedKeyboardActionDispatcher.java


示例19: getPopupStep

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
@Nullable
@Override
public ListPopup getPopupStep() {
    ActionGroup popupGroup = getActions();
    return new PopupFactoryImpl.ActionGroupPopup("Symfony Profiler", popupGroup, SimpleDataContext.getProjectContext(getProject()), false, false, false, true, null, -1, null, null);
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:7,代码来源:SymfonyProfilerWidget.java


示例20: shouldBeShowing

import com.intellij.ui.popup.PopupFactoryImpl; //导入依赖的package包/类
@Override
public final boolean shouldBeShowing(Object value) {
  if (!super.shouldBeShowing(value)) return false;
  if (!(value instanceof PopupFactoryImpl.ActionItem)) return true;
  return shouldBeShowing(((PopupFactoryImpl.ActionItem)value).getAction());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:7,代码来源:FlatSpeedSearchPopup.java



注:本文中的com.intellij.ui.popup.PopupFactoryImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HandlerChain类代码示例发布时间:2022-05-22
下一篇:
Java GetNewApplicationRequestProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap