Bug 508119 - Icon and title are not aligned for View Editor/Preview
Change-Id: Ife586da81798b5200b6f0c448c292a29af60197d
Signed-off-by: Alexandra Buzila <abuzila@eclipsesource.com>
diff --git a/bundles/org.eclipse.emf.ecp.view.model.preview.e3/src/org/eclipse/emf/ecp/view/model/internal/preview/e3/views/PreviewView.java b/bundles/org.eclipse.emf.ecp.view.model.preview.e3/src/org/eclipse/emf/ecp/view/model/internal/preview/e3/views/PreviewView.java
index e5d345a..e0a92b7 100644
--- a/bundles/org.eclipse.emf.ecp.view.model.preview.e3/src/org/eclipse/emf/ecp/view/model/internal/preview/e3/views/PreviewView.java
+++ b/bundles/org.eclipse.emf.ecp.view.model.preview.e3/src/org/eclipse/emf/ecp/view/model/internal/preview/e3/views/PreviewView.java
@@ -392,9 +392,11 @@
titleFont = new Font(title.getDisplay(), getDefaultFontName(title), 12, SWT.BOLD);
title.setFont(titleFont);
title.setForeground(getTitleColor());
+ final int titleHeight = title.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
final FormData titleData = new FormData();
- title.setLayoutData(titleData);
titleData.left = new FormAttachment(titleImage, 5, SWT.DEFAULT);
+ titleData.top = new FormAttachment(50, -titleHeight / 2);
+ title.setLayoutData(titleData);
return header;
}
diff --git a/bundles/org.eclipse.emf.ecp.view.treemasterdetail.ui.swt/src/org/eclipse/emf/ecp/view/spi/treemasterdetail/ui/swt/TreeMasterDetailSWTRenderer.java b/bundles/org.eclipse.emf.ecp.view.treemasterdetail.ui.swt/src/org/eclipse/emf/ecp/view/spi/treemasterdetail/ui/swt/TreeMasterDetailSWTRenderer.java
index 5e50782..c082790 100644
--- a/bundles/org.eclipse.emf.ecp.view.treemasterdetail.ui.swt/src/org/eclipse/emf/ecp/view/spi/treemasterdetail/ui/swt/TreeMasterDetailSWTRenderer.java
+++ b/bundles/org.eclipse.emf.ecp.view.treemasterdetail.ui.swt/src/org/eclipse/emf/ecp/view/spi/treemasterdetail/ui/swt/TreeMasterDetailSWTRenderer.java
@@ -529,9 +529,6 @@
}
}
- /**
- * @param form2
- */
private Composite getPageHeader(Composite parent) {
final Composite header = new Composite(parent, SWT.FILL);
final FormLayout layout = new FormLayout();
@@ -558,17 +555,16 @@
titleFont = new Font(title.getDisplay(), getDefaultFontName(title), 12, SWT.BOLD);
title.setFont(titleFont);
title.setForeground(getTitleColor(parent));
+ final int titleHeight = title.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
final FormData titleData = new FormData();
- title.setLayoutData(titleData);
titleData.left = new FormAttachment(titleImage, 5, SWT.DEFAULT);
+ titleData.top = new FormAttachment(50, -titleHeight / 2);
+ title.setLayoutData(titleData);
return header;
}
- /**
- * @return
- */
private Color getTitleColor(Composite parent) {
if (titleColor == null) {
titleColor = new Color(parent.getDisplay(), new RGB(25, 76, 127));
@@ -632,9 +628,6 @@
return control.getDisplay().getSystemFont().getFontData()[0].getName();
}
- /**
- *
- */
private List<Action> readToolbarActions(EObject modelElement, final EditingDomain editingDomain) {
final List<Action> actions = new ArrayList<Action>();
final IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
diff --git a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/EditorToolBar.java b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/EditorToolBar.java
index e952baa..830806a 100644
--- a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/EditorToolBar.java
+++ b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/EditorToolBar.java
@@ -81,8 +81,10 @@
title.setFont(boldFont);
title.setText(titleText);
final FormData titleData = new FormData();
- title.setLayoutData(titleData);
titleData.left = new FormAttachment(titleImage, 5, SWT.DEFAULT);
+ final int titleHeight = title.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
+ titleData.top = new FormAttachment(50, -titleHeight / 2);
+ title.setLayoutData(titleData);
// Create the toolbar and add it to the header
final ToolBar toolBar = new ToolBar(this, SWT.FLAT | SWT.RIGHT);