コード例 #1
0
  /** DOC amaumont Comment method "initProposal". */
  private void initProposal() {
    if (contentProposalAdapter == null) {
      contentProposalAdapter = ProposalUtils.getCommonProposal(textCellEditor);
      contentProposalAdapter.addContentProposalListener(
          new IContentProposalExtendedListener() {

            public void proposalBeforeModifyControl(IContentProposal proposal) {
              if (!text.isFocusControl() && contentProposalAdapter.hasFocus()) {
                activateCellEditor();
                text.setSelection(
                    new Point(selectionBeforeFocusLost.x, selectionBeforeFocusLost.y));
              }
            }

            public void proposalClosed() {}

            public void proposalOpened() {}

            public void proposalAccepted(IContentProposal proposal) {
              selectionBeforeFocusLost = text.getSelection();
              activateCellEditorAsynch(null, false);
            }
          });
    }
  }
コード例 #2
0
  protected void keyReleaseOccured(KeyEvent keyEvent) {
    boolean proposalOpened = contentProposalAdapter.isProposalOpened();
    if (!proposalOpened) {

      if (keyEvent.character == '\r') { // Return key
        if (text != null && !text.isDisposed() && (text.getStyle() & SWT.MULTI) != 0) {
          if ((keyEvent.stateMask & SWT.CTRL) != 0) {
            return;
          }
        }
        keyEvent.doit = false;
      }
      cellEditorClassKeyReleasedOccured(keyEvent);
    }
  }
コード例 #3
0
 public void setContentProposalProvider(IContentProposalProvider proposalProvider) {
   if (contentProposalAdapter != null) {
     contentProposalAdapter.setContentProposalProvider(proposalProvider);
   }
 }
コード例 #4
0
 public IContentProposalProvider getProposalProvider() {
   if (contentProposalAdapter != null) {
     return contentProposalAdapter.getContentProposalProvider();
   }
   return null;
 }