this. in getter and setter methods [message #122330] |
Wed, 26 November 2003 08:59  |
Eclipse User |
|
|
|
Originally posted by: kl.itec.uni-klu.ac.at
Hi,
is it possible to customize the "Generate Getter and Setter" functionality
by adding a "this." before the attribute to set/get?
Example:
What Eclipse does:
public void setSomething(int i) {
something = i;
}
What I want:
public void setSomething(int i) {
this.something = i;
}
Thanks in advance,
Klaus
|
|
|
|
|
|
|
|
|
|
|
Re: this. in getter and setter methods [message #122714 is a reply to message #122429] |
Thu, 27 November 2003 10:06   |
Eclipse User |
|
|
|
Michael Legart wrote:
> On Wed, 26 Nov 2003 16:06:48 +0100, Tom Eicher <eclipse@tkilla.ch> wrote:
>
>>>No getter and setter stuff here :(
>>
>>What build are you on? AFAIR, this has been added around M3 or M4.
>>-tom
>
>
> Is it just me or is this broken in M5? When I choose "Generate
> Getters and Setters" nothing happends. No dialig appears and
> no errormessage. Any ideas?
This appears to be 'half' broken in M5. If I right click on a field
variable and do 'Source|Generate Getters and Setters', then it works
absolutely ok. On the other hand, if I right click on some empty space
in the class and do the same thing, or if I try to use the Eclipse menu
option for this, I get no visible results, and some errors appear in the
Error Log, as follows:
!ENTRY org.eclipse.ui 4 4 Nov 27, 2003 10:01:47.980
!MESSAGE Unhandled event loop exception
!ENTRY org.eclipse.ui 4 0 Nov 27, 2003 10:01:47.980
!MESSAGE null argument;
!STACK 0
org.eclipse.jface.util.Assert$AssertionFailedException: null argument;
at org.eclipse.jface.util.Assert.isNotNull(Assert.java:139)
at org.eclipse.jface.util.Assert.isNotNull(Assert.java:116)
at
org.eclipse.jface.viewers.AbstractTreeViewer.reveal(Abstract TreeViewer.java:1233)
at
org.eclipse.jdt.ui.actions.AddGetterSetterAction$GetterSette rTreeSelectionDialog.createDialogArea(AddGetterSetterAction. java:972)
at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java: 573)
at org.eclipse.jface.window.Window.create(Window.java:305)
at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:883)
at
org.eclipse.ui.dialogs.SelectionStatusDialog.create(Selectio nStatusDialog.java:143)
at
org.eclipse.ui.dialogs.CheckedTreeSelectionDialog.access$sup erCreate(CheckedTreeSelectionDialog.java:215)
at
org.eclipse.ui.dialogs.CheckedTreeSelectionDialog.access$0(C heckedTreeSelectionDialog.java:214)
at
org.eclipse.ui.dialogs.CheckedTreeSelectionDialog$1.run(Chec kedTreeSelectionDialog.java:240)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:84)
at
org.eclipse.ui.dialogs.CheckedTreeSelectionDialog.create(Che ckedTreeSelectionDialog.java:238)
at org.eclipse.jface.window.Window.open(Window.java:555)
at
org.eclipse.ui.dialogs.CheckedTreeSelectionDialog.open(Check edTreeSelectionDialog.java:209)
at
org.eclipse.jdt.ui.actions.AddGetterSetterAction.run(AddGett erSetterAction.java:255)
at
org.eclipse.jdt.ui.actions.AddGetterSetterAction.run(AddGett erSetterAction.java:505)
at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchR un(SelectionDispatchAction.java:196)
at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(Selec tionDispatchAction.java:172)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:842 )
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:542)
at
org.eclipse.jface.action.ActionContributionItem.access$4(Act ionContributionItem.java:494)
at
org.eclipse.jface.action.ActionContributionItem$6.handleEven t(ActionContributionItem.java:466)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:847)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:2187)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1877)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1381)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:237)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:139)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:47)
at
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.java:858)
at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.basicRun(Main.java:299)
at org.eclipse.core.launcher.Main.run(Main.java:767)
at org.eclipse.core.launcher.Main.main(Main.java:601)
|
|
|
Re: this. in getter and setter methods [message #122723 is a reply to message #122714] |
Thu, 27 November 2003 10:34  |
Eclipse User |
|
|
|
Originally posted by: eclipse.tkilla.ch
Please file a bug report agains jdt ui.
-tom
Colin Sampaleanu wrote:
> Michael Legart wrote:
> This appears to be 'half' broken in M5. If I right click on a field
> variable and do 'Source|Generate Getters and Setters', then it works
> absolutely ok. On the other hand, if I right click on some empty space
> in the class and do the same thing, or if I try to use the Eclipse menu
> option for this, I get no visible results, and some errors appear in the
> Error Log, as follows:
>
> !ENTRY org.eclipse.ui 4 4 Nov 27, 2003 10:01:47.980
> !MESSAGE Unhandled event loop exception
> !ENTRY org.eclipse.ui 4 0 Nov 27, 2003 10:01:47.980
> !MESSAGE null argument;
> !STACK 0
> org.eclipse.jface.util.Assert$AssertionFailedException: null argument;
> at org.eclipse.jface.util.Assert.isNotNull(Assert.java:139)
> at org.eclipse.jface.util.Assert.isNotNull(Assert.java:116)
> at
> org.eclipse.jface.viewers.AbstractTreeViewer.reveal(Abstract TreeViewer.java:1233)
>
> at
> org.eclipse.jdt.ui.actions.AddGetterSetterAction$GetterSette rTreeSelectionDialog.createDialogArea(AddGetterSetterAction. java:972)
>
> at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java: 573)
> at org.eclipse.jface.window.Window.create(Window.java:305)
> at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:883)
> at
> org.eclipse.ui.dialogs.SelectionStatusDialog.create(Selectio nStatusDialog.java:143)
>
> at
> org.eclipse.ui.dialogs.CheckedTreeSelectionDialog.access$sup erCreate(CheckedTreeSelectionDialog.java:215)
>
> at
> org.eclipse.ui.dialogs.CheckedTreeSelectionDialog.access$0(C heckedTreeSelectionDialog.java:214)
>
> at
> org.eclipse.ui.dialogs.CheckedTreeSelectionDialog$1.run(Chec kedTreeSelectionDialog.java:240)
>
> at
> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:84)
> at
> org.eclipse.ui.dialogs.CheckedTreeSelectionDialog.create(Che ckedTreeSelectionDialog.java:238)
>
> at org.eclipse.jface.window.Window.open(Window.java:555)
> at
> org.eclipse.ui.dialogs.CheckedTreeSelectionDialog.open(Check edTreeSelectionDialog.java:209)
>
> at
> org.eclipse.jdt.ui.actions.AddGetterSetterAction.run(AddGett erSetterAction.java:255)
>
> at
> org.eclipse.jdt.ui.actions.AddGetterSetterAction.run(AddGett erSetterAction.java:505)
>
> at
> org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchR un(SelectionDispatchAction.java:196)
>
> at
> org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(Selec tionDispatchAction.java:172)
>
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:842 )
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:542)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$4(Act ionContributionItem.java:494)
>
> at
> org.eclipse.jface.action.ActionContributionItem$6.handleEven t(ActionContributionItem.java:466)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :82)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:847)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:2187)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1877)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1405)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1381)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:237)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:139)
> at
> org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:47)
> at
> org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.java:858)
>
> at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:299)
> at org.eclipse.core.launcher.Main.run(Main.java:767)
> at org.eclipse.core.launcher.Main.main(Main.java:601)
>
|
|
|
Powered by
FUDForum. Page generated in 0.04137 seconds