Java Code Examples for org.eclipse.jface.viewers.CellEditor#getControl()
The following examples show how to use
org.eclipse.jface.viewers.CellEditor#getControl() .
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: ProcessEditPartFactory.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @generated */ public void relocate(CellEditor celleditor) { Text text = (Text) celleditor.getControl(); Rectangle rect = getWrapLabel().getTextBounds().getCopy(); getWrapLabel().translateToAbsolute(rect); if (!text.getFont().isDisposed()) { if (getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) { //Adjust editor location rect.x = rect.x - 5; if (rect.width < 75) { rect.width = 75; } rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT))); } else { int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth(); rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0)); } } if (!rect.equals(new Rectangle(text.getBounds()))) { text.setBounds(rect.x, rect.y, rect.width, rect.height); } }
Example 2
Source File: NoteEditorLocator.java From ermasterr with Apache License 2.0 | 5 votes |
@Override public void relocate(final CellEditor cellEditor) { final Text text = (Text) cellEditor.getControl(); final Rectangle rect = figure.getBounds().getCopy(); figure.translateToAbsolute(rect); text.setBounds(rect.x + NoteFigure.RETURN_WIDTH, rect.y + NoteFigure.RETURN_WIDTH, rect.width - NoteFigure.RETURN_WIDTH * 2, rect.height - NoteFigure.RETURN_WIDTH * 2); }
Example 3
Source File: XtextDirectEditManager.java From statecharts with Eclipse Public License 1.0 | 5 votes |
/** * This method is used to set the cell editors text * * @param toEdit * String to be set in the cell editor */ public void setEditText(String toEdit) { // Get the cell editor CellEditor cellEditor = getCellEditor(); // IF the cell editor doesn't exist yet... if (cellEditor == null) { // Do nothing return; } // Get the Text Compartment Edit Part IXtextAwareEditPart textEP = (IXtextAwareEditPart) getEditPart(); // Get the Text control StyledText textControl = (StyledText) cellEditor.getControl(); // Set the Figures text textEP.setLabelText(toEdit); // See RATLC00522324 if (cellEditor instanceof TextCellEditorEx) { ((TextCellEditorEx) cellEditor).setValueAndProcessEditOccured(toEdit); } else { cellEditor.setValue(toEdit); } // Set the controls text and position the caret at the end of the text textControl.setSelection(toEdit.length()); }
Example 4
Source File: WalkerNoteEditorLocator.java From erflute with Apache License 2.0 | 5 votes |
@Override public void relocate(CellEditor cellEditor) { final Text text = (Text) cellEditor.getControl(); final Rectangle rect = figure.getBounds().getCopy(); figure.translateToAbsolute(rect); text.setBounds(rect.x + WalkerNoteFigure.RETURN_WIDTH, rect.y + WalkerNoteFigure.RETURN_WIDTH, rect.width - WalkerNoteFigure.RETURN_WIDTH * 2, rect.height - WalkerNoteFigure.RETURN_WIDTH * 2); }
Example 5
Source File: FigureCellEditorLocator.java From birt with Eclipse Public License 1.0 | 5 votes |
public void relocate( CellEditor celleditor ) { Text text = (Text) celleditor.getControl( ); Rectangle rect = figure.getClientArea( ).getCopy( ); figure.translateToAbsolute( rect ); int xOffset = 0; int wOffset = 0; int yOffset = 0; int hOffset = 0; if ( SWT.getPlatform( ).equalsIgnoreCase( "gtk" ) ) { //$NON-NLS-1$ xOffset = GTK_X_OFFSET; wOffset = GTK_W_OFFSET; } else if ( SWT.getPlatform( ).equalsIgnoreCase( "carbon" ) ) { //$NON-NLS-1$ xOffset = MAC_X_OFFSET; wOffset = MAC_W_OFFSET; yOffset = MAC_Y_OFFSET; hOffset = MAC_H_OFFSET; } else { xOffset = WIN_X_OFFSET; wOffset = WIN_W_OFFSET; } text.setBounds( rect.x + xOffset, rect.y + yOffset, rect.width + wOffset, rect.height + hOffset ); }
Example 6
Source File: ProcessEditPartFactory.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ public void relocate(CellEditor celleditor) { Text text = (Text) celleditor.getControl(); Rectangle rect = getLabel().getTextBounds().getCopy(); getLabel().translateToAbsolute(rect); if (!text.getFont().isDisposed()) { int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth(); rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0)); } if (!rect.equals(new Rectangle(text.getBounds()))) { text.setBounds(rect.x, rect.y, rect.width, rect.height); } }
Example 7
Source File: NoteEditorLocator.java From ermaster-b with Apache License 2.0 | 5 votes |
public void relocate(CellEditor cellEditor) { Text text = (Text) cellEditor.getControl(); Rectangle rect = this.figure.getBounds().getCopy(); this.figure.translateToAbsolute(rect); text.setBounds(rect.x + NoteFigure.RETURN_WIDTH, rect.y + NoteFigure.RETURN_WIDTH, rect.width - NoteFigure.RETURN_WIDTH * 2, rect.height - NoteFigure.RETURN_WIDTH * 2); }