|
Lines 12-17
Link Here
|
| 12 |
|
12 |
|
| 13 |
import java.io.File; |
13 |
import java.io.File; |
| 14 |
import java.io.IOException; |
14 |
import java.io.IOException; |
|
|
15 |
|
| 15 |
import org.eclipse.core.resources.IProject; |
16 |
import org.eclipse.core.resources.IProject; |
| 16 |
import org.eclipse.core.resources.IResource; |
17 |
import org.eclipse.core.resources.IResource; |
| 17 |
import org.eclipse.core.resources.IResourceRuleFactory; |
18 |
import org.eclipse.core.resources.IResourceRuleFactory; |
|
Lines 23-32
Link Here
|
| 23 |
import org.eclipse.core.runtime.Platform; |
24 |
import org.eclipse.core.runtime.Platform; |
| 24 |
import org.eclipse.core.runtime.Status; |
25 |
import org.eclipse.core.runtime.Status; |
| 25 |
import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
26 |
import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
| 26 |
import org.eclipse.core.runtime.preferences.InstanceScope; |
|
|
| 27 |
import org.eclipse.jdt.core.IPackageFragment; |
27 |
import org.eclipse.jdt.core.IPackageFragment; |
| 28 |
import org.eclipse.jdt.core.IPackageFragmentRoot; |
28 |
import org.eclipse.jdt.core.IPackageFragmentRoot; |
| 29 |
import org.eclipse.jface.dialogs.Dialog; |
|
|
| 30 |
import org.eclipse.jface.dialogs.IDialogConstants; |
29 |
import org.eclipse.jface.dialogs.IDialogConstants; |
| 31 |
import org.eclipse.jface.resource.JFaceResources; |
30 |
import org.eclipse.jface.resource.JFaceResources; |
| 32 |
import org.eclipse.jface.resource.LocalResourceManager; |
31 |
import org.eclipse.jface.resource.LocalResourceManager; |
|
Lines 53-65
Link Here
|
| 53 |
import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin; |
52 |
import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin; |
| 54 |
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons; |
53 |
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons; |
| 55 |
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages; |
54 |
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages; |
|
|
55 |
import org.eclipse.jpt.jpa.ui.internal.dialogs.DontShowAgainDialog; |
| 56 |
import org.eclipse.osgi.util.NLS; |
56 |
import org.eclipse.osgi.util.NLS; |
| 57 |
import org.eclipse.swt.SWT; |
57 |
import org.eclipse.swt.SWT; |
| 58 |
import org.eclipse.swt.events.SelectionEvent; |
|
|
| 59 |
import org.eclipse.swt.events.SelectionListener; |
| 60 |
import org.eclipse.swt.layout.GridData; |
58 |
import org.eclipse.swt.layout.GridData; |
| 61 |
import org.eclipse.swt.layout.GridLayout; |
59 |
import org.eclipse.swt.layout.GridLayout; |
| 62 |
import org.eclipse.swt.widgets.Button; |
|
|
| 63 |
import org.eclipse.swt.widgets.Composite; |
60 |
import org.eclipse.swt.widgets.Composite; |
| 64 |
import org.eclipse.swt.widgets.Control; |
61 |
import org.eclipse.swt.widgets.Control; |
| 65 |
import org.eclipse.swt.widgets.Display; |
62 |
import org.eclipse.swt.widgets.Display; |
|
Lines 73-80
Link Here
|
| 73 |
|
70 |
|
| 74 |
public static final String HELP_CONTEXT_ID = JptJpaUiPlugin.PLUGIN_ID + ".GenerateEntitiesFromSchemaWizard"; //$NON-NLS-1$ |
71 |
public static final String HELP_CONTEXT_ID = JptJpaUiPlugin.PLUGIN_ID + ".GenerateEntitiesFromSchemaWizard"; //$NON-NLS-1$ |
| 75 |
|
72 |
|
| 76 |
private static final String DONT_SHOW_OVERWRITE_WARNING_DIALOG = "DONT_SHOW_OVERWRITE_WARNING_DIALOG"; //$NON-NLS-1$ |
|
|
| 77 |
|
| 78 |
private JpaProject jpaProject; |
73 |
private JpaProject jpaProject; |
| 79 |
|
74 |
|
| 80 |
private IStructuredSelection selection; |
75 |
private IStructuredSelection selection; |
|
Lines 251-258
Link Here
|
| 251 |
} |
246 |
} |
| 252 |
|
247 |
|
| 253 |
public static boolean showOverwriteWarning(){ |
248 |
public static boolean showOverwriteWarning(){ |
| 254 |
IEclipsePreferences pref = new InstanceScope().getNode(JptJpaUiPlugin.PLUGIN_ID); |
249 |
IEclipsePreferences pref = DontShowAgainDialog.getDontShowPreferences(); |
| 255 |
boolean ret = ! pref.getBoolean( DONT_SHOW_OVERWRITE_WARNING_DIALOG, false) ; |
250 |
boolean ret = ! pref.getBoolean(DontShowAgainDialog.DONT_SHOW_OVERWRITE_WARNING_DIALOG, false) ; |
| 256 |
return ret; |
251 |
return ret; |
| 257 |
} |
252 |
} |
| 258 |
|
253 |
|
|
Lines 312-318
Link Here
|
| 312 |
|
307 |
|
| 313 |
// ********** overwrite dialog ********** |
308 |
// ********** overwrite dialog ********** |
| 314 |
|
309 |
|
| 315 |
static class OverwriteConfirmerDialog extends Dialog { |
310 |
static class OverwriteConfirmerDialog extends DontShowAgainDialog { |
| 316 |
private final String className; |
311 |
private final String className; |
| 317 |
private boolean yes = false; |
312 |
private boolean yes = false; |
| 318 |
private boolean yesToAll = false; |
313 |
private boolean yesToAll = false; |
|
Lines 323-328
Link Here
|
| 323 |
super(parent); |
318 |
super(parent); |
| 324 |
this.className = className; |
319 |
this.className = className; |
| 325 |
} |
320 |
} |
|
|
321 |
|
| 322 |
@Override |
| 323 |
protected String getPreferenceKey() { |
| 324 |
return DONT_SHOW_OVERWRITE_WARNING_DIALOG; |
| 325 |
} |
| 326 |
|
326 |
|
| 327 |
@Override |
327 |
@Override |
| 328 |
protected void configureShell(Shell shell) { |
328 |
protected void configureShell(Shell shell) { |
|
Lines 344-366
Link Here
|
| 344 |
|
344 |
|
| 345 |
return composite; |
345 |
return composite; |
| 346 |
} |
346 |
} |
| 347 |
|
347 |
|
| 348 |
protected Control createDontShowControl(Composite composite) { |
|
|
| 349 |
final Button checkbox = new Button( composite, SWT.CHECK ); |
| 350 |
checkbox.setText( JptUiEntityGenMessages.GenerateEntitiesWizard_doNotShowWarning ); |
| 351 |
checkbox.setSelection(false); |
| 352 |
final IEclipsePreferences pref = new InstanceScope().getNode( JptJpaUiPlugin.PLUGIN_ID); |
| 353 |
checkbox.setLayoutData( new GridData(GridData.FILL_BOTH) ); |
| 354 |
checkbox.addSelectionListener(new SelectionListener (){ |
| 355 |
public void widgetDefaultSelected(SelectionEvent e) {} |
| 356 |
public void widgetSelected(SelectionEvent e) { |
| 357 |
boolean b = checkbox.getSelection(); |
| 358 |
pref.putBoolean( DONT_SHOW_OVERWRITE_WARNING_DIALOG, b); |
| 359 |
} |
| 360 |
}); |
| 361 |
return checkbox; |
| 362 |
} |
| 363 |
|
| 364 |
@Override |
348 |
@Override |
| 365 |
protected void createButtonsForButtonBar(Composite parent) { |
349 |
protected void createButtonsForButtonBar(Composite parent) { |
| 366 |
this.createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, false); |
350 |
this.createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, false); |