Package org.eclipse.jface.fieldassist

Examples of org.eclipse.jface.fieldassist.ControlDecoration$Hover


    /* 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


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

    /* 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

          /* Provide Auto-Complete Field */
          hookAutoComplete(text, field.getSearchValueType().getEnumValues());

          /* Show UI Hint that Content Assist is available */
          ControlDecoration controlDeco = new ControlDecoration(text, SWT.LEFT | SWT.TOP);
          controlDeco.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage());
          controlDeco.setDescriptionText("Content Assist Available (Press Arrow-Down Key)");
          controlDeco.setShowOnlyOnFocus(true);

          /* Pre-Select input if given */
          String inputValue = (input != null ? input.toString() : null);
          if (inputValue != null)
            text.setText(inputValue);

          /* Update Input Value */
          fInputValue = text.getText();

          break;
        }

          /* Type: Number */
        case ISearchValueType.NUMBER:
        case ISearchValueType.INTEGER: {
          final Spinner spinner = new Spinner(inputField, SWT.BORDER);
          spinner.setMinimum(0);
          spinner.setMaximum(1000);
          spinner.addListener(SWT.Modify, new Listener() {
            public void handleEvent(Event event) {
              fInputValue = spinner.getSelection();

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

          /* Pre-Select input if given */
          Object presetInput = (input == null) ? fInputValue : input;
          if (presetInput != null && presetInput instanceof Integer)
            spinner.setSelection((Integer) presetInput);

          /* Update Input Value */
          fInputValue = spinner.getSelection();

          break;
        }

          /* Type: String */
        case ISearchValueType.STRING:
        case ISearchValueType.LINK: {
          final Text text = new Text(inputField, SWT.BORDER);
          text.addListener(SWT.Modify, new Listener() {
            public void handleEvent(Event event) {
              fInputValue = text.getText();

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

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

            /* Load proposals in the Background */
            JobRunner.runDelayedInBackgroundThread(new Runnable() {
              public void run() {
                if (!text.isDisposed()) {
                  Set<String> values = null;
                  if (field.getId() == INews.CATEGORIES)
                    values = fDaoService.getCategoryDAO().loadAllNames();
                  else if (field.getId() == INews.AUTHOR)
                    values = fDaoService.getPersonDAO().loadAllNames();
                  else if (field.getId() == INews.FEED)
                    values = Controller.getDefault().getCacheService().getFeedLinks();

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

            /* Show UI Hint that Content Assist is available */
            ControlDecoration controlDeco = new ControlDecoration(text, SWT.LEFT | SWT.TOP);
            controlDeco.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage());
            controlDeco.setDescriptionText("Content Assist Available (Press Arrow-Down Key)");
            controlDeco.setShowOnlyOnFocus(true);
          }

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

                fModified = true;
            }
          });

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

          /* 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());
                }
              }
            });
          }

          /* 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

        frameworkViewer.setUseHashlookup(true);
        frameworkViewer.setContentProvider(fwkContentProvider);

        Label lblExecEnv = tk.createLabel(composite, "Execution Env.:");
        cmbExecEnv = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
        ControlDecoration eeDecor = new ControlDecoration(cmbExecEnv, SWT.LEFT | SWT.TOP, composite);
        eeDecor.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
        eeDecor.setDescriptionText("The runtime Java Virtual Machine will be required/assumed " + "\nto support this Execution Environment");

        eeViewer = new ComboViewer(cmbExecEnv);
        eeViewer.setContentProvider(ArrayContentProvider.getInstance());
        eeViewer.setLabelProvider(new LabelProvider() {
            @Override
View Full Code Here

        mainComposite = toolkit.createComposite(mainSection);
        mainSection.setClient(mainComposite);

        toolkit.createLabel(mainComposite, "Pattern:");
        txtName = toolkit.createText(mainComposite, "", SWT.BORDER);
        ControlDecoration decPattern = new ControlDecoration(txtName, SWT.LEFT | SWT.TOP, mainComposite);
        decPattern.setImage(assistDecor.getImage());
        if (assistKeyStroke == null) {
            decPattern.setDescriptionText("Content assist is available. Start typing to activate");
        } else {
            decPattern.setDescriptionText(MessageFormat.format("Content assist is available. Press {0} or start typing to activate", assistKeyStroke.format()));
        }
        decPattern.setShowHover(true);
        decPattern.setShowOnlyOnFocus(true);

        PkgPatternsProposalProvider proposalProvider = new PkgPatternsProposalProvider(new FormPartJavaSearchContext(this));
        ContentProposalAdapter patternProposalAdapter = new ContentProposalAdapter(txtName, new TextContentAdapter(), proposalProvider, assistKeyStroke, UIConstants.autoActivationCharacters());
        patternProposalAdapter.addContentProposalListener(proposalProvider);
        patternProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_IGNORE);
View Full Code Here

    private Control createHelpLabel(Composite container, String text) {
        Label label = new Label(container, SWT.WRAP);
        label.setText(text);

        ControlDecoration decoration = new ControlDecoration(label, SWT.LEFT, container);
        Image imgInfo = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage();
        decoration.setImage(imgInfo);

        GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
        gd.horizontalIndent = imgInfo.getBounds().width;
        gd.widthHint = 100;
        label.setLayoutData(gd);
View Full Code Here

        activatorProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
        activatorProposalAdapter.setLabelProvider(new JavaContentProposalLabelProvider());
        activatorProposalAdapter.setAutoActivationDelay(1000);

        // Decorator for the Activator field
        ControlDecoration decorActivator = new ControlDecoration(txtActivator, SWT.LEFT | SWT.CENTER, composite);
        decorActivator.setImage(contentAssistDecoration.getImage());
        if (assistKeyStroke == null) {
            decorActivator.setDescriptionText("Content Assist is available. Start typing to activate");
        } else {
            decorActivator.setDescriptionText(MessageFormat.format("Content Assist is available. Press {0} or start typing to activate", assistKeyStroke.format()));
        }
        decorActivator.setShowOnlyOnFocus(true);
        decorActivator.setShowHover(true);

        // Decorator for the Components combo
        ControlDecoration decorComponents = new ControlDecoration(cmbComponents, SWT.LEFT | SWT.CENTER, composite);
        decorComponents.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
        decorComponents.setDescriptionText("Use Java annotations to detect Declarative Service Components.");
        decorComponents.setShowOnlyOnFocus(false);
        decorComponents.setShowHover(true);

        // Listeners
        txtVersion.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                lock.ifNotModifying(new Runnable() {
View Full Code Here

        processingErrorsText = new Text(cmpProcessingErrors, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.READ_ONLY);
        GridData gd_processingErrors = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
        gd_processingErrors.heightHint = 80;
        processingErrorsText.setLayoutData(gd_processingErrors);

        ControlDecoration controlDecoration = new ControlDecoration(processingErrorsText, SWT.RIGHT | SWT.TOP);
        controlDecoration.setMarginWidth(2);
        controlDecoration.setDescriptionText("Double-click to view details");
        controlDecoration.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage());

        Composite cmpUnresolved = new Composite(sashForm, SWT.NONE);
        GridLayout gl_unresolved = new GridLayout(2, false);
        gl_unresolved.marginRight = 7;
        cmpUnresolved.setLayout(gl_unresolved);
View Full Code Here

        frameworkViewer.setUseHashlookup(true);
        frameworkViewer.setContentProvider(fwkContentProvider);

        Label lblExecEnv = tk.createLabel(composite, "Execution Env.:");
        cmbExecEnv = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
        ControlDecoration eeDecor = new ControlDecoration(cmbExecEnv, SWT.LEFT | SWT.TOP, composite);
        eeDecor.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
        eeDecor.setDescriptionText("The runtime Java Virtual Machine will be required/assumed " + "\nto support this Execution Environment");

        eeViewer = new ComboViewer(cmbExecEnv);
        eeViewer.setContentProvider(ArrayContentProvider.getInstance());
        eeViewer.setLabelProvider(new LabelProvider() {
            @Override
View Full Code Here

TOP

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

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.