org.eclipse.jface.viewers.ViewerRow Java Examples

The following examples show how to use org.eclipse.jface.viewers.ViewerRow. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GridTreeViewer.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new ViewerRow at rowIndex
 * 
 * @param parent 
 * 				the parent row
 * @param style 
 * 				the style bits to use for the new row
 * @param rowIndex 
 * 				the index at which the new row should be created under the parent
 * @return ViewerRow 
 * 				the new row
 */
private ViewerRow createNewRowPart(ViewerRow parent, int style, int rowIndex) {
	if (parent == null) {
		if (rowIndex >= 0) {
			return getViewerRowFromItem(new GridItem(grid, style, rowIndex));
		}
		return getViewerRowFromItem(new GridItem(grid, style));
	}

	if (rowIndex >= 0) {
		return getViewerRowFromItem(new GridItem((GridItem) parent
				.getItem(), SWT.NONE, rowIndex));
	}

	return getViewerRowFromItem(new GridItem((GridItem) parent.getItem(),
			SWT.NONE));
}
 
Example #2
Source File: GridTreeViewer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create a new ViewerRow at rowIndex
 * 
 * @param parent 
 * 				the parent row
 * @param style 
 * 				the style bits to use for the new row
 * @param rowIndex 
 * 				the index at which the new row should be created under the parent
 * @return ViewerRow 
 * 				the new row
 */
private ViewerRow createNewRowPart(ViewerRow parent, int style, int rowIndex) {
	if (parent == null) {
		if (rowIndex >= 0) {
			return getViewerRowFromItem(new GridItem(grid, style, rowIndex));
		}
		return getViewerRowFromItem(new GridItem(grid, style));
	}

	if (rowIndex >= 0) {
		return getViewerRowFromItem(new GridItem((GridItem) parent
				.getItem(), SWT.NONE, rowIndex));
	}

	return getViewerRowFromItem(new GridItem((GridItem) parent.getItem(),
			SWT.NONE));
}
 
Example #3
Source File: GalleryTreeViewer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public void editElement(Object element, int column) {
	if (element instanceof TreePath) {
		setSelection(new TreeSelection((TreePath) element));
		GalleryItem[] items = gallery.getSelection();

		if (items.length == 1) {
			ViewerRow row = getViewerRowFromItem(items[0]);

			if (row != null) {
				ViewerCell cell = row.getCell(column);
				if (cell != null) {
					getControl().setRedraw(false);
					triggerEditorActivationEvent(
							new ColumnViewerEditorActivationEvent(cell));
					getControl().setRedraw(true);
				}
			}
		}
	} else {
		super.editElement(element, column);
	}
}
 
Example #4
Source File: GridTableViewer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void editElement(Object element, int column) {
    try {
        getControl().setRedraw(false);
        Widget item = findItem(element);
        if (item != null) {
            ViewerRow row = getViewerRowFromItem(item);
            if (row != null) {
                ViewerCell cell = row.getCell(column);
                if (cell != null) {
                    triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(cell));
                }
            }
        }
    } finally {
        getControl().setRedraw(true);
    }
    // }
}
 
Example #5
Source File: GridViewerEditor.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
    * FIXME
    * {@inheritDoc}
    */
@Override
public ViewerCell getFocusCell() {
	Grid grid = (Grid)getViewer().getControl();

	if( grid.getCellSelectionEnabled() ) {
		Point p = grid.getFocusCell();

		if( p.x >= 0 && p.y >= 0 ) {
			GridItem item = grid.getItem(p.y);
			if( item != null ) {
				ViewerRow row = getViewerRowFromItem(item);
				return row.getCell(p.x);
			}
		}
	}

	return null;
}
 
Example #6
Source File: GalleryTreeViewer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create a new ViewerRow at rowIndex
 * 
 * @param parent
 * @param style
 * @param rowIndex
 * @return ViewerRow
 */
private ViewerRow createNewRowPart(ViewerRow parent, int style,
		int rowIndex) {
	if (parent == null) {
		if (rowIndex >= 0) {
			return getViewerRowFromItem(
					new GalleryItem(gallery, style, rowIndex));
		}
		return getViewerRowFromItem(new GalleryItem(gallery, style));
	}

	if (rowIndex >= 0) {
		return getViewerRowFromItem(new GalleryItem(
				(GalleryItem) parent.getItem(), SWT.NONE, rowIndex));
	}

	return getViewerRowFromItem(
			new GalleryItem((GalleryItem) parent.getItem(), SWT.NONE));
}
 
