Package org.eclipse.egit.ui.internal.components

Examples of org.eclipse.egit.ui.internal.components.RefContentAssistProvider


    }
  }

  private void setRefAssist(RemoteConfig config) {
    if (config != null && config.getURIs().size() > 0) {
      this.assist = new RefContentAssistProvider(
          PushBranchPage.this.repository, config.getURIs().get(0),
          getShell());
    }
  }
View Full Code Here


      else
        uriToCheck = config.getPushURIs().get(0);
    } else
      uriToCheck = config.getURIs().get(0);

    final RefContentAssistProvider assistProvider = new RefContentAssistProvider(
        repo, uriToCheck, getShell());

    // source
    Label sourceLabel = new Label(main, SWT.NONE);
    if (pushMode)
      sourceLabel.setText(UIText.RefSpecDialog_SourceBranchPushLabel);
    else
      sourceLabel.setText(UIText.RefSpecDialog_SourceBranchFetchLabel);
    sourceText = new Text(main, SWT.BORDER);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
        false).applyTo(sourceText);
    if (spec != null && spec.getSource() != null)
      sourceText.setText(spec.getSource());
    sourceText.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent e) {
        if (sourceText.isFocusControl())
          if (autoSuggestDestination) {
            String name = sourceText.getText();
            if (name.startsWith(Constants.R_HEADS))
              name = name.substring(Constants.R_HEADS.length());
            else if (name.startsWith(Constants.R_TAGS))
              name = name.substring(Constants.R_TAGS.length());
            RefSpec sourceChanged = getSpec().setSource(
                sourceText.getText());
            setSpec(sourceChanged
                .setDestination(Constants.R_REMOTES
                    + config.getName() + '/' + name));
          } else
            setSpec(getSpec().setSource(sourceText.getText()));
      }
    });
    // content assist for source
    UIUtils.addRefContentProposalToText(sourceText, repo,
        new IRefListProvider() {
          public List<Ref> getRefList() {
            return assistProvider.getRefsForContentAssist(true, pushMode);
          }
        });

    // suggest remote tracking branch
    if (!pushMode) {
      final Button autoSuggest = new Button(main, SWT.CHECK);
      GridDataFactory.fillDefaults().span(2, 1).applyTo(autoSuggest);
      autoSuggest.setText(UIText.RefSpecDialog_AutoSuggestCheckbox);
      autoSuggest.setSelection(true);
      autoSuggest.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
          autoSuggestDestination = autoSuggest.getSelection();
        }
      });
    }

    // destination
    Label destinationLabel = new Label(main, SWT.NONE);
    if (pushMode)
      destinationLabel.setText(UIText.RefSpecDialog_DestinationPushLabel);
    else
      destinationLabel
          .setText(UIText.RefSpecDialog_DestinationFetchLabel);
    destinationText = new Text(main, SWT.BORDER);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
        false).applyTo(destinationText);
    if (spec != null && spec.getDestination() != null)
      destinationText.setText(spec.getDestination());
    destinationText.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent e) {
        if (destinationText.isFocusControl())
          setSpec(getSpec().setDestination(destinationText.getText()));
      }
    });
    // content assist for destination
    UIUtils.addRefContentProposalToText(destinationText, repo,
        new IRefListProvider() {
          public List<Ref> getRefList() {
            return assistProvider.getRefsForContentAssist(false, pushMode);
          }
        });

    // force update
    forceButton = new Button(main, SWT.CHECK);
View Full Code Here

TOP

Related Classes of org.eclipse.egit.ui.internal.components.RefContentAssistProvider

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.