Package org.eclipse.jface.fieldassist

Examples of org.eclipse.jface.fieldassist.FieldDecorationRegistry


        if( input != null && input.getFeedback() != null ){
            ControlDecoration feedback = input.getFeedback();
           
            feedback.setDescriptionText(warning);
           
            FieldDecorationRegistry decorations = FieldDecorationRegistry.getDefault();
            FieldDecoration errorDecoration = decorations.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING);
            feedback.setImage(errorDecoration.getImage());
            feedback.show();
        }
        Control control = getControl();
        if (control != null && !control.isDisposed()) {
View Full Code Here


            if( input != null && input.getFeedback() != null ){
                ControlDecoration feedback = input.getFeedback();
               
                feedback.setDescriptionText(warning);
               
                FieldDecorationRegistry decorations = FieldDecorationRegistry.getDefault();
                if( isRequired ){
                    FieldDecoration requiredDecoration = decorations.getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED);
                    feedback.setImage(requiredDecoration.getImage());
                } else {
                    FieldDecoration warningDecoration = decorations.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING );
                    feedback.setImage(warningDecoration.getImage());
                }
                feedback.show();
            }
            Control control = getControl();
View Full Code Here

    protected void feedback(String error, Throwable exception){
        if( input != null && input.getFeedback() != null ){
            ControlDecoration feedback = input.getFeedback();
           
            feedback.setDescriptionText(error);
            FieldDecorationRegistry decorations = FieldDecorationRegistry.getDefault();
            FieldDecoration warningDecoration = decorations.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING);
            feedback.setImage(warningDecoration.getImage());
            feedback.show();
        }
        Control control = getControl();
        if (control != null && !control.isDisposed()) {
View Full Code Here

   * Get a field decoration appropriate for cueing the user, including a
   * description of the active key binding.
   *
   */
  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 = (IBindingService) PlatformUI
        .getWorkbench().getService(IBindingService.class);
View Full Code Here

   * assist.
   *
   * @since 3.3
   */
  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 = (IBindingService) PlatformUI
        .getWorkbench().getService(IBindingService.class);
View Full Code Here

     *
     * @return true if the field is valid
     */
    public boolean validate(){
        System.out.println("Expression Viewer validate");
        FieldDecorationRegistry decorations = FieldDecorationRegistry.getDefault();       
        try {
            expr = ECQL.toExpression( text.getText() );
        } catch (CQLException e) {
            expr = null;
            feedback.setDescriptionText( e.getSyntaxError() );
            feedback.setImage( decorations.getFieldDecoration( FieldDecorationRegistry.DEC_ERROR).getImage() );
            feedback.show();
            return false;
        }
        if( expr == null ){
            feedback.setDescriptionText("(empty)");
            feedback.setImage( decorations.getFieldDecoration( FieldDecorationRegistry.DEC_ERROR).getImage() );
            feedback.show();
           
            return false; // so not valid!
        }
        if( isRequired && expr == Expression.NIL ){
            feedback.setDescriptionText("Required");
            feedback.setImage( decorations.getFieldDecoration( FieldDecorationRegistry.DEC_REQUIRED ).getImage() );
            feedback.show();
           
            return false;
        }
        feedback.setDescriptionText(null);
View Full Code Here

    /**
     * Used to check for any validation messages (such as required field etc...)
     * @return Validation message
     */
    public String getValidationMessage(){
        FieldDecorationRegistry decorations = FieldDecorationRegistry.getDefault();
        if( feedback.getImage() == decorations.getFieldDecoration( FieldDecorationRegistry.DEC_ERROR).getImage() ){
            String errorMessage = feedback.getDescriptionText();
            if( errorMessage == null ){
                errorMessage = "invalid";
            }
            return errorMessage;
        }
        if( feedback.getImage() == decorations.getFieldDecoration( FieldDecorationRegistry.DEC_REQUIRED ).getImage() ){
            String requiredMessage = feedback.getDescriptionText();
            if( requiredMessage == null ){
                requiredMessage = "invalid";
            }
            return requiredMessage;
View Full Code Here

     * encountered.
     *
     * @return true if the field is valid
     */
    public boolean validate() {
        FieldDecorationRegistry decorations = FieldDecorationRegistry.getDefault();
        try {
            filter = ECQL.toFilter(text.getText());
        } catch (CQLException e) {
            filter = null;
            feedback.setDescriptionText(e.getSyntaxError());
            feedback.setImage(decorations.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR)
                    .getImage());
            feedback.show();
            return false;
        }
        if (filter == null) {
            feedback.setDescriptionText("(empty)");
            feedback.setImage(decorations.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR)
                    .getImage());
            feedback.show();

            return false; // so not valid!
        }
        if (isRequired && filter == Expression.NIL) {
            feedback.setDescriptionText("Required");
            feedback.setImage(decorations.getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED)
                    .getImage());
            feedback.show();

            return false;
        }
View Full Code Here

     * Used to check for any validation messages (such as required field etc...)
     *
     * @return Validation message
     */
    public String getValidationMessage() {
        FieldDecorationRegistry decorations = FieldDecorationRegistry.getDefault();
        if (feedback.getImage() == decorations
                .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage()) {
            String errorMessage = feedback.getDescriptionText();
            if (errorMessage == null) {
                errorMessage = "invalid";
            }
            return errorMessage;
        }
        if (feedback.getImage() == decorations.getFieldDecoration(
                FieldDecorationRegistry.DEC_REQUIRED).getImage()) {
            String requiredMessage = feedback.getDescriptionText();
            if (requiredMessage == null) {
                requiredMessage = "invalid";
            }
View Full Code Here

    protected void feedback(String error, Throwable exception){
        if( input != null && input.getFeedback() != null ){
            ControlDecoration feedback = input.getFeedback();
           
            feedback.setDescriptionText(error);
            FieldDecorationRegistry decorations = FieldDecorationRegistry.getDefault();
            FieldDecoration warningDecoration = decorations.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING);
            feedback.setImage(warningDecoration.getImage());
            feedback.show();
        }
        Control control = getControl();
        if (control != null && !control.isDisposed()) {
View Full Code Here

TOP

Related Classes of org.eclipse.jface.fieldassist.FieldDecorationRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.