Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2016-10-05 09:17:53 +0000
committerGerrit Code Review @ Eclipse.org2016-10-06 13:56:17 +0000
commit721ef7d021121732a8ec45f5df6daab3ee4abce7 (patch)
tree7ab854b9bd66aae72bfc762bc810d2e63588cb5d /plugins
parentc9fe1f3aca27974c66c4818306cf9ab104ebe45a (diff)
downloadorg.eclipse.papyrus-721ef7d021121732a8ec45f5df6daab3ee4abce7.tar.gz
org.eclipse.papyrus-721ef7d021121732a8ec45f5df6daab3ee4abce7.tar.xz
org.eclipse.papyrus-721ef7d021121732a8ec45f5df6daab3ee4abce7.zip
Bug 503038 - [Model Explorer] The validation of search field should be
improved. https://bugs.eclipse.org/bugs/show_bug.cgi?id=503038 - Add new Model explorer preference for filter field validation: -Live validataion -delay field(ms) -Some refactor to clean Model explorer Preferences. Change-Id: Icead28b694eaed6b5d7c7cad7caac94e9e6e9170 Signed-off-by: Mickael ADAM <mickael.adam@ALL4TEC.net>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StringWithClearEditor.java3
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF1
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml5
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Messages.java3
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java49
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/messages.properties5
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/FilterFieldPreferencesGroup.java115
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/FilterPreferenceInitializer.java40
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/IFilterPreferenceConstants.java32
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/ModelExplorerPreferencePage.java54
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/NavigatorPreferencePage.java68
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/TransformCommandShowPopupDialogGroup.java8
12 files changed, 297 insertions, 86 deletions
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StringWithClearEditor.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StringWithClearEditor.java
index abb3851b81d..c30e8eea1dc 100644
--- a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StringWithClearEditor.java
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StringWithClearEditor.java
@@ -106,7 +106,7 @@ public class StringWithClearEditor extends AbstractValueEditor implements KeyLis
final Composite filterComposite = new Composite(this, style);
filterComposite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- // Initialise the layout of the filter composite to display the widgets on 2 columns
+ // Initialize the layout of the filter composite to display the widgets on 2 columns
final GridLayout filterLayout = new GridLayout(2, false);
filterLayout.marginHeight = 0;
filterLayout.marginWidth = 0;
@@ -131,6 +131,7 @@ public class StringWithClearEditor extends AbstractValueEditor implements KeyLis
@Override
public void mouseUp(MouseEvent e) {
text.setText(EMPTY);
+ notifyChange();
}
});
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF
index a121486cbab..303731cc0ea 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF
@@ -17,7 +17,6 @@ Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)";visibili
org.eclipse.emf.workspace.ui;bundle-version="[1.3.0,2.0.0)",
org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[1.2.0,2.0.0)",
org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.services.semantic;bundle-version="[1.2.0,2.0.0)",
org.eclipse.papyrus.infra.services.navigation;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml
index 81b373de3a2..daf647e2b17 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/plugin.xml
@@ -300,9 +300,12 @@
<extension point="org.eclipse.core.runtime.preferences">
<?gmfgen generated="false"?>
<initializer class="org.eclipse.papyrus.views.modelexplorer.preferences.NavigatorPreferenceInitializer"/>
+ <initializer
+ class="org.eclipse.papyrus.views.modelexplorer.preferences.FilterPreferenceInitializer">
+ </initializer>
</extension>
<extension point="org.eclipse.ui.preferencePages">
- <page category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory" class="org.eclipse.papyrus.views.modelexplorer.preferences.NavigatorPreferencePage" id="org.eclipse.papyrus.views.modelexplorer.preferences.NavigatorPreferencePage" name="Papyrus Model Explorer">
+ <page category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory" class="org.eclipse.papyrus.views.modelexplorer.preferences.ModelExplorerPreferencePage" id="org.eclipse.papyrus.views.modelexplorer.preferences.NavigatorPreferencePage" name="Model Explorer">
</page>
</extension>
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Messages.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Messages.java
index d1a64ce9bca..d71f4a8788d 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Messages.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Messages.java
@@ -16,6 +16,9 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.papyrus.views.modelexplorer.messages"; //$NON-NLS-1$
+ public static String FilterFieldPreferencesGroup_groupTitle;
+ public static String FilterFieldPreferencesGroup_UseValidationPreferenceLabel;
+ public static String FilterFieldPreferencesGroup_ValidationDelayPreferenceLabel;
public static String ModelExplorerView_CaseSensitiveCheckBoxLabel;
public static String ModelExplorerView_CaseSensitiveCheckBoxTooltip;
public static String ModelExplorerView_SearchTextFieldTooltip;
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
index e38c09b274d..c9043908651 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
@@ -91,12 +91,13 @@ import org.eclipse.papyrus.views.modelexplorer.matching.IMatchingItem;
import org.eclipse.papyrus.views.modelexplorer.matching.LinkItemMatchingItem;
import org.eclipse.papyrus.views.modelexplorer.matching.ModelElementItemMatchingItem;
import org.eclipse.papyrus.views.modelexplorer.matching.ReferencableMatchingItem;
+import org.eclipse.papyrus.views.modelexplorer.preferences.IFilterPreferenceConstants;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.SelectionAdapter;
@@ -637,24 +638,21 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
// Set the viewerFilter
viewerFilter = new PatternViewerFilter();
getCommonViewer().setFilters(viewerFilter);
+ viewerFilter.setPattern("*");//$NON-NLS-1$
// Create the filter composite
final StringWithClearEditor filterText = new StringWithClearEditor(filterComposite, SWT.BORDER);
filterText.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
filterText.setValue("");//$NON-NLS-1$
filterText.setToolTipText(Messages.ModelExplorerView_SearchTextFieldTooltip);
- filterText.getText().addModifyListener(new ModifyListener() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void modifyText(final ModifyEvent e) {
- viewerFilter.setPattern(filterText.getValue());
- getCommonViewer().refresh();
- }
+ filterText.addCommitListener(event -> {
+ viewerFilter.setPattern(filterText.getValue());
+ getCommonViewer().refresh();
});
+ filterText.setValidateOnDelay(getValidationDelay());
+ filterText.setValidateOnDelay(isFilterValidateOnDelay());
+
// Key listener to focus in the treeviewer when presser arrow up key
filterText.getText().addKeyListener(new KeyAdapter() {
@@ -683,6 +681,33 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
}
});
+ filterText.getText().addFocusListener(new FocusAdapter() {
+ /**
+ * {@inhiriteDoc}
+ *
+ * @see java.awt.event.FocusAdapter#focusGained(java.awt.event.FocusEvent)
+ */
+ @Override
+ public void focusGained(final FocusEvent e) {
+ filterText.setValidateOnDelay(getValidationDelay());
+ filterText.setValidateOnDelay(isFilterValidateOnDelay());
+ }
+ });
+
+ }
+
+ /**
+ * Gets the preferences for the validation kind of filter field.
+ */
+ private boolean isFilterValidateOnDelay() {
+ return Activator.getDefault().getPreferenceStore().getBoolean(IFilterPreferenceConstants.PREF_FILTER_LIVE_VALIDATION);
+ }
+
+ /**
+ * Gets the preferences for the validation delay.
+ */
+ private int getValidationDelay() {
+ return Activator.getDefault().getPreferenceStore().getInt(IFilterPreferenceConstants.PREF_FILTER_VALIDATION_DELAY);
}
@Override
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/messages.properties b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/messages.properties
index 8d0e6669ac8..a72b6f7376d 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/messages.properties
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/messages.properties
@@ -11,7 +11,10 @@
# Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
#
########################################################################################
-ModelExplorerView_CaseSensitiveCheckBoxLabel=Case Sensitive
+FilterFieldPreferencesGroup_groupTitle=Filter field
+FilterFieldPreferencesGroup_UseValidationPreferenceLabel=Use live validation
+FilterFieldPreferencesGroup_ValidationDelayPreferenceLabel=Validation delay(ms)
+ModelExplorerView_CaseSensitiveCheckBoxLabel=Aa
MoDiscoLabelProvider_ProxyLabel=Unreachable {0} in {1}
ModelExplorerView_CaseSensitiveCheckBoxTooltip=The Search is Case Sensitive if Selected
ModelExplorerView_SearchTextFieldTooltip=Enter the Name of the Elements you Looking for. You can use * as a Wildcard
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/FilterFieldPreferencesGroup.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/FilterFieldPreferencesGroup.java
new file mode 100644
index 00000000000..ef80cc46954
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/FilterFieldPreferencesGroup.java
@@ -0,0 +1,115 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST, ALL4TEC 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.views.modelexplorer.preferences;
+
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.papyrus.infra.ui.preferences.AbstractPreferenceGroup;
+import org.eclipse.papyrus.views.modelexplorer.Activator;
+import org.eclipse.papyrus.views.modelexplorer.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+
+/**
+ * Preference group for model explorer Search Field.
+ */
+public class FilterFieldPreferencesGroup extends AbstractPreferenceGroup {
+
+ /** The property change listener on validation delay field. */
+ private IPropertyChangeListener listener = event -> refreshDelayField(event);
+
+ /** The field editor for the delay value. */
+ private IntegerFieldEditor delayFieldEditor;
+
+ /** The group. */
+ private Group fieldGroup;
+
+ /** The field editor for the lave validation preference. */
+ private FieldEditor liveValidationfieldEditor;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The parent.
+ * @param title
+ * The group title.
+ * @param dialogPage
+ * The dialog page.
+ */
+ public FilterFieldPreferencesGroup(final Composite parent, final String title, final DialogPage dialogPage) {
+ super(parent, title, dialogPage);
+ createContent(parent);
+ }
+
+ /**
+ * Creates the content.
+ *
+ * @param parent
+ * the parent
+ */
+ public void createContent(final Composite parent) {
+ fieldGroup = new Group(parent, SWT.SCROLL_PAGE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ fieldGroup.setLayout(layout);
+ fieldGroup.setText(Messages.FilterFieldPreferencesGroup_groupTitle);
+
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(fieldGroup);
+
+ liveValidationfieldEditor = new BooleanFieldEditor(IFilterPreferenceConstants.PREF_FILTER_LIVE_VALIDATION, Messages.FilterFieldPreferencesGroup_UseValidationPreferenceLabel, fieldGroup);
+ liveValidationfieldEditor.setPage(dialogPage);
+ addFieldEditor(liveValidationfieldEditor);
+
+ // Composite use to manage layout
+ Composite composite = new Composite(fieldGroup, SWT.NONE);
+ GridDataFactory.fillDefaults().hint(5, 5).applyTo(composite);
+
+ liveValidationfieldEditor.setPropertyChangeListener(listener);
+
+ delayFieldEditor = new IntegerFieldEditor(IFilterPreferenceConstants.PREF_FILTER_VALIDATION_DELAY, Messages.FilterFieldPreferencesGroup_ValidationDelayPreferenceLabel, fieldGroup);
+ delayFieldEditor.setPage(dialogPage);
+ addFieldEditor(delayFieldEditor);
+
+ delayFieldEditor.setEnabled(Activator.getDefault().getPreferenceStore().getBoolean(IFilterPreferenceConstants.PREF_FILTER_LIVE_VALIDATION), fieldGroup);
+ }
+
+ /**
+ * Enable of delay field editor when the live validation is set to true.
+ */
+ private void refreshDelayField(final PropertyChangeEvent event) {
+ if (null != delayFieldEditor && null != liveValidationfieldEditor && event.getSource().equals(liveValidationfieldEditor)) {
+ delayFieldEditor.setEnabled((boolean) event.getNewValue(), fieldGroup);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.widgets.Widget#dispose()
+ */
+ @Override
+ public void dispose() {
+ // dispose listener
+ liveValidationfieldEditor.setPropertyChangeListener(null);
+ super.dispose();
+ }
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/FilterPreferenceInitializer.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/FilterPreferenceInitializer.java
new file mode 100644
index 00000000000..62d41da612f
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/FilterPreferenceInitializer.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST, ALL4TEC 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.views.modelexplorer.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.views.modelexplorer.Activator;
+
+/**
+ * This preference initializer for filter preferences.
+ */
+public class FilterPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /**
+ * Initialize default preferences specific filter field preferences.
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = getPreferenceStore();
+ store.setDefault(IFilterPreferenceConstants.PREF_FILTER_LIVE_VALIDATION, IFilterPreferenceConstants.DEFAULT_FILTER_LIVE_VALIDATION_VALUE);
+ store.setDefault(IFilterPreferenceConstants.PREF_FILTER_VALIDATION_DELAY, IFilterPreferenceConstants.DEFAULT_VALIDATION_DELAY_VALUE);
+ }
+
+ /**
+ * Get the preference store.
+ */
+ protected IPreferenceStore getPreferenceStore() {
+ return Activator.getDefault().getPreferenceStore();
+ }
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/IFilterPreferenceConstants.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/IFilterPreferenceConstants.java
new file mode 100644
index 00000000000..677f7af3a7a
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/IFilterPreferenceConstants.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST, ALL4TEC 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.views.modelexplorer.preferences;
+
+/**
+ * Interface to define preference constants for the filter field.
+ */
+public interface IFilterPreferenceConstants {
+
+ /** The preference if the filter is in live validation. */
+ public static final String PREF_FILTER_LIVE_VALIDATION = "liveValidation"; //$NON-NLS-1$
+
+ /** The preference of the delay of live validation. */
+ public static final String PREF_FILTER_VALIDATION_DELAY = "validateDelay"; //$NON-NLS-1$
+
+ /** the default value for validation delay. */
+ public static final String DEFAULT_VALIDATION_DELAY_VALUE = "600"; //$NON-NLS-1$
+
+ /** the default value for the use of live validation in filter. */
+ public static final String DEFAULT_FILTER_LIVE_VALIDATION_VALUE = "true"; //$NON-NLS-1$
+
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/ModelExplorerPreferencePage.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/ModelExplorerPreferencePage.java
new file mode 100644
index 00000000000..caa0bf17050
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/ModelExplorerPreferencePage.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * Copyright (c) 2010 Atos Origin.
+ *
+ *
+ * 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:
+ * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
+ * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - add search fiel preference page. Rename class name.
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.views.modelexplorer.preferences;
+
+import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage;
+import org.eclipse.papyrus.views.modelexplorer.Activator;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Preference page for model explorer.
+ */
+public class ModelExplorerPreferencePage extends AbstractPapyrusPreferencePage {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage#getBundleId()
+ */
+ @Override
+ protected String getBundleId() {
+ return Activator.PLUGIN_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage#createPageContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected void createPageContents(final Composite parent) {
+ // Add filter field preferences
+ FilterFieldPreferencesGroup searchGroup = new FilterFieldPreferencesGroup(
+ parent, getTitle(), this);
+ addPreferenceGroup(searchGroup);
+
+ // show popup dialog
+ TransformCommandShowPopupDialogGroup groupComposite = new TransformCommandShowPopupDialogGroup(
+ parent, getTitle(), this);
+ addPreferenceGroup(groupComposite);
+ }
+
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/NavigatorPreferencePage.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/NavigatorPreferencePage.java
deleted file mode 100644
index 6aa0ad2aec5..00000000000
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/NavigatorPreferencePage.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.views.modelexplorer.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage;
-import org.eclipse.papyrus.views.modelexplorer.Activator;
-import org.eclipse.swt.widgets.Composite;
-
-public class NavigatorPreferencePage extends AbstractPapyrusNodePreferencePage {
-
- /**
- * @generated
- */
- @Override
- protected String getBundleId() {
- return Activator.PLUGIN_ID;
- }
-
- /**
- * @generated
- */
- public static void initDefaults(IPreferenceStore store) {
-
- // String elementName = "Model Explorer";
- // PreferenceConverter.setDefault(store,
- // PreferencesConstantsHelper.getElementConstant(elementName,
- // PreferencesConstantsHelper.COLOR_FILL), new
- // org.eclipse.swt.graphics.RGB(255, 255, 255));
- // PreferenceConverter.setDefault(store,
- // PreferencesConstantsHelper.getElementConstant(elementName,
- // PreferencesConstantsHelper.COLOR_LINE), new
- // org.eclipse.swt.graphics.RGB(0, 0, 0));
- //
- // // Set the default for the gradient
- // store.setDefault(PreferencesConstantsHelper.getElementConstant(elementName,
- // PreferencesConstantsHelper.GRADIENT_POLICY), false);
- // GradientPreferenceConverter gradientPreferenceConverter = new
- // GradientPreferenceConverter(new org.eclipse.swt.graphics.RGB(255,
- // 255, 255), new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
- // store.setDefault(PreferencesConstantsHelper.getElementConstant(elementName,
- // PreferencesConstantsHelper.COLOR_GRADIENT),
- // gradientPreferenceConverter.getPreferenceValue());
-
- }
-
- @Override
- protected void createPageContents(Composite parent) {
- // super.createPageContents(parent);
-
- // show popup dialog
- TransformCommandShowPopupDialogGroup groupComposite = new TransformCommandShowPopupDialogGroup(
- parent, getTitle(), this);
- addPreferenceGroup(groupComposite);
- }
-
-}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/TransformCommandShowPopupDialogGroup.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/TransformCommandShowPopupDialogGroup.java
index af219f4ea5d..7ac8ac2ceba 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/TransformCommandShowPopupDialogGroup.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/TransformCommandShowPopupDialogGroup.java
@@ -9,19 +9,21 @@
*
* Contributors:
* Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
+ * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - use of AbstractPreferenceGroup
*
*****************************************************************************/
package org.eclipse.papyrus.views.modelexplorer.preferences;
import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup;
+import org.eclipse.papyrus.infra.ui.preferences.AbstractPreferenceGroup;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
-public class TransformCommandShowPopupDialogGroup extends AbstractGroup {
+public class TransformCommandShowPopupDialogGroup extends AbstractPreferenceGroup {
private static final String SHOW_POPUP_DIALOG_GROUP_TITLE = "Transform into Action";
@@ -57,6 +59,8 @@ public class TransformCommandShowPopupDialogGroup extends AbstractGroup {
visibilityGroup.setLayout(new GridLayout());
visibilityGroup.setText(SHOW_POPUP_DIALOG_GROUP_TITLE);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(visibilityGroup);
+
// field for name label visibility
showPopupDialogBooleanFieldEditor = new BooleanFieldEditor(
INavigatorPreferenceConstants.PREF_NAVIGATOR_TRANSFORM_INTO_SHOW_POPUP,

Back to the top