Refine search
public int open() { Display display = parent.getDisplay(); shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE ); shell.setImage( GUIResource.getInstance().getImageSpoon() ); image = display.getSystemImage( SWT.ICON_WARNING ); image = display.getSystemImage( SWT.ICON_INFORMATION ); image = display.getSystemImage( SWT.ICON_QUESTION ); wlDesc = new StyledText( shell, SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL ); shell.setSize( 550, 350 ); fdlDesc.bottom = new FormAttachment( 100, -50 ); fdlDesc.right = new FormAttachment( 100, 0 ); } else { wlDesc = new StyledText( shell, SWT.MULTI | SWT.READ_ONLY ); fdlDesc.right = new FormAttachment( 100, 0 ); wlDesc.setCaret( null ); wlDesc.setText( message ); props.setLook( wlDesc ); wlDesc.setLayoutData( fdlDesc );
private boolean findText() { String searchString = searchText.getText(); String textString = text.getText(); int offset = text.getCaretOffset(); int start = -1; if ( !btnIgnoreCase.getSelection() ) { searchString = searchString.toLowerCase(); textString = textString.toLowerCase(); } // if (1==1) { start = textString.indexOf( searchString, offset ); /* * }else if (text.getSelectionRange().y > searchString.length()) { start = textString.lastIndexOf(searchString, * offset - 1); }else { start = textString.lastIndexOf(searchString, offset - text.getSelectionRange().y - 1); } */ if ( start > -1 ) { text.setSelection( start, start + searchString.length() ); return true; } return false; }
public void run() { if ( text.isDisposed() ) { return; text.getDisplay().asyncExec( new Runnable() { public void run() { HasLogChannelInterface provider = logProvider.getLogChannelProvider();
public void clearLog() { if ( jobLogText != null && !jobLogText.isDisposed() ) { jobLogText.setText( "" ); } }
public String getLoggingText() { if ( transLogText != null && !transLogText.isDisposed() ) { return transLogText.getText(); } else { return null; } }
@Override public void setEnabled( boolean enabled ) { styledText.setEnabled( enabled ); // StyledText component does not get the "disabled" look, so it needs to be applied explicitly // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=4745 if ( Display.getDefault() != null ) { Color foreground = Display.getDefault().getSystemColor( enabled ? SWT.COLOR_BLACK : SWT.COLOR_DARK_GRAY ); Color background = Display.getDefault().getSystemColor( enabled ? SWT.COLOR_WHITE : SWT.COLOR_WIDGET_BACKGROUND ); styledText.setForeground( foreground ); styledText.setBackground( background ); } } }
public void open() { sShell = new Shell( parent, SWT.DIALOG_TRIM | SWT.NO_REDRAW_RESIZE | SWT.APPLICATION_MODAL ); sShell.setImage( GUIResource.getInstance().getImageSpoon() ); sShell.setText( strHeader ); sShell.setSize( new Point( 360, 126 ) ); FormLayout formLayout = new FormLayout(); lblFind.setLayoutData( frmData ); btnNext = new Button( sShell, SWT.PUSH ); btnNext.setText( BaseMessages.getString( PKG, "Widget.Styled.Comp.FindNext" ) ); btnNext.setEnabled( false ); frmData = new FormData(); frmData.left = new FormAttachment( searchText, 7 ); if ( text.getSelectionText() != null ) { String tt = text.getSelectionText(); if ( tt.indexOf( '\n' ) < 0 ) { searchText.setText( text.getSelectionText() ); sShell.open(); Display display = parent.getDisplay(); while ( !parent.isDisposed() && !sShell.isDisposed() && !text.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep();
shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN ); formLayout.marginWidth = 5; formLayout.marginHeight = 5; shell.setLayout( formLayout ); fdBC.left = new FormAttachment( sashForm, 0, SWT.CENTER ); fdBC.bottom = new FormAttachment( 100, 0 ); buttonsComposite.setLayoutData( fdBC ); expressionEditor = new StyledText( rightSash, SWT.NONE ); expressionEditor.setText( this.formula ); expressionEditor.addModifyListener( new ModifyListener() { public void modifyText( ModifyEvent event ) { setStyles(); expressionEditor.addKeyListener( this ); red = new Color( shell.getDisplay(), 255, 0, 0 ); green = new Color( shell.getDisplay(), 0, 220, 0 ); blue = new Color( shell.getDisplay(), 0, 0, 255 );
composite_4 = new Composite(composite_3, SWT.NONE); sashForm3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); inputCmd = new StyledText(sashForm3, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI); inputCmd.addLineStyleListener(new LineStyleListener() inputCmd.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { inputCmd.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { cmdResult = new StyledText(composite_5, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI); cmdResult.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); cmdResult.setEditable(false); cmdResult.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { inputCmd.setFocus(); inputCmd.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { switch (e.keyCode) {
private void createDialog( String title, String url, int options, Image logo ) { display = parent.getDisplay(); helpButton.setLayoutData( helpButtonFormData ); StyledText helpLabel = new StyledText( dialog, SWT.NONE ); helpLabel.setText( "Help" ); helpLabel.setCaret( null ); helpLabel.setEditable( false ); helpLabel.setFont( new Font( display, "Open Sans Regular", 11, SWT.NORMAL ) ); helpLabel.setForeground( new Color( display, 0, 94, 170 ) ); FormData helpLabelFormData = new FormData(); helpLabelFormData.left = new FormAttachment( 0, 40 ); helpLabelFormData.bottom = new FormAttachment( 100, -27 ); helpLabel.setLayoutData( helpLabelFormData ); helpLabel.addListener( SWT.MouseUp, new Listener() { public void handleEvent( Event event ) { helpLabel.addListener( SWT.MouseEnter, new Listener() { public void handleEvent( Event event ) { StyleRange style1 = new StyleRange(); helpLabel.addListener( SWT.MouseExit, new Listener() { public void handleEvent( Event event ) { StyleRange style1 = new StyleRange();
public void addJobLog() { if ( jobGraph.extraViewComposite == null || jobGraph.extraViewComposite.isDisposed() ) { jobGraph.addExtraView(); } else { jobLogTab.setText( BaseMessages.getString( PKG, "JobGraph.LogTab.Name" ) ); jobLogComposite = new Composite( jobGraph.extraViewTabFolder, SWT.NONE ); jobLogComposite.setLayout( new FormLayout() ); jobLogText = new StyledText( jobLogComposite, SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL ); spoon.props.setLook( jobLogText ); FormData fdText = new FormData(); fdText.top = new FormAttachment( (Control) toolbar.getManagedObject(), 0 ); fdText.bottom = new FormAttachment( 100, 0 ); jobLogText.setLayoutData( fdText );
/** * Creates page 2 of the multi-page editor, which shows the sorted text. */ void createPage2() { Composite composite = new Composite(getContainer(), SWT.NONE); FillLayout layout = new FillLayout(); composite.setLayout(layout); text = new StyledText(composite, SWT.H_SCROLL | SWT.V_SCROLL); text.setEditable(false); int index = addPage(composite); setPageText(index, "Preview"); }
void createStyledText() { text = new StyledText (shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); GridData spec = new GridData(); spec.horizontalAlignment = GridData.FILL; spec.grabExcessHorizontalSpace = true; spec.verticalAlignment = GridData.FILL; spec.grabExcessVerticalSpace = true; text.setLayoutData(spec); text.addLineStyleListener(lineStyler); text.setEditable(false); Color bg = Display.getDefault().getSystemColor(SWT.COLOR_GRAY); text.setBackground(bg); }
protected void createContent(Composite parent) { Display display = parent.getDisplay(); Color foreground = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND); Color background = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND); StyledText hint = new StyledText(popup, SWT.READ_ONLY | SWT.SINGLE); String enterKeyName = getEnterBinding(); String hintTemplate = "Enter new name, press {0} to refactor"; hint.setText(Messages.format(hintTemplate, enterKeyName)); hint.setForeground(foreground); hint.setStyleRange(new StyleRange(hintTemplate.indexOf("{0}"), enterKeyName.length(), null, null, SWT.BOLD)); //$NON-NLS-1$ hint.setEnabled(false); // text must not be selectable addViewMenu(parent); recursiveSetBackgroundColor(parent, background); }
protected Control createDialogArea(Composite parent) { GridData gd = new GridData(GridData.FILL_BOTH); StyledText text = new StyledText(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL); text.setLayoutData(gd); text.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); text.setText(resultString); return text; } }
private Control createControl(Composite parent) { fStyledText= new StyledText(parent, SWT.FLAT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); fStyledText.setEditable(false); Cursor arrowCursor= fStyledText.getDisplay().getSystemCursor(SWT.CURSOR_ARROW); fStyledText.setCursor(arrowCursor); // Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263 // fStyledText.setCaret(null); final GridData data= new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); fStyledText.setLayoutData(data); configureStyledText(fText, fEnabled); return fStyledText; }
@Override public void copyValuesFromGUI() { sofaName = sofaNameUI.getText(); isInput = inputButton.getSelection(); }
public void dragOver( DropTargetEvent e ) { styledText.setFocus(); Point location = xParent.getDisplay().map( null, styledText, e.x, e.y ); location.x = Math.max( 0, location.x ); location.y = Math.max( 0, location.y ); try { int offset = styledText.getOffsetAtLocation( new Point( location.x, location.y ) ); styledText.setCaretOffset( offset ); } catch ( IllegalArgumentException ex ) { int maxOffset = styledText.getCharCount(); Point maxLocation = styledText.getLocationAtOffset( maxOffset ); if ( location.y >= maxLocation.y ) { if ( location.x >= maxLocation.x ) { styledText.setCaretOffset( maxOffset ); } else { int offset = styledText.getOffsetAtLocation( new Point( location.x, maxLocation.y ) ); styledText.setCaretOffset( offset ); } } else { styledText.setCaretOffset( maxOffset ); } } }
public void clearLog() { if ( transLogText != null && !transLogText.isDisposed() ) { transLogText.setText( "" ); } Map<StepMeta, String> stepLogMap = transGraph.getStepLogMap(); if ( stepLogMap != null ) { stepLogMap.clear(); transGraph.getDisplay().asyncExec( new Runnable() { public void run() { transGraph.redraw(); } } ); } }
styles.addElement( new StyleRange( event.lineOffset, event.lineText.length() + 4, colors[2], null ) ); event.styles = new StyleRange[styles.size()]; styles.copyInto( event.styles ); String xs = ( (StyledText) event.widget ).getText(); if ( xs != null ) { parseBlockComments( xs ); if ( color != colors[0] ) { // hardcoded default foreground color, black StyleRange style = new StyleRange( scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null ); if ( token == KEY ) { style.fontStyle = SWT.BOLD; } else { lastStyle = styles.lastElement(); if ( lastStyle.similarTo( style ) && ( lastStyle.start + lastStyle.length == style.start ) ) { lastStyle.length += style.length; } else {