String message = "Review file " + iReviewFile + " is readonly. Please make it writable " +
"to save your issues.";
ReviewDialog.openSimpleComfirmMessageDialog("Review Management", message);
}
ReviewTableView tableView = ReviewTableView.getActiveView();
String selectedIssueId = "";
if (tableView != null) {
TableItem[] selecteItems = tableView.getTable().getSelection();
if (selecteItems.length > 0) {
selectedIssueId = ((ReviewIssue) selecteItems[0].getData()).getIssueId();
}
}
ReviewIssueModelManager reviewIssueModelManager = ReviewIssueModelManager.getInstance();
ReviewIssueModel reviewIssueModel = reviewIssueModelManager.getModel(project, reviewId);
reviewIssueModel.notifyListeners(ReviewIssueModelEvent.MERGE);
ColumnDataModelManager columnDataModelManager = ColumnDataModelManager.getInstance();
ColumnDataModel columnDataModel = columnDataModelManager.getModel(reviewPhaseNameKey);
reviewModel = ReviewModel.getInstance();
project = reviewModel.getProjectManager().getProject();
reviewId = reviewModel.getReviewIdManager().getReviewId();
reviewerId = reviewModel.getReviewerIdManager().getReviewerId();
iReviewFile = FileResource.getReviewFile(project, reviewId, reviewerId);
// null happens when the view is not opened yet after Eclipse startup.
if (tableView == null) {
tableView = ReviewTableView.bringViewToTop();
}
tableView.createColumns(columnDataModel);
PropertyResource propertyResource = PropertyResource.getInstance(project, true);
String reviewIdString = reviewId.getReviewId();
ReviewResource reviewResource = propertyResource.getReviewResource(reviewIdString, true);
IPreferenceStore store = ReviewPlugin.getInstance().getPreferenceStore();
String prefFilterKey = FilterPreferencePage.ENABLE_FILTER_STORE_KEY;
boolean isPrefFilterEnabled = store.getBoolean(prefFilterKey);
if (isPrefFilterEnabled) {
tableView.setFilterStatus(isPrefFilterEnabled);
}
else {
if (reviewResource != null) {
FilterPhase filterPhase = reviewResource.getFilterPhase(reviewPhaseNameKey);
tableView.setFilterStatus(filterPhase.isEnabled());
}
}
// Opens editor view.
try {
ReviewEditorView editorView = ReviewEditorView.bringViewToTop();
TableItem[] tableItems = tableView.getTable().getItems();
boolean isFound = false;
// select the previous selected item.
for (int i = 0; i < tableItems.length; i++) {
String issueId = ((ReviewIssue) tableItems[i].getData()).getIssueId();
if (issueId.equals(selectedIssueId)) {
tableView.getTable().select(i);
isFound = true;
break;
}
}
if (!isFound) {
if (tableView.getTable().getItemCount() > 0) {
tableView.getTable().select(0);
}
else {
editorView.clearAllFields();
editorView.setEnable(false);
}