|
From: David C. <dc...@us...> - 2005-10-13 01:00:35
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/views In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3401/src/org/rubypeople/rdt/testunit/views Modified Files: FailureTab.java Added Files: OpenClassAction.java Log Message: Partial support for opening classes from Test::Unit failure. --- NEW FILE: OpenClassAction.java --- package org.rubypeople.rdt.testunit.views; import java.util.Set; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.rubypeople.rdt.internal.core.symbols.ClassSymbol; import org.rubypeople.rdt.internal.core.symbols.Location; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; import org.rubypeople.rdt.internal.ui.util.PositionBasedEditorOpener; public class OpenClassAction extends Action implements IAction { private final String className; private final SymbolIndex index; public OpenClassAction(String className, SymbolIndex index) { super(TestUnitMessages.getString("OpenEditor.action.label")); this.className = className; this.index = index; } public void run() { Set locations = index.find(new ClassSymbol(className)); if (locations.size() == 1) { Location location = (Location) locations.iterator().next(); new PositionBasedEditorOpener(location.getFilename(), location.getPosition()).open(); } else { System.out.println("Too many locations"); // DSC temporary } } } Index: FailureTab.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/views/FailureTab.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FailureTab.java 1 Oct 2005 23:10:52 -0000 1.5 --- FailureTab.java 13 Oct 2005 01:00:27 -0000 1.6 *************** *** 37,40 **** --- 37,42 ---- import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; + import org.rubypeople.rdt.core.RubyCore; + import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; import org.rubypeople.rdt.testunit.ITestRunListener; *************** *** 150,160 **** String methodName = getMethodName(); if (className != null) { ! // TODO Add back the actions! ! //manager.add(new OpenTestAction(fRunnerViewPart, className, ! // methodName)); manager.add(new Separator()); ! manager.add(new RerunAction(fRunnerViewPart, getSelectedTestId(), className, methodName, ILaunchManager.RUN_MODE)); ! manager.add(new RerunAction(fRunnerViewPart, getSelectedTestId(), className, methodName, ILaunchManager.DEBUG_MODE)); manager.add(new Separator()); //manager.add(new CopyFailureListAction(fRunnerViewPart, // FailureTab.this, fClipboard)); --- 152,163 ---- String methodName = getMethodName(); if (className != null) { ! manager.add(new OpenClassAction(className, getSymbolIndex())); manager.add(new Separator()); ! manager.add(new RerunAction(fRunnerViewPart, getSelectedTestId(), ! className, methodName, ILaunchManager.RUN_MODE)); ! manager.add(new RerunAction(fRunnerViewPart, getSelectedTestId(), ! className, methodName, ILaunchManager.DEBUG_MODE)); manager.add(new Separator()); + // TODO Add back the actions! //manager.add(new CopyFailureListAction(fRunnerViewPart, // FailureTab.this, fClipboard)); *************** *** 163,166 **** --- 166,173 ---- } + private SymbolIndex getSymbolIndex() { + return RubyCore.getPlugin().getSymbolIndex(); + } + private TableItem getSelectedItem() { int index = fTable.getSelectionIndex(); *************** *** 268,274 **** void handleDoubleClick(MouseEvent e) { ! // TODO create the OpenTestAction ! //if (fTable.getSelectionCount() > 0) new OpenTestAction(fRunnerViewPart, ! // getClassName(), getMethodName()).run(); } --- 275,280 ---- void handleDoubleClick(MouseEvent e) { ! if (fTable.getSelectionCount() > 0) ! new OpenClassAction(getClassName(), getSymbolIndex()).run(); } |