Search in sources :

Example 26 with RepositoryNode

use of org.eclipse.egit.ui.internal.repository.tree.RepositoryNode in project egit by eclipse.

the class RemoveOrDeleteRepositoryCommand method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    List<RepositoryNode> selectedNodes = getSelectedNodes(event);
    if (selectedNodes.size() != 1) {
        return null;
    }
    Repository repository = selectedNodes.get(0).getObject();
    if (repository == null) {
        return null;
    }
    String repositoryName = Activator.getDefault().getRepositoryUtil().getRepositoryName(repository);
    String message = MessageFormat.format(UIText.RemoveOrDeleteRepositoryCommand_DialogMessage, repositoryName);
    String[] buttonLabels = { UIText.RemoveOrDeleteRepositoryCommand_RemoveFromViewButton, UIText.RemoveOrDeleteRepositoryCommand_DeleteRepositoryButton, IDialogConstants.CANCEL_LABEL };
    MessageDialog dialog = new MessageDialog(getShell(event), UIText.RemoveOrDeleteRepositoryCommand_DialogTitle, null, message, MessageDialog.QUESTION, buttonLabels, 0);
    int result = dialog.open();
    if (result == 0) {
        // Remove from View
        super.removeRepository(event, false);
    } else if (result == 1) {
        // Delete Repository...
        super.removeRepository(event, true);
    }
    return null;
}
Also used : Repository(org.eclipse.jgit.lib.Repository) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) RepositoryNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)

Example 27 with RepositoryNode

use of org.eclipse.egit.ui.internal.repository.tree.RepositoryNode in project egit by eclipse.

the class FetchCommand method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    RepositoryNode node = getSelectedNodes(event).get(0);
    try {
        WizardDialog dlg = new WizardDialog(getShell(event), new FetchWizard(node.getRepository()));
        dlg.setHelpAvailable(false);
        dlg.open();
    } catch (URISyntaxException e1) {
        Activator.handleError(e1.getMessage(), e1, true);
    }
    return null;
}
Also used : FetchWizard(org.eclipse.egit.ui.internal.fetch.FetchWizard) URISyntaxException(java.net.URISyntaxException) RepositoryNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

RepositoryNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)27 Repository (org.eclipse.jgit.lib.Repository)18 File (java.io.File)7 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)7 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 LocalNode (org.eclipse.egit.ui.internal.repository.tree.LocalNode)4 TagsNode (org.eclipse.egit.ui.internal.repository.tree.TagsNode)4 Before (org.junit.Before)4 URISyntaxException (java.net.URISyntaxException)3 RepositoriesViewLabelProvider (org.eclipse.egit.ui.internal.repository.RepositoriesViewLabelProvider)3 BranchesNode (org.eclipse.egit.ui.internal.repository.tree.BranchesNode)3 RefNode (org.eclipse.egit.ui.internal.repository.tree.RefNode)3 RemoteTrackingNode (org.eclipse.egit.ui.internal.repository.tree.RemoteTrackingNode)3 RepositoryTreeNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 List (java.util.List)2 ExecutionException (org.eclipse.core.commands.ExecutionException)2 IProject (org.eclipse.core.resources.IProject)2 IResource (org.eclipse.core.resources.IResource)2