public DataItemLabel ( final Composite composite, final String connectionId, final String itemId ) { this.label = new CLabel ( composite, SWT.NONE ); this.dataItem = new DataItemObservableValue ( Activator.getDefault ().getBundle ().getBundleContext (), connectionId, itemId ); this.label.addDisposeListener ( new DisposeListener () { @Override public void widgetDisposed ( final DisposeEvent e ) { handleDispose (); } } ); this.model = PojoObservables.observeDetailValue ( this.dataItem, "value", Variant.class ); //$NON-NLS-1$ this.dbc = new DataBindingContext (); bind (); }
private void addStats() { for (String key : statsProject.keySet()) { if (key != project.getName()) { CLabel title = new CLabel(descriptifRight, SWT.BOLD); title.setText(key); title.setImage(new Image(display, getClass() .getResourceAsStream( "images/stats_" + key.replaceAll(" ", "_") .toLowerCase() + "_16x16.png"))); title.setBackground(new Color(display, 255, 255, 255)); title.setMargins(10, 10, 0, 0); FontData[] fd = title.getFont().getFontData(); fd[0].setStyle(SWT.BOLD); title.setFont(new Font(title.getFont().getDevice(), fd)); CLabel subText = new CLabel(descriptifRight, SWT.NONE); subText.setText(statsProject.get(key) .replaceAll("<br/>", "\r\n").replaceAll(" ", " ")); subText.setBackground(new Color(display, 255, 255, 255)); subText.setMargins(30, 0, 0, 0); } } }
/** * Create the composite. * @param parent * @param style */ public HydroGroup(Composite parent, int style) { super(parent, style); setLayout(new GridLayout(1, false)); setData("org.eclipse.e4.ui.css.id", "HydrographGroup"); hydroGroupLabel = new CLabel(this, SWT.NONE); hydroGroupLabel.setText("Hydro Group Label"); hydroGroupLabel.setData("org.eclipse.e4.ui.css.id", "HydroGroupLabel"); hydroGroupBorder = new Composite(this, SWT.NONE); hydroGroupBorder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); GridLayout gl_hydroGroupBorder = new GridLayout(1, false); gl_hydroGroupBorder.verticalSpacing = 1; gl_hydroGroupBorder.marginWidth = 1; gl_hydroGroupBorder.marginHeight = 1; gl_hydroGroupBorder.horizontalSpacing = 1; hydroGroupBorder.setLayout(gl_hydroGroupBorder); hydroGroupBorder.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 0, 0, 0)); hydroGroupBorder.setData("org.eclipse.e4.ui.css.id", "HydroGroupBorder"); hydroGroupClientArea = new Composite(hydroGroupBorder, SWT.NONE); hydroGroupClientArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); hydroGroupClientArea.setData("org.eclipse.e4.ui.css.id", "HydroGroupClientArea"); }
public static void updateTooltipLanguageFromData(Widget widget) { if (widget == null || widget.isDisposed()) { return; } if (widget.getData() != null) { String sToolTip = MessageText.getString((String) widget.getData()); if (widget instanceof CLabel) ((CLabel) widget).setToolTipText(sToolTip); else if (widget instanceof Label) ((Label) widget).setToolTipText(sToolTip); else if (widget instanceof Text) ((Text) widget).setToolTipText(sToolTip); else if (widget instanceof Canvas) ((Canvas) widget).setToolTipText(sToolTip); else if (widget instanceof Composite) ((Composite) widget).setToolTipText(sToolTip); else if (widget instanceof Control) ((Control) widget).setToolTipText(sToolTip); else System.out.println("No cast for " + widget.getClass().getName()); } }
private void populate() { final Color backgroundColor = getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND); final FillLayout layout = new FillLayout(); layout.marginHeight = 0; layout.marginWidth = 0; setLayout(layout); setBackground(backgroundColor); label = new CLabel(this, SWT.LEFT); label.setBackground(backgroundColor); attachWorkItemListeners(); addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(final DisposeEvent e) { onDispose(); } }); }
/** * Creates a label for a knob * @param root * @param knob */ private CLabel createLabel(final Composite root, final Knob<Double> knob) { // Label String text = "100%"; //$NON-NLS-1$ final CLabel label = new CLabel(root, SWT.NONE); label.setText(text); label.setAlignment(SWT.LEFT); label.setLayoutData(SWTUtil.createFillGridData()); label.setToolTipText(text); // Listen knob.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { updateLabel(knob, label); } }); // Return return label; }
/** * @see nexcore.tool.uml.ui.property.section.AbstractPropertyCommonSection#createMainComposite() */ @Override public void createMainComposite() { sectionComposite = getWidgetFactory().createComposite(parent); sectionLayout = new GridLayout(2, false); sectionComposite.setLayout(sectionLayout); CLabel visibilityLabel = getWidgetFactory().createCLabel(sectionComposite, UMLMessage.LABEL_VISIBILITY + UICoreConstant.UMLSECTION_CONSTANTS__COLON_TEXT); //$NON-NLS-1$ gridData = new GridData(); Composite visibilityComposite = getWidgetFactory().createComposite(sectionComposite); sectionLayout = new GridLayout(4, false); visibilityComposite.setLayout(sectionLayout); gridData.widthHint = UICoreConstant.UMLSECTION_CONSTANTS___LABEL_WIDTH_HINT_FOR_RADIO; visibilityLabel.setLayoutData(gridData); publicButton = getWidgetFactory().createButton(visibilityComposite, UMLMessage.LABEL_PUBLIC, SWT.RADIO); privateButton = getWidgetFactory().createButton(visibilityComposite, UMLMessage.LABEL_PRIVATE, SWT.RADIO); protectedButton = getWidgetFactory().createButton(visibilityComposite, UMLMessage.LABEL_PROTECTED, SWT.RADIO); packageButton = getWidgetFactory().createButton(visibilityComposite, UMLMessage.LABEL_PACKAGE, SWT.RADIO); }
@Override protected Control createDialogArea(Composite parent) { Composite control = new Composite(parent, SWT.NONE); control.setLayout(new GridLayout(2, true)); Composite imageControl = new Composite(control, SWT.BORDER); imageControl.setLayout(new FillLayout()); imageControl.setLayoutData(new GridData(GridData.FILL_VERTICAL)); Label imageLabel = new Label(imageControl, SWT.CENTER); imageLabel.setImage(mAboutImage); CLabel textLabel = new CLabel(control, SWT.NONE); // TODO: update with new year date (search this to find other occurrences to update) textLabel.setText("Hierarchy Viewer\nCopyright 2012, The Android Open Source Project\nAll Rights Reserved."); textLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, true)); getShell().setText("About..."); getShell().setImage(mSmallImage); return control; }
private void initGUI() { try { RowLayout thisLayout = new RowLayout(org.eclipse.swt.SWT.HORIZONTAL); thisLayout.pack = false; thisLayout.justify = true; thisLayout.fill = true; this.setLayout(thisLayout); jLabel1 = new CLabel(this, SWT.NONE); jLabel1.setText("Flower:"); jLabel2 = new CLabel(this, SWT.NONE); jLabel2.setText("(Family)"); flowerLabel = new CLabel(this, SWT.NONE); flowerLabel.setText("$NAME$"); jLabel3 = new CLabel(this, SWT.NONE); jLabel3.setText("Quantity:"); quantityTextField = new Text(this, SWT.NONE); } catch (Exception e) { e.printStackTrace(); } }
public ASPropertyWidget createWidget4Property(APropertyNode element, Composite composite, Object property, boolean showLabel) { if (element != null) { IPropertyDescriptor[] pds = element.getPropertyDescriptors(); for (IPropertyDescriptor pd : pds) { if (pd.getId().equals(property)) { CLabel label = createLabel(composite, showLabel, pd); ASPropertyWidget widget = SPWidgetFactory.createWidget(composite, this, pd); if (widget != null) { widget.setLabel(label); widgets.put(pd.getId(), widget); return widget; } break; } } } return null; }
/** * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) */ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); parent = getWidgetFactory().createSection(parent, Messages.SizeSection_sizeSectionTitle, true, 4); section = (ExpandableComposite)parent.getParent(); ASPropertyWidget hw = createWidget4Property(parent, JRDesignElement.PROPERTY_WIDTH); CLabel lbl = hw.getLabel(); lbl.setText(Messages.SizeSection_widthLabel); lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); hw = createWidget4Property(parent, JRDesignElement.PROPERTY_HEIGHT); lbl = hw.getLabel(); lbl.setText(Messages.SizeSection_heightLabel); lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); ASPropertyWidget w = createWidget4Property(parent, JRDesignElement.PROPERTY_STRETCH_TYPE); GridData gd = new GridData(); gd.horizontalSpan = 3; w.getControl().setLayoutData(gd); }
/** * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) */ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); parent = getWidgetFactory().createSection(parent, Messages.LocationSection_locationLabel, true, 4); section = (ExpandableComposite)parent.getParent(); ASPropertyWidget pw = createWidget4Property(parent, JRDesignElement.PROPERTY_X); CLabel lbl = pw.getLabel(); lbl.setText(Messages.LocationSection_xCoordinateLabel); lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); pw = createWidget4Property(parent, JRDesignElement.PROPERTY_Y); lbl = pw.getLabel(); lbl.setText(Messages.LocationSection_yCoordinateLabel); lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); ASPropertyWidget w = createWidget4Property(parent, JRDesignElement.PROPERTY_POSITION_TYPE); GridData gd = new GridData(); gd.horizontalSpan = 3; w.getControl().setLayoutData(gd); }
public void createUI(Composite cParent) { Label spcStatus = new Label(cParent, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_IN); spcStatus.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Composite pStatus = new Composite(cParent, SWT.NO_FOCUS); pStatus.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); GridLayout gl_pStatus = new GridLayout(4, false); gl_pStatus.marginTop = 1; gl_pStatus.marginBottom = 2; gl_pStatus.marginHeight = 0; gl_pStatus.verticalSpacing = 0; pStatus.setLayout(gl_pStatus); pStatus.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lStatus = new CLabel(pStatus, SWT.NONE); lStatus.setLeftMargin(3); lStatus.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lStatus.setRightMargin(5); lStatus.setTopMargin(2); lStatus.setBottomMargin(1); setPortStatus("Port closed", false); createLeds(pStatus); }
protected void createLeds(Composite parent) { Composite pSigstate = new Composite(parent, SWT.NONE); GridLayout gl_pSigstate = new GridLayout(6, true); gl_pSigstate.marginHeight = 0; pSigstate.setLayout(gl_pSigstate); createLed(pSigstate, Serial.Pin.RXD); createLed(pSigstate, Serial.Pin.TXD); createLed(pSigstate, Serial.Pin.CTS); createLed(pSigstate, Serial.Pin.DCD); createLed(pSigstate, Serial.Pin.DSR); createLed(pSigstate, Serial.Pin.RNG); CLabel led = createLed(parent, Serial.Pin.BREAK); led.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); led.setLeftMargin(20); led = createLed(parent, Serial.Pin.ERROR); led.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); led.setRightMargin(2); led.setLeftMargin(10); }
private void createUI_26_SmoothAltitude(final Composite parent) { /* * image: altitude */ _iconAltitude = new CLabel(parent, SWT.NONE); GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconAltitude); _iconAltitude.setBackground(_tk.getColors().getBackground()); _iconAltitude.setImage(_imageAltitude); /* * checkbox: smooth altitude */ _chkIsAltitudeSmoothing = _tk.createButton( parent, Messages.TourChart_Smoothing_Checkbox_IsAltitudeSmoothing, SWT.CHECK); GridDataFactory.fillDefaults() // .align(SWT.FILL, SWT.CENTER) .span(2, 1) .applyTo(_chkIsAltitudeSmoothing); _chkIsAltitudeSmoothing.setToolTipText(Messages.TourChart_Smoothing_Checkbox_IsAltitudeSmoothing_Tooltip); _chkIsAltitudeSmoothing.addSelectionListener(_selectionListener); }
/** * Sets the tour type image and text into a {@link CLabel} * * @param tourData * @param lblTourType * @param isTextDisplayed */ public static void updateUI_TourType( final TourData tourData, final CLabel lblTourType, final boolean isTextDisplayed) { final TourType tourType = tourData.getTourType(); // tour type if (tourType == null) { lblTourType.setText(UI.EMPTY_STRING); lblTourType.setImage(TourTypeImage.getTourTypeImage(TourDatabase.ENTITY_IS_NOT_SAVED)); } else { lblTourType.setImage(TourTypeImage.getTourTypeImage(tourType.getTypeId())); lblTourType.setText(isTextDisplayed ? tourType.getName() : UI.EMPTY_STRING); } lblTourType.pack(true); lblTourType.redraw(); // display changed tour image }
public static void updateTooltipLanguageFromData(Widget widget) { if (widget == null || widget.isDisposed()) { return; } if (widget.getData() != null) { String sToolTip = MessageText.getString((String) widget.getData()); if (widget instanceof CLabel) ((CLabel) widget).setToolTipText(sToolTip); else if (widget instanceof Label) ((Label) widget).setToolTipText(sToolTip); else if (widget instanceof Text) ((Text) widget).setToolTipText(sToolTip); else if (widget instanceof Canvas) ((Canvas) widget).setToolTipText(sToolTip); else System.out.println("No cast for " + widget.getClass().getName()); } }
private void createComposite1() { GridData gridData2 = new GridData(); gridData2.horizontalSpan = 2; gridData2.grabExcessVerticalSpace = true; gridData2.horizontalAlignment = GridData.FILL; gridData2.verticalAlignment = GridData.FILL; gridData2.grabExcessHorizontalSpace = true; GridData gridData1 = new GridData(); gridData1.grabExcessHorizontalSpace = true; GridLayout gridLayout1 = new GridLayout(); gridLayout1.numColumns = 2; composite1 = new Composite(sashForm, SWT.NONE); composite1.setLayout(gridLayout1); Schema = new CLabel(composite1, SWT.NONE); Schema.setText("Schema"); Schema.setLayoutData(gridData1); buttonRefresh = new Button(composite1, SWT.NONE); buttonRefresh.setText("Refresh Schema"); tree = new Tree(composite1, SWT.NONE); tree.setLayoutData(gridData2); }
private void createComposite2() throws ForceConnectionException, ForceRemoteException { GridData gridData6 = new GridData(); gridData6.horizontalAlignment = GridData.FILL; gridData6.grabExcessHorizontalSpace = true; gridData6.heightHint = 6; gridData6.verticalAlignment = GridData.CENTER; GridData gridData5 = new GridData(); gridData5.horizontalAlignment = GridData.FILL; gridData5.grabExcessHorizontalSpace = true; gridData5.grabExcessVerticalSpace = true; gridData5.verticalAlignment = GridData.FILL; composite2 = new Composite(sashForm1, SWT.NONE); composite2.setLayout(new GridLayout()); textSOQL = new Text(composite2, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); textSOQL.setText(SoqlEnum.getSchemaInitalizationQuery()); textSOQL.setLayoutData(gridData5); cLabel1 = new CLabel(composite2, SWT.NONE); cLabel1.setText(""); cLabel1.setLayoutData(gridData6); queryTableViewer.setProject(project); queryTableViewer.initialize(sashForm1); }
protected void createProjectComposite(Composite parent) { final Composite group = new Composite(parent, SWT.NONE); group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); group.setLayout(new GridLayout(3, false)); final CLabel label = new CLabel(group, SWT.NONE); label.setLayoutData(new GridData(SWT.BEGINNING)); label.setText("Project:"); projectField = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY); projectField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); projectField.addSelectionListener(projectSelectionListener); final List<IProject> projects = getProjects(); projectField.setData(projects); projectField.setEnabled(!projects.isEmpty()); for (final IProject project : projects) { projectField.add(project.getName()); } }
@Override protected void createEditRow(Composite theContainer) { Object[] layoutData = this.getLookAndBehaviour().getLayoutDataOfControls(); CLabel labelId = new CLabel( theContainer, SWT.LEFT); labelId.setText( this.getParameter().getId()); labelId.setLayoutData( layoutData[0]); String toolTipString = this.getParameter().getName() + ":\n" + this.getParameter().getDescription(); labelId.setToolTipText( toolTipString); createInputWidget( theContainer, layoutData[0]); Button reset = new Button (theContainer, SWT.PUSH); reset.setText ("Reset"); reset.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent theEvent) { String defaultValueString = ParameterValueUtil.getDefaultValue( getParameter()); setInputValue( defaultValueString); super.widgetSelected( theEvent); } }); theContainer.pack(); }
@Override protected void createEditRow(Composite theContainer) { Object[] layoutData = this.getLookAndBehaviour().getLayoutDataOfControls(); CLabel label = new CLabel( theContainer, SWT.LEFT); label.setText( this.getParameter().getId()); label.setLayoutData( layoutData[0]); String toolTipString = this.getParameter().getName() + ":\n" + this.getParameter().getDescription(); label.setToolTipText( toolTipString); createTextInputWidget( theContainer, layoutData[0]); Button reset = new Button (theContainer, SWT.PUSH); reset.setText ("Reset"); reset.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent theEvent) { String defaultValueString = ParameterValueUtil.getDefaultValue( getParameter()); setInputValue( defaultValueString); super.widgetSelected( theEvent); } }); theContainer.pack(); }
protected CLabel createContextButton (String text, Image icon) { CLabel lbl = new CLabel(buttonsContainer, SWT.NONE); lbl.setLayoutData(new RowData(SWT.DEFAULT, 28)); lbl.setRightMargin(10); lbl.setLeftMargin(8); lbl.setText(text); lbl.setImage(icon); lbl.setBackground(ColorResources.COLOR_CS_BLUE); lbl.setForeground(ColorResources.COLOR_WHITE); lbl.setCursor(new Cursor(getDisplay(), SWT.CURSOR_HAND)); contextButtonsMap.put(lbl, text); return lbl; }
private void setContextButtonsTextVisible (boolean visible) { if (this.contextButtonsVisible == visible) return; for (CLabel lbl : contextButtonsMap.keySet()) { if (lbl.getImage() == null) continue; if (visible) { lbl.setText(contextButtonsMap.get(lbl)); } else { lbl.setText(""); } } this.contextButtonsVisible = visible; layout(); }
private void createOffsetStrategy(Composite mainComp) { FillLayout fillLayout = new FillLayout(); fillLayout.type = org.eclipse.swt.SWT.VERTICAL; GridData gridData7 = new GridData(); gridData7.horizontalSpan = 2; gridData7.verticalAlignment = GridData.CENTER; gridData7.grabExcessHorizontalSpace = true; gridData7.horizontalAlignment = GridData.FILL; Composite comboComp = new Composite(mainComp, SWT.NONE); comboComp.setLayoutData(gridData7); comboComp.setLayout(fillLayout); methodInsertionLbl = new CLabel(comboComp, SWT.NONE); methodInsertionLbl.setText(Messages.offsetStrategyInsertionPointMethod); methodInsertionComb = createComboViewer(comboComp); methodInsertionComb.getCombo().select(0); }
private Composite createMainComp(Composite parent) { GridData gridData12 = new GridData(); gridData12.horizontalSpan = 2; GridData gridData11 = new GridData(); gridData11.horizontalSpan = 2; GridLayout gridLayout2 = new GridLayout(); gridLayout2.numColumns = 2; GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.verticalAlignment = GridData.FILL; mainComp = new Composite(parent, SWT.NONE); mainComp.setLayoutData(gridData); cLabel = new CLabel(mainComp, SWT.NONE); cLabel.setText(Messages.constructorFieldSelect); cLabel.setLayoutData(gridData11); createTreeComp(); createButtonComp(); mainComp.setLayout(gridLayout2); createComboComp(); return mainComp; }
String getAssociatedLabel() { Control[] siblings = getParent().getChildren(); for (int i = 0; i < siblings.length; i++) { if (siblings[i] == this) { if (i > 0) { Control sibling = siblings[i - 1]; if (sibling instanceof Label) return ((Label) sibling).getText(); if (sibling instanceof CLabel) return ((CLabel) sibling).getText(); } break; } } return null; }
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); Composite parentComposite = getWidgetFactory().createFlatFormComposite(parent); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 3; gridLayout.horizontalSpacing = 0; parentComposite.setLayout(gridLayout); CLabel nameLabel = getWidgetFactory().createCLabel(parentComposite, getLabelText(), SWT.WRAP | SWT.MULTI); GridData gridData = new GridData(); gridData.widthHint = getStandardLabelWidth(parentComposite, new String[] { getLabelText() }); nameLabel.setLayoutData(gridData); text = createText(parentComposite); Button b = new Button(parentComposite, SWT.NULL); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { openDialog(); } }); b.setText("..."); //$NON-NLS-1$ }
/** * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) */ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); parentComposite = getWidgetFactory().createFlatFormComposite(parent); FormData data; text = createText(parentComposite, ""); //$NON-NLS-1$ CLabel nameLabel = getWidgetFactory().createCLabel(parentComposite, getLabelText()); data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(text, -ITabbedPropertyConstants.HSPACE); data.top = new FormAttachment(text, 0, SWT.CENTER); nameLabel.setLayoutData(data); listener = new TextChangeHelper() { public void textChanged(Control control) { handleTextModified(); } }; listener.startListeningTo(text); if (fireChangeOnEnter()) listener.startListeningForEnter(text); }
/** * Create the image controls. * * @param inParent * the parent <code>Composite</code>. * @since 3.0 */ private void createImage(final Composite inParent) { descImageCanvas = new CLabel(inParent, SWT.NONE); final GridData lData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING); lData.widthHint = 0; lData.heightHint = 0; descImageCanvas.setLayoutData(lData); // hook a listener to get rid of cached images. descImageCanvas.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(final DisposeEvent inEvent) { for (final Iterator<Image> lImages = imageTable.values() .iterator(); lImages.hasNext();) { lImages.next().dispose(); } imageTable.clear(); } }); }
/** * Creates a new <code>CLabel</code> that will wrap at the specified width and has the specified image * @param parent the parent to add this label to * @param text the text for the label * @param image the image for the label * @param hspan the h span to take up in the parent * @param wrapwidth the with to wrap at * @return a new <code>CLabel</code> * @since 3.3 */ public static CLabel createWrapCLabel(Composite parent, String text, Image image, int hspan, int wrapwidth) { CLabel label = new CLabel(parent, SWT.NONE | SWT.WRAP); label.setFont(parent.getFont()); if(text != null) { label.setText(text); } if(image != null) { label.setImage(image); } GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = hspan; gd.widthHint = wrapwidth; label.setLayoutData(gd); return label; }
private void element(String text, Object model, int colorIndex) { if (model instanceof CategorizedDescriptor || model instanceof CategorizedEntity) { ImageHyperlink link = new ImageHyperlink(composite, SWT.TOP); link.setText(text); link.setImage(getImage(colorIndex)); Controls.onClick(link, (e) -> { if (model instanceof CategorizedDescriptor) { App.openEditor((CategorizedDescriptor) model); } else if (model instanceof CategorizedEntity) { App.openEditor((CategorizedEntity) model); } }); createdLinks.push(link); } else { CLabel label = new CLabel(composite, SWT.TOP); label.setImage(getImage(colorIndex)); label.setText(text); createdLinks.push(label); } }
private void initNotificationsPrefsTab() { TabItem notificationsTabbedItem = new TabItem(tabFolder, SWT.NONE); notificationsTabbedItem.setText("Notifications"); notificationsComposite = new Composite(tabFolder, SWT.NONE); notificationsTabbedItem.setControl(notificationsComposite); notificationsComposite.setLayout(new GridLayout(1, false)); this.addEnableNotificationsEditor(); this.addNotificationsEditors(); this.addSelectionButtons(); CLabel explanationsLabel = new CLabel(notificationsComposite, SWT.NONE); ImageRegistry reg = WaqtSalatPreferencePlugin.getDefault().getImageRegistry(); explanationsLabel.setImage(reg.get(WaqtSalatPreferenceConstants.IconsKeys.NOTIFICATION_1)); explanationsLabel .setText("Notifications will alert you when it is time to pray.\nNotification will fade automatically. A small window will be shown at the corner of the screen."); }
public ComponentExplorerComposite(Composite parent, int style, Object parentObject, Class<? extends DatabaseObject> beanClass) { super(parent, style); this.parentObject = (DatabaseObject) parentObject; this.databaseObjectClass = beanClass; objectsMap = new HashMap<CLabel, Object>(32); initialize(); }
public ObjectsExplorerComposite(Composite parent, int style, Object parentObject, Class<? extends DatabaseObject> beanClass) { super(parent, style); this.parentObject = (DatabaseObject) parentObject; this.databaseObjectClass = beanClass; objectsMap = new HashMap<CLabel, Object>(32); initialize(); }
private Composite createPositionButton(final Composite content, final String propName, String label, String iconPath) { final CLabel position = new CLabel(content, SWT.LEFT); position.setBackground(content.getDisplay().getSystemColor(SWT.COLOR_WHITE)); position.setImage(Activator.getImageDescriptor(iconPath).createImage()); position.setText(label); position.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); GridUtils.setVisible(position, store.getBoolean(propName)); return position; }
@Override protected Control createDialogArea(Composite parent) { // create a composite with standard margins and spacing Composite composite = (Composite)super.createDialogArea(parent); composite.setLayout(new GridLayout(1, false)); final CLabel warning = new CLabel(composite, SWT.LEFT); warning.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); warning.setImage(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/error.png").createImage()); warning.setText("Expert queue configuration parameters, please use with caution."); TableViewer viewer = new TableViewer(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); viewer.setUseHashlookup(true); viewer.getTable().setHeaderVisible(true); viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); createColumns(viewer); viewer.setContentProvider(createContentProvider()); viewer.setInput(props); final Button adv = new Button(composite, SWT.PUSH); adv.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); adv.setText("Advanced..."); adv.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(getShell(), "org.dawnsci.commandserver.ui.activemqPage", null, null); if (pref != null) pref.open(); } }); return composite; }
@Override protected Control createContents(Composite parent) { Composite panel = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; layout.marginWidth = 0; panel.setLayout(layout); btnForceUnixNewlines = new Button(panel, SWT.CHECK); btnForceUnixNewlines.setText(Messages.ProjectProperties_force_unix_newlines); btnForceUnixNewlines.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1)); btnForceUnixNewlines.setSelection(prefs.getBoolean(PROJ_PREF.FORCE_UNIX_NEWLINES, true)); Label label = new Label(panel, SWT.NONE); label.setText(Messages.projectProperties_timezone_for_all_db_connections); cmbTimezone = new Combo(panel, SWT.BORDER | SWT.DROP_DOWN); cmbTimezone.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); cmbTimezone.setItems(UIConsts.TIME_ZONES.toArray(new String[UIConsts.TIME_ZONES.size()])); String tz = prefs.get(PROJ_PREF.TIMEZONE, ApgdiffConsts.UTC); cmbTimezone.setText(tz); cmbTimezone.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { checkSwitchWarnLbl(); } }); lblWarn = new CLabel(panel, SWT.NONE); lblWarn.setImage(Activator.getEclipseImage(ISharedImages.IMG_OBJS_WARN_TSK)); lblWarn.setText(Messages.ProjectProperties_change_projprefs_warn); GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, false, false, 2, 1); gd.exclude = true; lblWarn.setLayoutData(gd); lblWarn.setVisible(false); return panel; }