diff --git a/de.weingardt.mylyn.gitlab.core/META-INF/MANIFEST.MF b/de.weingardt.mylyn.gitlab.core/META-INF/MANIFEST.MF
index 2b1ffa3..f062f1e 100644
--- a/de.weingardt.mylyn.gitlab.core/META-INF/MANIFEST.MF
+++ b/de.weingardt.mylyn.gitlab.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mylyn Gitlab Connector Core
Bundle-SymbolicName: de.weingardt.mylyn.gitlab.core;singleton:=true
-Bundle-Version: 1.5.0
+Bundle-Version: 1.6.0
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.mylyn.commons.core;bundle-version="[3.8.0,4.0.0)",
org.eclipse.mylyn.commons.net;bundle-version="[3.8.0,4.0.0)",
diff --git a/de.weingardt.mylyn.gitlab.core/pom.xml b/de.weingardt.mylyn.gitlab.core/pom.xml
index 368e3fa..73b452c 100644
--- a/de.weingardt.mylyn.gitlab.core/pom.xml
+++ b/de.weingardt.mylyn.gitlab.core/pom.xml
@@ -6,7 +6,7 @@
../pom.xml
de.weingardt.mylyn.gitlab
de.weingardt.mylyn.gitlab-parent
- 1.5.0
+ 1.6.0
de.weingardt.mylyn.gitlab.core
diff --git a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/ConnectionManager.java b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/ConnectionManager.java
index ece7615..fab78e5 100644
--- a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/ConnectionManager.java
+++ b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/ConnectionManager.java
@@ -79,13 +79,29 @@ private static String constructURL(TaskRepository repository) {
*/
static GitlabConnection validate(TaskRepository repository) throws GitlabException {
try {
- Matcher matcher = URLPattern.matcher(repository.getUrl());
- if(!matcher.find()) {
- throw new GitlabException("Invalid Project-URL!");
+ String projectPath = null;
+ String host = null;
+
+ if(repository.getProperty("gitlabBaseUrl").trim().length() > 0) {
+ host = repository.getProperty("gitlabBaseUrl").trim();
+ if(!repository.getUrl().startsWith(host)) {
+ throw new GitlabException("Invalid project URL!");
+ }
+
+ projectPath = repository.getUrl().replaceFirst(Matcher.quoteReplacement(host), "");
+ if(projectPath.startsWith("/")) {
+ projectPath = projectPath.substring(1);
+ }
+ } else {
+ Matcher matcher = URLPattern.matcher(repository.getUrl());
+ if(!matcher.find()) {
+ throw new GitlabException("Invalid Project-URL!");
+ }
+
+ projectPath = matcher.group(2);
+ host = matcher.group(1);
}
- String projectPath = matcher.group(2);
- String host = matcher.group(1);
String username = repository.getCredentials(AuthenticationType.REPOSITORY).getUserName();
String password= repository.getCredentials(AuthenticationType.REPOSITORY).getPassword();
diff --git a/de.weingardt.mylyn.gitlab.ui/META-INF/MANIFEST.MF b/de.weingardt.mylyn.gitlab.ui/META-INF/MANIFEST.MF
index 59b9f96..dd7a2b8 100644
--- a/de.weingardt.mylyn.gitlab.ui/META-INF/MANIFEST.MF
+++ b/de.weingardt.mylyn.gitlab.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mylyn Gitlab Connector UI
Bundle-SymbolicName: de.weingardt.mylyn.gitlab.ui;singleton:=true
-Bundle-Version: 1.5.0
+Bundle-Version: 1.6.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
diff --git a/de.weingardt.mylyn.gitlab.ui/pom.xml b/de.weingardt.mylyn.gitlab.ui/pom.xml
index 956d7d5..9e8796f 100644
--- a/de.weingardt.mylyn.gitlab.ui/pom.xml
+++ b/de.weingardt.mylyn.gitlab.ui/pom.xml
@@ -5,7 +5,7 @@
../pom.xml
de.weingardt.mylyn.gitlab
de.weingardt.mylyn.gitlab-parent
- 1.5.0
+ 1.6.0
de.weingardt.mylyn.gitlab.ui
diff --git a/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabRepositorySettingsPage.java b/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabRepositorySettingsPage.java
index aca3007..b466c5a 100644
--- a/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabRepositorySettingsPage.java
+++ b/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabRepositorySettingsPage.java
@@ -23,6 +23,8 @@
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
import de.weingardt.mylyn.gitlab.core.GitlabConnector;
import de.weingardt.mylyn.gitlab.core.GitlabPluginCore;
@@ -30,11 +32,13 @@
public class GitlabRepositorySettingsPage extends AbstractRepositorySettingsPage {
private Button useToken;
-
+
+ private Text gitlabBaseUrl;
+
public GitlabRepositorySettingsPage(String title, String description,
TaskRepository taskRepository) {
super(title, description, taskRepository);
-
+
setNeedsValidateOnFinish(true);
}
@@ -47,29 +51,44 @@ protected void createAdditionalControls(final Composite composite) {
GridDataFactory.fillDefaults().span(2, 1).applyTo(useToken);
useToken.addSelectionListener(new SelectionAdapter() {
-
+
@Override
public void widgetSelected(SelectionEvent e) {
setUsernameFieldEnabled(!useToken.getSelection());
getWizard().getContainer().updateButtons();
}
-
+
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
-
+
+ Label l = new Label(composite, SWT.NONE);
+ l.setText("Gitlab base URL");
+
+ gitlabBaseUrl = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ GridDataFactory.fillDefaults().span(1, 1).applyTo(gitlabBaseUrl);
+
+ /**
+ * Set widget texts and check boxes if necessary.
+ */
if (serverUrlCombo.getText().length() == 0) {
// This means, that there the user is *not* editing an existing repository configuration
serverUrlCombo.setText("https://your-host.org/namespace/project.git");
- } else {
- if(getRepository().getProperty("usePrivateToken").equals("true")) {
+ }
+
+ if(getRepository() != null) {
+ if("true".equals(getRepository().getProperty("usePrivateToken"))) {
useToken.setSelection(true);
setUsernameFieldEnabled(false);
}
+
+ if(getRepository().getProperty("gitlabBaseUrl") != null) {
+ gitlabBaseUrl.setText(getRepository().getProperty("gitlabBaseUrl"));
+ }
}
}
-
+
private void setUsernameFieldEnabled(boolean enabled) {
if(enabled) {
repositoryUserNameEditor.getTextControl(compositeContainer).setEnabled(true);
@@ -80,7 +99,7 @@ private void setUsernameFieldEnabled(boolean enabled) {
repositoryUserNameEditor.setStringValue("");
repositoryUserNameEditor.getTextControl(compositeContainer).setEnabled(false);
repositoryUserNameEditor.setEmptyStringAllowed(true);
- repositoryPasswordEditor.setLabelText("Private token:");
+ repositoryPasswordEditor.setLabelText("Private token:");
compositeContainer.layout();
}
}
@@ -95,7 +114,7 @@ public TaskRepository createTaskRepository() {
TaskRepository repo = super.createTaskRepository();
return repo;
}
-
+
@Override
public void applyTo(TaskRepository repository) {
repository.setCategory(TaskRepository.CATEGORY_BUGS);
@@ -105,8 +124,11 @@ public void applyTo(TaskRepository repository) {
} else {
repository.setProperty("usePrivateToken", "false");
}
+
+ repository.setProperty("gitlabBaseUrl", gitlabBaseUrl.getText());
+
}
-
+
@Override
protected boolean isMissingCredentials() {
if(useToken != null && useToken.getSelection()) {
@@ -115,7 +137,7 @@ protected boolean isMissingCredentials() {
return super.isMissingCredentials();
}
}
-
+
@Override
protected Validator getValidator(final TaskRepository repository) {
return new Validator() {
@@ -124,7 +146,7 @@ protected Validator getValidator(final TaskRepository repository) {
public void run(IProgressMonitor monitor) throws CoreException {
GitlabConnector.validate(repository);
}
-
+
};
}
diff --git a/de.weingardt.mylyn.gitlab.updatesite/category.xml b/de.weingardt.mylyn.gitlab.updatesite/category.xml
index 839e29b..3ce6320 100644
--- a/de.weingardt.mylyn.gitlab.updatesite/category.xml
+++ b/de.weingardt.mylyn.gitlab.updatesite/category.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/de.weingardt.mylyn.gitlab.updatesite/pom.xml b/de.weingardt.mylyn.gitlab.updatesite/pom.xml
index fc42703..320c73a 100644
--- a/de.weingardt.mylyn.gitlab.updatesite/pom.xml
+++ b/de.weingardt.mylyn.gitlab.updatesite/pom.xml
@@ -5,7 +5,7 @@
../pom.xml
de.weingardt.mylyn.gitlab
de.weingardt.mylyn.gitlab-parent
- 1.5.0
+ 1.6.0
de.weingardt.mylyn.gitlab.updatesite
diff --git a/de.weingardt.mylyn.gitlab/feature.xml b/de.weingardt.mylyn.gitlab/feature.xml
index 460eeba..4fcf2e6 100644
--- a/de.weingardt.mylyn.gitlab/feature.xml
+++ b/de.weingardt.mylyn.gitlab/feature.xml
@@ -2,7 +2,7 @@
@@ -21,14 +21,14 @@
id="de.weingardt.mylyn.gitlab.core"
download-size="0"
install-size="0"
- version="1.5.0"
+ version="1.6.0"
unpack="false"/>
diff --git a/de.weingardt.mylyn.gitlab/pom.xml b/de.weingardt.mylyn.gitlab/pom.xml
index f7fb4d7..485f828 100644
--- a/de.weingardt.mylyn.gitlab/pom.xml
+++ b/de.weingardt.mylyn.gitlab/pom.xml
@@ -6,7 +6,7 @@
../pom.xml
de.weingardt.mylyn.gitlab
de.weingardt.mylyn.gitlab-parent
- 1.5.0
+ 1.6.0
de.weingardt.mylyn.gitlab
diff --git a/pom.xml b/pom.xml
index c3068b9..0f22847 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
de.weingardt.mylyn.gitlab
de.weingardt.mylyn.gitlab-parent
- 1.5.0
+ 1.6.0
pom