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 196280 Details for
Bug 346799
[wizard] new role wizard should respect text selection
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]
Implementation
Bug_346799.patch (text/plain), 2.55 KB, created by
Stephan Herrmann
on 2011-05-21 18:15:01 EDT
(
hide
)
Description:
Implementation
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2011-05-21 18:15:01 EDT
Size:
2.55 KB
patch
obsolete
>Index: src/org/eclipse/objectteams/otdt/internal/ui/wizards/NewTypeWizardPage.java >=================================================================== >--- src/org/eclipse/objectteams/otdt/internal/ui/wizards/NewTypeWizardPage.java (revision 1114) >+++ src/org/eclipse/objectteams/otdt/internal/ui/wizards/NewTypeWizardPage.java (working copy) >@@ -52,6 +52,7 @@ > import org.eclipse.jdt.internal.corext.util.JavaModelUtil; > import org.eclipse.jdt.internal.corext.util.Messages; > import org.eclipse.jdt.internal.corext.util.Resources; >+import org.eclipse.jdt.internal.ui.JavaPlugin; > import org.eclipse.jdt.internal.ui.JavaPluginImages; > import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; > import org.eclipse.jdt.internal.ui.dialogs.StatusUtil; >@@ -76,6 +77,7 @@ > import org.eclipse.jdt.ui.wizards.NewContainerWizardPage; > import org.eclipse.jface.contentassist.SubjectControlContentAssistant; > import org.eclipse.jface.dialogs.Dialog; >+import org.eclipse.jface.text.ITextSelection; > import org.eclipse.jface.viewers.CellEditor; > import org.eclipse.jface.viewers.ICellModifier; > import org.eclipse.jface.viewers.ISelection; >@@ -99,6 +101,7 @@ > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Item; > import org.eclipse.swt.widgets.Text; >+import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.contentassist.ContentAssistHandler; > > /** >@@ -779,6 +782,33 @@ > initContainerPage(jelem); > initTypePage(jelem); > } >+ >+ @Override >+ protected IJavaElement getInitialJavaElement(IStructuredSelection structuredSelection) { >+ IJavaElement element = super.getInitialJavaElement(structuredSelection); >+ if (element.getElementType() == IJavaElement.COMPILATION_UNIT) { >+ // try to improve: >+ IWorkbenchWindow window= JavaPlugin.getActiveWorkbenchWindow(); >+ if (window != null) { >+ ISelection selection= window.getSelectionService().getSelection(); >+ if (selection instanceof ITextSelection) { >+ ITextSelection textSelection = (ITextSelection) selection; >+ try { >+ IJavaElement selected = ((ICompilationUnit)element).getElementAt(textSelection.getOffset()); >+ if (selected != null) { >+ selected = selected.getAncestor(IJavaElement.TYPE); >+ if (selected != null) { >+ if (((IType)selected).isLocal()) >+ selected = ((IType)selected).getDeclaringType(); >+ return selected; >+ } >+ } >+ } catch (JavaModelException e) { /* nop */ } >+ } >+ } >+ } >+ return element; >+ } > > /** > * Initializes all fields provided by the page with a given selection.
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 346799
: 196280