Package org.eclipse.jface.fieldassist

Examples of org.eclipse.jface.fieldassist.ControlDecoration


    // FIXME: VERY ANNOYING! reported as 243991 in eclipse bugzilla
    // when typing, pressing arrow-down key opens combo box drop-down
    // instead of moving within autocompletion list (Mac 10.4&10.5, Eclipse
    // 3.4)
    final Combo combo = new Combo(parent, SWT.DROP_DOWN);
    final ControlDecoration decoration = new ControlDecoration(combo,
        SWT.BOTTOM | SWT.LEFT);
    final ContentAssistCommandAdapter proposal = new ContentAssistCommandAdapter(
        combo, new ComboContentAdapter(), proposalProvider, null, null,
        true);
    proposal
View Full Code Here


   * @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);
  }
View Full Code Here

        fControlDecoration= null;
      }

    } else {
      if (fControlDecoration == null) {
        fControlDecoration= new ControlDecoration(getControl(), (SWT.TOP | SWT.LEFT));
        getControl().addDisposeListener(new DisposeListener() {
          public void widgetDisposed(DisposeEvent e) {
            if (fCueLabelProvider != null) {
              fCueLabelProvider.dispose();
              fCueLabelProvider= null;
View Full Code Here

      fCustomBrowserInput = new Text(group, SWT.BORDER);
      OwlUI.makeAccessible(fCustomBrowserInput, fUseCustomExternalBrowser);
      fCustomBrowserInput.setEnabled(fUseCustomExternalBrowser.getSelection());
      fCustomBrowserInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));

      ControlDecoration controlDeco = new ControlDecoration(fCustomBrowserInput, SWT.LEFT | SWT.TOP);
      controlDeco.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
      controlDeco.setDescriptionText(Messages.BrowserPreferencePage_BROWSER_PARAMETER_SUPPORT);
      controlDeco.setShowOnlyOnFocus(true);

      String customBrowserValue = fGlobalScope.getString(DefaultPreferences.CUSTOM_BROWSER_PATH);
      if (customBrowserValue != null)
        fCustomBrowserInput.setText(customBrowserValue);
View Full Code Here

   */
  public static Pair<SimpleContentProposalProvider, ContentProposalAdapter> hookAutoComplete(final Control control, IControlContentAdapter contentAdapter, Collection<String> values, boolean decorate, final boolean autoActivate) {

    /* Show UI Hint that Content Assist is available */
    if (decorate) {
      ControlDecoration controlDeco = new ControlDecoration(control, SWT.LEFT | SWT.TOP);
      controlDeco.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage());
      controlDeco.setDescriptionText(Messages.OwlUI_CONTENT_ASSIST);
      controlDeco.setShowOnlyOnFocus(true);
    }

    /* Auto-Activate on Key-Down */
    KeyStroke activationKey = KeyStroke.getInstance(SWT.ARROW_DOWN);

View Full Code Here

        case ISearchValueType.LINK: {
          final Text text = new Text(inputField, SWT.BORDER);
          OwlUI.makeAccessible(text, NLS.bind(Messages.SearchConditionItem_SEARCH_VALUE_FIELD, field.getName()));

          /* Show UI Hint for extra information is available */
          final ControlDecoration controlDeco = new ControlDecoration(text, SWT.LEFT | SWT.TOP);
          controlDeco.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage());
          controlDeco.setShowOnlyOnFocus(true);

          /* Listen to Changes of Input */
          text.addListener(SWT.Modify, new Listener() {
            private boolean isShowingWarning = false;

            public void handleEvent(Event event) {
              String textValue = text.getText();
              fInputValue = textValue;

              if (!fInputValue.equals(input))
                fModified = true;

              if (isShowingWarning)
                controlDeco.hideHover();

              /* Determine any Search Warning to show depending on field and text value */
              SearchWarning warning = SearchWarning.NO_WARNING;
              if (field.getId() == INews.CATEGORIES || field.getId() == INews.SOURCE || field.getId() == INews.FEED || field.getId() == INews.LINK) {
                if (StringUtils.isPhraseSearch(textValue))
                  warning = SearchWarning.PHRASE_SEARCH_UNSUPPORTED;
              } else {
                if (StringUtils.isPhraseSearchWithWildcardToken(textValue))
                  warning = SearchWarning.PHRASE_AND_WILDCARD_SEARCH_COMBINED;
                else if (StringUtils.isSpecialCharacterSearchWithWildcardToken(textValue))
                  warning = SearchWarning.WILDCARD_AND_SPECIAL_CHAR_SEARCH;
              }

              /* Indicate a warning to the user if phrase search and wildcards combined or wrongly used */
              if (warning != SearchWarning.NO_WARNING && !isShowingWarning) {
                updateFieldDecoration(text, controlDeco, warning, field);
                isShowingWarning = true;
              }

              /* Clear any error if shown previously */
              else if (warning == SearchWarning.NO_WARNING && isShowingWarning) {
                updateFieldDecoration(text, controlDeco, warning, field);
                isShowingWarning = false;
              }
            }
          });

          /* Provide auto-complete for Categories, Authors and Feeds */
          if (field.getId() == INews.CATEGORIES || field.getId() == INews.AUTHOR || field.getId() == INews.FEED) {
            controlDeco.setDescriptionText(Messages.SearchConditionItem_CONTENT_ASSIST_INFO);
            final Pair<SimpleContentProposalProvider, ContentProposalAdapter> pair = OwlUI.hookAutoComplete(text, null, false, true);

            /* Load proposals in the Background */
            JobRunner.runInBackgroundThread(100, new Runnable() {
              public void run() {
                if (!text.isDisposed()) {
                  Set<String> values = new TreeSet<String>(new Comparator<String>() {
                    public int compare(String o1, String o2) {
                      return o1.compareToIgnoreCase(o2);
                    }
                  });

                  if (field.getId() == INews.CATEGORIES)
                    values.addAll(fDaoService.getCategoryDAO().loadAllNames());
                  else if (field.getId() == INews.AUTHOR)
                    values.addAll(fDaoService.getPersonDAO().loadAllNames());
                  else if (field.getId() == INews.FEED)
                    values.addAll(CoreUtils.getFeedLinks());

                  /* Apply Proposals */
                  if (!text.isDisposed())
                    OwlUI.applyAutoCompleteProposals(values, pair.getFirst(), pair.getSecond(), true);
                }
              }
            });
          }

          /* Show UI Hint that Wildcards can be used */
          else {
            controlDeco.setDescriptionText(Messages.SearchConditionItem_SEARCH_HELP);
          }

          /* Pre-Select input if given */
          Object presetInput = (input == null && fInputValue instanceof String) ? fInputValue : input;
          if (presetInput != null)
View Full Code Here

    /* Use Control Decoration on Mac */
    if (Application.IS_MAC) {

      /* Use a decoration to help the user understand the State Semantic */
      final ControlDecoration newControlDeco = new ControlDecoration(fNewState, SWT.LEFT | SWT.TOP);
      newControlDeco.setImage(OwlUI.getImage(fNewState, "icons/obj16/dotempty.gif")); //$NON-NLS-1$
      newControlDeco.hide();

      final ControlDecoration unreadControlDeco = new ControlDecoration(fUnreadState, SWT.LEFT | SWT.TOP);
      unreadControlDeco.setImage(OwlUI.getImage(fUnreadState, "icons/obj16/dotempty.gif")); //$NON-NLS-1$
      unreadControlDeco.hide();

      fNewState.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
          if (fNewState.getSelection() && !fUnreadState.getSelection()) {
            unreadControlDeco.show();
            unreadControlDeco.showHoverText(Messages.StateConditionControl_UNREAD_HINT);
          } else {
            unreadControlDeco.hide();
            unreadControlDeco.hideHover();
          }
        }
      });

      fUnreadState.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
          if (fUnreadState.getSelection() && !fNewState.getSelection()) {
            newControlDeco.show();
            newControlDeco.showHoverText(Messages.StateConditionControl_NEW_HINT);
          } else {
            newControlDeco.hide();
            newControlDeco.hideHover();
          }
        }
      });

      fNewState.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
          newControlDeco.hide();
          newControlDeco.hideHover();
        }
      });

      fUnreadState.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
          unreadControlDeco.hide();
          unreadControlDeco.hideHover();
        }
      });
    }

    /* Use Balloon Tooltip on Windows and Linux */
 
