Bug 12543 - Code assist to insert method does not work when there are extra top-level statements
Summary: Code assist to insert method does not work when there are extra top-level sta...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: 2.0 M6   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-01 10:19 EST by Nick Edgar CLA
Modified: 2002-05-02 11:17 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 Nick Edgar CLA 2002-04-01 10:19:31 EST
Build 20020328

In the following compilation unit, I tried using Ctrl+Space at <|> to generate 
an inherited method implementation (for fillContextMenu).
Instead, it inserted "OpenActionGroup".
The statements following <|> were intended to be the body of the new method.
It works OK if these extra statements are not there.

package org.eclipse.ui.views.navigator;

import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.actions.OpenFileAction;

/**
 * This is the action group for the open actions.
 */
public class OpenActionGroup extends ActionGroup {

	private IResourceNavigatorPart navigator;
	private OpenFileAction openFileAction;
//	private OpenSystemEditorAction openSystemEditorAction;
	public static final String ID = PlatformUI.PLUGIN_ID 
+ ".OpenWithSubMenu";//$NON-NLS-1$

	public OpenActionGroup(IResourceNavigatorPart navigator) {
		this.navigator = navigator;
		makeActions();
	}

	private void makeActions() {
		openFileAction = new OpenFileAction(navigator.getSite().getPage
());
//		openSystemEditorAction = new OpenSystemEditorAction
(site.getPage());
	}

<|>

		selectionChanged(selection);

		boolean anyResourceSelected =
			!selection.isEmpty()
				&& ResourceSelectionUtil.allResourcesAreOfType(
					selection,
					IResource.PROJECT | IResource.FOLDER | 
IResource.FILE);
		boolean onlyFilesSelected =
			!selection.isEmpty()
				&& ResourceSelectionUtil.allResourcesAreOfType
(selection, IResource.FILE);

		if (onlyFilesSelected)
			menu.add(openFileAction);

		if (anyResourceSelected) {
			fillOpenWithMenu(menu, selection);
			fillOpenToMenu(menu, selection);
		}
	}

	
}
Comment 1 Erich Gamma CLA 2002-04-09 12:59:49 EDT
moving to JDT Core for investigation
Comment 2 David Audel CLA 2002-05-02 11:17:31 EDT
Fixed.