Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Delisle2016-06-30 10:55:13 -0400
committerLaurent Delaigue2016-09-12 10:59:24 -0400
commit10679ac6b633f8877a0ed83c2cfd6d44ed791cbc (patch)
tree012bee52659adeec0701f5206e621a565cb5b75a
parentae818ac53b9dc7429ec5cc5f501d71abdfe0d430 (diff)
downloadorg.eclipse.emf.compare-10679ac6b633f8877a0ed83c2cfd6d44ed791cbc.tar.gz
org.eclipse.emf.compare-10679ac6b633f8877a0ed83c2cfd6d44ed791cbc.tar.xz
org.eclipse.emf.compare-10679ac6b633f8877a0ed83c2cfd6d44ed791cbc.zip
[495753] Fix preference pages inconsistent layouts
Reworked the layout of all preference pages to be more consistent and scalable. Bug: 495753 Change-Id: I3257de5507df50de0b8c7f75a80b39871462e1ff Also-by: Laurent Delaigue <laurent.delaigue@obeo.fr> Signed-off-by: Simon Delisle <simon.delisle@ericsson.com> Signed-off-by: Laurent Delaigue <laurent.delaigue@obeo.fr>
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/plugin.xml3
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/preferences/ModelResolutionPreferencePage.java30
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/plugin.xml5
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/emfcomparercpuimessages.properties22
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/AdapterFactoriesPreferencePage.java23
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/EditorPreferencePage.java7
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/FiltersPreferencePage.java178
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/GroupsPreferencePage.java85
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/LoggingPreferencePage.java33
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/PostProcessorPreferencePage.java7
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/impl/GroupsInteractiveContent.java111
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/impl/InteractiveUIContent.java12
12 files changed, 262 insertions, 254 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/plugin.xml b/plugins/org.eclipse.emf.compare.ide.ui/plugin.xml
index 1b56feaae..210653643 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.compare.ide.ui/plugin.xml
@@ -12,6 +12,7 @@
Obeo - initial API and implementation
Stefan Dirix - bugs 456699, 474723
Michael Borkowski - bug 467191
+ Simon Delisle - bug 495753
-->
<plugin>
@@ -430,7 +431,7 @@
category="org.eclipse.emf.compare.rcp.ui.preferencePage.global"
class="org.eclipse.emf.compare.ide.ui.internal.preferences.ModelResolutionPreferencePage"
id="org.eclipse.emf.compare.ide.ui.preferencepage.resolvers"
- name="Resolution strategy">
+ name="Resolution Strategy">
</page>
<page
category="org.eclipse.emf.compare.rcp.ui.preferencePage.global"
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/preferences/ModelResolutionPreferencePage.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/preferences/ModelResolutionPreferencePage.java
index 475305636..4c581dd31 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/preferences/ModelResolutionPreferencePage.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/preferences/ModelResolutionPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Obeo.
+ * Copyright (c) 2014, 2016 Obeo and others.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Simon Delisle - bug 495753
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.preferences;
@@ -55,7 +56,9 @@ public class ModelResolutionPreferencePage extends FieldEditorPreferencePage imp
private Label resolutionScopeMainDescription;
- private Label resolutionScopeDescription;
+ private Label resolutionScopeDescriptionLabel;
+
+ private Composite resolutionScopeDescriptionComposite;
private Composite resolutionScopeComboComposite;
@@ -99,10 +102,15 @@ public class ModelResolutionPreferencePage extends FieldEditorPreferencePage imp
addField(resolutionScope);
resolutionScopeComboComposite.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- resolutionScopeDescription = new Label(resolutionScopeComposite, SWT.WRAP | SWT.BORDER);
- final GridData descriptionData = new GridData(SWT.FILL, SWT.FILL, true, false);
+ resolutionScopeDescriptionComposite = new Composite(resolutionScopeComposite, SWT.BORDER);
+ resolutionScopeDescriptionComposite.setLayout(new GridLayout(1, true));
+ GridData descriptionData = new GridData(SWT.FILL, SWT.FILL, true, false);
descriptionData.widthHint = 200;
- resolutionScopeDescription.setLayoutData(descriptionData);
+ resolutionScopeDescriptionComposite.setLayoutData(descriptionData);
+
+ resolutionScopeDescriptionLabel = new Label(resolutionScopeDescriptionComposite, SWT.WRAP);
+ GridData labelData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ resolutionScopeDescriptionLabel.setLayoutData(labelData);
updateFieldEnablement(
getPreferenceStore().getBoolean(EMFCompareUIPreferences.DISABLE_RESOLVERS_PREFERENCE));
@@ -124,7 +132,7 @@ public class ModelResolutionPreferencePage extends FieldEditorPreferencePage imp
useThreads.setEnabled(!disabled, getFieldEditorParent());
resolutionScopeMainDescription.setEnabled(!disabled);
resolutionScope.setEnabled(!disabled, resolutionScopeComboComposite);
- resolutionScopeDescription.setEnabled(!disabled);
+ resolutionScopeDescriptionComposite.setEnabled(!disabled);
}
private void updateScopeDescription(String scopeValue) {
@@ -136,24 +144,24 @@ public class ModelResolutionPreferencePage extends FieldEditorPreferencePage imp
}
switch (scope) {
case WORKSPACE:
- resolutionScopeDescription.setText(EMFCompareIDEUIMessages
+ resolutionScopeDescriptionLabel.setText(EMFCompareIDEUIMessages
.getString("ModelResolutionPreferencesPage.resolutionScope.workspace.description")); //$NON-NLS-1$
break;
case PROJECT:
- resolutionScopeDescription.setText(EMFCompareIDEUIMessages
+ resolutionScopeDescriptionLabel.setText(EMFCompareIDEUIMessages
.getString("ModelResolutionPreferencesPage.resolutionScope.project.description")); //$NON-NLS-1$
break;
case CONTAINER:
- resolutionScopeDescription.setText(EMFCompareIDEUIMessages
+ resolutionScopeDescriptionLabel.setText(EMFCompareIDEUIMessages
.getString("ModelResolutionPreferencesPage.resolutionScope.container.description")); //$NON-NLS-1$
break;
case OUTGOING:
- resolutionScopeDescription.setText(EMFCompareIDEUIMessages
+ resolutionScopeDescriptionLabel.setText(EMFCompareIDEUIMessages
.getString("ModelResolutionPreferencesPage.resolutionScope.outgoing.description")); //$NON-NLS-1$
break;
default:
// Shouldn't happen
- resolutionScopeDescription.setText(EMFCompareIDEUIMessages
+ resolutionScopeDescriptionLabel.setText(EMFCompareIDEUIMessages
.getString("ModelResolutionPreferencesPage.resolutionScope.invalid")); //$NON-NLS-1$
break;
}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/plugin.xml b/plugins/org.eclipse.emf.compare.rcp.ui/plugin.xml
index 41aca43c6..7331d4180 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/plugin.xml
@@ -2,7 +2,7 @@
<?eclipse version="3.4"?>
<!--
- Copyright (c) 2013, 2015 Obeo.
+ Copyright (c) 2013, 2015, 2016 Obeo and others..
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
@@ -10,6 +10,7 @@
Contributors:
Obeo - initial API and implementation
+ Simon Delisle - bug 495753
-->
<plugin>
@@ -227,7 +228,7 @@
category="org.eclipse.emf.compare.rcp.ui.preferencePage.global"
class="org.eclipse.emf.compare.rcp.ui.internal.preferences.AdapterFactoriesPreferencePage"
id="org.eclipse.emf.compare.rcp.ui.preferencePage.adapterfactories"
- name="Item providers">
+ name="Item Providers">
</page>
<page
category="org.eclipse.emf.compare.rcp.ui.preferencePage.global"
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/emfcomparercpuimessages.properties b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/emfcomparercpuimessages.properties
index b3a9e8014..fd77e3408 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/emfcomparercpuimessages.properties
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/emfcomparercpuimessages.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2013, 2016 Obeo.
+# Copyright (c) 2013, 2016 Obeo and others.
# 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
@@ -8,6 +8,7 @@
# Contributors:
# Obeo - initial API and implementation
# Philip Langer - bug 493921
+# Simon Delisle - bug 495753
################################################################################
## note : apostrophes need to be doubled in these messages or they'll be ignored
TableMergeViewer.directResourceContentsLabel = resource contents
@@ -19,9 +20,9 @@ SynchronizerDialog.hyperlink.message = <a>See EMF Compare preferences</a>
SynchronizerDialog.notAskAgain.label = Do not ask me again.
FilterActionMenu.tooltip = Filters
FilterAction.synchronization.dialog.title = Filters preference
-FilterAction.synchronization.dialog.message = Would you like to remember the filters selection for next comparison?
+FilterAction.synchronization.dialog.message = Would you like to remember the selected filters for next comparison?
GroupAction.synchronization.dialog.title = Group preference
-GroupAction.synchronization.dialog.message = Would you like to remember the group selection for next comparison?
+GroupAction.synchronization.dialog.message = Would you like to remember the selected group for next comparison?
GroupActionMenu.tooltip = Groups
@@ -36,8 +37,8 @@ ThreeWayComparisonGroupProvider.right.label = Right Side
BasicDifferenceGroup.name = Group
-InteractiveFilterUIContent.sync.behavior.group.label = Automatic behavior
-InteractiveFilterUIContent.sync.behavior.label = Synchronize current filter selection:
+InteractiveFilterUIContent.sync.behavior.group.label = Remember selected filters
+InteractiveFilterUIContent.sync.behavior.label = Remember user-selected filters in future comparisons:
# Messages for preference pages.
@@ -53,8 +54,8 @@ InteractiveUIContent.descriptionComposite.label = Description
InteractiveUIContent.incorrectSelection.title = Incorrect selection
InteractiveUIContent.incorrectSelection.message = At least one item has to be selected.
-GroupsInteractiveContent.SYNC_BEHAVIOR_GROUP_LABEL = Automatic behavior
-GroupsInteractiveContent.SYNC_BEHAVIOR_LABEL = Synchronize current group selection:
+GroupsInteractiveContent.SYNC_BEHAVIOR_GROUP_LABEL = Remember selected groups
+GroupsInteractiveContent.SYNC_BEHAVIOR_LABEL = Remember user-selected group in future comparisons:
GroupsInteractiveContent.ALWAYS_COMBO_LABEL = Always
GroupsInteractiveContent.NEVER_COMBO_LABEL = Never
GroupsInteractiveContent.ASK_EACH_TIME_LABEL = Ask each time
@@ -68,11 +69,11 @@ EditorPreferencePage.mainTab.label = Main
EditorPreferencePage.mainTab.colorHyperLink.label = See <a>''Color and Fonts''</a> preferences for EMF Compare colors.
FiltersPreferencePage.INTRO_SELECT_TEXT = Select the filters that should be enabled by default\:
-FiltersPreferencePage.activateIntro.text = Deactivating filters entirely prevents them from being applied and hides them from the list of available\n filters in the drop-down filter menu in the compare editor. If a filter is deactivated below, but enabled\n in the Enabled/Disabled tab, the filter will be deactivated and hidden.
+FiltersPreferencePage.activateIntro.text = Deactivating filters entirely prevents them from being applied and hides them from the list of available filters in the drop-down filter menu in the compare editor. If a filter is deactivated below, but enabled in the Enabled/Disabled tab, the filter will be deactivated and hidden.
FiltersPreferencePage.INTRO_DEACTIVATE_TEXT = Select the filters that should be active (the others will be completely ignored)\:
FiltersPreferencePage.activate.tab.label = Activate/Deactivate
FiltersPreferencePage.select.tab.label = Enable/Disable
-FiltersPreferencePage.selectIntro.text = You can configure whether filters should be enabled or disabled by default. You can still enable or\n disable them using the drop-down filter menu in the compare editor. Note that 'disabled' filters may\n still have an impact on the differences shown in the compare editor.
+FiltersPreferencePage.selectIntro.text = You can configure whether filters should be enabled or disabled by default. You can still enable or disable them using the drop-down filter menu in the compare editor. Note that 'disabled' filters may still have an impact on the differences shown in the compare editor.
EnginesPreferencePage.differenceEngine.tab.label = Difference
EnginesPreferencePage.equivalenceEngine.tab.label = Equivalence
@@ -85,8 +86,9 @@ EnginesPreferencePage.equiEngineIntro.text = Select the equivalence engine to us
EnginesPreferencePage.reqEngineIntro.text = Select the requirement engine to use:
EnginesPreferencePage.conflictDetectorIntro.text = Select the conflict detector to use:
-AdapterFactoryPreferencePage.itemProviderGroup.text = Item providers
+AdapterFactoryPreferencePage.itemProviderGroup.text = Item Providers
AdapterFactoryPreferencePage.descriptionGroup.text = Description
+AdapterFactoryPreferencePage.preferencePage.description = Select active item providers used in the comparison editor:
LoggingPreferencePage.preferencePage.description = Logging in EMFCompare
LoggingPreferencePage.log.level = Log level:
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/AdapterFactoriesPreferencePage.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/AdapterFactoriesPreferencePage.java
index 21f9f394a..fee8a93ce 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/AdapterFactoriesPreferencePage.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/AdapterFactoriesPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Obeo.
+ * Copyright (c) 2014, 2016 Obeo and others.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Simon Delisle - bug 495753
*******************************************************************************/
package org.eclipse.emf.compare.rcp.ui.internal.preferences;
@@ -27,6 +28,7 @@ import org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescr
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.rcp.internal.preferences.EMFComparePreferences;
import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareRCPUIMessages;
+import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
@@ -37,6 +39,7 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -76,12 +79,15 @@ public class AdapterFactoriesPreferencePage extends PreferencePage implements IW
@Override
protected Control createContents(Composite parent) {
Composite containerComposite = new Composite(parent, SWT.NONE);
- containerComposite.setLayout(new GridLayout(1, false));
+ GridLayoutFactory.fillDefaults().applyTo(containerComposite);
containerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ Label introductionLabel = new Label(containerComposite, SWT.WRAP);
+ introductionLabel.setText(
+ EMFCompareRCPUIMessages.getString("AdapterFactoryPreferencePage.preferencePage.description")); //$NON-NLS-1$
createViewer(containerComposite);
- createDescriptionText(parent);
+ createDescriptionText(containerComposite);
fillViewer();
@@ -99,6 +105,9 @@ public class AdapterFactoriesPreferencePage extends PreferencePage implements IW
});
adapterFactoryDescriptorViewer.setInput(descriptors);
+ if (!descriptors.isEmpty()) {
+ adapterFactoryDescriptorViewer.setSelection(new StructuredSelection(descriptors.get(0)), true);
+ }
List<String> disabledDescriptors = EMFComparePreferences.getDisabledAdapterFacotryDescriptorIds(
EMFCompareRCPPlugin.getDefault().getEMFComparePreferences());
@@ -146,13 +155,7 @@ public class AdapterFactoriesPreferencePage extends PreferencePage implements IW
}
private void createViewer(Composite containerComposite) {
- Group interactiveGroup = new Group(containerComposite, SWT.BORDER);
- interactiveGroup.setText(
- EMFCompareRCPUIMessages.getString("AdapterFactoryPreferencePage.itemProviderGroup.text")); //$NON-NLS-1$
- interactiveGroup.setLayout(new GridLayout(1, false));
- interactiveGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
-
- adapterFactoryDescriptorViewer = CheckboxTableViewer.newCheckList(interactiveGroup,
+ adapterFactoryDescriptorViewer = CheckboxTableViewer.newCheckList(containerComposite,
SWT.BORDER | SWT.V_SCROLL | SWT.FULL_SELECTION);
adapterFactoryDescriptorViewer.setContentProvider(ArrayContentProvider.getInstance());
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/EditorPreferencePage.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/EditorPreferencePage.java
index a360f0e97..fa95fc859 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/EditorPreferencePage.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/EditorPreferencePage.java
@@ -12,11 +12,11 @@ package org.eclipse.emf.compare.rcp.ui.internal.preferences;
import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareRCPUIMessages;
import org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.CompareColorImpl;
+import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.resource.ImageDescriptor;
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;
import org.eclipse.ui.IWorkbench;
@@ -48,8 +48,9 @@ public class EditorPreferencePage extends PreferencePage implements IWorkbenchPr
@Override
protected Control createContents(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- container.setLayout(new GridLayout(1, false));
+ Composite container = new Composite(parent, SWT.NONE);
+ GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(false).applyTo(container);
+
// Link to color tab
PreferenceLinkArea fileEditorsArea = new PreferenceLinkArea(container, SWT.NONE,
"org.eclipse.ui.preferencePages.ColorsAndFonts", //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/FiltersPreferencePage.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/FiltersPreferencePage.java
index 6cb20c08e..c38167856 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/FiltersPreferencePage.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/FiltersPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2016 Obeo.
+ * Copyright (c) 2014, 2016 Obeo and others.
* 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
@@ -7,9 +7,15 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Simon Delisle - bug 495753
*******************************************************************************/
package org.eclipse.emf.compare.rcp.ui.internal.preferences;
+import static org.eclipse.jface.dialogs.MessageDialogWithToggle.ALWAYS;
+import static org.eclipse.jface.dialogs.MessageDialogWithToggle.NEVER;
+import static org.eclipse.jface.dialogs.MessageDialogWithToggle.PROMPT;
+
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.collect.Sets.SetView;
@@ -34,6 +40,8 @@ import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.IDifferenceFi
import org.eclipse.jface.databinding.viewers.IViewerObservableSet;
import org.eclipse.jface.databinding.viewers.ViewersObservables;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CheckboxTableViewer;
@@ -47,13 +55,11 @@ import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TabFolder;
@@ -75,9 +81,11 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
/** Preference key holding synchronization behavior value. */
public static final String SYNCHRONIZATION_BEHAVIOR = "org.eclipse.emf.compare.rcp.ui.filters.syncbehavior"; //$NON-NLS-1$
+ /** Width hint for introduction label. */
+ private static final int INTRO_TEXT_WIDTH_HINT = 400;
+
/** Values used for the combobox. */
- private static final List<String> comboValues = Lists.newArrayList(MessageDialogWithToggle.ALWAYS,
- MessageDialogWithToggle.NEVER, MessageDialogWithToggle.PROMPT);
+ private static final List<String> SYNC_VALUES = ImmutableList.of(ALWAYS, NEVER, PROMPT);
/** Filter manager. Used to retrieve current and default configuration. */
private DifferenceFilterManager filterManager = null;
@@ -94,6 +102,12 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
/** The tab used to choose active filters. */
private Composite activateFilterTabComposite;
+ /** Combo holding synchronization behavior preferences. */
+ private Combo combo;
+
+ /** Field holding {@link SynchronizationBehavior} */
+ private String synchronizationBehaviorValue;
+
public void init(IWorkbench workbench) {
// Do not use InstanceScope.Instance to be compatible with Helios.
@SuppressWarnings("deprecation")
@@ -105,9 +119,15 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
@Override
protected Control createContents(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- container.setLayout(new FillLayout(SWT.HORIZONTAL));
+ Composite container = new Composite(parent, SWT.NONE);
+ GridLayoutFactory.fillDefaults().applyTo(container);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
+
+ createSynchronizationBehaviorContent(container);
+ setComboInput(getCurrentSynchronizationBehavior());
+
TabFolder tabFolder = new TabFolder(container, SWT.NONE);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(tabFolder);
// Create tab to choose filters that are enabled by default
createDefaultEnabledFilterTab(tabFolder);
@@ -130,7 +150,6 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
}
defaultFilterInteractiveContent = new InteractiveFilterUIContent(enabledFilterTabComposite,
filterManager.getAllFilters(), filterManager.getCurrentByDefaultFilters(), false);
- defaultFilterInteractiveContent.setComboInput(getCurrentSynchronizationBehavior());
}
/**
@@ -163,16 +182,62 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
tbtmMain.setText(tabLabel);
Composite tabComposite = new Composite(tabFolder, SWT.NONE);
tbtmMain.setControl(tabComposite);
- tabComposite.setLayout(new GridLayout(1, true));
+ GridLayout layout = new GridLayout(1, true);
+ tabComposite.setLayout(layout);
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
tabComposite.setLayoutData(layoutData);
// Description text
Label introductionText = new Label(tabComposite, SWT.WRAP);
+ GridDataFactory.fillDefaults().grab(true, false).hint(INTRO_TEXT_WIDTH_HINT, SWT.DEFAULT)
+ .applyTo(introductionText);
introductionText.setText(introText);
return tabComposite;
}
/**
+ * Content for synchronization behavior preferences.
+ *
+ * @param parent
+ */
+ private void createSynchronizationBehaviorContent(Composite parent) {
+ Composite synchronizationComposite = new Composite(parent, SWT.NONE);
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(synchronizationComposite);
+ Label label = new Label(synchronizationComposite, SWT.WRAP);
+ label.setText(EMFCompareRCPUIMessages.getString("InteractiveFilterUIContent.sync.behavior.label")); //$NON-NLS-1$
+ label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ combo = new Combo(synchronizationComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
+ for (String comboLabel : SYNC_VALUES) {
+ combo.add(comboLabel);
+ }
+ combo.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true));
+ combo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (combo.equals(e.getSource())) {
+ synchronizationBehaviorValue = combo.getItem(combo.getSelectionIndex());
+ }
+ }
+
+ });
+ }
+
+ /**
+ * Select the correct behavior in the interactive UI.
+ *
+ * @param behavior
+ */
+ public void setComboInput(String behavior) {
+ int index = 0;
+ for (String value : SYNC_VALUES) {
+ if (value.equals(behavior)) {
+ combo.select(index);
+ synchronizationBehaviorValue = behavior;
+ }
+ index++;
+ }
+ }
+
+ /**
* Gets the current value of the filter synchronization behavior.
* <p>
* This value can only be one of the following:
@@ -187,7 +252,7 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
*/
public String getCurrentSynchronizationBehavior() {
String value = getPreferenceStore().getString(SYNCHRONIZATION_BEHAVIOR);
- if (value == null || !comboValues.contains(value)) {
+ if (value == null || !SYNC_VALUES.contains(value)) {
value = getDefaultSynchronizationBehavior();
}
return value;
@@ -230,7 +295,7 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
public boolean performOk() {
filterManager.setCurrentByDefaultFilters(defaultFilterInteractiveContent.getCheckedFilter());
filterManager.setCurrentActiveFilters(activateFilterInteractiveContent.getCheckedFilter());
- setCurrentSynchronizationBehavior(defaultFilterInteractiveContent.getSynchronizationBehavior());
+ setCurrentSynchronizationBehavior(synchronizationBehaviorValue);
return super.performOk();
}
@@ -244,7 +309,7 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
}
if (enabledFilterTabComposite.isVisible()) {
defaultFilterInteractiveContent.checkElements(filterManager.getInitialByDefaultFilters());
- defaultFilterInteractiveContent.setComboInput(getDefaultSynchronizationBehavior());
+ setComboInput(getDefaultSynchronizationBehavior());
}
super.performDefaults();
}
@@ -256,6 +321,12 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
*/
private static class InteractiveFilterUIContent {
+ /** Height hint for the description label. */
+ private static final int DESCRIPTION_LABEL_HEIGHT_HINT = 50;
+
+ /** Width hint for configuration composite. */
+ private static final int DESCRIPTION_LABEL_WIDTH_HINT = 400;
+
/** Text that will be updated with the description of the viewer. */
private final Label descriptionText;
@@ -268,17 +339,11 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
/** DataHolder for activated/deactivated {@link IDifferenceFilter}. */
private FilterDataHolder allFilters = new FilterDataHolder();
- /** Combo holding synchronization behavior preferences. */
- private Combo combo;
-
- /** Field holding {@link SynchronizationBehavior} */
- private String synchronizationBehaviorValue;
-
private InteractiveFilterUIContent(Composite parent, Collection<? extends IDifferenceFilter> filters,
Collection<? extends IDifferenceFilter> defaultCheck, boolean isDeactivateTab) {
super();
- Composite contentComposite = new Composite(parent, SWT.BORDER);
- contentComposite.setLayout(new GridLayout(1, true));
+ Composite contentComposite = new Composite(parent, SWT.NONE);
+ GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 10, 0).applyTo(contentComposite);
contentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
Label introductionText = new Label(contentComposite, SWT.WRAP);
@@ -292,14 +357,12 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
introductionText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
// Engine chooser composite
Composite viewerComposite = new Composite(contentComposite, SWT.NONE);
- viewerComposite.setLayout(new GridLayout(1, true));
+ GridLayoutFactory.fillDefaults().applyTo(viewerComposite);
viewerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
viewer = createViewer(viewerComposite);
// Descriptor engine Text
this.descriptionText = createDescriptionComposite(contentComposite);
- if (!isDeactivateTab) {
- createSynchronizationBehaviorContent(parent);
- }
+
setViewerInput(Lists.newArrayList(filters));
if (isDeactivateTab) {
SetView<IDifferenceFilter> activatedFilters = Sets.difference(Sets.newLinkedHashSet(filters),
@@ -312,46 +375,6 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
}
/**
- * Content for synchronization behavior preferences.
- *
- * @param parent
- */
- private void createSynchronizationBehaviorContent(Composite parent) {
- Group synchronizationGroup = new Group(parent, SWT.NONE);
- GridData layoutData = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
- GridLayout layout = new GridLayout(2, false);
- synchronizationGroup.setLayout(layout);
- synchronizationGroup.setLayoutData(layoutData);
- synchronizationGroup.setText(EMFCompareRCPUIMessages
- .getString("InteractiveFilterUIContent.sync.behavior.group.label")); //$NON-NLS-1$
- Label label = new Label(synchronizationGroup, SWT.WRAP);
- label.setText(
- EMFCompareRCPUIMessages.getString("InteractiveFilterUIContent.sync.behavior.label")); //$NON-NLS-1$
- label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- combo = new Combo(synchronizationGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
- for (String comboLabel : comboValues) {
- combo.add(comboLabel);
- }
- combo.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true));
- combo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (combo.equals(e.getSource())) {
- synchronizationBehaviorValue = combo.getItem(combo.getSelectionIndex());
- }
- }
-
- });
- }
-
- /**
- * @return The state of the group synchronization behavior field.
- */
- public String getSynchronizationBehavior() {
- return synchronizationBehaviorValue;
- }
-
- /**
* @return All checked {@link IDifferenceFilter}.
*/
public Set<IDifferenceFilter> getCheckedFilter() {
@@ -437,15 +460,12 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
Group descriptionComposite = new Group(composite, SWT.NONE);
descriptionComposite.setText(
EMFCompareRCPUIMessages.getString("InteractiveUIContent.descriptionComposite.label")); //$NON-NLS-1$
- descriptionComposite.setLayout(new GridLayout(1, false));
+ GridLayoutFactory.swtDefaults().applyTo(descriptionComposite);
descriptionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
Label engineDescriptionLabel = new Label(descriptionComposite, SWT.WRAP);
- engineDescriptionLabel
- .setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
- layoutData.widthHint = 400;
- layoutData.heightHint = 50;
- engineDescriptionLabel.setLayoutData(layoutData);
+ GridDataFactory.fillDefaults().grab(true, false)
+ .hint(DESCRIPTION_LABEL_WIDTH_HINT, DESCRIPTION_LABEL_HEIGHT_HINT)
+ .applyTo(engineDescriptionLabel);
return engineDescriptionLabel;
}
@@ -476,22 +496,6 @@ public class FiltersPreferencePage extends PreferencePage implements IWorkbenchP
}
/**
- * Select the correct behavior in the interactive UI.
- *
- * @param behavior
- */
- public void setComboInput(String behavior) {
- int index = 0;
- for (String value : comboValues) {
- if (value.equals(behavior)) {
- combo.select(index);
- synchronizationBehaviorValue = behavior;
- }
- index++;
- }
- }
-
- /**
* Listener to update description text
*
* @author <a href="mailto:arthur.daussy@obeo.fr">Arthur Daussy</a>
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/GroupsPreferencePage.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/GroupsPreferencePage.java
index 94c608cb5..e4fa48457 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/GroupsPreferencePage.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/GroupsPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Obeo.
+ * Copyright (c) 2014, 2016 Obeo and others.
* 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
@@ -7,11 +7,16 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Simon Delisle - bug 495753
*******************************************************************************/
package org.eclipse.emf.compare.rcp.ui.internal.preferences;
+import static org.eclipse.jface.dialogs.MessageDialogWithToggle.ALWAYS;
+import static org.eclipse.jface.dialogs.MessageDialogWithToggle.NEVER;
+import static org.eclipse.jface.dialogs.MessageDialogWithToggle.PROMPT;
+
import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
+import com.google.common.collect.ImmutableList;
import java.util.List;
@@ -27,12 +32,16 @@ import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroupProvider;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroupProvider.Descriptor;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ListViewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
@@ -56,8 +65,7 @@ public class GroupsPreferencePage extends PreferencePage implements IWorkbenchPr
private static final String SYNC_DEFAULT_VALUE = MessageDialogWithToggle.PROMPT;
/** List of all available values possible for synchronization behavior. */
- private static final List<String> SYNC_VALUES = Lists.newArrayList(MessageDialogWithToggle.ALWAYS,
- MessageDialogWithToggle.NEVER, MessageDialogWithToggle.PROMPT);
+ private static final List<String> SYNC_VALUES = ImmutableList.of(ALWAYS, NEVER, PROMPT);
/** Synchronization behavior for group 2 way comparison capable. */
private static final String TWO_WAY_COMPARISON_SYNC_BEHAVIOR = "org.eclipse.emf.compare.rcp.ui.groups.2way.syncbehavior"; //$NON-NLS-1$
@@ -65,6 +73,12 @@ public class GroupsPreferencePage extends PreferencePage implements IWorkbenchPr
/** Synchronization behavior for group 3 way comparison capable. */
private static final String THREE_WAY_COMPARISON_SYNC_BEHAVIOR = "org.eclipse.emf.compare.rcp.ui.groups.3ways.syncbehavior"; //$NON-NLS-1$
+ /** Combo holding syncrhonization behavior preferences. */
+ private Combo combo;
+
+ /** Field holding the synchronization behavior chosen by the user. */
+ private String synchronizationBehaviorValue;
+
/** UI content for two way comparison tab. */
private GroupsInteractiveContent twoWayComparisonContent;
@@ -105,10 +119,11 @@ public class GroupsPreferencePage extends PreferencePage implements IWorkbenchPr
@Override
protected Control createContents(Composite parent) {
- parent.setLayout(new GridLayout(1, true));
- Composite container = new Composite(parent, SWT.NONE);
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayoutFactory.fillDefaults().applyTo(container);
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- container.setLayout(new GridLayout(1, true));
+
+ createSynchronizationBehaviorContent(container);
TabFolder tabFolder = new TabFolder(container, SWT.NONE);
tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
@@ -133,7 +148,7 @@ public class GroupsPreferencePage extends PreferencePage implements IWorkbenchPr
twoWayComparisonContent = createInteractiveContent(tabSkeletonComposite, currentGroupRanking,
currentGroupRanking.get(0));
- twoWayComparisonContent.setComboInput(getCurrentSynchronizationBehavior(false));
+ setComboInput(getCurrentSynchronizationBehavior(false));
}
/**
@@ -150,7 +165,7 @@ public class GroupsPreferencePage extends PreferencePage implements IWorkbenchPr
List<IItemDescriptor<Descriptor>> currentGroupRanking = groupManager.getCurrentGroupRanking(true);
threeWayComparisonContent = createInteractiveContent(tabSkeletonComposite, currentGroupRanking,
currentGroupRanking.get(0));
- threeWayComparisonContent.setComboInput(getCurrentSynchronizationBehavior(true));
+ setComboInput(getCurrentSynchronizationBehavior(true));
}
/**
@@ -198,9 +213,6 @@ public class GroupsPreferencePage extends PreferencePage implements IWorkbenchPr
tabComposite.setLayout(new GridLayout(1, true));
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
tabComposite.setLayoutData(layoutData);
- // Description text
- Label introductionText = new Label(tabComposite, SWT.WRAP);
- introductionText.setText(introText);
return tabComposite;
}
@@ -220,13 +232,56 @@ public class GroupsPreferencePage extends PreferencePage implements IWorkbenchPr
descriptorViewer.getControl().setLayoutData(gd);
}
+ /**
+ * Content for synchronization behavior preferences.
+ *
+ * @param parent
+ * Main composite.
+ */
+ private void createSynchronizationBehaviorContent(Composite parent) {
+ Composite synchronizationComposite = new Composite(parent, SWT.NONE);
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(synchronizationComposite);
+ Label label = new Label(synchronizationComposite, SWT.WRAP);
+ label.setText(EMFCompareRCPUIMessages.getString("GroupsInteractiveContent.SYNC_BEHAVIOR_LABEL")); //$NON-NLS-1$
+ label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ combo = new Combo(synchronizationComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
+ for (String comboLabel : SYNC_VALUES) {
+ combo.add(comboLabel);
+ }
+ combo.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true));
+ combo.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (combo.equals(e.getSource())) {
+ synchronizationBehaviorValue = SYNC_VALUES.get(combo.getSelectionIndex());
+ }
+ }
+
+ });
+ }
+
+ /**
+ * Sets the combo to the given synchronization behavior.
+ *
+ * @param behavior
+ * Input.
+ */
+ public void setComboInput(String behavior) {
+ int index = SYNC_VALUES.indexOf(behavior);
+ if (index != -1) {
+ combo.select(index);
+ synchronizationBehaviorValue = behavior;
+ }
+ }
+
@Override
public boolean performOk() {
groupManager.setCurrentGroupRanking(twoWayComparisonContent.getOrderedItems(), false);
- setCurrentSynchronizationBehavior(twoWayComparisonContent.getSynchronizationBehavior(), false);
+ setCurrentSynchronizationBehavior(synchronizationBehaviorValue, false);
groupManager.setCurrentGroupRanking(threeWayComparisonContent.getOrderedItems(), true);
- setCurrentSynchronizationBehavior(threeWayComparisonContent.getSynchronizationBehavior(), true);
+ setCurrentSynchronizationBehavior(synchronizationBehaviorValue, true);
return super.performOk();
}
@@ -253,7 +308,7 @@ public class GroupsPreferencePage extends PreferencePage implements IWorkbenchPr
*/
private void resetGroupPreference(boolean isThreeWay, GroupsInteractiveContent interactiveContent) {
interactiveContent.setViewerInput(groupManager.getDefaultRankingConfiguration(isThreeWay));
- interactiveContent.setComboInput(SYNC_DEFAULT_VALUE);
+ setComboInput(SYNC_DEFAULT_VALUE);
}
/**
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/LoggingPreferencePage.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/LoggingPreferencePage.java
index 44615cd7a..33237038b 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/LoggingPreferencePage.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/LoggingPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 Obeo.
+ * Copyright (c) 2015, 2016 Obeo and others.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Simon Delisle - bug 495753
*******************************************************************************/
package org.eclipse.emf.compare.rcp.ui.internal.preferences;
@@ -25,6 +26,7 @@ import java.util.Arrays;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareRCPUIMessages;
+import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
@@ -33,13 +35,11 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
@@ -101,21 +101,20 @@ public class LoggingPreferencePage extends PreferencePage implements IWorkbenchP
@Override
protected Control createContents(Composite parent) {
- Group group = new Group(parent, SWT.NULL);
- group.setLayout(new GridLayout(3, false));
- group.setText(EMFCompareRCPUIMessages.getString("LoggingPreferencePage.preferencePage.description")); //$NON-NLS-1$
+ Composite loggingComposite = new Composite(parent, SWT.NONE);
+ GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).applyTo(loggingComposite);
- new Label(group, SWT.LEAD)
+ new Label(loggingComposite, SWT.LEAD)
.setText(EMFCompareRCPUIMessages.getString("LoggingPreferencePage.log.level")); //$NON-NLS-1$
- levelCombo = new Combo(group, SWT.DROP_DOWN);
+ levelCombo = new Combo(loggingComposite, SWT.DROP_DOWN);
levelCombo.setItems(LOG_LEVELS);
- levelCombo.setLayoutData(getDefaultFieldGridData(40));
+ levelCombo.setLayoutData(getDefaultFieldGridData(100));
- Label fileLabel = new Label(group, SWT.LEAD);
+ Label fileLabel = new Label(loggingComposite, SWT.LEAD);
fileLabel.setText(EMFCompareRCPUIMessages.getString("LoggingPreferencePage.log.file")); //$NON-NLS-1$
- fileField = new Text(group, SWT.BORDER | SWT.SINGLE);
+ fileField = new Text(loggingComposite, SWT.BORDER | SWT.SINGLE);
fileField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- Button fileButton = new Button(group, SWT.PUSH);
+ Button fileButton = new Button(loggingComposite, SWT.PUSH);
fileButton.setText(EMFCompareRCPUIMessages.getString("LoggingPreferencePage.filebutton.label")); //$NON-NLS-1$
fileButton.addSelectionListener(new SelectionAdapter() {
@Override
@@ -131,21 +130,21 @@ public class LoggingPreferencePage extends PreferencePage implements IWorkbenchP
}
});
- Label maxSizeLabel = new Label(group, SWT.LEAD);
+ Label maxSizeLabel = new Label(loggingComposite, SWT.LEAD);
maxSizeLabel.setText(EMFCompareRCPUIMessages.getString("LoggingPreferencePage.log.file.size")); //$NON-NLS-1$
- maxSizeField = new Text(group, SWT.BORDER | SWT.SINGLE);
+ maxSizeField = new Text(loggingComposite, SWT.BORDER | SWT.SINGLE);
maxSizeField.setLayoutData(getDefaultFieldGridData(80));
maxSizeField.addVerifyListener(new VerifyIntegerListener());
- Label maxBackupLabel = new Label(group, SWT.LEAD);
+ Label maxBackupLabel = new Label(loggingComposite, SWT.LEAD);
maxBackupLabel.setText(EMFCompareRCPUIMessages.getString("LoggingPreferencePage.log.backup.count")); //$NON-NLS-1$
- maxBackupField = new Text(group, SWT.BORDER | SWT.SINGLE);
+ maxBackupField = new Text(loggingComposite, SWT.BORDER | SWT.SINGLE);
maxBackupField.setLayoutData(getDefaultFieldGridData(80));
maxBackupField.addVerifyListener(new VerifyIntegerListener());
refreshWidgets();
- return group;
+ return loggingComposite;
}
protected GridData getDefaultFieldGridData(int width) {
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/PostProcessorPreferencePage.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/PostProcessorPreferencePage.java
index 48a3efb77..19ebe1dc5 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/PostProcessorPreferencePage.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/PostProcessorPreferencePage.java
@@ -31,10 +31,10 @@ import org.eclipse.emf.compare.rcp.internal.tracer.TracingConstant;
import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareRCPUIMessages;
import org.eclipse.emf.compare.rcp.ui.internal.preferences.impl.InteractiveUIContent;
import org.eclipse.emf.compare.rcp.ui.internal.preferences.impl.InteractiveUIContent.InteractiveUIBuilder;
+import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
@@ -97,8 +97,9 @@ public class PostProcessorPreferencePage extends PreferencePage implements IWork
@Override
protected Control createContents(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- container.setLayout(new GridLayout(1, true));
+ Composite container = new Composite(parent, SWT.NONE);
+ GridLayoutFactory.fillDefaults().equalWidth(true).applyTo(container);
+ // container.setLayout(new GridLayout(1, true));
Label introductionText = new Label(container, SWT.WRAP);
introductionText.setText(
EMFCompareRCPUIMessages.getString("PostProcessorPreferencePage.preferencePage.description")); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/impl/GroupsInteractiveContent.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/impl/GroupsInteractiveContent.java
index 0213d4062..f9a23ae1c 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/impl/GroupsInteractiveContent.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/impl/GroupsInteractiveContent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Obeo.
+ * Copyright (c) 2014, 2016 Obeo and others.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Simon Delisle - bug 495753
*******************************************************************************/
package org.eclipse.emf.compare.rcp.ui.internal.preferences.impl;
@@ -21,7 +22,8 @@ import org.eclipse.emf.compare.rcp.ui.EMFCompareRCPUIPlugin;
import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareRCPUIMessages;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroupProvider;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroupProvider.Descriptor;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -32,12 +34,9 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
@@ -49,7 +48,7 @@ import org.eclipse.swt.widgets.Label;
public class GroupsInteractiveContent {
/** Height hint for the description label. */
- private static final int DESCRIPTION_LABEL_HEIGHT_HINT = 50;
+ private static final int DESCRIPTION_LABEL_HEIGHT_HINT = 40;
/** Width hint for configuration composite. */
private static final int DESCRIPTION_LABEL_WIDTH_HINT = 400;
@@ -60,22 +59,12 @@ public class GroupsInteractiveContent {
/** Up icon picture. */
private static final String ENABLE_UP_IMG = "icons/full/pref16/up.gif"; //$NON-NLS-1$
- /** Combo values. */
- private static final List<String> COMBO_VALUES = Lists.newArrayList(MessageDialogWithToggle.ALWAYS,
- MessageDialogWithToggle.NEVER, MessageDialogWithToggle.PROMPT);
-
- /** Combo holding syncrhonization behavior preferences. */
- private Combo combo;
-
/** Label that will display the viewer's description. */
- private final Label descriptionLabel;
+ private final Label descriptionText;
/** List of descriptors. */
private ArrayList<IItemDescriptor<IDifferenceGroupProvider.Descriptor>> descriptors;
- /** Field holding the synchronization behavior chosen by the user. */
- private String synchronizationBehaviorValue;
-
/** Button to decrease the rank of a item. */
private Button downButton;
@@ -97,55 +86,24 @@ public class GroupsInteractiveContent {
public GroupsInteractiveContent(Composite parent) {
super();
Composite containerComposite = new Composite(parent, SWT.NONE);
- containerComposite.setLayout(new GridLayout(1, false));
+ GridLayoutFactory.fillDefaults().applyTo(containerComposite);
containerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- Composite interactiveComposite = new Composite(containerComposite, SWT.BORDER);
- interactiveComposite.setLayout(new GridLayout(2, false));
+ Composite interactiveComposite = new Composite(containerComposite, SWT.NONE);
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(interactiveComposite);
interactiveComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ Label introductionText = new Label(interactiveComposite, SWT.WRAP);
+ introductionText
+ .setText(EMFCompareRCPUIMessages.getString("GroupsPreferencePage.viewerDescription.label")); //$NON-NLS-1$
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(introductionText);
// Engine chooser composite
this.viewerCompsite = new Composite(interactiveComposite, SWT.NONE);
- viewerCompsite.setLayout(new GridLayout(1, true));
+ GridLayoutFactory.fillDefaults().applyTo(viewerCompsite);
viewerCompsite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
// Descriptor engine Label
createButtonComposite(interactiveComposite);
- this.descriptionLabel = createDescriptionComposite(interactiveComposite);
- createSynchronizationBehaviorContent(containerComposite);
- }
-
- /**
- * Content for synchronization behavior preferences.
- *
- * @param parent
- * Main composite.
- */
- private void createSynchronizationBehaviorContent(Composite parent) {
- Group synchronizationGroup = new Group(parent, SWT.NONE);
- GridData layoutData = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
- GridLayout layout = new GridLayout(2, false);
- synchronizationGroup.setLayout(layout);
- synchronizationGroup.setLayoutData(layoutData);
- synchronizationGroup.setText(
- EMFCompareRCPUIMessages.getString("GroupsInteractiveContent.SYNC_BEHAVIOR_GROUP_LABEL")); //$NON-NLS-1$
- Label label = new Label(synchronizationGroup, SWT.WRAP);
- label.setText(EMFCompareRCPUIMessages.getString("GroupsInteractiveContent.SYNC_BEHAVIOR_LABEL")); //$NON-NLS-1$
- label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- combo = new Combo(synchronizationGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
- for (String comboLabel : COMBO_VALUES) {
- combo.add(comboLabel);
- }
- combo.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true));
- combo.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (combo.equals(e.getSource())) {
- synchronizationBehaviorValue = COMBO_VALUES.get(combo.getSelectionIndex());
- }
- }
-
- });
+ this.descriptionText = createDescriptionComposite(interactiveComposite);
}
/**
@@ -213,28 +171,17 @@ public class GroupsInteractiveContent {
Group descriptionComposite = new Group(composite, SWT.NONE);
descriptionComposite.setText(
EMFCompareRCPUIMessages.getString("InteractiveUIContent.descriptionComposite.label")); //$NON-NLS-1$
- descriptionComposite.setLayout(new GridLayout(1, false));
+ GridLayoutFactory.swtDefaults().applyTo(descriptionComposite);
descriptionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
+
Label engineDescriptionLabel = new Label(descriptionComposite, SWT.WRAP);
- engineDescriptionLabel
- .setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
- layoutData.heightHint = DESCRIPTION_LABEL_HEIGHT_HINT;
- layoutData.widthHint = DESCRIPTION_LABEL_WIDTH_HINT;
- engineDescriptionLabel.setLayoutData(layoutData);
+ GridDataFactory.fillDefaults().grab(true, false)
+ .hint(DESCRIPTION_LABEL_WIDTH_HINT, DESCRIPTION_LABEL_HEIGHT_HINT)
+ .applyTo(engineDescriptionLabel);
return engineDescriptionLabel;
}
/**
- * Get Synchronization behavior.
- *
- * @return The state of the group synchronization behavior field.
- */
- public String getSynchronizationBehavior() {
- return synchronizationBehaviorValue;
- }
-
- /**
* Gets the current selected descriptor.
*
* @return current selected descriptor.
@@ -327,20 +274,6 @@ public class GroupsInteractiveContent {
}
/**
- * Sets the combo to the given synchronization behavior.
- *
- * @param behavior
- * Input.
- */
- public void setComboInput(String behavior) {
- int index = COMBO_VALUES.indexOf(behavior);
- if (index != -1) {
- combo.select(index);
- synchronizationBehaviorValue = behavior;
- }
- }
-
- /**
* Set the viewer.
*
* @param inputViewer
@@ -373,7 +306,7 @@ public class GroupsInteractiveContent {
*/
private void updateLinkedElements(IItemDescriptor<IDifferenceGroupProvider.Descriptor> descriptor) {
// Update description
- descriptionLabel.setText(descriptor.getDescription());
+ descriptionText.setText(descriptor.getDescription());
}
/**
@@ -394,7 +327,7 @@ public class GroupsInteractiveContent {
if (selected instanceof IItemDescriptor<?>) {
IItemDescriptor<?> desc = (IItemDescriptor<?>)selected;
String description = desc.getDescription();
- descriptionLabel.setText(description);
+ descriptionText.setText(description);
}
}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/impl/InteractiveUIContent.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/impl/InteractiveUIContent.java
index 55af71306..dfd4e44f8 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/impl/InteractiveUIContent.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/preferences/impl/InteractiveUIContent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Obeo.
+ * Copyright (c) 2014, 2016 Obeo and others.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Simon Delisle - bug 495753
*******************************************************************************/
package org.eclipse.emf.compare.rcp.ui.internal.preferences.impl;
@@ -32,6 +33,7 @@ import org.eclipse.emf.compare.rcp.ui.internal.preferences.DataHolder;
import org.eclipse.jface.databinding.viewers.IViewerObservableSet;
import org.eclipse.jface.databinding.viewers.ViewersObservables;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
@@ -120,11 +122,11 @@ public final class InteractiveUIContent {
} else {
numberOfColumns = 1;
}
- contentComposite.setLayout(new GridLayout(numberOfColumns, false));
+ GridLayoutFactory.fillDefaults().numColumns(numberOfColumns).applyTo(contentComposite);
contentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
// Engine chooser composite
this.viewerCompsite = new Composite(contentComposite, SWT.NONE);
- viewerCompsite.setLayout(new GridLayout(1, true));
+ GridLayoutFactory.fillDefaults().applyTo(viewerCompsite);
viewerCompsite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
if (hasConfiguration) {
// Config composite
@@ -197,7 +199,7 @@ public final class InteractiveUIContent {
EMFCompareRCPUIMessages.getString("InteractiveUIContent.configurationComposite.label")); //$NON-NLS-1$
StackLayout layout = new StackLayout();
layout.marginHeight = 10;
- layout.marginWidth = 10;
+ layout.marginWidth = 5;
confComposite.setLayout(layout);
GridData layoutData = new GridData(SWT.BEGINNING, SWT.FILL, false, true);
layoutData.widthHint = WIDTH_HINT_CONFIG_COMPOSITE;
@@ -220,8 +222,6 @@ public final class InteractiveUIContent {
descriptionComposite.setLayout(new GridLayout(1, false));
descriptionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
Label engineDescriptionLabel = new Label(descriptionComposite, SWT.WRAP);
- engineDescriptionLabel
- .setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
layoutData.heightHint = DESCRIPTION_COMPOSITE_HEIGHT_HINT;
layoutData.widthHint = DESCRIPTION_COMPOSITE_WIDTH_HINT;

Back to the top