Java 类com.intellij.ui.components.labels.LinkLabel 实例源码

项目:intellij-ce-playground    文件:PackageChooserDialog.java   
private void setupPathComponent(final JPanel northPanel) {
  northPanel.add(new TextFieldAction() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      toggleShowPathComponent(northPanel, this);
    }
  }, BorderLayout.EAST);
  myPathEditor = new EditorTextField(JavaReferenceEditorUtil.createDocument("", myProject, false), myProject, StdFileTypes.JAVA);
  myPathEditor.addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      myAlarm.cancelAllRequests();
      myAlarm.addRequest(new Runnable() {
        @Override
        public void run() {
          updateTreeFromPath();
        }
      }, 300);
    }
  });
  myPathEditor.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0));
  northPanel.add(myPathEditor, BorderLayout.SOUTH);
}
项目:intellij-ce-playground    文件:Banner.java   
public void addAction(final Action action) {
  action.addPropertyChangeListener(this);
  final LinkLabel label = new LinkLabel(null, null, new LinkListener() {
    @Override
    public void linkSelected(final LinkLabel aSource, final Object aLinkData) {
      action.actionPerformed(new ActionEvent(Banner.this, ActionEvent.ACTION_PERFORMED, Action.ACTION_COMMAND_KEY));
    }
  }) {
    @Override
    protected Color getTextColor() {
      return PlatformColors.BLUE;
    }
  };
  label.setFont(label.getFont().deriveFont(Font.BOLD));
  myActions.put(action, label);
  myActionsPanel.add(label);
  updateAction(action);
}
项目:intellij-ce-playground    文件:CustomizePluginsStepPanel.java   
@Override
public void linkSelected(LinkLabel linkLabel, String command) {
  if (command == null || !command.contains(":")) return;
  int semicolonPosition = command.indexOf(":");
  String group = command.substring(semicolonPosition + 1);
  command = command.substring(0, semicolonPosition);

  if (SWITCH_COMMAND.equals(command)) {
    boolean enabled = isGroupEnabled(group);
    List<IdSet> sets = myPluginGroups.getSets(group);
    for (IdSet idSet : sets) {
      String[] ids = idSet.getIds();
      for (String id : ids) {
        myPluginGroups.setPluginEnabledWithDependencies(id, !enabled);
      }
    }
    repaint();
    return;
  }
  if (CUSTOMIZE_COMMAND.equals(command)) {
    myCustomizePanel.update(group);
    myCardLayout.show(this, CUSTOMIZE);
    setButtonsVisible(false);
  }
}
项目:intellij-ce-playground    文件:CustomizePluginsStepPanel.java   
private IdSetPanel() {
  setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, GAP, true, false));
  add(myTitleLabel);
  add(myContentPanel);
  JPanel buttonPanel = new JPanel(new GridBagLayout());
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.insets.right = 25;
  gbc.gridy = 0;
  buttonPanel.add(mySaveButton, gbc);
  buttonPanel.add(new LinkLabel<String>("Enable All", null, this, "enable"), gbc);
  buttonPanel.add(new LinkLabel<String>("Disable All", null, this, "disable"), gbc);
  gbc.weightx = 1;
  buttonPanel.add(Box.createHorizontalGlue(), gbc);
  add(buttonPanel);
  mySaveButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      myCardLayout.show(CustomizePluginsStepPanel.this, MAIN);
      setButtonsVisible(true);
    }
  });
}
项目:intellij-ce-playground    文件:PushLog.java   
private JComponent createStrategyPanel() {
  final JPanel labelPanel = new JPanel(new BorderLayout());
  labelPanel.setBackground(myTree.getBackground());
  final LinkLabel<String> linkLabel = new LinkLabel<String>("Edit all targets", null);
  linkLabel.setBorder(new EmptyBorder(2, 2, 2, 2));
  linkLabel.setListener(new LinkListener<String>() {
    @Override
    public void linkSelected(LinkLabel aSource, String aLinkData) {
      if (linkLabel.isEnabled()) {
        startSyncEditing();
      }
    }
  }, null);
  myTree.addPropertyChangeListener(PushLogTreeUtil.EDIT_MODE_PROP, new PropertyChangeListener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      Boolean editMode = (Boolean)evt.getNewValue();
      linkLabel.setEnabled(!editMode);
      linkLabel.setPaintUnderline(!editMode);
      linkLabel.repaint();
    }
  });
  labelPanel.add(linkLabel, BorderLayout.EAST);
  return labelPanel;
}
项目:intellij-ce-playground    文件:VcsUpdateInfoScopeFilterConfigurable.java   
@Nullable
@Override
public JComponent createComponent() {
  final JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
  panel.add(myCheckbox);
  panel.add(myComboBox);
  panel.add(Box.createHorizontalStrut(UIUtil.DEFAULT_HGAP));
  panel.add(new LinkLabel("Manage Scopes", null, new LinkListener() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      Settings settings = Settings.KEY.getData(DataManager.getInstance().getDataContext(panel));
      if (settings != null) {
        settings.select(settings.find(ScopeChooserConfigurable.PROJECT_SCOPES));
      }
    }
  }));
  return panel;
}
项目:intellij-ce-playground    文件:SvnConfigurable.java   
private void createUIComponents() {
  myLockOnDemand = new JCheckBox() {
    @Override
    public JToolTip createToolTip() {
      JToolTip toolTip = new JToolTip(){{
        setUI(new MultiLineTooltipUI());
      }};
      toolTip.setComponent(this);
      return toolTip;
    }
  };

  final SvnConfiguration configuration = SvnConfiguration.getInstance(myProject);
  int value = configuration.getMaxAnnotateRevisions();
  value = (value == -1) ? SvnConfiguration.ourMaxAnnotateRevisionsDefault : value;
  myNumRevsInAnnotations = new JSpinner(new SpinnerNumberModel(value, 10, 100000, 100));

  myNavigateToCommonProxyLink = new LinkLabel<Object>(SvnBundle.message("navigate.to.idea.proxy.settings"), null);

  final Long maximum = 30 * 60 * 1000L;
  final long connection = configuration.getSshConnectionTimeout() <= maximum ? configuration.getSshConnectionTimeout() : maximum;
  final long read = configuration.getSshReadTimeout() <= maximum ? configuration.getSshReadTimeout() : maximum;
  mySSHConnectionTimeout = new JSpinner(new SpinnerNumberModel(Long.valueOf(connection / 1000), Long.valueOf(0L), maximum, Long.valueOf(10L)));
  mySSHReadTimeout = new JSpinner(new SpinnerNumberModel(Long.valueOf(read / 1000), Long.valueOf(0L), maximum, Long.valueOf(10L)));
  myHttpTimeout = new JSpinner(new SpinnerNumberModel(Long.valueOf(read / 1000), Long.valueOf(0L), maximum, Long.valueOf(10L)));
}
项目:translate-me    文件:ResultDialog.java   
public ResultDialog(String message, java.util.List<String> detail) {
    super(JOptionPane.getRootFrame(), message, true);

    final JPanel content = new JPanel();

 Box verticalBox = Box.createVerticalBox();

 for (int i  = 0; i < detail.size(); i++) {
  verticalBox.add(new JLabel(i + 1 + ". " + detail.get(0)));
  verticalBox.add(Box.createVerticalGlue());
 }

 final LinkLabel showMoreLink = createLinkLabel();
 verticalBox.add(showMoreLink);

 content.add(verticalBox);

    getContentPane().add(content, BorderLayout.NORTH);

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    pack();
    setResizable(false);
    setLocationRelativeTo(getOwner());

 addEscapeListener(this);
}
项目:tools-idea    文件:PackageChooserDialog.java   
private void setupPathComponent(final JPanel northPanel) {
  northPanel.add(new TextFieldAction() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      toggleShowPathComponent(northPanel, this);
    }
  }, BorderLayout.EAST);
  myPathEditor = new EditorTextField(JavaReferenceEditorUtil.createDocument("", myProject, false), myProject, StdFileTypes.JAVA);
  myPathEditor.addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      myAlarm.cancelAllRequests();
      myAlarm.addRequest(new Runnable() {
        @Override
        public void run() {
          updateTreeFromPath();
        }
      }, 300);
    }
  });
  myPathEditor.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0));
  northPanel.add(myPathEditor, BorderLayout.SOUTH);
}
项目:tools-idea    文件:Banner.java   
public void addAction(final Action action) {
  action.addPropertyChangeListener(this);
  final LinkLabel label = new LinkLabel(null, null, new LinkListener() {
    public void linkSelected(final LinkLabel aSource, final Object aLinkData) {
      action.actionPerformed(new ActionEvent(Banner.this, ActionEvent.ACTION_PERFORMED, Action.ACTION_COMMAND_KEY));
    }
  }) {
    @Override
    protected Color getTextColor() {
      return PlatformColors.BLUE;
    }
  };
  label.setFont(label.getFont().deriveFont(Font.BOLD));
  myActions.put(action, label);
  myActionsPanel.add(label);
  updateAction(action);
}
项目:tools-idea    文件:VcsUpdateInfoScopeFilterConfigurable.java   
@Nullable
@Override
public JComponent createComponent() {
  final JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
  panel.add(myCheckbox);
  panel.add(myComboBox);
  panel.add(Box.createHorizontalStrut(UIUtil.DEFAULT_HGAP));
  panel.add(new LinkLabel("Edit scopes", null, new LinkListener() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      final OptionsEditor optionsEditor = OptionsEditor.KEY.getData(DataManager.getInstance().getDataContext(panel));
      if (optionsEditor != null) {
        SearchableConfigurable configurable = optionsEditor.findConfigurableById(new ScopeChooserConfigurable(myProject).getId());
        if (configurable != null) {
          optionsEditor.select(configurable);
        }
      }
    }
  }));
  return panel;
}
项目:ali-idea-plugin    文件:RequirementsContent.java   
@Override
public JComponent create(final Project project) {
    JPanel requirementToolbar = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 2));
    LinkLabel gotoRequirement = new LinkLabel("", gotoIcon);
    requirementToolbar.add(gotoRequirement);
    final EntityContentPanel requirementPanel = new EntityContentPanel(project, "requirement", requirementToolbar);
    gotoRequirement.setListener(new LinkListener() {
        public void linkSelected(LinkLabel aSource, Object aLinkData) {
            HierarchicalChooser popupDialog = new HierarchicalChooser(project, "requirement", false, false, true, false, null);
            popupDialog.setVisible(true);
            String idStr = popupDialog.getSelectedValue();
            if(!idStr.isEmpty()) {
                requirementPanel.goTo(idStr);
            }
        }
    }, null);
    return requirementPanel;
}
项目:ali-idea-plugin    文件:PropertyGrid.java   
public ColumnControls(String col) {
    super(new GridLayout(1, 0, 5, 0));

    this.column = col;

    setBorder(new EmptyBorder(0, 0, 0, 5));

    moveDownLabel = new LinkLabel("", IconLoader.getIcon("/actions/sortDesc.png"), moveDown, col);
    add(moveDownLabel);
    moveUpLabel = new LinkLabel("", IconLoader.getIcon("/actions/sortAsc.png"), moveUp, col);
    add(moveUpLabel);
    deleteLabel = new LinkLabel("", IconLoader.getIcon("/modules/deleteContentFolder.png"), remove, col);
    add(deleteLabel);

    update();
}
项目:ali-idea-plugin    文件:EntityFilterPanel.java   
public ColumnPanel(final EntityFilterPanel parent, String entityType, String property, T value, LinkListener listener) {
    this.entityType = entityType;
    this.property = property;
    nameLabel = new FieldNameLabel(entityType, property, parent.project.getComponent(MetadataService.class)) {
        @Override
        public Color getForeground() {
            return parent.isEnabled() ? SystemColor.textText : SystemColor.textInactiveText;
        }
    };
    valueLabel = new JLabel() {
        @Override
        public Color getForeground() {
            return parent.isEnabled() ? SystemColor.textText : SystemColor.textInactiveText;
        }
    };
    setValue(value);

    setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));

    add(nameLabel);
    add(valueLabel);

    if(parent.quickRemove) {
        add(new LinkLabel("", IconLoader.getIcon("/actions/clean.png"), listener, this));
    }
}
项目:ali-idea-plugin    文件:EntityQueryPanel.java   
public EntityQueryPanel(final Project project, final EntityFilterModel<EntityQuery> model, final String entityType, final Set<String> hiddenFields, String delimiter, boolean showEmptyLabel, boolean showSection, boolean showIcon, boolean quickRemove) {
    super(project, model, entityType, delimiter, showEmptyLabel, showSection, quickRemove, false);

    crossLabel  = makeLabel("Cross-Filter:");
    crossLabel.setVisible(false);
    add(crossLabel);

    orderLabel = makeLabel("Order By:");
    orderLabel.setVisible(false);
    add(orderLabel);

    if(showIcon) {
        LinkLabel modifyFilterLink = new LinkLabel("", modifyFilterIcon, new LinkListener() {
            public void linkSelected(LinkLabel aSource, Object aLinkData) {
                EntityQuery updatedQuery = new EntityQueryDialog(project, entityType, model.getFilter(), "Filter:", hiddenFields).chooseQuery();
                if(updatedQuery != null) {
                    model.getFilter().copyFrom(updatedQuery);
                    model.fireFilterUpdated(true);
                }
            }
        });
        add(modifyFilterLink, 0);
    }

    loadMetadata();
}
项目:ali-idea-plugin    文件:WarningPanel.java   
public WarningPanel(JComponent comp, Color background, boolean canClose, boolean visible) {
    super(new FlowLayout(FlowLayout.LEFT, 2, 2));

    this.component = comp;

    comp.setBackground(Color.YELLOW);
    setBackground(Color.YELLOW);
    setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(2, 0, 2, 0, background), BorderFactory.createEtchedBorder()));
    add(new JLabel(IconLoader.getIcon("/general/balloonInformation.png")));
    add(comp);
    if(canClose) {
        LinkLabel warningCloseLink = new LinkLabel("", IconLoader.getIcon("/actions/closeNew.png"));
        warningCloseLink.setListener(new LinkListener() {
            @Override
            public void linkSelected(LinkLabel linkLabel, Object o) {
                setVisible(false);
            }
        }, null);
        add(warningCloseLink);
    }
    setVisible(visible);
}
项目:ali-idea-plugin    文件:MultiValueSelectorLabel.java   
@Override
public void linkSelected(LinkLabel aSource, Object aLinkData) {
    String values = StringUtils.join(selectedItems, ";");
    FilterChooser chooser = new MultipleItemsChooserFactory(project, title, true, new ItemsProvider.Loader<ComboItem>() {
        @Override
        public List<ComboItem> load() {
            return FilterManager.asItems(items, true, true);
        }
    }).createChooser(values);
    chooser.show();
    String selectedValue = chooser.getSelectedValue();
    if (selectedValue != null) {
        if (selectedValue.isEmpty()) {
            selectedItems = new HashSet<String>(items);
        } else {
            selectedItems = new HashSet<String>(Arrays.asList(selectedValue.split(";")));
        }
        linkLabel.setText(displayValue());
        fireChangeEvent(this);
    }
}
项目:Crucible4IDEA    文件:CommentNodeRenderer.java   
CommentRendererPanel() {
  super(new BorderLayout());
  setOpaque(false);

  myIconLabel = new JBLabel();
  myMessageLabel = new JBLabel();
  myMessageLabel.setOpaque(false);

  JPanel actionsPanel = new JPanel();
  myPostLink = new LinkLabel("Publish", null);
  actionsPanel.add(myPostLink);

  myMainPanel = new JPanel(new GridBagLayout());
  GridBag bag = new GridBag()
    .setDefaultInsets(UIUtil.DEFAULT_VGAP, UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP, UIUtil.DEFAULT_HGAP)
    .setDefaultPaddingY(UIUtil.DEFAULT_VGAP);
  myMainPanel.add(myIconLabel, bag.next().coverColumn().anchor(GridBagConstraints.NORTHWEST).weightx(0.1));
  myMainPanel.add(myMessageLabel, bag.next().fillCell().anchor(GridBagConstraints.NORTH).weightx(1.0));
  myMainPanel.add(myPostLink, bag.nextLine().anchor(GridBagConstraints.SOUTHEAST));

  add(myMainPanel);
}
项目:consulo    文件:Banner.java   
public void addAction(final Action action) {
  action.addPropertyChangeListener(this);
  final LinkLabel label = new LinkLabel(null, null, new LinkListener() {
    @Override
    public void linkSelected(final LinkLabel aSource, final Object aLinkData) {
      action.actionPerformed(new ActionEvent(Banner.this, ActionEvent.ACTION_PERFORMED, Action.ACTION_COMMAND_KEY));
    }
  }) {
    @Override
    protected Color getTextColor() {
      return PlatformColors.BLUE;
    }
  };
  label.setFont(label.getFont().deriveFont(Font.BOLD));
  myActions.put(action, label);
  myActionsPanel.add(label);
  updateAction(action);
}
项目:consulo    文件:PushLog.java   
private JComponent createStrategyPanel() {
  final JPanel labelPanel = new JPanel(new BorderLayout());
  labelPanel.setBackground(myTree.getBackground());
  final LinkLabel<String> linkLabel = new LinkLabel<>("Edit all targets", null);
  linkLabel.setBorder(new EmptyBorder(2, 2, 2, 2));
  linkLabel.setListener(new LinkListener<String>() {
    @Override
    public void linkSelected(LinkLabel aSource, String aLinkData) {
      if (linkLabel.isEnabled()) {
        startSyncEditing();
      }
    }
  }, null);
  myTree.addPropertyChangeListener(PushLogTreeUtil.EDIT_MODE_PROP, new PropertyChangeListener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      Boolean editMode = (Boolean)evt.getNewValue();
      linkLabel.setEnabled(!editMode);
      linkLabel.setPaintUnderline(!editMode);
      linkLabel.repaint();
    }
  });
  labelPanel.add(linkLabel, BorderLayout.EAST);
  return labelPanel;
}
项目:consulo    文件:VcsUpdateInfoScopeFilterConfigurable.java   
@Nullable
@Override
public JComponent createComponent() {
  final JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
  panel.add(myCheckbox);
  panel.add(myComboBox);
  panel.add(Box.createHorizontalStrut(UIUtil.DEFAULT_HGAP));
  panel.add(new LinkLabel("Edit scopes", null, new LinkListener() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      final OptionsEditor optionsEditor = DataManager.getInstance().getDataContext(panel).getData(OptionsEditor.KEY);
      if (optionsEditor != null) {
        SearchableConfigurable configurable = optionsEditor.findConfigurableById(new ScopeChooserConfigurable(myProject).getId());
        if (configurable != null) {
          optionsEditor.select(configurable);
        }
      }
    }
  }));
  return panel;
}
项目:intellij-ce-playground    文件:ConfigurationErrorsComponent.java   
private static void updateLabel(@NotNull final JLabel label, @NotNull final Color bgColor, @Nullable final LinkListener listener, @Nullable Object linkData) {
  label.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));
  label.setOpaque(true);
  label.setBackground(bgColor);
  if (label instanceof LinkLabel) {
    ((LinkLabel)label).setListener(listener, linkData);
  }
}
项目:intellij-ce-playground    文件:NewWelcomeScreen.java   
private static JPanel createFooterPanel() {
  JLabel versionLabel = new JLabel(ApplicationNamesInfo.getInstance().getFullProductName() +
                           " " +
                           ApplicationInfo.getInstance().getFullVersion() +
                           " Build " +
                           ApplicationInfo.getInstance().getBuild().asStringWithoutProductCode());
  makeSmallFont(versionLabel);
  versionLabel.setForeground(WelcomeScreenColors.FOOTER_FOREGROUND);

  JPanel footerPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
  footerPanel.setBackground(WelcomeScreenColors.FOOTER_BACKGROUND);
  footerPanel.setBorder(new EmptyBorder(2, 5, 2, 5) {
    @Override
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
      g.setColor(WelcomeScreenColors.BORDER_COLOR);
      g.drawLine(x, y, x + width, y);
    }
  });
  footerPanel.add(versionLabel);
  footerPanel.add(makeSmallFont(new JLabel(".  ")));
  footerPanel.add(makeSmallFont(new LinkLabel("Check", null, new LinkListener() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      UpdateChecker.updateAndShowResult(null, null);
    }
  })));
  footerPanel.add(makeSmallFont(new JLabel(" for updates now.")));
  return footerPanel;
}
项目:intellij-ce-playground    文件:InfoAndProgressPanel.java   
private void buildInProcessCount() {
  removeAll();
  setLayout(new BorderLayout());

  final JPanel progressCountPanel = new JPanel(new BorderLayout(0, 0));
  progressCountPanel.setOpaque(false);
  String processWord = myOriginals.size() == 1 ? " process" : " processes";
  final LinkLabel label = new LinkLabel(myOriginals.size() + processWord + " running...", null, new LinkListener() {
    @Override
    public void linkSelected(final LinkLabel aSource, final Object aLinkData) {
      triggerPopupShowing();
    }
  });

  if (SystemInfo.isMac) label.setFont(JBUI.Fonts.label(11));

  label.setOpaque(false);

  final Wrapper labelComp = new Wrapper(label);
  labelComp.setOpaque(false);
  progressCountPanel.add(labelComp, BorderLayout.CENTER);

  //myProgressIcon.setBorder(new IdeStatusBarImpl.MacStatusBarWidgetBorder());
  progressCountPanel.add(myProgressIcon, BorderLayout.WEST);

  add(myRefreshAndInfoPanel, BorderLayout.CENTER);

  progressCountPanel.setBorder(JBUI.Borders.emptyRight(4));
  add(progressCountPanel, BorderLayout.EAST);

  revalidate();
  repaint();
}
项目:intellij-ce-playground    文件:OptionsEditor.java   
/**
 * Returns default view for the specified configurable.
 * It uses the configurable identifier to retrieve description.
 *
 * @param searchable the configurable that does not have any view
 * @return default view for the specified configurable
 */
