summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-11 04:02:45 (EDT)
committerEike Stepper2007-10-11 04:02:45 (EDT)
commit0fd9442436a57fec5fc17e22afe4daf14d2e19e0 (patch)
tree7a67bfb57bcb1c3f8aea8943d4ffc3bcbb1fdc9d
parent23c4eea0ead49083ddba5eddb4a55ecde7414d3a (diff)
downloadcdo-0fd9442436a57fec5fc17e22afe4daf14d2e19e0.zip
cdo-0fd9442436a57fec5fc17e22afe4daf14d2e19e0.tar.gz
cdo-0fd9442436a57fec5fc17e22afe4daf14d2e19e0.tar.bz2
[205668] Provide buddies example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205668
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageManagerDialog.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java30
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/preferences/BuddiesPreferencePage.java13
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java37
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java17
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/security/CredentialsDialog.java4
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/views/Net4jIntrospectorView.java31
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java13
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java11
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/HistoryText.java5
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/LogDialog.java6
14 files changed, 98 insertions, 93 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java
index 96b445d..f732281 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java
@@ -12,9 +12,10 @@ package org.eclipse.emf.cdo.internal.ui.dialogs;
import org.eclipse.emf.cdo.internal.ui.SharedIcons;
+import org.eclipse.net4j.util.ui.UIUtil;
+
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -69,7 +70,7 @@ public class OpenAuditDialog extends TitleAreaDialog
protected Control createDialogArea(Composite parent)
{
Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setLayoutData(UIUtil.createGridData());
composite.setLayout(new GridLayout(3, false));
setTitle(TITLE);
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java
index 2567ae2..28519c1 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java
@@ -15,6 +15,7 @@ import org.eclipse.emf.cdo.internal.ui.bundle.OM;
import org.eclipse.net4j.internal.util.collection.PreferenceHistory;
import org.eclipse.net4j.util.collection.IHistory;
+import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.net4j.util.ui.widgets.HistoryText;
import org.eclipse.net4j.util.ui.widgets.PreferenceButton;
@@ -95,7 +96,7 @@ public class OpenSessionDialog extends TitleAreaDialog
protected Control createDialogArea(Composite parent)
{
Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setLayoutData(UIUtil.createGridData());
composite.setLayout(new GridLayout(2, false));
setTitle(TITLE);
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageManagerDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageManagerDialog.java
index fffa5b3..d60d063 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageManagerDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageManagerDialog.java
@@ -20,12 +20,13 @@ import org.eclipse.emf.cdo.protocol.model.CDOPackage;
import org.eclipse.emf.cdo.util.CDOPackageType;
import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.net4j.util.ObjectUtil;
-
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.ui.UIUtil;
+
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.viewers.BaseLabelProvider;
@@ -35,7 +36,6 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
@@ -97,7 +97,7 @@ public class PackageManagerDialog extends TitleAreaDialog
Table table = viewer.getTable();
table.setHeaderVisible(true);
- table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ table.setLayoutData(UIUtil.createGridData());
addColumn(table, "Package", 400, SWT.LEFT);
addColumn(table, "Registry", 80, SWT.CENTER);
addColumn(table, "Repository", 80, SWT.CENTER);
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java
index 57b064f..e60bcfe 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java
@@ -15,10 +15,11 @@ import org.eclipse.emf.cdo.internal.ui.bundle.OM;
import org.eclipse.emf.cdo.util.CDOPackageType;
import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.net4j.util.ui.widgets.BaseDialog;
-
import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.net4j.util.ui.UIUtil;
+import org.eclipse.net4j.util.ui.widgets.BaseDialog;
+
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITableColorProvider;
@@ -28,7 +29,6 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -73,7 +73,7 @@ public class SelectPackageDialog extends BaseDialog<CheckboxTableViewer>
protected void createUI(Composite parent)
{
CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(parent, SWT.SINGLE | SWT.BORDER);
- viewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ viewer.getTable().setLayoutData(UIUtil.createGridData());
viewer.setContentProvider(new PackageContentProvider());
viewer.setLabelProvider(new PackageLabelProvider());
viewer.setInput(packageTypes);
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java
index 7f93acb..c9fa61b 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.net4j.util.ui.prefs.OMPreferencePage;
import org.eclipse.swt.SWT;
@@ -55,43 +56,38 @@ public class CDOPreferencePage extends OMPreferencePage
@Override
protected Control createUI(Composite parent)
{
- GridLayout grid = new GridLayout(1, false);
- grid.marginHeight = 0;
- grid.marginWidth = 0;
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(grid);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ Composite composite = UIUtil.createGridComposite(parent, 1);
+ composite.setLayoutData(UIUtil.createGridData());
Group sessionGroup = new Group(composite, SWT.NONE);
- sessionGroup.setText("Session Defaults");
- sessionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
sessionGroup.setLayout(new GridLayout(2, false));
+ sessionGroup.setText("Session Defaults");
+ sessionGroup.setLayoutData(UIUtil.createGridData(true, false));
new Label(sessionGroup, SWT.NONE).setText("Repository name:");
repositoryName = new Text(sessionGroup, SWT.BORDER);
- repositoryName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ repositoryName.setLayoutData(UIUtil.createGridData(true, false));
new Label(sessionGroup, SWT.NONE).setText("User name:");
userName = new Text(sessionGroup, SWT.BORDER);
- userName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ userName.setLayoutData(UIUtil.createGridData(true, false));
new Label(sessionGroup, SWT.NONE).setText("Connector description:");
connectorDescription = new Text(sessionGroup, SWT.BORDER);
- connectorDescription.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ connectorDescription.setLayoutData(UIUtil.createGridData(true, false));
new Label(sessionGroup, SWT.NONE).setText("Reference chunk size:");
referenceChunkSize = new TextAndDisable(sessionGroup, SWT.BORDER, String.valueOf(CDORevision.UNCHUNKED));
- referenceChunkSize.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ referenceChunkSize.setLayoutData(UIUtil.createGridData(true, false));
Group viewGroup = new Group(composite, SWT.NONE);
- viewGroup.setText("View Defaults");
- viewGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
viewGroup.setLayout(new GridLayout(2, false));
+ viewGroup.setText("View Defaults");
+ viewGroup.setLayoutData(UIUtil.createGridData(true, false));
new Label(viewGroup, SWT.NONE).setText("Preload chunk size:");
preloadChunkSize = new TextAndDisable(viewGroup, SWT.BORDER, String.valueOf(CDOView.NO_PRELOAD));
- preloadChunkSize.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ preloadChunkSize.setLayoutData(UIUtil.createGridData(true, false));
new Label(viewGroup, SWT.NONE).setText("EMF invalidation notifications:");
invalidationNotifications = new Button(viewGroup, SWT.CHECK);
@@ -160,7 +156,7 @@ public class CDOPreferencePage extends OMPreferencePage
disabled = new Button(this, SWT.CHECK);
disabled.setText("Disabled");
disabled.addSelectionListener(this);
- disabled.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ disabled.setLayoutData(UIUtil.createGridData(false, false));
}
public Text getText()
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/preferences/BuddiesPreferencePage.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/preferences/BuddiesPreferencePage.java
index 4b9f435..3cd4758 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/preferences/BuddiesPreferencePage.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/preferences/BuddiesPreferencePage.java
@@ -11,11 +11,11 @@
package org.eclipse.net4j.buddies.internal.ui.preferences;
import org.eclipse.net4j.buddies.internal.ui.bundle.OM;
+import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.net4j.util.ui.prefs.OMPreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -43,17 +43,12 @@ public class BuddiesPreferencePage extends OMPreferencePage
@Override
protected Control createUI(Composite parent)
{
- GridLayout grid = new GridLayout(2, false);
- grid.marginHeight = 0;
- grid.marginWidth = 0;
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(grid);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ Composite composite = UIUtil.createGridComposite(parent, 2);
+ composite.setLayoutData(UIUtil.createGridData());
new Label(composite, SWT.NONE).setText("Server:");
connectorDescription = new Text(composite, SWT.BORDER);
- connectorDescription.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ connectorDescription.setLayoutData(UIUtil.createGridData(true, false));
new Label(composite, SWT.NONE).setText("User ID:");
userID = new Text(composite, SWT.BORDER);
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
new file mode 100644
index 0000000..d0ea9e1
--- /dev/null
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
@@ -0,0 +1,37 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.buddies.internal.ui.views;
+
+import org.eclipse.net4j.buddies.BuddiesUtil;
+import org.eclipse.net4j.util.ui.UIUtil;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class CollaborationsPane extends Composite
+{
+ public CollaborationsPane(CollaborationsView collaborationsView, Composite parent)
+ {
+ super(parent, SWT.NONE);
+ setLayout(UIUtil.createGridLayout(1));
+
+ List list = new List(this, SWT.NONE);
+ list.setLayoutData(UIUtil.createGridData());
+ for (String facilityType : BuddiesUtil.getFacilityTypes())
+ {
+ list.add(facilityType);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
index 45b905d..07010cf 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.buddies.internal.ui.views;
-import org.eclipse.net4j.buddies.BuddiesUtil;
import org.eclipse.net4j.util.container.ContainerUtil;
import org.eclipse.net4j.util.container.IContainer;
import org.eclipse.net4j.util.ui.widgets.SashComposite;
@@ -18,7 +17,6 @@ import org.eclipse.net4j.util.ui.widgets.SashComposite;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.List;
public class CollaborationsView extends SessionManagerView
{
@@ -36,7 +34,7 @@ public class CollaborationsView extends SessionManagerView
@Override
protected Control createControl(Composite parent)
{
- return sashComposite = new SashComposite(parent, SWT.NONE, 10, 30)
+ return new SashComposite(parent, SWT.NONE, 10, 30)
{
@Override
protected Control createControl1(Composite parent)
@@ -47,22 +45,11 @@ public class CollaborationsView extends SessionManagerView
@Override
protected Control createControl2(Composite parent)
{
- return createPane(parent);
+ return new CollaborationsPane(CollaborationsView.this, parent);
}
};
}
- protected Control createPane(Composite parent)
- {
- List list = new List(parent, SWT.NONE);
- for (String facilityType : BuddiesUtil.getFacilityTypes())
- {
- list.add(facilityType);
- }
-
- return list;
- }
-
@Override
protected IContainer<?> getContainer()
{
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/security/CredentialsDialog.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/security/CredentialsDialog.java
index ce56eb6..e411221 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/security/CredentialsDialog.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/security/CredentialsDialog.java
@@ -13,11 +13,11 @@ package org.eclipse.net4j.util.internal.ui.security;
import org.eclipse.net4j.internal.util.security.PasswordCredentials;
import org.eclipse.net4j.util.internal.ui.bundle.OM;
import org.eclipse.net4j.util.security.IPasswordCredentials;
+import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.net4j.util.ui.widgets.BaseDialog;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
@@ -54,7 +54,7 @@ public class CredentialsDialog extends BaseDialog<Viewer>
{
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setLayoutData(UIUtil.createGridData());
new Label(composite, SWT.NONE).setText("User ID:");
userIDControl = new Text(composite, SWT.BORDER);
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/views/Net4jIntrospectorView.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/views/Net4jIntrospectorView.java
index 2a44ec5..a5bc989 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/views/Net4jIntrospectorView.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/views/Net4jIntrospectorView.java
@@ -16,6 +16,7 @@ import org.eclipse.net4j.util.event.EventUtil;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.internal.ui.bundle.OM;
+import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
@@ -35,8 +36,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
@@ -99,24 +98,24 @@ public class Net4jIntrospectorView extends ViewPart implements ISelectionListene
Color gray = parent.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE);
Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(newGrid(1));
+ composite.setLayout(UIUtil.createGridLayout(1));
Composite c = new Composite(composite, SWT.BORDER);
- c.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- c.setLayout(newGrid(2));
+ c.setLayout(UIUtil.createGridLayout(2));
+ c.setLayoutData(UIUtil.createGridData(true, false));
classLabel = new Text(c, SWT.READ_ONLY);
- classLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ classLabel.setLayoutData(UIUtil.createGridData(false, false));
classLabel.setBackground(bg);
classLabel.setForeground(gray);
objectLabel = new Text(c, SWT.READ_ONLY);
- objectLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ objectLabel.setLayoutData(UIUtil.createGridData(true, false));
objectLabel.setBackground(bg);
stackLayout = new StackLayout();
stacked = new Composite(composite, SWT.NONE);
- stacked.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ stacked.setLayoutData(UIUtil.createGridData());
stacked.setLayout(stackLayout);
objectViewer = createViewer(stacked);
@@ -159,7 +158,7 @@ public class Net4jIntrospectorView extends ViewPart implements ISelectionListene
private TableViewer createViewer(Composite parent)
{
TableViewer viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ viewer.getTable().setLayoutData(UIUtil.createGridData());
viewer.getTable().setHeaderVisible(true);
viewer.getTable().setLinesVisible(true);
return viewer;
@@ -317,20 +316,6 @@ public class Net4jIntrospectorView extends ViewPart implements ISelectionListene
refreshViewer();
}
- private GridLayout newGrid(int numColumns)
- {
- GridLayout grid = new GridLayout(numColumns, false);
- grid.marginTop = 0;
- grid.marginLeft = 0;
- grid.marginRight = 0;
- grid.marginBottom = 0;
- grid.marginWidth = 0;
- grid.marginHeight = 0;
- grid.horizontalSpacing = 0;
- grid.verticalSpacing = 0;
- return grid;
- }
-
private void createObjectColmuns()
{
Table table = objectViewer.getTable();
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java
index 87b002e..18a5286 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java
@@ -16,6 +16,7 @@ import org.eclipse.net4j.util.security.IPasswordCredentialsProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -33,7 +34,7 @@ public final class UIUtil
public static void dispose(Font font)
{
- if (font!= null)
+ if (font != null)
{
font.dispose();
}
@@ -102,4 +103,14 @@ public final class UIUtil
layout.horizontalSpacing = 0;
return layout;
}
+
+ public static GridData createGridData()
+ {
+ return new GridData(SWT.FILL, SWT.FILL, true, true);
+ }
+
+ public static GridData createGridData(boolean grabHorizontal, boolean grabVertical)
+ {
+ return new GridData(SWT.FILL, SWT.FILL, grabHorizontal, grabVertical);
+ }
}
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java
index a0cc10b..9c5f6ab 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerView.java
@@ -22,8 +22,6 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
@@ -101,15 +99,10 @@ public abstract class ContainerView extends ViewPart implements ISetSelectionTar
public final void createPartControl(Composite parent)
{
shell = parent.getShell();
- GridLayout grid = new GridLayout(1, false);
- grid.marginWidth = 0;
- grid.marginHeight = 0;
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(grid);
+ Composite composite = UIUtil.createGridComposite(parent, 1);
Control control = createUI(composite);
- control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ control.setLayoutData(UIUtil.createGridData());
}
protected Control createUI(Composite parent)
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/HistoryText.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/HistoryText.java
index be62221..1a5933d 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/HistoryText.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/HistoryText.java
@@ -18,12 +18,11 @@ import org.eclipse.net4j.util.collection.IHistoryElement;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.internal.ui.bundle.OM;
+import org.eclipse.net4j.util.ui.UIUtil;
-import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
@@ -57,7 +56,7 @@ public class HistoryText
history.addListener(historyListener);
combo = new CCombo(parent, style);
- combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ combo.setLayoutData(UIUtil.createGridData());
combo.addDisposeListener(new DisposeListener()
{
public void widgetDisposed(DisposeEvent e)
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/LogDialog.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/LogDialog.java
index a00943d..7e1d7fe 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/LogDialog.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/widgets/LogDialog.java
@@ -11,6 +11,7 @@
package org.eclipse.net4j.util.ui.widgets;
import org.eclipse.net4j.util.io.IORuntimeException;
+import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -20,7 +21,6 @@ import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.TextStyle;
-import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
@@ -136,7 +136,7 @@ public class LogDialog extends BaseDialog<Viewer>
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(grid);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setLayoutData(UIUtil.createGridData());
font = new Font(getShell().getDisplay(), "Courier New", 9, SWT.NORMAL);
checkStyleRange();
@@ -144,7 +144,7 @@ public class LogDialog extends BaseDialog<Viewer>
checkStyleRange();
text = new StyledText(composite, SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ text.setLayoutData(UIUtil.createGridData());
text.setText(log.toString());
text.setStyleRanges(styleRanges.toArray(new StyleRange[styleRanges.size()]));
text.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE));