Package org.eclipse.jface.bindings.keys

Examples of org.eclipse.jface.bindings.keys.KeyStroke


      controlDeco.setDescriptionText(Messages.OwlUI_CONTENT_ASSIST);
      controlDeco.setShowOnlyOnFocus(true);
    }

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

    /* Create Content Proposal Adapter */
    SimpleContentProposalProvider proposalProvider = new SimpleContentProposalProvider(new String[0]) {
      @Override
      public IContentProposal[] getProposals(String contents, int position) {
View Full Code Here


  }

  private Pair<SimpleContentProposalProvider, ContentProposalAdapter> hookAutoComplete(final Text text, Collection<String> values) {

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

    /* Create Content Proposal Adapter */
    SimpleContentProposalProvider proposalProvider = new SimpleContentProposalProvider(new String[0]);
    proposalProvider.setFiltering(true);
    final ContentProposalAdapter adapter = new ContentProposalAdapter(text, new TextContentAdapter(), proposalProvider, activationKey, null);
View Full Code Here

  }

  private Pair<SimpleContentProposalProvider, ContentProposalAdapter> hookAutoComplete(final Text text, Collection<String> values) {

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

    /* Create Content Proposal Adapter */
    SimpleContentProposalProvider proposalProvider = new SimpleContentProposalProvider(new String[0]);
    proposalProvider.setFiltering(true);
    final ContentProposalAdapter adapter = new ContentProposalAdapter(text, new TextContentAdapter(), proposalProvider, activationKey, null);
View Full Code Here

    public void createContents(Composite parent) {
        FormToolkit toolkit = getManagedForm().getToolkit();

        FieldDecoration assistDecor = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
        KeyStroke assistKeyStroke = null;
        try {
            assistKeyStroke = KeyStroke.getInstance("Ctrl+Space");
        } catch (ParseException x) {
            // Ignore
        }

        Section mainSection = toolkit.createSection(parent, Section.TITLE_BAR);
        mainSection.setText(title);

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

    }

    private void createSection(Section section, FormToolkit toolkit) {
        section.setText("Basic Information");

        KeyStroke assistKeyStroke = null;
        try {
            assistKeyStroke = KeyStroke.getInstance("Ctrl+Space");
        } catch (ParseException x) {
            // Ignore
        }
        FieldDecoration contentAssistDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);

        Composite composite = toolkit.createComposite(section);
        section.setClient(composite);

        toolkit.createLabel(composite, "Version:");
        txtVersion = toolkit.createText(composite, "", SWT.BORDER);
        ToolTips.setupMessageAndToolTipFromSyntax(txtVersion, Constants.BUNDLE_VERSION);

        Hyperlink linkActivator = toolkit.createHyperlink(composite, "Activator:", SWT.NONE);
        txtActivator = toolkit.createText(composite, "", SWT.BORDER);
        ToolTips.setupMessageAndToolTipFromSyntax(txtActivator, Constants.BUNDLE_ACTIVATOR);

        toolkit.createLabel(composite, "Declarative Services:");
        cmbComponents = new Combo(composite, SWT.READ_ONLY);
        cmbComponents.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

        // Content Proposal for the Activator field
        ContentProposalAdapter activatorProposalAdapter = null;

        ActivatorClassProposalProvider proposalProvider = new ActivatorClassProposalProvider();
        activatorProposalAdapter = new ContentProposalAdapter(txtActivator, new TextContentAdapter(), proposalProvider, assistKeyStroke, UIConstants.autoActivationCharacters());
        activatorProposalAdapter.addContentProposalListener(proposalProvider);
        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
View Full Code Here

    }

    private void createSection(Section section, FormToolkit toolkit) {
        section.setText("Basic Information");

        KeyStroke assistKeyStroke = null;
        try {
            assistKeyStroke = KeyStroke.getInstance("Ctrl+Space");
        } catch (ParseException x) {
            // Ignore
        }
        FieldDecoration contentAssistDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);

        Composite composite = toolkit.createComposite(section);
        section.setClient(composite);

        toolkit.createLabel(composite, "Version:");
        txtVersion = toolkit.createText(composite, "", SWT.BORDER);
        ToolTips.setupMessageAndToolTipFromSyntax(txtVersion, Constants.BUNDLE_VERSION);

        Hyperlink linkActivator = toolkit.createHyperlink(composite, "Activator:", SWT.NONE);
        txtActivator = toolkit.createText(composite, "", SWT.BORDER);
        ToolTips.setupMessageAndToolTipFromSyntax(txtActivator, Constants.BUNDLE_ACTIVATOR);

        toolkit.createLabel(composite, "Declarative Services:");
        cmbComponents = new Combo(composite, SWT.READ_ONLY);

        // Content Proposal for the Activator field
        ContentProposalAdapter activatorProposalAdapter = null;

        ActivatorClassProposalProvider proposalProvider = new ActivatorClassProposalProvider();
        activatorProposalAdapter = new ContentProposalAdapter(txtActivator, new TextContentAdapter(), proposalProvider, assistKeyStroke, UIConstants.autoActivationCharacters());
        activatorProposalAdapter.addContentProposalListener(proposalProvider);
        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());
        decorActivator.setMarginWidth(3);
        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
