Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2012-10-17 00:08:33 +0000
committerMatthias Sohn2012-10-17 23:05:26 +0000
commit0d264c63788cd6607fe3a83c62f6af5e2d85bc7d (patch)
tree7bc7817b2f4acffd4cc766ff65abb7b52ff77f09
parent33f55cf7dfc6fc8ed88c596efc7f4748f474cfcb (diff)
downloadegit-0d264c63788cd6607fe3a83c62f6af5e2d85bc7d.tar.gz
egit-0d264c63788cd6607fe3a83c62f6af5e2d85bc7d.tar.xz
egit-0d264c63788cd6607fe3a83c62f6af5e2d85bc7d.zip
Do not show modal warning dialog on plugin start
Do not open a modal dialog on plugin start but log a warning instead. Writing these log entries can be suppressed in preference settings. Bug: 391377 Change-Id: I3b0da8483e47f5119a3a91580771cdb4a3b7640f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/plugin.properties2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java19
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java15
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ConfigurationChecker.java34
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/DialogsPreferencePage.java36
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties20
6 files changed, 66 insertions, 60 deletions
diff --git a/org.eclipse.egit.ui/plugin.properties b/org.eclipse.egit.ui/plugin.properties
index 091a121585..142f6d64f4 100644
--- a/org.eclipse.egit.ui/plugin.properties
+++ b/org.eclipse.egit.ui/plugin.properties
@@ -318,7 +318,7 @@ RepositoriesViewContext.name= In Git Repositories View
SwitchToMenu.label = S&witch To
-DialogsPreferencePage.name = Confirmation Dialogs
+DialogsPreferencePage.name = Confirmations and Warnings
SynchronizePreferencePage.name = Synchronize
HistoryPreferencePage.name = History
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
index f4c41425fa..21731b3684 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
@@ -2,6 +2,7 @@
* Copyright (C) 2007,2010 Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2010, Mathias Kinzler <mathias.kinzler@sap.com>
+ * Copyright (C) 2012, Matthias Sohn <matthias.sohn@sap.com>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -107,7 +108,23 @@ public class Activator extends AbstractUIPlugin implements DebugOptionsListener
*/
public static void handleError(String message, Throwable throwable,
boolean show) {
- IStatus status = new Status(IStatus.ERROR, getPluginId(), message,
+ handleIssue(IStatus.ERROR, message, throwable, show);
+ }
+
+ /**
+ * Handle an issue. The issue is logged. If <code>show</code> is
+ * <code>true</code> the issue is shown to the user.
+ *
+ * @param severity
+ * status severity, use constants defined in {@link IStatus}
+ * @param message
+ * a localized message
+ * @param throwable
+ * @param show
+ */
+ public static void handleIssue(int severity, String message, Throwable throwable,
+ boolean show) {
+ IStatus status = new Status(severity, getPluginId(), message,
throwable);
int style = StatusManager.LOG;
if (show)
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
index 1fb89525bc..1a24ac744f 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
@@ -1974,21 +1974,9 @@ public class UIText extends NLS {
public static String ConfigurationChecker_gitPrefixWarningMessage;
/** */
- public static String ConfigurationChecker_gitPrefixWarningTitle;
-
- /** */
- public static String ConfigurationChecker_checkHomeDirectory;
-
- /** */
public static String ConfigurationChecker_checkConfiguration;
/** */
- public static String ConfigurationChecker_doNotShowAgain;
-
- /** */
- public static String ConfigurationChecker_doNotShowGitPrefixWarningAgain;
-
- /** */
public static String ConfigurationChecker_homeNotSet;
/** */
@@ -3075,6 +3063,9 @@ public class UIText extends NLS {
public static String DialogsPreferencePage_HideConfirmationGroupHeader;
/** */
+ public static String DialogsPreferencePage_HideWarningGroupHeader;
+
+ /** */
public static String DialogsPreferencePage_HomeDirWarning;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ConfigurationChecker.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ConfigurationChecker.java
index 175096aa67..bdba80fec5 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ConfigurationChecker.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ConfigurationChecker.java
@@ -1,5 +1,6 @@
/*******************************************************************************
* Copyright (C) 2010, Jens Baumgart <jens.baumgart@sap.com>
+ * Copyright (C) 2012, Matthias Sohn <matthias.sohn@sap.com>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -17,7 +18,6 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.UIText;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.SystemReader;
@@ -63,20 +63,10 @@ public class ConfigurationChecker {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
boolean hidden = !store
.getBoolean(UIPreferences.SHOW_GIT_PREFIX_WARNING);
- if (!hidden) {
- if (FS.DETECTED.gitPrefix() == null) {
- MessageDialogWithToggle dialog = MessageDialogWithToggle
- .openInformation(
- PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell(),
- UIText.ConfigurationChecker_gitPrefixWarningTitle,
- UIText.ConfigurationChecker_gitPrefixWarningMessage,
- UIText.ConfigurationChecker_doNotShowGitPrefixWarningAgain,
- false, null, null);
- store.setValue(UIPreferences.SHOW_GIT_PREFIX_WARNING,
- !dialog.getToggleState());
- }
- }
+ if (!hidden && FS.DETECTED.gitPrefix() == null)
+ Activator.handleIssue(IStatus.WARNING,
+ UIText.ConfigurationChecker_gitPrefixWarningMessage, null,
+ false);
}
private static void checkHome() {
@@ -84,21 +74,11 @@ public class ConfigurationChecker {
if (home != null)
return; // home is set => ok
home = calcHomeDir();
-
- String title = NLS.bind(UIText.ConfigurationChecker_checkHomeDirectory,
- home);
String message = NLS.bind(UIText.ConfigurationChecker_homeNotSet, home);
- String toggleMessage = UIText.ConfigurationChecker_doNotShowAgain;
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
boolean hidden = !store.getBoolean(UIPreferences.SHOW_HOME_DIR_WARNING);
- if (!hidden) {
- MessageDialogWithToggle dialog = MessageDialogWithToggle
- .openInformation(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell(), title,
- message, toggleMessage, false, null, null);
- store.setValue(UIPreferences.SHOW_HOME_DIR_WARNING, !dialog
- .getToggleState());
- }
+ if (!hidden)
+ Activator.handleIssue(IStatus.WARNING, message, null, false);
}
private static String calcHomeDir() {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/DialogsPreferencePage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/DialogsPreferencePage.java
index f888705121..16ca1f8025 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/DialogsPreferencePage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/DialogsPreferencePage.java
@@ -46,33 +46,43 @@ public class DialogsPreferencePage extends FieldEditorPreferencePage implements
protected void createFieldEditors() {
Composite main = getFieldEditorParent();
- Group confirmGroup = new Group(main, SWT.SHADOW_ETCHED_IN);
+ Group confirmDialogsGroup = new Group(main, SWT.SHADOW_ETCHED_IN);
GridDataFactory.fillDefaults().grab(true, false).span(GROUP_SPAN, 1)
- .applyTo(confirmGroup);
- confirmGroup
+ .applyTo(confirmDialogsGroup);
+ confirmDialogsGroup
.setText(UIText.DialogsPreferencePage_HideConfirmationGroupHeader);
GridDataFactory.fillDefaults().grab(true, false).span(GROUP_SPAN, 1)
- .applyTo(confirmGroup);
+ .applyTo(confirmDialogsGroup);
addField(new BooleanFieldEditor(
UIPreferences.SHOW_INITIAL_CONFIG_DIALOG,
UIText.DialogsPreferencePage_ShowInitialConfigCheckbox,
- confirmGroup));
+ confirmDialogsGroup));
addField(new BooleanFieldEditor(UIPreferences.SHOW_REBASE_CONFIRM,
- UIText.DialogsPreferencePage_RebaseCheckbox, confirmGroup));
+ UIText.DialogsPreferencePage_RebaseCheckbox, confirmDialogsGroup));
addField(new BooleanFieldEditor(
UIPreferences.SHOW_DETACHED_HEAD_WARNING,
- UIText.DialogsPreferencePage_DetachedHeadCombo, confirmGroup));
- addField(new BooleanFieldEditor(UIPreferences.SHOW_HOME_DIR_WARNING,
- UIText.DialogsPreferencePage_HomeDirWarning, confirmGroup));
- addField(new BooleanFieldEditor(UIPreferences.SHOW_GIT_PREFIX_WARNING,
- UIText.DialogsPreferencePage_GitPrefixWarning, confirmGroup));
+ UIText.DialogsPreferencePage_DetachedHeadCombo, confirmDialogsGroup));
addField(new BooleanFieldEditor(
UIPreferences.CLONE_WIZARD_SHOW_DETAILED_FAILURE_DIALOG,
UIText.DialogsPreferencePage_ShowCloneFailedDialog,
- confirmGroup));
- updateMargins(confirmGroup);
+ confirmDialogsGroup));
+ updateMargins(confirmDialogsGroup);
+
+ Group warningsGroup = new Group(main, SWT.SHADOW_ETCHED_IN);
+ GridDataFactory.fillDefaults().grab(true, false).span(GROUP_SPAN, 1)
+ .applyTo(warningsGroup);
+ warningsGroup
+ .setText(UIText.DialogsPreferencePage_HideWarningGroupHeader);
+
+ GridDataFactory.fillDefaults().grab(true, false).span(GROUP_SPAN, 1)
+ .applyTo(warningsGroup);
+ addField(new BooleanFieldEditor(UIPreferences.SHOW_HOME_DIR_WARNING,
+ UIText.DialogsPreferencePage_HomeDirWarning, warningsGroup));
+ addField(new BooleanFieldEditor(UIPreferences.SHOW_GIT_PREFIX_WARNING,
+ UIText.DialogsPreferencePage_GitPrefixWarning, warningsGroup));
+ updateMargins(warningsGroup);
}
private void updateMargins(Group group) {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
index a6260dee02..4de3d865d2 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
@@ -1064,6 +1064,7 @@ RepositoriesViewLabelProvider_TagsNodeText=Tags
DialogsPreferencePage_DetachedHeadCombo=D&etached HEAD warning
DialogsPreferencePage_DontShowDialog=Do not prompt
DialogsPreferencePage_HideConfirmationGroupHeader=Show confirmation dialogs
+DialogsPreferencePage_HideWarningGroupHeader=Log warnings
DialogsPreferencePage_HomeDirWarning=&Home directory warning (Windows only)
DialogsPreferencePage_GitPrefixWarning=&Git prefix warning (Windows typically)
DialogsPreferencePage_RebaseCheckbox=&Rebase confirmation
@@ -1156,13 +1157,20 @@ GitSelectWizardPage_ImportAsGeneralButton=Import as &general project
GitSelectWizardPage_ImportExistingButton=Import &existing projects
GitSelectWizardPage_ProjectCreationHeader=Wizard for project import
GitSelectWizardPage_UseNewProjectsWizardButton=Use the New &Project wizard
-ConfigurationChecker_gitPrefixWarningMessage=EGit does not require Git to function, but there may be important\nsettings in the installation directory that EGit needs to know\nabout in order to be compatible with Git. The most important of\nthese settings is core.autocrlf. Git for Windows by default\nsets this parameter to true in the etc directory of the Git\ninstallation.\nThe directory can be configured in Preferences under Team > Git > Configuration, tab System Settings, field Location.
-ConfigurationChecker_gitPrefixWarningTitle=EGit could not detect where Git is installed
-ConfigurationChecker_checkHomeDirectory=Check Home Directory {0}
+ConfigurationChecker_gitPrefixWarningMessage=\
+Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level\n\
+Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory.\n\
+The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in\n\
+this system level configuration. The Git installation directory can be configured in Preferences under\n\
+"Team > Git > Configuration", tab "System Settings", field "Location". This warning can be switched off in\n\
+Preferences under "Team > Git > Confirmations and Warnings".
ConfigurationChecker_checkConfiguration=Check Configuration
-ConfigurationChecker_doNotShowAgain=Do not show again
-ConfigurationChecker_doNotShowGitPrefixWarningAgain=Do not warn again if Git cannot be found
-ConfigurationChecker_homeNotSet=The environment variable HOME is not set. The following directory will be used for storing the Git user configuration and as default repository location: {0}.\n If this is not correct please set the HOME environment variable and restart Eclipse.
+ConfigurationChecker_homeNotSet=\
+Warning: The environment variable HOME is not set. The following directory will be used to store the Git\n\
+user global configuration and to define the default location to store repositories: ''{0}''. If this is\n\
+not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and\n\
+EGit might behave differently since they see different configuration options. This warning can be switched\n\
+off in Preferences under "Team > Git > Confirmations and Warnings".
ConfigurationEditorComponent_BrowseForPrefix=&Browse...
ConfigurationEditorComponent_CannotChangeGitPrefixError=Cannot change Git prefix
ConfigurationEditorComponent_ConfigLocationLabel=&Location:

Back to the top