warningControlDecoration = new ControlDecoration( wText, SWT.CENTER | SWT.RIGHT ); Image warningImage = GUIResource.getInstance().getImageWarning(); warningControlDecoration.setImage( warningImage ); warningControlDecoration.setDescriptionText( BaseMessages.getString( PKG, "TextVar.tooltip.FieldIsInUse" ) ); warningControlDecoration.hide();
public void modifyText( ModifyEvent arg0 ) { // Verify all the warning interfaces. // Show the first that has a warning to show... // boolean foundOne = false; for ( WarningInterface warningInterface : warningInterfaces ) { WarningMessageInterface warningSituation = warningInterface.getWarningSituation( wText.getText(), wText, this ); if ( warningSituation.isWarning() ) { foundOne = true; warningControlDecoration.show(); warningControlDecoration.setDescriptionText( warningSituation.getWarningMessage() ); break; } } if ( !foundOne ) { warningControlDecoration.hide(); } } } );
controlDecoration = new ControlDecoration( wText, SWT.CENTER | SWT.RIGHT, this ); Image image = GUIResource.getInstance().getImageVariable(); controlDecoration.setImage( image ); controlDecoration.setDescriptionText( BaseMessages.getString( PKG, "TextVar.tooltip.InsertVariable" ) ); PropsUI.getInstance().setLook( controlDecoration.getControl() );
controlDecoration = new ControlDecoration( wCombo, SWT.CENTER | SWT.RIGHT, this ); controlDecoration.setImage( image ); controlDecoration.setDescriptionText( BaseMessages.getString( PKG, "TextVar.tooltip.InsertVariable" ) );
/** * 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); }
controlDecoration = new ControlDecoration( wBox, SWT.CENTER | SWT.LEFT ); Image image = GUIResource.getInstance().getImageVariable(); controlDecoration.setImage( image ); controlDecoration.setDescriptionText( BaseMessages.getString( PKG, "CheckBoxVar.tooltip.InsertVariable" ) ); controlDecoration.addSelectionListener( new SelectionAdapter() {
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(); }
updateProjectPath(projectLocationText.getText()); }); projectLocationControlDecoration = new ControlDecoration(projectLocationText, SWT.TOP | SWT.LEFT); projectLocationControlDecoration.setImage(errorImage); frameworkViewer.setContentProvider(new ArrayContentProvider()); frameworkViewer.add(Messages.DotnetExportWizardPage_noFrameworksAvailable); frameworkControlDecoration = new ControlDecoration(frameworkViewer.getControl(), SWT.TOP | SWT.LEFT); frameworkControlDecoration.setImage(errorImage); frameworkViewer.addSelectionChangedListener(e -> { setLocationIfDefault(); setPageComplete(isPageComplete()); }); runtimeControlDecoration = new ControlDecoration(runtimeText, SWT.TOP | SWT.LEFT); runtimeControlDecoration.setImage(errorImage); setPageComplete(isPageComplete()); }); exportLocationControlDecoration = new ControlDecoration(exportLocationText, SWT.TOP | SWT.LEFT); exportLocationControlDecoration.setImage(errorImage); setPageComplete(isPageComplete()); }); configControlDecoration = new ControlDecoration(versionText, SWT.TOP | SWT.LEFT); configControlDecoration.setImage(errorImage); configControlDecoration.setShowOnlyOnFocus(true);
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 void setControlDecoration(final ControlDecoration control, final String imageKey, final String description) { control.setImage(getDecorationImage(imageKey)); control.setDescriptionText(description); control.show(); }
private void targetAdded(IObservable target) { Control control = findControl(target); if (control != null) targetDecorations.add(new TargetDecoration(target, new ControlDecoration(control, position, composite))); }
decoration = new ControlDecoration(control, SWT.LEFT | SWT.BOTTOM); decoration.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage()); decoration.hide();
protected void setRepoComboDecoration(final IStatus status) { if (status == null || status.isOK() || status.getSeverity() == IStatus.CANCEL) { repoDec.setShowOnlyOnFocus(true); repoDec.setDescriptionText(ProvUIMessages.AvailableIUsPage_RepoFilterInstructions); repoDec.setImage(info); repoDec.showHoverText(null); return; else image = info; repoDec.setImage(image); repoDec.setDescriptionText(status.getMessage()); repoDec.setShowOnlyOnFocus(false);
void updatePosition() { Control control = decoration.getControl(); decoration.dispose(); this.decoration = new ControlDecoration(control, decorationPosition, form.getBody()); update(); }
disposeListener = event -> dispose(); printAddListener(control, "DISPOSE"); //$NON-NLS-1$ control.addDisposeListener(disposeListener); printAddListener(control, "FOCUS"); //$NON-NLS-1$ control.addFocusListener(focusListener); Rectangle rect = getDecorationRectangle(control); if (shouldShowDecoration()) { event.gc.drawImage(getImage(), rect.x, rect.y); if (showHover) { if (!decorationRectangle.contains(event.x, event.y)) { hideHover(); printRemoveListener(event.widget, "MOUSEMOVE"); //$NON-NLS-1$ ((Control) event.widget) .removeMouseMoveListener(mouseMoveListener); case SWT.MouseDown: if (!selectionListeners.isEmpty()) notifySelectionListeners(event); break; case SWT.MouseDoubleClick: if (!selectionListeners.isEmpty()) notifySelectionListeners(event); break; case SWT.MenuDetect: if (!menuDetectListeners.isEmpty())
fControlDecoration.dispose(); fControlDecoration= null; fControlDecoration= new ControlDecoration(getControl(), (SWT.TOP | SWT.LEFT)); getControl().addDisposeListener(new DisposeListener() { @Override fControlDecoration.setShowHover(true); fControlDecoration.setShowOnlyOnFocus(true);
this.controlDecoration = new ControlDecoration(control, SWT.LEFT | SWT.BOTTOM); this.controlDecoration.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage());
projectNameControlDecoration.hide(); locationControlDecoration.hide(); templateControlDecoration.hide(); } else { if (!locationError.isEmpty()) { locationControlDecoration.showHoverText(locationError); locationControlDecoration.show(); projectNameControlDecoration.hide(); templateControlDecoration.hide(); } else if(!projectNameError.isEmpty()) { projectNameControlDecoration.showHoverText(projectNameError); projectNameControlDecoration.show(); locationControlDecoration.hide(); templateControlDecoration.hide(); } else { templateControlDecoration.showHoverText(projectNameError); templateControlDecoration.show(); locationControlDecoration.hide(); projectNameControlDecoration.hide();
protected void validatePage() { if (!isPageComplete()) { this.rootDirectoryTextDecorator.show(); setErrorMessage(this.rootDirectoryTextDecorator.getDescriptionText()); } else { this.rootDirectoryTextDecorator.hide(); setErrorMessage(null); } setPageComplete(isPageComplete()); }