{
inShowEditorInput = true;
if ( input instanceof EntryEditorInput )
{
EntryEditorInput eei = ( EntryEditorInput ) input;
/*
* Optimization: no need to set the input again if the same input is already set
*/
if ( getEntryEditorInput() != null
&& getEntryEditorInput().getResolvedEntry() == eei.getResolvedEntry() )
{
return;
}
// If the editor is dirty, let's ask for a save before changing the input
if ( isDirty() )
{
if ( !EntryEditorUtils.askSaveSharedWorkingCopyBeforeInputChange( this ) )
{
return;
}
}
/*
* 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