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 199360 Details for
Bug 310876
cannot restore overwrite dialog for entity wizard
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]
proposed bug fix patch
propossed_patch_310876_4.txt (text/plain), 18.76 KB, created by
Leslie Davis
on 2011-07-08 16:07:09 EDT
(
hide
)
Description:
proposed bug fix patch
Filename:
MIME Type:
Creator:
Leslie Davis
Created:
2011-07-08 16:07:09 EDT
Size:
18.76 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jpt.jpa.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.xml,v >retrieving revision 1.6 >diff -u -r1.6 plugin.xml >--- plugin.xml 28 Apr 2011 00:26:55 -0000 1.6 >+++ plugin.xml 8 Jul 2011 20:01:50 -0000 >@@ -965,7 +965,7 @@ > <page > id="org.eclipse.jpt.jpa.ui.preferences" > name="%javaPersistenceNode" >- class="org.eclipse.ui.internal.dialogs.EmptyPreferencePage"/> >+ class="org.eclipse.jpt.jpa.ui.internal.preferences.JptPreferencesPage"/> > > <page > id="org.eclipse.jpt.jpa.ui.jpaPreferences" >Index: property_files/jpt_ui.properties >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_ui.properties,v >retrieving revision 1.3 >diff -u -r1.3 jpt_ui.properties >--- property_files/jpt_ui.properties 12 Apr 2011 22:12:49 -0000 1.3 >+++ property_files/jpt_ui.properties 8 Jul 2011 20:01:50 -0000 >@@ -44,6 +44,8 @@ > DatabaseSchemaWizardPage_connectionInfo=(Note: JPA project must have a connection and it must be active to select a schema) > DatabaseSchemaWizardPage_schemaInfo=(Note: Must have active connection to select schema) > >+OptionalMessageDialog_doNotShowWarning= Don't show me this warning again >+ > Error_openingEditor=Error Opening Editor > > General_browse=Br&owse... >@@ -118,6 +120,10 @@ > JpaMakePersistentWizardPage_mappingFileDoesNotExistError=The XML mapping file does not exist > JpaMakePersistentWizardPage_mappingFileNotListedInPersistenceXmlError=The XML mapping file is not listed in the persistence.xml > >+JptPreferencesPage_DoNotShowDialogs=Dialogs >+JptPreferencesPage_DoNotShowText=Clear all 'do not show again' settings and show all hidden dialogs again. >+JptPreferencesPage_ClearButtonText=&Clear >+ > JpaPreferencesPage_description=General settings for JPA development: > JpaPreferencesPage_jpqlEditor=JPQL Editing > JpaPreferencesPage_jpqlEditor_description=Specify the case for JPQL identifiers used with content assist. >Index: property_files/jpt_ui_entity_gen.properties >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_ui_entity_gen.properties,v >retrieving revision 1.1 >diff -u -r1.1 jpt_ui_entity_gen.properties >--- property_files/jpt_ui_entity_gen.properties 6 Feb 2011 02:26:35 -0000 1.1 >+++ property_files/jpt_ui_entity_gen.properties 8 Jul 2011 20:01:50 -0000 >@@ -104,7 +104,6 @@ > GenerateEntitiesWizard_assocEditor_tableJoin=Table &join: > GenerateEntitiesWizard_assocEditor_joinedWhen=The table rows are joined when:\n%s > GenerateEntitiesWizard_assocEditor_genAssoc=Generate &this association >-GenerateEntitiesWizard_doNotShowWarning = Don't show me this warning again > > selectCascadeDlgTitle=Select Cascade > selectTableDlgTitle=Table Selection >Index: src/org/eclipse/jpt/jpa/ui/internal/JptUiMessages.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JptUiMessages.java,v >retrieving revision 1.2 >diff -u -r1.2 JptUiMessages.java >--- src/org/eclipse/jpt/jpa/ui/internal/JptUiMessages.java 12 Apr 2011 22:12:50 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/ui/internal/JptUiMessages.java 8 Jul 2011 20:01:50 -0000 >@@ -49,6 +49,7 @@ > public static String DatabaseSchemaWizardPage_schema; > public static String DatabaseSchemaWizardPage_connectionInfo; > public static String DatabaseSchemaWizardPage_schemaInfo; >+ public static String OptionalMessageDialog_doNotShowWarning; > public static String Error_openingEditor; > public static String General_browse; > public static String General_revert; >@@ -135,6 +136,9 @@ > public static String OverwriteConfirmerDialog_title; > public static String PersistenceItemLabelProviderFactory_persistenceLabel; > public static String EntitiesGenerator_jobName; >+ public static String JptPreferencesPage_DoNotShowDialogs; >+ public static String JptPreferencesPage_DoNotShowText; >+ public static String JptPreferencesPage_ClearButtonText; > public static String JpaPreferencesPage_description; > public static String JpaPreferencesPage_jpqlEditor; > public static String JpaPreferencesPage_jpqlEditor_description; >Index: src/org/eclipse/jpt/jpa/ui/internal/dialogs/OptionalMessageDialog.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/ui/internal/dialogs/OptionalMessageDialog.java >diff -N src/org/eclipse/jpt/jpa/ui/internal/dialogs/OptionalMessageDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/ui/internal/dialogs/OptionalMessageDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,107 @@ >+package org.eclipse.jpt.jpa.ui.internal.dialogs; >+ >+import org.eclipse.jdt.internal.ui.JavaPlugin; >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.dialogs.IDialogSettings; >+import org.eclipse.jface.dialogs.MessageDialog; >+import org.eclipse.jpt.jpa.ui.internal.JptUiMessages; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Shell; >+ >+ >+/** >+ * A <code>OptionalMessageDialog</code> is a dialog that has a check box allowing the >+ * option to no longer show the dialog in the future. >+ */ >+public abstract class OptionalMessageDialog extends MessageDialog { >+ >+ private static final String CHECKBOX_TEXT = JptUiMessages.OptionalMessageDialog_doNotShowWarning; >+ >+ // Dialog store id constants >+ private static final String STORE_ID= "OptionalMessageDialog.hide."; //$NON-NLS-1$ >+ >+ public static final int NOT_SHOWN= IDialogConstants.CLIENT_ID + 1; >+ >+ private final String id; >+ >+ private final String checkBoxText; >+ >+ /** >+ * Creates a dialog with the given parent. >+ * >+ * @param parentShell >+ * object that returns the current parent shell >+ */ >+ public OptionalMessageDialog(String id, Shell parentShell, String dialogTitle, String dialogMessage, int dialogType, String[] buttonLabels, int defaultButtonIndex) { >+ this(id, parentShell, dialogTitle, dialogMessage, dialogType, buttonLabels, defaultButtonIndex, CHECKBOX_TEXT); >+ } >+ >+ /** >+ * Creates a dialog with the given parent and a checkbox with the labeled with the text in <code>checkBoxText</code> >+ * >+ * @param parentShell >+ * object that returns the current parent shell >+ */ >+ public OptionalMessageDialog(String id, Shell parentShell, String dialogTitle, String dialogMessage, int dialogType, String[] buttonLabels, int defaultButtonIndex, String checkBoxText) { >+ super(parentShell, dialogTitle, null, dialogMessage, dialogType, buttonLabels, defaultButtonIndex); >+ this.id = id; >+ this.checkBoxText = checkBoxText; >+ } >+ >+ @Override >+ protected Control createCustomArea(Composite parent) { >+ final Button checkbox = new Button(parent, SWT.CHECK); >+ checkbox.setText(this.checkBoxText); >+ checkbox.setSelection(false); >+ checkbox.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ checkbox.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ setDialogEnabled(id, !((Button)e.widget).getSelection()); >+ } >+ }); >+ return checkbox; >+ } >+ >+ /** >+ * Returns this dialog settings >+ * >+ * @return the settings to be used >+ */ >+ private static IDialogSettings getDialogSettings() { >+ IDialogSettings settings= JavaPlugin.getDefault().getDialogSettings(); >+ settings= settings.getSection(STORE_ID); >+ if (settings == null) >+ settings= JavaPlugin.getDefault().getDialogSettings().addNewSection(STORE_ID); >+ return settings; >+ } >+ >+ /** >+ * Answers whether the optional dialog is enabled and should be shown. >+ */ >+ public static boolean isDialogEnabled(String key) { >+ IDialogSettings settings= getDialogSettings(); >+ return !settings.getBoolean(key); >+ } >+ >+ /** >+ * Sets whether the optional dialog is enabled and should be shown. >+ */ >+ public static void setDialogEnabled(String key, boolean isEnabled) { >+ IDialogSettings settings= getDialogSettings(); >+ settings.put(key, !isEnabled); >+ } >+ >+ /** >+ * Clears all remembered information about hidden dialogs >+ */ >+ public static void clearAllRememberedStates() { >+ IDialogSettings settings= JavaPlugin.getDefault().getDialogSettings(); >+ settings.addNewSection(STORE_ID); >+ } >+} >Index: src/org/eclipse/jpt/jpa/ui/internal/preferences/JpaPreferencesPage.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/preferences/JpaPreferencesPage.java,v >retrieving revision 1.2 >diff -u -r1.2 JpaPreferencesPage.java >--- src/org/eclipse/jpt/jpa/ui/internal/preferences/JpaPreferencesPage.java 12 Apr 2011 22:12:50 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/ui/internal/preferences/JpaPreferencesPage.java 8 Jul 2011 20:01:51 -0000 >@@ -29,7 +29,8 @@ > import org.eclipse.ui.IWorkbenchPreferencePage; > > /** >- * This is the root of the Java Persistence preferences hierarchy in the IDE preferences dialog. >+ * This is the root of the JPA preferences hierarchy in the IDE >+ * preferences dialog. > * <p> > * Structure: > * <p> >Index: src/org/eclipse/jpt/jpa/ui/internal/preferences/JptPreferencesPage.java >=================================================================== >RCS file: src/org/eclipse/jpt/jpa/ui/internal/preferences/JptPreferencesPage.java >diff -N src/org/eclipse/jpt/jpa/ui/internal/preferences/JptPreferencesPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jpt/jpa/ui/internal/preferences/JptPreferencesPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,81 @@ >+package org.eclipse.jpt.jpa.ui.internal.preferences; >+ >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.preference.PreferencePage; >+import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin; >+import org.eclipse.jpt.jpa.ui.internal.JptUiMessages; >+import org.eclipse.jpt.jpa.ui.internal.dialogs.OptionalMessageDialog; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.ui.IWorkbench; >+import org.eclipse.ui.IWorkbenchPreferencePage; >+ >+/** >+ * This is the root of the Java Persistence preferences hierarchy in the IDE >+ * preferences dialog. >+ * <p> >+ * Structure: >+ * <p> >+ * Java Persistence<br> >+ * >+ * @version 2.2 >+ * @since 2.2 >+ */ >+public class JptPreferencesPage extends PreferencePage implements IWorkbenchPreferencePage { >+ >+ @Override >+ protected Control createContents(Composite parent) { >+ >+ Composite container= new Composite(parent, SWT.NONE); >+ GridLayout layout= new GridLayout(); >+ layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); >+ layout.marginWidth= 0; >+ layout.verticalSpacing= convertVerticalDLUsToPixels(10); >+ layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); >+ container.setLayout(layout); >+ >+ layout = new GridLayout(); >+ layout.numColumns= 2; >+ >+ Group dontAskGroup = new Group(container, SWT.NONE); >+ dontAskGroup.setLayout(layout); >+ dontAskGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ dontAskGroup.setText(JptUiMessages.JptPreferencesPage_DoNotShowDialogs); >+ >+ Label label = new Label(dontAskGroup, SWT.WRAP); >+ label.setText(JptUiMessages.JptPreferencesPage_DoNotShowText); >+ GridData data= new GridData(GridData.FILL, GridData.CENTER, true, false); >+ data.widthHint= convertVerticalDLUsToPixels(50); >+ label.setLayoutData(data); >+ >+ Button button = new Button(dontAskGroup, SWT.PUSH); >+ button.setText(JptUiMessages.JptPreferencesPage_ClearButtonText); >+ button.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); >+ button.addSelectionListener(new SelectionListener() { >+ public void widgetSelected(SelectionEvent e) { >+ unhideAllDialogs(); >+ } >+ public void widgetDefaultSelected(SelectionEvent e) { >+ unhideAllDialogs(); >+ } >+ }); >+ >+ return container; >+ } >+ >+ public void init(IWorkbench workbench) { >+ setPreferenceStore(JptJpaUiPlugin.instance().getPreferenceStore()); >+ } >+ >+ private final void unhideAllDialogs() { >+ OptionalMessageDialog.clearAllRememberedStates(); >+ } >+} >Index: src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java,v >retrieving revision 1.2 >diff -u -r1.2 GenerateEntitiesFromSchemaWizard.java >--- src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java 22 Feb 2011 17:58:29 -0000 1.2 >+++ src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java 8 Jul 2011 20:01:52 -0000 >@@ -12,6 +12,7 @@ > > import java.io.File; > import java.io.IOException; >+ > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.IResourceRuleFactory; >@@ -22,12 +23,10 @@ > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.Status; >-import org.eclipse.core.runtime.preferences.IEclipsePreferences; >-import org.eclipse.core.runtime.preferences.InstanceScope; > import org.eclipse.jdt.core.IPackageFragment; > import org.eclipse.jdt.core.IPackageFragmentRoot; >-import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.resource.JFaceResources; > import org.eclipse.jface.resource.LocalResourceManager; > import org.eclipse.jface.resource.ResourceManager; >@@ -53,17 +52,10 @@ > import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin; > import org.eclipse.jpt.jpa.ui.internal.JptUiIcons; > import org.eclipse.jpt.jpa.ui.internal.JptUiMessages; >+import org.eclipse.jpt.jpa.ui.internal.dialogs.OptionalMessageDialog; > import org.eclipse.osgi.util.NLS; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.events.SelectionEvent; >-import org.eclipse.swt.events.SelectionListener; >-import org.eclipse.swt.layout.GridData; >-import org.eclipse.swt.layout.GridLayout; >-import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Display; >-import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.INewWizard; > import org.eclipse.ui.IWorkbench; >@@ -73,8 +65,6 @@ > > public static final String HELP_CONTEXT_ID = JptJpaUiPlugin.PLUGIN_ID + ".GenerateEntitiesFromSchemaWizard"; //$NON-NLS-1$ > >- private static final String DONT_SHOW_OVERWRITE_WARNING_DIALOG = "DONT_SHOW_OVERWRITE_WARNING_DIALOG"; //$NON-NLS-1$ >- > private JpaProject jpaProject; > > private IStructuredSelection selection; >@@ -251,9 +241,7 @@ > } > > public static boolean showOverwriteWarning(){ >- IEclipsePreferences pref = new InstanceScope().getNode(JptJpaUiPlugin.PLUGIN_ID); >- boolean ret = ! pref.getBoolean( DONT_SHOW_OVERWRITE_WARNING_DIALOG, false) ; >- return ret; >+ return OptionalMessageDialog.isDialogEnabled(OverwriteConfirmerDialog.ID); > } > > // ********** overwrite confirmer ********** >@@ -312,55 +300,27 @@ > > // ********** overwrite dialog ********** > >- static class OverwriteConfirmerDialog extends Dialog { >- private final String className; >+ static class OverwriteConfirmerDialog extends OptionalMessageDialog { > private boolean yes = false; > private boolean yesToAll = false; > private boolean no = false; > private boolean noToAll = false; > >- OverwriteConfirmerDialog(Shell parent, String className) { >- super(parent); >- this.className = className; >- } >+ private static final String ID= "dontShowOverwrite.warning"; //$NON-NLS-1$ > >- @Override >- protected void configureShell(Shell shell) { >- super.configureShell(shell); >- shell.setText(JptUiMessages.OverwriteConfirmerDialog_title); >+ OverwriteConfirmerDialog(Shell parent, String className) { >+ super(ID, parent, >+ JptUiMessages.OverwriteConfirmerDialog_title, >+ NLS.bind(JptUiMessages.OverwriteConfirmerDialog_text, className), >+ MessageDialog.WARNING, >+ new String[] {IDialogConstants.YES_LABEL, >+ IDialogConstants.YES_TO_ALL_LABEL, >+ IDialogConstants.NO_LABEL, >+ IDialogConstants.NO_TO_ALL_LABEL, >+ IDialogConstants.CANCEL_LABEL}, >+ 2); > } >- >- @Override >- protected Control createDialogArea(Composite parent) { >- Composite composite = (Composite) super.createDialogArea(parent); >- GridLayout gridLayout = (GridLayout) composite.getLayout(); >- gridLayout.numColumns = 1; >- >- Label text = new Label(composite, SWT.LEFT); >- text.setText(NLS.bind(JptUiMessages.OverwriteConfirmerDialog_text, this.className)); >- text.setLayoutData(new GridData()); >- >- createDontShowControl(composite); >- >- return composite; >- } >- >- protected Control createDontShowControl(Composite composite) { >- final Button checkbox = new Button( composite, SWT.CHECK ); >- checkbox.setText( JptUiEntityGenMessages.GenerateEntitiesWizard_doNotShowWarning ); >- checkbox.setSelection(false); >- final IEclipsePreferences pref = new InstanceScope().getNode( JptJpaUiPlugin.PLUGIN_ID); >- checkbox.setLayoutData( new GridData(GridData.FILL_BOTH) ); >- checkbox.addSelectionListener(new SelectionListener (){ >- public void widgetDefaultSelected(SelectionEvent e) {} >- public void widgetSelected(SelectionEvent e) { >- boolean b = checkbox.getSelection(); >- pref.putBoolean( DONT_SHOW_OVERWRITE_WARNING_DIALOG, b); >- } >- }); >- return checkbox; >- } >- >+ > @Override > protected void createButtonsForButtonBar(Composite parent) { > this.createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, false);
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 310876
:
192891
|
192983
|
196499
|
199360