Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomDefaultColumnReorderBindings.java')
-rw-r--r--sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomDefaultColumnReorderBindings.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomDefaultColumnReorderBindings.java b/sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomDefaultColumnReorderBindings.java
new file mode 100644
index 00000000000..1fb16f6a614
--- /dev/null
+++ b/sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/reorder/CustomDefaultColumnReorderBindings.java
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.reorder;
+
+import org.eclipse.nebula.widgets.nattable.reorder.config.DefaultColumnReorderBindings;
+import org.eclipse.nebula.widgets.nattable.ui.action.AggregateDragMode;
+import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.swt.SWT;
+
+/**
+ *
+ * This bindings allows to move the columns, only when the manager allows it.
+ *
+ */
+public class CustomDefaultColumnReorderBindings extends DefaultColumnReorderBindings {
+
+ /**
+ * the table manager
+ */
+ private final INattableModelManager manager;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param manager
+ * the table manager
+ */
+ public CustomDefaultColumnReorderBindings(final INattableModelManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.reorder.config.DefaultReorderBindings#configureUiBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
+ *
+ * @param uiBindingRegistry
+ */
+ @Override
+ public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
+ assert manager != null;
+ uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE), new AggregateDragMode(new CustomCellDragModeForColumn(this.manager), new CustomColumnReorderDragMode(this.manager)));
+ }
+
+}

Back to the top