Community
Participate
Working Groups
I have noticed with 3.2M7 that Code Assist and Open Declaration (F3) occasionally do not work properly in anonymous nested classes. I ran JDT in the debugger and found that the method is being parsed incorrectly. Here is the method: =============================================================================================================================== private void createScriptSaveSettingsGroup(Composite parent) { final Group group = NSISWizardDialogUtil.createGroup(parent, 1, "script.save.settings.group.label",null,true); //$NON-NLS-1$ final NSISWizardSettings settings = mWizard.getSettings(); Composite c = new Composite(group,SWT.None); c.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,false)); GridLayout layout = new GridLayout(3,false); layout.marginHeight = layout.marginWidth = 0; c.setLayout(layout); final Button[] radioButtons = NSISWizardDialogUtil.createRadioGroup(c,new String[] {EclipseNSISPlugin.getResourceString("workspace.save.label"), EclipseNSISPlugin.getResourceString("filesystem.save.label")}, mWizard.getSettings().isSaveExternal()?1:0,"save.label",true,null,false); final Text t = NSISWizardDialogUtil.createText(c, settings.getSavePath().toString(),"save.location.label",true,null,true); //$NON-NLS-1$ ((GridData)t.getLayoutData()).horizontalSpan = 1; t.addModifyListener(new ModifyListener(){ public void modifyText(ModifyEvent e) { settings.setSavePath(((Text)e.widget).getText()); validateField(SAVE_PATH_CHECK); } }); SelectionAdapter selectionAdapter = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { boolean saveExternal = radioButtons[1].getSelection(); if(saveExternal != settings.isSaveExternal()) { settings.setSaveExternal(saveExternal); t.setText(""); } } }; radioButtons[0].addSelectionListener(selectionAdapter); radioButtons[1].addSelectionListener(selectionAdapter); Button b = new Button(c,SWT.PUSH); b.setText(EclipseNSISPlugin.getResourceString("browse.text")); //$NON-NLS-1$ b.setToolTipText(EclipseNSISPlugin.getResourceString("browse.tooltip")); //$NON-NLS-1$ SelectionAdapter selectionAdapter2 = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { String savePath = settings.getSavePath(); if(Common.isEmpty(savePath)) { savePath = EclipseNSISPlugin.getResourceString("default.save.name"); //$NON-NLS-1$ } if(settings.isSaveExternal()) { FileDialog dialog = new FileDialog(getShell(),SWT.SAVE); dialog.setFileName(savePath); dialog.setFilterExtensions(new String[] {INSISConstants.NSI_EXTENSION}); dialog.setText(EclipseNSISPlugin.getResourceString("save.location.title")); //$NON-NLS-1$ savePath = dialog.open(); if(savePath != null) { t.setText(savePath); } } else { SaveAsDialog dialog = new SaveAsDialog(getShell()); IPath path = new Path(savePath); if(path.isAbsolute()) { try { IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); dialog.setOriginalFile(file); } catch (Exception e1) { } } else { dialog.setOriginalName(path.toString()); } dialog.setTitle(EclipseNSISPlugin.getResourceString("save.location.title")); //$NON-NLS-1$ dialog.create(); dialog.setMessage(EclipseNSISPlugin.getResourceString("save.location.message")); //$NON-NLS-1$ int returnCode = dialog.open(); if(returnCode == Window.OK) { t.setText(dialog.getResult().toString()); } } } }; b.addSelectionListener(selectionAdapter2); final Button b2 = NSISWizardDialogUtil.createCheckBox(group, "make.paths.relative.label", //$NON-NLS-1$ settings.isMakePathsRelative(),true, null, false); b2.addSelectionListener(new SelectionAdapter(){ public void widgetSelected(SelectionEvent e) { settings.setMakePathsRelative(((Button)e.widget).getSelection()); } }); c = new Composite(group,SWT.None); c.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,false)); layout = new GridLayout(2,false); layout.marginHeight = layout.marginWidth = 0; c.setLayout(layout); final Button b3 = NSISWizardDialogUtil.createCheckBox(c, "compile.label", //$NON-NLS-1$ settings.isCompileScript(), true, null, false); ((GridData)b3.getLayoutData()).horizontalSpan = 1; b3.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { settings.setCompileScript(((Button)e.widget).getSelection()); } }); MasterSlaveController m = new MasterSlaveController(b3); final Button b4 = NSISWizardDialogUtil.createCheckBox(c, "test.label", //$NON-NLS-1$ settings.isTestScript(), b3.getSelection(), m, false); ((GridData)b4.getLayoutData()).horizontalSpan = 1; b4.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { settings.setTestScript(((Button)e.widget).getSelection()); } }); if(mWizard instanceof NSISScriptWizard) { final NSISScriptWizard scriptWizard = (NSISScriptWizard)mWizard; final Button button = NSISWizardDialogUtil.createCheckBox(group,"save.wizard.template.label",scriptWizard.isSaveAsTemplate(),true,null,false); //$NON-NLS-1$ button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { scriptWizard.setSaveAsTemplate(button.getSelection()); } }); scriptWizard.addSettingsListener(new INSISWizardSettingsListener() { public void settingsChanged() { scriptWizard.setSaveAsTemplate(false); button.setSelection(false); } }); } mWizard.addSettingsListener(new INSISWizardSettingsListener() { public void settingsChanged() { NSISWizardSettings settings = mWizard.getSettings(); t.setText(settings.getSavePath().toString()); b2.setSelection(settings.isMakePathsRelative()); b3.setSelection(settings.isCompileScript()); b4.setSelection(settings.isTestScript()); } }); } =============================================================================================================================== In the debugger, the MethodDeclaration traverse() method had the following array of Statement objects: [final Group group;, final NSISWizardSettings settings;, Composite c;, GridLayout layout;, final Button[] radioButtons;, final Text t;, SelectionAdapter selectionAdapter;, Button b;, SelectionAdapter selectionAdapter2;, new SelectionAdapter() { final Button b2; x() { super(); } () { } public void widgetSelected(SelectionEvent e) { new SelectionAdapter() { x() { super(); } () { } public void widgetSelected(SelectionEvent e) { } }; new INSISWizardSettingsListener() { x() { super(); } () { } public void settingsChanged() { } }; new INSISWizardSettingsListener() { x() { super(); } () { } public void settingsChanged() { } }; } }] As you can see, the last Statement object includes code which are not part of it. This causes F3 to fail.
I can not reproduce the bug in 3.2RC1 or in I20090407-1430 (3.5). I close this bug as WORKSFORME.
Verified for 3.5M7 using build I20090426-2000