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

Examples of org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode


*/
public class CheckoutCommand extends
    RepositoriesViewCommandHandler<RepositoryTreeNode> implements
    IElementUpdater {
  public Object execute(final ExecutionEvent event) throws ExecutionException {
    final RepositoryTreeNode node = getSelectedNodes(event).get(0);
    if (!(node.getObject() instanceof Ref))
      return null;

    final Ref ref = (Ref) node.getObject();
    Repository repo = node.getRepository();

    BranchOperationUI op = BranchOperationUI.checkout(repo, ref.getName());
    op.start();

    return null;
View Full Code Here


  }

  public void updateElement(UIElement element, Map parameters) {
    List<RepositoryTreeNode> nodes = getSelectedNodes();
    if (!nodes.isEmpty()) {
      RepositoryTreeNode node = nodes.get(0);
      if (node.getObject() instanceof Ref) {
        Ref ref = (Ref) node.getObject();
        if (BranchOperationUI.checkoutWillShowQuestionDialog(ref
            .getName())) {
          element.setText(UIText.CheckoutCommand_CheckoutLabelWithQuestion);
          return;
        }
View Full Code Here

* Configures the Push
*/
public class ConfigurePushCommand extends
    RepositoriesViewCommandHandler<RepositoryTreeNode> {
  public Object execute(ExecutionEvent event) throws ExecutionException {
    RepositoryTreeNode selectedNode = getFirstOrNull(getSelectedNodes(event));

    final String configName;
    if (selectedNode instanceof RemoteNode)
      configName = ((RemoteNode) selectedNode).getObject();
    else if (selectedNode instanceof PushNode)
      configName = ((RemoteNode) selectedNode.getParent()).getObject();
    else
      return null;

    Dialog dlg = SimpleConfigurePushDialog.getDialog(getShell(event),
        selectedNode.getRepository(), configName);
    dlg.open();
    return null;
  }
View Full Code Here

* Fetches from the remote
*/
public class FetchConfiguredRemoteCommand extends
    RepositoriesViewCommandHandler<RepositoryTreeNode> {
  public Object execute(ExecutionEvent event) throws ExecutionException {
    RepositoryTreeNode node = getSelectedNodes(event).get(0);
    RemoteConfig config = getRemoteConfig(node);
    if (config == null) {
      MessageDialog
          .openInformation(
              getShell(event),
              UIText.SimpleFetchActionHandler_NothingToFetchDialogTitle,
              UIText.SimpleFetchActionHandler_NothingToFetchDialogMessage);
      return null;
    }
    int timeout = Activator.getDefault().getPreferenceStore()
        .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT);
    new FetchOperationUI(node.getRepository(), config, timeout, false)
        .start();
    return null;
  }
View Full Code Here

    return null;
  }

  @Override
  public boolean isEnabled() {
    RepositoryTreeNode node = getSelectedNodes().get(0);
    try {
      return getRemoteConfig(node) != null;
    } catch (ExecutionException e) {
      return false;
    }
View Full Code Here

* Implements "Copy Path to Clipboard"
*/
public class CopyPathCommand extends
    RepositoriesViewCommandHandler<RepositoryTreeNode> {
  public Object execute(ExecutionEvent event) throws ExecutionException {
    RepositoryTreeNode node = getSelectedNodes(event).get(0);
    String path;

    switch (node.getType()) {
    case REPO:
      path = node.getRepository().getDirectory().toString();
      break;
    case WORKINGDIR:
      if (node.getRepository().isBare())
        return null;
      path = node.getRepository().getWorkTree().toString();
      break;
    case FILE:
      path = ((FileNode) node).getObject().getPath().toString();
      break;
    case FOLDER:
View Full Code Here

      MessageDialog.openError(Display.getDefault().getActiveShell(),
          UIText.ImportProjectsWrongSelection,
          UIText.ImportProjectsSelectionInRepositoryRequired);
      return null;
    }
    RepositoryTreeNode node = selectedNodes.get(0);
    String path;

    switch (node.getType()) {
    case REPO:
      // fall through
    case WORKINGDIR:
      path = node.getRepository().getWorkTree().toString();
      break;
    case FOLDER:
      path = ((FolderNode) node).getObject().getPath().toString();
      break;
    default:
      MessageDialog.openError(Display.getDefault().getActiveShell(),
          UIText.ImportProjectsWrongSelection,
          UIText.ImportProjectsSelectionInRepositoryRequired);
      return null;
    }

    WizardDialog dlg = new WizardDialog(
        getShell(event),
        new GitCreateProjectViaWizardWizard(node.getRepository(), path)) {
      @Override
      protected IDialogSettings getDialogBoundsSettings() {
        // preserve dialog bounds
        return Activator.getDefault().getDialogSettings();
      }
View Full Code Here

* Pushes to the remote
*/
public class PushConfiguredRemoteCommand extends
    RepositoriesViewCommandHandler<RepositoryTreeNode<?>> {
  public Object execute(ExecutionEvent event) throws ExecutionException {
    RepositoryTreeNode node = getSelectedNodes(event).get(0);
    RemoteConfig config = getRemoteConfig(node);
    if (config == null) {
      MessageDialog.openInformation(getShell(event),
          UIText.SimplePushActionHandler_NothingToPushDialogTitle,
          UIText.SimplePushActionHandler_NothingToPushDialogMessage);
      return null;
    }
    new PushOperationUI(node.getRepository(), config.getName(), false)
        .start();
    return null;
  }
View Full Code Here

  public Object execute(final ExecutionEvent event) throws ExecutionException {
    final List<RepositoryTreeNode> nodes = getSelectedNodes(event);
    if (nodes.isEmpty())
      return null;

    final RepositoryTreeNode node = nodes.get(0);

    if (node instanceof RefNode || node instanceof TagNode)
      return new CheckoutCommand().execute(event);
    if (node instanceof FileNode)
      return new OpenInEditorCommand().execute(event);
    if (node instanceof StashedCommitNode) {
      RepositoryCommit repositoryCommit = new RepositoryCommit(
          node.getRepository(),
          ((StashedCommitNode) node).getObject());
      repositoryCommit.setStash(true);
      CommitEditor.openQuiet(repositoryCommit);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode

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.