diff --git a/plugins/org.jkiss.dbeaver.core/plugin.xml b/plugins/org.jkiss.dbeaver.core/plugin.xml index 1fe8c0c33f6c96948a47d25e4dee0177e534a67d..c135e49e2f1a7454437b781df47661b24d0b4eda 100644 --- a/plugins/org.jkiss.dbeaver.core/plugin.xml +++ b/plugins/org.jkiss.dbeaver.core/plugin.xml @@ -2149,6 +2149,8 @@ + + diff --git a/plugins/org.jkiss.dbeaver.ext.mockdata/plugin.xml b/plugins/org.jkiss.dbeaver.ext.mockdata/plugin.xml index 1204dd6cd6b6c76e5c7253f2274cfecee655d82f..21180d4c1de2e118898fc450b925e9422a00df99 100644 --- a/plugins/org.jkiss.dbeaver.ext.mockdata/plugin.xml +++ b/plugins/org.jkiss.dbeaver.ext.mockdata/plugin.xml @@ -5,18 +5,31 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/handlers/MockDataHandler.java b/plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/handlers/MockDataHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..927df177fdc445b6ebb99cae4d40b09e9d61c9b5 --- /dev/null +++ b/plugins/org.jkiss.dbeaver.ext.mockdata/src/org/jkiss/dbeaver/ext/mockdata/handlers/MockDataHandler.java @@ -0,0 +1,54 @@ +/* + * DBeaver - Universal Database Manager + * Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org) + * + * 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.mockdata.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; +import org.jkiss.dbeaver.DBException; +import org.jkiss.dbeaver.Log; +import org.jkiss.dbeaver.ext.mockdata.MockDataGenerateTool; +import org.jkiss.dbeaver.model.struct.DBSObject; +import org.jkiss.dbeaver.ui.navigator.NavigatorUtils; + +import java.util.List; + +public class MockDataHandler extends AbstractHandler { + + private static final Log log = Log.getLog(MockDataHandler.class); + + public MockDataHandler() { + } + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + + List selectedObjects = NavigatorUtils.getSelectedObjects( + HandlerUtil.getCurrentSelection(event)); + + MockDataGenerateTool mockDataGenerator = new MockDataGenerateTool(); + try { + mockDataGenerator.execute( + HandlerUtil.getActiveWorkbenchWindow(event), null, selectedObjects); + } catch (DBException e) { + log.error("Error launching the Mock Data Generator", e); + } + + return null; + } +}