Example #7
Source File: GridTreeViewer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create a new ViewerRow at rowIndex
 * 
 * @param parent 
 * 				the parent row
 * @param style 
 * 				the style bits to use for the new row
 * @param rowIndex 
 * 				the index at which the new row should be created under the parent
 * @return ViewerRow 
 * 				the new row
 */
private ViewerRow createNewRowPart(ViewerRow parent, int style, int rowIndex) {
	if (parent == null) {
		if (rowIndex >= 0) {
			return getViewerRowFromItem(new GridItem(grid, style, rowIndex));
		}
		return getViewerRowFromItem(new GridItem(grid, style));
	}

	if (rowIndex >= 0) {
		return getViewerRowFromItem(new GridItem((GridItem) parent
				.getItem(), SWT.NONE, rowIndex));
	}

	return getViewerRowFromItem(new GridItem((GridItem) parent.getItem(),
			SWT.NONE));
}
 
Example #8
Source File: GridViewerEditor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
    * FIXME
    * {@inheritDoc}
    */
public ViewerCell getFocusCell() {
	Grid grid = (Grid)getViewer().getControl();

	if( grid.getCellSelectionEnabled() ) {
		Point p = grid.getFocusCell();

		if( p.x >= 0 && p.y >= 0 ) {
			GridItem item = grid.getItem(p.y);
			if( item != null ) {
				ViewerRow row = getViewerRowFromItem(item);
				return row.getCell(p.x);
			}
		}
	}

	return null;
}
 
Example #9
Source File: GridTableViewer.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void editElement(Object element, int column) {
	try {
		getControl().setRedraw(false);
		Widget item = findItem(element);
		if (item != null) {
			ViewerRow row = getViewerRowFromItem(item);
			if (row != null) {
				ViewerCell cell = row.getCell(column);
				if (cell != null) {
					triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(
							cell));
				}
			}
		}
	} finally {
		getControl().setRedraw(true);
	}
	// }
}
 
Example #10
Source File: GridViewerEditor.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public ViewerCell getFocusCell() {
	Grid grid = (Grid)getViewer().getControl();

	if( grid.getCellSelectionEnabled() ) {
		Point p = grid.getFocusCell();

		if( p.x >= 0 && p.y >= 0 ) {
			GridItem item = grid.getItem(p.y);
			if( item != null ) {
				ViewerRow row = getViewerRowFromItem(item);
				return row.getCell(p.x);
			}
		}
	}

	return null;
}
 
Example #11
Source File: GridTreeViewer.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new ViewerRow at rowIndex
 * 
 * @param parent 
 * 				the parent row
 * @param style 
 * 				the style bits to use for the new row
 * @param rowIndex 
 * 				the index at which the new row should be created under the parent
 * @return ViewerRow 
 * 				the new row
 */
private ViewerRow createNewRowPart(ViewerRow parent, int style, int rowIndex) {
	if (parent == null) {
		if (rowIndex >= 0) {
			return getViewerRowFromItem(new GridItem(grid, style, rowIndex));
		}
		return getViewerRowFromItem(new GridItem(grid, style));
	}

	if (rowIndex >= 0) {
		return getViewerRowFromItem(new GridItem((GridItem) parent
				.getItem(), SWT.NONE, rowIndex));
	}

	return getViewerRowFromItem(new GridItem((GridItem) parent.getItem(),
			SWT.NONE));
}
 
Example #12
Source File: CTreeComboViewer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/** 
 * @see org.eclipse.jface.viewers.ColumnViewer#editElement(java.lang.Object, int)
 */
public void editElement(Object element, int column) {
	if (element instanceof TreePath) {
		try {
			getControl().setRedraw(false);
			setSelection(new TreeSelection((TreePath) element));
			CTreeComboItem[] items = tree.getSelection();

			if (items.length == 1) {
				ViewerRow row = getViewerRowFromItem(items[0]);

				if (row != null) {
					ViewerCell cell = row.getCell(column);
					if (cell != null) {
						triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(cell));
					}
				}
			}
		} finally {
			getControl().setRedraw(true);
		}
	} else {
		super.editElement(element, column);
	}
}
 
