You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2016/10/11 19:55:48 UTC
svn commit: r1764332 - in /directory/studio/trunk:
plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/
plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/
plugins/ldapbrowser.ui/src/main/...
Author: seelmann
Date: Tue Oct 11 19:55:47 2016
New Revision: 1764332
URL: http://svn.apache.org/viewvc?rev=1764332&view=rev
Log:
DIRSTUDIO-1121: Performance penalty as editor input is always set twice
Added:
directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/AbstractLinkWithEditorAction.java (with props)
Modified:
directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditor.java
directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java
directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java
directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditor.java
directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditor.java
directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/LinkWithEditorAction.java
directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/LinkWithEditorAction.java
directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/TemplateEntryEditor.java
directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java
directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
Modified: directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditor.java?rev=1764332&r1=1764331&r2=1764332&view=diff
==============================================================================
--- directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditor.java (original)
+++ directory/studio/trunk/plugins/combinededitor/src/main/java/org/apache/directory/studio/combinededitor/editor/CombinedEntryEditor.java Tue Oct 11 19:55:47 2016
@@ -23,9 +23,8 @@ package org.apache.directory.studio.comb
import org.apache.directory.studio.entryeditors.EntryEditorInput;
import org.apache.directory.studio.entryeditors.EntryEditorUtils;
import org.apache.directory.studio.entryeditors.IEntryEditor;
-import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
-import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT;
@@ -33,7 +32,6 @@ import org.eclipse.swt.custom.CTabFolder
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.INavigationLocation;
import org.eclipse.ui.INavigationLocationProvider;
@@ -415,6 +413,15 @@ public abstract class CombinedEntryEdito
{
if ( input instanceof EntryEditorInput )
{
+ /*
+ * Optimization: no need to set the input again if the same input is already set
+ */
+ if ( getEntryEditorInput() != null
+ && getEntryEditorInput().getResolvedEntry() == ( ( EntryEditorInput ) input ).getResolvedEntry() )
+ {
+ return;
+ }
+
// If the editor is dirty, let's ask for a save before changing the input
if ( isDirty() )
{
@@ -424,39 +431,10 @@ public abstract class CombinedEntryEdito
}
}
- /*
- * Workaround to make link-with-editor working for the single-tab editor:
- * The call of firePropertyChange is used to inform the link-with-editor action.
- * However firePropertyChange also modifies the navigation history.
- * Thus, a dummy input with the real entry but a null extension is set.
- * This avoids to modification of the navigation history.
- * Afterwards the real input is set.
- */
- EntryEditorInput eei = ( EntryEditorInput ) input;
- IEntry entryInput = eei.getEntryInput();
- ISearchResult searchResultInput = eei.getSearchResultInput();
- IBookmark bookmarkInput = eei.getBookmarkInput();
- EntryEditorInput dummyInput;
-
- if ( entryInput != null )
- {
- dummyInput = new EntryEditorInput( entryInput, null );
- }
- else if ( searchResultInput != null )
- {
- dummyInput = new EntryEditorInput( searchResultInput, null );
- }
- else
- {
- dummyInput = new EntryEditorInput( bookmarkInput, null );
- }
-
- setInput( dummyInput );
- firePropertyChange( IEditorPart.PROP_INPUT );
-
// now set the real input and mark history location
setInput( input );
getSite().getPage().getNavigationHistory().markLocation( this );
+ firePropertyChange( BrowserUIConstants.INPUT_CHANGED );
// Getting the preference store
IPreferenceStore store = CombinedEditorPlugin.getDefault().getPreferenceStore();
Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java?rev=1764332&r1=1764331&r2=1764332&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java Tue Oct 11 19:55:47 2016
@@ -240,4 +240,5 @@ public final class BrowserUIConstants
public static final String WIZARD_NEW_SEARCH = BrowserUIPlugin.getDefault().getPluginProperties()
.getString( "NewWizard_NewSearchWizard_id" ); //$NON-NLS-1$
+ public static final int INPUT_CHANGED = 1342730831;
}
Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java?rev=1764332&r1=1764331&r2=1764332&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java Tue Oct 11 19:55:47 2016
@@ -27,9 +27,7 @@ import org.apache.directory.studio.entry
import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidget;
-import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
-import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.util.IPropertyChangeListener;
@@ -405,6 +403,15 @@ public abstract class EntryEditor extend
{
if ( input instanceof EntryEditorInput )
{
+ /*
+ * Optimization: no need to set the input again if the same input is already set
+ */
+ if ( getEntryEditorInput() != null
+ && getEntryEditorInput().getResolvedEntry() == ( ( EntryEditorInput ) input ).getResolvedEntry() )
+ {
+ return;
+ }
+
// If the editor is dirty, let's ask for a save before changing the input
if ( isDirty() )
{
@@ -414,37 +421,10 @@ public abstract class EntryEditor extend
}
}
- /*
- * Workaround to make link-with-editor working for the single-tab editor:
- * The call of firePropertyChange is used to inform the link-with-editor action.
- * However firePropertyChange also modifies the navigation history.
- * Thus, a dummy input with the real entry but a null extension is set.
- * This avoids to modification of the navigation history.
- * Afterwards the real input is set.
- */
- EntryEditorInput eei = ( EntryEditorInput ) input;
- IEntry entry = eei.getEntryInput();
- ISearchResult searchResult = eei.getSearchResultInput();
- IBookmark bookmark = eei.getBookmarkInput();
- EntryEditorInput dummyInput;
- if ( entry != null )
- {
- dummyInput = new EntryEditorInput( entry, null );
- }
- else if ( searchResult != null )
- {
- dummyInput = new EntryEditorInput( searchResult, null );
- }
- else
- {
- dummyInput = new EntryEditorInput( bookmark, null );
- }
- setInput( dummyInput );
- firePropertyChange( IEditorPart.PROP_INPUT );
-
// now set the real input and mark history location
setInput( input );
getSite().getPage().getNavigationHistory().markLocation( this );
+ firePropertyChange( BrowserUIConstants.INPUT_CHANGED );
}
}
Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditor.java?rev=1764332&r1=1764331&r2=1764332&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditor.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditor.java Tue Oct 11 19:55:47 2016
@@ -28,9 +28,8 @@ import org.apache.directory.studio.ldapb
import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeAttributesRunnable;
import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob;
-import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
-import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
import org.apache.directory.studio.ldifeditor.editor.LdifEditor;
import org.apache.directory.studio.ldifeditor.editor.LdifOutlinePage;
import org.apache.directory.studio.utils.ActionUtils;
@@ -41,7 +40,6 @@ import org.eclipse.jface.action.IMenuMan
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.INavigationLocation;
import org.eclipse.ui.IShowEditorInput;
@@ -356,36 +354,10 @@ public abstract class LdifEntryEditor ex
}
}
- /*
- * Workaround to make link-with-editor working for the single-tab editor:
- * The call of firePropertyChange is used to inform the link-with-editor action.
- * However firePropertyChange also modifies the navigation history.
- * Thus, a dummy input with the real entry but a null extension is set.
- * This avoids to modification of the navigation history.
- * Afterwards the real input is set.
- */
- IEntry entry = eei.getEntryInput();
- ISearchResult searchResult = eei.getSearchResultInput();
- IBookmark bookmark = eei.getBookmarkInput();
- EntryEditorInput dummyInput;
- if ( entry != null )
- {
- dummyInput = new EntryEditorInput( entry, null );
- }
- else if ( searchResult != null )
- {
- dummyInput = new EntryEditorInput( searchResult, null );
- }
- else
- {
- dummyInput = new EntryEditorInput( bookmark, null );
- }
- doSetInput( dummyInput );
- firePropertyChange( IEditorPart.PROP_INPUT );
-
// now set the real input and mark history location
doSetInput( input );
getSite().getPage().getNavigationHistory().markLocation( this );
+ firePropertyChange( BrowserUIConstants.INPUT_CHANGED );
}
}
catch ( CoreException e )
Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditor.java?rev=1764332&r1=1764331&r2=1764332&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditor.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditor.java Tue Oct 11 19:55:47 2016
@@ -170,22 +170,17 @@ public class SearchResultEditor extends
if ( input instanceof SearchResultEditorInput )
{
/*
- * Workaround to make link-with-editor working for the single-tab editor:
- * The call of firePropertyChange is used to inform the link-with-editor action.
- * However firePropertyChange also modifies the navigation history.
- * Thus, a dummy input with the real search but dummy flag is set.
- * This avoids to modification of the navigation history.
- * Afterwards the real input is set.
+ * Optimization: no need to set the input again if the same input is already set
*/
- SearchResultEditorInput srei = ( SearchResultEditorInput ) input;
- ISearch search = srei.getSearch();
- SearchResultEditorInput dummyInput = new SearchResultEditorInput( search, true );
- setInput( dummyInput );
- firePropertyChange( IEditorPart.PROP_INPUT );
+ if ( getEditorInput() != null && getEditorInput().equals( input ) )
+ {
+ return;
+ }
// now set the real input and mark history location
setInput( input );
getSite().getPage().getNavigationHistory().markLocation( this );
+ firePropertyChange( BrowserUIConstants.INPUT_CHANGED );
}
}
Added: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/AbstractLinkWithEditorAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/AbstractLinkWithEditorAction.java?rev=1764332&view=auto
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/AbstractLinkWithEditorAction.java (added)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/AbstractLinkWithEditorAction.java Tue Oct 11 19:55:47 2016
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.ldapbrowser.ui.views.browser;
+
+
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
+import org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditor;
+import org.apache.directory.studio.ldapbrowser.ui.editors.searchresult.SearchResultEditor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.ViewPart;
+
+
+/**
+ * This class implements common aspects for the Link With Editor Action.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class AbstractLinkWithEditorAction extends Action
+{
+ /** The view */
+ private ViewPart viewPart;
+
+ /** The listener listening on opening/closing editors */
+ private IPartListener partListener = new IPartListener()
+ {
+
+ @Override
+ public void partOpened( IWorkbenchPart part )
+ {
+ registerPropertyListener( part );
+
+ }
+
+
+ @Override
+ public void partClosed( IWorkbenchPart part )
+ {
+ unregisterPropertyListener( part );
+ }
+
+
+ @Override
+ public void partDeactivated( IWorkbenchPart part )
+ {
+ }
+
+
+ @Override
+ public void partBroughtToTop( IWorkbenchPart part )
+ {
+ }
+
+
+ @Override
+ public void partActivated( IWorkbenchPart part )
+ {
+ }
+ };
+
+ /** The listener listening on input changes in editors */
+ private IPropertyListener propertyListener = new IPropertyListener()
+ {
+ @Override
+ public void propertyChanged( Object source, int propId )
+ {
+ if ( source instanceof IEditorPart && propId == BrowserUIConstants.INPUT_CHANGED )
+ {
+ linkViewWithEditor( ( IEditorPart ) source );
+ }
+ }
+ };
+
+
+ private void registerListeners()
+ {
+ // register part listeners
+ viewPart.getSite().getWorkbenchWindow().getPartService().addPartListener( partListener );
+
+ // register property listener
+ IEditorReference[] editorReferences = viewPart.getSite().getPage().getEditorReferences();
+ for ( IEditorReference editorReference : editorReferences )
+ {
+ IEditorPart editor = editorReference.getEditor( false );
+ registerPropertyListener( editor );
+ }
+ }
+
+
+ private void registerPropertyListener( IWorkbenchPart part )
+ {
+ if ( part instanceof EntryEditor || part instanceof SearchResultEditor )
+ {
+ part.addPropertyListener( propertyListener );
+ }
+ }
+
+
+ private void unregisterListeners()
+ {
+ // unregister part listener
+ viewPart.getSite().getWorkbenchWindow().getPartService().removePartListener( partListener );
+
+ // unregister property listener
+ IEditorReference[] editorReferences = viewPart.getSite().getPage().getEditorReferences();
+ for ( IEditorReference editorReference : editorReferences )
+ {
+ IEditorPart editor = editorReference.getEditor( false );
+ unregisterPropertyListener( editor );
+ }
+ }
+
+
+ private void unregisterPropertyListener( IWorkbenchPart part )
+ {
+ if ( part instanceof EntryEditor || part instanceof SearchResultEditor )
+ {
+ part.removePropertyListener( propertyListener );
+ }
+ }
+
+
+ public AbstractLinkWithEditorAction( ViewPart viewPart, String message )
+ {
+ super( message, AS_CHECK_BOX ); //$NON-NLS-1$
+ setImageDescriptor(
+ BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_LINK_WITH_EDITOR ) );
+ setEnabled( true );
+ setChecked( BrowserUIPlugin.getDefault().getPreferenceStore()
+ .getBoolean( BrowserUIConstants.PREFERENCE_BROWSER_LINK_WITH_EDITOR ) );
+ this.viewPart = viewPart;
+ }
+
+
+ protected void init()
+ {
+ // Enable the listeners
+ if ( isChecked() )
+ {
+ registerListeners();
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void run()
+ {
+ setChecked( isChecked() );
+ BrowserUIPlugin.getDefault().getPreferenceStore()
+ .setValue( BrowserUIConstants.PREFERENCE_BROWSER_LINK_WITH_EDITOR, isChecked() );
+
+ if ( isChecked() )
+ {
+ // Enable the listener
+ registerListeners();
+
+ // link
+ IEditorPart activeEditor = viewPart.getSite().getWorkbenchWindow().getActivePage().getActiveEditor();
+ linkViewWithEditor( activeEditor );
+ }
+ else
+ {
+ // Disable the listener
+ unregisterListeners();
+ }
+ }
+
+
+ /**
+ * Links the view with the right editor
+ *
+ * @param partRef the part
+ */
+ protected abstract void linkViewWithEditor( IWorkbenchPart part );
+
+
+ /**
+ * Disposes this action.
+ */
+ public void dispose()
+ {
+ if ( partListener != null && propertyListener != null )
+ {
+ unregisterListeners();
+ propertyListener = null;
+ partListener = null;
+ }
+
+ viewPart = null;
+ }
+
+}
Propchange: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/AbstractLinkWithEditorAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/LinkWithEditorAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/LinkWithEditorAction.java?rev=1764332&r1=1764331&r2=1764332&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/LinkWithEditorAction.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/LinkWithEditorAction.java Tue Oct 11 19:55:47 2016
@@ -22,16 +22,11 @@ package org.apache.directory.studio.ldap
import org.apache.directory.studio.entryeditors.EntryEditorInput;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
import org.apache.directory.studio.ldapbrowser.ui.editors.searchresult.SearchResultEditorInput;
-import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IPartListener2;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
/**
@@ -39,80 +34,11 @@ import org.eclipse.ui.IWorkbenchPartRefe
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class LinkWithEditorAction extends Action
+public class LinkWithEditorAction extends AbstractLinkWithEditorAction
{
/** The browser view */
private BrowserView browserView;
- /** The listener listening on changes on editors */
- private IPartListener2 editorListener = new IPartListener2()
- {
- /**
- * {@inheritDoc}
- */
- public void partBroughtToTop( IWorkbenchPartReference partRef )
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partActivated( IWorkbenchPartReference partRef )
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partClosed( IWorkbenchPartReference partRef )
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partDeactivated( IWorkbenchPartReference partRef )
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partHidden( IWorkbenchPartReference partRef )
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partInputChanged( IWorkbenchPartReference partRef )
- {
- linkViewWithEditor( partRef.getPart( false ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partOpened( IWorkbenchPartReference partRef )
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partVisible( IWorkbenchPartReference partRef )
- {
- linkViewWithEditor( partRef.getPart( false ) );
- }
- };
-
/**
* Creates a new instance of LinkWithEditorAction.
@@ -122,44 +48,9 @@ public class LinkWithEditorAction extend
*/
public LinkWithEditorAction( BrowserView browserView )
{
- super( Messages.getString( "LinkWithEditorAction.LinkWithEditor" ), AS_CHECK_BOX ); //$NON-NLS-1$
- setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_LINK_WITH_EDITOR ) );
- setEnabled( true );
- setChecked( BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
- BrowserUIConstants.PREFERENCE_BROWSER_LINK_WITH_EDITOR ) );
+ super( browserView, Messages.getString( "LinkWithEditorAction.LinkWithEditor" ) ); //$NON-NLS-1$
this.browserView = browserView;
-
- // Enable the listeners
- if ( isChecked() )
- {
- browserView.getSite().getWorkbenchWindow().getPartService().addPartListener( editorListener );
- }
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void run()
- {
- setChecked( isChecked() );
- BrowserUIPlugin.getDefault().getPreferenceStore().setValue(
- BrowserUIConstants.PREFERENCE_BROWSER_LINK_WITH_EDITOR, isChecked() );
-
- if ( isChecked() )
- {
- // Enable the listener
- browserView.getSite().getWorkbenchWindow().getPartService().addPartListener( editorListener );
-
- // link
- IEditorPart activeEditor = browserView.getSite().getWorkbenchWindow().getActivePage().getActiveEditor();
- linkViewWithEditor( activeEditor );
- }
- else
- {
- // Disable the listener
- browserView.getSite().getWorkbenchWindow().getPartService().removePartListener( editorListener );
- }
+ super.init();
}
@@ -168,7 +59,7 @@ public class LinkWithEditorAction extend
*
* @param partRef the part
*/
- private void linkViewWithEditor( IWorkbenchPart part )
+ protected void linkViewWithEditor( IWorkbenchPart part )
{
if ( part != null && browserView != null
&& part.getSite().getWorkbenchWindow() == browserView.getSite().getWorkbenchWindow() )
@@ -205,19 +96,4 @@ public class LinkWithEditorAction extend
}
}
-
- /**
- * Disposes this action.
- */
- public void dispose()
- {
- if ( editorListener != null )
- {
- browserView.getSite().getWorkbenchWindow().getPartService().removePartListener( editorListener );
- editorListener = null;
- }
-
- browserView = null;
- }
-
}
Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/LinkWithEditorAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/LinkWithEditorAction.java?rev=1764332&r1=1764331&r2=1764332&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/LinkWithEditorAction.java (original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/LinkWithEditorAction.java Tue Oct 11 19:55:47 2016
@@ -24,18 +24,12 @@ package org.apache.directory.studio.ldap
import org.apache.directory.studio.entryeditors.EntryEditorInput;
import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
import org.apache.directory.studio.ldapbrowser.ui.editors.searchresult.SearchResultEditorInput;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
+import org.apache.directory.studio.ldapbrowser.ui.views.browser.AbstractLinkWithEditorAction;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IPartListener2;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
/**
@@ -46,96 +40,11 @@ import org.eclipse.ui.IWorkbenchPartRefe
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class LinkWithEditorAction extends Action
+public class LinkWithEditorAction extends AbstractLinkWithEditorAction
{
/** The connection view */
private ConnectionView connectionView;
- /** The listener listening on changes on editors */
- private IPartListener2 editorListener = new IPartListener2()
- {
- /**
- * {@inheritDoc}
- */
- public void partBroughtToTop( IWorkbenchPartReference partRef )
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partActivated( IWorkbenchPartReference partRef )
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partClosed( IWorkbenchPartReference partRef )
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partDeactivated( IWorkbenchPartReference partRef )
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partHidden( IWorkbenchPartReference partRef )
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partInputChanged( IWorkbenchPartReference partRef )
- {
- linkViewWithEditor( partRef.getPart( false ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partOpened( IWorkbenchPartReference partRef )
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void partVisible( IWorkbenchPartReference partRef )
- {
- linkViewWithEditor( partRef.getPart( false ) );
- }
- };
-
- /** The listener listening on changes of the link with editor action of the browser view */
- private IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener()
- {
-
- /**
- * {@inheritDoc}
- */
- public void propertyChange( PropertyChangeEvent event )
- {
- if ( BrowserUIConstants.PREFERENCE_BROWSER_LINK_WITH_EDITOR.equals( event.getProperty() ) )
- {
- run();
- }
- }
- };
-
/**
* Creates a new instance of LinkWithEditorAction.
@@ -145,47 +54,9 @@ public class LinkWithEditorAction extend
*/
public LinkWithEditorAction( ConnectionView connectionView )
{
- super( Messages.getString( "LinkWithEditorAction.LinkWithEditor" ), AS_CHECK_BOX ); //$NON-NLS-1$
-
- super.setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor(
- BrowserUIConstants.IMG_LINK_WITH_EDITOR ) );
- super.setEnabled( true );
+ super( connectionView, Messages.getString( "LinkWithEditorAction.LinkWithEditor" ) ); //$NON-NLS-1$
this.connectionView = connectionView;
-
- super.setChecked( BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
- BrowserUIConstants.PREFERENCE_BROWSER_LINK_WITH_EDITOR ) );
-
- // enable the listeners
- BrowserUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( propertyChangeListener );
- if ( isChecked() )
- {
- connectionView.getSite().getWorkbenchWindow().getPartService().addPartListener( editorListener );
- }
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void run()
- {
- setChecked( BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
- BrowserUIConstants.PREFERENCE_BROWSER_LINK_WITH_EDITOR ) );
-
- if ( isChecked() )
- {
- // enable the listeners
- connectionView.getSite().getWorkbenchWindow().getPartService().addPartListener( editorListener );
-
- // link
- IEditorPart activeEditor = connectionView.getSite().getWorkbenchWindow().getActivePage().getActiveEditor();
- linkViewWithEditor( activeEditor );
- }
- else
- {
- // dsable the listeners
- connectionView.getSite().getWorkbenchWindow().getPartService().removePartListener( editorListener );
- }
+ super.init();
}
@@ -194,7 +65,7 @@ public class LinkWithEditorAction extend
*
* @param partRef the part
*/
- private void linkViewWithEditor( IWorkbenchPart part )
+ protected void linkViewWithEditor( IWorkbenchPart part )
{
if ( part != null && connectionView != null
&& part.getSite().getWorkbenchWindow() == connectionView.getSite().getWorkbenchWindow() )
@@ -239,20 +110,4 @@ public class LinkWithEditorAction extend
}
}
-
- /**
- * Disposes this action.
- */
- public void dispose()
- {
- if ( editorListener != null )
- {
- connectionView.getSite().getWorkbenchWindow().getPartService().removePartListener( editorListener );
- BrowserUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener( propertyChangeListener );
- editorListener = null;
- }
-
- connectionView = null;
- }
-
}
Modified: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/TemplateEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/TemplateEntryEditor.java?rev=1764332&r1=1764331&r2=1764332&view=diff
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/TemplateEntryEditor.java (original)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/TemplateEntryEditor.java Tue Oct 11 19:55:47 2016
@@ -23,13 +23,11 @@ package org.apache.directory.studio.temp
import org.apache.directory.studio.entryeditors.EntryEditorInput;
import org.apache.directory.studio.entryeditors.EntryEditorUtils;
import org.apache.directory.studio.entryeditors.IEntryEditor;
-import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
-import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.INavigationLocation;
import org.eclipse.ui.INavigationLocationProvider;
@@ -268,6 +266,15 @@ public abstract class TemplateEntryEdito
{
if ( input instanceof EntryEditorInput )
{
+ /*
+ * Optimization: no need to set the input again if the same input is already set
+ */
+ if ( getEntryEditorInput() != null
+ && getEntryEditorInput().getResolvedEntry() == ( ( EntryEditorInput ) input ).getResolvedEntry() )
+ {
+ return;
+ }
+
// If the editor is dirty, let's ask for a save before changing the input
if ( isDirty() )
{
@@ -277,37 +284,10 @@ public abstract class TemplateEntryEdito
}
}
- /*
- * Workaround to make link-with-editor working for the single-tab editor:
- * The call of firePropertyChange is used to inform the link-with-editor action.
- * However firePropertyChange also modifies the navigation history.
- * Thus, a dummy input with the real entry but a null extension is set.
- * This avoids to modification of the navigation history.
- * Afterwards the real input is set.
- */
- EntryEditorInput eei = ( EntryEditorInput ) input;
- IEntry entryInput = eei.getEntryInput();
- ISearchResult searchResultInput = eei.getSearchResultInput();
- IBookmark bookmarkInput = eei.getBookmarkInput();
- EntryEditorInput dummyInput;
- if ( entryInput != null )
- {
- dummyInput = new EntryEditorInput( entryInput, null );
- }
- else if ( searchResultInput != null )
- {
- dummyInput = new EntryEditorInput( searchResultInput, null );
- }
- else
- {
- dummyInput = new EntryEditorInput( bookmarkInput, null );
- }
- setInput( dummyInput );
- firePropertyChange( IEditorPart.PROP_INPUT );
-
// now set the real input and mark history location
setInput( input );
getSite().getPage().getNavigationHistory().markLocation( this );
+ firePropertyChange( BrowserUIConstants.INPUT_CHANGED );
// Updating the input on the template editor widget
templateEditorWidget.editorInputChanged();
Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java?rev=1764332&r1=1764331&r2=1764332&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java (original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java Tue Oct 11 19:55:47 2016
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertFal
import static org.junit.Assert.assertTrue;
import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.lang.StringUtils;
import org.apache.directory.server.annotations.CreateLdapServer;
@@ -44,6 +45,9 @@ import org.apache.directory.studio.ldapb
import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
import org.apache.directory.studio.ldapbrowser.core.model.impl.Bookmark;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
+import org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditor;
import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.DeleteDialogBot;
@@ -55,6 +59,11 @@ import org.apache.directory.studio.test.
import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.PlatformUI;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -541,4 +550,77 @@ public class BrowserTest extends Abstrac
assertTrue( entry.contains( "uid", "user.1" ) );
}
+
+ /**
+ * Test for DIRSTUDIO-XXX.
+ *
+ * Verify input is set only once when entry is selected.
+ */
+ @Test
+ public void TestSetInputOnlyOnce() throws Exception
+ {
+ browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+
+ // verify link-with-editor is enabled
+ assertTrue( BrowserUIPlugin.getDefault().getPreferenceStore()
+ .getBoolean( BrowserUIConstants.PREFERENCE_BROWSER_LINK_WITH_EDITOR ) );
+
+ // setup counter and listener to record entry editor input changes
+ final AtomicInteger counter = new AtomicInteger();
+ UIThreadRunnable.syncExec( new VoidResult()
+ {
+ public void run()
+ {
+ try
+ {
+ IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .getActiveEditor();
+ editor.addPropertyListener( new IPropertyListener()
+ {
+ @Override
+ public void propertyChanged( Object source, int propId )
+ {
+ if ( source instanceof EntryEditor && propId == BrowserUIConstants.INPUT_CHANGED )
+ {
+ counter.incrementAndGet();
+ }
+ }
+ } );
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+ } );
+
+ // select 3 different entries, select one twice should not set the input again
+ browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
+ browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
+ browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.2" );
+ browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.2" );
+ browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.3" );
+ browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.3" );
+
+ // verify that input was only set 3 times.
+ assertEquals( "Only 3 input changes expected.", 3, counter.get() );
+
+ // reset counter
+ counter.set( 0 );
+
+ // use navigation history to go back and forth, each step should set input only once
+ studioBot.navigationHistoryBack();
+ assertEquals( "uid=user.2", browserViewBot.getSelectedEntry() );
+ studioBot.navigationHistoryBack();
+ assertEquals( "uid=user.1", browserViewBot.getSelectedEntry() );
+ studioBot.navigationHistoryForward();
+ assertEquals( "uid=user.2", browserViewBot.getSelectedEntry() );
+ studioBot.navigationHistoryForward();
+ assertEquals( "uid=user.3", browserViewBot.getSelectedEntry() );
+
+ // verify that input was only set 4 times.
+ assertEquals( "Only 4 input changes expected.", 4, counter.get() );
+ }
+
}
Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java?rev=1764332&r1=1764331&r2=1764332&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java (original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java Tue Oct 11 19:55:47 2016
@@ -43,6 +43,11 @@ public class BrowserViewBot
}
+ public String getSelectedEntry() {
+ return browserBot.getSelectedEntry();
+ }
+
+
public boolean existsEntry( String... path )
{
return browserBot.existsEntry( path );
Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java?rev=1764332&r1=1764331&r2=1764332&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java (original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java Tue Oct 11 19:55:47 2016
@@ -113,6 +113,12 @@ class BrowserWidgetBot
}
+ String getSelectedEntry()
+ {
+ return getTree().selection().get( 0 ).get( 0 );
+ }
+
+
private SWTBotTreeItem getEntry( String... path )
{
SWTBotTree browserTree = bot.tree();
Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java?rev=1764332&r1=1764331&r2=1764332&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java (original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java Tue Oct 11 19:55:47 2016
@@ -26,6 +26,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
import org.eclipse.ui.IViewReference;
@@ -228,4 +229,17 @@ public class StudioBot
new SWTBot().menu( "Window" ).menu( "Show View" ).menu( "Other..." ).click();
return new ShowViewsBot();
}
+
+
+ public void navigationHistoryBack()
+ {
+ new SWTBot().activeShell().pressShortcut( Keystrokes.ALT, Keystrokes.LEFT );
+ }
+
+
+ public void navigationHistoryForward()
+ {
+ new SWTBot().activeShell().pressShortcut( Keystrokes.ALT, Keystrokes.RIGHT );
+ }
+
}