提交 75c5ac6e 编写于 作者: S serge-rider

Object list control refactoring (actions contribution)


Former-commit-id: c52a76aa
上级 249abe5c
......@@ -23,6 +23,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
......@@ -214,10 +215,10 @@ public class ProgressPageControl extends Composite implements ISearchContextProv
return customControlsComposite;
}
protected void fillCustomToolbar(ToolBarManager toolbarManager)
protected void fillCustomActions(IContributionManager contributionManager)
{
if (childPageControl != null) {
childPageControl.fillCustomToolbar(toolbarManager);
childPageControl.fillCustomActions(contributionManager);
}
}
......@@ -260,7 +261,7 @@ public class ProgressPageControl extends Composite implements ISearchContextProv
}
customToolbarManager.removeAll();
fillCustomToolbar(customToolbarManager);
fillCustomActions(customToolbarManager);
if (!customToolbarManager.isEmpty()) {
ToolBar toolbar = customToolbarManager.createControl(customControlsComposite);
toolbar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END));
......
......@@ -18,7 +18,7 @@
package org.jkiss.dbeaver.ui.controls.itemlist;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
......@@ -36,7 +36,6 @@ import org.jkiss.dbeaver.ui.actions.navigator.NavigatorHandlerConfigureFilter;
import org.jkiss.dbeaver.runtime.properties.ObjectPropertyDescriptor;
import org.jkiss.dbeaver.ui.navigator.NavigatorUtils;
import org.jkiss.utils.ArrayUtils;
import org.jkiss.utils.CommonUtils;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
......@@ -71,10 +70,10 @@ public class ItemListControl extends NodeListControl
}
@Override
protected void fillCustomToolbar(ToolBarManager toolbarManager)
protected void fillCustomActions(IContributionManager contributionManager)
{
if (getRootNode() instanceof DBNDatabaseFolder && ((DBNDatabaseFolder)getRootNode()).getItemsMeta() != null) {
toolbarManager.add(new Action(
contributionManager.add(new Action(
"Filter",
DBeaverIcons.getImageDescriptor(UIIcon.FILTER))
{
......
......@@ -20,8 +20,8 @@ package org.jkiss.dbeaver.ui.editors.sql;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.text.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
......@@ -314,7 +314,7 @@ public abstract class SQLEditorNested<T extends DBSObject>
protected abstract void setSourceText(DBRProgressMonitor monitor, String sourceText);
protected void contributeEditorCommands(ToolBarManager toolBarManager)
protected void contributeEditorCommands(IContributionManager toolBarManager)
{
toolBarManager.add(ActionUtils.makeCommandContribution(getSite().getWorkbenchWindow(), ICommandIds.CMD_OPEN_FILE));
toolBarManager.add(ActionUtils.makeCommandContribution(getSite().getWorkbenchWindow(), ICommandIds.CMD_SAVE_FILE));
......@@ -334,8 +334,8 @@ public abstract class SQLEditorNested<T extends DBSObject>
}
@Override
protected void fillCustomToolbar(ToolBarManager toolBarManager) {
contributeEditorCommands(toolBarManager);
protected void fillCustomActions(IContributionManager contributionManager) {
contributeEditorCommands(contributionManager);
}
}
......
......@@ -17,7 +17,7 @@
*/
package org.jkiss.dbeaver.ui.search;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
......@@ -132,7 +132,7 @@ public abstract class AbstractSearchResultsPage <OBJECT_TYPE> extends Page imple
}
@Override
protected void fillCustomToolbar(ToolBarManager toolbarManager)
protected void fillCustomActions(IContributionManager contributionManager)
{
}
......
......@@ -18,7 +18,7 @@
package org.jkiss.dbeaver.ui.views.plan;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
......@@ -82,9 +82,9 @@ public class ExplainPlanViewer implements IPropertyChangeListener
this.planTree = new PlanNodesTree(leftPanel, SWT.SHEET) {
@Override
protected void fillCustomToolbar(ToolBarManager toolbarManager) {
toolbarManager.add(toggleViewAction);
toolbarManager.add(refreshPlanAction);
protected void fillCustomActions(IContributionManager contributionManager) {
contributionManager.add(toggleViewAction);
contributionManager.add(refreshPlanAction);
}
};
this.planTree.setShowDivider(true);
......
......@@ -18,7 +18,7 @@
package org.jkiss.dbeaver.ui.views.session;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
......@@ -144,7 +144,7 @@ public class SessionManagerViewer
}
}
protected void contributeToToolbar(DBAServerSessionManager sessionManager, ToolBarManager toolBar)
protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager)
{
}
......@@ -192,9 +192,9 @@ public class SessionManagerViewer
}
@Override
protected void fillCustomToolbar(ToolBarManager toolbarManager) {
contributeToToolbar(sessionManager, toolbarManager);
toolbarManager.add(new Action("Refresh sessions", DBeaverIcons.getImageDescriptor(UIIcon.REFRESH)) {
protected void fillCustomActions(IContributionManager contributionManager) {
contributeToToolbar(sessionManager, contributionManager);
contributionManager.add(new Action("Refresh sessions", DBeaverIcons.getImageDescriptor(UIIcon.REFRESH)) {
@Override
public void run()
{
......
......@@ -107,11 +107,7 @@ class SessionTable extends DatabaseObjectListControl<DBAServerSession> {
}
}
} catch (Throwable ex) {
if (ex instanceof InvocationTargetException) {
throw (InvocationTargetException)ex;
} else {
throw new InvocationTargetException(ex);
}
throw new InvocationTargetException(ex);
}
}
}
......@@ -139,11 +135,7 @@ class SessionTable extends DatabaseObjectListControl<DBAServerSession> {
}
}
} catch (Throwable ex) {
if (ex instanceof InvocationTargetException) {
throw (InvocationTargetException)ex;
} else {
throw new InvocationTargetException(ex);
}
throw new InvocationTargetException(ex);
}
}
......
......@@ -19,8 +19,8 @@
package org.jkiss.dbeaver.ext.db2.model.app;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
import org.jkiss.dbeaver.ui.DBeaverIcons;
......@@ -61,10 +61,10 @@ public class DB2ServerApplicationEditor extends SinglePageDatabaseEditor<IDataba
@Override
@SuppressWarnings("rawtypes")
protected void contributeToToolbar(DBAServerSessionManager sessionManager, ToolBarManager toolBar)
protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager)
{
toolBar.add(forceApplicationAction);
toolBar.add(new Separator());
contributionManager.add(forceApplicationAction);
contributionManager.add(new Separator());
}
@Override
......
......@@ -849,7 +849,7 @@ public abstract class ERDEditorPart extends GraphicalEditorWithFlyoutPalette
}
@Override
protected void fillCustomToolbar(ToolBarManager toolBarManager) {
protected void fillCustomActions(IContributionManager toolBarManager) {
ZoomManager zoomManager = rootPart.getZoomManager();
String[] zoomStrings = new String[]{
......
......@@ -19,8 +19,8 @@
package org.jkiss.dbeaver.ext.mysql.editors;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.ISharedImages;
......@@ -62,11 +62,11 @@ public class MySQLSessionEditor extends AbstractSessionEditor
protected SessionManagerViewer createSessionViewer(DBCExecutionContext executionContext, Composite parent) {
return new SessionManagerViewer(this, parent, new MySQLSessionManager((MySQLDataSource) executionContext.getDataSource())) {
@Override
protected void contributeToToolbar(DBAServerSessionManager sessionManager, ToolBarManager toolBar)
protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager)
{
toolBar.add(killSessionAction);
toolBar.add(terminateQueryAction);
toolBar.add(new Separator());
contributionManager.add(killSessionAction);
contributionManager.add(terminateQueryAction);
contributionManager.add(new Separator());
}
@Override
......
......@@ -19,8 +19,8 @@
package org.jkiss.dbeaver.ext.oracle.editors;
import org.eclipse.jface.action.ControlContribution;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
......@@ -42,15 +42,14 @@ public class OracleObjectDDLEditor extends SQLSourceViewer<OracleTable> {
}
@Override
protected void contributeEditorCommands(ToolBarManager toolBarManager)
protected void contributeEditorCommands(IContributionManager contributionManager)
{
super.contributeEditorCommands(toolBarManager);
super.contributeEditorCommands(contributionManager);
toolBarManager.add(new Separator());
toolBarManager.add(new ControlContribution("DDLFormat") {
contributionManager.add(new Separator());
contributionManager.add(new ControlContribution("DDLFormat") {
@Override
protected Control createControl(Composite parent)
{
protected Control createControl(Composite parent) {
OracleDDLFormat ddlFormat = OracleDDLFormat.getCurrentFormat(getSourceObject().getDataSource());
final Combo ddlFormatCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY | SWT.DROP_DOWN);
ddlFormatCombo.setToolTipText("DDL Format");
......@@ -62,8 +61,7 @@ public class OracleObjectDDLEditor extends SQLSourceViewer<OracleTable> {
}
ddlFormatCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e)
{
public void widgetSelected(SelectionEvent e) {
for (OracleDDLFormat format : OracleDDLFormat.values()) {
if (format.ordinal() == ddlFormatCombo.getSelectionIndex()) {
getEditorInput().getDatabaseObject().getDataSource().getContainer().getPreferenceStore().setValue(
......
......@@ -19,8 +19,8 @@
package org.jkiss.dbeaver.ext.oracle.editors;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
......@@ -58,11 +58,11 @@ public class OracleSessionEditor extends AbstractSessionEditor
protected SessionManagerViewer createSessionViewer(DBCExecutionContext executionContext, Composite parent) {
return new SessionManagerViewer(this, parent, new OracleServerSessionManager(getExecutionContext())) {
@Override
protected void contributeToToolbar(DBAServerSessionManager sessionManager, ToolBarManager toolBar)
protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager)
{
toolBar.add(killSessionAction);
toolBar.add(disconnectSessionAction);
toolBar.add(new Separator());
contributionManager.add(killSessionAction);
contributionManager.add(disconnectSessionAction);
contributionManager.add(new Separator());
}
@Override
......
......@@ -18,8 +18,8 @@
package org.jkiss.dbeaver.ext.postgresql.edit;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.ISharedImages;
......@@ -51,10 +51,10 @@ public class PostgreSessionEditor extends AbstractSessionEditor
protected SessionManagerViewer createSessionViewer(DBCExecutionContext executionContext, Composite parent) {
return new SessionManagerViewer(this, parent, new PostgreSessionManager((PostgreDataSource) executionContext.getDataSource())) {
@Override
protected void contributeToToolbar(DBAServerSessionManager sessionManager, ToolBarManager toolBar)
protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager)
{
toolBar.add(terminateQueryAction);
toolBar.add(new Separator());
contributionManager.add(terminateQueryAction);
contributionManager.add(new Separator());
}
@Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册