issue_id
int64 2.04k
425k
| title
stringlengths 9
251
| body
stringlengths 4
32.8k
⌀ | status
stringclasses 6
values | after_fix_sha
stringlengths 7
7
| project_name
stringclasses 6
values | repo_url
stringclasses 6
values | repo_name
stringclasses 6
values | language
stringclasses 1
value | issue_url
null | before_fix_sha
null | pull_url
null | commit_datetime
unknown | report_datetime
unknown | updated_file
stringlengths 23
187
| chunk_content
stringlengths 1
22k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | return null;
}
/**
* Finds a a member in a compilation unit. Typical usage is to find the corresponding
* member in a working copy.
* @param cu the compilation unit (eg. working copy) to search in
* @param member the member (eg. from the original)
* @return the member found, or null if not existing
*/
public static IMember findMemberInCompilationUnit(ICompilationUnit cu, IMember member) throws JavaModelException {
if (member.getElementType() == IJavaElement.TYPE) {
return findTypeInCompilationUnit(cu, getTypeQualifiedName((IType)member));
} else {
IType declaringType= findTypeInCompilationUnit(cu, getTypeQualifiedName(member.getDeclaringType()));
if (declaringType != null) {
IMember result= null;
switch (member.getElementType()) {
case IJavaElement.FIELD:
result= declaringType.getField(member.getElementName());
break;
case IJavaElement.METHOD:
IMethod meth= (IMethod) member;
result= findMethod(meth.getElementName(), meth.getParameterTypes(), meth.isConstructor(), declaringType);
break;
case IJavaElement.INITIALIZER:
result= declaringType.getInitializer(0);
break;
}
if (result != null && result.exists()) { |
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | return result;
}
}
}
return null;
}
/**
* Returns the element contained in the given set with the same name
* as the given key.
*
* @param set the set to choose from
* @param key the key to look for
* @return the member of the given set with the same name as the given key
*/
private static IJavaElement find(IJavaElement[] set, IJavaElement key) {
if (set == null)
return null;
String name= key.getElementName();
if (name == null)
return null;
for (int i= 0; i < set.length; i++) {
if (name.equals(set[i].getElementName()))
return set[i];
}
return null;
} |
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | /**
* Returns the element of the given compilation unit which is "equal" to the
* given element. Note that the given element usually has a parent different
* from the given compilation unit.
*
* @param cu the cu to search in
* @param element the element to look for
* @return an element of the given cu "equal" to the given element
*/
public static IJavaElement findInCompilationUnit(ICompilationUnit cu, IJavaElement element) throws JavaModelException {
if (element instanceof IMember)
return findMemberInCompilationUnit(cu, (IMember) element);
int type= element.getElementType();
switch (type) {
case IJavaElement.IMPORT_CONTAINER:
return cu.getImportContainer();
case IJavaElement.PACKAGE_DECLARATION:
return find(cu.getPackageDeclarations(), element);
case IJavaElement.IMPORT_DECLARATION:
return find(cu.getImports(), element);
case IJavaElement.COMPILATION_UNIT:
return cu;
} |
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | return null;
}
/**
* Returns the qualified type name of the given type using '.' as separators.
* This is a replace for IType.getTypeQualifiedName()
* which uses '$' as separators. As '$' is also a valid character in an id
* this is ambiguous. JavaCore PR: 1GCFUNT
*/
public static String getTypeQualifiedName(IType type) {
StringBuffer buf= new StringBuffer();
getTypeQualifiedName(type, buf);
return buf.toString();
}
private static void getTypeQualifiedName(IType type, StringBuffer buf) {
IType outerType= type.getDeclaringType();
if (outerType != null) {
getTypeQualifiedName(outerType, buf);
buf.append('.');
}
buf.append(type.getElementName());
}
/**
* Returns the fully qualified name of the given type using '.' as separators.
* This is a replace for IType.getFullyQualifiedTypeName
* which uses '$' as separators. As '$' is also a valid character in an id
* this is ambiguous. JavaCore PR: 1GCFUNT
*/
public static String getFullyQualifiedName(IType type) { |
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | StringBuffer buf= new StringBuffer();
String packName= type.getPackageFragment().getElementName();
if (packName.length() > 0) {
buf.append(packName);
buf.append('.');
}
getTypeQualifiedName(type, buf);
return buf.toString();
}
/**
* Returns the fully qualified name of a type's container. (package name or enclosing type name)
*/
public static String getTypeContainerName(IType type) {
IType outerType= type.getDeclaringType();
if (outerType != null) {
return getFullyQualifiedName(outerType);
} else {
return type.getPackageFragment().getElementName();
}
}
/**
* Returns the raw class path entry corresponding to a package fragment root
* or null if there isn't a corresponding entry.
*/
public static IClasspathEntry getRawClasspathEntry(IPackageFragmentRoot root) throws JavaModelException {
IPath path= root.getPath();
IClasspathEntry[] entries= root.getJavaProject().getRawClasspath();
for (int i= 0; i < entries.length; i++) { |
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | IClasspathEntry curr= entries[i];
if (curr.getEntryKind() == IClasspathEntry.CPE_VARIABLE) {
curr= JavaCore.getResolvedClasspathEntry(curr);
}
if (curr != null && curr.getContentKind() == root.getKind() && path.equals(curr.getPath())) {
return entries[i];
}
}
return null;
}
/**
* Concatenates two names. Uses a dot for separation.
* Both strings can be empty or <code>null</code>.
*/
public static String concatenateName(String name1, String name2) {
StringBuffer buf= new StringBuffer();
if (name1 != null && name1.length() > 0) {
buf.append(name1);
if (name2 != null && name2.length() > 0) {
buf.append('.');
buf.append(name2);
}
}
return buf.toString();
}
/**
* Evaluates if a member (possible from another package) is visible from
* elements in a package. |
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | * @param member The member to test the visibility for
* @param pack The package in focus
*/
public static boolean isVisible(IMember member, IPackageFragment pack) throws JavaModelException {
int otherflags= member.getFlags();
if (Flags.isPublic(otherflags) || Flags.isProtected(otherflags)) {
return true;
} else if (Flags.isPrivate(otherflags)) {
return false;
}
IPackageFragment otherpack= (IPackageFragment) findParentOfKind(member, IJavaElement.PACKAGE_FRAGMENT);
return (pack != null && pack.equals(otherpack));
}
/**
* Returns true if the element is on the build path of the given project
*/
public static boolean isOnBuildPath(IJavaProject jproject, IJavaElement element) throws JavaModelException {
IPath rootPath;
if (element.getElementType() == IJavaElement.JAVA_PROJECT) {
rootPath= ((IJavaProject)element).getProject().getFullPath();
} else {
IPackageFragmentRoot root= getPackageFragmentRoot(element);
if (root == null) {
return false;
}
rootPath= root.getPath();
} |
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | return jproject.findPackageFragmentRoot(rootPath) != null;
}
/**
* Returns the package fragment root of <code>IJavaElement</code>. If the given
* element is already a package fragment root, the element itself is returned.
*/
public static IPackageFragmentRoot getPackageFragmentRoot(IJavaElement element) {
return (IPackageFragmentRoot)findElementOfKind(element, IJavaElement.PACKAGE_FRAGMENT_ROOT);
}
/**
* Returns the first openable parent. If the given element is openable, the element
* itself is returned.
*/
public static IOpenable getOpenable(IJavaElement element) {
while (element != null && !(element instanceof IOpenable)) {
element= element.getParent();
}
return (IOpenable) element;
}
/**
* Returns the parent of the supplied java element that conforms to the given
* parent type or <code>null</code>, if such a parent doesn't exit.
*/
public static IJavaElement findParentOfKind(IJavaElement element, int kind) {
if (element == null)
return null; |
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | return findElementOfKind(element.getParent(), kind);
}
/**
* Returns the first java element that conforms to the given type walking the
* java element's parent relationship. If the given element alrady conforms to
* the given kind, the element is returned.
* Returns <code>null</code> if no such element exits.
*/
public static IJavaElement findElementOfKind(IJavaElement element, int kind) {
while (element != null && element.getElementType() != kind)
element= element.getParent();
return element;
}
/**
* Finds a method in a type.
* This searches for a method with the same name and signature. Parameter types are only
* compared by the simple name, no resolving for the fully qualified type name is done.
* Constructors are only compared by parameters, not the name.
* @param name The name of the method to find
* @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
* @param isConstructor If the method is a constructor
* @return The first found method or <code>null</code>, if nothing found
*/
public static IMethod findMethod(String name, String[] paramTypes, boolean isConstructor, IType type) throws JavaModelException {
return findMethod(name, paramTypes, isConstructor, type.getMethods());
}
/**
* Finds a method by name.
* This searches for a method with a name and signature. Parameter types are only |
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | * compared by the simple name, no resolving for the fully qualified type name is done.
* Constructors are only compared by parameters, not the name.
* @param name The name of the method to find
* @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
* @param isConstructor If the method is a constructor
* @param methods The methods to search in
* @return The found method or <code>null</code>, if nothing found
*/
public static IMethod findMethod(String name, String[] paramTypes, boolean isConstructor, IMethod[] methods) throws JavaModelException {
for (int i= methods.length - 1; i >= 0; i--) {
if (isSameMethodSignature(name, paramTypes, isConstructor, methods[i])) {
return methods[i];
}
}
return null;
}
/**
* Finds a method declararion in a type's hierarchy. The search is top down, so this
* returns the first declaration of the method in the hierarchy.
* This searches for a method with a name and signature. Parameter types are only
* compared by the simple name, no resolving for the fully qualified type name is done.
* Constructors are only compared by parameters, not the name.
* @param name The name of the method to find
* @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
* @param isConstructor If the method is a constructor
* @return The first method found or null, if nothing found
*/
public static IMethod findMethodDeclarationInHierarchy(ITypeHierarchy hierarchy, String name, String[] paramTypes, boolean isConstructor) throws JavaModelException {
IType[] superTypes= hierarchy.getAllSupertypes(hierarchy.getType()); |
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | for (int i= superTypes.length - 1; i >= 0; i--) {
IMethod found= findMethod(name, paramTypes, isConstructor, superTypes[i]);
if (found != null) {
return found;
}
}
return null;
}
/**
* Finds a method implementation in a type's hierarchy. The search is bottom-up, so this
* returns the overwritten method.
* This searches for a method with a name and signature. Parameter types are only
* compared by the simple name, no resolving for the fully qualified type name is done.
* Constructors are only compared by parameters, not the name.
* @param name The name of the method to find
* @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
* @param isConstructor If the method is a constructor
* @return The first method found or null, if nothing found
*/
public static IMethod findMethodImplementationInHierarchy(ITypeHierarchy hierarchy, String name, String[] paramTypes, boolean isConstructor) throws JavaModelException {
IType[] superTypes= hierarchy.getAllSupertypes(hierarchy.getType());
for (int i= 0; i < superTypes.length; i++) {
IMethod found= findMethod(name, paramTypes, isConstructor, superTypes[i]);
if (found != null) {
return found;
}
}
return null;
} |
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | /**
* Tests if a method equals to the given signature.
* Parameter types are only compared by the simple name, no resolving for
* the fully qualified type name is done. Constructors are only compared by
* parameters, not the name.
* @param Name of the method
* @param The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
* @param Specifies if the method is a constructor
* @return Returns <code>true</code> if the method has the given name and parameter types and constructor state.
*/
public static boolean isSameMethodSignature(String name, String[] paramTypes, boolean isConstructor, IMethod curr) throws JavaModelException {
if (isConstructor || name.equals(curr.getElementName())) {
if (isConstructor == curr.isConstructor()) {
String[] currParamTypes= curr.getParameterTypes();
if (paramTypes.length == currParamTypes.length) {
for (int i= 0; i < paramTypes.length; i++) {
String t1= Signature.getSimpleName(Signature.toString(paramTypes[i]));
String t2= Signature.getSimpleName(Signature.toString(currParamTypes[i]));
if (!t1.equals(t2)) {
return false;
}
}
return true;
}
}
}
return false;
} |
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | /**
* Checks whether the given type has a valid main method or not.
*/
public static boolean hasMainMethod(IType type) throws JavaModelException {
String[] paramSignature= { Signature.createArraySignature(Signature.createTypeSignature("String", false), 1) };
IMethod method= findMethod("main", paramSignature, false, type);
if (method != null) {
int flags= method.getFlags();
return Flags.isStatic(flags) && Flags.isPublic(flags) && Signature.SIG_VOID.equals(method.getReturnType());
}
return false;
}
/**
* Tests if a method is a main method. Does not resolve the parameter types.
* Method must exist.
*/
public static boolean isMainMethod(IMethod method) throws JavaModelException {
if ("main".equals(method.getElementName()) && Signature.SIG_VOID.equals(method.getReturnType())) {
int flags= method.getFlags();
if (Flags.isStatic(flags) && Flags.isPublic(flags)) {
String[] paramTypes= method.getParameterTypes();
if (paramTypes.length == 1) {
String name= Signature.toString(paramTypes[0]);
return "String[]".equals(Signature.getSimpleName(name));
}
}
}
return false;
} |
6,051 | Bug 6051 IllegalArgumentException in Initializer constructor | Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException | resolved fixed | 4029c4d | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-19T18:14:44Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | /**
* Resolves a type name in the context of the declaring type.
* @param refTypeSig the type name in signature notation (for example 'QVector')
* this can also be an array type, but dimensions will be ignored.
* @param declaringType the context for resolving (type where the reference was made in)
* @return returns the fully qualified type name or build-in-type name.
* if a unresoved type couldn't be resolved null is returned
*/
public static String getResolvedTypeName(String refTypeSig, IType declaringType) throws JavaModelException {
int arrayCount= Signature.getArrayCount(refTypeSig);
char type= refTypeSig.charAt(arrayCount);
if (type == Signature.C_UNRESOLVED) {
int semi= refTypeSig.indexOf(Signature.C_SEMICOLON, arrayCount + 1);
if (semi == -1) {
throw new IllegalArgumentException();
}
String name= refTypeSig.substring(arrayCount + 1, semi);
String[][] resolvedNames= declaringType.resolveType(name);
if (resolvedNames != null && resolvedNames.length > 0) {
return JavaModelUtil.concatenateName(resolvedNames[0][0], resolvedNames[0][1]);
}
return null;
} else {
return Signature.toString(refTypeSig.substring(arrayCount));
}
}
} |
6,050 | Bug 6050 Avoid references to preference pages | Preference pages are optional. It should be possible to add and remove them from the code without further impact on the system. I.e. preference pages should not be used as accessors to preference settings. (See JavaCompletionProcessor) | resolved fixed | a28ec98 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T11:02:04Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/WorkInProgressPreferencePage.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.preferences;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.help.DialogPageContextComputer;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaUIMessages;
/*
* The page for setting 'work in progress' features preferences.
*/
public class WorkInProgressPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
private static final String CODE_ASSIST_EXPERIMENTAL= "org.eclipse.jdt.ui.text.codeassist.experimental";
public WorkInProgressPreferencePage() {
super(GRID);
setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore());
setDescription(JavaUIMessages.getString("WorkInProgressPreferencePage.description"));
}
public static void initDefaults(IPreferenceStore store) { |
6,050 | Bug 6050 Avoid references to preference pages | Preference pages are optional. It should be possible to add and remove them from the code without further impact on the system. I.e. preference pages should not be used as accessors to preference settings. (See JavaCompletionProcessor) | resolved fixed | a28ec98 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T11:02:04Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/WorkInProgressPreferencePage.java | store.setDefault(CODE_ASSIST_EXPERIMENTAL, false);
}
/**
* @see PreferencePage#createControl(Composite)
*/
public void createControl(Composite parent) {
super.createControl(parent);
WorkbenchHelp.setHelp(getControl(), new DialogPageContextComputer(this, IJavaHelpContextIds.WORK_IN_PROGRESS_PREFERENCE_PAGE));
}
protected void createFieldEditors() {
Composite parent= getFieldEditorParent();
BooleanFieldEditor boolEditor= new BooleanFieldEditor(
CODE_ASSIST_EXPERIMENTAL,
JavaUIMessages.getString("WorkInProgressPreferencePage.codeassist.experimental"),
parent
);
addField(boolEditor);
}
public void init(IWorkbench workbench) {
}
public static boolean fillArgumentsOnMethodCompletion() {
IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
return store.getBoolean(CODE_ASSIST_EXPERIMENTAL);
}
} |
6,050 | Bug 6050 Avoid references to preference pages | Preference pages are optional. It should be possible to add and remove them from the code without further impact on the system. I.e. preference pages should not be used as accessors to preference settings. (See JavaCompletionProcessor) | resolved fixed | a28ec98 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T11:02:04Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaCompletionProcessor.java | package org.eclipse.jdt.internal.ui.text.java;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
import org.eclipse.ui.IEditorPart;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Hashtable;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.IWorkingCopyManager;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.preferences.WorkInProgressPreferencePage;
import org.eclipse.jdt.internal.ui.text.template.TemplateContext;
import org.eclipse.jdt.internal.ui.text.template.TemplateEngine;
/**
* Java completion processor.
*/
public class JavaCompletionProcessor implements IContentAssistProcessor { |
6,050 | Bug 6050 Avoid references to preference pages | Preference pages are optional. It should be possible to add and remove them from the code without further impact on the system. I.e. preference pages should not be used as accessors to preference settings. (See JavaCompletionProcessor) | resolved fixed | a28ec98 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T11:02:04Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaCompletionProcessor.java | private static class CompletionProposalComparator implements Comparator {
public int compare(Object o1, Object o2) {
ICompletionProposal c1= (ICompletionProposal) o1;
ICompletionProposal c2= (ICompletionProposal) o2;
return c1.getDisplayString().compareTo(c2.getDisplayString()); |
6,050 | Bug 6050 Avoid references to preference pages | Preference pages are optional. It should be possible to add and remove them from the code without further impact on the system. I.e. preference pages should not be used as accessors to preference settings. (See JavaCompletionProcessor) | resolved fixed | a28ec98 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T11:02:04Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaCompletionProcessor.java | }
};
private final static String VISIBILITY= "org.eclipse.jdt.core.codeComplete.visibilityCheck";
private final static String ENABLED= "enabled";
private final static String DISABLED= "disabled";
private IEditorPart fEditor;
private ResultCollector fCollector;
private IWorkingCopyManager fManager;
private IContextInformationValidator fValidator;
private char[] fProposalAutoActivationSet;
private Comparator fComparator;
private TemplateEngine fTemplateEngine;
private ExperimentalResultCollector fExperimentalCollector;
public JavaCompletionProcessor(IEditorPart editor) {
fEditor= editor;
fCollector= new ResultCollector();
fManager= JavaPlugin.getDefault().getWorkingCopyManager();
fTemplateEngine= new TemplateEngine(TemplateContext.JAVA);
fExperimentalCollector= new ExperimentalResultCollector();
}
/**
* Sets this processor's set of characters triggering the activation of the |
6,050 | Bug 6050 Avoid references to preference pages | Preference pages are optional. It should be possible to add and remove them from the code without further impact on the system. I.e. preference pages should not be used as accessors to preference settings. (See JavaCompletionProcessor) | resolved fixed | a28ec98 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T11:02:04Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaCompletionProcessor.java | * completion proposal computation.
*
* @param activationSet the activation set
*/
public void setCompletionProposalAutoActivationCharacters(char[] activationSet) {
fProposalAutoActivationSet= activationSet;
}
/**
* Tells this processor to restrict its proposal to those element
* visible in the actual invocation context.
*
* @param restrict <code>true</code> if proposals should be restricted
*/
public void restrictProposalsToVisibility(boolean restrict) {
Hashtable options= JavaCore.getOptions();
Object value= options.get(VISIBILITY);
if (value instanceof String) {
String newValue= restrict ? ENABLED : DISABLED;
if ( !newValue.equals((String) value)) {
options.put(VISIBILITY, newValue);
JavaCore.setOptions(options);
}
}
}
/**
* Tells this processor to order the proposals alphabetically.
*
* @param order <code>true</code> if proposals should be ordered. |
6,050 | Bug 6050 Avoid references to preference pages | Preference pages are optional. It should be possible to add and remove them from the code without further impact on the system. I.e. preference pages should not be used as accessors to preference settings. (See JavaCompletionProcessor) | resolved fixed | a28ec98 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T11:02:04Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaCompletionProcessor.java | */
public void orderProposalsAlphabetically(boolean order) {
fComparator= order ? new CompletionProposalComparator() : null;
}
/**
* Tells this processor to restrict is proposals to those
* starting with matching cases.
*
* @param restrict <code>true</code> if proposals should be restricted
*/
public void restrictProposalsToMatchingCases(boolean restrict) {
}
/**
* @see IContentAssistProcessor#getErrorMessage()
*/
public String getErrorMessage() {
return fCollector.getErrorMessage();
}
/**
* @see IContentAssistProcessor#getContextInformationValidator()
*/
public IContextInformationValidator getContextInformationValidator() {
if (fValidator == null)
fValidator= new JavaParameterListValidator();
return fValidator;
}
/** |
6,050 | Bug 6050 Avoid references to preference pages | Preference pages are optional. It should be possible to add and remove them from the code without further impact on the system. I.e. preference pages should not be used as accessors to preference settings. (See JavaCompletionProcessor) | resolved fixed | a28ec98 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T11:02:04Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaCompletionProcessor.java | * @see IContentAssistProcessor#getContextInformationAutoActivationCharacters()
*/
public char[] getContextInformationAutoActivationCharacters() {
return null;
}
/**
* @see IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
*/
public char[] getCompletionProposalAutoActivationCharacters() {
return fProposalAutoActivationSet;
}
/**
* @see IContentAssistProcessor#computeContextInformation(ITextViewer, int)
*/
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
return null;
}
/**
* @see IContentAssistProcessor#computeCompletionProposals(ITextViewer, int)
*/
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
ICompilationUnit unit= fManager.getWorkingCopy(fEditor.getEditorInput());
IDocument document= viewer.getDocument();
ICompletionProposal[] results;
if (WorkInProgressPreferencePage.fillArgumentsOnMethodCompletion()) {
try {
if (unit != null) { |
6,050 | Bug 6050 Avoid references to preference pages | Preference pages are optional. It should be possible to add and remove them from the code without further impact on the system. I.e. preference pages should not be used as accessors to preference settings. (See JavaCompletionProcessor) | resolved fixed | a28ec98 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T11:02:04Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaCompletionProcessor.java | fExperimentalCollector.reset(viewer, offset, unit.getJavaProject(), unit);
Point selection= viewer.getSelectedRange();
if (selection.y > 0)
fExperimentalCollector.setReplacementLength(selection.y);
unit.codeComplete(offset, fExperimentalCollector);
}
} catch (JavaModelException x) {
Shell shell= viewer.getTextWidget().getShell();
ErrorDialog.openError(shell, JavaTextMessages.getString("CompletionProcessor.error.accessing.title"), JavaTextMessages.getString("CompletionProcessor.error.accessing.message"), x.getStatus());
}
results= fExperimentalCollector.getResults();
} else {
try {
if (unit != null) {
fCollector.reset(offset, unit.getJavaProject(), unit);
Point selection= viewer.getSelectedRange();
if (selection.y > 0)
fCollector.setReplacementLength(selection.y);
unit.codeComplete(offset, fCollector);
}
} catch (JavaModelException x) {
Shell shell= viewer.getTextWidget().getShell();
ErrorDialog.openError(shell, JavaTextMessages.getString("CompletionProcessor.error.accessing.title"), JavaTextMessages.getString("CompletionProcessor.error.accessing.message"), x.getStatus());
}
results= fCollector.getResults();
} |
6,050 | Bug 6050 Avoid references to preference pages | Preference pages are optional. It should be possible to add and remove them from the code without further impact on the system. I.e. preference pages should not be used as accessors to preference settings. (See JavaCompletionProcessor) | resolved fixed | a28ec98 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T11:02:04Z" | "2001-11-19T11:40:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaCompletionProcessor.java | try {
fTemplateEngine.reset();
fTemplateEngine.complete(viewer, offset, unit);
} catch (JavaModelException x) {
Shell shell= viewer.getTextWidget().getShell();
ErrorDialog.openError(shell, JavaTextMessages.getString("CompletionProcessor.error.accessing.title"), JavaTextMessages.getString("CompletionProcessor.error.accessing.message"), x.getStatus());
}
ICompletionProposal[] templateResults= fTemplateEngine.getResults();
ICompletionProposal[] total= new ICompletionProposal[results.length + templateResults.length];
System.arraycopy(templateResults, 0, total, 0, templateResults.length);
System.arraycopy(results, 0, total, templateResults.length, results.length);
/*
* Order here and not in result collector to make sure that the order
* applies to all proposals and not just those of the compilation unit.
*/
return order(total);
}
/**
* Order the given proposals.
*/
private ICompletionProposal[] order(ICompletionProposal[] proposals) {
if (fComparator != null)
Arrays.sort(proposals, fComparator);
return proposals;
}
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AbstractOpenWizardAction.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.actions;
import java.util.Iterator;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.IWorkbenchWizard;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaUIMessages;
public abstract class AbstractOpenWizardAction extends Action implements IWorkbenchWindowActionDelegate { |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AbstractOpenWizardAction.java | private Class[] fActivatedOnTypes;
private boolean fAcceptEmptySelection;
private boolean fNoChecking;
/**
* Creates a AbstractOpenWizardAction.
* @param label The label of the action
* @param acceptEmptySelection Specifies if the action allows an empty selection
*/
public AbstractOpenWizardAction(String label, boolean acceptEmptySelection) {
this(label, null, acceptEmptySelection);
}
/**
* Creates a AbstractOpenWizardAction.
* @param label The label of the action
* @param activatedOnTypes The action is only enabled when all objects in the selection
* are of the given types. <code>null</code> will allow all types.
* @param acceptEmptySelection Specifies if the action allows an empty selection |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AbstractOpenWizardAction.java | */
public AbstractOpenWizardAction(String label, Class[] activatedOnTypes, boolean acceptEmptySelection) {
super(label);
fActivatedOnTypes= activatedOnTypes;
fAcceptEmptySelection= acceptEmptySelection;
}
/**
* Creates a AbstractOpenWizardAction with no restrictions on types, and does allow
* an empty selection.
*/
protected AbstractOpenWizardAction() {
fActivatedOnTypes= null;
fAcceptEmptySelection= true;
fNoChecking= true;
}
protected IWorkbench getWorkbench() {
return JavaPlugin.getDefault().getWorkbench();
}
private boolean isOfAcceptedType(Object obj) {
if (fActivatedOnTypes != null) {
for (int i= 0; i < fActivatedOnTypes.length; i++) {
if (fActivatedOnTypes[i].isInstance(obj)) {
return true;
}
}
return false;
}
return true; |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AbstractOpenWizardAction.java | }
private boolean isEnabled(IStructuredSelection selection) {
Iterator iter= selection.iterator();
while (iter.hasNext()) {
Object obj= iter.next();
if (!isOfAcceptedType(obj) || !shouldAcceptElement(obj)) {
return false;
}
}
return true;
}
/**
* Can be overridden to add more checks.
* obj is guaranteed to be instance of one of the accepted types
*/
protected boolean shouldAcceptElement(Object obj) {
return true;
}
/**
* Creates the specific wizard.
* (to be implemented by a subclass)
*/
abstract protected Wizard createWizard();
protected IStructuredSelection getCurrentSelection() {
IWorkbenchWindow window= JavaPlugin.getActiveWorkbenchWindow();
if (window != null) { |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AbstractOpenWizardAction.java | ISelection selection= window.getSelectionService().getSelection();
if (selection instanceof IStructuredSelection) {
return (IStructuredSelection) selection;
}
}
return null;
}
/**
* The user has invoked this action.
*/
public void run() {
if (!fNoChecking && !canActionBeAdded()) {
return;
}
Wizard wizard= createWizard();
if (wizard instanceof IWorkbenchWizard) {
((IWorkbenchWizard)wizard).init(getWorkbench(), getCurrentSelection());
}
WizardDialog dialog= new WizardDialog(JavaPlugin.getActiveWorkbenchShell(), wizard);
dialog.create();
dialog.getShell().setText(JavaUIMessages.getString("AbstractOpenWizardAction.title"));
dialog.open();
}
/**
* Tests if the action can be run on the current selection.
*/
public boolean canActionBeAdded() { |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AbstractOpenWizardAction.java | IStructuredSelection selection= getCurrentSelection();
if (selection == null || selection.isEmpty()) {
return fAcceptEmptySelection;
}
return isEnabled(selection);
}
/*
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
run();
}
/*
* @see IWorkbenchWindowActionDelegate#dispose()
*/
public void dispose() {
}
/*
* @see IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
*/
public void init(IWorkbenchWindow window) {
}
/*
* @see IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
}
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/ContainerPage.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.wizards;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.JavaElementContentProvider; |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/ContainerPage.java | import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.jdt.internal.ui.dialogs.ISelectionValidator;
import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.jdt.internal.ui.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.viewsupport.JavaElementSorter;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
public abstract class ContainerPage extends NewElementWizardPage {
/**
* container field id
*/
protected static final String CONTAINER= "ContainerPage.container";
/**
* Status of last validation
*/
protected IStatus fContainerStatus;
private StringButtonDialogField fContainerDialogField;
/*
* package fragment root corresponding to the input type (can be null)
*/
private IPackageFragmentRoot fCurrRoot;
private IWorkspaceRoot fWorkspaceRoot; |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/ContainerPage.java | public ContainerPage(String name, IWorkspaceRoot root) {
super(name);
fWorkspaceRoot= root;
ContainerFieldAdapter adapter= new ContainerFieldAdapter();
fContainerDialogField= new StringButtonDialogField(adapter);
fContainerDialogField.setDialogFieldListener(adapter);
fContainerDialogField.setLabelText(NewWizardMessages.getString("ContainerPage.container.label"));
fContainerDialogField.setButtonLabel(NewWizardMessages.getString("ContainerPage.container.button"));
fContainerStatus= new StatusInfo();
fCurrRoot= null;
}
/**
* Initializes the fields provided by the container page with a given
* Java element as selection.
* @param elem The initial selection of this page or null if no
* selection was available
*/
protected void initContainerPage(IJavaElement elem) {
IPackageFragmentRoot initRoot= null;
if (elem != null) {
initRoot= JavaModelUtil.getPackageFragmentRoot(elem);
if (initRoot == null || initRoot.isArchive()) {
IJavaProject jproject= elem.getJavaProject();
try {
initRoot= null;
IPackageFragmentRoot[] roots= jproject.getPackageFragmentRoots();
for (int i= 0; i < roots.length; i++) { |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/ContainerPage.java | if (roots[i].getKind() == IPackageFragmentRoot.K_SOURCE) {
initRoot= roots[i];
break;
}
}
} catch (JavaModelException e) {
JavaPlugin.log(e.getStatus());
}
if (initRoot == null) {
initRoot= jproject.getPackageFragmentRoot("");
}
}
}
setPackageFragmentRoot(initRoot, true);
}
/**
* Creates the controls for the container field.
* @param parent The parent composite
* @param nColumns The number of columns to span
*/
protected void createContainerControls(Composite parent, int nColumns) {
fContainerDialogField.doFillIntoGrid(parent, nColumns);
}
protected void setFocusOnContainer() {
fContainerDialogField.setFocus();
}
private class ContainerFieldAdapter implements IStringButtonAdapter, IDialogFieldListener { |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/ContainerPage.java | public void changeControlPressed(DialogField field) {
containerChangeControlPressed(field);
}
public void dialogFieldChanged(DialogField field) {
containerDialogFieldChanged(field);
}
}
private void containerChangeControlPressed(DialogField field) {
IPackageFragmentRoot root= getPackageFragmentRoot();
root= chooseSourceContainer(root);
if (root != null) {
setPackageFragmentRoot(root, true);
}
}
private void containerDialogFieldChanged(DialogField field) {
if (field == fContainerDialogField) {
fContainerStatus= containerChanged(); |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/ContainerPage.java | }
handleFieldChanged(CONTAINER);
}
/**
* Called after the container field has changed.
* Updates the model and returns the status.
* Model is only valid if returned status is OK
*/
protected IStatus containerChanged() {
StatusInfo status= new StatusInfo();
fCurrRoot= null;
String str= getContainerText();
if ("".equals(str)) {
status.setError(NewWizardMessages.getString("ContainerPage.error.EnterContainerName"));
return status;
}
IPath path= new Path(str);
IResource res= fWorkspaceRoot.findMember(path);
if (res != null) {
int resType= res.getType();
if (resType == IResource.PROJECT || resType == IResource.FOLDER) {
IProject proj= res.getProject();
if (!proj.isOpen()) {
status.setError(NewWizardMessages.getFormattedString("ContainerPage.error.ProjectClosed", proj.getFullPath().toString()));
return status; |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/ContainerPage.java | }
IJavaProject jproject= JavaCore.create(proj);
fCurrRoot= jproject.getPackageFragmentRoot(res);
if (fCurrRoot.exists()) {
try {
if (!proj.hasNature(JavaCore.NATURE_ID)) {
if (resType == IResource.PROJECT) {
status.setWarning(NewWizardMessages.getString("ContainerPage.warning.NotAJavaProject"));
} else {
status.setWarning(NewWizardMessages.getString("ContainerPage.warning.NotInAJavaProject"));
}
return status;
}
} catch (CoreException e) {
status.setWarning(NewWizardMessages.getString("ContainerPage.warning.NotAJavaProject"));
}
try {
if (!JavaModelUtil.isOnBuildPath(jproject, fCurrRoot)) {
status.setWarning(NewWizardMessages.getFormattedString("ContainerPage.warning.NotOnClassPath", str));
}
} catch (JavaModelException e) {
status.setWarning(NewWizardMessages.getFormattedString("ContainerPage.warning.NotOnClassPath", str));
}
if (fCurrRoot.isArchive()) {
status.setError(NewWizardMessages.getFormattedString("ContainerPage.error.ContainerIsBinary", str));
return status;
}
}
return status;
} else { |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/ContainerPage.java | status.setError(NewWizardMessages.getFormattedString("ContainerPage.error.NotAFolder", str));
return status;
}
} else {
status.setError(NewWizardMessages.getFormattedString("ContainerPage.error.ContainerDoesNotExist", str));
return status;
}
}
/**
* Called when a field on a page changed. Every sub type is responsible to
* call this method when a field on its page has changed.
* Subtypes override (extend) the method to add verification when own field has a
* dependency to an other field. (for example the class name input must be verified
* again, when the package field changes (check for duplicated class names))
* @param fieldName The name of the field that has changed (field id)
*/
protected void handleFieldChanged(String fieldName) {
}
/**
* Returns the workspace root.
*/
public IWorkspaceRoot getWorkspaceRoot() {
return fWorkspaceRoot; |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/ContainerPage.java | }
/**
* Returns the PackageFragmentRoot corresponding to the current input.
* @return the PackageFragmentRoot or <code>null</code> if the current
* input is not a valid source folder
*/
public IPackageFragmentRoot getPackageFragmentRoot() {
return fCurrRoot;
}
/**
* Returns the text of the container field.
*/
public String getContainerText() {
return fContainerDialogField.getText();
}
/**
* Sets the current PackageFragmentRoot (model and text field).
* @param canBeModified Selects if the container field can be changed by the user
*/
public void setPackageFragmentRoot(IPackageFragmentRoot root, boolean canBeModified) {
fCurrRoot= root;
String str= (root == null) ? "" : root.getPath().makeRelative().toString();
fContainerDialogField.setText(str);
fContainerDialogField.setEnabled(canBeModified);
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/ContainerPage.java | private IPackageFragmentRoot chooseSourceContainer(IJavaElement initElement) {
Class[] acceptedClasses= new Class[] { IPackageFragmentRoot.class, IJavaProject.class };
ISelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, false) {
public boolean isSelectedValid(Object element) {
try {
if (element instanceof IJavaProject) {
IJavaProject jproject= (IJavaProject)element;
IPath path= jproject.getProject().getFullPath();
return (jproject.findPackageFragmentRoot(path) != null);
} else if (element instanceof IPackageFragmentRoot) {
return (((IPackageFragmentRoot)element).getKind() == IPackageFragmentRoot.K_SOURCE);
}
return true;
} catch (JavaModelException e) {
JavaPlugin.log(e.getStatus());
}
return false;
}
};
acceptedClasses= new Class[] { IJavaModel.class, IPackageFragmentRoot.class, IJavaProject.class };
ViewerFilter filter= new TypedViewerFilter(acceptedClasses) {
public boolean select(Viewer viewer, Object parent, Object element) {
if (element instanceof IPackageFragmentRoot) {
try {
return (((IPackageFragmentRoot)element).getKind() == IPackageFragmentRoot.K_SOURCE);
} catch (JavaModelException e) {
JavaPlugin.log(e.getStatus());
return false; |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/ContainerPage.java | }
}
return super.select(viewer, parent, element);
}
};
JavaElementContentProvider provider= new JavaElementContentProvider();
ILabelProvider labelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), labelProvider, provider);
dialog.setValidator(validator);
dialog.setSorter(new JavaElementSorter());
dialog.setTitle(NewWizardMessages.getString("ContainerPage.ChooseSourceContainerDialog.title"));
dialog.setMessage(NewWizardMessages.getString("ContainerPage.ChooseSourceContainerDialog.description"));
dialog.addFilter(filter);
dialog.setInput(JavaCore.create(fWorkspaceRoot));
dialog.setInitialSelection(initElement);
if (dialog.open() == dialog.OK) {
Object element= dialog.getFirstResult();
if (element instanceof IJavaProject) {
IJavaProject jproject= (IJavaProject)element;
return jproject.getPackageFragmentRoot(jproject.getProject());
} else if (element instanceof IPackageFragmentRoot) {
return (IPackageFragmentRoot)element;
}
return null;
}
return null;
}
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewClassCreationWizardPage.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.wizards;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.help.DialogPageContextComputer;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.codemanipulation.IImportsStructure;
import org.eclipse.jdt.internal.ui.dialogs.StatusUtil;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.util.SWTUtil;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil; |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewClassCreationWizardPage.java | import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogFieldGroup;
import org.eclipse.jdt.internal.ui.wizards.swt.MGridLayout;
public class NewClassCreationWizardPage extends TypePage {
private final static String PAGE_NAME= "NewClassCreationWizardPage";
private SelectionButtonDialogFieldGroup fMethodStubsButtons;
public NewClassCreationWizardPage(IWorkspaceRoot root) {
super(true, PAGE_NAME, root);
setTitle(NewWizardMessages.getString("NewClassCreationWizardPage.title"));
setDescription(NewWizardMessages.getString("NewClassCreationWizardPage.description"));
String[] buttonNames3= new String[] {
NewWizardMessages.getString("NewClassCreationWizardPage.methods.main"), NewWizardMessages.getString("NewClassCreationWizardPage.methods.constructors"),
NewWizardMessages.getString("NewClassCreationWizardPage.methods.inherited")
};
fMethodStubsButtons= new SelectionButtonDialogFieldGroup(SWT.CHECK, buttonNames3, 1);
fMethodStubsButtons.setLabelText(NewWizardMessages.getString("NewClassCreationWizardPage.methods.label"));
}
/**
* Should be called from the wizard with the input element.
*/
public void init(IStructuredSelection selection) {
IJavaElement jelem= null;
if (selection != null && !selection.isEmpty()) {
Object selectedElement= selection.getFirstElement(); |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewClassCreationWizardPage.java | if (selectedElement instanceof IAdaptable) {
IAdaptable adaptable= (IAdaptable) selectedElement;
jelem= (IJavaElement) adaptable.getAdapter(IJavaElement.class);
if (jelem == null) {
IResource resource= (IResource) adaptable.getAdapter(IResource.class);
if (resource != null) {
IProject proj= resource.getProject();
if (proj != null) {
jelem= JavaCore.create(proj);
}
}
}
}
}
if (jelem == null) {
jelem= EditorUtility.getActiveEditorJavaInput();
}
initContainerPage(jelem);
initTypePage(jelem);
updateStatus(findMostSevereStatus());
}
/**
* Finds the most severe error (if there is one)
*/
private IStatus findMostSevereStatus() {
return StatusUtil.getMostSevere(new IStatus[] { |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewClassCreationWizardPage.java | fContainerStatus,
isEnclosingTypeSelected() ? fEnclosingTypeStatus : fPackageStatus,
fTypeNameStatus,
fModifierStatus,
fSuperClassStatus,
fSuperInterfacesStatus
});
}
/*
* @see ContainerPage#handleFieldChanged
*/
protected void handleFieldChanged(String fieldName) {
super.handleFieldChanged(fieldName);
updateStatus(findMostSevereStatus());
}
/*
* @see WizardPage#createControl
*/
public void createControl(Composite parent) {
Composite composite= new Composite(parent, SWT.NONE);
int nColumns= 4;
MGridLayout layout= new MGridLayout(); |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewClassCreationWizardPage.java | layout.minimumWidth= SWTUtil.convertWidthInCharsToPixels(80, composite);
layout.numColumns= nColumns;
composite.setLayout(layout);
createContainerControls(composite, nColumns);
createPackageControls(composite, nColumns);
createEnclosingTypeControls(composite, nColumns);
createSeparator(composite, nColumns);
createTypeNameControls(composite, nColumns);
createModifierControls(composite, nColumns);
createSuperClassControls(composite, nColumns);
createSuperInterfacesControls(composite, nColumns);
createMethodStubSelectionControls(composite, nColumns);
setControl(composite);
setFocus();
WorkbenchHelp.setHelp(composite, new DialogPageContextComputer(this, IJavaHelpContextIds.NEW_CLASS_WIZARD_PAGE));
}
protected void createMethodStubSelectionControls(Composite composite, int nColumns) {
LayoutUtil.setHorizontalSpan(fMethodStubsButtons.getLabelControl(composite), nColumns);
DialogField.createEmptySpace(composite); |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewClassCreationWizardPage.java | LayoutUtil.setHorizontalSpan(fMethodStubsButtons.getSelectionButtonsGroup(composite), nColumns - 1);
}
/*
* @see TypePage#evalMethods
*/
protected String[] evalMethods(IType type, IImportsStructure imports, IProgressMonitor monitor) throws CoreException {
List newMethods= new ArrayList();
boolean doConstr= fMethodStubsButtons.isSelected(1);
boolean doInherited= fMethodStubsButtons.isSelected(2);
String[] meth= constructInheritedMethods(type, doConstr, doInherited, imports, new SubProgressMonitor(monitor, 1));
for (int i= 0; i < meth.length; i++) {
newMethods.add(meth[i]);
}
if (monitor != null) {
monitor.done();
}
if (fMethodStubsButtons.isSelected(0)) {
String main= "public static void main(String[] args) {}";
newMethods.add(main);
}
return (String[]) newMethods.toArray(new String[newMethods.size()]);
}
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewGroup.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.wizards;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.actions.NewWizardAction;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.IContextMenuConstants;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.internal.ui.actions.AbstractOpenWizardAction;
import org.eclipse.jdt.internal.ui.actions.ContextMenuGroup;
import org.eclipse.jdt.internal.ui.actions.GroupContext;
import org.eclipse.jdt.internal.ui.util.JavaModelUtil;
public class NewGroup extends ContextMenuGroup { |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewGroup.java | private AbstractOpenWizardAction fNewProjectAction;
private AbstractOpenWizardAction fNewPackageAction;
private AbstractOpenWizardAction fNewClassAction;
private AbstractOpenWizardAction fNewInterfaceAction;
private AbstractOpenWizardAction fNewPackageRootAction;
private AbstractOpenWizardAction fNewSnippetAction;
private NewWizardAction fNewWizardAction;
private boolean fActionsCreated;
public static final String GROUP_NAME= IContextMenuConstants.GROUP_NEW;
public NewGroup() {
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewGroup.java | private void createActions() {
if (fActionsCreated)
return;
String label= NewWizardMessages.getString("NewGroup.wizards_add_package.label");
Class[] acceptedTypes= new Class[] { IJavaProject.class, IPackageFragmentRoot.class };
fNewPackageAction= new OpenPackageWizardAction(label, acceptedTypes);
fNewPackageAction.setImageDescriptor(JavaPluginImages.DESC_TOOL_NEWPACKAGE);
fNewPackageAction.setToolTipText(NewWizardMessages.getString("NewGroup.wizards_add_package.tooltip"));
fNewPackageAction.setDescription(NewWizardMessages.getString("NewGroup.wizards_add_package.description"));
label= NewWizardMessages.getString("NewGroup.wizards_add_class.label");
acceptedTypes= new Class[] { IJavaProject.class, IPackageFragmentRoot.class,
IPackageFragment.class, ICompilationUnit.class, IClassFile.class };
fNewClassAction= new OpenClassWizardAction(label, acceptedTypes);
fNewClassAction.setImageDescriptor(JavaPluginImages.DESC_TOOL_NEWCLASS);
fNewClassAction.setToolTipText(NewWizardMessages.getString("NewGroup.wizards_add_class.tooltip"));
fNewClassAction.setDescription(NewWizardMessages.getString("NewGroup.wizards_add_class.description"));
label= NewWizardMessages.getString("NewGroup.wizards_add_interface.label");
fNewInterfaceAction= new OpenInterfaceWizardAction(label, acceptedTypes);
fNewInterfaceAction.setImageDescriptor(JavaPluginImages.DESC_TOOL_NEWINTERFACE);
fNewInterfaceAction.setToolTipText(NewWizardMessages.getString("NewGroup.wizards_add_interface.tooltip"));
fNewInterfaceAction.setDescription(NewWizardMessages.getString("NewGroup.wizards_add_interface.description"));
acceptedTypes= new Class[] { IJavaProject.class };
label= NewWizardMessages.getString("NewGroup.wizards_add_snippet.label");
fNewSnippetAction= new OpenSnippetWizardAction(label, acceptedTypes);
fNewSnippetAction.setImageDescriptor(JavaPluginImages.DESC_TOOL_NEWSNIPPET); |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewGroup.java | fNewSnippetAction.setToolTipText(NewWizardMessages.getString("NewGroup.wizards_add_snippet.tooltip"));
fNewSnippetAction.setDescription(NewWizardMessages.getString("NewGroup.wizards_add_snippet.description"));
label= NewWizardMessages.getString("NewGroup.wizards_add_packageroot.label");
acceptedTypes= new Class[] { IJavaProject.class };
fNewPackageRootAction=
new AbstractOpenWizardAction(label, acceptedTypes, false) {
protected Wizard createWizard() { return new NewSourceFolderCreationWizard(); }
protected boolean shouldAcceptElement(Object obj) { return !isOnBuildPath(obj); }
};
fNewPackageRootAction.setImageDescriptor(JavaPluginImages.DESC_TOOL_NEWPACKROOT);
fNewPackageRootAction.setToolTipText(NewWizardMessages.getString("NewGroup.wizards_add_packageroot.tooltip"));
fNewPackageRootAction.setDescription(NewWizardMessages.getString("NewGroup.wizards_add_packageroot.description"));
label= NewWizardMessages.getString("NewGroup.wizards_add_project.label");
acceptedTypes= new Class[] { IJavaModel.class };
fNewProjectAction= new OpenProjectWizardAction(label, acceptedTypes);
fNewProjectAction.setImageDescriptor(JavaPluginImages.DESC_TOOL_NEWPROJECT);
fNewProjectAction.setToolTipText(NewWizardMessages.getString("NewGroup.wizards_add_project.tooltip"));
fNewProjectAction.setDescription(NewWizardMessages.getString("NewGroup.wizards_add_project.description"));
fNewWizardAction= new NewWizardAction();
fActionsCreated= true;
}
static boolean isOnBuildPath(Object obj) {
try {
if (obj instanceof IJavaElement) {
IJavaElement elem= (IJavaElement)obj;
return JavaModelUtil.isOnBuildPath(elem.getJavaProject(), elem);
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewGroup.java | } catch (JavaModelException e) {
JavaPlugin.log(e.getStatus());
}
return false;
}
static boolean isInArchive(Object obj) {
if (obj instanceof IJavaElement) {
IPackageFragmentRoot root= JavaModelUtil.getPackageFragmentRoot((IJavaElement)obj);
return (root != null) && root.isArchive();
}
return false;
}
/**
* fill the context menu with new-wizard actions
*/
public void fill(IMenuManager menu, GroupContext context) {
createActions();
int i= 0;
MenuManager manager= new MenuManager(NewWizardMessages.getString("NewGroup.wizards_add"));
if (fNewProjectAction.canActionBeAdded()) {
manager.add(fNewProjectAction);
i++;
}
if (fNewPackageRootAction.canActionBeAdded()) {
manager.add(fNewPackageRootAction);
i++;
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewGroup.java | if (fNewPackageAction.canActionBeAdded()) {
manager.add(fNewPackageAction);
i++;
}
if (fNewClassAction.canActionBeAdded()) {
manager.add(fNewClassAction);
i++;
}
if (fNewInterfaceAction.canActionBeAdded()) {
manager.add(fNewInterfaceAction);
i++;
}
if (fNewSnippetAction.canActionBeAdded()) {
manager.add(fNewSnippetAction);
i++;
}
boolean added= i != 0;
if (added) {
manager.add(new Separator());
manager.add(fNewWizardAction);
}
else
manager.add(fNewWizardAction);
menu.appendToGroup(GROUP_NAME, manager);
}
public String getGroupName() {
return GROUP_NAME;
}
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewInterfaceCreationWizardPage.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.wizards;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.help.DialogPageContextComputer;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.dialogs.StatusUtil;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.util.SWTUtil;
import org.eclipse.jdt.internal.ui.wizards.swt.MGridLayout;
public class NewInterfaceCreationWizardPage extends TypePage { |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewInterfaceCreationWizardPage.java | private final static String PAGE_NAME= "NewInterfaceCreationWizardPage";
public NewInterfaceCreationWizardPage(IWorkspaceRoot root) {
super(false, PAGE_NAME, root);
setTitle(NewWizardMessages.getString("NewInterfaceCreationWizardPage.title"));
setDescription(NewWizardMessages.getString("NewInterfaceCreationWizardPage.description"));
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewInterfaceCreationWizardPage.java | /**
* Should be called from the wizard with the input element.
*/
public void init(IStructuredSelection selection) {
IJavaElement jelem= null;
if (selection != null && !selection.isEmpty()) {
Object selectedElement= selection.getFirstElement();
if (selectedElement instanceof IAdaptable) {
IAdaptable adaptable= (IAdaptable) selectedElement;
jelem= (IJavaElement) adaptable.getAdapter(IJavaElement.class);
if (jelem == null) {
IResource resource= (IResource) adaptable.getAdapter(IResource.class);
if (resource != null) {
IProject proj= resource.getProject();
if (proj != null) {
jelem= JavaCore.create(proj);
}
}
}
}
}
if (jelem == null) {
jelem= EditorUtility.getActiveEditorJavaInput();
}
initContainerPage(jelem);
initTypePage(jelem);
updateStatus(findMostSevereStatus());
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewInterfaceCreationWizardPage.java | /**
* Finds the most severe error (if there is one)
*/
private IStatus findMostSevereStatus() {
return StatusUtil.getMostSevere(new IStatus[] {
fContainerStatus,
isEnclosingTypeSelected() ? fEnclosingTypeStatus : fPackageStatus,
fTypeNameStatus,
fModifierStatus,
fSuperInterfacesStatus
});
}
/**
* @see ContainerPage#handleFieldChanged
*/
protected void handleFieldChanged(String fieldName) {
super.handleFieldChanged(fieldName);
updateStatus(findMostSevereStatus());
}
/**
* @see WizardPage#createControl |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewInterfaceCreationWizardPage.java | */
public void createControl(Composite parent) {
Composite composite= new Composite(parent, SWT.NONE);
int nColumns= 4;
MGridLayout layout= new MGridLayout();
layout.minimumWidth= SWTUtil.convertWidthInCharsToPixels(80, composite);
layout.numColumns= nColumns;
composite.setLayout(layout);
createContainerControls(composite, nColumns);
createPackageControls(composite, nColumns);
createEnclosingTypeControls(composite, nColumns);
createSeparator(composite, nColumns);
createTypeNameControls(composite, nColumns);
createModifierControls(composite, nColumns);
createSuperInterfacesControls(composite, nColumns);
setControl(composite);
setFocus();
WorkbenchHelp.setHelp(composite, new DialogPageContextComputer(this, IJavaHelpContextIds.NEW_INTERFACE_WIZARD_PAGE));
}
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewPackageCreationWizardPage.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.wizards;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot; |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewPackageCreationWizardPage.java | import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.help.DialogPageContextComputer;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.jdt.internal.ui.dialogs.StatusUtil;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.util.SWTUtil;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField;
import org.eclipse.jdt.internal.ui.wizards.swt.MGridLayout;
public class NewPackageCreationWizardPage extends ContainerPage {
private static final String PAGE_NAME= "NewPackageCreationWizardPage";
protected static final String PACKAGE= "NewPackageCreationWizardPage.package"; |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewPackageCreationWizardPage.java | private StringDialogField fPackageDialogField;
/**
* Status of last validation of the package field
*/
protected IStatus fPackageStatus;
private IPackageFragment fCreatedPackageFragment;
public NewPackageCreationWizardPage(IWorkspaceRoot root) {
super(PAGE_NAME, root);
setTitle(NewWizardMessages.getString("NewPackageCreationWizardPage.title"));
setDescription(NewWizardMessages.getString("NewPackageCreationWizardPage.description"));
fCreatedPackageFragment= null;
PackageFieldAdapter adapter= new PackageFieldAdapter();
fPackageDialogField= new StringDialogField();
fPackageDialogField.setDialogFieldListener(adapter);
fPackageDialogField.setLabelText(NewWizardMessages.getString("NewPackageCreationWizardPage.package.label"));
fPackageStatus= new StatusInfo();
}
/**
* Should be called from the wizard with the input element.
*/
public void init(IStructuredSelection selection) { |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewPackageCreationWizardPage.java | IJavaElement jelem= null;
if (selection != null && !selection.isEmpty()) {
Object selectedElement= selection.getFirstElement();
if (selectedElement instanceof IAdaptable) {
IAdaptable adaptable= (IAdaptable) selectedElement;
jelem= (IJavaElement) adaptable.getAdapter(IJavaElement.class);
if (jelem == null) {
IResource resource= (IResource) adaptable.getAdapter(IResource.class);
if (resource != null) {
IProject proj= resource.getProject();
if (proj != null) {
jelem= JavaCore.create(proj);
}
}
}
}
}
if (jelem == null) {
jelem= EditorUtility.getActiveEditorJavaInput();
}
initContainerPage(jelem);
setPackageText("");
updateStatus(findMostSevereStatus());
}
/** |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewPackageCreationWizardPage.java | * @see WizardPage#createControl
*/
public void createControl(Composite parent) {
Composite composite= new Composite(parent, SWT.NONE);
int nColumns= 3;
MGridLayout layout= new MGridLayout();
layout.marginWidth= 0;
layout.marginHeight= 0;
layout.minimumWidth= SWTUtil.convertWidthInCharsToPixels(80, composite);
layout.minimumHeight= SWTUtil.convertHeightInCharsToPixels(20, composite);
layout.numColumns= 3;
composite.setLayout(layout);
createContainerControls(composite, nColumns);
createPackageControls(composite, nColumns);
fPackageDialogField.setFocus();
setControl(composite);
WorkbenchHelp.setHelp(composite, new DialogPageContextComputer(this, IJavaHelpContextIds.NEW_PACKAGE_WIZARD_PAGE));
}
protected void createPackageControls(Composite composite, int nColumns) {
fPackageDialogField.doFillIntoGrid(composite, nColumns - 1);
DialogField.createEmptySpace(composite);
}
private class PackageFieldAdapter implements IDialogFieldListener { |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewPackageCreationWizardPage.java | public void dialogFieldChanged(DialogField field) {
fPackageStatus= packageChanged();
handleFieldChanged(PACKAGE);
}
}
/**
* Called when a dialog field on this page changed
* @see ContainerPage#fieldUpdated
*/
protected void handleFieldChanged(String fieldName) {
super.handleFieldChanged(fieldName);
if (fieldName == CONTAINER) {
fPackageStatus= packageChanged();
}
updateStatus(findMostSevereStatus());
}
/**
* Finds the most severe error (if there is one)
*/
protected IStatus findMostSevereStatus() { |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewPackageCreationWizardPage.java | return StatusUtil.getMoreSevere(fContainerStatus, fPackageStatus);
}
/**
* Verify the input for the package field
*/
private IStatus packageChanged() {
StatusInfo status= new StatusInfo();
String packName= fPackageDialogField.getText();
if (!"".equals(packName)) {
IStatus val= JavaConventions.validatePackageName(packName);
if (val.getSeverity() == IStatus.ERROR) {
status.setError(NewWizardMessages.getFormattedString("NewPackageCreationWizardPage.error.InvalidPackageName", val.getMessage()));
return status;
} else if (val.getSeverity() == IStatus.WARNING) {
status.setWarning(NewWizardMessages.getFormattedString("NewPackageCreationWizardPage.warning.DiscouragedPackageName", val.getMessage()));
}
} else {
status.setError(NewWizardMessages.getString("NewPackageCreationWizardPage.error.DefaultPackageExists"));
return status;
}
IPackageFragmentRoot root= getPackageFragmentRoot();
if (root != null) {
IPackageFragment pack= root.getPackageFragment(packName);
try {
IPath rootPath= root.getPath();
IPath outputPath= root.getJavaProject().getOutputLocation();
if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) { |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewPackageCreationWizardPage.java | IPath packagePath= pack.getUnderlyingResource().getFullPath();
if (outputPath.isPrefixOf(packagePath)) {
status.setError(NewWizardMessages.getString("NewPackageCreationWizardPage.error.IsOutputFolder"));
return status;
}
}
if (pack.exists()) {
if (pack.containsJavaResources() || !pack.hasSubpackages()) {
status.setError(NewWizardMessages.getString("NewPackageCreationWizardPage.error.PackageExists"));
} else {
status.setWarning(NewWizardMessages.getString("NewPackageCreationWizardPage.warning.PackageNotShown"));
}
}
} catch (JavaModelException e) {
JavaPlugin.log(e.getStatus());
}
}
return status;
}
protected String getPackageText() {
return fPackageDialogField.getText();
}
protected void setPackageText(String str) {
fPackageDialogField.setText(str);
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewPackageCreationWizardPage.java | /**
* @see NewElementWizardPage#getRunnable
*/
public IRunnableWithProgress getRunnable() {
return new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
createPackage(monitor);
} catch (JavaModelException e) {
throw new InvocationTargetException(e);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
};
}
public IPackageFragment getNewPackageFragment() {
return fCreatedPackageFragment;
}
protected void createPackage(IProgressMonitor monitor) throws JavaModelException, CoreException, InterruptedException {
IPackageFragmentRoot root= getPackageFragmentRoot();
String packName= getPackageText();
fCreatedPackageFragment= root.createPackageFragment(packName, true, monitor);
}
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/OpenClassWizardAction.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.wizards;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jdt.internal.ui.actions.AbstractOpenWizardAction;
public class OpenClassWizardAction extends AbstractOpenWizardAction {
public OpenClassWizardAction() {
}
public OpenClassWizardAction(String label, Class[] acceptedTypes) {
super(label, acceptedTypes, false);
}
protected Wizard createWizard() {
return new NewClassCreationWizard();
}
protected boolean shouldAcceptElement(Object obj) {
return NewGroup.isOnBuildPath(obj) && !NewGroup.isInArchive(obj);
}
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/OpenInterfaceWizardAction.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.wizards;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jdt.internal.ui.actions.AbstractOpenWizardAction;
public class OpenInterfaceWizardAction extends AbstractOpenWizardAction {
public OpenInterfaceWizardAction() {
}
public OpenInterfaceWizardAction(String label, Class[] acceptedTypes) {
super(label, acceptedTypes, false);
}
protected Wizard createWizard() {
return new NewInterfaceCreationWizard();
}
protected boolean shouldAcceptElement(Object obj) {
return NewGroup.isOnBuildPath(obj) && !NewGroup.isInArchive(obj);
}
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/OpenPackageWizardAction.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.wizards;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jdt.internal.ui.actions.AbstractOpenWizardAction;
public class OpenPackageWizardAction extends AbstractOpenWizardAction {
public OpenPackageWizardAction() {
}
public OpenPackageWizardAction(String label, Class[] acceptedTypes) {
super(label, acceptedTypes, false);
}
protected Wizard createWizard() {
return new NewPackageCreationWizard();
}
protected boolean shouldAcceptElement(Object obj) {
return NewGroup.isOnBuildPath(obj) && !NewGroup.isInArchive(obj);
}
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/OpenProjectWizardAction.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.wizards;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jdt.internal.ui.actions.AbstractOpenWizardAction;
public class OpenProjectWizardAction extends AbstractOpenWizardAction {
public OpenProjectWizardAction() {
}
public OpenProjectWizardAction(String label, Class[] acceptedTypes) {
super(label, acceptedTypes, true);
}
protected Wizard createWizard() {
return new NewProjectCreationWizard();
}
} |
5,765 | Bug 5765 New Class button in empty workspace should be more supportive | User feedback: "Confused how to create my first project" We should be more supportive in the UI for this special case since it is a first time experience with the UI. Therefore when the workbench is empty we should offer to create a new Java project. Minimal solution is to show an info dialog that explains that user should create a project first and offer a button to open the Java project wizard. The same is true for the new package and new interface buttons. | resolved fixed | ed4c009 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T14:08:51Z" | "2001-11-10T19:20:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/OpenSnippetWizardAction.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.wizards;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jdt.internal.ui.actions.AbstractOpenWizardAction;
public class OpenSnippetWizardAction extends AbstractOpenWizardAction {
public OpenSnippetWizardAction() {
}
public OpenSnippetWizardAction(String label, Class[] acceptedTypes) {
super(label, acceptedTypes, false);
}
protected Wizard createWizard() {
return new NewSnippetFileCreationWizard();
}
protected boolean shouldAcceptElement(Object obj) {
return !NewGroup.isInArchive(obj);
}
} |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.util;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IOpenable;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
/**
* Utility methods for the Java Model.
*/
public class JavaModelUtil { |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | /**
* Finds a type by its qualified type name (dot separated).
* @param jproject The java project to search in
* @param str The fully qualified name (type name with enclosing type names and package (all separated by dots))
* @return The type found, or null if not existing
* The method does not find inner types. Waiting for a Java Core solution
*/
public static IType findType(IJavaProject jproject, String fullyQualifiedName) throws JavaModelException {
String pathStr= fullyQualifiedName.replace('.', '/') + ".java";
IJavaElement jelement= jproject.findElement(new Path(pathStr));
if (jelement == null) { |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | String qualifier= Signature.getQualifier(fullyQualifiedName);
if (qualifier.length() > 0) {
IType type= findType(jproject, qualifier);
if (type != null) {
IType res= type.getType(Signature.getSimpleName(fullyQualifiedName));
if (res.exists()) {
return res;
}
}
}
} else if (jelement.getElementType() == IJavaElement.COMPILATION_UNIT) {
String simpleName= Signature.getSimpleName(fullyQualifiedName);
return ((ICompilationUnit) jelement).getType(simpleName);
} else if (jelement.getElementType() == IJavaElement.CLASS_FILE) {
return ((IClassFile) jelement).getType();
}
return null;
}
/**
* Finds a type by package and type name.
* @param jproject the java project to search in
* @param pack The package name
* @param typeQualifiedName the type qualified name (type name with enclosing type names (separated by dots))
* @return the type found, or null if not existing
*/
public static IType findType(IJavaProject jproject, String pack, String typeQualifiedName) throws JavaModelException {
int dot= typeQualifiedName.indexOf('.');
if (dot == -1) {
return findType(jproject, concatenateName(pack, typeQualifiedName)); |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | }
IPath packPath;
if (pack.length() > 0) {
packPath= new Path(pack.replace('.', '/'));
} else {
packPath= new Path("");
}
IPath path= packPath.append(typeQualifiedName.substring(0, dot) + ".java");
IJavaElement elem= jproject.findElement(path);
if (elem instanceof ICompilationUnit) {
return findTypeInCompilationUnit((ICompilationUnit)elem, typeQualifiedName);
} else if (elem instanceof IClassFile) {
path= packPath.append(typeQualifiedName.replace('.', '$') + ".class");
elem= jproject.findElement(path);
if (elem instanceof IClassFile) {
return ((IClassFile)elem).getType();
}
}
return null;
}
/**
* Finds a type container by container name.
* The returned element will be of type <code>IType</code> or a <code>IPackageFragment</code>.
* <code>null</code> is returned if the type container could not be found.
* @param jproject The Java project defining the context to search
* @param typeContainerName A dot separarted name of the type container
* @see #getTypeContainerName()
*/ |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | public static IJavaElement findTypeContainer(IJavaProject jproject, String typeContainerName) throws JavaModelException {
IJavaElement result= findType(jproject, typeContainerName);
if (result == null) {
IPath path= new Path(typeContainerName.replace('.', '/'));
result= jproject.findElement(path);
if (!(result instanceof IPackageFragment)) {
result= null;
}
}
return result;
}
/**
* Finds a type in a compilation unit. Typical usage is to find the corresponding
* type in a working copy.
* @param cu the compilation unit to search in
* @param typeQualifiedName the type qualified name (type name with enclosing type names (separated by dots))
* @return the type found, or null if not existing
*/
public static IType findTypeInCompilationUnit(ICompilationUnit cu, String typeQualifiedName) throws JavaModelException {
IType[] types= cu.getAllTypes();
for (int i= 0; i < types.length; i++) {
String currName= getTypeQualifiedName(types[i]);
if (typeQualifiedName.equals(currName)) {
return types[i];
}
} |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | return null;
}
/**
* Finds a a member in a compilation unit. Typical usage is to find the corresponding
* member in a working copy.
* @param cu the compilation unit (eg. working copy) to search in
* @param member the member (eg. from the original)
* @return the member found, or null if not existing
*/
public static IMember findMemberInCompilationUnit(ICompilationUnit cu, IMember member) throws JavaModelException {
if (member.getElementType() == IJavaElement.TYPE) {
return findTypeInCompilationUnit(cu, getTypeQualifiedName((IType)member));
} else {
IType declaringType= findTypeInCompilationUnit(cu, getTypeQualifiedName(member.getDeclaringType()));
if (declaringType != null) {
IMember result= null;
switch (member.getElementType()) {
case IJavaElement.FIELD:
result= declaringType.getField(member.getElementName());
break;
case IJavaElement.METHOD:
IMethod meth= (IMethod) member;
result= findMethod(meth.getElementName(), meth.getParameterTypes(), meth.isConstructor(), declaringType);
break;
case IJavaElement.INITIALIZER:
result= declaringType.getInitializer(1);
break;
}
if (result != null && result.exists()) { |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | return result;
}
}
}
return null;
}
/**
* Returns the element contained in the given set with the same name
* as the given key.
*
* @param set the set to choose from
* @param key the key to look for
* @return the member of the given set with the same name as the given key
*/
private static IJavaElement find(IJavaElement[] set, IJavaElement key) {
if (set == null)
return null;
String name= key.getElementName();
if (name == null)
return null;
for (int i= 0; i < set.length; i++) {
if (name.equals(set[i].getElementName()))
return set[i];
}
return null;
} |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | /**
* Returns the element of the given compilation unit which is "equal" to the
* given element. Note that the given element usually has a parent different
* from the given compilation unit.
*
* @param cu the cu to search in
* @param element the element to look for
* @return an element of the given cu "equal" to the given element
*/
public static IJavaElement findInCompilationUnit(ICompilationUnit cu, IJavaElement element) throws JavaModelException {
if (element instanceof IMember)
return findMemberInCompilationUnit(cu, (IMember) element);
int type= element.getElementType();
switch (type) {
case IJavaElement.IMPORT_CONTAINER:
return cu.getImportContainer();
case IJavaElement.PACKAGE_DECLARATION:
return find(cu.getPackageDeclarations(), element);
case IJavaElement.IMPORT_DECLARATION:
return find(cu.getImports(), element);
case IJavaElement.COMPILATION_UNIT:
return cu;
} |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | return null;
}
/**
* Returns the qualified type name of the given type using '.' as separators.
* This is a replace for IType.getTypeQualifiedName()
* which uses '$' as separators. As '$' is also a valid character in an id
* this is ambiguous. JavaCore PR: 1GCFUNT
*/
public static String getTypeQualifiedName(IType type) {
StringBuffer buf= new StringBuffer();
getTypeQualifiedName(type, buf);
return buf.toString();
}
private static void getTypeQualifiedName(IType type, StringBuffer buf) {
IType outerType= type.getDeclaringType();
if (outerType != null) {
getTypeQualifiedName(outerType, buf);
buf.append('.');
}
buf.append(type.getElementName());
}
/**
* Returns the fully qualified name of the given type using '.' as separators.
* This is a replace for IType.getFullyQualifiedTypeName
* which uses '$' as separators. As '$' is also a valid character in an id
* this is ambiguous. JavaCore PR: 1GCFUNT
*/
public static String getFullyQualifiedName(IType type) { |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | StringBuffer buf= new StringBuffer();
String packName= type.getPackageFragment().getElementName();
if (packName.length() > 0) {
buf.append(packName);
buf.append('.');
}
getTypeQualifiedName(type, buf);
return buf.toString();
}
/**
* Returns the fully qualified name of a type's container. (package name or enclosing type name)
*/
public static String getTypeContainerName(IType type) {
IType outerType= type.getDeclaringType();
if (outerType != null) {
return getFullyQualifiedName(outerType);
} else {
return type.getPackageFragment().getElementName();
}
}
/**
* Returns the raw class path entry corresponding to a package fragment root
* or null if there isn't a corresponding entry.
*/
public static IClasspathEntry getRawClasspathEntry(IPackageFragmentRoot root) throws JavaModelException {
IPath path= root.getPath();
IClasspathEntry[] entries= root.getJavaProject().getRawClasspath();
for (int i= 0; i < entries.length; i++) { |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | IClasspathEntry curr= entries[i];
if (curr.getEntryKind() == IClasspathEntry.CPE_VARIABLE) {
curr= JavaCore.getResolvedClasspathEntry(curr);
}
if (curr != null && curr.getContentKind() == root.getKind() && path.equals(curr.getPath())) {
return entries[i];
}
}
return null;
}
/**
* Concatenates two names. Uses a dot for separation.
* Both strings can be empty or <code>null</code>.
*/
public static String concatenateName(String name1, String name2) {
StringBuffer buf= new StringBuffer();
if (name1 != null && name1.length() > 0) {
buf.append(name1);
if (name2 != null && name2.length() > 0) {
buf.append('.');
buf.append(name2);
}
}
return buf.toString();
}
/**
* Evaluates if a member (possible from another package) is visible from
* elements in a package. |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | * @param member The member to test the visibility for
* @param pack The package in focus
*/
public static boolean isVisible(IMember member, IPackageFragment pack) throws JavaModelException {
int otherflags= member.getFlags();
if (Flags.isPublic(otherflags) || Flags.isProtected(otherflags)) {
return true;
} else if (Flags.isPrivate(otherflags)) {
return false;
}
IPackageFragment otherpack= (IPackageFragment) findParentOfKind(member, IJavaElement.PACKAGE_FRAGMENT);
return (pack != null && pack.equals(otherpack));
}
/**
* Returns true if the element is on the build path of the given project
*/
public static boolean isOnBuildPath(IJavaProject jproject, IJavaElement element) throws JavaModelException {
IPath rootPath;
if (element.getElementType() == IJavaElement.JAVA_PROJECT) {
rootPath= ((IJavaProject)element).getProject().getFullPath();
} else {
IPackageFragmentRoot root= getPackageFragmentRoot(element);
if (root == null) {
return false;
}
rootPath= root.getPath();
} |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | return jproject.findPackageFragmentRoot(rootPath) != null;
}
/**
* Returns the package fragment root of <code>IJavaElement</code>. If the given
* element is already a package fragment root, the element itself is returned.
*/
public static IPackageFragmentRoot getPackageFragmentRoot(IJavaElement element) {
return (IPackageFragmentRoot)findElementOfKind(element, IJavaElement.PACKAGE_FRAGMENT_ROOT);
}
/**
* Returns the first openable parent. If the given element is openable, the element
* itself is returned.
*/
public static IOpenable getOpenable(IJavaElement element) {
while (element != null && !(element instanceof IOpenable)) {
element= element.getParent();
}
return (IOpenable) element;
}
/**
* Returns the parent of the supplied java element that conforms to the given
* parent type or <code>null</code>, if such a parent doesn't exit.
*/
public static IJavaElement findParentOfKind(IJavaElement element, int kind) {
if (element == null)
return null; |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | return findElementOfKind(element.getParent(), kind);
}
/**
* Returns the first java element that conforms to the given type walking the
* java element's parent relationship. If the given element alrady conforms to
* the given kind, the element is returned.
* Returns <code>null</code> if no such element exits.
*/
public static IJavaElement findElementOfKind(IJavaElement element, int kind) {
while (element != null && element.getElementType() != kind)
element= element.getParent();
return element;
}
/**
* Finds a method in a type.
* This searches for a method with the same name and signature. Parameter types are only
* compared by the simple name, no resolving for the fully qualified type name is done.
* Constructors are only compared by parameters, not the name.
* @param name The name of the method to find
* @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
* @param isConstructor If the method is a constructor
* @return The first found method or <code>null</code>, if nothing found
*/
public static IMethod findMethod(String name, String[] paramTypes, boolean isConstructor, IType type) throws JavaModelException {
return findMethod(name, paramTypes, isConstructor, type.getMethods());
}
/**
* Finds a method by name.
* This searches for a method with a name and signature. Parameter types are only |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | * compared by the simple name, no resolving for the fully qualified type name is done.
* Constructors are only compared by parameters, not the name.
* @param name The name of the method to find
* @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
* @param isConstructor If the method is a constructor
* @param methods The methods to search in
* @return The found method or <code>null</code>, if nothing found
*/
public static IMethod findMethod(String name, String[] paramTypes, boolean isConstructor, IMethod[] methods) throws JavaModelException {
for (int i= methods.length - 1; i >= 0; i--) {
if (isSameMethodSignature(name, paramTypes, isConstructor, methods[i])) {
return methods[i];
}
}
return null;
}
/**
* Finds a method declararion in a type's hierarchy. The search is top down, so this
* returns the first declaration of the method in the hierarchy.
* This searches for a method with a name and signature. Parameter types are only
* compared by the simple name, no resolving for the fully qualified type name is done.
* Constructors are only compared by parameters, not the name.
* @param name The name of the method to find
* @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
* @param isConstructor If the method is a constructor
* @return The first method found or null, if nothing found
*/
public static IMethod findMethodDeclarationInHierarchy(ITypeHierarchy hierarchy, String name, String[] paramTypes, boolean isConstructor) throws JavaModelException {
IType[] superTypes= hierarchy.getAllSupertypes(hierarchy.getType()); |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | for (int i= superTypes.length - 1; i >= 0; i--) {
IMethod found= findMethod(name, paramTypes, isConstructor, superTypes[i]);
if (found != null) {
return found;
}
}
return null;
}
/**
* Finds a method implementation in a type's hierarchy. The search is bottom-up, so this
* returns the overwritten method.
* This searches for a method with a name and signature. Parameter types are only
* compared by the simple name, no resolving for the fully qualified type name is done.
* Constructors are only compared by parameters, not the name.
* @param name The name of the method to find
* @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
* @param isConstructor If the method is a constructor
* @return The first method found or null, if nothing found
*/
public static IMethod findMethodImplementationInHierarchy(ITypeHierarchy hierarchy, String name, String[] paramTypes, boolean isConstructor) throws JavaModelException {
IType[] superTypes= hierarchy.getAllSupertypes(hierarchy.getType());
for (int i= 0; i < superTypes.length; i++) {
IMethod found= findMethod(name, paramTypes, isConstructor, superTypes[i]);
if (found != null) {
return found;
}
}
return null;
} |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | /**
* Tests if a method equals to the given signature.
* Parameter types are only compared by the simple name, no resolving for
* the fully qualified type name is done. Constructors are only compared by
* parameters, not the name.
* @param Name of the method
* @param The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
* @param Specifies if the method is a constructor
* @return Returns <code>true</code> if the method has the given name and parameter types and constructor state.
*/
public static boolean isSameMethodSignature(String name, String[] paramTypes, boolean isConstructor, IMethod curr) throws JavaModelException {
if (isConstructor || name.equals(curr.getElementName())) {
if (isConstructor == curr.isConstructor()) {
String[] currParamTypes= curr.getParameterTypes();
if (paramTypes.length == currParamTypes.length) {
for (int i= 0; i < paramTypes.length; i++) {
String t1= Signature.getSimpleName(Signature.toString(paramTypes[i]));
String t2= Signature.getSimpleName(Signature.toString(currParamTypes[i]));
if (!t1.equals(t2)) {
return false;
}
}
return true;
}
}
}
return false;
} |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | /**
* Checks whether the given type has a valid main method or not.
*/
public static boolean hasMainMethod(IType type) throws JavaModelException {
String[] paramSignature= { Signature.createArraySignature(Signature.createTypeSignature("String", false), 1) };
IMethod method= findMethod("main", paramSignature, false, type);
if (method != null) {
int flags= method.getFlags();
return Flags.isStatic(flags) && Flags.isPublic(flags) && Signature.SIG_VOID.equals(method.getReturnType());
}
return false;
}
/**
* Tests if a method is a main method. Does not resolve the parameter types.
* Method must exist.
*/
public static boolean isMainMethod(IMethod method) throws JavaModelException {
if ("main".equals(method.getElementName()) && Signature.SIG_VOID.equals(method.getReturnType())) {
int flags= method.getFlags();
if (Flags.isStatic(flags) && Flags.isPublic(flags)) {
String[] paramTypes= method.getParameterTypes();
if (paramTypes.length == 1) {
String name= Signature.toString(paramTypes[0]);
return "String[]".equals(Signature.getSimpleName(name));
}
}
}
return false;
} |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java | /**
* Resolves a type name in the context of the declaring type.
* @param refTypeSig the type name in signature notation (for example 'QVector')
* this can also be an array type, but dimensions will be ignored.
* @param declaringType the context for resolving (type where the reference was made in)
* @return returns the fully qualified type name or build-in-type name.
* if a unresoved type couldn't be resolved null is returned
*/
public static String getResolvedTypeName(String refTypeSig, IType declaringType) throws JavaModelException {
int arrayCount= Signature.getArrayCount(refTypeSig);
char type= refTypeSig.charAt(arrayCount);
if (type == Signature.C_UNRESOLVED) {
int semi= refTypeSig.indexOf(Signature.C_SEMICOLON, arrayCount + 1);
if (semi == -1) {
throw new IllegalArgumentException();
}
String name= refTypeSig.substring(arrayCount + 1, semi);
String[][] resolvedNames= declaringType.resolveType(name);
if (resolvedNames != null && resolvedNames.length > 0) {
return JavaModelUtil.concatenateName(resolvedNames[0][0], resolvedNames[0][1]);
}
return null;
} else {
return Signature.toString(refTypeSig.substring(arrayCount));
}
}
} |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/TypePage.java | /*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.wizards;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IBuffer;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject; |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/TypePage.java | import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.ui.IJavaElementSearchConstants;
import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jdt.internal.compiler.env.IConstants;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.internal.ui.codemanipulation.IImportsStructure;
import org.eclipse.jdt.internal.ui.codemanipulation.ImportsStructure;
import org.eclipse.jdt.internal.ui.codemanipulation.StubUtility;
import org.eclipse.jdt.internal.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.jdt.internal.ui.dialogs.TypeSelectionDialog;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.preferences.ImportOrganizePreferencePage;
import org.eclipse.jdt.internal.ui.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField; |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/TypePage.java | import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogFieldGroup;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.Separator;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringButtonStatusDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField;
import org.eclipse.jdt.internal.ui.wizards.swt.MGridData;
/**
* <code>TypePage</code> contains controls and validation routines for a 'New Type WizardPage'
* Implementors decide which components to add and to enable. Implementors can also
* customize the validation code.
* <code>TypePage</code> is intended to serve as base class of all wizards that create types.
* Applets, Servlets, Classes, Interfaces...
* See <code>NewClassCreationWizardPage</code> or <code>NewInterfaceCreationWizardPage</code> for an
* example usage of TypePage.
*/
public abstract class TypePage extends ContainerPage {
private final static String PAGE_NAME= "TypePage";
protected final static String PACKAGE= PAGE_NAME + ".package";
protected final static String ENCLOSING= PAGE_NAME + ".enclosing";
protected final static String ENCLOSINGSELECTION= ENCLOSING + ".selection";
protected final static String TYPENAME= PAGE_NAME + ".typename";
protected final static String SUPER= PAGE_NAME + ".superclass";
protected final static String INTERFACES= PAGE_NAME + ".interfaces";
protected final static String MODIFIERS= PAGE_NAME + ".modifiers";
protected final static String METHODS= PAGE_NAME + ".methods";
private class InterfacesListLabelProvider extends LabelProvider { |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/TypePage.java | private Image fInterfaceImage;
public InterfacesListLabelProvider() {
super();
fInterfaceImage= JavaPlugin.getDefault().getImageRegistry().get(JavaPluginImages.IMG_OBJS_INTERFACE);
}
public Image getImage(Object element) {
return fInterfaceImage;
}
}
private StringButtonStatusDialogField fPackageDialogField;
private SelectionButtonDialogField fEnclosingTypeSelection;
private StringButtonDialogField fEnclosingTypeDialogField;
private boolean fCanModifyPackage;
private boolean fCanModifyEnclosingType;
private IPackageFragment fCurrPackage;
private IType fCurrEnclosingType;
private StringDialogField fTypeNameDialogField;
private StringButtonDialogField fSuperClassDialogField;
private ListDialogField fSuperInterfacesDialogField; |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/TypePage.java | private IType fSuperClass;
private SelectionButtonDialogFieldGroup fAccMdfButtons;
private SelectionButtonDialogFieldGroup fOtherMdfButtons;
private IType fCreatedType;
protected IStatus fEnclosingTypeStatus;
protected IStatus fPackageStatus;
protected IStatus fTypeNameStatus;
protected IStatus fSuperClassStatus;
protected IStatus fModifierStatus;
protected IStatus fSuperInterfacesStatus;
private boolean fIsClass;
private int fStaticMdfIndex;
private final int PUBLIC_INDEX= 0, DEFAULT_INDEX= 1, PRIVATE_INDEX= 2, PROTECTED_INDEX= 3;
private final int ABSTRACT_INDEX= 0, FINAL_INDEX= 1;
public TypePage(boolean isClass, String pageName, IWorkspaceRoot root) {
super(pageName, root);
fCreatedType= null;
fIsClass= isClass;
TypeFieldsAdapter adapter= new TypeFieldsAdapter();
fPackageDialogField= new StringButtonStatusDialogField(adapter); |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/TypePage.java | fPackageDialogField.setDialogFieldListener(adapter);
fPackageDialogField.setLabelText(NewWizardMessages.getString("TypePage.package.label"));
fPackageDialogField.setButtonLabel(NewWizardMessages.getString("TypePage.package.button"));
fPackageDialogField.setStatusWidthHint(NewWizardMessages.getString("TypePage.default"));
fEnclosingTypeSelection= new SelectionButtonDialogField(SWT.CHECK);
fEnclosingTypeSelection.setDialogFieldListener(adapter);
fEnclosingTypeSelection.setLabelText(NewWizardMessages.getString("TypePage.enclosing.selection.label"));
fEnclosingTypeDialogField= new StringButtonDialogField(adapter);
fEnclosingTypeDialogField.setDialogFieldListener(adapter);
fEnclosingTypeDialogField.setButtonLabel(NewWizardMessages.getString("TypePage.enclosing.button"));
fTypeNameDialogField= new StringDialogField();
fTypeNameDialogField.setDialogFieldListener(adapter);
fTypeNameDialogField.setLabelText(NewWizardMessages.getString("TypePage.typename.label"));
fSuperClassDialogField= new StringButtonDialogField(adapter);
fSuperClassDialogField.setDialogFieldListener(adapter);
fSuperClassDialogField.setLabelText(NewWizardMessages.getString("TypePage.superclass.label"));
fSuperClassDialogField.setButtonLabel(NewWizardMessages.getString("TypePage.superclass.button"));
String[] addButtons= new String[] {
NewWizardMessages.getString("TypePage.interfaces.add"),
null,
NewWizardMessages.getString("TypePage.interfaces.remove")
};
fSuperInterfacesDialogField= new ListDialogField(adapter, addButtons, new InterfacesListLabelProvider());
fSuperInterfacesDialogField.setDialogFieldListener(adapter);
String interfaceLabel= fIsClass ? NewWizardMessages.getString("TypePage.interfaces.class.label") : NewWizardMessages.getString("TypePage.interfaces.ifc.label"); |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/TypePage.java | fSuperInterfacesDialogField.setLabelText(interfaceLabel);
fSuperInterfacesDialogField.setRemoveButtonIndex(2);
String[] buttonNames1= new String[] {
NewWizardMessages.getString("TypePage.modifiers.public"),
NewWizardMessages.getString("TypePage.modifiers.default"),
NewWizardMessages.getString("TypePage.modifiers.private"),
NewWizardMessages.getString("TypePage.modifiers.protected")
};
fAccMdfButtons= new SelectionButtonDialogFieldGroup(SWT.RADIO, buttonNames1, 4);
fAccMdfButtons.setDialogFieldListener(adapter);
fAccMdfButtons.setLabelText(NewWizardMessages.getString("TypePage.modifiers.acc.label"));
fAccMdfButtons.setSelection(0, true);
String[] buttonNames2;
if (fIsClass) {
buttonNames2= new String[] {
NewWizardMessages.getString("TypePage.modifiers.abstract"),
NewWizardMessages.getString("TypePage.modifiers.final"),
NewWizardMessages.getString("TypePage.modifiers.static")
};
fStaticMdfIndex= 2;
} else {
buttonNames2= new String[] {
NewWizardMessages.getString("TypePage.modifiers.static")
};
fStaticMdfIndex= 0;
}
fOtherMdfButtons= new SelectionButtonDialogFieldGroup(SWT.CHECK, buttonNames2, 4);
fOtherMdfButtons.setDialogFieldListener(adapter); |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/TypePage.java | fAccMdfButtons.enableSelectionButton(PRIVATE_INDEX, false);
fAccMdfButtons.enableSelectionButton(PROTECTED_INDEX, false);
fOtherMdfButtons.enableSelectionButton(fStaticMdfIndex, false);
fPackageStatus= new StatusInfo();
fEnclosingTypeStatus= new StatusInfo();
fCanModifyPackage= true;
fCanModifyEnclosingType= true;
updateEnableState();
fTypeNameStatus= new StatusInfo();
fSuperClassStatus= new StatusInfo();
fSuperInterfacesStatus= new StatusInfo();
fModifierStatus= new StatusInfo();
}
/**
* Initializes all fields provided by the type page with a given
* Java element as selection.
* @param elem The initial selection of this page or null if no
* selection was available
*/
protected void initTypePage(IJavaElement elem) {
String initSuperclass= "java.lang.Object";
ArrayList initSuperinterfaces= new ArrayList(5);
IPackageFragment pack= null;
if (elem != null) {
pack= (IPackageFragment) JavaModelUtil.findElementOfKind(elem, IJavaElement.PACKAGE_FRAGMENT); |
6,009 | Bug 6009 New class wizard doesn't get context right for nested classes | Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor | verified fixed | eaf4bd8 | JDT | https://github.com/eclipse-jdt/eclipse.jdt.ui | eclipse-jdt/eclipse.jdt.ui | java | null | null | null | "2001-11-20T15:51:14Z" | "2001-11-16T17:00:00Z" | org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/TypePage.java | try {
IType type= null;
if (elem.getElementType() == IJavaElement.TYPE) {
type= (IType)elem;
if (type.exists()) {
String superName= JavaModelUtil.getFullyQualifiedName(type);
if (type.isInterface()) {
initSuperinterfaces.add(superName);
} else {
initSuperclass= superName;
}
}
}
} catch (JavaModelException e) {
JavaPlugin.log(e.getStatus());
}
}
setPackageFragment(pack, true);
setEnclosingType(null, true);
setEnclosingTypeSelection(false, true);
setTypeName("", true);
setSuperClass(initSuperclass, true);
setSuperInterfaces(initSuperinterfaces, true);
}
/** |