Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2014-04-30 23:05:15 -0400
committerIgor Fedorenko2014-04-30 23:07:03 -0400
commit5a6d84ae5da85978dd4ada4a56de1cd729655f61 (patch)
treea53ed0bb05ba11f5a35aac3d87d1e9410b8f7cf8
parentb501a1608205e94edc74a7aea44c78717b31047a (diff)
downloadm2e-core-5a6d84ae5da85978dd4ada4a56de1cd729655f61.tar.gz
m2e-core-5a6d84ae5da85978dd4ada4a56de1cd729655f61.tar.xz
m2e-core-5a6d84ae5da85978dd4ada4a56de1cd729655f61.zip
433224 fixed missing open-in-editor link for default user settings.xml
Change-Id: I01a0cea1be8fdf2b5fcb15d43ae709d6fd584894 Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenSettingsPreferencePage.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenSettingsPreferencePage.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenSettingsPreferencePage.java
index 1f217627..78fd80ba 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenSettingsPreferencePage.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenSettingsPreferencePage.java
@@ -182,10 +182,9 @@ public class MavenSettingsPreferencePage extends PreferencePage implements IWork
globalSettingsLink.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String globalSettings = getGlobalSettings();
- if(globalSettings.length() == 0) {
- globalSettings = MavenCli.DEFAULT_GLOBAL_SETTINGS_FILE.getAbsolutePath();
+ if(globalSettings != null) {
+ openEditor(globalSettings);
}
- openEditor(globalSettings);
}
});
@@ -207,7 +206,7 @@ public class MavenSettingsPreferencePage extends PreferencePage implements IWork
userSettingsLink.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String userSettings = getUserSettings();
- if(userSettings.length() == 0) {
+ if(userSettings == null) {
userSettings = MavenCli.DEFAULT_USER_SETTINGS_FILE.getAbsolutePath();
}
openEditor(userSettings);
@@ -283,7 +282,13 @@ public class MavenSettingsPreferencePage extends PreferencePage implements IWork
return composite;
}
- private void updateUserSettingsLink(boolean active) {
+ private void updateUserSettingsLink(String userSettings) {
+ File userSettingsFile = MavenCli.DEFAULT_USER_SETTINGS_FILE;
+ if(userSettings != null) {
+ userSettingsFile = new File(userSettings);
+ }
+ boolean active = userSettingsFile.canRead();
+
String text = Messages.MavenSettingsPreferencePage_userSettingslink1;
if(active) {
text = Messages.MavenSettingsPreferencePage_userSettingslink2;
@@ -291,7 +296,8 @@ public class MavenSettingsPreferencePage extends PreferencePage implements IWork
userSettingsLink.setText(text);
}
- private void updateGlobalSettingsLink(boolean active) {
+ private void updateGlobalSettingsLink(String globalSettings) {
+ boolean active = globalSettings != null && new File(globalSettings).canRead();
String text = Messages.MavenSettingsPreferencePage_globalSettingslink1;
if(active) {
text = Messages.MavenSettingsPreferencePage_globalSettingslink2;
@@ -323,10 +329,10 @@ public class MavenSettingsPreferencePage extends PreferencePage implements IWork
// NB: enable/disable links regardless of validation errors
String globalSettings = getGlobalSettings();
- updateGlobalSettingsLink(globalSettings != null && new File(globalSettings).canRead());
+ updateGlobalSettingsLink(globalSettings);
String userSettings = getUserSettings();
- updateUserSettingsLink(userSettings != null && new File(userSettings).canRead());
+ updateUserSettingsLink(userSettings);
if(globalSettings != null
&& !checkSettings(globalSettings, Messages.MavenSettingsPreferencePage_error_globalSettingsMissing,

Back to the top