Bug 19104 Basket for problems with .java files outside build path
1) .java file is not inside a source folder - "Rename" refactoring is enabled but does not work: no preview and does not rename if finished is pressed. 2) .java file that is inside a non-Java project - Lots of problems when views hold on to a working copy which can not be mapped to a compilation unit after the editor has been closed - shows red squiggly lines when using "Show Source of selected element only" - same problems as 1) MORE WILL FOLLOW TOMORROW
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/ShowInPackageViewAction.java
}
	
	private IJavaElement getVisibleParent(IJavaElement element) {
		switch (element.getElementType()) {
			case IJavaElement.IMPORT_DECLARATION:
			case IJavaElement.PACKAGE_DECLARATION:
			case IJavaElement.IMPORT_CONTAINER:
			case IJavaElement.TYPE:
			case IJavaElement.METHOD:
			case IJavaElement.FIELD:
			case IJavaElement.INITIALIZER:
				
				element= (IJavaElement)element.getOpenable();
				break;
			case IJavaElement.JAVA_MODEL:
				element= null;
				break;
		}
		if (element.getElementType() == IJavaElement.COMPILATION_UNIT) {
			ICompilationUnit unit= (ICompilationUnit)element;
			if (unit.isWorkingCopy())
				element= unit.getOriginalElement();
		}
		return element;
	}
	
	private static String getDialogTitle() {
		return ActionMessages.getString("ShowInPackageViewAction.dialog.title"); 
	}
}