Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package mobi.hsz.idea.gitignore; | ||
|
||
public class GitignoreException extends Exception { | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import com.intellij.openapi.project.Project; | ||
import com.intellij.openapi.vfs.VirtualFile; | ||
import mobi.hsz.idea.gitignore.GitignoreBundle; | ||
import mobi.hsz.idea.gitignore.util.ExternalFileException; | ||
import mobi.hsz.idea.gitignore.util.Icons; | ||
import mobi.hsz.idea.gitignore.util.Utils; | ||
import org.jetbrains.annotations.NotNull; | ||
|
@@ -30,9 +31,15 @@ public void update(AnActionEvent e) { | |
final Project project = e.getData(CommonDataKeys.PROJECT); | ||
files.clear(); | ||
if (project != null && file != null) { | ||
files.addAll(Utils.getSuitableGitignoreFiles(project, file)); | ||
Collections.reverse(files); | ||
baseDir = project.getBaseDir(); | ||
try { | ||
files.addAll(Utils.getSuitableGitignoreFiles(project, file)); | ||
e.getPresentation().setVisible(true); | ||
Collections.reverse(files); | ||
baseDir = project.getBaseDir(); | ||
} catch (ExternalFileException e1) { | ||
e.getPresentation().setVisible(false); | ||
e1.printStackTrace(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
hsz
Author
Member
|
||
} | ||
} | ||
setPopup(files.size() > 1); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package mobi.hsz.idea.gitignore.util; | ||
|
||
import mobi.hsz.idea.gitignore.GitignoreException; | ||
|
||
public class ExternalFileException extends GitignoreException { | ||
} |
2 comments
on commit e705c68
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringUtil.startsWith(file.getCanonicalPath(), project.getBasePath()) could be changed to util-method
com.intellij.openapi.vfs.VfsUtilCore#isAncestor()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with 3c4b494
quite sensless action, user won't see that, you can try to use com.intellij.openapi.diagnostic.Logger#getInstance().error(). In this case someone could report an exception to JetBrains.