Bug 18961 Adding new class creates class in wrong package in Java Browsing Perspective [browsing]
Hi, I'm working on a class in package A and want to create a class in package B in the Java Browsing perspective. I select package B in the Packages view go into the Types view, click the right mouse button and select New Class. The new class is created in package A instead of package B. Environment: Windows 2000 JSDK 1.4.0 Eclipse F2
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java
element= getParent(element);
						if (element != null) {
							newSelection= new StructuredSelection(element);
							fViewer.setSelection(newSelection);
						}
					}
				} finally {
					fViewer.addSelectionChangedListener(fSelectionListener);
				}
			}
		}
	}
	/**
	 * Returns the element's parent.
	 * 
	 * @return the parent or <code>null</code> if there's no parent
	 */
	private Object getParent(Object element) {
		if (element instanceof IJavaElement)
			return ((IJavaElement)element).getParent();
		else if (element instanceof IResource)
			return ((IResource)element).getParent();
			
		return null;
	}
	
	/**
	 * A compilation unit or class was expanded, expand
	 * the main type.