| author | Edyta Przymus | 2012-08-08 10:23:26 (EDT) |
|---|---|---|
| committer | Szymon Brandys | 2012-08-08 10:23:26 (EDT) |
| commit | 73356fdf34ec1bc59928d55fe3eb67b81e034dc3 (patch) (side-by-side diff) | |
| tree | 5875e446c3912b4f28c0afd3ac5588f95d96efc2 | |
| parent | 160f4eefa006f6b74514a8f8a24a458a0b569e53 (diff) | |
| download | org.eclipse.orion.client-73356fdf34ec1bc59928d55fe3eb67b81e034dc3.zip org.eclipse.orion.client-73356fdf34ec1bc59928d55fe3eb67b81e034dc3.tar.gz org.eclipse.orion.client-73356fdf34ec1bc59928d55fe3eb67b81e034dc3.tar.bz2 | |
Bug 385833 - Be able to add remote to existing repo on pullRequest pagev20120808-1423
7 files changed, 343 insertions, 185 deletions
diff --git a/bundles/org.eclipse.orion.client.core/web-ide.launch b/bundles/org.eclipse.orion.client.core/web-ide.launch index a8d6de5..6af434d 100644 --- a/bundles/org.eclipse.orion.client.core/web-ide.launch +++ b/bundles/org.eclipse.orion.client.core/web-ide.launch @@ -1,32 +1,32 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher"> -<setAttribute key="additional_plugins"/> -<booleanAttribute key="append.args" value="true"/> -<booleanAttribute key="automaticAdd" value="false"/> -<booleanAttribute key="automaticValidate" value="true"/> -<stringAttribute key="bootstrap" value=""/> -<stringAttribute key="checked" value="[NONE]"/> -<booleanAttribute key="clearConfig" value="false"/> -<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/web-ide"/> -<booleanAttribute key="default" value="false"/> -<booleanAttribute key="default_auto_start" value="true"/> -<intAttribute key="default_start_level" value="4"/> -<stringAttribute key="featureDefaultLocation" value="workspace"/> -<stringAttribute key="featurePluginResolution" value="workspace"/> -<booleanAttribute key="includeOptional" value="false"/> -<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -console -data ${workspace_loc}/../foo -clean -product org.eclipse.orion.product"/> -<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dorg.eclipse.equinox.http.jetty.http.port=8080 -Dorg.eclipse.equinox.http.jetty.autostart=false -Dorion.core.configFile=${project_loc:org.eclipse.orion.client.core}/web-ide.conf"/> -<stringAttribute key="pde.version" value="3.3"/> -<setAttribute key="selected_features"> -<setEntry value="org.eclipse.orion.base.feature:default"/> -<setEntry value="org.eclipse.orion.client.feature:default"/> -<setEntry value="org.eclipse.orion.server.authentication.feature:default"/> -<setEntry value="org.eclipse.orion.server.feature:default"/> -<setEntry value="org.eclipse.orion.server.search.feature:default"/> -</setAttribute> -<booleanAttribute key="show_selected_only" value="false"/> -<booleanAttribute key="tracing" value="false"/> -<booleanAttribute key="useCustomFeatures" value="true"/> -<booleanAttribute key="useDefaultConfigArea" value="true"/> -</launchConfiguration> +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
+<setAttribute key="additional_plugins"/>
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="true"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/web-ide"/>
+<booleanAttribute key="default" value="false"/>
+<booleanAttribute key="default_auto_start" value="true"/>
+<intAttribute key="default_start_level" value="4"/>
+<stringAttribute key="featureDefaultLocation" value="workspace"/>
+<stringAttribute key="featurePluginResolution" value="workspace"/>
+<booleanAttribute key="includeOptional" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -console -data ${workspace_loc}/../foo3 -clean -product org.eclipse.orion.product"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dorg.eclipse.equinox.http.jetty.http.port=8080 -Dorg.eclipse.equinox.http.jetty.autostart=false -Dorion.core.configFile=${project_loc:org.eclipse.orion.client.core}/web-ide.conf"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<setAttribute key="selected_features">
+<setEntry value="org.eclipse.orion.base.feature:default"/>
+<setEntry value="org.eclipse.orion.client.feature:default"/>
+<setEntry value="org.eclipse.orion.server.authentication.feature:default"/>
+<setEntry value="org.eclipse.orion.server.feature:default"/>
+<setEntry value="org.eclipse.orion.server.search.feature:default"/>
+</setAttribute>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.orion.client.git/web/git/pullRequest.css b/bundles/org.eclipse.orion.client.git/web/git/pullRequest.css index 2ed1842..a94b760 100644 --- a/bundles/org.eclipse.orion.client.git/web/git/pullRequest.css +++ b/bundles/org.eclipse.orion.client.git/web/git/pullRequest.css @@ -32,6 +32,10 @@ border-bottom: 1px solid #e6e6e6;
}
+.lightTreeTableRow{
+ overflow: hidden;
+}
+
.stretch {
float: left;
position: relative;
@@ -48,6 +52,10 @@ padding-left:8px;
}
+.gitSecondaryDescription{
+ padding-top:10px;
+}
+
pre {
margin-left: 10px;
padding: 15px;
diff --git a/bundles/org.eclipse.orion.client.git/web/git/pullRequest.html b/bundles/org.eclipse.orion.client.git/web/git/pullRequest.html index e28f9b3..67dcfcc 100644 --- a/bundles/org.eclipse.orion.client.git/web/git/pullRequest.html +++ b/bundles/org.eclipse.orion.client.git/web/git/pullRequest.html @@ -50,11 +50,13 @@ </div>
<div class="mainpane" dojoType="dijit.layout.ContentPane" splitter="false"region="center">
<div id="mainNode" class="settings mainPadding">
- <div id="openCommitSection" class="displayTable">
+ <div id="commitDiv" class="displayTable">
</div>
<div id="fetchDiv" class="displayTable">
</div>
- <div id="table" class="displayTable">
+ <div id="remoteDiv" class="displayTable">
+ </div>
+ <div id="cloneDiv" class="displayTable">
</div>
</div>
</div>
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 260fa42..e29d868 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/GetPullRequestUrlDialog', - 'orion/git/widgets/ContentDialog', 'orion/git/widgets/CommitDialog'], + 'orion/git/widgets/ContentDialog', 'orion/git/widgets/CommitDialog', 'orion/git/widgets/AddRemoteRepositoryPrompterDialog'], function(messages, require, dojo, mCommands, mUtil, mGitUtil, mCompareUtils) { /** @@ -228,7 +228,6 @@ var exports = {}; }; var errorData = data.errorData; - // if this is a known hosts error, show a prompt always if (errorData && errorData.HostKey) { if(confirm(dojo.string.substitute(messages['Would you like to add ${0} key for host ${1} to continue operation? Key fingerpt is ${2}.'], @@ -244,7 +243,7 @@ var exports = {}; } if (!data.parameters && !data.optionsRequested){ - triggerCallback({ gitSshUsername: "", gitSshPassword: "", gitPrivateKey: "", gitPassphrase: ""}); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ + triggerCallback({gitSshUsername: "", gitSshPassword: "", gitPrivateKey: "", gitPassphrase: ""}); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ return def; } @@ -869,7 +868,6 @@ var exports = {}; }, function(jsonData, secondArg) { exports.handleProgressServiceResponse2(jsonData, serviceRegistry, function() { - }, function (jsonData) { handleResponse(jsonData, commandInvocation); } @@ -2009,6 +2007,108 @@ var exports = {}; }); commandService.addCommand(cloneGitRepositoryCommandPullReq); + var addRemotePullRequestCommand = new mCommands.Command({ + name : messages["Add Remote"], + tooltip : messages["Add a new remote to the repository"], + id : "eclipse.addRemotePullRequestCommand", //$NON-NLS-0$ + imageClass: "git-sprite-fetch", //$NON-NLS-0$ + spriteClass: "gitCommandSprite", //$NON-NLS-0$ + callback : function(data) { + var commandInvocation = data; + var handleResponse = function(jsonData, commandInvocation){ + if (jsonData.JsonData.HostKey){ + commandInvocation.parameters = null; + } else if (!commandInvocation.optionsRequested){ + if (jsonData.JsonData.User) + commandInvocation.parameters = new mCommands.ParametersDescription([new mCommands.CommandParameter("sshpassword", "password", messages["SSH Password:"])], {hasOptionalParameters: true}); //$NON-NLS-1$ //$NON-NLS-0$ + else + commandInvocation.parameters = new mCommands.ParametersDescription([new mCommands.CommandParameter("sshuser", "text", messages["SSH User Name:"]), new mCommands.CommandParameter("sshpassword", "password", messages['SSH Password:'])], {hasOptionalParameters: true}); //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-0$ + } + + commandInvocation.errorData = jsonData.JsonData; + commandService.collectParameters(commandInvocation); + }; + + if (commandInvocation.parameters && commandInvocation.parameters.optionsRequested){ + commandInvocation.parameters = null; + commandInvocation.optionsRequested = true; + commandService.collectParameters(commandInvocation); + return; + } + 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) { + serviceRegistry.getService("orion.git.provider").getGitRemote(selectedRepository.RemoteLocation).then( + function(remotes){ + var remoteToFetch; + for(var i=0;i<remotes.Children.length;i++){ + if(remotes.Children[i].Name === name){ + remoteToFetch = remotes.Children[i]; + } + } + var item = selectedRepository; + var gitService = serviceRegistry.getService("orion.git.provider"); //$NON-NLS-0$ + var statusService = serviceRegistry.getService("orion.page.message"); //$NON-NLS-0$ + var deferred = gitService.doFetch(remoteToFetch.Location, false, + options.gitSshUsername, + options.gitSshPassword, + options.knownHosts, + options.gitPrivateKey, + options.gitPassphrase); + statusService.createProgressMonitor(deferred, messages["Fetching remote: "] + remoteToFetch.Location); + deferred.then( + function(jsonData, secondArg) { + exports.handleProgressServiceResponse2(jsonData, serviceRegistry, + function() { + gitService.getGitRemote(remoteToFetch.Location).then( + function(jsonData){ + var remoteJsonData = jsonData; + if (explorer.parentId === "explorer-tree") { //$NON-NLS-0$ + dojo.place(document.createTextNode(messages['Getting git incoming changes...']), "explorer-tree", "only"); //$NON-NLS-2$ //$NON-NLS-1$ + gitService.getLog(remoteJsonData.HeadLocation, remoteJsonData.Id).then(function(loadScopedCommitsList) { + explorer.renderer.setIncomingCommits(loadScopedCommitsList.Children); + explorer.loadCommitsList(remoteJsonData.CommitLocation + "?page=1", remoteJsonData, true); //$NON-NLS-0$ + }); + } + dojo.hitch(explorer, explorer.changedItem)(item); + }, displayErrorOnStatus + ); + }, function (jsonData) { + handleResponse(jsonData, data); + } + ); + },function(jsonData, secondArg) { + exports.handleProgressServiceResponse2(jsonData, serviceRegistry, + function() { + }, function (jsonData) { + handleResponse(jsonData, commandInvocation); + } + ); + } + ); + }); + }); + }, 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(); + + }, + visibleWhen : function(item) { + return true; + } + }); + commandService.addCommand(addRemotePullRequestCommand); + var initRepositoryParameters = new mCommands.ParametersDescription([new mCommands.CommandParameter("folderName", "text", messages['New folder:'])], {hasOptionalParameters: true}); //$NON-NLS-1$ //$NON-NLS-0$ var initGitRepositoryCommand = new mCommands.Command({ @@ -2586,7 +2686,8 @@ var exports = {}; } }); - commandService.addCommand(rebaseAbortCommand); + commandService.addCommand(rebaseAbortCommand); + function _rebase(HeadLocation, action){ var progressService = serviceRegistry.getService("orion.page.message"); //$NON-NLS-0$ diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitPullRequestExplorer.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitPullRequestExplorer.js index be89770..f423c7d 100644 --- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitPullRequestExplorer.js +++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitPullRequestExplorer.js @@ -13,9 +13,9 @@ /*global dojo eclipse:true widgets*/ /*jslint regexp:false browser:true forin:true*/ -define(['i18n!git/nls/gitmessages', 'require', 'dojo','dijit', 'orion/section', 'orion/explorer', 'orion/i18nUtil', 'orion/globalCommands', 'orion/compare/diff-provider', +define(['i18n!git/nls/gitmessages', 'require', 'dojo','dijit', 'orion/section', 'orion/i18nUtil', 'orion/globalCommands', 'orion/compare/diff-provider', 'orion/compare/compare-container' ,'orion/git/gitCommands', 'orion/navigationUtils','dijit/TooltipDialog', 'orion/git/widgets/CommitTooltipDialog'], - function(messages, require, dojo, dijit ,mSection, mExplorer, i18nUtil, mGlobalCommands, mDiffProvider , mCompareContainer, mGitCommands, mNavUtils) { + function(messages, require, dojo, dijit , mSection, i18nUtil, mGlobalCommands, mDiffProvider , mCompareContainer, mGitCommands, mNavUtils) { var exports = {}; exports.GitPullRequestExplorer = (function() { @@ -29,30 +29,8 @@ define(['i18n!git/nls/gitmessages', 'require', 'dojo','dijit', 'orion/section', this.registry = serviceRegistry; this.gitClient = gitClient; this.commandService = commandService; - mExplorer.createExplorerCommands(commandService); } - GitPullRequestExplorer.prototype.handleError = function(error) { - var display = {}; - display.Severity = "Error"; //$NON-NLS-0$ - display.HTML = false; - try { - var resp = JSON.parse(error.responseText); - display.Message = resp.DetailedMessage ? resp.DetailedMessage : resp.Message; - } catch (Exception) { - display.Message = error.message; - } - this.registry.getService("orion.page.message").setProgressResult(display); //$NON-NLS-0$ - - if (error.status === 404) { - this.initTitleBar(); - this.displayCommit(); - } - }; - GitPullRequestExplorer.prototype.setDefaultPath = function(defaultPath){ - this.defaultPath = defaultPath; - }; - GitPullRequestExplorer.prototype.changedItem = function(parent, children) { this.redisplay(); }; @@ -80,23 +58,28 @@ define(['i18n!git/nls/gitmessages', 'require', 'dojo','dijit', 'orion/section', } this.url = params[2]; this.initTitleBar(params[1], params[0]); - dojo.empty(dojo.byId("table")); - dojo.empty(dojo.byId("openCommitSection")); + + dojo.empty(dojo.byId("cloneDiv")); + dojo.empty(dojo.byId("commitDiv")); dojo.empty(dojo.byId("fetchDiv")); + dojo.empty(dojo.byId("remoteDiv")); + this.fileClient.loadWorkspace().then( function(workspace){ - that.setDefaultPath(workspace.Location); that.commandService.registerCommandContribution("fetch", "eclipse.orion.git.fetch", 200); that.commandService.registerCommandContribution("fetch", "eclipse.orion.git.fetchForce", 250); - var tableNode = dojo.byId("table"); - var titleWrapper1 = new mSection.Section(dojo.byId("openCommitSection"), { + that.commandService.registerCommandContribution("add", "eclipse.addRemotePullRequestCommand", 300); + var tableNode = dojo.byId("cloneDiv"); + + var titleWrapper1 = new mSection.Section(dojo.byId("commitDiv"), { id: "open commit from existing repository", //$NON-NLS-0$ title: "Commit not found", //$NON-NLS-0$ slideout: true, canHide: true, preferenceService: that.registry.getService("orion.core.preference"), - content: '<div id="openExistingNode" class="mainPadding"></list>' //$NON-NLS-0$ + content: '<div id="commitNode" class="mainPadding"></list>' //$NON-NLS-0$ }); + var titleWrapper2 = new mSection.Section(dojo.byId("fetchDiv"), { id: "fetch section", //$NON-NLS-0$ title: "No repository to fetch from the remote", //$NON-NLS-0$ @@ -105,27 +88,36 @@ define(['i18n!git/nls/gitmessages', 'require', 'dojo','dijit', 'orion/section', preferenceService: that.registry.getService("orion.core.preference"), content: '<div id="fetchNode" class="mainPadding"></list>' //$NON-NLS-0$ }); + var titleWrapper3 = new mSection.Section(tableNode, { id: "create new clone", //$NON-NLS-0$ title: "Create new repository", //$NON-NLS-0$ - content: '<div id="createNewNode" class="mainPadding"></list>' //$NON-NLS-0$ + content: '<div id="cloneNode" class="mainPadding"></list>' //$NON-NLS-0$ + }); + + var titleWrapper4 = new mSection.Section(dojo.byId("remoteDiv"), { + id: "add", //$NON-NLS-0$ + title: "All repositories have remote " + params[0] + " attached", //$NON-NLS-0$ + slideout: true, + canHide: true, + hidden: true, + content: '<div id="remoteNode" class="mainPadding"></list>' //$NON-NLS-0$ }); that.renderCloneSection(params); + if(workspace.Children.length === 0){ + dojo.byId("addTitle").innerHTML = "There are no repositories in the workspace"; + } that.renderSections(workspace.Children, params[0], params[2], params[1]); - }, - function(){ } ); - - }; GitPullRequestExplorer.prototype.renderCloneSection = function(params){ var that = this; that.commandService.registerCommandContribution("clone", "eclipse.cloneGitRepositoryPullReq", 200); - that.commandService.renderCommands("clone", dojo.byId("createNewNode"), "clone", that, "button", params[0]); - dojo.create("span", { style: "padding: 0px; text-align: left; width: 20px class: gitMainDescription", innerHTML : " using " + params[0] }, dojo.byId("createNewNode")); + that.commandService.renderCommands("clone", dojo.byId("cloneNode"), "clone", that, "button", params[0]);; + dojo.create("span", { style: "padding: 0px; text-align: left;", class: "gitMainDescription", innerHTML : " using " + params[0] }, dojo.byId("cloneNode")); }; GitPullRequestExplorer.prototype.renderSections = function(repositories, url1, url2, sha){ @@ -150,7 +142,7 @@ define(['i18n!git/nls/gitmessages', 'require', 'dojo','dijit', 'orion/section', } return deferred; - }; + }; if (repositories.length > 0) { @@ -163,133 +155,121 @@ define(['i18n!git/nls/gitmessages', 'require', 'dojo','dijit', 'orion/section', } path += repositories[0].Name; repositories[0].Content.Path = path; + that.registry.getService("orion.git.provider").getGitClone(repositories[0].Git.CloneLocation).then( function(resp){ + resp.Children[0].Id = repositories[0].Id; + that.registry.getService("orion.git.provider").getGitRemote("/gitapi/remote" + repositories[0].Location).then( - function(remotes){ - var found = false; - for(var i=0;i<remotes.Children.length;i++){ - if(remotes.Children[i].GitUrl === url1 || remotes.Children[i].GitUrl === url2) - found = true; - } - - if(found){ - findCommitLocation(repositories, sha, null, that).then( - function(commitLocation){ - var _timer; - var commitPageURL = "/git/git-commit.html#" + commitLocation + "?page=1&pageSize=1"; - var repoURL = "/git/git-repository.html#" + resp.Children[0].Location; - dojo.create("div", {id : resp.Children[0].Name + "tableitem" , class: "sectionTableItem lightTreeTableRow" , style: "height: 20px"}, dojo.byId("openExistingNode")); - dojo.create("div", {id : resp.Children[0].Name + "div" , class: "stretch" , style: "width: 1000px"}, dojo.byId(resp.Children[0].Name + "tableitem")); - dojo.create("div", {id : resp.Children[0].Name + "divCommands" , class: "sectionTableItemActions" }, dojo.byId(resp.Children[0].Name + "tableitem")); - var link2 = dojo.create("a", {style: "padding: 0px; text-align: left; display: inline-block; width: 150px", innerHTML: repositories[0].Name , href: repoURL }, dojo.byId(resp.Children[0].Name + "div")); - dojo.create("span", {style: "class: gitSecondaryDescription", innerHTML: "location: " + repositories[0].Content.Path},dojo.byId(resp.Children[0].Name + "div")); - var link = dojo.create("a", {id : resp.Children[0].Name + "a", style: "padding: 0px; text-align: left; width: 50px", innerHTML: "Open Commit", href: commitPageURL }, dojo.byId(resp.Children[0].Name + "divCommands")); - dojo.byId("open commit from existing repositoryTitle").innerHTML = "Open Commit"; - var tooltipDialog = new orion.git.widgets.CommitTooltipDialog({ - commit: that.currentCommit.Children[0], - onMouseLeave: function(){ - if(dijit.popup.hide) - dijit.popup.hide(tooltipDialog); //close doesn't work on FF - dijit.popup.close(tooltipDialog); - }, - onMouseEnter: function(){ - clearTimeout(_timer); - } - }); - dojo.connect(link, "onmouseover", link2, function() { //$NON-NLS-0$ - clearTimeout(_timer); + function(remotes){ + var found = false; + for(var i=0;i<remotes.Children.length;i++){ + if(remotes.Children[i].GitUrl === url1 || remotes.Children[i].GitUrl === url2) + found = true; + } + + if(found){ + findCommitLocation(repositories, sha, null, that).then( + function(commitLocation){ + var _timer; + var commitPageURL = "/git/git-commit.html#" + commitLocation + "?page=1&pageSize=1"; + var repoURL = "/git/git-repository.html#" + resp.Children[0].Location; + dojo.create("div", {id : resp.Children[0].Id + "tableitem" , class: "sectionTableItem lightTreeTableRow"}, dojo.byId("commitNode")); + dojo.create("div", {id : resp.Children[0].Id + "div" , class: "stretch"}, dojo.byId(resp.Children[0].Id + "tableitem")); + dojo.create("div", {id : resp.Children[0].Id + "divCommands" , class: "sectionTableItemActions" }, dojo.byId(resp.Children[0].Id + "tableitem")); + var link2 = dojo.create("a", {style: "padding: 0px; text-align: left; display: inline-block; width: 150px", innerHTML: repositories[0].Name , href: repoURL }, dojo.byId(resp.Children[0].Id + "div")); + dojo.create("span", {class: "gitSecondaryDescription", innerHTML: "location: " + repositories[0].Content.Path},dojo.byId(resp.Children[0].Id + "div")); + var link = dojo.create("a", {id : resp.Children[0].Id + "a", style: "padding: 0px; text-align: left; width: 50px", innerHTML: "Open Commit", href: commitPageURL }, dojo.byId(resp.Children[0].Id + "divCommands")); + dojo.byId("open commit from existing repositoryTitle").innerHTML = "Open Commit"; - _timer = setTimeout(function(){ - dijit.popup.open({ - popup: tooltipDialog, - around: link, - position: "before", - orient: {'BL':'TL', 'TR':'BR'} //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ - }); - }, 600); - }); - - dojo.connect(link, "onmouseout", link, function() { //$NON-NLS-0$ - clearTimeout(_timer); + var tooltipDialog = new orion.git.widgets.CommitTooltipDialog({ + commit: that.currentCommit.Children[0], + onMouseLeave: function(){ + if(dijit.popup.hide) + dijit.popup.hide(tooltipDialog); //close doesn't work on FF + dijit.popup.close(tooltipDialog); + }, + onMouseEnter: function(){ + clearTimeout(_timer); + } + }); - _timer = setTimeout(function(){ - if(dijit.popup.hide) - dijit.popup.hide(tooltipDialog); //close doesn't work on FF - dijit.popup.close(tooltipDialog); - }, 200); - }); - }, - function(){ - var index; - for(var i=0;i<remotes.Children.length;i++){ - if(remotes.Children[i].GitUrl === url1 || remotes.Children[i].GitUrl === url2){ - index = i; + dojo.connect(link, "onmouseover", link2, function() { //$NON-NLS-0$ + clearTimeout(_timer); + + _timer = setTimeout(function(){ + dijit.popup.open({ + popup: tooltipDialog, + around: link, + position: "before", + orient: {'BL':'TL', 'TR':'BR'} //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ + }); + }, 600); + }); + + dojo.connect(link, "onmouseout", link, function() { //$NON-NLS-0$ + clearTimeout(_timer); + + _timer = setTimeout(function(){ + if(dijit.popup.hide) + dijit.popup.hide(tooltipDialog); //close doesn't work on FF + dijit.popup.close(tooltipDialog); + }, 200); + }); + }, + function(){ + var index; + for(var i=0;i<remotes.Children.length;i++){ + if(remotes.Children[i].GitUrl === url1 || remotes.Children[i].GitUrl === url2){ + index = i; + } } + var repoURL = "/git/git-repository.html#" + resp.Children[0].Location; + dojo.create("div", {id : resp.Children[0].Id + "tableitem" , class: "sectionTableItem lightTreeTableRow" , style: "height: 20px"}, dojo.byId("fetchNode")); + dojo.create("div", {id : resp.Children[0].Id + "div" , class: "stretch" }, dojo.byId(resp.Children[0].Id + "tableitem")); + dojo.create("div", {id : resp.Children[0].Id + "divCommands" , class: "sectionTableItemActions" }, dojo.byId(resp.Children[0].Id + "tableitem")); + dojo.create("a", {id : resp.Children[0].Id, style: "padding: 0px; text-align: left; display: inline-block; width: 150px", innerHTML: resp.Children[0].Name + " " , href: repoURL }, dojo.byId(resp.Children[0].Id + "div")); + dojo.create("span", {class: "gitSecondaryDescription", innerHTML: "location: " + repositories[0].Content.Path},dojo.byId(resp.Children[0].Id + "div")); + that.commandService.renderCommands("fetch", dojo.byId(resp.Children[0].Id + "divCommands"), remotes.Children[index], that, "tool"); + dojo.byId("fetch sectionTitle").innerHTML = "Fetch from repository with the remote attached"; } - var repoURL = "/git/git-repository.html#" + resp.Children[0].Location; - dojo.create("div", {id : resp.Children[0].Name + "tableitem" , class: "sectionTableItem lightTreeTableRow" , style: "height: 20px"}, dojo.byId("fetchNode")); - dojo.create("div", {id : resp.Children[0].Name + "div" , class: "stretch" }, dojo.byId(resp.Children[0].Name + "tableitem")); - dojo.create("div", {id : resp.Children[0].Name + "divCommands" , class: "sectionTableItemActions" }, dojo.byId(resp.Children[0].Name + "tableitem")); - dojo.create("a", {id : resp.Children[0].Name, style: "padding: 0px; text-align: left; display: inline-block; width: 150px", innerHTML: resp.Children[0].Name + " " , href: repoURL }, dojo.byId(resp.Children[0].Name + "div")); - dojo.create("span", {style: "class: gitSecondaryDescription", innerHTML: "location: " + repositories[0].Content.Path},dojo.byId(resp.Children[0].Name + "div")); - that.commandService.renderCommands("fetch", dojo.byId(resp.Children[0].Name + "divCommands"), remotes.Children[index], that, "tool"); - dojo.byId("fetch sectionTitle").innerHTML = "Fetch from repository with the remote attached"; - + ); + } else { + var repoURL = "/git/git-repository.html#" + resp.Children[0].Location; + dojo.create("div", {id : resp.Children[0].Id + "tableitem" , class: "sectionTableItem lightTreeTableRow"}, dojo.byId("remoteNode")); + dojo.create("div", {id : resp.Children[0].Id + "div" , class: "stretch" }, dojo.byId(resp.Children[0].Id + "tableitem")); + dojo.create("div", {id : resp.Children[0].Id + "divCommands" , class: "sectionTableItemActions" }, dojo.byId(resp.Children[0].Id + "tableitem")); + dojo.create("a", {id : resp.Children[0].Id, style: "padding: 0px; text-align: left; display: inline-block; width: 150px", innerHTML: resp.Children[0].Name + " " , href: repoURL }, dojo.byId(resp.Children[0].Id + "div")); + dojo.create("span", {class: "gitSecondaryDescription", innerHTML: "location: " + repositories[0].Content.Path},dojo.byId(resp.Children[0].Id + "div")); + that.commandService.renderCommands("add", dojo.byId(resp.Children[0].Id + "divCommands"), resp.Children[0], that, "tool", url1); + dojo.byId("addTitle").innerHTML = "Attach remote " + url1 + " to existing repository and fetch"; + for(var i=0;i<remotes.Children.length;i++){ + dojo.create("div", {}, dojo.byId(resp.Children[0].Id + "div")); + resp.Children[0].RemoteLocation = "/gitapi/remote" + repositories[0].Location; + dojo.create("div", {class: "gitSecondaryDescription", innerHTML: remotes.Children[i].Name + " : " + remotes.Children[i].GitUrl},dojo.byId(resp.Children[0].Id + "div")); } - ); + } + that.renderSections(repositories.slice(1), url1, url2, sha); } - that.renderSections(repositories.slice(1), url1, url2, sha); - } - ); - - }, - function(error){ - } - ); - } - }; - - GitPullRequestExplorer.prototype.makeHref = function (fileClient, seg, location, isRemote) { - if (!location) { - return; + ); } - - fileClient.read(location, true).then(dojo.hitch(this, function(metadata) { - if (isRemote) { - var gitService = this.registry.getService("orion.git.provider"); //$NON-NLS-0$ - if (metadata.Git) { - gitService.getDefaultRemoteBranch(metadata.Git.RemoteLocation).then(function(defaultRemoteBranchJsonData, secondArg) { - seg.href = require.toUrl("git/git-log.html") + "#" + defaultRemoteBranchJsonData.Location + "?page=1"; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ - }); - } - } else { - if (metadata.Git) { - seg.href = require.toUrl("git/git-log.html") + "#" + metadata.Git.CommitLocation + "?page=1"; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ - } - } - }), dojo.hitch(this, function(error) { - window.console.error("Error loading file metadata: " + error.message); //$NON-NLS-0$ - })); }; GitPullRequestExplorer.prototype.initTitleBar = function(commit, url){ + var title = "Pull Request for " + commit + " on " + url; + var item = {}; - item.Name = "Pull Request for " + commit + " on " + url; - var title = "Pull Request for " + commit + " on " + url; - var breadcrumbRootName = "Pull Request for " + commit + " on " + url; - mGlobalCommands.setPageTarget({task: "Pull Request", title: title, breadcrumbTarget: item, - breadcrumbRootName: breadcrumbRootName, - makeBreadcrumbLink: function(seg, location) { - this.makeHref(this.fileClient, seg, location, false); - }, - serviceRegistry: this.registry, commandService: this.commandService}); + item.Name = title; + + mGlobalCommands.setPageTarget({ + task: "Pull Request", + breadcrumbTarget: item + }); }; - return GitPullRequestExplorer; }()); 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 new file mode 100644 index 0000000..4030a4d --- a/dev/null +++ b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/AddRemoteRepositoryPrompterDialog.js @@ -0,0 +1,46 @@ +/******************************************************************************* + * @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 new file mode 100644 index 0000000..5b0cdd1 --- a/dev/null +++ b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/templates/AddRemoteRepositoryPrompterDialog.html @@ -0,0 +1,21 @@ +<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> |

