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
timestamp[us, tz=UTC] | report_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 23
187
| chunk_content
stringlengths 1
22k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.IContextMenuConstants;
import org.eclipse.jdt.ui.IWorkingCopyManager;
import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jdt.ui.JavaElementSorter;
import org.eclipse.jdt.internal.core.JavaElement;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.actions.ContextMenuGroup;
import org.eclipse.jdt.internal.ui.actions.GenerateGroup;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput;
import org.eclipse.jdt.internal.ui.javaeditor.JarEntryEditorInput;
import org.eclipse.jdt.internal.ui.packageview.BuildGroup;
import org.eclipse.jdt.internal.ui.packageview.OpenResourceAction;
import org.eclipse.jdt.internal.ui.packageview.PackagesMessages;
import org.eclipse.jdt.internal.ui.packageview.ShowInNavigatorAction;
import org.eclipse.jdt.internal.ui.refactoring.actions.IRefactoringAction;
import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringGroup;
import org.eclipse.jdt.internal.ui.reorg.ReorgGroup;
import org.eclipse.jdt.internal.ui.search.JavaSearchGroup;
import org.eclipse.jdt.internal.ui.util.JavaUIHelp;
import org.eclipse.jdt.internal.ui.util.OpenTypeHierarchyUtil;
import org.eclipse.jdt.internal.ui.viewsupport.BaseJavaElementContentProvider;
import org.eclipse.jdt.internal.ui.viewsupport.IProblemChangedListener;
import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider;
import org.eclipse.jdt.internal.ui.viewsupport.ProblemTableViewer;
import org.eclipse.jdt.internal.ui.viewsupport.StandardJavaUILabelProvider;
import org.eclipse.jdt.internal.ui.viewsupport.StatusBarUpdater;
abstract class JavaBrowsingPart extends ViewPart implements IMenuListener, ISelectionListener {
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
private ILabelProvider fLabelProvider;
private ILabelProvider fTitleProvider;
private StructuredViewer fViewer;
private IMemento fMemento;
private JavaElementTypeComparator fTypeComparator;
private ContextMenuGroup[] fStandardGroups;
private Menu fContextMenu;
private OpenResourceAction fOpenCUAction;
private Action fOpenToAction;
private Action fShowNavigatorAction;
private PropertyDialogAction fPropertyDialogAction;
private IRefactoringAction fDeleteAction;
private RefreshAction fRefreshAction;
private BackAction fBackAction;
private ForwardAction fForwardAction;
private GoIntoAction fZoomInAction;
private UpAction fUpAction;
private IWorkbenchPart fPreviousSelectionProvider;
private Image fOriginalTitleImage;
/*
* Ensure selection changed events being processed only if
* initiated by user interaction with this part.
*/
private boolean fProcessSelectionEvents= true;
private IPartListener fPartListener= new IPartListener() {
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
public void partActivated(IWorkbenchPart part) {
setSelectionFromEditor(part);
}
public void partBroughtToTop(IWorkbenchPart part) {
}
public void partClosed(IWorkbenchPart part) {
}
public void partDeactivated(IWorkbenchPart part) {
}
public void partOpened(IWorkbenchPart part) {
}
};
/*
* Implements method from IViewPart.
*/
public void init(IViewSite site, IMemento memento) throws PartInitException {
super.init(site, memento);
fMemento= memento;
}
/*
* Implements method from IViewPart.
*/
public void saveState(IMemento memento) {
if (fViewer == null) {
if (fMemento != null)
memento.putMemento(fMemento);
return;
}
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
}
/**
* Creates the search list inner viewer.
*/
public void createPartControl(Composite parent) {
Assert.isTrue(fViewer == null);
if (fMemento != null)
fMemento= null;
fTypeComparator= new JavaElementTypeComparator();
fViewer= createViewer(parent);
fLabelProvider= createLabelProvider();
ILabelDecorator decorationMgr= PlatformUI.getWorkbench().getDecoratorManager();
fViewer.setLabelProvider(new DecoratingLabelProvider(fLabelProvider, decorationMgr));
fViewer.setSorter(new JavaElementSorter());
fViewer.setUseHashlookup(true);
JavaPlugin.getDefault().getProblemMarkerManager().addListener((IProblemChangedListener)fViewer);
fTitleProvider= createTitleProvider();
MenuManager menuMgr= new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(this);
fContextMenu= menuMgr.createContextMenu(fViewer.getControl());
fViewer.getControl().setMenu(fContextMenu);
getSite().registerContextMenu(menuMgr, fViewer);
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
createActions();
addKeyListener();
getSite().setSelectionProvider(fViewer);
IStatusLineManager slManager= getViewSite().getActionBars().getStatusLineManager();
fViewer.addSelectionChangedListener(new StatusBarUpdater(slManager));
hookViewerListeners();
fViewer.setContentProvider(createContentProvider());
setInitialInput();
setInitialSelection();
addFilters();
fillToolBar(getViewSite().getActionBars().getToolBarManager());
getViewSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this);
getViewSite().getPage().addPartListener(fPartListener);
setHelp();
}
public void setFocus() {
fViewer.getControl().setFocus();
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
}
public void dispose() {
if (fViewer != null) {
JavaPlugin.getDefault().getProblemMarkerManager().removeListener((IProblemChangedListener)fViewer);
getViewSite().getWorkbenchWindow().getSelectionService().removeSelectionListener(this);
getViewSite().getPage().removePartListener(fPartListener);
fViewer= null;
}
super.dispose();
}
/**
* Adds the KeyListener
*/
protected void addKeyListener() {
fViewer.getControl().addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent event) {
handleKeyReleased(event);
}
});
}
protected void handleKeyReleased(KeyEvent event) {
if (event.stateMask != 0)
return;
int key= event.keyCode;
if (key == SWT.F5) {
fRefreshAction.selectionChanged(
(IStructuredSelection) fViewer.getSelection());
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
if (fRefreshAction.isEnabled())
fRefreshAction.run();
} else if (key == SWT.F4) {
OpenTypeHierarchyUtil.open(getSelectionProvider().getSelection(), getSite().getWorkbenchWindow());
} else if (key == SWT.F3) {
fOpenCUAction.update();
if (fOpenCUAction.isEnabled())
fOpenCUAction.run();
}
else if (event.character == SWT.DEL) {
fDeleteAction.update();
if (fDeleteAction.isEnabled())
fDeleteAction.run();
}
}
protected void fillToolBar(IToolBarManager tbm) {
}
/**
* Called when the context menu is about to open.
* Override to add your own context dependent menu contributions.
*/
public void menuAboutToShow(IMenuManager menu) {
JavaPlugin.createStandardGroups(menu);
IStructuredSelection selection= (IStructuredSelection) fViewer.getSelection();
fPropertyDialogAction.selectionChanged(selection);
MenuManager newMenu= new MenuManager(PackagesMessages.getString("PackageExplorer.new"));
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
menu.appendToGroup(IContextMenuConstants.GROUP_NEW, newMenu);
new NewWizardMenu(newMenu, getSite().getWorkbenchWindow(), false);
fOpenCUAction.update();
if (fOpenCUAction.isEnabled())
menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, fOpenCUAction);
addOpenWithMenu(menu, selection);
addOpenToMenu(menu, selection);
addRefactoring(menu);
ContextMenuGroup.add(menu, fStandardGroups, fViewer);
menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, fRefreshAction);
fRefreshAction.selectionChanged(selection);
menu.add(new Separator());
if (fPropertyDialogAction.isApplicableForSelection())
menu.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, fPropertyDialogAction);
}
private void addRefactoring(IMenuManager menu){
MenuManager refactoring= new MenuManager(PackagesMessages.getString("PackageExplorer.refactoringTitle"));
ContextMenuGroup.add(refactoring, new ContextMenuGroup[] { new RefactoringGroup() }, fViewer);
if (!refactoring.isEmpty())
menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, refactoring);
}
private void createActions() {
ISelectionProvider provider= getSelectionProvider();
fOpenCUAction= new OpenResourceAction(provider);
fPropertyDialogAction= new PropertyDialogAction(getShell(), provider);
fShowNavigatorAction= new ShowInNavigatorAction(provider);
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
fStandardGroups= new ContextMenuGroup[] {
new BuildGroup(),
new ReorgGroup(),
new GenerateGroup(),
new JavaSearchGroup()
};
fDeleteAction= ReorgGroup.createDeleteAction(provider);
fRefreshAction= new RefreshAction(getShell());
IActionBars actionService= getViewSite().getActionBars();
actionService.setGlobalActionHandler(IWorkbenchActionConstants.DELETE, fDeleteAction);
ReorgGroup.addGlobalReorgActions(actionService, provider);
}
private void addOpenToMenu(IMenuManager menu, IStructuredSelection selection) {
if (selection.size() != 1)
return;
IAdaptable element= (IAdaptable) selection.getFirstElement();
IResource resource= (IResource)element.getAdapter(IResource.class);
if ((resource instanceof IContainer)) {
MenuManager submenu = new MenuManager(PackagesMessages.getString("PackageExplorer.openPerspective"));
submenu.add(new OpenPerspectiveMenu(getSite().getWorkbenchWindow(), resource));
menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
OpenTypeHierarchyUtil.addToMenu(getSite().getWorkbenchWindow(), menu, element);
}
private void addOpenWithMenu(IMenuManager menu, IStructuredSelection selection) {
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
if (selection.size() != 1)
return;
IAdaptable element= (IAdaptable)selection.getFirstElement();
Object resource= element.getAdapter(IResource.class);
if (!(resource instanceof IFile))
return;
MenuManager submenu= new MenuManager(PackagesMessages.getString("PackageExplorer.openWith"));
submenu.add(new OpenWithMenu(getSite().getPage(), (IFile) resource));
menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
/**
* Returns the shell to use for opening dialogs.
* Used in this class, and in the actions.
*/
private Shell getShell() {
return fViewer.getControl().getShell();
}
protected final Display getDisplay() {
return fViewer.getControl().getDisplay();
}
/**
* Returns the selection provider.
*/
private ISelectionProvider getSelectionProvider() {
return fViewer;
}
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
/**
* Answers if the given <code>element</code> is a valid
* input for this part.
*
* @param element the object to test
* @return <true> if the given element is a valid input
*/
abstract protected boolean isValidInput(Object element);
/**
* Answers if the given <code>element</code> is a valid
* element for this part.
*
* @param element the object to test
* @return <true> if the given element is a valid element
*/
protected boolean isValidElement(Object element) {
if (element == null)
return false;
element= getSuitableJavaElement(element);
if (element == null)
return false;
Object input= getViewer().getInput();
if (input == null)
return false;
if (input instanceof Collection)
return ((Collection)input).contains(element);
else
return input.equals(element);
}
private boolean isInputResetBy(Object newInput, Object input, IWorkbenchPart part) {
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
if (newInput == null)
return part == fPreviousSelectionProvider;
if (input instanceof IJavaElement && newInput instanceof IJavaElement)
return getTypeComparator().compare(newInput, input) > 0;
else
return false;
}
protected boolean isAncestorOf(Object ancestor, Object element) {
if (element instanceof IJavaElement && ancestor instanceof IJavaElement)
return !element.equals(ancestor) && internalIsAncestorOf((IJavaElement)ancestor, (IJavaElement)element);
return false;
}
private boolean internalIsAncestorOf(IJavaElement ancestor, IJavaElement element) {
if (element != null)
return element.equals(ancestor) || internalIsAncestorOf(ancestor, element.getParent());
else
return false;
}
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (!fProcessSelectionEvents || part == this || !(selection instanceof IStructuredSelection))
return;
if (selection.isEmpty() && part instanceof JavaBrowsingPart && !(part instanceof ProjectsView))
return;
Object newInput= getElementFromSingleSelection(selection);
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
Object currentInput= (IJavaElement)getViewer().getInput();
if (newInput != null && newInput.equals(currentInput)) {
IJavaElement elementToSelect= findElementToSelect(getElementFromSingleSelection(selection));
if (elementToSelect != null && getTypeComparator().compare(newInput, elementToSelect) < 0)
setSelection(new StructuredSelection(elementToSelect), true);
fPreviousSelectionProvider= part;
return;
}
if (part != fPreviousSelectionProvider && newInput != null && !newInput.equals(currentInput) && isInputResetBy(newInput, currentInput, part)) {
if (!isAncestorOf(newInput, currentInput))
setInput(null);
fPreviousSelectionProvider= part;
return;
} else if (newInput == null && part == fPreviousSelectionProvider) {
setInput(null);
fPreviousSelectionProvider= part;
return;
}
fPreviousSelectionProvider= part;
if (newInput instanceof IJavaElement)
adjustInputAndSetSelection((IJavaElement)newInput);
else
setSelection(StructuredSelection.EMPTY, true);
}
protected void setInput(Object input) {
if (input == null)
setTitleImage(fOriginalTitleImage);
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
else if (input instanceof Collection) {
if (((Collection)input).isEmpty())
setTitleImage(fOriginalTitleImage);
else {
Object firstElement= ((Collection)input).iterator().next();
setTitleImage(fTitleProvider.getImage(firstElement));
}
} else
setTitleImage(fTitleProvider.getImage(input));
setViewerInput(input);
}
private void setViewerInput(Object input) {
fProcessSelectionEvents= false;
fViewer.setInput(input);
fProcessSelectionEvents= true;
}
/**
* Sets or clears the title image of this part and
* store the orignal image on the first call.
*/
protected void setTitleImage(Image titleImage) {
if (fOriginalTitleImage == null)
fOriginalTitleImage= getTitleImage();
if (titleImage == null)
titleImage= fOriginalTitleImage;
super.setTitleImage(titleImage);
}
protected final StructuredViewer getViewer() {
return fViewer;
}
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
protected ILabelProvider createLabelProvider() {
return new StandardJavaUILabelProvider(
StandardJavaUILabelProvider.DEFAULT_TEXTFLAGS,
StandardJavaUILabelProvider.DEFAULT_IMAGEFLAGS | JavaElementImageProvider.SMALL_ICONS,
StandardJavaUILabelProvider.getAdornmentProviders(true, null)
);
}
protected ILabelProvider createTitleProvider() {
return new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_BASICS | JavaElementLabelProvider.SHOW_SMALL_ICONS);
}
protected final ILabelProvider getLabelProvider() {
return fLabelProvider;
}
protected final ILabelProvider getTitleProvider() {
return fTitleProvider;
}
/**
* Creates the the viewer of this part.
*
* @param parent the parent for the viewer
*/
protected StructuredViewer createViewer(Composite parent) {
return new ProblemTableViewer(parent, SWT.MULTI);
}
protected int getLabelProviderFlags() {
return JavaElementLabelProvider.SHOW_BASICS | JavaElementLabelProvider.SHOW_OVERLAY_ICONS |
JavaElementLabelProvider.SHOW_SMALL_ICONS | JavaElementLabelProvider.SHOW_VARIABLE | JavaElementLabelProvider.SHOW_PARAMETERS;
}
/**
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
* Adds filters the viewer of this part.
*/
protected void addFilters() {
}
/**
* Creates the the content provider of this part.
*/
protected BaseJavaElementContentProvider createContentProvider() {
return new JavaElementContentProvider(true, this);
}
protected void setInitialInput() {
ISelection selection= getSite().getPage().getSelection();
Object input= getElementFromSingleSelection(selection);
if (!(input instanceof IJavaElement)) {
input= getSite().getPage().getInput();
if (!(input instanceof IJavaElement) && input instanceof IAdaptable)
input= ((IAdaptable)input).getAdapter(IJavaElement.class);
}
setInput(findInputForJavaElement((JavaElement)input));
}
protected void setInitialSelection() {
Object input;
ISelection selection= getSite().getPage().getSelection();
if (selection != null && !selection.isEmpty())
input= getElementFromSingleSelection(selection);
else {
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
input= getSite().getPage().getInput();
if (!(input instanceof IJavaElement) && input instanceof IAdaptable)
input= ((IAdaptable)input).getAdapter(IJavaElement.class);
else
return;
}
if (findElementToSelect((IJavaElement)input) != null)
adjustInputAndSetSelection((IJavaElement)input);
}
final protected void setHelp() {
JavaUIHelp.setHelp(fViewer, getHelpContextId());
}
/**
* Returns the context ID for the Help system
*
* @return the string used as ID for the Help context
*/
abstract protected String getHelpContextId();
/**
* Adds additional listeners to this view.
*/
protected void hookViewerListeners() {
fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
if (!fProcessSelectionEvents)
return;
if (JavaBrowsingPreferencePage.openEditorOnSingleClick())
new ShowInEditorAction().run(event.getSelection(), getSite().getPage());
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
else
linkToEditor((IStructuredSelection)event.getSelection());
}
});
fViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
if (fProcessSelectionEvents && !JavaBrowsingPreferencePage.openEditorOnSingleClick())
new ShowInEditorAction().run(event.getSelection(), getSite().getPage());
}
});
}
void adjustInputAndSetSelection(IJavaElement je) {
je= getSuitableJavaElement(je);
IJavaElement elementToSelect= findElementToSelect(je);
IJavaElement newInput= findInputForJavaElement(je);
if (elementToSelect == null && !isValidInput(newInput))
setInput(null);
else if (elementToSelect == null || getViewer().testFindItem(elementToSelect) == null)
setInput(findInputForJavaElement(je));
if (elementToSelect != null)
setSelection(new StructuredSelection(elementToSelect), true);
else
setSelection(StructuredSelection.EMPTY, true);
}
/**
* Finds the closest Java element which can be used as input for
* this part and has the given Java element as child
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
*
* @param je the Java element for which to search the closest input
* @return the closest Java element used as input for this part
*/
protected IJavaElement findInputForJavaElement(IJavaElement je) {
if (je == null)
return null;
if (isValidInput(je))
return je;
return findInputForJavaElement(je.getParent());
}
final protected IJavaElement findElementToSelect(Object obj) {
if (obj instanceof IJavaElement)
return findElementToSelect((IJavaElement)obj);
return null;
}
/**
* Finds the element which has to be selected in this part.
*
* @param je the Java element which has the focus
*/
abstract protected IJavaElement findElementToSelect(IJavaElement je);
private Object getElementFromSingleSelection(ISelection selection) {
if (selection instanceof StructuredSelection
&& ((StructuredSelection)selection).size() == 1)
return ((StructuredSelection)selection).getFirstElement();
return null;
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
}
/**
* Gets the typeComparator.
* @return Returns a JavaElementTypeComparator
*/
protected Comparator getTypeComparator() {
return fTypeComparator;
}
/**
* Links to editor (if option enabled)
*/
private void linkToEditor(IStructuredSelection selection) {
if (selection == null || selection.isEmpty())
return;
Object obj= selection.getFirstElement();
Object element= null;
if (selection.size() == 1) {
if (obj instanceof IJavaElement) {
IJavaElement cu= JavaModelUtil.findElementOfKind((IJavaElement)obj, IJavaElement.COMPILATION_UNIT);
if (cu != null)
element= getResourceFor(cu);
if (element == null)
element= JavaModelUtil.findElementOfKind((IJavaElement)obj, IJavaElement.CLASS_FILE);
}
else if (obj instanceof IFile)
element= obj;
if (element == null)
return;
IWorkbenchPage page= getSite().getPage();
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
IEditorPart editorArray[]= page.getEditors();
for (int i= 0; i < editorArray.length; ++i) {
IEditorPart editor= editorArray[i];
Object input= getElementOfInput(editor.getEditorInput());
if (input != null && input.equals(element)) {
page.bringToTop(editor);
if (obj instanceof IJavaElement)
EditorUtility.revealInEditor(editor, (IJavaElement) obj);
return;
}
}
}
}
private void setSelectionFromEditor(IWorkbenchPart part) {
if (part == null)
return;
IWorkbenchPartSite site= part.getSite();
if (site == null)
return;
ISelectionProvider provider= site.getSelectionProvider();
if (provider != null)
setSelectionFromEditor(part, provider.getSelection());
}
private void setSelectionFromEditor(IWorkbenchPart part, ISelection selection) {
if (part instanceof IEditorPart && JavaBrowsingPreferencePage.linkViewSelectionToEditor()) {
IEditorInput ei= ((IEditorPart)part).getEditorInput();
if (selection instanceof ITextSelection) {
int offset= ((ITextSelection)selection).getOffset();
IJavaElement element= getElementForInputAt(ei, offset);
if (element != null) {
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
adjustInputAndSetSelection(element);
return;
}
}
if (ei instanceof IFileEditorInput) {
IFile file= ((IFileEditorInput)ei).getFile();
IJavaElement je= (IJavaElement)file.getAdapter(IJavaElement.class);
if (je == null) {
setSelection(null, false);
return;
}
adjustInputAndSetSelection(je);
} else if (ei instanceof IClassFileEditorInput) {
IClassFile cf= ((IClassFileEditorInput)ei).getClassFile();
adjustInputAndSetSelection(cf);
}
return;
}
}
/**
* Returns the element contained in the EditorInput
*/
Object getElementOfInput(IEditorInput input) {
if (input instanceof IClassFileEditorInput)
return ((IClassFileEditorInput)input).getClassFile();
else if (input instanceof IFileEditorInput)
return ((IFileEditorInput)input).getFile();
else if (input instanceof JarEntryEditorInput)
return ((JarEntryEditorInput)input).getStorage();
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
return null;
}
private IResource getResourceFor(Object element) {
if (element instanceof IJavaElement) {
if (element instanceof IWorkingCopy) {
IWorkingCopy wc= (IWorkingCopy)element;
IJavaElement original= wc.getOriginalElement();
if (original != null)
element= original;
}
try {
element= ((IJavaElement)element).getUnderlyingResource();
} catch (JavaModelException e) {
return null;
}
}
if (!(element instanceof IResource) || ((IResource)element).isPhantom()) {
return null;
}
return (IResource)element;
}
private void setSelection(ISelection selection, boolean reveal) {
if (selection != null && selection.equals(fViewer.getSelection()))
return;
fProcessSelectionEvents= false;
fViewer.setSelection(selection, reveal);
fProcessSelectionEvents= true;
}
/**
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
* Tries to find the given element in a workingcopy.
*/
protected static IJavaElement getWorkingCopy(IJavaElement input) {
try {
if (input instanceof ICompilationUnit)
return EditorUtility.getWorkingCopy((ICompilationUnit)input);
else
return EditorUtility.getWorkingCopy(input, true);
} catch (JavaModelException ex) {
}
return null;
}
/**
* Returns the original element from which the specified working copy
* element was created from. This is a handle only method, the
* returned element may or may not exist.
*
* @param workingCopy the element for which to get the original
* @return the original Java element or <code>null</code> if this is not a working copy element
*/
protected static IJavaElement getOriginal(IJavaElement workingCopy) {
ICompilationUnit cu= getCompilationUnit(workingCopy);
if (cu != null)
return ((IWorkingCopy)cu).getOriginal(workingCopy);
return null;
}
/**
* Returns the compilation unit for the given java element.
*
* @param element the java element whose compilation unit is searched for
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
* @return the compilation unit of the given java element
*/
protected static ICompilationUnit getCompilationUnit(IJavaElement element) {
if (element == null)
return null;
if (element instanceof IMember)
return ((IMember) element).getCompilationUnit();
int type= element.getElementType();
if (IJavaElement.COMPILATION_UNIT == type)
return (ICompilationUnit) element;
if (IJavaElement.CLASS_FILE == type)
return null;
return getCompilationUnit(element.getParent());
}
/**
* Converts the given Java element to one which is suitable for this
* view. It takes into account wether the view shows working copies or not.
*
* @param element the Java element to be converted
* @return an element suitable for this view
*/
protected IJavaElement getSuitableJavaElement(Object obj) {
if (!(obj instanceof IJavaElement))
return null;
IJavaElement element= (IJavaElement)obj;
if (fTypeComparator.compare(element, IJavaElement.COMPILATION_UNIT) > 0)
return element;
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
if (element.getElementType() == IJavaElement.CLASS_FILE)
return element;
if (((BaseJavaElementContentProvider)getViewer().getContentProvider()).getProvideWorkingCopy()) {
IJavaElement wc= getWorkingCopy(element);
if (wc != null)
element= wc;
return element;
}
else {
ICompilationUnit cu= getCompilationUnit(element);
if (cu != null && ((IWorkingCopy)cu).isWorkingCopy())
return ((IWorkingCopy)cu).getOriginal(element);
else
return element;
}
}
/**
* @see JavaEditor#getElementAt(int)
*/
protected IJavaElement getElementForInputAt(IEditorInput input, int offset) {
if (input instanceof IClassFileEditorInput) {
try {
return ((IClassFileEditorInput)input).getClassFile().getElementAt(offset);
} catch (JavaModelException ex) {
return null;
}
}
IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager();
ICompilationUnit unit= manager.getWorkingCopy(input);
if (unit != null)
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingPart.java
|
synchronized (unit) {
try {
unit.reconcile(null);
return unit.getElementAt(offset);
} catch (JavaModelException x) {
}
}
return null;
}
protected IType getTypeForCU(ICompilationUnit cu) {
cu= (ICompilationUnit)getSuitableJavaElement(cu);
IType primaryType= JavaModelUtil.findPrimaryType(cu);
if (primaryType != null)
return primaryType;
try {
IType[] types= cu.getTypes();
if (types.length > 0)
return types[0];
else
return null;
} catch (JavaModelException ex) {
return null;
}
}
}
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/TypesView.java
|
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.browsing;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.viewsupport.StandardJavaUILabelProvider;
public class TypesView extends JavaBrowsingPart {
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/TypesView.java
|
/**
* Creates and returns the label provider for this part.
*
* @return the label provider
* @see ILabelProvider
*/
protected ILabelProvider createLabelProvider() {
return new StandardJavaUILabelProvider(
StandardJavaUILabelProvider.DEFAULT_TEXTFLAGS,
StandardJavaUILabelProvider.DEFAULT_IMAGEFLAGS,
StandardJavaUILabelProvider.getAdornmentProviders(true, null)
);
}
/**
* Adds filters the viewer of this part.
*/
protected void addFilters() {
getViewer().addFilter(new NonJavaElementFilter());
}
/**
* Answers if the given <code>element</code> is a valid
* input for this part.
*
* @param element the object to test
* @return <true> if the given element is a valid input
*/
protected boolean isValidInput(Object element) {
return element instanceof IPackageFragment;
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/TypesView.java
|
}
/**
* Answers if the given <code>element</code> is a valid
* element for this part.
*
* @param element the object to test
* @return <true> if the given element is a valid element
*/
protected boolean isValidElement(Object element) {
if (element instanceof ICompilationUnit)
return super.isValidElement(((ICompilationUnit)element).getParent());
else if (element instanceof IType) {
IType type= (IType)element;
return type.getDeclaringType() == null && isValidElement(type.getCompilationUnit());
}
return false;
}
/**
* Finds the element which has to be selected in this part.
*
* @param je the Java element which has the focus
*/
protected IJavaElement findElementToSelect(IJavaElement je) {
if (je == null)
return null;
switch (je.getElementType()) {
case IJavaElement.TYPE:
IType type= ((IType)je).getDeclaringType();
if (type == null)
|
11,770 |
Bug 11770 java browsing: multi-selection disabled in 2 of 4 views
|
multi selection is disabled in the package and type views but it's enabled in project and member views
|
verified fixed
|
3839f03
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T15:41:17Z | 2002-03-20T10:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/TypesView.java
|
type= (IType)je;
return getSuitableJavaElement(type);
case IJavaElement.COMPILATION_UNIT:
return getTypeForCU((ICompilationUnit)je);
case IJavaElement.CLASS_FILE:
try {
return findElementToSelect(((IClassFile)je).getType());
} catch (JavaModelException ex) {
return null;
}
case IJavaElement.IMPORT_CONTAINER:
case IJavaElement.IMPORT_DECLARATION:
case IJavaElement.PACKAGE_DECLARATION:
return findElementToSelect(je.getParent());
default:
if (je instanceof IMember)
return findElementToSelect(((IMember)je).getDeclaringType());
return null;
}
}
/**
* Returns the context ID for the Help system
*
* @return the string used as ID for the Help context
*/
protected String getHelpContextId() {
return IJavaHelpContextIds.TYPES_VIEW;
}
}
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
package org.eclipse.jdt.junit.wizards;
import java.awt.Stroke;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.ListIterator;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
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.internal.corext.codemanipulation.CodeGenerationSettings;
import org.eclipse.jdt.internal.corext.codemanipulation.IImportsStructure;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
import org.eclipse.jdt.internal.junit.ui.JUnitPlugin;
import org.eclipse.jdt.internal.junit.util.JUnitStatus;
import org.eclipse.jdt.internal.junit.util.JUnitStubUtility;
import org.eclipse.jdt.internal.junit.util.LayoutUtil;
import org.eclipse.jdt.internal.junit.util.TestSearchEngine;
import org.eclipse.jdt.internal.junit.util.JUnitStubUtility.GenStubSettings;
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
import org.eclipse.jdt.internal.ui.util.SWTUtil;
import org.eclipse.jdt.ui.IJavaElementSearchConstants;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jdt.ui.wizards.NewTypeWizardPage;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.SelectionDialog;
/**
* The first page of the TestCase creation wizard.
*/
public class NewTestCaseCreationWizardPage extends NewTypeWizardPage {
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
protected final static String PAGE_NAME= "NewTestCaseCreationWizardPage";
protected final static String CLASS_TO_TEST= PAGE_NAME + ".classtotest";
protected final static String TEST_CLASS= PAGE_NAME + ".testclass";
protected final static String TEST_SUFFIX= "Test";
protected final static String SETUP= "setUp";
protected final static String TEARDOWN= "tearDown";
protected final static String STORE_GENERATE_MAIN= PAGE_NAME + ".GENERATE_MAIN";
protected final static String STORE_USE_TESTRUNNER= PAGE_NAME + ".USE_TESTRUNNER";
protected final static String STORE_TESTRUNNER_TYPE= PAGE_NAME + ".TESTRUNNER_TYPE";
private String fDefaultClassToTest;
private NewTestCaseCreationWizardPage2 fPage2;
private SelectionButtonGroup fMethodStubsButtons;
private IType fClassToTest;
protected IStatus fClassToTestStatus;
protected IStatus fTestClassStatus;
private int fIndexOfFirstTestMethod;
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
private Label fClassToTestLabel;
private Text fClassToTestText;
private Button fClassToTestButton;
private Label fTestClassLabel;
private Text fTestClassText;
private String fTestClassTextInitialValue;
private IMethod[] fTestMethods;
private IType fCreatedType;
private boolean fFirstTime;
public NewTestCaseCreationWizardPage() {
super(true, PAGE_NAME);
fFirstTime= true;
fTestClassTextInitialValue= "";
setTitle(Messages.getString("NewTestClassWizPage.title"));
setDescription(Messages.getString("NewTestClassWizPage.description"));
String[] buttonNames= new String[] {
"public static void main(Strin&g[] args)",
Messages.getString("NewTestClassWizPage.methodStub.testRunner"),
Messages.getString("NewTestClassWizPage.methodStub.setUp"),
Messages.getString("NewTestClassWizPage.methodStub.tearDown")
};
fMethodStubsButtons= new SelectionButtonGroup(SWT.CHECK, buttonNames, 1);
fMethodStubsButtons.setLabelText(Messages.getString("NewTestClassWizPage.method.Stub.label"));
fMethodStubsButtons.setSelectionGroupListener(new SelectionButtonGroup.SelectionButtonGroupListener() {
public void groupChanged(SelectionButtonGroup field) {
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
field.setEnabled(1, field.isSelected(0));
}
});
fClassToTestStatus= new JUnitStatus();
fTestClassStatus= new JUnitStatus();
fDefaultClassToTest= "";
}
/**
* Should be called from the wizard with the input element.
*/
public void init(IStructuredSelection selection, NewTestCaseCreationWizardPage2 page2) {
fPage2= page2;
IJavaElement element= getInitialJavaElement(selection);
initContainerPage(element);
initTypePage(element);
updateStatus(findMostSevereStatus());
if (element != null) {
IType enclosingType= null;
IPackageFragment pack= (IPackageFragment) JavaModelUtil.findElementOfKind(element, IJavaElement.PACKAGE_FRAGMENT);
IType typeInCompUnit= (IType) JavaModelUtil.findElementOfKind(element, IJavaElement.TYPE);
if (typeInCompUnit != null) {
if (typeInCompUnit.getCompilationUnit() != null) {
enclosingType= typeInCompUnit;
}
} else {
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
ICompilationUnit cu= (ICompilationUnit) JavaModelUtil.findElementOfKind(element, IJavaElement.COMPILATION_UNIT);
if (cu != null)
enclosingType= JavaModelUtil.findPrimaryType(cu);
}
if (enclosingType != null) {
try {
if (!TestSearchEngine.isTestImplementor(enclosingType)) {
fDefaultClassToTest= enclosingType.getFullyQualifiedName();
}
} catch (JavaModelException e) {
JUnitPlugin.log(e);
}
}
}
fMethodStubsButtons.setSelection(0, false);
fMethodStubsButtons.setSelection(1, false);
fMethodStubsButtons.setEnabled(1, false);
fMethodStubsButtons.setSelection(2, false);
fMethodStubsButtons.setSelection(3, false);
}
/**
* Finds the most severe error (if there is one)
*/
private IStatus findMostSevereStatus() {
return NewTestCaseCreationWizardPage.getMostSevere(new IStatus[] {
fContainerStatus,
fPackageStatus,
fTestClassStatus,
fClassToTestStatus,
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
fModifierStatus,
fSuperClassStatus
});
}
/*
* @see ContainerPage#handleFieldChanged
*/
protected void handleFieldChanged(String fieldName) {
super.handleFieldChanged(fieldName);
if (fieldName.equals(CLASS_TO_TEST)) {
fClassToTestStatus= classToTestClassChanged();
updateDefaultName();
} else if (fieldName.equals(SUPER)) {
validateSuperClass();
} else if (fieldName.equals(TEST_CLASS)) {
fTestClassStatus= testClassChanged();
} else if (fieldName.equals(PACKAGE) || fieldName.equals(CONTAINER)) {
if (fieldName.equals(PACKAGE))
fPackageStatus= packageChanged();
if (!fFirstTime) {
validateSuperClass();
fClassToTestStatus= classToTestClassChanged();
fTestClassStatus= testClassChanged();
}
}
updateStatus(findMostSevereStatus());
}
protected void updateDefaultName() {
String s= fClassToTestText.getText();
if (s.lastIndexOf('.') > -1)
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
s= s.substring(s.lastIndexOf('.') + 1);
if (s.length() > 0)
setTypeName(s + TEST_SUFFIX, true);
}
/*
* @see IDialogPage#createControl(Composite)
*/
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite= new Composite(parent, SWT.NONE);
int nColumns= 4;
GridLayout layout= new GridLayout();
layout.numColumns= nColumns;
composite.setLayout(layout);
createContainerControls(composite, nColumns);
createPackageControls(composite, nColumns);
createSeparator(composite, nColumns);
createTestClassControls(composite, nColumns);
createClassToTestControls(composite, nColumns);
createSuperClassControls(composite, nColumns);
createMethodStubSelectionControls(composite, nColumns);
setSuperClass(JUnitPlugin.TEST_SUPERCLASS_NAME, true);
setControl(composite);
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
fClassToTestText.setText(fDefaultClassToTest);
restoreWidgetValues();
setFocus();
}
protected void createMethodStubSelectionControls(Composite composite, int nColumns) {
LayoutUtil.setHorizontalSpan(fMethodStubsButtons.getLabelControl(composite), nColumns);
LayoutUtil.createEmptySpace(composite,1);
LayoutUtil.setHorizontalSpan(fMethodStubsButtons.getSelectionButtonsGroup(composite), nColumns - 1);
}
protected void createClassToTestControls(Composite composite, int nColumns) {
fClassToTestLabel= new Label(composite, SWT.LEFT | SWT.WRAP);
fClassToTestLabel.setFont(composite.getFont());
fClassToTestLabel.setText(Messages.getString("NewTestClassWizPage.class_to_test.label"));
GridData gd= new GridData();
gd.horizontalSpan= 1;
fClassToTestLabel.setLayoutData(gd);
fClassToTestText= new Text(composite, SWT.SINGLE | SWT.BORDER);
fClassToTestText.setEnabled(true);
fClassToTestText.setFont(composite.getFont());
fClassToTestText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
handleFieldChanged(CLASS_TO_TEST);
}
});
gd= new GridData();
gd.horizontalAlignment= gd.FILL;
gd.grabExcessHorizontalSpace= true;
gd.horizontalSpan= nColumns - 2;
fClassToTestText.setLayoutData(gd);
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
fClassToTestButton= new Button(composite, SWT.PUSH);
fClassToTestButton.setText(Messages.getString("NewTestClassWizPage.class_to_test.browse"));
fClassToTestButton.setEnabled(true);
fClassToTestButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
classToTestButtonPressed();
}
public void widgetSelected(SelectionEvent e) {
classToTestButtonPressed();
}
});
gd= new GridData();
gd.horizontalAlignment= gd.FILL;
gd.grabExcessHorizontalSpace= false;
gd.horizontalSpan= 1;
gd.heightHint = SWTUtil.getButtonHeigthHint(fClassToTestButton);
gd.widthHint = SWTUtil.getButtonWidthHint(fClassToTestButton);
fClassToTestButton.setLayoutData(gd);
}
private void classToTestButtonPressed() {
IType type= chooseClassToTestType();
if (type != null) {
fClassToTestText.setText(JavaModelUtil.getFullyQualifiedName(type));
handleFieldChanged(CLASS_TO_TEST);
}
}
private IType chooseClassToTestType() {
IPackageFragmentRoot root= getPackageFragmentRoot();
if (root == null)
return null;
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
IJavaElement[] elements= new IJavaElement[] { root.getJavaProject() };
IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
IType type= null;
try {
SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), getWizard().getContainer(), scope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, null);
dialog.setTitle(Messages.getString("NewTestClassWizPage.class_to_test.dialog.title"));
dialog.setMessage(Messages.getString("NewTestClassWizPage.class_to_test.dialog.message"));
dialog.open();
if (dialog.getReturnCode() != SelectionDialog.OK)
return type;
else {
Object[] resultArray= dialog.getResult();
type= (IType) resultArray[0];
}
} catch (JavaModelException e) {
JUnitPlugin.log(e);
}
return type;
}
protected IStatus classToTestClassChanged() {
fClassToTestButton.setEnabled(getPackageFragmentRoot() != null);
IStatus status= validateClassToTest();
return status;
}
/**
* Gets the content of the class to test text field.
*/
public String getClassToTestText() {
return fClassToTestText.getText();
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
}
public IType getClassToTest() {
return fClassToTest;
}
/**
* Sets the class to test name.
* @param canBeModified Selects if the super class can be changed by the user
*/
public void setClassToTest(String name) {
fClassToTestText.setText(name);
}
/*
* @see TypePage#evalMethods
*/
protected void createTypeMembers(IType type, IImportsStructure imports, IProgressMonitor monitor) throws CoreException {
fIndexOfFirstTestMethod= 0;
createConstructor(type);
if (fMethodStubsButtons.isSelected(0))
createMain(type);
if (fMethodStubsButtons.isSelected(2)) {
createSetUp(type, imports);
}
if (fMethodStubsButtons.isSelected(3)) {
createTearDown(type, imports);
}
if (isNextPageValid()) {
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
createTestMethodStubs(type);
}
}
protected void createConstructor(IType type) throws JavaModelException {
String constr= "public "+getTypeName()+"(String name) {super(name);}\n\n";
type.createMethod(constr, null, false, null);
fIndexOfFirstTestMethod++;
}
protected void createMain(IType type) throws JavaModelException {
StringBuffer main= new StringBuffer("public static void main(String[] args) {");
if (fMethodStubsButtons.isSelected(1)) {
main.append("junit.");
switch (fMethodStubsButtons.getComboSelection()) {
case 0:
main.append("textui");
break;
case 1:
main.append("swingui");
break;
case 2 :
main.append("awtui");
break;
default :
main.append("textui");
break;
}
main.append(".TestRunner.run(" + getTypeName() + ".class);");
}
main.append("}\n");
type.createMethod(main.toString(), null, false, null);
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
fIndexOfFirstTestMethod++;
}
protected void createSetUp(IType type, IImportsStructure imports) throws JavaModelException {
ITypeHierarchy typeHierarchy= null;
IType[] superTypes= null;
String setUp;
IMethod methodTemplate= null;
if (type.exists()) {
typeHierarchy= type.newSupertypeHierarchy(null);
superTypes= typeHierarchy.getAllSuperclasses(type);
for (int i= 0; i < superTypes.length; i++) {
if (superTypes[i].exists()) {
IMethod testMethod= superTypes[i].getMethod(SETUP, new String[] {});
if (testMethod.exists()) {
methodTemplate= testMethod;
break;
}
}
}
}
if (methodTemplate != null) {
CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
GenStubSettings genStubSettings= new GenStubSettings(settings);
genStubSettings.fCallSuper= true;
genStubSettings.fMethodOverwrites= true;
setUp= JUnitStubUtility.genStub(getTypeName(), methodTemplate, genStubSettings, imports);
} else {
setUp="/**\n * Sets up the fixture, for example, open a network connection.\n * This method is called before a test is executed.\n * @throws Exception\n */\n" +
"protected void "+SETUP+"() throws Exception {}\n\n";
}
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
type.createMethod(setUp, null, false, null);
fIndexOfFirstTestMethod++;
}
protected void createTearDown(IType type, IImportsStructure imports) throws JavaModelException {
ITypeHierarchy typeHierarchy= null;
IType[] superTypes= null;
String tearDown;
IMethod methodTemplate= null;
if (type.exists()) {
if (typeHierarchy == null) {
typeHierarchy= type.newSupertypeHierarchy(null);
superTypes= typeHierarchy.getAllSuperclasses(type);
}
for (int i= 0; i < superTypes.length; i++) {
if (superTypes[i].exists()) {
IMethod testM= superTypes[i].getMethod(TEARDOWN, new String[] {});
if (testM.exists()) {
methodTemplate= testM;
break;
}
}
}
}
if (methodTemplate != null) {
CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
GenStubSettings genStubSettings= new GenStubSettings(settings);
genStubSettings.fCallSuper= true;
genStubSettings.fMethodOverwrites= true;
tearDown= JUnitStubUtility.genStub(getTypeName(), methodTemplate, genStubSettings, imports);
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
} else {
tearDown="/**\n * Tears down the fixture, for example, close a network connection.\n * This method is called after a test is executed.\n * @throws Exception\n */\n" +
"protected void "+TEARDOWN+"() throws Exception {}\n\n";
}
type.createMethod(tearDown, null, false, null);
fIndexOfFirstTestMethod++;
}
protected void createTestMethodStubs(IType type) throws JavaModelException {
IMethod[] methods= fPage2.getCheckedMethods();
if (methods.length > 0) {
ArrayList allMethods= new ArrayList();
IMethod[] allMethodsArray= fPage2.getAllMethods();
for (int i= 0; i < allMethodsArray.length; i++) {
allMethods.add(allMethodsArray[i]);
}
ArrayList overloadedMethods= new ArrayList();
for (int i= 0; i < allMethods.size(); i++) {
IMethod current= (IMethod) allMethods.get(i);
String currentName= current.getElementName();
boolean currentAdded= false;
for (ListIterator iter= allMethods.listIterator(i+1); iter.hasNext(); ) {
IMethod iterMethod= (IMethod) iter.next();
if (iterMethod.getElementName().equals(currentName)) {
if (!currentAdded) {
overloadedMethods.add(current);
currentAdded= true;
}
overloadedMethods.add(iterMethod);
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
iter.remove();
}
}
}
/* used when for example both sum and Sum methods are present. Then
* sum -> testSum
* Sum -> testSum1
*/
ArrayList newMethodsNames= new ArrayList();
for (int i = 0; i < methods.length; i++) {
String elementName= methods[i].getElementName();
StringBuffer methodName= new StringBuffer(NewTestCaseCreationWizardPage2.PREFIX+Character.toUpperCase(elementName.charAt(0))+elementName.substring(1));
StringBuffer newMethod= new StringBuffer();
if (overloadedMethods.contains(methods[i])) {
IMethod method= methods[i];
newMethod.append("/*\n * Test for "+Signature.toString(method.getReturnType())+" "+method.getElementName()+"(");
String[] paramTypes= method.getParameterTypes();
if (paramTypes.length > 0) {
if (paramTypes.length > 1) {
for (int j= 0; j < paramTypes.length-1; j++) {
newMethod.append(Signature.toString(paramTypes[j])+", ");
}
}
newMethod.append(Signature.toString(paramTypes[paramTypes.length-1]));
}
newMethod.append(")\n */\n");
String[] params= methods[i].getParameterTypes();
for (int j= 0; j < params.length; j++) {
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
String param= params[j];
int start= 0, end= param.length();
if (param.startsWith( (new Character(Signature.C_ARRAY)).toString() ))
start= 1;
if (param.endsWith((new Character(Signature.C_NAME_END)).toString() ))
end--;
if (param.startsWith((new Character(Signature.C_UNRESOLVED)).toString() ,start)
|| param.startsWith((new Character(Signature.C_RESOLVED)).toString() ,start))
start++;
String paramName= param.substring(start, end);
if (paramName.indexOf('.') != -1) {
start += paramName.lastIndexOf('.')+1;
}
methodName.append(param.substring(start, end));
if (param.startsWith( (new Character(Signature.C_ARRAY)).toString() ))
methodName.append("Array");
}
}
if (newMethodsNames.contains(methodName.toString()))
methodName.append("1");
newMethodsNames.add(new String(methodName));
newMethod.append("public void "+methodName.toString()+"() {}\n\n");
type.createMethod(newMethod.toString(), null, false, null);
}
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
}
}
protected static GridData gridDataForDefaultForTypeName(int span) {
GridData gd= new GridData();
gd.horizontalSpan= span;
return gd;
}
public static Control createEmptySpace(Composite parent, int span) {
Label label= new Label(parent, SWT.LEFT);
GridData gd= new GridData();
gd.horizontalAlignment= gd.BEGINNING;
gd.grabExcessHorizontalSpace= false;
gd.horizontalSpan= span;
gd.horizontalIndent= 0;
gd.widthHint= 0;
gd.heightHint= 0;
label.setLayoutData(gd);
return label;
}
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible && fFirstTime) {
handleFieldChanged(CLASS_TO_TEST);
fFirstTime= false;
}
}
public int getIndexOfFirstMethod() {
return fIndexOfFirstTestMethod;
}
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
/**
* Creates a type using the current field values.
*/
public void createType(IProgressMonitor monitor) throws CoreException, InterruptedException {
super.createType(monitor);
if (fPage2.getCreateTasksButtonSelection()) {
createTaskMarkers();
}
}
private void createTaskMarkers() throws CoreException {
IType createdType= getCreatedType();
fTestMethods= createdType.getMethods();
ICompilationUnit cu= createdType.getCompilationUnit();
cu.save(null, false);
IResource res= createdType.getCompilationUnit().getUnderlyingResource();
for (int i= getIndexOfFirstMethod(); i < fTestMethods.length; i++) {
IMethod method= fTestMethods[i];
IMarker marker= res.createMarker("org.eclipse.jdt.junit.junit_task");
HashMap attributes= new HashMap(10);
attributes.put(IMarker.PRIORITY, new Integer(IMarker.PRIORITY_NORMAL));
attributes.put(IMarker.MESSAGE, Messages.getFormattedString("NewTestClassWizPage.marker.message",method.getElementName()));
ISourceRange markerRange= method.getSourceRange();
attributes.put(IMarker.CHAR_START, new Integer(markerRange.getOffset()));
attributes.put(IMarker.CHAR_END, new Integer(markerRange.getOffset()+markerRange.getLength()));
marker.setAttributes(attributes);
}
}
private void validateSuperClass() {
fMethodStubsButtons.setEnabled(2, true);
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
fMethodStubsButtons.setEnabled(3, true);
String superClassName= getSuperClass();
if (superClassName != null && !superClassName.equals("") && getPackageFragmentRoot() != null) {
try {
IType type= NewTestCaseCreationWizardPage.resolveClassNameToType(getPackageFragmentRoot().getJavaProject(), getPackageFragment(), superClassName);
JUnitStatus status = new JUnitStatus();
if (type == null) {
status.setError(Messages.getString("NewTestClassWizPage.error.superclass.not_exist"));
fSuperClassStatus= status;
} else {
if (type.isInterface()) {
status.setError(Messages.getString("NewTestClassWizPage.error.superclass.is_interface"));
fSuperClassStatus= status;
}
if (!TestSearchEngine.isTestImplementor(type)) {
status.setError(Messages.getFormattedString("NewTestClassWizPage.error.superclass.not_implementing_test_interface", JUnitPlugin.TEST_INTERFACE_NAME));
fSuperClassStatus= status;
} else {
IMethod setupMethod= type.getMethod(SETUP, new String[] {});
IMethod teardownMethod= type.getMethod(TEARDOWN, new String[] {});
if (setupMethod.exists())
fMethodStubsButtons.setEnabled(2, !Flags.isFinal(setupMethod.getFlags()));
if (teardownMethod.exists())
fMethodStubsButtons.setEnabled(3, !Flags.isFinal(teardownMethod.getFlags()));
}
}
} catch (JavaModelException e) {
JUnitPlugin.log(e);
}
}
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
}
protected void createTestClassControls(Composite composite, int nColumns) {
fTestClassLabel= new Label(composite, SWT.LEFT | SWT.WRAP);
fTestClassLabel.setFont(composite.getFont());
fTestClassLabel.setText(Messages.getString("NewTestClassWizPage.testcase.label"));
GridData gd= new GridData();
gd.horizontalSpan= 1;
fTestClassLabel.setLayoutData(gd);
fTestClassText= new Text(composite, SWT.SINGLE | SWT.BORDER);
fTestClassText.setEnabled(true);
fTestClassText.setFont(composite.getFont());
fTestClassText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
handleFieldChanged(TEST_CLASS);
}
});
gd= new GridData();
gd.horizontalAlignment= gd.FILL;
gd.grabExcessHorizontalSpace= true;
gd.horizontalSpan= nColumns - 2;
fTestClassText.setLayoutData(gd);
Label space= new Label(composite, SWT.LEFT);
space.setText(" ");
gd= new GridData();
gd.horizontalSpan= 1;
space.setLayoutData(gd);
}
/**
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
* Gets the type name.
*/
public String getTypeName() {
return (fTestClassText==null)?fTestClassTextInitialValue:fTestClassText.getText();
}
/**
* Sets the type name.
*/
public void setTypeName(String name, boolean canBeModified) {
if (fTestClassText == null) {
fTestClassTextInitialValue= name;
}
else {
fTestClassText.setText(name);
fTestClassText.setEnabled(canBeModified);
}
}
/**
* Called when the type name has changed.
* The method validates the type name and returns the status of the validation.
* Can be extended to add more validation
*/
protected IStatus testClassChanged() {
JUnitStatus status= new JUnitStatus();
String typeName= getTypeName();
if (typeName.length() == 0) {
status.setError(Messages.getString("NewTestClassWizPage.error.testcase.name_empty"));
return status;
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
}
if (typeName.indexOf('.') != -1) {
status.setError(Messages.getString("NewTestClassWizPage.error.testcase.name_qualified"));
return status;
}
IStatus val= JavaConventions.validateJavaTypeName(typeName);
if (val.getSeverity() == IStatus.ERROR) {
status.setError(Messages.getString("NewTestClassWizPage.error.testcase.name_not_valid")+val.getMessage());
return status;
} else if (val.getSeverity() == IStatus.WARNING) {
status.setWarning(Messages.getString("NewTestClassWizPage.error.testcase.name_discouraged")+val.getMessage());
}
IPackageFragment pack= getPackageFragment();
if (pack != null) {
ICompilationUnit cu= pack.getCompilationUnit(typeName + ".java");
if (cu.exists()) {
status.setError(Messages.getString("NewTestClassWizPage.error.testcase.already_exists"));
return status;
}
}
return status;
}
/**
* @see WizardPage#getNextPage
*/
public boolean canFlipToNextPage() {
return isPageComplete() && getNextPage() != null && isNextPageValid();
}
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
protected boolean isNextPageValid() {
return !getClassToTestText().equals("");
}
protected JUnitStatus validateClassToTest() {
IPackageFragmentRoot root= getPackageFragmentRoot();
IPackageFragment pack= getPackageFragment();
String classToTestName= fClassToTestText.getText();
JUnitStatus status= new JUnitStatus();
fClassToTest= null;
if (classToTestName.length() == 0) {
return status;
}
IStatus val= JavaConventions.validateJavaTypeName(classToTestName);
if (!val.isOK()) {
status.setError(Messages.getString("NewTestClassWizPage.error.class_to_test.not_valid"));
return status;
}
if (root != null) {
try {
IType type= NewTestCaseCreationWizardPage.resolveClassNameToType(root.getJavaProject(), pack, classToTestName);
if (type == null) {
status.setError(Messages.getString("NewTestClassWizPage.error.class_to_test.not_exist"));
return status;
} else {
if (type.isInterface()) {
status.setWarning(Messages.getFormattedString("NewTestClassWizPage.warning.class_to_test.is_interface",classToTestName));
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
return status;
}
if (pack != null && !JavaModelUtil.isVisible(type, pack)) {
status.setWarning(Messages.getFormattedString("NewTestClassWizPage.warning.class_to_test.interface_not_visible",classToTestName));
return status;
}
}
fClassToTest= type;
} catch (JavaModelException e) {
status.setError(Messages.getString("NewTestClassWizPage.error.class_to_test.not_valid"));
}
} else {
status.setError("");
}
return status;
}
static public IType resolveClassNameToType(IJavaProject jproject, IPackageFragment pack, String classToTestName) throws JavaModelException {
IType type= null;
if (type == null && pack != null) {
String packName= pack.getElementName();
if (!pack.isDefaultPackage()) {
type= JavaModelUtil.findType(jproject, packName, classToTestName);
}
if (type == null && !"java.lang".equals(packName)) {
type= JavaModelUtil.findType(jproject, "java.lang", classToTestName);
}
}
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
if (type == null) {
type= JavaModelUtil.findType(jproject, classToTestName);
}
return type;
}
/**
* Finds the most severe status from a array of stati.
* An error is more severe than a warning, and a warning is more severe
* than ok.
*/
public static IStatus getMostSevere(IStatus[] status) {
IStatus max= null;
for (int i= 0; i < status.length; i++) {
IStatus curr= status[i];
if (curr.matches(IStatus.ERROR)) {
return curr;
}
if (max == null || curr.getSeverity() > max.getSeverity()) {
max= curr;
}
}
return max;
}
/**
* Sets the focus on the type name.
*/
protected void setFocus() {
fTestClassText.setFocus();
}
|
11,842 |
Bug 11842 new TestCase not always initialized correctly
|
It works for CUs but not for classes Test Case: select class Test in the Packages view and create an new TestCase ==> only superclass field is initialized
|
resolved fixed
|
e03f80e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T16:26:40Z | 2002-03-20T13:13:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
/**
* Use the dialog store to restore widget values to the values that they held
* last time this wizard was used to completion
*/
private void restoreWidgetValues() {
IDialogSettings settings= getDialogSettings();
if (settings != null) {
boolean generateMain= settings.getBoolean(STORE_GENERATE_MAIN);
fMethodStubsButtons.setSelection(0, generateMain);
fMethodStubsButtons.setEnabled(1, generateMain);
fMethodStubsButtons.setSelection(1,settings.getBoolean(STORE_USE_TESTRUNNER));
try {
fMethodStubsButtons.setComboSelection(settings.getInt(STORE_TESTRUNNER_TYPE));
} catch(NumberFormatException e) {}
}
}
/**
* Since Finish was pressed, write widget values to the dialog store so that they
* will persist into the next invocation of this wizard page
*/
void saveWidgetValues() {
IDialogSettings settings= getDialogSettings();
if (settings != null) {
settings.put(STORE_GENERATE_MAIN, fMethodStubsButtons.isSelected(0));
settings.put(STORE_USE_TESTRUNNER, fMethodStubsButtons.isSelected(1));
settings.put(STORE_TESTRUNNER_TYPE, fMethodStubsButtons.getComboSelection());
}
}
}
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
package org.eclipse.jdt.junit.wizards;
import java.awt.Stroke;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.ListIterator;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
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.internal.corext.codemanipulation.CodeGenerationSettings;
import org.eclipse.jdt.internal.corext.codemanipulation.IImportsStructure;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
import org.eclipse.jdt.internal.junit.ui.JUnitPlugin;
import org.eclipse.jdt.internal.junit.util.JUnitStatus;
import org.eclipse.jdt.internal.junit.util.JUnitStubUtility;
import org.eclipse.jdt.internal.junit.util.LayoutUtil;
import org.eclipse.jdt.internal.junit.util.TestSearchEngine;
import org.eclipse.jdt.internal.junit.util.JUnitStubUtility.GenStubSettings;
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
import org.eclipse.jdt.internal.ui.util.SWTUtil;
import org.eclipse.jdt.ui.IJavaElementSearchConstants;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jdt.ui.wizards.NewTypeWizardPage;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.SelectionDialog;
/**
* The first page of the TestCase creation wizard.
*/
public class NewTestCaseCreationWizardPage extends NewTypeWizardPage {
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
protected final static String PAGE_NAME= "NewTestCaseCreationWizardPage";
protected final static String CLASS_TO_TEST= PAGE_NAME + ".classtotest";
protected final static String TEST_CLASS= PAGE_NAME + ".testclass";
protected final static String TEST_SUFFIX= "Test";
protected final static String SETUP= "setUp";
protected final static String TEARDOWN= "tearDown";
protected final static String STORE_GENERATE_MAIN= PAGE_NAME + ".GENERATE_MAIN";
protected final static String STORE_USE_TESTRUNNER= PAGE_NAME + ".USE_TESTRUNNER";
protected final static String STORE_TESTRUNNER_TYPE= PAGE_NAME + ".TESTRUNNER_TYPE";
private String fDefaultClassToTest;
private NewTestCaseCreationWizardPage2 fPage2;
private SelectionButtonGroup fMethodStubsButtons;
private IType fClassToTest;
protected IStatus fClassToTestStatus;
protected IStatus fTestClassStatus;
private int fIndexOfFirstTestMethod;
private Label fClassToTestLabel;
private Text fClassToTestText;
private Button fClassToTestButton;
private Label fTestClassLabel;
private Text fTestClassText;
private String fTestClassTextInitialValue;
private IMethod[] fTestMethods;
private IType fCreatedType;
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
private boolean fFirstTime;
public NewTestCaseCreationWizardPage() {
super(true, PAGE_NAME);
fFirstTime= true;
fTestClassTextInitialValue= "";
setTitle(Messages.getString("NewTestClassWizPage.title"));
setDescription(Messages.getString("NewTestClassWizPage.description"));
String[] buttonNames= new String[] {
"public static void main(Strin&g[] args)",
Messages.getString("NewTestClassWizPage.methodStub.testRunner"),
Messages.getString("NewTestClassWizPage.methodStub.setUp"),
Messages.getString("NewTestClassWizPage.methodStub.tearDown")
};
fMethodStubsButtons= new SelectionButtonGroup(SWT.CHECK, buttonNames, 1);
fMethodStubsButtons.setLabelText(Messages.getString("NewTestClassWizPage.method.Stub.label"));
fMethodStubsButtons.setSelectionGroupListener(new SelectionButtonGroup.SelectionButtonGroupListener() {
public void groupChanged(SelectionButtonGroup field) {
field.setEnabled(1, field.isSelected(0));
}
});
fClassToTestStatus= new JUnitStatus();
fTestClassStatus= new JUnitStatus();
fDefaultClassToTest= "";
}
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
/**
* Should be called from the wizard with the input element.
*/
public void init(IStructuredSelection selection, NewTestCaseCreationWizardPage2 page2) {
fPage2= page2;
IJavaElement element= getInitialJavaElement(selection);
initContainerPage(element);
initTypePage(element);
updateStatus(findMostSevereStatus());
if (element != null) {
IType classToTest= null;
IPackageFragment pack= (IPackageFragment) JavaModelUtil.findElementOfKind(element, IJavaElement.PACKAGE_FRAGMENT);
IType typeInCompUnit= (IType) JavaModelUtil.findElementOfKind(element, IJavaElement.TYPE);
if (typeInCompUnit != null) {
if (typeInCompUnit.getCompilationUnit() != null) {
classToTest= typeInCompUnit;
}
} else {
ICompilationUnit cu= (ICompilationUnit) JavaModelUtil.findElementOfKind(element, IJavaElement.COMPILATION_UNIT);
if (cu != null)
classToTest= JavaModelUtil.findPrimaryType(cu);
else {
if (element instanceof IClassFile) {
try {
IClassFile cf= (IClassFile) element;
if (cf.isStructureKnown())
classToTest= cf.getType();
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
} catch(JavaModelException e) {
JUnitPlugin.log(e);
}
}
}
}
if (classToTest != null) {
try {
if (!TestSearchEngine.isTestImplementor(classToTest)) {
fDefaultClassToTest= classToTest.getFullyQualifiedName();
}
} catch (JavaModelException e) {
JUnitPlugin.log(e);
}
}
}
fMethodStubsButtons.setSelection(0, false);
fMethodStubsButtons.setSelection(1, false);
fMethodStubsButtons.setEnabled(1, false);
fMethodStubsButtons.setSelection(2, false);
fMethodStubsButtons.setSelection(3, false);
}
/**
* Finds the most severe error (if there is one)
*/
private IStatus findMostSevereStatus() {
return NewTestCaseCreationWizardPage.getMostSevere(new IStatus[] {
fContainerStatus,
fPackageStatus,
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
fTestClassStatus,
fClassToTestStatus,
fModifierStatus,
fSuperClassStatus
});
}
/*
* @see ContainerPage#handleFieldChanged
*/
protected void handleFieldChanged(String fieldName) {
super.handleFieldChanged(fieldName);
if (fieldName.equals(CLASS_TO_TEST)) {
fClassToTestStatus= classToTestClassChanged();
updateDefaultName();
} else if (fieldName.equals(SUPER)) {
validateSuperClass();
} else if (fieldName.equals(TEST_CLASS)) {
fTestClassStatus= testClassChanged();
} else if (fieldName.equals(PACKAGE) || fieldName.equals(CONTAINER)) {
if (fieldName.equals(PACKAGE))
fPackageStatus= packageChanged();
if (!fFirstTime) {
validateSuperClass();
fClassToTestStatus= classToTestClassChanged();
fTestClassStatus= testClassChanged();
}
}
updateStatus(findMostSevereStatus());
}
protected void updateDefaultName() {
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
String s= fClassToTestText.getText();
if (s.lastIndexOf('.') > -1)
s= s.substring(s.lastIndexOf('.') + 1);
if (s.length() > 0)
setTypeName(s + TEST_SUFFIX, true);
}
/*
* @see IDialogPage#createControl(Composite)
*/
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite= new Composite(parent, SWT.NONE);
int nColumns= 4;
GridLayout layout= new GridLayout();
layout.numColumns= nColumns;
composite.setLayout(layout);
createContainerControls(composite, nColumns);
createPackageControls(composite, nColumns);
createSeparator(composite, nColumns);
createTestClassControls(composite, nColumns);
createClassToTestControls(composite, nColumns);
createSuperClassControls(composite, nColumns);
createMethodStubSelectionControls(composite, nColumns);
setSuperClass(JUnitPlugin.TEST_SUPERCLASS_NAME, true);
setControl(composite);
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
fClassToTestText.setText(fDefaultClassToTest);
restoreWidgetValues();
setFocus();
}
protected void createMethodStubSelectionControls(Composite composite, int nColumns) {
LayoutUtil.setHorizontalSpan(fMethodStubsButtons.getLabelControl(composite), nColumns);
LayoutUtil.createEmptySpace(composite,1);
LayoutUtil.setHorizontalSpan(fMethodStubsButtons.getSelectionButtonsGroup(composite), nColumns - 1);
}
protected void createClassToTestControls(Composite composite, int nColumns) {
fClassToTestLabel= new Label(composite, SWT.LEFT | SWT.WRAP);
fClassToTestLabel.setFont(composite.getFont());
fClassToTestLabel.setText(Messages.getString("NewTestClassWizPage.class_to_test.label"));
GridData gd= new GridData();
gd.horizontalSpan= 1;
fClassToTestLabel.setLayoutData(gd);
fClassToTestText= new Text(composite, SWT.SINGLE | SWT.BORDER);
fClassToTestText.setEnabled(true);
fClassToTestText.setFont(composite.getFont());
fClassToTestText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
handleFieldChanged(CLASS_TO_TEST);
}
});
gd= new GridData();
gd.horizontalAlignment= gd.FILL;
gd.grabExcessHorizontalSpace= true;
gd.horizontalSpan= nColumns - 2;
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
fClassToTestText.setLayoutData(gd);
fClassToTestButton= new Button(composite, SWT.PUSH);
fClassToTestButton.setText(Messages.getString("NewTestClassWizPage.class_to_test.browse"));
fClassToTestButton.setEnabled(true);
fClassToTestButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
classToTestButtonPressed();
}
public void widgetSelected(SelectionEvent e) {
classToTestButtonPressed();
}
});
gd= new GridData();
gd.horizontalAlignment= gd.FILL;
gd.grabExcessHorizontalSpace= false;
gd.horizontalSpan= 1;
gd.heightHint = SWTUtil.getButtonHeigthHint(fClassToTestButton);
gd.widthHint = SWTUtil.getButtonWidthHint(fClassToTestButton);
fClassToTestButton.setLayoutData(gd);
}
private void classToTestButtonPressed() {
IType type= chooseClassToTestType();
if (type != null) {
fClassToTestText.setText(JavaModelUtil.getFullyQualifiedName(type));
handleFieldChanged(CLASS_TO_TEST);
}
}
private IType chooseClassToTestType() {
IPackageFragmentRoot root= getPackageFragmentRoot();
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
if (root == null)
return null;
IJavaElement[] elements= new IJavaElement[] { root.getJavaProject() };
IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
IType type= null;
try {
SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), getWizard().getContainer(), scope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, null);
dialog.setTitle(Messages.getString("NewTestClassWizPage.class_to_test.dialog.title"));
dialog.setMessage(Messages.getString("NewTestClassWizPage.class_to_test.dialog.message"));
dialog.open();
if (dialog.getReturnCode() != SelectionDialog.OK)
return type;
else {
Object[] resultArray= dialog.getResult();
type= (IType) resultArray[0];
}
} catch (JavaModelException e) {
JUnitPlugin.log(e);
}
return type;
}
protected IStatus classToTestClassChanged() {
fClassToTestButton.setEnabled(getPackageFragmentRoot() != null);
IStatus status= validateClassToTest();
return status;
}
/**
* Gets the content of the class to test text field.
*/
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
public String getClassToTestText() {
return fClassToTestText.getText();
}
public IType getClassToTest() {
return fClassToTest;
}
/**
* Sets the class to test name.
* @param canBeModified Selects if the super class can be changed by the user
*/
public void setClassToTest(String name) {
fClassToTestText.setText(name);
}
/*
* @see TypePage#evalMethods
*/
protected void createTypeMembers(IType type, IImportsStructure imports, IProgressMonitor monitor) throws CoreException {
fIndexOfFirstTestMethod= 0;
createConstructor(type);
if (fMethodStubsButtons.isSelected(0))
createMain(type);
if (fMethodStubsButtons.isSelected(2)) {
createSetUp(type, imports);
}
if (fMethodStubsButtons.isSelected(3)) {
createTearDown(type, imports);
}
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
if (isNextPageValid()) {
createTestMethodStubs(type);
}
}
protected void createConstructor(IType type) throws JavaModelException {
String constr= "public "+getTypeName()+"(String name) {super(name);}\n\n";
type.createMethod(constr, null, false, null);
fIndexOfFirstTestMethod++;
}
protected void createMain(IType type) throws JavaModelException {
StringBuffer main= new StringBuffer("public static void main(String[] args) {");
if (fMethodStubsButtons.isSelected(1)) {
main.append("junit.");
switch (fMethodStubsButtons.getComboSelection()) {
case 0:
main.append("textui");
break;
case 1:
main.append("swingui");
break;
case 2 :
main.append("awtui");
break;
default :
main.append("textui");
break;
}
main.append(".TestRunner.run(" + getTypeName() + ".class);");
}
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
main.append("}\n");
type.createMethod(main.toString(), null, false, null);
fIndexOfFirstTestMethod++;
}
protected void createSetUp(IType type, IImportsStructure imports) throws JavaModelException {
ITypeHierarchy typeHierarchy= null;
IType[] superTypes= null;
String setUp;
IMethod methodTemplate= null;
if (type.exists()) {
typeHierarchy= type.newSupertypeHierarchy(null);
superTypes= typeHierarchy.getAllSuperclasses(type);
for (int i= 0; i < superTypes.length; i++) {
if (superTypes[i].exists()) {
IMethod testMethod= superTypes[i].getMethod(SETUP, new String[] {});
if (testMethod.exists()) {
methodTemplate= testMethod;
break;
}
}
}
}
if (methodTemplate != null) {
CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
GenStubSettings genStubSettings= new GenStubSettings(settings);
genStubSettings.fCallSuper= true;
genStubSettings.fMethodOverwrites= true;
setUp= JUnitStubUtility.genStub(getTypeName(), methodTemplate, genStubSettings, imports);
} else {
setUp="/**\n * Sets up the fixture, for example, open a network connection.\n * This method is called before a test is executed.\n * @throws Exception\n */\n" +
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
"protected void "+SETUP+"() throws Exception {}\n\n";
}
type.createMethod(setUp, null, false, null);
fIndexOfFirstTestMethod++;
}
protected void createTearDown(IType type, IImportsStructure imports) throws JavaModelException {
ITypeHierarchy typeHierarchy= null;
IType[] superTypes= null;
String tearDown;
IMethod methodTemplate= null;
if (type.exists()) {
if (typeHierarchy == null) {
typeHierarchy= type.newSupertypeHierarchy(null);
superTypes= typeHierarchy.getAllSuperclasses(type);
}
for (int i= 0; i < superTypes.length; i++) {
if (superTypes[i].exists()) {
IMethod testM= superTypes[i].getMethod(TEARDOWN, new String[] {});
if (testM.exists()) {
methodTemplate= testM;
break;
}
}
}
}
if (methodTemplate != null) {
CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
GenStubSettings genStubSettings= new GenStubSettings(settings);
genStubSettings.fCallSuper= true;
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
genStubSettings.fMethodOverwrites= true;
tearDown= JUnitStubUtility.genStub(getTypeName(), methodTemplate, genStubSettings, imports);
} else {
tearDown="/**\n * Tears down the fixture, for example, close a network connection.\n * This method is called after a test is executed.\n * @throws Exception\n */\n" +
"protected void "+TEARDOWN+"() throws Exception {}\n\n";
}
type.createMethod(tearDown, null, false, null);
fIndexOfFirstTestMethod++;
}
protected void createTestMethodStubs(IType type) throws JavaModelException {
IMethod[] methods= fPage2.getCheckedMethods();
if (methods.length > 0) {
ArrayList allMethods= new ArrayList();
IMethod[] allMethodsArray= fPage2.getAllMethods();
for (int i= 0; i < allMethodsArray.length; i++) {
allMethods.add(allMethodsArray[i]);
}
ArrayList overloadedMethods= new ArrayList();
for (int i= 0; i < allMethods.size(); i++) {
IMethod current= (IMethod) allMethods.get(i);
String currentName= current.getElementName();
boolean currentAdded= false;
for (ListIterator iter= allMethods.listIterator(i+1); iter.hasNext(); ) {
IMethod iterMethod= (IMethod) iter.next();
if (iterMethod.getElementName().equals(currentName)) {
if (!currentAdded) {
overloadedMethods.add(current);
currentAdded= true;
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
}
overloadedMethods.add(iterMethod);
iter.remove();
}
}
}
/* used when for example both sum and Sum methods are present. Then
* sum -> testSum
* Sum -> testSum1
*/
ArrayList newMethodsNames= new ArrayList();
for (int i = 0; i < methods.length; i++) {
String elementName= methods[i].getElementName();
StringBuffer methodName= new StringBuffer(NewTestCaseCreationWizardPage2.PREFIX+Character.toUpperCase(elementName.charAt(0))+elementName.substring(1));
StringBuffer newMethod= new StringBuffer();
if (overloadedMethods.contains(methods[i])) {
IMethod method= methods[i];
newMethod.append("/*\n * Test for "+Signature.toString(method.getReturnType())+" "+method.getElementName()+"(");
String[] paramTypes= method.getParameterTypes();
if (paramTypes.length > 0) {
if (paramTypes.length > 1) {
for (int j= 0; j < paramTypes.length-1; j++) {
newMethod.append(Signature.toString(paramTypes[j])+", ");
}
}
newMethod.append(Signature.toString(paramTypes[paramTypes.length-1]));
}
newMethod.append(")\n */\n");
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
String[] params= methods[i].getParameterTypes();
for (int j= 0; j < params.length; j++) {
String param= params[j];
int start= 0, end= param.length();
if (param.startsWith( (new Character(Signature.C_ARRAY)).toString() ))
start= 1;
if (param.endsWith((new Character(Signature.C_NAME_END)).toString() ))
end--;
if (param.startsWith((new Character(Signature.C_UNRESOLVED)).toString() ,start)
|| param.startsWith((new Character(Signature.C_RESOLVED)).toString() ,start))
start++;
String paramName= param.substring(start, end);
if (paramName.indexOf('.') != -1) {
start += paramName.lastIndexOf('.')+1;
}
methodName.append(param.substring(start, end));
if (param.startsWith( (new Character(Signature.C_ARRAY)).toString() ))
methodName.append("Array");
}
}
if (newMethodsNames.contains(methodName.toString()))
methodName.append("1");
newMethodsNames.add(new String(methodName));
newMethod.append("public void "+methodName.toString()+"() {}\n\n");
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
type.createMethod(newMethod.toString(), null, false, null);
}
}
}
protected static GridData gridDataForDefaultForTypeName(int span) {
GridData gd= new GridData();
gd.horizontalSpan= span;
return gd;
}
public static Control createEmptySpace(Composite parent, int span) {
Label label= new Label(parent, SWT.LEFT);
GridData gd= new GridData();
gd.horizontalAlignment= gd.BEGINNING;
gd.grabExcessHorizontalSpace= false;
gd.horizontalSpan= span;
gd.horizontalIndent= 0;
gd.widthHint= 0;
gd.heightHint= 0;
label.setLayoutData(gd);
return label;
}
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible && fFirstTime) {
handleFieldChanged(CLASS_TO_TEST);
fFirstTime= false;
}
}
public int getIndexOfFirstMethod() {
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
return fIndexOfFirstTestMethod;
}
/**
* Creates a type using the current field values.
*/
public void createType(IProgressMonitor monitor) throws CoreException, InterruptedException {
super.createType(monitor);
if (fPage2.getCreateTasksButtonSelection()) {
createTaskMarkers();
}
}
private void createTaskMarkers() throws CoreException {
IType createdType= getCreatedType();
fTestMethods= createdType.getMethods();
ICompilationUnit cu= createdType.getCompilationUnit();
cu.save(null, false);
IResource res= createdType.getCompilationUnit().getUnderlyingResource();
for (int i= getIndexOfFirstMethod(); i < fTestMethods.length; i++) {
IMethod method= fTestMethods[i];
IMarker marker= res.createMarker("org.eclipse.jdt.junit.junit_task");
HashMap attributes= new HashMap(10);
attributes.put(IMarker.PRIORITY, new Integer(IMarker.PRIORITY_NORMAL));
attributes.put(IMarker.MESSAGE, Messages.getFormattedString("NewTestClassWizPage.marker.message",method.getElementName()));
ISourceRange markerRange= method.getSourceRange();
attributes.put(IMarker.CHAR_START, new Integer(markerRange.getOffset()));
attributes.put(IMarker.CHAR_END, new Integer(markerRange.getOffset()+markerRange.getLength()));
marker.setAttributes(attributes);
}
}
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
private void validateSuperClass() {
fMethodStubsButtons.setEnabled(2, true);
fMethodStubsButtons.setEnabled(3, true);
String superClassName= getSuperClass();
if (superClassName != null && !superClassName.equals("") && getPackageFragmentRoot() != null) {
try {
IType type= NewTestCaseCreationWizardPage.resolveClassNameToType(getPackageFragmentRoot().getJavaProject(), getPackageFragment(), superClassName);
JUnitStatus status = new JUnitStatus();
if (type == null) {
status.setError(Messages.getString("NewTestClassWizPage.error.superclass.not_exist"));
fSuperClassStatus= status;
} else {
if (type.isInterface()) {
status.setError(Messages.getString("NewTestClassWizPage.error.superclass.is_interface"));
fSuperClassStatus= status;
}
if (!TestSearchEngine.isTestImplementor(type)) {
status.setError(Messages.getFormattedString("NewTestClassWizPage.error.superclass.not_implementing_test_interface", JUnitPlugin.TEST_INTERFACE_NAME));
fSuperClassStatus= status;
} else {
IMethod setupMethod= type.getMethod(SETUP, new String[] {});
IMethod teardownMethod= type.getMethod(TEARDOWN, new String[] {});
if (setupMethod.exists())
fMethodStubsButtons.setEnabled(2, !Flags.isFinal(setupMethod.getFlags()));
if (teardownMethod.exists())
fMethodStubsButtons.setEnabled(3, !Flags.isFinal(teardownMethod.getFlags()));
}
}
} catch (JavaModelException e) {
JUnitPlugin.log(e);
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
}
}
}
protected void createTestClassControls(Composite composite, int nColumns) {
fTestClassLabel= new Label(composite, SWT.LEFT | SWT.WRAP);
fTestClassLabel.setFont(composite.getFont());
fTestClassLabel.setText(Messages.getString("NewTestClassWizPage.testcase.label"));
GridData gd= new GridData();
gd.horizontalSpan= 1;
fTestClassLabel.setLayoutData(gd);
fTestClassText= new Text(composite, SWT.SINGLE | SWT.BORDER);
fTestClassText.setEnabled(true);
fTestClassText.setFont(composite.getFont());
fTestClassText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
handleFieldChanged(TEST_CLASS);
}
});
gd= new GridData();
gd.horizontalAlignment= gd.FILL;
gd.grabExcessHorizontalSpace= true;
gd.horizontalSpan= nColumns - 2;
fTestClassText.setLayoutData(gd);
Label space= new Label(composite, SWT.LEFT);
space.setText(" ");
gd= new GridData();
gd.horizontalSpan= 1;
space.setLayoutData(gd);
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
}
/**
* Gets the type name.
*/
public String getTypeName() {
return (fTestClassText==null)?fTestClassTextInitialValue:fTestClassText.getText();
}
/**
* Sets the type name.
*/
public void setTypeName(String name, boolean canBeModified) {
if (fTestClassText == null) {
fTestClassTextInitialValue= name;
}
else {
fTestClassText.setText(name);
fTestClassText.setEnabled(canBeModified);
}
}
/**
* Called when the type name has changed.
* The method validates the type name and returns the status of the validation.
* Can be extended to add more validation
*/
protected IStatus testClassChanged() {
JUnitStatus status= new JUnitStatus();
String typeName= getTypeName();
if (typeName.length() == 0) {
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
status.setError(Messages.getString("NewTestClassWizPage.error.testcase.name_empty"));
return status;
}
if (typeName.indexOf('.') != -1) {
status.setError(Messages.getString("NewTestClassWizPage.error.testcase.name_qualified"));
return status;
}
IStatus val= JavaConventions.validateJavaTypeName(typeName);
if (val.getSeverity() == IStatus.ERROR) {
status.setError(Messages.getString("NewTestClassWizPage.error.testcase.name_not_valid")+val.getMessage());
return status;
} else if (val.getSeverity() == IStatus.WARNING) {
status.setWarning(Messages.getString("NewTestClassWizPage.error.testcase.name_discouraged")+val.getMessage());
}
IPackageFragment pack= getPackageFragment();
if (pack != null) {
ICompilationUnit cu= pack.getCompilationUnit(typeName + ".java");
if (cu.exists()) {
status.setError(Messages.getString("NewTestClassWizPage.error.testcase.already_exists"));
return status;
}
}
return status;
}
/**
* @see WizardPage#getNextPage
*/
public boolean canFlipToNextPage() {
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
return isPageComplete() && getNextPage() != null && isNextPageValid();
}
protected boolean isNextPageValid() {
return !getClassToTestText().equals("");
}
protected JUnitStatus validateClassToTest() {
IPackageFragmentRoot root= getPackageFragmentRoot();
IPackageFragment pack= getPackageFragment();
String classToTestName= fClassToTestText.getText();
JUnitStatus status= new JUnitStatus();
fClassToTest= null;
if (classToTestName.length() == 0) {
return status;
}
IStatus val= JavaConventions.validateJavaTypeName(classToTestName);
if (!val.isOK()) {
status.setError(Messages.getString("NewTestClassWizPage.error.class_to_test.not_valid"));
return status;
}
if (root != null) {
try {
IType type= NewTestCaseCreationWizardPage.resolveClassNameToType(root.getJavaProject(), pack, classToTestName);
if (type == null) {
status.setError(Messages.getString("NewTestClassWizPage.error.class_to_test.not_exist"));
return status;
} else {
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
if (type.isInterface()) {
status.setWarning(Messages.getFormattedString("NewTestClassWizPage.warning.class_to_test.is_interface",classToTestName));
}
if (pack != null && !JavaModelUtil.isVisible(type, pack)) {
status.setWarning(Messages.getFormattedString("NewTestClassWizPage.warning.class_to_test.interface_not_visible",classToTestName));
}
}
fClassToTest= type;
} catch (JavaModelException e) {
status.setError(Messages.getString("NewTestClassWizPage.error.class_to_test.not_valid"));
}
} else {
status.setError("");
}
return status;
}
static public IType resolveClassNameToType(IJavaProject jproject, IPackageFragment pack, String classToTestName) throws JavaModelException {
IType type= null;
if (type == null && pack != null) {
String packName= pack.getElementName();
if (!pack.isDefaultPackage()) {
type= JavaModelUtil.findType(jproject, packName, classToTestName);
}
if (type == null && !"java.lang".equals(packName)) {
type= JavaModelUtil.findType(jproject, "java.lang", classToTestName);
}
}
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
if (type == null) {
type= JavaModelUtil.findType(jproject, classToTestName);
}
return type;
}
/**
* Finds the most severe status from a array of stati.
* An error is more severe than a warning, and a warning is more severe
* than ok.
*/
public static IStatus getMostSevere(IStatus[] status) {
IStatus max= null;
for (int i= 0; i < status.length; i++) {
IStatus curr= status[i];
if (curr.matches(IStatus.ERROR)) {
return curr;
}
if (max == null || curr.getSeverity() > max.getSeverity()) {
max= curr;
}
}
return max;
}
/**
* Sets the focus on the type name.
*/
protected void setFocus() {
fTestClassText.setFocus();
}
|
12,002 |
Bug 12002 TestCase wizard: error when pressing finish with an empty test name
|
the finish button should be disabled when the test name field is empty
|
resolved fixed
|
7f6ca90
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-25T17:01:26Z | 2002-03-21T05:53:20Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
/**
* Use the dialog store to restore widget values to the values that they held
* last time this wizard was used to completion
*/
private void restoreWidgetValues() {
IDialogSettings settings= getDialogSettings();
if (settings != null) {
boolean generateMain= settings.getBoolean(STORE_GENERATE_MAIN);
fMethodStubsButtons.setSelection(0, generateMain);
fMethodStubsButtons.setEnabled(1, generateMain);
fMethodStubsButtons.setSelection(1,settings.getBoolean(STORE_USE_TESTRUNNER));
try {
fMethodStubsButtons.setComboSelection(settings.getInt(STORE_TESTRUNNER_TYPE));
} catch(NumberFormatException e) {}
}
}
/**
* Since Finish was pressed, write widget values to the dialog store so that they
* will persist into the next invocation of this wizard page
*/
void saveWidgetValues() {
IDialogSettings settings= getDialogSettings();
if (settings != null) {
settings.put(STORE_GENERATE_MAIN, fMethodStubsButtons.isSelected(0));
settings.put(STORE_USE_TESTRUNNER, fMethodStubsButtons.isSelected(1));
settings.put(STORE_TESTRUNNER_TYPE, fMethodStubsButtons.getComboSelection());
}
}
}
|
12,195 |
Bug 12195 TestCase creation wizard: no progress when pressing super button
|
There is no progress shown in the wizard when pressing the browse button for selecting the super class. This is not consistent with the New Class wizard.
|
resolved fixed
|
1fdab7d
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-26T08:11:30Z | 2002-03-24T22:46:40Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/JUnitWizard.java
|
/*
* (c) Copyright 2001 MyCorporation.
* All Rights Reserved.
*/
package org.eclipse.jdt.junit.wizards;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.internal.junit.ui.JUnitPlugin;
import org.eclipse.jdt.internal.junit.util.*;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
/**
* The wizard base class for JUnit creation wizards.
*/
public class JUnitWizard extends BasicNewResourceWizard {
|
12,195 |
Bug 12195 TestCase creation wizard: no progress when pressing super button
|
There is no progress shown in the wizard when pressing the browse button for selecting the super class. This is not consistent with the New Class wizard.
|
resolved fixed
|
1fdab7d
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-26T08:11:30Z | 2002-03-24T22:46:40Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/JUnitWizard.java
|
/*
* @see IWizard#performFinish()
*/
public boolean performFinish() {
return false;
}
/**
* Run a runnable
*/
protected boolean finishPage(IRunnableWithProgress runnable) {
IRunnableWithProgress op= new WorkspaceModifyDelegatingOperation(runnable);
try {
getContainer().run(false, true, op);
} catch (InvocationTargetException e) {
Shell shell= getShell();
|
12,195 |
Bug 12195 TestCase creation wizard: no progress when pressing super button
|
There is no progress shown in the wizard when pressing the browse button for selecting the super class. This is not consistent with the New Class wizard.
|
resolved fixed
|
1fdab7d
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-26T08:11:30Z | 2002-03-24T22:46:40Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/JUnitWizard.java
|
String title= Messages.getString("NewJUnitWizard.op_error.title");
String message= Messages.getString("NewJUnitWizard.op_error.message");
ExceptionHandler.handle(e, shell, title, message);
return false;
} catch (InterruptedException e) {
return false;
}
return true;
}
protected void openResource(final IResource resource) {
if (resource.getType() == IResource.FILE) {
final IWorkbenchPage activePage= JUnitPlugin.getDefault().getActivePage();
if (activePage != null) {
final Display display= getShell().getDisplay();
if (display != null) {
display.asyncExec(new Runnable() {
public void run() {
try {
activePage.openEditor((IFile)resource);
} catch (PartInitException e) {
JUnitPlugin.log(e);
}
}
});
}
}
}
}
}
|
12,195 |
Bug 12195 TestCase creation wizard: no progress when pressing super button
|
There is no progress shown in the wizard when pressing the browse button for selecting the super class. This is not consistent with the New Class wizard.
|
resolved fixed
|
1fdab7d
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-26T08:11:30Z | 2002-03-24T22:46:40Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
package org.eclipse.jdt.junit.wizards;
import java.awt.Stroke;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.ListIterator;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
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.internal.corext.codemanipulation.CodeGenerationSettings;
import org.eclipse.jdt.internal.corext.codemanipulation.IImportsStructure;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
|
12,195 |
Bug 12195 TestCase creation wizard: no progress when pressing super button
|
There is no progress shown in the wizard when pressing the browse button for selecting the super class. This is not consistent with the New Class wizard.
|
resolved fixed
|
1fdab7d
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-26T08:11:30Z | 2002-03-24T22:46:40Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
import org.eclipse.jdt.internal.junit.ui.JUnitPlugin;
import org.eclipse.jdt.internal.junit.util.JUnitStatus;
import org.eclipse.jdt.internal.junit.util.JUnitStubUtility;
import org.eclipse.jdt.internal.junit.util.LayoutUtil;
import org.eclipse.jdt.internal.junit.util.TestSearchEngine;
import org.eclipse.jdt.internal.junit.util.JUnitStubUtility.GenStubSettings;
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
import org.eclipse.jdt.internal.ui.util.SWTUtil;
import org.eclipse.jdt.ui.IJavaElementSearchConstants;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jdt.ui.wizards.NewTypeWizardPage;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.SelectionDialog;
/**
* The first page of the TestCase creation wizard.
*/
public class NewTestCaseCreationWizardPage extends NewTypeWizardPage {
|
12,195 |
Bug 12195 TestCase creation wizard: no progress when pressing super button
|
There is no progress shown in the wizard when pressing the browse button for selecting the super class. This is not consistent with the New Class wizard.
|
resolved fixed
|
1fdab7d
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-26T08:11:30Z | 2002-03-24T22:46:40Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
protected final static String PAGE_NAME= "NewTestCaseCreationWizardPage";
protected final static String CLASS_TO_TEST= PAGE_NAME + ".classtotest";
protected final static String TEST_CLASS= PAGE_NAME + ".testclass";
protected final static String TEST_SUFFIX= "Test";
protected final static String SETUP= "setUp";
protected final static String TEARDOWN= "tearDown";
protected final static String STORE_GENERATE_MAIN= PAGE_NAME + ".GENERATE_MAIN";
protected final static String STORE_USE_TESTRUNNER= PAGE_NAME + ".USE_TESTRUNNER";
protected final static String STORE_TESTRUNNER_TYPE= PAGE_NAME + ".TESTRUNNER_TYPE";
private String fDefaultClassToTest;
private NewTestCaseCreationWizardPage2 fPage2;
private SelectionButtonGroup fMethodStubsButtons;
private IType fClassToTest;
protected IStatus fClassToTestStatus;
protected IStatus fTestClassStatus;
private int fIndexOfFirstTestMethod;
private Label fClassToTestLabel;
private Text fClassToTestText;
private Button fClassToTestButton;
private Label fTestClassLabel;
private Text fTestClassText;
private String fTestClassTextInitialValue;
private IMethod[] fTestMethods;
private IType fCreatedType;
private boolean fFirstTime;
public NewTestCaseCreationWizardPage() {
super(true, PAGE_NAME);
|
12,195 |
Bug 12195 TestCase creation wizard: no progress when pressing super button
|
There is no progress shown in the wizard when pressing the browse button for selecting the super class. This is not consistent with the New Class wizard.
|
resolved fixed
|
1fdab7d
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-26T08:11:30Z | 2002-03-24T22:46:40Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
fFirstTime= true;
fTestClassTextInitialValue= "";
setTitle(Messages.getString("NewTestClassWizPage.title"));
setDescription(Messages.getString("NewTestClassWizPage.description"));
String[] buttonNames= new String[] {
"public static void main(Strin&g[] args)",
Messages.getString("NewTestClassWizPage.methodStub.testRunner"),
Messages.getString("NewTestClassWizPage.methodStub.setUp"),
Messages.getString("NewTestClassWizPage.methodStub.tearDown")
};
fMethodStubsButtons= new SelectionButtonGroup(SWT.CHECK, buttonNames, 1);
fMethodStubsButtons.setLabelText(Messages.getString("NewTestClassWizPage.method.Stub.label"));
fMethodStubsButtons.setSelectionGroupListener(new SelectionButtonGroup.SelectionButtonGroupListener() {
public void groupChanged(SelectionButtonGroup field) {
field.setEnabled(1, field.isSelected(0));
}
});
fClassToTestStatus= new JUnitStatus();
fTestClassStatus= new JUnitStatus();
fDefaultClassToTest= "";
}
/**
* Should be called from the wizard with the input element.
*/
|
12,195 |
Bug 12195 TestCase creation wizard: no progress when pressing super button
|
There is no progress shown in the wizard when pressing the browse button for selecting the super class. This is not consistent with the New Class wizard.
|
resolved fixed
|
1fdab7d
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-26T08:11:30Z | 2002-03-24T22:46:40Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
public void init(IStructuredSelection selection, NewTestCaseCreationWizardPage2 page2) {
fPage2= page2;
IJavaElement element= getInitialJavaElement(selection);
initContainerPage(element);
initTypePage(element);
updateStatus(findMostSevereStatus());
if (element != null) {
IType classToTest= null;
IPackageFragment pack= (IPackageFragment) JavaModelUtil.findElementOfKind(element, IJavaElement.PACKAGE_FRAGMENT);
IType typeInCompUnit= (IType) JavaModelUtil.findElementOfKind(element, IJavaElement.TYPE);
if (typeInCompUnit != null) {
if (typeInCompUnit.getCompilationUnit() != null) {
classToTest= typeInCompUnit;
}
} else {
ICompilationUnit cu= (ICompilationUnit) JavaModelUtil.findElementOfKind(element, IJavaElement.COMPILATION_UNIT);
if (cu != null)
classToTest= JavaModelUtil.findPrimaryType(cu);
else {
if (element instanceof IClassFile) {
try {
IClassFile cf= (IClassFile) element;
if (cf.isStructureKnown())
classToTest= cf.getType();
} catch(JavaModelException e) {
JUnitPlugin.log(e);
}
|
12,195 |
Bug 12195 TestCase creation wizard: no progress when pressing super button
|
There is no progress shown in the wizard when pressing the browse button for selecting the super class. This is not consistent with the New Class wizard.
|
resolved fixed
|
1fdab7d
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-26T08:11:30Z | 2002-03-24T22:46:40Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
}
}
}
if (classToTest != null) {
try {
if (!TestSearchEngine.isTestImplementor(classToTest)) {
fDefaultClassToTest= classToTest.getFullyQualifiedName();
}
} catch (JavaModelException e) {
JUnitPlugin.log(e);
}
}
}
fMethodStubsButtons.setSelection(0, false);
fMethodStubsButtons.setSelection(1, false);
fMethodStubsButtons.setEnabled(1, false);
fMethodStubsButtons.setSelection(2, false);
fMethodStubsButtons.setSelection(3, false);
}
/**
* Finds the most severe error (if there is one)
*/
private IStatus findMostSevereStatus() {
return NewTestCaseCreationWizardPage.getMostSevere(new IStatus[] {
fContainerStatus,
fPackageStatus,
fTestClassStatus,
fClassToTestStatus,
fModifierStatus,
|
12,195 |
Bug 12195 TestCase creation wizard: no progress when pressing super button
|
There is no progress shown in the wizard when pressing the browse button for selecting the super class. This is not consistent with the New Class wizard.
|
resolved fixed
|
1fdab7d
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-26T08:11:30Z | 2002-03-24T22:46:40Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
fSuperClassStatus
});
}
/*
* @see ContainerPage#handleFieldChanged
*/
protected void handleFieldChanged(String fieldName) {
super.handleFieldChanged(fieldName);
if (fieldName.equals(CLASS_TO_TEST)) {
fClassToTestStatus= classToTestClassChanged();
updateDefaultName();
} else if (fieldName.equals(SUPER)) {
validateSuperClass();
} else if (fieldName.equals(TEST_CLASS)) {
fTestClassStatus= testClassChanged();
} else if (fieldName.equals(PACKAGE) || fieldName.equals(CONTAINER)) {
if (fieldName.equals(PACKAGE))
fPackageStatus= packageChanged();
if (!fFirstTime) {
validateSuperClass();
fClassToTestStatus= classToTestClassChanged();
fTestClassStatus= testClassChanged();
}
}
updateStatus(findMostSevereStatus());
}
protected void updateDefaultName() {
String s= fClassToTestText.getText();
if (s.lastIndexOf('.') > -1)
s= s.substring(s.lastIndexOf('.') + 1);
|
12,195 |
Bug 12195 TestCase creation wizard: no progress when pressing super button
|
There is no progress shown in the wizard when pressing the browse button for selecting the super class. This is not consistent with the New Class wizard.
|
resolved fixed
|
1fdab7d
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-26T08:11:30Z | 2002-03-24T22:46:40Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
if (s.length() > 0)
setTypeName(s + TEST_SUFFIX, true);
}
/*
* @see IDialogPage#createControl(Composite)
*/
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite= new Composite(parent, SWT.NONE);
int nColumns= 4;
GridLayout layout= new GridLayout();
layout.numColumns= nColumns;
composite.setLayout(layout);
createContainerControls(composite, nColumns);
createPackageControls(composite, nColumns);
createSeparator(composite, nColumns);
createTestClassControls(composite, nColumns);
createClassToTestControls(composite, nColumns);
createSuperClassControls(composite, nColumns);
createMethodStubSelectionControls(composite, nColumns);
setSuperClass(JUnitPlugin.TEST_SUPERCLASS_NAME, true);
setControl(composite);
fClassToTestText.setText(fDefaultClassToTest);
|
12,195 |
Bug 12195 TestCase creation wizard: no progress when pressing super button
|
There is no progress shown in the wizard when pressing the browse button for selecting the super class. This is not consistent with the New Class wizard.
|
resolved fixed
|
1fdab7d
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-26T08:11:30Z | 2002-03-24T22:46:40Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
restoreWidgetValues();
setFocus();
}
protected void createMethodStubSelectionControls(Composite composite, int nColumns) {
LayoutUtil.setHorizontalSpan(fMethodStubsButtons.getLabelControl(composite), nColumns);
LayoutUtil.createEmptySpace(composite,1);
LayoutUtil.setHorizontalSpan(fMethodStubsButtons.getSelectionButtonsGroup(composite), nColumns - 1);
}
protected void createClassToTestControls(Composite composite, int nColumns) {
fClassToTestLabel= new Label(composite, SWT.LEFT | SWT.WRAP);
fClassToTestLabel.setFont(composite.getFont());
fClassToTestLabel.setText(Messages.getString("NewTestClassWizPage.class_to_test.label"));
GridData gd= new GridData();
gd.horizontalSpan= 1;
fClassToTestLabel.setLayoutData(gd);
fClassToTestText= new Text(composite, SWT.SINGLE | SWT.BORDER);
fClassToTestText.setEnabled(true);
fClassToTestText.setFont(composite.getFont());
fClassToTestText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
handleFieldChanged(CLASS_TO_TEST);
}
});
gd= new GridData();
gd.horizontalAlignment= gd.FILL;
gd.grabExcessHorizontalSpace= true;
gd.horizontalSpan= nColumns - 2;
fClassToTestText.setLayoutData(gd);
|
12,195 |
Bug 12195 TestCase creation wizard: no progress when pressing super button
|
There is no progress shown in the wizard when pressing the browse button for selecting the super class. This is not consistent with the New Class wizard.
|
resolved fixed
|
1fdab7d
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-03-26T08:11:30Z | 2002-03-24T22:46:40Z |
org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseCreationWizardPage.java
|
fClassToTestButton= new Button(composite, SWT.PUSH);
fClassToTestButton.setText(Messages.getString("NewTestClassWizPage.class_to_test.browse"));
fClassToTestButton.setEnabled(true);
fClassToTestButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
classToTestButtonPressed();
}
public void widgetSelected(SelectionEvent e) {
classToTestButtonPressed();
}
});
gd= new GridData();
gd.horizontalAlignment= gd.FILL;
gd.grabExcessHorizontalSpace= false;
gd.horizontalSpan= 1;
gd.heightHint = SWTUtil.getButtonHeigthHint(fClassToTestButton);
gd.widthHint = SWTUtil.getButtonWidthHint(fClassToTestButton);
fClassToTestButton.setLayoutData(gd);
}
private void classToTestButtonPressed() {
IType type= chooseClassToTestType();
if (type != null) {
fClassToTestText.setText(JavaModelUtil.getFullyQualifiedName(type));
handleFieldChanged(CLASS_TO_TEST);
}
}
private IType chooseClassToTestType() {
IPackageFragmentRoot root= getPackageFragmentRoot();
if (root == null)
return null;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.