Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 59921 Details for
Bug 172646
[Viewers] Activate Editors using a specialized Event
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
start for next iteration
clipboard31968.txt (text/plain), 68.46 KB, created by
Thomas Schindl
on 2007-02-27 16:51:41 EST
(
hide
)
Description:
start for next iteration
Filename:
MIME Type:
Creator:
Thomas Schindl
Created:
2007-02-27 16:51:41 EST
Size:
68.46 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jface.snippets >Index: Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet025TabEditing.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet025TabEditing.java,v >retrieving revision 1.2 >diff -u -r1.2 Snippet025TabEditing.java >--- Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet025TabEditing.java 4 Feb 2007 22:00:22 -0000 1.2 >+++ Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet025TabEditing.java 27 Feb 2007 21:46:12 -0000 >@@ -12,10 +12,13 @@ > package org.eclipse.jface.snippets.viewers; > > import org.eclipse.jface.viewers.CellEditor; >+import org.eclipse.jface.viewers.ColumnViewerEditor; >+import org.eclipse.jface.viewers.ColumnViewerKeyboardSupport; > import org.eclipse.jface.viewers.EditingSupport; > import org.eclipse.jface.viewers.ICellModifier; > import org.eclipse.jface.viewers.IStructuredContentProvider; > import org.eclipse.jface.viewers.LabelProvider; >+import org.eclipse.jface.viewers.TableColumnViewerEditor; > import org.eclipse.jface.viewers.TableViewer; > import org.eclipse.jface.viewers.TextCellEditor; > import org.eclipse.jface.viewers.Viewer; >@@ -111,7 +114,7 @@ > > v.setColumnProperties(new String[] { "column1", "column2" }); > v.setCellEditors(new CellEditor[] { new TextCellEditor(v.getTable()), new TextCellEditor(v.getTable()) }); >- v.setTabEditingStyle(EditingSupport.TABBING_HORIZONTAL|EditingSupport.TABBING_MOVE_TO_ROW_NEIGHBOR|EditingSupport.TABBING_VERTICAL); >+ v.setColumnViewerEditor(new TableColumnViewerEditor(v,new ColumnViewerKeyboardSupport(v),ColumnViewerEditor.TABBING_HORIZONTAL|ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR|ColumnViewerEditor.TABBING_VERTICAL)); > > > MyModel[] model = createModel(); >Index: Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet026TreeViewerTabEditing.java >=================================================================== >RCS file: Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet026TreeViewerTabEditing.java >diff -N Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet026TreeViewerTabEditing.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet026TreeViewerTabEditing.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,203 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 Tom Schindl 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: >+ * Tom Schindl - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.jface.snippets.viewers; >+ >+import java.util.ArrayList; >+ >+import org.eclipse.jface.viewers.CellEditor; >+import org.eclipse.jface.viewers.CellEditorActivationEvent; >+import org.eclipse.jface.viewers.ColumnLabelProvider; >+import org.eclipse.jface.viewers.ColumnViewerEditorActivationSupport; >+import org.eclipse.jface.viewers.EditingSupport; >+import org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter; >+import org.eclipse.jface.viewers.ITreeContentProvider; >+import org.eclipse.jface.viewers.SWTCellFocusManager; >+import org.eclipse.jface.viewers.TextCellEditor; >+import org.eclipse.jface.viewers.TreeFocusCellManager; >+import org.eclipse.jface.viewers.TreeViewer; >+import org.eclipse.jface.viewers.TreeViewerColumn; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.FillLayout; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Shell; >+ >+/** >+ * A simple TreeViewer to demonstrate usage >+ * >+ * @author Tom Schindl <tom.schindl@bestsolution.at> >+ * >+ */ >+public class Snippet026TreeViewerTabEditing { >+ public Snippet026TreeViewerTabEditing(final Shell shell) { >+ final TreeViewer v = new TreeViewer(shell, SWT.BORDER >+ | SWT.FULL_SELECTION); >+ v.getTree().setLinesVisible(true); >+ v.getTree().setHeaderVisible(true); >+ >+ TreeFocusCellManager focusCellManager = new TreeFocusCellManager(new FocusCellOwnerDrawHighlighter(v), new ColumnViewerCellNavigationStrategy()); >+ ColumnViewerEditorActivationSupport actSupport = new ColumnViewerEditorActivationSupport( >+ v, cellSupport) { >+ >+ protected boolean isEditorActivationEvent( >+ CellEditorActivationEvent event) { >+ return event.eventType == CellEditorActivationEvent.TRAVERSAL >+ || event.eventType == CellEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION >+ || (event.eventType == CellEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR) >+ || event.eventType == CellEditorActivationEvent.PROGRAMATIC; >+ } >+ >+ }; >+ >+ TreeColumnViewerEditor treeViewerEditor = new TreeColumnViewerEditor (v, focusCellManager /*oder null fuer keine focus cell*/, actSupport, TreeColumnViewerEditor.TABBING_HORIZONTAL); >+ v.setEditor(treeViewerEditor); >+ >+ final TextCellEditor textCellEditor = new TextCellEditor(v.getTree()); >+ >+ TreeViewerColumn column = new TreeViewerColumn(v, SWT.NONE); >+ column.getColumn().setWidth(200); >+ column.getColumn().setText("Column 1"); >+ column.setLabelProvider(new ColumnLabelProvider() { >+ >+ public String getText(Object element) { >+ return "Column 1 => " + element.toString(); >+ } >+ >+ }); >+ column.setEditingSupport(new EditingSupport(v) { >+ protected boolean canEdit(Object element) { >+ return true; >+ } >+ >+ protected CellEditor getCellEditor(Object element) { >+ return textCellEditor; >+ } >+ >+ protected Object getValue(Object element) { >+ return ((MyModel) element).counter + ""; >+ } >+ >+ protected void setValue(Object element, Object value) { >+ ((MyModel) element).counter = Integer >+ .parseInt(value.toString()); >+ v.update(element, null); >+ } >+ }); >+ v.setTabEditingStyle(EditingSupport.TABBING_HORIZONTAL >+ | EditingSupport.TABBING_MOVE_TO_ROW_NEIGHBOR >+ | EditingSupport.TABBING_VERTICAL); >+ >+ column = new TreeViewerColumn(v, SWT.NONE); >+ column.getColumn().setWidth(200); >+ column.getColumn().setText("Column 2"); >+ column.setLabelProvider(new ColumnLabelProvider() { >+ >+ public String getText(Object element) { >+ return "Column 2 => " + element.toString(); >+ } >+ >+ }); >+ >+ v.setContentProvider(new MyContentProvider()); >+ >+ v.setInput(createModel()); >+ } >+ >+ private MyModel createModel() { >+ >+ MyModel root = new MyModel(0, null); >+ root.counter = 0; >+ >+ MyModel tmp; >+ MyModel subItem; >+ for (int i = 1; i < 10; i++) { >+ tmp = new MyModel(i, root); >+ root.child.add(tmp); >+ for (int j = 1; j < i; j++) { >+ subItem = new MyModel(j, tmp); >+ subItem.child.add(new MyModel(j * 100, subItem)); >+ tmp.child.add(subItem); >+ } >+ } >+ >+ return root; >+ } >+ >+ public static void main(String[] args) { >+ Display display = new Display(); >+ Shell shell = new Shell(display); >+ shell.setLayout(new FillLayout()); >+ new Snippet026TreeViewerTabEditing(shell); >+ shell.open(); >+ >+ while (!shell.isDisposed()) { >+ if (!display.readAndDispatch()) >+ display.sleep(); >+ } >+ >+ display.dispose(); >+ } >+ >+ private class MyContentProvider implements ITreeContentProvider { >+ >+ public Object[] getElements(Object inputElement) { >+ return ((MyModel) inputElement).child.toArray(); >+ } >+ >+ public void dispose() { >+ } >+ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ } >+ >+ public Object[] getChildren(Object parentElement) { >+ return getElements(parentElement); >+ } >+ >+ public Object getParent(Object element) { >+ if (element == null) { >+ return null; >+ } >+ return ((MyModel) element).parent; >+ } >+ >+ public boolean hasChildren(Object element) { >+ return ((MyModel) element).child.size() > 0; >+ } >+ >+ } >+ >+ public class MyModel { >+ public MyModel parent; >+ >+ public ArrayList child = new ArrayList(); >+ >+ public int counter; >+ >+ public MyModel(int counter, MyModel parent) { >+ this.parent = parent; >+ this.counter = counter; >+ } >+ >+ public String toString() { >+ String rv = "Item "; >+ if (parent != null) { >+ rv = parent.toString() + "."; >+ } >+ >+ rv += counter; >+ >+ return rv; >+ } >+ } >+ >+} >#P org.eclipse.jface >Index: src/org/eclipse/jface/viewers/TableViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewer.java,v >retrieving revision 1.75 >diff -u -r1.75 TableViewer.java >--- src/org/eclipse/jface/viewers/TableViewer.java 5 Feb 2007 02:49:28 -0000 1.75 >+++ src/org/eclipse/jface/viewers/TableViewer.java 27 Feb 2007 21:46:20 -0000 >@@ -16,9 +16,7 @@ > > > import org.eclipse.core.runtime.Assert; >-import org.eclipse.jface.viewers.CellEditor.LayoutData; > import org.eclipse.swt.SWT; >-import org.eclipse.swt.custom.TableEditor; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.graphics.Point; > import org.eclipse.swt.widgets.Composite; >@@ -67,11 +65,6 @@ > private Table table; > > /** >- * This viewer's table editor. >- */ >- private TableEditor tableEditor; >- >- /** > * Creates a table viewer on a newly-created table control under the given > * parent. The table control is created using the SWT style bits > * <code>MULTI, H_SCROLL, V_SCROLL,</code> and <code>BORDER</code>. The >@@ -110,7 +103,6 @@ > */ > public TableViewer(Table table) { > this.table = table; >- tableEditor = new TableEditor(table); > hookControl(table); > } > >@@ -128,31 +120,7 @@ > } > > protected ColumnViewerEditor createViewerEditor() { >- return new ColumnViewerEditor(this) { >- >- protected StructuredSelection createSelection(Object element) { >- return new StructuredSelection(element); >- } >- >- protected Item[] getSelection() { >- return table.getSelection(); >- } >- >- protected void setEditor(Control w, Item item, int fColumnNumber) { >- tableEditor.setEditor(w, (TableItem) item, fColumnNumber); >- } >- >- protected void setLayoutData(LayoutData layoutData) { >- tableEditor.grabHorizontal = layoutData.grabHorizontal; >- tableEditor.horizontalAlignment = layoutData.horizontalAlignment; >- tableEditor.minimumWidth = layoutData.minimumWidth; >- } >- >- protected void showSelection() { >- table.showSelection(); >- } >- >- }; >+ return new TableColumnViewerEditor(this,new ColumnViewerKeyboardSupport(this),ColumnViewerEditor.DEFAULT); > } > > /** >Index: src/org/eclipse/jface/viewers/TreeViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java,v >retrieving revision 1.77 >diff -u -r1.77 TreeViewer.java >--- src/org/eclipse/jface/viewers/TreeViewer.java 5 Feb 2007 02:49:28 -0000 1.77 >+++ src/org/eclipse/jface/viewers/TreeViewer.java 27 Feb 2007 21:46:22 -0000 >@@ -16,9 +16,7 @@ > import java.util.List; > > import org.eclipse.jface.util.Policy; >-import org.eclipse.jface.viewers.CellEditor.LayoutData; > import org.eclipse.swt.SWT; >-import org.eclipse.swt.custom.TreeEditor; > import org.eclipse.swt.events.DisposeEvent; > import org.eclipse.swt.events.DisposeListener; > import org.eclipse.swt.events.TreeEvent; >@@ -63,11 +61,6 @@ > private Tree tree; > > /** >- * This viewer's tree editor. >- */ >- private TreeEditor treeEditor; >- >- /** > * Flag for whether the tree has been disposed of. > */ > private boolean treeIsDisposed = false; >@@ -116,7 +109,6 @@ > super(); > this.tree = tree; > hookControl(tree); >- treeEditor = new TreeEditor(tree); > } > > /* >@@ -274,35 +266,7 @@ > } > > protected ColumnViewerEditor createViewerEditor() { >- return new ColumnViewerEditor(this) { >- >- protected StructuredSelection createSelection(Object element) { >- if (element instanceof TreePath) { >- return new TreeSelection((TreePath) element, getComparer()); >- } >- >- return new StructuredSelection(element); >- } >- >- protected Item[] getSelection() { >- return tree.getSelection(); >- } >- >- protected void setEditor(Control w, Item item, int fColumnNumber) { >- treeEditor.setEditor(w, (TreeItem) item, fColumnNumber); >- } >- >- protected void setLayoutData(LayoutData layoutData) { >- treeEditor.grabHorizontal = layoutData.grabHorizontal; >- treeEditor.horizontalAlignment = layoutData.horizontalAlignment; >- treeEditor.minimumWidth = layoutData.minimumWidth; >- } >- >- protected void showSelection() { >- getTree().showSelection(); >- } >- >- }; >+ return new TreeColumnViewerEditor(this,new ColumnViewerKeyboardSupport(this),ColumnViewerEditor.DEFAULT); > } > > /* >Index: src/org/eclipse/jface/viewers/EditingSupport.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/EditingSupport.java,v >retrieving revision 1.6 >diff -u -r1.6 EditingSupport.java >--- src/org/eclipse/jface/viewers/EditingSupport.java 4 Feb 2007 22:00:23 -0000 1.6 >+++ src/org/eclipse/jface/viewers/EditingSupport.java 27 Feb 2007 21:46:20 -0000 >@@ -13,9 +13,8 @@ > > package org.eclipse.jface.viewers; > >+ > import org.eclipse.core.runtime.Assert; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.events.TraverseEvent; > > /** > * EditingSupport is the abstract superclass of the support for cell editing. >@@ -27,32 +26,6 @@ > * > */ > public abstract class EditingSupport { >- /** >- * Tabing from cell to cell is turned off >- */ >- public static final int TABBING_NONE = 1; >- >- /** >- * Should if the end of the row is reach started from the start/end of the >- * row below/above >- */ >- public static final int TABBING_MOVE_TO_ROW_NEIGHBOR = 1 << 1; >- >- /** >- * Should if the end of the row is reach started from the beginning in the >- * same row >- */ >- public static final int TABBING_CYCLE_IN_ROW = 1 << 2; >- >- /** >- * Support tabing to Cell above/below the current cell >- */ >- public static final int TABBING_VERTICAL = 1 << 3; >- >- /** >- * Should tabing from column to column with in one row be supported >- */ >- public static final int TABBING_HORIZONTAL = 1 << 4; > > private ColumnViewer viewer; > >@@ -103,171 +76,6 @@ > * the new value > */ > protected abstract void setValue(Object element, Object value); >- >- /** >- * @return <code>true</code> if tabing supported >- */ >- protected boolean isTabingSupported() { >- return (TABBING_NONE & getTabingStyle()) != TABBING_NONE; >- } >- >- /** >- * @return the bit mask representing the tabing style >- */ >- int getTabingStyle() { >- return viewer.getTabEditingStyle(); >- } >- >- /** >- * Process the travers event and opens the next available editor depending >- * of the implemented strategy. The default implementation uses the style >- * constants >- * <ul> >- * <li>{@link #TABBING_MOVE_TO_ROW_NEIGHBOR}</li> >- * <li>{@link #TABBING_CYCLE_IN_ROW}</li> >- * <li>{@link #TABBING_VERTICAL}</li> >- * <li>{@link #TABBING_HORIZONTAL}</li> >- * </ul> >- * >- * <p> >- * Subclasses may overwrite to implement their custom logic to edit the next >- * cell >- * </p> >- * >- * @param columnIndex >- * the index of the current column >- * @param row >- * the current row >- * @param event >- * the travers event >- */ >- protected void processTraversEvent(int columnIndex, >- ViewerRow row, TraverseEvent event) { >- >- ViewerCell cell2edit = null; >- >- if (event.detail == SWT.TRAVERSE_TAB_PREVIOUS) { >- event.doit = false; >- >- if ((event.stateMask & SWT.CTRL) == SWT.CTRL >- && (getTabingStyle() & TABBING_VERTICAL) == TABBING_VERTICAL) { >- cell2edit = searchCellAboveBelow(row, viewer, columnIndex, true); >- } else if ((getTabingStyle() & TABBING_HORIZONTAL) == TABBING_HORIZONTAL) { >- cell2edit = searchPreviousCell(row, viewer, columnIndex, >- columnIndex); >- } >- } else if (event.detail == SWT.TRAVERSE_TAB_NEXT) { >- event.doit = false; >- >- if ((event.stateMask & SWT.CTRL) == SWT.CTRL >- && (getTabingStyle() & TABBING_VERTICAL) == TABBING_VERTICAL) { >- cell2edit = searchCellAboveBelow(row, viewer, columnIndex, >- false); >- } else if ((getTabingStyle() & TABBING_HORIZONTAL) == TABBING_HORIZONTAL) { >- cell2edit = searchNextCell(row, viewer, columnIndex, >- columnIndex); >- } >- } >- >- if (cell2edit != null) { >- viewer.editElement(cell2edit.getElement(), cell2edit >- .getColumnIndex()); >- } >- } >- >- private ViewerCell searchCellAboveBelow(ViewerRow row, ColumnViewer viewer, >- int columnIndex, boolean above) { >- ViewerCell rv = null; >- >- ViewerRow newRow = null; >- >- if (above) { >- newRow = row.getNeighbor(ViewerRow.ABOVE, false); >- } else { >- newRow = row.getNeighbor(ViewerRow.BELOW,false); >- } >- >- if (newRow != null) { >- ViewerColumn column = viewer.getViewerColumn(columnIndex); >- if (column != null >- && column.getEditingSupport().canEdit( >- newRow.getItem().getData())) { >- rv = newRow.getCell(columnIndex); >- } else { >- rv = searchCellAboveBelow(newRow, viewer, columnIndex, above); >- } >- } >- >- return rv; >- } >- >- private ViewerCell searchPreviousCell(ViewerRow row, ColumnViewer viewer, >- int columnIndex, int startIndex) { >- ViewerCell rv = null; >- >- if (columnIndex - 1 >= 0) { >- ViewerColumn column = viewer.getViewerColumn(columnIndex - 1); >- if (column != null >- && column.getEditingSupport().canEdit( >- row.getItem().getData())) { >- rv = row.getCell(columnIndex - 1); >- } else { >- rv = searchPreviousCell(row, viewer, columnIndex - 1, >- startIndex); >- } >- } else { >- if ((getTabingStyle() & TABBING_CYCLE_IN_ROW) == TABBING_CYCLE_IN_ROW) { >- // Check that we don't get into endless loop >- if (columnIndex - 1 != startIndex) { >- // Don't subtract -1 from getColumnCount() we need to >- // start in the virtual column >- // next to it >- rv = searchPreviousCell(row, viewer, row.getColumnCount(), >- startIndex); >- } >- } else if ((getTabingStyle() & TABBING_MOVE_TO_ROW_NEIGHBOR) == TABBING_MOVE_TO_ROW_NEIGHBOR) { >- ViewerRow rowAbove = row.getNeighbor(ViewerRow.ABOVE,false); >- if (rowAbove != null) { >- rv = searchPreviousCell(rowAbove, viewer, rowAbove >- .getColumnCount(), startIndex); >- } >- } >- } >- >- return rv; >- } >- >- private ViewerCell searchNextCell(ViewerRow row, ColumnViewer viewer, >- int columnIndex, int startIndex) { >- ViewerCell rv = null; >- >- if (columnIndex + 1 < row.getColumnCount()) { >- ViewerColumn column = viewer.getViewerColumn(columnIndex + 1); >- if (column != null >- && column.getEditingSupport().canEdit( >- row.getItem().getData())) { >- rv = row.getCell(columnIndex + 1); >- } else { >- rv = searchNextCell(row, viewer, columnIndex + 1, startIndex); >- } >- } else { >- if ((getTabingStyle() & TABBING_CYCLE_IN_ROW) == TABBING_CYCLE_IN_ROW) { >- // Check that we don't get into endless loop >- if (columnIndex + 1 != startIndex) { >- // Start from -1 from the virtual column before the >- // first one >- rv = searchNextCell(row, viewer, -1, startIndex); >- } >- } else if ((getTabingStyle() & TABBING_MOVE_TO_ROW_NEIGHBOR) == TABBING_MOVE_TO_ROW_NEIGHBOR) { >- ViewerRow rowBelow = row.getNeighbor(ViewerRow.BELOW,false); >- if (rowBelow != null) { >- rv = searchNextCell(rowBelow, viewer, -1, startIndex); >- } >- } >- } >- >- return rv; >- } > > /** > * @return the viewer this editing support works for >Index: src/org/eclipse/jface/viewers/ColumnViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnViewer.java,v >retrieving revision 1.24 >diff -u -r1.24 ColumnViewer.java >--- src/org/eclipse/jface/viewers/ColumnViewer.java 5 Feb 2007 04:55:37 -0000 1.24 >+++ src/org/eclipse/jface/viewers/ColumnViewer.java 27 Feb 2007 21:46:18 -0000 >@@ -14,6 +14,8 @@ > > package org.eclipse.jface.viewers; > >+import java.util.List; >+ > import org.eclipse.core.runtime.Assert; > import org.eclipse.swt.events.MouseAdapter; > import org.eclipse.swt.events.MouseEvent; >@@ -38,6 +40,11 @@ > * > */ > public abstract class ColumnViewer extends StructuredViewer { >+ private CellEditor[] cellEditors; >+ >+ private ICellModifier cellModifier; >+ >+ private String[] columnProperties; > > private ToolTipSupport tooltipSupport; > >@@ -48,17 +55,16 @@ > > private ColumnViewerEditor viewerEditor; > >- private int tabEditingStyle = EditingSupport.TABBING_NONE; >- > /** > * Create a new instance of the receiver. > */ > public ColumnViewer() { >- viewerEditor = createViewerEditor(); >+ > } > > protected void hookControl(Control control) { > super.hookControl(control); >+ viewerEditor = createViewerEditor(); > hookEditingSupport(control); > } > >@@ -76,16 +82,18 @@ > if (viewerEditor != null) { > control.addMouseListener(new MouseAdapter() { > public void mouseDown(MouseEvent e) { >- viewerEditor.handleMouseDown(e); >+ handleMouseDown(e); > } > }); > } > } > > /** >- * Creates the viewer editor used for editing cell contents. To be implemented by subclasses. >+ * Creates the viewer editor used for editing cell contents. To be >+ * implemented by subclasses. > * >- * @return the editor, or <code>null</code> if this viewer does not support editing cell contents. >+ * @return the editor, or <code>null</code> if this viewer does not >+ * support editing cell contents. > */ > protected abstract ColumnViewerEditor createViewerEditor(); > >@@ -95,7 +103,8 @@ > * > * @param point > * the widget-relative coordinates >- * @return the cell or <code>null</code> if no cell is found at the given point >+ * @return the cell or <code>null</code> if no cell is found at the given >+ * point > */ > ViewerCell getCell(Point point) { > ViewerRow row = getViewerRow(point); >@@ -127,7 +136,8 @@ > /** > * Returns the viewer row associated with the given row widget. > * >- * @param item the row widget >+ * @param item >+ * the row widget > * @return ViewerRow the associated viewer row > */ > protected ViewerRow getViewerRowFromItem(Widget item) { >@@ -137,7 +147,8 @@ > /** > * Returns the column widget at the given column index. > * >- * @param columnIndex the column index >+ * @param columnIndex >+ * the column index > * @return Widget the column widget > */ > protected abstract Widget getColumnViewerOwner(int columnIndex); >@@ -150,7 +161,7 @@ > * @return the viewer column at the given index, or <code>null</code> if > * there is none for the given index > */ >- /* package */ ViewerColumn getViewerColumn(final int columnIndex) { >+ /* package */ViewerColumn getViewerColumn(final int columnIndex) { > > ViewerColumn viewer; > Widget columnOwner = getColumnViewerOwner(columnIndex); >@@ -176,7 +187,8 @@ > } > > /** >- * Sets up editing support for the given column based on the "old" cell editor API. >+ * Sets up editing support for the given column based on the "old" cell >+ * editor API. > * > * @param columnIndex > * @param viewer >@@ -229,15 +241,19 @@ > } > > /** >- * Creates a generic viewer column for the given column widget, based on the given label provider. >+ * Creates a generic viewer column for the given column widget, based on the >+ * given label provider. > * >- * @param columnOwner the column widget >- * @param labelProvider the label provider to use for the column >+ * @param columnOwner >+ * the column widget >+ * @param labelProvider >+ * the label provider to use for the column > * @return ViewerColumn the viewer column > */ > private ViewerColumn createViewerColumn(Widget columnOwner, > CellLabelProvider labelProvider) { >- ViewerColumn column = new ViewerColumn(this,columnOwner) {}; >+ ViewerColumn column = new ViewerColumn(this, columnOwner) { >+ }; > column.setLabelProvider(labelProvider, false); > return column; > } >@@ -269,19 +285,19 @@ > * @param column > * @return ViewerCell > */ >- /* package */ ViewerCell updateCell(ViewerRow rowItem, int column) { >+ /* package */ViewerCell updateCell(ViewerRow rowItem, int column) { > cell.update(rowItem, column); > return cell; > } > > /** > * Returns the {@link Item} at the given widget-relative coordinates, or >- * <code>null</code> if there is no item at the given coordinates. >+ * <code>null</code> if there is no item at the given coordinates. > * > * @param point > * the widget-relative coordinates >- * @return the {@link Item} at the coordinates or <code>null</code> if there >- * is no item at the given coordinates >+ * @return the {@link Item} at the coordinates or <code>null</code> if >+ * there is no item at the given coordinates > */ > protected abstract Item getItemAt(Point point); > >@@ -339,7 +355,7 @@ > > /** > * Cancels a currently active cell editor if one is active. All changes >- * already done in the cell editor are lost. >+ * already done in the cell editor are lost. > * > * @since 3.1 (in subclasses, added in 3.3 to abstract class) > */ >@@ -371,17 +387,37 @@ > */ > public void editElement(Object element, int column) { > if (viewerEditor != null) { >- viewerEditor.editElement(element, column); >+ Widget item = findItem(element); >+ if (item != null) { >+ ViewerRow row = getViewerRowFromItem(item); >+ if (row != null) { >+ ViewerCell cell = row.getCell(column); >+ if (cell != null) { >+ getControl().setRedraw(false); >+ >+ List l = getSelectionFromWidget(); >+ >+ if (l.size() > 1 || !l.contains(cell.getElement())) { >+ setSelection(new StructuredSelection(cell >+ .getElement())); >+ } >+ >+ triggerEditorActivationEvent(new EditorActivationEvent( >+ cell)); >+ getControl().setRedraw(true); >+ } >+ } >+ } > } > } > > /** > * Return the CellEditors for the receiver, or <code>null</code> if no >- * cell editors are set. >+ * cell editors are set. > * <p> > * Since 3.3, an alternative API is available, see >- * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible >- * way of editing values in a column viewer. >+ * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more >+ * flexible way of editing values in a column viewer. > * </p> > * > * @return CellEditor[] >@@ -390,20 +426,17 @@ > * @see EditingSupport > */ > public CellEditor[] getCellEditors() { >- if (viewerEditor != null) { >- return viewerEditor.getCellEditors(); >- } >- return null; >+ return cellEditors; > } > > /** > * Returns the cell modifier of this viewer, or <code>null</code> if none >- * has been set. >+ * has been set. > * > * <p> > * Since 3.3, an alternative API is available, see >- * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible >- * way of editing values in a column viewer. >+ * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more >+ * flexible way of editing values in a column viewer. > * </p> > * > * @return the cell modifier, or <code>null</code> >@@ -412,10 +445,7 @@ > * @see EditingSupport > */ > public ICellModifier getCellModifier() { >- if (viewerEditor != null) { >- return viewerEditor.getCellModifier(); >- } >- return null; >+ return cellModifier; > } > > /** >@@ -425,8 +455,8 @@ > * > * <p> > * Since 3.3, an alternative API is available, see >- * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible >- * way of editing values in a column viewer. >+ * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more >+ * flexible way of editing values in a column viewer. > * </p> > * > * @return the list of column properties >@@ -435,10 +465,7 @@ > * @see EditingSupport > */ > public Object[] getColumnProperties() { >- if (viewerEditor != null) { >- return viewerEditor.getColumnProperties(); >- } >- return null; >+ return columnProperties; > } > > /** >@@ -446,8 +473,8 @@ > * > * <p> > * Since 3.3, an alternative API is available, see >- * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible >- * way of editing values in a column viewer. >+ * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more >+ * flexible way of editing values in a column viewer. > * </p> > * > * @return <code>true</code> if there is an active cell editor, and >@@ -469,8 +496,8 @@ > * > * <p> > * Since 3.3, an alternative API is available, see >- * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible >- * way of editing values in a column viewer. >+ * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more >+ * flexible way of editing values in a column viewer. > * </p> > * > * @param editors >@@ -480,19 +507,17 @@ > * @see EditingSupport > */ > public void setCellEditors(CellEditor[] editors) { >- if (viewerEditor != null) { >- viewerEditor.setCellEditors(editors); >- } >+ this.cellEditors = editors; > } > > /** >- * Sets the cell modifier for this column viewer. This method does nothing if editing >- * is not supported by this viewer. >+ * Sets the cell modifier for this column viewer. This method does nothing >+ * if editing is not supported by this viewer. > * > * <p> > * Since 3.3, an alternative API is available, see >- * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible >- * way of editing values in a column viewer. >+ * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more >+ * flexible way of editing values in a column viewer. > * </p> > * > * @param modifier >@@ -502,9 +527,7 @@ > * @see EditingSupport > */ > public void setCellModifier(ICellModifier modifier) { >- if (viewerEditor != null) { >- viewerEditor.setCellModifier(modifier); >- } >+ this.cellModifier = modifier; > } > > /** >@@ -515,8 +538,8 @@ > * > * <p> > * Since 3.3, an alternative API is available, see >- * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible >- * way of editing values in a column viewer. >+ * {@link ViewerColumn#setEditingSupport(EditingSupport)} for a more >+ * flexible way of editing values in a column viewer. > * </p> > * > * @param columnProperties >@@ -526,25 +549,9 @@ > * @see EditingSupport > */ > public void setColumnProperties(String[] columnProperties) { >- if (viewerEditor != null) { >- viewerEditor.setColumnProperties(columnProperties); >- } >- } >- >- /** >- * The tab-editing style used if the default implementation is used >- * >- * @param tabEditingStyle >- * bit mask for the tab editing style >- */ >- public void setTabEditingStyle(int tabEditingStyle) { >- this.tabEditingStyle = tabEditingStyle; >+ this.columnProperties = columnProperties; > } > >- int getTabEditingStyle() { >- return this.tabEditingStyle; >- } >- > /** > * Returns the number of columns contained in the receiver. If no columns > * were created by the programmer, this value is zero, despite the fact that >@@ -576,4 +583,52 @@ > } > return null; > } >-} >+ >+ private void handleMouseDown(MouseEvent e) { >+ ViewerCell cell = getCell(new Point(e.x, e.y)); >+ >+ if (cell != null) { >+ triggerEditorActivationEvent(new EditorActivationEvent(cell, e)); >+ } >+ } >+ >+ /** >+ * Invoking this method fires an editor activation event which tries to >+ * enable the editor but before this event is passed to >+ * {@link ColumnViewerKeyboardSupport} to see if this event should really >+ * trigger editor activation >+ * >+ * @param event >+ * the activation event >+ */ >+ protected void triggerEditorActivationEvent(EditorActivationEvent event) { >+ viewerEditor.handleEditorActivationEvent(event); >+ } >+ >+ /** >+ * To fully control the strategy used to control on which cell-selection >+ * events the editor has to be activated you can pass your customized >+ * strategy using this method. >+ * >+ * @param editorActivationStrategy >+ * the strategy used to activate an editor >+ */ >+ public void setEditorActivationSupport( >+ ColumnViewerKeyboardSupport editorActivationStrategy) { >+ if (viewerEditor != null) { >+ viewerEditor.setEditorActivationStrategy(editorActivationStrategy); >+ } else { >+ throw new IllegalStateException( >+ "This feature is not supported by the widget"); //$NON-NLS-1$ >+ } >+ } >+ >+ /** >+ * @param columnViewerEditor >+ * the new column viewer editor >+ */ >+ public void setColumnViewerEditor(ColumnViewerEditor columnViewerEditor) { >+ Assert.isNotNull(viewerEditor); >+ this.viewerEditor = columnViewerEditor; >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/jface/viewers/CellEditor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/CellEditor.java,v >retrieving revision 1.25 >diff -u -r1.25 CellEditor.java >--- src/org/eclipse/jface/viewers/CellEditor.java 10 Nov 2006 17:42:08 -0000 1.25 >+++ src/org/eclipse/jface/viewers/CellEditor.java 27 Feb 2007 21:46:17 -0000 >@@ -853,4 +853,14 @@ > dirty = true; > fireEditorValueChanged(oldValidState, newValidState); > } >+ >+ /** >+ * Activate the editor but also inform the editor which event triggered its activation. >+ * <b>The default implementation simply calls {@link #activate()}</b> >+ * >+ * @param activationEvent the editor activation event >+ */ >+ public void activate(EditorActivationEvent activationEvent) { >+ activate(); >+ } > } >Index: src/org/eclipse/jface/viewers/ColumnViewerEditor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnViewerEditor.java,v >retrieving revision 1.1 >diff -u -r1.1 ColumnViewerEditor.java >--- src/org/eclipse/jface/viewers/ColumnViewerEditor.java 5 Feb 2007 02:49:28 -0000 1.1 >+++ src/org/eclipse/jface/viewers/ColumnViewerEditor.java 27 Feb 2007 21:46:20 -0000 >@@ -14,6 +14,11 @@ > > package org.eclipse.jface.viewers; > >+ >+import java.util.List; >+ >+import org.eclipse.core.runtime.ListenerList; >+import org.eclipse.swt.SWT; > import org.eclipse.swt.events.FocusAdapter; > import org.eclipse.swt.events.FocusEvent; > import org.eclipse.swt.events.FocusListener; >@@ -22,7 +27,6 @@ > import org.eclipse.swt.events.MouseListener; > import org.eclipse.swt.events.TraverseEvent; > import org.eclipse.swt.events.TraverseListener; >-import org.eclipse.swt.graphics.Rectangle; > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Item; >@@ -40,39 +44,67 @@ > public abstract class ColumnViewerEditor { > private CellEditor cellEditor; > >- private CellEditor[] cellEditors; >- >- private ICellModifier cellModifier; >- >- private String[] columnProperties; >- >- private int columnNumber; >- > private ICellEditorListener cellEditorListener; > > private FocusListener focusListener; > > private MouseListener mouseListener; > >- private int doubleClickExpirationTime; >- > private ColumnViewer viewer; > >- private Item item; >- > private TraverseListener tabeditingListener; > >+ private int activationTime; >+ >+ private ViewerCell cell; >+ >+ private EditorActivationEvent activationEvent; >+ >+ private ListenerList editorActivationListener; >+ >+ private ColumnViewerKeyboardSupport editorActivationStrategy; >+ >+ /** >+ * Tabing from cell to cell is turned off >+ */ >+ public static final int DEFAULT = 1; >+ >+ /** >+ * Should if the end of the row is reach started from the start/end of the >+ * row below/above >+ */ >+ public static final int TABBING_MOVE_TO_ROW_NEIGHBOR = 1 << 1; >+ >+ /** >+ * Should if the end of the row is reach started from the beginning in the >+ * same row >+ */ >+ public static final int TABBING_CYCLE_IN_ROW = 1 << 2; >+ >+ /** >+ * Support tabing to Cell above/below the current cell >+ */ >+ public static final int TABBING_VERTICAL = 1 << 3; >+ >+ /** >+ * Should tabing from column to column with in one row be supported >+ */ >+ public static final int TABBING_HORIZONTAL = 1 << 4; >+ >+ private int feature; >+ > /** >- * Create a new editor implementation for the viewer >- * > * @param viewer >- * the column viewer >+ * @param editorActivationStrategy >+ * @param feature > */ >- public ColumnViewerEditor(ColumnViewer viewer) { >+ protected ColumnViewerEditor(ColumnViewer viewer, ColumnViewerKeyboardSupport editorActivationStrategy, int feature) { > this.viewer = viewer; >+ this.editorActivationStrategy = editorActivationStrategy; >+ this.feature = feature; > initCellEditorListener(); > } >- >+ > private void initCellEditorListener() { > cellEditorListener = new ICellEditorListener() { > public void editorValueChanged(boolean oldValidState, >@@ -92,13 +124,26 @@ > > void activateCellEditor() { > >- ViewerColumn part = viewer.getViewerColumn(columnNumber); >- Object element = item.getData(); >- >+ ViewerColumn part = viewer.getViewerColumn(cell.getColumnIndex()); >+ Object element = cell.getElement(); >+ > if (part != null && part.getEditingSupport() != null > && part.getEditingSupport().canEdit(element)) { >+ > cellEditor = part.getEditingSupport().getCellEditor(element); > if (cellEditor != null) { >+ if( editorActivationListener != null && ! editorActivationListener.isEmpty() ) { >+ Object[] ls = editorActivationListener.getListeners(); >+ for( int i = 0; i < ls.length; i++ ) { >+ >+ if( activationEvent.cancle ) { >+ return; >+ } >+ >+ ((ColumnViewerEditorActivationListener)ls[i]).beforeEditorActivated(activationEvent); >+ } >+ } >+ > cellEditor.addListener(cellEditorListener); > Object value = part.getEditingSupport().getValue(element); > cellEditor.setValue(value); >@@ -108,12 +153,12 @@ > // so must get control first, but must still call activate() > // even if there is no control. > final Control control = cellEditor.getControl(); >- cellEditor.activate(); >+ cellEditor.activate(activationEvent); > if (control == null) { > return; > } > setLayoutData(cellEditor.getLayoutData()); >- setEditor(control, item, columnNumber); >+ setEditor(control, cell.getItem(), cell.getColumnIndex()); > cellEditor.setFocus(); > if (focusListener == null) { > focusListener = new FocusAdapter() { >@@ -128,7 +173,7 @@ > public void mouseDown(MouseEvent e) { > // time wrap? > // check for expiration of doubleClickTime >- if (e.time <= doubleClickExpirationTime) { >+ if (e.time <= activationTime) { > control.removeMouseListener(mouseListener); > cancelEditing(); > handleDoubleClickEvent(); >@@ -143,53 +188,25 @@ > tabeditingListener = new TraverseListener() { > > public void keyTraversed(TraverseEvent e) { >- ViewerColumn col = viewer.getViewerColumn(columnNumber); >- if ( col != null && col.getEditingSupport().isTabingSupported() ) { >- col.getEditingSupport().processTraversEvent( >- columnNumber, >- viewer.getViewerRowFromItem(item), e); >+ if( (feature & DEFAULT) != DEFAULT ) { >+ processTraversEvent( >+ cell.getColumnIndex(), >+ viewer.getViewerRowFromItem(cell.getItem()), e); > } > } > }; > } > > control.addTraverseListener(tabeditingListener); >- >- } >- } >- } >- >- /** >- * Activate a cell editor for the given mouse position. >- */ >- private void activateCellEditor(MouseEvent event) { >- if (item == null || item.isDisposed()) { >- // item no longer exists >- return; >- } >- int columnToEdit; >- ViewerRow row = viewer.getViewerRowFromItem(item); >- int columns = row.getColumnCount(); >- if (columns == 0) { >- // If no TableColumn, Table acts as if it has a single column >- // which takes the whole width. >- columnToEdit = 0; >- } else { >- columnToEdit = -1; >- for (int i = 0; i < columns; i++) { >- Rectangle bounds = row.getBounds(i); >- if (bounds.contains(event.x, event.y)) { >- columnToEdit = i; >- break; >+ >+ if( editorActivationListener != null && ! editorActivationListener.isEmpty() ) { >+ Object[] ls = editorActivationListener.getListeners(); >+ for( int i = 0; i < ls.length; i++ ) { >+ ((ColumnViewerEditorActivationListener)ls[i]).afterEditorActivated(activationEvent); >+ } > } > } >- if (columnToEdit == -1) { >- return; >- } > } >- >- columnNumber = columnToEdit; >- activateCellEditor(); > } > > /** >@@ -203,8 +220,22 @@ > // in case save results in applyEditorValue being re-entered > // see 1GAHI8Z: ITPUI:ALL - How to code event notification when > // using cell editor ? >+ EditorDeactivationEvent tmp = new EditorDeactivationEvent(cell); >+ if( editorActivationListener != null && ! editorActivationListener.isEmpty() ) { >+ Object[] ls = editorActivationListener.getListeners(); >+ for( int i = 0; i < ls.length; i++ ) { >+ >+ if( tmp.cancle ) { >+ return; >+ } >+ >+ ((ColumnViewerEditorActivationListener)ls[i]).beforeEditorDeactivated(tmp); >+ } >+ } >+ > this.cellEditor = null; >- Item t = this.item; >+ this.activationEvent = null; >+ Item t = this.cell.getItem(); > // don't null out table item -- same item is still selected > if (t != null && !t.isDisposed()) { > saveEditorValue(c, t); >@@ -227,6 +258,13 @@ > } > } > c.deactivate(); >+ >+ if( editorActivationListener != null && ! editorActivationListener.isEmpty() ) { >+ Object[] ls = editorActivationListener.getListeners(); >+ for( int i = 0; i < ls.length; i++ ) { >+ ((ColumnViewerEditorActivationListener)ls[i]).afterEditorDeactivated(tmp); >+ } >+ } > } > } > >@@ -235,6 +273,18 @@ > */ > void cancelEditing() { > if (cellEditor != null) { >+ EditorDeactivationEvent tmp = new EditorDeactivationEvent(cell); >+ if( editorActivationListener != null && ! editorActivationListener.isEmpty() ) { >+ Object[] ls = editorActivationListener.getListeners(); >+ for( int i = 0; i < ls.length; i++ ) { >+ if( tmp.cancle ) { >+ return; >+ } >+ >+ ((ColumnViewerEditorActivationListener)ls[i]).beforeEditorDeactivated(tmp); >+ } >+ } >+ > setEditor(null, null, 0); > cellEditor.removeListener(cellEditorListener); > >@@ -256,70 +306,39 @@ > > CellEditor oldEditor = cellEditor; > cellEditor = null; >+ activationEvent=null; > oldEditor.deactivate(); >+ >+ if( editorActivationListener != null && ! editorActivationListener.isEmpty() ) { >+ Object[] ls = editorActivationListener.getListeners(); >+ for( int i = 0; i < ls.length; i++ ) { >+ ((ColumnViewerEditorActivationListener)ls[i]).afterEditorDeactivated(tmp); >+ } >+ } > } > } >- >+ > /** > * Enable the editor by mouse down > * > * @param event > */ >- void handleMouseDown(MouseEvent event) { >- if (event.button != 1) { >- return; >- } >- >- if (cellEditor != null) { >- applyEditorValue(); >- } >- >- // activate the cell editor immediately. If a second mouseDown >- // is received prior to the expiration of the doubleClick time then >- // the cell editor will be deactivated and a doubleClick event will >- // be processed. >- // >- doubleClickExpirationTime = event.time >- + Display.getCurrent().getDoubleClickTime(); >- >- Item[] items = getSelection(); >- // Do not edit if more than one row is selected. >- if (items.length != 1) { >- item = null; >- return; >- } >- item = items[0]; >- activateCellEditor(event); >- } >- >- /** >- * Start editing the given element. >- * >- * @param element >- * @param column >- */ >- void editElement(Object element, int column) { >- if (cellEditor != null) { >- applyEditorValue(); >- } >+ void handleEditorActivationEvent(EditorActivationEvent event) { >+ if( editorActivationStrategy.isEditorActivationEvent(event) ) { >+ if (cellEditor != null) { >+ applyEditorValue(); >+ } > >- setSelection(createSelection(element), true); >- Item[] selection = getSelection(); >- if (selection.length != 1) { >- return; >+ this.cell = (ViewerCell)event.getSource(); >+ activationEvent = event; >+ activationTime = event.time + Display.getCurrent().getDoubleClickTime(); >+ >+ activateCellEditor(); > } >- >- item = selection[0]; >- >- // Make sure selection is visible >- showSelection(); >- columnNumber = column; >- activateCellEditor(); >- > } > > private void saveEditorValue(CellEditor cellEditor, Item tableItem) { >- ViewerColumn part = viewer.getViewerColumn(columnNumber); >+ ViewerColumn part = viewer.getViewerColumn(cell.getColumnIndex()); > > if (part != null && part.getEditingSupport() != null) { > part.getEditingSupport().setValue(tableItem.getData(), >@@ -337,70 +356,192 @@ > return cellEditor != null; > } > >- /** >- * Set the cell editors >- * >- * @param editors >- */ >- void setCellEditors(CellEditor[] editors) { >- this.cellEditors = editors; >- } > >- /** >- * Set the cell modifier >- * >- * @param modifier >- */ >- void setCellModifier(ICellModifier modifier) { >- this.cellModifier = modifier; >+ void handleDoubleClickEvent() { >+ viewer.fireDoubleClick(new DoubleClickEvent(viewer, viewer >+ .getSelection())); >+ viewer.fireOpen(new OpenEvent(viewer, viewer.getSelection())); > } > >- /** >- * Set the column properties >- * >- * @param columnProperties >+ void addEditorActivationListener(ColumnViewerEditorActivationListener listener) { >+ if( editorActivationListener == null ) { >+ editorActivationListener = new ListenerList(); >+ } >+ editorActivationListener.add(listener); >+ } >+ >+ void removeEditorActivationListener(ColumnViewerEditorActivationListener listener) { >+ if( editorActivationListener != null ) { >+ editorActivationListener.remove(listener); >+ } >+ } >+ >+ void setEditorActivationStrategy( >+ ColumnViewerKeyboardSupport editorActivationStrategy) { >+ this.editorActivationStrategy = editorActivationStrategy; >+ } >+ >+ /** >+ * Process the travers event and opens the next available editor depending >+ * of the implemented strategy. The default implementation uses the style >+ * constants >+ * <ul> >+ * <li>{@link ColumnViewerEditor#TABBING_MOVE_TO_ROW_NEIGHBOR}</li> >+ * <li>{@link ColumnViewerEditor#TABBING_CYCLE_IN_ROW}</li> >+ * <li>{@link ColumnViewerEditor#TABBING_VERTICAL}</li> >+ * <li>{@link ColumnViewerEditor#TABBING_HORIZONTAL}</li> >+ * </ul> >+ * >+ * <p> >+ * Subclasses may overwrite to implement their custom logic to edit the next >+ * cell >+ * </p> >+ * >+ * @param columnIndex >+ * the index of the current column >+ * @param row >+ * the current row >+ * @param event >+ * the travers event > */ >- void setColumnProperties(String[] columnProperties) { >- this.columnProperties = columnProperties; >- } >+ protected void processTraversEvent(int columnIndex, >+ ViewerRow row, TraverseEvent event) { >+ >+ ViewerCell cell2edit = null; >+ >+ if (event.detail == SWT.TRAVERSE_TAB_PREVIOUS) { >+ event.doit = false; >+ >+ if ((event.stateMask & SWT.CTRL) == SWT.CTRL >+ && (feature & TABBING_VERTICAL) == TABBING_VERTICAL) { >+ cell2edit = searchCellAboveBelow(row, viewer, columnIndex, true); >+ } else if ((feature & TABBING_HORIZONTAL) == TABBING_HORIZONTAL) { >+ cell2edit = searchPreviousCell(row, viewer, columnIndex, >+ columnIndex); >+ } >+ } else if (event.detail == SWT.TRAVERSE_TAB_NEXT) { >+ event.doit = false; > >- /** >- * Return the properties for the column >- * >- * @return the array of column properties >- */ >- Object[] getColumnProperties() { >- return columnProperties; >- } >+ if ((event.stateMask & SWT.CTRL) == SWT.CTRL >+ && (feature & TABBING_VERTICAL) == TABBING_VERTICAL) { >+ cell2edit = searchCellAboveBelow(row, viewer, columnIndex, >+ false); >+ } else if ((feature & TABBING_HORIZONTAL) == TABBING_HORIZONTAL) { >+ cell2edit = searchNextCell(row, viewer, columnIndex, >+ columnIndex); >+ } >+ } > >- /** >- * Get the cell modifier >- * >- * @return the cell modifier >- */ >- ICellModifier getCellModifier() { >- return cellModifier; >+ if (cell2edit != null) { >+ List l = viewer.getSelectionFromWidget(); >+ >+ viewer.getControl().setRedraw(false); >+ >+ //TODO Is this correct in terms of other controls e.g. grid >+ if( ! l.contains(cell2edit.getElement()) ) { >+ viewer.setSelection(new StructuredSelection(cell2edit.getElement())); >+ } >+ >+ EditorActivationEvent acEvent = new EditorActivationEvent(cell2edit,event); >+ viewer.triggerEditorActivationEvent(acEvent); >+ viewer.getControl().setRedraw(true); >+ } > } > >- /** >- * Return the array of CellEditors used in the viewer >- * >- * @return the cell editors >- */ >- CellEditor[] getCellEditors() { >- return cellEditors; >- } >+ private ViewerCell searchCellAboveBelow(ViewerRow row, ColumnViewer viewer, >+ int columnIndex, boolean above) { >+ ViewerCell rv = null; > >- void setSelection(StructuredSelection selection, boolean b) { >- viewer.setSelection(selection, b); >+ ViewerRow newRow = null; >+ >+ if (above) { >+ newRow = row.getNeighbor(ViewerRow.ABOVE, false); >+ } else { >+ newRow = row.getNeighbor(ViewerRow.BELOW,false); >+ } >+ >+ if (newRow != null) { >+ ViewerColumn column = viewer.getViewerColumn(columnIndex); >+ if (column != null >+ && column.getEditingSupport().canEdit( >+ newRow.getItem().getData())) { >+ rv = newRow.getCell(columnIndex); >+ } else { >+ rv = searchCellAboveBelow(newRow, viewer, columnIndex, above); >+ } >+ } >+ >+ return rv; > } > >- void handleDoubleClickEvent() { >- viewer.fireDoubleClick(new DoubleClickEvent(viewer, viewer >- .getSelection())); >- viewer.fireOpen(new OpenEvent(viewer, viewer.getSelection())); >+ private ViewerCell searchPreviousCell(ViewerRow row, ColumnViewer viewer, >+ int columnIndex, int startIndex) { >+ ViewerCell rv = null; >+ >+ if (columnIndex - 1 >= 0) { >+ ViewerColumn column = viewer.getViewerColumn(columnIndex - 1); >+ if (column != null >+ && column.getEditingSupport().canEdit( >+ row.getItem().getData())) { >+ rv = row.getCell(columnIndex - 1); >+ } else { >+ rv = searchPreviousCell(row, viewer, columnIndex - 1, >+ startIndex); >+ } >+ } else { >+ if ((feature & TABBING_CYCLE_IN_ROW) == TABBING_CYCLE_IN_ROW) { >+ // Check that we don't get into endless loop >+ if (columnIndex - 1 != startIndex) { >+ // Don't subtract -1 from getColumnCount() we need to >+ // start in the virtual column >+ // next to it >+ rv = searchPreviousCell(row, viewer, row.getColumnCount(), >+ startIndex); >+ } >+ } else if ((feature & TABBING_MOVE_TO_ROW_NEIGHBOR) == TABBING_MOVE_TO_ROW_NEIGHBOR) { >+ ViewerRow rowAbove = row.getNeighbor(ViewerRow.ABOVE,false); >+ if (rowAbove != null) { >+ rv = searchPreviousCell(rowAbove, viewer, rowAbove >+ .getColumnCount(), startIndex); >+ } >+ } >+ } >+ >+ return rv; > } > >+ private ViewerCell searchNextCell(ViewerRow row, ColumnViewer viewer, >+ int columnIndex, int startIndex) { >+ ViewerCell rv = null; >+ >+ if (columnIndex + 1 < row.getColumnCount()) { >+ ViewerColumn column = viewer.getViewerColumn(columnIndex + 1); >+ if (column != null >+ && column.getEditingSupport().canEdit( >+ row.getItem().getData())) { >+ rv = row.getCell(columnIndex + 1); >+ } else { >+ rv = searchNextCell(row, viewer, columnIndex + 1, startIndex); >+ } >+ } else { >+ if ((feature & TABBING_CYCLE_IN_ROW) == TABBING_CYCLE_IN_ROW) { >+ // Check that we don't get into endless loop >+ if (columnIndex + 1 != startIndex) { >+ // Start from -1 from the virtual column before the >+ // first one >+ rv = searchNextCell(row, viewer, -1, startIndex); >+ } >+ } else if ((feature & TABBING_MOVE_TO_ROW_NEIGHBOR) == TABBING_MOVE_TO_ROW_NEIGHBOR) { >+ ViewerRow rowBelow = row.getNeighbor(ViewerRow.BELOW,false); >+ if (rowBelow != null) { >+ rv = searchNextCell(rowBelow, viewer, -1, startIndex); >+ } >+ } >+ } >+ >+ return rv; >+ } >+ > /** > * Create a selection for this model element > * >@@ -429,14 +570,11 @@ > * the layout data used when editor is displayed > */ > protected abstract void setLayoutData(CellEditor.LayoutData layoutData); >- >+ > /** >- * Show up the current selection (scroll the selection into view) >+ * @return the viewer working for > */ >- protected abstract void showSelection(); >- >- /** >- * @return the current selection >- */ >- protected abstract Item[] getSelection(); >-} >+ protected ColumnViewer getViewer() { >+ return viewer; >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/jface/viewers/ColumnViewerKeyboardSupport.java >=================================================================== >RCS file: src/org/eclipse/jface/viewers/ColumnViewerKeyboardSupport.java >diff -N src/org/eclipse/jface/viewers/ColumnViewerKeyboardSupport.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jface/viewers/ColumnViewerKeyboardSupport.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,91 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation 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: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.jface.viewers; >+ >+import org.eclipse.swt.events.KeyEvent; >+import org.eclipse.swt.events.KeyListener; >+ >+/** >+ * This class is responsible to determin if a cell selection event is triggers >+ * an editor activation >+ * >+ * @since 3.3 >+ */ >+public class ColumnViewerKeyboardSupport { >+ private ColumnViewer viewer; >+ >+ private KeyListener keyboardActivationListener; >+ >+ /** >+ * @param viewer the viewer the editor support is attached to >+ */ >+ public ColumnViewerKeyboardSupport(ColumnViewer viewer) { >+ this.viewer = viewer; >+ } >+ >+ /** >+ * @param event >+ * @return bla bl >+ */ >+ protected boolean isEditorActivationEvent(EditorActivationEvent event) { >+ return event.eventType == EditorActivationEvent.MOUSE_CLICK_SELECTION >+ || event.eventType == EditorActivationEvent.PROGRAMATIC >+ || event.eventType == EditorActivationEvent.TRAVERSAL; >+ } >+ >+ /** >+ * @return the cell holding the current focus >+ */ >+ protected ViewerCell getFocusCell() { >+ return null; >+ } >+ >+ /** >+ * @return the viewer >+ */ >+ public ColumnViewer getViewer() { >+ return viewer; >+ } >+ >+ /** >+ * Enable activation of cell editors by keyboard >+ * @param enable <code>true</code> to enable >+ */ >+ public void setEnableEditorActivationWithKeyboard(boolean enable) { >+ if( enable ) { >+ if( keyboardActivationListener == null ) { >+ keyboardActivationListener = new KeyListener() { >+ >+ public void keyPressed(KeyEvent e) { >+ ViewerCell cell = getFocusCell(); >+ >+ if( cell != null ) { >+ viewer.triggerEditorActivationEvent(new EditorActivationEvent(cell,e)); >+ } >+ } >+ >+ public void keyReleased(KeyEvent e) { >+ >+ } >+ >+ }; >+ viewer.getControl().addKeyListener(keyboardActivationListener); >+ } >+ } else { >+ if( keyboardActivationListener != null ) { >+ viewer.getControl().removeKeyListener(keyboardActivationListener); >+ keyboardActivationListener = null; >+ } >+ } >+ } >+ >+} >Index: src/org/eclipse/jface/viewers/EditorDeactivationEvent.java >=================================================================== >RCS file: src/org/eclipse/jface/viewers/EditorDeactivationEvent.java >diff -N src/org/eclipse/jface/viewers/EditorDeactivationEvent.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jface/viewers/EditorDeactivationEvent.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,41 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation 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: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.jface.viewers; >+ >+import java.util.EventObject; >+ >+/** >+ * This event is fired when an editor deactivated >+ * >+ * @since 3.3 >+ * >+ */ >+public class EditorDeactivationEvent extends EventObject { >+ >+ /** >+ * >+ */ >+ private static final long serialVersionUID = 1L; >+ >+ /** >+ * Cancle the event >+ */ >+ public boolean cancle = false; >+ >+ /** >+ * @param source >+ */ >+ public EditorDeactivationEvent(Object source) { >+ super(source); >+ } >+ >+} >Index: src/org/eclipse/jface/viewers/EditorActivationEvent.java >=================================================================== >RCS file: src/org/eclipse/jface/viewers/EditorActivationEvent.java >diff -N src/org/eclipse/jface/viewers/EditorActivationEvent.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jface/viewers/EditorActivationEvent.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,164 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation 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: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.jface.viewers; >+ >+import java.util.EventObject; >+ >+import org.eclipse.swt.events.KeyEvent; >+import org.eclipse.swt.events.MouseEvent; >+import org.eclipse.swt.events.TraverseEvent; >+ >+/** >+ * This event is passed on when a cell-editor is going to be activated >+ * >+ * @since 3.3 >+ * >+ */ >+public class EditorActivationEvent extends EventObject { >+ /** >+ * >+ */ >+ private static final long serialVersionUID = 1L; >+ >+ /** >+ * if a key is pressed on a selected cell >+ */ >+ public static final int KEY_PRESSED = 1; >+ >+ /** >+ * if a cell is selected using a single click of the mouse >+ */ >+ public static final int MOUSE_CLICK_SELECTION = 2; >+ >+ /** >+ * if a cell is selected using double clicking of the mouse >+ */ >+ public static final int MOUSE_DOUBLE_CLICK_SELECTION = 3; >+ >+ /** >+ * if a cell is activated using code like e.g >+ * {@link ColumnViewer#editElement(Object, int)} >+ */ >+ public static final int PROGRAMATIC = 4; >+ >+ /** >+ * is a cell is activated by traversing >+ */ >+ public static final int TRAVERSAL = 5; >+ >+ /** >+ * the original event triggered >+ */ >+ public EventObject sourceEvent; >+ >+ /** >+ * The time the event is triggered >+ */ >+ public int time; >+ >+ /** >+ * The event type triggered: >+ * <ul> >+ * <li>{@link #KEY_PRESSED} if a key is pressed on a selected cell</li> >+ * <li>{@link #MOUSE_CLICK_SELECTION} if a cell is selected using a single >+ * click of the mouse</li> >+ * <li>{@link #MOUSE_DOUBLE_CLICK_SELECTION} if a cell is selected using >+ * double clicking of the mouse</li> >+ * </ul> >+ */ >+ public int eventType; >+ >+ /** >+ * <b>Only set for {@link #KEY_PRESSED}</b> >+ */ >+ public int keyCode; >+ >+ /** >+ * <b>Only set for {@link #KEY_PRESSED}</b> >+ */ >+ public char character; >+ >+ /** >+ * The statemask >+ */ >+ public int stateMask; >+ >+ /** >+ * Cancle the event (=> editor is not activated) >+ */ >+ public boolean cancle = false; >+ >+ /** >+ * This constructor can be used when no event exists. The type set is >+ * {@link #PROGRAMATIC} >+ * >+ * @param cell >+ * the cell >+ */ >+ public EditorActivationEvent(ViewerCell cell) { >+ super(cell); >+ eventType = PROGRAMATIC; >+ } >+ >+ /** >+ * This constructor is used for all types of mouse events. Currently the >+ * type is can be {@link #MOUSE_CLICK_SELECTION} and >+ * {@link #MOUSE_DOUBLE_CLICK_SELECTION} >+ * >+ * @param cell >+ * the cell source of the event >+ * @param event >+ * the event >+ */ >+ public EditorActivationEvent(ViewerCell cell, MouseEvent event) { >+ super(cell); >+ >+ if (event.count >= 2) { >+ eventType = MOUSE_DOUBLE_CLICK_SELECTION; >+ } else { >+ eventType = MOUSE_CLICK_SELECTION; >+ } >+ >+ this.sourceEvent = event; >+ this.time = event.time; >+ } >+ >+ /** >+ * @param cell >+ * the cell source of the event >+ * @param event >+ * the event >+ */ >+ public EditorActivationEvent(ViewerCell cell, KeyEvent event) { >+ super(cell); >+ this.eventType = KEY_PRESSED; >+ this.sourceEvent = event; >+ this.time = 0; >+ this.keyCode = event.keyCode; >+ this.character = event.character; >+ this.stateMask = event.stateMask; >+ } >+ >+ /** >+ * This constructur is used to mark the activation triggered by a traversal >+ * >+ * @param cell >+ * the cell source of the event >+ * @param event >+ * the event >+ */ >+ public EditorActivationEvent(ViewerCell cell, TraverseEvent event) { >+ super(cell); >+ this.eventType = TRAVERSAL; >+ this.sourceEvent = event; >+ } >+} >Index: src/org/eclipse/jface/viewers/ColumnViewerEditorActivationListener.java >=================================================================== >RCS file: src/org/eclipse/jface/viewers/ColumnViewerEditorActivationListener.java >diff -N src/org/eclipse/jface/viewers/ColumnViewerEditorActivationListener.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jface/viewers/ColumnViewerEditorActivationListener.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,52 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation 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: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.jface.viewers; >+ >+/** >+ * Parties interested in activation and deactivation of editors extend this >+ * class and implement any or all of the methods >+ * >+ * @since 3.3 >+ * >+ */ >+public abstract class ColumnViewerEditorActivationListener { >+ /** >+ * Called before an editor is activated >+ * >+ * @param event >+ * the event >+ */ >+ public abstract void beforeEditorActivated(EditorActivationEvent event); >+ >+ /** >+ * Called after an editor has been activated >+ * >+ * @param event the event >+ */ >+ public abstract void afterEditorActivated(EditorActivationEvent event); >+ >+ /** >+ * Called before an editor is deactivated >+ * >+ * @param event >+ * the event >+ */ >+ public abstract void beforeEditorDeactivated(EditorDeactivationEvent event); >+ >+ >+ /** >+ * Called after an editor is deactivated >+ * >+ * @param event the event >+ */ >+ public abstract void afterEditorDeactivated(EditorDeactivationEvent event); >+} >Index: src/org/eclipse/jface/viewers/TreeColumnViewerEditor.java >=================================================================== >RCS file: src/org/eclipse/jface/viewers/TreeColumnViewerEditor.java >diff -N src/org/eclipse/jface/viewers/TreeColumnViewerEditor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jface/viewers/TreeColumnViewerEditor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,57 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation 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: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.jface.viewers; >+ >+import org.eclipse.jface.viewers.CellEditor.LayoutData; >+import org.eclipse.swt.custom.TreeEditor; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Item; >+import org.eclipse.swt.widgets.TreeItem; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class TreeColumnViewerEditor extends ColumnViewerEditor { >+ /** >+ * This viewer's tree editor. >+ */ >+ private TreeEditor treeEditor; >+ >+ /** >+ * @param viewer >+ * @param editorActivationStrategy >+ * @param feature >+ */ >+ public TreeColumnViewerEditor(TreeViewer viewer, ColumnViewerKeyboardSupport editorActivationStrategy, int feature) { >+ super(viewer,editorActivationStrategy,feature); >+ treeEditor = new TreeEditor(viewer.getTree()); >+ } >+ >+ protected StructuredSelection createSelection(Object element) { >+ if (element instanceof TreePath) { >+ return new TreeSelection((TreePath) element, getViewer().getComparer()); >+ } >+ >+ return new StructuredSelection(element); >+ } >+ >+ protected void setEditor(Control w, Item item, int fColumnNumber) { >+ treeEditor.setEditor(w, (TreeItem) item, fColumnNumber); >+ } >+ >+ protected void setLayoutData(LayoutData layoutData) { >+ treeEditor.grabHorizontal = layoutData.grabHorizontal; >+ treeEditor.horizontalAlignment = layoutData.horizontalAlignment; >+ treeEditor.minimumWidth = layoutData.minimumWidth; >+ } >+} >Index: src/org/eclipse/jface/viewers/TableColumnViewerEditor.java >=================================================================== >RCS file: src/org/eclipse/jface/viewers/TableColumnViewerEditor.java >diff -N src/org/eclipse/jface/viewers/TableColumnViewerEditor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jface/viewers/TableColumnViewerEditor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation 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: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.jface.viewers; >+ >+import org.eclipse.jface.viewers.CellEditor.LayoutData; >+import org.eclipse.swt.custom.TableEditor; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Item; >+import org.eclipse.swt.widgets.TableItem; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class TableColumnViewerEditor extends ColumnViewerEditor { >+ /** >+ * This viewer's table editor. >+ */ >+ private TableEditor tableEditor; >+ >+ /** >+ * @param viewer >+ * @param editorActivationStrategy >+ * @param feature >+ */ >+ public TableColumnViewerEditor(TableViewer viewer, ColumnViewerKeyboardSupport editorActivationStrategy, int feature) { >+ super(viewer,editorActivationStrategy,feature); >+ tableEditor = new TableEditor(viewer.getTable()); >+ } >+ >+ protected StructuredSelection createSelection(Object element) { >+ return new StructuredSelection(element); >+ } >+ >+ protected void setEditor(Control w, Item item, int columnNumber) { >+ tableEditor.setEditor(w, (TableItem) item, columnNumber); >+ } >+ >+ protected void setLayoutData(LayoutData layoutData) { >+ tableEditor.grabHorizontal = layoutData.grabHorizontal; >+ tableEditor.horizontalAlignment = layoutData.horizontalAlignment; >+ tableEditor.minimumWidth = layoutData.minimumWidth; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 172646
:
58144
|
58157
|
58201
|
58739
|
58764
|
59015
|
59270
|
59808
|
59921
|
59931
|
60115
|
60666
|
61074
|
61075