private static Image getDecorationImage(final String key) { return FieldDecorationRegistry.getDefault().getFieldDecoration(key) .getImage(); }
private int widthOf(Image image) { if (image == null) { return 0; } return useMaxDecorationWidth ? FieldDecorationRegistry.getDefault() .getMaximumDecorationWidth() : image.getBounds().width; } }
/** * 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); }
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);
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 );
/** * Create a MarkerViewLabelProvider on a field. * * @param field */ MarkerColumnLabelProvider(MarkerField field) { FieldDecorationRegistry.getDefault(); this.field = field; imageManager = new LocalResourceManager(IDEWorkbenchPlugin.getDefault() .getResourceManager()); field.setImageManager(imageManager); }
/** * Get the default FieldDecorationRegistry. * * @return the singleton FieldDecorationRegistry that is used to manage * shared field decorations. */ public static FieldDecorationRegistry getDefault() { if (defaultInstance == null) { defaultInstance = new FieldDecorationRegistry(); } return defaultInstance; }
/** * Get the default FieldDecorationRegistry. * * @return the singleton FieldDecorationRegistry that is used to manage * shared field decorations. */ public static FieldDecorationRegistry getDefault() { if (defaultInstance == null) { defaultInstance = new FieldDecorationRegistry(); } return defaultInstance; }
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault() .getFieldDecoration(fieldDecorationID); return fieldDecoration == null ? null : fieldDecoration.getImage();
/** * 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 int widthOf(Image image) { if (image == null) { return 0; } return useMaxDecorationWidth ? FieldDecorationRegistry.getDefault() .getMaximumDecorationWidth() : image.getBounds().width; } }
/** * Get the default FieldDecorationRegistry. * * @return the singleton FieldDecorationRegistry that is used to manage * shared field decorations. */ public static FieldDecorationRegistry getDefault() { if (defaultInstance == null) { defaultInstance = new FieldDecorationRegistry(); } return defaultInstance; }
/** * 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 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 int widthOf(Image image) { if (image == null) { return 0; } return useMaxDecorationWidth ? FieldDecorationRegistry.getDefault() .getMaximumDecorationWidth() : image.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; }
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 void createParameterNameInput(Composite group) { Label l= new Label(group, SWT.NONE); l.setText(RefactoringMessages.ExtractClassWizard_field_name); final Text text= new Text(group, SWT.BORDER); fParameterNameDecoration= new ControlDecoration(text, SWT.TOP | SWT.LEAD); text.setText(fDescriptor.getFieldName()); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { fDescriptor.setFieldName(text.getText()); validateRefactoring(); } }); GridData gridData= new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalIndent= FieldDecorationRegistry.getDefault().getMaximumDecorationWidth(); text.setLayoutData(gridData); }
/** * 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; }
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; }