Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 82803 Details for
Bug 208951
[api] Require an extension point to specify file transfer mode (binary/ascii) for a specific filetype
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch with changes to preferences
patch.txt (text/plain), 17.53 KB, created by
David McKnight
on 2007-11-13 15:48:28 EST
(
hide
)
Description:
patch with changes to preferences
Filename:
MIME Type:
Creator:
David McKnight
Created:
2007-11-13 15:48:28 EST
Size:
17.53 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.subsystems.files.core >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.files.core/META-INF/MANIFEST.MF,v >retrieving revision 1.16 >diff -u -r1.16 MANIFEST.MF >--- META-INF/MANIFEST.MF 31 Oct 2007 18:13:23 -0000 1.16 >+++ META-INF/MANIFEST.MF 13 Nov 2007 20:44:07 -0000 >@@ -1,7 +1,7 @@ > Manifest-Version: 1.0 > Bundle-ManifestVersion: 2 > Bundle-Name: %pluginName >-Bundle-SymbolicName: org.eclipse.rse.subsystems.files.core >+Bundle-SymbolicName: org.eclipse.rse.subsystems.files.core;singleton:=true > Bundle-Version: 3.0.0.qualifier > Bundle-Activator: org.eclipse.rse.internal.subsystems.files.core.Activator > Bundle-Localization: plugin >Index: src/org/eclipse/rse/subsystems/files/core/model/SystemFileTransferModeRegistry.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/SystemFileTransferModeRegistry.java,v >retrieving revision 1.14 >diff -u -r1.14 SystemFileTransferModeRegistry.java >--- src/org/eclipse/rse/subsystems/files/core/model/SystemFileTransferModeRegistry.java 15 May 2007 23:54:43 -0000 1.14 >+++ src/org/eclipse/rse/subsystems/files/core/model/SystemFileTransferModeRegistry.java 13 Nov 2007 20:44:07 -0000 >@@ -13,6 +13,7 @@ > * > * Contributors: > * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin >+ * David McKnight (IBM) - [208951] Use remoteFileTypes extension point to determine file types > *******************************************************************************/ > > package org.eclipse.rse.subsystems.files.core.model; >@@ -29,8 +30,12 @@ > import java.util.List; > import java.util.SortedSet; > import java.util.TreeSet; >+import java.util.Vector; > > import org.eclipse.core.resources.IFile; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtensionRegistry; >+import org.eclipse.core.runtime.Platform; > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants; > import org.eclipse.rse.services.clientserver.SystemEncodingUtil; >@@ -41,8 +46,6 @@ > import org.eclipse.ui.IFileEditorMapping; > import org.eclipse.ui.IMemento; > import org.eclipse.ui.IPropertyListener; >-import org.eclipse.ui.IWorkbench; >-import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.XMLMemento; > > >@@ -70,6 +73,7 @@ > private static final String BINARY_VALUE = "binary"; //$NON-NLS-1$ > private static final String TEXT_VALUE = "text"; //$NON-NLS-1$ > >+ > > /** > * Constructor for SystemFileTransferModeRegistry >@@ -102,6 +106,106 @@ > // load our current associations (if any) > loadAssociations(); > >+ >+ // lists to hold the information from the extensions to our >+ // extension point >+ Vector extTextList = new Vector(); >+ Vector extBinaryList = new Vector(); >+ >+ // get reference to the extension registry >+ IExtensionRegistry extRegistry = Platform.getExtensionRegistry(); >+ >+ // get extensions to our extension point >+ IConfigurationElement[] elements = extRegistry.getConfigurationElementsFor("org.eclipse.rse.subsystems.files.core", "remoteFileTypes"); >+ >+ // go through all extensions >+ for (int i = 0; i < elements.length; i++) { >+ IConfigurationElement element = elements[i]; >+ >+ // get the extension attribute value >+ String extension = element.getAttribute("extension"); >+ >+ if (extension != null && !extension.equals("")) { >+ >+ // get the type attribute value >+ String type = element.getAttribute("type"); >+ >+ if (type != null && !type.equals("")) { >+ >+ // add extension to list of text types >+ if (type.equalsIgnoreCase("text")) { >+ >+ // if the extension is not already part of our text >+ // types list >+ if (!extTextList.contains(extension)) { >+ >+ // add to list >+ extTextList.add(extension); >+ >+ // create an editor mapping >+ // FileEditorMapping mapping = new FileEditorMapping("*", extension); >+ >+ // add to editor mapping list >+ // editorMappings.add(mapping); >+ } >+ } >+ // add extension to list of binary types >+ if (type.equalsIgnoreCase("binary")) { >+ >+ // if the extension is not already part of our >+ // binary types list >+ if (!extBinaryList.contains(extension)) { >+ >+ // add to list >+ extBinaryList.add(extension); >+ >+ // create an editor mapping >+ // FileEditorMapping mapping = new FileEditorMapping("*", extension); >+ >+ // add to editor mapping list >+ // editorMappings.add(mapping); >+ } >+ } >+ else { >+ continue; >+ } >+ } >+ } >+ else { >+ continue; >+ } >+ } >+ >+ // add text extension to the mappings list >+ for (int t = 0; t < extTextList.size(); t++) >+ { >+ String extension = (String)extTextList.get(t); >+ SystemFileTransferModeMapping mapping = new SystemFileTransferModeMapping(extension); >+ >+ String key = getMappingKey(mapping); >+ if (!typeModeMappings.containsKey(key)) >+ { >+ mapping.setAsText(); >+ typeModeMappings.put(key, mapping); >+ } >+ } >+ >+ // add binary extension to the mappings list >+ for (int b = 0; b < extBinaryList.size(); b++) >+ { >+ String extension = (String)extBinaryList.get(b); >+ SystemFileTransferModeMapping mapping = new SystemFileTransferModeMapping(extension); >+ >+ >+ String key = getMappingKey(mapping); >+ if (!typeModeMappings.containsKey(key)) >+ { >+ mapping.setAsBinary(); >+ typeModeMappings.put(key, mapping); >+ } >+ } >+ >+ /* > // now we need to ensure that our mapping is in sync with the > // editor registry. We can be out of sync because we may not have > // been listening for editor registry changes (e.g. if our plugin wasn't >@@ -124,6 +228,7 @@ > > registry.addPropertyListener(this); > } >+ */ > } > > >@@ -385,6 +490,18 @@ > > SystemFileTransferModeMapping mapping = new SystemFileTransferModeMapping(name, extension); > >+ /* >+ // if the extension is part of the extension text type list >+ if (extTextList.contains(extension)) { >+ mapping.setAsText(); >+ return mapping; >+ } >+ // if the extension is part of the extension binary type list >+ else if (extBinaryList.contains(extension)) { >+ mapping.setAsBinary(); >+ return mapping; >+ } >+ */ > > // check if it's a default text file name > for (int i = 0; i < DEFAULT_TEXT_FILE_NAMES.length; i++) >Index: plugin.xml >=================================================================== >RCS file: plugin.xml >diff -N plugin.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ plugin.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<?eclipse version="3.0"?> >+<plugin> >+<!-- ================================================================= --> >+<!-- Define Remote File Types extension point --> >+<!-- ================================================================= --> >+ <extension-point id="remoteFileTypes" name="%extPoint.remoteFileTypes" schema="schema/remoteFileTypes.exsd"/> >+ >+ >+ >+<extension point="org.eclipse.rse.subsystems.files.core.remoteFileTypes"> >+ <remoteFileTypes extension="txt" type="text"/> >+ <remoteFileTypes extension="gif" type="binary"/> >+</extension> >+ >+</plugin> >Index: schema/remoteFileTypes.exsd >=================================================================== >RCS file: schema/remoteFileTypes.exsd >diff -N schema/remoteFileTypes.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/remoteFileTypes.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,120 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.rse.subsystems.files.core"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.rse.subsystems.files.core" id="remoteFileTypes" name="%extPoint.remoteFileTypes"/> >+ </appInfo> >+ <documentation> >+ This extension point is used to register information about whether particular file types should be considered text or binary. This information is important as it will determine how files will be transferred. >+ >+Providers may provide an extension for this extension point. No code beyond the XML extension declaration is required. >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <complexType> >+ <sequence minOccurs="1" maxOccurs="unbounded"> >+ <element ref="remoteFileTypes"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="remoteFileTypes"> >+ <complexType> >+ <attribute name="extension" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="type" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ 3.0 >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ <extension point="org.eclipse.rse.subsystems.files.core.remoteFileTypes"> >+ <remoteFileTypes extension="txt" type="text"/> >+ <remoteFileTypes extension="gif" type="binary"/> >+</extension> >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiInfo"/> >+ </appInfo> >+ <documentation> >+ There is no code to implement for this extension point. >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ Copyright (c) 2006, 2007 IBM Corporation. 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 >+ </documentation> >+ </annotation> >+ >+</schema> >#P org.eclipse.rse.files.ui >Index: src/org/eclipse/rse/internal/files/ui/propertypages/UniversalPreferencePage.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/UniversalPreferencePage.java,v >retrieving revision 1.4 >diff -u -r1.4 UniversalPreferencePage.java >--- src/org/eclipse/rse/internal/files/ui/propertypages/UniversalPreferencePage.java 31 Oct 2007 21:02:34 -0000 1.4 >+++ src/org/eclipse/rse/internal/files/ui/propertypages/UniversalPreferencePage.java 13 Nov 2007 20:44:09 -0000 >@@ -35,6 +35,7 @@ > import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; > import org.eclipse.rse.services.clientserver.messages.SystemMessage; > import org.eclipse.rse.services.clientserver.messages.SystemMessageFile; >+import org.eclipse.rse.subsystems.files.core.model.ISystemFileTransferModeMapping; > import org.eclipse.rse.subsystems.files.core.model.SystemFileTransferModeMapping; > import org.eclipse.rse.subsystems.files.core.model.SystemFileTransferModeRegistry; > import org.eclipse.rse.ui.ISystemMessages; >@@ -65,11 +66,12 @@ > import org.eclipse.ui.IEditorRegistry; > import org.eclipse.ui.IFileEditorMapping; > import org.eclipse.ui.IPropertyListener; >+import org.eclipse.ui.ISharedImages; > import org.eclipse.ui.IWorkbench; > import org.eclipse.ui.IWorkbenchPreferencePage; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.WorkbenchImages; > import org.eclipse.ui.internal.dialogs.FileExtensionDialog; >-import org.eclipse.ui.internal.registry.EditorRegistry; > import org.eclipse.ui.internal.registry.FileEditorMapping; > > /** >@@ -96,7 +98,7 @@ > protected Button defaultTextButton; > > protected SystemFileTransferModeRegistry modeRegistry; >- protected IEditorRegistry editorRegistry; >+ //protected IEditorRegistry editorRegistry; > > protected ArrayList modeMappings; > protected ArrayList editorMappings; >@@ -129,7 +131,7 @@ > protected void createFieldEditors() { > > modeRegistry = SystemFileTransferModeRegistry.getInstance(); >- editorRegistry = PlatformUI.getWorkbench().getEditorRegistry(); >+ //editorRegistry = PlatformUI.getWorkbench().getEditorRegistry(); > > modeMappings = new ArrayList(); > editorMappings = new ArrayList(); >@@ -429,10 +431,12 @@ > tableCol.setResizable(false); > tableCol.setText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_TABLECOL_LABEL); > >- IFileEditorMapping[] mappingArray = editorRegistry.getFileEditorMappings(); > >- for (int i = 0; i < mappingArray.length; i++) { >- newResourceTableItem(mappingArray[i], i, false); >+ //IFileEditorMapping[] mappingArray = editorRegistry.getFileEditorMappings(); >+ ISystemFileTransferModeMapping[] mappings = modeRegistry.getModeMappings(); >+ >+ for (int i = 0; i < mappings.length; i++) { >+ newResourceTableItem(mappings[i], i, false); > } > > int defaultFileTransferMode = getFileTransferModeDefaultPreference(); >@@ -458,10 +462,11 @@ > resourceTypeTable.removeAll(); > > >- IFileEditorMapping[] mappingArray = editorRegistry.getFileEditorMappings(); >- for (int i = 0; i < mappingArray.length; i++) >+ ISystemFileTransferModeMapping[] mappings = modeRegistry.getModeMappings(); >+ //IFileEditorMapping[] mappingArray = editorRegistry.getFileEditorMappings(); >+ for (int i = 0; i < mappings.length; i++) > { >- newResourceTableItem(mappingArray[i], i, false); >+ newResourceTableItem(mappings[i], i, false); > } > resourceTypeTable.setRedraw(true); > >@@ -493,16 +498,22 @@ > uploadBufferSize.setText(ISystemFilePreferencesConstants.DEFAULT_DOWNLOAD_BUFFER_SIZE + ""); //$NON-NLS-1$ > } > >+ private Image getImageDescriptor(ISystemFileTransferModeMapping mapping) >+ { >+ String extension = mapping.getExtension(); >+ return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE).createImage(); >+ } >+ > /** > * Create a new <code>TableItem</code> to represent the resource > * type editor description supplied. > */ >- protected TableItem newResourceTableItem(IFileEditorMapping mapping, int index, boolean selected) { >- >- editorMappings.add(index, ((FileEditorMapping)mapping).clone()); >- modeMappings.add(index, modeRegistry.getMapping(mapping).clone()); >+ protected TableItem newResourceTableItem(ISystemFileTransferModeMapping mapping, int index, boolean selected) { > >- Image image = mapping.getImageDescriptor().createImage(false); >+ // editorMappings.add(index, ((FileEditorMapping)mapping).clone()); >+ modeMappings.add(index, mapping); >+ >+ Image image = getImageDescriptor(mapping); > > if (image != null) > imagesToDispose.add(image); >@@ -514,6 +525,8 @@ > if (selected) > resourceTypeTable.setSelection(index); > >+ >+ > return item; > } > >@@ -691,7 +704,9 @@ > > // Create the new type and insert it > resourceType = new FileEditorMapping(newName, newExtension); >- newResourceTableItem(resourceType, i, true); >+ SystemFileTransferModeMapping mapping = modeRegistry.getMapping(resourceType); >+ >+ newResourceTableItem(mapping, i, true); > resourceTypeTable.setFocus(); > fillMode(); > } >@@ -778,7 +793,7 @@ > super.performOk(); > if (modeMappings != null) > { >- IFileEditorMapping[] originalMappingArray = editorRegistry.getFileEditorMappings(); >+ //IFileEditorMapping[] originalMappingArray = editorRegistry.getFileEditorMappings(); > > // first save the transfer mode registry > Object[] array1 = modeMappings.toArray(); >@@ -799,8 +814,8 @@ > mappingArray2[j] = (FileEditorMapping)(array2[j]); > } > >- ((EditorRegistry)editorRegistry).setFileEditorMappings(mappingArray2); >- ((EditorRegistry)editorRegistry).saveAssociations(); >+ //((EditorRegistry)editorRegistry).setFileEditorMappings(mappingArray2); >+ //((EditorRegistry)editorRegistry).saveAssociations(); > > > // editorRegistry.removePropertyListener(this);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 208951
:
82788
| 82803