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 52582 Details for
Bug 154781
Generic annotation editing solution
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Improved patch
patch.txt (text/plain), 3.72 KB, created by
Dani Megert
on 2006-10-24 06:59:54 EDT
(
hide
)
Description:
Improved patch
Filename:
MIME Type:
Creator:
Dani Megert
Created:
2006-10-24 06:59:54 EDT
Size:
3.72 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditorSelectionConverter.java >=================================================================== >RCS file: ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditorSelectionConverter.java >diff -N ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditorSelectionConverter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditorSelectionConverter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,90 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the terms of >+ * the Eclipse Public License v1.0, which accompanies this distribution and is available at >+ * http://www.eclipse.org/legal/epl-v10.html. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.jdt.internal.ui.javaeditor; >+ >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.StructuredSelection; >+ >+import org.eclipse.jface.text.ITextSelection; >+ >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.IWorkbenchPage; >+ >+import org.eclipse.ui.views.properties.tabbed.ISelectionConverter; >+ >+import org.eclipse.jdt.core.IJavaElement; >+import org.eclipse.jdt.core.ISourceRange; >+import org.eclipse.jdt.core.ISourceReference; >+import org.eclipse.jdt.core.JavaModelException; >+ >+import org.eclipse.jdt.internal.ui.JavaPlugin; >+import org.eclipse.jdt.internal.ui.actions.SelectionConverter; >+ >+/** >+ * An implementation of the tabbed properties ISelectionConverter for the JavaEditor. >+ * It takes an ISelection which from the JavaEditor will be an ITextSelection and converts >+ * it into an IStructuredSelection containing an IJavaElement. >+ * >+ * @since 3.3 >+ */ >+public class JavaEditorSelectionConverter implements ISelectionConverter { >+ >+ public IStructuredSelection structuredSelection(ISelection selection) { >+ if (selection instanceof IStructuredSelection) >+ return (IStructuredSelection) selection; >+ >+ if (!(selection instanceof ITextSelection)) >+ return StructuredSelection.EMPTY; >+ >+ ITextSelection textSelection= (ITextSelection)selection; >+ >+ IJavaElement javaElement= getJavaElementAt((textSelection)); >+ if (javaElement == null) >+ return StructuredSelection.EMPTY; >+ >+ if (javaElement instanceof ISourceReference) { >+ //make sure only one JavaElement is in the selection. Compare its length >+ //to the length of the selection. >+ try { >+ ISourceRange range= ((ISourceReference) javaElement).getSourceRange(); >+ if (range != null && textSelection.getLength() > range.getLength()) >+ return StructuredSelection.EMPTY; >+ } >+ catch (JavaModelException e) { >+ JavaPlugin.log(e); >+ return StructuredSelection.EMPTY; >+ } >+ } >+ >+ return new StructuredSelection(javaElement); >+ } >+ >+ private IJavaElement getJavaElementAt(ITextSelection textSelection) { >+ IEditorPart editor= getActiveEditor(); >+ if (editor instanceof JavaEditor) { >+ IJavaElement je= ((JavaEditor)editor).getInputJavaElement(); >+ try { >+ return SelectionConverter.getElementAtOffset(je, textSelection); >+ } catch (JavaModelException e) { >+ JavaPlugin.log(e); >+ // Fall through >+ } >+ } >+ return null; >+ } >+ >+ private IEditorPart getActiveEditor() { >+ IWorkbenchPage activePage= JavaPlugin.getActivePage(); >+ if (activePage == null) >+ return null; >+ return activePage.getActiveEditor(); >+ } >+}
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