|
From: David C. <dc...@us...> - 2005-11-19 20:23:37
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/views In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22241/src/org/rubypeople/rdt/testunit/views Modified Files: TestHierarchyTab.java FailureTab.java OpenSymbolAction.java Log Message: Introduce ISymbolFinder, and change SymbolIndex clients accordingly. Index: FailureTab.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/views/FailureTab.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FailureTab.java 18 Nov 2005 22:46:09 -0000 1.8 --- FailureTab.java 19 Nov 2005 20:23:30 -0000 1.9 *************** *** 39,43 **** 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; --- 39,43 ---- import org.eclipse.swt.widgets.TableItem; import org.rubypeople.rdt.core.RubyCore; ! import org.rubypeople.rdt.internal.core.symbols.ISymbolFinder; import org.rubypeople.rdt.testunit.ITestRunListener; *************** *** 152,156 **** String methodName = getMethodName(); if (className != null) { ! manager.add(OpenSymbolAction.forClass(className, getSymbolIndex(), getShell())); manager.add(new Separator()); manager.add(new RerunAction(fRunnerViewPart, getSelectedTestId(), --- 152,156 ---- String methodName = getMethodName(); if (className != null) { ! manager.add(OpenSymbolAction.forClass(className, getSymbolFinder(), getShell())); manager.add(new Separator()); manager.add(new RerunAction(fRunnerViewPart, getSelectedTestId(), *************** *** 166,171 **** } ! private SymbolIndex getSymbolIndex() { ! return RubyCore.getPlugin().getSymbolIndex(); } --- 166,171 ---- } ! private ISymbolFinder getSymbolFinder() { ! return RubyCore.getPlugin().getSymbolFinder(); } *************** *** 276,280 **** void handleDoubleClick(MouseEvent e) { if (fTable.getSelectionCount() > 0) ! OpenSymbolAction.forClass(getClassName(), getSymbolIndex(), getShell()).run(); } --- 276,280 ---- void handleDoubleClick(MouseEvent e) { if (fTable.getSelectionCount() > 0) ! OpenSymbolAction.forClass(getClassName(), getSymbolFinder(), getShell()).run(); } Index: TestHierarchyTab.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/views/TestHierarchyTab.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TestHierarchyTab.java 18 Nov 2005 22:46:09 -0000 1.4 --- TestHierarchyTab.java 19 Nov 2005 20:23:30 -0000 1.5 *************** *** 47,51 **** import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.internal.core.symbols.ClassSymbol; ! import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; import org.rubypeople.rdt.testunit.ITestRunListener; --- 47,51 ---- import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.internal.core.symbols.ClassSymbol; ! import org.rubypeople.rdt.internal.core.symbols.ISymbolFinder; import org.rubypeople.rdt.testunit.ITestRunListener; *************** *** 416,424 **** Shell shell = fTree.getShell(); ! SymbolIndex index = RubyCore.getPlugin().getSymbolIndex(); if (isSuiteSelected()) ! action= OpenSymbolAction.forClass(getClassName(), index, shell); else ! action= OpenSymbolAction.forMethod(getClassName(), getTestMethod(), index, shell); if (action != null && action.isEnabled()) --- 416,424 ---- Shell shell = fTree.getShell(); ! ISymbolFinder finder = RubyCore.getPlugin().getSymbolFinder(); if (isSuiteSelected()) ! action= OpenSymbolAction.forClass(getClassName(), finder, shell); else ! action= OpenSymbolAction.forMethod(getClassName(), getTestMethod(), finder, shell); if (action != null && action.isEnabled()) *************** *** 432,438 **** String testLabel = testInfo.getTestName(); Shell shell = fTree.getShell(); ! SymbolIndex symbolIndex = RubyCore.getPlugin().getSymbolIndex(); if (isSuiteSelected()) { ! manager.add(OpenSymbolAction.forClass(getClassName(), symbolIndex, shell)); manager.add(new Separator()); if (testClassExists(getClassName()) && !fTestRunnerPart.lastLaunchIsKeptAlive()) { --- 432,438 ---- String testLabel = testInfo.getTestName(); Shell shell = fTree.getShell(); ! ISymbolFinder symbolFinder = RubyCore.getPlugin().getSymbolFinder(); if (isSuiteSelected()) { ! manager.add(OpenSymbolAction.forClass(getClassName(), symbolFinder, shell)); manager.add(new Separator()); if (testClassExists(getClassName()) && !fTestRunnerPart.lastLaunchIsKeptAlive()) { *************** *** 442,446 **** } else { manager.add(OpenSymbolAction.forMethod(getClassName(), ! getTestMethod(), symbolIndex, shell)); manager.add(new Separator()); manager.add(new RerunAction(fTestRunnerPart, getSelectedTestId(), getClassName(), getTestMethod(), ILaunchManager.RUN_MODE)); --- 442,446 ---- } else { manager.add(OpenSymbolAction.forMethod(getClassName(), ! getTestMethod(), symbolFinder, shell)); manager.add(new Separator()); manager.add(new RerunAction(fTestRunnerPart, getSelectedTestId(), getClassName(), getTestMethod(), ILaunchManager.RUN_MODE)); *************** *** 453,457 **** private boolean testClassExists(String className) { ! return RubyCore.getPlugin().getSymbolIndex().find(new ClassSymbol(className)).size() > 0; } --- 453,457 ---- private boolean testClassExists(String className) { ! return RubyCore.getPlugin().getSymbolFinder().find(new ClassSymbol(className)).size() > 0; } Index: OpenSymbolAction.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/views/OpenSymbolAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OpenSymbolAction.java 18 Nov 2005 22:46:09 -0000 1.1 --- OpenSymbolAction.java 19 Nov 2005 20:23:30 -0000 1.2 *************** *** 12,19 **** import org.eclipse.swt.widgets.Shell; import org.rubypeople.rdt.internal.core.symbols.ClassSymbol; import org.rubypeople.rdt.internal.core.symbols.Location; import org.rubypeople.rdt.internal.core.symbols.MethodSymbol; import org.rubypeople.rdt.internal.core.symbols.Symbol; - import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; import org.rubypeople.rdt.internal.ui.RubyPluginImages; import org.rubypeople.rdt.internal.ui.dialogs.ElementListSelectionDialog; --- 12,19 ---- import org.eclipse.swt.widgets.Shell; import org.rubypeople.rdt.internal.core.symbols.ClassSymbol; + import org.rubypeople.rdt.internal.core.symbols.ISymbolFinder; import org.rubypeople.rdt.internal.core.symbols.Location; import org.rubypeople.rdt.internal.core.symbols.MethodSymbol; import org.rubypeople.rdt.internal.core.symbols.Symbol; import org.rubypeople.rdt.internal.ui.RubyPluginImages; import org.rubypeople.rdt.internal.ui.dialogs.ElementListSelectionDialog; *************** *** 24,45 **** private final Symbol symbol; ! private final SymbolIndex index; private final Shell shell; private String dialogTitle; ! public static IAction forClass(String className, SymbolIndex index, Shell shell) { ! return new OpenSymbolAction(new ClassSymbol(className), index, shell, "Open Class"); } public static IAction forMethod(String className, String testMethod, ! SymbolIndex index, Shell shell) { ! return new OpenSymbolAction(new MethodSymbol(className, testMethod), index, shell, "Open Method"); } ! public OpenSymbolAction(Symbol symbol, SymbolIndex index, Shell shell, String title) { super(TestUnitMessages.getString("OpenEditor.action.label")); this.shell = shell; this.symbol = symbol; ! this.index = index; this.dialogTitle = title; } --- 24,45 ---- private final Symbol symbol; ! private final ISymbolFinder finder; private final Shell shell; private String dialogTitle; ! public static IAction forClass(String className, ISymbolFinder finder, Shell shell) { ! return new OpenSymbolAction(new ClassSymbol(className), finder, shell, "Open Class"); } public static IAction forMethod(String className, String testMethod, ! ISymbolFinder finder, Shell shell) { ! return new OpenSymbolAction(new MethodSymbol(className, testMethod), finder, shell, "Open Method"); } ! public OpenSymbolAction(Symbol symbol, ISymbolFinder finder, Shell shell, String title) { super(TestUnitMessages.getString("OpenEditor.action.label")); this.shell = shell; this.symbol = symbol; ! this.finder = finder; this.dialogTitle = title; } *************** *** 47,51 **** public void run() { ! Set locations = index.find(symbol); if (locations.size() == 0) return; --- 47,51 ---- public void run() { ! Set locations = finder.find(symbol); if (locations.size() == 0) return; |