Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-12-10 15:39:46 -0500
committerMichael Valenta2004-12-10 15:39:46 -0500
commit840fec15beb5fe660c8c754b2c3d3f7985b836bb (patch)
treeef2c24ff06d19f91dedcb2e662956680cfa24942
parent7056a918dc8b87bfa91edcc80d43481aefef7bde (diff)
downloadeclipse.platform.team-branch_20041208_CommitWizard_FileTypes.tar.gz
eclipse.platform.team-branch_20041208_CommitWizard_FileTypes.tar.xz
eclipse.platform.team-branch_20041208_CommitWizard_FileTypes.zip
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/FileContentManager.java227
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileContentManager.java189
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java1
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/IStringMapping.java43
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java308
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/KnownModesForNames.java111
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.java83
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java114
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java65
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java22
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardFileTypePage.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java27
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java36
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizePageConfiguration.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPagePane.java2
19 files changed, 840 insertions, 452 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/FileContentManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/FileContentManager.java
new file mode 100644
index 000000000..bb1311d17
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/FileContentManager.java
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.team.core;
+
+import java.io.*;
+import java.util.*;
+
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.team.internal.core.*;
+
+/**
+ * TODO: implement extension point
+ */
+public class FileContentManager implements IFileContentManager {
+
+ private static final String PREF_TEAM_EXTENSION_TYPES= "file_types"; //$NON-NLS-1$
+ private static final String PREF_TEAM_FILENAME_TYPES= "cvs_mode_for_file_without_extensions"; //$NON-NLS-1$
+
+ private static class StringMapping implements IStringMapping {
+
+ private final String fString;
+ private final int fType;
+
+ public StringMapping(String string, int type) {
+ fString= string;
+ fType= type;
+ }
+
+ public String getString() {
+ return fString;
+ }
+
+ public int getType() {
+ return fType;
+ }
+ }
+
+ private static class UserExtensionMappings extends UserStringMappings {
+
+ public UserExtensionMappings(String key) {
+ super(key);
+ }
+
+ protected Map loadMappingsFromPreferences() {
+ final Map result= super.loadMappingsFromPreferences();
+ if (loadMappingsFromOldWorkspace(result)) {
+ TeamPlugin.getPlugin().savePluginPreferences();
+ }
+ return result;
+ }
+
+ /**
+ * If the workspace is an old 2.0 one, read the old file and delete it.
+ *
+ * @param A map where the new mappings should be added.
+ *
+ * @return true if the workspace was a 2.0 one and the old mappings have
+ * been added to the map, false otherwise.
+ *
+ */
+ private boolean loadMappingsFromOldWorkspace(Map map) {
+ // File name of the persisted file type information
+ String STATE_FILE = ".fileTypes"; //$NON-NLS-1$
+ IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation().append(STATE_FILE);
+ File f = pluginStateLocation.toFile();
+
+ if (!f.exists())
+ return false;
+
+ try {
+ DataInputStream input = new DataInputStream(new FileInputStream(f));
+ try {
+ map.putAll(readOldFormatExtensionMappings(input));
+ } finally {
+ input.close();
+ f.delete();
+ }
+ } catch (IOException ex) {
+ TeamPlugin.log(Status.ERROR, ex.getMessage(), ex);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Read the saved file type state from the given input stream.
+ *
+ * @param input the input stream to read the saved state from
+ * @throws IOException if an I/O problem occurs
+ */
+ private Map readOldFormatExtensionMappings(DataInputStream input) throws IOException {
+ final Map result= new TreeMap();
+ int numberOfMappings = 0;
+ try {
+ numberOfMappings = input.readInt();
+ } catch (EOFException e) {
+ // Ignore the exception, it will occur if there are no
+ // patterns stored in the state file.
+ return Collections.EMPTY_MAP;
+ }
+ for (int i = 0; i < numberOfMappings; i++) {
+ final String extension = input.readUTF();
+ final int type = input.readInt();
+ result.put(extension, new Integer(type));
+ }
+ return result;
+ }
+ }
+
+ private final UserStringMappings fUserExtensionMappings, fUserNameMappings;
+ private PluginStringMappings fPluginExtensionMappings;//, fPluginNameMappings;
+
+ public FileContentManager() {
+ fUserExtensionMappings= new UserExtensionMappings(PREF_TEAM_EXTENSION_TYPES);
+ fUserNameMappings= new UserStringMappings(PREF_TEAM_FILENAME_TYPES);
+ fPluginExtensionMappings= new PluginStringMappings(TeamPlugin.FILE_TYPES_EXTENSION, "extension"); //$NON-NLS-1$
+ }
+
+ public int getTypeForName(String filename) {
+ final int userType= fUserNameMappings.getType(filename);
+// final int pluginType= fPluginNameMappings.getType(filename);
+// return userType != Team.UNKNOWN ? userType : pluginType;
+ return userType;
+ }
+
+ public int getTypeForExtension(String extension) {
+ final int userType= fUserExtensionMappings.getType(extension);
+ final int pluginType= fPluginExtensionMappings.getType(extension);
+ return userType != Team.UNKNOWN ? userType : pluginType;
+ }
+
+ public void addNameMappings(String[] names, int [] types) {
+ fUserNameMappings.addStringMappings(names, types);
+ }
+
+ public void addExtensionMappings(String[] extensions, int [] types) {
+ fUserExtensionMappings.addStringMappings(extensions, types);
+ }
+
+ public void setNameMappings(String[] names, int [] types) {
+ fUserNameMappings.setStringMappings(names, types);
+ }
+
+ public void setExtensionMappings(String[] extensions, int [] types) {
+ fUserExtensionMappings.setStringMappings(extensions, types);
+ }
+
+ public IStringMapping[] getNameMappings() {
+ return getMappings(fUserNameMappings, null);//fPluginNameMappings);
+ }
+
+ public IStringMapping[] getExtensionMappings() {
+ return getMappings(fUserExtensionMappings, fPluginExtensionMappings);
+ }
+
+ public int getType(IStorage storage) {
+ int type;
+
+ final String name= storage.getName();
+ if (name != null && (type= getTypeForName(name)) != Team.UNKNOWN)
+ return type;
+
+ final String extension= getFileExtension(name);
+ if (extension != null && (type= getTypeForExtension(extension)) != Team.UNKNOWN)
+ return type;
+
+ return Team.UNKNOWN;
+ }
+
+ public IStringMapping[] getDefaultNameMappings() {
+ return new IStringMapping[0];//getStringMappings(fPluginNameMappings.referenceMap());
+ }
+
+ public IStringMapping[] getDefaultExtensionMappings() {
+ return getStringMappings(fPluginExtensionMappings.referenceMap());
+ }
+
+ public boolean isKnownExtension(String extension) {
+ return fUserExtensionMappings.referenceMap().containsKey(extension)
+ || fPluginExtensionMappings.referenceMap().containsKey(extension);
+ }
+
+ public boolean isKnownFilename(String filename) {
+ return fUserNameMappings.referenceMap().containsKey(filename);
+// || fPluginNameMappings.referenceMap().containsKey(filename);
+ }
+
+ private static String getFileExtension(String name) {
+ if (name == null)
+ return null;
+ int index = name.lastIndexOf('.');
+ if (index == -1)
+ return null;
+ if (index == (name.length() - 1))
+ return ""; //$NON-NLS-1$
+ return name.substring(index + 1);
+ }
+
+ private static IStringMapping [] getStringMappings(Map map) {
+ final IStringMapping [] result= new IStringMapping [map.size()];
+ int index= 0;
+ for (final Iterator iter = map.entrySet().iterator(); iter.hasNext();) {
+ final Map.Entry entry= (Map.Entry)iter.next();
+ result[index++]= new StringMapping((String)entry.getKey(), ((Integer)entry.getValue()).intValue());
+ }
+ return result;
+ }
+
+ private IStringMapping [] getMappings(UserStringMappings userMappings, PluginStringMappings pluginMappings) {
+ final Map mappings= new HashMap();
+ if (pluginMappings != null)
+ mappings.putAll(pluginMappings.referenceMap());
+ mappings.putAll(userMappings.referenceMap());
+ return getStringMappings(mappings);
+ }
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileContentManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileContentManager.java
new file mode 100644
index 000000000..77b6c9a48
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileContentManager.java
@@ -0,0 +1,189 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.team.core;
+
+import org.eclipse.core.resources.IStorage;
+
+/**
+ * This is the API to define mappings between file names, file extensions and
+ * content types, typically used by repository providers in order to determine
+ * whether a given file can be treated as text or must be considered binary.
+ *
+ * Mappings for names and extensions can either be contributed via an extension
+ * point or via this interface.
+ *
+ * For methods that determine the content type for a given file, the following
+ * rules apply:
+ * <li>
+ * <ul>
+ * Mappings for the entire file name take precedence over mappings for the file
+ * extension only.
+ * </ul>
+ * <ul>
+ * User-defined mappings take precedence over plugin-contributed mappings
+ * </ul>
+ * </li>
+ *
+ * If a mapping is added for a name or an extension that already has a mapping
+ * which has been contributed by a plugin, it overrides the one contributed by the plugin.
+ * If the user-defined mapping is deleted, the plugin-contributed mapping is valid again.
+ * This interface is not intented to be implemented by clients.
+ *
+ * @see org.eclipse.team.core.Team.getFileContentManager()
+ *
+ * @since 3.1
+ */
+public interface IFileContentManager {
+
+ /**
+ * Get the content type for a given instance of <code>IStorage</code>. User-defined mappings
+ * take precedence over plugin-contributed mappings; further, mappings for the entire file name
+ * take precedence over mappings for the file extension only.
+ *
+ * @param storage the instance of <code>IStorage</code>.
+ * @return one of <code>Team.UNKNOWN</code>, <code>Team.TEXT</code> or <code>Team.BINARY</code>.
+ *
+ * @since 3.1
+ */
+ int getType(IStorage storage);
+
+ /**
+ * Check whether the given file name is assigned to a specific type in the content type registry.
+ * @param filename the file name to check for
+ * @return True if the file name is registered in the system and assigned to a content type, false
+ * if the file name is unknown.
+ *
+ * @since 3.1
+ */
+ boolean isKnownFilename(String filename);
+
+ /**
+ * Check whether the given file extension is assigned to a specific type in the content type registry.
+ * @param extension the extension to check for
+ * @return True if the extension is registered in the system and assigned to a content type, false
+ * if the extension is unknown.
+ *
+ * @since 3.1
+ */
+ boolean isKnownExtension(String extension);
+
+ /**
+ * Get the content type for a given file name.
+ * @param filename The file name
+ * @return one of <code>Team.UNKNOWN</code>, <code>Team.TEXT</code> or <code>Team.BINARY</code>.
+ *
+ * @since 3.1
+ */
+ int getTypeForName(String filename);
+
+ /**
+ * Get the content type for a given file extension.
+ * @param filename The extension
+ * @return one of <code>Team.UNKNOWN</code>, <code>Team.TEXT</code> or <code>Team.BINARY</code>.
+ *
+ * @since 3.1
+ */
+ int getTypeForExtension(String extension);
+
+ /**
+ * Map a set of file names to a set of content types and save the mappings in
+ * the preferences. Already existing mappings for these file names are updated
+ * with the new ones, other mappings will be preserved.
+ *
+ * @param names The file names
+ * @param types The corresponding types, each one being one of
+ * <code>Team.UNKNOWN</code>,<code>Team.TEXT</code> or
+ * <code>Team.BINARY</code>.
+ *
+ * @since 3.1
+ */
+ void addNameMappings(String[] names, int[] types);
+
+ /**
+ * Map a set of file extensions to a set of content types and save the mapping in
+ * the preferences. Already existing mappings for these extensions are updated
+ * with the new ones, other mappings will be preserved.
+ *
+ * @param names The extensions
+ * @param types The corresponding types, each one being one of
+ * <code>Team.UNKNOWN</code>,<code>Team.TEXT</code> or
+ * <code>Team.BINARY</code>.
+ *
+ * @since 3.1
+ */
+ void addExtensionMappings(String[] extensions, int[] types);
+
+ /**
+ * Map a set of file names to a set of content types and save the mappings in
+ * the preferences. All existing user-defined mappings for <b>any
+ * </b> file names are deleted and replaced by the new ones.
+ *
+ * @param names The file names
+ * @param types The corresponding types, each one being one of
+ * <code>Team.UNKNOWN</code>,<code>Team.TEXT</code> or
+ * <code>Team.BINARY</code>.
+ *
+ * @since 3.1
+ */
+ void setNameMappings(String[] names, int[] types);
+
+ /**
+ * Map a set of file extensions to a set of content types and save the
+ * mapping in the preferences. All existing user-defined mappings for <b>any
+ * </b> file extensions are deleted and replaced by the new ones.
+ *
+ * @param names The extensions
+ * @param types The corresponding types, each one being one of
+ * <code>Team.UNKNOWN</code>,<code>Team.TEXT</code> or
+ * <code>Team.BINARY</code>.
+ *
+ * @since 3.1
+ */
+ void setExtensionMappings(String[] extensions, int[] types);
+
+ /**
+ * Get all the currently defined mappings from file names to content types.
+ *
+ * @return the mappings
+ *
+ * @since 3.1
+ */
+ IStringMapping [] getNameMappings();
+
+ /**
+ * Get all the currently defined mappings from file names to content types.
+ *
+ * @return the mappings
+ *
+ * @since 3.1
+ */
+ IStringMapping [] getExtensionMappings();
+
+ /**
+ * Get all the plugin-contributed mappings from file names to content types.
+ * TODO: the extension point for names is still missing.
+ *
+ * @return the mappings
+ *
+ * @since 3.1
+ */
+ IStringMapping [] getDefaultNameMappings();
+
+ /**
+ * Get all the plugin-contributed mappings from file extensions to content types.
+ *
+ * @return the mappings
+
+ * @since 3.1
+ */
+ IStringMapping [] getDefaultExtensionMappings();
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java
index eaab301ba..2f5889bba 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java
@@ -15,6 +15,7 @@ package org.eclipse.team.core;
* corresponding file type.
*
* @since 2.0
+ * @deprecated Use the <code>IFileContentManager</code> API instead.
*/
public interface IFileTypeInfo {
/**
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IStringMapping.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IStringMapping.java
new file mode 100644
index 000000000..50a3262c7
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IStringMapping.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.team.core;
+
+
+/**
+ * A simple interface for mappings from a string (usually a file name or a file extension)
+ * and a content type (typically <code>Team.TEXT</code>, <code>Team.BINARY</code> or
+ * <code>Team.UNKNOWN</code>.
+ *
+ * This interface is not intented to be implemented by clients.
+ *
+ * @since 3.1
+ */
+public interface IStringMapping {
+
+ /**
+ * The string part of the mapping
+ *
+ * @return the string
+ *
+ * @since 3.1
+ */
+ String getString();
+
+ /**
+ * The content type associated with the string
+ *
+ * @return the content type
+ *
+ * @since 3.1
+ */
+ int getType();
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
index a2bde8dc4..229a10f6c 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
@@ -25,9 +25,26 @@ import org.eclipse.team.internal.core.*;
* @since 2.0
*/
public final class Team {
+
+ private static class StringMappingWrapper implements IFileTypeInfo {
+
+ private final IStringMapping fMapping;
+
+ public StringMappingWrapper(IStringMapping mapping) {
+ fMapping= mapping;
+ }
+
+ public String getExtension() {
+ return fMapping.getString();
+ }
+
+ public int getType() {
+ return fMapping.getType();
+ }
+
+ }
private static final String PREF_TEAM_IGNORES = "ignore_files"; //$NON-NLS-1$
- private static final String PREF_TEAM_TYPES = "file_types"; //$NON-NLS-1$
private static final String PREF_TEAM_SEPARATOR = "\n"; //$NON-NLS-1$
public static final Status OK_STATUS = new Status(Status.OK, TeamPlugin.ID, Status.OK, Policy.bind("ok"), null); //$NON-NLS-1$
@@ -36,31 +53,22 @@ public final class Team {
public static final int TEXT = 1;
public static final int BINARY = 2;
- // Keys: file extensions. Values: Integers
- private static SortedMap globalTypes, pluginTypes;
// The ignore list that is read at startup from the persisted file
- private static SortedMap globalIgnore, pluginIgnore;
+ protected static SortedMap globalIgnore, pluginIgnore;
private static StringMatcher[] ignoreMatchers;
+
+ private final static FileContentManager fFileContentManager;
+
+ static {
+ fFileContentManager= new FileContentManager();
+ }
- private static class FileTypeInfo implements IFileTypeInfo {
- private String extension;
- private int type;
-
- public FileTypeInfo(String extension, int type) {
- this.extension = extension;
- this.type = type;
- }
- public String getExtension() {
- return extension;
- }
- public int getType() {
- return type;
- }
- }
/**
- * Return the type of the given IStorage.
+ * Return the type of the given IStorage. First, we check whether a mapping has
+ * been defined for the name of the IStorage. If this is not the case, we check for
+ * a mapping with the extension. If no mapping is defined, UNKNOWN is returned.
*
* Valid return values are:
* Team.TEXT
@@ -69,16 +77,11 @@ public final class Team {
*
* @param storage the IStorage
* @return whether the given IStorage is TEXT, BINARY, or UNKNOWN
+ *
+ * @deprecated Use <code>getFileContentManager().getType(IStorage storage)</code> instead.
*/
public static int getType(IStorage storage) {
- String extension = getFileExtension(storage.getName());
- if (extension == null) {
- return KnownModesForNames.getType(storage.getName());
- }
- SortedMap table = getFileTypeTable();
- Integer integer = (Integer)table.get(extension);
- if (integer == null) return UNKNOWN;
- return integer.intValue();
+ return fFileContentManager.getType(storage);
}
/**
@@ -120,26 +123,22 @@ public final class Team {
return matchesEnabledIgnore(file);
}
- private static IFileTypeInfo[] getFileTypeInfo(SortedMap map) {
- List result = new ArrayList();
- Iterator e = map.keySet().iterator();
- while (e.hasNext()) {
- String string = (String)e.next();
- int type = ((Integer)map.get(string)).intValue();
- result.add(new FileTypeInfo(string, type));
- }
- return (IFileTypeInfo[])result.toArray(new IFileTypeInfo[result.size()]);
- }
/**
- * Return all known file types.
+ * Return all known file types.
*
* @return all known file types
+ * @deprecated Use <code>getFileContentManager().getExtensionMappings()</code> instead.
*/
public static IFileTypeInfo[] getAllTypes() {
- return getFileTypeInfo(getFileTypeTable());
+ final IStringMapping [] mappings= fFileContentManager.getExtensionMappings();
+ final IFileTypeInfo [] infos= new IFileTypeInfo[mappings.length];
+ for (int i = 0; i < infos.length; i++) {
+ infos[i]= new StringMappingWrapper(mappings[i]);
+ }
+ return infos;
}
-
+
/**
* Returns the list of global ignores.
*/
@@ -171,12 +170,12 @@ public final class Team {
final boolean enabled = ((Boolean)gIgnore.get(pattern)).booleanValue();
result[i++] = new IIgnoreInfo() {
private String p = pattern;
- private boolean e = enabled;
+ private boolean e1 = enabled;
public String getPattern() {
return p;
}
public boolean getEnabled() {
- return e;
+ return e1;
}
};
}
@@ -198,16 +197,9 @@ public final class Team {
return ignoreMatchers;
}
- private synchronized static SortedMap getFileTypeTable() {
- // The types are cached and when the preferences change the
- // cache is cleared. This makes it faster to lookup without having
- // to re-parse the preferences.
- if (globalTypes == null) loadTextState();
- return globalTypes;
- }
/**
- * Set the file type for the give extensions to the given types. This
+ * Set the file type for the give extensions. This
* will replace the existing file types with this new list.
*
* Valid types are:
@@ -217,54 +209,15 @@ public final class Team {
*
* @param extensions the file extensions
* @param types the file types
+ *
+ * @deprecated Use <code>getFileContentManager().setExtensionMappings()</code> instead.
*/
public static void setAllTypes(String[] extensions, int[] types) {
- internalAddAllTypes(extensions, types, true);
- }
-
- /**
- * Add the file type for the given extensions to the given types. This
- * will append to the existing file types.
- *
- * Valid types are:
- * Team.TEXT
- * Team.BINARY
- * Team.UNKNOWN
- *
- * @param extensions the file extensions
- * @param types the file types
- */
- public static void addAllTypes(String[] extensions, int[] types) {
- internalAddAllTypes(extensions, types, false);
- }
-
- private static void internalAddAllTypes(String[] extensions, int[] types, boolean removeExisting) {
- if (pluginTypes == null) {
- loadTextState();
- }
- if (removeExisting)
- globalTypes = new TreeMap();
- for (int i = 0; i < extensions.length; i++) {
- globalTypes.put(extensions[i], new Integer(types[i]));
- }
- // Now set into preferences
- StringBuffer buf = new StringBuffer();
- Iterator e = globalTypes.keySet().iterator();
- while (e.hasNext()) {
- String extension = (String)e.next();
- boolean isCustom = (!pluginTypes.containsKey(extension)) ||
- !((Integer)pluginTypes.get(extension)).equals(globalTypes.get(extension));
- if (isCustom) {
- buf.append(extension);
- buf.append(PREF_TEAM_SEPARATOR);
- Integer type = (Integer)globalTypes.get(extension);
- buf.append(type);
- buf.append(PREF_TEAM_SEPARATOR);
- }
-
- }
- TeamPlugin.getPlugin().getPluginPreferences().setValue(PREF_TEAM_TYPES, buf.toString());
+ fFileContentManager.addExtensionMappings(extensions, types);
}
+
+
+
/**
* Add patterns to the list of global ignores.
*/
@@ -293,130 +246,9 @@ public final class Team {
TeamPlugin.getPlugin().getPluginPreferences().setValue(PREF_TEAM_IGNORES, buf.toString());
}
- /*
- * TEXT
- *
- * Reads the text patterns currently defined by extensions.
- */
- private static void initializePluginPatterns(Map pTypes, Map fTypes) {
- TeamPlugin plugin = TeamPlugin.getPlugin();
- if (plugin != null) {
- IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.ID, TeamPlugin.FILE_TYPES_EXTENSION);
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- String ext = configElements[j].getAttribute("extension"); //$NON-NLS-1$
- if (ext != null) {
- String type = configElements[j].getAttribute("type"); //$NON-NLS-1$
- // If the extension doesn't already exist, add it.
- if (!fTypes.containsKey(ext)) {
- if (type.equals("text")) { //$NON-NLS-1$
- pTypes.put(ext, new Integer(TEXT));
- fTypes.put(ext, new Integer(TEXT));
- } else if (type.equals("binary")) { //$NON-NLS-1$
- fTypes.put(ext, new Integer(BINARY));
- pTypes.put(ext, new Integer(BINARY));
- }
- }
- }
- }
- }
- }
- }
- }
-
- /*
- * TEXT
- *
- * Read the saved file type state from the given input stream.
- *
- * @param dis the input stream to read the saved state from
- * @throws IOException if an I/O problem occurs
- */
- private static void readTextState(DataInputStream dis) throws IOException {
- int extensionCount = 0;
- try {
- extensionCount = dis.readInt();
- } catch (EOFException e) {
- // Ignore the exception, it will occur if there are no
- // patterns stored in the state file.
- return;
- }
- for (int i = 0; i < extensionCount; i++) {
- String extension = dis.readUTF();
- int type = dis.readInt();
- globalTypes.put(extension, new Integer(type));
- }
- }
- /*
- * TEXT
- *
- * Load the file type registry saved state. This loads the previously saved
- * contents, as well as discovering any values contributed by plug-ins.
- */
- private static void loadTextState() {
- globalTypes = new TreeMap();
- boolean old = loadBackwardCompatibleTextState();
- if (!old)
- loadTextPreferences();
- pluginTypes = new TreeMap();
- initializePluginPatterns(pluginTypes, globalTypes);
- if (old) TeamPlugin.getPlugin().savePluginPreferences();
- }
- private static void loadTextPreferences() {
- Preferences pref = TeamPlugin.getPlugin().getPluginPreferences();
- if (!pref.contains(PREF_TEAM_TYPES)) return;
- pref.addPropertyChangeListener(new Preferences.IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- // when a property is changed, invalidate our cache so that
- // properties will be recalculated.
- if(event.getProperty().equals(PREF_TEAM_TYPES))
- globalTypes = null;
- }
- });
- String prefTypes = pref.getString(PREF_TEAM_TYPES);
- StringTokenizer tok = new StringTokenizer(prefTypes, PREF_TEAM_SEPARATOR);
- String extension, integer;
- try {
- while (true) {
- extension = tok.nextToken();
- if (extension.length()==0) return;
- integer = tok.nextToken();
- globalTypes.put(extension, Integer.valueOf(integer));
- }
- } catch (NoSuchElementException e) {
- return;
- }
-
- }
- /*
- * If the workspace is an old 2.0 one, read the old file and delete it
- */
- private static boolean loadBackwardCompatibleTextState() {
- // File name of the persisted file type information
- String STATE_FILE = ".fileTypes"; //$NON-NLS-1$
- IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation().append(STATE_FILE);
- File f = pluginStateLocation.toFile();
- if (!f.exists()) return false;
- try {
- DataInputStream dis = new DataInputStream(new FileInputStream(f));
- try {
- readTextState(dis);
- } finally {
- dis.close();
- }
- } catch (IOException ex) {
- TeamPlugin.log(Status.ERROR, ex.getMessage(), ex);
- return false;
- }
- f.delete();
- return true;
- }
-
+
/*
* IGNORE
*
@@ -585,15 +417,6 @@ public final class Team {
return null;
}
- private static String getFileExtension(String name) {
- if (name == null) return null;
- int index = name.lastIndexOf('.');
- if (index == -1)
- return null;
- if (index == (name.length() - 1))
- return ""; //$NON-NLS-1$
- return name.substring(index + 1);
- }
/**
* Return the default ignore infos
@@ -610,16 +433,39 @@ public final class Team {
}
/**
+ * TODO: change to file content manager
* Return the default file type bindings
* (i.e. those that are specified in
* plugin manifests).
* @return the default file type bindings
* @since 3.0
+ * @deprecated Use Team.getFileContentManager().getDefaultExtensionMappings() instead.
*/
public static IFileTypeInfo[] getDefaultTypes() {
- SortedMap gTypes = new TreeMap();
- SortedMap pTypes = new TreeMap();
- initializePluginPatterns(pTypes, gTypes);
- return getFileTypeInfo(gTypes);
+ return asFileTypeInfo(getFileContentManager().getDefaultExtensionMappings());
}
+
+ private static IFileTypeInfo [] asFileTypeInfo(IStringMapping [] mappings) {
+ final IFileTypeInfo [] infos= new IFileTypeInfo[mappings.length];
+ for (int i = 0; i < infos.length; i++) {
+ infos[i]= new StringMappingWrapper(mappings[i]);
+ }
+ return infos;
+ }
+
+ /**
+ * Get the file content manager which implements the API for manipulating the mappings between
+ * file names, file extensions and content types.
+ *
+ * @return an instance of IFileContentManager
+ *
+ * @see IFileContentManager
+ *
+ * @since 3.1
+ */
+ public static IFileContentManager getFileContentManager() {
+ return fFileContentManager;
+ }
+
+
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/KnownModesForNames.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/KnownModesForNames.java
index 3b8fc54bb..b4466f714 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/KnownModesForNames.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/KnownModesForNames.java
@@ -11,12 +11,7 @@
package org.eclipse.team.internal.core;
-import java.util.*;
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
import org.eclipse.team.core.IFileTypeInfo;
-import org.eclipse.team.core.Team;
/**
*
@@ -45,112 +40,10 @@ public class KnownModesForNames {
return fMode;
}
}
+ static final String PREF_TEAM_TYPES_FOR_FILES= "cvs_mode_for_file_without_extensions"; //$NON-NLS-1$
- private static class CachedModesForNames implements Preferences.IPropertyChangeListener {
-
- private static final String PREF_TEAM_TYPES_FOR_FILES= "cvs_mode_for_file_without_extensions";
- private static final String PREF_TEAM_SEPARATOR = "\n"; //$NON-NLS-1$
-
- private Map fMap;
- private final Preferences fPreferences;
-
- public CachedModesForNames() {
- fPreferences= TeamPlugin.getPlugin().getPluginPreferences();
- fPreferences.addPropertyChangeListener(this);
- }
-
- public Map referenceMap() {
- if (fMap == null) {
- fMap= new HashMap();
- if (!fPreferences.contains(PREF_TEAM_TYPES_FOR_FILES))
- return Collections.EMPTY_MAP;
-
- final String prefTypes = fPreferences.getString(PREF_TEAM_TYPES_FOR_FILES);
- final StringTokenizer tok = new StringTokenizer(prefTypes, PREF_TEAM_SEPARATOR);
- try {
- while (true) {
- final String name = tok.nextToken();
- if (name.length()==0)
- return Collections.EMPTY_MAP;
- final String mode= tok.nextToken();
- fMap.put(name, Integer.valueOf(mode));
- }
- } catch (NoSuchElementException e) {
- return Collections.EMPTY_MAP;
- }
-
- }
- return fMap;
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- if(event.getProperty().equals(PREF_TEAM_TYPES_FOR_FILES))
- fMap= null;
- }
-
- public void save() {
- // Now set into preferences
- final StringBuffer buffer = new StringBuffer();
- final Iterator e = fMap.keySet().iterator();
-
- while (e.hasNext()) {
- final String filename = (String)e.next();
- buffer.append(filename);
- buffer.append(PREF_TEAM_SEPARATOR);
- final Integer type = (Integer)fMap.get(filename);
- buffer.append(type);
- buffer.append(PREF_TEAM_SEPARATOR);
- }
- TeamPlugin.getPlugin().getPluginPreferences().setValue(PREF_TEAM_TYPES_FOR_FILES, buffer.toString());
- }
- }
-
- private static final CachedModesForNames fCachedModes= new CachedModesForNames();
+ private static final UserStringMappings fCachedModes= new UserStringMappings(PREF_TEAM_TYPES_FOR_FILES);
private KnownModesForNames() {
}
-
- public static IFileTypeInfo [] getKnownModesForNames() {
- return toFileTypeInfoArray(fCachedModes.referenceMap());
- }
-
- public static void addModesForFiles(String [] names, int [] modes) {
- final Map map= fCachedModes.referenceMap();
- map.putAll(toMap(names, modes));
- fCachedModes.save();
- }
-
- public static void setModesforFiles(String [] names, int [] modes) {
- final Map map= fCachedModes.referenceMap();
- map.putAll(toMap(names, modes));
- fCachedModes.save();
- }
-
- private static Map toMap(String [] filenames, int [] modes) {
- final SortedMap map= new TreeMap();
- for (int i = 0; i < filenames.length; i++) {
- map.put(filenames[i], new Integer(modes[i]));
- }
- return map;
- }
-
- private static IFileTypeInfo [] toFileTypeInfoArray(Map map) {
-
- final IFileTypeInfo [] result= new IFileTypeInfo[map.size()];
- int index= 0;
- for (Iterator iter = map.keySet().iterator(); iter.hasNext();) {
- final String name = (String) iter.next();
- result[index++]= new FileTypeInfo(name, (Integer)map.get(name));
- }
- return result;
- }
-
- /**
- * @param name
- * @return
- */
- public static int getType(String name) {
- final Integer mode= (Integer)fCachedModes.referenceMap().get(name);
- return mode != null ? mode.intValue() : Team.UNKNOWN;
- }
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.java
new file mode 100644
index 000000000..20522ae84
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.team.internal.core;
+
+import java.util.*;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.team.core.Team;
+
+/**
+ *
+ */
+public class PluginStringMappings {
+
+ private final String fExtensionID;
+ private final String fAttributeName;
+
+ private SortedMap fMappings;
+
+ public PluginStringMappings(String extensionID, String stringAttributeName) {
+ fExtensionID= extensionID;
+ fAttributeName= stringAttributeName;
+ }
+
+ /**
+ * Load all the extension patterns contributed by plugins.
+ * @return a map with the patterns
+ */
+ private SortedMap loadPluginPatterns() {
+
+ final SortedMap result= new TreeMap();
+
+ final TeamPlugin plugin = TeamPlugin.getPlugin();
+ if (plugin == null)
+ return result;
+
+ final IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.ID, fExtensionID);//TeamPlugin.FILE_TYPES_EXTENSION);
+ if (extension == null)
+ return result;
+
+ final IExtension[] extensions = extension.getExtensions();
+
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
+
+ for (int j = 0; j < configElements.length; j++) {
+
+ final String ext = configElements[j].getAttribute(fAttributeName);//"extension"); //$NON-NLS-1$
+ final String type = configElements[j].getAttribute("type"); //$NON-NLS-1$
+ if (ext == null || type == null)
+ continue;
+
+ if (type.equals("text")) { //$NON-NLS-1$
+ result.put(ext, new Integer(Team.TEXT));
+ } else if (type.equals("binary")) { //$NON-NLS-1$
+ result.put(ext, new Integer(Team.BINARY));
+ }
+ }
+ }
+ return result;
+ }
+
+ public Map referenceMap() {
+ if (fMappings == null) {
+ fMappings= loadPluginPatterns();
+ }
+ return fMappings;
+ }
+
+ public int getType(String filename) {
+ final Map mappings= referenceMap();
+ return mappings.containsKey(filename) ? ((Integer)mappings.get(filename)).intValue() : Team.UNKNOWN;
+ }
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java
new file mode 100644
index 000000000..57d8bf14c
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.team.internal.core;
+
+import java.util.*;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
+import org.eclipse.team.core.Team;
+
+
+public class UserStringMappings implements Preferences.IPropertyChangeListener {
+
+ public static final Integer BINARY= new Integer(Team.BINARY);
+ public static final Integer TEXT= new Integer(Team.TEXT);
+ public static final Integer UNKNOWN= new Integer(Team.UNKNOWN);
+
+
+ private static final String PREF_TEAM_SEPARATOR = "\n"; //$NON-NLS-1$
+
+ private final Preferences fPreferences;
+ private final String fKey;
+
+ private Map fMap;
+
+ public UserStringMappings(String key) {
+ fKey= key;
+ fPreferences= TeamPlugin.getPlugin().getPluginPreferences();
+ fPreferences.addPropertyChangeListener(this);
+ }
+
+ public Map referenceMap() {
+ if (fMap == null) {
+ fMap= loadMappingsFromPreferences();
+ }
+ return fMap;
+ }
+
+ public void addStringMappings(String[] names, int[] types) {
+ Assert.isTrue(names.length == types.length);
+ final Map map= referenceMap();
+
+ for (int i = 0; i < names.length; i++) {
+ switch (types[i]) {
+ case Team.BINARY: map.put(names[i], BINARY); break;
+ case Team.TEXT: map.put(names[i], TEXT); break;
+ case Team.UNKNOWN: map.put(names[i], UNKNOWN); break;
+ }
+ }
+ save();
+ }
+
+ public void setStringMappings(String [] names, int [] types) {
+ Assert.isTrue(names.length == types.length);
+ referenceMap().clear();
+ addStringMappings(names, types);
+ }
+
+ public int getType(String string) {
+ if (string == null)
+ return Team.UNKNOWN;
+ final Integer type= (Integer)referenceMap().get(string);
+ return type != null ? type.intValue() : Team.UNKNOWN;
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ if(event.getProperty().equals(fKey))
+ fMap= null;
+ }
+
+ public void save() {
+ // Now set into preferences
+ final StringBuffer buffer = new StringBuffer();
+ final Iterator e = fMap.keySet().iterator();
+
+ while (e.hasNext()) {
+ final String filename = (String)e.next();
+ buffer.append(filename);
+ buffer.append(PREF_TEAM_SEPARATOR);
+ final Integer type = (Integer)fMap.get(filename);
+ buffer.append(type);
+ buffer.append(PREF_TEAM_SEPARATOR);
+ }
+ TeamPlugin.getPlugin().getPluginPreferences().setValue(fKey, buffer.toString());
+ }
+
+ protected Map loadMappingsFromPreferences() {
+ final Map result= new HashMap();
+
+ if (!fPreferences.contains(fKey))
+ return result;
+
+ final String prefTypes = fPreferences.getString(fKey);
+ final StringTokenizer tok = new StringTokenizer(prefTypes, PREF_TEAM_SEPARATOR);
+ try {
+ while (tok.hasMoreElements()) {
+ final String name = tok.nextToken();
+ final String mode= tok.nextToken();
+ result.put(name, Integer.valueOf(mode));
+ }
+ } catch (NoSuchElementException e) {
+ }
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java
index e72a3f181..8d676e17e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java
@@ -23,7 +23,7 @@ import org.eclipse.jface.wizard.*;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.IFileTypeInfo;
+import org.eclipse.team.core.IFileContentManager;
import org.eclipse.team.core.Team;
import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.internal.ccvs.core.*;
@@ -32,7 +32,6 @@ import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.operations.*;
-import org.eclipse.team.internal.core.KnownModesForNames;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
@@ -154,6 +153,7 @@ public class CommitWizard extends Wizard {
private CommitWizard(IResource [] resources, SyncInfoSet syncInfos) throws CVSException {
super();
setWindowTitle(Policy.bind("CommitWizard.2")); //$NON-NLS-1$
+ setDefaultPageImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION));
final IDialogSettings cvsSettings = CVSUIPlugin.getPlugin().getDialogSettings();
IDialogSettings section = cvsSettings.getSection(COMMIT_WIZARD_SECTION);
@@ -195,36 +195,24 @@ public class CommitWizard extends Wizard {
private static void getUnknownNamesAndExtension(SyncInfoSet infos, Collection names, Collection extensions) {
- final Set knownNames= createSetOfStrings(KnownModesForNames.getKnownModesForNames());
- final Set knownExtensions= createSetOfStrings(Team.getAllTypes());
+ final IFileContentManager manager= Team.getFileContentManager();
for (final Iterator iter = infos.iterator(); iter.hasNext();) {
final SyncInfo info = (SyncInfo)iter.next();
+
final String extension= info.getLocal().getFileExtension();
- final String name= info.getLocal().getName();
+ if (extension != null && !manager.isKnownExtension(extension)) {
+ extensions.add(extension);
+ continue;
+ }
- if (extension == null && !knownNames.contains(name))
+ final String name= info.getLocal().getName();
+ if (name != null && !manager.isKnownFilename(name))
names.add(name);
-
- if (extension != null && !knownExtensions.contains(extension))
- extensions.add(extension);
}
}
-
- /**
- * Create a set of strings from an array of IFileTypeInfo. This set can be used to
- * determine whether a given name or extension of a file is known.
- */
- private static Set createSetOfStrings(IFileTypeInfo [] infos) {
- final Set result= new HashSet();
- for (int i = 0; i < infos.length; ++i) {
- result.add(infos[i].getExtension());
- }
- return result;
- }
-
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#addPages()
*/
@@ -245,7 +233,6 @@ public class CommitWizard extends Wizard {
super.addPages();
}
-
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.IWizard#performFinish()
*/
@@ -269,19 +256,19 @@ public class CommitWizard extends Wizard {
final AddAndCommitOperation operation= new AddAndCommitOperation(getPart(), infos.getResources(), comment);
if (fFileTypePage != null) {
- final Map toSave= new HashMap();
- final Map notToSave= new HashMap();
-
- fFileTypePage.getModesForExtensions(toSave, notToSave);
- saveExtensionMappings(toSave);
- operation.setModesForExtensionsForOneTime(notToSave);
+ final Map extensionsToSave= new HashMap();
+ final Map extensionsNotToSave= new HashMap();
- toSave.clear();
- notToSave.clear();
+ fFileTypePage.getModesForExtensions(extensionsToSave, extensionsNotToSave);
+ saveExtensionMappings(extensionsToSave);
+ operation.setModesForExtensionsForOneTime(extensionsNotToSave);
- fFileTypePage.getModesForNames(toSave, notToSave);
- saveNameMappings(toSave);
- operation.setModesForNamesForOneTime(notToSave);
+ final Map namesToSave= new HashMap();
+ final Map namesNotToSave= new HashMap();
+
+ fFileTypePage.getModesForNames(namesToSave, namesNotToSave);
+ saveNameMappings(namesToSave);
+ operation.setModesForNamesForOneTime(namesNotToSave);
}
if (unadded.size() > 0) {
@@ -361,21 +348,21 @@ public class CommitWizard extends Wizard {
modes[index]= ((Integer)modesToPersist.get(extensions[index])).intValue();
++index;
}
- Team.addAllTypes(extensions, modes);
+ Team.getFileContentManager().addExtensionMappings(extensions, modes);
}
private static void saveNameMappings(Map modesToPersist) {
- final String [] extensions= new String [modesToPersist.size()];
+ final String [] names= new String [modesToPersist.size()];
final int [] modes= new int[modesToPersist.size()];
int index= 0;
for (Iterator iter= modesToPersist.keySet().iterator(); iter.hasNext();) {
- extensions[index]= (String) iter.next();
- modes[index]= ((Integer)modesToPersist.get(extensions[index])).intValue();
+ names[index]= (String) iter.next();
+ modes[index]= ((Integer)modesToPersist.get(names[index])).intValue();
++index;
}
- KnownModesForNames.addModesForFiles(extensions, modes);
+ Team.getFileContentManager().addNameMappings(names, modes);
}
/**
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java
index ec5ec2805..0ef6ff703 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java
@@ -18,7 +18,7 @@ import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.*;
import org.eclipse.jface.wizard.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
@@ -33,7 +33,8 @@ import org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction;
import org.eclipse.team.internal.ccvs.ui.subscriber.*;
import org.eclipse.team.internal.ui.SWTUtils;
import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.synchronize.*;
+import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
+import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.*;
/**
@@ -54,6 +55,11 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
ISynchronizePageConfiguration.OBJECT_CONTRIBUTIONS_GROUP,
new CVSActionDelegateWrapper(new IgnoreAction(), configuration));
}
+
+ public void modelChanged(ISynchronizeModelElement root) {
+ super.modelChanged(root);
+ expand();
+ }
}
/**
@@ -142,7 +148,7 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
*/
public CommitWizardCommitPage(IResource [] resources, CommitWizardFileTypePage fileTypePage) {
super(Policy.bind("CommitWizardCommitPage.0")); //$NON-NLS-1$
- setTitle(Policy.bind("CommitWizardCommitPage.2")); //$NON-NLS-1$
+ setTitle(Policy.bind("CommitWizardCommitPage.0")); //$NON-NLS-1$
setDescription(Policy.bind("CommitWizardCommitPage.2")); //$NON-NLS-1$
fSettingsSaver= new SettingsSaver();
@@ -206,14 +212,12 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
fConfiguration.setProperty(ISynchronizePageConfiguration.P_CONTEXT_MENU, ISynchronizePageConfiguration.DEFAULT_CONTEXT_MENU);
fConfiguration.addActionContribution(new ActionContribution());
- fConfiguration.setProperty(ISynchronizePageConfiguration.P_LAYOUT, ISynchronizePageConfiguration.FLAT_LAYOUT);
fConfiguration.setRunnableContext(getContainer());
fConfiguration.setMode(ISynchronizePageConfiguration.OUTGOING_MODE);
final ParticipantPagePane part= new ParticipantPagePane(getShell(), true /* modal */, fConfiguration, participant);
Control control = part.createPartControl(composite);
control.setLayoutData(SWTUtils.createHVFillGridData());
-
}
/**
* @param composite
@@ -243,6 +247,14 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
super.setVisible(visible);
fCommentArea.setFocus();
fConfiguration.getPage().getViewer().refresh();
+ expand();
+ }
+
+ protected void expand() {
+ final Viewer viewer= fConfiguration.getPage().getViewer();
+ if (viewer instanceof TreeViewer) {
+ ((TreeViewer)viewer).expandAll();
+ }
}
/**
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardFileTypePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardFileTypePage.java
index 1126f77f0..e462ef2be 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardFileTypePage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardFileTypePage.java
@@ -40,7 +40,7 @@ public class CommitWizardFileTypePage extends WizardPage implements FileTypeTabl
public CommitWizardFileTypePage(Collection unknownExtensions, Collection unknownNames) {
super(Policy.bind("CommitWizardFileTypePage.0")); //$NON-NLS-1$
- setTitle("Add Resources"); //$NON-NLS-1$
+ setTitle(Policy.bind("CommitWizardFileTypePage.0")); //$NON-NLS-1$
setDescription(Policy.bind("CommitWizardFileTypePage.2")); //$NON-NLS-1$
fNames= new ArrayList();
@@ -70,6 +70,7 @@ public class CommitWizardFileTypePage extends WizardPage implements FileTypeTabl
final List items= new ArrayList();
items.addAll(fNames);
items.addAll(fExtensions);
+
new FileTypeTable(composite, this, items, true);
setControl(composite);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
index 84c472338..cd33bb9ce 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
@@ -100,6 +100,7 @@ TeamFile.saveChanges=Unable to save changes to file: {0}
TeamFile.modified={0}*
TextPreferencePage.add=&Add Extension...
+TextPreferencePage.0=Add Name...
TextPreferencePage.binary=Binary
TextPreferencePage.change=&Change
TextPreferencePage.contents=Contents
@@ -398,6 +399,7 @@ SynchronizeManager.31=&Remember my decision
SynchronizeManager.30=The Synchronize View is associated with the {0} perspective. Do you want to switch to that perspective now?
RefreshCompleteDialog.9=Changes
Participant.comparing=Comparing
+ParticipantPagePane.0=Error creating Synchronize Page
Participant.merging=Merging
Participant.synchronizing=Synchronizing
Participant.comparingDetail=Comparing {0}
@@ -491,3 +493,10 @@ ChangeLogModelProvider.6=Ed&it Change Set...
ChangeLogModelProvider.9=Make De&fault
ChangeLogModelManager.0=Show Change Sets
CommitSetDiffNode.0={0} (default)
+FileTypeTable.0=Binary
+FileTypeTable.1=ASCII Text
+FileTypeTable.2=Yes
+FileTypeTable.3=No
+FileTypeTable.4=Name/Extension
+FileTypeTable.5=Content
+FileTypeTable.6=Remember decision?
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java
index 7793f8e9e..30e0ba4b4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java
@@ -20,6 +20,7 @@ import org.eclipse.swt.custom.TableEditor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.*;
import org.eclipse.team.core.Team;
+import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.SWTUtils;
@@ -27,11 +28,11 @@ public class FileTypeTable implements ICellModifier, IStructuredContentProvider,
private final static int COMBO_INDEX_BINARY= 0;
private final static int COMBO_INDEX_TEXT= 1;
- private final static String [] MODES_TEXT= { "Binary", "ASCII Text" };
+ private final static String [] MODES_TEXT= { Policy.bind("FileTypeTable.0"), Policy.bind("FileTypeTable.1") }; //$NON-NLS-1$ //$NON-NLS-2$
private final static int COMBO_INDEX_SAVE= 0;
private final static int COMBO_INDEX_DONT_SAVE= 1;
- private static final String [] SAVE_TEXT= { "Yes", "No" };
+ private static final String [] SAVE_TEXT= { Policy.bind("FileTypeTable.2"), Policy.bind("FileTypeTable.3") }; //$NON-NLS-1$ //$NON-NLS-2$
public interface PixelConverter {
@@ -59,9 +60,9 @@ public class FileTypeTable implements ICellModifier, IStructuredContentProvider,
private final static int SMALL_COLUMN= 15;
private final static int LARGE_COLUMN= 30;
- protected static final String ITEM = "item";
- protected static final String PROPERTY_MODE= "mode";
- protected static final String PROPERTY_SAVE= "save";
+ protected static final String ITEM = "item"; //$NON-NLS-1$
+ protected static final String PROPERTY_MODE= "mode"; //$NON-NLS-1$
+ protected static final String PROPERTY_SAVE= "save"; //$NON-NLS-1$
private final TableViewer fTableViewer;
private final List fItems;
@@ -104,14 +105,14 @@ public class FileTypeTable implements ICellModifier, IStructuredContentProvider,
*/
final TableColumn fileColumn = new TableColumn(table, SWT.NONE, 0);
fileColumn.setWidth(converter.convertWidthInCharsToPixels(LARGE_COLUMN));
- fileColumn.setText("Name/Extension");
+ fileColumn.setText(Policy.bind("FileTypeTable.4")); //$NON-NLS-1$
/**
* The 'Mode' column
*/
final TableColumn modeColumn = new TableColumn(table, SWT.NONE, 1);
modeColumn.setWidth(converter.convertWidthInCharsToPixels(SMALL_COLUMN));
- modeColumn.setText("Content");
+ modeColumn.setText(Policy.bind("FileTypeTable.5")); //$NON-NLS-1$
/**
* The 'Save' column
@@ -119,7 +120,7 @@ public class FileTypeTable implements ICellModifier, IStructuredContentProvider,
if (fShowSaveColumn) {
final TableColumn saveColumn = new TableColumn(table, SWT.NONE, 2);
saveColumn.setWidth(converter.convertWidthInCharsToPixels(LARGE_COLUMN));
- saveColumn.setText("Remember decision?");
+ saveColumn.setText(Policy.bind("FileTypeTable.6")); //$NON-NLS-1$
}
/**
@@ -194,7 +195,7 @@ public class FileTypeTable implements ICellModifier, IStructuredContentProvider,
final Item item= (Item) element;
if (columnIndex == 0) {
- return (item instanceof Extension ? "*." : "") + item.name;
+ return (item instanceof Extension ? "*." : "") + item.name; //$NON-NLS-1$ //$NON-NLS-2$
}
if (columnIndex == 1) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
index 17aa0a36f..de4e6b016 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/TextPreferencePage.java
@@ -22,9 +22,8 @@ import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.IFileTypeInfo;
+import org.eclipse.team.core.IStringMapping;
import org.eclipse.team.core.Team;
-import org.eclipse.team.internal.core.KnownModesForNames;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.ui.IWorkbench;
@@ -55,19 +54,19 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
fItems.clear();
- final IFileTypeInfo [] extensionInfoArray= Team.getAllTypes();
- final IFileTypeInfo [] nameInfoArray= KnownModesForNames.getKnownModesForNames();
+ final IStringMapping [] extensionInfoArray= Team.getFileContentManager().getExtensionMappings();
+ final IStringMapping [] nameInfoArray= Team.getFileContentManager().getNameMappings();
for (int i = 0; i < extensionInfoArray.length; i++) {
- final IFileTypeInfo info= extensionInfoArray[i];
- final FileTypeTable.Extension extension= new FileTypeTable.Extension(info.getExtension());
+ final IStringMapping info= extensionInfoArray[i];
+ final FileTypeTable.Extension extension= new FileTypeTable.Extension(info.getString());
extension.mode= info.getType();
fItems.add(extension);
}
for (int i = 0; i < nameInfoArray.length; i++) {
- final IFileTypeInfo info= nameInfoArray[i];
- final FileTypeTable.Name name= new FileTypeTable.Name(info.getExtension());
+ final IStringMapping info= nameInfoArray[i];
+ final FileTypeTable.Name name= new FileTypeTable.Name(info.getString());
name.mode= info.getType();
fItems.add(name);
}
@@ -127,7 +126,7 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
});
final Button addNameButton = new Button(buttonsComposite, SWT.PUSH);
- addNameButton.setText("Add Name...");
+ addNameButton.setText(Policy.bind("TextPreferencePage.0")); //$NON-NLS-1$
addNameButton.setLayoutData(SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.FILL, SWT.FILL, false, false));
addNameButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
@@ -197,8 +196,8 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
final int [] extensionsModes= integerListToIntArray(extensionsModesList);
final int [] namesModes= integerListToIntArray(namesModesList);
- Team.setAllTypes(extensions, extensionsModes);
- KnownModesForNames.setModesforFiles(names, namesModes);
+ Team.getFileContentManager().setExtensionMappings(extensions, extensionsModes);
+ Team.getFileContentManager().setNameMappings(names, namesModes);
TeamUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, TeamUI.GLOBAL_FILE_TYPES_CHANGED, null, null));
@@ -221,8 +220,8 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
dialog.open();
if (dialog.getReturnCode() != InputDialog.OK) return;
- final String extension = dialog.getValue().trim().replaceAll("\\*\\.", "");
- if (extension.equals(""))
+ final String extension = dialog.getValue().trim().replaceAll("\\*\\.", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (extension.equals("")) //$NON-NLS-1$
return;
// Check if the item already exists
@@ -248,7 +247,7 @@ public class TextPreferencePage extends PreferencePage implements IWorkbenchPref
if (dialog.getReturnCode() != InputDialog.OK) return;
final String name = dialog.getValue();
- if (name.length() == 0 || name.indexOf(" ") >= 0)
+ if (name.length() == 0 || name.indexOf(" ") >= 0) //$NON-NLS-1$
return; //$NON-NLS-1$
// Check if the item already exists
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java
index f2d3b0ce0..eb031e0be 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/HierarchicalModelManager.java
@@ -36,7 +36,7 @@ public class HierarchicalModelManager extends SynchronizeModelManager {
*/
protected ISynchronizeModelProvider createModelProvider(String id) {
if(id == null) {
- id = getConfiguration().getProviderID();
+ id = getDefaultProviderId();
}
if (id.endsWith(FlatModelProvider.FlatModelProviderDescriptor.ID)) {
return new FlatModelProvider(getConfiguration(), getSyncInfoSet());
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java
index d843cbbe1..30d32b44f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelManager.java
@@ -20,8 +20,7 @@ import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.core.Assert;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.*;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.IActionBars;
@@ -106,6 +105,18 @@ public abstract class SynchronizeModelManager extends SynchronizePageActionGroup
return modelProvider;
}
+ protected String getDefaultProviderId() {
+ String defaultLayout = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_LAYOUT);
+ if (defaultLayout.equals(IPreferenceIds.TREE_LAYOUT)) {
+ return HierarchicalModelProvider.HierarchicalModelProviderDescriptor.ID;
+ }
+ if (defaultLayout.equals(IPreferenceIds.FLAT_LAYOUT)) {
+ return FlatModelProvider.FlatModelProviderDescriptor.ID;
+ }
+ // Return compressed folder is the others were not a match
+ return CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID;
+ }
+
/**
* Return the id of the selected provider. By default, this is the
* id of the active provider. However, subclasses that use a composite
@@ -118,7 +129,7 @@ public abstract class SynchronizeModelManager extends SynchronizePageActionGroup
if (provider != null) {
return provider.getDescriptor().getId();
}
- return configuration.getProviderID();
+ return getDefaultProviderId();
}
/**
@@ -209,7 +220,7 @@ public abstract class SynchronizeModelManager extends SynchronizePageActionGroup
// The input may of been set already. In that case, don't change it and
// simply assign it to the view.
if(modelProvider == null) {
- String defaultProviderId = configuration.getProviderID(); /* use providers prefered */
+ String defaultProviderId = getDefaultProviderId(); /* use providers prefered */
IDialogSettings pageSettings = configuration.getSite().getPageSettings();
if(pageSettings != null && pageSettings.get(P_LAST_PROVIDER) != null) {
defaultProviderId = pageSettings.get(P_LAST_PROVIDER);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
index 2a44b8bf6..cc25ba381 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java
@@ -17,13 +17,19 @@ import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.util.*;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.ListenerList;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ui.IPreferenceIds;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.synchronize.actions.DefaultSynchronizePageActions;
-import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
+import org.eclipse.team.ui.synchronize.ISynchronizePage;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
+import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.actions.ActionContext;
@@ -539,28 +545,4 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp
public IRunnableContext getRunnableContext() {
return context;
}
-
- public String getProviderID() {
- String layout= (String)getProperty(P_LAYOUT);
- if (layout == null) {
- return getDefaultProviderID();
- }
- if (FLAT_LAYOUT.equals(layout))
- return FlatModelProvider.FlatModelProviderDescriptor.ID;
- if (TREE_LAYOUT.equals(layout))
- return HierarchicalModelProvider.HierarchicalModelProviderDescriptor.ID;
- return CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID;
- }
-
- private String getDefaultProviderID() {
- String defaultLayout = TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_LAYOUT);
- if (defaultLayout.equals(IPreferenceIds.TREE_LAYOUT)) {
- return HierarchicalModelProvider.HierarchicalModelProviderDescriptor.ID;
- }
- if (defaultLayout.equals(IPreferenceIds.FLAT_LAYOUT)) {
- return FlatModelProvider.FlatModelProviderDescriptor.ID;
- }
- // Return compressed folder is the others were not a match
- return CompressedFoldersModelProvider.CompressedFolderModelProviderDescriptor.ID;
- }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizePageConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizePageConfiguration.java
index 57f6d5a50..cb7f868e2 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizePageConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizePageConfiguration.java
@@ -32,9 +32,6 @@ import org.eclipse.ui.IWorkbenchActionConstants;
*/
public interface ISynchronizePageConfiguration {
-
- public static final String P_LAYOUT = TeamUIPlugin.ID + "P_LAYOUT"; //$NON-NLS-1$
-
/**
* Property constant for the <code>SyncInfoSet</code> that is being
* displayed by the page.
@@ -109,11 +106,6 @@ public interface ISynchronizePageConfiguration {
*/
public static final String P_SUPPORTED_MODES = TeamUIPlugin.ID + ".P_SUPPORTED_MODES"; //$NON-NLS-1$
-
- public static final String FLAT_LAYOUT= "flat";
- public static final String TREE_LAYOUT= "tree";
- public static final String COMPRESSED_LAYOUT= "compressed";
-
/**
* The id of the synchronize group the determines where the synchronize
* actions appear.
@@ -212,7 +204,7 @@ public interface ISynchronizePageConfiguration {
public final static int BOTH_MODE = 0x4;
public final static int CONFLICTING_MODE = 0x8;
public final static int ALL_MODES = INCOMING_MODE | OUTGOING_MODE | CONFLICTING_MODE | BOTH_MODE;
-
+
/**
* Return the particpant associated with the page to shich this configuration
* is associated.
@@ -395,6 +387,4 @@ public interface ISynchronizePageConfiguration {
* @return a runnable context (or <code>null</code>)
*/
IRunnableContext getRunnableContext();
-
- public String getProviderID();
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPagePane.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPagePane.java
index f6de2e4b5..fbadc08c3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPagePane.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ParticipantPagePane.java
@@ -169,7 +169,7 @@ public final class ParticipantPagePane {
try {
((ISynchronizePage)page).init(pageConfiguration.getSite());
} catch (PartInitException e1) {
- TeamUIPlugin.log(IStatus.ERROR, "Error creating Synchronize Page", e1);
+ TeamUIPlugin.log(IStatus.ERROR, Policy.bind("ParticipantPagePane.0"), e1); //$NON-NLS-1$
}
page.createControl(fEditionPane);

Back to the top