Package org.eclipse.egit.ui.internal.actions

Source Code of org.eclipse.egit.ui.internal.actions.SimplePushActionHandler

/*******************************************************************************
* Copyright (C) 2010, Mathias Kinzler <mathias.kinzler@sap.com>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.egit.ui.internal.actions;

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.internal.push.PushOperationUI;
import org.eclipse.egit.ui.internal.push.SimpleConfigurePushDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.RemoteConfig;

/**
* Action for "Simple Push"
*/
public class SimplePushActionHandler extends RepositoryActionHandler {
  public Object execute(ExecutionEvent event) throws ExecutionException {
    final Repository repository = getRepository(true, event);
    if (repository == null)
      return null;
    RemoteConfig config = SimpleConfigurePushDialog
        .getConfiguredRemote(repository);
    if (config == null) {
      MessageDialog.openInformation(getShell(event),
          UIText.SimplePushActionHandler_NothingToPushDialogTitle,
          UIText.SimplePushActionHandler_NothingToPushDialogMessage);
      return null;
    }

    PushOperationUI op = new PushOperationUI(repository, config.getName(), false);
    op.start();
    return null;
  }

  @Override
  public boolean isEnabled() {
    final Repository repository = getRepository();
    return repository != null
        && SimpleConfigurePushDialog
            .getConfiguredRemote(repository) != null;
  }
}
TOP

Related Classes of org.eclipse.egit.ui.internal.actions.SimplePushActionHandler

TOP
Copyright © 2018 www.massapi.com. 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.