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(); } } } );
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(); } } } );
warningControlDecoration.setImage( warningImage ); warningControlDecoration.setDescriptionText( BaseMessages.getString( PKG, "TextVar.tooltip.FieldIsInUse" ) ); warningControlDecoration.hide();
warningControlDecoration.setImage( warningImage ); warningControlDecoration.setDescriptionText( BaseMessages.getString( PKG, "TextVar.tooltip.FieldIsInUse" ) ); warningControlDecoration.hide();
@Override public void focusLost(FocusEvent e) { fControlDecoration.hide(); } });
/** * Update prototype text widget decorator. */ private void updateProductDecorator() { if (fAppliedPrototype != null && !fAppliedPrototype.exists()) { fPrototypeTextDecoration.show(); } else { fPrototypeTextDecoration.hide(); } }
/** * Hides error. */ private void hide() { if (null != controlDecoration) { controlDecoration.hide(); } else if (null != messageManager) { messageManager.removeMessage(this, control); } if (alterControlBackround) { control.setBackground(controlBackground); } }
private void updateProductDecorator() { if (!fProductCombo.isEnabled()) { fProductComboDecoration.hide(); return; } String productValue = fProductCombo.getText(); String[] knownProducts = TargetPlatform.getProducts(); boolean found = false; for (String knownProduct : knownProducts) { if (knownProduct.equals(productValue)) { found = true; break; } } if (found) fProductComboDecoration.hide(); else fProductComboDecoration.show(); } }
/** * Displays validation errors in the decoration box if any of the passed {@link ValidationError} * s is involving the property displayed in this control. Otherwise the decoration box is * hidden. * * @param errors * Validation errors to check. */ public void displayValidationErrors(Collection<ValidationError> errors) { boolean showDecoration = false; StringBuilder stringBuilder = new StringBuilder("Validation errors:"); for (ValidationError error : errors) { if (error.getInvolvedProperties().contains(property)) { showDecoration = true; stringBuilder.append("\n - "); stringBuilder.append(error.getMessage()); } } if (showDecoration) { decoration.show(); decoration.setDescriptionText(stringBuilder.toString()); } else { decoration.hide(); } decorationDisplayed = showDecoration; }
//---> input myPackage = new Text(grpConnection, SWT.BORDER); myPackage.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); //---> input event myPackage.addModifyListener(new ModifyListener(){ // decorator for UI warning ControlDecoration decorator; /* * In this anonymous constructor we will initialize what needs to be initialized only once, namely the decorator. */ { decorator = new ControlDecoration(myPackage, SWT.CENTER); decorator.setDescriptionText("Not a valid package"); Image image = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage(); decorator.setImage(image); } @Override public void modifyText(ModifyEvent e) { if (true) { // place your condition here decorator.show(); } else { decorator.hide(); } } });
/** * Shows or hides all controls for this property if property is advanced. * * @param visible * <code>true</code> if control should be visible, <code>false</code> otherwise. */ public void showIfAdvanced(boolean visible) { if (property.isAdvanced()) { for (Control control : allControls) { control.setVisible(visible); } if (decorationDisplayed && visible) { decoration.show(); } else { decoration.hide(); } } }
@Override protected void performApply() { super.performApply(); if (engine != null) { ITheme theme = getSelectedTheme(); boolean themeChanged = theme != null && !theme.equals(currentTheme); boolean colorsAndFontsThemeChanged = !PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getId() .equals(currentColorsAndFontsTheme.getId()); if (theme != null) { currentTheme = theme; } ColorsAndFontsTheme colorsAndFontsTheme = getSelectedColorsAndFontsTheme(); if (colorsAndFontsTheme != null) { currentColorsAndFontsTheme = colorsAndFontsTheme; } themeComboDecorator.hide(); colorFontsDecorator.hide(); if (themeChanged || colorsAndFontsThemeChanged) { MessageDialog.openWarning(getShell(), WorkbenchMessages.ThemeChangeWarningTitle, WorkbenchMessages.ThemeChangeWarningText); } } }
public void update() { if (controlMessages.isEmpty()) { decoration.setDescriptionText(null); decoration.hide(); } else { ArrayList<Message> peers = createPeers(controlMessages); int type = peers.get(0).getMessageType(); String description = createDetails(createPeers(peers), true); if (type == IMessageProvider.ERROR) decoration.setImage(standardError.getImage()); else if (type == IMessageProvider.WARNING) decoration.setImage(standardWarning.getImage()); else if (type == IMessageProvider.INFORMATION) decoration.setImage(standardInformation.getImage()); decoration.setDescriptionText(description); decoration.show(); } }
public void update() { if (controlMessages.isEmpty()) { decoration.setDescriptionText(null); decoration.hide(); } else { ArrayList<Message> peers = createPeers(controlMessages); int type = peers.get(0).getMessageType(); String description = createDetails(createPeers(peers), true); if (type == IMessageProvider.ERROR) decoration.setImage(standardError.getImage()); else if (type == IMessageProvider.WARNING) decoration.setImage(standardWarning.getImage()); else if (type == IMessageProvider.INFORMATION) decoration.setImage(standardInformation.getImage()); decoration.setDescriptionText(description); decoration.show(); } }
protected void validatePage() { if (!isPageComplete()) { this.rootDirectoryTextDecorator.show(); setErrorMessage(this.rootDirectoryTextDecorator.getDescriptionText()); } else { this.rootDirectoryTextDecorator.hide(); setErrorMessage(null); } setPageComplete(isPageComplete()); }
/** * Updates the visibility, image, and description text of the given * ControlDecoration to represent the given status. * * @param decoration * the ControlDecoration to update * @param status * the status to be displayed by the decoration */ protected void update(ControlDecoration decoration, IStatus status) { if (status == null || status.isOK()) { decoration.hide(); } else { decoration.setImage(getImage(status)); decoration.setDescriptionText(getDescriptionText(status)); decoration.show(); } }
@Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); if (decoration != null) { if (enabled) { decoration.show(); } else { decoration.hide(); } } if (getControl().isFocusControl()) { if (enabled) { activateHandler(); } else { deactivateHandler(); } } }
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(); }
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(); } }