Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDariusz Luksza2013-02-12 13:38:24 +0000
committerMatthias Sohn2013-02-12 23:40:30 +0000
commita623b2474e958db195e34640584fa872a02cfaf0 (patch)
tree7b8875acbad1e7c3ab309f37bfa0fa044815e354
parent097b18f8a7db53dece2cacafd868e243bcc5897e (diff)
downloadegit-a623b2474e958db195e34640584fa872a02cfaf0.tar.gz
egit-a623b2474e958db195e34640584fa872a02cfaf0.tar.xz
egit-a623b2474e958db195e34640584fa872a02cfaf0.zip
Mark org.eclipse.debug.ui as optional dependency
Debug.ui dependency is used only for showing dialog with all available properties for convenient configuration of default repository folder. This also makes creating standalone EGit client harder and increase its weight. This patch mark this dependency as optional and will hide 'Variable...' button when StringVariableSelectionDialog class cannot be found on classpath. Change-Id: Ifea5bd8b94f948af8a93842d28f273a8aa89098a Signed-off-by: Dariusz Luksza <dariusz@luksza.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitPreferenceRoot.java22
2 files changed, 20 insertions, 4 deletions
diff --git a/org.eclipse.egit.ui/META-INF/MANIFEST.MF b/org.eclipse.egit.ui/META-INF/MANIFEST.MF
index 7552b339d1..edeb538c0f 100644
--- a/org.eclipse.egit.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.ui/META-INF/MANIFEST.MF
@@ -29,7 +29,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.eclipse.equinox.security;bundle-version="[1.0.0,2.0.0)",
org.eclipse.help;bundle-version="[3.4.0,4.0.0)",
org.eclipse.search;bundle-version="[3.4.0,4.0.0)";resolution:=optional,
- org.eclipse.debug.ui;bundle-version="[3.4.0,4.0.0)"
+ org.eclipse.debug.ui;bundle-version="[3.4.0,4.0.0)";resolution:=optional
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.eclipse.egit.core;version="[2.3.0,2.4.0)",
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitPreferenceRoot.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitPreferenceRoot.java
index ccdba0af35..666ce338d6 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitPreferenceRoot.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitPreferenceRoot.java
@@ -2,6 +2,7 @@
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2010, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2010, Mathias Kinzler <mathias.kinzler@sap.com>
+ * Copyright (C) 2013, Dariusz Luksza <dariusz.luksza@gmail.com>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -15,8 +16,6 @@ import java.io.File;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
-
-import org.eclipse.debug.ui.StringVariableSelectionDialog;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.UIText;
@@ -47,6 +46,8 @@ public class GitPreferenceRoot extends FieldEditorPreferencePage implements
private final static String[][] MERGE_MODE_NAMES_AND_VALUES = new String[3][2];
+ private final static boolean HAS_DEBUG_UI = hasDebugUiBundle();
+
static {
MERGE_MODE_NAMES_AND_VALUES[0][0] = UIText.GitPreferenceRoot_MergeMode_0_Label;
MERGE_MODE_NAMES_AND_VALUES[0][1] = "0";//$NON-NLS-1$
@@ -131,12 +132,18 @@ public class GitPreferenceRoot extends FieldEditorPreferencePage implements
super.createControl(parent);
+ if (HAS_DEBUG_UI)
+ addVariablesButton(parent);
+ }
+
+ private void addVariablesButton(Composite parent) {
Button variableButton = new Button(parent, SWT.PUSH);
variableButton.setText(UIText.GitPreferenceRoot_DefaultRepoFolderVariableButton);
variableButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
+ org.eclipse.debug.ui.StringVariableSelectionDialog dialog = new org.eclipse.debug.ui.StringVariableSelectionDialog(
+ getShell());
int returnCode = dialog.open();
if (returnCode == Window.OK)
setStringValue(dialog.getVariableExpression());
@@ -215,4 +222,13 @@ public class GitPreferenceRoot extends FieldEditorPreferencePage implements
layout.marginWidth = 5;
layout.marginHeight = 5;
}
+
+ private static final boolean hasDebugUiBundle() {
+ try {
+ return Class
+ .forName("org.eclipse.debug.ui.StringVariableSelectionDialog") != null; //$NON-NLS-1$
+ } catch (ClassNotFoundException e) {
+ return false;
+ }
+ }
}

Back to the top