Example #13
Source File: CTreeViewer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create a new ViewerRow at rowIndex
 * 
 * @param parent
 * @param style
 * @param rowIndex
 * @return ViewerRow
 */
private ViewerRow createNewRowPart(ViewerRow parent, int style, int rowIndex) {
	if (parent == null) {
		if (rowIndex >= 0) {
			return getViewerRowFromItem(new CTreeItem(ctree, style, rowIndex));
		}
		return getViewerRowFromItem(new CTreeItem(ctree, style));
	}

	if (rowIndex >= 0) {
		return getViewerRowFromItem(new CTreeItem((CTreeItem) parent.getItem(),
				SWT.NONE, rowIndex));
	}

	return getViewerRowFromItem(new CTreeItem((CTreeItem) parent.getItem(),
			SWT.NONE));
}
 
Example #14
Source File: GridViewerEditor.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
    * FIXME
    * {@inheritDoc}
    */
public ViewerCell getFocusCell() {
	Grid grid = (Grid)getViewer().getControl();

	if( grid.getCellSelectionEnabled() ) {
		Point p = grid.getFocusCell();

		if( p.x >= 0 && p.y >= 0 ) {
			GridItem item = grid.getItem(p.y);
			if( item != null ) {
				ViewerRow row = getViewerRowFromItem(item);
				return row.getCell(p.x);
			}
		}
	}

	return null;
}
 
Example #15
Source File: GridTableViewer.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void editElement(Object element, int column) {
	try {
		getControl().setRedraw(false);
		Widget item = findItem(element);
		if (item != null) {
			ViewerRow row = getViewerRowFromItem(item);
			if (row != null) {
				ViewerCell cell = row.getCell(column);
				if (cell != null) {
					triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(
							cell));
				}
			}
		}
	} finally {
		getControl().setRedraw(true);
	}
	// }
}
 
Example #16
Source File: TableComboViewer.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
protected ViewerRow getViewerRowFromItem(Widget item) {
	if (cachedRow == null) {
		cachedRow = new TableComboViewerRow((TableItem) item);
	} else {
		cachedRow.setItem((TableItem) item);
	}

	return cachedRow;
}
 
Example #17
Source File: TableComboViewerRow.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public ViewerRow getNeighbor(int direction, boolean sameLevel) {
	if (direction == ViewerRow.ABOVE) {
		return getRowAbove();
	} else if (direction == ViewerRow.BELOW) {
		return getRowBelow();
	} else {
		throw new IllegalArgumentException("Illegal value of direction argument."); //$NON-NLS-1$
	}
}
 
Example #18
Source File: TableComboViewerRow.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private ViewerRow getRowBelow() {
    int index = item.getParent().indexOf(item) + 1;

    if (index < item.getParent().getItemCount()) {
        TableItem tmp = item.getParent().getItem(index);
        //TODO NULL can happen in case of VIRTUAL => How do we deal with that
        if (tmp != null) {
            return new TableComboViewerRow(tmp);
        }
    }

    return null;
}
 
Example #19
Source File: TableComboViewerRow.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
private ViewerRow getRowBelow() {
	int index = item.getParent().indexOf(item) + 1;

	if (index < item.getParent().getItemCount()) {
		TableItem tmp = item.getParent().getItem(index);
		// TODO NULL can happen in case of VIRTUAL => How do we deal with that
		if (tmp != null) {
			return new TableComboViewerRow(tmp);
		}
	}

	return null;
}
 
Example #20
Source File: GridViewerEditor.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private ViewerRow getViewerRowFromItem(GridItem item) {
	if( getViewer() instanceof GridTableViewer ) {
		return ((GridTableViewer)getViewer()).getViewerRowFromItem(item);
	} else {
		return ((GridTreeViewer)getViewer()).getViewerRowFromItem(item);
	}
}
 
Example #21
Source File: TableComboViewerRow.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
private ViewerRow getRowAbove() {
	int index = item.getParent().indexOf(item) - 1;

	if (index >= 0) {
		return new TableComboViewerRow(item.getParent().getItem(index));
	}

	return null;
}
 
