当前位置: 首页>>代码示例>>Java>>正文


Java ActionLink类代码示例

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


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

示例1: createActionLink

import com.intellij.ui.components.labels.ActionLink; //导入依赖的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

示例2: createForcePushInfoLabel

import com.intellij.ui.components.labels.ActionLink; //导入依赖的package包/类
@NotNull
private JComponent createForcePushInfoLabel() {
  JPanel text = new JPanel();
  text.setLayout(new BoxLayout(text, BoxLayout.X_AXIS));
  JLabel label = new JLabel("You can enable and configure Force Push in " + ShowSettingsUtil.getSettingsMenuName() + ".");
  label.setEnabled(false);
  label.setFont(JBUI.Fonts.smallFont());
  text.add(label);
  ActionLink here = new ActionLink("Configure", new AnAction() {
    @Override
    public void actionPerformed(AnActionEvent e) {
      Project project = myController.getProject();
      VcsPushDialog.this.doCancelAction(e.getInputEvent());
      ShowSettingsUtilImpl.showSettingsDialog(project, "vcs.Git", "force push");
    }
  });
  here.setFont(JBUI.Fonts.smallFont());
  text.add(here);
  return JBUI.Panels.simplePanel().addToRight(text).withBorder(JBUI.Borders.emptyBottom(4));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:VcsPushDialog.java

示例3: createActionLink

import com.intellij.ui.components.labels.ActionLink; //导入依赖的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

示例4: createSettingsAndDocs

import com.intellij.ui.components.labels.ActionLink; //导入依赖的package包/类
private JComponent createSettingsAndDocs() {
  JPanel panel = new NonOpaquePanel(new BorderLayout());
  NonOpaquePanel toolbar = new NonOpaquePanel();
  AnAction register = ActionManager.getInstance().getAction("Register");
  boolean registeredVisible = false;
  if (register != null) {
    AnActionEvent e =
      AnActionEvent.createFromAnAction(register, null, ActionPlaces.WELCOME_SCREEN, DataManager.getInstance().getDataContext(this));
    register.update(e);
    Presentation presentation = e.getPresentation();
    if (presentation.isEnabled()) {
      ActionLink registerLink = new ActionLink("Register", register);
      registerLink.setNormalColor(getLinkNormalColor());
      NonOpaquePanel button = new NonOpaquePanel(new BorderLayout());
      button.setBorder(JBUI.Borders.empty(4, 10));
      button.add(registerLink);
      installFocusable(button, register, KeyEvent.VK_UP, KeyEvent.VK_RIGHT, true);
      NonOpaquePanel wrap = new NonOpaquePanel();
      wrap.setBorder(JBUI.Borders.emptyLeft(10));
      wrap.add(button);
      panel.add(wrap, BorderLayout.WEST);
      registeredVisible = true;
    }
  }

  toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.X_AXIS));
  toolbar.add(createActionLink("Configure", IdeActions.GROUP_WELCOME_SCREEN_CONFIGURE, AllIcons.General.GearPlain, !registeredVisible));
  toolbar.add(createActionLink("Get Help", IdeActions.GROUP_WELCOME_SCREEN_DOC, null, false));

  panel.add(toolbar, BorderLayout.EAST);


  panel.setBorder(JBUI.Borders.empty(0, 0, 8, 11));
  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:FlatWelcomeFrame.java

示例5: createArrow

