| author | Maciej Bendkowski | 2012-08-30 11:23:23 (EDT) |
|---|---|---|
| committer | Szymon Brandys | 2012-08-30 11:23:23 (EDT) |
| commit | 3a6f146fbfab6f052c141220bd0e386faaadbccc (patch) (side-by-side diff) | |
| tree | 2c2b6f9e7f0b1e915dc761d8a0142ac1c5f2378a | |
| parent | eef76045f1d410c3ed36cdc832251c03f4a23c9d (diff) | |
| download | org.eclipse.orion.client-3a6f146fbfab6f052c141220bd0e386faaadbccc.zip org.eclipse.orion.client-3a6f146fbfab6f052c141220bd0e386faaadbccc.tar.gz org.eclipse.orion.client-3a6f146fbfab6f052c141220bd0e386faaadbccc.tar.bz2 | |
Bug 388219 - [Review] I'm asked many times for the remote name
3 files changed, 20 insertions, 79 deletions
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js index f23c666..cbf657a 100644 --- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js +++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js @@ -14,7 +14,7 @@ define(['i18n!git/nls/gitmessages', 'require', 'dojo', 'orion/commands', 'orion/util', 'orion/git/util', 'orion/compare/compareUtils', 'orion/git/widgets/CloneGitRepositoryDialog', 'orion/git/widgets/AddRemoteDialog', 'orion/git/widgets/GitCredentialsDialog', 'orion/widgets/NewItemDialog', 'orion/git/widgets/RemotePrompterDialog', 'orion/git/widgets/ApplyPatchDialog', 'orion/git/widgets/OpenCommitDialog', 'orion/git/widgets/ConfirmPushDialog', 'orion/git/widgets/ReviewRequestDialog', - 'orion/git/widgets/ContentDialog', 'orion/git/widgets/CommitDialog', 'orion/git/widgets/AddRemoteRepositoryPrompterDialog'], + 'orion/git/widgets/ContentDialog', 'orion/git/widgets/CommitDialog'], function(messages, require, dojo, mCommands, mUtil, mGitUtil, mCompareUtils) { /** @@ -2047,6 +2047,11 @@ var exports = {}; imageClass: "git-sprite-fetch", //$NON-NLS-0$ spriteClass: "gitCommandSprite", //$NON-NLS-0$ callback : function(data) { + // check if we know the remote name + if(data.parameters && data.parameters.valueFor("remoteName")){ + data.remoteName = data.parameters.valueFor("remoteName"); + } + var commandInvocation = data; var handleResponse = function(jsonData, commandInvocation){ if (jsonData.JsonData.HostKey){ @@ -2068,7 +2073,7 @@ var exports = {}; commandService.collectParameters(commandInvocation); return; } - var createRemoteFunction = function(remoteLocation, name, selectedRepository) { + var createRemoteFunction = function(remoteLocation, name, selectedRepository) { serviceRegistry.getService("orion.git.provider").addRemote(remoteLocation, name, data.userData).then(function() { //$NON-NLS-0$ exports.gatherSshCredentials(serviceRegistry, data).then( function(options) { @@ -2124,16 +2129,19 @@ var exports = {}; }); }, displayErrorOnStatus); }; - var gitService = serviceRegistry.getService("orion.git.provider"); - var dialog = new orion.git.widgets.AddRemoteRepositoryPrompterDialog({ - title: messages["Remote Name:"], - serviceRegistry: serviceRegistry, - repository: data.items, - gitClient: gitService, - func: createRemoteFunction - }); - dialog.startup(); - dialog.show(); + + if(commandInvocation.remoteName){ + // known remote name, execute without prompting + createRemoteFunction(commandInvocation.items.RemoteLocation, + commandInvocation.remoteName, + commandInvocation.items); + } else { + commandInvocation.parameters = new mCommands.ParametersDescription([ + new mCommands.CommandParameter("remoteName", "text", messages["Remote Name:"]) + ], {hasOptionalParameters : false}); + + commandService.collectParameters(commandInvocation); + } }, visibleWhen : function(item) { diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/AddRemoteRepositoryPrompterDialog.js b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/AddRemoteRepositoryPrompterDialog.js deleted file mode 100644 index 4030a4d..0000000 --- a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/AddRemoteRepositoryPrompterDialog.js +++ b/dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * @license - * Copyright (c) 2011, 2012 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials are made - * available under the terms of the Eclipse Public License v1.0 - * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution - * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). - * - * Contributors: IBM Corporation - initial API and implementation - ******************************************************************************/ -/*global dojo dijit eclipse widgets */ -/*jslint browser:true */ - -define(['i18n!git/nls/gitmessages', 'dojo', 'dijit', 'orion/util', 'orion/explorer', 'dijit/Dialog', 'dijit/form/Button', 'orion/widgets/ExplorerTree', 'orion/widgets/_OrionDialogMixin', 'text!orion/git/widgets/templates/AddRemoteRepositoryPrompterDialog.html'], function(messages, dojo, dijit, mUtil, mExplorer) { - -/** -* @param options {{ - func : function(item) Function to be called with the selected item - }} - */ - -dojo.declare("orion.git.widgets.AddRemoteRepositoryPrompterDialog", [ dijit.Dialog, orion.widgets._OrionDialogMixin ], { //$NON-NLS-0$ - treeWidget : null, - treeRoot : {}, - widgetsInTemplate : true, - templateString : dojo.cache('orion', 'git/widgets/templates/AddRemoteRepositoryPrompterDialog.html'), //$NON-NLS-1$ //$NON-NLS-0$ - constructor : function() { - this.inherited(arguments); - this.options = arguments[0] || {}; - }, - - postMixInProperties : function() { - this.inherited(arguments); - this.title = this.options.title; - //this.buttonOk = messages["OK"]; - }, - - postCreate : function() { - this.inherited(arguments); - }, - - execute : function() { - this.options.func(this.options.repository.RemoteLocation, this.remoteName.value, this.options.repository); - } -}); -});
\ No newline at end of file diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/templates/AddRemoteRepositoryPrompterDialog.html b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/templates/AddRemoteRepositoryPrompterDialog.html deleted file mode 100644 index 5b0cdd1..0000000 --- a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/templates/AddRemoteRepositoryPrompterDialog.html +++ b/dev/null @@ -1,21 +0,0 @@ -<div class="dijitDialog" tabindex="-1" waiRole="dialog" waiState="labelledby-${id}_title"> - <div dojoAttachPoint="titleBar" class="dijitDialogTitleBar"> - <span dojoAttachPoint="titleNode" class="dijitDialogTitle" id="${id}_title"></span> - <span dojoAttachPoint="closeButtonNode" class="dijitDialogCloseIcon" dojoAttachEvent="onclick: onCancel" title="${buttonCancel}"> - <span dojoAttachPoint="closeText" class="closeText" title="${buttonCancel}">x</span> - </span> - </div> - <div dojoAttachPoint="containerNode" class="dijitDialogPaneContent"> - <!-- Actual content here --> - <div style="display: table"> - <div style="display: table-row"> - <div style="display: table-cell; padding: 1px;"> - <div style="display: block; padding: 5; width: 20em; text-align: right; float: right"> - <input dojoAttachPoint="remoteName" id="gitUrl" style="display: inline-block; width: 100%;" value=""> - </div> - <button dojoAttachPoint="RepositoryBrowserButton" dojoType="dijit.form.Button" type="submit" value="OK" style="padding: 20 0 10 0; float: right; clear: both;">${buttonOk} - </button> - </div> - </div> <!-- end table --> - </div> <!-- content pane --> -</div> |

