use of com.intellij.ui.ToolbarDecorator in project azure-tools-for-java by Microsoft.
the class SettingPanel method createUIComponents.
private void createUIComponents() {
containerSettingPanel = new ContainerSettingPanel(project);
// create table of Web App on Linux
final DefaultTableModel tableModel = new DefaultTableModel() {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
tableModel.addColumn(TABLE_HEAD_WEB_APP_NAME);
tableModel.addColumn(TABLE_HEAD_RESOURCE_GROUP);
webAppTable = new JBTable(tableModel);
webAppTable.getEmptyText().setText(TABLE_LOADING_MESSAGE);
webAppTable.setRowSelectionAllowed(true);
webAppTable.setDragEnabled(false);
webAppTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
webAppTable.getSelectionModel().addListSelectionListener(event -> {
final int index = webAppTable.getSelectedRow();
if (cachedWebAppList != null && index >= 0 && index < cachedWebAppList.size()) {
textSelectedAppName.setText(cachedWebAppList.get(webAppTable.getSelectedRow()).name());
}
});
btnRefresh = new AnActionButton("Refresh", AllIcons.Actions.Refresh) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
btnRefresh.setEnabled(false);
webAppTable.getEmptyText().setText(TABLE_LOADING_MESSAGE);
final DefaultTableModel model = (DefaultTableModel) webAppTable.getModel();
model.getDataVector().clear();
model.fireTableDataChanged();
textSelectedAppName.setText("");
webAppOnLinuxDeployPresenter.onRefreshList();
}
};
final ToolbarDecorator tableToolbarDecorator = ToolbarDecorator.createDecorator(webAppTable).addExtraActions(btnRefresh).setToolbarPosition(ActionToolbarPosition.TOP);
pnlWebAppOnLinuxTable = tableToolbarDecorator.createPanel();
}
use of com.intellij.ui.ToolbarDecorator in project azure-tools-for-java by Microsoft.
the class ContainerRegistryPropertyView method createUIComponents.
private void createUIComponents() {
DefaultTableModel repoModel = new DefaultTableModel() {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
repoModel.addColumn(REPOSITORY);
tblRepo = new JBTable(repoModel);
tblRepo.getEmptyText().setText(TABLE_LOADING_MESSAGE);
tblRepo.setRowSelectionAllowed(true);
tblRepo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tblRepo.setStriped(true);
tblRepo.getSelectionModel().addListSelectionListener(event -> {
if (event.getValueIsAdjusting()) {
return;
}
int selectedRow = tblRepo.getSelectedRow();
if (selectedRow < 0 || selectedRow >= tblRepo.getRowCount()) {
return;
}
String selectedRepo = (String) tblRepo.getModel().getValueAt(selectedRow, 0);
if (Utils.isEmptyString(selectedRepo) || Comparing.equal(selectedRepo, currentRepo)) {
return;
}
currentRepo = selectedRepo;
disableWidgets(false, true);
tblTag.getEmptyText().setText(TABLE_LOADING_MESSAGE);
containerPropertyPresenter.onListTags(subscriptionId, registryId, currentRepo, true);
});
btnRepoRefresh = new AnActionButton(REFRESH, AllIcons.Actions.Refresh) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
disableWidgets(true, true);
tblTag.getEmptyText().setText(TABLE_EMPTY_MESSAGE);
containerPropertyPresenter.onRefreshRepositories(subscriptionId, registryId, true);
}
};
btnRepoPrevious = new AnActionButton(PREVIOUS_PAGE, AllIcons.Actions.MoveUp) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
disableWidgets(true, true);
tblTag.getEmptyText().setText(TABLE_EMPTY_MESSAGE);
containerPropertyPresenter.onListRepositories(subscriptionId, registryId, false);
}
};
btnRepoNext = new AnActionButton(NEXT_PAGE, AllIcons.Actions.MoveDown) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
disableWidgets(true, true);
tblTag.getEmptyText().setText(TABLE_EMPTY_MESSAGE);
containerPropertyPresenter.onListRepositories(subscriptionId, registryId, true);
}
};
ToolbarDecorator repoDecorator = ToolbarDecorator.createDecorator(tblRepo).addExtraActions(btnRepoRefresh).addExtraAction(btnRepoPrevious).addExtraAction(btnRepoNext).setToolbarPosition(ActionToolbarPosition.BOTTOM).setToolbarBorder(JBUI.Borders.empty());
pnlRepoTable = repoDecorator.createPanel();
DefaultTableModel tagModel = new DefaultTableModel() {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
tagModel.addColumn(TAG);
tblTag = new JBTable(tagModel);
tblTag.getEmptyText().setText(TABLE_EMPTY_MESSAGE);
tblTag.setRowSelectionAllowed(true);
tblTag.setStriped(true);
tblTag.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tblTag.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) {
int rowIndex = tblTag.getSelectedRow();
if (rowIndex < 0 || rowIndex >= tblTag.getRowCount()) {
return;
}
currentTag = (String) tblTag.getModel().getValueAt(rowIndex, 0);
menu.show(e.getComponent(), e.getX(), e.getY());
}
}
});
btnTagRefresh = new AnActionButton(REFRESH, AllIcons.Actions.Refresh) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
if (Utils.isEmptyString(currentRepo)) {
return;
}
disableWidgets(false, true);
containerPropertyPresenter.onListTags(subscriptionId, registryId, currentRepo, true);
}
};
btnTagPrevious = new AnActionButton(PREVIOUS_PAGE, AllIcons.Actions.MoveUp) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
if (Utils.isEmptyString(currentRepo)) {
return;
}
disableWidgets(false, true);
containerPropertyPresenter.onListTags(subscriptionId, registryId, currentRepo, false);
}
};
btnTagNext = new AnActionButton(NEXT_PAGE, AllIcons.Actions.MoveDown) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
if (Utils.isEmptyString(currentRepo)) {
return;
}
disableWidgets(false, true);
containerPropertyPresenter.onListTags(subscriptionId, registryId, currentRepo, true);
}
};
ToolbarDecorator tagDecorator = ToolbarDecorator.createDecorator(tblTag).addExtraActions(btnTagRefresh).addExtraAction(btnTagPrevious).addExtraAction(btnTagNext).setToolbarPosition(ActionToolbarPosition.BOTTOM).setToolbarBorder(JBUI.Borders.empty());
pnlTagTable = tagDecorator.createPanel();
}
use of com.intellij.ui.ToolbarDecorator in project android by JetBrains.
the class CreateXmlResourceSubdirPanel method setupDirectoriesPanel.
protected void setupDirectoriesPanel() {
final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myDirectoriesList);
decorator.setEditAction(null);
decorator.disableUpDownActions();
decorator.setAddAction(button -> doAddNewDirectory());
decorator.setRemoveAction(button -> doDeleteDirectory());
final AnActionButton selectAll = new AnActionButton("Select All", null, PlatformIcons.SELECT_ALL_ICON) {
@Override
public void actionPerformed(AnActionEvent e) {
doSelectAllDirs();
}
};
decorator.addExtraAction(selectAll);
final AnActionButton unselectAll = new AnActionButton("Unselect All", null, PlatformIcons.UNSELECT_ALL_ICON) {
@Override
public void actionPerformed(AnActionEvent e) {
doUnselectAllDirs();
}
};
decorator.addExtraAction(unselectAll);
myDirectoriesPanel.add(decorator.createPanel());
updateDirectories(true, myParent.getResourceDirectory());
}
use of com.intellij.ui.ToolbarDecorator in project intellij-plugins by JetBrains.
the class FilesToPackageForm method initTableButtons.
private void initTableButtons() {
ToolbarDecorator d = ToolbarDecorator.createDecorator(myFilesToPackageTable);
d.setAddAction(new AnActionButtonRunnable() {
public void run(AnActionButton button) {
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, true, false, true);
final VirtualFile[] files = FileChooser.chooseFiles(descriptor, myProject, null);
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
for (final VirtualFile file : files) {
final VirtualFile sourceRoot = fileIndex.getSourceRootForFile(file);
String relativePath = sourceRoot == null ? null : sourceRoot.equals(file) ? "." : VfsUtilCore.getRelativePath(file, sourceRoot, '/');
myFilesToPackage.add(new FilePathAndPathInPackage(file.getPath(), StringUtil.notNullize(relativePath, file.getName())));
}
if (files.length > 0) {
fireDataChanged();
IdeFocusManager.getInstance(myProject).requestFocus(myFilesToPackageTable, true);
final int rowCount = myFilesToPackageTable.getRowCount();
myFilesToPackageTable.setRowSelectionInterval(rowCount - files.length, rowCount - 1);
}
}
});
d.setRemoveAction(new AnActionButtonRunnable() {
public void run(AnActionButton anActionButton) {
TableUtil.stopEditing(myFilesToPackageTable);
final int[] selectedRows = myFilesToPackageTable.getSelectedRows();
Arrays.sort(selectedRows);
for (int i = selectedRows.length - 1; i >= 0; i--) {
myFilesToPackage.remove(selectedRows[i]);
}
fireDataChanged();
}
});
myMainPanel.add(d.createPanel(), BorderLayout.CENTER);
}
use of com.intellij.ui.ToolbarDecorator in project intellij-community by JetBrains.
the class ProjectSettingsPanel method getMainComponent.
public JComponent getMainComponent() {
final LabeledComponent<JComboBox> component = new LabeledComponent<>();
component.setText("Default &project copyright:");
component.setLabelLocation(BorderLayout.WEST);
component.setComponent(myProfilesComboBox);
ElementProducer<ScopeSetting> producer = new ElementProducer<ScopeSetting>() {
@Override
public ScopeSetting createElement() {
return new ScopeSetting(CustomScopesProviderEx.getAllScope(), myProfilesModel.getAllProfiles().values().iterator().next());
}
@Override
public boolean canCreateElement() {
return !myProfilesModel.getAllProfiles().isEmpty();
}
};
ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myScopeMappingTable, producer);
return JBUI.Panels.simplePanel(0, 10).addToTop(component).addToCenter(decorator.createPanel()).addToBottom(myScopesLink);
}
Aggregations