Text text = new Text(composite, SWT.BORDER); FieldDecorationRegistry decRegistry = FieldDecorationRegistry.getDefault(); FieldDecoration infoField = decRegistry.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION); ControlDecoration decoration = new ControlDecoration(text, SWT.TOP | SWT.LEFT); decoration.setImage(infoField.getImage()); decoration.setDescriptionText("Info decoration text"); GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); // Space for decoration image gridData.horizontalIndent = decRegistry.getMaximumDecorationWidth(); text.setLayoutData(gridData);
private static Image getDecorationImage(final String key) { return FieldDecorationRegistry.getDefault().getFieldDecoration(key) .getImage(); }
Composite composite = new Composite( shell, SWT.NONE ); composite.setLayout( new GridLayout( 2, false ) ); composite.setBackground( composite.getDisplay().getSystemColor( SWT.COLOR_GREEN ) ); Label label = new Label( composite, SWT.NONE ); label.setText( "MyLabel" ); Text text = new Text( composite, SWT.BORDER ); text.setText( "my text" ); ControlDecoration decoration = new ControlDecoration( text, SWT.TOP | SWT.LEFT ); FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault(); FieldDecoration fieldDecoration = registry.getFieldDecoration( DEC_CONTENT_PROPOSAL ); decoration.setImage( fieldDecoration.getImage() ); label.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false ) ); GridData gridData = new GridData( SWT.BEGINNING, SWT.CENTER, false, false ); gridData.horizontalIndent = 10; text.setLayoutData( gridData );
/** * Adds an image to decorated field to be shown in the message area. * * @param image * desired image to be shown in the ImageAndMessageArea */ public void setImage(Image image) { FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault(); registry.registerFieldDecoration("messageImage", null, image); //$NON-NLS-1$ messageField.addFieldDecoration(registry .getFieldDecoration("messageImage"), //$NON-NLS-1$ SWT.LEFT | SWT.TOP, false); }
/** * Adds an image to decorated field to be shown in the message area. * * @param image * desired image to be shown in the ImageAndMessageArea */ public void setImage(Image image) { FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault(); registry.registerFieldDecoration("messageImage", null, image); //$NON-NLS-1$ messageField.addFieldDecoration(registry .getFieldDecoration("messageImage"), //$NON-NLS-1$ SWT.LEFT | SWT.TOP, false); }
/** * Adds an image to decorated field to be shown in the message area. * * @param image * desired image to be shown in the ImageAndMessageArea */ public void setImage(Image image) { FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault(); registry.registerFieldDecoration("messageImage", null, image); //$NON-NLS-1$ messageField.addFieldDecoration(registry .getFieldDecoration("messageImage"), //$NON-NLS-1$ SWT.LEFT | SWT.TOP, false); }
private FieldDecoration getFieldDecoration() { FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault(); // Look for a decoration installed for this particular command id. String decId = CONTENT_ASSIST_DECORATION_ID + adapter.getCommandId(); FieldDecoration dec = registry.getFieldDecoration(decId); // If there is not one, base ours on the standard JFace one. if (dec == null) { FieldDecoration originalDec = registry .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); registry.registerFieldDecoration(decId, null, originalDec .getImage()); dec = registry.getFieldDecoration(decId); } // Always update the decoration text since the key binding may // have changed since it was last retrieved. IBindingService bindingService = PlatformUI .getWorkbench().getService(IBindingService.class); dec.setDescription(NLS.bind( WorkbenchMessages.ContentAssist_Cue_Description_Key, bindingService.getBestActiveBindingFormattedFor(adapter .getCommandId()))); // Now return the field decoration return dec; }
private FieldDecoration getContentAssistFieldDecoration() { FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault(); // Look for a decoration installed for this particular command id. String decId = CONTENT_ASSIST_DECORATION_ID + getCommandId(); FieldDecoration dec = registry.getFieldDecoration(decId); // If there is not one, base ours on the standard JFace one. if (dec == null) { FieldDecoration originalDec = registry .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); registry.registerFieldDecoration(decId, null, originalDec .getImage()); dec = registry.getFieldDecoration(decId); } // Always update the decoration text since the key binding may // have changed since it was last retrieved. IBindingService bindingService = PlatformUI .getWorkbench().getService(IBindingService.class); dec .setDescription(NLS .bind( WorkbenchMessages.ContentAssist_Cue_Description_Key, bindingService .getBestActiveBindingFormattedFor(getCommandId()))); // Now return the field decoration return dec; }
protected void createProductSection(Composite parent) { fProductButton = new Button(parent, SWT.RADIO); fProductButton.setText(PDEUIMessages.ProgramBlock_runProduct); fProductButton.addSelectionListener(fListener); fProductCombo = SWTFactory.createCombo(parent, SWT.DROP_DOWN, 1, TargetPlatform.getProducts()); fProductCombo.addSelectionListener(fListener); fProductCombo.addModifyListener(fListener); fProductComboDecoration = new ControlDecoration(fProductCombo, SWT.TOP | SWT.LEFT); FieldDecoration warningDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING); fProductComboDecoration.setDescriptionText(PDEUIMessages.ProgramBlock_productDecorationWarning0); fProductComboDecoration.setImage(warningDecoration.getImage()); }
/** * Adds enough space in the control's layout data margin for the content assist * decoration. * @param control the control that needs a margin * @since 3.3 */ private void addDecorationMargin(Control control) { Object layoutData= control.getLayoutData(); if (!(layoutData instanceof GridData)) return; GridData gd= (GridData)layoutData; FieldDecoration dec= FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); gd.horizontalIndent= dec.getImage().getBounds().width; }
/** * Adds enough space in the control's layout data margin for the content assist * decoration. * @param control the control that needs a margin * @since 3.3 */ private void addDecorationMargin(Control control) { Object layoutData= control.getLayoutData(); if (!(layoutData instanceof GridData)) return; GridData gd= (GridData)layoutData; FieldDecoration dec= FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); gd.horizontalIndent= dec.getImage().getBounds().width; }
/** * Adds enough space in the control's layout data margin for the content assist * decoration. * @param control the control that needs a margin * @since 3.3 */ private void addDecorationMargin(Control control) { Object layoutData= control.getLayoutData(); if (!(layoutData instanceof GridData)) return; GridData gd= (GridData)layoutData; FieldDecoration dec= FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); gd.horizontalIndent= dec.getImage().getBounds().width; }
/** * Initializes the control editor. * * @param itemEditor * the editor to initialize */ protected void initItemEditor(C itemEditor) { this.setItemEditor(itemEditor); setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage()); hide(); }
public static void addRequiredDecoration(Control control) { FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration( FieldDecorationRegistry.DEC_REQUIRED); ControlDecoration controlDecoration = new ControlDecoration(control, SWT.LEFT | SWT.CENTER); controlDecoration.setDescriptionText(fieldDecoration.getDescription()); controlDecoration.setImage(fieldDecoration.getImage()); } }
protected void updateDecoration(ControlDecoration decoration, RefactoringStatus status) { RefactoringStatusEntry highestSeverity= status.getEntryWithHighestSeverity(); if (highestSeverity != null) { Image newImage= null; FieldDecorationRegistry registry= FieldDecorationRegistry.getDefault(); switch (highestSeverity.getSeverity()) { case RefactoringStatus.INFO: newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage(); break; case RefactoringStatus.WARNING: newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage(); break; case RefactoringStatus.FATAL: case RefactoringStatus.ERROR: newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage(); } decoration.setDescriptionText(highestSeverity.getMessage()); decoration.setImage(newImage); decoration.show(); } else { decoration.setDescriptionText(null); decoration.hide(); } }
protected void updateDecoration(ControlDecoration decoration, RefactoringStatus status) { RefactoringStatusEntry highestSeverity= status.getEntryWithHighestSeverity(); if (highestSeverity != null) { Image newImage= null; FieldDecorationRegistry registry= FieldDecorationRegistry.getDefault(); switch (highestSeverity.getSeverity()) { case RefactoringStatus.INFO: newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage(); break; case RefactoringStatus.WARNING: newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage(); break; case RefactoringStatus.FATAL: case RefactoringStatus.ERROR: newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage(); } decoration.setDescriptionText(highestSeverity.getMessage()); decoration.setImage(newImage); decoration.show(); } else { decoration.setDescriptionText(null); decoration.hide(); } }
protected Control createDialogArea(Composite parent) { Control createDialogArea = super.createDialogArea(parent); decorator = new ControlDecoration(getText(), SWT.TOP | SWT.LEFT); decorator.setDescriptionText(NetUIMessages.NonProxyHostsComposite_0); decorator.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration( FieldDecorationRegistry.DEC_INFORMATION).getImage()); return createDialogArea; } public boolean close() {
/** * Adds little bulb decoration to given control. Bulb will appear in top * left corner of control after giving focus for this control. * * After clicking on bulb image text from <code>tooltip</code> will appear. * * @param control * instance of {@link Control} object with should be decorated * @param tooltip * text value which should appear after clicking on bulb image. */ public static void addBulbDecorator(final Control control, final String tooltip) { ControlDecoration dec = new ControlDecoration(control, SWT.TOP | SWT.LEFT); dec.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration( FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage()); dec.setShowOnlyOnFocus(true); dec.setShowHover(true); dec.setDescriptionText(tooltip); }
private void createUIFieldDecorationTemplate() { // Decorate the combo with the info image int bits = SWT.TOP | SWT.LEFT; fControlDecoration = new ControlDecoration(fFieldTemplateCombo.getControl(), bits); // Configure decoration // No margin fControlDecoration.setMarginWidth(0); // Custom hover tip text fControlDecoration.setDescriptionText(PDEUIMessages.SplashConfigurationSection_msgDecorationTemplateSupport); // Custom hover properties fControlDecoration.setShowHover(true); // Hover image to use FieldDecoration contentProposalImage = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION); fControlDecoration.setImage(contentProposalImage.getImage()); // Hide the decoration initially fControlDecoration.hide(); }
if (!colorsAndFontsTheme.equals(currentColorsAndFontsTheme)) { Image decorationImage = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage(); colorFontsDecorator.setImage(decorationImage); colorFontsDecorator