private JComponent createDefaultComponent(SearchableConfigurable searchable) {
  JPanel panel = new JPanel(new BorderLayout(0, 9));
  try {
    panel.add(BorderLayout.NORTH, new JLabel(getDefaultDescription(searchable)));
  }
  catch (AssertionError error) {
    return null; // description is not set
  }
  if (searchable instanceof Configurable.Composite) {
    JPanel box = new JPanel();
    box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS));
    panel.add(BorderLayout.CENTER, box);

    Configurable.Composite composite = (Configurable.Composite)searchable;
    for (final Configurable configurable : composite.getConfigurables()) {
      LinkLabel label = new LinkLabel(configurable.getDisplayName(), null) {
        @Override
        public void doClick() {
          select(configurable, null);
        }
      };
      label.setBorder(BorderFactory.createEmptyBorder(1, 17, 3, 1));
      box.add(label);
    }
  }
  return panel;
}
项目:intellij-ce-playground    文件:ConfigurableEditor.java   
private JComponent createDefaultContent(Configurable configurable) {
  JComponent content = new JPanel(new BorderLayout());
  content.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  String key = configurable == null ? null : ConfigurableVisitor.ByID.getID(configurable) + ".settings.description";
  String description = key == null ? null : getString(configurable, key);
  if (description == null) {
    description = "Select configuration element in the tree to edit its settings";
    content.add(BorderLayout.CENTER, new JLabel(description, SwingConstants.CENTER));
    content.setPreferredSize(JBUI.size(800, 600));
  }
  else {
    content.add(BorderLayout.NORTH, new JLabel(description));
    if (configurable instanceof Configurable.Composite) {
      Configurable.Composite composite = (Configurable.Composite)configurable;

      JPanel panel = new JPanel();
      panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
      content.add(BorderLayout.CENTER, panel);
      panel.add(Box.createVerticalStrut(10));
      for (final Configurable current : composite.getConfigurables()) {
        LinkLabel label = new LinkLabel(current.getDisplayName(), null) {
          @Override
          public void doClick() {
            openLink(current);
          }
        };
        label.setBorder(BorderFactory.createEmptyBorder(1, 17, 3, 1));
        panel.add(label);
      }
    }
  }
  return content;
}
项目:intellij-ce-playground    文件:CustomizePluginsStepPanel.java   
private LinkLabel createLink(String command, final TextProvider provider) {
  return new LinkLabel<String>("", null, this, command) {
    @Override
    public String getText() {
      return provider.getText();
    }
  };
}
项目:intellij-ce-playground    文件:CustomizePluginsStepPanel.java   
@Override
public void linkSelected(LinkLabel aSource, String command) {
  if (myGroup == null) return;
  boolean enable = "enable".equals(command);
  List<IdSet> idSets = myPluginGroups.getSets(myGroup);
  for (IdSet set : idSets) {
    myPluginGroups.setIdSetEnabled(set, enable);
  }
  CustomizePluginsStepPanel.this.repaint();
}
项目:intellij-ce-playground    文件:BreakpointEditor.java   
private void createUIComponents() {
  AnAction action = ActionManager.getInstance().getAction(XDebuggerActions.VIEW_BREAKPOINTS);
  String shortcutText = action != null ? KeymapUtil.getFirstKeyboardShortcutText(action) : null;
  String text = shortcutText != null ? "More (" + shortcutText + ")" : "More";
  myShowMoreOptionsLink = new LinkLabel(text, null, new LinkListener() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      if (myDelegate != null) {
        myDelegate.more();
      }
    }
  });
}
项目:intellij-ce-playground    文件:RegExHelpPopup.java   
@NotNull
public static LinkLabel createRegExLink(@NotNull String title, @Nullable final Component owner, @Nullable final Logger logger) {
  final Runnable action = createRegExLinkRunnable(owner, logger);
  return new LinkLabel<Object>(title, null, new LinkListener<Object>() {

    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      action.run();
    }
  });
}
项目:intellij-ce-playground    文件:ConfigurationErrorsPanel.java   
private static void updateLabel(@NotNull JLabel label,
                                @NotNull Color bgColor,
                                @Nullable LinkListener listener,
                                @Nullable Object linkData) {
  label.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));
  label.setOpaque(true);
  label.setBackground(bgColor);
  if (label instanceof LinkLabel) {
    //noinspection ConstantConditions
    ((LinkLabel)label).setListener(listener, linkData);
  }
}
项目:intellij-ce-playground    文件:GitCrlfDialog.java   
@Override
protected JComponent createCenterPanel() {
  JLabel description = new JBLabel(
    "<html>You are about to commit CRLF line separators to the Git repository.<br/>" +
    "It is recommended to set core.autocrlf Git attribute to <code>" + RECOMMENDED_VALUE +
    "</code> to avoid line separator issues.</html>");

  JLabel additionalDescription = new JBLabel(
    "<html>Fix and Commit: <code>git config --global core.autocrlf " + RECOMMENDED_VALUE + "</code> will be called,<br/>" +
    "Commit as Is: the config value won't be set.</html>", UIUtil.ComponentStyle.SMALL);

  JLabel readMore = new LinkLabel("Read more", null, new LinkListener() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      BrowserUtil.browse("https://help.github.com/articles/dealing-with-line-endings");
    }
  });

  JLabel icon = new JLabel(UIUtil.getWarningIcon(), SwingConstants.LEFT);
  myDontWarn = new JBCheckBox("Don't warn again");
  myDontWarn.setMnemonic('w');

  JPanel rootPanel = new JPanel(new GridBagLayout());
  GridBag g = new GridBag()
    .setDefaultInsets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP))
    .setDefaultAnchor(GridBagConstraints.LINE_START)
    .setDefaultFill(GridBagConstraints.HORIZONTAL);

  rootPanel.add(icon, g.nextLine().next().coverColumn(4));
  rootPanel.add(description, g.next());
  rootPanel.add(readMore, g.nextLine().next().next());
  rootPanel.add(additionalDescription, g.nextLine().next().next().pady(DEFAULT_HGAP));
  rootPanel.add(myDontWarn,  g.nextLine().next().next().insets(0, 0, 0, 0));

  return rootPanel;

}
项目:vso-intellij    文件:Hyperlink.java   
public Hyperlink() {
    super("Hyperlink", null);

    super.setListener(new LinkListener<Object>() {
        @Override
        public void linkSelected(final LinkLabel aSource, final Object aLinkData) {
            notifyActionListeners();
        }
    }, null);

    // Make our link focusable via the keyboard (Tab key)
    super.setFocusable(true);
}
项目:robovm-idea    文件:XcodeSetupDialog.java   
private void createUIComponents() {
    linkLabel = new LinkLabel("Visit the Apple iOS Developer Center", null, new LinkListener() {
        @Override
        public void linkSelected(LinkLabel aSource, Object aLinkData) {
            try {
                Desktop.getDesktop().browse(new URI("https://developer.apple.com/devcenter/ios/index.action"));
            } catch (URISyntaxException | IOException ex) {
                //It looks like there's a problem
            }
        }
    });
}
项目:translate-me    文件:ResultDialog.java   
@NotNull
private LinkLabel createLinkLabel() {

    final LinkLabel showMoreLink = new LinkLabel("Powered by Yandex.Translator", null);
    LinkListener showMoreListener = new LinkListener() {

        public void linkSelected(LinkLabel aSource, Object aLinkData) {
         BrowserUtil.browse("http://translate.yandex.com/");
        }
    };
    showMoreLink.setListener(showMoreListener, null);
    return showMoreLink;
}
项目:tools-idea    文件:ConfigurationErrorsComponent.java   
private static void updateLabel(@NotNull final JLabel label, @NotNull final Color bgColor, @Nullable final LinkListener listener, @Nullable Object linkData) {
  label.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));
  label.setOpaque(true);
  label.setBackground(bgColor);
  if (label instanceof LinkLabel) {
    ((LinkLabel)label).setListener(listener, linkData);
  }
}
项目:tools-idea    文件:NewWelcomeScreen.java   
private static JPanel createFooterPanel() {
  JLabel versionLabel = new JLabel(ApplicationNamesInfo.getInstance().getFullProductName() +
                           " " +
                           ApplicationInfo.getInstance().getFullVersion() +
                           " Build " +
                           ApplicationInfo.getInstance().getBuild().asStringWithoutProductCode());
  makeSmallFont(versionLabel);
  versionLabel.setForeground(WelcomeScreenColors.FOOTER_FOREGROUND);

  JPanel footerPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
  footerPanel.setBackground(WelcomeScreenColors.FOOTER_BACKGROUND);
  footerPanel.setBorder(new EmptyBorder(2, 5, 2, 5) {
    @Override
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
      g.setColor(WelcomeScreenColors.BORDER_COLOR);
      g.drawLine(x, y, x + width, y);
    }
  });
  footerPanel.add(versionLabel);
  footerPanel.add(makeSmallFont(new JLabel(".  ")));
  footerPanel.add(makeSmallFont(new LinkLabel("Check", null, new LinkListener() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      CheckForUpdateAction.actionPerformed(null, true, null, UpdateSettings.getInstance());
    }
  })));
  footerPanel.add(makeSmallFont(new JLabel(" for updates now.")));
  return footerPanel;
}
项目:tools-idea    文件:InfoAndProgressPanel.java   
private void buildInProcessCount() {
  removeAll();
  setLayout(new BorderLayout());

  final JPanel progressCountPanel = new JPanel(new BorderLayout(0, 0));
  progressCountPanel.setOpaque(false);
  String processWord = myOriginals.size() == 1 ? " process" : " processes";
  final LinkLabel label = new LinkLabel(myOriginals.size() + processWord + " running...", null, new LinkListener() {
    @Override
    public void linkSelected(final LinkLabel aSource, final Object aLinkData) {
      triggerPopupShowing();
    }
  });

  if (SystemInfo.isMac) label.setFont(UIUtil.getLabelFont().deriveFont(11.0f));

  label.setOpaque(false);

  final Wrapper labelComp = new Wrapper(label);
  labelComp.setOpaque(false);
  progressCountPanel.add(labelComp, BorderLayout.CENTER);

  //myProgressIcon.setBorder(new IdeStatusBarImpl.MacStatusBarWidgetBorder());
  progressCountPanel.add(myProgressIcon, BorderLayout.WEST);

  add(myRefreshAndInfoPanel, BorderLayout.CENTER);

  progressCountPanel.setBorder(new EmptyBorder(0, 0, 0, 4));
  add(progressCountPanel, BorderLayout.EAST);

  revalidate();
  repaint();
}
项目:tools-idea    文件:BreakpointEditor.java   
private void createUIComponents() {
  AnAction action = ActionManager.getInstance().getAction(XDebuggerActions.VIEW_BREAKPOINTS);
  String shortcutText = action != null ? KeymapUtil.getFirstKeyboardShortcutText(action) : null;
  String text = shortcutText != null ? "More (" + shortcutText + ")" : "More";
  myShowMoreOptionsLink = new LinkLabel(text, null, new LinkListener() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      if (myDelegate != null) {
        myDelegate.more();
      }
    }
  });
}
项目:tools-idea    文件:VcsDirectoryConfigurationPanel.java   
VcsRootErrorLabel(String title) {
  super(new BorderLayout(DEFAULT_HGAP, DEFAULT_VGAP));

  CompoundBorder outsideBorder =
    BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(5, 0, 5, 0, UIUtil.getPanelBackground()),
                                       BorderFactory.createLineBorder(UIUtil.getPanelBackground().darker()));
  setBorder(BorderFactory.createCompoundBorder(outsideBorder, BorderFactory.createEmptyBorder(DEFAULT_VGAP, DEFAULT_HGAP,
                                                                                              DEFAULT_VGAP, DEFAULT_HGAP)));
  setOpaque(true);
  setBackground(new Color(255, 186, 192));

  JBLabel label = new JBLabel(title);
  if( UIUtil.isUnderDarcula()) {
    label.setForeground(UIUtil.getPanelBackground());
  }

  myAddLabel = new LinkLabel("Add root", null);

  myAddLabel.setOpaque(false);

  JPanel actionsPanel = new JPanel(new BorderLayout(DEFAULT_HGAP, DEFAULT_VGAP));
  actionsPanel.setOpaque(false);
  actionsPanel.add(myAddLabel, BorderLayout.CENTER);

  add(label, BorderLayout.CENTER);
  add(actionsPanel, BorderLayout.EAST);
}