View Full Code Here

        gd.widthHint = 200;

        parentTemplate = new Text(container, SWT.BORDER | SWT.SINGLE);
        parentTemplate.setLayoutData(gd);

        ControlDecoration dec = new ControlDecoration(parentTemplate, SWT.TOP | SWT.LEFT);
        FieldDecoration indicator = FieldDecorationRegistry.getDefault().
                getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);

        dec.setImage(indicator.getImage());
        dec.setDescriptionText(indicator.getDescription() + "(Ctrl+Space)");
        dec.setShowOnlyOnFocus(true);

        Label filler = new Label(container, SWT.NONE);
        filler.setVisible(false);

        gd = new GridData();
View Full Code Here

      valueTextDecorator.hide();
    }
  }

  private ControlDecoration createDecorator(Text text, String message) {
    ControlDecoration controlDecoration = new ControlDecoration(text, SWT.LEFT | SWT.TOP);
    controlDecoration.setDescriptionText(message);
    FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
      FieldDecorationRegistry.DEC_ERROR);
    controlDecoration.setImage(fieldDecoration.getImage());
    return controlDecoration;
  }
View Full Code Here

      valueTextDecorator.hide();
    }
  }

  private ControlDecoration createDecorator(Text text, String message) {
    ControlDecoration controlDecoration = new ControlDecoration(text, SWT.LEFT | SWT.TOP);
    controlDecoration.setDescriptionText(message);
    FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
      FieldDecorationRegistry.DEC_ERROR);
    controlDecoration.setImage(fieldDecoration.getImage());
    return controlDecoration;
  }
View Full Code Here

TOP

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

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.