/** * Sets the text in the decorated field which will be displayed in the * message area. * * @param text * the text to be displayed in the message area * * @see org.eclipse.swt.widgets.Text#setText(String string) */ public void setText(String text) { ((Text) messageField.getControl()).setText(text); }
/** * Hide the specified decoration. This message has no effect if the * decoration is already hidden, or was not already added to the field using * <code>addFieldDecoration</code>. * * @param decoration * the decoration to be hidden. */ public void hideDecoration(FieldDecoration decoration) { FieldDecorationData data = getDecorationData(decoration); if (data == null) { return; } // Store the desired visibility in the decData. We remember the // client's instructions so that changes in visibility caused by // field focus changes won't violate the client's visibility setting. data.visible = false; setVisible(data, false); }
@Override public void mouseDown(MouseEvent e) { hideHover(); } });
final Label label; FormData formData; int i = indexForPosition(position); if (decDatas[i] == null) { formData = createFormDataForIndex(i, decoration.getImage()); label = new Label(form, SWT.HORIZONTAL | SWT.VERTICAL | SWT.CENTER); showHoverText( decDatas[i].decoration.getDescription(), label ); updateControlAttachments(i, decDatas[i]);
container.setLayout(glayout); messageField = new DecoratedField(container, SWT.READ_ONLY | style, new TextControlCreator()); setFont(JFaceResources.getDialogFont()); int lineHeight = ((Text) messageField.getControl()).getLineHeight(); if ((style & SWT.WRAP) > 0) gd.heightHint = 2 * lineHeight; gd.heightHint = lineHeight; messageField.getLayoutControl().setLayoutData(gd);
final Label label; FormData formData; int i = indexForPosition(position); if (decDatas[i] == null) { formData = createFormDataForIndex(i, decoration.getImage()); label = new Label(form, SWT.HORIZONTAL | SWT.VERTICAL | SWT.CENTER); label.addMouseTrackListener(new MouseTrackListener() { updateControlAttachments(i, decDatas[i]);
public void setBackground(Color bg) { super.setBackground(bg); messageField.getLayoutControl().setBackground(bg); messageField.getControl().setBackground(bg); container.setBackground(bg); }
/** * Update the specified decoration. This message should be used if the image * or description in the decoration have changed. This message has no * immediate effect if the decoration is not visible, and no effect at all * if the decoration was not previously added to the field. * * @param decoration * the decoration to be hidden. */ public void updateDecoration(FieldDecoration decoration) { FieldDecorationData data = getDecorationData(decoration); if (data == null) { return; } if (data.label != null) { data.label.setImage(decoration.getImage()); // If the decoration is being shown, and a hover is active, // update the hover text to display the new description. if (data.label.getVisible() == true && hover != null) { showHoverText(decoration.getDescription(), data.label); } } }
/** * Construct a decorated field which is parented by the specified composite * and has the given style bits. Use the controlCreator to create the * specific kind of control that is decorated inside the field. * * @param parent * the parent of the decorated field. * @param style * the desired style bits for the field. * @param controlCreator * the IControlCreator used to specify the specific kind of * control that is to be decorated. * * @see IControlCreator */ public DecoratedField(Composite parent, int style, IControlCreator controlCreator) { this.form = createForm(parent); this.control = controlCreator.createControl(form, style); addControlListeners(); form.setTabList(new Control[] { control }); // Set up the initial layout data. 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); control.setLayoutData(data); }
/** * 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); }
container.setLayout(glayout); messageField = new DecoratedField(container, SWT.READ_ONLY | style, new TextControlCreator()); setFont(JFaceResources.getDialogFont()); int lineHeight = ((Text) messageField.getControl()).getLineHeight(); if ((style & SWT.WRAP) > 0) gd.heightHint = 2 * lineHeight; gd.heightHint = lineHeight; messageField.getLayoutControl().setLayoutData(gd);
final Label label; FormData formData; int i = indexForPosition(position); if (decDatas[i] == null) { formData = createFormDataForIndex(i, decoration.getImage()); label = new Label(form, SWT.HORIZONTAL | SWT.VERTICAL | SWT.CENTER); label.addMouseTrackListener(new MouseTrackListener() { updateControlAttachments(i, decDatas[i]);
@Override public void setBackground(Color bg) { super.setBackground(bg); messageField.getLayoutControl().setBackground(bg); messageField.getControl().setBackground(bg); container.setBackground(bg); }
/** * Update the specified decoration. This message should be used if the image * or description in the decoration have changed. This message has no * immediate effect if the decoration is not visible, and no effect at all * if the decoration was not previously added to the field. * * @param decoration * the decoration to be hidden. */ public void updateDecoration(FieldDecoration decoration) { FieldDecorationData data = getDecorationData(decoration); if (data == null) { return; } if (data.label != null) { data.label.setImage(decoration.getImage()); // If the decoration is being shown, and a hover is active, // update the hover text to display the new description. if (data.label.getVisible() == true && hover != null) { showHoverText(decoration.getDescription(), data.label); } } }
/** * Construct a decorated field which is parented by the specified composite * and has the given style bits. Use the controlCreator to create the * specific kind of control that is decorated inside the field. * * @param parent * the parent of the decorated field. * @param style * the desired style bits for the field. * @param controlCreator * the IControlCreator used to specify the specific kind of * control that is to be decorated. * * @see IControlCreator */ public DecoratedField(Composite parent, int style, IControlCreator controlCreator) { this.form = createForm(parent); this.control = controlCreator.createControl(form, style); addControlListeners(); form.setTabList(new Control[] { control }); // Set up the initial layout data. 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); control.setLayoutData(data); }
/** * 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); }
container.setLayout(glayout); messageField = new DecoratedField(container, SWT.READ_ONLY | style, new TextControlCreator()); setFont(JFaceResources.getDialogFont()); int lineHeight = ((Text) messageField.getControl()).getLineHeight(); if ((style & SWT.WRAP) > 0) gd.heightHint = 2 * lineHeight; gd.heightHint = lineHeight; messageField.getLayoutControl().setLayoutData(gd);
/** * Hide the specified decoration. This message has no effect if the * decoration is already hidden, or was not already added to the field using * <code>addFieldDecoration</code>. * * @param decoration * the decoration to be hidden. */ public void hideDecoration(FieldDecoration decoration) { FieldDecorationData data = getDecorationData(decoration); if (data == null) { return; } // Store the desired visibility in the decData. We remember the // client's instructions so that changes in visibility caused by // field focus changes won't violate the client's visibility setting. data.visible = false; setVisible(data, false); }
@Override public void setBackground(Color bg) { super.setBackground(bg); messageField.getLayoutControl().setBackground(bg); messageField.getControl().setBackground(bg); container.setBackground(bg); }
/** * Update the specified decoration. This message should be used if the image * or description in the decoration have changed. This message has no * immediate effect if the decoration is not visible, and no effect at all * if the decoration was not previously added to the field. * * @param decoration * the decoration to be hidden. */ public void updateDecoration(FieldDecoration decoration) { FieldDecorationData data = getDecorationData(decoration); if (data == null) { return; } if (data.label != null) { data.label.setImage(decoration.getImage()); // If the decoration is being shown, and a hover is active, // update the hover text to display the new description. if (data.label.getVisible() == true && hover != null) { showHoverText(decoration.getDescription(), data.label); } } }