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 51771 Details for
Bug 154781
Generic annotation editing solution
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to implement StructuredSelectionProvider and tabbed properties in the JavaEditor
154781Patch.txt (text/plain), 7.53 KB, created by
Karen Butzke
on 2006-10-11 13:08:21 EDT
(
hide
)
Description:
Patch to implement StructuredSelectionProvider and tabbed properties in the JavaEditor
Filename:
MIME Type:
Creator:
Karen Butzke
Created:
2006-10-11 13:08:21 EDT
Size:
7.53 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/plugin.properties,v >retrieving revision 1.435 >diff -u -r1.435 plugin.properties >--- plugin.properties 6 Sep 2006 16:20:45 -0000 1.435 >+++ plugin.properties 11 Oct 2006 17:08:14 -0000 >@@ -1014,3 +1014,5 @@ > > #--- Work in Progress > contentAssistAdvancedName= Advanced >+ >+JavaPropertiesTab=Java >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/plugin.xml,v >retrieving revision 1.705 >diff -u -r1.705 plugin.xml >--- plugin.xml 6 Sep 2006 16:20:45 -0000 1.705 >+++ plugin.xml 11 Oct 2006 17:08:20 -0000 >@@ -5479,5 +5479,31 @@ > </selectionEnablement> > </linkHelper> > </extension> >+ <extension >+ point="org.eclipse.ui.views.properties.tabbed.propertyContributor"> >+ <propertyContributor >+ contributorId="javaEditor" >+ structuredSelectionProvider="org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$StructuredSelectionProvider"> >+ <propertyCategory category="java"/> >+ </propertyContributor> >+ </extension> >+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs"> >+ <propertyTabs contributorId="javaEditor"> >+ <propertyTab >+ category="java" >+ id="javaEditor.JavaTab" >+ label="%JavaPropertiesTab"/> >+ </propertyTabs> >+ </extension> >+ <extension point="org.eclipse.ui.views.properties.tabbed.propertySections"> >+ <propertySections contributorId="javaEditor"> >+ <propertySection >+ class="org.eclipse.ui.views.properties.tabbed.AdvancedPropertySection" >+ id="javaEditor.AdvancedSection" >+ tab="javaEditor.JavaTab"> >+ <input type="org.eclipse.jdt.core.IJavaElement"/> >+ </propertySection> >+ </propertySections> >+ </extension> > > </plugin> >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.43 >diff -u -r1.43 MANIFEST.MF >--- META-INF/MANIFEST.MF 11 Sep 2006 13:19:18 -0000 1.43 >+++ META-INF/MANIFEST.MF 11 Oct 2006 17:08:20 -0000 >@@ -127,7 +127,8 @@ > org.eclipse.ltk.ui.refactoring;bundle-version="[3.3.0,4.0.0)", > org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)", > org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)", >- org.eclipse.jdt.core.manipulation;bundle-version="[1.1.0,2.0.0)" >+ org.eclipse.jdt.core.manipulation;bundle-version="[1.1.0,2.0.0)", >+ org.eclipse.ui.views.properties.tabbed;bundle-version="[3.2.0,4.0.0)" > Eclipse-LazyStart: true > Plugin-Class: org.eclipse.jdt.internal.ui.JavaPlugin > Import-Package: com.ibm.icu.text >Index: ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java,v >retrieving revision 1.409 >diff -u -r1.409 JavaEditor.java >--- ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java 17 Aug 2006 13:29:59 -0000 1.409 >+++ ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java 11 Oct 2006 17:08:23 -0000 >@@ -33,6 +33,7 @@ > import org.eclipse.core.runtime.preferences.IEclipsePreferences; > import org.eclipse.core.runtime.preferences.IScopeContext; > >+import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.ProjectScope; > >@@ -117,6 +118,7 @@ > > import org.eclipse.ui.IEditorInput; > import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.IFileEditorInput; > import org.eclipse.ui.IPageLayout; > import org.eclipse.ui.IPartListener2; > import org.eclipse.ui.IPartService; >@@ -155,6 +157,10 @@ > > import org.eclipse.ui.views.contentoutline.ContentOutline; > import org.eclipse.ui.views.contentoutline.IContentOutlinePage; >+import org.eclipse.ui.views.properties.IPropertySheetPage; >+import org.eclipse.ui.views.properties.tabbed.IStructuredSelectionProvider; >+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; >+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; > > import org.eclipse.jdt.core.IClassFile; > import org.eclipse.jdt.core.ICompilationUnit; >@@ -1552,6 +1558,77 @@ > public void partInputChanged(IWorkbenchPartReference partRef) {} > } > >+ public static class StructuredSelectionProvider >+ implements IStructuredSelectionProvider >+ { >+ public IStructuredSelection structuredSelection(ISelection selection) { >+ if (selection instanceof IStructuredSelection) { >+ return (IStructuredSelection) selection; >+ } >+ int offset = ((ITextSelection) selection).getOffset(); >+ >+ ICompilationUnit unit = getCompilationUnit(); >+ IJavaElement javaElement = null; >+ if (unit != null) { >+ try { >+ javaElement = unit.getElementAt(offset); >+ } catch (JavaModelException ex) { >+ // fall through >+ } >+ } >+ >+ if (javaElement == null) { >+ return StructuredSelection.EMPTY; >+ } >+ return new StructuredSelection(javaElement); >+ } >+ >+ private ICompilationUnit getCompilationUnit() { >+ IEditorPart editor = getActiveEditor(); >+ if (editor == null) { >+ return null; >+ } >+ IEditorInput editorInput = editor.getEditorInput(); >+ if (editorInput instanceof IFileEditorInput) { >+ IFileEditorInput fileInput = (IFileEditorInput) editorInput; >+ IFile file = fileInput.getFile(); >+ return JavaCore.createCompilationUnitFrom(file); >+ } >+ return null; >+ } >+ >+ private IEditorPart getActiveEditor() { >+ IWorkbenchWindow activeWorkbenchWindow = JavaPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(); >+ if (activeWorkbenchWindow == null) { >+ return null; >+ } >+ IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage(); >+ if (activePage == null) { >+ return null; >+ } >+ return activePage.getActiveEditor(); >+ } >+ >+// >+// public IJpaFile persistenceFileFor(IEditorInput input) { >+// IFile file = null; >+// if (input instanceof IFileEditorInput) { >+// IFileEditorInput fileInput = (IFileEditorInput) input; >+// file = fileInput.getFile(); >+// } >+// else if (input instanceof IClassFileEditorInput) { >+// IClassFileEditorInput classFileEditorInput = (IClassFileEditorInput) input; >+// IClassFile classFile = classFileEditorInput.getClassFile(); >+// classFile.getResource(); >+// >+// } >+// if (file == null) { >+// return null; >+// } >+// return JpaCorePlugin.getJpaFile(file); >+// } >+ } >+ > /** Preference key for matching brackets */ > protected final static String MATCHING_BRACKETS= PreferenceConstants.EDITOR_MATCHING_BRACKETS; > /** Preference key for matching brackets color */ >@@ -2036,10 +2113,22 @@ > > if (required == IContextProvider.class) > return JavaUIHelp.getHelpContextProvider(this, IJavaHelpContextIds.JAVA_EDITOR); >+ >+ if (required == IPropertySheetPage.class) { >+ return new TabbedPropertySheetPage(buildTabbedPropertySheetPageContributor()); >+ } > > return super.getAdapter(required); > } > >+ private ITabbedPropertySheetPageContributor buildTabbedPropertySheetPageContributor() { >+ return new ITabbedPropertySheetPageContributor() { >+ public String getContributorId() { >+ return "javaEditor"; //$NON-NLS-1$ >+ } >+ }; >+ } >+ > /** > * React to changed 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 154781
:
50902
|
51002
|
51771
|
52128
|
52319
|
52582