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 142359 Details for
Bug 48966
[preferences] Should be able to export from 'Formatter' preference page
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
patch6_48966.txt (text/plain), 11.27 KB, created by
Raksha Vasisht
on 2009-07-23 05:46:32 EDT
(
hide
)
Description:
Patch with changes
Filename:
MIME Type:
Creator:
Raksha Vasisht
Created:
2009-07-23 05:46:32 EDT
Size:
11.27 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: ui/org/eclipse/jdt/internal/ui/preferences/formatter/ProfileConfigurationBlock.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/ProfileConfigurationBlock.java,v >retrieving revision 1.12 >diff -u -r1.12 ProfileConfigurationBlock.java >--- ui/org/eclipse/jdt/internal/ui/preferences/formatter/ProfileConfigurationBlock.java 18 Mar 2009 11:06:47 -0000 1.12 >+++ ui/org/eclipse/jdt/internal/ui/preferences/formatter/ProfileConfigurationBlock.java 23 Jul 2009 09:35:04 -0000 >@@ -13,6 +13,7 @@ > import java.io.File; > import java.util.ArrayList; > import java.util.Collection; >+import java.util.Iterator; > import java.util.List; > import java.util.Observable; > import java.util.Observer; >@@ -32,6 +33,8 @@ > import org.eclipse.swt.widgets.Shell; > > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.content.IContentType; > import org.eclipse.core.runtime.preferences.DefaultScope; > import org.eclipse.core.runtime.preferences.IScopeContext; > import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; >@@ -58,6 +61,7 @@ > import org.eclipse.jdt.internal.ui.preferences.formatter.ProfileManager.Profile; > import org.eclipse.jdt.internal.ui.util.ExceptionHandler; > import org.eclipse.jdt.internal.ui.util.SWTUtil; >+import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels; > > > public abstract class ProfileConfigurationBlock { >@@ -146,6 +150,7 @@ > fEditButton.addSelectionListener(this); > fDeleteButton.addSelectionListener(this); > fLoadButton.addSelectionListener(this); >+ fExportAllButton.addSelectionListener(this); > update(fProfileManager, null); > } > >@@ -165,6 +170,47 @@ > newButtonPressed(); > else if (button == fLoadButton) > loadButtonPressed(); >+ else if(button == fExportAllButton) >+ exportAllButtonPressed(); >+ } >+ >+ /** >+ * Exports all the profiles to a file. >+ * @since 3.6 >+ */ >+ private void exportAllButtonPressed() { >+ final FileDialog dialog= new FileDialog(fComposite.getShell(), SWT.SAVE); >+ dialog.setText(FormatterMessages.CodingStyleConfigurationBlock_export_profiles_dialog_title); >+ dialog.setFileName("formatterprofiles"); //$NON-NLS-1$ >+ dialog.setFilterExtensions(new String [] {"*.xml"}); //$NON-NLS-1$ >+ final String lastPath= JavaPlugin.getDefault().getDialogSettings().get(fLastSaveLoadPathKey + ".loadpath"); //$NON-NLS-1$ >+ if (lastPath != null) { >+ dialog.setFilterPath(lastPath); >+ } >+ final String path= dialog.open(); >+ if (path == null) >+ return; >+ >+ JavaPlugin.getDefault().getDialogSettings().put(fLastSaveLoadPathKey + ".savepath", dialog.getFilterPath()); //$NON-NLS-1$ >+ >+ final File file= new File(path); >+ if (file.exists() && !MessageDialog.openQuestion(fComposite.getShell(), FormatterMessages.CodingStyleConfigurationBlock_export_profiles_overwrite_title, Messages.format(FormatterMessages.CodingStyleConfigurationBlock_export_profiles_overwrite_message, BasicElementLabels.getPathLabel(file)))) { >+ return; >+ } >+ String encoding= ProfileStore.ENCODING; >+ final IContentType type= Platform.getContentTypeManager().getContentType("org.eclipse.core.runtime.xml"); //$NON-NLS-1$ >+ if (type != null) >+ encoding= type.getDefaultCharset(); >+ final Collection profiles= new ArrayList(); >+ profiles.addAll(fProfileManager.getSortedProfiles()); >+ try { >+ fProfileStore.writeProfilesToFile(profiles, file, encoding); >+ } catch (CoreException e) { >+ final String title= FormatterMessages.CodingStyleConfigurationBlock_export_profiles_error_title; >+ final String message= FormatterMessages.CodingStyleConfigurationBlock_export_profiles_error_message; >+ ExceptionHandler.handle(e, fComposite.getShell(), title, message); >+ } >+ > } > > public void widgetDefaultSelected(SelectionEvent e) { >@@ -218,29 +264,32 @@ > } > if (profiles == null || profiles.isEmpty()) > return; >+ Iterator iter=profiles.iterator(); >+ while (iter.hasNext()) { >+ final CustomProfile profile= (CustomProfile)iter.next(); >+ >+ if (!fProfileVersioner.getProfileKind().equals(profile.getKind())) { >+ final String title= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_title; >+ final String message= Messages.format(FormatterMessages.ProfileConfigurationBlock_load_profile_wrong_profile_message, new String[] { fProfileVersioner.getProfileKind(), >+ profile.getKind() }); >+ MessageDialog.openError(fComposite.getShell(), title, message); >+ return; >+ } > >- final CustomProfile profile= (CustomProfile)profiles.iterator().next(); >- >- if (!fProfileVersioner.getProfileKind().equals(profile.getKind())) { >- final String title= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_title; >- final String message= Messages.format(FormatterMessages.ProfileConfigurationBlock_load_profile_wrong_profile_message, new String[] {fProfileVersioner.getProfileKind(), profile.getKind()}); >- MessageDialog.openError(fComposite.getShell(), title, message); >- return; >- } >- >- if (profile.getVersion() > fProfileVersioner.getCurrentVersion()) { >- final String title= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_too_new_title; >- final String message= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_too_new_message; >- MessageDialog.openWarning(fComposite.getShell(), title, message); >- } >+ if (profile.getVersion() > fProfileVersioner.getCurrentVersion()) { >+ final String title= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_too_new_title; >+ final String message= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_too_new_message; >+ MessageDialog.openWarning(fComposite.getShell(), title, message); >+ } > >- if (fProfileManager.containsName(profile.getName())) { >- final AlreadyExistsDialog aeDialog= new AlreadyExistsDialog(fComposite.getShell(), profile, fProfileManager); >- if (aeDialog.open() != Window.OK) >- return; >+ if (fProfileManager.containsName(profile.getName())) { >+ final AlreadyExistsDialog aeDialog= new AlreadyExistsDialog(fComposite.getShell(), profile, fProfileManager); >+ if (aeDialog.open() != Window.OK) >+ return; >+ } >+ fProfileVersioner.update(profile); >+ fProfileManager.addProfile(profile); > } >- fProfileVersioner.update(profile); >- fProfileManager.addProfile(profile); > } > } > >@@ -253,6 +302,7 @@ > private Button fDeleteButton; > private Button fNewButton; > private Button fLoadButton; >+ private Button fExportAllButton; > > private PixelConverter fPixConv; > /** >@@ -365,6 +415,7 @@ > > fNewButton= createButton(fComposite, FormatterMessages.CodingStyleConfigurationBlock_new_button_desc, GridData.HORIZONTAL_ALIGN_BEGINNING); > fLoadButton= createButton(fComposite, FormatterMessages.CodingStyleConfigurationBlock_load_button_desc, GridData.HORIZONTAL_ALIGN_END); >+ fExportAllButton= createButton(fComposite, FormatterMessages.CodingStyleConfigurationBlock_export_all_button_desc, GridData.HORIZONTAL_ALIGN_BEGINNING); > createLabel(fComposite, "", 3); //$NON-NLS-1$ > > configurePreview(fComposite, numColumns, fProfileManager); >Index: ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.java,v >retrieving revision 1.25 >diff -u -r1.25 FormatterMessages.java >--- ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.java 8 Dec 2008 16:49:40 -0000 1.25 >+++ ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.java 23 Jul 2009 09:34:49 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 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 >@@ -456,6 +456,12 @@ > public static String CodingStyleConfigurationBlock_load_profile_error_too_new_message; > public static String CodingStyleConfigurationBlock_save_profile_overwrite_title; > public static String CodingStyleConfigurationBlock_save_profile_overwrite_message; >+ public static String CodingStyleConfigurationBlock_export_all_button_desc; >+ public static String CodingStyleConfigurationBlock_export_profiles_dialog_title; >+ public static String CodingStyleConfigurationBlock_export_profiles_error_title; >+ public static String CodingStyleConfigurationBlock_export_profiles_error_message; >+ public static String CodingStyleConfigurationBlock_export_profiles_overwrite_title; >+ public static String CodingStyleConfigurationBlock_export_profiles_overwrite_message; > public static String CodingStyleConfigurationBlock_edit_button_desc; > public static String CodingStyleConfigurationBlock_remove_button_desc; > public static String CodingStyleConfigurationBlock_new_button_desc; >Index: ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties,v >retrieving revision 1.77 >diff -u -r1.77 FormatterMessages.properties >--- ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties 8 Dec 2008 16:49:40 -0000 1.77 >+++ ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties 23 Jul 2009 09:34:56 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2008 IBM Corporation and others. >+# Copyright (c) 2000, 2009 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 >@@ -518,6 +518,12 @@ > that upgrading profiles from older to newer builds is fully supported. > CodingStyleConfigurationBlock_save_profile_overwrite_title=Export Profile > CodingStyleConfigurationBlock_save_profile_overwrite_message=The file ''{0}'' already exists.\nDo you want to replace it? >+CodingStyleConfigurationBlock_export_all_button_desc=E&xport All... >+CodingStyleConfigurationBlock_export_profiles_dialog_title= Export Profiles >+CodingStyleConfigurationBlock_export_profiles_error_title=Export Profiles >+CodingStyleConfigurationBlock_export_profiles_error_message=Could not export the profiles. >+CodingStyleConfigurationBlock_export_profiles_overwrite_title= Export Profiles >+CodingStyleConfigurationBlock_export_profiles_overwrite_message=The file ''{0}'' already exists.\nDo you want to replace it? > CodingStyleConfigurationBlock_edit_button_desc=&Edit... > CodingStyleConfigurationBlock_remove_button_desc=&Remove > CodingStyleConfigurationBlock_new_button_desc=Ne&w...
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
Flags:
daniel_megert
:
review+
Actions:
View
|
Diff
Attachments on
bug 48966
:
140866
|
141296
| 142359