diff options
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardFileTypePage.java')
-rw-r--r-- | bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardFileTypePage.java | 155 |
1 files changed, 0 insertions, 155 deletions
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 deleted file mode 100644 index 891b8e273..000000000 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardFileTypePage.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.team.internal.ccvs.ui.wizards; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.team.core.Team; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.ICVSFile; -import org.eclipse.team.internal.ccvs.core.client.Command; -import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption; -import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; -import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; -import org.eclipse.team.internal.ccvs.ui.*; -import org.eclipse.team.internal.ui.SWTUtils; -import org.eclipse.team.internal.ui.preferences.FileTypeTable; -import org.eclipse.ui.PlatformUI; - -/** - * - */ -public class CommitWizardFileTypePage extends WizardPage { - - private final Collection fExtensions; - private final Collection fNames; - - public CommitWizardFileTypePage(Collection unknownExtensions, Collection unknownNames) { - super(CVSUIMessages.CommitWizardFileTypePage_0); - setTitle(CVSUIMessages.CommitWizardFileTypePage_0); - setDescription(CVSUIMessages.CommitWizardFileTypePage_2); - - fNames= new ArrayList(); - for (final Iterator iter = unknownNames.iterator(); iter.hasNext();) { - final String name = (String) iter.next(); - fNames.add(new FileTypeTable.Name(name, false)); - } - - fExtensions= new ArrayList(); - for (final Iterator iter = unknownExtensions.iterator(); iter.hasNext();) { - final String extension= (String)iter.next(); - fExtensions.add(new FileTypeTable.Extension(extension, false)); - } - } - - public void createControl(Composite parent) { - - initializeDialogUnits(parent); - - final Composite composite= new Composite(parent, SWT.NONE); - composite.setLayout(new GridLayout(1, false)); - // set F1 help - PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.COMMIT_FILE_TYPES_PAGE); - - final Label label= new Label(composite, SWT.WRAP); - label.setText(CVSUIMessages.CommitWizardFileTypePage_3); - label.setLayoutData(SWTUtils.createHFillGridData()); - Dialog.applyDialogFont(composite); - - final List items= new ArrayList(); - items.addAll(fNames); - items.addAll(fExtensions); - - new FileTypeTable(composite, items, true); - - setControl(composite); - - } - - public void getModesForExtensions(Map toSave, Map notToSave) { - getModes(fExtensions, toSave, notToSave); - } - - public void getModesForNames(Map toSave, Map notToSave) { - getModes(fNames, toSave, notToSave); - } - - private static void getModes(Collection items, Map toSave, Map notToSave) { - for (final Iterator iter = items.iterator(); iter.hasNext();) { - final FileTypeTable.Item item= (FileTypeTable.Item)iter.next(); - final Map destination= item.save ? toSave : notToSave; - destination.put(item.name, new Integer(item.mode)); - } - } - - public KSubstOption getOption(IFile file) throws CVSException { - final String extension= file.getFileExtension(); - if (extension != null) { - for (Iterator iter = fExtensions.iterator(); iter.hasNext();) { - final FileTypeTable.Item element = (FileTypeTable.Item) iter.next(); - if (element.name.equals(extension)) { - return element.mode == Team.TEXT ? KSubstOption.getDefaultTextMode() : Command.KSUBST_BINARY; - } - } - } else { - final String name= file.getName(); - for (Iterator iter = fNames.iterator(); iter.hasNext();) { - FileTypeTable.Item item = (FileTypeTable.Item) iter.next(); - if (item.name.equals(name)) { - return item.mode == Team.TEXT ? KSubstOption.getDefaultTextMode() : Command.KSUBST_BINARY; - } - } - } - final ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file); - ResourceSyncInfo fileInfo = cvsFile.getSyncInfo(); - return fileInfo != null ? fileInfo.getKeywordMode() : KSubstOption.fromFile(file); - } - - public static void saveExtensionMappings(Map modesToPersist) { - - final String [] extensions= 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(); - ++index; - } - Team.getFileContentManager().addExtensionMappings(extensions, modes); - } - - public static void saveNameMappings(Map modesToPersist) { - - 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();) { - names[index]= (String) iter.next(); - modes[index]= ((Integer)modesToPersist.get(names[index])).intValue(); - ++index; - } - Team.getFileContentManager().addNameMappings(names, modes); - } -} |