if (cell != null && cell.isModified() && !cell.isLobValue()) {
RevertChangesAction revertChangesAction = new RevertChangesAction(cell);
add(revertChangesAction);
}
DefaultActionGroup filterActionGroup = new DefaultActionGroup("Filter", true);
filterActionGroup.getTemplatePresentation().setIcon(Icons.DATASET_FILTER_NEW);
//filterActionGroup.getTemplatePresentation().setIcon(Icons.DATASET_FILTER);
filterActionGroup.add(new CreateFilterAction(false));
filterActionGroup.addSeparator();
if (columnValue != null ) filterActionGroup.add(new CreateFilterAction(true));
DBDataType dataType = columnInfo.getDataType();
String text = getClipboardContent((int) dataType.getLength());
if (text != null) {
filterActionGroup.add(new CreateClipboardFilterAction(text, false));
if (dataType.isNative() && dataType.getNativeDataType().getBasicDataType() == GenericDataType.LITERAL) {
filterActionGroup.add(new CreateClipboardFilterAction(text, true));
}
}
// show the create additional condition action in case the filter is basic,
// the join is AND, and the column is not already present
DatasetFilterManager filterManager = DatasetFilterManager.getInstance(table.getDataset().getProject());
DatasetFilter activeFilter = filterManager.getActiveFilter(table.getDataset());
if (activeFilter instanceof DatasetBasicFilter) {
DatasetBasicFilter basicFilter = (DatasetBasicFilter) activeFilter;
if (basicFilter.getJoinType() == DatasetBasicFilter.JOIN_TYPE_AND &&
!basicFilter.containsConditionForColumn(columnInfo.getName())) {
filterActionGroup.addSeparator();
filterActionGroup.add(new CreateAdditionalConditionAction());
}
}
add(filterActionGroup);
if (columnInfo.isSortable()) {
DefaultActionGroup sortingActionGroup = new DefaultActionGroup("Sort", true);
//sortingActionGroup.getTemplatePresentation().setIcon(Icons.COMMON_SORTING);
sortingActionGroup.add(new SortAscendingAction());
sortingActionGroup.add(new SortDescendingAction());
add(sortingActionGroup);
}
DBDataset dataset = table.getDataset();
DBColumn column = dataset.getColumn(columnInfo.getName());
if (columnValue != null) {
if (column.isForeignKey()) {
DatasetFilterInput filterInput = table.getModel().resolveForeignKeyRecord(cell);
add(new ShowReferencedRecordAction(filterInput));
}
if (column.isPrimaryKey()) {
ShowReferencingRecordsAction action = new ShowReferencingRecordsAction(column, columnValue);
action.setPopupLocation(table.getColumnHeaderLocation(column));
add(action);
}
}
addSeparator();
DefaultActionGroup columnPropertiesActionGroup = new DefaultActionGroup("Column info", true);
columnPropertiesActionGroup.add(new NavigateToObjectAction(column));
for (DBObjectNavigationList navigationList : column.getNavigationLists()) {
if (!navigationList.isLazy()) {
add(new ObjectNavigationListActionGroup(column, navigationList, true));
}
}