Java Code Examples for org.eclipse.swt.SWT#LEFT_TO_RIGHT
The following examples show how to use
org.eclipse.swt.SWT#LEFT_TO_RIGHT .
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: CCombo.java From birt with Eclipse Public License 1.0 | 6 votes |
void createPopup(String[] items, int selectionIndex) { // create shell and list popup = new Shell (getShell(), SWT.NO_TRIM | SWT.ON_TOP); int style = getStyle(); int listStyle = SWT.SINGLE | SWT.V_SCROLL; if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT; if ((style & SWT.RIGHT_TO_LEFT) != 0) listStyle |= SWT.RIGHT_TO_LEFT; if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT; list = new List (popup, listStyle); if (font != null) list.setFont(font); if (foreground != null) list.setForeground(foreground); if (background != null) list.setBackground(background); int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate}; for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener); int [] listEvents = {SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose}; for (int i=0; i<listEvents.length; i++) list.addListener (listEvents [i], listener); if (items != null) list.setItems(items); if (selectionIndex != -1) list.setSelection(selectionIndex); }
Example 2
Source File: ImageLabel.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Check the style bits to ensure that no invalid styles are applied. */ private static int checkStyle( int style ) { if ( ( style & SWT.BORDER ) != 0 ) style |= SWT.SHADOW_IN; int mask = SWT.SHADOW_IN | SWT.SHADOW_OUT | SWT.SHADOW_NONE | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; style = style & mask; style |= SWT.NO_FOCUS; if ( ( style & ( SWT.CENTER | SWT.RIGHT ) ) == 0 ) style |= SWT.LEFT; // TEMPORARY CODE /* * The default background on carbon and some GTK themes is not a solid * color but a texture. To show the correct default background, we must * allow the operating system to draw it and therefore, we can not use * the NO_BACKGROUND style. The NO_BACKGROUND style is not required on * platforms that use double buffering which is true in both of these * cases. */ String platform = SWT.getPlatform( ); if ( "carbon".equals( platform ) || "gtk".equals( platform ) )return style; //$NON-NLS-1$ //$NON-NLS-2$ return style | SWT.NO_BACKGROUND; }
Example 3
Source File: TextPainterWithPadding.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
private TextLayout getCellTextLayout(LayerCell cell) { int orientation = editor.getTable().getStyle() & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT); TextLayout layout = new TextLayout(editor.getTable().getDisplay()); layout.setOrientation(orientation); layout.setSpacing(Constants.SEGMENT_LINE_SPACING); layout.setFont(font); layout.setAscent(ascent); layout.setDescent(descent); // 和 StyledTextEditor 同步 layout.setTabs(new int[] { tabWidth }); Rectangle rectangle = cell.getBounds(); int width = rectangle.width - leftPadding - rightPadding; width -= 1; if (wrapText && width > 0) { layout.setWidth(width); } String displayText = InnerTagUtil.resolveTag(innerTagFactory.parseInnerTag((String) cell.getDataValue())); if (XliffEditorParameter.getInstance().isShowNonpirnttingCharacter()) { displayText = displayText.replaceAll("\\n", Constants.LINE_SEPARATOR_CHARACTER + "\n"); displayText = displayText.replaceAll("\\t", Constants.TAB_CHARACTER + ""); displayText = displayText.replaceAll(" ", Constants.SPACE_CHARACTER + ""); } layout.setText(displayText); List<InnerTagBean> innerTagBeans = innerTagFactory.getInnerTagBeans(); for (InnerTagBean innerTagBean : innerTagBeans) { String placeHolder = placeHolderBuilder.getPlaceHolder(innerTagBeans, innerTagBeans.indexOf(innerTagBean)); int start = displayText.indexOf(placeHolder); if (start == -1) { continue; } TextStyle style = new TextStyle(); Point rect = tagRender.calculateTagSize(innerTagBean); style.metrics = new GlyphMetrics(rect.y, 0, rect.x + SEGMENT_LINE_SPACING * 2); layout.setStyle(style, start, start + placeHolder.length() - 1); } return layout; }
Example 4
Source File: MonthCalendarableItemControl.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Check the style bits to ensure that no invalid styles are applied. */ private static int checkStyle (int style) { if ((style & SWT.BORDER) != 0) style |= SWT.SHADOW_IN; int mask = SWT.SHADOW_IN | SWT.SHADOW_OUT | SWT.SHADOW_NONE | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; style = style & mask; return style |= SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED; }
Example 5
Source File: TemplateProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public IInformationControlCreator getInformationControlCreator() { int orientation; IEditorPart editor= getJavaEditor(); if (editor instanceof IWorkbenchPartOrientation) orientation= ((IWorkbenchPartOrientation)editor).getOrientation(); else orientation= SWT.LEFT_TO_RIGHT; return new TemplateInformationControlCreator(orientation); }
Example 6
Source File: ExpressionBuilder.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Creates the source viewer to be used by this editor. * * @param parent * the parent control * @return the source viewer */ protected SourceViewer createSourceViewer( Composite parent ) { IVerticalRuler ruler = createVerticalRuler( ); Composite composite = new Composite( parent, SWT.BORDER | SWT.LEFT_TO_RIGHT ); composite.setLayoutData( new GridData( GridData.FILL_BOTH ) ); composite.setLayout( UIUtil.createGridLayoutWithoutMargin( ) ); int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; SourceViewer viewer = new SourceViewer( composite, ruler, styles ); viewer.configure( sourceViewerConfiguration ); updateStyledTextColors( viewer.getTextWidget( ) ); JSEditorInput editorInput = new JSEditorInput( expression, getEncoding( ) ); JSDocumentProvider documentProvider = new JSDocumentProvider( ); try { documentProvider.connect( editorInput ); } catch ( CoreException e ) { ExceptionHandler.handle( e ); } viewer.setDocument( documentProvider.getDocument( editorInput ), ruler == null ? null : ruler.getModel( ) ); return viewer; }
Example 7
Source File: GanttEvent.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Another utility method for setting new dates but this method enforces the usual validation. The difference here * is that you can tell the method in which order the new dates should be set. If you say left to right, the start * is set first, the end last. * * @param revisedStart Revised start date * @param revisedEnd Revised end date * @param order <code>SWT.LEFT_TO_RIHT</code> or <code>SWT.RIGHT_TO_LEFT</code> */ public void setRevisedDates(final Calendar revisedStart, final Calendar revisedEnd, final int order) { if (order == SWT.LEFT_TO_RIGHT) { setRevisedStart(revisedStart); setRevisedEnd(revisedEnd); } else { setRevisedEnd(revisedEnd); setRevisedStart(revisedStart); } updateDaysBetweenStartAndEnd(); }
Example 8
Source File: JavaMergeViewer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public JavaMergeViewer(Composite parent, int styles, CompareConfiguration mp) { super(parent, styles | SWT.LEFT_TO_RIGHT, mp); }
Example 9
Source File: TabBar.java From nebula with Eclipse Public License 2.0 | 4 votes |
private static int checkStyle(int style) { int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT | SWT.RIGHT; return (style & mask) | SWT.DOUBLE_BUFFERED; }
Example 10
Source File: TableCombo.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * creates the popup shell. * @param selectionIndex */ void createPopup(int selectionIndex) { // create shell and table popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP); // set style int style = getStyle(); int tableStyle = SWT.SINGLE | SWT.V_SCROLL; if ((style & SWT.FLAT) != 0) tableStyle |= SWT.FLAT; if ((style & SWT.RIGHT_TO_LEFT) != 0) tableStyle |= SWT.RIGHT_TO_LEFT; if ((style & SWT.LEFT_TO_RIGHT) != 0) tableStyle |= SWT.LEFT_TO_RIGHT; // create table table = new Table(popup, SWT.SINGLE | SWT.FULL_SELECTION); if (font != null) table.setFont(font); if (foreground != null) table.setForeground(foreground); if (background != null) table.setBackground(background); // Add popup listeners int[] popupEvents = { SWT.Close, SWT.Paint, SWT.Deactivate, SWT.Help }; for (int i = 0; i < popupEvents.length; i++) { popup.addListener(popupEvents[i], listener); } // add table listeners int[] tableEvents = { SWT.MouseMove, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose }; for (int i = 0; i < tableEvents.length; i++) { table.addListener(tableEvents[i], listener); } // set the selection if (selectionIndex != -1) { table.setSelection(selectionIndex); } }
Example 11
Source File: JavaEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public int getOrientation() { return SWT.LEFT_TO_RIGHT; //Java editors are always left to right by default }
Example 12
Source File: TypeScriptMergeViewer.java From typescript.java with MIT License | 4 votes |
public TypeScriptMergeViewer(Composite parent, int styles, CompareConfiguration mp) { super(parent, styles | SWT.LEFT_TO_RIGHT, mp); }
Example 13
Source File: TableCombo.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
/** * creates the popup shell. * @param selectionIndex */ void createPopup(int selectionIndex) { // create shell and table popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP); // set style int style = getStyle(); int tableStyle = SWT.SINGLE | SWT.V_SCROLL; if ((style & SWT.FLAT) != 0) tableStyle |= SWT.FLAT; if ((style & SWT.RIGHT_TO_LEFT) != 0) tableStyle |= SWT.RIGHT_TO_LEFT; if ((style & SWT.LEFT_TO_RIGHT) != 0) tableStyle |= SWT.LEFT_TO_RIGHT; // create table table = new Table(popup, SWT.SINGLE | SWT.FULL_SELECTION); if (font != null) table.setFont(font); if (foreground != null) table.setForeground(foreground); if (background != null) table.setBackground(background); // Add popup listeners int[] popupEvents = { SWT.Close, SWT.Paint, SWT.Deactivate, SWT.Help }; for (int i = 0; i < popupEvents.length; i++) { popup.addListener(popupEvents[i], listener); } // add table listeners int[] tableEvents = { SWT.MouseMove, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose }; for (int i = 0; i < tableEvents.length; i++) { table.addListener(tableEvents[i], listener); } // set the selection if (selectionIndex != -1) { table.setSelection(selectionIndex); } }
Example 14
Source File: CTreeCombo.java From nebula with Eclipse Public License 2.0 | 4 votes |
static int checkStyle(int style) { final int mask = SWT.BORDER | SWT.READ_ONLY | SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; return SWT.NO_FOCUS | style & mask; }
Example 15
Source File: DataItemCombo.java From birt with Eclipse Public License 1.0 | 4 votes |
void createPopup( String[] items, int selectionIndex ) { // create shell and list popup = new Shell( getShell( ), SWT.NO_TRIM | SWT.ON_TOP ); int style = getStyle( ); int listStyle = SWT.SINGLE | SWT.V_SCROLL; if ( ( style & SWT.FLAT ) != 0 ) listStyle |= SWT.FLAT; if ( ( style & SWT.RIGHT_TO_LEFT ) != 0 ) listStyle |= SWT.RIGHT_TO_LEFT; if ( ( style & SWT.LEFT_TO_RIGHT ) != 0 ) listStyle |= SWT.LEFT_TO_RIGHT; list = new List( popup, listStyle ); if ( font != null ) list.setFont( font ); if ( foreground != null ) list.setForeground( foreground ); if ( background != null ) list.setBackground( background ); int[] popupEvents = { SWT.Close, SWT.Paint, SWT.Deactivate }; for ( int i = 0; i < popupEvents.length; i++ ) popup.addListener( popupEvents[i], listener ); int[] listEvents = { SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose }; for ( int i = 0; i < listEvents.length; i++ ) list.addListener( listEvents[i], listener ); if ( items != null ) list.setItems( items ); if ( selectionIndex != -1 ) list.setSelection( selectionIndex ); }
Example 16
Source File: CustomColorPalettePopup.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * @param style * @return */ private static int checkStyle(int style) { int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; return style & mask; }
Example 17
Source File: AbstractLangEditor.java From goclipse with Eclipse Public License 1.0 | 4 votes |
@Override public int getOrientation() { return SWT.LEFT_TO_RIGHT; // Always left to right, // also, this fixes bug super.getOrientation(), which can return SWT.NONE (but shouldn't) }
Example 18
Source File: ExcelFileSelectionWizardPage.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Create the middle button composite that displays ADD button * * @param composite * @return */ private Composite createAddBtnComposite( Composite composite ) { FormData data = new FormData( ); data.top = new FormAttachment( 50, 5 ); data.left = new FormAttachment( availableList, 3 ); Composite btnComposite = new Composite( composite, SWT.NONE ); btnComposite.setLayoutData( data ); GridLayout layout = new GridLayout( ); layout.numColumns = 1; btnComposite.setLayout( layout ); btnAdd = new Button( btnComposite, SWT.NONE ); GridData gridData = new GridData( GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL ); gridData.heightHint = 25; btnAdd.setLayoutData( gridData ); btnAdd.setToolTipText( Messages.getString( "tooltip.button.add" ) ); //$NON-NLS-1$ if ( btnAdd.getStyle( ) == ( btnAdd.getStyle( ) | SWT.LEFT_TO_RIGHT ) ) { btnAdd.setImage( PlatformUI.getWorkbench( ) .getSharedImages( ) .getImage( ISharedImages.IMG_TOOL_FORWARD ) ); } else { btnAdd.setImage( PlatformUI.getWorkbench( ) .getSharedImages( ) .getImage( ISharedImages.IMG_TOOL_BACK ) ); } btnAdd.addSelectionListener( new SelectionAdapter( ) { public void widgetSelected( SelectionEvent e ) { addColumns( ); } } ); btnAdd.setEnabled( false ); return btnComposite; }
Example 19
Source File: CustomCombo.java From nebula with Eclipse Public License 2.0 | 4 votes |
static int checkStyle(int style) { int mask = SWT.BORDER | SWT.READ_ONLY | SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; return SWT.NO_FOCUS | (style & mask); }
Example 20
Source File: PropertiesFileEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public int getOrientation() { return SWT.LEFT_TO_RIGHT; // properties editors are always left to right by default (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=110986) }