import com.intellij.ui.components.labels.ActionLink; //导入依赖的package包/类
private static JLabel createArrow(final ActionLink link) {
  JLabel arrow = new JLabel(AllIcons.General.Combo3);
  arrow.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  arrow.setVerticalAlignment(SwingConstants.BOTTOM);
  new ClickListener() {
    @Override
    public boolean onClick(@NotNull MouseEvent e, int clickCount) {
      final MouseEvent newEvent = MouseEventAdapter.convert(e, link, e.getX(), e.getY());
      link.doClick(newEvent);
      return true;
    }
  }.installOn(arrow);
  return arrow;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:FlatWelcomeFrame.java

示例6: drawPressAddButtonMessage

import com.intellij.ui.components.labels.ActionLink; //导入依赖的package包/类
private void drawPressAddButtonMessage(final ConfigurationType configurationType) {
  JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
  panel.setBorder(new EmptyBorder(30, 0, 0, 0));
  panel.add(new JLabel("Press the"));

  ActionLink addIcon = new ActionLink("", ADD_ICON, myAddAction);
  addIcon.setBorder(new EmptyBorder(0, 0, 0, 5));
  panel.add(addIcon);

  final String configurationTypeDescription = configurationType != null
                                              ? configurationType.getConfigurationTypeDescription()
                                              : ExecutionBundle.message("run.configuration.default.type.description");
  panel.add(new JLabel(ExecutionBundle.message("empty.run.configuration.panel.text.label3", configurationTypeDescription)));
  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(panel, true);

  myRightPanel.removeAll();
  myRightPanel.add(scrollPane, BorderLayout.CENTER);
  if (configurationType == null) {
    JPanel settingsPanel = new JPanel(new GridBagLayout());
    GridBag grid = new GridBag().setDefaultAnchor(GridBagConstraints.NORTHWEST);

    for (Pair<UnnamedConfigurable, JComponent> each : myAdditionalSettings) {
      settingsPanel.add(each.second, grid.nextLine().next());
    }
    settingsPanel.add(createSettingsPanel(), grid.nextLine().next());

    JPanel wrapper = new JPanel(new BorderLayout());
    wrapper.add(settingsPanel, BorderLayout.WEST);
    wrapper.add(Box.createGlue(), BorderLayout.CENTER);

    myRightPanel.add(wrapper, BorderLayout.SOUTH);
  }
  myRightPanel.revalidate();
  myRightPanel.repaint();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:RunConfigurable.java

示例7: createLink

import com.intellij.ui.components.labels.ActionLink; //导入依赖的package包/类
/**
 * Creates {@link ActionLink} component with URL open action.
 *
 * @param title title of link
 * @param url   url to open
 * @return {@link ActionLink} component
 */
private ActionLink createLink(@NotNull String title, @NotNull final String url) {
    final ActionLink action = new ActionLink(title, new AnAction() {
        @Override
        public void actionPerformed(AnActionEvent anActionEvent) {
            BrowserUtil.browse(url);
        }
    });
    action.setBorder(new EmptyBorder(0, 5, 0, 5));
    return action;
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:18,代码来源:IgnoreSettingsPanel.java

示例8: drawPressAddButtonMessage

import com.intellij.ui.components.labels.ActionLink; //导入依赖的package包/类
private void drawPressAddButtonMessage(final ConfigurationType configurationType) {
  JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
  panel.setBorder(new EmptyBorder(7, 10, 0, 0));
  panel.add(new JLabel("Press the"));

  ActionLink addIcon = new ActionLink("", ADD_ICON, myAddAction);
  addIcon.setBorder(new EmptyBorder(0, 5, 0, 5));
  panel.add(addIcon);

  final String configurationTypeDescription = configurationType != null
                                              ? configurationType.getConfigurationTypeDescription()
                                              : ExecutionBundle.message("run.configuration.default.type.description");
  panel.add(new JLabel(ExecutionBundle.message("empty.run.configuration.panel.text.label3", configurationTypeDescription)));
  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(panel, true);

  myRightPanel.removeAll();
  myRightPanel.add(scrollPane, BorderLayout.CENTER);
  if (configurationType == null) {
    JPanel settingsPanel = new JPanel(new GridBagLayout());
    settingsPanel.setBorder(new EmptyBorder(7, 10, 0, 0));
    GridBag grid = new GridBag().setDefaultAnchor(GridBagConstraints.NORTHWEST);

    for (Pair<UnnamedConfigurable, JComponent> each : myAdditionalSettings) {
      settingsPanel.add(each.second, grid.nextLine().next());
    }
    settingsPanel.add(createSettingsPanel(), grid.nextLine().next());

    JPanel wrapper = new JPanel(new BorderLayout());
    wrapper.add(settingsPanel, BorderLayout.WEST);
    wrapper.add(Box.createGlue(), BorderLayout.CENTER);

    myRightPanel.add(wrapper, BorderLayout.SOUTH);
  }
  myRightPanel.revalidate();
  myRightPanel.repaint();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:37,代码来源:RunConfigurable.java

示例9: createEventsLink

import com.intellij.ui.components.labels.ActionLink; //导入依赖的package包/类
private JComponent createEventsLink() {
  final Ref<ActionLink> actionLinkRef = new Ref<>();
  final JComponent panel = createActionLink("Events", AllIcons.Ide.Notification.NoEvents, actionLinkRef, new AnAction() {
    @RequiredDispatchThread
    @Override
    public void actionPerformed(@Nonnull AnActionEvent e) {
      ((WelcomeDesktopBalloonLayoutImpl)myFlatWelcomeFrame.getBalloonLayout()).showPopup();
    }
  });
  panel.setVisible(false);
  myEventListener = types -> {
    NotificationType type1 = null;
    for (NotificationType t : types) {
      if (NotificationType.ERROR == t) {
        type1 = NotificationType.ERROR;
        break;
      }
      if (NotificationType.WARNING == t) {
        type1 = NotificationType.WARNING;
      }
      else if (type1 == null && NotificationType.INFORMATION == t) {
        type1 = NotificationType.INFORMATION;
      }
    }

    actionLinkRef.get().setIcon(IdeNotificationArea.createIconWithNotificationCount(actionLinkRef.get(), type1, types.size()));
    panel.setVisible(true);
  };
  myEventLocation = () -> {
    Point location = SwingUtilities.convertPoint(panel, 0, 0, getRootPane().getLayeredPane());
    return new Point(location.x, location.y + 5);
  };
  return panel;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:35,代码来源:FlatWelcomePanel.java

示例10: createArrow

import com.intellij.ui.components.labels.ActionLink; //导入依赖的package包/类
public static JLabel createArrow(final ActionLink link) {
  JLabel arrow = new JLabel(AllIcons.General.Combo3);
  arrow.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  arrow.setVerticalAlignment(SwingConstants.BOTTOM);
  new ClickListener() {
    @Override
    public boolean onClick(@Nonnull MouseEvent e, int clickCount) {
      final MouseEvent newEvent = MouseEventAdapter.convert(e, link, e.getX(), e.getY());
      link.doClick(newEvent);
      return true;
    }
  }.installOn(arrow);
  return arrow;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:FlatWelcomePanel.java

示例11: createUIComponents

import com.intellij.ui.components.labels.ActionLink; //导入依赖的package包/类
private void createUIComponents() {
  mySetIcon = new ActionLink("Change...", new ChangeProjectIcon(false));
  mySetIconDark = new ActionLink("Change...", new ChangeProjectIcon(true));
  myClear = new ActionLink("Reset", new ResetProjectIcon(false));
  myClearDark = new ActionLink("Reset", new ResetProjectIcon(true));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ChangeProjectIconForm.java

示例12: createActionPanel

import com.intellij.ui.components.labels.ActionLink; //导入依赖的package包/类
private JComponent createActionPanel() {
  JPanel actions = new NonOpaquePanel();
  actions.setBorder(JBUI.Borders.emptyLeft(10));
  actions.setLayout(new BoxLayout(actions, BoxLayout.Y_AXIS));
  ActionManager actionManager = ActionManager.getInstance();
  ActionGroup quickStart = (ActionGroup)actionManager.getAction(IdeActions.GROUP_WELCOME_SCREEN_QUICKSTART);
  DefaultActionGroup group = new DefaultActionGroup();
  collectAllActions(group, quickStart);

  for (AnAction action : group.getChildren(null)) {
    JPanel button = new JPanel(new BorderLayout());
    button.setOpaque(false);
    button.setBorder(JBUI.Borders.empty(8, 20));
    AnActionEvent e =
      AnActionEvent.createFromAnAction(action, null, ActionPlaces.WELCOME_SCREEN, DataManager.getInstance().getDataContext(this));
    action.update(e);
    Presentation presentation = e.getPresentation();
    if (presentation.isVisible()) {
      String text = presentation.getText();
      if (text != null && text.endsWith("...")) {
        text = text.substring(0, text.length() - 3);
      }
      Icon icon = presentation.getIcon();
      if (icon.getIconHeight() != JBUI.scale(16) || icon.getIconWidth() != JBUI.scale(16)) {
        icon = JBUI.emptyIcon(16);
      }
      action = wrapGroups(action);
      ActionLink link = new ActionLink(text, icon, action, createUsageTracker(action));
      link.setPaintUnderline(false);
      link.setNormalColor(getLinkNormalColor());
      button.add(link);
      if (action instanceof WelcomePopupAction) {
        button.add(createArrow(link), BorderLayout.EAST);
      }
      installFocusable(button, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, true);
      actions.add(button);
    }
  }

  WelcomeScreenActionsPanel panel = new WelcomeScreenActionsPanel();
  panel.actions.add(actions);
  return panel.root;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:FlatWelcomeFrame.java

示例13: createActionPanel

import com.intellij.ui.components.labels.ActionLink; //导入依赖的package包/类
@RequiredDispatchThread
private JComponent createActionPanel(FlatWelcomePanel welcomePanel) {
  JPanel actions = new NonOpaquePanel();
  actions.setBorder(JBUI.Borders.emptyLeft(10));
  actions.setLayout(new BoxLayout(actions, BoxLayout.Y_AXIS));
  ActionManager actionManager = ActionManager.getInstance();
  ActionGroup quickStart = (ActionGroup)actionManager.getAction(IdeActions.GROUP_WELCOME_SCREEN_QUICKSTART);
  List<AnAction> group = new ArrayList<>();
  collectAllActions(group, quickStart);

  for (AnAction action : group) {
    AnActionEvent e = AnActionEvent.createFromAnAction(action, null, ActionPlaces.WELCOME_SCREEN, DataManager.getInstance().getDataContext(welcomePanel));
    action.update(e);

    if (action instanceof WelcomeScreenSlideAction) {
      final WelcomeScreenSlideAction oldAction = (WelcomeScreenSlideAction)action;
      action = new AnAction() {
        @RequiredDispatchThread
        @Override
        public void actionPerformed(@Nonnull AnActionEvent e) {
          JComponent panel = oldAction.createSlide(myWelcomeFrame, myWelcomeFrame::setTitle);
          JBCardLayout layout = (JBCardLayout)FlatWelcomeScreen.this.getLayout();
          String id = oldAction.getClass().getName();

          FlatWelcomeScreen.this.add(panel, id);

          layout.swipe(FlatWelcomeScreen.this, id, JBCardLayout.SwipeDirection.FORWARD);
        }
      };
      action.copyFrom(oldAction);
    }

    Presentation presentation = e.getPresentation();
    if (presentation.isVisible()) {
      String text = presentation.getText();
      if (text != null && text.endsWith("...")) {
        text = text.substring(0, text.length() - 3);
      }
      ActionLink link = new ActionLink(text, presentation.getIcon(), action, createUsageTracker(action));
      // Don't allow focus, as the containing panel is going to focusable.
      link.setFocusable(false);
      link.setPaintUnderline(false);
      link.setNormalColor(WelcomeScreenConstants.getLinkNormalColor());
      FlatWelcomePanel.JActionLinkPanel button = new FlatWelcomePanel.JActionLinkPanel(link);
      button.setBorder(JBUI.Borders.empty(8, 20));
      if (action instanceof WelcomePopupAction) {
        button.add(FlatWelcomePanel.createArrow(link), BorderLayout.EAST);
      }
      welcomePanel.installFocusable(button, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, true);
      actions.add(button);
    }
  }

  JPanel panel = new JPanel();
  //panel.setBackground(FlatWelcomeFrame.getMainBackground());
  panel.add(actions);
  return panel;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:59,代码来源:FlatWelcomeScreen.java

示例14: JActionLinkPanel

import com.intellij.ui.components.labels.ActionLink; //导入依赖的package包/类
public JActionLinkPanel(@Nonnull ActionLink actionLink) {
  super(new BorderLayout());
  myActionLink = actionLink;
  add(myActionLink);
  NonOpaquePanel.setTransparent(this);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:7,代码来源:FlatWelcomePanel.java


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