Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2003-01-13 20:55:29 +0000
committerMichael Valenta2003-01-13 20:55:29 +0000
commita3d528f2529529d1d4ed7305bf17b434fdfc3f3c (patch)
tree915d45916733885575c828db2f3f9d4d130a12a1 /bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs
parent6a35fa1b1511d07b903c765f561c75a2bdf05be0 (diff)
downloadeclipse.platform.team-a3d528f2529529d1d4ed7305bf17b434fdfc3f3c.tar.gz
eclipse.platform.team-a3d528f2529529d1d4ed7305bf17b434fdfc3f3c.tar.xz
eclipse.platform.team-a3d528f2529529d1d4ed7305bf17b434fdfc3f3c.zip
Optimized plugin startup a bit
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs')
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java31
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java18
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java3
3 files changed, 24 insertions, 28 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
index 9f7622d69..fa7fcee69 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
@@ -23,6 +23,7 @@ import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -80,6 +81,10 @@ public class CVSUIPlugin extends AbstractUIPlugin implements IPropertyChangeList
*/
private RepositoryManager repositoryManager;
+ // constants used by watch/edit as values for string preference
+ public static final String ALWAYS_EDIT = "always_edit"; //$NON-NLS-1$
+ public static final String PROMPT = "prompt"; //$NON-NLS-1$
+
// Property change listener
IPropertyChangeListener listener = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
@@ -245,7 +250,15 @@ public class CVSUIPlugin extends AbstractUIPlugin implements IPropertyChangeList
*
* @return the repository manager
*/
- public RepositoryManager getRepositoryManager() {
+ public synchronized RepositoryManager getRepositoryManager() {
+ if (repositoryManager == null) {
+ repositoryManager = new RepositoryManager();
+ try {
+ repositoryManager.startup();
+ } catch (TeamException e) {
+ CVSUIPlugin.log(e.getStatus());
+ }
+ }
return repositoryManager;
}
@@ -457,6 +470,9 @@ public class CVSUIPlugin extends AbstractUIPlugin implements IPropertyChangeList
*/
protected void initializePreferences() {
IPreferenceStore store = getPreferenceStore();
+ // Get the plugin preferences for CVS Core
+ Preferences corePrefs = CVSProviderPlugin.getPlugin().getPluginPreferences();
+
store.setDefault(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY, false);
store.setDefault(ICVSUIConstants.PREF_SHOW_COMMENTS, true);
store.setDefault(ICVSUIConstants.PREF_SHOW_TAGS, true);
@@ -498,7 +514,11 @@ public class CVSUIPlugin extends AbstractUIPlugin implements IPropertyChangeList
store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_SAVING_IN_SYNC, true);
store.setDefault(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS, ICVSUIConstants.OPTION_PROMPT);
- WatchEditPreferencePage.setDefaults();
+ // Set the watch/edit preferences defaults and values
+ store.setDefault(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY, corePrefs.getDefaultBoolean(CVSProviderPlugin.READ_ONLY));
+ store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_EDIT, PROMPT);
+ // Ensure that the preference values in UI match Core
+ store.setValue(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY, corePrefs.getBoolean(CVSProviderPlugin.READ_ONLY));
// Forward the values to the CVS plugin
CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(store.getBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
@@ -530,17 +550,10 @@ public class CVSUIPlugin extends AbstractUIPlugin implements IPropertyChangeList
initializeImages();
initializePreferences();
- repositoryManager = new RepositoryManager();
// if the global ignores list is changed then update decorators.
TeamUI.addPropertyChangeListener(listener);
- try {
- repositoryManager.startup();
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- }
-
Console.startup();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java
index fc7af7fdf..9ca762b50 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java
@@ -20,22 +20,6 @@ import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
* This page contains preferences related to the cvs watch/edit commands
*/
public class WatchEditPreferencePage extends CVSFieldEditorPreferencePage {
-
- public static final String ALWAYS_EDIT = "always_edit"; //$NON-NLS-1$
- public static final String PROMPT = "prompt"; //$NON-NLS-1$
-
- public static void setDefaults() {
- // Get the preference store from CVS core
- Preferences corePrefs = CVSProviderPlugin.getPlugin().getPluginPreferences();
- // Set the UI defaults
- IPreferenceStore store = getCVSPreferenceStore();
- store.setDefault(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY,
- corePrefs.getDefaultBoolean(CVSProviderPlugin.READ_ONLY));
- store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_EDIT, PROMPT);
- // Ensure that the preference values in UI match Core
- store.setValue(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY,
- corePrefs.getBoolean(CVSProviderPlugin.READ_ONLY));
- }
/**
* @see org.eclipse.team.internal.ccvs.ui.CVSPreferencePage#getPageHelpContextId()
@@ -63,7 +47,7 @@ public class WatchEditPreferencePage extends CVSFieldEditorPreferencePage {
ICVSUIConstants.PREF_PROMPT_ON_EDIT,
Policy.bind("WatchEditPreferencePage.validateEditSaveAction"), //$NON-NLS-1$
1,
- new String[][] {{Policy.bind("WatchEditPreferencePage.always"), ALWAYS_EDIT}, {Policy.bind("WatchEditPreferencePage.prompt"), PROMPT}}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[][] {{Policy.bind("WatchEditPreferencePage.always"), CVSUIPlugin.ALWAYS_EDIT}, {Policy.bind("WatchEditPreferencePage.prompt"), CVSUIPlugin.PROMPT}}, //$NON-NLS-1$ //$NON-NLS-2$
getFieldEditorParent(), true));
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java
index 9c9fa3c79..48260aa67 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java
@@ -26,7 +26,6 @@ import org.eclipse.team.internal.ccvs.core.EditorsInfo;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.EditorsDialog;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.WatchEditPreferencePage;
import org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction.IProviderAction;
@@ -65,7 +64,7 @@ public class EditorsAction implements IProviderAction, IRunnableWithProgress {
public boolean promptToEdit(Shell shell) {
- if (!WatchEditPreferencePage.PROMPT.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_PROMPT_ON_EDIT))) {
+ if (!CVSUIPlugin.PROMPT.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_PROMPT_ON_EDIT))) {
return true;
}

Back to the top