/* * @see IContributionItem#fill(Composite) */ public void fill(Composite parent) { Label sep = new Label(parent, SWT.SEPARATOR); fLabel = new CLabel(parent, SWT.SHADOW_NONE); fLabel.addDisposeListener( new DisposeListener() { public void widgetDisposed(DisposeEvent e) { fMouseListener = null; } }); if (fActionHandler != null) { fMouseListener = new Listener(); fLabel.addMouseListener(fMouseListener); } StatusLineLayoutData data = new StatusLineLayoutData(); data.widthHint = getWidthHint(parent); fLabel.setLayoutData(data); data = new StatusLineLayoutData(); data.heightHint = getHeightHint(parent); sep.setLayoutData(data); updateMessageLabel(); }
private void createUI22SmoothGradient(final Composite parent) { /* * image: gradient */ _iconGradient = new CLabel(parent, SWT.NONE); GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconGradient); _iconGradient.setBackground(_tk.getColors().getBackground()); _iconGradient.setImage(_imageGradient); /* * label: smooth gradient */ final Label label = _tk.createLabel(parent, Messages.TourChart_Smoothing_Label_GradientSmoothing, SWT.CHECK); GridDataFactory.fillDefaults() // .align(SWT.FILL, SWT.CENTER) .applyTo(label); label.setToolTipText(Messages.TourChart_Smoothing_Label_GradientSmoothing_Tooltip); /* * spinner: gradient tau */ _spinnerGradientTau = new Spinner(parent, SWT.BORDER); GridDataFactory.fillDefaults() // .align(SWT.BEGINNING, SWT.FILL) .applyTo(_spinnerGradientTau); _spinnerGradientTau.setDigits(1); _spinnerGradientTau.setMinimum(1); _spinnerGradientTau.setMaximum(MAX_TAU); _spinnerGradientTau.addSelectionListener(_selectionListener); _spinnerGradientTau.addMouseWheelListener(_spinnerMouseWheelListener); }
/** * Update the Attribute Conversion Panel with the provided binding info * * @param binding the selected Binding */ private void updateAttributeConversionPanel(Binding binding) { if (binding != null) { // get the attribute from the binding Object attr = binding.getAttribute(); // Update the runtimeType label text and image attrRuntimeTypeLabel.setText(getTypeText(binding)); attributeLabel.setImage(getLabelImage(attr)); String nameStr = getLabelText(attr); String labelStr = nameStr; attributeLabel.setText(labelStr); // Update Datatype Chooser EObject dtype = binding.getCurrentAttrDatatype(); if (dtype != null) { setChooserDatatype(dtype); } } updateAttributeConversionPanelButtons(binding); // chooserPanel.layout(); attrGroup.layout(); }
/** * Update the Symbol Conversion Panel with the provided binding info * * @param binding the selected Binding */ private void updateSymbolConversionPanel(Binding binding) { if (binding != null) { // Update the runtimeType label text and image Object symbol = binding.getCurrentSymbol(); if (symbol != null) { symbolRuntimeTypeLabel.setText(getTypeText(symbol)); sqlSymbolLabel.setImage(getLabelImage(symbol)); sqlSymbolLabel.setText(symbol.toString()); } // Update the available conversion label String convertedSymbol = binding.getSqlConversionText(); int lossOfPrecIndex = convertedSymbol.indexOf('\n'); String warningText = CoreStringUtil.Constants.EMPTY_STRING; if (lossOfPrecIndex > -1) { warningText = convertedSymbol.substring(lossOfPrecIndex + 1, convertedSymbol.length()); convertedSymbol = convertedSymbol.substring(0, lossOfPrecIndex); } symbolConversionLabel.setText(convertedSymbol); symbolWarningLabel.setText(warningText); } updateSymbolConversionPanelButtons(binding); sqlGroup.layout(); }
private void setChooserDatatype(EObject datatype) { this.chooserDatatype = datatype; // Update the data label text and image attrDatatypeLabel.setText(getDatatypeText(chooserDatatype)); attrDatatypeLabel.setImage(getDatatypeImage(chooserDatatype)); }
/** * @see * org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) */ public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { super.createControls(parent, factory); Composite composite = getWidgetFactory().createFlatFormComposite(parent); // Create label first then attach other control to it CLabel nameLabel = getWidgetFactory().createCLabel(composite, NAME); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 Point p = nameLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); int labelWidth = Math.max(p.x, 98); FormData data = new FormData(labelWidth, SWT.DEFAULT); data.left = new FormAttachment(0, 0); data.top = new FormAttachment(0, 0); nameLabel.setLayoutData(data); nameText = getWidgetFactory().createText(composite, ""); // $NON-NLS-1$ data = new FormData(); data.left = new FormAttachment(nameLabel, -ITabbedPropertyConstants.HSPACE); data.right = new FormAttachment(100); data.top = new FormAttachment(nameLabel, 0, SWT.CENTER); nameText.setLayoutData(data); nameText.addListener(SWT.Modify, this); // listener.startListeningForEnter(nameText); // listener.startListeningTo(nameText); }
public void updateStatus() { if (quickCopy == null) { // this called before createPart from preference monitor. // ignore it } String ffmpegPath = FFMpegUI.getFFmpeg(); if (ffmpegPath == null) { if (noFFMpegImage != null) { // initial call,there are null image dragHere.setImage(noFFMpegImage); } setMessage(""); // setMessage(Messages.getString("")); if (quickCopy != null) { setCanConvert(quickCopy.getSelection()); // enable only if copy on setCantConvertStatusbarMessage(Messages.getString("ffmpeg_statusbar.no_ffmpeg")); } else { log.warn("this never called"); // before initialize setCanConvert(getPreferenceStore().getBoolean(getPreferenceKey() + "." + "quickcopy")); } } else { if (canConvertImage != null) dragHere.setImage(canConvertImage); if (samefolder.getSelection() || directoryChooser.getFile() != null) { setMessage(Messages.getString("dropsomething.drag_folder")); setCanConvert(true); } else { setErrorMessage(Messages.getString("dropsomething.choose_folder")); setCanConvert(false); } } log.info("currentStatus:" + isCanConvert()); }
/** {@inheritDoc} */ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); /* * We set the color as it's a InterpretedExpression */ text.setBackground(SiriusEditor.getColorRegistry().get("yellow")); text.setToolTipText(getToolTipText()); help = getWidgetFactory().createCLabel(composite, ""); FormData data = new FormData(); data.top = new FormAttachment(text, 0, SWT.TOP); data.left = new FormAttachment(nameLabel); help.setLayoutData(data); help.setImage(getHelpIcon()); help.setToolTipText(getToolTipText()); nameLabel.setFont(SiriusEditor.getFontRegistry().get("required")); TypeContentProposalProvider.bindPluginsCompletionProcessors(this, text); // Start of user code create controls // End of user code create controls }
private void createUI24SmoothPulse(final Composite parent) { /* * image: pulse */ _iconPulse = new CLabel(parent, SWT.NONE); GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconPulse); _iconPulse.setBackground(_tk.getColors().getBackground()); _iconPulse.setImage(_imagePulse); /* * checkbox: smooth speed */ _chkIsPulseSmoothing = _tk.createButton(parent, Messages.TourChart_Smoothing_Checkbox_IsPulseSmoothing, SWT.CHECK); GridDataFactory.fillDefaults() // .align(SWT.FILL, SWT.CENTER) .applyTo(_chkIsPulseSmoothing); _chkIsPulseSmoothing.addSelectionListener(_selectionListener); _chkIsPulseSmoothing.setToolTipText( Messages.TourChart_Smoothing_Checkbox_IsPulseSmoothing_Tooltip); /* * spinner: speed tau */ _spinnerPulseTau = new Spinner(parent, SWT.BORDER); GridDataFactory.fillDefaults() // .align(SWT.BEGINNING, SWT.FILL) .applyTo(_spinnerPulseTau); _spinnerPulseTau.setDigits(1); _spinnerPulseTau.setMinimum(1); _spinnerPulseTau.setMaximum(MAX_TAU); _spinnerPulseTau.addSelectionListener(_selectionListener); _spinnerPulseTau.addMouseWheelListener(_spinnerMouseWheelListener); }
public StereotypeImageEditor(Composite parent, int style) { TabbedPropertySheetWidgetFactory factory = AbstractEditor.factory; composite = factory.createFlatFormComposite(parent); FormData data; browseButton = factory.createButton(composite, "", SWT.PUSH); // $NON-NLS-1$ browseButton.setImage(Activator.getDefault().getImage(addImagePath)); removeButton = factory.createButton(composite, "", SWT.PUSH); // $NON-NLS-1$ removeButton.setImage(Activator.getDefault().getImage("/icons/delete.gif")); // $NON-NLS-1$ CLabel iconLabel = factory.createCLabel(composite, "Content: "); // browseButton layout data = new FormData(); data.left = new FormAttachment(0, 85); data.top = new FormAttachment(0, ITabbedPropertyConstants.HSPACE); browseButton.setLayoutData(data); // removeButton layout data = new FormData(); data.left = new FormAttachment(browseButton, ITabbedPropertyConstants.HSPACE); data.top = new FormAttachment(browseButton, 0, SWT.CENTER); removeButton.setLayoutData(data); // iconLabel layout data = new FormData(); data.left = new FormAttachment(0, 0); data.top = new FormAttachment(browseButton, 0, SWT.CENTER); iconLabel.setLayoutData(data); browseButton.addSelectionListener(this); removeButton.addSelectionListener(this); }
private void statusMessage(boolean error, String message) { fStatusLabel.setText(message); if (error) { fStatusLabel.setForeground(JFaceColors.getErrorText(fStatusLabel.getDisplay())); } else { fStatusLabel.setForeground(null); } }
/** * Constructor for TabbedPropertyTitle. * * @param parent the parent composite. * @param factory the widget factory for the tabbed property sheet */ public TabbedPropertyTitle(Composite parent, TabbedPropertySheetWidgetFactory factory) { super(parent, SWT.NO_FOCUS); this.factory = factory; // RAP not suppported // this.addPaintListener(new PaintListener() { // // public void paintControl(PaintEvent e) { // if (image == null && (text == null || text.equals(BLANK))) { // label.setVisible(false); // } else { // label.setVisible(true); // drawTitleBackground(e); // } // } // }); // /RAP factory.getColors().initializeSectionToolBarColors(); setBackground(factory.getColors().getBackground()); setForeground(factory.getColors().getForeground()); FormLayout layout = new FormLayout(); layout.marginWidth = 1; layout.marginHeight = 2; setLayout(layout); Font font; if (!JFaceResources.getFontRegistry().hasValueFor(TITLE_FONT)) { FontData[] fontData = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT).getFontData(); /* title font is 2pt larger than that used in the tabs. */ fontData[0].setHeight(fontData[0].getHeight() + 2); JFaceResources.getFontRegistry().put(TITLE_FONT, fontData); } font = JFaceResources.getFont(TITLE_FONT); label = factory.createCLabel(this, BLANK); // label.setBackground(new Color[] { // factory.getColors().getColor(IFormColors.H_GRADIENT_END), // factory.getColors().getColor(IFormColors.H_GRADIENT_START) }, // new int[] { 100 }, true); label.setFont(font); label.setForeground(factory.getColors().getColor(IFormColors.TITLE)); FormData data = new FormData(); data.left = new FormAttachment(0, 0); data.top = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); data.bottom = new FormAttachment(100, 0); label.setLayoutData(data); /* * setImage(PlatformUI.getWorkbench().getSharedImages().getImage( * ISharedImages.IMG_OBJ_ELEMENT)); */ }
private CLabel createLabel( Composite parent, String text, Control control, TabbedPropertySheetWidgetFactory factory) { CLabel label = factory.createCLabel(parent, text); // $NON-NLS-1$ FormData data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(control, -HSPACE); data.top = new FormAttachment(control, 0, SWT.TOP); label.setLayoutData(data); return label; }
private void setErrorMessage(String errorMessage) { errorMessageLabel.setText((errorMessage == null) ? "" : errorMessage); errorMessageLabel.setImage( (errorMessage == null) ? null : PlatformUI.getWorkbench() .getSharedImages() .getImage(ISharedImages.IMG_OBJS_ERROR_TSK)); getButton(IDialogConstants.OK_ID).setEnabled(errorMessage == null); getShell().update(); }
/** * Set the text label. * * @param text the text label. * @param image the image for the label. */ public void setTitle(String text, Image image) { // this.text = text; // this.image = image; if (text != null) { label.setText(text); } else { label.setText(BLANK); } label.setImage(image); redraw(); }
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { super.createControls(parent, aTabbedPropertySheetPage); Composite composite = getWidgetFactory().createFlatFormComposite(parent); CLabel nameLabel = getWidgetFactory().createCLabel(composite, label); FormData data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); data.top = new FormAttachment(0, 0); nameLabel.setLayoutData(data); }
private void initialize() { this.labels = new ArrayList(); String[] fields = labelStrings; for (int i = 0; i < fields.length; i++) { CLabel label = new CLabel(this, SWT.NONE); if (label.isDisposed()) return; this.labels.add(label); label.setText(fields[i]); initializeLabel(label); } }
@Override public Control createContents(Composite parent) { CLabel label = new CLabel(parent, SWT.NONE); if (operation == BonitaGroovyRefactoringAction.REFACTOR_OPERATION) { label.setText(Messages.bind(Messages.reviewChangesMessageRefactoring, elementName, newName)); } else { label.setText(Messages.bind(Messages.reviewChangesMessageRemoving, elementName)); } label.setImage(Display.getCurrent().getSystemImage(SWT.ICON_WARNING)); return super.createContents(parent); }
private CLabel createLabel(Composite parent, String text, Control control) { CLabel label = new CLabel(parent, SWT.NONE); label.setText(text); FormData data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(control, -HSPACE); data.top = new FormAttachment(control, 0, SWT.TOP); label.setLayoutData(data); label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); return label; }
public TagLabel(Composite parent, int style, String tagName) { super(parent, style); if (tagName == null || tagName.length() == 0) { throw new IllegalArgumentException("tag name is empty"); } this.tagName = tagName; GridLayout gl = new GridLayout(2, false); GUIUtil.resetGridLayout(gl); super.setLayout(gl); final CLabel cross = new CLabel(this, 0); cross.setText("×"); GridData data = new GridData(SWT.LEFT, SWT.TOP, false, true); cross.setLayoutData(data); data = new GridData(SWT.RIGHT, SWT.TOP, true, true); CLabel tagText = new CLabel(this, 0); tagText.setText(tagName); plainFont = cross.getFont(); FontData fd = plainFont.getFontData()[0]; boldFont = new Font(cross.getDisplay(), fd.getName(), fd.getHeight(), SWT.BOLD); cross.addListener( SWT.MouseEnter, new Listener() { @Override public void handleEvent(Event event) { cross.setFont(boldFont); cross.setCursor(handCursor); } }); cross.addListener( SWT.MouseExit, new Listener() { @Override public void handleEvent(Event event) { cross.setFont(plainFont); cross.setCursor(defaultCursor); } }); cross.addListener( SWT.MouseDown, new Listener() { @Override public void handleEvent(Event event) { if (delegate != null) { delegate.tagLabelClicked(TagLabel.this); } } }); }
@Override public Control createDialogArea(Composite parent) { super.createDialogArea(parent); errorMessageLabel = new CLabel(parent, SWT.LEFT_TO_RIGHT); errorMessageLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1)); errorMessageLabel.setImage( PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK)); errorMessageLabel.setVisible(false); return parent; }
private void fillTags(Composite parent, FormToolkit toolkit) { if (tagLabelArea != null) tagLabelArea.dispose(); tagLabelArea = toolkit.createComposite(parent); GridLayoutFactory.fillDefaults().spacing(1, 1).numColumns(4).applyTo(tagLabelArea); GridDataFactory.fillDefaults().grab(true, true).applyTo(tagLabelArea); List<String> tags = getTags(); for (String tag : tags) { CLabel tagLabel = new CLabel(tagLabelArea, SWT.NONE); toolkit.adapt(tagLabel, false, false); tagLabel.setImage(getImage(UIIcons.TAG)); tagLabel.setText(tag); } }
public void setActionHandler(IAction actionHandler) { if (fActionHandler != null && actionHandler == null && fMouseListener != null) { if (!fLabel.isDisposed()) fLabel.removeMouseListener(fMouseListener); fMouseListener = null; } fActionHandler = actionHandler; if (fLabel != null && !fLabel.isDisposed() && fMouseListener == null && fActionHandler != null) { fMouseListener = new Listener(); fLabel.addMouseListener(fMouseListener); } }
private void setLoggingInfo(LoggingInfo loggingInfo) { logCategoryCombo.select(loggingInfo.getCategorySelection()); logLevelScale.setMaximum(LoggingInfo.getLoggingLevelRange(loggingInfo.getCategoryExt()) - 1); logLevelScale.setSelection(loggingInfo.getLevelScaleSelection()); logLevelDesc.setText(PLUS_PREFIX + loggingInfo.getLevelLabelText()); layout(true, true); }
protected Control createDialogArea(Composite parent) { Composite comp; Composite subComp; ValidationHandler validationHandler; Label label; comp = (Composite) super.createDialogArea(parent); subComp = new Composite(comp, SWT.NONE); subComp.setLayout(new GridLayout(1, false)); validationHandler = new ValidationHandler(); // Create pool group. createPoolGroup(subComp, validationHandler); // Create vertical spacer. label = new Label(subComp, SWT.NONE); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // Create tab folder. tabFolder = new TabFolder(subComp, SWT.NONE); tabFolder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); createSignalTab(tabFolder, validationHandler); createStackTab(tabFolder, validationHandler); // Create error message label. errorMessageLabel = new CLabel(subComp, SWT.NONE); errorMessageLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // Create separator line. label = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); applyDialogFont(comp); return comp; }
/** * Provide layout and listeners for the controls. * * @param parent */ private void addLayout(Composite parent) { FormData data; // http://www.eclipse.org/forums/index.php/t/202738/ final FormLayout layout = new FormLayout(); layout.marginWidth = 4; layout.marginHeight = 0; layout.spacing = 10; // 100; parent.setLayout(layout); data = new FormData(); data.left = new FormAttachment(0, 0); data.top = new FormAttachment(nameTextVal, 0, SWT.CENTER); valueLabel.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(valueLabel, 0); // data.right = new FormAttachment(100, 0); // data.right = new FormAttachment(50, 0); data.width = 200; data.top = new FormAttachment(0, VSPACE); // data.width = SWT.BORDER; nameTextVal.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(0, 0); data.width = 200; // data.right = new FormAttachment(100, 0); // data.right = new FormAttachment(50, 0); data.top = new FormAttachment(nameTextVal, VSPACE); // data.width = SWT.BORDER; allowedModes.setLayoutData(data); }
/** * 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; }
/** {@inheritDoc} */ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); combo.setToolTipText( "Tool to call when the user ask for deletion. If you don't set this reference then\nthe default behavior is to remove all the associated semantic elements."); CLabel help = getWidgetFactory().createCLabel(composite, ""); FormData data = new FormData(); data.top = new FormAttachment(combo, 0, SWT.TOP); data.left = new FormAttachment(nameLabel); help.setLayoutData(data); help.setImage(getHelpIcon()); help.setToolTipText( "Tool to call when the user ask for deletion. If you don't set this reference then\nthe default behavior is to remove all the associated semantic elements."); // Start of user code create controls // End of user code create controls }
/** @see org.eclipse.ui.views.properties.tabbed.view.ITabbedPropertySection#refresh() */ public void refresh() { super.refresh(); final String tooltip = getToolTipText(); if (tooltip != null && help != null) { help.setToolTipText(getToolTipText()); } }
public void setLanguageObject(ILanguageObject theLangObj) { // language object must be cloned here so that the original isn't modified. // this prevents the original from being modified even if the user cancels out of the builder. ILanguageObject langObj = (theLangObj == null) ? null : (ILanguageObject) theLangObj.clone(); savedLangObj = langObj; setOriginalSql(langObj); setCurrentSql(langObj); treeViewer.setLanguageObject(langObj); treeViewer.selectRoot(); treeViewer.expandAll(); // Defect 22003 - needed a context for the original expression // Providing a Lable at the top of the dialog. String labelText = Util.getString(PREFIX + "initialExpression") + //$NON-NLS-1$ CoreStringUtil.Constants.DBL_SPACE + CoreStringUtil.Constants.DBL_SPACE + Util.getString(PREFIX + "undefined"); // $NON-NLS-1$ if (savedLangObj != null) { String loString = savedLangObj.toString(); if (loString.length() > 50) { loString = loString.substring(0, 50) + "..."; // $NON-NLS-1$ } labelText = Util.getString(PREFIX + "initialExpression") + //$NON-NLS-1$ CoreStringUtil.Constants.DBL_SPACE + CoreStringUtil.Constants.DBL_SPACE + loString; } if (originalLanguageObjLabel != null) { originalLanguageObjLabel.setText(labelText); originalLanguageObjLabel.getParent().layout(); } // select root tree node Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { treeViewer.selectRoot(); } }); }