View Full Code Here

              final Trigger[] triggers = triggerSequence
                  .getTriggers();
              if (triggers.length == 1) {
                final Trigger trigger = triggers[0];
                if (trigger instanceof KeyStroke) {
                  final KeyStroke currentKeyStroke = (KeyStroke) trigger;
                  final int currentNaturalKey = currentKeyStroke
                      .getNaturalKey();
                  if ((currentKeyStroke.getModifierKeys() == (lookup
                      .getCtrl() | lookup.getShift()))
                      && ((currentNaturalKey >= '0' && currentNaturalKey <= '9')
                          || (currentNaturalKey >= 'A' && currentNaturalKey <= 'F') || (currentNaturalKey == 'U'))) {
                    accelerator = currentKeyStroke
                        .getModifierKeys()
                        | currentNaturalKey;
                    acceleratorText = triggerSequence
                        .format();
                    break;
View Full Code Here

  private final int countStrokes(final Trigger[] triggers) {
    int strokeCount = triggers.length;
    for (int i = 0; i < triggers.length; i++) {
      final Trigger trigger = triggers[i];
      if (trigger instanceof KeyStroke) {
        final KeyStroke keyStroke = (KeyStroke) trigger;
        final int modifierKeys = keyStroke.getModifierKeys();
        final IKeyLookup lookup = KeyLookupFactory.getDefault();
        if ((modifierKeys & lookup.getAlt()) != 0) {
          strokeCount += 8;
        }
        if ((modifierKeys & lookup.getCtrl()) != 0) {
View Full Code Here

      if (triggerSequence != null) {
        final Trigger[] triggers = triggerSequence.getTriggers();
        if (triggers.length == 1) {
          final Trigger trigger = triggers[0];
          if (trigger instanceof KeyStroke) {
            final KeyStroke keyStroke = (KeyStroke) trigger;
            final int accelerator = SWTKeySupport
                .convertKeyStrokeToAccelerator(keyStroke);
            return new Integer(accelerator);
          }
        }
View Full Code Here

      public void keyPressed(KeyEvent e) {
        int keyCode = e.keyCode;
        char character = e.character;
        int accelerator = SWTKeySupport
            .convertEventToUnmodifiedAccelerator(e);
        KeyStroke keyStroke = SWTKeySupport
            .convertAcceleratorToKeyStroke(accelerator);

        boolean acceleratorForward = false;
        boolean acceleratorBackward = false;
View Full Code Here

TOP

Related Classes of org.eclipse.jface.bindings.keys.KeyStroke

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.