use of com.intellij.util.ui.update.UiNotifyConnector in project intellij-community by JetBrains.
the class ActionToolbarImpl method updateWhenFirstShown.
private static void updateWhenFirstShown(JComponent targetComponent, final ToolbarReference ref) {
Activatable activatable = new Activatable.Adapter() {
public void showNotify() {
ActionToolbarImpl toolbar = ref.get();
if (toolbar != null) {
toolbar.myUpdater.updateActions(false, false);
}
}
};
ref.myDisposable = new UiNotifyConnector(targetComponent, activatable) {
@Override
protected void showNotify() {
super.showNotify();
ref.disposeReference();
}
};
}
use of com.intellij.util.ui.update.UiNotifyConnector in project intellij-community by JetBrains.
the class SelectLocationStep method createComponent.
protected JComponent createComponent() {
final JPanel panel = new MyPanel();
final JPanel toolbarPanel = new JPanel(new GridBagLayout());
final GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = 0;
constraints.gridy = 0;
toolbarPanel.add(myFileSystemToolBar.getComponent(), constraints);
constraints.gridx = 1;
constraints.weightx = 1.0;
constraints.anchor = GridBagConstraints.EAST;
toolbarPanel.add(myTextFieldAction, constraints);
myNorthPanel.add(toolbarPanel, BorderLayout.NORTH);
panel.add(myNorthPanel, BorderLayout.NORTH);
panel.add(ScrollPaneFactory.createScrollPane(myFileSystemTree.getTree()), BorderLayout.CENTER);
JLabel dndLabel = new JLabel(FileChooserDialogImpl.DRAG_N_DROP_HINT, SwingConstants.CENTER);
dndLabel.setFont(JBUI.Fonts.miniFont());
dndLabel.setForeground(UIUtil.getLabelDisabledForeground());
panel.add(dndLabel, BorderLayout.SOUTH);
myUiUpdater = new MergingUpdateQueue("FileChooserUpdater", 200, false, panel);
Disposer.register(myFileSystemTree, myUiUpdater);
new UiNotifyConnector(panel, myUiUpdater);
updateTextFieldShowing();
return panel;
}
use of com.intellij.util.ui.update.UiNotifyConnector 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