提交 22ae5c7b 编写于 作者: S Serge Rider

#91 Reorder actions available only for persisted object. Reorder undo reflector fix.

上级 7bd47f36
......@@ -103,7 +103,7 @@ public class ItemListControl extends NodeListControl
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, IWorkbenchCommandConstants.FILE_REFRESH));
}
if (rootNode instanceof DBNDatabaseNode) {
if (rootNode instanceof DBNDatabaseNode && rootNode.isPersisted()) {
boolean hasReorder = false;
List<Class<?>> childrenTypes = ((DBNDatabaseNode) rootNode).getChildrenTypes(null);
for (Class<?> chilType : childrenTypes) {
......
......@@ -143,8 +143,10 @@ public abstract class SQLObjectEditor<OBJECT_TYPE extends DBSObject, CONTAINER_T
protected void addObjectReorderActions(List<DBEPersistAction> actions, ObjectReorderCommand command)
{
// Not supported by implementation
throw new IllegalStateException("Object reorder is not supported in " + getClass().getSimpleName()); //$NON-NLS-1$
if (command.getObject().isPersisted()) {
// Not supported by implementation
throw new IllegalStateException("Object reorder is not supported in " + getClass().getSimpleName()); //$NON-NLS-1$
}
}
protected abstract void addObjectDeleteActions(List<DBEPersistAction> actions, ObjectDeleteCommand command);
......@@ -473,7 +475,11 @@ public abstract class SQLObjectEditor<OBJECT_TYPE extends DBSObject, CONTAINER_T
public void undoCommand(ObjectReorderCommand command)
{
((DBPOrderedObject)command.getObject()).setOrdinalPosition(command.oldPosition);
DBUtils.fireObjectUpdate(command.getObject());
final DBSObject parentObject = command.getObject().getParentObject();
if (parentObject != null) {
// We need to update order in navigator model
DBUtils.fireObjectUpdate(parentObject, DBPEvent.REORDER);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册