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 220359 Details for
Bug 315480
Ability to open orm.xml file for target entity
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 patch
315480_08_26_2012_commit (text/plain), 3.71 KB, created by
Nan Li
on 2012-08-27 17:41:45 EDT
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Nan Li
Created:
2012-08-27 17:41:45 EDT
Size:
3.71 KB
patch
obsolete
>diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TargetEntityClassChooser.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TargetEntityClassChooser.java >index b483621..6b90bf5 100644 >--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TargetEntityClassChooser.java >+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TargetEntityClassChooser.java >@@ -9,7 +9,11 @@ > *******************************************************************************/ > package org.eclipse.jpt.jpa.ui.internal.details; > >+import org.eclipse.core.resources.IFile; > import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.IType; >+import org.eclipse.jpt.common.core.internal.utility.JDTTools; >+import org.eclipse.jpt.common.core.internal.utility.PlatformTools; > import org.eclipse.jpt.common.ui.internal.JptCommonUiMessages; > import org.eclipse.jpt.common.ui.internal.widgets.ClassChooserComboPane; > import org.eclipse.jpt.common.ui.internal.widgets.Pane; >@@ -18,11 +22,19 @@ > import org.eclipse.jpt.common.utility.model.value.ListValueModel; > import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel; > import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; >+import org.eclipse.jpt.jpa.core.context.PersistentType; > import org.eclipse.jpt.jpa.core.context.RelationshipMapping; >+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; > import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds; >+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin; >+import org.eclipse.jpt.jpa.ui.selection.JpaSelectionManager; > import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.PartInitException; >+import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.forms.widgets.Hyperlink; >+import org.eclipse.ui.ide.IDE; > > /** > * target entity hyperlink label, combo and browse button >@@ -132,4 +144,52 @@ > } > return JptCommonUiMessages.DefaultEmpty; > } >+ >+ /* >+ * Duplicate persistent type case is not handled so the opened mapping file could be >+ * any one of the existent mapping files that has the persistent type. >+ * User needs to solve the duplicate problem to open the mapping file he wants to open. >+ */ >+ protected void hyperLinkSelected() { >+ String className = this.getFullyQualifiedClassName(); >+ if (className != null) { >+ PersistentType pType = this.getSubject().getPersistenceUnit().getPersistentType(className); >+ if (pType instanceof OrmPersistentType) { >+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); >+ IFile file = ((OrmPersistentType)pType).getParent().getParent().getXmlResource().getFile(); >+ openInEditor(page, file); >+ setSelectionInEditor(page, pType); >+ } else { >+ IType type = JDTTools.findType(this.getJavaProject(), className); >+ if (type != null) { >+ openInEditor(type); >+ } else { >+ createType(); >+ } >+ } >+ } >+ } >+ >+ /** >+ * Open the file in an editor of the active workbench page >+ * @param page >+ * @param file >+ */ >+ private void openInEditor(IWorkbenchPage page, IFile file) { >+ try { >+ IDE.openEditor(page, file); >+ } catch (PartInitException ex) { >+ JptJpaUiPlugin.instance().logError(ex); >+ } >+ } >+ /** >+ * Set the selection to the persistent type in the editor >+ * @param page >+ * @param persistentType >+ */ >+ >+ private void setSelectionInEditor(IWorkbenchPage page, PersistentType persistentType) { >+ JpaSelectionManager selectionManager = PlatformTools.getAdapter(page, JpaSelectionManager.class); >+ selectionManager.setSelection(persistentType); >+ } > } >\ 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
Flags:
neil.hauge
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 315480
: 220359