Permalink
Browse files

invalid node fixed

searcher fixed
  • Loading branch information...
1 parent c249c27 commit 89b858486139f7d20921c7aeba9a8acdb90ff3de @fearfall fearfall committed Aug 10, 2011
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,6 +1,5 @@
package patch;
-import com.intellij.openapi.Disposable;
import com.intellij.openapi.vcs.CheckinProjectPanel;
import com.intellij.openapi.vcs.checkin.CheckinHandler;
import com.intellij.openapi.vcs.checkin.CheckinHandlerFactory;
@@ -4,18 +4,14 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.util.xmlb.XmlSerializer;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
-import org.jdom.output.Format;
-import org.jdom.output.XMLOutputter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import reviewresult.ReviewManager;
import reviewresult.persistent.ReviewsState;
-import ui.reviewpoint.ReviewPointManager;
import java.io.IOException;
import java.io.StringReader;
@@ -5,7 +5,6 @@
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
@@ -36,6 +35,7 @@ public Review(@NotNull ReviewBean reviewBean, @NotNull Project project){
this.virtualFile = VirtualFileManager.getInstance().refreshAndFindFileByUrl(reviewBean.getFilePath());
if(virtualFile == null) {reviewBean.setValid(false); return;}
+
this.reviewBean.checkValid(virtualFile.getLength(), virtualFile.isValid());
}
@@ -77,7 +77,7 @@ public OpenFileDescriptor getElement() {
public boolean isValid() {
return reviewBean.isValid()
- && ReviewManager.getInstance(project).getRootManager().getFileIndex().isInContent(virtualFile);
+ && ProjectRootManager.getInstance(project).getFileIndex().isInContent(virtualFile);
}
public int getLine() {
@@ -1,10 +1,11 @@
package reviewresult;
-import com.intellij.openapi.components.*;
+import com.intellij.ide.startup.StartupManagerEx;
+import com.intellij.openapi.components.AbstractProjectComponent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.vfs.*;
import com.intellij.util.xmlb.XmlSerializer;
import org.jdom.Element;
@@ -13,10 +14,8 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import reviewresult.persistent.ReviewBean;
-import reviewresult.persistent.ReviewItem;
import reviewresult.persistent.ReviewsState;
import ui.reviewpoint.ReviewPointManager;
-import utils.Util;
import java.util.*;
@@ -30,20 +29,21 @@
private Map<String, List<Review>> filePath2reviews = new HashMap<String, List<Review>>();
- private Set<String> exportedFiles = new HashSet<String>();
+ //exported files = files, which already were exported in patch file
+ // private Set<String> exportedFiles = new HashSet<String>();
private boolean saveReviewsToPatch;
private final ReviewsChangedListener eventPublisher;
private static final Logger LOG = Logger.getInstance(ReviewManager.class.getName());
- private ProjectRootManager rootManager;
+ private final StartupManagerEx startupManager;
- public ReviewManager(@NotNull Project project, final ProjectRootManager rootManager) {
+ public ReviewManager(@NotNull Project project, final StartupManager startupManager) {
super(project);
- this.rootManager = rootManager;
+ this.startupManager = (StartupManagerEx)startupManager;
VirtualFileManager.getInstance().addVirtualFileListener(new ReviewVirtualFileListener(), project);
eventPublisher = project.getMessageBus().syncPublisher(ReviewChangedTopics.REVIEW_STATUS);
@@ -53,9 +53,6 @@ public static ReviewManager getInstance(@NotNull Project project) {
return project.getComponent(ReviewManager.class);
}
- public ProjectRootManager getRootManager() {
- return rootManager;
- }
public List<ReviewBean> getState() {
List<ReviewBean> result = new ArrayList<ReviewBean>();
@@ -75,16 +72,25 @@ public void loadReviewsForFile(List<ReviewBean> reviewBeans) {
loadReviews(reviewBeans, true);
}
- public void loadReviews(List<ReviewBean> reviewBeans, boolean part) {
- if(!part) {
+ public void loadReviews(List<ReviewBean> reviewBeans, boolean isPartOfState) {
+ if(!isPartOfState) {
filePath2reviews = new HashMap<String, List<Review>>();
}
for (ReviewBean reviewBean : reviewBeans) {
- Review review = new Review(reviewBean, myProject);
- addReview(review);
-
+ final Review review = new Review(reviewBean, myProject);
+ Runnable runnable = new Runnable() {
+ public void run() {
+ addReview(review);
+ }
+ };
+ if (startupManager.startupActivityPassed()) {
+ runnable.run();
+ }
+ else {
+ startupManager.registerPostStartupActivity(runnable);
+ }
}
- ReviewPointManager.getInstance(myProject).updateUI();
+ //ReviewPointManager.getInstance(myProject).updateUI();
}
@@ -140,12 +146,11 @@ public void addReview(Review newReview) {
return reviewsList;
}
+ @Nullable
public Set<String> getFileNames() {
return filePath2reviews.keySet();
}
-
-
@NotNull
@Override
public String getComponentName() {
@@ -211,24 +216,20 @@ public boolean isSaveReviewsToPatch() {
return saveReviewsToPatch;
}
- public List<ReviewBean> getReviewsToExport() {
- return getReviewsToExport("");
- }
-
-
@Nullable
public List<ReviewBean> getReviewsToExport(String filepath) {
- if(exportedFiles.isEmpty()) {
+ /*if(exportedFiles.isEmpty()) {
exportedFiles = filePath2reviews.keySet();
}
+ */
List<ReviewBean> result = new ArrayList<ReviewBean>();
if("".equals(filepath)) {
for(String path : filePath2reviews.keySet()) {
result.addAll(getAddedForFile(path));
}
return result;
}
- exportedFiles.remove(filepath);
+// exportedFiles.add(filepath);
return getAddedForFile(filepath);
}
@@ -1,8 +1,5 @@
package reviewresult;
-import com.intellij.util.messages.Topic;
-import reviewresult.Review;
-
import java.util.EventListener;
/**
@@ -3,9 +3,6 @@
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.Tag;
-import org.apache.commons.lang.Validate;
-import org.jetbrains.annotations.NotNull;
-import ui.actions.DeleteReviewAction;
import java.util.ArrayList;
import java.util.List;
@@ -3,7 +3,6 @@
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.Tag;
-import com.intellij.util.xmlb.annotations.Transient;
import reviewresult.ReviewStatus;
import java.util.Date;
@@ -6,29 +6,17 @@
import com.intellij.openapi.editor.CaretModel;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.event.CaretEvent;
-import com.intellij.openapi.editor.event.CaretListener;
-import com.intellij.openapi.editor.ex.EditorEx;
-import com.intellij.openapi.editor.ex.EditorGutterComponentEx;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.popup.Balloon;
-import com.intellij.openapi.ui.popup.BalloonBuilder;
-import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
-import com.intellij.ui.awt.RelativePoint;
import reviewresult.Review;
import reviewresult.ReviewManager;
-import ui.forms.EditReviewForm;
import ui.reviewpoint.ReviewPoint;
import ui.reviewpoint.ReviewPointManager;
-import javax.swing.*;
-import java.awt.*;
-
/**
* User: Alisa.Afonina
* Date: 7/12/11
@@ -3,17 +3,13 @@
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
-import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.vfs.VirtualFile;
import reviewresult.Review;
import reviewresult.ReviewManager;
-import sun.misc.resources.Messages_es;
-import ui.reviewpoint.ReviewPoint;
-import ui.reviewtoolwindow.ReviewView;
import javax.swing.*;
@@ -44,15 +40,16 @@ public void actionPerformed(AnActionEvent e) {
if(review == null) review = e.getData(Review.REVIEW_DATA_KEY);
if(review != null) {
if(Messages.showOkCancelDialog(project, "Are you sure you want to delete review?",
- "Delete review", null) == Messages.OK) {
+ "Delete Review", null) == Messages.OK) {
instance.removeReview(review);
review = null;
}
} else {
VirtualFile file = PlatformDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
if(file != null) {
if(Messages.showOkCancelDialog(project, "Are you sure you want to delete all reviews in this file?",
- "Delete reviews", null) == Messages.OK) {
+ "Delete Reviews", null) == Messages.OK) {
+
instance.removeAll(file);
}
}
@@ -5,20 +5,12 @@
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.ex.EditorEx;
-import com.intellij.openapi.editor.ex.EditorGutterComponentEx;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.popup.Balloon;
-import com.intellij.openapi.ui.popup.BalloonBuilder;
-import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.IconLoader;
-import com.intellij.ui.awt.RelativePoint;
-import ui.forms.EditReviewForm;
import ui.reviewpoint.ReviewPoint;
import javax.swing.*;
-import java.awt.*;
/**
* User: Alisa.Afonina
Oops, something went wrong.

0 comments on commit 89b8584

Please sign in to comment.