|
Lines 30-43
import org.eclipse.jubula.client.core.utils.DatabaseStateDispatcher;
Link Here
|
| 30 |
import org.eclipse.jubula.client.core.utils.DatabaseStateEvent; |
30 |
import org.eclipse.jubula.client.core.utils.DatabaseStateEvent; |
| 31 |
import org.eclipse.jubula.client.core.utils.IDatabaseStateListener; |
31 |
import org.eclipse.jubula.client.core.utils.IDatabaseStateListener; |
| 32 |
import org.eclipse.jubula.client.ui.constants.CommandIDs; |
32 |
import org.eclipse.jubula.client.ui.constants.CommandIDs; |
|
|
33 |
import org.eclipse.jubula.client.ui.constants.Constants; |
| 34 |
import org.eclipse.jubula.client.ui.editors.TestResultViewer; |
| 33 |
import org.eclipse.jubula.client.ui.handlers.project.AbstractSelectDatabaseHandler; |
35 |
import org.eclipse.jubula.client.ui.handlers.project.AbstractSelectDatabaseHandler; |
| 34 |
import org.eclipse.jubula.client.ui.rcp.Plugin; |
36 |
import org.eclipse.jubula.client.ui.rcp.Plugin; |
| 35 |
import org.eclipse.jubula.client.ui.rcp.businessprocess.ProjectUIBP; |
37 |
import org.eclipse.jubula.client.ui.rcp.businessprocess.ProjectUIBP; |
| 36 |
import org.eclipse.jubula.client.ui.rcp.constants.RCPCommandIDs; |
38 |
import org.eclipse.jubula.client.ui.rcp.constants.RCPCommandIDs; |
|
|
39 |
import org.eclipse.jubula.client.ui.rcp.controllers.TestResultPartsTracker; |
| 40 |
import org.eclipse.jubula.client.ui.rcp.views.TestResultTreeView; |
| 37 |
import org.eclipse.jubula.client.ui.utils.CommandHelper; |
41 |
import org.eclipse.jubula.client.ui.utils.CommandHelper; |
| 38 |
import org.eclipse.jubula.client.ui.utils.JobUtils; |
42 |
import org.eclipse.jubula.client.ui.utils.JobUtils; |
| 39 |
import org.eclipse.jubula.tools.constants.StringConstants; |
43 |
import org.eclipse.jubula.tools.constants.StringConstants; |
| 40 |
import org.eclipse.swt.graphics.Image; |
44 |
import org.eclipse.swt.graphics.Image; |
|
|
45 |
import org.eclipse.ui.IEditorPart; |
| 46 |
import org.eclipse.ui.IPartListener; |
| 47 |
import org.eclipse.ui.IPerspectiveDescriptor; |
| 48 |
import org.eclipse.ui.IViewPart; |
| 49 |
import org.eclipse.ui.IViewReference; |
| 41 |
import org.eclipse.ui.IWorkbenchPage; |
50 |
import org.eclipse.ui.IWorkbenchPage; |
| 42 |
import org.eclipse.ui.IWorkbenchPart; |
51 |
import org.eclipse.ui.IWorkbenchPart; |
| 43 |
import org.eclipse.ui.IWorkbenchWindow; |
52 |
import org.eclipse.ui.IWorkbenchWindow; |
|
Lines 47-52
import org.eclipse.ui.application.ActionBarAdvisor;
Link Here
|
| 47 |
import org.eclipse.ui.application.IActionBarConfigurer; |
56 |
import org.eclipse.ui.application.IActionBarConfigurer; |
| 48 |
import org.eclipse.ui.application.IWorkbenchWindowConfigurer; |
57 |
import org.eclipse.ui.application.IWorkbenchWindowConfigurer; |
| 49 |
import org.eclipse.ui.application.WorkbenchWindowAdvisor; |
58 |
import org.eclipse.ui.application.WorkbenchWindowAdvisor; |
|
|
59 |
import org.eclipse.ui.part.ViewPart; |
| 50 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
60 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
| 51 |
|
61 |
|
| 52 |
|
62 |
|
|
Lines 59-65
public class JubulaWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
Link Here
|
| 59 |
* the delay used to schedule the auto logon job |
69 |
* the delay used to schedule the auto logon job |
| 60 |
*/ |
70 |
*/ |
| 61 |
private static final int AUTO_LOGON_JOB_SCHEDULE_DELAY = 1000; |
71 |
private static final int AUTO_LOGON_JOB_SCHEDULE_DELAY = 1000; |
| 62 |
|
72 |
|
| 63 |
/** |
73 |
/** |
| 64 |
* all basic action sets that should be hidden when running Jubula as |
74 |
* all basic action sets that should be hidden when running Jubula as |
| 65 |
* a stand-alone client |
75 |
* a stand-alone client |
|
Lines 71-76
public class JubulaWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
Link Here
|
| 71 |
"org.eclipse.ui.edit.text.actionSet.navigation", //$NON-NLS-1$ |
81 |
"org.eclipse.ui.edit.text.actionSet.navigation", //$NON-NLS-1$ |
| 72 |
"org.eclipse.ui.edit.text.actionSet.annotationNavigation" //$NON-NLS-1$ |
82 |
"org.eclipse.ui.edit.text.actionSet.annotationNavigation" //$NON-NLS-1$ |
| 73 |
}; |
83 |
}; |
|
|
84 |
|
| 85 |
/** |
| 86 |
* the active page of active workbench window |
| 87 |
*/ |
| 88 |
private static IWorkbenchPage actPage; |
| 89 |
|
| 90 |
/** |
| 91 |
* the listener to track parts for viewing test results |
| 92 |
*/ |
| 93 |
private static PartListenerToTrackTRParts trPartslistener; |
| 94 |
|
| 95 |
/** |
| 96 |
* the current perspective descriptor of the active page |
| 97 |
*/ |
| 98 |
private static IPerspectiveDescriptor currPesrpDescriptor; |
| 74 |
|
99 |
|
| 75 |
/** |
100 |
/** |
| 76 |
* the application window title updater |
101 |
* the application window title updater |
|
Lines 78-83
public class JubulaWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
Link Here
|
| 78 |
private ApplicationWindowTitleUpdater m_updater; |
103 |
private ApplicationWindowTitleUpdater m_updater; |
| 79 |
|
104 |
|
| 80 |
/** |
105 |
/** |
|
|
106 |
* sets the value of the current perspective descriptor of the active page |
| 107 |
* @param pDescr the value to set |
| 108 |
*/ |
| 109 |
private static void setCurrentPesrpective(IPerspectiveDescriptor pDescr) { |
| 110 |
currPesrpDescriptor = pDescr; |
| 111 |
} |
| 112 |
|
| 113 |
/** |
| 114 |
*@return the value of the current perspective descriptor of the active page |
| 115 |
*/ |
| 116 |
private static IPerspectiveDescriptor getCurrentPesrpective() { |
| 117 |
return currPesrpDescriptor; |
| 118 |
} |
| 119 |
|
| 120 |
/** |
| 121 |
* @author BREDEX GmbH |
| 122 |
* |
| 123 |
*/ |
| 124 |
private static class PartListenerToTrackTRParts implements IPartListener { |
| 125 |
/** {@inheritDoc} */ |
| 126 |
public void partActivated(IWorkbenchPart part) { |
| 127 |
if (!actPage.getPerspective().equals(getCurrentPesrpective())) { |
| 128 |
TestResultPartsTracker.getInstance().disableGoToButtons(true); |
| 129 |
TestResultPartsTracker.getInstance(). |
| 130 |
setTRTreeViewHiddenStateTo(true); |
| 131 |
setCurrentPesrpective(actPage.getPerspective()); |
| 132 |
} |
| 133 |
if (part instanceof TestResultTreeView) { |
| 134 |
TestResultPartsTracker.getInstance(). |
| 135 |
setTRTreeViewHiddenStateTo(false); |
| 136 |
} |
| 137 |
if (part instanceof IEditorPart) { |
| 138 |
if (part instanceof TestResultViewer) { |
| 139 |
TestResultPartsTracker.getInstance(). |
| 140 |
disableGoToButtons(false); |
| 141 |
} else { |
| 142 |
TestResultPartsTracker.getInstance(). |
| 143 |
disableGoToButtons(true); |
| 144 |
} |
| 145 |
} |
| 146 |
} |
| 147 |
|
| 148 |
/** {@inheritDoc} */ |
| 149 |
public void partOpened(IWorkbenchPart part) { |
| 150 |
if (part instanceof TestResultTreeView) { |
| 151 |
TestResultPartsTracker.getInstance(). |
| 152 |
setTRTreeViewHiddenStateTo(false); |
| 153 |
} else if (part instanceof TestResultViewer) { |
| 154 |
TestResultPartsTracker.getInstance(). |
| 155 |
addTRViewer((TestResultViewer)part); |
| 156 |
} |
| 157 |
} |
| 158 |
|
| 159 |
/** {@inheritDoc} */ |
| 160 |
public void partDeactivated(IWorkbenchPart part) { |
| 161 |
//do nothing |
| 162 |
} |
| 163 |
|
| 164 |
/** {@inheritDoc} */ |
| 165 |
public void partClosed(IWorkbenchPart part) { |
| 166 |
if (part instanceof TestResultTreeView) { |
| 167 |
TestResultPartsTracker.getInstance(). |
| 168 |
setTRTreeViewHiddenStateTo(true); |
| 169 |
} else if (part instanceof TestResultViewer) { |
| 170 |
TestResultPartsTracker.getInstance(). |
| 171 |
removeTRViewer((TestResultViewer)part); |
| 172 |
} |
| 173 |
} |
| 174 |
|
| 175 |
/** {@inheritDoc} */ |
| 176 |
public void partBroughtToTop(IWorkbenchPart part) { |
| 177 |
if (part instanceof TestResultTreeView) { |
| 178 |
TestResultPartsTracker.getInstance(). |
| 179 |
setTRTreeViewHiddenStateTo(false); |
| 180 |
} |
| 181 |
if (!((part instanceof TestResultTreeView) |
| 182 |
|| (part instanceof TestResultViewer))) { |
| 183 |
TestResultPartsTracker.getInstance().getOpenTRViewers(); |
| 184 |
if (part instanceof IViewPart) { |
| 185 |
try { |
| 186 |
IViewPart[] stackedViews = |
| 187 |
actPage.getViewStack((ViewPart)part); |
| 188 |
for (IViewPart iViewPart : stackedViews) { |
| 189 |
if (iViewPart instanceof TestResultTreeView) { |
| 190 |
TestResultPartsTracker.getInstance(). |
| 191 |
setTRTreeViewHiddenStateTo(true); |
| 192 |
} |
| 193 |
} |
| 194 |
} catch (NullPointerException e) { |
| 195 |
//if stack was not jet created (when view is moved to the place where no other views are located) |
| 196 |
} |
| 197 |
} |
| 198 |
} |
| 199 |
} |
| 200 |
} |
| 201 |
|
| 202 |
/** |
| 81 |
* @author BREDEX GmbH |
203 |
* @author BREDEX GmbH |
| 82 |
* @created 09.04.2011 |
204 |
* @created 09.04.2011 |
| 83 |
*/ |
205 |
*/ |
|
Lines 192-198
public class JubulaWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
Link Here
|
| 192 |
} |
314 |
} |
| 193 |
} |
315 |
} |
| 194 |
} |
316 |
} |
| 195 |
|
317 |
|
|
|
318 |
trPartslistener = new PartListenerToTrackTRParts(); |
| 319 |
actPage = PlatformUI.getWorkbench(). |
| 320 |
getActiveWorkbenchWindow().getActivePage(); |
| 321 |
actPage.addPartListener(trPartslistener); |
| 322 |
setCurrentPesrpective(actPage.getPerspective()); |
| 323 |
// addListenerToTrackTRParts(actPage); |
| 324 |
|
| 325 |
handleTestResultTreeViewInitialState(actPage); |
| 326 |
|
| 196 |
AbstractUIPlugin plugin = Activator.getDefault(); |
327 |
AbstractUIPlugin plugin = Activator.getDefault(); |
| 197 |
ImageRegistry imageRegistry = plugin.getImageRegistry(); |
328 |
ImageRegistry imageRegistry = plugin.getImageRegistry(); |
| 198 |
getWindowConfigurer().getWindow().getShell().setImages( |
329 |
getWindowConfigurer().getWindow().getShell().setImages( |
|
Lines 216-221
public class JubulaWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
Link Here
|
| 216 |
} |
347 |
} |
| 217 |
|
348 |
|
| 218 |
/** |
349 |
/** |
|
|
350 |
* @param page the page for which state of Test Result Tree View is tracked and handled |
| 351 |
*/ |
| 352 |
private void handleTestResultTreeViewInitialState(IWorkbenchPage page) { |
| 353 |
for (IViewReference viewRef : page.getViewReferences()) { |
| 354 |
if (viewRef.getId().equals(Constants.TESTRE_ID)) { |
| 355 |
TestResultPartsTracker.getInstance(). |
| 356 |
addTRTreeView((TestResultTreeView)viewRef.getPart(true)); |
| 357 |
TestResultPartsTracker.getInstance(). |
| 358 |
setTRTreeViewHiddenStateTo(true); |
| 359 |
} |
| 360 |
} |
| 361 |
} |
| 362 |
|
| 363 |
/** |
| 219 |
* invoke implicit startup hooks |
364 |
* invoke implicit startup hooks |
| 220 |
*/ |
365 |
*/ |
| 221 |
private void checkAndPerformStartupHooks() { |
366 |
private void checkAndPerformStartupHooks() { |
|
Lines 271-275
public class JubulaWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
Link Here
|
| 271 |
ded.removeProjectLoadedListener(m_updater); |
416 |
ded.removeProjectLoadedListener(m_updater); |
| 272 |
ded.removeDataChangedListener(m_updater); |
417 |
ded.removeDataChangedListener(m_updater); |
| 273 |
DatabaseStateDispatcher.removeDatabaseStateListener(m_updater); |
418 |
DatabaseStateDispatcher.removeDatabaseStateListener(m_updater); |
|
|
419 |
PlatformUI.getWorkbench().getActiveWorkbenchWindow(). |
| 420 |
getActivePage().removePartListener(trPartslistener); |
| 274 |
} |
421 |
} |
| 275 |
} |
422 |
} |