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 79439 Details for
Bug 97676
[Preferences] Pref Page General/Editors/Content Types problems - File Associations
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 to add an 'Edit...' button to the preference page.
content-type-edit-btn-patch.txt (text/plain), 7.06 KB, created by
Remy Suen
on 2007-09-29 10:23:21 EDT
(
hide
)
Description:
Patch to add an 'Edit...' button to the preference page.
Filename:
MIME Type:
Creator:
Remy Suen
Created:
2007-09-29 10:23:21 EDT
Size:
7.06 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java,v >retrieving revision 1.16 >diff -u -r1.16 FileExtensionDialog.java >--- Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java 2 Jul 2007 22:56:24 -0000 1.16 >+++ Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java 29 Sep 2007 14:21:24 -0000 >@@ -40,6 +40,8 @@ > private static final String DIALOG_SETTINGS_SECTION = "FileExtensionDialogSettings"; //$NON-NLS-1$ > > private String filename = ""; //$NON-NLS-1$ >+ >+ private String initialValue; > > private Text filenameField; > >@@ -80,6 +82,9 @@ > .setText(WorkbenchMessages.FileExtension_fileTypeLabel); > > filenameField = new Text(contents, SWT.SINGLE | SWT.BORDER); >+ if (initialValue != null) { >+ filenameField.setText(initialValue); >+ } > filenameField.addModifyListener(new ModifyListener() { > public void modifyText(ModifyEvent event) { > if (event.widget == filenameField) { >@@ -192,6 +197,16 @@ > return filename.substring(0, index); > } > >+ /** >+ * Sets the initial value that should be prepopulated in this dialog. >+ * >+ * @param initialValue >+ * the value to be displayed to the user >+ * @since 3.4 >+ */ >+ public void setInitialValue(String initialValue) { >+ this.initialValue = initialValue; >+ } > > /* (non-Javadoc) > * @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsSettings() >Index: Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypesPreferencePage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypesPreferencePage.java,v >retrieving revision 1.20 >diff -u -r1.20 ContentTypesPreferencePage.java >--- Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypesPreferencePage.java 16 Apr 2007 20:33:38 -0000 1.20 >+++ Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypesPreferencePage.java 29 Sep 2007 14:21:22 -0000 >@@ -77,6 +77,8 @@ > private TreeViewer contentTypesViewer; > > private Button addButton; >+ >+ private Button editButton; > > private Text charsetField; > >@@ -422,6 +424,7 @@ > IStructuredSelection selection = (IStructuredSelection) event > .getSelection(); > if (selection.isEmpty()) { >+ editButton.setEnabled(false); > removeButton.setEnabled(false); > return; > } >@@ -433,6 +436,7 @@ > enabled = false; > } > } >+ editButton.setEnabled(enabled && selection.size() == 1); > removeButton.setEnabled(enabled); > } > }); >@@ -481,7 +485,60 @@ > StatusManager.SHOW, shell); > WorkbenchPlugin.log(ex); > } finally { >- fileAssociationViewer.setInput(selectedContentType); >+ fileAssociationViewer.refresh(false); >+ } >+ } >+ } >+ }); >+ >+ editButton = new Button(buttonArea, SWT.PUSH); >+ editButton.setFont(composite.getFont()); >+ editButton >+ .setText(WorkbenchMessages.ContentTypes_fileAssociationsEditLabel); >+ editButton.setEnabled(false); >+ setButtonLayoutData(editButton); >+ editButton.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ Shell shell = composite.getShell(); >+ IContentType selectedContentType = getSelectedContentType(); >+ Spec spec = getSelectedSpecs()[0]; >+ FileExtensionDialog dialog = new FileExtensionDialog(shell); >+ if (spec.name == null) { >+ dialog.setInitialValue("*." + spec.ext); //$NON-NLS-1$ >+ } else { >+ dialog.setInitialValue(spec.name); >+ } >+ if (dialog.open() == Window.OK) { >+ String name = dialog.getName(); >+ String extension = dialog.getExtension(); >+ try { >+ // remove the original spec >+ if (spec.name != null) { >+ selectedContentType.removeFileSpec(spec.name, >+ IContentType.FILE_NAME_SPEC); >+ } else if (spec.ext != null) { >+ selectedContentType.removeFileSpec(spec.ext, >+ IContentType.FILE_EXTENSION_SPEC); >+ } >+ >+ // add the new one >+ if (name.equals("*")) { //$NON-NLS-1$ >+ selectedContentType.addFileSpec(extension, >+ IContentType.FILE_EXTENSION_SPEC); >+ } else { >+ selectedContentType >+ .addFileSpec( >+ name >+ + (extension.length() > 0 ? ('.' + extension) >+ : ""), //$NON-NLS-1$ >+ IContentType.FILE_NAME_SPEC); >+ } >+ } catch (CoreException ex) { >+ StatusUtil.handleStatus(ex.getStatus(), >+ StatusManager.SHOW, shell); >+ WorkbenchPlugin.log(ex); >+ } finally { >+ fileAssociationViewer.refresh(false); > } > } > } >@@ -523,7 +580,7 @@ > StatusUtil.handleStatus(result, StatusManager.SHOW, > composite.getShell()); > } >- fileAssociationViewer.setInput(contentType); >+ fileAssociationViewer.refresh(false); > } > }); > } >Index: Eclipse UI/org/eclipse/ui/internal/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties,v >retrieving revision 1.361 >diff -u -r1.361 messages.properties >--- Eclipse UI/org/eclipse/ui/internal/messages.properties 10 Sep 2007 14:54:21 -0000 1.361 >+++ Eclipse UI/org/eclipse/ui/internal/messages.properties 29 Sep 2007 14:21:20 -0000 >@@ -933,6 +933,7 @@ > ContentTypes_characterSetUpdateLabel = &Update > ContentTypes_fileAssociationsLabel = &File associations: > ContentTypes_fileAssociationsAddLabel = &Add... >+ContentTypes_fileAssociationsEditLabel = E&dit... > ContentTypes_fileAssociationsRemoveLabel = &Remove > ContentTypes_contentTypesLabel = &Content types: > ContentTypes_errorDialogMessage = There was an error removing content type file association(s). >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java,v >retrieving revision 1.91 >diff -u -r1.91 WorkbenchMessages.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java 29 Aug 2007 14:53:05 -0000 1.91 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java 29 Sep 2007 14:21:15 -0000 >@@ -933,6 +933,7 @@ > public static String ContentTypes_characterSetUpdateLabel; > public static String ContentTypes_fileAssociationsLabel; > public static String ContentTypes_fileAssociationsAddLabel; >+ public static String ContentTypes_fileAssociationsEditLabel; > public static String ContentTypes_fileAssociationsRemoveLabel; > public static String ContentTypes_contentTypesLabel; > public static String ContentTypes_errorDialogMessage;
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 97676
: 79439