Merge branch 'stable-4.4'
* stable-4.4:
Allow using JDK 7 bootclasspath when compiling egit using Java 8
Fix wrong toc.xml in documentation bundle
Update wikitext used to generated documentation from wiki to 2.9
Change-Id: I02000f4cebb81cf82720fe29c397d167072cda3c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
diff --git a/org.eclipse.egit-feature/feature.xml b/org.eclipse.egit-feature/feature.xml
index e2fd970..5796d5e 100644
--- a/org.eclipse.egit-feature/feature.xml
+++ b/org.eclipse.egit-feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.egit"
label="%featureName"
- version="4.4.1.qualifier"
+ version="4.5.0.qualifier"
provider-name="%providerName"
plugin="org.eclipse.egit"
license-feature="org.eclipse.license"
@@ -40,7 +40,7 @@
<import plugin="org.eclipse.jsch.ui" version="1.1.100" match="compatible"/>
<import plugin="org.eclipse.jsch.core" version="1.1.100" match="compatible"/>
<import plugin="com.jcraft.jsch" version="0.1.37" match="compatible"/>
- <import feature="org.eclipse.jgit" version="4.4.1" match="equivalent"/>
+ <import feature="org.eclipse.jgit" version="4.5.0" match="equivalent"/>
</requires>
<plugin
diff --git a/org.eclipse.egit-feature/pom.xml b/org.eclipse.egit-feature/pom.xml
index 50697c9..f3d9280 100644
--- a/org.eclipse.egit-feature/pom.xml
+++ b/org.eclipse.egit-feature/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.egit.feature</groupId>
diff --git a/org.eclipse.egit.core.test/META-INF/MANIFEST.MF b/org.eclipse.egit.core.test/META-INF/MANIFEST.MF
index b1aa00a..6525272 100644
--- a/org.eclipse.egit.core.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.core.test/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@
Bundle-Vendor: Eclipse.org
Bundle-SymbolicName: org.eclipse.egit.core.test;singleton:=true
Fragment-Host: org.eclipse.egit.core
-Bundle-Version: 4.4.1.qualifier
+Bundle-Version: 4.5.0.qualifier
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)",
org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
@@ -17,14 +17,14 @@
Import-Package: org.mockito;version="[1.8.0,1.9.0)",
org.mockito.runners;version="[1.8.0,1.9.0)",
org.mockito.stubbing;version="[1.8.0,1.9.0)",
- org.eclipse.egit.core;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.op;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.project;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.api.errors;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.junit;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.lib;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.treewalk;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.treewalk.filter;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.util;version="[4.4.1,4.5.0)"
+ org.eclipse.egit.core;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.op;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.project;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.api.errors;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.junit;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.lib;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.treewalk;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.treewalk.filter;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.util;version="[4.5.0,4.6.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Export-Package: org.eclipse.egit.core.test;version="4.4.1"
+Export-Package: org.eclipse.egit.core.test;version="4.5.0"
diff --git a/org.eclipse.egit.core.test/pom.xml b/org.eclipse.egit.core.test/pom.xml
index ffa70fa..38b91d3 100644
--- a/org.eclipse.egit.core.test/pom.xml
+++ b/org.eclipse.egit.core.test/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.egit.core.test</artifactId>
diff --git a/org.eclipse.egit.core/META-INF/MANIFEST.MF b/org.eclipse.egit.core/META-INF/MANIFEST.MF
index 802a608..b4af9c8 100644
--- a/org.eclipse.egit.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %plugin_name
Bundle-SymbolicName: org.eclipse.egit.core;singleton:=true
-Bundle-Version: 4.4.1.qualifier
+Bundle-Version: 4.5.0.qualifier
Bundle-Activator: org.eclipse.egit.core.Activator
Bundle-Vendor: %provider_name
Bundle-Localization: plugin
@@ -13,56 +13,56 @@
org.eclipse.equinox.security;bundle-version="[1.0.0,2.0.0)",
org.eclipse.core.variables;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.filebuffers;bundle-version="[3.5.0,4.0.0)"
-Export-Package: org.eclipse.egit.core;version="4.4.1";
+Export-Package: org.eclipse.egit.core;version="4.5.0";
x-friends:="org.eclipse.egit.ui,
org.eclipse.egit.ui.test,
org.eclipse.egit.mylyn.ui,
org.eclipse.egit.gitflow.test,
org.eclipse.egit.gitflow.ui",
- org.eclipse.egit.core.internal;version="4.4.1";x-friends:="org.eclipse.egit.ui,org.eclipse.egit.import,org.eclipse.egit.gitflow.ui",
- org.eclipse.egit.core.internal.gerrit;version="4.4.1";x-friends:="org.eclipse.egit.ui",
- org.eclipse.egit.core.internal.indexdiff;version="4.4.1";x-friends:="org.eclipse.egit.ui,org.eclipse.egit.ui.test",
- org.eclipse.egit.core.internal.job;version="4.4.1";x-friends:="org.eclipse.egit.ui,org.eclipse.egit.gitflow.ui,org.eclipse.egit.gitflow",
- org.eclipse.egit.core.internal.merge;version="4.4.1";x-internal:=true,
- org.eclipse.egit.core.internal.rebase;version="4.4.1";x-friends:="org.eclipse.egit.ui",
- org.eclipse.egit.core.internal.storage;version="4.4.1";x-friends:="org.eclipse.egit.ui,org.eclipse.egit.core.test",
- org.eclipse.egit.core.internal.trace;version="4.4.1";x-internal:=true,
- org.eclipse.egit.core.internal.util;version="4.4.1";x-friends:="org.eclipse.egit.ui",
- org.eclipse.egit.core.op;version="4.4.1";
+ org.eclipse.egit.core.internal;version="4.5.0";x-friends:="org.eclipse.egit.ui,org.eclipse.egit.import,org.eclipse.egit.gitflow.ui",
+ org.eclipse.egit.core.internal.gerrit;version="4.5.0";x-friends:="org.eclipse.egit.ui",
+ org.eclipse.egit.core.internal.indexdiff;version="4.5.0";x-friends:="org.eclipse.egit.ui,org.eclipse.egit.ui.test",
+ org.eclipse.egit.core.internal.job;version="4.5.0";x-friends:="org.eclipse.egit.ui,org.eclipse.egit.gitflow.ui,org.eclipse.egit.gitflow",
+ org.eclipse.egit.core.internal.merge;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.core.internal.rebase;version="4.5.0";x-friends:="org.eclipse.egit.ui",
+ org.eclipse.egit.core.internal.storage;version="4.5.0";x-friends:="org.eclipse.egit.ui,org.eclipse.egit.core.test",
+ org.eclipse.egit.core.internal.trace;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.core.internal.util;version="4.5.0";x-friends:="org.eclipse.egit.ui",
+ org.eclipse.egit.core.op;version="4.5.0";
x-friends:="org.eclipse.egit.ui.test,
org.eclipse.egit.ui,
org.eclipse.egit.gitflow,
org.eclipse.egit.gitflow.test,
org.eclipse.egit.gitflow.ui",
- org.eclipse.egit.core.project;version="4.4.1";x-friends:="org.eclipse.egit.ui,org.eclipse.egit.ui.test,org.eclipse.egit.gitflow.ui",
- org.eclipse.egit.core.securestorage;version="4.4.1";x-friends:="org.eclipse.egit.ui",
- org.eclipse.egit.core.storage;version="4.4.1";uses:="org.eclipse.core.runtime,org.eclipse.jgit.lib,org.eclipse.core.resources",
- org.eclipse.egit.core.synchronize;version="4.4.1";x-friends:="org.eclipse.egit.ui,org.eclipse.egit.ui.test",
- org.eclipse.egit.core.synchronize.dto;version="4.4.1";x-friends:="org.eclipse.egit.ui"
+ org.eclipse.egit.core.project;version="4.5.0";x-friends:="org.eclipse.egit.ui,org.eclipse.egit.ui.test,org.eclipse.egit.gitflow.ui",
+ org.eclipse.egit.core.securestorage;version="4.5.0";x-friends:="org.eclipse.egit.ui",
+ org.eclipse.egit.core.storage;version="4.5.0";uses:="org.eclipse.core.runtime,org.eclipse.jgit.lib,org.eclipse.core.resources",
+ org.eclipse.egit.core.synchronize;version="4.5.0";x-friends:="org.eclipse.egit.ui,org.eclipse.egit.ui.test",
+ org.eclipse.egit.core.synchronize.dto;version="4.5.0";x-friends:="org.eclipse.egit.ui"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.jcraft.jsch;bundle-version="[0.1.37,0.2.0)",
org.eclipse.core.net.proxy;bundle-version="[1.1.0,2.0.0)",
- org.eclipse.jgit.annotations;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.api;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.api.errors;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.diff;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.dircache;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.errors;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.events;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.internal.storage.file;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.lib;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.merge;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.patch;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.revwalk;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.revwalk.filter;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.storage.file;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.submodule;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.transport;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.treewalk;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.treewalk.filter;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.util;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.util.io;version="[4.4.1,4.5.0)",
+ org.eclipse.jgit.annotations;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.api;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.api.errors;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.diff;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.dircache;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.errors;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.events;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.internal.storage.file;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.lib;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.merge;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.patch;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.revwalk;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.revwalk.filter;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.storage.file;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.submodule;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.transport;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.treewalk;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.treewalk.filter;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.util;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.util.io;version="[4.5.0,4.6.0)",
org.eclipse.jsch.core;bundle-version="[1.1.100,2.0.0)",
org.slf4j;version="[1.7.0,2.0.0)"
Eclipse-ExtensibleAPI: true
diff --git a/org.eclipse.egit.core/pom.xml b/org.eclipse.egit.core/pom.xml
index 48fbc48..ea37dec 100644
--- a/org.eclipse.egit.core/pom.xml
+++ b/org.eclipse.egit.core/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.egit.core</artifactId>
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/CoreText.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/CoreText.java
index ad899ff..378468c 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/CoreText.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/CoreText.java
@@ -95,6 +95,9 @@
public static String ContainerTreeIterator_DeletedFile;
/** */
+ public static String DeleteBranchOperation_Canceled;
+
+ /** */
public static String DeleteBranchOperation_TaskName;
/** */
@@ -152,6 +155,9 @@
public static String UntrackOperation_writingIndex;
/** */
+ public static String GerritUtil_ConfigSaveError;
+
+ /** */
public static String GitFileHistory_errorParsingHistory;
/** */
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/coretext.properties b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/coretext.properties
index b4690a8..62c08a4 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/coretext.properties
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/coretext.properties
@@ -23,6 +23,7 @@
ConnectProviderOperation_UnexpectedRepositoryError=Error connecting project {0}, suggested path ''{1}'' do not match found Git repositories ''{2}''.
ContainerTreeIterator_DeletedFile=Deleted file: ''{0}''
+DeleteBranchOperation_Canceled=Deletion of branches canceled
DeleteBranchOperation_TaskName=Deleting branch {0}
DeleteTagOperation_exceptionMessage=Exception deleting tag ''{0}''
DiffHeaderFormat_Email=Git (e-mail header)
@@ -58,6 +59,8 @@
UntrackOperation_failed=Failed to untrack resource.
UntrackOperation_writingIndex=Writing index for {0}
+GerritUtil_ConfigSaveError=Cannot properly configure repository ''{0}'' for use with Gerrit
+
GitFileHistory_errorParsingHistory=Error parsing history for {0}.
GitFileHistory_gitNotAttached=Git not attached to project {0}.
GitFileHistory_invalidCommit=Commit {0} is not part of the history for {1}.
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java
index 95af64f..013dd70 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/gerrit/GerritUtil.java
@@ -10,13 +10,22 @@
*******************************************************************************/
package org.eclipse.egit.core.internal.gerrit;
+import java.io.File;
+import java.io.IOException;
import java.net.URISyntaxException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.egit.core.Activator;
+import org.eclipse.egit.core.internal.CoreText;
+import org.eclipse.jgit.annotations.NonNull;
+import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.jgit.transport.URIish;
@@ -127,16 +136,19 @@
*
* @param remoteConfig
* the remote configuration to configure this in
+ * @return {@code true} if the {@code remoteConfig} was changed,
+ * {@code false} otherwise.
*/
- public static void configureFetchNotes(RemoteConfig remoteConfig) {
+ public static boolean configureFetchNotes(RemoteConfig remoteConfig) {
String notesRef = Constants.R_NOTES + "*"; //$NON-NLS-1$
List<RefSpec> fetchRefSpecs = remoteConfig.getFetchRefSpecs();
for (RefSpec refSpec : fetchRefSpecs) {
if (refSpec.matchSource(notesRef)) {
- return;
+ return false;
}
}
- remoteConfig.addFetchRefSpec(new RefSpec(notesRef + ":" + notesRef)); //$NON-NLS-1$
+ remoteConfig.addFetchRefSpec(new RefSpec(notesRef + ':' + notesRef));
+ return true;
}
@@ -181,4 +193,82 @@
}
return false;
}
+
+ /**
+ * If the repository is not bare and looks like it might be a Gerrit
+ * repository, try to configure it such that EGit's Gerrit support is
+ * enabled.
+ *
+ * @param repository
+ * to try to configure
+ */
+ public static void tryToAutoConfigureForGerrit(
+ @NonNull Repository repository) {
+ if (repository.isBare()) {
+ return;
+ }
+ StoredConfig config = repository.getConfig();
+ boolean isGerrit = false;
+ boolean changed = false;
+ try {
+ for (RemoteConfig remote : RemoteConfig
+ .getAllRemoteConfigs(config)) {
+ if (isGerritPush(remote)) {
+ isGerrit = true;
+ if (configureFetchNotes(remote)) {
+ changed = true;
+ remote.update(config);
+ }
+ }
+ }
+ } catch (URISyntaxException ignored) {
+ // Ignore it here -- we're just trying to set up Gerrit support.
+ }
+ if (isGerrit) {
+ if (config.getString(ConfigConstants.CONFIG_GERRIT_SECTION, null,
+ ConfigConstants.CONFIG_KEY_CREATECHANGEID) != null) {
+ // Already configured.
+ } else {
+ setCreateChangeId(config);
+ changed = true;
+ }
+ if (changed) {
+ try {
+ config.save();
+ } catch (IOException e) {
+ Activator.logError(
+ MessageFormat.format(
+ CoreText.GerritUtil_ConfigSaveError,
+ repository.getDirectory()),
+ e);
+ }
+ }
+ }
+ }
+
+ /**
+ * If the repository is not bare and looks like it might be a Gerrit
+ * repository, try to configure it such that EGit's Gerrit support is
+ * enabled. Does nothing if the {@code repositoryDir} is {@code null} or the
+ * repository cannot be configured.
+ *
+ * @param repositoryDir
+ * .git Directory of the repository to try to configure
+ */
+ public static void tryToAutoConfigureForGerrit(
+ @Nullable File repositoryDir) {
+ if (repositoryDir != null) {
+ try {
+ Repository repository = Activator.getDefault()
+ .getRepositoryCache().lookupRepository(repositoryDir);
+ if (repository != null) {
+ tryToAutoConfigureForGerrit(repository);
+ }
+ } catch (IOException ignored) {
+ // Ignore it here -- this is just a best-effort. If the repo
+ // cannot be read, other places will report the problem.
+ }
+ }
+ }
+
}
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/DeleteBranchOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/DeleteBranchOperation.java
index fcd0db5..70db84b 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/DeleteBranchOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/DeleteBranchOperation.java
@@ -1,10 +1,12 @@
/*******************************************************************************
- * Copyright (C) 2010, Mathias Kinzler <mathias.kinzler@sap.com>
+ * Copyright (C) 2010, 2016 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
+ *
+ * Lars Vogel <Lars.Vogel@vogella.com> - Bug 497630
*******************************************************************************/
package org.eclipse.egit.core.op;
@@ -19,7 +21,8 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.egit.core.Activator;
import org.eclipse.egit.core.internal.CoreText;
@@ -94,12 +97,7 @@
@Override
public void execute(IProgressMonitor m) throws CoreException {
- IProgressMonitor monitor;
- if (m == null)
- monitor = new NullProgressMonitor();
- else
- monitor = m;
-
+ SubMonitor subMonitor = SubMonitor.convert(m);
IWorkspaceRunnable action = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor actMonitor) throws CoreException {
@@ -122,6 +120,10 @@
}
actMonitor.beginTask(taskName, branches.size());
for (Ref branch : branches) {
+ if (actMonitor.isCanceled()) {
+ throw new OperationCanceledException(
+ CoreText.DeleteBranchOperation_Canceled);
+ }
try (Git git = new Git(repository)) {
git.branchDelete().setBranchNames(
branch.getName()).setForce(force).call();
@@ -144,7 +146,7 @@
};
// lock workspace to protect working tree changes
ResourcesPlugin.getWorkspace().run(action, getSchedulingRule(),
- IWorkspace.AVOID_UPDATE, monitor);
+ IWorkspace.AVOID_UPDATE, subMonitor);
}
@Override
diff --git a/org.eclipse.egit.doc/META-INF/MANIFEST.MF b/org.eclipse.egit.doc/META-INF/MANIFEST.MF
index 9707dfb..33be343 100644
--- a/org.eclipse.egit.doc/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.doc/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.egit.doc;singleton:=true
-Bundle-Version: 4.4.1.qualifier
+Bundle-Version: 4.5.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/org.eclipse.egit.doc/pom.xml b/org.eclipse.egit.doc/pom.xml
index 1c3f8ce..967c3ca 100644
--- a/org.eclipse.egit.doc/pom.xml
+++ b/org.eclipse.egit.doc/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.egit.doc</artifactId>
diff --git a/org.eclipse.egit.gitflow-feature/feature.xml b/org.eclipse.egit.gitflow-feature/feature.xml
index 7976291..8111bd8 100644
--- a/org.eclipse.egit.gitflow-feature/feature.xml
+++ b/org.eclipse.egit.gitflow-feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.egit.gitflow.feature"
label="%featureName"
- version="4.4.1.qualifier"
+ version="4.5.0.qualifier"
provider-name="%providerName"
plugin="org.eclipse.egit.gitflow"
license-feature="org.eclipse.license"
@@ -26,9 +26,9 @@
</url>
<requires>
- <import feature="org.eclipse.jgit" version="4.4.1" match="equivalent"/>
- <import plugin="org.eclipse.egit.core" version="4.4.1" match="equivalent"/>
- <import plugin="org.eclipse.egit.ui" version="4.4.1" match="equivalent"/>
+ <import feature="org.eclipse.jgit" version="4.5.0" match="equivalent"/>
+ <import plugin="org.eclipse.egit.core" version="4.5.0" match="equivalent"/>
+ <import plugin="org.eclipse.egit.ui" version="4.5.0" match="equivalent"/>
</requires>
<plugin
diff --git a/org.eclipse.egit.gitflow-feature/pom.xml b/org.eclipse.egit.gitflow-feature/pom.xml
index 6ab26fe..398e8fa 100644
--- a/org.eclipse.egit.gitflow-feature/pom.xml
+++ b/org.eclipse.egit.gitflow-feature/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.egit.feature</groupId>
diff --git a/org.eclipse.egit.gitflow.test/META-INF/MANIFEST.MF b/org.eclipse.egit.gitflow.test/META-INF/MANIFEST.MF
index 37c63e4..5a72d31 100644
--- a/org.eclipse.egit.gitflow.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.gitflow.test/META-INF/MANIFEST.MF
@@ -2,10 +2,10 @@
Bundle-ManifestVersion: 2
Bundle-Name: GitFlow Test
Bundle-SymbolicName: org.eclipse.egit.gitflow.test;singleton:=true
-Bundle-Version: 4.4.1.qualifier
+Bundle-Version: 4.5.0.qualifier
Fragment-Host: org.eclipse.egit.gitflow
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Import-Package: org.eclipse.egit.core;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.test;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.junit;version="[4.4.1,4.5.0)",
+Import-Package: org.eclipse.egit.core;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.test;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.junit;version="[4.5.0,4.6.0)",
org.junit;version="[4.3.0,5.0.0)"
diff --git a/org.eclipse.egit.gitflow.test/pom.xml b/org.eclipse.egit.gitflow.test/pom.xml
index 4119e8d..06237d4 100644
--- a/org.eclipse.egit.gitflow.test/pom.xml
+++ b/org.eclipse.egit.gitflow.test/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.egit.gitflow.test</artifactId>
diff --git a/org.eclipse.egit.gitflow.ui/META-INF/MANIFEST.MF b/org.eclipse.egit.gitflow.ui/META-INF/MANIFEST.MF
index a21d9c8..e47ed7c 100644
--- a/org.eclipse.egit.gitflow.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.gitflow.ui/META-INF/MANIFEST.MF
@@ -2,35 +2,35 @@
Bundle-ManifestVersion: 2
Bundle-Name: %plugin_name
Bundle-SymbolicName: org.eclipse.egit.gitflow.ui;singleton:=true
-Bundle-Version: 4.4.1.qualifier
+Bundle-Version: 4.5.0.qualifier
Bundle-Activator: org.eclipse.egit.gitflow.ui.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %provider_name
Bundle-Localization: plugin
-Import-Package: org.eclipse.egit.core;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.internal;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.internal.job;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.op;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.project;version="[4.4.1,4.5.0)",
- org.eclipse.egit.gitflow;version="[4.4.1,4.5.0)",
- org.eclipse.egit.gitflow.op;version="[4.4.1,4.5.0)",
- org.eclipse.egit.ui;version="[4.4.1,4.5.0)",
- org.eclipse.egit.ui.internal;version="[4.4.1,4.5.0)",
- org.eclipse.egit.ui.internal.branch;version="[4.4.1,4.5.0)",
- org.eclipse.egit.ui.internal.commit;version="[4.4.1,4.5.0)",
- org.eclipse.egit.ui.internal.history;version="[4.4.1,4.5.0)",
- org.eclipse.egit.ui.internal.operations;version="[4.4.1,4.5.0)",
- org.eclipse.egit.ui.internal.rebase;version="[4.4.1,4.5.0)",
- org.eclipse.egit.ui.internal.repository.tree;version="[4.4.1,4.5.0)",
- org.eclipse.egit.ui.internal.selection;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.api;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.api.errors;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.lib;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.merge;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.revplot;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.revwalk;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.util;version="[4.4.1,4.5.0)"
+Import-Package: org.eclipse.egit.core;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.internal;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.internal.job;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.op;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.project;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.gitflow;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.gitflow.op;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.ui;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.ui.internal;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.ui.internal.branch;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.ui.internal.commit;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.ui.internal.history;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.ui.internal.operations;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.ui.internal.rebase;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.ui.internal.repository.tree;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.ui.internal.selection;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.api;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.api.errors;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.lib;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.merge;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.revplot;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.revwalk;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.util;version="[4.5.0,4.6.0)"
Require-Bundle: org.eclipse.core.jobs;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
@@ -44,12 +44,12 @@
org.eclipse.core.databinding.beans;bundle-version="[1.2.0,2.0.0)",
org.eclipse.core.databinding;bundle-version="[1.4.0,2.0.0)",
org.eclipse.jface.text;bundle-version="[3.4.0,4.0.0)"
-Export-Package: org.eclipse.egit.gitflow.ui;version="4.4.1";x-friends:="org.eclipse.egit.ui.test",
- org.eclipse.egit.gitflow.ui.internal;version="4.4.1";x-friends:="org.eclipse.egit.ui.test",
- org.eclipse.egit.gitflow.ui.internal.actions;version="4.4.1";x-friends:="org.eclipse.egit.ui.test",
- org.eclipse.egit.gitflow.ui.internal.decorators;version="4.4.1";x-internal:=true,
- org.eclipse.egit.gitflow.ui.internal.dialogs;version="4.4.1";x-internal:=true,
- org.eclipse.egit.gitflow.ui.internal.factories;version="4.4.1";x-internal:=true,
- org.eclipse.egit.gitflow.ui.internal.menu;version="4.4.1";x-internal:=true,
- org.eclipse.egit.gitflow.ui.internal.properties;version="4.4.1";x-internal:=true,
- org.eclipse.egit.gitflow.ui.internal.validation;version="4.4.1";x-internal:=true
+Export-Package: org.eclipse.egit.gitflow.ui;version="4.5.0";x-friends:="org.eclipse.egit.ui.test",
+ org.eclipse.egit.gitflow.ui.internal;version="4.5.0";x-friends:="org.eclipse.egit.ui.test",
+ org.eclipse.egit.gitflow.ui.internal.actions;version="4.5.0";x-friends:="org.eclipse.egit.ui.test",
+ org.eclipse.egit.gitflow.ui.internal.decorators;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.gitflow.ui.internal.dialogs;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.gitflow.ui.internal.factories;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.gitflow.ui.internal.menu;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.gitflow.ui.internal.properties;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.gitflow.ui.internal.validation;version="4.5.0";x-internal:=true
diff --git a/org.eclipse.egit.gitflow.ui/pom.xml b/org.eclipse.egit.gitflow.ui/pom.xml
index bd33046..6033b9a 100644
--- a/org.eclipse.egit.gitflow.ui/pom.xml
+++ b/org.eclipse.egit.gitflow.ui/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.egit.gitflow.ui</artifactId>
diff --git a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/GitFlowHandlerUtil.java b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/GitFlowHandlerUtil.java
index fbea957..893990a 100644
--- a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/GitFlowHandlerUtil.java
+++ b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/GitFlowHandlerUtil.java
@@ -72,7 +72,8 @@
.exactRef(gfRepo.getConfig().getDevelopFull());
if (develop == null) {
throw new IllegalStateException(
- "Gitflow command called on non-Gitflow repository"); //$NON-NLS-1$
+ "Gitflow command called on Gitflow repository with no develop branch. " //$NON-NLS-1$
+ + "The Gitflow configuration is either corrupt or incomplete."); //$NON-NLS-1$
}
return develop.getName();
}
diff --git a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java
new file mode 100644
index 0000000..264b5f0
--- /dev/null
+++ b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/BranchComparator.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (C) 2016, Max Hohenegger <eclipse@hohenegger.eu>
+ *
+ * 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.gitflow.ui.internal.dialogs;
+
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.TreeColumn;
+
+/**
+ * Comparator for {@link FilteredBranchesWidget}.
+ *
+ */
+public class BranchComparator extends ViewerComparator {
+ private TreeColumn currentColumn;
+
+ private static final int DESCENDING = SWT.DOWN;
+
+ private static final int ASCENDING = SWT.UP;
+
+ private int direction = DESCENDING;
+
+ private ColumnLabelProvider labelProvider;
+
+ /**
+ * Direction indicator to be supplied to
+ * {@link org.eclipse.swt.widgets.Tree#setSortDirection(int)}
+ *
+ * @return one of <code>UP</code>, <code>DOWN</code> or <code>NONE</code>.
+ */
+ public int getDirection() {
+ return direction;
+ }
+
+ /**
+ * Set the column to sort by, flipping sort direction, if the same column
+ * was set before.
+ *
+ * @param column
+ * to sort by
+ * @param labelProvider
+ * to convert cells from selected column into text
+ */
+ public void setColumn(TreeColumn column, ColumnLabelProvider labelProvider) {
+ this.labelProvider = labelProvider;
+ if (column.equals(currentColumn)) {
+ flipSortDirection();
+ } else {
+ currentColumn = column;
+ direction = DESCENDING;
+ }
+ }
+
+ private void flipSortDirection() {
+ direction = (direction == DESCENDING) ? ASCENDING : DESCENDING;
+ }
+
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ int rc = 0;
+
+ String firstCell = labelProvider.getText(e1).toLowerCase();
+ String secondCell = labelProvider.getText(e2).toLowerCase();
+ if (direction == DESCENDING) {
+ rc = secondCell.compareTo(firstCell);
+ } else {
+ rc = firstCell.compareTo(secondCell);
+ }
+
+ return rc;
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/FilteredBranchesWidget.java b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/FilteredBranchesWidget.java
index 7ef1ed2..a72cfd7 100644
--- a/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/FilteredBranchesWidget.java
+++ b/org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/FilteredBranchesWidget.java
@@ -8,25 +8,26 @@
*******************************************************************************/
package org.eclipse.egit.gitflow.ui.internal.dialogs;
-import static org.eclipse.egit.ui.internal.CommonUtils.STRING_ASCENDING_COMPARATOR;
-
import java.util.List;
import org.eclipse.egit.gitflow.GitFlowRepository;
import org.eclipse.egit.gitflow.ui.internal.UIText;
import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.TreeColumnLayout;
import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -46,6 +47,8 @@
private GitFlowRepository gfRepo;
+ private BranchComparator comparator;
+
FilteredBranchesWidget(List<Ref> refs, String prefix, GitFlowRepository gfRepo) {
this.refs = refs;
this.prefix = prefix;
@@ -82,9 +85,15 @@
branchesViewer.getTree().setLinesVisible(false);
branchesViewer.getTree().setHeaderVisible(true);
+ comparator = new BranchComparator();
+ branchesViewer.setComparator(comparator);
+
+ DecoratedBranchLabelProvider nameLabelProvider = new DecoratedBranchLabelProvider(gfRepo.getRepository(), prefix);
TreeColumn nameColumn = createColumn(
UIText.BranchSelectionTree_NameColumn, branchesViewer,
- new DecoratedBranchLabelProvider(gfRepo.getRepository(), prefix));
+ nameLabelProvider);
+ setSortedColumn(nameColumn, nameLabelProvider);
+
TreeColumn idColumn = createColumn(UIText.BranchSelectionTree_IdColumn, branchesViewer, new ColumnLabelProvider() {
@Override
@@ -116,27 +125,45 @@
GridDataFactory.fillDefaults().grab(true, true).applyTo(branchesViewer.getControl());
branchesViewer.setContentProvider(new BranchListContentProvider());
- branchesViewer.setComparator(new ViewerComparator(STRING_ASCENDING_COMPARATOR));
branchesViewer.setInput(refs);
+ // Layout tree for maximum width of message column
+ TreeColumnLayout layout = new TreeColumnLayout();
nameColumn.pack();
+ layout.setColumnData(nameColumn, new ColumnWeightData(0, nameColumn.getWidth()));
idColumn.pack();
- msgColumn.pack();
+ layout.setColumnData(idColumn, new ColumnWeightData(0, idColumn.getWidth()));
+ layout.setColumnData(msgColumn, new ColumnWeightData(100));
+ branchesViewer.getTree().getParent().setLayout(layout);
branchesViewer.addFilter(createFilter());
return area;
}
- private TreeColumn createColumn(String name, TreeViewer treeViewer, ColumnLabelProvider labelProvider) {
- TreeColumn column = new TreeColumn(treeViewer.getTree(), SWT.LEFT);
+ private TreeColumn createColumn(final String name, TreeViewer treeViewer, final ColumnLabelProvider labelProvider) {
+ final TreeColumn column = new TreeColumn(treeViewer.getTree(), SWT.LEFT);
column.setAlignment(SWT.LEFT);
column.setText(name);
+ column.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setSortedColumn(column, labelProvider);
+ }
+ });
TreeViewerColumn treeViewerNameColumn = new TreeViewerColumn(treeViewer, column);
treeViewerNameColumn.setLabelProvider(labelProvider);
return column;
}
+ private void setSortedColumn(final TreeColumn column, ColumnLabelProvider labelProvider) {
+ comparator.setColumn(column, labelProvider);
+ int dir = comparator.getDirection();
+ branchesViewer.getTree().setSortDirection(dir);
+ branchesViewer.getTree().setSortColumn(column);
+ branchesViewer.refresh();
+ }
+
private ViewerFilter createFilter() {
return new ViewerFilter() {
@Override
diff --git a/org.eclipse.egit.gitflow/META-INF/MANIFEST.MF b/org.eclipse.egit.gitflow/META-INF/MANIFEST.MF
index 8e1f42a..1c4780f 100644
--- a/org.eclipse.egit.gitflow/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.gitflow/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %plugin_name
Bundle-SymbolicName: org.eclipse.egit.gitflow;singleton:=true
-Bundle-Version: 4.4.1.qualifier
+Bundle-Version: 4.5.0.qualifier
Bundle-Vendor: %provider_name
Bundle-Activator: org.eclipse.egit.gitflow.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
@@ -11,14 +11,14 @@
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.jdt.annotation;bundle-version="[1.1.0,2.0.0)";resolution:=optional
-Export-Package: org.eclipse.egit.gitflow;version="4.4.1";
+Export-Package: org.eclipse.egit.gitflow;version="4.5.0";
uses:="org.osgi.framework,
org.eclipse.jgit.transport,
org.eclipse.core.runtime,
org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk",
org.eclipse.egit.gitflow.internal;x-internal:=true,
- org.eclipse.egit.gitflow.op;version="4.4.1";
+ org.eclipse.egit.gitflow.op;version="4.5.0";
uses:="org.eclipse.jgit.transport,
org.eclipse.core.runtime.jobs,
org.eclipse.core.runtime,
@@ -27,13 +27,13 @@
org.eclipse.jgit.revwalk,
org.eclipse.jgit.lib,
org.eclipse.egit.core.op"
-Import-Package: org.eclipse.egit.core;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.internal.job;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.op;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.api;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.api.errors;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.errors;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.lib;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.revwalk;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.revwalk.filter;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.transport;version="[4.4.1,4.5.0)"
+Import-Package: org.eclipse.egit.core;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.internal.job;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.op;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.api;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.api.errors;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.errors;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.lib;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.revwalk;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.revwalk.filter;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.transport;version="[4.5.0,4.6.0)"
diff --git a/org.eclipse.egit.gitflow/pom.xml b/org.eclipse.egit.gitflow/pom.xml
index d472192..a4927dc 100644
--- a/org.eclipse.egit.gitflow/pom.xml
+++ b/org.eclipse.egit.gitflow/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.egit.gitflow</artifactId>
diff --git a/org.eclipse.egit.mylyn-feature/feature.xml b/org.eclipse.egit.mylyn-feature/feature.xml
index acc3568..1141697 100644
--- a/org.eclipse.egit.mylyn-feature/feature.xml
+++ b/org.eclipse.egit.mylyn-feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.egit.mylyn"
label="%featureName"
- version="4.4.1.qualifier"
+ version="4.5.0.qualifier"
provider-name="%providerName"
plugin="org.eclipse.egit"
license-feature="org.eclipse.license"
@@ -26,7 +26,7 @@
</url>
<requires>
- <import feature="org.eclipse.egit" version="4.4.1" match="greaterOrEqual"/>
+ <import feature="org.eclipse.egit" version="4.5.0" match="greaterOrEqual"/>
<import feature="org.eclipse.mylyn.team_feature" version="3.5.0" match="greaterOrEqual"/>
</requires>
diff --git a/org.eclipse.egit.mylyn-feature/pom.xml b/org.eclipse.egit.mylyn-feature/pom.xml
index 78c7c72..7701081 100644
--- a/org.eclipse.egit.mylyn-feature/pom.xml
+++ b/org.eclipse.egit.mylyn-feature/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.egit.feature</groupId>
diff --git a/org.eclipse.egit.mylyn.ui.test/META-INF/MANIFEST.MF b/org.eclipse.egit.mylyn.ui.test/META-INF/MANIFEST.MF
index a5800b1..52e1f2a 100644
--- a/org.eclipse.egit.mylyn.ui.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.mylyn.ui.test/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Git Team Provider Mylyn UI Test Fragment
Bundle-SymbolicName: org.eclipse.egit.mylyn.ui.test
-Bundle-Version: 4.4.1.qualifier
+Bundle-Version: 4.5.0.qualifier
Fragment-Host: org.eclipse.egit.mylyn.ui
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.apache.log4j;bundle-version="[1.0.0,2.0.0)",
diff --git a/org.eclipse.egit.mylyn.ui.test/pom.xml b/org.eclipse.egit.mylyn.ui.test/pom.xml
index 5011192..20b3c1c 100644
--- a/org.eclipse.egit.mylyn.ui.test/pom.xml
+++ b/org.eclipse.egit.mylyn.ui.test/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.egit.mylyn.ui.test</artifactId>
diff --git a/org.eclipse.egit.mylyn.ui/META-INF/MANIFEST.MF b/org.eclipse.egit.mylyn.ui/META-INF/MANIFEST.MF
index c1ec775..e804120 100644
--- a/org.eclipse.egit.mylyn.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.mylyn.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.egit.mylyn.ui;singleton:=true
-Bundle-Version: 4.4.1.qualifier
+Bundle-Version: 4.5.0.qualifier
Bundle-Activator: org.eclipse.egit.internal.mylyn.ui.EGitMylynUI
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.team.core,
@@ -24,15 +24,15 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
-Export-Package: org.eclipse.egit.internal.mylyn.ui;version="4.4.1";x-friends:="org.eclipse.egit.ui.test",
- org.eclipse.egit.internal.mylyn.ui.commit;version="4.4.1";x-internal:=true
-Import-Package: org.eclipse.egit.core;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.synchronize;version="[4.4.1,4.5.0)",
- org.eclipse.egit.ui;version="[4.4.1,4.5.0)",
- org.eclipse.egit.ui.internal.commit;version="[4.4.1,4.5.0)",
- org.eclipse.egit.ui.internal.synchronize.model;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.errors;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.lib;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.revwalk;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.transport;version="[4.4.1,4.5.0)",
+Export-Package: org.eclipse.egit.internal.mylyn.ui;version="4.5.0";x-friends:="org.eclipse.egit.ui.test",
+ org.eclipse.egit.internal.mylyn.ui.commit;version="4.5.0";x-internal:=true
+Import-Package: org.eclipse.egit.core;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.synchronize;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.ui;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.ui.internal.commit;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.ui.internal.synchronize.model;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.errors;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.lib;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.revwalk;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.transport;version="[4.5.0,4.6.0)",
org.eclipse.ui.plugin
diff --git a/org.eclipse.egit.mylyn.ui/pom.xml b/org.eclipse.egit.mylyn.ui/pom.xml
index 0a8e55c..7753577 100644
--- a/org.eclipse.egit.mylyn.ui/pom.xml
+++ b/org.eclipse.egit.mylyn.ui/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.egit.mylyn.ui</artifactId>
diff --git a/org.eclipse.egit.repository/category.xml b/org.eclipse.egit.repository/category.xml
index 9a784cc..8bbf32d 100644
--- a/org.eclipse.egit.repository/category.xml
+++ b/org.eclipse.egit.repository/category.xml
@@ -30,6 +30,9 @@
<feature url="features/org.eclipse.egit.gitflow.feature_0.0.0.qualifier.jar" id="org.eclipse.egit.gitflow.feature" version="0.0.0">
<category name="Eclipse Git Team Provider - experimental features (incubation)"/>
</feature>
+ <feature url="features/org.eclipse.jgit.lfs_4.5.0.qualifier.jar" id="org.eclipse.jgit.lfs" version="4.5.0.qualifier">
+ <category name="JGit"/>
+ </feature>
<bundle id="org.eclipse.egit.ui.smartimport" version="0.0.0">
<category name="Eclipse Git Team Provider - experimental features (incubation)"/>
</bundle>
diff --git a/org.eclipse.egit.repository/pom.xml b/org.eclipse.egit.repository/pom.xml
index dac61df..95ee98e 100644
--- a/org.eclipse.egit.repository/pom.xml
+++ b/org.eclipse.egit.repository/pom.xml
@@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.egit.repository</artifactId>
diff --git a/org.eclipse.egit.source-feature/feature.xml b/org.eclipse.egit.source-feature/feature.xml
index 3f5abe6..ddbda8a 100644
--- a/org.eclipse.egit.source-feature/feature.xml
+++ b/org.eclipse.egit.source-feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.egit.source"
label="%featureName"
- version="4.4.1.qualifier"
+ version="4.5.0.qualifier"
provider-name="%providerName"
plugin="org.eclipse.egit"
license-feature="org.eclipse.license"
diff --git a/org.eclipse.egit.source-feature/pom.xml b/org.eclipse.egit.source-feature/pom.xml
index dce0a49..840a3fa 100644
--- a/org.eclipse.egit.source-feature/pom.xml
+++ b/org.eclipse.egit.source-feature/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.egit.feature</groupId>
diff --git a/org.eclipse.egit.target/META-INF/MANIFEST.MF b/org.eclipse.egit.target/META-INF/MANIFEST.MF
index eae7a06..26bb418 100644
--- a/org.eclipse.egit.target/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.target/META-INF/MANIFEST.MF
@@ -2,5 +2,5 @@
Bundle-ManifestVersion: 2
Bundle-Name: EGit Target Platform Bundle
Bundle-SymbolicName: org.eclipse.egit.target
-Bundle-Version: 4.4.1.qualifier
+Bundle-Version: 4.5.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
diff --git a/org.eclipse.egit.target/egit-4.6-staging.target b/org.eclipse.egit.target/egit-4.6-staging.target
index 620c3d8..d0f2217 100644
--- a/org.eclipse.egit.target/egit-4.6-staging.target
+++ b/org.eclipse.egit.target/egit-4.6-staging.target
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
-<target name="egit-4.6-staging" sequenceNumber="1464179861">
+<target name="egit-4.6-staging" sequenceNumber="1465553347">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.2.13.v20150730"/>
diff --git a/org.eclipse.egit.target/egit-4.6.target b/org.eclipse.egit.target/egit-4.6.target
index fef8a64..618fa7b 100644
--- a/org.eclipse.egit.target/egit-4.6.target
+++ b/org.eclipse.egit.target/egit-4.6.target
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
-<target name="egit-4.6" sequenceNumber="1464179840">
+<target name="egit-4.6" sequenceNumber="1465553336">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.2.13.v20150730"/>
diff --git a/org.eclipse.egit.target/pom.xml b/org.eclipse.egit.target/pom.xml
index d66d419..a1111be 100644
--- a/org.eclipse.egit.target/pom.xml
+++ b/org.eclipse.egit.target/pom.xml
@@ -18,7 +18,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<build>
diff --git a/org.eclipse.egit.ui.importer.tests/META-INF/MANIFEST.MF b/org.eclipse.egit.ui.importer.tests/META-INF/MANIFEST.MF
index 6e342b6..adde32b 100644
--- a/org.eclipse.egit.ui.importer.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.ui.importer.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %plugin_name
Bundle-SymbolicName: org.eclipse.egit.ui.importer.tests
-Bundle-Version: 4.4.1.qualifier
+Bundle-Version: 4.5.0.qualifier
Bundle-Vendor: %provider_name
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-Localization: plugin
diff --git a/org.eclipse.egit.ui.importer.tests/pom.xml b/org.eclipse.egit.ui.importer.tests/pom.xml
index 9d03201..8404f4c 100644
--- a/org.eclipse.egit.ui.importer.tests/pom.xml
+++ b/org.eclipse.egit.ui.importer.tests/pom.xml
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.egit</groupId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
<artifactId>egit-parent</artifactId>
</parent>
<artifactId>org.eclipse.egit.ui.importer.tests</artifactId>
diff --git a/org.eclipse.egit.ui.smartimport/META-INF/MANIFEST.MF b/org.eclipse.egit.ui.smartimport/META-INF/MANIFEST.MF
index 8871d8b..7339ce4 100644
--- a/org.eclipse.egit.ui.smartimport/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.ui.smartimport/META-INF/MANIFEST.MF
@@ -2,15 +2,15 @@
Bundle-ManifestVersion: 2
Bundle-Name: %fragment_name
Bundle-SymbolicName: org.eclipse.egit.ui.smartimport;singleton:=true
-Fragment-Host: org.eclipse.egit.ui;bundle-version="[4.4.0,4.5.0)"
-Bundle-Version: 4.4.1.qualifier
+Fragment-Host: org.eclipse.egit.ui;bundle-version="[4.5.0,4.6.0)"
+Bundle-Version: 4.5.0.qualifier
Bundle-Vendor: %provider_name
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ui.ide;bundle-version="3.12.0",
- org.eclipse.jgit;bundle-version="[4.4.1,4.5.0)"
+ org.eclipse.jgit;bundle-version="[4.5.0,4.6.0)"
Bundle-Localization: fragment
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.egit.ui.internal.clone;version="4.4.1";x-internal:=true;
+Export-Package: org.eclipse.egit.ui.internal.clone;version="4.5.0";x-internal:=true;
uses:="org.eclipse.ui,org.eclipse.jface.wizard,org.eclipse.jface.viewers"
diff --git a/org.eclipse.egit.ui.smartimport/pom.xml b/org.eclipse.egit.ui.smartimport/pom.xml
index 1117f88..b27c994 100644
--- a/org.eclipse.egit.ui.smartimport/pom.xml
+++ b/org.eclipse.egit.ui.smartimport/pom.xml
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.egit</groupId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
<artifactId>egit-parent</artifactId>
</parent>
<artifactId>org.eclipse.egit.ui.smartimport</artifactId>
diff --git a/org.eclipse.egit.ui.test/META-INF/MANIFEST.MF b/org.eclipse.egit.ui.test/META-INF/MANIFEST.MF
index bf57fb0..82bb3f4 100644
--- a/org.eclipse.egit.ui.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.ui.test/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@
Bundle-Vendor: Eclipse.org
Bundle-SymbolicName: org.eclipse.egit.ui.test;singleton:=true
Fragment-Host: org.eclipse.egit.ui
-Bundle-Version: 4.4.1.qualifier
+Bundle-Version: 4.5.0.qualifier
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.apache.log4j;bundle-version="[1.0.0,2.0.0)",
@@ -18,22 +18,22 @@
org.objenesis;bundle-version="[1.0.0,2.0.0)",
org.eclipse.jdt.launching;bundle-version="[3.8.0,4.0.0)"
Import-Package: org.eclipse.core.net.proxy;bundle-version="[1.1.0,2.0.0)",
- org.eclipse.egit.core.test;version="[4.4.1,4.5.0)",
- org.eclipse.egit.gitflow;version="[4.4.1,4.5.0)",
- org.eclipse.egit.gitflow.op;version="[4.4.1,4.5.0)",
- org.eclipse.egit.gitflow.ui;version="[4.4.1,4.5.0)",
- org.eclipse.egit.gitflow.ui.internal;version="[4.4.1,4.5.0)",
- org.eclipse.egit.gitflow.ui.internal.actions;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.api;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.api.errors;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.junit;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.junit.http;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.lib;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.revwalk;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.storage.file;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.transport;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.transport.resolver;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.util;version="[4.4.1,4.5.0)",
+ org.eclipse.egit.core.test;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.gitflow;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.gitflow.op;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.gitflow.ui;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.gitflow.ui.internal;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.gitflow.ui.internal.actions;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.api;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.api.errors;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.junit;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.junit.http;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.lib;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.revwalk;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.storage.file;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.transport;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.transport.resolver;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.util;version="[4.5.0,4.6.0)",
org.eclipse.swt.widgets,
org.eclipse.swtbot.eclipse.finder,
org.eclipse.swtbot.eclipse.finder.exceptions,
diff --git a/org.eclipse.egit.ui.test/pom.xml b/org.eclipse.egit.ui.test/pom.xml
index 466eb85..3e10685 100644
--- a/org.eclipse.egit.ui.test/pom.xml
+++ b/org.eclipse.egit.ui.test/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.egit.ui.test</artifactId>
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java
index 45fcfd0..0bee09f 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java
@@ -8,7 +8,9 @@
*******************************************************************************/
package org.eclipse.egit.ui.internal.submodules;
+import static org.eclipse.egit.ui.JobFamilies.ADD_TO_INDEX;
import static org.eclipse.egit.ui.JobFamilies.GENERATE_HISTORY;
+import static org.eclipse.egit.ui.JobFamilies.REMOVE_FROM_INDEX;
import static org.eclipse.swtbot.eclipse.finder.waits.Conditions.waitForEditor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -203,10 +205,10 @@
node.select();
ContextMenuHelper.clickContextMenuSync(projectExplorerTree, "Team",
util.getPluginLocalizedValue("AddToIndexAction_label"));
+ TestUtil.joinJobs(ADD_TO_INDEX);
TestUtil.joinJobs(JobFamilies.INDEX_DIFF_CACHE_UPDATE);
IndexDiffCacheEntry cache = Activator.getDefault().getIndexDiffCache()
.getIndexDiffCacheEntry(subRepository);
- TestUtil.joinJobs(JobFamilies.INDEX_DIFF_CACHE_UPDATE);
IResourceState state = ResourceStateFactory.getInstance()
.get(cache.getIndexDiff(), file);
assertTrue("File should be staged", state.isStaged());
@@ -214,6 +216,7 @@
assertFalse(node.getText().startsWith("> "));
ContextMenuHelper.clickContextMenuSync(projectExplorerTree, "Team",
util.getPluginLocalizedValue("RemoveFromIndexAction_label"));
+ TestUtil.joinJobs(REMOVE_FROM_INDEX);
TestUtil.joinJobs(JobFamilies.INDEX_DIFF_CACHE_UPDATE);
state = ResourceStateFactory.getInstance().get(cache.getIndexDiff(),
file);
@@ -273,6 +276,8 @@
.getPluginLocalizedValue("DisconnectAction_label");
ContextMenuHelper.clickContextMenuSync(projectExplorerTree, "Team",
menuString);
+ TestUtil.waitForJobs(500, 5000);
+ TestUtil.joinJobs(JobFamilies.INDEX_DIFF_CACHE_UPDATE);
ResourcesPlugin.getWorkspace().getRoot()
.refreshLocal(IResource.DEPTH_INFINITE, null);
// Access the session property directly: RepositoryMapping.getMapping()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java
index 41fee09..2581e45 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java
@@ -20,6 +20,7 @@
import org.eclipse.egit.ui.common.EGitTestCase;
import org.eclipse.egit.ui.internal.UIText;
+import org.eclipse.egit.ui.internal.preferences.GlobalConfigurationPreferencePage;
import org.eclipse.egit.ui.test.Eclipse;
import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -29,9 +30,12 @@
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PreferencesUtil;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -50,8 +54,6 @@
private static final SWTWorkbenchBot bot = new SWTWorkbenchBot();
- private static final TestUtil util = new TestUtil();
-
private static FileBasedConfig config;
private SWTBotShell preferencePage;
@@ -68,23 +70,34 @@
config.unsetSection(TESTSECTION, TESTSUBSECTION);
config.unsetSection(TESTSECTION, null);
config.save();
- getGitConfigurationPreferencePage();
}
private void getGitConfigurationPreferencePage() {
- preferencePage = new Eclipse().openPreferencePage(preferencePage);
- SWTBotTreeItem team = preferencePage.bot().tree().getTreeItem("Team");
- team = TestUtil.expandAndWaitFor(team,
- util.getPluginLocalizedValue("GitPreferences_name"));
- team = TestUtil.expandAndWaitFor(team,
- util.getPluginLocalizedValue("ConfigurationPage.name"));
- team.select();
+ if (preferencePage != null) {
+ preferencePage.close();
+ bot.waitUntil(Conditions.shellCloses(preferencePage));
+ }
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ PreferencesUtil.createPreferenceDialogOn(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell(),
+ GlobalConfigurationPreferencePage.ID, null, null)
+ .open();
+ }
+ });
+ bot.waitUntil(Conditions.shellIsActive("Preferences"));
+ preferencePage = bot.shell("Preferences");
}
@After
public void after() throws Exception {
if (preferencePage != null) {
preferencePage.close();
+ bot.waitUntil(Conditions.shellCloses(preferencePage));
+ preferencePage = null;
}
TestUtil.processUIEvents();
}
@@ -100,6 +113,7 @@
@Test
public void testNodes() throws Exception {
+ getGitConfigurationPreferencePage();
SWTBotTree configTree = preferencePage.bot().tree(1);
for (String section : config.getSections()) {
SWTBotTreeItem sectionItem = configTree.getTreeItem(section);
@@ -124,6 +138,7 @@
@Test
public void testAddSectionEntry() throws Exception {
+ getGitConfigurationPreferencePage();
preferencePage.bot().button(
UIText.ConfigurationEditorComponent_AddButton).click();
SWTBotShell addDialog = bot
@@ -149,6 +164,7 @@
@Test
public void testAddSubSectionEntry() throws Exception {
+ getGitConfigurationPreferencePage();
preferencePage.bot().button(
UIText.ConfigurationEditorComponent_AddButton).click();
SWTBotShell addDialog = bot
@@ -213,6 +229,7 @@
@Test
public void testChecksForKey() throws Exception {
+ getGitConfigurationPreferencePage();
preferencePage.bot().button(
UIText.ConfigurationEditorComponent_AddButton).click();
SWTBotShell addDialog = bot
@@ -245,6 +262,7 @@
@Test
public void testSubsectionWithDot() throws Exception {
+ getGitConfigurationPreferencePage();
preferencePage.bot()
.button(UIText.ConfigurationEditorComponent_AddButton).click();
SWTBotShell addDialog = bot
@@ -345,6 +363,7 @@
@Test
public void testOpenEditor() throws Exception {
+ getGitConfigurationPreferencePage();
try {
preferencePage.bot().button(
UIText.ConfigurationEditorComponent_OpenEditorButton)
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/JobJoiner.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/JobJoiner.java
index 3d3fddd..b6af33a 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/JobJoiner.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/JobJoiner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (C) 2012, Robin Stocker <robin@nibor.org>
+ * Copyright (C) 2012, 2016 Robin Stocker <robin@nibor.org> and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -75,10 +75,13 @@
/**
* Join the job. If the job is either not yet scheduled within the timeout
* or not yet done, an {@link AssertionError} is thrown.
+ *
+ * @return the joined job, if any, or {@code null}
*/
- public void join() {
+ public Job join() {
try {
doJoin();
+ return scheduledJob;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("Thread was interrupted.", e);
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
index bec7c1c..a9e88e1 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
@@ -413,8 +413,7 @@
dialog.bot().button(UIText.RenameBranchDialog_RenameButtonLabel)
.click();
// rename stable to renamed
- SWTBotShell newNameDialog = bot
- .shell(UIText.RenameBranchDialog_RenameBranchDialogNewNameInputWindowTitle);
+ SWTBotShell newNameDialog = bot.shell(UIText.BranchRenameDialog_Title);
newNameDialog.bot().text().setText("master");
assertFalse(newNameDialog.bot().button(IDialogConstants.OK_LABEL)
.isEnabled());
@@ -431,8 +430,7 @@
dialog.bot().button(UIText.RenameBranchDialog_RenameButtonLabel)
.click();
// rename renamed to stable
- newNameDialog = bot
- .shell(UIText.RenameBranchDialog_RenameBranchDialogNewNameInputWindowTitle);
+ newNameDialog = bot.shell(UIText.BranchRenameDialog_Title);
newNameDialog.bot().text().setText("stable");
newNameDialog.bot().button(IDialogConstants.OK_LABEL).click();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/DisconnectConnectTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/DisconnectConnectTest.java
index 5c69e84..6e092f4 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/DisconnectConnectTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/DisconnectConnectTest.java
@@ -27,6 +27,7 @@
import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
@@ -64,6 +65,7 @@
.select();
connectDialog.bot().tree().getAllItems()[0].select();
connectDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
+ bot.waitUntil(Conditions.shellCloses(connectDialog));
ResourcesPlugin.getWorkspace().getRoot().refreshLocal(
IResource.DEPTH_INFINITE, null);
TestUtil.waitForJobs(500, 5000);
@@ -93,6 +95,7 @@
.contains("["));
SWTBotShell connectDialog = openConnectDialog();
connectDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
+ bot.waitUntil(Conditions.shellCloses(connectDialog));
TestUtil.waitForJobs(500, 5000);
TestUtil.joinJobs(JobFamilies.INDEX_DIFF_CACHE_UPDATE);
TestUtil.waitForDecorations();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java
index de5c97c..990cd7a 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java
@@ -29,7 +29,6 @@
import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTestUtils;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
@@ -37,6 +36,7 @@
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
@@ -82,12 +82,11 @@
String oldContent = getTestFileContent();
fetch();
+ final String title = NLS.bind(UIText.FetchResultDialog_title,
+ childRepositoryFile.getParentFile().getName() + " - origin");
+ bot.waitUntil(Conditions.shellIsActive(title));
- String uri = lookupRepository(childRepositoryFile).getConfig()
- .getString(ConfigConstants.CONFIG_REMOTE_SECTION, "origin",
- ConfigConstants.CONFIG_KEY_URL);
- SWTBotShell confirm = bot.shell(NLS.bind(
- UIText.FetchResultDialog_title, uri));
+ SWTBotShell confirm = bot.shell(title);
SWTBotTree tree = confirm.bot().tree();
String branch = tree.getAllItems()[0].getText();
assertTrue("Wrong result",
@@ -99,7 +98,8 @@
assertEquals(oldContent, newContent);
fetch();
- confirm = bot.shell(NLS.bind(UIText.FetchResultDialog_title, uri));
+ bot.waitUntil(Conditions.shellIsActive(title));
+ confirm = bot.shell(title);
int count = confirm.bot().tree().rowCount();
confirm.close();
@@ -165,23 +165,14 @@
}
private void fetch() throws Exception {
- SWTBotShell fetchDialog = openFetchDialog();
- fetchDialog.bot().button(IDialogConstants.NEXT_LABEL).click();
- JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.FETCH, 20, TimeUnit.SECONDS);
- fetchDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
- jobJoiner.join();
- }
-
- private SWTBotShell openFetchDialog() throws Exception {
SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
getProjectItem(projectExplorerTree, PROJ1).select();
- String menuString = util.getPluginLocalizedValue("FetchAction_label");
- String submenuString = util
- .getPluginLocalizedValue("RemoteSubMenu.label");
+ String menuString = util
+ .getPluginLocalizedValue("FetchFromUpstreamAction.label");
+ JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.FETCH, 20, TimeUnit.SECONDS);
ContextMenuHelper.clickContextMenu(projectExplorerTree, "Team",
- submenuString, menuString);
- SWTBotShell dialog = bot.shell(UIText.FetchWizard_windowTitleDefault);
- return dialog;
+ menuString);
+ jobJoiner.join();
}
private SWTBotShell openMergeDialog() throws Exception {
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java
index e03dde5..79d6565 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java
@@ -10,25 +10,35 @@
*******************************************************************************/
package org.eclipse.egit.ui.test.team.actions;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.egit.ui.JobFamilies;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.test.ContextMenuHelper;
+import org.eclipse.egit.ui.test.JobJoiner;
import org.eclipse.egit.ui.test.TestUtil;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.ui.progress.IProgressConstants;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -61,6 +71,21 @@
pushTo("push", false);
}
+ private void openResultDialog(Job job) {
+ assertNotNull("Job should not be null", job);
+ final Action action = (Action) job
+ .getProperty(IProgressConstants.ACTION_PROPERTY);
+ if (action != null) {
+ UIThreadRunnable.asyncExec(new VoidResult() {
+
+ @Override
+ public void run() {
+ action.run();
+ }
+ });
+ }
+ }
+
private void pushTo(String destination, boolean withConfirmPage)
throws Exception, MissingObjectException,
IncorrectObjectTypeException, IOException {
@@ -78,11 +103,17 @@
}
pushDialog.bot().button(IDialogConstants.NEXT_LABEL).click();
- if (withConfirmPage)
+ if (withConfirmPage) {
pushDialog.bot().button(IDialogConstants.NEXT_LABEL).click();
+ }
+ JobJoiner joiner = JobJoiner.startListening(JobFamilies.PUSH, 20,
+ TimeUnit.SECONDS);
pushDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
- SWTBotShell confirm = bot.shell(
- NLS.bind(UIText.PushResultDialog_title, destination));
+ Job job = joiner.join();
+ openResultDialog(job);
+ String title = NLS.bind(UIText.PushResultDialog_title, destination);
+ bot.waitUntil(Conditions.shellIsActive(title));
+ SWTBotShell confirm = bot.shell(title);
String result = confirm.bot().tree().getAllItems()[0].getText();
assertTrue("Wrong result",
@@ -99,11 +130,16 @@
}
pushDialog.bot().button(IDialogConstants.NEXT_LABEL).click();
- if (withConfirmPage)
+ if (withConfirmPage) {
pushDialog.bot().button(IDialogConstants.NEXT_LABEL).click();
+ }
+ joiner = JobJoiner.startListening(JobFamilies.PUSH, 20,
+ TimeUnit.SECONDS);
pushDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
- confirm = bot.shell(
- NLS.bind(UIText.PushResultDialog_title, destination));
+ job = joiner.join();
+ openResultDialog(job);
+ bot.waitUntil(Conditions.shellIsActive(title));
+ confirm = bot.shell(title);
result = confirm.bot().tree().getAllItems()[0].getText();
confirm.close();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
index 7f44b2a..8a8372c 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
@@ -12,11 +12,13 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.util.concurrent.TimeUnit;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.egit.core.op.CloneOperation;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.JobFamilies;
@@ -25,15 +27,20 @@
import org.eclipse.egit.ui.test.ContextMenuHelper;
import org.eclipse.egit.ui.test.JobJoiner;
import org.eclipse.egit.ui.test.TestUtil;
+import org.eclipse.jface.action.Action;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.ui.progress.IProgressConstants;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -124,6 +131,7 @@
destinationString);
// first time: expect new branch
+ bot.waitUntil(Conditions.shellIsActive(dialogTitle));
SWTBotShell confirmed = bot.shell(dialogTitle);
SWTBotTreeItem[] treeItems = confirmed.bot().tree().getAllItems();
boolean newBranch = false;
@@ -140,6 +148,7 @@
runPush(tree);
+ bot.waitUntil(Conditions.shellIsActive(dialogTitle));
confirmed = bot.shell(dialogTitle);
treeItems = confirmed.bot().tree().getAllItems();
boolean uptodate = false;
@@ -163,6 +172,7 @@
runPush(updatedTree);
+ bot.waitUntil(Conditions.shellIsActive(dialogTitle));
confirmed = bot.shell(dialogTitle);
treeItems = confirmed.bot().tree().getAllItems();
newBranch = false;
@@ -229,6 +239,7 @@
selectNode(tree, useRemote, true);
runFetch(tree);
+ bot.waitUntil(Conditions.shellIsActive(dialogTitle));
SWTBotShell confirm = bot.shell(dialogTitle);
assertEquals("Wrong result tree row count", 0, confirm.bot().tree()
.rowCount());
@@ -256,6 +267,7 @@
selectNode(tree, useRemote, true);
runFetch(tree);
+ bot.waitUntil(Conditions.shellIsActive(dialogTitle));
confirm = bot.shell(dialogTitle);
SWTBotTreeItem[] treeItems = confirm.bot().tree().getAllItems();
boolean found = false;
@@ -289,17 +301,32 @@
}
}
+ private void openResultDialog(Job job) {
+ assertNotNull("Job should not be null", job);
+ final Action action = (Action) job
+ .getProperty(IProgressConstants.ACTION_PROPERTY);
+ if (action != null) {
+ UIThreadRunnable.asyncExec(new VoidResult() {
+
+ @Override
+ public void run() {
+ action.run();
+ }
+ });
+ }
+ }
+
private void runPush(SWTBotTree tree) {
JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.PUSH, 60, TimeUnit.SECONDS);
ContextMenuHelper.clickContextMenuSync(tree, myUtil
.getPluginLocalizedValue("SimplePushCommand"));
- jobJoiner.join();
+ openResultDialog(jobJoiner.join());
}
private void runFetch(SWTBotTree tree) {
JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.FETCH, 60, TimeUnit.SECONDS);
ContextMenuHelper.clickContextMenuSync(tree, myUtil
.getPluginLocalizedValue("SimpleFetchCommand"));
- jobJoiner.join();
+ openResultDialog(jobJoiner.join());
}
}
diff --git a/org.eclipse.egit.ui/META-INF/MANIFEST.MF b/org.eclipse.egit.ui/META-INF/MANIFEST.MF
index c151944..bcdabf1 100644
--- a/org.eclipse.egit.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %plugin_name
Bundle-SymbolicName: org.eclipse.egit.ui;singleton:=true
-Bundle-Version: 4.4.1.qualifier
+Bundle-Version: 4.5.0.qualifier
Bundle-Activator: org.eclipse.egit.ui.Activator
Bundle-Vendor: %provider_name
Bundle-Localization: plugin
@@ -31,90 +31,91 @@
org.eclipse.jdt.ui;bundle-version="[3.4.0,4.0.0)";resolution:=optional
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Import-Package: org.eclipse.egit.core;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.internal;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.internal.gerrit;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.internal.indexdiff;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.internal.job;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.internal.rebase;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.internal.storage;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.internal.util;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.op;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.project;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.securestorage;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.synchronize;version="[4.4.1,4.5.0)",
- org.eclipse.egit.core.synchronize.dto;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.annotations;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.api;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.api.errors;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.blame;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.diff;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.dircache;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.errors;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.events;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.fnmatch;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.internal.storage.file;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.lib;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.merge;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.notes;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.patch;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.revplot;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.revwalk;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.revwalk.filter;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.storage.file;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.submodule;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.transport;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.treewalk;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.treewalk.filter;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.util;version="[4.4.1,4.5.0)",
- org.eclipse.jgit.util.io;version="[4.4.1,4.5.0)"
-Export-Package: org.eclipse.egit.ui;version="4.4.1";x-friends:="org.eclipse.egit.mylyn.ui,org.eclipse.egit.gitflow.ui",
- org.eclipse.egit.ui.internal;version="4.4.1";x-friends:="org.eclipse.egit.import,org.eclipse.egit.gitflow.ui",
- org.eclipse.egit.ui.internal.actions;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.blame;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.branch;version="4.4.1";x-friends:="org.eclipse.egit.gitflow.ui",
- org.eclipse.egit.ui.internal.clean;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.clone;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.commands;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.commands.shared;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.commit;version="4.4.1";x-friends:="org.eclipse.egit.mylyn.ui,org.eclipse.egit.gitflow.ui",
- org.eclipse.egit.ui.internal.commit.command;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.components;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.credentials;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.decorators;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.dialogs;version="4.4.1";x-friends:="org.eclipse.egit.gitflow.ui",
- org.eclipse.egit.ui.internal.factories;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.fetch;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.gerrit;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.handler;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.history;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.history.command;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.importing;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.merge;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.operations;version="4.4.1";x-friends:="org.eclipse.egit.gitflow.ui",
- org.eclipse.egit.ui.internal.patch;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.preferences;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.provisional.wizards;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.pull;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.push;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.rebase;version="4.4.1";x-friends:="org.eclipse.egit.gitflow.ui",
- org.eclipse.egit.ui.internal.reflog;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.reflog.command;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.repository;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.repository.tree;version="4.4.1";x-friends:="org.eclipse.egit.gitflow.ui",
- org.eclipse.egit.ui.internal.repository.tree.command;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.resources;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.revision;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.search;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.selection;version="4.4.1";x-friends:="org.eclipse.egit.gitflow.ui",
- org.eclipse.egit.ui.internal.sharing;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.staging;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.stash;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.submodule;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.synchronize;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.synchronize.action;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.synchronize.compare;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.synchronize.mapping;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.synchronize.model;version="4.4.1";x-friends:="org.eclipse.egit.mylyn.ui",
- org.eclipse.egit.ui.internal.trace;version="4.4.1";x-internal:=true,
- org.eclipse.egit.ui.internal.variables;version="4.4.1";x-internal:=true
+Import-Package: org.eclipse.egit.core;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.internal;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.internal.gerrit;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.internal.indexdiff;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.internal.job;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.internal.rebase;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.internal.storage;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.internal.util;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.op;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.project;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.securestorage;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.synchronize;version="[4.5.0,4.6.0)",
+ org.eclipse.egit.core.synchronize.dto;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.annotations;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.api;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.api.errors;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.blame;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.diff;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.dircache;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.errors;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.events;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.fnmatch;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.internal.storage.file;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.lib;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.merge;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.notes;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.patch;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.revplot;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.revwalk;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.revwalk.filter;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.storage.file;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.submodule;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.transport;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.treewalk;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.treewalk.filter;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.util;version="[4.5.0,4.6.0)",
+ org.eclipse.jgit.util.io;version="[4.5.0,4.6.0)"
+Export-Package: org.eclipse.egit.ui;version="4.5.0";x-friends:="org.eclipse.egit.mylyn.ui,org.eclipse.egit.gitflow.ui",
+ org.eclipse.egit.ui.internal;version="4.5.0";x-friends:="org.eclipse.egit.import,org.eclipse.egit.gitflow.ui",
+ org.eclipse.egit.ui.internal.actions;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.blame;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.branch;version="4.5.0";x-friends:="org.eclipse.egit.gitflow.ui",
+ org.eclipse.egit.ui.internal.clean;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.clone;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.commands;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.commands.shared;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.commit;version="4.5.0";x-friends:="org.eclipse.egit.mylyn.ui,org.eclipse.egit.gitflow.ui",
+ org.eclipse.egit.ui.internal.commit.command;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.components;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.credentials;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.decorators;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.dialogs;version="4.5.0";x-friends:="org.eclipse.egit.gitflow.ui",
+ org.eclipse.egit.ui.internal.factories;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.fetch;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.gerrit;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.handler;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.history;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.history.command;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.importing;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.jobs;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.merge;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.operations;version="4.5.0";x-friends:="org.eclipse.egit.gitflow.ui",
+ org.eclipse.egit.ui.internal.patch;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.preferences;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.provisional.wizards;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.pull;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.push;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.rebase;version="4.5.0";x-friends:="org.eclipse.egit.gitflow.ui",
+ org.eclipse.egit.ui.internal.reflog;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.reflog.command;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.repository;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.repository.tree;version="4.5.0";x-friends:="org.eclipse.egit.gitflow.ui",
+ org.eclipse.egit.ui.internal.repository.tree.command;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.resources;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.revision;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.search;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.selection;version="4.5.0";x-friends:="org.eclipse.egit.gitflow.ui",
+ org.eclipse.egit.ui.internal.sharing;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.staging;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.stash;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.submodule;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.synchronize;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.synchronize.action;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.synchronize.compare;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.synchronize.mapping;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.synchronize.model;version="4.5.0";x-friends:="org.eclipse.egit.mylyn.ui",
+ org.eclipse.egit.ui.internal.trace;version="4.5.0";x-internal:=true,
+ org.eclipse.egit.ui.internal.variables;version="4.5.0";x-internal:=true
diff --git a/org.eclipse.egit.ui/plugin.properties b/org.eclipse.egit.ui/plugin.properties
index 3132639..609a0b1 100644
--- a/org.eclipse.egit.ui/plugin.properties
+++ b/org.eclipse.egit.ui/plugin.properties
@@ -142,7 +142,6 @@
CommitCommand = Commit
PastePathCommand = Paste Repository Path or URI
PushCommand = Push...
-RefreshCommand = Refresh
RemoveRepositoryCommand = Remove Repository
ImportProjectsCommand = Import Projects...
ImportProjectsCommand_description = Import or create in local Git repository
@@ -262,7 +261,6 @@
RepoAddRepositoryViewMenu.label = &Add a Repository
RepoCloneRepositoryViewMenu.label = &Clone a Repository
RepoCreateRepositoryViewMenu.label = &Create a Repository
-RepoViewRefreshViewMenu.label = &Refresh
RepoViewLinkWithSelectionMenu.label = Link with &Selection
RepoViewCreateRepositoryCommand.name = Create a Repository
CreateRepositoryWizard.name = Git Repository
diff --git a/org.eclipse.egit.ui/plugin.xml b/org.eclipse.egit.ui/plugin.xml
index 527ca63..ab9c127 100644
--- a/org.eclipse.egit.ui/plugin.xml
+++ b/org.eclipse.egit.ui/plugin.xml
@@ -377,11 +377,11 @@
</with>
</or>
</definition>
- <definition id="org.eclipse.egit.ui.fileOrFolderInRepositoryWithGerritConfiguration">
+ <definition id="org.eclipse.egit.ui.fileOrFolderPushToGerrit">
<or>
<test
property="GitSelection.fileOrFolderInRepository"
- args="hasGerritConfiguration">
+ args="canPushToGerrit">
</test>
<with variable="activePart">
<instanceof
@@ -395,7 +395,32 @@
property="GitResource.isShared">
</test>
<test
- property="GitResource.hasGerritConfiguration">
+ property="GitResource.canPushToGerrit">
+ </test>
+ </adapt>
+ </with>
+ </with>
+ </or>
+ </definition>
+ <definition id="org.eclipse.egit.ui.fileOrFolderFetchFromGerrit">
+ <or>
+ <test
+ property="GitSelection.fileOrFolderInRepository"
+ args="canFetchFromGerrit">
+ </test>
+ <with variable="activePart">
+ <instanceof
+ value="org.eclipse.ui.IEditorPart">
+ </instanceof>
+ <with
+ variable="activeEditorInput">
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="GitResource.isShared">
+ </test>
+ <test
+ property="GitResource.canFetchFromGerrit">
</test>
</adapt>
</with>
@@ -1706,6 +1731,20 @@
</activeWhen>
</handler>
<handler
+ commandId="org.eclipse.ui.file.refresh">
+ <class
+ class="org.eclipse.egit.ui.internal.repository.tree.command.RefreshCommand">
+ </class>
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.eclipse.egit.ui.RepositoriesView">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
commandId="org.eclipse.egit.ui.RepositoriesViewRemoveRemote">
<class
class="org.eclipse.egit.ui.internal.repository.tree.command.RemoveRemoteCommand">
@@ -1775,6 +1814,31 @@
</activeWhen>
</handler>
<handler
+ commandId="org.eclipse.egit.ui.team.RenameBranch"
+ class="org.eclipse.egit.ui.internal.actions.RenameBranchActionHandler">
+ <activeWhen>
+ <test property="GitSelection.projectsSingleRepository" />
+ </activeWhen>
+ </handler>
+ <handler
+ commandId="org.eclipse.ui.edit.rename"
+ class="org.eclipse.egit.ui.internal.history.command.RenameBranchOnCommitHandler">
+ <activeWhen>
+ <and>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.eclipse.team.ui.GenericHistoryView">
+ </equals>
+ </with>
+ <count value="1" />
+ <iterate>
+ <instanceof value="org.eclipse.egit.ui.internal.history.SWTCommit" />
+ </iterate>
+ </and>
+ </activeWhen>
+ </handler>
+ <handler
commandId="org.eclipse.egit.ui.team.submodule.update">
<class
class="org.eclipse.egit.ui.internal.repository.tree.command.SubmoduleUpdateCommand">
@@ -3821,7 +3885,9 @@
visible="true">
</separator>
<command
- commandId="org.eclipse.egit.ui.RepositoriesViewRefresh"
+ commandId="org.eclipse.ui.file.refresh"
+ icon="icons/obj16/refresh.gif"
+ disabledIcon="icons/obj16/refresh.gif"
style="push">
</command>
<command
@@ -3866,8 +3932,8 @@
visible="true">
</separator>
<command
- commandId="org.eclipse.egit.ui.RepositoriesViewRefresh"
- label="%RepoViewRefreshViewMenu.label"
+ commandId="org.eclipse.ui.file.refresh"
+ icon="icons/obj16/refresh.gif"
style="push">
</command>
<command
@@ -4102,7 +4168,7 @@
<visibleWhen
checkEnabled="false">
<reference
- definitionId="org.eclipse.egit.ui.fileOrFolderInRepositoryWithGerritConfiguration">
+ definitionId="org.eclipse.egit.ui.fileOrFolderPushToGerrit">
</reference>
</visibleWhen>
</command>
@@ -4113,7 +4179,7 @@
<visibleWhen
checkEnabled="false">
<reference
- definitionId="org.eclipse.egit.ui.fileOrFolderInRepositoryWithGerritConfiguration">
+ definitionId="org.eclipse.egit.ui.fileOrFolderFetchFromGerrit">
</reference>
</visibleWhen>
</command>
@@ -4809,24 +4875,12 @@
</command>
<command
categoryId="org.eclipse.egit.ui.commandCategory"
- defaultHandler="org.eclipse.egit.ui.internal.repository.tree.command.RenameBranchCommand"
- id="org.eclipse.egit.ui.RepositoriesViewRenameBranch"
- name="%RenameBranchCommand">
- </command>
- <command
- categoryId="org.eclipse.egit.ui.commandCategory"
defaultHandler="org.eclipse.egit.ui.internal.repository.tree.command.PasteCommand"
id="org.eclipse.egit.ui.RepositoriesViewPaste"
name="%PastePathCommand">
</command>
<command
categoryId="org.eclipse.egit.ui.commandCategory"
- defaultHandler="org.eclipse.egit.ui.internal.repository.tree.command.RefreshCommand"
- id="org.eclipse.egit.ui.RepositoriesViewRefresh"
- name="%RefreshCommand">
- </command>
- <command
- categoryId="org.eclipse.egit.ui.commandCategory"
defaultHandler="org.eclipse.egit.ui.internal.repository.tree.command.RemoveCommand"
id="org.eclipse.egit.ui.RepositoriesViewRemove"
name="%RemoveRepositoryCommand">
@@ -5025,10 +5079,6 @@
icon="icons/obj16/cloneGit.gif">
</image>
<image
- commandId="org.eclipse.egit.ui.RepositoriesViewRefresh"
- icon="icons/obj16/refresh.gif">
- </image>
- <image
commandId="org.eclipse.egit.ui.RepositoriesLinkWithSelection"
icon="icons/elcl16/synced.png">
</image>
@@ -5325,10 +5375,6 @@
icon="icons/obj16/stash-create.png">
</image>
<image
- commandId="org.eclipse.egit.ui.history.RenameBranch"
- icon="icons/obj16/editconfig.gif">
- </image>
- <image
commandId="org.eclipse.egit.ui.history.ShowBlame"
icon="icons/etool16/annotate.gif">
</image>
@@ -5632,9 +5678,8 @@
</command>
<command
categoryId="org.eclipse.egit.ui.commandCategory"
- defaultHandler="org.eclipse.egit.ui.internal.actions.RenameBranchActionHandler"
id="org.eclipse.egit.ui.team.RenameBranch"
- name="%RenameBranchCommand.name">
+ name="%RenameBranchCommand">
</command>
<command
categoryId="org.eclipse.egit.ui.commandCategory"
@@ -5740,11 +5785,6 @@
name="%DeleteBranchCommand">
</command>
<command
- defaultHandler="org.eclipse.egit.ui.internal.history.command.RenameBranchOnCommitHandler"
- id="org.eclipse.egit.ui.history.RenameBranch"
- name="%RenameBranchCommand">
- </command>
- <command
defaultHandler="org.eclipse.egit.ui.internal.history.command.CreateTagOnCommitHandler"
id="org.eclipse.egit.ui.history.CreateTag"
name="%CreateTagCommand.name">
diff --git a/org.eclipse.egit.ui/pom.xml b/org.eclipse.egit.ui/pom.xml
index 8738ad3..7d9937e 100644
--- a/org.eclipse.egit.ui/pom.xml
+++ b/org.eclipse.egit.ui/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.egit.ui</artifactId>
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/JobFamilies.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/JobFamilies.java
index 0053f5e..c45a462 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/JobFamilies.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/JobFamilies.java
@@ -8,174 +8,207 @@
*******************************************************************************/
package org.eclipse.egit.ui;
+import org.eclipse.egit.ui.internal.UIIcons;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.progress.IProgressService;
+
/**
* Job families of EGit jobs. May be used in tests to join job execution.
*
*/
public class JobFamilies {
+
+ /**
+ * Job family with icon for progress reporting
+ */
+ private static final class JobFamily {
+
+ /**
+ * job family with custom progress icon
+ *
+ * @param imageDescriptor
+ * icon for this job family
+ */
+ protected JobFamily(final ImageDescriptor imageDescriptor) {
+ IProgressService service = PlatformUI.getWorkbench()
+ .getProgressService();
+ service.registerIconForFamily(imageDescriptor, this);
+ }
+
+ /**
+ * job family with standard repository icon
+ */
+ protected JobFamily() {
+ this(UIIcons.REPOSITORY);
+ }
+ }
+
/**
* GenerateHistoryJob
*/
- public final static Object GENERATE_HISTORY = new Object();
+ public final static Object GENERATE_HISTORY = new JobFamily(
+ UIIcons.HISTORY);
/**
* History diff jobs
*/
- public final static Object HISTORY_DIFF = new Object();
+ public final static Object HISTORY_DIFF = new JobFamily();
/**
* Commit job
*/
- public final static Object COMMIT = new Object();
+ public final static Object COMMIT = new JobFamily(UIIcons.COMMIT);
/**
* Checkout job
*/
- public final static Object CHECKOUT = new Object();
+ public final static Object CHECKOUT = new JobFamily(UIIcons.CHECKOUT);
/**
* Push job
*/
- public final static Object PUSH = new Object();
+ public final static Object PUSH = new JobFamily(UIIcons.PUSH);
/**
* Fetch job
*/
- public final static Object FETCH = new Object();
+ public final static Object FETCH = new JobFamily(UIIcons.FETCH);
/**
* Repositories View refresh
*/
- public final static Object REPO_VIEW_REFRESH = new Object();
+ public final static Object REPO_VIEW_REFRESH = new JobFamily();
/**
* Delete repository job
*/
- public final static Object REPOSITORY_DELETE = new Object();
+ public final static Object REPOSITORY_DELETE = new JobFamily(
+ UIIcons.ELCL16_DELETE);
/**
* Tag job
*/
- public final static Object TAG = new Object();
+ public final static Object TAG = new JobFamily(UIIcons.TAG);
/**
* Reset job
*/
- public static final Object RESET = new Object();
+ public static final Object RESET = new JobFamily(UIIcons.RESET);
/**
* Rebase job
*/
- public static final Object REBASE = new Object();
+ public static final Object REBASE = new JobFamily(UIIcons.REBASE);
/**
* Pull job
*/
- public final static Object PULL = new Object();
+ public final static Object PULL = new JobFamily(UIIcons.PULL);
/**
* Format job
*/
- public final static Object FORMAT_COMMIT_INFO = new Object();
+ public final static Object FORMAT_COMMIT_INFO = new JobFamily();
/**
* Fill tag list
*/
- public final static Object FILL_TAG_LIST = new Object();
+ public final static Object FILL_TAG_LIST = new JobFamily(UIIcons.TAGS);
/**
* AssumeUnchanged/NoAssumeUnchanged
*/
- public final static Object ASSUME_NOASSUME_UNCHANGED = new Object();
+ public final static Object ASSUME_NOASSUME_UNCHANGED = new JobFamily();
/**
* Untrack
*/
- public final static Object UNTRACK = new Object();
+ public final static Object UNTRACK = new JobFamily();
/**
* Disconnect
*/
- public final static Object DISCONNECT = new Object();
+ public final static Object DISCONNECT = new JobFamily();
/**
* Discard Changes
*/
- public final static Object DISCARD_CHANGES = new Object();
+ public final static Object DISCARD_CHANGES = new JobFamily();
/**
* Add to index job
*/
- public static final Object ADD_TO_INDEX = new Object();
+ public static final Object ADD_TO_INDEX = new JobFamily(UIIcons.ELCL16_ADD);
/**
* Remove from index job
*/
- public static final Object REMOVE_FROM_INDEX = new Object();
+ public static final Object REMOVE_FROM_INDEX = new JobFamily();
/**
* Updates staging view repository on selection change
*/
- public static final Object UPDATE_SELECTION = new Object();
+ public static final Object UPDATE_SELECTION = new JobFamily();
/**
* Cherry pick commit job
*/
- public static final Object CHERRY_PICK = new Object();
+ public static final Object CHERRY_PICK = new JobFamily(UIIcons.CHERRY_PICK);
/**
* Squash commits job
*/
- public static final Object SQUASH = new Object();
+ public static final Object SQUASH = new JobFamily(UIIcons.SQUASH_DOWN);
/**
* Reword commit job
*/
- public static final Object REWORD = new Object();
+ public static final Object REWORD = new JobFamily(UIIcons.REWORD);
/**
* Edit commit job
*/
- public static final Object EDIT = new Object();
+ public static final Object EDIT = new JobFamily();
/**
* Revert commit job
*/
- public static final Object REVERT_COMMIT = new Object();
+ public static final Object REVERT_COMMIT = new JobFamily();
/**
* Clone repository job
*/
- public static final Object CLONE = new Object();
+ public static final Object CLONE = new JobFamily(UIIcons.CLONEGIT);
/**
* Fetch data from git job
*/
- public static final Object SYNCHRONIZE_READ_DATA = new Object();
+ public static final Object SYNCHRONIZE_READ_DATA = new JobFamily();
/**
* Show annotations git job
*/
- public static final Object BLAME = new Object();
+ public static final Object BLAME = new JobFamily();
/**
* Submodule add git job
*/
- public static final Object SUBMODULE_ADD = new Object();
+ public static final Object SUBMODULE_ADD = new JobFamily();
/**
* Submodule sync git job
*/
- public static final Object SUBMODULE_SYNC = new Object();
+ public static final Object SUBMODULE_SYNC = new JobFamily();
/**
* Submodule update git job
*/
- public static final Object SUBMODULE_UPDATE = new Object();
+ public static final Object SUBMODULE_UPDATE = new JobFamily();
/**
* Stash git job
*/
- public static final Object STASH = new Object();
+ public static final Object STASH = new JobFamily(UIIcons.STASH);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
index 2b9c129..44e77a6 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
@@ -2160,6 +2160,15 @@
public static String PushOperationUI_PushJobName;
/** */
+ public static String RepositoryJob_NullStatus;
+
+ /** */
+ public static String RepositoryJobResultAction_RepositoryGone;
+
+ /** */
+ public static String ShowPushResultAction_name;
+
+ /** */
public static String PushWizard_cantConnectToAny;
/** */
@@ -2772,6 +2781,9 @@
public static String FetchOperationUI_FetchJobName;
/** */
+ public static String FetchOperationUI_ShowFetchResult;
+
+ /** */
public static String FetchDestinationPage_CouldNotGetBranchesMessage;
/** */
@@ -3843,6 +3855,9 @@
public static String GitSelectRepositoryPage_PageMessage;
/** */
+ public static String GitSelectRepositoryPage_BareRepositoriesHidden;
+
+ /** */
public static String GitSelectRepositoryPage_PageTitle;
/** */
@@ -4580,18 +4595,9 @@
public static String RenameBranchDialog_DialogTitle;
/** */
- public static String RenameBranchDialog_NewNameInputDialogPrompt;
-
- /** */
- public static String RenameBranchDialog_RenameBranchDialogNewNameInputWindowTitle;
-
- /** */
public static String RenameBranchDialog_RenameButtonLabel;
/** */
- public static String RenameBranchDialog_RenameErrorMessage;
-
- /** */
public static String RenameBranchDialog_WindowTitle;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ActionCommands.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ActionCommands.java
index 41b650d..bc7ab1ee2 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ActionCommands.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ActionCommands.java
@@ -95,9 +95,6 @@
/** "Push branch" action command id */
public static final String PUSH_BRANCH_ACTION = "org.eclipse.egit.ui.team.PushBranch"; //$NON-NLS-1$
- /** "Rename Branch" action command id */
- public static final String RENAME_BRANCH_ACTION = "org.eclipse.egit.ui.team.RenameBranch"; //$NON-NLS-1$
-
/** "Simple Push" action command id */
public static final String SIMPLE_PUSH_ACTION = "org.eclipse.egit.ui.team.SimplePush"; //$NON-NLS-1$
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/BranchActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/BranchActionHandler.java
index fa52208..0034b80 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/BranchActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/BranchActionHandler.java
@@ -13,6 +13,8 @@
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.egit.ui.internal.branch.BranchOperationUI;
+import org.eclipse.egit.ui.internal.dialogs.CheckoutDialog;
+import org.eclipse.jface.window.Window;
import org.eclipse.jgit.lib.Repository;
/**
@@ -25,9 +27,13 @@
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final Repository repository = getRepository(true, event);
- if (repository == null)
+ if (repository == null) {
return null;
- BranchOperationUI.checkout(repository).start();
+ }
+ CheckoutDialog dialog = new CheckoutDialog(getShell(event), repository);
+ if (dialog.open() == Window.OK) {
+ BranchOperationUI.checkout(repository, dialog.getRefName()).start();
+ }
return null;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/DeleteBranchActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/DeleteBranchActionHandler.java
index 31a83cf..14566c8 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/DeleteBranchActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/DeleteBranchActionHandler.java
@@ -10,7 +10,7 @@
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.egit.ui.internal.branch.BranchOperationUI;
+import org.eclipse.egit.ui.internal.dialogs.DeleteBranchDialog;
import org.eclipse.jgit.lib.Repository;
/**
@@ -23,7 +23,9 @@
final Repository repository = getRepository(true, event);
if (repository == null)
return null;
- BranchOperationUI.delete(repository).start();
+ DeleteBranchDialog dialog = new DeleteBranchDialog(getShell(event),
+ repository);
+ dialog.open();
return null;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RenameBranchAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RenameBranchAction.java
deleted file mode 100644
index ccede23..0000000
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RenameBranchAction.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011, 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;
-
-/**
- * Action for renaming a branch
- */
-public class RenameBranchAction extends RepositoryAction {
- /**
- * Constructs this action
- */
- public RenameBranchAction() {
- super(ActionCommands.RENAME_BRANCH_ACTION,
- new RenameBranchActionHandler());
- }
-}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RenameBranchActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RenameBranchActionHandler.java
index 8f2c331..763eff5 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RenameBranchActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RenameBranchActionHandler.java
@@ -10,7 +10,7 @@
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.egit.ui.internal.branch.BranchOperationUI;
+import org.eclipse.egit.ui.internal.dialogs.RenameBranchDialog;
import org.eclipse.jgit.lib.Repository;
/**
@@ -23,7 +23,9 @@
final Repository repository = getRepository(true, event);
if (repository == null)
return null;
- BranchOperationUI.rename(repository).start();
+ RenameBranchDialog dialog = new RenameBranchDialog(getShell(event),
+ repository);
+ dialog.open();
return null;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SwitchToMenu.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SwitchToMenu.java
index b3c1f95..077c68a 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SwitchToMenu.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SwitchToMenu.java
@@ -23,9 +23,13 @@
import org.eclipse.egit.ui.internal.UIIcons;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.internal.branch.BranchOperationUI;
+import org.eclipse.egit.ui.internal.dialogs.CheckoutDialog;
+import org.eclipse.egit.ui.internal.repository.CreateBranchWizard;
import org.eclipse.egit.ui.internal.selection.SelectionUtils;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.resource.ResourceManager;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jgit.lib.CheckoutEntry;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
@@ -100,16 +104,28 @@
String sourceRef = repository.getConfig().getString(
ConfigConstants.CONFIG_WORKFLOW_SECTION, null,
ConfigConstants.CONFIG_KEY_DEFBRANCHSTARTPOINT);
+ CreateBranchWizard wiz = null;
try {
- Ref ref = repository.findRef(sourceRef);
- if (ref != null)
- BranchOperationUI.createWithRef(repository,
- ref.getName()).start();
- else
- BranchOperationUI.create(repository).start();
+ Ref ref = null;
+ if (sourceRef != null) {
+ ref = repository.findRef(sourceRef);
+ }
+ if (ref != null) {
+ wiz = new CreateBranchWizard(repository, ref.getName());
+ } else {
+ wiz = new CreateBranchWizard(repository,
+ repository.getFullBranch());
+ }
} catch (IOException e1) {
- BranchOperationUI.create(repository).start();
+ // Ignore
}
+ if (wiz == null) {
+ wiz = new CreateBranchWizard(repository);
+ }
+ WizardDialog dlg = new WizardDialog(e.display.getActiveShell(),
+ wiz);
+ dlg.setHelpAvailable(false);
+ dlg.open();
}
});
createSeparator(menu);
@@ -182,7 +198,14 @@
others.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- BranchOperationUI.checkout(repository).start();
+ CheckoutDialog dialog = new CheckoutDialog(
+ e.display.getActiveShell(), repository);
+ if (dialog.open() == Window.OK) {
+ BranchOperationUI
+ .checkout(repository, dialog.getRefName())
+ .start();
+ }
+
}
});
} catch (IOException e) {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/blame/BlameOperation.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/blame/BlameOperation.java
index bec2d04..5bd2e1c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/blame/BlameOperation.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/blame/BlameOperation.java
@@ -293,17 +293,6 @@
if (editor == null)
return;
- // Show history view for path
- try {
- IHistoryView part = (IHistoryView) page.showView(
- IHistoryView.VIEW_ID, null, IWorkbenchPage.VIEW_VISIBLE);
- HistoryPageInput input = createHistoryPageInputWhenEditorOpened();
- part.showHistoryFor(input);
- } catch (PartInitException e) {
- Activator.handleError("Error displaying blame annotations", e, //$NON-NLS-1$
- false);
- }
-
// IRevisionRulerColumn would also be possible but using
// IVerticalRulerInfo seems to work in more situations.
IVerticalRulerInfo rulerInfo = AdapterUtils.adapt(editor,
@@ -340,30 +329,6 @@
storage));
}
- private HistoryPageInput createHistoryPageInputWhenEditorOpened() {
- if (storage instanceof IFile) {
- IResource resource = (IResource) storage;
- if (startCommit != null) {
- return new BlameHistoryPageInput(repository, startCommit,
- resource);
- } else {
- return new HistoryPageInput(repository,
- new IResource[] { resource });
- }
- } else if (!repository.isBare()) {
- File file = new File(repository.getWorkTree(), path);
- if (startCommit != null) {
- return new BlameHistoryPageInput(repository, startCommit,
- file);
- } else {
- return new HistoryPageInput(repository,
- new File[] { file });
- }
- } else {
- return new HistoryPageInput(repository);
- }
- }
-
@Override
public ISchedulingRule getSchedulingRule() {
return null;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchOperationUI.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchOperationUI.java
index 8b6491d..811224d 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchOperationUI.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchOperationUI.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2013 SAP AG and others.
+ * Copyright (c) 2010, 2016 SAP AG and others.
* 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
@@ -7,11 +7,11 @@
*
* Contributors:
* Mathias Kinzler (SAP AG) - initial implementation
+ * Thomas Wolf <thomas.wolf@paranor.ch> - Refactor
*******************************************************************************/
package org.eclipse.egit.ui.internal.branch;
import java.io.File;
-import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.HashSet;
@@ -27,17 +27,11 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.ISourceLocator;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
-import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
import org.eclipse.egit.core.RepositoryUtil;
import org.eclipse.egit.core.internal.util.ProjectUtil;
import org.eclipse.egit.core.op.BranchOperation;
@@ -48,11 +42,7 @@
import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.internal.decorators.GitLightweightDecorator;
-import org.eclipse.egit.ui.internal.dialogs.AbstractBranchSelectionDialog;
-import org.eclipse.egit.ui.internal.dialogs.CheckoutDialog;
-import org.eclipse.egit.ui.internal.dialogs.DeleteBranchDialog;
import org.eclipse.egit.ui.internal.dialogs.NonDeletedFilesDialog;
-import org.eclipse.egit.ui.internal.dialogs.RenameBranchDialog;
import org.eclipse.egit.ui.internal.repository.CreateBranchWizard;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -60,7 +50,6 @@
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.operation.ModalContext;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jgit.annotations.NonNull;
import org.eclipse.jgit.api.CheckoutResult;
@@ -69,7 +58,6 @@
import org.eclipse.jgit.lib.Repository;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.PlatformUI;
@@ -78,21 +66,11 @@
* The UI wrapper for {@link BranchOperation}
*/
public class BranchOperationUI {
- // create
- private final static int MODE_CREATE = 1;
-
- private final static int MODE_CHECKOUT = 2;
-
- private final static int MODE_DELETE = 3;
-
- private final static int MODE_RENAME = 4;
private final Repository repository;
private String target;
- private String base;
-
/**
* In the case of checkout conflicts, a dialog is shown to let the user
* stash, reset or commit. After that, checkout is tried again. The second
@@ -101,62 +79,6 @@
*/
private final boolean showQuestionsBeforeCheckout;
- private final int mode;
-
- /**
- * Create an operation for manipulating branches
- *
- * @param repository
- * @return the {@link BranchOperationUI}
- */
- public static BranchOperationUI rename(Repository repository) {
- return new BranchOperationUI(repository, MODE_RENAME);
- }
-
- /**
- * Create an operation for manipulating branches
- *
- * @param repository
- * @return the {@link BranchOperationUI}
- */
- public static BranchOperationUI delete(Repository repository) {
- return new BranchOperationUI(repository, MODE_DELETE);
- }
-
- /**
- * Create an operation for creating a local branch
- *
- * @param repository
- * @return the {@link BranchOperationUI}
- */
- public static BranchOperationUI create(Repository repository) {
- BranchOperationUI op = new BranchOperationUI(repository, MODE_CREATE);
- return op;
- }
-
- /**
- * Create an operation for creating a local branch with a given base reference
- *
- * @param repository
- * @param baseRef
- * @return the {@link BranchOperationUI}
- */
- public static BranchOperationUI createWithRef(Repository repository, String baseRef) {
- BranchOperationUI op = new BranchOperationUI(repository, MODE_CREATE);
- op.base = baseRef;
- return op;
- }
-
- /**
- * Create an operation for checking out a local branch
- *
- * @param repository
- * @return the {@link BranchOperationUI}
- */
- public static BranchOperationUI checkout(Repository repository) {
- return new BranchOperationUI(repository, MODE_CHECKOUT);
- }
-
/**
* Create an operation for checking out a branch
*
@@ -171,20 +93,6 @@
}
/**
- * Create an operation for checking out a branch without showing a question
- * dialog about the target.
- *
- * @param repository
- * @param target
- * a valid {@link Ref} name or commit id
- * @return the {@link BranchOperationUI}
- */
- public static BranchOperationUI checkoutWithoutQuestion(
- Repository repository, String target) {
- return new BranchOperationUI(repository, target, false);
- }
-
- /**
* @param refName
* the full ref name which will be checked out
* @return true if checkout will need additional input from the user before
@@ -204,40 +112,76 @@
this.repository = repository;
this.target = target;
this.showQuestionsBeforeCheckout = showQuestionsBeforeCheckout;
- this.mode = 0;
}
- /**
- * Select and checkout a branch
- *
- * @param repository
- * @param mode
- */
- private BranchOperationUI(Repository repository, int mode) {
- this.repository = repository;
- this.mode = mode;
- this.showQuestionsBeforeCheckout = true;
+ private String confirmTarget(IProgressMonitor monitor) {
+ if (target != null) {
+ if (!repository.getRepositoryState().canCheckout()) {
+ PlatformUI.getWorkbench().getDisplay()
+ .asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog.openError(getShell(),
+ UIText.BranchAction_cannotCheckout,
+ NLS.bind(
+ UIText.BranchAction_repositoryState,
+ repository.getRepositoryState()
+ .getDescription()));
+ }
+ });
+ return null;
+ }
+
+ if (shouldCancelBecauseOfRunningLaunches(monitor)) {
+ return null;
+ }
+
+ askForTargetIfNecessary();
+ }
+ return target;
+ }
+
+ private BranchOperation getOperation(boolean restore) {
+ BranchOperation bop = new BranchOperation(repository, target, !restore);
+ if (restore) {
+ final BranchProjectTracker tracker = new BranchProjectTracker(
+ repository);
+ final AtomicReference<IMemento> memento = new AtomicReference<>();
+ bop.addPreExecuteTask(new PreExecuteTask() {
+
+ @Override
+ public void preExecute(Repository pRepo,
+ IProgressMonitor pMonitor) throws CoreException {
+ // Snapshot current projects before checkout
+ // begins
+ memento.set(tracker.snapshot());
+ }
+ });
+ bop.addPostExecuteTask(new PostExecuteTask() {
+
+ @Override
+ public void postExecute(Repository pRepo,
+ IProgressMonitor pMonitor) throws CoreException {
+ IMemento snapshot = memento.get();
+ if (snapshot != null) {
+ // Save previous branch's projects and restore
+ // current branch's projects
+ tracker.save(snapshot).restore(pMonitor);
+ }
+ }
+ });
+ }
+ return bop;
}
/**
* Starts the operation asynchronously
*/
public void start() {
- if (!repository.getRepositoryState().canCheckout()) {
- MessageDialog.openError(getShell(),
- UIText.BranchAction_cannotCheckout, NLS.bind(
- UIText.BranchAction_repositoryState, repository
- .getRepositoryState().getDescription()));
+ target = confirmTarget(new NullProgressMonitor());
+ if (target == null) {
return;
}
-
- if (shouldCancelBecauseOfRunningLaunches(new NullProgressMonitor()))
- return;
-
- askForTargetIfNecessary();
- if (target == null)
- return;
-
String repoName = Activator.getDefault().getRepositoryUtil()
.getRepositoryName(repository);
String jobname = NLS.bind(UIText.BranchAction_checkingOut, repoName,
@@ -245,45 +189,13 @@
final boolean restore = Activator.getDefault().getPreferenceStore()
.getBoolean(UIPreferences.CHECKOUT_PROJECT_RESTORE);
- final BranchOperation bop = new BranchOperation(repository, target,
- !restore);
+ final BranchOperation bop = getOperation(restore);
Job job = new WorkspaceJob(jobname) {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) {
try {
- if (restore) {
- final BranchProjectTracker tracker = new BranchProjectTracker(
- repository);
- final AtomicReference<IMemento> memento = new AtomicReference<>();
- bop.addPreExecuteTask(new PreExecuteTask() {
-
- @Override
- public void preExecute(Repository pRepo,
- IProgressMonitor pMonitor)
- throws CoreException {
- // Snapshot current projects before checkout
- // begins
- memento.set(tracker.snapshot());
- }
- });
- bop.addPostExecuteTask(new PostExecuteTask() {
-
- @Override
- public void postExecute(Repository pRepo,
- IProgressMonitor pMonitor)
- throws CoreException {
- IMemento snapshot = memento.get();
- if (snapshot == null)
- return;
- // Save previous branch's projects and restore
- // current branch's projects
- tracker.save(snapshot).restore(pMonitor);
- }
- });
- }
-
bop.execute(monitor);
} catch (CoreException e) {
switch (bop.getResult().getStatus()) {
@@ -310,8 +222,9 @@
job.setUser(true);
// Set scheduling rule to workspace because we may have to re-create
// projects using BranchProjectTracker.
- if (restore)
+ if (restore) {
job.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ }
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent cevent) {
@@ -322,43 +235,26 @@
}
/**
- * Runs the operation synchronously
+ * Runs the operation synchronously.
*
* @param monitor
* @throws CoreException
*
*/
public void run(IProgressMonitor monitor) throws CoreException {
- if (!repository.getRepositoryState().canCheckout()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(getShell(),
- UIText.BranchAction_cannotCheckout, NLS.bind(
- UIText.BranchAction_repositoryState,
- repository.getRepositoryState()
- .getDescription()));
- }
- });
+ SubMonitor progress = SubMonitor.convert(monitor, 100);
+ target = confirmTarget(progress.newChild(20));
+ if (target == null) {
return;
}
-
- if (shouldCancelBecauseOfRunningLaunches(monitor))
- return;
-
- askForTargetIfNecessary();
- if (target == null)
- return;
-
- BranchOperation bop = new BranchOperation(repository, target);
- bop.execute(monitor);
-
+ final boolean restore = Activator.getDefault().getPreferenceStore()
+ .getBoolean(UIPreferences.CHECKOUT_PROJECT_RESTORE);
+ BranchOperation bop = getOperation(restore);
+ bop.execute(progress.newChild(80));
show(bop.getResult());
}
private void askForTargetIfNecessary() {
- if (target == null)
- target = getTargetWithDialog();
if (target != null && showQuestionsBeforeCheckout) {
if (shouldShowCheckoutRemoteTrackingDialog(target))
target = getTargetWithCheckoutRemoteTrackingDialog();
@@ -382,50 +278,6 @@
}
}
- private String getTargetWithDialog() {
- final String[] dialogResult = new String[1];
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- dialogResult[0] = getTargetWithDialogInUI();
- }
- });
- return dialogResult[0];
- }
-
- private String getTargetWithDialogInUI() {
- AbstractBranchSelectionDialog dialog;
- switch (mode) {
- case MODE_CHECKOUT:
- dialog = new CheckoutDialog(getShell(), repository);
- break;
- case MODE_CREATE:
- CreateBranchWizard wiz;
- try {
- if (base == null)
- base = repository.getFullBranch();
- wiz = new CreateBranchWizard(repository, base);
- } catch (IOException e) {
- wiz = new CreateBranchWizard(repository);
- }
- new WizardDialog(getShell(), wiz).open();
- return null;
- case MODE_DELETE:
- new DeleteBranchDialog(getShell(), repository).open();
- return null;
- case MODE_RENAME:
- new RenameBranchDialog(getShell(), repository).open();
- return null;
- default:
- return null;
- }
-
- if (dialog.open() != Window.OK) {
- return null;
- }
- return dialog.getRefName();
- }
-
private String getTargetWithCheckoutRemoteTrackingDialog() {
final String[] dialogResult = new String[1];
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@@ -490,8 +342,8 @@
repository, result.getConflictList());
cleanupUncomittedChangesDialog.open();
if (cleanupUncomittedChangesDialog.shouldContinue()) {
- BranchOperationUI op = BranchOperationUI
- .checkoutWithoutQuestion(repository, target);
+ BranchOperationUI op = new BranchOperationUI(repository,
+ target, false);
op.start();
}
}
@@ -545,15 +397,14 @@
private boolean shouldCancelBecauseOfRunningLaunches(
IProgressMonitor monitor) {
- if (mode == MODE_CHECKOUT)
+ if (!showQuestionsBeforeCheckout) {
return false;
- if (!showQuestionsBeforeCheckout)
- return false;
+ }
final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- if (!store
- .getBoolean(UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING))
+ if (!store.getBoolean(
+ UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING)) {
return false;
-
+ }
final ILaunchConfiguration launchConfiguration = getRunningLaunchConfiguration(monitor);
if (launchConfiguration != null) {
final boolean[] dialogResult = new boolean[1];
@@ -594,67 +445,30 @@
private ILaunchConfiguration getRunningLaunchConfiguration(
IProgressMonitor monitor) {
- final ILaunchConfiguration[] lc = new ILaunchConfiguration[1];
+ final ILaunchConfiguration[] result = { null };
+ IRunnableWithProgress operation = new IRunnableWithProgress() {
+
+ @Override
+ public void run(IProgressMonitor m)
+ throws InvocationTargetException, InterruptedException {
+ Set<IProject> projects = new HashSet<>(
+ Arrays.asList(ProjectUtil.getProjects(repository)));
+ result[0] = LaunchFinder.findLaunch(projects, m);
+ }
+ };
try {
- ModalContext.run(new IRunnableWithProgress() {
-
- @Override
- public void run(IProgressMonitor m)
- throws InvocationTargetException, InterruptedException {
-
- Set<IProject> projects = new HashSet<>(Arrays
- .asList(ProjectUtil.getProjects(repository)));
-
- ILaunchManager launchManager = DebugPlugin.getDefault()
- .getLaunchManager();
- ILaunch[] launches = launchManager.getLaunches();
- m.beginTask(
- UIText.BranchOperationUI_SearchLaunchConfiguration,
- launches.length);
- for (ILaunch launch : launches) {
- m.worked(1);
- if (launch.isTerminated())
- continue;
- ISourceLocator locator = launch.getSourceLocator();
- if (locator instanceof ISourceLookupDirector) {
- ISourceLookupDirector director = (ISourceLookupDirector) locator;
- ISourceContainer[] containers = director
- .getSourceContainers();
- if (isAnyProjectInSourceContainers(containers,
- projects)) {
- lc[0] = launch.getLaunchConfiguration();
- return;
- }
- }
- }
- }
- }, true, monitor, Display.getDefault());
+ if (ModalContext.isModalContextThread(Thread.currentThread())) {
+ operation.run(monitor);
+ } else {
+ ModalContext.run(operation, true, monitor,
+ PlatformUI.getWorkbench().getDisplay());
+ }
} catch (InvocationTargetException e) {
// ignore
} catch (InterruptedException e) {
// ignore
}
- return lc[0];
- }
-
- private boolean isAnyProjectInSourceContainers(
- ISourceContainer[] containers, Set<IProject> projects) {
- for (ISourceContainer container : containers) {
- if (container instanceof ProjectSourceContainer) {
- ProjectSourceContainer projectContainer = (ProjectSourceContainer) container;
- if (projects.contains(projectContainer.getProject()))
- return true;
- }
- try {
- boolean found = isAnyProjectInSourceContainers(
- container.getSourceContainers(), projects);
- if (found)
- return true;
- } catch (CoreException e) {
- // Ignore the child source containers, continue search
- }
- }
- return false;
+ return result[0];
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/LaunchFinder.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/LaunchFinder.java
new file mode 100644
index 0000000..77e3e62
--- /dev/null
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/LaunchFinder.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2013, 2016 Robin Stocker and others.
+ * 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
+ *
+ * Contributors:
+ * Thomas Wolf <thomas.wolf@paranor.ch>
+ *******************************************************************************/
+package org.eclipse.egit.ui.internal.branch;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.ISourceLocator;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
+import org.eclipse.egit.ui.internal.UIText;
+import org.eclipse.jgit.annotations.Nullable;
+
+/**
+ * Utility class for finding launch configurations.
+ */
+public final class LaunchFinder {
+
+ private LaunchFinder() {
+ // Utility class shall not be instantiated
+ }
+
+ /**
+ * If there is a running launch covering one of the given projects, return
+ * the first such launch configuration.
+ *
+ * @param projects
+ * to check for
+ * @param monitor
+ * for progress reporting and cancellation
+ * @return the launch configuration, or {@code null} if none found.
+ */
+ @Nullable
+ public static ILaunchConfiguration findLaunch(Set<IProject> projects,
+ IProgressMonitor monitor) {
+ ILaunchManager launchManager = DebugPlugin.getDefault()
+ .getLaunchManager();
+ ILaunch[] launches = launchManager.getLaunches();
+ SubMonitor progress = SubMonitor.convert(monitor,
+ UIText.BranchOperationUI_SearchLaunchConfiguration,
+ launches.length);
+ for (ILaunch launch : launches) {
+ if (progress.isCanceled()) {
+ break;
+ }
+ if (launch.isTerminated()) {
+ progress.worked(1);
+ continue;
+ }
+ ISourceLocator locator = launch.getSourceLocator();
+ if (locator instanceof ISourceLookupDirector) {
+ ISourceLookupDirector director = (ISourceLookupDirector) locator;
+ ISourceContainer[] containers = director.getSourceContainers();
+ if (isAnyProjectInSourceContainers(containers, projects,
+ progress.newChild(1))) {
+ return launch.getLaunchConfiguration();
+ }
+ } else {
+ progress.worked(1);
+ }
+ }
+ return null;
+ }
+
+ private static boolean isAnyProjectInSourceContainers(
+ ISourceContainer[] containers, Set<IProject> projects,
+ IProgressMonitor monitor) {
+ SubMonitor progress = SubMonitor.convert(monitor, containers.length);
+ for (ISourceContainer container : containers) {
+ if (progress.isCanceled()) {
+ break;
+ }
+ if (container instanceof ProjectSourceContainer) {
+ ProjectSourceContainer projectContainer = (ProjectSourceContainer) container;
+ if (projects.contains(projectContainer.getProject())) {
+ progress.worked(1);
+ return true;
+ }
+ }
+ try {
+ boolean found = isAnyProjectInSourceContainers(
+ container.getSourceContainers(), projects,
+ progress.newChild(1));
+ if (found) {
+ return true;
+ }
+ } catch (CoreException e) {
+ // Ignore the child source containers, continue search
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitImportWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitImportWizard.java
index 007aaec..127ceff 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitImportWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitImportWizard.java
@@ -56,7 +56,8 @@
public class GitImportWizard extends AbstractGitCloneWizard implements IImportWizard {
private static final String GIT_IMPORT_SECTION = "GitImportWizard"; //$NON-NLS-1$
- private GitSelectRepositoryPage selectRepoPage = new GitSelectRepositoryPage();
+ private GitSelectRepositoryPage selectRepoPage = new GitSelectRepositoryPage(
+ false);
private GitSelectWizardPage importWithDirectoriesPage = new GitSelectWizardPage(){
@Override
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitSelectRepositoryPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitSelectRepositoryPage.java
index 283aa6f..69af920 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitSelectRepositoryPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitSelectRepositoryPage.java
@@ -15,12 +15,15 @@
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.egit.core.RepositoryUtil;
+import org.eclipse.egit.core.internal.gerrit.GerritUtil;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.internal.repository.RepositoriesViewContentProvider;
@@ -32,6 +35,7 @@
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -43,13 +47,15 @@
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
+import org.eclipse.jgit.util.FileUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.dialogs.FilteredTree;
import org.eclipse.ui.dialogs.PatternFilter;
@@ -62,20 +68,36 @@
private final RepositoryUtil util;
+ private final boolean allowBare;
+
private TreeViewer tv;
private Button addRepo;
+ private Composite bareMsg;
+
private IPreferenceChangeListener configChangeListener;
/**
- *
+ * Creates a new {@link GitSelectRepositoryPage} that allows also bare
+ * repositories to be selected.
*/
public GitSelectRepositoryPage() {
+ this(true);
+ }
+
+ /**
+ * Creates a new {@link GitSelectRepositoryPage}.
+ *
+ * @param allowBare
+ * whether bare repositories shall be shown
+ */
+ public GitSelectRepositoryPage(boolean allowBare) {
super(GitSelectRepositoryPage.class.getName());
setTitle(UIText.GitSelectRepositoryPage_PageTitle);
- setMessage(UIText.GitSelectRepositoryPage_PageMessage);
+ setDescription(UIText.GitSelectRepositoryPage_PageMessage);
util = Activator.getDefault().getRepositoryUtil();
+ this.allowBare = allowBare;
}
/**
@@ -105,6 +127,27 @@
tv = tree.getViewer();
GridDataFactory.fillDefaults().grab(true, true).applyTo(tree);
tv.setContentProvider(new RepositoriesViewContentProvider() {
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ Object[] elements = super.getElements(inputElement);
+ if (allowBare) {
+ return elements;
+ }
+ List<Object> result = new ArrayList<>();
+ for (Object element : elements) {
+ if (element instanceof RepositoryTreeNode) {
+ RepositoryTreeNode node = (RepositoryTreeNode) element;
+ if (node.getRepository() != null
+ && !node.getRepository().isBare()) {
+ result.add(element);
+ }
+ }
+ }
+ bareMsg.setVisible(result.size() != elements.length);
+ return result.toArray();
+ }
+
// we never show children, only the Repository nodes
@Override
public Object[] getChildren(Object parentElement) {
@@ -133,19 +176,35 @@
public void widgetSelected(SelectionEvent e) {
List<String> configuredDirs = util.getConfiguredRepositories();
RepositorySearchWizard wizard = new RepositorySearchWizard(
- configuredDirs);
+ configuredDirs, allowBare);
WizardDialog dlg = new WizardDialog(getShell(), wizard);
if (dlg.open() == Window.OK
&& !wizard.getDirectories().isEmpty()) {
Set<String> dirs = wizard.getDirectories();
- for (String dir : dirs)
- util.addConfiguredRepository(new File(dir));
+ for (String dir : dirs) {
+ File gitDir = FileUtils.canonicalize(new File(dir));
+ GerritUtil.tryToAutoConfigureForGerrit(gitDir);
+ util.addConfiguredRepository(gitDir);
+ }
checkPage();
}
}
});
+ if (!allowBare) {
+ bareMsg = new Composite(main, SWT.NONE);
+ bareMsg.setLayout(new RowLayout());
+ bareMsg.setLayoutData(
+ GridDataFactory.fillDefaults().grab(true, false).create());
+ Label imageLabel = new Label(bareMsg, SWT.NONE);
+ imageLabel.setImage(
+ JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO));
+ Label textLabel = new Label(bareMsg, SWT.WRAP);
+ textLabel.setText(
+ UIText.GitSelectRepositoryPage_BareRepositoriesHidden);
+ bareMsg.setVisible(false);
+ }
tv.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
@@ -173,8 +232,10 @@
display.asyncExec(new Runnable() {
@Override
public void run() {
- refreshRepositoryList();
- checkPage();
+ if (!tv.getControl().isDisposed()) {
+ refreshRepositoryList();
+ checkPage();
+ }
}
});
}
@@ -215,28 +276,46 @@
}
private void refreshRepositoryList() {
- List<String> dirsBefore = (List<String>) tv.getInput();
+ List<?> dirsBefore = (List<?>) tv.getInput();
List<String> dirsAfter = util.getConfiguredRepositories();
- if (dirsBefore != null && !dirsBefore.containsAll(dirsAfter)) {
+ if (dirsBefore == null) {
+ dirsBefore = Collections.emptyList();
+ }
+ if (!dirsBefore.containsAll(dirsAfter)) {
+ IStructuredSelection previousSelection = (IStructuredSelection) tv
+ .getSelection();
tv.setInput(dirsAfter);
- for (String dir : dirsAfter)
- if (!dirsBefore.contains(dir))
+ for (String dir : dirsAfter) {
+ if (!dirsBefore.contains(dir)) {
try {
- RepositoryNode node = new RepositoryNode(null,
- FileRepositoryBuilder.create(new File(dir)));
- tv.setSelection(new StructuredSelection(
- node));
+ Repository newRepository = org.eclipse.egit.core.Activator
+ .getDefault().getRepositoryCache()
+ .lookupRepository(new File(dir));
+ if (!allowBare && newRepository.isBare()) {
+ // Re-set to previous selection, if any
+ if (!previousSelection.isEmpty()) {
+ tv.setSelection(previousSelection);
+ }
+ } else {
+ RepositoryNode node = new RepositoryNode(null,
+ newRepository);
+ tv.setSelection(new StructuredSelection(node));
+ }
} catch (IOException e1) {
Activator.handleError(e1.getMessage(), e1,
false);
}
+ break;
+ }
+ }
}
}
private void checkPage() {
setErrorMessage(null);
try {
- if (((List) tv.getInput()).isEmpty()) {
+ List<?> currentInput = (List<?>) tv.getInput();
+ if (currentInput == null || currentInput.isEmpty()) {
setErrorMessage(UIText.GitSelectRepositoryPage_NoRepoFoundMessage);
return;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/RenameBranchDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/RenameBranchDialog.java
index 1e1e216..2d2cbda 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/RenameBranchDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/RenameBranchDialog.java
@@ -5,6 +5,7 @@
* Copyright (C) 2010, Chris Aniszczyk <caniszczyk@gmail.com>
* Copyright (C) 2010, Mathias Kinzler <mathias.kinzler@sap.com>
* Copyright (C) 2011, Dariusz Luksza <dariusz@luksza.org>
+ * Copyright (C) 2016, Thomas Wolf <thomas.wolf@paranor.ch>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -13,18 +14,15 @@
*******************************************************************************/
package org.eclipse.egit.ui.internal.dialogs;
-import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.internal.UIText;
-import org.eclipse.egit.ui.internal.ValidationUtils;
-import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.window.Window;
-import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
/**
* The branch and reset selection dialog
@@ -41,49 +39,22 @@
| EXPAND_LOCAL_BRANCHES_NODE);
}
- private InputDialog getRefNameInputDialog(String prompt,
- final String refPrefix, String initialValue) {
- InputDialog branchNameDialog = new InputDialog(
- getShell(),
- UIText.RenameBranchDialog_RenameBranchDialogNewNameInputWindowTitle,
- prompt, initialValue, ValidationUtils.getRefNameInputValidator(
- repo, refPrefix, true));
- branchNameDialog.setBlockOnOpen(true);
- return branchNameDialog;
- }
-
@Override
protected void okPressed() {
- String refName = refNameFromDialog();
- String refPrefix;
+ final Ref toRename = refFromDialog();
- if (refName.startsWith(Constants.R_HEADS))
- refPrefix = Constants.R_HEADS;
- else if (refName.startsWith(Constants.R_REMOTES))
- refPrefix = Constants.R_REMOTES;
- else if (refName.startsWith(Constants.R_TAGS))
- refPrefix = Constants.R_TAGS;
- else {
- // the button should be disabled anyway, but we check again
- return;
- }
+ if (toRename != null) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- String branchName = refName.substring(refPrefix.length());
-
- InputDialog labelDialog = getRefNameInputDialog(NLS.bind(
- UIText.RenameBranchDialog_NewNameInputDialogPrompt, branchName,
- refPrefix), refPrefix, branchName);
- if (labelDialog.open() == Window.OK) {
- String newRefName = refPrefix + labelDialog.getValue();
- try (Git git = new Git(repo)) {
- git.branchRename().setOldName(refName)
- .setNewName(labelDialog.getValue()).call();
- branchTree.refresh();
- markRef(newRefName);
- } catch (Throwable e1) {
- reportError(e1, UIText.RenameBranchDialog_RenameErrorMessage,
- refName, newRefName, e1.getMessage());
- }
+ @Override
+ public void run() {
+ BranchRenameDialog dialog = new BranchRenameDialog(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell(),
+ repo, toRename);
+ dialog.open();
+ }
+ });
}
super.okPressed();
}
@@ -136,20 +107,12 @@
return super.getShellStyle() | SWT.RESIZE;
}
- private void reportError(Throwable e, String message, Object... args) {
- String msg = NLS.bind(message, args);
- Activator.handleError(msg, e, true);
- }
-
@Override
protected void refNameSelected(String refName) {
- boolean tagSelected = refName != null
- && refName.startsWith(Constants.R_TAGS);
-
boolean branchSelected = refName != null
&& (refName.startsWith(Constants.R_HEADS) || refName
.startsWith(Constants.R_REMOTES));
- getButton(Window.OK).setEnabled(branchSelected || tagSelected);
+ getButton(Window.OK).setEnabled(branchSelected);
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangePage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangePage.java
index b16306d..34b131c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangePage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangePage.java
@@ -185,6 +185,7 @@
Clipboard clipboard = new Clipboard(parent.getDisplay());
String clipText = (String) clipboard.getContents(TextTransfer
.getInstance());
+ clipboard.dispose();
String defaultUri = null;
String defaultCommand = null;
String defaultChange = null;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchOperationUI.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchOperationUI.java
index 135eefe..4d3dc38 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchOperationUI.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchOperationUI.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SAP AG.
+ * Copyright (c) 2011, 2016 SAP AG and others.
* 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
@@ -7,25 +7,27 @@
*
* Contributors:
* Mathias Kinzler (SAP AG) - initial implementation
+ * Thomas Wolf <thomas.wolf@paranor.ch> - Bug 495512
*******************************************************************************/
package org.eclipse.egit.ui.internal.fetch;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
-import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.egit.core.op.FetchOperation;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.JobFamilies;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider;
+import org.eclipse.egit.ui.internal.jobs.RepositoryJob;
+import org.eclipse.egit.ui.internal.jobs.RepositoryJobResultAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jgit.annotations.NonNull;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.CredentialsProvider;
import org.eclipse.jgit.transport.FetchResult;
@@ -34,6 +36,8 @@
import org.eclipse.jgit.transport.TagOpt;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
/**
* UI Wrapper for {@link FetchOperation}
@@ -113,14 +117,20 @@
* completion
*/
public void start() {
- Job job = new WorkspaceJob(NLS.bind(
+ final Repository repo = repository;
+ if (repo == null) {
+ return;
+ }
+ Job job = new RepositoryJob(NLS.bind(
UIText.FetchOperationUI_FetchJobName,
sourceString)) {
+ private FetchResult result;
+
@Override
- public IStatus runInWorkspace(IProgressMonitor monitor) {
+ public IStatus performJob(IProgressMonitor monitor) {
try {
- execute(monitor);
+ result = execute(monitor);
} catch (CoreException e) {
return Activator.createErrorStatus(e.getStatus()
.getMessage(), e);
@@ -129,25 +139,21 @@
}
@Override
+ protected IAction getAction() {
+ return new ShowResultAction(repo, result, sourceString);
+ }
+
+ @Override
public boolean belongsTo(Object family) {
- if (JobFamilies.FETCH.equals(family))
+ if (JobFamilies.FETCH.equals(family)) {
return true;
+ }
return super.belongsTo(family);
}
+
};
job.setUser(true);
job.schedule();
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- if (event.getResult().isOK())
- FetchResultDialog.show(repository, op.getOperationResult(),
- sourceString);
- else
- Activator.handleError(event.getResult().getMessage(), event
- .getResult().getException(), true);
- }
- });
}
/**
@@ -156,4 +162,28 @@
public String getSourceString(){
return sourceString;
}
+
+ private static class ShowResultAction extends RepositoryJobResultAction {
+
+ private final FetchResult result;
+
+ private final String source;
+
+ public ShowResultAction(@NonNull Repository repository,
+ FetchResult result, String source) {
+ super(repository, UIText.FetchOperationUI_ShowFetchResult);
+ this.result = result;
+ this.source = source;
+ }
+
+ @Override
+ protected void showResult(@NonNull Repository repository) {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell();
+ FetchResultDialog dialog = new FetchResultDialog(shell, repository,
+ result, source);
+ dialog.open();
+ }
+ }
+
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchResultDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchResultDialog.java
index afecb95..6f46317 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchResultDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchResultDialog.java
@@ -57,26 +57,6 @@
}
/**
- * Shows this dialog asynchronously
- *
- * @param repository
- * @param result
- * @param sourceString
- */
- public static void show(final Repository repository,
- final FetchResult result, final String sourceString) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- Shell shell = PlatformUI.getWorkbench()
- .getModalDialogShellProvider().getShell();
- new FetchResultDialog(shell, repository, result, sourceString)
- .open();
- }
- });
- }
-
- /**
* @param parentShell
* @param localDb
* @param result
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindResults.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindResults.java
index a05b818..5b07e6f 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindResults.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindResults.java
@@ -23,7 +23,7 @@
* table that contain a match to a given pattern.
*
* @see FindToolbar
- * @see FindToolbarThread
+ * @see FindToolbarJob
*/
public class FindResults {
private Map<Integer, Integer> matchesMap = new LinkedHashMap<>();
@@ -36,14 +36,28 @@
private RevFlag highlight;
+ private boolean overflow;
+
+ private final IFindListener listener;
+
+ /**
+ * Creates a new results object notifying the given listener upon changes.
+ *
+ * @param listener
+ * to notify
+ */
+ public FindResults(IFindListener listener) {
+ this.listener = listener;
+ }
+
/**
* Returns if the index in the history table matches the find pattern.
*
* @param index
* history table item index.
- * @return boolean <code>true</code> if the history table
- * <code>index</code> contains a match to the find pattern,
- * <code>false</code> otherwise
+ * @return boolean <code>true</code> if the history table <code>index</code>
+ * contains a match to the find pattern, <code>false</code>
+ * otherwise
*/
public synchronized boolean isFoundAt(int index) {
return matchesMap.containsKey(Integer.valueOf(index));
@@ -165,6 +179,7 @@
revObjList.clear();
keysArray = null;
matchesCount = 0;
+ listener.cleared();
}
/**
@@ -182,6 +197,7 @@
revObjList.add(revObj);
revObj.add(highlight);
keysArray = null;
+ listener.itemAdded(matchIx, revObj);
}
private Integer[] getkeysArray() {
@@ -199,4 +215,12 @@
}
this.highlight = hFlag;
}
+
+ synchronized void setOverflow() {
+ overflow = true;
+ }
+
+ synchronized boolean isOverflow() {
+ return overflow;
+ }
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbar.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbar.java
index 944e547..eecf521 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbar.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbar.java
@@ -4,6 +4,7 @@
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2010, Mathias Kinzler <mathias.kinzler@sap.com>
* Copyright (C) 2013, Robin Stocker <robin@nibor.org>
+ * Copyright (C) 2016, Thomas Wolf <thomas.wolf@paranor.ch>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -13,15 +14,20 @@
package org.eclipse.egit.ui.internal.history;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.internal.UIIcons;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
+import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jgit.revwalk.RevFlag;
+import org.eclipse.jgit.revwalk.RevObject;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@@ -46,7 +52,6 @@
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
@@ -56,7 +61,7 @@
/**
* A toolbar for the history page.
*
- * @see FindToolbarThread
+ * @see FindToolbarJob
* @see FindResults
* @see GitHistoryPage
*/
@@ -81,7 +86,7 @@
/**
* The results (matches) of the current find operation.
*/
- public final FindResults findResults = new FindResults();
+ private final FindResults findResults;
private IPersistentPreferenceStore store = (IPersistentPreferenceStore) Activator.getDefault().getPreferenceStore();
@@ -99,8 +104,6 @@
private Label currentPositionLabel;
- private ProgressBar progressBar;
-
private String lastErrorPattern;
private ToolItem prefsDropDown;
@@ -137,6 +140,10 @@
private Image branchesIcon;
+ private FindToolbarJob job;
+
+ private int currentPosition = -1;
+
/**
* Creates the toolbar.
*
@@ -145,32 +152,36 @@
*/
public FindToolbar(Composite parent) {
super(parent, SWT.NULL);
+ findResults = new FindResults(createFindListener());
createToolbar();
}
private void createToolbar() {
errorBackgroundColor = new Color(getDisplay(), new RGB(255, 150, 150));
- nextIcon = UIIcons.ELCL16_NEXT.createImage();
- previousIcon = UIIcons.ELCL16_PREVIOUS.createImage();
- allIcon = UIIcons.SEARCH_COMMIT.createImage();
- commitIdIcon = UIIcons.ELCL16_ID.createImage();
- commentsIcon = UIIcons.ELCL16_COMMENTS.createImage();
- authorIcon = UIIcons.ELCL16_AUTHOR.createImage();
- committerIcon = UIIcons.ELCL16_COMMITTER.createImage();
- branchesIcon = UIIcons.BRANCHES.createImage();
-
+ ResourceManager resourceManager = Activator.getDefault()
+ .getResourceManager();
+ nextIcon = UIIcons.getImage(resourceManager, UIIcons.ELCL16_NEXT);
+ previousIcon = UIIcons.getImage(resourceManager,
+ UIIcons.ELCL16_PREVIOUS);
+ allIcon = UIIcons.getImage(resourceManager, UIIcons.SEARCH_COMMIT);
+ commitIdIcon = UIIcons.getImage(resourceManager,
+ UIIcons.ELCL16_ID);
+ commentsIcon = UIIcons.getImage(resourceManager,
+ UIIcons.ELCL16_COMMENTS);
+ authorIcon = UIIcons.getImage(resourceManager, UIIcons.ELCL16_AUTHOR);
+ committerIcon = UIIcons.getImage(resourceManager,
+ UIIcons.ELCL16_COMMITTER);
+ branchesIcon = UIIcons.getImage(resourceManager, UIIcons.BRANCHES);
GridLayout findLayout = new GridLayout();
findLayout.marginHeight = 2;
findLayout.marginWidth = 2;
- findLayout.numColumns = 8;
+ findLayout.numColumns = 5;
setLayout(findLayout);
setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- Label findLabel = new Label(this, SWT.NULL);
- findLabel.setText(UIText.HistoryPage_findbar_find);
-
- patternField = new Text(this, SWT.SEARCH);
- GridData findTextData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ patternField = new Text(this,
+ SWT.SEARCH | SWT.ICON_CANCEL | SWT.ICON_SEARCH);
+ GridData findTextData = new GridData(SWT.FILL, SWT.LEFT, true, false);
findTextData.minimumWidth = 50;
patternField.setLayoutData(findTextData);
patternField.setTextLimit(100);
@@ -248,24 +259,25 @@
currentPositionLabel.setAlignment(SWT.RIGHT);
currentPositionLabel.setText(""); //$NON-NLS-1$
- progressBar = new ProgressBar(this, SWT.HORIZONTAL);
- GridData findProgressBarData = new GridData();
- findProgressBarData.heightHint = 12;
- findProgressBarData.widthHint = 35;
- progressBar.setLayoutData(findProgressBarData);
- progressBar.setMinimum(0);
- progressBar.setMaximum(100);
-
patternField.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
- final FindToolbarThread finder = createFinder();
- getDisplay().timerExec(200, new Runnable() {
- @Override
- public void run() {
- finder.start();
- }
- });
+ final FindToolbarJob finder = createFinder();
+ finder.setUser(true);
+ finder.schedule(200);
+ }
+ });
+
+ patternField.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ if (e.detail != SWT.ICON_CANCEL
+ && !patternField.getText().isEmpty()) {
+ // ENTER or the search icon clicked
+ final FindToolbarJob finder = createFinder();
+ finder.setUser(true);
+ finder.schedule();
+ }
}
});
@@ -276,8 +288,9 @@
&& findResults.size() == 0) {
// If the toolbar was cleared and has a pattern typed,
// then we redo the find with the new table data.
- final FindToolbarThread finder = createFinder();
- finder.start();
+ final FindToolbarJob finder = createFinder();
+ finder.setUser(true);
+ finder.schedule();
patternField.setSelection(0, 0);
} else {
int currentIx = historyTable.getSelectionIndex();
@@ -296,14 +309,14 @@
sendEvent(event.widget, newIx);
String current = null;
- int currentValue = findResults.getMatchNumberFor(newIx);
- if (currentValue == -1) {
+ currentPosition = findResults.getMatchNumberFor(newIx);
+ if (currentPosition == -1) {
current = "-"; //$NON-NLS-1$
} else {
- current = String.valueOf(currentValue);
+ current = String.valueOf(currentPosition);
}
- currentPositionLabel.setText(current + "/" //$NON-NLS-1$
- + findResults.size());
+ currentPositionLabel
+ .setText(current + '/' + findResults.size());
}
}
};
@@ -369,16 +382,12 @@
@Override
public void widgetDisposed(DisposeEvent e) {
+ if (job != null) {
+ job.cancel();
+ job = null;
+ }
prefsMenu.dispose();
errorBackgroundColor.dispose();
- nextIcon.dispose();
- previousIcon.dispose();
- allIcon.dispose();
- commitIdIcon.dispose();
- commentsIcon.dispose();
- authorIcon.dispose();
- committerIcon.dispose();
- branchesIcon.dispose();
}
});
}
@@ -441,26 +450,56 @@
clear();
}
- private FindToolbarThread createFinder() {
- final FindToolbarThread finder = new FindToolbarThread();
- finder.pattern = patternField.getText();
- finder.fileRevisions = fileRevisions;
- finder.toolbar = this;
- finder.ignoreCase = caseItem.getSelection();
- if (allItem.getSelection()) {
- finder.findInCommitId = true;
- finder.findInComments = true;
- finder.findInAuthor = true;
- finder.findInCommitter = true;
- finder.findInReference = true;
- } else {
- finder.findInCommitId = commitIdItem.getSelection();
- finder.findInComments = commentsItem.getSelection();
- finder.findInAuthor = authorItem.getSelection();
- finder.findInCommitter = committerItem.getSelection();
- finder.findInReference = referenceItem.getSelection();
+ private FindToolbarJob createFinder() {
+ if (job != null) {
+ job.cancel();
}
- return finder;
+ final String currentPattern = patternField.getText();
+
+ job = new FindToolbarJob(MessageFormat
+ .format(UIText.HistoryPage_findbar_find, currentPattern),
+ findResults);
+ job.pattern = currentPattern;
+ job.fileRevisions = fileRevisions;
+ job.ignoreCase = caseItem.getSelection();
+ if (allItem.getSelection()) {
+ job.findInCommitId = true;
+ job.findInComments = true;
+ job.findInAuthor = true;
+ job.findInCommitter = true;
+ job.findInReference = true;
+ } else {
+ job.findInCommitId = commitIdItem.getSelection();
+ job.findInComments = commentsItem.getSelection();
+ job.findInAuthor = authorItem.getSelection();
+ job.findInCommitter = committerItem.getSelection();
+ job.findInReference = referenceItem.getSelection();
+ }
+ job.addJobChangeListener(new JobChangeAdapter() {
+
+ private final FindToolbarJob myJob = job;
+
+ @Override
+ public void done(final IJobChangeEvent event) {
+ if (event.getResult().isOK()) {
+ getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (myJob != job) {
+ // Job superseded by another one
+ return;
+ }
+ if (!isDisposed()) {
+ findCompletionUpdate(currentPattern,
+ findResults.isOverflow());
+ }
+ }
+ });
+ }
+ }
+ });
+ return job;
}
/**
@@ -481,40 +520,28 @@
findResults.setHighlightFlag(hFlag);
}
- void progressUpdate(int percent) {
- int total = findResults.size();
- currentPositionLabel.setText("-/" + total); //$NON-NLS-1$
- currentPositionLabel.setForeground(null);
- if (total > 0) {
- nextButton.setEnabled(true);
- previousButton.setEnabled(true);
- patternField.setBackground(null);
- } else {
- nextButton.setEnabled(false);
- previousButton.setEnabled(false);
- }
- progressBar.setSelection(percent);
- historyTable.clearAll();
- }
-
- void findCompletionUpdate(String pattern, boolean overflow) {
+ private void findCompletionUpdate(String pattern, boolean overflow) {
int total = findResults.size();
if (total > 0) {
+ String position = (currentPosition < 0) ? "1" //$NON-NLS-1$
+ : Integer.toString(currentPosition);
if (overflow) {
- currentPositionLabel
- .setText(UIText.HistoryPage_findbar_exceeded + " 1/" //$NON-NLS-1$
- + total);
+ currentPositionLabel.setText(UIText.HistoryPage_findbar_exceeded
+ + ' ' + position + '/' + total);
} else {
- currentPositionLabel.setText("1/" + total); //$NON-NLS-1$
+ currentPositionLabel.setText(position + '/' + total);
}
- int ix = findResults.getFirstIndex();
- sendEvent(null, ix);
-
+ if (currentPosition < 0) {
+ currentPosition = 1;
+ int ix = findResults.getFirstIndex();
+ sendEvent(null, ix);
+ }
patternField.setBackground(null);
nextButton.setEnabled(true);
previousButton.setEnabled(true);
lastErrorPattern = null;
} else {
+ currentPosition = -1;
if (pattern.length() > 0) {
patternField.setBackground(errorBackgroundColor);
currentPositionLabel
@@ -536,7 +563,6 @@
lastErrorPattern = null;
}
}
- progressBar.setSelection(0);
historyTable.clearAll();
if (overflow) {
@@ -554,24 +580,18 @@
*/
void clear() {
patternField.setBackground(null);
- if (patternField.getText().length() > 0) {
- patternField.selectAll();
- nextButton.setEnabled(true);
- previousButton.setEnabled(true);
- } else {
- nextButton.setEnabled(false);
- previousButton.setEnabled(false);
- }
- currentPositionLabel.setText(""); //$NON-NLS-1$
- progressBar.setSelection(0);
lastErrorPattern = null;
- findResults.clear();
- if (historyTable != null) {
- historyTable.clearAll();
+ if (job != null) {
+ job.cancel();
+ job = null;
}
- FindToolbarThread.updateGlobalThreadIx();
+ findResults.clear();
+
+ if (patternField.getText().length() > 0) {
+ patternField.selectAll();
+ }
}
private void sendEvent(Widget widget, int index) {
@@ -596,4 +616,72 @@
eventList.add(listener);
}
+ private IFindListener createFindListener() {
+ return new IFindListener() {
+
+ private static final long UPDATE_INTERVAL = 200L; // ms
+
+ private long lastUpdate = 0L;
+
+ @Override
+ public void itemAdded(int index, RevObject rev) {
+ long now = System.currentTimeMillis();
+ if (now - lastUpdate > UPDATE_INTERVAL) {
+ final boolean firstUpdate = lastUpdate == 0L;
+ lastUpdate = now;
+ getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ int total = findResults.size();
+ currentPositionLabel.setForeground(null);
+ if (total > 0) {
+ if (currentPosition == -1) {
+ currentPositionLabel.setText("-/" + total); //$NON-NLS-1$
+ } else {
+ currentPositionLabel.setText(
+ Integer.toString(currentPosition)
+ + '/' + total);
+ }
+ nextButton.setEnabled(true);
+ previousButton.setEnabled(true);
+ patternField.setBackground(null);
+ if (firstUpdate) {
+ historyTable.clearAll();
+ }
+ } else {
+ clear();
+ }
+ }
+ });
+ }
+ }
+
+ @Override
+ public void cleared() {
+ lastUpdate = 0L;
+ if (Display.getCurrent() == null) {
+ getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ clear();
+ }
+ });
+ } else {
+ clear();
+ }
+ }
+
+ private void clear() {
+ currentPosition = -1;
+ currentPositionLabel.setText(""); //$NON-NLS-1$
+ nextButton.setEnabled(false);
+ previousButton.setEnabled(false);
+ if (historyTable != null) {
+ historyTable.clearAll();
+ }
+ }
+ };
+ }
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbarJob.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbarJob.java
new file mode 100644
index 0000000..81f821c
--- /dev/null
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbarJob.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * Copyright (C) 2008, 2016 Roger C. Soares <rogersoares@intelinet.com.br> and others
+ *
+ * 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
+ *
+ * Contributors:
+ * Thomas Wolf <thomas.wolf@paranor.ch> - rewrite as Job
+ *******************************************************************************/
+package org.eclipse.egit.ui.internal.history;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.egit.ui.Activator;
+import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.lib.Repository;
+
+/**
+ * This class executes the search function for the find toolbar. To avoid
+ * consuming all the memory in the system, this class limits the maximum results
+ * it stores.
+ *
+ * @see FindToolbar
+ * @see FindResults
+ */
+public class FindToolbarJob extends Job {
+
+ private static final int MAX_RESULTS = 20000;
+
+ private static final ISchedulingRule SINGLE_JOB_RULE = new ISchedulingRule() {
+
+ @Override
+ public boolean contains(ISchedulingRule rule) {
+ return this == rule;
+ }
+
+ @Override
+ public boolean isConflicting(ISchedulingRule rule) {
+ return this == rule;
+ }
+ };
+
+ String pattern;
+
+ SWTCommit[] fileRevisions;
+
+ boolean ignoreCase;
+
+ boolean findInCommitId;
+
+ boolean findInComments;
+
+ boolean findInAuthor;
+
+ boolean findInCommitter;
+
+ boolean findInReference;
+
+ private final FindResults findResults;
+
+ /**
+ * Creates a new history search job.
+ *
+ * @param name
+ * of the job
+ * @param findResults
+ * to fill
+ */
+ public FindToolbarJob(String name, FindResults findResults) {
+ super(name);
+ this.findResults = findResults;
+ setRule(SINGLE_JOB_RULE);
+ }
+
+ private boolean find(String needle, String text) {
+ if (text == null) {
+ return false;
+ }
+ if (ignoreCase) {
+ return text.toLowerCase().indexOf(needle) >= 0;
+ }
+ return text.indexOf(needle) >= 0;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ findResults.clear();
+
+ if (pattern == null || pattern.isEmpty() || fileRevisions == null
+ || fileRevisions.length == 0) {
+ return Status.OK_STATUS;
+ }
+ String findPattern = pattern;
+ if (ignoreCase) {
+ findPattern = pattern.toLowerCase();
+ }
+
+ int totalRevisions = fileRevisions.length;
+ SubMonitor progress = SubMonitor.convert(monitor, totalRevisions);
+ for (int i = 0; i < totalRevisions; i++) {
+ if (progress.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ if (findResults.size() >= MAX_RESULTS) {
+ findResults.setOverflow();
+ break;
+ }
+
+ // Finds for the pattern in the revision history.
+ SWTCommit revision = fileRevisions[i];
+ try {
+ revision.parseBody();
+ } catch (IOException e) {
+ Activator.logError("Error parsing body", e); //$NON-NLS-1$
+ continue;
+ }
+
+ if (findInCommitId && find(findPattern, revision.getId().name())) {
+ if (progress.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ findResults.add(i, revision);
+ continue;
+ }
+ if (findInComments
+ && find(findPattern, revision.getFullMessage())) {
+ if (progress.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ findResults.add(i, revision);
+ continue;
+ }
+
+ if (findInAuthor && (find(findPattern,
+ revision.getAuthorIdent().getName())
+ || find(findPattern,
+ revision.getAuthorIdent().getEmailAddress()))) {
+ if (progress.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ findResults.add(i, revision);
+ continue;
+ }
+
+ if (findInCommitter && (find(findPattern,
+ revision.getCommitterIdent().getName())
+ || find(findPattern,
+ revision.getCommitterIdent().getEmailAddress()))) {
+ if (progress.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ findResults.add(i, revision);
+ continue;
+ }
+
+ if (findInReference) {
+ for (int j = 0; j < revision.getRefCount(); j++) {
+ if (progress.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ Ref ref = revision.getRef(j);
+ String refName = ref.getName();
+ refName = Repository.shortenRefName(refName);
+ if (find(findPattern, refName)) {
+ if (progress.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ findResults.add(i, revision);
+ break;
+ }
+ }
+ }
+ progress.worked(1);
+ }
+ return progress.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
+ }
+
+}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbarThread.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbarThread.java
deleted file mode 100644
index ac85984..0000000
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbarThread.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2008, Roger C. Soares <rogersoares@intelinet.com.br>
- *
- * 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.history;
-
-import java.io.IOException;
-
-import org.eclipse.egit.ui.Activator;
-import org.eclipse.jgit.lib.Ref;
-import org.eclipse.jgit.lib.Repository;
-
-/**
- * This class executes the search function for the find toolbar. Only one thread
- * is executed at a time.
- * <p>
- * This class maintains a <code>globalThreadIx</code> internal variable that
- * is incremented for each new thread started and the current running thread
- * constantly checks this variable. If the current thread has the same value as
- * <code>globalThreadIx</code> it continues executing, if it has a lower value
- * it means that a more recent search needs to be done and the current isn't
- * necessary any more, so the current thread returns.
- * </p>
- * <p>
- * To avoid consuming all the memory in the system, this class limits the
- * maximum results it stores.
- * </p>
- *
- * @see FindToolbar
- * @see FindResults
- */
-public class FindToolbarThread extends Thread {
-
- private static final Object EXEC_LOCK = new Object();
-
- private static final int MAX_RESULTS = 20000;
-
- String pattern;
-
- SWTCommit[] fileRevisions;
-
- FindToolbar toolbar;
-
- boolean ignoreCase;
-
- boolean findInCommitId;
-
- boolean findInComments;
-
- boolean findInAuthor;
-
- boolean findInCommitter;
-
- boolean findInReference;
-
- private volatile static int globalThreadIx = 0;
-
- private int currentThreadIx;
-
- /**
- * Creates a new object and increments the internal
- * <code>globalThreadIx</code> variable causing any earlier running thread
- * to return.
- */
- public FindToolbarThread() {
- super("history_find_thread" + ++globalThreadIx); //$NON-NLS-1$
- currentThreadIx = globalThreadIx;
- }
-
- @Override
- public void run() {
- synchronized (EXEC_LOCK) {
- execFind();
- }
- }
-
- private void execFind() {
- // If it isn't the last event, just ignore it.
- if (currentThreadIx < globalThreadIx) {
- return;
- }
-
- FindResults findResults = toolbar.findResults;
- findResults.clear();
-
- boolean maxResultsOverflow = false;
- if (pattern.length() > 0 && fileRevisions != null) {
- String findPattern = pattern;
- if (ignoreCase) {
- findPattern = pattern.toLowerCase();
- }
-
- long lastUIUpdate = System.currentTimeMillis();
-
- int totalRevisions = fileRevisions.length;
- int totalMatches = 0;
- boolean notFound = true;
- for (int i = 0; i < totalRevisions; i++) {
- // If a new find event was generated, ends the current thread.
- if (toolbar.getDisplay().isDisposed()
- || currentThreadIx < globalThreadIx) {
- return;
- }
-
- // Updates the toolbar with in process info.
- if (System.currentTimeMillis() - lastUIUpdate > 500) {
- final int percentage = (int) (((i + 1F) / totalRevisions) * 100);
- toolbar.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (toolbar.isDisposed()) {
- return;
- }
- toolbar.progressUpdate(percentage);
- }
- });
- lastUIUpdate = System.currentTimeMillis();
- }
-
- // Finds for the pattern in the revision history.
- notFound = true;
- SWTCommit revision = fileRevisions[i];
- try {
- revision.parseBody();
- } catch (IOException e) {
- Activator.error("Error parsing body", e); //$NON-NLS-1$
- continue;
- }
-
- if (findInCommitId) {
- String contentId = revision.getId().name();
- if (contentId != null) {
- if (ignoreCase) {
- contentId = contentId.toLowerCase();
- }
- if (contentId.indexOf(findPattern) != -1) {
- totalMatches++;
- findResults.add(i, revision);
- notFound = false;
- }
- }
- }
-
- if (findInComments && notFound) {
- String comment = revision.getFullMessage();
- if (comment != null) {
- if (ignoreCase) {
- comment = comment.toLowerCase();
- }
- if (comment.indexOf(findPattern) != -1) {
- totalMatches++;
- findResults.add(i, revision);
- notFound = false;
- }
- }
- }
-
- if (findInAuthor && notFound) {
- String author = revision.getAuthorIdent().getName();
- if (author != null) {
- if (ignoreCase) {
- author = author.toLowerCase();
- }
- if (author.indexOf(findPattern) != -1) {
- totalMatches++;
- findResults.add(i, revision);
- notFound = false;
- }
- }
- if (notFound) {
- String email = revision.getAuthorIdent()
- .getEmailAddress();
- if (email != null) {
- if (ignoreCase) {
- email = email.toLowerCase();
- }
- if (email.indexOf(findPattern) != -1) {
- totalMatches++;
- findResults.add(i, revision);
- notFound = false;
- }
- }
- }
- }
-
- if (findInCommitter && notFound) {
- String committer = revision.getCommitterIdent().getName();
- if (committer != null) {
- if (ignoreCase) {
- committer = committer.toLowerCase();
- }
- if (committer.indexOf(findPattern) != -1) {
- totalMatches++;
- findResults.add(i, revision);
- notFound = false;
- }
- }
- if (notFound) {
- String email = revision.getCommitterIdent()
- .getEmailAddress();
- if (email != null) {
- if (ignoreCase) {
- email = email.toLowerCase();
- }
- if (email.indexOf(findPattern) != -1) {
- totalMatches++;
- findResults.add(i, revision);
- notFound = false;
- }
- }
- }
- }
-
- if (findInReference && notFound) {
- if (revision.getRefCount() > 0) {
- for (int j = 0; j < revision.getRefCount(); j++) {
- Ref ref = revision.getRef(j);
- String refName = ref.getName();
- refName = Repository.shortenRefName(refName);
- if (ignoreCase)
- refName = refName.toLowerCase();
- if (refName.indexOf(findPattern) != -1) {
- totalMatches++;
- findResults.add(i, revision);
- notFound = false;
- }
- }
- }
- }
-
- if (totalMatches == MAX_RESULTS) {
- maxResultsOverflow = true;
- break;
- }
- }
-
- }
-
- // Updates the toolbar with the result find info.
- final boolean overflow = maxResultsOverflow;
- toolbar.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- if (toolbar.isDisposed()) {
- return;
- }
- toolbar.findCompletionUpdate(pattern, overflow);
- }
- });
- }
-
- static void updateGlobalThreadIx() {
- ++globalThreadIx;
- }
-}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/IFindListener.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/IFindListener.java
new file mode 100644
index 0000000..38b6546
--- /dev/null
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/IFindListener.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (C) 2016, Thomas Wolf <thomas.wolf@paranor.ch>
+ *
+ * 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.history;
+
+import org.eclipse.jgit.revwalk.RevObject;
+
+/**
+ * Listener interface to listen for changes in a {@link FindResults} object.
+ */
+public interface IFindListener {
+
+ /**
+ * Called when an item has been added.
+ *
+ * @param index
+ * table index of the new item
+ * @param rev
+ * of the new item
+ */
+ void itemAdded(int index, RevObject rev);
+
+ /**
+ * Called when an item has been removed.
+ */
+ void cleared();
+}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java
index 11db83f..5562f52 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java
@@ -26,9 +26,8 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.egit.core.Activator;
import org.eclipse.egit.core.AdapterUtils;
-import org.eclipse.egit.core.project.RepositoryMapping;
+import org.eclipse.egit.core.internal.util.ResourceUtil;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.internal.history.GitHistoryPage;
import org.eclipse.egit.ui.internal.history.HistoryPageInput;
@@ -82,25 +81,11 @@
if (input instanceof RepositoryTreeNode) {
return ((RepositoryTreeNode) input).getRepository();
}
- if (input instanceof IResource) {
- IResource resource = (IResource) input;
- RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
- if (mapping != null) {
- return mapping.getRepository();
- }
- // for closed projects team framework doesn't allow to get mapping
- // so try again using a path based approach
- Repository repository = Activator.getDefault().getRepositoryCache()
- .getRepository(resource);
- if (repository != null) {
- return repository;
- }
- }
IResource resource = AdapterUtils.adapt(input, IResource.class);
if (resource != null) {
- RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
- if (mapping != null) {
- return mapping.getRepository();
+ Repository repository = ResourceUtil.getRepository(resource);
+ if (repository != null) {
+ return repository;
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/HistoryViewCommands.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/HistoryViewCommands.java
index db567e1..de28d88 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/HistoryViewCommands.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/HistoryViewCommands.java
@@ -42,7 +42,7 @@
public static final String DELETE_BRANCH = "org.eclipse.egit.ui.history.DeleteBranch"; //$NON-NLS-1$
/** "Rename Branch" */
- public static final String RENAME_BRANCH = "org.eclipse.egit.ui.history.RenameBranch"; //$NON-NLS-1$
+ public static final String RENAME_BRANCH = "org.eclipse.ui.edit.rename"; //$NON-NLS-1$
/** "Create Patch" */
public static final String CREATE_PATCH = "org.eclipse.egit.ui.history.CreatePatch"; //$NON-NLS-1$
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/jobs/RepositoryJob.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/jobs/RepositoryJob.java
new file mode 100644
index 0000000..f41fc28
--- /dev/null
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/jobs/RepositoryJob.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Thomas Wolf <thomas.wolf@paranor.ch>
+ * 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.jobs;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.egit.ui.Activator;
+import org.eclipse.egit.ui.internal.UIText;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.progress.IProgressConstants;
+
+/**
+ * A {@link Job} operating (solely) on a repository, reporting some result
+ * beyond a mere {@link IStatus} back to the user via an {@link IAction}. If the
+ * job is running in a dialog when its {@link #performJob(IProgressMonitor)}
+ * method returns, the action is invoked directly in the display thread,
+ * otherwise {@link IProgressConstants#ACTION_PROPERTY} is used to associate the
+ * action with the finished job and eventual display of the result is left to
+ * the progress reporting framework.
+ */
+public abstract class RepositoryJob extends Job {
+
+ /**
+ * Creates a new {@link RepositoryJob}.
+ *
+ * @param name
+ * of the job.
+ */
+ public RepositoryJob(String name) {
+ super(name);
+ }
+
+ @Override
+ protected final IStatus run(IProgressMonitor monitor) {
+ IStatus status = performJob(monitor);
+ if (status == null) {
+ return Activator
+ .createErrorStatus(
+ MessageFormat.format(
+ UIText.RepositoryJob_NullStatus, getName()),
+ new NullPointerException());
+ } else if (!status.isOK()) {
+ return status;
+ }
+ IAction action = getAction();
+ if (action != null) {
+ if (isModal()) {
+ showResult(action);
+ } else {
+ setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
+ setProperty(IProgressConstants.ACTION_PROPERTY, action);
+ return new Status(IStatus.OK, Activator.getPluginId(),
+ IStatus.OK, action.getText(), null);
+ }
+ }
+ return status;
+ }
+
+ /**
+ * Performs the actual work of the job.
+ *
+ * @param monitor
+ * for progress reporting and cancellation.
+ * @return an {@link IStatus} describing the outcome of the job
+ */
+ abstract protected IStatus performJob(IProgressMonitor monitor);
+
+ /**
+ * Obtains an {@link IAction} to report the full job result if
+ * {@link #performJob(IProgressMonitor)} returned an {@link IStatus#isOK()
+ * isOK()} status.
+ *
+ * @return the action, or {@code null} if no action is to be taken
+ */
+ abstract protected IAction getAction();
+
+ private boolean isModal() {
+ Boolean modal = (Boolean) getProperty(
+ IProgressConstants.PROPERTY_IN_DIALOG);
+ return modal != null && modal.booleanValue();
+ }
+
+ private void showResult(final IAction action) {
+ final Display display = PlatformUI.getWorkbench().getDisplay();
+ if (display != null) {
+ display.asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (!display.isDisposed()) {
+ action.run();
+ }
+ }
+ });
+ }
+ }
+}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/jobs/RepositoryJobResultAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/jobs/RepositoryJobResultAction.java
new file mode 100644
index 0000000..4ad0dd8
--- /dev/null
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/jobs/RepositoryJobResultAction.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Thomas Wolf <thomas.wolf@paranor.ch>
+ * 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.jobs;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.MessageFormat;
+
+import org.eclipse.egit.core.RepositoryCache;
+import org.eclipse.egit.ui.Activator;
+import org.eclipse.egit.ui.internal.UIText;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jgit.annotations.NonNull;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.RepositoryCache.FileKey;
+import org.eclipse.jgit.util.FS;
+
+/**
+ * An {@link Action} to report some background job result.
+ */
+public abstract class RepositoryJobResultAction extends Action {
+
+ /**
+ * Because this action may be associated with a job and may be invoked long
+ * after the repository operation had been performed we do not keep a
+ * reference to the {@link Repository} here. The repository might have been
+ * deleted in the meantime.
+ */
+ private final File repositoryDir;
+
+ private boolean repositoryGone;
+
+ /**
+ * Creates a new {@link RepositoryJobResultAction}.
+ *
+ * @param repository
+ * the result belongs to
+ * @param title
+ * of the action
+ */
+ public RepositoryJobResultAction(@NonNull Repository repository,
+ String title) {
+ super(title);
+ this.repositoryDir = repository.getDirectory();
+ }
+
+ @Override
+ public final void run() {
+ Repository repo = null;
+ if (!repositoryGone) {
+ RepositoryCache repoCache = org.eclipse.egit.core.Activator
+ .getDefault().getRepositoryCache();
+ repo = repoCache.getRepository(repositoryDir);
+ if (repo == null
+ && FileKey.isGitRepository(repositoryDir, FS.DETECTED)) {
+ // No longer in the Egit cache but still on disk
+ try {
+ repo = repoCache.lookupRepository(repositoryDir);
+ } catch (IOException e) {
+ // Ignore, repo remains null
+ }
+ }
+ repositoryGone = repo == null;
+ }
+ if (repositoryGone || repo == null) {
+ Activator.showError(MessageFormat.format(
+ UIText.RepositoryJobResultAction_RepositoryGone,
+ repositoryDir), null);
+ return;
+ }
+ showResult(repo);
+ }
+
+ /**
+ * Shows the job result to the user.
+ *
+ * @param repository
+ * the result belongs to
+ */
+ abstract protected void showResult(@NonNull Repository repository);
+}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushOperationUI.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushOperationUI.java
index 862d993..c948725 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushOperationUI.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushOperationUI.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 SAP AG and others.
+ * Copyright (c) 2011, 2016 SAP AG and others.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Mathias Kinzler (SAP AG) - initial implementation
+ * Thomas Wolf <thomas.wolf@paranor.ch> - Bug 495512
*******************************************************************************/
package org.eclipse.egit.ui.internal.push;
@@ -20,9 +21,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.egit.core.op.PushOperation;
import org.eclipse.egit.core.op.PushOperationResult;
import org.eclipse.egit.core.op.PushOperationSpecification;
@@ -31,6 +30,8 @@
import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider;
+import org.eclipse.egit.ui.internal.jobs.RepositoryJob;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.CredentialsProvider;
@@ -221,12 +222,19 @@
* completion
*/
public void start() {
- Job job = new Job(NLS.bind(UIText.PushOperationUI_PushJobName,
+ final Repository repo = repository;
+ if (repo == null) {
+ return;
+ }
+ Job job = new RepositoryJob(NLS.bind(UIText.PushOperationUI_PushJobName,
destinationString)) {
+
+ private PushOperationResult result;
+
@Override
- protected IStatus run(IProgressMonitor monitor) {
+ protected IStatus performJob(IProgressMonitor monitor) {
try {
- execute(monitor);
+ result = execute(monitor);
} catch (CoreException e) {
return Activator.createErrorStatus(e.getStatus()
.getMessage(), e);
@@ -235,28 +243,25 @@
}
@Override
+ protected IAction getAction() {
+ if (expectedResult == null || !expectedResult.equals(result)) {
+ return new ShowPushResultAction(repo, result,
+ destinationString, showConfigureButton);
+ }
+ return null;
+ }
+
+ @Override
public boolean belongsTo(Object family) {
- if (JobFamilies.PUSH.equals(family))
+ if (JobFamilies.PUSH.equals(family)) {
return true;
+ }
return super.belongsTo(family);
}
+
};
job.setUser(true);
job.schedule();
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- PushOperationResult result = op.getOperationResult();
- if (expectedResult == null || !expectedResult.equals(result)) {
- if (event.getResult().isOK())
- PushResultDialog.show(repository, result,
- destinationString, showConfigureButton, false);
- else
- Activator.handleError(event.getResult().getMessage(),
- event.getResult().getException(), true);
- }
- }
- });
}
/**
@@ -270,4 +275,5 @@
return Activator.getDefault().getPreferenceStore()
.getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT);
}
+
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushWizard.java
index e9a2025..ebf1cd5 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushWizard.java
@@ -2,6 +2,7 @@
* Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
* Copyright (C) 2010, Mathias Kinzler <mathias.kinzler@sap.com>
* Copyright (C) 2012, Robin Stocker <robin@nibor.org>
+ * Copyright (C) 2016, Thomas Wolf <thomas.wolf@paranor.ch>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -26,6 +27,7 @@
import org.eclipse.egit.core.op.PushOperationSpecification;
import org.eclipse.egit.core.securestorage.UserPasswordCredentials;
import org.eclipse.egit.ui.Activator;
+import org.eclipse.egit.ui.JobFamilies;
import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.internal.SecureStoreUtils;
import org.eclipse.egit.ui.internal.UIIcons;
@@ -34,6 +36,8 @@
import org.eclipse.egit.ui.internal.components.RepositorySelection;
import org.eclipse.egit.ui.internal.components.RepositorySelectionPage;
import org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider;
+import org.eclipse.egit.ui.internal.jobs.RepositoryJob;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
@@ -268,7 +272,7 @@
return destination;
}
- static class PushJob extends Job {
+ static class PushJob extends RepositoryJob {
private final PushOperation operation;
private final PushOperationResult resultToCompare;
@@ -277,6 +281,8 @@
private Repository localDb;
+ private PushOperationResult operationResult;
+
public PushJob(final Repository localDb, final PushOperation operation,
final PushOperationResult resultToCompare,
final String destinationString) {
@@ -289,7 +295,7 @@
}
@Override
- protected IStatus run(final IProgressMonitor monitor) {
+ protected IStatus performJob(final IProgressMonitor monitor) {
try {
operation.run(monitor);
} catch (final InvocationTargetException e) {
@@ -297,18 +303,34 @@
UIText.PushWizard_unexpectedError, e.getCause());
}
- final PushOperationResult result = operation.getOperationResult();
- if (!result.isSuccessfulConnectionForAnyURI()) {
- return new Status(IStatus.ERROR, Activator.getPluginId(), NLS
- .bind(UIText.PushWizard_cantConnectToAny, result
- .getErrorStringForAllURis()));
+ operationResult = operation.getOperationResult();
+ if (!operationResult.isSuccessfulConnectionForAnyURI()) {
+ return new Status(IStatus.ERROR, Activator.getPluginId(),
+ NLS.bind(UIText.PushWizard_cantConnectToAny,
+ operationResult.getErrorStringForAllURis()));
}
- if (resultToCompare == null || !result.equals(resultToCompare)) {
- PushResultDialog.show(localDb, result, destinationString, true,
- false);
- }
return Status.OK_STATUS;
}
+
+ @Override
+ protected IAction getAction() {
+ Repository repo = localDb;
+ if (repo != null && (resultToCompare == null
+ || !resultToCompare.equals(operationResult))) {
+ return new ShowPushResultAction(repo, operationResult,
+ destinationString, true);
+ }
+ return null;
+ }
+
+ @Override
+ public boolean belongsTo(Object family) {
+ if (JobFamilies.PUSH.equals(family)) {
+ return true;
+ }
+ return super.belongsTo(family);
+ }
+
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/ShowPushResultAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/ShowPushResultAction.java
new file mode 100644
index 0000000..b5e101c
--- /dev/null
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/ShowPushResultAction.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Thomas Wolf <thomas.wolf@paranor.ch>
+ * 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.push;
+
+import org.eclipse.egit.core.op.PushOperationResult;
+import org.eclipse.egit.ui.internal.UIText;
+import org.eclipse.egit.ui.internal.jobs.RepositoryJobResultAction;
+import org.eclipse.jgit.annotations.NonNull;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Action to display a {@link PushOperationResult} in a
+ * {@link PushResultDialog}.
+ */
+public class ShowPushResultAction extends RepositoryJobResultAction {
+
+ private final boolean showConfigure;
+
+ private final PushOperationResult operationResult;
+
+ private final String destination;
+
+ /**
+ * Creates a new {@link ShowPushResultAction}.
+ *
+ * @param repository
+ * the result belongs to
+ * @param result
+ * to show
+ * @param destination
+ * describing where the push went to
+ * @param showConfigureButton
+ * {@code true} to show a configure button in the
+ * {@link PushResultDialog}
+ */
+ public ShowPushResultAction(@NonNull Repository repository,
+ PushOperationResult result, String destination,
+ boolean showConfigureButton) {
+ super(repository, UIText.ShowPushResultAction_name);
+ this.operationResult = result;
+ this.destination = destination;
+ this.showConfigure = showConfigureButton;
+ }
+
+ @Override
+ protected void showResult(Repository repository) {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell();
+ PushResultDialog dialog = new PushResultDialog(shell, repository,
+ operationResult, destination, false);
+ dialog.showConfigureButton(showConfigure);
+ dialog.open();
+ }
+}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositorySearchDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositorySearchDialog.java
index e23508b..30d446a 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositorySearchDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositorySearchDialog.java
@@ -13,7 +13,9 @@
package org.eclipse.egit.ui.internal.repository;
import java.io.File;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.nio.file.Files;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -42,6 +44,7 @@
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.jgit.annotations.NonNull;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.RepositoryCache.FileKey;
import org.eclipse.jgit.util.FS;
@@ -103,6 +106,8 @@
private final IEclipsePreferences prefs = InstanceScope.INSTANCE
.getNode(Activator.getPluginId());
+ private boolean allowBare;
+
private static final class ContentProvider implements ITreeContentProvider {
private final Object[] children = new Object[0];
@@ -180,19 +185,23 @@
* @param existingDirs
*/
public RepositorySearchDialog(Collection<String> existingDirs) {
- this(existingDirs, false);
+ this(existingDirs, false, true);
}
/**
* @param existingDirs
- * @param fillSearch true to fill search results when initially displayed
+ * @param fillSearch
+ * true to fill search results when initially displayed
+ * @param allowBare
+ * if {@code true} allow bare repositories
*/
public RepositorySearchDialog(Collection<String> existingDirs,
- boolean fillSearch) {
- super(
- "searchPage", UIText.RepositorySearchDialog_SearchTitle, UIIcons.WIZBAN_IMPORT_REPO); //$NON-NLS-1$
+ boolean fillSearch, boolean allowBare) {
+ super("searchPage", UIText.RepositorySearchDialog_SearchTitle, //$NON-NLS-1$
+ UIIcons.WIZBAN_IMPORT_REPO);
this.fExistingDirectories.addAll(existingDirs);
this.fillSearch = fillSearch;
+ this.allowBare = allowBare;
}
/**
@@ -411,7 +420,7 @@
// check the root first
File resolved = FileKey.resolve(root, FS.DETECTED);
- if (resolved != null) {
+ if ((resolved != null) && !suppressed(root, resolved)) {
gitDirs.add(resolved.getAbsoluteFile());
monitor.setTaskName(NLS.bind(
UIText.RepositorySearchDialog_RepositoriesFound_message,
@@ -419,7 +428,7 @@
}
// check depth and if we are not in private git folder ".git" itself
- if ((depth != 0) && !root.equals(resolved)) {
+ if ((depth != 0) && !(resolved != null && isSameFile(root, resolved))) {
File[] children = root.listFiles();
for (File child : children) {
if (monitor.isCanceled()) {
@@ -435,6 +444,19 @@
}
}
+ private boolean suppressed(@NonNull File root, @NonNull File resolved) {
+ return !allowBare && !Constants.DOT_GIT.equals(resolved.getName())
+ && isSameFile(root, resolved);
+ }
+
+ private boolean isSameFile(@NonNull File f1, @NonNull File f2) {
+ try {
+ return Files.isSameFile(f1.toPath(), f2.toPath());
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
private HashSet<String> getCheckedItems() {
HashSet<String> ret = new HashSet<>();
for (Object item : fTreeViewer.getCheckedLeafElements())
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositorySearchWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositorySearchWizard.java
index c36a8d5..decaaf1 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositorySearchWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositorySearchWizard.java
@@ -25,20 +25,25 @@
private RepositorySearchDialog searchPage;
+ private boolean allowBare;
+
/**
* Create repository search wizard
*
* @param existingDirs
+ * @param allowBare
*/
- public RepositorySearchWizard(Collection<String> existingDirs) {
+ public RepositorySearchWizard(Collection<String> existingDirs,
+ boolean allowBare) {
dirs = existingDirs;
+ this.allowBare = allowBare;
setWindowTitle(UIText.RepositorySearchDialog_AddGitRepositories);
setNeedsProgressMonitor(true);
}
@Override
public void addPages() {
- searchPage = new RepositorySearchDialog(dirs, true);
+ searchPage = new RepositorySearchDialog(dirs, true, allowBare);
addPage(searchPage);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/AddCommand.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/AddCommand.java
index c66b9cc..3012839 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/AddCommand.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/AddCommand.java
@@ -31,6 +31,7 @@
import org.eclipse.egit.core.GitCorePreferences;
import org.eclipse.egit.core.JobFamilies;
import org.eclipse.egit.core.internal.CoreText;
+import org.eclipse.egit.core.internal.gerrit.GerritUtil;
import org.eclipse.egit.core.internal.job.JobUtil;
import org.eclipse.egit.core.op.ConnectProviderOperation;
import org.eclipse.egit.core.project.RepositoryFinder;
@@ -50,7 +51,7 @@
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
RepositorySearchWizard wizard = new RepositorySearchWizard(
- util.getConfiguredRepositories());
+ util.getConfiguredRepositories(), true);
WizardDialog dialog = new WizardDialog(getShell(event), wizard);
if (dialog.open() == Window.OK) {
for (String dir : wizard.getDirectories()) {
@@ -62,9 +63,11 @@
}
private void addRepository(File repositoryDir) {
+ GerritUtil.tryToAutoConfigureForGerrit(repositoryDir);
util.addConfiguredRepository(repositoryDir);
- if (doAutoShare())
+ if (doAutoShare()) {
autoShareProjects(repositoryDir);
+ }
}
private void autoShareProjects(File repositoryDir) {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/PasteCommand.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/PasteCommand.java
index 5d396ad..f44580d 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/PasteCommand.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/PasteCommand.java
@@ -91,23 +91,26 @@
if (util.addConfiguredRepository(file)) {
// let's do the auto-refresh the rest
- } else
+ } else {
errorMessage = NLS.bind(
UIText.RepositoriesView_PasteRepoAlreadyThere, content);
-
+ }
return null;
} finally {
- if (clip != null)
+ if (clip != null) {
// we must dispose ourselves
clip.dispose();
- if (errorMessage != null)
- Activator.handleError(errorMessage, null, true);
+ }
+ if (errorMessage != null) {
+ Activator.showError(errorMessage, null);
+ }
}
}
private URIish getCloneURI(String content) {
- if (content.startsWith("git clone")) //$NON-NLS-1$
+ if (content.startsWith("git clone")) { //$NON-NLS-1$
content = content.substring("git clone".length()); //$NON-NLS-1$
+ }
URIish finalURI;
try {
finalURI = new URIish(content.trim());
@@ -115,13 +118,12 @@
|| Protocol.GIT.handles(finalURI)
|| Protocol.HTTP.handles(finalURI)
|| Protocol.HTTPS.handles(finalURI)
- || Protocol.SSH.handles(finalURI))
+ || Protocol.SSH.handles(finalURI)) {
return finalURI;
- else
- return null;
+ }
} catch (URISyntaxException e) {
- Activator.handleError(e.getLocalizedMessage(), e, true);
- return null;
+ // Swallow, caller will show an error message when we return null
}
+ return null;
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
index 8845345..bb4224e 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
@@ -679,7 +679,7 @@
HistoryPage_authorDateColumn=Authored Date
HistoryPage_refreshJob=Reading history from Git repository ''{0}''
-HistoryPage_findbar_find=Find:
+HistoryPage_findbar_find=Search in history for ''{0}''
HistoryPage_findbar_next=Next
HistoryPage_findbar_previous=Previous
HistoryPage_findbar_ignorecase=Ignore Case
@@ -750,6 +750,10 @@
PushOperationUI_MultiRepositoriesDestinationString={0} repositories
PushOperationUI_PushJobName=Push to {0}
+RepositoryJob_NullStatus=Internal error: job ''{0}'' returned a null status.
+RepositoryJobResultAction_RepositoryGone=Cannot find git repository ''{0}'' anymore: result cannot be shown.
+ShowPushResultAction_name=Show Push Result...
+
PushWizard_cantConnectToAny=Can''t connect to any repository: {0}
PushWizard_cantPrepareUpdatesMessage=Can't resolve ref specifications locally (local refs changed?) or create tracking ref update.
PushWizard_cantPrepareUpdatesTitle=Preparing Ref Updates Error
@@ -929,6 +933,7 @@
FetchAction_wrongURITitle=Corrupted Configuration
FetchAction_wrongURIMessage=Remote repositories URIs configuration is corrupted.
FetchOperationUI_FetchJobName=Fetch from {0}
+FetchOperationUI_ShowFetchResult=Show Fetch Result...
FetchDestinationPage_PageTitle=Please select a fetch destination
FetchDestinationPage_CouldNotGetBranchesMessage=Could not obtain tracking branches
@@ -1354,6 +1359,7 @@
GitSelectRepositoryPage_AddTooltip=Add a Git repository from the local file system
GitSelectRepositoryPage_NoRepoFoundMessage=No repositories found, please clone or add a repository
GitSelectRepositoryPage_PageMessage=You can also clone a repository or add local repositories to the list
+GitSelectRepositoryPage_BareRepositoriesHidden=Bare repositories are not shown.
GitSelectRepositoryPage_PageTitle=Select a Git Repository
GitSelectRepositoryPage_PleaseSelectMessage=Please select a repository from the list
GitSelectWizardPage_ImportAsGeneralButton=Import as &general project
@@ -1641,10 +1647,7 @@
RemoveOrDeleteRepositoryCommand_RemoveFromViewButton=Remove from View
RenameBranchDialog_DialogMessage=Select a branch to rename
RenameBranchDialog_DialogTitle=Rename a Branch
-RenameBranchDialog_NewNameInputDialogPrompt=Enter new name of the {0} branch. {1} will be prepended to the name you type
-RenameBranchDialog_RenameBranchDialogNewNameInputWindowTitle=New Branch Name
RenameBranchDialog_RenameButtonLabel=&Rename
-RenameBranchDialog_RenameErrorMessage=Failed to rename branch {0} -> {1}, status={2}
RenameBranchDialog_WindowTitle=Branch Rename
RenameBranchOnCommitHandler_SelectBranchDialogMessage=Please select the branch you want to rename
RenameBranchOnCommitHandler_SelectBranchDialogTitle=Rename Branch
diff --git a/org.eclipse.egit/META-INF/MANIFEST.MF b/org.eclipse.egit/META-INF/MANIFEST.MF
index 22a0d2d..f3f5566 100644
--- a/org.eclipse.egit/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %plugin_name
Bundle-SymbolicName: org.eclipse.egit;singleton:=true
-Bundle-Version: 4.4.1.qualifier
+Bundle-Version: 4.5.0.qualifier
Bundle-Vendor: %provider_name
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
diff --git a/org.eclipse.egit/pom.xml b/org.eclipse.egit/pom.xml
index 2adcad1..7396731 100644
--- a/org.eclipse.egit/pom.xml
+++ b/org.eclipse.egit/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.egit</artifactId>
diff --git a/pom.xml b/pom.xml
index b62acb7..12d59f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
<groupId>org.eclipse.egit</groupId>
<artifactId>egit-parent</artifactId>
- <version>4.4.1-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>EGit Parent</name>
@@ -62,7 +62,7 @@
</licenses>
<properties>
- <egit-version>4.4.1-SNAPSHOT</egit-version>
+ <egit-version>4.5.0-SNAPSHOT</egit-version>
<tycho-version>0.23.0</tycho-version>
<tycho-extras-version>${tycho-version}</tycho-extras-version>
<jboss-tycho-plugins-version>0.22.0</jboss-tycho-plugins-version>