Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 338216 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jpt/ui/diagrameditor/internal/dialog/SelectTypeDialog.java (+1 lines)
Lines 56-61 Link Here
56
import org.eclipse.ui.progress.IProgressService;
56
import org.eclipse.ui.progress.IProgressService;
57
57
58
58
59
@SuppressWarnings("restriction")
59
public class SelectTypeDialog extends TitleAreaDialog {
60
public class SelectTypeDialog extends TitleAreaDialog {
60
	
61
	
61
	protected String title;
62
	protected String title;
(-)src/org/eclipse/jpt/ui/diagrameditor/internal/i18n/JPAEditorMessages.java (+5 lines)
Lines 116-121 Link Here
116
	public static String JPAEditorPreferencesPage_defaultFolderControlLabel;
116
	public static String JPAEditorPreferencesPage_defaultFolderControlLabel;
117
	public static String JPAEditorPreferencesPage_invalidFolder;
117
	public static String JPAEditorPreferencesPage_invalidFolder;
118
	public static String JPAEditorPreferencesPage_emptyFolder;
118
	public static String JPAEditorPreferencesPage_emptyFolder;
119
	public static String JPAEditorPreferencesPage_oneToManyOldStyle;
120
	public static String JPAEditorPreferencesPage_oneToManyOldStyleTooltip;
121
	
122
	public static String JPAEditorPropertyPage_oneToManyOldStyle;
123
	public static String JPAEditorPropertyPage_oneToManyOldStyleTooltip;
119
124
120
	public static String JPAEditorToolBehaviorProvider_collapseAttrGroupMenuItem;
125
	public static String JPAEditorToolBehaviorProvider_collapseAttrGroupMenuItem;
121
126
(-)src/org/eclipse/jpt/ui/diagrameditor/internal/i18n/messages.properties (+5 lines)
Lines 98-103 Link Here
98
JPAEditorPreferencesPage_defaultFolderControlLabel=Folder for &diagrams:
98
JPAEditorPreferencesPage_defaultFolderControlLabel=Folder for &diagrams:
99
JPAEditorPreferencesPage_invalidFolder=The folder name must be preceded by "{0}".
99
JPAEditorPreferencesPage_invalidFolder=The folder name must be preceded by "{0}".
100
JPAEditorPreferencesPage_emptyFolder=The folder name for diagrams must not be empty.
100
JPAEditorPreferencesPage_emptyFolder=The folder name for diagrams must not be empty.
101
JPAEditorPreferencesPage_oneToManyOldStyle=&One-to-Many unidirectional old (JPA 1.0) style relations in JPA 2.0 projects 
102
JPAEditorPreferencesPage_oneToManyOldStyleTooltip=If this option is checked, the newly created One-to-Many\nunidirectional relations in JPA 2.0 projects will be old\n(JPA 1.0) style.  I.e., the corresponding attributes will\nbe created without @JoinColumn(s) annotation.
103
104
JPAEditorPropertyPage_oneToManyOldStyle=&One-to-Many unidirectional old (JPA 1.0) style relations
105
JPAEditorPropertyPage_oneToManyOldStyleTooltip=If this option is checked, the newly created One-to-Many\nunidirectional relations will be old (JPA 1.0) style.\nI.e., the corresponding attributes will be created without\n@JoinColumn(s) annotation.
101
106
102
JPAEditorToolBehaviorProvider_collapseAttrGroupMenuItem=Collapse Attributes Group
107
JPAEditorToolBehaviorProvider_collapseAttrGroupMenuItem=Collapse Attributes Group
103
JPAEditorToolBehaviorProvider_collapseAttrGroupMenuItemDescr=Collapse the attributes group.
108
JPAEditorToolBehaviorProvider_collapseAttrGroupMenuItemDescr=Collapse the attributes group.
(-)src/org/eclipse/jpt/ui/diagrameditor/internal/modelintegration/ui/OpenJpaDiagramActionDelegate.java (-16 / +2 lines)
Lines 50-55 Link Here
50
import org.eclipse.jpt.ui.diagrameditor.internal.modelintegration.util.ModelIntegrationUtil;
50
import org.eclipse.jpt.ui.diagrameditor.internal.modelintegration.util.ModelIntegrationUtil;
51
import org.eclipse.jpt.ui.diagrameditor.internal.provider.JPAEditorDiagramTypeProvider;
51
import org.eclipse.jpt.ui.diagrameditor.internal.provider.JPAEditorDiagramTypeProvider;
52
import org.eclipse.jpt.ui.diagrameditor.internal.util.JPAEditorConstants;
52
import org.eclipse.jpt.ui.diagrameditor.internal.util.JPAEditorConstants;
53
import org.eclipse.jpt.ui.diagrameditor.internal.util.JPAEditorUtil;
53
import org.eclipse.jpt.ui.diagrameditor.internal.util.JpaArtifactFactory;
54
import org.eclipse.jpt.ui.diagrameditor.internal.util.JpaArtifactFactory;
54
import org.eclipse.jpt.ui.diagrameditor.internal.util.Wrp;
55
import org.eclipse.jpt.ui.diagrameditor.internal.util.Wrp;
55
import org.eclipse.swt.SWT;
56
import org.eclipse.swt.SWT;
Lines 89-95 Link Here
89
	public static IDiagramEditor openDiagramEditor(Diagram diagram) {
90
	public static IDiagramEditor openDiagramEditor(Diagram diagram) {
90
91
91
		JpaProject jpaProject = ModelIntegrationUtil.getProjectByDiagram(diagram);
92
		JpaProject jpaProject = ModelIntegrationUtil.getProjectByDiagram(diagram);
92
		if (!isJPAFacetVersion10(jpaProject)) {
93
		if (!JPAEditorUtil.checkJPAFacetVersion(jpaProject, "1.0")) {					//$NON-NLS-1$
93
			boolean wasEnabled = OptionalMessageDialog.isDialogEnabled(JPAEditorConstants.JPA_SUPPORT_DIALOG_ID);
94
			boolean wasEnabled = OptionalMessageDialog.isDialogEnabled(JPAEditorConstants.JPA_SUPPORT_DIALOG_ID);
94
			int btnIndex = OptionalMessageDialog.open(JPAEditorConstants.JPA_SUPPORT_DIALOG_ID, 
95
			int btnIndex = OptionalMessageDialog.open(JPAEditorConstants.JPA_SUPPORT_DIALOG_ID, 
95
									   Display.getDefault().getShells()[0], 
96
									   Display.getDefault().getShells()[0], 
Lines 132-152 Link Here
132
		return (JPADiagramEditor)wrp.getObj();
133
		return (JPADiagramEditor)wrp.getObj();
133
	}
134
	}
134
135
135
	static private boolean isJPAFacetVersion10(JpaProject jpaProject) {
136
		IFacetedProject fproj = null;
137
		try {
138
			fproj = ProjectFacetsManager.create(jpaProject.getProject());
139
		} catch (CoreException e) {
140
		}
141
		Set<IProjectFacetVersion> projFacets = fproj.getProjectFacets();
142
		Iterator<IProjectFacetVersion> it = projFacets.iterator();
143
		while (it.hasNext()) {
144
			IProjectFacetVersion fv = it.next();
145
			if (fv.getProjectFacet().getId().equals("jpt.jpa")) 	//$NON-NLS-1$
146
				return fv.getVersionString().equals("1.0");			//$NON-NLS-1$
147
		}
148
		return false;
149
	}	
150
136
151
	private static final String ERROR_OPENING_DIAGRAM = JPAEditorMessages.OpenJpaDiagramActionDelegate_openJPADiagramErrorMsg;
137
	private static final String ERROR_OPENING_DIAGRAM = JPAEditorMessages.OpenJpaDiagramActionDelegate_openJPADiagramErrorMsg;
152
	private JpaProject jpaProject;
138
	private JpaProject jpaProject;
(-)src/org/eclipse/jpt/ui/diagrameditor/internal/preferences/JPAEditorPreferenceInitializer.java (-9 / +12 lines)
Lines 22-33 Link Here
22
public class JPAEditorPreferenceInitializer extends
22
public class JPAEditorPreferenceInitializer extends
23
		AbstractPreferenceInitializer {
23
		AbstractPreferenceInitializer {
24
	
24
	
25
	public static final String PROPERTY_DIAGRAM_FOLDER 			= "org.eclipse.jpt.ui.diagrameditor.diagramfolder";						//$NON-NLS-1$
25
	public static final String PROPERTY_DIAGRAM_FOLDER 				= "org.eclipse.jpt.ui.diagrameditor.diagramfolder";						//$NON-NLS-1$
26
	public static final String PROPERTY_ENTITY_PACKAGE 			= "org.eclipse.jpt.ui.diagrameditor.entity.defaultPackage";				//$NON-NLS-1$
26
	public static final String PROPERTY_ENTITY_PACKAGE 				= "org.eclipse.jpt.ui.diagrameditor.entity.defaultPackage";				//$NON-NLS-1$
27
	public static final String PROPERTY_TABLE_NAME_PREFIX 		= "org.eclipse.jpt.ui.diagrameditor.entity.defaultTableNamePrefix";		//$NON-NLS-1$
27
	public static final String PROPERTY_TABLE_NAME_PREFIX 			= "org.eclipse.jpt.ui.diagrameditor.entity.defaultTableNamePrefix";		//$NON-NLS-1$
28
	public static final String PROPERTY_DIRECT_EDIT_CLASS_NAME 	= "org.eclipse.jpt.ui.diagrameditor.entity.defaultDirectEditClassName";	//$NON-NLS-1$
28
	public static final String PROPERTY_DIRECT_EDIT_CLASS_NAME 		= "org.eclipse.jpt.ui.diagrameditor.entity.defaultDirectEditClassName";	//$NON-NLS-1$
29
	public static final String PROPERTY_ENTITY_ACCESS_TYPE 		= "org.eclipse.jpt.ui.diagrameditor.entity.defaultEntityAccessType";	//$NON-NLS-1$	
29
	public static final String PROPERTY_ENTITY_ACCESS_TYPE 			= "org.eclipse.jpt.ui.diagrameditor.entity.defaultEntityAccessType";	//$NON-NLS-1$	
30
	public static final String PROPERTY_DEFAULT_COLLECTION_TYPE = "org.eclipse.jpt.ui.diagrameditor.entity.defaultCollectionType";	//$NON-NLS-1$	
30
	public static final String PROPERTY_DEFAULT_COLLECTION_TYPE 	= "org.eclipse.jpt.ui.diagrameditor.entity.defaultCollectionType";		//$NON-NLS-1$
31
	public static final String PROPERTY_ONE_TO_MANY_OLD_STYLE	  	= "org.eclipse.jpt.ui.diagrameditor.entity.defaultOneToManyOldStyle";			//$NON-NLS-1$
32
	
31
33
32
	
34
	
33
	
35
	
Lines 38-45 Link Here
38
	public static final String PROPERTY_VAL_ACCESS_PROPERTY_BASED 	= "property";			//$NON-NLS-1$
40
	public static final String PROPERTY_VAL_ACCESS_PROPERTY_BASED 	= "property";			//$NON-NLS-1$
39
	
41
	
40
	public static final String PROPERTY_VAL_COLLECTION_TYPE 	= "collection";			//$NON-NLS-1$
42
	public static final String PROPERTY_VAL_COLLECTION_TYPE 	= "collection";			//$NON-NLS-1$
41
	public static final String PROPERTY_VAL_LIST_TYPE 	= "list";			//$NON-NLS-1$
43
	public static final String PROPERTY_VAL_LIST_TYPE 			= "list";			//$NON-NLS-1$
42
	public static final String PROPERTY_VAL_SET_TYPE 	= "set";			//$NON-NLS-1$
44
	public static final String PROPERTY_VAL_SET_TYPE 			= "set";			//$NON-NLS-1$
43
45
44
	
46
	
45
	
47
	
Lines 65-73 Link Here
65
		store.setDefault(PROPERTY_DIAGRAM_FOLDER, PROPERTY_VAL_DIAGRAM_FOLDER);		
67
		store.setDefault(PROPERTY_DIAGRAM_FOLDER, PROPERTY_VAL_DIAGRAM_FOLDER);		
66
		store.setDefault(PROPERTY_ENTITY_PACKAGE, PROPERTY_VAL_ENTITY_PACKAGE);
68
		store.setDefault(PROPERTY_ENTITY_PACKAGE, PROPERTY_VAL_ENTITY_PACKAGE);
67
		store.setDefault(PROPERTY_TABLE_NAME_PREFIX, PROPERTY_VAL_PREFIX);
69
		store.setDefault(PROPERTY_TABLE_NAME_PREFIX, PROPERTY_VAL_PREFIX);
68
		store.setDefault(PROPERTY_DIRECT_EDIT_CLASS_NAME, false);
70
		store.setDefault(PROPERTY_DIRECT_EDIT_CLASS_NAME, true);
69
		store.setDefault(PROPERTY_ENTITY_ACCESS_TYPE, PROPERTY_VAL_ACCESS_FIELD_BASED);
71
		store.setDefault(PROPERTY_ENTITY_ACCESS_TYPE, PROPERTY_VAL_ACCESS_FIELD_BASED);
70
		store.setDefault(PROPERTY_DEFAULT_COLLECTION_TYPE, PROPERTY_VAL_COLLECTION_TYPE);
72
		store.setDefault(PROPERTY_DEFAULT_COLLECTION_TYPE, PROPERTY_VAL_COLLECTION_TYPE);
73
		store.setDefault(PROPERTY_ONE_TO_MANY_OLD_STYLE, false);
71
	}
74
	}
72
75
73
}
76
}
(-)src/org/eclipse/jpt/ui/diagrameditor/internal/preferences/JPAEditorPreferencesPage.java (-3 / +12 lines)
Lines 40-52 Link Here
40
import org.eclipse.ui.IWorkbench;
40
import org.eclipse.ui.IWorkbench;
41
import org.eclipse.ui.IWorkbenchPreferencePage;
41
import org.eclipse.ui.IWorkbenchPreferencePage;
42
42
43
@SuppressWarnings("restriction")
43
public class JPAEditorPreferencesPage extends FieldEditorPreferencePage
44
public class JPAEditorPreferencesPage extends FieldEditorPreferencePage
44
		implements IWorkbenchPreferencePage {
45
		implements IWorkbenchPreferencePage {
45
46
46
	private static final String 	FICTIVE_PROJECT_NAME = "PROJECT NAME";		//$NON-NLS-1$ 
47
	private static final String 	FICTIVE_PROJECT_NAME = "PROJECT NAME";		//$NON-NLS-1$ 
47
	private static final String COLLECTIION_TYPE = "java.util.Collection"; //$NON-NLS-1$
48
	private static final String 	COLLECTIION_TYPE = "java.util.Collection"; //$NON-NLS-1$
48
	private static final String LIST_TYPE = "java.util.List"; //$NON-NLS-1$
49
	private static final String 	LIST_TYPE = "java.util.List"; //$NON-NLS-1$
49
	private static final String SET_TYPE = "java.util.Set"; //$NON-NLS-1$
50
	private static final String 	SET_TYPE = "java.util.Set"; //$NON-NLS-1$
50
	
51
	
51
	private StringFieldEditor 		fDefaultDiagramFolderField;
52
	private StringFieldEditor 		fDefaultDiagramFolderField;
52
	private StringFieldEditor 		fDefaultEntityPackageField;
53
	private StringFieldEditor 		fDefaultEntityPackageField;
Lines 54-59 Link Here
54
	private JPABooleanFieldEditor 	directEditAffectsClass;
55
	private JPABooleanFieldEditor 	directEditAffectsClass;
55
	private RadioGroupFieldEditor 	entityAccessTypeChooser;
56
	private RadioGroupFieldEditor 	entityAccessTypeChooser;
56
	private RadioGroupFieldEditor   defaultCollectionTypeChooser;
57
	private RadioGroupFieldEditor   defaultCollectionTypeChooser;
58
	private JPABooleanFieldEditor 	oneToManyOldStyle;
57
59
58
	public JPAEditorPreferencesPage() {
60
	public JPAEditorPreferencesPage() {
59
		super(GRID);
61
		super(GRID);
Lines 104-109 Link Here
104
		defaultCollectionTypeChooser.setPreferenceStore(getPreferenceStore());
106
		defaultCollectionTypeChooser.setPreferenceStore(getPreferenceStore());
105
		defaultCollectionTypeChooser.getRadioBoxControl(parent).setToolTipText(JPAEditorMessages.JPAEditorPreferencesPage_DefaultCollectionTypeSectionDescription);
107
		defaultCollectionTypeChooser.getRadioBoxControl(parent).setToolTipText(JPAEditorMessages.JPAEditorPreferencesPage_DefaultCollectionTypeSectionDescription);
106
		addField(defaultCollectionTypeChooser);
108
		addField(defaultCollectionTypeChooser);
109
		
110
		oneToManyOldStyle = new JPABooleanFieldEditor("",	//$NON-NLS-1$ 
111
				JPAEditorMessages.JPAEditorPreferencesPage_oneToManyOldStyle, 
112
				BooleanFieldEditor.DEFAULT, parent);
113
		oneToManyOldStyle.setPreferenceName(JPAEditorPreferenceInitializer.PROPERTY_ONE_TO_MANY_OLD_STYLE);
114
		oneToManyOldStyle.getCheckBox(parent).setToolTipText(JPAEditorMessages.JPAEditorPreferencesPage_oneToManyOldStyleTooltip);
115
		addField(oneToManyOldStyle);		
107
	}
116
	}
108
	
117
	
109
	protected void createFolderField(Composite parent) {
118
	protected void createFolderField(Composite parent) {
(-)src/org/eclipse/jpt/ui/diagrameditor/internal/propertypage/JPADiagramPropertyPage.java (-6 / +41 lines)
Lines 36-41 Link Here
36
import org.eclipse.jpt.ui.diagrameditor.internal.i18n.JPAEditorMessages;
36
import org.eclipse.jpt.ui.diagrameditor.internal.i18n.JPAEditorMessages;
37
import org.eclipse.jpt.ui.diagrameditor.internal.preferences.JPAEditorPreferenceInitializer;
37
import org.eclipse.jpt.ui.diagrameditor.internal.preferences.JPAEditorPreferenceInitializer;
38
import org.eclipse.jpt.ui.diagrameditor.internal.preferences.JPAEditorPreferencesPage;
38
import org.eclipse.jpt.ui.diagrameditor.internal.preferences.JPAEditorPreferencesPage;
39
import org.eclipse.jpt.ui.diagrameditor.internal.util.JPAEditorUtil;
39
import org.eclipse.swt.SWT;
40
import org.eclipse.swt.SWT;
40
import org.eclipse.swt.events.ModifyEvent;
41
import org.eclipse.swt.events.ModifyEvent;
41
import org.eclipse.swt.events.ModifyListener;
42
import org.eclipse.swt.events.ModifyListener;
Lines 55-60 Link Here
55
public class JPADiagramPropertyPage extends PropertyPage {
56
public class JPADiagramPropertyPage extends PropertyPage {
56
	
57
	
57
	public static final String PROJECT_SETTINGS_PATH = "/.settings/org.eclipse.jpt.ui.diagrameditor";	//$NON-NLS-1$;
58
	public static final String PROJECT_SETTINGS_PATH = "/.settings/org.eclipse.jpt.ui.diagrameditor";	//$NON-NLS-1$;
59
	protected IProject project = null;
60
	protected boolean isJPA10Project = false;				//$NON-NLS-1$;
61
	
58
	private Properties editorProps;
62
	private Properties editorProps;
59
	
63
	
60
	private Text txtDefaultFolderField;
64
	private Text txtDefaultFolderField;
Lines 68-73 Link Here
68
	private Button btnCollectionType;
72
	private Button btnCollectionType;
69
	private Button btnListType;
73
	private Button btnListType;
70
	private Button btnSetType;
74
	private Button btnSetType;
75
	private Button checkOneToManyOldStyle;
71
76
72
	private boolean propsModified = false;
77
	private boolean propsModified = false;
73
78
Lines 77-83 Link Here
77
	static public final QualifiedName PROP_DEFAULT_TABLE_NAME_PREFIX 	= new QualifiedName(QUALIFIER, "defaultTableNamePrefix");	//$NON-NLS-1$;
82
	static public final QualifiedName PROP_DEFAULT_TABLE_NAME_PREFIX 	= new QualifiedName(QUALIFIER, "defaultTableNamePrefix");	//$NON-NLS-1$;
78
	static public final QualifiedName PROP_DIRECT_EDIT_AFFECTS_CLASS 	= new QualifiedName(QUALIFIER, "directEditAffectsClass");	//$NON-NLS-1$;
83
	static public final QualifiedName PROP_DIRECT_EDIT_AFFECTS_CLASS 	= new QualifiedName(QUALIFIER, "directEditAffectsClass");	//$NON-NLS-1$;
79
	static public final QualifiedName PROP_ACCESS_TYPE 					= new QualifiedName(QUALIFIER, "accessType");				//$NON-NLS-1$;
84
	static public final QualifiedName PROP_ACCESS_TYPE 					= new QualifiedName(QUALIFIER, "accessType");				//$NON-NLS-1$;
80
	static public final QualifiedName PROP_COLLECTION_TYPE 				= new QualifiedName(QUALIFIER, "collectionType");				//$NON-NLS-1$;
85
	static public final QualifiedName PROP_COLLECTION_TYPE 				= new QualifiedName(QUALIFIER, "collectionType");			//$NON-NLS-1$;
86
	static public final QualifiedName PROP_ONE_TO_MANY_OLD_STYLE		= new QualifiedName(QUALIFIER, "oneToManyOldStyle");		//$NON-NLS-1$;
87
	
81
88
82
    public static final String COLLECTION_TYPE = "java.util.Collection"; //$NON-NLS-1$
89
    public static final String COLLECTION_TYPE = "java.util.Collection"; //$NON-NLS-1$
83
    public static final String LIST_TYPE = "java.util.List"; //$NON-NLS-1$
90
    public static final String LIST_TYPE = "java.util.List"; //$NON-NLS-1$
Lines 89-94 Link Here
89
	@Override
96
	@Override
90
	protected Control createContents(Composite parent) {
97
	protected Control createContents(Composite parent) {
91
		final Composite composite = createCompositeContainer(parent);
98
		final Composite composite = createCompositeContainer(parent);
99
		project = (IProject)getElement().getAdapter(IProject.class);
100
		isJPA10Project = JPAEditorUtil.checkJPAFacetVersion(project, "1.0");				//$NON-NLS-1$;		
92
		loadProperties();
101
		loadProperties();
93
		createDefaultFolderControl(composite);
102
		createDefaultFolderControl(composite);
94
		createDefaultPackageControl(composite);
103
		createDefaultPackageControl(composite);
Lines 96-101 Link Here
96
		createDirectEditAffectsClassControl(composite);
105
		createDirectEditAffectsClassControl(composite);
97
		createAccessTypeControl(composite);
106
		createAccessTypeControl(composite);
98
		createDefaultCollectionTypeControl(composite);
107
		createDefaultCollectionTypeControl(composite);
108
		if (!isJPA10Project)
109
			createOneToManyOldStyleControl(composite);
99
		Dialog.applyDialogFont(composite);
110
		Dialog.applyDialogFont(composite);
100
		validatePage();
111
		validatePage();
101
		return composite;		
112
		return composite;		
Lines 196-201 Link Here
196
		});			
207
		});			
197
	}
208
	}
198
	
209
	
210
	private void createOneToManyOldStyleControl(Composite composite) {
211
		checkOneToManyOldStyle = new Button(composite, SWT.FLAT | SWT.CHECK);
212
		checkOneToManyOldStyle.setText(JPAEditorMessages.JPAEditorPropertyPage_oneToManyOldStyle);
213
		checkOneToManyOldStyle.setToolTipText(JPAEditorMessages.JPAEditorPropertyPage_oneToManyOldStyleTooltip);
214
		checkOneToManyOldStyle.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 2, 1));
215
		
216
		boolean defaultDirectEditAffectsClass = Boolean.parseBoolean(editorProps.getProperty(PROP_ONE_TO_MANY_OLD_STYLE.getLocalName()));
217
		checkOneToManyOldStyle.setSelection(defaultDirectEditAffectsClass);
218
		checkOneToManyOldStyle.addSelectionListener(new SelectionListener() {
219
			public void widgetSelected(SelectionEvent e) {
220
				propsModified = true;
221
			}
222
			public void widgetDefaultSelected(SelectionEvent e) {}			
223
		});			
224
	}
225
	
226
	
227
	
199
	private void createDefaultCollectionTypeControl(Composite composite) {
228
	private void createDefaultCollectionTypeControl(Composite composite) {
200
		groupCollectionType = new Group(composite, 0);
229
		groupCollectionType = new Group(composite, 0);
201
		groupCollectionType.setText(JPAEditorMessages.JPAEditorPreferencesPage_DefaultCollectionTypeSectionTittle);
230
		groupCollectionType.setText(JPAEditorMessages.JPAEditorPreferencesPage_DefaultCollectionTypeSectionTittle);
Lines 321-332 Link Here
321
		String defaultCollectionType = store.getString(JPAEditorPreferenceInitializer.PROPERTY_DEFAULT_COLLECTION_TYPE);
350
		String defaultCollectionType = store.getString(JPAEditorPreferenceInitializer.PROPERTY_DEFAULT_COLLECTION_TYPE);
322
		btnCollectionType.setSelection(defaultCollectionType.equals(JPAEditorPreferenceInitializer.PROPERTY_VAL_COLLECTION_TYPE));
351
		btnCollectionType.setSelection(defaultCollectionType.equals(JPAEditorPreferenceInitializer.PROPERTY_VAL_COLLECTION_TYPE));
323
		btnListType.setSelection(defaultCollectionType.equals(JPAEditorPreferenceInitializer.PROPERTY_VAL_LIST_TYPE));		
352
		btnListType.setSelection(defaultCollectionType.equals(JPAEditorPreferenceInitializer.PROPERTY_VAL_LIST_TYPE));		
324
		btnSetType.setSelection(defaultCollectionType.equals(JPAEditorPreferenceInitializer.PROPERTY_VAL_SET_TYPE));		
353
		btnSetType.setSelection(defaultCollectionType.equals(JPAEditorPreferenceInitializer.PROPERTY_VAL_SET_TYPE));
354
	    boolean defaultOneToManyOldStyle = store.getBoolean(JPAEditorPreferenceInitializer.PROPERTY_ONE_TO_MANY_OLD_STYLE);
355
	    if (!isJPA10Project)
356
	    	checkOneToManyOldStyle.setSelection(defaultOneToManyOldStyle);		
325
		super.performDefaults();
357
		super.performDefaults();
326
    }
358
    }
327
    
359
    
328
    synchronized protected void validatePage() {
360
    synchronized protected void validatePage() {
329
    	IProject project = (IProject)getElement().getAdapter(IProject.class);
330
    	IStatus statFolder = JPAEditorPreferencesPage.validateDefaultFolder(txtDefaultFolderField.getText().trim(), 
361
    	IStatus statFolder = JPAEditorPreferencesPage.validateDefaultFolder(txtDefaultFolderField.getText().trim(), 
331
    																		project.getName());
362
    																		project.getName());
332
    	IStatus statPack = JPAEditorPreferencesPage.validateDefaultPackage(txtDefaultEntityPackageField.getText().trim());
363
    	IStatus statPack = JPAEditorPreferencesPage.validateDefaultPackage(txtDefaultEntityPackageField.getText().trim());
Lines 402-409 Link Here
402
		editorProps.put(PROP_DEFAULT_TABLE_NAME_PREFIX.getLocalName(), txtDefaultTableNamePrefix.getText().trim());
433
		editorProps.put(PROP_DEFAULT_TABLE_NAME_PREFIX.getLocalName(), txtDefaultTableNamePrefix.getText().trim());
403
		editorProps.put(PROP_DIRECT_EDIT_AFFECTS_CLASS.getLocalName(), "" + checkDirectEditAffectsClass.getSelection());	//$NON-NLS-1$;
434
		editorProps.put(PROP_DIRECT_EDIT_AFFECTS_CLASS.getLocalName(), "" + checkDirectEditAffectsClass.getSelection());	//$NON-NLS-1$;
404
		editorProps.put(PROP_ACCESS_TYPE.getLocalName(), btnFieldBasedAccess.getSelection() ? JPAEditorPreferenceInitializer.PROPERTY_VAL_ACCESS_FIELD_BASED : JPAEditorPreferenceInitializer.PROPERTY_VAL_ACCESS_PROPERTY_BASED);		
435
		editorProps.put(PROP_ACCESS_TYPE.getLocalName(), btnFieldBasedAccess.getSelection() ? JPAEditorPreferenceInitializer.PROPERTY_VAL_ACCESS_FIELD_BASED : JPAEditorPreferenceInitializer.PROPERTY_VAL_ACCESS_PROPERTY_BASED);		
405
		editorProps.put(PROP_COLLECTION_TYPE.getLocalName(), getCollectionProperty());		
436
		editorProps.put(PROP_COLLECTION_TYPE.getLocalName(), getCollectionProperty());
406
437
		if (!isJPA10Project)
438
			editorProps.put(PROP_ONE_TO_MANY_OLD_STYLE.getLocalName(), "" + checkOneToManyOldStyle.getSelection());	//$NON-NLS-1$;
407
	}
439
	}
408
	
440
	
409
	
441
	
Lines 428-434 Link Here
428
		editorDefaultProps.setProperty(PROP_DEFAULT_TABLE_NAME_PREFIX.getLocalName(), store.getString(JPAEditorPreferenceInitializer.PROPERTY_TABLE_NAME_PREFIX));
460
		editorDefaultProps.setProperty(PROP_DEFAULT_TABLE_NAME_PREFIX.getLocalName(), store.getString(JPAEditorPreferenceInitializer.PROPERTY_TABLE_NAME_PREFIX));
429
		editorDefaultProps.setProperty(PROP_DIRECT_EDIT_AFFECTS_CLASS.getLocalName(), "" + store.getBoolean(JPAEditorPreferenceInitializer.PROPERTY_DIRECT_EDIT_CLASS_NAME));	//$NON-NLS-1$;
461
		editorDefaultProps.setProperty(PROP_DIRECT_EDIT_AFFECTS_CLASS.getLocalName(), "" + store.getBoolean(JPAEditorPreferenceInitializer.PROPERTY_DIRECT_EDIT_CLASS_NAME));	//$NON-NLS-1$;
430
		editorDefaultProps.setProperty(PROP_ACCESS_TYPE.getLocalName(), store.getString(JPAEditorPreferenceInitializer.PROPERTY_ENTITY_ACCESS_TYPE));		
462
		editorDefaultProps.setProperty(PROP_ACCESS_TYPE.getLocalName(), store.getString(JPAEditorPreferenceInitializer.PROPERTY_ENTITY_ACCESS_TYPE));		
431
		editorDefaultProps.setProperty(PROP_COLLECTION_TYPE.getLocalName(), store.getString(JPAEditorPreferenceInitializer.PROPERTY_DEFAULT_COLLECTION_TYPE));		
463
		editorDefaultProps.setProperty(PROP_COLLECTION_TYPE.getLocalName(), store.getString(JPAEditorPreferenceInitializer.PROPERTY_DEFAULT_COLLECTION_TYPE));
464
		editorDefaultProps.setProperty(PROP_ONE_TO_MANY_OLD_STYLE.getLocalName(), "" + store.getBoolean(JPAEditorPreferenceInitializer.PROPERTY_ONE_TO_MANY_OLD_STYLE));	//$NON-NLS-1$;
465
		
466
		
432
		return editorDefaultProps;
467
		return editorDefaultProps;
433
	}
468
	}
434
469
(-)src/org/eclipse/jpt/ui/diagrameditor/internal/util/JPAEditorUtil.java (+23 lines)
Lines 91-96 Link Here
91
import org.eclipse.ui.IWorkbenchSite;
91
import org.eclipse.ui.IWorkbenchSite;
92
import org.eclipse.ui.PlatformUI;
92
import org.eclipse.ui.PlatformUI;
93
import org.eclipse.ui.part.FileEditorInput;
93
import org.eclipse.ui.part.FileEditorInput;
94
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
95
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
96
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
94
97
95
98
96
public class JPAEditorUtil {
99
public class JPAEditorUtil {
Lines 1353-1357 Link Here
1353
    	String res = getAttributeTypeName(at);
1356
    	String res = getAttributeTypeName(at);
1354
    	return MessageFormat.format(JPAEditorMessages.JPAEditorUtil_typeTooltipText, new Object[] { res }); 
1357
    	return MessageFormat.format(JPAEditorMessages.JPAEditorUtil_typeTooltipText, new Object[] { res }); 
1355
    }
1358
    }
1359
    
1360
	static public boolean checkJPAFacetVersion(JpaProject jpaProject, String version) {
1361
		return checkJPAFacetVersion(jpaProject.getProject(), version);
1362
	}	
1356
	
1363
	
1364
	static public boolean checkJPAFacetVersion(IProject project, String version) {
1365
		IFacetedProject fproj = null;
1366
		try {
1367
			fproj = ProjectFacetsManager.create(project);
1368
		} catch (CoreException e) {
1369
		}
1370
		Set<IProjectFacetVersion> projFacets = fproj.getProjectFacets();
1371
		Iterator<IProjectFacetVersion> it = projFacets.iterator();
1372
		while (it.hasNext()) {
1373
			IProjectFacetVersion fv = it.next();
1374
			if (fv.getProjectFacet().getId().equals("jpt.jpa")) 	//$NON-NLS-1$
1375
				return fv.getVersionString().equals(version);			
1376
		}
1377
		return false;
1378
	}	
1379
1357
}
1380
}

Return to bug 338216