Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 239343 Details for
Bug 417829
Next/previous error buttons for test result view are only present when view has focus
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch for Bug 417829
417829_goToErrorButtons.patch (text/plain), 60.45 KB, created by
Maissmaallsmyss Maulhs-Vvuillss
on 2014-01-27 08:02:42 EST
(
hide
)
Description:
patch for Bug 417829
Filename:
MIME Type:
Creator:
Maissmaallsmyss Maulhs-Vvuillss
Created:
2014-01-27 08:02:42 EST
Size:
60.45 KB
patch
obsolete
>diff --git a/org.eclipse.jubula.app/src/org/eclipse/jubula/app/core/JubulaWorkbenchAdvisor.java b/org.eclipse.jubula.app/src/org/eclipse/jubula/app/core/JubulaWorkbenchAdvisor.java >index f6820d3..2e7362d 100644 >--- a/org.eclipse.jubula.app/src/org/eclipse/jubula/app/core/JubulaWorkbenchAdvisor.java >+++ b/org.eclipse.jubula.app/src/org/eclipse/jubula/app/core/JubulaWorkbenchAdvisor.java >@@ -28,7 +28,8 @@ import org.eclipse.jubula.app.i18n.Messages; > import org.eclipse.jubula.client.core.businessprocess.progress.OperationCanceledUtil; > import org.eclipse.jubula.client.ui.constants.Constants; > import org.eclipse.jubula.client.ui.rcp.Plugin; >-import org.eclipse.jubula.client.ui.rcp.Plugin.ClientStatus; >+import org.eclipse.jubula.client.ui.rcp.events.GuiEventDispatcher; >+import org.eclipse.jubula.client.ui.rcp.events.GuiEventDispatcher.ClientStatus; > import org.eclipse.jubula.client.ui.utils.ErrorHandlingUtil; > import org.eclipse.jubula.tools.constants.StringConstants; > import org.eclipse.jubula.tools.exception.JBFatalException; >@@ -371,8 +372,9 @@ public class JubulaWorkbenchAdvisor extends WorkbenchAdvisor { > * {@inheritDoc} > */ > public boolean preShutdown() { >- try { >- Plugin.getDefault().setClientStatus(ClientStatus.STOPPING); >+ try { >+ GuiEventDispatcher.getInstance().fireClientStatusChanged( >+ ClientStatus.STOPPING); > // Close all open editors > IWorkbenchWindow[] allWW = PlatformUI.getWorkbench() > .getWorkbenchWindows(); >diff --git a/org.eclipse.jubula.client.alm.mylyn.ui.bridge/src/org/eclipse/jubula/client/alm/mylyn/ui/bridge/monitor/EditorInteractionMonitor.java b/org.eclipse.jubula.client.alm.mylyn.ui.bridge/src/org/eclipse/jubula/client/alm/mylyn/ui/bridge/monitor/EditorInteractionMonitor.java >index f7de4c7..1da14f3 100644 >--- a/org.eclipse.jubula.client.alm.mylyn.ui.bridge/src/org/eclipse/jubula/client/alm/mylyn/ui/bridge/monitor/EditorInteractionMonitor.java >+++ b/org.eclipse.jubula.client.alm.mylyn.ui.bridge/src/org/eclipse/jubula/client/alm/mylyn/ui/bridge/monitor/EditorInteractionMonitor.java >@@ -16,13 +16,12 @@ import org.eclipse.jubula.client.alm.mylyn.ui.bridge.constants.ContentType; > import org.eclipse.jubula.client.core.model.IAUTMainPO; > import org.eclipse.jubula.client.core.model.INodePO; > import org.eclipse.jubula.client.core.model.IPersistentObject; >-import org.eclipse.jubula.client.ui.rcp.Plugin; >-import org.eclipse.jubula.client.ui.rcp.Plugin.ClientStatus; > import org.eclipse.jubula.client.ui.rcp.editors.AbstractJBEditor; > import org.eclipse.jubula.client.ui.rcp.editors.CentralTestDataEditor; > import org.eclipse.jubula.client.ui.rcp.editors.IJBEditor; > import org.eclipse.jubula.client.ui.rcp.editors.ObjectMappingMultiPageEditor; > import org.eclipse.jubula.client.ui.rcp.editors.PersistableEditorInput; >+import org.eclipse.jubula.client.ui.rcp.events.GuiEventDispatcher.ClientStatus; > import org.eclipse.mylyn.context.core.AbstractContextStructureBridge; > import org.eclipse.mylyn.context.core.ContextCore; > import org.eclipse.mylyn.context.core.IInteractionContext; >@@ -46,6 +45,10 @@ public class EditorInteractionMonitor extends AbstractEditorTracker { > * <code>CDTE_HANDLE</code> > */ > private static final String CDTE_HANDLE = "00000000000000000000000000000005"; //$NON-NLS-1$ >+ /** >+ * the status >+ */ >+ private ClientStatus m_status; > > /** {@inheritDoc} */ > protected void editorBroughtToTop(IEditorPart part) { >@@ -54,7 +57,7 @@ public class EditorInteractionMonitor extends AbstractEditorTracker { > > /** {@inheritDoc} */ > protected void editorClosed(IEditorPart part) { >- if (Plugin.getDefault().getClientStatus() == ClientStatus.STOPPING >+ if (m_status == ClientStatus.STOPPING > || TasksUi.getTaskActivityManager().getActiveTask() == null) { > return; > } >@@ -155,4 +158,9 @@ public class EditorInteractionMonitor extends AbstractEditorTracker { > return new InteractionEvent(InteractionEvent.Kind.SELECTION, > ContentType.OM_EDITOR, id, id); > } >+ >+ /** {@inheritDoc} */ >+ public void handleClientStateChanged(ClientStatus status) { >+ m_status = status; >+ } > } >diff --git a/org.eclipse.jubula.client.ui.rcp/plugin.xml b/org.eclipse.jubula.client.ui.rcp/plugin.xml >index 41f33bf..5d5aeb0 100644 >--- a/org.eclipse.jubula.client.ui.rcp/plugin.xml >+++ b/org.eclipse.jubula.client.ui.rcp/plugin.xml >@@ -2839,23 +2839,35 @@ > class="org.eclipse.jubula.client.ui.rcp.handlers.GoToNextTestResultErrorHandler" > commandId="org.eclipse.jubula.client.ui.commands.GoToNextError"> > <activeWhen> >- <with >- variable="activePartId"> >- <equals >- value="org.eclipse.jubula.client.ui.rcp.views.TestResultTreeView"> >- </equals> >- </with></activeWhen> >+ <or> >+ <with >+ variable="activePartId"> >+ <equals >+ value="org.eclipse.jubula.client.ui.rcp.views.TestResultTreeView"> >+ </equals> >+ </with> >+ <reference >+ definitionId="org.eclipse.jubula.client.ui.reference.distinct.activeWhen.TRTreeViewIsNotHidden"> >+ </reference> >+ </or> >+ </activeWhen> > </handler> > <handler > class="org.eclipse.jubula.client.ui.rcp.handlers.GoToPreviousTestResultErrorHandler" > commandId="org.eclipse.jubula.client.ui.commands.GoToPreviousError"> > <activeWhen> >- <with >- variable="activePartId"> >- <equals >- value="org.eclipse.jubula.client.ui.rcp.views.TestResultTreeView"> >- </equals> >- </with></activeWhen> >+ <or> >+ <with >+ variable="activePartId"> >+ <equals >+ value="org.eclipse.jubula.client.ui.rcp.views.TestResultTreeView"> >+ </equals> >+ </with> >+ <reference >+ definitionId="org.eclipse.jubula.client.ui.reference.distinct.activeWhen.TRTreeViewIsNotHidden"> >+ </reference> >+ </or> >+ </activeWhen> > </handler> > </extension> > <extension point="org.eclipse.ui.commandImages"> >@@ -3919,6 +3931,26 @@ > priorityLevel="workbench" /> > </sourceProvider> > <sourceProvider >+ provider="org.eclipse.jubula.client.ui.rcp.sourceprovider.TestResultSourceProvider"> >+ <variable >+ name="org.eclipse.jubula.client.ui.rcp.variable.isPartToViewTestResultOpen" >+ priorityLevel="workbench" /> >+ <variable >+ name="org.eclipse.jubula.client.ui.rcp.variable.isTRTreeViewHidden" >+ priorityLevel="workbench" /> >+ <!-- currently it is impossible easy to check if the part (view/editor) >+ was hidden by other editor, because no list of stacked editors exist (only of staked views); >+ state of TestResultViewer is regarded as "may be hidden" when (this behaviour is defined >+ in methods of PartListenerToTrackTRParts and other methods of TestResultPartsTracker): >+ - editor other then TestResultViewer was activated ; >+ - on Perspective change; >+ - when TestResultViewer was closed; >+ --> >+ <variable >+ name="org.eclipse.jubula.client.ui.variable.mayTestResultViewerBeHidden" >+ priorityLevel="workbench" /> >+ </sourceProvider> >+ <sourceProvider > provider="org.eclipse.jubula.client.ui.rcp.sourceprovider.TestExecutionSourceProvider"> > <variable > name="org.eclipse.jubula.client.ui.rcp.variable.isTestRunning" >@@ -4063,37 +4095,48 @@ > id="org.eclipse.jubula.client.ui.reference.distinct.visibleWhen.TestResultToolbar"> > <or> > <with >- variable="activeEditorId"> >+ variable="org.eclipse.jubula.client.ui.rcp.variable.isPartToViewTestResultOpen"> > <equals >- value="org.eclipse.jubula.client.ui.editors.TestResultViewer"> >- </equals> >- </with> >- <with >- variable="activePartId"> >- <equals >- value="org.eclipse.jubula.client.ui.rcp.views.TestResultTreeView"> >+ value="true"> > </equals> > </with> > </or> > </definition> > <definition > id="org.eclipse.jubula.client.ui.reference.distinct.activeWhen.GoToTestResultError"> >- <and> >+ <and> >+ <with >+ variable="activeEditorId"> >+ <equals >+ value="org.eclipse.jubula.client.ui.editors.TestResultViewer"> >+ </equals> >+ </with> >+ <not> >+ <with >+ variable="activePartId"> >+ <equals >+ value="org.eclipse.jubula.client.ui.rcp.views.TestResultTreeView"> >+ </equals> >+ </with> >+ </not> >+ <not> >+ <with >+ variable="org.eclipse.jubula.client.ui.variable.mayTestResultViewerBeHidden"> >+ <equals >+ value="true"> >+ </equals> >+ </with> >+ </not> >+ </and> >+ </definition> >+ <definition >+ id="org.eclipse.jubula.client.ui.reference.distinct.activeWhen.TRTreeViewIsNotHidden"> > <with >- variable="activeEditorId"> >+ variable="org.eclipse.jubula.client.ui.rcp.variable.isTRTreeViewHidden"> > <equals >- value="org.eclipse.jubula.client.ui.editors.TestResultViewer"> >+ value="false"> > </equals> > </with> >- <not> >- <with >- variable="activePartId"> >- <equals >- value="org.eclipse.jubula.client.ui.rcp.views.TestResultTreeView"> >- </equals> >- </with> >- </not> >- </and> > </definition> > </extension> > </plugin> >diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/Plugin.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/Plugin.java >index b3816f1..3d295b7 100644 >--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/Plugin.java >+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/Plugin.java >@@ -15,12 +15,17 @@ import java.util.ArrayList; > import java.util.HashMap; > import java.util.List; > import java.util.Map; >+import java.util.concurrent.atomic.AtomicReference; > > import javax.persistence.PersistenceException; > > import org.apache.commons.lang.Validate; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.core.runtime.preferences.InstanceScope; > import org.eclipse.jface.action.IStatusLineManager; > import org.eclipse.jface.action.StatusLineManager; >@@ -48,16 +53,20 @@ import org.eclipse.jubula.client.ui.rcp.businessprocess.ProblemsBP; > import org.eclipse.jubula.client.ui.rcp.businessprocess.ToolkitBP; > import org.eclipse.jubula.client.ui.rcp.businessprocess.WorkingLanguageBP; > import org.eclipse.jubula.client.ui.rcp.controllers.TestExecutionContributor; >+import org.eclipse.jubula.client.ui.rcp.controllers.TestResultPartsTracker; > import org.eclipse.jubula.client.ui.rcp.editors.AbstractJBEditor; > import org.eclipse.jubula.client.ui.rcp.editors.AbstractTestCaseEditor; > import org.eclipse.jubula.client.ui.rcp.editors.IJBEditor; > import org.eclipse.jubula.client.ui.rcp.editors.TestJobEditor; >+import org.eclipse.jubula.client.ui.rcp.events.GuiEventDispatcher; >+import org.eclipse.jubula.client.ui.rcp.events.GuiEventDispatcher.ClientStatus; > import org.eclipse.jubula.client.ui.rcp.i18n.Messages; > import org.eclipse.jubula.client.ui.rcp.provider.contentprovider.DirtyStarListContentProvider; > import org.eclipse.jubula.client.ui.rcp.provider.labelprovider.DirtyStarListLabelProvider; > import org.eclipse.jubula.client.ui.rcp.search.query.AbstractQuery; > import org.eclipse.jubula.client.ui.rcp.widgets.StatusLineContributionItem; > import org.eclipse.jubula.client.ui.utils.ErrorHandlingUtil; >+import org.eclipse.jubula.client.ui.utils.JobUtils; > import org.eclipse.jubula.client.ui.views.IJBPart; > import org.eclipse.jubula.tools.constants.StringConstants; > import org.eclipse.jubula.tools.exception.JBException; >@@ -65,6 +74,7 @@ import org.eclipse.jubula.tools.exception.JBFatalException; > import org.eclipse.jubula.tools.exception.JBRuntimeException; > import org.eclipse.jubula.tools.i18n.CompSystemI18n; > import org.eclipse.jubula.tools.messagehandling.MessageIDs; >+import org.eclipse.jubula.tools.utils.TimeUtil; > import org.eclipse.osgi.util.NLS; > import org.eclipse.search.ui.IQueryListener; > import org.eclipse.search.ui.ISearchQuery; >@@ -141,8 +151,6 @@ public class Plugin extends AbstractUIPlugin implements IProgressConsole { > private static final String AUT_TOOLKIT_STATUSLINE_ITEM = "autToolKitInfo"; //$NON-NLS-1$ > /** <code>LANG_STATUSLINE_ITEM</code> */ > private static final String LANG_STATUSLINE_ITEM = "lang"; //$NON-NLS-1$ >- /** the client status */ >- private ClientStatus m_status = ClientStatus.STARTING; > /** the preference store for this bundle */ > private ScopedPreferenceStore m_preferenceStore = null; > /** the console */ >@@ -171,43 +179,11 @@ public class Plugin extends AbstractUIPlugin implements IProgressConsole { > } > > /** >- * The Client Status >- */ >- public enum ClientStatus { >- /** >- * Jubula is launched completely >- */ >- RUNNING, >- /** >- * Jubula is starting up >- */ >- STARTING, >- /** >- * Jubula is shutting down >- */ >- STOPPING >- } >- >- /** >- * >- * @param statust - the new ClientStatus (RUNNING,STOPPING,STARTING) >- */ >- public void setClientStatus(ClientStatus statust) { >- m_status = statust; >- } >- >- /** >- * >- * @return the actual ClientStatus (RUNNING,STARTING,STOPPING) >- */ >- public ClientStatus getClientStatus() { >- return m_status; >- } >- >- /** > * {@inheritDoc} > */ > public void stop(BundleContext context) throws Exception { >+ GuiEventDispatcher.getInstance(). >+ removeClientStatusListener(TestResultPartsTracker.getInstance()); > super.stop(context); > } > >@@ -1056,6 +1032,8 @@ public class Plugin extends AbstractUIPlugin implements IProgressConsole { > * - ComponentNamesListBP > */ > private void registerPermanentServices() { >+ registerWorkbenchStartupListenerJob(); >+ > // register problem view listeners > ProblemsBP.getInstance(); > >@@ -1086,6 +1064,47 @@ public class Plugin extends AbstractUIPlugin implements IProgressConsole { > > // register service for toolkit > ToolkitBP.getInstance(); >+ >+ // setup view tracker >+ TestResultPartsTracker.getInstance(); >+ } >+ >+ /** >+ * setup the test result viewer tracker >+ */ >+ private void registerWorkbenchStartupListenerJob() { >+ JobUtils.executeJob(new Job(Messages.RegisterWorkbenchStartupListener) { >+ @Override >+ protected IStatus run(IProgressMonitor monitor) { >+ monitor.beginTask(Messages.WorkbenchStartupListenerIsRegistring, >+ IProgressMonitor.UNKNOWN); >+ final AtomicReference<Object> ref = >+ new AtomicReference<Object>(); >+ ref.set(null); >+ Display defaultDisplay = Display.getDefault(); >+ while (ref.get() == null) { >+ if (monitor.isCanceled()) { >+ break; >+ } >+ TimeUtil.delay(1000); >+ defaultDisplay.syncExec(new Runnable() { >+ public void run() { >+ // important! >+ ref.set(Plugin.getActivePage()); >+ } >+ }); >+ } >+ monitor.done(); >+ defaultDisplay.syncExec(new Runnable() { >+ public void run() { >+ GuiEventDispatcher.getInstance() >+ .fireClientStatusChanged( >+ ClientStatus.RUNNING); >+ } >+ }); >+ return Status.OK_STATUS; >+ } >+ }, null, 1000); > } > > /** >diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/TestResultPartsTracker.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/TestResultPartsTracker.java >new file mode 100644 >index 0000000..af3aa28 >--- /dev/null >+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/TestResultPartsTracker.java >@@ -0,0 +1,383 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2012 BREDEX GmbH. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * BREDEX GmbH - initial API and implementation and/or initial documentation >+ *******************************************************************************/ >+package org.eclipse.jubula.client.ui.rcp.controllers; >+ >+import java.util.ArrayList; >+import java.util.LinkedList; >+import java.util.List; >+import org.eclipse.jubula.client.ui.constants.Constants; >+import org.eclipse.jubula.client.ui.editors.TestResultViewer; >+import org.eclipse.jubula.client.ui.rcp.Plugin; >+import org.eclipse.jubula.client.ui.rcp.events.GuiEventDispatcher; >+import org.eclipse.jubula.client.ui.rcp.events.GuiEventDispatcher.ClientStatus; >+import org.eclipse.jubula.client.ui.rcp.events.GuiEventDispatcher.IClientStatusListener; >+import org.eclipse.jubula.client.ui.rcp.sourceprovider.TestResultSourceProvider; >+import org.eclipse.jubula.client.ui.rcp.views.TestResultTreeView; >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.IPartListener; >+import org.eclipse.ui.IPerspectiveDescriptor; >+import org.eclipse.ui.IViewPart; >+import org.eclipse.ui.IViewReference; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.part.ViewPart; >+import org.eclipse.ui.part.WorkbenchPart; >+ >+/** >+ * @author BREDEX GmbH >+ */ >+public class TestResultPartsTracker implements IClientStatusListener { >+ >+ /** >+ * the current perspective descriptor of the active page >+ */ >+ private static IPerspectiveDescriptor currPesrpDescriptor; >+ >+ /** >+ * singleton instance >+ */ >+ private static TestResultPartsTracker instance = null; >+ >+ /** >+ * the list of open test result viewers >+ */ >+ private List<TestResultViewer> m_trViewers = >+ new ArrayList<TestResultViewer>(); >+ >+ /** >+ * state is false is Test Result Tree View is hidden >+ * the value of this member is used to define if GoToNext/Previous Error Buttons should be disabled >+ * currently it is impossible easy to check if the part (view/editor) >+ * was hidden by other editor, because no list of stacked editors exist (only of staked views); >+ * state of TestResultViewer is regarded as "may be hidden" when (this behaviour is defined >+ * in methods of PartListenerToTrackTRParts and other methods of TestResultPartsTracker): >+ * - editor other then TestResultViewer was activated ; >+ * - on Perspective change; >+ * - when TestResultViewer was closed; >+ */ >+ private boolean m_isTRTreeViewHidden = true; >+ >+ /** >+ *it is not currently tracked if the TestResultViewer >+ *is hidden or visible, and when it might be hidden >+ *GoToErrorButtons should be disabled >+ */ >+ private boolean m_trViewerMayBeHidden = true; >+ >+ /** >+ * the ordered by activation time list of open test result viewers and test result view >+ */ >+ private List<WorkbenchPart> m_trParts = >+ new LinkedList<WorkbenchPart>(); >+ >+ /** >+ * the test result tree view >+ */ >+ private TestResultTreeView m_trTreeView = null; >+ >+ /** >+ * the source provider >+ */ >+ private TestResultSourceProvider m_provider = null; >+ >+ >+ /** >+ * private Constructor >+ */ >+ private TestResultPartsTracker() { >+ GuiEventDispatcher.getInstance() >+ .addClientStatusListener(this); >+ } >+ >+ /** >+ * sets the value of the current perspective descriptor of the active page >+ * @param pDescr the value to set >+ */ >+ private static void setCurrentPesrpective(IPerspectiveDescriptor pDescr) { >+ currPesrpDescriptor = pDescr; >+ } >+ >+ /** >+ *@return the value of the current perspective descriptor of the active page >+ */ >+ private static IPerspectiveDescriptor getCurrentPesrpective() { >+ return currPesrpDescriptor; >+ } >+ >+ /** >+ * @param page the page for which state of Test Result Tree View is tracked and handled >+ */ >+ private void handleTestResultTreeViewInitialState(IWorkbenchPage page) { >+ for (IViewReference viewRef : page.getViewReferences()) { >+ if (viewRef.getId().equals(Constants.TESTRE_ID)) { >+ addTRTreeView((TestResultTreeView)viewRef.getPart(true)); >+ setTRTreeViewHiddenStateTo(true); >+ } >+ } >+ } >+ >+ /** >+ * @author BREDEX The PartListener for tracking the state of Parts to view Test Result >+ * (TestResultViewer or TestResultTreeView) >+ */ >+ private class PartListenerToTrackTRParts implements IPartListener { >+ /** {@inheritDoc} */ >+ public void partActivated(IWorkbenchPart part) { >+ handlePerspectiveChange(); >+ if (part instanceof TestResultTreeView) { >+ setTRTreeViewHiddenStateTo(false); >+ } >+ if (part instanceof IEditorPart) { >+ setTRViewerMayBeHiddenStateTo( >+ !(part instanceof TestResultViewer)); >+ } >+ } >+ >+ /** {@inheritDoc} */ >+ public void partOpened(IWorkbenchPart part) { >+ if (partIsTestResultPart(part)) { >+ changeTRPartHiddenStateTo(part, false); >+ if (part instanceof TestResultTreeView) { >+ addTRTreeView((TestResultTreeView)part); >+ } else { >+ addTRViewer((TestResultViewer)part); >+ } >+ } >+ } >+ >+ /** {@inheritDoc} */ >+ public void partDeactivated(IWorkbenchPart part) { >+ //do nothing >+ } >+ >+ /** {@inheritDoc} */ >+ public void partClosed(IWorkbenchPart part) { >+ if (partIsTestResultPart(part)) { >+ if (part instanceof TestResultTreeView) { >+ removeTRTreeView((TestResultTreeView)part); >+ } else { >+ removeTRViewer((TestResultViewer)part); >+ } >+ changeTRPartHiddenStateTo(part, true); >+ } >+ } >+ >+ /** {@inheritDoc} */ >+ public void partBroughtToTop(IWorkbenchPart part) { >+ if (part instanceof TestResultTreeView) { >+ setTRTreeViewHiddenStateTo(false); >+ } >+ if (!((part instanceof TestResultTreeView) >+ || (part instanceof TestResultViewer))) { >+ if (part instanceof IViewPart) { >+ IWorkbenchPage actPage = Plugin.getActivePage(); >+ if (actPage != null) { >+ IViewPart[] stackedViews = >+ actPage.getViewStack((ViewPart)part); >+ for (IViewPart iViewPart : stackedViews) { >+ if (iViewPart instanceof TestResultTreeView) { >+ setTRTreeViewHiddenStateTo(true); >+ } >+ } >+ } >+ } >+ } >+ } >+ >+ /** >+ * @param part the part for which hidden state will be changed >+ * @param state the new value of the part hidden state >+ */ >+ private void changeTRPartHiddenStateTo(IWorkbenchPart part, >+ boolean state) { >+ if (part instanceof TestResultTreeView) { >+ setTRTreeViewHiddenStateTo(state); >+ } else { >+ setTRViewerMayBeHiddenStateTo(state); >+ } >+ } >+ >+ /** >+ * @param part the part to check >+ * @return true if the part is the one to view test results >+ * (TestResultTreeView or TestResultViewer) >+ */ >+ private boolean partIsTestResultPart(IWorkbenchPart part) { >+ return (part instanceof TestResultTreeView) >+ || (part instanceof TestResultViewer); >+ } >+ >+ /** >+ * handle availability of GoToErrorButtons on change of the current perspective >+ */ >+ private void handlePerspectiveChange() { >+ IWorkbenchPage actPage = Plugin.getActivePage(); >+ if (actPage != null) { >+ if (!actPage.getPerspective().equals(getCurrentPesrpective())) { >+ setTRViewerMayBeHiddenStateTo(true); >+ setTRTreeViewHiddenStateTo(true); >+ setCurrentPesrpective(actPage.getPerspective()); >+ } >+ } >+ } >+ >+ >+ } >+ >+ /** >+ * get single instance >+ * >+ * @return single instance of ImportFileBP >+ */ >+ public static TestResultPartsTracker getInstance() { >+ if (instance == null) { >+ instance = new TestResultPartsTracker(); >+ } >+ return instance; >+ } >+ >+ /** >+ * Add a test result viewer to this tracker. >+ * @param testResultViewer The test result viewer to add. >+ */ >+ public void addTRViewer(TestResultViewer testResultViewer) { >+ if (testResultViewer != null) { >+ m_trViewers.add(testResultViewer); >+ m_trParts.add(testResultViewer); >+ m_trViewerMayBeHidden = false; >+ fireStateChanged(); >+ } >+ } >+ >+ /** >+ * Add a test result tree view to this tracker. >+ * @param testResultTreeView The test result tree view to add. >+ */ >+ public void addTRTreeView(TestResultTreeView testResultTreeView) { >+ if (testResultTreeView != null) { >+ m_trTreeView = testResultTreeView; >+ m_trParts.add(testResultTreeView); >+ m_isTRTreeViewHidden = false; >+ fireStateChanged(); >+ } >+ } >+ >+ /** >+ * @param provider the provider to set >+ */ >+ public void setProvider(TestResultSourceProvider provider) { >+ m_provider = provider; >+ } >+ >+ /** >+ * set m_isTRTreeViewHidden to true or false >+ * @param state the state to what of m_isTRTreeViewHidden will be set >+ */ >+ public void setTRTreeViewHiddenStateTo(boolean state) { >+ m_isTRTreeViewHidden = state; >+ fireStateChanged(); >+ } >+ >+ /** >+ * set m_isTRTreeViewHidden to true or false >+ * @param state the state to what of m_isTRTreeViewHidden will be set >+ */ >+ public void setTRViewerMayBeHiddenStateTo(boolean state) { >+ m_trViewerMayBeHidden = state; >+ fireStateChanged(); >+ } >+ >+ /** >+ * @return the currently open instances of the Test Result Viewer editor >+ */ >+ public List<TestResultViewer> getOpenTRViewers() { >+ List<TestResultViewer> trvs = new ArrayList<TestResultViewer>(); >+ for (TestResultViewer trv : m_trViewers) { >+ trvs.add(trv); >+ } >+ return trvs; >+ } >+ >+ /** >+ * @return the list of open parts to view test result >+ * (test result tree view or test result viewers) >+ * ordered by their activation >+ */ >+ public List<WorkbenchPart> getTRParts() { >+ List<WorkbenchPart> trParts = new LinkedList<WorkbenchPart>(); >+ for (WorkbenchPart trv : m_trParts) { >+ trParts.add(trv); >+ } >+ return trParts; >+ } >+ >+ /** >+ * @return the currently open instance of the Test Result Tree View >+ */ >+ public TestResultTreeView getTRTreeView() { >+ return m_trTreeView; >+ } >+ >+ /** >+ * @return the value of m_isTRTreeViewHidden (true if Test Result Tree View is hidden) >+ */ >+ public boolean isTRTreeViewHidden() { >+ return m_isTRTreeViewHidden; >+ } >+ >+ /** >+ * @return the value of m_areButtonsDisabled >+ */ >+ public boolean mayTRViewerBeHidden() { >+ return m_trViewerMayBeHidden; >+ } >+ >+ /** >+ * Remove a test result tree view from this tracker. >+ * @param testResultViewer The test result tree view to remove. >+ */ >+ public void removeTRViewer(TestResultViewer testResultViewer) { >+ m_trViewers.remove(testResultViewer); >+ m_trParts.remove(testResultViewer); >+ fireStateChanged(); >+ } >+ >+ /** >+ * Remove a test result tree view from this tracker. >+ * @param testResultTreeView The test result tree view to remove. >+ */ >+ public void removeTRTreeView(TestResultTreeView testResultTreeView) { >+ m_trParts.remove(testResultTreeView); >+ m_trTreeView = null; >+ fireStateChanged(); >+ } >+ >+ /** >+ * fire data changed events >+ */ >+ private void fireStateChanged() { >+ if (m_provider != null) { >+ m_provider.externalFireSourceChanged(); >+ } >+ } >+ >+ /** {@inheritDoc} */ >+ public void handleClientStateChanged(ClientStatus status) { >+ if (status.equals(ClientStatus.RUNNING)) { >+ IWorkbenchPage actPage = Plugin.getActivePage(); >+ if (actPage != null) { >+ actPage.addPartListener(new PartListenerToTrackTRParts()); >+ setCurrentPesrpective(actPage.getPerspective()); >+ handleTestResultTreeViewInitialState(actPage); >+ } >+ } >+ } >+} >diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/events/GuiEventDispatcher.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/events/GuiEventDispatcher.java >index 51592c2..cdd5f88 100644 >--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/events/GuiEventDispatcher.java >+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/events/GuiEventDispatcher.java >@@ -36,6 +36,14 @@ public class GuiEventDispatcher { > boolean isDirty); > } > >+ /** to notify clients about changes client status */ >+ public interface IClientStatusListener { >+ /** >+ * @param status the status of the client >+ */ >+ public void handleClientStateChanged(ClientStatus status); >+ } >+ > /** logger */ > private static final Logger LOG = > LoggerFactory.getLogger(GuiEventDispatcher.class); >@@ -50,6 +58,13 @@ public class GuiEventDispatcher { > * <code>m_editorDirtyStateListeners</code> listener for notification > * about change of the dirty state of an editor > */ >+ private Set<IClientStatusListener> m_clStatusListeners = >+ new HashSet<IClientStatusListener>(); >+ >+ /** >+ * <code>m_editorDirtyStateListeners</code> listener for notification >+ * about change of the dirty state of an editor >+ */ > private Set<IEditorDirtyStateListener> m_editorDirtyStateListeners = > new HashSet<IEditorDirtyStateListener>(); > /** >@@ -60,6 +75,22 @@ public class GuiEventDispatcher { > private Set<IEditorDirtyStateListener> m_editorDirtyStateListenersPost = > new HashSet<IEditorDirtyStateListener>(); > >+ /** the Client Status */ >+ public enum ClientStatus { >+ /** >+ * Jubula is launched completely >+ */ >+ RUNNING, >+ /** >+ * Jubula is starting up >+ */ >+ STARTING, >+ /** >+ * Jubula is shutting down >+ */ >+ STOPPING >+ } >+ > /** > * private constructor > */ >@@ -131,4 +162,37 @@ public class GuiEventDispatcher { > } > } > } >+ >+ /** >+ * fire client status changed events >+ * >+ * @param status the new status >+ */ >+ public void fireClientStatusChanged(ClientStatus status) { >+ for (IClientStatusListener l : m_clStatusListeners) { >+ try { >+ l.handleClientStateChanged(status); >+ } catch (Throwable t) { >+ LOG.error(Messages.UnhandledExceptionCallingListeners, t); >+ } >+ } >+ } >+ >+ /** >+ * add client status listener >+ * >+ * @param l the listener to add >+ */ >+ public void addClientStatusListener(IClientStatusListener l) { >+ m_clStatusListeners.add(l); >+ } >+ >+ /** >+ * remove client status listener >+ * >+ * @param l the listener to remove >+ */ >+ public void removeClientStatusListener(IClientStatusListener l) { >+ m_clStatusListeners.remove(l); >+ } > } >diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/GoToNextTestResultErrorHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/GoToNextTestResultErrorHandler.java >index f2ecd60..48a3e3d 100644 >--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/GoToNextTestResultErrorHandler.java >+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/GoToNextTestResultErrorHandler.java >@@ -10,10 +10,10 @@ > *******************************************************************************/ > package org.eclipse.jubula.client.ui.rcp.handlers; > >-import java.util.List; >- > import org.eclipse.jface.viewers.TreeViewer; >+import org.eclipse.jubula.client.ui.editors.TestResultViewer; > import org.eclipse.jubula.client.ui.handlers.AbstractGoToTestResultErrorHandler; >+import org.eclipse.jubula.client.ui.rcp.controllers.TestResultPartsTracker; > import org.eclipse.jubula.client.ui.rcp.views.TestResultTreeView; > import org.eclipse.ui.IWorkbenchPart; > >@@ -33,11 +33,21 @@ public class GoToNextTestResultErrorHandler extends > return true; > } > >- /** >- * {@inheritDoc} >- */ >- protected TreeViewer handleActiveWorkbenchParts(List<IWorkbenchPart> list) { >- list.get(0).setFocus(); >- return ((TestResultTreeView) list.get(0)).getTreeViewer(); >+ @Override >+ protected TreeViewer handleTestResultPart(IWorkbenchPart part) { >+ TreeViewer viewer = null; >+ if (part instanceof TestResultTreeView) { >+ if (!(TestResultPartsTracker.getInstance(). >+ isTRTreeViewHidden())) { >+ part.setFocus(); >+ TestResultTreeView trTreeView = (TestResultTreeView)part; >+ viewer = trTreeView.getTreeViewer(); >+ } >+ } else if (part instanceof TestResultViewer) { >+ part.setFocus(); >+ TestResultViewer trViewer = (TestResultViewer)part; >+ viewer = trViewer.getTreeViewer(); >+ } >+ return viewer; > } > } >diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/GoToPreviousTestResultErrorHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/GoToPreviousTestResultErrorHandler.java >index 2de616b..562373f 100644 >--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/GoToPreviousTestResultErrorHandler.java >+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/GoToPreviousTestResultErrorHandler.java >@@ -10,13 +10,6 @@ > *******************************************************************************/ > package org.eclipse.jubula.client.ui.rcp.handlers; > >-import java.util.List; >- >-import org.eclipse.jface.viewers.TreeViewer; >-import org.eclipse.jubula.client.ui.handlers.AbstractGoToTestResultErrorHandler; >-import org.eclipse.jubula.client.ui.rcp.views.TestResultTreeView; >-import org.eclipse.ui.IWorkbenchPart; >- > /** > * Handler for navigating to the "previous" error in a Test Result. > * >@@ -24,7 +17,7 @@ import org.eclipse.ui.IWorkbenchPart; > * @created September 10, 2013 > */ > public class GoToPreviousTestResultErrorHandler extends >- AbstractGoToTestResultErrorHandler { >+ GoToNextTestResultErrorHandler { > > /** > * {@inheritDoc} >@@ -32,12 +25,4 @@ public class GoToPreviousTestResultErrorHandler extends > protected boolean isForwardIteration() { > return false; > } >- >- /** >- * {@inheritDoc} >- */ >- protected TreeViewer handleActiveWorkbenchParts(List<IWorkbenchPart> list) { >- list.get(0).setFocus(); >- return ((TestResultTreeView) list.get(0)).getTreeViewer(); >- } > } >diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java >index 9517631..cc95967 100644 >--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java >+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java >@@ -626,6 +626,7 @@ public class Messages extends NLS { > public static String ChangeParameterUsageOldNameLabel; > public static String ChangeParameterUsageNewNameLabel; > public static String ChangeParameterUsageOperation; >+ public static String RegisterWorkbenchStartupListener; > public static String RenameActionCatError; > public static String RenameActionCatLabel; > public static String RenameActionCatMessage; >@@ -892,6 +893,7 @@ public class Messages extends NLS { > public static String WasExpectedBut; > public static String WasFound; > public static String WindowIsNull; >+ public static String WorkbenchStartupListenerIsRegistring; > public static String WrongAUT; > public static String WrongEditorType; > public static String WrongEditSupportInTestCaseEditor; >diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties >index 87f4679..7b8041e 100644 >--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties >+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties >@@ -610,6 +610,7 @@ ChangeCtdsColumnUsageTestCaseCouldNotBeLocked=The Test Case "{0}" could not be l > ChangeParameterUsageOldNameLabel=Old parameter/column name > ChangeParameterUsageNewNameLabel=New parameter/column name > ChangeParameterUsageOperation=Change parameter usage from "{0}" to "{1}"... >+RegisterWorkbenchStartupListener=Register Workbench Startup Listener > RenameActionCatError=Category > RenameActionCatLabel=Category name\: > RenameActionCatMessage=Rename category >@@ -878,6 +879,7 @@ VersionDialogEmptyField=Version number fields may not be empty. > WasExpectedBut=was expected, but > WasFound=was found > WindowIsNull=Window is null >+WorkbenchStartupListenerIsRegistring=Workbench startup listener is being registred... > WrongAUT=Wrong AUT > WrongEditorType=Wrong editor type > WrongEditSupportInTestCaseEditor=Wrong edit support in TestCaseEditor >diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/sourceprovider/TestResultSourceProvider.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/sourceprovider/TestResultSourceProvider.java >new file mode 100644 >index 0000000..1f22f9d >--- /dev/null >+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/sourceprovider/TestResultSourceProvider.java >@@ -0,0 +1,116 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2010 BREDEX GmbH. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * BREDEX GmbH - initial API and implementation and/or initial documentation >+ *******************************************************************************/ >+package org.eclipse.jubula.client.ui.rcp.sourceprovider; >+ >+import java.util.HashMap; >+import java.util.Map; >+import org.eclipse.jubula.client.ui.rcp.controllers.TestResultPartsTracker; >+import org.eclipse.ui.ISources; >+ >+/** >+ * Provides variables related to the Test Result Viewers and Test Result Tree View. >+ * >+ * @author BREDEX GmbH >+ * @created Dec 09, 2013 >+ */ >+public class TestResultSourceProvider extends AbstractJBSourceProvider { >+ /** >+ * ID of variable that indicates whether at least one part to view test result >+ * (test result tree view or test result viewer) is open. >+ */ >+ public static final String IS_PART_TO_VIEW_TEST_RESULT_OPEN = >+ "org.eclipse.jubula.client.ui.rcp.variable.isPartToViewTestResultOpen"; //$NON-NLS-1$ >+ >+ /** >+ * ID of definition that indicates whether Go to Next/Previous Error Buttons should be disabled >+ * (the value depends on if open Test Result Tree View is hidden or not) >+ */ >+ public static final String IS_TEST_RESULT_TREE_VIEW_HIDDEN = >+ "org.eclipse.jubula.client.ui.rcp.variable.isTRTreeViewHidden"; //$NON-NLS-1$ >+ >+ /** >+ * ID of definition that indicates whether Go to Next/Previous Error Buttons should be disabled >+ * (the value depends on if open Test Result Tree View is hidden or not) >+ */ >+ public static final String TEST_RESLT_VIEWER_MAY_BE_HIDDEN = >+ "org.eclipse.jubula.client.ui.variable.mayTestResultViewerBeHidden"; //$NON-NLS-1$ >+ >+ /** >+ * Constructor. >+ */ >+ public TestResultSourceProvider() { >+ TestResultPartsTracker.getInstance().setProvider(this); >+ } >+ >+ /** >+ * >+ * {@inheritDoc} >+ */ >+ public void dispose() { >+ TestResultPartsTracker.getInstance().setProvider(null); >+ } >+ >+ /** >+ * >+ * {@inheritDoc} >+ */ >+ public Map getCurrentState() { >+ Map<String, Object> currentState = new HashMap<String, Object>(); >+ currentState.put(IS_PART_TO_VIEW_TEST_RESULT_OPEN, >+ TestResultPartsTracker.getInstance(). >+ getTRParts().size() > 0); >+ currentState.put(IS_TEST_RESULT_TREE_VIEW_HIDDEN, >+ TestResultPartsTracker.getInstance(). >+ isTRTreeViewHidden()); >+ currentState.put(TEST_RESLT_VIEWER_MAY_BE_HIDDEN, >+ TestResultPartsTracker.getInstance().mayTRViewerBeHidden()); >+ return currentState; >+ } >+ >+ /** >+ * >+ * {@inheritDoc} >+ */ >+ public String[] getProvidedSourceNames() { >+ return new String[] { IS_PART_TO_VIEW_TEST_RESULT_OPEN, >+ IS_TEST_RESULT_TREE_VIEW_HIDDEN, >+ TEST_RESLT_VIEWER_MAY_BE_HIDDEN}; >+ } >+ >+ /** >+ * Fires a source changed event for >+ * <code>IS_PART_TO_VIEW_TEST_RESULT_OPEN</code> and >+ * <code>IS_TEST_RESULT_TREE_VIEW_HIDDEN</code> >+ * <code>TEST_RESLT_VIEWER_MAY_BE_HIDDEN</code> >+ */ >+ private void fireSourceChanged() { >+ gdFireSourceChanged(ISources.WORKBENCH, >+ IS_PART_TO_VIEW_TEST_RESULT_OPEN, >+ TestResultPartsTracker.getInstance(). >+ getTRParts().size() > 0); >+ gdFireSourceChanged(ISources.WORKBENCH, >+ IS_TEST_RESULT_TREE_VIEW_HIDDEN, >+ TestResultPartsTracker.getInstance(). >+ isTRTreeViewHidden()); >+ gdFireSourceChanged(ISources.WORKBENCH, >+ TEST_RESLT_VIEWER_MAY_BE_HIDDEN, >+ TestResultPartsTracker.getInstance(). >+ mayTRViewerBeHidden()); >+ } >+ >+ /** >+ * specified in Listener >+ * callback method >+ */ >+ public void externalFireSourceChanged() { >+ fireSourceChanged(); >+ } >+} >diff --git a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/constants/Constants.java b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/constants/Constants.java >index 5737340..7438b2f 100644 >--- a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/constants/Constants.java >+++ b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/constants/Constants.java >@@ -74,6 +74,10 @@ public interface Constants { > public static final String TESTRE_ID = > "org.eclipse.jubula.client.ui.rcp.views.TestResultTreeView"; //$NON-NLS-1$ > >+ /** the ID of the test result viewer */ >+ public static final String TESTRE_VIEWER_ID = >+ "org.eclipse.jubula.client.ui.editors.TestResultViewer"; //$NON-NLS-1$ >+ > /** the ID of the test case browser */ > public static final String TC_BROWSER_ID = > "org.eclipse.jubula.client.ui.rcp.views.TestCaseBrowser"; //$NON-NLS-1$ >diff --git a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/AbstractGoToTestResultErrorHandler.java b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/AbstractGoToTestResultErrorHandler.java >index fb7ee3b..d34ac99 100644 >--- a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/AbstractGoToTestResultErrorHandler.java >+++ b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/AbstractGoToTestResultErrorHandler.java >@@ -10,64 +10,64 @@ > *******************************************************************************/ > package org.eclipse.jubula.client.ui.handlers; > >-import java.util.LinkedList; >-import java.util.List; >+import java.util.logging.Level; >+import java.util.logging.Logger; > > import org.eclipse.core.commands.AbstractHandler; > import org.eclipse.core.commands.ExecutionEvent; >-import org.eclipse.core.commands.ExecutionException; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.ITreeContentProvider; > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.jface.viewers.TreeViewer; > import org.eclipse.jubula.client.core.model.TestResultNode; >+import org.eclipse.jubula.client.ui.constants.Constants; >+import org.eclipse.jubula.client.ui.editors.TestResultViewer; >+import org.eclipse.jubula.client.ui.i18n.Messages; > import org.eclipse.jubula.client.ui.utils.TreeViewerIterator; >+import org.eclipse.ui.IEditorReference; >+import org.eclipse.ui.IViewReference; >+import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchPart; >-import org.eclipse.ui.handlers.HandlerUtil; >- >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.PlatformUI; > > /** > * Abstract handler for navigating to a test result node. >- * >+ * > * @author BREDEX GmbH > * @created Jun 3, 2010 > */ >-public abstract class AbstractGoToTestResultErrorHandler >- extends AbstractHandler { >+public abstract class AbstractGoToTestResultErrorHandler extends >+ AbstractHandler { > > /** > * {@inheritDoc} > */ >- public final Object execute(ExecutionEvent event) >- throws ExecutionException { >- >- List<IWorkbenchPart> listOfPossibleParts = >- new LinkedList<IWorkbenchPart>(); >- listOfPossibleParts.add(HandlerUtil.getActivePart(event)); >- listOfPossibleParts.add(HandlerUtil.getActiveEditor(event)); >- TreeViewer viewer = handleActiveWorkbenchParts(listOfPossibleParts); >- >- IStructuredSelection selection = >- (IStructuredSelection)viewer.getSelection(); >- ITreeContentProvider contentProvider = >- (ITreeContentProvider)viewer.getContentProvider(); >+ public final Object execute(ExecutionEvent event) { >+ activateTestResultTreeView(); >+ TreeViewer viewer = handleTestResultPart( >+ getTestResultPartToExecuteGoToOn()); >+ IStructuredSelection selection = (IStructuredSelection) viewer >+ .getSelection(); >+ ITreeContentProvider contentProvider = (ITreeContentProvider) viewer >+ .getContentProvider(); > TestResultNode startingNode = null; > if (selection.getFirstElement() instanceof TestResultNode) { >- startingNode = (TestResultNode)selection.getFirstElement(); >+ startingNode = (TestResultNode) selection.getFirstElement(); > } else { >- Object[] rootElements = >- contentProvider.getElements(viewer.getInput()); >+ Object[] rootElements = contentProvider.getElements(viewer >+ .getInput()); > for (Object element : rootElements) { > if (element instanceof TestResultNode) { >- startingNode = (TestResultNode)element; >+ startingNode = (TestResultNode) element; > break; > } > } > } >- >+ > TestResultNode targetNode = null; > TreeViewerIterator iter = new TreeViewerIterator(viewer, startingNode, >- isForwardIteration()); >+ isForwardIteration()); > while (iter.hasNext() && targetNode == null) { > Object nextElement = iter.next(); > if (nextElement instanceof TestResultNode) { >@@ -77,7 +77,7 @@ public abstract class AbstractGoToTestResultErrorHandler > } > } > } >- >+ > if (targetNode != null) { > viewer.reveal(targetNode); > viewer.setSelection(new StructuredSelection(targetNode)); >@@ -87,8 +87,75 @@ public abstract class AbstractGoToTestResultErrorHandler > } > > /** >+ * @return part to Execute GoTo on the active TestResultViewer or >+ * TestResultTreeView is selected to be a part if both >+ * TestResultViewer and TestResultTreeView or none of them are >+ * active, the part is considered to be a TestResultViewer >+ * return null if no active window or active page exist and if >+ * no TestResultTreeView or TestResultViewer is open >+ */ >+ private IWorkbenchPart getTestResultPartToExecuteGoToOn() { >+ IWorkbenchWindow actWindow = PlatformUI.getWorkbench() >+ .getActiveWorkbenchWindow(); >+ if (actWindow != null) { >+ IWorkbenchPage actPage = actWindow.getActivePage(); >+ if (actPage != null) { >+ // part is an active TestResultTreeView >+ for (IViewReference viewRef : actPage.getViewReferences()) { >+ if ((viewRef.getId().equals(Constants.TESTRE_ID)) >+ && (viewRef.equals( >+ actPage.getActivePartReference()))) { >+ return (IWorkbenchPart) viewRef.getView(true); >+ } >+ } >+ // part is an active TestResultViewer >+ for (IEditorReference edRef : actPage.getEditorReferences()) { >+ if ((edRef.getId().equals(Constants.TESTRE_VIEWER_ID)) >+ && (edRef.getEditor(true).equals(actPage >+ .getActiveEditor()))) { >+ return (IWorkbenchPart) edRef.getEditor(true); >+ } >+ } >+ // part is any of open TestResultViewers >+ for (IEditorReference edRef : actPage.getEditorReferences()) { >+ if (edRef.getId().equals(Constants.TESTRE_VIEWER_ID)) { >+ return (IWorkbenchPart) edRef.getEditor(true); >+ } >+ } >+ Logger.getGlobal().log(Level.SEVERE, Messages. >+ ErrorOccurredWhileGettingTestResultPartToExecuteGoToOn); >+ return null; >+ } >+ Logger.getGlobal().log(Level.SEVERE, Messages. >+ ActiveWorkbenchPageDoesNotExist); >+ return null; >+ } >+ Logger.getGlobal().log(Level.SEVERE, Messages. >+ ActiveWorkbenchWindowDoesNotExist); >+ return null; >+ } >+ >+ /** >+ * unlike Editors (for which value of last active editor is remembered even >+ * if Editor loses focus) last active view is not remembered and need to be >+ * activated at the beginning of GoToTestResultErrorHandler execution >+ */ >+ private void activateTestResultTreeView() { >+ IWorkbenchPage actPage = PlatformUI.getWorkbench() >+ .getActiveWorkbenchWindow().getActivePage(); >+ if (!(actPage.getActiveEditor() instanceof TestResultViewer)) { >+ for (IViewReference viewRef : actPage.getViewReferences()) { >+ if (viewRef.getId().equals(Constants.TESTRE_ID)) { >+ actPage.activate(viewRef.getView(true)); >+ } >+ } >+ } >+ } >+ >+ /** > * >- * @param node The node to check. >+ * @param node >+ * The node to check. > * @return <code>true</code> if the node is considered an error node. > */ > private final boolean isErrorNode(TestResultNode node) { >@@ -96,17 +163,17 @@ public abstract class AbstractGoToTestResultErrorHandler > return (status == TestResultNode.ERROR) > || (status == TestResultNode.ABORT); > } >- >+ > /** >- * @return a boolean describing the direction of iteration: >- * true = forwards; false = backwards >+ * @return a boolean describing the direction of iteration: true = forwards; >+ * false = backwards > */ > protected abstract boolean isForwardIteration(); >- >+ > /** >- * @param listOfPossibleParts a list of two possible parts to execute the GoTo on >- * @return the TreeViewer of the active part >+ * @param part >+ * a part to execute the GoTo on >+ * @return the TreeViewer of the part to execute the GoTo on > */ >- protected abstract TreeViewer handleActiveWorkbenchParts( >- List<IWorkbenchPart> listOfPossibleParts); >+ protected abstract TreeViewer handleTestResultPart(IWorkbenchPart part); > } >\ No newline at end of file >diff --git a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/GoToNextTestResultErrorHandler.java b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/GoToNextTestResultErrorHandler.java >index 68f592b..1dc3afa 100644 >--- a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/GoToNextTestResultErrorHandler.java >+++ b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/GoToNextTestResultErrorHandler.java >@@ -10,11 +10,11 @@ > *******************************************************************************/ > package org.eclipse.jubula.client.ui.handlers; > >-import java.util.List; >- > import org.eclipse.jface.viewers.TreeViewer; > import org.eclipse.jubula.client.ui.editors.TestResultViewer; >+import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.PlatformUI; > > /** > * Handler for navigating to the "next" error in a Test Result. >@@ -32,11 +32,24 @@ public class GoToNextTestResultErrorHandler extends > return true; > } > >- /** >- * {@inheritDoc} >- */ >- protected TreeViewer handleActiveWorkbenchParts(List<IWorkbenchPart> list) { >- list.get(1).setFocus(); >- return ((TestResultViewer) list.get(1)).getTreeViewer(); >+ @Override >+ protected TreeViewer handleTestResultPart(IWorkbenchPart part) { >+ TestResultViewer trViewer = null; >+ boolean existActTRViewer = false; >+ IWorkbenchPage actPage = PlatformUI.getWorkbench(). >+ getActiveWorkbenchWindow().getActivePage(); >+ if ((part instanceof TestResultViewer) >+ && (part.equals(actPage.getActiveEditor()))) { >+ part.setFocus(); >+ trViewer = (TestResultViewer) part; >+ existActTRViewer = true; >+ } >+ if (!existActTRViewer) { >+ if (part instanceof TestResultViewer) { >+ part.setFocus(); >+ trViewer = (TestResultViewer) part; >+ } >+ } >+ return trViewer.getTreeViewer(); > } > } >\ No newline at end of file >diff --git a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/GoToPreviousTestResultErrorHandler.java b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/GoToPreviousTestResultErrorHandler.java >index c36527d..9d0a44c 100644 >--- a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/GoToPreviousTestResultErrorHandler.java >+++ b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/handlers/GoToPreviousTestResultErrorHandler.java >@@ -10,11 +10,6 @@ > *******************************************************************************/ > package org.eclipse.jubula.client.ui.handlers; > >-import java.util.List; >- >-import org.eclipse.jface.viewers.TreeViewer; >-import org.eclipse.jubula.client.ui.editors.TestResultViewer; >-import org.eclipse.ui.IWorkbenchPart; > > /** > * Handler for navigating to the "previous" error in a Test Result. >@@ -23,7 +18,7 @@ import org.eclipse.ui.IWorkbenchPart; > * @created May 17, 2010 > */ > public class GoToPreviousTestResultErrorHandler extends >- AbstractGoToTestResultErrorHandler { >+ GoToNextTestResultErrorHandler { > > /** > * {@inheritDoc} >@@ -31,12 +26,4 @@ public class GoToPreviousTestResultErrorHandler extends > protected boolean isForwardIteration() { > return false; > } >- >- /** >- * {@inheritDoc} >- */ >- protected TreeViewer handleActiveWorkbenchParts(List<IWorkbenchPart> list) { >- list.get(1).setFocus(); >- return ((TestResultViewer) list.get(1)).getTreeViewer(); >- } > } >diff --git a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/i18n/Messages.java b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/i18n/Messages.java >index f7c0d17..e4661c4 100644 >--- a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/i18n/Messages.java >+++ b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/i18n/Messages.java >@@ -21,6 +21,8 @@ public class Messages extends NLS { > > private static final String BUNDLE_NAME = "org.eclipse.jubula.client.ui.i18n.messages"; //$NON-NLS-1$ > public static String AbstractGuiNodePropertySourceTaskId; >+ public static String ActiveWorkbenchPageDoesNotExist; >+ public static String ActiveWorkbenchWindowDoesNotExist; > public static String CantLoadMetadataFromDatabase; > public static String CapGUIPropertySourceAction; > public static String CapGUIPropertySourceActionType; >@@ -61,6 +63,7 @@ public class Messages extends NLS { > public static String EnterCommentDialogTitleLabel; > public static String ErrorFetchingTestResultInformation; > public static String ErrorOccurredWhileExecutingCommand; >+ public static String ErrorOccurredWhileGettingTestResultPartToExecuteGoToOn; > public static String InputElementHasInvalidTypeReturningEmptyArray; > public static String JobFilterSummaryView; > public static String NoEditorInputCouldBeCreated; >diff --git a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/i18n/messages.properties b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/i18n/messages.properties >index 64cb66a..66d0fb1 100644 >--- a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/i18n/messages.properties >+++ b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/i18n/messages.properties >@@ -6,6 +6,8 @@ > # http://www.eclipse.org/legal/epl-v10.html > ############################################################################## > AbstractGuiNodePropertySourceTaskId=Task ID >+ActiveWorkbenchPageDoesNotExist=Active Workbench page does not exist >+ActiveWorkbenchWindowDoesNotExist=Active Workbench window does not exist > AnErrorHasOccurred=An error has occurred > CantLoadMetadataFromDatabase=Can't load metadata from database > CapGUIPropertySourceAction=Action >@@ -46,6 +48,7 @@ EnterCommentDialogMessage=Enter a Comment. > EnterCommentDialogTitle=Enter a Comment > EnterCommentDialogTitleLabel=Title\: > ErrorFetchingTestResultInformation=Error occurred while fetching Test Result information >+ErrorOccurredWhileGettingTestResultPartToExecuteGoToOn=Error occurred while getting TestResult Part to execute GoToError > ErrorOccurredWhileExecutingCommand=Error occurred while executing command > InputElementHasInvalidTypeReturningEmptyArray=Input element has invalid type. Returning empty array. > JobFilterSummaryView=Filtering Summary View...
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 417829
:
237947
|
238932
| 239343