public class ObjectActionGroup extends DefaultActionGroup {
public ObjectActionGroup(DBObject object) {
DatabaseCompatibilityInterface compatibilityInterface = DatabaseCompatibilityInterface.getInstance(object);
DBObjectProperties properties = object.getProperties();
if(object instanceof DBSchemaObject) {
DBSchemaObject schemaObject = (DBSchemaObject) object;
if (properties.is(DBObjectProperty.EDITABLE)) {
DBContentType contentType = schemaObject.getContentType();
if (contentType == DBContentType.DATA || contentType == DBContentType.CODE_AND_DATA) {
add(new EditObjectDataAction(schemaObject));
}
if (contentType == DBContentType.CODE || contentType == DBContentType.CODE_AND_DATA || contentType == DBContentType.CODE_SPEC_AND_BODY) {
add(new EditObjectCodeAction(schemaObject));
}
}
if (properties.is(DBObjectProperty.COMPILABLE) && compatibilityInterface.supportsFeature(DatabaseFeature.OBJECT_INVALIDATION)) {
add(new CompileActionGroup(schemaObject));
}
if (properties.is(DBObjectProperty.DISABLEABLE) && compatibilityInterface.supportsFeature(DatabaseFeature.OBJECT_DISABLING)) {
add(new EnableDisableAction(schemaObject));
}
}
if (object instanceof DBMethod) {
if (compatibilityInterface.supportsFeature(DatabaseFeature.DEBUGGING)) {
add(new ExecuteActionGroup((DBSchemaObject) object));
} else {
add(new RunMethodAction((DBMethod) object));
}
}
if (object instanceof DBProgram && properties.is(DBObjectProperty.SCHEMA_OBJECT)) {
if (compatibilityInterface.supportsFeature(DatabaseFeature.DEBUGGING)) {
add(new ExecuteActionGroup((DBSchemaObject) object));
} else {
add(new RunProgramMethodAction((DBProgram) object));
}
}
if (properties.is(DBObjectProperty.SCHEMA_OBJECT)) {
add(new DropObjectAction((DBSchemaObject) object));
//add(new TestAction(object));
}
if(properties.is(DBObjectProperty.REFERENCEABLE) && compatibilityInterface.supportsFeature(DatabaseFeature.OBJECT_DEPENDENCIES)) {
addSeparator();
add (new DependenciesActionGroup((DBSchemaObject) object));
}
List<DBObjectNavigationList> navigationLists = object.getNavigationLists();
if (navigationLists != null && navigationLists.size() > 0) {
if (!properties.is(DBObjectProperty.REFERENCEABLE)) addSeparator();
//add(new DbsGoToActionGroup(linkLists));
for (DBObjectNavigationList navigationList : navigationLists) {
if (navigationList.isLazy()) {
add(new ObjectLazyNavigationListAction(object.getParentObject(), navigationList));
} else {