Search in sources :

Example 1 with HoverHyperlinkLabel

use of com.intellij.ui.HoverHyperlinkLabel in project intellij-community by JetBrains.

the class ContentRootPanel method createFolderComponent.

private <P extends JpsElement> JComponent createFolderComponent(final ContentFolder folder, Color foreground, ModuleSourceRootEditHandler<P> editor) {
    final VirtualFile folderFile = folder.getFile();
    final VirtualFile contentEntryFile = getContentEntry().getFile();
    final String properties = folder instanceof SourceFolder ? StringUtil.notNullize(editor.getPropertiesString((P) ((SourceFolder) folder).getJpsElement().getProperties())) : "";
    if (folderFile != null && contentEntryFile != null) {
        String path = folderFile.equals(contentEntryFile) ? "." : VfsUtilCore.getRelativePath(folderFile, contentEntryFile, File.separatorChar);
        HoverHyperlinkLabel hyperlinkLabel = new HoverHyperlinkLabel(path + properties, foreground);
        hyperlinkLabel.setMinimumSize(new Dimension(0, 0));
        hyperlinkLabel.addHyperlinkListener(new HyperlinkListener() {

            @Override
            public void hyperlinkUpdate(HyperlinkEvent e) {
                myCallback.navigateFolder(getContentEntry(), folder);
            }
        });
        registerTextComponent(hyperlinkLabel, foreground);
        return new UnderlinedPathLabel(hyperlinkLabel);
    } else {
        String path = toRelativeDisplayPath(folder.getUrl(), getContentEntry().getUrl());
        final JLabel pathLabel = new JLabel(path + properties);
        pathLabel.setOpaque(false);
        pathLabel.setForeground(JBColor.RED);
        return new UnderlinedPathLabel(pathLabel);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) SourceFolder(com.intellij.openapi.roots.SourceFolder) HoverHyperlinkLabel(com.intellij.ui.HoverHyperlinkLabel) HyperlinkEvent(javax.swing.event.HyperlinkEvent) HyperlinkListener(javax.swing.event.HyperlinkListener)

Example 2 with HoverHyperlinkLabel

use of com.intellij.ui.HoverHyperlinkLabel in project intellij-plugins by JetBrains.

the class DartProblemsFilterForm method createUIComponents.

private void createUIComponents() {
    myResetFilterHyperlink = new HoverHyperlinkLabel(DartBundle.message("reset.filter"));
    myResetFilterHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        protected void hyperlinkActivated(final HyperlinkEvent e) {
            myListeners.forEach(FilterListener::filtersResetRequested);
        }
    });
}
Also used : HoverHyperlinkLabel(com.intellij.ui.HoverHyperlinkLabel) HyperlinkEvent(javax.swing.event.HyperlinkEvent) HyperlinkAdapter(com.intellij.ui.HyperlinkAdapter)

Example 3 with HoverHyperlinkLabel

use of com.intellij.ui.HoverHyperlinkLabel in project intellij-community by JetBrains.

the class ValidatingTableEditor method createUIComponents.

private void createUIComponents() {
    myTable = new ChangesTrackingTableView<Item>() {

        protected void onCellValueChanged(int row, int column, Object value) {
            final Item original = getItems().get(row);
            Item override = cloneOf(original);
            final ColumnInfo<Item, Object> columnInfo = getTableModel().getColumnInfos()[column];
            columnInfo.setValue(override, value);
            updateMessage(row, override);
        }

        @Override
        protected void onEditingStopped() {
            updateMessage(-1, null);
        }
    };
    myFixLink = new HoverHyperlinkLabel(null);
}
Also used : HoverHyperlinkLabel(com.intellij.ui.HoverHyperlinkLabel)

Aggregations

HoverHyperlinkLabel (com.intellij.ui.HoverHyperlinkLabel)3 HyperlinkEvent (javax.swing.event.HyperlinkEvent)2 SourceFolder (com.intellij.openapi.roots.SourceFolder)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 HyperlinkAdapter (com.intellij.ui.HyperlinkAdapter)1 HyperlinkListener (javax.swing.event.HyperlinkListener)1