com.intellij.ui.components.labels.LinkLabel Java Examples
The following examples show how to use
com.intellij.ui.components.labels.LinkLabel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VcsUpdateInfoScopeFilterConfigurable.java From consulo with Apache License 2.0 | 6 votes |
@javax.annotation.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; }
Example #2
Source File: PushLog.java From consulo with Apache License 2.0 | 6 votes |
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; }
Example #3
Source File: CommentNodeRenderer.java From Crucible4IDEA with MIT License | 6 votes |
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); }
Example #4
Source File: WidgetPerfTipsPanel.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void showPerfTips(@NotNull ArrayList<PerfTip> tips) { perfTips.removeAll(); currentTips.clear(); currentTips.addAll(tips); for (PerfTip tip : tips) { final LinkLabel<PerfTip> label = new LinkLabel<>( "<html><body><a>" + tip.getMessage() + "</a><body></html>", tip.getRule().getIcon(), linkListener, tip ); label.setPaintUnderline(false); label.setBorder(JBUI.Borders.empty(0, 5, 5, 5)); perfTips.add(label); } add(perfTips); setVisible(hasPerfTips()); }
Example #5
Source File: WidgetPerfTipsPanel.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void showPerfTips(@NotNull ArrayList<PerfTip> tips) { perfTips.removeAll(); currentTips.clear(); currentTips.addAll(tips); for (PerfTip tip : tips) { final LinkLabel<PerfTip> label = new LinkLabel<>( "<html><body><a>" + tip.getMessage() + "</a><body></html>", tip.getRule().getIcon(), linkListener, tip ); label.setPaintUnderline(false); label.setBorder(JBUI.Borders.empty(0, 5, 5, 5)); perfTips.add(label); } add(perfTips); setVisible(hasPerfTips()); }
Example #6
Source File: TreeMouseAdapter.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 6 votes |
@Override public void mouseClicked(MouseEvent e) { Tree tree = (Tree) e.getComponent(); TreePath pathForLocation = tree.getPathForLocation(e.getX(), e.getY()); if (SwingUtilities.isLeftMouseButton(e)) { Optional.ofNullable(pathForLocation) .flatMap(p -> cast(p.getLastPathComponent(), PatchedDefaultMutableTreeNode.class)) .flatMap(n -> cast(n.getUserObject(), LinkLabel.class)) .ifPresent(LinkLabel::doClick); } else if (SwingUtilities.isRightMouseButton(e)) { DataContext dataContext = DataManager.getInstance().getDataContext(tree); contextMenuService.getContextMenu(pathForLocation) .ifPresent(dto -> dto.showPopup(dataContext)); } }
Example #7
Source File: PropertyTreeCellRenderer.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 6 votes |
@Override public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { Object userObject = ((DefaultMutableTreeNode) value).getUserObject(); if (userObject instanceof TreeNodeModelApi) { TreeNodeModelApi model = (TreeNodeModelApi) userObject; append(model.getText().orElse("") + ": ", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES, true); if (model.getDescription().isPresent()) { append(model.getDescription().get(), SimpleTextAttributes.GRAYED_SMALL_ATTRIBUTES); } else { if (model.getValue().isPresent()) { append(model.getValue().get().toString()); } } } else if (userObject instanceof LinkLabel) { String text = ((LinkLabel) userObject).getText(); append(text, SimpleTextAttributes.LINK_ATTRIBUTES); } else if (userObject != null) { append(userObject.toString()); } }
Example #8
Source File: AnalyzeSizeToolWindowTest.java From size-analyzer with Apache License 2.0 | 5 votes |
@Test public void selectingCategoryNodeChangesCategoryPanel() { JPanel toolPanel = toolWindow.getContent(); Component[] components = toolPanel.getComponents(); OnePixelSplitter splitter = (OnePixelSplitter) components[0]; JBScrollPane leftPane = (JBScrollPane) splitter.getFirstComponent(); JViewport leftView = leftPane.getViewport(); Tree suggestionTree = (Tree) leftView.getView(); assertThat(suggestionTree.getSelectionCount()).isEqualTo(0); TreePath webPPath = getTreePathWithString(suggestionTree, webPCategoryData.toString()); suggestionTree.addSelectionPath(webPPath); JPanel rightPane = (JPanel) splitter.getSecondComponent(); assertThat(suggestionTree.getSelectionCount()).isEqualTo(1); for (Component component : rightPane.getComponents()) { if (component instanceof SimpleColoredComponent) { assertThat(component.toString()).contains(webPCategoryData.toString()); assertThat(component.toString()).contains("Estimated savings: 29.30 KB"); } else if (component instanceof JPanel) { Component[] suggestionPanelComponents = ((JPanel) component).getComponents(); assertThat(suggestionPanelComponents).hasLength(1); for (Component linkLabel : suggestionPanelComponents) { assertThat(((LinkLabel<?>) linkLabel).getText()).isEqualTo(SuggestionDataFactory.issueTypeNodeNames.get(IssueType.WEBP)); } } } }
Example #9
Source File: RegExHelpPopup.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static LinkLabel createRegExLink(@Nonnull String title, @Nullable final Component owner, @Nullable final Logger logger) { return new LinkLabel(title, null, new LinkListener() { JBPopup helpPopup; @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { try { if (helpPopup != null && !helpPopup.isDisposed() && helpPopup.isVisible()) { return; } helpPopup = createRegExHelpPopup(); Disposer.register(helpPopup, new Disposable() { @Override public void dispose() { destroyPopup(); } }); helpPopup.showInCenterOf(owner); } catch (BadLocationException e) { if (logger != null) logger.info(e); } } private void destroyPopup() { helpPopup = null; } }); }
Example #10
Source File: BreakpointEditor.java From consulo with Apache License 2.0 | 5 votes |
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(); } } }); }
Example #11
Source File: InfoAndProgressPanel.java From consulo with Apache License 2.0 | 5 votes |
private void buildInProcessCount() { removeAll(); setLayout(new BorderLayout()); final JPanel progressCountPanel = new JPanel(new BorderLayout(0, 0)); progressCountPanel.setOpaque(false); myMultiProcessLink = new LinkLabel<>(getMultiProgressLinkText(), null, (aSource, aLinkData) -> triggerPopupShowing()); if (SystemInfo.isMac) myMultiProcessLink.setFont(JBUI.Fonts.label(11)); myMultiProcessLink.setOpaque(false); Wrapper labelComp = new Wrapper(myMultiProcessLink); labelComp.setOpaque(false); progressCountPanel.add(labelComp, BorderLayout.CENTER); //myProgressIcon.setBorder(new IdeStatusBarImpl.MacStatusBarWidgetBorder()); progressCountPanel.add(myProgressIcon.getValue(), BorderLayout.WEST); add(myRefreshAndInfoPanel, BorderLayout.CENTER); progressCountPanel.setBorder(JBUI.Borders.emptyRight(4)); add(progressCountPanel, BorderLayout.EAST); revalidate(); repaint(); }
Example #12
Source File: HelpTooltip.java From consulo with Apache License 2.0 | 5 votes |
/** * Enables link in the tooltip below description and sets action for it. * * @param linkText text to show in the link. * @param linkAction action to execute when link is clicked. * @return {@code this} */ public HelpTooltip setLink(String linkText, Runnable linkAction) { link = LinkLabel.create(linkText, () -> { hidePopup(true); linkAction.run(); }); return this; }
Example #13
Source File: Banner.java From consulo with Apache License 2.0 | 5 votes |
public void addAction(final Action action) { action.addPropertyChangeListener(this); final LinkLabel label = new LinkLabel(null, null, (LinkListener)(aSource, aLinkData) -> action.actionPerformed(new ActionEvent(Banner.this, ActionEvent.ACTION_PERFORMED, Action.ACTION_COMMAND_KEY))) { @Override protected Color getTextColor() { return JBColor.BLUE; } }; label.setFont(label.getFont().deriveFont(Font.BOLD)); myActions.put(action, label); myActionsPanel.add(label); updateAction(action); }
Example #14
Source File: PantsProjectSettingsControl.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@Override protected void fillExtraControls(@NotNull PaintAwarePanel content, int indentLevel) { PantsProjectSettings initialSettings = getInitialSettings(); myLibsWithSourcesCheckBox.setSelected(initialSettings.libsWithSources); myEnableIncrementalImportCheckBox.setSelected(initialSettings.incrementalImportEnabled); myImportDepthSpinner.setValue(initialSettings.incrementalImportDepth); myUseIdeaProjectJdkCheckBox.setSelected(initialSettings.useIdeaProjectJdk); myImportSourceDepsAsJarsCheckBox.setSelected(initialSettings.importSourceDepsAsJars); myUseIntellijCompilerCheckBox.setSelected(initialSettings.useIntellijCompiler); LinkLabel<?> intellijCompilerHelpMessage = LinkLabel.create( PantsBundle.message("pants.settings.text.use.intellij.compiler.help.messasge"), () -> BrowserUtil.browse(PantsBundle.message("pants.settings.text.use.intellij.compiler.help.messasge.link")) ); myTargetSpecsBox.setItems(initialSettings.getAllAvailableTargetSpecs(), x -> x); initialSettings.getSelectedTargetSpecs().forEach(spec -> myTargetSpecsBox.setItemSelected(spec, true)); insertNameFieldBeforeProjectPath(content); List<JComponent> boxes = ContainerUtil.newArrayList( myLibsWithSourcesCheckBox, myEnableIncrementalImportCheckBox, myImportDepthPanel, myUseIdeaProjectJdkCheckBox, myImportSourceDepsAsJarsCheckBox, myUseIntellijCompilerCheckBox, intellijCompilerHelpMessage, new JBLabel(PantsBundle.message("pants.settings.text.targets")), new JBScrollPane(myTargetSpecsBox) ); GridBag lineConstraints = ExternalSystemUiUtil.getFillLineConstraints(indentLevel); for (JComponent component : boxes) { content.add(component, lineConstraints); } }
Example #15
Source File: XcodeSetupDialog.java From robovm-idea with GNU General Public License v2.0 | 5 votes |
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 } } }); }
Example #16
Source File: AnalyzeSizeToolWindow.java From size-analyzer with Apache License 2.0 | 5 votes |
private void showCategoryInCategoryPanelFor(DefaultMutableTreeNode categoryNode) { CategoryData category = (CategoryData) categoryNode.getUserObject(); categoryTitle.clear(); categoryTitle.append(category.toString(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES); if (category.totalSizeSaved() != null) { categoryTitle.append( " Estimated savings: " + category.totalSizeSaved(), SimpleTextAttributes.GRAYED_ATTRIBUTES); } categoryTitle.setMaximumSize(categoryTitle.getPreferredSize()); suggestionsPanel.removeAll(); for (Enumeration<?> nodeEnumeration = categoryNode.children(); nodeEnumeration.hasMoreElements(); ) { Object nodeValue = nodeEnumeration.nextElement(); if (nodeValue instanceof DefaultMutableTreeNode) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) nodeValue; String linkTitle = extractLinkTitle(node); suggestionsPanel.add( new LinkLabel<>( linkTitle, null, new LinkListener<Object>() { @Override @SuppressWarnings("rawtypes") // Declaration uses raw type, needed for override. public void linkSelected(LinkLabel source, Object linkData) { suggestionTree.clearSelection(); TreePath selectedNode = new TreePath(((DefaultMutableTreeNode) linkData).getPath()); suggestionTree.addSelectionPath(selectedNode); suggestionTree.scrollPathToVisible(selectedNode); } }, node)); } } }
Example #17
Source File: CsvTableEditorActionListeners.java From intellij-csv-validator with Apache License 2.0 | 5 votes |
@Override public void linkSelected(LinkLabel linkLabel, Object o) { if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); if (desktop.isSupported(Desktop.Action.BROWSE)) { try { desktop.browse(URI.create("https://github.com/SeeSharpSoft/intellij-csv-validator")); } catch (IOException e) { e.printStackTrace(); } } } }
Example #18
Source File: Hyperlink.java From azure-devops-intellij with MIT License | 5 votes |
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); }
Example #19
Source File: FlutterProjectStep.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public LinkLabel getInstallActionLink() { return myInstallActionLink; }
Example #20
Source File: FileChooserDialogImpl.java From consulo with Apache License 2.0 | 4 votes |
protected JComponent createCenterPanel() { JPanel panel = new MyPanel(); myUiUpdater = new MergingUpdateQueue("FileChooserUpdater", 200, false, panel); Disposer.register(myDisposable, myUiUpdater); new UiNotifyConnector(panel, myUiUpdater); panel.setBorder(JBUI.Borders.empty()); createTree(); final DefaultActionGroup group = createActionGroup(); ActionToolbar toolBar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true); toolBar.setTargetComponent(panel); final JPanel toolbarPanel = new JPanel(new BorderLayout()); toolbarPanel.add(toolBar.getComponent(), BorderLayout.CENTER); myTextFieldAction = new TextFieldAction() { public void linkSelected(final LinkLabel aSource, final Object aLinkData) { toggleShowTextField(); } }; toolbarPanel.add(myTextFieldAction, BorderLayout.EAST); JPanel extraToolbarPanel = createExtraToolbarPanel(); if (extraToolbarPanel != null) { toolbarPanel.add(extraToolbarPanel, BorderLayout.SOUTH); } myPathTextFieldWrapper = new JPanel(new BorderLayout()); myPathTextFieldWrapper.setBorder(JBUI.Borders.emptyBottom(2)); myPathTextField = new FileTextFieldImpl.Vfs(FileChooserFactoryImpl.getMacroMap(), getDisposable(), new LocalFsFinder.FileChooserFilter(myChooserDescriptor, myFileSystemTree)) { @Override protected void onTextChanged(final String newValue) { myUiUpdater.cancelAllUpdates(); updateTreeFromPath(newValue); } }; consulo.disposer.Disposer.register(myDisposable, myPathTextField); myPathTextFieldWrapper.add(myPathTextField.getField(), BorderLayout.CENTER); if (getRecentFiles().length > 0) { myPathTextFieldWrapper.add(createHistoryButton(), BorderLayout.EAST); } myNorthPanel = new JPanel(new BorderLayout()); myNorthPanel.add(toolbarPanel, BorderLayout.NORTH); updateTextFieldShowing(); panel.add(myNorthPanel, BorderLayout.NORTH); registerMouseListener(group); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myFileSystemTree.getTree()); //scrollPane.setBorder(BorderFactory.createLineBorder(new Color(148, 154, 156))); panel.add(scrollPane, BorderLayout.CENTER); panel.setPreferredSize(JBUI.size(400)); JLabel hintLabel = new JLabel(DRAG_N_DROP_HINT, SwingConstants.CENTER); hintLabel.setForeground(JBColor.gray); hintLabel.setFont(JBUI.Fonts.smallFont()); panel.add(hintLabel, BorderLayout.SOUTH); ApplicationManager.getApplication().getMessageBus().connect(getDisposable()).subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener() { @Override public void applicationActivated(IdeFrame ideFrame) { ((DesktopSaveAndSyncHandlerImpl)SaveAndSyncHandler.getInstance()).maybeRefresh(ModalityState.current()); } }); return panel; }
Example #21
Source File: BreadcrumbsConfigurable.java From consulo with Apache License 2.0 | 4 votes |
@Override public JComponent createComponent() { if (component == null) { for (final BreadcrumbsProviderConfigurable configurable : getConfigurables()) { final String id = configurable.getId(); if (!map.containsKey(id)) { map.put(id, configurable.createComponent()); } } JPanel boxes = new JPanel(new GridLayout(0, 3, UIUtil.isUnderDarcula() ? JBUIScale.scale(10) : 0, 0)); map.values().stream().sorted((box1, box2) -> naturalCompare(box1.getText(), box2.getText())).forEach(box -> boxes.add(box)); show = new JCheckBox(message("checkbox.show.breadcrumbs")); show.addItemListener(event -> updateEnabled()); above = new JRadioButton(message("radio.show.breadcrumbs.above")); below = new JRadioButton(message("radio.show.breadcrumbs.below")); ButtonGroup group = new ButtonGroup(); group.add(above); group.add(below); placement = new JLabel(message("label.breadcrumbs.placement")); JPanel placementPanel = new JPanel(new HorizontalLayout(JBUIScale.scale(UIUtil.DEFAULT_HGAP))); placementPanel.setBorder(JBUI.Borders.emptyLeft(24)); placementPanel.add(placement); placementPanel.add(above); placementPanel.add(below); languages = new JLabel(message("label.breadcrumbs.languages")); JPanel languagesPanel = new JPanel(new VerticalLayout(JBUIScale.scale(6))); languagesPanel.setBorder(JBUI.Borders.empty(0, 24, 12, 0)); languagesPanel.add(languages); languagesPanel.add(boxes); component = new JPanel(new VerticalLayout(JBUIScale.scale(12), LEFT)); component.add(show); component.add(placementPanel); component.add(languagesPanel); component.add(LinkLabel.create(message("configure.breadcrumbs.colors"), () -> { DataContext context = DataManager.getInstance().getDataContext(component); selectOrEditColor(context, "Breadcrumbs//Current", GeneralColorsPage.class); })); } return component; }
Example #22
Source File: TodoCheckinHandler.java From consulo with Apache License 2.0 | 4 votes |
@Override public RefreshableOnComponent getBeforeCheckinConfigurationPanel() { JCheckBox checkBox = new JCheckBox(VcsBundle.message("before.checkin.new.todo.check", "")); return new RefreshableOnComponent() { @Override public JComponent getComponent() { JPanel panel = new JPanel(new BorderLayout(4, 0)); panel.add(checkBox, BorderLayout.WEST); setFilterText(myConfiguration.myTodoPanelSettings.todoFilterName); if (myConfiguration.myTodoPanelSettings.todoFilterName != null) { myTodoFilter = TodoConfiguration.getInstance().getTodoFilter(myConfiguration.myTodoPanelSettings.todoFilterName); } Consumer<TodoFilter> consumer = todoFilter -> { myTodoFilter = todoFilter; String name = todoFilter == null ? null : todoFilter.getName(); myConfiguration.myTodoPanelSettings.todoFilterName = name; setFilterText(name); }; LinkLabel linkLabel = new LinkLabel("Configure", null); linkLabel.setListener(new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { DefaultActionGroup group = SetTodoFilterAction.createPopupActionGroup(myProject, myConfiguration.myTodoPanelSettings, consumer); ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.TODO_VIEW_TOOLBAR, group); popupMenu.getComponent().show(linkLabel, 0, linkLabel.getHeight()); } }, null); panel.add(linkLabel, BorderLayout.CENTER); CheckinHandlerUtil.disableWhenDumb(myProject, checkBox, "TODO check is impossible until indices are up-to-date"); return panel; } private void setFilterText(String filterName) { if (filterName == null) { checkBox.setText(VcsBundle.message("before.checkin.new.todo.check", IdeBundle.message("action.todo.show.all"))); } else { checkBox.setText(VcsBundle.message("before.checkin.new.todo.check", "Filter: " + filterName)); } } @Override public void refresh() { } @Override public void saveState() { myConfiguration.CHECK_NEW_TODO = checkBox.isSelected(); } @Override public void restoreState() { checkBox.setSelected(myConfiguration.CHECK_NEW_TODO); } }; }
Example #23
Source File: CsvTableEditorSwing.java From intellij-csv-validator with Apache License 2.0 | 4 votes |
protected void createUIComponents() { tblEditor = new JBTable(new DefaultTableModel(0, 0)); lnkTextEditor = new LinkLabel("Open file in text editor", null); }
Example #24
Source File: CsvTableEditorActionListeners.java From intellij-csv-validator with Apache License 2.0 | 4 votes |
@Override public void linkSelected(LinkLabel linkLabel, Object o) { FileEditorManager.getInstance(csvTableEditor.getProject()).openTextEditor(new OpenFileDescriptor(csvTableEditor.getProject(), csvTableEditor.getFile()), true); // this line is for legacy reasons (https://youtrack.jetbrains.com/issue/IDEA-199790) FileEditorManager.getInstance(csvTableEditor.getProject()).setSelectedEditor(csvTableEditor.getFile(), CsvFileEditorProvider.EDITOR_TYPE_ID); }
Example #25
Source File: NotificationsManagerImpl.java From consulo with Apache License 2.0 | 4 votes |
private static void showPopup(@Nonnull LinkLabel link, @Nonnull DefaultActionGroup group) { ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group); menu.getComponent().show(link, JBUI.scale(-10), link.getHeight() + JBUI.scale(2)); }
Example #26
Source File: FlutterProjectStep.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public LinkLabel getInstallActionLink() { return myInstallActionLink; }
Example #27
Source File: Banner.java From consulo with Apache License 2.0 | 4 votes |
void updateAction(Action action) { final LinkLabel label = myActions.get(action); label.setVisible(action.isEnabled()); label.setText((String)action.getValue(Action.NAME)); label.setToolTipText((String)action.getValue(Action.SHORT_DESCRIPTION)); }
Example #28
Source File: FlutterGeneratorPeer.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public LinkLabel getInstallActionLink() { return myInstallActionLink; }
Example #29
Source File: OuterIgnoreWrapper.java From idea-gitignore with MIT License | 4 votes |
/** Constructor. */ @SuppressWarnings("unchecked") public OuterIgnoreWrapper(@NotNull final Project project, @NotNull final IgnoreLanguage language, @NotNull final List<VirtualFile> outerFiles) { this.outerFiles = outerFiles; settings = IgnoreSettings.getInstance(); panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 5, 10)); northPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 5)); JBLabel label = new JBLabel( IgnoreBundle.message("outer.label"), UIUtil.ComponentStyle.REGULAR, UIUtil.FontColor.BRIGHTER ); label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); northPanel.add(label); tabbedPanel = new TabbedPaneWrapper(project); messageBus = project.getMessageBus().connect(); messageBus.subscribe(UISettingsListener.TOPIC, uiSettings -> updateTabbedPanelPolicy()); updateTabbedPanelPolicy(); linkLabel = new LinkLabel( outerFiles.get(0).getPath(), null, (aSource, aLinkData) -> Utils.openFile(project, outerFiles.get(tabbedPanel.getSelectedIndex())) ); final VirtualFile userHomeDir = VfsUtil.getUserHomeDir(); for (final VirtualFile outerFile : outerFiles) { Document document = FileDocumentManager.getInstance().getDocument(outerFile); Editor outerEditor = document != null ? Utils.createPreviewEditor(document, null, true) : null; if (outerEditor != null) { final JScrollPane scrollPanel = ScrollPaneFactory.createScrollPane(outerEditor.getComponent()); scrollPanel.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); scrollPanel.setPreferredSize(new Dimension(0, settings.getOuterIgnoreWrapperHeight())); String path = outerFile.getPath(); if (userHomeDir != null) { path = path.replace(userHomeDir.getPath(), "~"); } Icon icon = ((language instanceof GitLanguage) || (language instanceof GitExcludeLanguage)) ? AllIcons.Vcs.Ignore_file : language.getIcon(); tabbedPanel.addTab(path, icon, scrollPanel, outerFile.getCanonicalPath()); outerEditors.add(outerEditor); } } northPanel.addMouseListener(this); northPanel.addMouseMotionListener(this); tabbedPanel.addChangeListener(this); panel.add(northPanel, BorderLayout.NORTH); panel.add(tabbedPanel.getComponent(), BorderLayout.CENTER); panel.add(linkLabel, BorderLayout.SOUTH); }
Example #30
Source File: FlutterGeneratorPeer.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public LinkLabel getInstallActionLink() { return myInstallActionLink; }