Bug 88299 - [code manipulation] Sort member doesn't scope to selected type
Summary: [code manipulation] Sort member doesn't scope to selected type
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-17 04:07 EST by Philipe Mulet CLA
Modified: 2007-06-22 09:10 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2005-03-17 04:07:47 EST
20050315

When selecting MyAnnotation declaration, and perform sort members (from
outline), it sorts entire unit.

import java.lang.annotation.*;

@Target(ElementType.METHOD)
@interface MyAnnotation {
	String name() default "";
	String value();
}

@MyAnnotation("type")
public class Class4 {

	@MyAnnotation(value = "method")
	void foo(){
		
	}
}
Comment 1 Dirk Baeumer CLA 2005-03-17 04:34:24 EST
The ComnpilationUnit sorter provided by JDT/Core always sorts the whole CU.

Moving to JDT/Core since this needs additional API.
Comment 2 Olivier Thomann CLA 2005-03-17 11:11:45 EST
Indeed the CompilationUnitSorter sorts... a compilation unit. We could add an
API that would give the context that we want to sort.
The new implementation is using a DOM/AST tree. So we would simply need to visit
a subpart of the tree instead of the whole cu.
If we add a new API, I don't think it makes sense to add it inside
CompilationUnitSorter. The name is misleading.
Comment 3 Olivier Thomann CLA 2005-03-26 11:48:13 EST
Philippe, this requires a new API. So if we want to fix it for 3.1 we need a new
API for M6.
Comment 4 Philipe Mulet CLA 2005-03-26 17:19:11 EST
+1 if reasonable change.

Note that it still sorts elements within a compilation unit, only could be given
a scope to restrain action.
Comment 5 Olivier Thomann CLA 2005-03-30 11:53:25 EST
I could suggest:

	public static void sort(ICompilationUnit compilationUnit,
	        IJavaElement elementToSort,
	        int[] positions,
	        Comparator comparator,
	        int options,
	        IProgressMonitor monitor) throws JavaModelException;