Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
optimise bookmark message from search result
  • Loading branch information
Patrick Huang committed Apr 29, 2013
1 parent c6bfa6b commit 86fe494
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Expand Up @@ -602,12 +602,15 @@ public void execute(TransUnitReplaceInfo info)
// in the case of editor still in filter mode or search result,
// requested text flow may not appear in result. We want to make
// sure it reloads everything for this document.
contextHolder.updateContext(null); // this will ensure HistoryEventHandlerService fire InitEditorEvent

HistoryToken token = history.getHistoryToken();
if (!contextHolder.getContext().acceptAll())
{
contextHolder.updateContext(null); // this will ensure HistoryEventHandlerService fire InitEditorEvent
token.clearEditorFilterAndSearch();
}
token.setView(MainView.Editor);
token.setDocumentPath(docPaths.get(info.getDocId()));
token.clearEditorFilterAndSearch();
token.setTextFlowId(info.getTransUnit().getId().toString());
history.newItem(token);
}
Expand Down
Expand Up @@ -28,6 +28,7 @@
import org.zanata.webtrans.shared.model.ValidationId;

import com.google.common.base.Objects;
import com.google.common.base.Strings;

/**
* This class is immutable and all the mutator methods will return a new instance of it.
Expand Down Expand Up @@ -237,4 +238,10 @@ public boolean needReloadNavigationIndex(GetTransUnitActionContext newContext)
|| !Objects.equal(findMessage, newContext.findMessage);
// @formatter:on
}

public boolean acceptAll()
{
boolean messageFilterAcceptAll = filterHasError == filterNeedReview && filterNeedReview == filterTranslated && filterTranslated == filterUntranslated;
return messageFilterAcceptAll && Strings.isNullOrEmpty(findMessage);
}
}
Expand Up @@ -88,9 +88,6 @@ public class NavigationService implements TransUnitUpdatedEventHandler, FindMess

private final History history;

//tracking variables
private GetTransUnitActionContext context;

@Inject
public NavigationService(EventBus eventBus, CachingDispatchAsync dispatcher, UserConfigHolder configHolder, TableEditorMessages messages, SinglePageDataModelImpl pageModel, ModalNavigationStateHolder navigationStateHolder, GetTransUnitActionContextHolder getTransUnitActionContextHolder, History history)
{
Expand Down

0 comments on commit 86fe494

Please sign in to comment.