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: 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 #2
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 #3
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 #4
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 #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: 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 #7
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 #8
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 #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: 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 #12
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 #13
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 #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: CallHierarchyViewPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void showPage(int page) { boolean isEmpty= page == PAGE_EMPTY; Control control= isEmpty ? (Control) fNoHierarchyShownLabel : fHierarchyLocationSplitter; if (isEmpty) { setContentDescription(""); //$NON-NLS-1$ setTitleToolTip(getPartName()); getViewSite().getActionBars().getStatusLineManager().setMessage(""); //$NON-NLS-1$ getViewer().clearViewer(); } fPagebook.showPage(control); if (fRefreshViewAction != null) fRefreshViewAction.setEnabled(!isEmpty); if (fRefreshSingleElementAction != null) fRefreshSingleElementAction.setEnabled(!isEmpty); }
Example #17
Source File: BonitaRulerGridPropertySection.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) */ public void handleEvent(Event event) { switch (event.type) { case SWT.KeyDown: textModified = true; if (event.character == SWT.CR) textChanged((Control) event.widget); break; case SWT.FocusOut: textChanged((Control) event.widget); break; } }
Example #18
Source File: TypeScriptTemplatePreferencePage.java From typescript.java with MIT License | 5 votes |
protected Control createContents(Composite ancestor) { ScrolledPageContent scrolled= new ScrolledPageContent(ancestor, SWT.H_SCROLL | SWT.V_SCROLL); scrolled.setExpandHorizontal(true); scrolled.setExpandVertical(true); Control control= super.createContents(scrolled); scrolled.setContent(control); final Point size= control.computeSize(SWT.DEFAULT, SWT.DEFAULT); scrolled.setMinSize(size.x, size.y); return scrolled; }
Example #19
Source File: PlaceBidOrderWizard.java From offspring with MIT License | 5 votes |
@Override public Control createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).spacing(10, 0) .margins(0, 0).applyTo(composite); textAsset = new Text(composite, SWT.BORDER); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER) .grab(true, false).applyTo(textAsset); String id = presetAssetId != null ? Convert.toUnsignedLong(presetAssetId) : ""; textAsset.setText(id); textAsset.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { requestVerification(); } }); labelAssetName = new Label(composite, SWT.NONE); GC gc = new GC(labelAssetName); GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER) .hint(gc.textExtent(THIRD_COLUMN).x, SWT.DEFAULT) .applyTo(labelAssetName); gc.dispose(); labelAssetName.setText(EMPTY_NAME); return composite; }
Example #20
Source File: SpecPropertyPage.java From tlaplus with MIT License | 5 votes |
protected Control createContents(Composite parent) { Control control = super.createContents(parent); // ensure the page has no special buttons noDefaultAndApplyButton(); UIHelper.setHelp(control, IHelpConstants.SPEC_PROPERTY_PAGE); return control; }
Example #21
Source File: NameConventionConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { Composite composite= (Composite) super.createDialogArea(parent); Composite inner= new Composite(composite, SWT.NONE); inner.setFont(composite.getFont()); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; layout.numColumns= 2; inner.setLayout(layout); fMessageField.doFillIntoGrid(inner, 2); fPrefixField.doFillIntoGrid(inner, 2); fSuffixField.doFillIntoGrid(inner, 2); LayoutUtil.setHorizontalGrabbing(fPrefixField.getTextControl(null)); LayoutUtil.setWidthHint(fPrefixField.getTextControl(null), convertWidthInCharsToPixels(45)); LayoutUtil.setWidthHint(fSuffixField.getTextControl(null), convertWidthInCharsToPixels(45)); fPrefixField.postSetFocusOnDialogField(parent.getDisplay()); applyDialogFont(composite); PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.CODE_STYLE_EDIT_PREFIX_SUFFIX); return composite; }
Example #22
Source File: SliderEditor.java From gama with GNU General Public License v3.0 | 5 votes |
@Override protected Control createCustomParameterControl(final Composite comp) throws GamaRuntimeException { final List<GamaColor> colors = getParam().getColor(getScope()); Color left = IGamaColors.OK.color(); Color right = IGamaColors.GRAY_LABEL.lighter(); Color thumb = left; if (colors != null) { if (colors.size() == 1) { left = thumb = GamaColors.get(colors.get(0)).color(); } else if (colors.size() == 2) { left = GamaColors.get(colors.get(0)).color(); right = GamaColors.get(colors.get(1)).color(); } else if (colors.size() >= 3) { left = GamaColors.get(colors.get(0)).color(); thumb = GamaColors.get(colors.get(1)).color(); right = GamaColors.get(colors.get(2)).color(); } } slider = new SimpleSlider(comp, left, right, thumb, false) {}; if (stepValue != null) { final Double realStep = stepValue.doubleValue() / (maxValue.doubleValue() - minValue.doubleValue()); slider.setStep(realStep); } slider.addPositionChangeListener((s, position) -> modifyAndDisplayValue(computeValue(position))); slider.pack(true); return slider; }
Example #23
Source File: ViewFilterDialog.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { getShell().setText(Messages.AbstractTimeGraphView_TimeEventFilterDialogTitle); Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(3, false); layout.horizontalSpacing = 0; layout.marginHeight = 0; layout.marginWidth = 0; container.setLayout(layout); Composite labels = createCLabelsArea(container); createFilterTextArea(parent, container, labels); createCloseButton(container); // support close on escape button getShell().addListener(SWT.Traverse, e -> { if (e.detail == SWT.TRAVERSE_ESCAPE) { clearFilter(); } }); for (String label : fFilterRegexes) { createCLabels(parent, labels, label); } fControl.addControlListener(fControlListener); fControl.getShell().addControlListener(fControlListener); return parent; }
Example #24
Source File: NewOrEditDependencyDialog.java From tesb-studio-se with Apache License 2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { final String name = type; final boolean isNew = origin == null; getShell().setText(name); setTitle(MessageFormat.format(isNew ? Messages.NewDependencyItemDialog_addTitle : Messages.NewDependencyItemDialog_editTitle, name)); setMessage(MessageFormat.format(isNew ? Messages.NewDependencyItemDialog_addMsg : Messages.NewDependencyItemDialog_editMsg, name)); parent.setLayout(new GridLayout()); Composite c = new Composite(parent, SWT.NONE); c.setLayout(new GridLayout(2, false)); c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new Label(c, SWT.NONE).setText(Messages.NewDependencyItemDialog_name); fNameText = new Text(c, SWT.BORDER); fNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (type != ManifestItem.EXPORT_PACKAGE) { Group propertiesGroup = new Group(parent, SWT.NONE); propertiesGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); propertiesGroup.setText(Messages.NewOrEditDependencyDialog_properties); propertiesGroup.setLayout(new GridLayout()); fOptionalBtn = new Button(propertiesGroup, SWT.CHECK); fOptionalBtn.setText(Messages.NewDependencyItemDialog_optional); } fVersionPart.createVersionFields(parent, true, true); preloadFields(); addListeners(); return c; }
Example #25
Source File: SegmentViewer.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 重置 ; */ public void reset() { StyledText styledText = getTextWidget(); Control[] children = styledText.getChildren(); for (Control child : children) { if (child != null && !child.isDisposed()) { child.dispose(); } } innerTagCacheList.clear(); errorTagStart = 0; }
Example #26
Source File: OccurrencesSearchMenuAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * {@inheritDoc} */ public Menu getMenu(Control parent) { setMenu(new Menu(parent)); fillMenu(fMenu); initMenu(fMenu); return fMenu; }
Example #27
Source File: MqttDialogSecurityLayout.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void buildSSLTable( Composite parentWidget, Control relativePosition ) { ColumnInfo[] columns = getSSLColumns(); sslTable = new TableView( transMeta, parentWidget, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, columns, 0, // num of starting rows (will be added later) false, lsMod, props, false ); sslTable.setSortable( false ); sslTable.getTable().addListener( SWT.Resize, event -> { Table table = (Table) event.widget; table.getColumn( 1 ).setWidth( 200 ); table.getColumn( 2 ).setWidth( 200 ); } ); populateSSLData(); FormData fdData = new FormData(); fdData.left = new FormAttachment( 0, 0 ); fdData.top = new FormAttachment( relativePosition, 5 ); fdData.bottom = new FormAttachment( 100, 0 ); fdData.width = INPUT_WIDTH + 80; // resize the columns to fit the data in them stream( sslTable.getTable().getColumns() ).forEach( column -> { if ( column.getWidth() > 0 ) { // don't pack anything with a 0 width, it will resize it to make it visible (like the index column) column.setWidth( 200 ); } } ); sslTable.setLayoutData( fdData ); }
Example #28
Source File: ReportPreviewFormPage.java From birt with Eclipse Public License 1.0 | 5 votes |
public Control getPartControl( ) { if ( reportViewer instanceof SWTAbstractViewer ) { return ( (SWTAbstractViewer) reportViewer ).getUI( ); // reportViewer.setReportDesignFile( getReportDesignFilePath( ) ); } return null; }
Example #29
Source File: CommonInputDialog.java From uima-uimaj with Apache License 2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { Composite mainArea = (Composite) super.createDialogArea(parent, existing); text = newSingleLineStyledText(mainArea, ""); AbstractSection.spacer(mainArea); newErrorMessage(mainArea); if (null != existing) text.setText(existing); else text.setText(S_); return mainArea; }
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( ); } }