Package org.eclipse.egit.ui.internal.repository

Examples of org.eclipse.egit.ui.internal.repository.SelectUriWizard


    changeCommonUri
        .setText(UIText.SimpleConfigureFetchDialog_ChangeUriButton);
    changeCommonUri.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        SelectUriWizard wiz;
        if (commonUriText.getText().length() > 0)
          wiz = new SelectUriWizard(true, commonUriText.getText());
        else
          wiz = new SelectUriWizard(true);
        if (new WizardDialog(getShell(), wiz).open() == Window.OK) {
          if (commonUriText.getText().length() > 0)
            try {
              config.removeURI(new URIish(commonUriText.getText()));
            } catch (URISyntaxException ex) {
              Activator.handleError(ex.getMessage(), ex, true);
            }
          config.addURI(wiz.getUri());
          updateControls();
        }
      }
    });

    final Button deleteCommonUri = new Button(sameUriDetails, SWT.PUSH);
    deleteCommonUri
        .setText(UIText.SimpleConfigureFetchDialog_DeleteUriButton);
    deleteCommonUri.setEnabled(false);
    deleteCommonUri.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        config.removeURI(config.getURIs().get(0));
        updateControls();
      }
    });

    commonUriText.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent e) {
        deleteCommonUri
            .setEnabled(commonUriText.getText().length() > 0);
      }
    });

    final Group refSpecGroup = new Group(main, SWT.SHADOW_ETCHED_IN);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(refSpecGroup);
    refSpecGroup.setText(UIText.SimpleConfigureFetchDialog_RefMappingGroup);
    refSpecGroup.setLayout(new GridLayout(2, false));

    specViewer = new TableViewer(refSpecGroup, SWT.BORDER | SWT.MULTI);
    specViewer.setContentProvider(ArrayContentProvider.getInstance());
    GridDataFactory.fillDefaults().hint(SWT.DEFAULT, 150)
        .minSize(SWT.DEFAULT, 30).grab(true, true)
        .applyTo(specViewer.getTable());

    specViewer.getTable().addKeyListener(new KeyAdapter() {
      @Override
      public void keyPressed(KeyEvent e) {
        if (e.stateMask == SWT.MOD1 && e.keyCode == 'v')
          doPaste();
      }
    });

    Composite buttonArea = new Composite(refSpecGroup, SWT.NONE);
    GridLayoutFactory.fillDefaults().applyTo(buttonArea);
    GridDataFactory.fillDefaults().grab(false, true).applyTo(buttonArea);

    addRefSpec = new Button(buttonArea, SWT.PUSH);
    addRefSpec.setText(UIText.SimpleConfigureFetchDialog_AddRefSpecButton);
    GridDataFactory.fillDefaults().applyTo(addRefSpec);
    addRefSpec.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        SimpleFetchRefSpecWizard wiz = new SimpleFetchRefSpecWizard(
            repository, config);
        WizardDialog dlg = new WizardDialog(getShell(), wiz);
        if (dlg.open() == Window.OK)
          config.addFetchRefSpec(wiz.getSpec());
        updateControls();
      }
    });

    changeRefSpec = new Button(buttonArea, SWT.PUSH);
View Full Code Here


    changeCommonUri
        .setText(UIText.SimpleConfigurePushDialog_ChangeUriButton);
    changeCommonUri.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        SelectUriWizard wiz;
        if (commonUriText.getText().length() > 0)
          wiz = new SelectUriWizard(false, commonUriText.getText());
        else
          wiz = new SelectUriWizard(false);
        if (new WizardDialog(getShell(), wiz).open() == Window.OK) {
          if (commonUriText.getText().length() > 0)
            try {
              config.removeURI(new URIish(commonUriText.getText()));
            } catch (URISyntaxException ex) {
              Activator.handleError(ex.getMessage(), ex, true);
            }
          config.addURI(wiz.getUri());
          updateControls();
        }
      }
    });

    deleteCommonUri = new Button(sameUriDetails, SWT.PUSH);
    deleteCommonUri
        .setText(UIText.SimpleConfigurePushDialog_DeleteUriButton);
    deleteCommonUri.setEnabled(false);
    deleteCommonUri.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        config.removeURI(config.getURIs().get(0));
        updateControls();
      }
    });

    commonUriText.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent e) {
        deleteCommonUri
            .setEnabled(commonUriText.getText().length() > 0);
      }
    });

    ExpandableComposite pushUriArea = new ExpandableComposite(main,
        ExpandableComposite.TREE_NODE
            | ExpandableComposite.CLIENT_INDENT);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(pushUriArea);
    pushUriArea.setExpanded(!config.getPushURIs().isEmpty());
    pushUriArea.addExpansionListener(new ExpansionAdapter() {

      public void expansionStateChanged(ExpansionEvent e) {
        main.layout(true, true);
        main.getShell().pack();
      }
    });
    pushUriArea.setText(UIText.SimpleConfigurePushDialog_PushUrisLabel);
    final Composite pushUriDetails = new Composite(pushUriArea, SWT.NONE);
    pushUriArea.setClient(pushUriDetails);
    pushUriDetails.setLayout(new GridLayout(2, false));
    GridDataFactory.fillDefaults().grab(true, true).applyTo(pushUriDetails);
    uriViewer = new TableViewer(pushUriDetails, SWT.BORDER | SWT.MULTI);
    GridDataFactory.fillDefaults().grab(true, true)
        .minSize(SWT.DEFAULT, 30).applyTo(uriViewer.getTable());
    uriViewer.setContentProvider(ArrayContentProvider.getInstance());

    final Composite uriButtonArea = new Composite(pushUriDetails, SWT.NONE);
    GridLayoutFactory.fillDefaults().applyTo(uriButtonArea);
    GridDataFactory.fillDefaults().grab(false, true).applyTo(uriButtonArea);

    Button addUri = new Button(uriButtonArea, SWT.PUSH);
    addUri.setText(UIText.SimpleConfigurePushDialog_AddPushUriButton);
    GridDataFactory.fillDefaults().applyTo(addUri);
    addUri.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        SelectUriWizard wiz = new SelectUriWizard(false);
        if (new WizardDialog(getShell(), wiz).open() == Window.OK) {
          config.addPushURI(wiz.getUri());
          updateControls();
        }
      }

    });

    final Button changeUri = new Button(uriButtonArea, SWT.PUSH);
    changeUri.setText(UIText.SimpleConfigurePushDialog_ChangePushUriButton);
    GridDataFactory.fillDefaults().applyTo(changeUri);
    changeUri.setEnabled(false);
    changeUri.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        URIish uri = (URIish) ((IStructuredSelection) uriViewer
            .getSelection()).getFirstElement();
        SelectUriWizard wiz = new SelectUriWizard(false, uri
            .toPrivateString());
        if (new WizardDialog(getShell(), wiz).open() == Window.OK) {
          config.removePushURI(uri);
          config.addPushURI(wiz.getUri());
          updateControls();
        }
      }
    });
    final Button deleteUri = new Button(uriButtonArea, SWT.PUSH);
View Full Code Here

TOP

Related Classes of org.eclipse.egit.ui.internal.repository.SelectUriWizard

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.