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 189924 Details for
Bug 338216
Add checkbox in pref/prop page for One-to-Many old style relation in JPA 2.0 projects
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 v2
OneToManyOldStylePref.v2.txt (text/plain), 24.67 KB, created by
Stefan Dimov
on 2011-02-28 04:48:06 EST
(
hide
)
Description:
patch v2
Filename:
MIME Type:
Creator:
Stefan Dimov
Created:
2011-02-28 04:48:06 EST
Size:
24.67 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jpt.jpadiagrameditor.ui >Index: src/org/eclipse/jpt/ui/diagrameditor/internal/dialog/SelectTypeDialog.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.ui.diagrameditor/src/org/eclipse/jpt/ui/diagrameditor/internal/dialog/SelectTypeDialog.java,v >retrieving revision 1.3 >diff -u -r1.3 SelectTypeDialog.java >--- src/org/eclipse/jpt/ui/diagrameditor/internal/dialog/SelectTypeDialog.java 24 Feb 2011 08:10:29 -0000 1.3 >+++ src/org/eclipse/jpt/ui/diagrameditor/internal/dialog/SelectTypeDialog.java 28 Feb 2011 09:44:18 -0000 >@@ -56,6 +56,7 @@ > import org.eclipse.ui.progress.IProgressService; > > >+@SuppressWarnings("restriction") > public class SelectTypeDialog extends TitleAreaDialog { > > protected String title; >Index: src/org/eclipse/jpt/ui/diagrameditor/internal/i18n/JPAEditorMessages.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.ui.diagrameditor/src/org/eclipse/jpt/ui/diagrameditor/internal/i18n/JPAEditorMessages.java,v >retrieving revision 1.1 >diff -u -r1.1 JPAEditorMessages.java >--- src/org/eclipse/jpt/ui/diagrameditor/internal/i18n/JPAEditorMessages.java 2 Feb 2011 11:37:13 -0000 1.1 >+++ src/org/eclipse/jpt/ui/diagrameditor/internal/i18n/JPAEditorMessages.java 28 Feb 2011 09:44:18 -0000 >@@ -116,6 +116,11 @@ > public static String JPAEditorPreferencesPage_defaultFolderControlLabel; > public static String JPAEditorPreferencesPage_invalidFolder; > public static String JPAEditorPreferencesPage_emptyFolder; >+ public static String JPAEditorPreferencesPage_oneToManyOldStyle; >+ public static String JPAEditorPreferencesPage_oneToManyOldStyleTooltip; >+ >+ public static String JPAEditorPropertyPage_oneToManyOldStyle; >+ public static String JPAEditorPropertyPage_oneToManyOldStyleTooltip; > > public static String JPAEditorToolBehaviorProvider_collapseAttrGroupMenuItem; > >Index: src/org/eclipse/jpt/ui/diagrameditor/internal/i18n/messages.properties >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.ui.diagrameditor/src/org/eclipse/jpt/ui/diagrameditor/internal/i18n/messages.properties,v >retrieving revision 1.1 >diff -u -r1.1 messages.properties >--- src/org/eclipse/jpt/ui/diagrameditor/internal/i18n/messages.properties 2 Feb 2011 11:37:13 -0000 1.1 >+++ src/org/eclipse/jpt/ui/diagrameditor/internal/i18n/messages.properties 28 Feb 2011 09:44:19 -0000 >@@ -98,6 +98,11 @@ > JPAEditorPreferencesPage_defaultFolderControlLabel=Folder for &diagrams: > JPAEditorPreferencesPage_invalidFolder=The folder name must be preceded by "{0}". > JPAEditorPreferencesPage_emptyFolder=The folder name for diagrams must not be empty. >+JPAEditorPreferencesPage_oneToManyOldStyle=&One-to-Many unidirectional old (JPA 1.0) style relations in JPA 2.0 projects >+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. >+ >+JPAEditorPropertyPage_oneToManyOldStyle=&One-to-Many unidirectional old (JPA 1.0) style relations >+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. > > JPAEditorToolBehaviorProvider_collapseAttrGroupMenuItem=Collapse Attributes Group > JPAEditorToolBehaviorProvider_collapseAttrGroupMenuItemDescr=Collapse the attributes group. >Index: src/org/eclipse/jpt/ui/diagrameditor/internal/modelintegration/ui/OpenJpaDiagramActionDelegate.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.ui.diagrameditor/src/org/eclipse/jpt/ui/diagrameditor/internal/modelintegration/ui/OpenJpaDiagramActionDelegate.java,v >retrieving revision 1.2 >diff -u -r1.2 OpenJpaDiagramActionDelegate.java >--- src/org/eclipse/jpt/ui/diagrameditor/internal/modelintegration/ui/OpenJpaDiagramActionDelegate.java 17 Feb 2011 09:17:15 -0000 1.2 >+++ src/org/eclipse/jpt/ui/diagrameditor/internal/modelintegration/ui/OpenJpaDiagramActionDelegate.java 28 Feb 2011 09:44:19 -0000 >@@ -50,6 +50,7 @@ > import org.eclipse.jpt.ui.diagrameditor.internal.modelintegration.util.ModelIntegrationUtil; > import org.eclipse.jpt.ui.diagrameditor.internal.provider.JPAEditorDiagramTypeProvider; > import org.eclipse.jpt.ui.diagrameditor.internal.util.JPAEditorConstants; >+import org.eclipse.jpt.ui.diagrameditor.internal.util.JPAEditorUtil; > import org.eclipse.jpt.ui.diagrameditor.internal.util.JpaArtifactFactory; > import org.eclipse.jpt.ui.diagrameditor.internal.util.Wrp; > import org.eclipse.swt.SWT; >@@ -89,7 +90,7 @@ > public static IDiagramEditor openDiagramEditor(Diagram diagram) { > > JpaProject jpaProject = ModelIntegrationUtil.getProjectByDiagram(diagram); >- if (!isJPAFacetVersion10(jpaProject)) { >+ if (!JPAEditorUtil.checkJPAFacetVersion(jpaProject, "1.0")) { //$NON-NLS-1$ > boolean wasEnabled = OptionalMessageDialog.isDialogEnabled(JPAEditorConstants.JPA_SUPPORT_DIALOG_ID); > int btnIndex = OptionalMessageDialog.open(JPAEditorConstants.JPA_SUPPORT_DIALOG_ID, > Display.getDefault().getShells()[0], >@@ -132,21 +133,6 @@ > return (JPADiagramEditor)wrp.getObj(); > } > >- static private boolean isJPAFacetVersion10(JpaProject jpaProject) { >- IFacetedProject fproj = null; >- try { >- fproj = ProjectFacetsManager.create(jpaProject.getProject()); >- } catch (CoreException e) { >- } >- Set<IProjectFacetVersion> projFacets = fproj.getProjectFacets(); >- Iterator<IProjectFacetVersion> it = projFacets.iterator(); >- while (it.hasNext()) { >- IProjectFacetVersion fv = it.next(); >- if (fv.getProjectFacet().getId().equals("jpt.jpa")) //$NON-NLS-1$ >- return fv.getVersionString().equals("1.0"); //$NON-NLS-1$ >- } >- return false; >- } > > private static final String ERROR_OPENING_DIAGRAM = JPAEditorMessages.OpenJpaDiagramActionDelegate_openJPADiagramErrorMsg; > private JpaProject jpaProject; >Index: src/org/eclipse/jpt/ui/diagrameditor/internal/preferences/JPAEditorPreferenceInitializer.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.ui.diagrameditor/src/org/eclipse/jpt/ui/diagrameditor/internal/preferences/JPAEditorPreferenceInitializer.java,v >retrieving revision 1.1 >diff -u -r1.1 JPAEditorPreferenceInitializer.java >--- src/org/eclipse/jpt/ui/diagrameditor/internal/preferences/JPAEditorPreferenceInitializer.java 2 Feb 2011 11:37:13 -0000 1.1 >+++ src/org/eclipse/jpt/ui/diagrameditor/internal/preferences/JPAEditorPreferenceInitializer.java 28 Feb 2011 09:44:19 -0000 >@@ -22,12 +22,14 @@ > public class JPAEditorPreferenceInitializer extends > AbstractPreferenceInitializer { > >- public static final String PROPERTY_DIAGRAM_FOLDER = "org.eclipse.jpt.ui.diagrameditor.diagramfolder"; //$NON-NLS-1$ >- public static final String PROPERTY_ENTITY_PACKAGE = "org.eclipse.jpt.ui.diagrameditor.entity.defaultPackage"; //$NON-NLS-1$ >- public static final String PROPERTY_TABLE_NAME_PREFIX = "org.eclipse.jpt.ui.diagrameditor.entity.defaultTableNamePrefix"; //$NON-NLS-1$ >- public static final String PROPERTY_DIRECT_EDIT_CLASS_NAME = "org.eclipse.jpt.ui.diagrameditor.entity.defaultDirectEditClassName"; //$NON-NLS-1$ >- public static final String PROPERTY_ENTITY_ACCESS_TYPE = "org.eclipse.jpt.ui.diagrameditor.entity.defaultEntityAccessType"; //$NON-NLS-1$ >- public static final String PROPERTY_DEFAULT_COLLECTION_TYPE = "org.eclipse.jpt.ui.diagrameditor.entity.defaultCollectionType"; //$NON-NLS-1$ >+ public static final String PROPERTY_DIAGRAM_FOLDER = "org.eclipse.jpt.ui.diagrameditor.diagramfolder"; //$NON-NLS-1$ >+ public static final String PROPERTY_ENTITY_PACKAGE = "org.eclipse.jpt.ui.diagrameditor.entity.defaultPackage"; //$NON-NLS-1$ >+ public static final String PROPERTY_TABLE_NAME_PREFIX = "org.eclipse.jpt.ui.diagrameditor.entity.defaultTableNamePrefix"; //$NON-NLS-1$ >+ public static final String PROPERTY_DIRECT_EDIT_CLASS_NAME = "org.eclipse.jpt.ui.diagrameditor.entity.defaultDirectEditClassName"; //$NON-NLS-1$ >+ public static final String PROPERTY_ENTITY_ACCESS_TYPE = "org.eclipse.jpt.ui.diagrameditor.entity.defaultEntityAccessType"; //$NON-NLS-1$ >+ public static final String PROPERTY_DEFAULT_COLLECTION_TYPE = "org.eclipse.jpt.ui.diagrameditor.entity.defaultCollectionType"; //$NON-NLS-1$ >+ public static final String PROPERTY_ONE_TO_MANY_OLD_STYLE = "org.eclipse.jpt.ui.diagrameditor.entity.defaultOneToManyOldStyle"; //$NON-NLS-1$ >+ > > > >@@ -38,8 +40,8 @@ > public static final String PROPERTY_VAL_ACCESS_PROPERTY_BASED = "property"; //$NON-NLS-1$ > > public static final String PROPERTY_VAL_COLLECTION_TYPE = "collection"; //$NON-NLS-1$ >- public static final String PROPERTY_VAL_LIST_TYPE = "list"; //$NON-NLS-1$ >- public static final String PROPERTY_VAL_SET_TYPE = "set"; //$NON-NLS-1$ >+ public static final String PROPERTY_VAL_LIST_TYPE = "list"; //$NON-NLS-1$ >+ public static final String PROPERTY_VAL_SET_TYPE = "set"; //$NON-NLS-1$ > > > >@@ -65,9 +67,10 @@ > store.setDefault(PROPERTY_DIAGRAM_FOLDER, PROPERTY_VAL_DIAGRAM_FOLDER); > store.setDefault(PROPERTY_ENTITY_PACKAGE, PROPERTY_VAL_ENTITY_PACKAGE); > store.setDefault(PROPERTY_TABLE_NAME_PREFIX, PROPERTY_VAL_PREFIX); >- store.setDefault(PROPERTY_DIRECT_EDIT_CLASS_NAME, false); >+ store.setDefault(PROPERTY_DIRECT_EDIT_CLASS_NAME, true); > store.setDefault(PROPERTY_ENTITY_ACCESS_TYPE, PROPERTY_VAL_ACCESS_FIELD_BASED); > store.setDefault(PROPERTY_DEFAULT_COLLECTION_TYPE, PROPERTY_VAL_COLLECTION_TYPE); >+ store.setDefault(PROPERTY_ONE_TO_MANY_OLD_STYLE, false); > } > > } >Index: src/org/eclipse/jpt/ui/diagrameditor/internal/preferences/JPAEditorPreferencesPage.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.ui.diagrameditor/src/org/eclipse/jpt/ui/diagrameditor/internal/preferences/JPAEditorPreferencesPage.java,v >retrieving revision 1.2 >diff -u -r1.2 JPAEditorPreferencesPage.java >--- src/org/eclipse/jpt/ui/diagrameditor/internal/preferences/JPAEditorPreferencesPage.java 24 Feb 2011 08:10:29 -0000 1.2 >+++ src/org/eclipse/jpt/ui/diagrameditor/internal/preferences/JPAEditorPreferencesPage.java 28 Feb 2011 09:44:19 -0000 >@@ -40,13 +40,14 @@ > import org.eclipse.ui.IWorkbench; > import org.eclipse.ui.IWorkbenchPreferencePage; > >+@SuppressWarnings("restriction") > public class JPAEditorPreferencesPage extends FieldEditorPreferencePage > implements IWorkbenchPreferencePage { > > private static final String FICTIVE_PROJECT_NAME = "PROJECT NAME"; //$NON-NLS-1$ >- private static final String COLLECTIION_TYPE = "java.util.Collection"; //$NON-NLS-1$ >- private static final String LIST_TYPE = "java.util.List"; //$NON-NLS-1$ >- private static final String SET_TYPE = "java.util.Set"; //$NON-NLS-1$ >+ private static final String COLLECTIION_TYPE = "java.util.Collection"; //$NON-NLS-1$ >+ private static final String LIST_TYPE = "java.util.List"; //$NON-NLS-1$ >+ private static final String SET_TYPE = "java.util.Set"; //$NON-NLS-1$ > > private StringFieldEditor fDefaultDiagramFolderField; > private StringFieldEditor fDefaultEntityPackageField; >@@ -54,6 +55,7 @@ > private JPABooleanFieldEditor directEditAffectsClass; > private RadioGroupFieldEditor entityAccessTypeChooser; > private RadioGroupFieldEditor defaultCollectionTypeChooser; >+ private JPABooleanFieldEditor oneToManyOldStyle; > > public JPAEditorPreferencesPage() { > super(GRID); >@@ -104,6 +106,13 @@ > defaultCollectionTypeChooser.setPreferenceStore(getPreferenceStore()); > defaultCollectionTypeChooser.getRadioBoxControl(parent).setToolTipText(JPAEditorMessages.JPAEditorPreferencesPage_DefaultCollectionTypeSectionDescription); > addField(defaultCollectionTypeChooser); >+ >+ oneToManyOldStyle = new JPABooleanFieldEditor("", //$NON-NLS-1$ >+ JPAEditorMessages.JPAEditorPreferencesPage_oneToManyOldStyle, >+ BooleanFieldEditor.DEFAULT, parent); >+ oneToManyOldStyle.setPreferenceName(JPAEditorPreferenceInitializer.PROPERTY_ONE_TO_MANY_OLD_STYLE); >+ oneToManyOldStyle.getCheckBox(parent).setToolTipText(JPAEditorMessages.JPAEditorPreferencesPage_oneToManyOldStyleTooltip); >+ addField(oneToManyOldStyle); > } > > protected void createFolderField(Composite parent) { >Index: src/org/eclipse/jpt/ui/diagrameditor/internal/propertypage/JPADiagramPropertyPage.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.ui.diagrameditor/src/org/eclipse/jpt/ui/diagrameditor/internal/propertypage/JPADiagramPropertyPage.java,v >retrieving revision 1.1 >diff -u -r1.1 JPADiagramPropertyPage.java >--- src/org/eclipse/jpt/ui/diagrameditor/internal/propertypage/JPADiagramPropertyPage.java 2 Feb 2011 11:37:13 -0000 1.1 >+++ src/org/eclipse/jpt/ui/diagrameditor/internal/propertypage/JPADiagramPropertyPage.java 28 Feb 2011 09:44:19 -0000 >@@ -36,6 +36,7 @@ > import org.eclipse.jpt.ui.diagrameditor.internal.i18n.JPAEditorMessages; > import org.eclipse.jpt.ui.diagrameditor.internal.preferences.JPAEditorPreferenceInitializer; > import org.eclipse.jpt.ui.diagrameditor.internal.preferences.JPAEditorPreferencesPage; >+import org.eclipse.jpt.ui.diagrameditor.internal.util.JPAEditorUtil; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.ModifyEvent; > import org.eclipse.swt.events.ModifyListener; >@@ -55,6 +56,9 @@ > public class JPADiagramPropertyPage extends PropertyPage { > > public static final String PROJECT_SETTINGS_PATH = "/.settings/org.eclipse.jpt.ui.diagrameditor"; //$NON-NLS-1$; >+ protected IProject project = null; >+ protected boolean isJPA10Project = false; //$NON-NLS-1$; >+ > private Properties editorProps; > > private Text txtDefaultFolderField; >@@ -68,6 +72,7 @@ > private Button btnCollectionType; > private Button btnListType; > private Button btnSetType; >+ private Button checkOneToManyOldStyle; > > private boolean propsModified = false; > >@@ -77,7 +82,9 @@ > static public final QualifiedName PROP_DEFAULT_TABLE_NAME_PREFIX = new QualifiedName(QUALIFIER, "defaultTableNamePrefix"); //$NON-NLS-1$; > static public final QualifiedName PROP_DIRECT_EDIT_AFFECTS_CLASS = new QualifiedName(QUALIFIER, "directEditAffectsClass"); //$NON-NLS-1$; > static public final QualifiedName PROP_ACCESS_TYPE = new QualifiedName(QUALIFIER, "accessType"); //$NON-NLS-1$; >- static public final QualifiedName PROP_COLLECTION_TYPE = new QualifiedName(QUALIFIER, "collectionType"); //$NON-NLS-1$; >+ static public final QualifiedName PROP_COLLECTION_TYPE = new QualifiedName(QUALIFIER, "collectionType"); //$NON-NLS-1$; >+ static public final QualifiedName PROP_ONE_TO_MANY_OLD_STYLE = new QualifiedName(QUALIFIER, "oneToManyOldStyle"); //$NON-NLS-1$; >+ > > public static final String COLLECTION_TYPE = "java.util.Collection"; //$NON-NLS-1$ > public static final String LIST_TYPE = "java.util.List"; //$NON-NLS-1$ >@@ -89,6 +96,8 @@ > @Override > protected Control createContents(Composite parent) { > final Composite composite = createCompositeContainer(parent); >+ project = (IProject)getElement().getAdapter(IProject.class); >+ isJPA10Project = JPAEditorUtil.checkJPAFacetVersion(project, "1.0"); //$NON-NLS-1$; > loadProperties(); > createDefaultFolderControl(composite); > createDefaultPackageControl(composite); >@@ -96,6 +105,8 @@ > createDirectEditAffectsClassControl(composite); > createAccessTypeControl(composite); > createDefaultCollectionTypeControl(composite); >+ if (!isJPA10Project) >+ createOneToManyOldStyleControl(composite); > Dialog.applyDialogFont(composite); > validatePage(); > return composite; >@@ -196,6 +207,24 @@ > }); > } > >+ private void createOneToManyOldStyleControl(Composite composite) { >+ checkOneToManyOldStyle = new Button(composite, SWT.FLAT | SWT.CHECK); >+ checkOneToManyOldStyle.setText(JPAEditorMessages.JPAEditorPropertyPage_oneToManyOldStyle); >+ checkOneToManyOldStyle.setToolTipText(JPAEditorMessages.JPAEditorPropertyPage_oneToManyOldStyleTooltip); >+ checkOneToManyOldStyle.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 2, 1)); >+ >+ boolean defaultDirectEditAffectsClass = Boolean.parseBoolean(editorProps.getProperty(PROP_ONE_TO_MANY_OLD_STYLE.getLocalName())); >+ checkOneToManyOldStyle.setSelection(defaultDirectEditAffectsClass); >+ checkOneToManyOldStyle.addSelectionListener(new SelectionListener() { >+ public void widgetSelected(SelectionEvent e) { >+ propsModified = true; >+ } >+ public void widgetDefaultSelected(SelectionEvent e) {} >+ }); >+ } >+ >+ >+ > private void createDefaultCollectionTypeControl(Composite composite) { > groupCollectionType = new Group(composite, 0); > groupCollectionType.setText(JPAEditorMessages.JPAEditorPreferencesPage_DefaultCollectionTypeSectionTittle); >@@ -321,12 +350,14 @@ > String defaultCollectionType = store.getString(JPAEditorPreferenceInitializer.PROPERTY_DEFAULT_COLLECTION_TYPE); > btnCollectionType.setSelection(defaultCollectionType.equals(JPAEditorPreferenceInitializer.PROPERTY_VAL_COLLECTION_TYPE)); > btnListType.setSelection(defaultCollectionType.equals(JPAEditorPreferenceInitializer.PROPERTY_VAL_LIST_TYPE)); >- btnSetType.setSelection(defaultCollectionType.equals(JPAEditorPreferenceInitializer.PROPERTY_VAL_SET_TYPE)); >+ btnSetType.setSelection(defaultCollectionType.equals(JPAEditorPreferenceInitializer.PROPERTY_VAL_SET_TYPE)); >+ boolean defaultOneToManyOldStyle = store.getBoolean(JPAEditorPreferenceInitializer.PROPERTY_ONE_TO_MANY_OLD_STYLE); >+ if (!isJPA10Project) >+ checkOneToManyOldStyle.setSelection(defaultOneToManyOldStyle); > super.performDefaults(); > } > > synchronized protected void validatePage() { >- IProject project = (IProject)getElement().getAdapter(IProject.class); > IStatus statFolder = JPAEditorPreferencesPage.validateDefaultFolder(txtDefaultFolderField.getText().trim(), > project.getName()); > IStatus statPack = JPAEditorPreferencesPage.validateDefaultPackage(txtDefaultEntityPackageField.getText().trim()); >@@ -402,8 +433,9 @@ > editorProps.put(PROP_DEFAULT_TABLE_NAME_PREFIX.getLocalName(), txtDefaultTableNamePrefix.getText().trim()); > editorProps.put(PROP_DIRECT_EDIT_AFFECTS_CLASS.getLocalName(), "" + checkDirectEditAffectsClass.getSelection()); //$NON-NLS-1$; > editorProps.put(PROP_ACCESS_TYPE.getLocalName(), btnFieldBasedAccess.getSelection() ? JPAEditorPreferenceInitializer.PROPERTY_VAL_ACCESS_FIELD_BASED : JPAEditorPreferenceInitializer.PROPERTY_VAL_ACCESS_PROPERTY_BASED); >- editorProps.put(PROP_COLLECTION_TYPE.getLocalName(), getCollectionProperty()); >- >+ editorProps.put(PROP_COLLECTION_TYPE.getLocalName(), getCollectionProperty()); >+ if (!isJPA10Project) >+ editorProps.put(PROP_ONE_TO_MANY_OLD_STYLE.getLocalName(), "" + checkOneToManyOldStyle.getSelection()); //$NON-NLS-1$; > } > > >@@ -428,7 +460,10 @@ > editorDefaultProps.setProperty(PROP_DEFAULT_TABLE_NAME_PREFIX.getLocalName(), store.getString(JPAEditorPreferenceInitializer.PROPERTY_TABLE_NAME_PREFIX)); > editorDefaultProps.setProperty(PROP_DIRECT_EDIT_AFFECTS_CLASS.getLocalName(), "" + store.getBoolean(JPAEditorPreferenceInitializer.PROPERTY_DIRECT_EDIT_CLASS_NAME)); //$NON-NLS-1$; > editorDefaultProps.setProperty(PROP_ACCESS_TYPE.getLocalName(), store.getString(JPAEditorPreferenceInitializer.PROPERTY_ENTITY_ACCESS_TYPE)); >- editorDefaultProps.setProperty(PROP_COLLECTION_TYPE.getLocalName(), store.getString(JPAEditorPreferenceInitializer.PROPERTY_DEFAULT_COLLECTION_TYPE)); >+ editorDefaultProps.setProperty(PROP_COLLECTION_TYPE.getLocalName(), store.getString(JPAEditorPreferenceInitializer.PROPERTY_DEFAULT_COLLECTION_TYPE)); >+ editorDefaultProps.setProperty(PROP_ONE_TO_MANY_OLD_STYLE.getLocalName(), "" + store.getBoolean(JPAEditorPreferenceInitializer.PROPERTY_ONE_TO_MANY_OLD_STYLE)); //$NON-NLS-1$; >+ >+ > return editorDefaultProps; > } > >Index: src/org/eclipse/jpt/ui/diagrameditor/internal/util/JPAEditorUtil.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa_diagram_editor/plugins/org.eclipse.jpt.ui.diagrameditor/src/org/eclipse/jpt/ui/diagrameditor/internal/util/JPAEditorUtil.java,v >retrieving revision 1.4 >diff -u -r1.4 JPAEditorUtil.java >--- src/org/eclipse/jpt/ui/diagrameditor/internal/util/JPAEditorUtil.java 23 Feb 2011 13:03:00 -0000 1.4 >+++ src/org/eclipse/jpt/ui/diagrameditor/internal/util/JPAEditorUtil.java 28 Feb 2011 09:44:19 -0000 >@@ -91,6 +91,9 @@ > import org.eclipse.ui.IWorkbenchSite; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.part.FileEditorInput; >+import org.eclipse.wst.common.project.facet.core.IFacetedProject; >+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; >+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; > > > public class JPAEditorUtil { >@@ -211,10 +214,10 @@ > > > public static String[] getGenericsElementTypes(String typeName) { >- if (typeName.indexOf("<") == -1) >+ if (typeName.indexOf("<") == -1) //$NON-NLS-1$ > return null; >- String types = typeName.substring(typeName.indexOf("<") + 1, typeName.lastIndexOf(">")); >- String[] typeNames = types.split(","); >+ String types = typeName.substring(typeName.indexOf("<") + 1, typeName.lastIndexOf(">")); //$NON-NLS-1$ //$NON-NLS-2$ >+ String[] typeNames = types.split(","); //$NON-NLS-1$ > for (int i = 0; i < typeNames.length; i++) { > typeNames[i] = typeNames[i].trim(); > } >@@ -226,7 +229,7 @@ > return null; > StringBuilder res = new StringBuilder(JPAEditorUtil.cutFromLastDot(strings[0])); > for (int i = 1; i < strings.length; i++) { >- res.append(" ,"); >+ res.append(", "); //$NON-NLS-1$ > res.append(JPAEditorUtil.cutFromLastDot(strings[i])); > } > return res.toString(); >@@ -237,7 +240,7 @@ > return null; > StringBuilder res = new StringBuilder(JPAEditorUtil.cutFromLastDot(strIt.next())); > while (strIt.hasNext()) { >- res.append(" ,"); >+ res.append(", "); //$NON-NLS-1$ > res.append(JPAEditorUtil.cutFromLastDot(strIt.next())); > } > return res.toString(); >@@ -248,7 +251,7 @@ > return null; > StringBuilder res = new StringBuilder(strIt.next()); > while (strIt.hasNext()) { >- res.append(" ,"); >+ res.append(" ,"); //$NON-NLS-1$ > res.append(strIt.next()); > } > return res.toString(); >@@ -266,7 +269,7 @@ > > public static JavaPersistentType getJPType(ICompilationUnit cu) { > String name = cu.getElementName(); >- if (!name.endsWith(".java"))//$NON-NLS-1$ >+ if (!name.endsWith(".java")) //$NON-NLS-1$ > return null; > IType tp = cu.findPrimaryType(); > if (tp == null) >@@ -355,7 +358,7 @@ > > public static String produceValidAttributeName(String name) { > if ((name == null) || (name.length() == 0)) >- return ""; //$NON-NLS-1$ >+ return ""; //$NON-NLS-1$ > if (name.length() == 1) > return name.toLowerCase(Locale.ENGLISH); > String secondSymbol = name.substring(1, 2); >@@ -1353,5 +1356,25 @@ > String res = getAttributeTypeName(at); > return MessageFormat.format(JPAEditorMessages.JPAEditorUtil_typeTooltipText, new Object[] { res }); > } >+ >+ static public boolean checkJPAFacetVersion(JpaProject jpaProject, String version) { >+ return checkJPAFacetVersion(jpaProject.getProject(), version); >+ } > >+ static public boolean checkJPAFacetVersion(IProject project, String version) { >+ IFacetedProject fproj = null; >+ try { >+ fproj = ProjectFacetsManager.create(project); >+ } catch (CoreException e) { >+ } >+ Set<IProjectFacetVersion> projFacets = fproj.getProjectFacets(); >+ Iterator<IProjectFacetVersion> it = projFacets.iterator(); >+ while (it.hasNext()) { >+ IProjectFacetVersion fv = it.next(); >+ if (fv.getProjectFacet().getId().equals("jpt.jpa")) //$NON-NLS-1$ >+ return fv.getVersionString().equals(version); >+ } >+ return false; >+ } >+ > } >\ No newline at end of file
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 338216
:
189920
| 189924