提交 2cf9beea 编写于 作者: S serge-rider

#10 Navigator packages refactoring

上级 517c9633
......@@ -684,15 +684,15 @@
</enabledWhen>
</handler>
<handler commandId="org.jkiss.dbeaver.core.driver.manager" class="org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerDriverManager"/>
<handler commandId="org.jkiss.dbeaver.core.new.connection" class="org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerConnectionCreate">
<handler commandId="org.jkiss.dbeaver.core.driver.manager" class="org.jkiss.dbeaver.ui.actions.NavigatorHandlerDriverManager"/>
<handler commandId="org.jkiss.dbeaver.core.new.connection" class="org.jkiss.dbeaver.ui.actions.NavigatorHandlerConnectionCreate">
<enabledWhen>
<with variable="activePart">
<test property="org.jkiss.dbeaver.core.global.hasActiveProject"/>
</with>
</enabledWhen>
</handler>
<handler commandId="org.jkiss.dbeaver.core.migrate.connection" class="org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerConnectionMigrate"/>
<handler commandId="org.jkiss.dbeaver.core.migrate.connection" class="org.jkiss.dbeaver.ui.actions.NavigatorHandlerConnectionMigrate"/>
<handler commandId="org.jkiss.dbeaver.core.new.folder" class="org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerLocalFolderCreate">
<enabledWhen>
<with variable="selection">
......@@ -740,7 +740,7 @@
</with>
</enabledWhen>
</handler>
<handler commandId="org.jkiss.dbeaver.core.navigator.bookmark.add" class="org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerAddBookmark">
<handler commandId="org.jkiss.dbeaver.core.navigator.bookmark.add" class="org.jkiss.dbeaver.ui.actions.NavigatorHandlerAddBookmark">
<enabledWhen>
<with variable="selection">
<count value="1"/>
......
......@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ui.navigator.actions;
package org.jkiss.dbeaver.ui.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
......
......@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ui.navigator.actions;
package org.jkiss.dbeaver.ui.actions;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
......@@ -38,6 +38,7 @@ import org.jkiss.dbeaver.runtime.ui.DBUserInterface;
import org.jkiss.dbeaver.ui.UIUtils;
import org.jkiss.dbeaver.ui.dialogs.EnterNameDialog;
import org.jkiss.dbeaver.ui.navigator.NavigatorUtils;
import org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerObjectBase;
import org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorTree;
import org.jkiss.dbeaver.ui.resources.bookmarks.BookmarksHandlerImpl;
......
......@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ui.navigator.actions;
package org.jkiss.dbeaver.ui.actions;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
......
......@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ui.navigator.actions;
package org.jkiss.dbeaver.ui.actions;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
......
......@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ui.navigator.actions;
package org.jkiss.dbeaver.ui.actions;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
......
......@@ -34,7 +34,7 @@ import org.jkiss.dbeaver.ui.ActionUtils;
import org.jkiss.dbeaver.ui.DBeaverIcons;
import org.jkiss.dbeaver.ui.UIUtils;
import org.jkiss.dbeaver.ui.actions.common.EmptyListAction;
import org.jkiss.dbeaver.ui.navigator.actions.NavigatorActionExecuteTool;
import org.jkiss.dbeaver.ui.actions.NavigatorActionExecuteTool;
import org.jkiss.dbeaver.ui.editors.DatabaseEditorInput;
import org.jkiss.dbeaver.ui.editors.IDatabaseEditorInput;
import org.jkiss.dbeaver.ui.navigator.NavigatorUtils;
......
......@@ -44,7 +44,7 @@ public class UIServiceSQLImpl implements UIServiceSQL {
private static final Log log = Log.getLog(UIServiceSQLImpl.class);
@Override
public void openSQLViewer(DBCExecutionContext context, String title, DBPImage image, String text) {
public int openSQLViewer(DBCExecutionContext context, String title, DBPImage image, String text, boolean showSaveButton) {
ViewSQLDialog dialog = new ViewSQLDialog(
UIUtils.getActiveWorkbenchWindow().getActivePage().getActivePart().getSite(),
context,
......@@ -52,7 +52,8 @@ public class UIServiceSQLImpl implements UIServiceSQL {
image,
text
);
dialog.open();
dialog.setShowSaveButton(showSaveButton);
return dialog.open();
}
@Override
......
......@@ -40,14 +40,14 @@ import org.jkiss.dbeaver.model.sql.SQLUtils;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSObjectReference;
import org.jkiss.dbeaver.registry.ObjectManagerRegistry;
import org.jkiss.dbeaver.ui.editors.SimpleCommandContext;
import org.jkiss.dbeaver.runtime.DBWorkbench;
import org.jkiss.dbeaver.runtime.ui.UIServiceSQL;
import org.jkiss.dbeaver.ui.UIIcon;
import org.jkiss.dbeaver.ui.UIUtils;
import org.jkiss.dbeaver.ui.controls.folders.ITabbedFolderContainer;
import org.jkiss.dbeaver.ui.editors.sql.dialogs.ViewSQLDialog;
import org.jkiss.dbeaver.ui.editors.IDatabaseEditor;
import org.jkiss.dbeaver.ui.editors.IDatabaseEditorInput;
import org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorView;
import org.jkiss.dbeaver.ui.editors.SimpleCommandContext;
import org.jkiss.dbeaver.utils.RuntimeUtils;
import java.lang.reflect.InvocationTargetException;
......@@ -214,19 +214,13 @@ public abstract class NavigatorHandlerObjectBase extends AbstractHandler {
} catch (InterruptedException e) {
return false;
}
DatabaseNavigatorView view = UIUtils.findView(workbenchWindow, DatabaseNavigatorView.class);
if (view != null) {
ViewSQLDialog dialog = new ViewSQLDialog(
view.getSite(),
commandContext.getExecutionContext(),
dialogTitle,
UIIcon.SQL_PREVIEW,
script.toString());
dialog.setShowSaveButton(true);
return dialog.open() == IDialogConstants.PROCEED_ID;
} else {
return false;
UIServiceSQL serviceSQL = DBWorkbench.getService(UIServiceSQL.class);
if (serviceSQL != null) {
return serviceSQL.openSQLViewer(
commandContext.getExecutionContext(), dialogTitle, UIIcon.SQL_PREVIEW, script.toString(), true) == IDialogConstants.PROCEED_ID;
}
return false;
}
private static class NodeLoader implements DBRRunnableWithProgress {
......
......@@ -55,7 +55,6 @@ import org.jkiss.utils.CommonUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class DatabaseConsumerPageMapping extends ActiveWizardPage<DataTransferWizard> {
......@@ -677,8 +676,8 @@ public class DatabaseConsumerPageMapping extends ActiveWizardPage<DataTransferWi
DBUtils.getDefaultContext(container, true),
"Target DDL",
null,
ddl
);
ddl,
false);
}
} catch (DBException e) {
DBUserInterface.getInstance().showError("Target DDL", "Error generatiung target DDL", e);
......
......@@ -29,7 +29,7 @@ import org.jkiss.dbeaver.model.exec.DBCExecutionContext;
*/
public interface UIServiceSQL {
void openSQLViewer(@Nullable DBCExecutionContext context, String title, @Nullable DBPImage image, String text);
int openSQLViewer(@Nullable DBCExecutionContext context, String title, @Nullable DBPImage image, String text, boolean showSaveButton);
/**
* @return IEditorPart
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册