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(); } } } );
@Override public void focusGained(FocusEvent e) { double currentTarget = TargetPlatformHelper.getTargetVersion(); if (currentTarget <= 3.2) { fControlDecoration.show(); } }
/** * Update prototype text widget decorator. */ private void updateProductDecorator() { if (fAppliedPrototype != null && !fAppliedPrototype.exists()) { fPrototypeTextDecoration.show(); } else { fPrototypeTextDecoration.hide(); } }
/** * Shows error. */ private void show() { if (null != controlDecoration) { controlDecoration.show(); } else if (null != messageManager) { messageManager.addMessage(this, descriptionText, null, IMessageProvider.ERROR, control); } if (alterControlBackround) { control.setBackground(nonValidBackground); } }
/** * 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; }
private static void setControlDecoration(final ControlDecoration control, final String imageKey, final String description) { control.setImage(getDecorationImage(imageKey)); control.setDescriptionText(description); control.show(); }
//---> 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(); } } }
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(); } }
} else { getButton(IDialogConstants.OK_ID).setEnabled(false); decorator.show();
setErrorMessage(Messages.AcuteDebugMainTab_notAProject); projectComboDecoration.setDescriptionText(Messages.AcuteDebugMainTab_notAProject); projectComboDecoration.show(); } else if (!Tester.isDotnetProject(p)) { setErrorMessage(Messages.AcuteDebugMainTab_notADotnetProject); projectComboDecoration.setDescriptionText(Messages.AcuteDebugMainTab_notADotnetProject); projectComboDecoration.show(); } else { setErrorMessage(null);
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(); } } }
colorFontsDecorator .setDescriptionText(WorkbenchMessages.ThemeChangeWarningText); colorFontsDecorator.show(); } else colorFontsDecorator.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(); } }