use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.
the class PushLog method createStrategyPanel.
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;
}
use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.
the class Banner method updateAction.
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));
}
use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.
the class TodoCheckinHandler method getBeforeCheckinConfigurationPanel.
@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);
}
};
}
use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.
the class FileChooserDialogImpl method createCenterPanel.
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)) {
protected void onTextChanged(final String newValue) {
myUiUpdater.cancelAllUpdates();
updateTreeFromPath(newValue);
}
};
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 dndLabel = new JLabel(DRAG_N_DROP_HINT, SwingConstants.CENTER);
dndLabel.setFont(JBUI.Fonts.miniFont());
dndLabel.setForeground(UIUtil.getLabelDisabledForeground());
panel.add(dndLabel, BorderLayout.SOUTH);
ApplicationManager.getApplication().getMessageBus().connect(getDisposable()).subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener.Adapter() {
@Override
public void applicationActivated(IdeFrame ideFrame) {
((SaveAndSyncHandlerImpl) SaveAndSyncHandler.getInstance()).maybeRefresh(ModalityState.current());
}
});
return panel;
}
Aggregations