org.eclipse.swt.widgets.Control Java Examples
The following examples show how to use
org.eclipse.swt.widgets.Control.
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: RegistryManagementDialog.java From codewind-eclipse with Eclipse Public License 2.0 | 6 votes |
protected Control createDialogArea(Composite parent) { setTitleImage(CodewindUIPlugin.getImage(CodewindUIPlugin.CODEWIND_BANNER)); setTitle(Messages.RegMgmtDialogTitle); if (connection.isLocal()) { setMessage(Messages.RegMgmtDialogLocalMessage); } else { setMessage(Messages.RegMgmtDialogMessage); } Composite content = (Composite) super.createDialogArea(parent); content.setLayout(new GridLayout()); content.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); regComposite = new RegistryManagementComposite(content, connection, regList, pushReg); GridData data = new GridData(GridData.FILL, GridData.FILL, true, true); data.widthHint = 250; regComposite.setLayoutData(data); return parent; }
Example #2
Source File: PropertyAndPreferencePage.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); composite.setFont(parent.getFont()); GridData data = new GridData(GridData.FILL, GridData.FILL, true, true); fConfigurationBlockControl = createPreferenceContent(composite); fConfigurationBlockControl.setLayoutData(data); if (isProjectPreferencePage()) { boolean useProjectSettings = hasProjectSpecificOptions(getProject()); enableProjectSpecificSettings(useProjectSettings); } Dialog.applyDialogFont(composite); return composite; }
Example #3
Source File: JavaSearchPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private Control createSearchFor(Composite parent) { Group result= new Group(parent, SWT.NONE); result.setText(SearchMessages.SearchPage_searchFor_label); result.setLayout(new GridLayout(2, true)); fSearchFor= new Button[] { createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_type, TYPE, true), createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_method, METHOD, false), createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_package, PACKAGE, false), createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_constructor, CONSTRUCTOR, false), createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_field, FIELD, false) }; // Fill with dummy radio buttons Label filler= new Label(result, SWT.NONE); filler.setVisible(false); filler.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); return result; }
Example #4
Source File: DataDefinitionTextManager.java From birt with Eclipse Public License 1.0 | 6 votes |
public void addDataDefinitionText( Control text, IQueryExpressionManager queryManager ) { textCollection.put( text, queryManager ); // update control color when switching. updateControlBackground( text, queryManager.getQuery( ).getDefinition( ) ); text.addDisposeListener( new DisposeListener( ) { public void widgetDisposed( DisposeEvent e ) { if ( e.widget instanceof Control ) { removeDataDefinitionText( (Control) e.widget ); } } } ); }
Example #5
Source File: JavaBuildConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected Control createContents(Composite parent) { fPixelConverter= new PixelConverter(parent); setShell(parent.getShell()); Composite mainComp= new Composite(parent, SWT.NONE); mainComp.setFont(parent.getFont()); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; mainComp.setLayout(layout); Composite othersComposite= createBuildPathTabContent(mainComp); GridData gridData= new GridData(GridData.FILL, GridData.FILL, true, true); gridData.heightHint= fPixelConverter.convertHeightInCharsToPixels(20); othersComposite.setLayoutData(gridData); validateSettings(null, null, null); return mainComp; }
Example #6
Source File: TMXValidatorDialog.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent) { Composite tparent = (Composite) super.createDialogArea(parent); GridDataFactory.fillDefaults().grab(true, true).hint(500, 450).applyTo(tparent); GridLayoutFactory.fillDefaults().spacing(0, 0).extendedMargins(8, 8, 0, 8).applyTo(tparent); createMenu(tparent); createToolBar(tparent); styledText = new StyledText(tparent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(100, 100).grab(true, true).applyTo(styledText); styledText.setText(""); tparent.layout(); getShell().layout(); return tparent; }
Example #7
Source File: CustomMatchConditionDialog.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 刷新过滤器设置组件 */ private void refresh() { filterNameTxt.setText(""); andBtn.setSelection(true); orBtn.setSelection(false); btnIsTagged.setSelection(false); btnQT.setSelection(false); btnPT.setSelection(false); if (btnIsRemoveFromSrc != null) { btnIsRemoveFromSrc.setSelection(false); } for (Control ctl : conditionList) { if (!ctl.isDisposed()) { ctl.dispose(); } } conditionList.clear(); new DynaComposite(dynaComp, SWT.NONE); scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); dynaComp.layout(); }
Example #8
Source File: TMinGenericEditorTest.java From tm4e with Eclipse Public License 1.0 | 6 votes |
@Test public void testTMHighlightInGenericEditorEdit() throws IOException, PartInitException { f = File.createTempFile("test" + System.currentTimeMillis(), ".ts"); FileOutputStream fileOutputStream = new FileOutputStream(f); fileOutputStream.write("let a = '';".getBytes()); fileOutputStream.close(); f.deleteOnExit(); editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), f.toURI(), editorDescriptor.getId(), true); StyledText text = (StyledText)editor.getAdapter(Control.class); Assert.assertTrue(new DisplayHelper() { @Override protected boolean condition() { return text.getStyleRanges().length > 1; } }.waitForCondition(text.getDisplay(), 3000)); int initialNumberOfRanges = text.getStyleRanges().length; text.setText("let a = '';\nlet b = 10;\nlet c = true;"); Assert.assertTrue("More styles should have been added", new DisplayHelper() { @Override protected boolean condition() { return text.getStyleRanges().length > initialNumberOfRanges + 3; } }.waitForCondition(text.getDisplay(), 300000)); }
Example #9
Source File: SelectionButtonDialogField.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
@Override public Control[] doFillIntoGrid(Composite parent, int nColumns) { assertEnoughColumns(nColumns); Button button = getSelectionButton(parent); GridData gd = new GridData(); gd.horizontalSpan = nColumns; gd.horizontalAlignment = GridData.FILL; if (fButtonStyle == SWT.PUSH) { gd.widthHint = getButtonWidthHint(button); } button.setLayoutData(gd); return new Control[] { button }; }
Example #10
Source File: CustomFilterDialog.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 刷新过滤器设置组件 */ private void refresh() { filterNameTxt.setText(""); andBtn.setSelection(true); orBtn.setSelection(false); for (Control ctl : conditionList) { if (!ctl.isDisposed()) { ctl.dispose(); } } conditionList.clear(); new DynaComposite(dynaComp, SWT.NONE); scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); dynaComp.layout(); }
Example #11
Source File: InternalCompositeTable.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Indicate to listeners that the focus is arriving on the specified row */ private void fireRowArriveEvent() { if (rows.size() < 1 || !isRowVisible(currentRow)) { return; } for (Iterator<?> rowChangeListenersIter = parent.rowFocusListeners .iterator(); rowChangeListenersIter.hasNext();) { IRowFocusListener listener = (IRowFocusListener) rowChangeListenersIter.next(); // currentRow() can be null if it's scrolled off the top or bottom TableRow row = currentRow(); Control control = row != null ? row.getRowControl() : null; listener.arrive(parent, topRow + currentRow, control); } }
Example #12
Source File: GroovyEditorDocumentationDialogTray.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected Control createContents(final Composite parent) { final Composite mainComposite = new Composite(parent, SWT.NONE); mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create()); createFunctionCategories(mainComposite); final SashForm sashForm = new SashForm(mainComposite, SWT.VERTICAL); sashForm.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(250, 250).minSize(100, SWT.DEFAULT).create()); final GridLayout gridLaout = GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 2).create(); sashForm.setLayout(gridLaout); createFunctionsList(sashForm); createFunctionDocumentaion(sashForm); sashForm.setWeights(new int[] { 1, 1 }); return mainComposite; }
Example #13
Source File: DebuggerTestUtils.java From Pydev with Eclipse Public License 1.0 | 6 votes |
/** * @return an action that can be run to create a breakpoint in the given line */ public PyBreakpointRulerAction createAddBreakPointAction(final int line) { PyBreakpointRulerAction ret = new PyBreakpointRulerAction(debugEditor, new IVerticalRulerInfo() { @Override public int getLineOfLastMouseButtonActivity() { return line; } @Override public Control getControl() { throw new RuntimeException("Not Implemented"); } @Override public int getWidth() { throw new RuntimeException("Not Implemented"); } @Override public int toDocumentLineNumber(int y_coordinate) { throw new RuntimeException("Not Implemented"); } }); ret.update(); return ret; }
Example #14
Source File: FindBarDecorator.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
void updateSearchScope(FindScope scope) { findScope = scope; scopeToolItem.setImage(FindBarPlugin.getImage(scopeMap.get(findScope))); scopeToolItem.setToolTipText(MessageFormat.format(Messages.FindBarDecorator_TOOLTIP_Scope_menu_item, findScope.toString())); boolean isCurrentFile = findScope == FindScope.CURRENT_FILE; Control[] controls = new Control[] { textReplace, replace, replaceAll, replaceFind }; for (Control control : controls) { control.setEnabled(isCurrentFile); } textReplace.setBackground(isCurrentFile ? null : UIUtils.getDisplay().getSystemColor( SWT.COLOR_WIDGET_BACKGROUND)); replaceHistory.setEnabled(isCurrentFile); searchSelection.setEnabled(isCurrentFile); countMatches.setEnabled(isCurrentFile); }
Example #15
Source File: ComponentTitledSeparator.java From arx with Apache License 2.0 | 6 votes |
/** * Redraw the composite */ private void redrawComposite() { // Dispose previous content for (final Control c : this.getChildren()) { c.dispose(); } int numberOfColumns = 1; if (this.text != null) { numberOfColumns++; } if (this.image != null) { numberOfColumns++; } if (this.alignment == SWT.CENTER) { numberOfColumns++; } super.setLayout(new GridLayout(numberOfColumns, false)); createContent(); }
Example #16
Source File: SrxMapRulesManageDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { Composite tparent = (Composite) super.createDialogArea(parent); GridDataFactory.fillDefaults().grab(true, true).hint(600, 500).minSize(600, 500).applyTo(tparent); Composite nameCmp = new Composite(tparent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(nameCmp); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(nameCmp); Label nameLbl = new Label(nameCmp, SWT.NONE); nameLbl.setText(Messages.getString("srx.SrxMapRulesManageDialog.nameLbl")); nameTxt = new Text(nameCmp, SWT.BORDER); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(nameTxt); createTable(tparent); return tparent; }
Example #17
Source File: RefactoringSaveHelper.java From typescript.java with MIT License | 5 votes |
private boolean askSaveAllDirtyEditors(Shell shell, IEditorPart[] dirtyEditors) { final boolean canSaveAutomatically= fSaveMode != SAVE_ALL_ALWAYS_ASK; if (canSaveAutomatically && RefactoringSavePreferences.getSaveAllEditors()) //must save everything return true; ListDialog dialog= new ListDialog(shell) { { setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL); } protected Control createDialogArea(Composite parent) { Composite result= (Composite) super.createDialogArea(parent); if (canSaveAutomatically) { final Button check= new Button(result, SWT.CHECK); check.setText(RefactoringMessages.RefactoringStarter_always_save); check.setSelection(RefactoringSavePreferences.getSaveAllEditors()); check.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { RefactoringSavePreferences.setSaveAllEditors(check.getSelection()); } }); applyDialogFont(result); } return result; } }; dialog.setTitle(RefactoringMessages.RefactoringStarter_save_all_resources); dialog.setAddCancelButton(true); dialog.setLabelProvider(createDialogLabelProvider()); dialog.setMessage(RefactoringMessages.RefactoringStarter_must_save); dialog.setContentProvider(new ArrayContentProvider()); dialog.setInput(Arrays.asList(dirtyEditors)); return dialog.open() == Window.OK; }
Example #18
Source File: LicenseAgreementDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { Composite tparent = (Composite) super.createDialogArea(parent); GridLayout layout = new GridLayout(); layout.marginTop = 5; layout.marginWidth = 10; tparent.setLayout(layout); GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true); parentData.heightHint = 380; tparent.setLayoutData(parentData); Label lbl = new Label(tparent, SWT.NONE); lbl.setText(Messages.getString("license.LicenseAgreementDialog.label")); lbl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Text text = new Text(tparent, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); text.setEditable(false); text.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); text.setText(Messages.getString("license.LicenseAgreementDialog.agreement")); GridData textData = new GridData(GridData.FILL_BOTH); text.setLayoutData(textData); agreeBtn = new Button(tparent, SWT.CHECK); agreeBtn.setText(Messages.getString("license.LicenseAgreementDialog.agreeBtn")); agreeBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); agreeBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { getButton(IDialogConstants.OK_ID).setEnabled(agreeBtn.getSelection()); } }); return super.createDialogArea(parent); }
Example #19
Source File: HtmlDialog.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { Composite c = (Composite) super.createDialogArea(parent); b = new Browser(c, SWT.BORDER); GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); b.setLayoutData(gd); b.setText(html); b.setSize(500, 500); if (listener != null) { b.addLocationListener(listener); } b.setMenu(pageOverviewGetPopup()); return c; }
Example #20
Source File: TmfSimpleTooltipProvider.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public void fill(Control control, MouseEvent event, Point pt) { IAxis xAxis = getXAxis(); IAxis yAxis = getYAxis(); double xCoordinate = xAxis.getDataCoordinate(pt.x); double yCoordinate = yAxis.getDataCoordinate(pt.y); ITmfChartTimeProvider viewer = getChartViewer(); ITmfTimestamp time = TmfTimestamp.fromNanos((long) xCoordinate + viewer.getTimeOffset()); /* set tooltip of current data point */ addItem(null, ToolTipString.fromString("x"), ToolTipString.fromTimestamp(time.toString(), time.toNanos())); //$NON-NLS-1$ addItem(null, "y", Double.toString(yCoordinate)); //$NON-NLS-1$ }
Example #21
Source File: CursorImageDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
protected Control createContents( Composite parent ) { Control ct = super.createContents( parent ); // ChartUIUtil.bindHelp( parent, ChartHelpContextIds.DIALOG_COLOR_IMAGE ); initDialog( ); return ct; }
Example #22
Source File: SkypeStyleChatDisplay.java From saros with GNU General Public License v2.0 | 5 votes |
@Override public void clear() { for (Control chatItem : contentComposite.getChildren()) { chatItem.dispose(); } refresh(); lastEntity = null; notifyChatCleared(); }
Example #23
Source File: InternalCompositeTable.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Method getControlRowObject. Given a row control, returns its row number * relative to the topRow. * * @param rowControl The row object to find * @return The row object managing the rowControl * @throws IllegalArgumentException if rowControl is not currently visible */ public TableRow getControlRowObject(Control rowControl) { for (Iterator<TableRow> rowsIter = rows.iterator(); rowsIter.hasNext();) { TableRow row = (TableRow) rowsIter.next(); if (row.getRowControl() == rowControl) { return row; } } throw new IllegalArgumentException("getControlRowObject passed a control that is not visible inside CompositeTable"); }
Example #24
Source File: StyledTextContentAdapter.java From AndroidRobot with Apache License 2.0 | 5 votes |
public Rectangle getInsertionBounds(Control control) { StyledText text = (StyledText) control; Point caretOrigin = text.getCaret().getLocation(); return new Rectangle(caretOrigin.x + text.getClientArea().x, caretOrigin.y + text.getClientArea().y + 3, 1, text.getLineHeight()); }
Example #25
Source File: CubeBuilder.java From birt with Eclipse Public License 1.0 | 5 votes |
protected Control createContents( Composite parent ) { String title = Messages.getString( "CubeBuilder.Title" ); //$NON-NLS-1$ getShell( ).setText( title ); if ( showNodeId != null ) { setDefaultNode( showNodeId ); } Control control = super.createContents( parent ); return control; }
Example #26
Source File: AbstractEditorPropertySection.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected void initContextMenu(Control control) { MenuManager menuManager = new FilteringMenuManager(); Menu contextMenu = menuManager.createContextMenu(control); control.setMenu(contextMenu); IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); IWorkbenchPartSite site = window.getActivePage().getActiveEditor().getSite(); site.registerContextMenu(CONTEXTMENUID, menuManager, site.getSelectionProvider()); }
Example #27
Source File: LevelDynamicAttributeDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
protected Control createDialogArea( Composite parent ) { Composite composite = (Composite) super.createDialogArea( parent ); Composite container = new Composite( composite, SWT.NONE ); container.setLayoutData( new GridData( GridData.FILL_BOTH ) ); GridLayout layout = new GridLayout( ); layout.numColumns = 2; layout.marginWidth = layout.marginHeight = 0; container.setLayout( layout ); Label nameLabel = new Label( container, SWT.WRAP ); nameLabel.setText( Messages.getString("LevelDynamicAttributeDialog.Label.Member") ); //$NON-NLS-1$ nameLabel.setLayoutData( new GridData( ) ); nameLabel.setFont( parent.getFont( ) ); memberCombo = new Combo( container, SWT.BORDER | SWT.READ_ONLY ); memberCombo.setVisibleItemCount( 30 ); GridData gd = new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL ); gd.widthHint = 250; memberCombo.setLayoutData( gd ); memberCombo.addSelectionListener( new SelectionAdapter( ) { public void widgetSelected( SelectionEvent e ) { checkButtonStatus( ); } } ); applyDialogFont( composite ); UIUtil.bindHelp( parent, IHelpContextIds.LEVEL_DYNAMIC_ATTRIBUTE_DIALOG ); initDialog( ); return composite; }
Example #28
Source File: SourceFolderSelectionDialogButtonField.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public Control[] doFillIntoGrid(Composite parent, int nColumns, int textWidth) { Control[] res= super.doFillIntoGrid(parent, nColumns); final Text text= getTextControl(null); LayoutUtil.setWidthHint(text, textWidth); LayoutUtil.setHorizontalGrabbing(text); return res; }
Example #29
Source File: WinEmulatorStatusHandler.java From thym with Eclipse Public License 1.0 | 5 votes |
protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); GridLayout layout = (GridLayout) composite.getLayout(); layout.numColumns = 1; Link desc = new Link(composite, SWT.NONE); desc.setText(Messages.WinEmulatorsStatusHandler_Message); desc.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Program.launch(WinConstants.SDK_DOWNLOAD_URL); } }); getShell().setText(Messages.WinEmulatorsStatusHandler_Title); return composite; }
Example #30
Source File: OptionsConfigurationBlock.java From birt with Eclipse Public License 1.0 | 5 votes |
public void selectOption( Key key ) { Control control = findControl( key ); if ( control != null ) { control.setFocus( ); } }