Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathalie Lepine2013-08-13 12:20:07 +0000
committerNathalie Lepine2013-08-13 12:20:07 +0000
commit1ac0c520c6a22c856ef2ddef6a686cbb0be76a71 (patch)
treeb48d4ffd2c3ff5b5b3437cfb4f5cf90187eda436 /plugins/org.eclipse.emf.eef.runtime
parent6e2d38a2741a95a7aab62a4d41fb4a0796fff9fa (diff)
downloadorg.eclipse.eef-1ac0c520c6a22c856ef2ddef6a686cbb0be76a71.tar.gz
org.eclipse.eef-1ac0c520c6a22c856ef2ddef6a686cbb0be76a71.tar.xz
org.eclipse.eef-1ac0c520c6a22c856ef2ddef6a686cbb0be76a71.zip
add LinkReferenceView
Diffstat (limited to 'plugins/org.eclipse.emf.eef.runtime')
-rw-r--r--plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/impl/components/SinglePartPropertiesEditingComponent.java2
-rw-r--r--plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/utils/EEFRuntimeUIMessages.java4
-rw-r--r--plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/utils/eefRuntimeUImessages.properties1
-rw-r--r--plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/AbstractAdvancedEObjectFlatComboViewer.java2
-rw-r--r--plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/AdvancedEObjectFlatComboViewer.java13
-rw-r--r--plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/LinkEObjectFlatComboViewer.java115
-rw-r--r--plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/LinkEReferenceViewer.java130
-rw-r--r--plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/LinkReferencesTable.java920
8 files changed, 192 insertions, 995 deletions
diff --git a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/impl/components/SinglePartPropertiesEditingComponent.java b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/impl/components/SinglePartPropertiesEditingComponent.java
index ae46b0ae6..64e0fb5d4 100644
--- a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/impl/components/SinglePartPropertiesEditingComponent.java
+++ b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/impl/components/SinglePartPropertiesEditingComponent.java
@@ -147,7 +147,7 @@ public abstract class SinglePartPropertiesEditingComponent extends StandardPrope
} else {
if (event instanceof PropertiesEditionEvent && (!(event.getKind() == PropertiesEditionEvent.EDIT)) && associatedFeature(event.getAffectedEditor()) != null) {
Object currentValue = semanticObject.eGet(associatedFeature(event.getAffectedEditor()));
- return (currentValue == null && event.getNewValue() != null)
+ return (currentValue == null && (event.getNewValue() != null || event.getKind() == PropertiesEditionEvent.ADD))
|| (currentValue != null && !currentValue.equals(event.getNewValue()));
}
}
diff --git a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/utils/EEFRuntimeUIMessages.java b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/utils/EEFRuntimeUIMessages.java
index 99938c653..1867b9c91 100644
--- a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/utils/EEFRuntimeUIMessages.java
+++ b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/utils/EEFRuntimeUIMessages.java
@@ -32,7 +32,7 @@ public class EEFRuntimeUIMessages extends NLS {
public static String AbstractEEFMasterPart_viewer_not_defined_on_selection_listener_adding;
public static String AdvancedEObjectFlatComboViewer_remove_tooltip;
-
+
public static String AdvancedEObjectFlatComboViewer_set_tooltip;
public static String EditPropertyWizard_main_page_description;
@@ -68,6 +68,8 @@ public class EEFRuntimeUIMessages extends NLS {
public static String FlatReferencesTable_featureEditor_title;
public static String FlatReferencesTable_nothing_to_do;
+
+ public static String LinkEReferenceViewer_add_tooltip;
public static String ModelChooserDialog_choose_model;
diff --git a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/utils/eefRuntimeUImessages.properties b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/utils/eefRuntimeUImessages.properties
index 0931b5857..4f6c22764 100644
--- a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/utils/eefRuntimeUImessages.properties
+++ b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/utils/eefRuntimeUImessages.properties
@@ -33,6 +33,7 @@ EMFModelViewerDialog_referenced_models_filter_title=Elements of the referenced m
EMFModelViewerDialog_single_element_title=Select an element
EMFModelViewerDialog_type_column_title=Type
EObjectFlatComboViewer_add_button=...
+LinkEReferenceViewer_add_tooltip=Add the reference value
FlatReferencesTable_featureEditor_title=Edit Feature
FlatReferencesTable_nothing_to_do=Nothing to do for the moment ...
ModelChooserDialog_choose_model=Choose a data model :
diff --git a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/AbstractAdvancedEObjectFlatComboViewer.java b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/AbstractAdvancedEObjectFlatComboViewer.java
index 0a4816c73..4fd07baa0 100644
--- a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/AbstractAdvancedEObjectFlatComboViewer.java
+++ b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/AbstractAdvancedEObjectFlatComboViewer.java
@@ -220,7 +220,7 @@ public abstract class AbstractAdvancedEObjectFlatComboViewer implements
return composite;
}
- private Button createButton(Composite parent, String text, int style) {
+ protected Button createButton(Composite parent, String text, int style) {
Button button;
if (widgetFactory == null) {
button = new Button(parent, style);
diff --git a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/AdvancedEObjectFlatComboViewer.java b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/AdvancedEObjectFlatComboViewer.java
index 79f45e7cb..d9b14f8fd 100644
--- a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/AdvancedEObjectFlatComboViewer.java
+++ b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/AdvancedEObjectFlatComboViewer.java
@@ -117,7 +117,6 @@ public class AdvancedEObjectFlatComboViewer extends AbstractAdvancedEObjectFlatC
this.valueText.setText(UNDEFINED_VALUE);
else
this.valueText.setText(text);
- // this.parent.pack();
}
/**
@@ -132,6 +131,18 @@ public class AdvancedEObjectFlatComboViewer extends AbstractAdvancedEObjectFlatC
}
/**
+ * Sets the given ID to the EObjectFlatComboViewer
+ *
+ * @param id
+ * the id of the widget
+ */
+ public void setID(Object id) {
+ super.setID(id);
+ EditingUtils.setID(valueText, id);
+ }
+
+
+ /**
* @return if the table is enabled
*/
public boolean isEnabled() {
diff --git a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/LinkEObjectFlatComboViewer.java b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/LinkEObjectFlatComboViewer.java
index 92ab8bd02..8146636f9 100644
--- a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/LinkEObjectFlatComboViewer.java
+++ b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/LinkEObjectFlatComboViewer.java
@@ -1,67 +1,47 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 CEA LIST and others.
+ * Copyright (c) 2008, 2013 Obeo.
* 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- * Obeo - Some improvements
+ * Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.emf.eef.runtime.ui.widgets;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.emf.eef.runtime.EEFRuntimePlugin;
-import org.eclipse.emf.eef.runtime.ui.utils.EEFRuntimeUIMessages;
import org.eclipse.emf.eef.runtime.ui.utils.EditingUtils;
-import org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
/**
- * This is an Abstract class use to display a label with the referenced named
- * Element For example type of a property
+ * AdvancedEObjectFlatComboViewer with a link to set the element properties.
*
- * @author Patrick Tessier
- * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
- * @author <a href="mailto:stephane.bouchet@obeo.fr">Stephane Bouchet</a>
+ * @author <a href="mailto:nathalie.lepine@obeo.fr">Nathalie Lépine</a>
*/
public class LinkEObjectFlatComboViewer extends AbstractAdvancedEObjectFlatComboViewer {
-
/** Associated link. */
protected Link valueLink;
-
+
/**
- * the constructor of this display
+ * Constructor from super class
*
- * @param labeltoDisplay
- * use to display the name is the label
- * @param filter
- * use to look for the good element
+ * @param dialogTitle
+ * @param input Object
+ * @param filter ViewerFilter
+ * @param adapterFactory AdapterFactory
+ * @param callback EObjectFlatComboViewerListener
*/
public LinkEObjectFlatComboViewer(String dialogTitle, Object input,
ViewerFilter filter, AdapterFactory adapterFactory,
@@ -69,40 +49,24 @@ public class LinkEObjectFlatComboViewer extends AbstractAdvancedEObjectFlatCombo
super(dialogTitle, input, filter, adapterFactory, callback);
}
+ /** (non-Javadoc)
+ * @see org.eclipse.emf.eef.runtime.ui.widgets.AbstractAdvancedEObjectFlatComboViewer#createLabels(org.eclipse.swt.widgets.Composite)
+ */
protected void createLabels(Composite parent) {
- // Display label
- // final Label displayLabel = createLabel(parent, dialogTitle,
- // SWT.NONE);
- // FormData data = new FormData();
- // data.left = new FormAttachment(0, 0);
- // data.top = new FormAttachment(0, 0);
- // displayLabel.setLayoutData(data);
-
- // Value Label
String value = UNDEFINED_VALUE;
if (selection != null) {
value = labelProvider.getText(selection);
}
this.valueLink = createLink(parent, value, SWT.NONE);
- // valueText.setEditable(false);
- // TODO set background color and dispose!
- // valueText.setEnabled(false);
- // valueText.setBackground(...);
FormData data = new FormData();
- // data.left = new FormAttachment(displayLabel, 5);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(browseButton, 0);
data.top = new FormAttachment(0, 1);
valueLink.setLayoutData(data);
- // valueText.addMouseListener(new MouseAdapter() {
- // @Override
- // public void mouseDoubleClick(MouseEvent e) {
- // callback.navigateTo(selection);
- // }
- // });
valueLink.addSelectionListener(new SelectionAdapter() {
- @SuppressWarnings("unchecked")
- @Override
+ /** (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
public void widgetSelected(SelectionEvent e) {
EObject editedElement = getSelection();
handleEdit(editedElement);
@@ -110,15 +74,22 @@ public class LinkEObjectFlatComboViewer extends AbstractAdvancedEObjectFlatCombo
});
}
+ /**
+ * @param parent Composite
+ * @param value String
+ * @param style
+ * @return the created Link
+ */
private Link createLink(Composite parent, String value, int style) {
Link link = new Link(parent, style);
link.setText(value);
- EditingUtils.setEEFtype(field,
- "eef::LinkEObjectFlatComboViewer::link");
+ EditingUtils.setEEFtype(field, "eef::LinkEObjectFlatComboViewer::link");
return link;
}
- @SuppressWarnings("unchecked")
+ /** (non-Javadoc)
+ * @see org.eclipse.emf.eef.runtime.ui.widgets.AbstractAdvancedEObjectFlatComboViewer#setSelection(org.eclipse.jface.viewers.ISelection)
+ */
public void setSelection(ISelection selection) {
if (selection instanceof StructuredSelection) {
StructuredSelection structuredSelection = (StructuredSelection) selection;
@@ -127,11 +98,13 @@ public class LinkEObjectFlatComboViewer extends AbstractAdvancedEObjectFlatCombo
setSelection((EObject) structuredSelection.getFirstElement());
} else {
this.valueLink.setText(UNDEFINED_VALUE);
- // this.parent.pack();
}
}
}
+ /** (non-Javadoc)
+ * @see org.eclipse.emf.eef.runtime.ui.widgets.AbstractAdvancedEObjectFlatComboViewer#setSelection(org.eclipse.emf.ecore.EObject)
+ */
public void setSelection(EObject selection) {
this.selection = selection;
String text = labelProvider.getText(selection);
@@ -139,37 +112,37 @@ public class LinkEObjectFlatComboViewer extends AbstractAdvancedEObjectFlatCombo
this.valueLink.setText(UNDEFINED_VALUE);
else
this.valueLink.setText("<a>" + text + "</a>");
- // this.parent.pack();
+ }
+
+ /** (non-Javadoc)
+ * @see org.eclipse.emf.eef.runtime.ui.widgets.AbstractAdvancedEObjectFlatComboViewer#setID(java.lang.Object)
+ */
+ public void setID(Object id) {
+ super.setID(id);
+ EditingUtils.setID(valueLink, id);
}
- /**
- * Sets the viewer readonly
- *
- * @param enabled
- * sets the viewer read only or not.
+ /** (non-Javadoc)
+ * @see org.eclipse.emf.eef.runtime.ui.widgets.AbstractAdvancedEObjectFlatComboViewer#setEnabled(boolean)
*/
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
valueLink.setEnabled(enabled);
}
- /**
- * @return if the table is enabled
+ /** (non-Javadoc)
+ * @see org.eclipse.emf.eef.runtime.ui.widgets.AbstractAdvancedEObjectFlatComboViewer#isEnabled()
*/
public boolean isEnabled() {
return super.isEnabled() && valueLink.isEnabled();
}
- /**
- * Sets the tooltip text on the viewer
- *
- * @param tooltip
- * the tooltip text
+ /** (non-Javadoc)
+ * @see org.eclipse.emf.eef.runtime.ui.widgets.AbstractAdvancedEObjectFlatComboViewer#setToolTipText(java.lang.String)
*/
public void setToolTipText(String tooltip) {
super.setToolTipText(tooltip);
valueLink.setToolTipText(tooltip);
}
-
}
diff --git a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/LinkEReferenceViewer.java b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/LinkEReferenceViewer.java
new file mode 100644
index 000000000..18bd44275
--- /dev/null
+++ b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/LinkEReferenceViewer.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.eef.runtime.ui.widgets;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.eef.runtime.EEFRuntimePlugin;
+import org.eclipse.emf.eef.runtime.ui.utils.EEFRuntimeUIMessages;
+import org.eclipse.emf.eef.runtime.ui.utils.EditingUtils;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * LinkEObjectFlatComboViewer with possibility to create the referenced element.
+ *
+ * @author <a href="mailto:nathalie.lepine@obeo.fr">Nathalie Lepine</a>
+ */
+public class LinkEReferenceViewer extends LinkEObjectFlatComboViewer {
+
+ /**
+ * Create referenced element button.
+ */
+ private Button createButton;
+
+ /** Image for the create button */
+ protected final org.eclipse.swt.graphics.Image createImage = EEFRuntimePlugin
+ .getImage(EEFRuntimePlugin.ICONS_16x16 + "Create_16x16.gif"); //$NON-NLS-1$
+
+
+ /**
+ * Constructor from superclass
+ *
+ * @param dialogTitle
+ * @param input Object
+ * @param filter ViewerFilter
+ * @param adapterFactory AdapterFactory
+ * @param callback EObjectFlatComboViewerListener
+ */
+ public LinkEReferenceViewer(String dialogTitle, Object input,
+ ViewerFilter filter, AdapterFactory adapterFactory,
+ EObjectFlatComboViewerListener callback) {
+ super(dialogTitle, input, filter, adapterFactory, callback);
+ }
+
+
+ /** (non-Javadoc)
+ * @see org.eclipse.emf.eef.runtime.ui.widgets.AbstractAdvancedEObjectFlatComboViewer#createControls(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControls(Composite parent) {
+ super.createControls(parent);
+
+ // add create button
+ createButton();
+ }
+
+
+ /**
+ * Add the create button
+ */
+ protected void createButton() {
+ createButton = super.createButton(composite, "", SWT.PUSH); //$NON-NLS-1$
+ createButton.setImage(createImage);
+ FormData data = new FormData();
+ data.right = new FormAttachment(browseButton, 2);
+ data.top = new FormAttachment(0, -2);
+ createButton.setLayoutData(data);
+ createButton.setToolTipText(EEFRuntimeUIMessages.LinkEReferenceViewer_add_tooltip);
+ EditingUtils.setEEFtype(createButton, "eef::LinkEReferenceViewer::createbutton");
+ data = (FormData)valueLink.getLayoutData();
+ data.right = new FormAttachment(createButton, 0);
+
+ // listeners setting
+ createButton.addMouseListener(new MouseAdapter() {
+
+ /** (non-Javadoc)
+ * @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
+ */
+ public void mouseUp(MouseEvent e) {
+ handleCreate();
+ }
+ });
+ }
+
+ /** (non-Javadoc)
+ * @see org.eclipse.emf.eef.runtime.ui.widgets.LinkEObjectFlatComboViewer#setID(java.lang.Object)
+ */
+ public void setID(Object id) {
+ super.setID(id);
+ EditingUtils.setID(createButton, id);
+ }
+
+ /** (non-Javadoc)
+ * @see org.eclipse.emf.eef.runtime.ui.widgets.LinkEObjectFlatComboViewer#setEnabled(boolean)
+ */
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ createButton.setEnabled(enabled);
+ }
+
+ /** (non-Javadoc)
+ * @see org.eclipse.emf.eef.runtime.ui.widgets.LinkEObjectFlatComboViewer#isEnabled()
+ */
+ public boolean isEnabled() {
+ return super.isEnabled() && createButton.isEnabled();
+ }
+
+ /** (non-Javadoc)
+ * @see org.eclipse.emf.eef.runtime.ui.widgets.LinkEObjectFlatComboViewer#setToolTipText(java.lang.String)
+ */
+ public void setToolTipText(String tooltip) {
+ super.setToolTipText(tooltip);
+ createButton.setToolTipText(tooltip);
+ }
+
+
+}
diff --git a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/LinkReferencesTable.java b/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/LinkReferencesTable.java
deleted file mode 100644
index 402a2e4bb..000000000
--- a/plugins/org.eclipse.emf.eef.runtime/src/org/eclipse/emf/eef/runtime/ui/widgets/LinkReferencesTable.java
+++ /dev/null
@@ -1,920 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2013 CEA LIST 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- * Obeo - Some improvements
- *******************************************************************************/
-package org.eclipse.emf.eef.runtime.ui.widgets;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.emf.eef.runtime.EEFRuntimePlugin;
-import org.eclipse.emf.eef.runtime.ui.utils.EEFRuntimeUIMessages;
-import org.eclipse.emf.eef.runtime.ui.utils.EditingUtils;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-/**
- * Base class for a complex section composite. This composite has a label, a
- * table that describes a tree structure, and four buttons on the side of the
- * table to add an element into the table, remove selected element(s), move up
- * or down the selected element.
- *
- * @author Remi SCHNEKENBURGER
- * @author Patrick Tessier
- * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
- * @author <a href="mailto:goulwen.lefur@obeo.fr">Goulwen Le Fur</a>
- * @author <a href="mailto:stephane.bouchet@obeo.fr">Stephane Bouchet</a>
- */
-public class LinkReferencesTable implements IPropertiesFilteredWidget {
-
- /**
- * Image for the add element button.
- */
- final protected static Image NEW_ELEMENT_IMG = EEFRuntimePlugin
- .getImage(EEFRuntimePlugin.ICONS_16x16 + "Add_16x16.gif"); //$NON-NLS-1$
-
- /**
- * Image for the delete element button.
- */
- final protected static Image DELETE_ELEMENT_IMG = EEFRuntimePlugin
- .getImage(EEFRuntimePlugin.ICONS_16x16 + "Delete_16x16.gif"); //$NON-NLS-1$
-
- /**
- * Image for the up button.
- */
- final protected static Image UP_ELEMENT_IMG = EEFRuntimePlugin
- .getImage(EEFRuntimePlugin.ICONS_16x16 + "ArrowUp_16x16.gif"); //$NON-NLS-1$
-
- /**
- * Image for the down button.
- */
- final protected static Image DOWN_ELEMENT_IMG = EEFRuntimePlugin
- .getImage(EEFRuntimePlugin.ICONS_16x16 + "ArrowDown_16x16.gif"); //$NON-NLS-1$
-
- /** list of element that we want to display * */
- private Object input;
-
- /**
- * Label above the table.
- */
- private Label label;
-
- /**
- * Table that displays a property for the current element.
- */
- private Table table;
-
- /** the table viewer to associate the label provider * */
- private TableViewer tableViewer;
-
- /**
- * Button that adds an element.
- */
- private Button addButton;
-
- /**
- * Button that removes an element.
- */
- private Button removeButton;
-
- /**
- * button that moves the element up.
- */
- private Button upButton;
-
- /**
- * button that moves the element down.
- */
- private Button downButton;
-
- /**
- * Listener for the add button.
- */
- private MouseListener addButtonlistener;
-
- /**
- * Listener for the delete button.
- */
- private MouseListener removeButtonlistener;
-
- /**
- * Listener for the up button.
- */
- private MouseListener upButtonlistener;
-
- /**
- * Listener for the down button.
- */
- private MouseListener downButtonlistener;
-
- private Listener tableListener;
-
- private int upperBound = -1;
-
- private int lowerBound = 0;
-
- /**
- * The listener used by the client to handle business events (Add, Remove,
- * Move, NavigateTo)
- */
- private ReferencesTableListener referencesTableListener;
-
- private String labelToDisplay;
-
- /**
- * The Form tool kit use to use this widget in an Eclipse Forms compliant
- * mode
- */
- private FormToolkit widgetFactory;
-
- /**
- * The main composite
- */
- private Composite composite;
-
- /**
- * The adapter factory.
- */
- protected AdapterFactory adapterFactory = new ComposedAdapterFactory(
- ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
-
- /**
- * The help text
- */
- private String helpText;
-
- /** The business rules filters. */
- protected List<ViewerFilter> bpFilters;
-
- /** The filters. */
- protected List<ViewerFilter> filters;
-
- /**
- * ContentProvider of the table
- */
- private IStructuredContentProvider contentProvider;
-
- /**
- * the constructor
- *
- * @param labeltoDisplay
- * the label to display
- * @param the
- * listener to handle Add, Remove, Move and NavigateTo events
- */
- public LinkReferencesTable(String labeltoDisplay,
- ReferencesTableListener referenceListener) {
- this.labelToDisplay = labeltoDisplay;
- this.addButtonlistener = new AddButtonlistener();
- this.removeButtonlistener = new RemoveButtonlistener();
- this.upButtonlistener = new UpButtonlistener();
- this.downButtonlistener = new DownButtonlistener();
- bpFilters = new ArrayList<ViewerFilter>();
- filters = new ArrayList<ViewerFilter>();
- addTableReferenceListener(referenceListener);
- }
-
- public void addTableReferenceListener(
- ReferencesTableListener referenceListener) {
- this.referencesTableListener = referenceListener;
- }
-
- public void addSelectionListener(SelectionListener selectionListener) {
- this.table.addSelectionListener(selectionListener);
- }
-
- public void createControls(Composite parent, FormToolkit widgetFactory) {
- this.widgetFactory = widgetFactory;
- createControls(parent);
- }
-
- private Composite createComposite(Composite parent) {
- Composite composite;
- if (widgetFactory == null) {
- composite = new Composite(parent, SWT.NONE);
- } else {
- composite = widgetFactory.createComposite(parent);
- }
- return composite;
- }
-
- private Button createButton(Composite parent, String text, int style) {
- Button button;
- if (widgetFactory == null) {
- button = new Button(parent, style);
- button.setText(text);
- } else {
- button = widgetFactory.createButton(parent, text, style);
- }
- return button;
- }
-
- private Label createLabel(Composite parent, String text, int style) {
- Label label;
- if (widgetFactory == null) {
- label = new Label(parent, SWT.PUSH);
- label.setText(text);
- } else {
- label = widgetFactory.createLabel(parent, text, style);
- }
- return label;
- }
-
- private Table createTable(Composite parent, int style) {
- Table table;
- if (widgetFactory == null) {
- table = new Table(parent, style);
- } else {
- table = widgetFactory.createTable(parent, style);
- }
- return table;
- }
-
- public void createControls(Composite parent) {
- composite = createComposite(parent);
- if (parent instanceof ExpandableComposite) {
- ((ExpandableComposite) parent).setClient(composite);
- }
- FormLayout formLayout = new FormLayout();
- formLayout.marginTop = 7;
- composite.setLayout(formLayout);
-
- FormData data;
-
- // Create Help Button
- data = new FormData();
- data.top = new FormAttachment(-2, 0);
- data.right = new FormAttachment(100, -ITabbedPropertyConstants.HSPACE);
- Control helpButton = null;
- if (helpText != null) {
- if (widgetFactory != null) {
- helpButton = FormUtils.createHelpButton(widgetFactory,
- composite, helpText, null);
- } else {
- helpButton = SWTUtils.createHelpButton(composite, helpText,
- null);
- }
- helpButton.setLayoutData(data);
- }
-
- // ///////////////////////////////////////////////////////////////////////////
- // Create and place button vertically on the left side
- // Button : Add Element
- // Button Delete Element
- removeButton = createButton(composite, "", SWT.PUSH); //$NON-NLS-1$
- removeButton.setVisible(true);
- removeButton.setImage(DELETE_ELEMENT_IMG);
- removeButton
- .setToolTipText(EEFRuntimeUIMessages.ReferencesTable_remove_tooltip);
- data = new FormData();
- // data.top = new FormAttachment(addButton,
- // ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(-6, 0);
- if (helpText != null) {
- data.right = new FormAttachment(helpButton,
- -ITabbedPropertyConstants.HSPACE);
- } else {
- data.right = new FormAttachment(100,
- -ITabbedPropertyConstants.HSPACE);
- }
- removeButton.setLayoutData(data);
- removeButton.addMouseListener(removeButtonlistener);
-
- addButton = createButton(composite, "", SWT.PUSH); //$NON-NLS-1$
- addButton.setVisible(true);
- addButton.setImage(NEW_ELEMENT_IMG);
- addButton
- .setToolTipText(EEFRuntimeUIMessages.ReferencesTable_add_tooltip);
-
- data = new FormData();
- // data.top = new FormAttachment(label,
- // ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(-6, 0);
- data.right = new FormAttachment(removeButton,
- -ITabbedPropertyConstants.HSPACE);
- addButton.setLayoutData(data);
- addButton.addMouseListener(addButtonlistener);
-
- // Button Up
- upButton = createButton(composite, "", SWT.PUSH); //$NON-NLS-1$
- upButton.setVisible(true);
- upButton.setImage(UP_ELEMENT_IMG);
- upButton
- .setToolTipText(EEFRuntimeUIMessages.ReferencesTable_up_tooltip);
-
- data = new FormData();
- // data.top = new FormAttachment(removeButton,
- // ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(-6, 0);
- data.right = new FormAttachment(addButton,
- -ITabbedPropertyConstants.HSPACE);
- upButton.setLayoutData(data);
- upButton.addMouseListener(upButtonlistener);
-
- // Button Down
- downButton = createButton(composite, "", SWT.PUSH); //$NON-NLS-1$
- downButton.setVisible(true);
- downButton.setImage(DOWN_ELEMENT_IMG);
- downButton
- .setToolTipText(EEFRuntimeUIMessages.ReferencesTable_down_tooltip);
-
- data = new FormData();
- // data.top = new FormAttachment(upButton,
- // ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(-6, 0);
- data.right = new FormAttachment(upButton,
- -ITabbedPropertyConstants.HSPACE);
- downButton.setLayoutData(data);
- downButton.addMouseListener(downButtonlistener);
-
- // Create label
- label = createLabel(composite, labelToDisplay, SWT.NONE);
- // label.setLayout(new FormLayout());
- data = new FormData();
- data.left = new FormAttachment(2, 0);
- data.right = new FormAttachment(downButton,
- -ITabbedPropertyConstants.HSPACE - 5/* 50 */);
- data.top = new FormAttachment(0, 0);
- label.setLayoutData(data);
-
- // ///////////////////////////////////////////////////////////////////////////
- // Create and place Table
- table = createTable(composite, SWT.MULTI | SWT.H_SCROLL | SWT.BORDER);
- table.setLayout(new FormLayout());
- table.setVisible(true);
- table.addListener(SWT.MouseDoubleClick,
- tableListener = new EditItemListener());
- // createTable
- tableViewer = new TableViewer(table);
-
- // The filters.
-
- data = new FormData();
- data.height = 100;
- data.top = new FormAttachment(label,
- ITabbedPropertyConstants.VSPACE + 4);
- data.left = new FormAttachment(0, ITabbedPropertyConstants.HSPACE);
- data.right = new FormAttachment(100, -ITabbedPropertyConstants.HSPACE);
-
- table.setLayoutData(data);
- table.addMouseListener(new MouseListener() {
-
- @SuppressWarnings("unchecked")
- public void mouseDoubleClick(MouseEvent e) {
- if (table.getSelection() != null
- && table.getSelectionCount() != 0
- && table.getSelection()[0].getData() instanceof EObject) {
- // Navigate
- referencesTableListener.navigateTo((EObject) table
- .getSelection()[0].getData());
- }
- }
-
- public void mouseDown(MouseEvent e) {
- }
-
- public void mouseUp(MouseEvent e) {
- }
- });
- // tableViewer.refresh();
- // table.pack();
- }
-
- /**
- * @param layoutData
- * the layoutData to set
- */
- public void setLayoutData(Object layoutData) {
- composite.setLayoutData(layoutData);
- }
-
- /**
- * @param contentProvider
- * contentProvider to use in the Table
- */
- public void setContentProvider(IStructuredContentProvider contentProvider) {
- this.contentProvider = contentProvider;
- }
-
- public void setUpperBound(int value) {
- if (value < 0)
- this.upperBound = -1;
- else
- this.upperBound = value;
- }
-
- public int getUpperBound() {
- return this.upperBound;
- }
-
- public void setLowerBound(int value) {
- if (value <= 0)
- this.lowerBound = 0;
- else
- this.lowerBound = value;
- }
-
- public int getLowerBound() {
- return this.lowerBound;
- }
-
- private int getSize() {
- if (contentProvider != null && input != null)
- return contentProvider.getElements(input).length;
- return -1;
- }
-
- private int indexOf(Object elem) {
- Object[] elements = contentProvider.getElements(input);
- for (int i = 0; i < elements.length; i++) {
- Object next = elements[i];
- if (next.equals(elem))
- return i;
-
- }
- return -1;
- }
-
- /**
- * Sets the given ID to the EMFComboViewer
- *
- * @param id
- * the ID to give
- */
- public void setID(Object id) {
- EditingUtils.setID(table, id);
- EditingUtils.setID(addButton, id);
- EditingUtils.setID(removeButton, id);
- EditingUtils.setID(upButton, id);
- EditingUtils.setID(downButton, id);
- }
-
- /**
- * Defines the type of reference table
- *
- * @param id
- * the type to give
- */
- public void setEEFType(String type) {
- EditingUtils.setEEFtype(table, type + "::field");
- EditingUtils.setEEFtype(addButton, type + "::addbutton");
- EditingUtils.setEEFtype(removeButton, type + "::removebutton");
- EditingUtils.setEEFtype(upButton, type + "::upbutton");
- EditingUtils.setEEFtype(downButton, type + "::downbutton");
- }
-
- /**
- * @return the ID of the EObjectFlatComboViewer
- */
- public Object getID() {
- return EditingUtils.getID(table);
- }
-
- /**
- * @param helpText
- */
- public void setHelpText(String helpText) {
- this.helpText = helpText;
- }
-
- public void refresh() {
- tableViewer.refresh();
- computeAddButtonStatus();
- computeRemoveButtonStatus();
- }
-
- private void computeRemoveButtonStatus() {
- if (getSize() > this.lowerBound)
- removeButton.setEnabled(true);
- else
- removeButton.setEnabled(false);
-
- }
-
- private void computeAddButtonStatus() {
- if (this.upperBound < 0 || getSize() < this.upperBound)
- addButton.setEnabled(true);
- else
- addButton.setEnabled(false);
- }
-
- /**
- * display the content of the table
- */
- public void initLabelProvider() {
- if (!table.isDisposed()) {
- // set the label provider
- tableViewer.setLabelProvider(getLabelProvider());
- }
- }
-
- /**
- * Returns the label provider for the composite
- *
- * @return the label provider or <code>null</code>
- */
- public AdapterFactoryLabelProvider getLabelProvider() {
- return new AdapterFactoryLabelProvider(adapterFactory);
- }
-
- /**
- * Disable Move capability (Hide Up and Down buttons)
- */
- public void disableMove() {
- upButton.setVisible(false);
- downButton.setVisible(false);
- }
-
- /**
- * Listener for the Add Button Specific behavior is implemented in
- * {@link ReferencesTable#addButtonPressed()}.
- *
- * @author Remi SCHNEKENBURGER
- */
- private class AddButtonlistener implements MouseListener {
-
- /**
- * {@inheritDoc}
- */
- public void mouseDoubleClick(MouseEvent e) {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDown(MouseEvent e) {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseUp(MouseEvent e) {
- referencesTableListener.handleAdd();
-
- }
- }
-
- /**
- * Listener for the Remove Button Specific behavior is implemented in
- * {@link ReferencesTable#removeButtonPressed()}.
- *
- * @author Remi SCHNEKENBURGER
- */
- private class RemoveButtonlistener implements MouseListener {
-
- /**
- * {@inheritDoc}
- */
- public void mouseDoubleClick(MouseEvent e) {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDown(MouseEvent e) {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public void mouseUp(MouseEvent e) {
- // Keep selection
- TableItem[] tableItems = table.getSelection();
-
- for (int i = (tableItems.length - 1); i >= 0; i--) {
- // Remove
- referencesTableListener.handleRemove((EObject) tableItems[i]
- .getData());
- }
- }
- }
-
- /**
- * Listener for the Up Button Specific behavior is implemented in
- * {@link ReferencesTable#upButtonPressed()}.
- *
- * @author Remi SCHNEKENBURGER
- */
- private class UpButtonlistener implements MouseListener {
-
- /**
- * {@inheritDoc}
- */
- public void mouseDoubleClick(MouseEvent e) {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDown(MouseEvent e) {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public void mouseUp(MouseEvent e) {
- // Keep selection
- TableItem[] tableItems = table.getSelection();
-
- for (int i = 0; i < tableItems.length; i++) {
- int indexInTable = indexInTable(tableItems[i]);
- if (indexInTable == 1) {
- //
- // Go first
- referencesTableListener.handleMove((EObject) tableItems[i]
- .getData(), -1, 0);
- } else if (indexInTable > 1) {
- // get previous table item.
- TableItem previousTableItem = getPreviousTableItem(tableItems[i]);
- int newIndex = indexOf(previousTableItem.getData());
- referencesTableListener.handleMove((EObject) tableItems[i]
- .getData(), -1, newIndex);
- }
- }
-
- }
- }
-
- /**
- * Listener for the Down Button Specific behavior is implemented in
- * {@link ReferencesTable#downButtonPressed()}.
- *
- * @author Remi SCHNEKENBURGER
- */
- private class DownButtonlistener implements MouseListener {
-
- /**
- * {@inheritDoc}
- */
- public void mouseDoubleClick(MouseEvent e) {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- public void mouseDown(MouseEvent e) {
- // do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public void mouseUp(MouseEvent e) {
- TableItem[] tableItems = table.getSelection();
- for (int i = (tableItems.length - 1); i >= 0; i--) {
- int indexInTable = indexInTable(tableItems[i]);
- if (indexInTable == table.getItemCount() - 2) {
- //
- // Go last
- referencesTableListener.handleMove((EObject) tableItems[i]
- .getData(), -1,
- contentProvider.getElements(input).length - 1);
- } else if (indexInTable < table.getItemCount() - 2) {
- // get next table item.
- TableItem nextTableItem = getNextTableItem(tableItems[i]);
- int newIndex = indexOf(nextTableItem.getData());
- referencesTableListener.handleMove((EObject) tableItems[i]
- .getData(), -1, newIndex);
- }
- }
- }
- }
-
- /**
- *
- */
- private class EditItemListener implements Listener {
-
- /** @{inheritDoc */
- @SuppressWarnings("unchecked")
- public void handleEvent(Event event) {
- if (table.getSelection().length > 0) {
- TableItem item = table.getSelection()[0];
- // Edit
- referencesTableListener.handleEdit((EObject) item.getData());
- }
- }
- }
-
- /**
- * removes listeners from buttons.
- */
- public void dispose() {
- if (addButton != null && !addButton.isDisposed())
- addButton.removeMouseListener(addButtonlistener);
- if (removeButton != null && !removeButton.isDisposed())
- removeButton.removeMouseListener(removeButtonlistener);
- if (upButton != null && !upButton.isDisposed())
- upButton.removeMouseListener(upButtonlistener);
- if (downButton != null && !downButton.isDisposed())
- downButton.removeMouseListener(downButtonlistener);
- if (table != null && !table.isDisposed())
- table.removeListener(SWT.MouseDoubleClick, tableListener);
- if (filters != null) {
- filters.clear();
- filters = null;
- }
- if (bpFilters != null) {
- bpFilters.clear();
- bpFilters = null;
- }
- }
-
- private int indexInTable(TableItem tableItem) {
- for (int i = 0; i < table.getItemCount(); i++) {
- if (table.getItem(i) == tableItem)
- return i;
- }
- return -1;
- }
-
- private TableItem getPreviousTableItem(TableItem tableItem) {
- int indexInTable = indexInTable(tableItem);
- return table.getItem(indexInTable - 1);
- }
-
- private TableItem getNextTableItem(TableItem tableItem) {
- int indexInTable = indexInTable(tableItem);
- return table.getItem(indexInTable + 1);
- }
-
- /**
- * input of viewer
- *
- * @param input
- */
- public void setInput(Object input) {
- this.input = input;
- initLabelProvider();
- tableViewer.setContentProvider(contentProvider);
- tableViewer.setInput(input);
- for (ViewerFilter filter : filters) {
- this.tableViewer.addFilter(filter);
- }
- for (ViewerFilter filter : bpFilters) {
- this.tableViewer.addFilter(filter);
- }
- computeAddButtonStatus();
- computeRemoveButtonStatus();
- }
-
- /**
- * @return the input of the viewer
- */
- public Object getInput() {
- return input;
- }
-
- public interface ReferencesTableListener {
-
- void handleAdd();
-
- void handleRemove(EObject element);
-
- void handleMove(EObject element, int oldIndex, int newIndex);
-
- void handleEdit(EObject element);
-
- void navigateTo(EObject element);
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.eclipse.emf.eef.runtime.ui.widgets.IPropertiesFilteredWidget#
- * addBusinessRuleFilter(org.eclipse. jface.viewers.ViewerFilter)
- */
- public void addBusinessRuleFilter(ViewerFilter filter) {
- this.bpFilters.add(filter);
- if (this.tableViewer != null) {
- this.tableViewer.addFilter(filter);
- this.tableViewer.refresh();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.emf.eef.runtime.ui.widgets.IPropertiesFilteredWidget#addFilter
- * (org.eclipse.jface.viewers .ViewerFilter)
- */
- public void addFilter(ViewerFilter filter) {
- this.filters.add(filter);
- if (this.tableViewer != null) {
- this.tableViewer.addFilter(filter);
- this.tableViewer.refresh();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.eclipse.emf.eef.runtime.ui.widgets.IPropertiesFilteredWidget#
- * removeBusinessRuleFilter(org.eclipse .jface.viewers.ViewerFilter)
- */
- public void removeBusinessRuleFilter(ViewerFilter filter) {
- this.bpFilters.remove(filter);
- if (this.tableViewer != null) {
- this.tableViewer.removeFilter(filter);
- this.tableViewer.refresh();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.emf.eef.runtime.ui.widgets.IPropertiesFilteredWidget#removeFilter
- * (org.eclipse.jface.viewers .ViewerFilter)
- */
- public void removeFilter(ViewerFilter filter) {
- this.filters.remove(filter);
- if (this.tableViewer != null) {
- this.tableViewer.removeFilter(filter);
- this.tableViewer.refresh();
- }
- }
-
- protected void refreshFilters() {
- }
-
- /**
- * Sets the tables readonly or not
- *
- * @param enabled
- * to set the table readonly or not
- */
- public void setEnabled(boolean enabled) {
- addButton.setEnabled(enabled);
- downButton.setEnabled(enabled);
- removeButton.setEnabled(enabled);
- table.setEnabled(enabled);
- upButton.setEnabled(enabled);
- }
-
- /**
- * Sets the tooltip text for the viewer
- *
- * @param tooltip
- * the tooltip text
- */
- public void setToolTipText(String tooltip) {
- addButton.setToolTipText(tooltip);
- downButton.setToolTipText(tooltip);
- removeButton.setToolTipText(tooltip);
- table.setToolTipText(tooltip);
- upButton.setToolTipText(tooltip);
- }
-
- /**
- * Returns the table.
- *
- * @return the table.
- */
- public Table getTable() {
- return table;
- }
-
-}

Back to the top