Source:
<code>public void testCloneSingleTrace() { SWTBotMenu cloneMenu = fOriginalViewBot.viewMenu().menu(NEW_CALL_STACK_MENU); cloneMenu.menu(PINNED_TO_PREFIX + fUstTestTrace.getName()).click(); assertOriginalViewTitle(CALL_STACK_VIEW_TITLE); SWTBotView clonedView = fBot.viewByTitle(PINNED_TO_UST_CALL_STACK_VIEW_TITLE); assertEquals("Should not have created a new instance", 1, fBot.editors().size()); clonedView.close(); cloneMenu.menu(PINNED_TO_PREFIX + fUstTestTrace.getName() + " | new instance").click(); assertOriginalViewTitle(CALL_STACK_VIEW_TITLE); clonedView = fBot.viewByTitle("Call Stack <context-switches-ust | 2>"); assertEquals("Should have created a new instance", 2, fBot.editors().size()); SWTBotEditor cloneEditor = fBot.editorByTitle(fUstTestTrace.getName() + " | 2"); TmfTraceManager traceManager = TmfTraceManager.getInstance(); ITmfTrace cloneTrace = traceManager.getActiveTrace(); TmfTimeRange expectedCloneRange = traceManager.getCurrentTraceContext().getWindowRange(); SWTBotUtils.activateEditor(fBot, fUstTestTrace.getName()); fOriginalViewBot.toolbarButton(PIN_VIEW_BUTTON_NAME).click(); ITmfTrace ust = traceManager.getActiveTrace(); updateTimeRange(ust, UST_START + SECOND, UST_START + 2* SECOND); <START> IWorkbenchPart part = fOriginalViewBot.getViewReference().getPart(false); <END> assertTrue(part instanceof AbstractTimeGraphView); AbstractTimeGraphView abstractTimeGraphView = (AbstractTimeGraphView) part; fBot.waitUntil(new PinAndCloneCondition(abstractTimeGraphView, cloneTrace, expectedCloneRange)); cloneEditor.close(); }</code><technical_language>get part cloned view</technical_language>

Target:
public void testCloneSingleTrace() { SWTBotMenu cloneMenu = fOriginalViewBot.viewMenu().menu(NEW_CALL_STACK_MENU); cloneMenu.menu(PINNED_TO_PREFIX + fUstTestTrace.getName()).click(); assertOriginalViewTitle(CALL_STACK_VIEW_TITLE); SWTBotView clonedView = fBot.viewByTitle(PINNED_TO_UST_CALL_STACK_VIEW_TITLE); assertEquals("Should not have created a new instance", 1, fBot.editors().size()); clonedView.close(); cloneMenu.menu(PINNED_TO_PREFIX + fUstTestTrace.getName() + " | new instance").click(); assertOriginalViewTitle(CALL_STACK_VIEW_TITLE); clonedView = fBot.viewByTitle("Call Stack <context-switches-ust | 2>"); assertEquals("Should have created a new instance", 2, fBot.editors().size()); SWTBotEditor cloneEditor = fBot.editorByTitle(fUstTestTrace.getName() + CLONED_TRACE_SUFFIX); TmfTraceManager traceManager = TmfTraceManager.getInstance(); ITmfTrace cloneTrace = traceManager.getActiveTrace(); assertNotNull(cloneTrace); SWTBotUtils.activateEditor(fBot, fUstTestTrace.getName()); fOriginalViewBot.toolbarButton(PIN_VIEW_BUTTON_NAME).click(); ITmfTrace ust = traceManager.getActiveTrace(); TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, RANGE, ust)); SWTBotUtils.activateEditor(fBot, cloneTrace.getName() + CLONED_TRACE_SUFFIX); IWorkbenchPart part = clonedView.getViewReference().getPart(false); assertTrue(part instanceof AbstractTimeGraphView); AbstractTimeGraphView abstractTimeGraphView = (AbstractTimeGraphView) part; fBot.waitUntil(new PinAndCloneCondition(abstractTimeGraphView, cloneTrace, INITIAL_UST_RANGE)); cloneEditor.close(); }