Example #22
Source File: TableComboViewerRow.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public ViewerRow getNeighbor(int direction, boolean sameLevel) {
	if (direction == ViewerRow.ABOVE) {
		return getRowAbove();
	} else if (direction == ViewerRow.BELOW) {
		return getRowBelow();
	} else {
		throw new IllegalArgumentException("Illegal value of direction argument."); //$NON-NLS-1$
	}
}
 
Example #23
Source File: TableComboViewer.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected ViewerRow getViewerRowFromItem(Widget item) {
    if (cachedRow == null) {
        cachedRow = new TableComboViewerRow((TableItem) item);
    } else {
        cachedRow.setItem((TableItem) item);
    }

    return cachedRow;
}
 
Example #24
Source File: GridViewerEditor.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
private ViewerRow getViewerRowFromItem(GridItem item) {
	if( getViewer() instanceof GridTableViewer ) {
		return ((GridTableViewer)getViewer()).getViewerRowFromItem(item);
	} else {
		return ((GridTreeViewer)getViewer()).getViewerRowFromItem(item);
	}
}
 
Example #25
Source File: GalleryTreeViewer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @see org.eclipse.jface.viewers.ColumnViewer#getRowPartFromItem(org.eclipse
 *      .swt.widgets.Widget)
 */
protected ViewerRow getViewerRowFromItem(Widget item) {
	if (cachedRow == null) {
		cachedRow = new GalleryViewerRow((GalleryItem) item);
	} else {
		cachedRow.setItem((GalleryItem) item);
	}

	return cachedRow;
}
 
Example #26
Source File: GridTableViewer.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected ViewerRow getViewerRowFromItem(Widget item) {
	if (cachedRow == null) {
		cachedRow = new GridViewerRow((GridItem) item);
	} else {
		cachedRow.setItem((GridItem) item);
	}

	return cachedRow;
}
 
Example #27
Source File: GridTreeViewer.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected ViewerRow getViewerRowFromItem(Widget item) {
	if (cachedRow == null) {
		cachedRow = new GridViewerRow((GridItem) item);
	} else {
		cachedRow.setItem((GridItem) item);
	}

	return cachedRow;
}
 
Example #28
Source File: LabResultEditingSupport.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void setValue(final Object element, final Object value){
	if (element instanceof LaborItemResults && value != null) {
		LabItem labItem = ((LaborItemResults) element).getLabItem();
		if (labItem.getTyp() == LabItemTyp.DOCUMENT) {
			return;
		}
		LabResult result = createResult(labItem, LabOrder.getOrCreateManualLabor());
		final LabResult lockResult = result;
		AcquireLockBlockingUi.aquireAndRun(result, new ILockHandler() {
			
			@Override
			public void lockFailed(){
				// do nothing
				
			}
			
			@Override
			public void lockAcquired(){
				if (lockResult.getItem().getTyp() == LabItemTyp.TEXT) {
					lockResult.setResult("Text"); //$NON-NLS-1$
					lockResult.set(LabResult.COMMENT, value.toString());
				} else if (lockResult.getItem().getTyp() == LabItemTyp.DOCUMENT) {
					// dont know what todo ...
				} else {
					lockResult.setResult(value.toString());
				}
			}
		});
		int columnIdx = focusCell.getFocusCell().getColumnIndex();
		ViewerRow row = focusCell.getFocusCell().getViewerRow();
		ViewerRow nextRow = row.getNeighbor(ViewerRow.BELOW, true);
		composite.reload();
		if (nextRow != null) {
			getViewer().setSelection(new StructuredSelection(nextRow.getElement()), true);
			getViewer().editElement(nextRow.getElement(), columnIdx);
		}
	}
}
 
Example #29
Source File: GridViewerRow.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
private ViewerRow getRowBelow() {
	int index = item.getParent().indexOf(item) + 1;

	if( index < item.getParent().getItemCount() ) {
		GridItem tmp = item.getParent().getItem(index);
		if( tmp != null ) {
			return new GridViewerRow(tmp);
		}
	}

	return null;
}
 
Example #30
Source File: GridViewerRow.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
    * {@inheritDoc}
    */
   public ViewerRow getNeighbor(int direction, boolean sameLevel) {
	if( direction == ViewerRow.ABOVE ) {
		return getRowAbove();
	} else if( direction == ViewerRow.BELOW ) {
		return getRowBelow();
	} else {
		throw new IllegalArgumentException("Illegal value of direction argument."); //$NON-NLS-1$
	}
}