Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java9
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java215
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneWizard.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/RepositorySelectionPage.java120
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java189
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchWizard.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushWizard.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/ConfigureRemoteWizard.java11
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/NewRemoteWizard.java10
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties4
10 files changed, 253 insertions, 315 deletions
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 46f8da4a8..66275dcaa 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
@@ -1084,9 +1084,6 @@ public class UIText extends NLS {
public static String ConfigureUriPage_Remove_button;
/** */
- public static String CommitDialog_ValueHelp_Message;
-
- /** */
public static String CommitMessageViewer_author;
/** */
@@ -1936,6 +1933,12 @@ public class UIText extends NLS {
public static String UIIcons_errorLoadingPluginImage;
/** */
+ public static String UIUtils_PressShortcutMessage;
+
+ /** */
+ public static String UIUtils_StartTypingForPreviousValuesMessage;
+
+ /** */
public static String Untrack_untrack;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
index f81199249..408db433f 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
@@ -10,18 +10,84 @@
*******************************************************************************/
package org.eclipse.egit.ui;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+import org.eclipse.jface.bindings.keys.KeyStroke;
+import org.eclipse.jface.bindings.keys.ParseException;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.fieldassist.ContentProposalAdapter;
import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.jface.fieldassist.IContentProposal;
+import org.eclipse.jface.fieldassist.IContentProposalProvider;
+import org.eclipse.jface.fieldassist.TextContentAdapter;
import org.eclipse.jface.resource.FontRegistry;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
/**
* Some utilities for UI code
*/
public class UIUtils {
+ /**
+ * these activate the content assist; alphanumeric,
+ * space plus some expected special chars
+ */
+ private static final char[] VALUE_HELP_ACTIVATIONCHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123457890*@ <>".toCharArray(); //$NON-NLS-1$
+
+ /**
+ * Handles a "previously used values" content assist.
+ * <p>
+ * Adding this to a text field will enable "content assist" by keeping track
+ * of the previously used valued for this field. The previously used values
+ * will be shown in the order they were last used (most recently used ones
+ * coming first in the list) and the number of entries is limited.
+ * <p>
+ * A "bulb" decorator will indicate that content assist is available for the
+ * field, and a tool tip is provided giving more information.
+ * <p>
+ * Content assist is activated by either typing in the field or by using a
+ * dedicated key stroke which is indicated in the tool tip. The list will be
+ * filtered with the content already in the text field with '*' being usable
+ * as wild card.
+ * <p>
+ * Note that the application must issue a call to {@link #updateProposals()}
+ * in order to add a new value to the "previously used values" list.
+ * <p>
+ * The list will be persisted in the plug-in dialog settings.
+ *
+ * @noextend not to be extended by clients
+ * @noimplement not to be implemented by clients, use
+ * {@link UIUtils#addPreviousValuesContentProposalToText(Text, String)}
+ * to create instances of this
+ */
+ public interface IPreviousValueProposalHandler {
+ /**
+ * Updates the proposal list from the value in the text field.
+ * <p>
+ * The value will be truncated to the first 2000 characters in order to
+ * limit data size.
+ * <p>
+ * Note that this must be called in the UI thread, since it accesses the
+ * text field.
+ * <p>
+ * If the value is already in the list, it will become the first entry,
+ * otherwise it will be added at the beginning. Note that empty Strings
+ * will not be stored. The length of the list is limited, and the
+ * "oldest" entries will be removed once the limit is exceeded.
+ * <p>
+ * This call should only be issued if the value in the text field is
+ * "valid" in terms of the application.
+ */
+ public void updateProposals();
+ }
/**
* @param id see {@link FontRegistry#get(String)}
@@ -62,4 +128,153 @@ public class UIUtils {
dec.setDescriptionText(tooltip);
}
+ /**
+ * Adds a "previously used values" content proposal handler to a text field.
+ * <p>
+ * The keyboard shortcut will be "M1+SPACE" and the list will be limited to
+ * 10 values.
+ *
+ * @param textField
+ * the text field
+ * @param preferenceKey
+ * the key under which to store the "previously used values" in
+ * the dialog settings
+ * @return the handler the proposal handler
+ */
+ public static IPreviousValueProposalHandler addPreviousValuesContentProposalToText(
+ final Text textField, final String preferenceKey) {
+ KeyStroke stroke;
+ try {
+ stroke = KeyStroke.getInstance("M1+SPACE"); //$NON-NLS-1$
+ addBulbDecorator(textField, NLS.bind(
+ UIText.UIUtils_PressShortcutMessage, stroke.format()));
+ } catch (ParseException e1) {
+ Activator.handleError(e1.getMessage(), e1, false);
+ stroke = null;
+ addBulbDecorator(textField,
+ UIText.UIUtils_StartTypingForPreviousValuesMessage);
+ }
+
+ IContentProposalProvider cp = new IContentProposalProvider() {
+
+ public IContentProposal[] getProposals(String contents, int position) {
+
+ List<IContentProposal> resultList = new ArrayList<IContentProposal>();
+
+ // make the simplest possible pattern check: allow "*"
+ // for multiple characters
+ String patternString = contents;
+ // ignore spaces in the beginning
+ while (patternString.length() > 0
+ && patternString.charAt(0) == ' ') {
+ patternString = patternString.substring(1);
+ }
+
+ // we quote the string as it may contain spaces
+ // and other stuff colliding with the Pattern
+ patternString = Pattern.quote(patternString);
+
+ patternString = patternString.replaceAll("\\x2A", ".*"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // make sure we add a (logical) * at the end
+ if (!patternString.endsWith(".*")) { //$NON-NLS-1$
+ patternString = patternString + ".*"; //$NON-NLS-1$
+ }
+
+ // let's compile a case-insensitive pattern (assumes ASCII only)
+ Pattern pattern;
+ try {
+ pattern = Pattern.compile(patternString,
+ Pattern.CASE_INSENSITIVE);
+ } catch (PatternSyntaxException e) {
+ pattern = null;
+ }
+
+ String[] proposals = org.eclipse.egit.ui.Activator.getDefault()
+ .getDialogSettings().getArray(preferenceKey);
+
+ if (proposals != null)
+ for (final String uriString : proposals) {
+
+ if (pattern != null
+ && !pattern.matcher(uriString).matches())
+ continue;
+
+ IContentProposal propsal = new IContentProposal() {
+
+ public String getLabel() {
+ return null;
+ }
+
+ public String getDescription() {
+ return null;
+ }
+
+ public int getCursorPosition() {
+ return 0;
+ }
+
+ public String getContent() {
+ return uriString;
+ }
+ };
+ resultList.add(propsal);
+ }
+
+ return resultList.toArray(new IContentProposal[resultList
+ .size()]);
+ }
+ };
+
+ ContentProposalAdapter adapter = new ContentProposalAdapter(textField,
+ new TextContentAdapter(), cp, stroke,
+ VALUE_HELP_ACTIVATIONCHARS);
+ // set the acceptance style to always replace the complete content
+ adapter
+ .setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
+
+ return new IPreviousValueProposalHandler() {
+ public void updateProposals() {
+ String value = textField.getText();
+ // don't store empty values
+ if (value.length() > 0) {
+ // we don't want to save too much in the preferences
+ if (value.length() > 2000) {
+ value = value.substring(0, 1999);
+ }
+ // now we need to mix the value into the list
+ IDialogSettings settings = org.eclipse.egit.ui.Activator
+ .getDefault().getDialogSettings();
+ String[] existingValues = settings.getArray(preferenceKey);
+ if (existingValues == null) {
+ existingValues = new String[] { value };
+ settings.put(preferenceKey, existingValues);
+ } else {
+
+ List<String> values = new ArrayList<String>(
+ existingValues.length + 1);
+
+ for (String existingValue : existingValues)
+ values.add(existingValue);
+ // if it is already the first value, we don't need to do
+ // anything
+ if (values.indexOf(value) == 0)
+ return;
+
+ values.remove(value);
+ // we insert at the top
+ values.add(0, value);
+ // make sure to not store more than the maximum number
+ // of values
+ while (values.size() > 10)
+ values.remove(values.size() - 1);
+
+ settings.put(preferenceKey, values
+ .toArray(new String[values.size()]));
+ }
+ }
+ }
+ };
+ }
+
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneWizard.java
index a222eed1b..f8123114c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneWizard.java
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* Copyright (C) 2008, Roger C. Soares <rogersoares@intelinet.com.br>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
@@ -154,7 +154,7 @@ public class GitCloneWizard extends Wizard {
protected IStatus run(final IProgressMonitor monitor) {
try {
op.run(monitor);
- RepositorySelectionPage.saveUriInPrefs(uri.toString());
+ cloneSource.saveUriInPrefs();
config.addConfiguredRepository(op.getGitDir());
return Status.OK_STATUS;
} catch (InterruptedException e) {
@@ -184,7 +184,7 @@ public class GitCloneWizard extends Wizard {
}
});
- RepositorySelectionPage.saveUriInPrefs(uri.toString());
+ cloneSource.saveUriInPrefs();
config.addConfiguredRepository(op.getGitDir());
return true;
} catch (InterruptedException e) {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/RepositorySelectionPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/RepositorySelectionPage.java
index fd79ee472..c63a850de 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/RepositorySelectionPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/RepositorySelectionPage.java
@@ -18,18 +18,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIText;
import org.eclipse.egit.ui.UIUtils;
+import org.eclipse.egit.ui.UIUtils.IPreviousValueProposalHandler;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.fieldassist.ContentProposalAdapter;
-import org.eclipse.jface.fieldassist.IContentProposal;
-import org.eclipse.jface.fieldassist.IContentProposalProvider;
-import org.eclipse.jface.fieldassist.TextContentAdapter;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.transport.RemoteConfig;
@@ -57,7 +53,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.osgi.service.prefs.BackingStoreException;
/**
* Wizard page that allows the user entering the location of a remote repository
@@ -138,6 +133,8 @@ public class RepositorySelectionPage extends BaseWizardPage {
private Button uriButton;
+ private IPreviousValueProposalHandler uriProposalHandler;
+
/**
* Create repository selection page, allowing user specifying URI or
* (optionally) choosing from preconfigured remotes list.
@@ -328,7 +325,7 @@ public class RepositorySelectionPage extends BaseWizardPage {
}
});
- addContentProposalToUriText(uriText);
+ uriProposalHandler = UIUtils.addPreviousValuesContentProposalToText(uriText, USED_URIS_PREF);
Button browseButton = new Button(g, SWT.NULL);
browseButton.setText(UIText.RepositorySelectionPage_BrowseLocalFile);
@@ -744,43 +741,12 @@ public class RepositorySelectionPage extends BaseWizardPage {
uriText.setFocus();
}
+
/**
- * Adds a URI string to the list of previously added ones
- *
- * TODO move this to some proper preferences handling class instead of
- * making it static
- *
- * @param stringToAdd
+ * Updates the proposal list for the URI field
*/
- public static void saveUriInPrefs(String stringToAdd) {
-
- List<String> uriStrings = getUrisFromPrefs();
-
- if (uriStrings.indexOf(stringToAdd) == 0)
- return;
- uriStrings.add(0, stringToAdd);
-
- IEclipsePreferences prefs = new InstanceScope().getNode(Activator
- .getPluginId());
-
- StringBuilder sb = new StringBuilder();
- StringBuilder lb = new StringBuilder();
-
- // there is no "good" separator for URIish, so we
- // keep track of the URI lengths separately
- for (String uriString : uriStrings) {
- sb.append(uriString);
- lb.append(uriString.length());
- lb.append(" "); //$NON-NLS-1$
- }
- prefs.put(USED_URIS_PREF, sb.toString());
- prefs.put(USED_URIS_LENGTH_PREF, lb.toString());
-
- try {
- prefs.flush();
- } catch (BackingStoreException e) {
- // we simply ignore this here
- }
+ public void saveUriInPrefs() {
+ uriProposalHandler.updateProposals();
}
/**
@@ -829,76 +795,6 @@ public class RepositorySelectionPage extends BaseWizardPage {
setEnabledRecursively(child, enable);
}
- private void addContentProposalToUriText(Text uriTextField) {
-
- UIUtils.addBulbDecorator(uriTextField, UIText.RepositorySelectionPage_ShowPreviousURIs_HoverText);
-
- IContentProposalProvider cp = new IContentProposalProvider() {
-
- public IContentProposal[] getProposals(String contents, int position) {
-
- List<IContentProposal> resultList = new ArrayList<IContentProposal>();
-
- String patternString = contents;
- while (patternString.length() > 0
- && patternString.charAt(0) == ' ')
- patternString = patternString.substring(1);
- // make the simplest possible pattern check: allow "*"
- // for multiple characters
- patternString = patternString.replaceAll("\\x2A", ".*"); //$NON-NLS-1$ //$NON-NLS-2$
- // make sure we add a (logical) * at the end
- if (!patternString.endsWith(".*")) { //$NON-NLS-1$
- patternString = patternString + ".*"; //$NON-NLS-1$
- }
- // let's compile a case-insensitive pattern (assumes ASCII only)
- Pattern pattern;
- try {
- pattern = Pattern.compile(patternString,
- Pattern.CASE_INSENSITIVE);
- } catch (PatternSyntaxException e) {
- pattern = null;
- }
-
- List<String> uriStrings = getUrisFromPrefs();
- for (final String uriString : uriStrings) {
-
- if (pattern != null
- && !pattern.matcher(uriString).matches())
- continue;
-
- IContentProposal propsal = new IContentProposal() {
-
- public String getLabel() {
- return null;
- }
-
- public String getDescription() {
- return null;
- }
-
- public int getCursorPosition() {
- return 0;
- }
-
- public String getContent() {
- return uriString;
- }
- };
- resultList.add(propsal);
- }
-
- return resultList.toArray(new IContentProposal[resultList
- .size()]);
- }
- };
-
- // set the acceptance style to always replace the complete content
- new ContentProposalAdapter(uriTextField, new TextContentAdapter(), cp,
- null, null)
- .setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
-
- }
-
private void updateFields(final String text) {
try {
eventDepth++;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java
index 2b0806c51..3970643a3 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java
@@ -19,36 +19,24 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
-import java.util.List;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
import org.eclipse.compare.CompareUI;
import org.eclipse.compare.ITypedElement;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.egit.core.Activator;
import org.eclipse.egit.core.GitProvider;
import org.eclipse.egit.core.internal.storage.GitFileHistoryProvider;
-
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.egit.ui.UIText;
+import org.eclipse.egit.ui.UIUtils;
+import org.eclipse.egit.ui.UIUtils.IPreviousValueProposalHandler;
import org.eclipse.egit.ui.internal.GitCompareFileRevisionEditorInput;
-import org.eclipse.jface.bindings.keys.KeyStroke;
-import org.eclipse.jface.bindings.keys.ParseException;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.fieldassist.ContentProposalAdapter;
-import org.eclipse.jface.fieldassist.ControlDecoration;
-import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
-import org.eclipse.jface.fieldassist.IContentProposal;
-import org.eclipse.jface.fieldassist.IContentProposalProvider;
-import org.eclipse.jface.fieldassist.TextContentAdapter;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.IStructuredContentProvider;
@@ -57,7 +45,14 @@ import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.osgi.util.NLS;
+import org.eclipse.jgit.lib.Commit;
+import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.GitIndex;
+import org.eclipse.jgit.lib.PersonIdent;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.Tree;
+import org.eclipse.jgit.lib.TreeEntry;
+import org.eclipse.jgit.lib.GitIndex.Entry;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
@@ -86,14 +81,6 @@ import org.eclipse.team.core.history.IFileHistoryProvider;
import org.eclipse.team.core.history.IFileRevision;
import org.eclipse.team.internal.ui.history.FileRevisionTypedElement;
import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.jgit.lib.Commit;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.GitIndex;
-import org.eclipse.jgit.lib.PersonIdent;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.lib.Tree;
-import org.eclipse.jgit.lib.TreeEntry;
-import org.eclipse.jgit.lib.GitIndex.Entry;
/**
* Dialog is shown to user when they request to commit files. Changes in the
@@ -160,10 +147,6 @@ public class CommitDialog extends Dialog {
ArrayList<CommitItem> items = new ArrayList<CommitItem>();
- // these activate the value help on author/committer fields; alphanumeric,
- // space plus some expected special chars
- private static final char[] VALUE_HELP_ACTIVATIONCHARS = "abcdefghijklmnopqrstuvwxyz0123457890*@ <>".toCharArray(); //$NON-NLS-1$
-
private static final String COMMITTER_VALUES_PREF = "CommitDialog.committerValues"; //$NON-NLS-1$
private static final String AUTHOR_VALUES_PREF = "CommitDialog.authorValues"; //$NON-NLS-1$
@@ -238,7 +221,7 @@ public class CommitDialog extends Dialog {
if (author != null)
authorText.setText(author);
- addContentProposalToText(authorText, AUTHOR_VALUES_PREF);
+ authorHandler = UIUtils.addPreviousValuesContentProposalToText(authorText, AUTHOR_VALUES_PREF);
new Label(container, SWT.LEFT).setText(UIText.CommitDialog_Committer);
committerText = new Text(container, SWT.BORDER);
committerText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
@@ -259,7 +242,7 @@ public class CommitDialog extends Dialog {
}
});
- addContentProposalToText(committerText, COMMITTER_VALUES_PREF);
+ committerHandler = UIUtils.addPreviousValuesContentProposalToText(committerText, COMMITTER_VALUES_PREF);
amendingButton = new Button(container, SWT.CHECK);
if (amending) {
@@ -575,6 +558,9 @@ public class CommitDialog extends Dialog {
private ArrayList<IFile> selectedFiles = new ArrayList<IFile>();
private String previousCommitMessage = ""; //$NON-NLS-1$
+ private IPreviousValueProposalHandler authorHandler;
+ private IPreviousValueProposalHandler committerHandler;
+
/**
* Pre-select suggested set of resources to commit
@@ -738,8 +724,8 @@ public class CommitDialog extends Dialog {
return;
}
- addValueToPrefs(author, AUTHOR_VALUES_PREF);
- addValueToPrefs(committer, COMMITTER_VALUES_PREF);
+ authorHandler.updateProposals();
+ committerHandler.updateProposals();
IDialogSettings settings = org.eclipse.egit.ui.Activator
.getDefault().getDialogSettings();
@@ -747,41 +733,6 @@ public class CommitDialog extends Dialog {
super.okPressed();
}
- private void addValueToPrefs(String value, String prefsName) {
- // don't store empty values
- if (value.length() > 0) {
- // we need to mix the value in
- IDialogSettings settings = org.eclipse.egit.ui.Activator
- .getDefault().getDialogSettings();
- String[] existingValues = settings.getArray(prefsName);
- if (existingValues == null) {
- existingValues = new String[] { value };
- settings.put(prefsName, existingValues);
- } else {
-
- List<String> values = new ArrayList<String>(
- existingValues.length + 1);
-
- for (String existingValue : existingValues)
- values.add(existingValue);
- // if it is already the first value, we don't need to do
- // anything
- if (values.indexOf(value) == 0)
- return;
-
- values.remove(value);
- // we insert at the top
- values.add(0, value);
-
- while (values.size() > 10)
- values.remove(values.size() - 1);
-
- settings.put(prefsName, values
- .toArray(new String[values.size()]));
- }
- }
- }
-
/**
* Set the total list of changed resources, including additions and
* removals
@@ -905,112 +856,6 @@ public class CommitDialog extends Dialog {
protected int getShellStyle() {
return super.getShellStyle() | SWT.RESIZE;
}
-
- private void addContentProposalToText(Text textField,
- final String preferenceKey) {
-
- KeyStroke stroke;
- try {
- stroke = KeyStroke.getInstance("M1+SPACE"); //$NON-NLS-1$
- } catch (ParseException e1) {
- org.eclipse.egit.ui.Activator.getDefault().getLog().log(
- new Status(IStatus.ERROR, org.eclipse.egit.ui.Activator
- .getPluginId(), e1.getMessage(), e1));
- return;
- }
-
- ControlDecoration dec = new ControlDecoration(textField, SWT.TOP
- | SWT.LEFT);
-
- dec.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(
- FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage());
-
- dec.setShowOnlyOnFocus(true);
- dec.setShowHover(true);
-
- dec.setDescriptionText(NLS.bind(UIText.CommitDialog_ValueHelp_Message,
- stroke.format()));
-
- IContentProposalProvider cp = new IContentProposalProvider() {
-
- public IContentProposal[] getProposals(String contents, int position) {
-
- List<IContentProposal> resultList = new ArrayList<IContentProposal>();
-
- // make the simplest possible pattern check: allow "*"
- // for multiple characters
- String patternString = contents;
- // ignore spaces in the beginning
- while (patternString.length() > 0
- && patternString.charAt(0) == ' ') {
- patternString = patternString.substring(1);
- }
-
- // we quote the string as it may contain spaces
- // and other stuff colliding with the Pattern
- patternString = Pattern.quote(patternString);
-
- patternString = patternString.replaceAll("\\x2A", ".*"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // make sure we add a (logical) * at the end
- if (!patternString.endsWith(".*")) { //$NON-NLS-1$
- patternString = patternString + ".*"; //$NON-NLS-1$
- }
-
- // let's compile a case-insensitive pattern (assumes ASCII only)
- Pattern pattern;
- try {
- pattern = Pattern.compile(patternString,
- Pattern.CASE_INSENSITIVE);
- } catch (PatternSyntaxException e) {
- pattern = null;
- }
-
- String[] proposals = org.eclipse.egit.ui.Activator.getDefault()
- .getDialogSettings().getArray(preferenceKey);
-
- if (proposals != null)
- for (final String uriString : proposals) {
-
- if (pattern != null
- && !pattern.matcher(uriString).matches())
- continue;
-
- IContentProposal propsal = new IContentProposal() {
-
- public String getLabel() {
- return null;
- }
-
- public String getDescription() {
- return null;
- }
-
- public int getCursorPosition() {
- return 0;
- }
-
- public String getContent() {
- return uriString;
- }
- };
- resultList.add(propsal);
- }
-
- return resultList.toArray(new IContentProposal[resultList
- .size()]);
- }
- };
-
- ContentProposalAdapter adapter = new ContentProposalAdapter(textField,
- new TextContentAdapter(), cp, stroke,
- VALUE_HELP_ACTIVATIONCHARS);
- // set the acceptance style to always replace the complete content
- adapter
- .setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
-
- }
-
}
class CommitItem {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchWizard.java
index 33eb228e3..00d5fbdc0 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchWizard.java
@@ -118,7 +118,7 @@ public class FetchWizard extends Wizard {
fetchJob.setUser(true);
fetchJob.schedule();
- RepositorySelectionPage.saveUriInPrefs(repoPage.getSelection().getURI().toString());
+ repoPage.saveUriInPrefs();
return true;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushWizard.java
index 89de38d3c..37335b362 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushWizard.java
@@ -125,7 +125,7 @@ public class PushWizard extends Wizard {
job.setUser(true);
job.schedule();
- RepositorySelectionPage.saveUriInPrefs(repoPage.getSelection().getURI().toString());
+ repoPage.saveUriInPrefs();
return true;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/ConfigureRemoteWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/ConfigureRemoteWizard.java
index 9cbb9c5f4..7d9ff908b 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/ConfigureRemoteWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/ConfigureRemoteWizard.java
@@ -16,7 +16,6 @@ import java.net.URISyntaxException;
import org.eclipse.egit.ui.UIText;
import org.eclipse.egit.ui.internal.components.RefSpecPage;
import org.eclipse.egit.ui.internal.components.RepositorySelection;
-import org.eclipse.egit.ui.internal.components.RepositorySelectionPage;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jgit.lib.Repository;
@@ -160,16 +159,6 @@ public class ConfigureRemoteWizard extends Wizard {
try {
myConfiguration.save();
-
- // Save the uris in the RepositorySelectionPage preferences
-
- for (URIish uri: myRemoteConfiguration.getURIs())
- RepositorySelectionPage.saveUriInPrefs(uri.toPrivateString());
-
- for (URIish uri: myRemoteConfiguration.getPushURIs())
- RepositorySelectionPage.saveUriInPrefs(uri.toPrivateString());
-
-
return true;
} catch (IOException e) {
// TODO better Exception handling
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/NewRemoteWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/NewRemoteWizard.java
index b25077eb7..793324fa2 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/NewRemoteWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/NewRemoteWizard.java
@@ -16,7 +16,6 @@ import java.net.URISyntaxException;
import org.eclipse.egit.ui.UIText;
import org.eclipse.egit.ui.internal.components.RefSpecPage;
import org.eclipse.egit.ui.internal.components.RepositorySelection;
-import org.eclipse.egit.ui.internal.components.RepositorySelectionPage;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jgit.lib.Repository;
@@ -145,15 +144,6 @@ public class NewRemoteWizard extends Wizard {
try {
myConfiguration.save();
-
- // Save the uris in the RepositorySelectionPage preferences
-
- for (URIish uri : config.getURIs())
- RepositorySelectionPage.saveUriInPrefs(uri.toPrivateString());
-
- for (URIish uri : config.getPushURIs())
- RepositorySelectionPage.saveUriInPrefs(uri.toPrivateString());
-
return true;
} catch (IOException e) {
// TODO better Exception handling
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 9269fee2c..fe688161b 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
@@ -369,8 +369,6 @@ CommitDialog_StatusRemoved=Removed
CommitDialog_StatusRemovedNotStaged=Rem., not staged
CommitDialog_StatusUnknown=Unknown
CommitDialog_StatusUntracked=Untracked
-CommitDialog_ValueHelp_Message=Press {0} to see previously used values (use "*" as wildcard)
-
ConfigureKeysDialog_AddStandardButton=Add standard keys
ConfigureKeysDialog_AlreadyThere_Message=Key {0} is alredy in the list
ConfigureKeysDialog_DeleteButton=Delete
@@ -686,6 +684,8 @@ MixedResetToRevisionAction_mixedReset=Mixed Reset
UIIcons_errorDeterminingIconBase=Can't determine icon base.
UIIcons_errorLoadingPluginImage=Can't load plugin image.
+UIUtils_PressShortcutMessage=Press {0} or begin typing to see a filtered list of previously used values (use "*" as wildcard)
+UIUtils_StartTypingForPreviousValuesMessage=Start typing to see a filtered list of previously used values (use "*" as wildcard)
Untrack_untrack=Untrack
Update_update=Update

Back to the top