提交 28366bb3 编写于 作者: L LonwoLonwo

#11312 disable/enable table trigger tool added


Former-commit-id: a7bde723
上级 5e12b1ca
...@@ -307,6 +307,24 @@ ...@@ -307,6 +307,24 @@
singleton="false"> singleton="false">
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleTable"/> <objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleTable"/>
</tool> </tool>
<tool
class="org.jkiss.dbeaver.ext.oracle.ui.tools.maintenance.OracleToolTriggerDisable"
description="Disable trigger(s)"
id="org.jkiss.dbeaver.ext.oracle.ui.tools.maintenance.OracleToolTriggerDisable"
group="org.jkiss.dbeaver.ext.oracle.ui.tools.maintenance"
label="Disable trigger"
singleton="false">
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleTableTrigger" if="object.status == 'ENABLED'"/>
</tool>
<tool
class="org.jkiss.dbeaver.ext.oracle.ui.tools.maintenance.OracleToolTriggerEnable"
description="Enable trigger(s)"
id="org.jkiss.dbeaver.ext.oracle.ui.tools.maintenance.OracleToolTriggerEnable"
group="org.jkiss.dbeaver.ext.oracle.ui.tools.maintenance"
label="Enable trigger"
singleton="false">
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleTableTrigger" if="object.status == 'DISABLED'"/>
</tool>
</tools> </tools>
</extension> </extension>
......
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2021 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.oracle.ui.tools.maintenance;
public class OracleToolTriggerDisable extends OracleToolTriggerToggle {
public OracleToolTriggerDisable() {
super(false);
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2021 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.oracle.ui.tools.maintenance;
public class OracleToolTriggerEnable extends OracleToolTriggerToggle {
public OracleToolTriggerEnable() {
super(true);
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2021 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.oracle.ui.tools.maintenance;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizardDialog;
import org.jkiss.dbeaver.ui.navigator.NavigatorUtils;
import org.jkiss.dbeaver.ui.tools.IUserInterfaceTool;
import java.util.Collection;
public abstract class OracleToolTriggerToggle implements IUserInterfaceTool {
private boolean isEnable;
public OracleToolTriggerToggle(boolean isEnable) {
this.isEnable = isEnable;
}
@Override
public void execute(IWorkbenchWindow window, IWorkbenchPart activePart, Collection<DBSObject> objects) {
if (isEnable) {
TaskConfigurationWizardDialog.openNewTaskDialog(
window,
NavigatorUtils.getSelectedProject(),
"oracleToolTriggerEnable",
new StructuredSelection(objects.toArray()));
} else {
TaskConfigurationWizardDialog.openNewTaskDialog(
window,
NavigatorUtils.getSelectedProject(),
"oracleToolTriggerDisable",
new StructuredSelection(objects.toArray()));
}
}
}
...@@ -521,6 +521,14 @@ ...@@ -521,6 +521,14 @@
<datasource id="oracle"/> <datasource id="oracle"/>
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleMaterializedView"/> <objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleMaterializedView"/>
</task> </task>
<task id="oracleToolTriggerEnable" name="Enable trigger" description="Enable trigger" icon="platform:/plugin/org.jkiss.dbeaver.model/icons/tree/admin.png" type="oracleTool" handler="org.jkiss.dbeaver.ext.oracle.tasks.OracleToolTableTriggerEnable">
<datasource id="oracle"/>
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleTableTrigger" if="object.status == 'DISABLED'"/>
</task>
<task id="oracleToolTriggerDisable" name="Disable trigger" description="Disable trigger" icon="platform:/plugin/org.jkiss.dbeaver.model/icons/tree/admin.png" type="oracleTool" handler="org.jkiss.dbeaver.ext.oracle.tasks.OracleToolTableTriggerDisable">
<datasource id="oracle"/>
<objectType name="org.jkiss.dbeaver.ext.oracle.model.OracleTableTrigger" if="object.status == 'ENABLED'"/>
</task>
</extension> </extension>
</plugin> </plugin>
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2021 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.oracle.tasks;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.ext.oracle.model.OracleTableTrigger;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.edit.DBEPersistAction;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.exec.DBCSession;
import org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction;
import org.jkiss.dbeaver.model.sql.task.SQLToolExecuteHandler;
import java.util.List;
public class OracleToolTableTriggerDisable extends SQLToolExecuteHandler<OracleTableTrigger, OracleToolTableTriggerSettings> {
@NotNull
@Override
public OracleToolTableTriggerSettings createToolSettings() {
return new OracleToolTableTriggerSettings();
}
@Override
public void generateObjectQueries(DBCSession session, OracleToolTableTriggerSettings settings, List<DBEPersistAction> queries, OracleTableTrigger object) throws DBCException {
String sql = "ALTER TRIGGER " + object.getFullyQualifiedName(DBPEvaluationContext.DDL) + " DISABLE";
queries.add(new SQLDatabasePersistAction(sql));
}
public boolean needsRefreshOnFinish() {
return true;
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2021 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.oracle.tasks;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.ext.oracle.model.OracleTableTrigger;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.edit.DBEPersistAction;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.exec.DBCSession;
import org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction;
import org.jkiss.dbeaver.model.sql.task.SQLToolExecuteHandler;
import java.util.List;
public class OracleToolTableTriggerEnable extends SQLToolExecuteHandler<OracleTableTrigger, OracleToolTableTriggerSettings> {
@NotNull
@Override
public OracleToolTableTriggerSettings createToolSettings() {
return new OracleToolTableTriggerSettings();
}
@Override
public void generateObjectQueries(DBCSession session, OracleToolTableTriggerSettings settings, List<DBEPersistAction> queries, OracleTableTrigger object) throws DBCException {
String sql = "ALTER TRIGGER " + object.getFullyQualifiedName(DBPEvaluationContext.DDL) + " ENABLE";
queries.add(new SQLDatabasePersistAction(sql));
}
public boolean needsRefreshOnFinish() {
return true;
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2021 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.oracle.tasks;
import org.jkiss.dbeaver.ext.oracle.model.OracleTableTrigger;
import org.jkiss.dbeaver.model.sql.task.SQLToolExecuteSettings;
public class OracleToolTableTriggerSettings extends SQLToolExecuteSettings<OracleTableTrigger> {
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册