Bug 59750 - DCR: Code Assist: Hook to add getter and setters
Summary: DCR: Code Assist: Hook to add getter and setters
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-23 03:27 EDT by Martin Aeschlimann CLA
Modified: 2004-05-18 11:34 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2004-04-23 03:27:33 EDT
20040423

This is a feature I would think is worth an effort to put in 3.0.

Similar to overridden methods that are suggested in type bodies I would like to
offer getter and setters at this place.
e.g. on

class A {
  Point size;
  Sting source;

  getS|code assist  I would suggest getSize(), getSource()

To minimize the work of jdt.core, we could do the following:
The result collectpr in jdt.ui need a way to detect that the current index is at
a method body declaration. That means I need at least one 'method decl' assist
callback and then we can then add all the getter/setter proposals.
Therefore jdt.core could always given me a method decl assist: On 'getS',
suggest a method 
  private void getS() {
  }

This would be an nice feature anyways:
  foo|code assist ->
  private void foo() {
  }
Have nice quick method stub for tests, demos ect
(An additional idea would be to switch to the template mode when applied, e.g to
Step through modifier, return type and parameter
Comment 1 Philipe Mulet CLA 2004-04-23 07:34:50 EDT
Nice to have, but post 3.0 and with the new codeassist API.
Comment 2 Philipe Mulet CLA 2004-04-28 12:23:41 EDT
How would a random client know that this method is an artifact ?
Comment 3 Martin Aeschlimann CLA 2004-04-29 03:59:38 EDT
The trick is that it's useful as is. As said, it offers to create a method 
stub with the name that's currently there.

class A {
eq|
}

suggests
  'equals': existing proposals to override the equals methods
    -> public boolean equals(Object o) { ... }
  'eq': new (test method with the name 'eq'
    -> private void eq() {}

You would use this proposal for quickly create a test method, ect.
Comment 4 Philipe Mulet CLA 2004-04-29 06:49:44 EDT
Could be useful indeed. Will investigate.
Comment 5 David Audel CLA 2004-05-04 05:35:34 EDT
Fixed. Added a new interface

public interface IExtendedCompletionRequestor extends ICompletionRequestor {
	void acceptPotentialMethodDeclaration(
			char[] declaringTypePackageName,
			char[] declaringTypeName,
			char[] selector,
			int completionStart,
			int completionEnd,
			int relevance);
}

Implements this class and use them as a completion requestor.

This is a temporary fix. Once the new completion API will be ready, this class 
will be removed.
Comment 6 Olivier Thomann CLA 2004-05-18 11:34:41 EDT
Verified in 200405180816