mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EDU-409 Show Preview action does nothing for non-text files (e.g.pictures)
This commit is contained in:
+7
-5
@@ -31,6 +31,7 @@ import com.intellij.openapi.project.DumbModePermission;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.FrameWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
@@ -54,7 +55,7 @@ public class CCShowPreview extends DumbAwareAction {
|
||||
private static final Logger LOG = Logger.getInstance(CCShowPreview.class.getName());
|
||||
|
||||
public CCShowPreview() {
|
||||
super("Show Preview","Show preview", null);
|
||||
super("Show Preview","Show Preview", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,12 +64,10 @@ public class CCShowPreview extends DumbAwareAction {
|
||||
return;
|
||||
}
|
||||
Presentation presentation = e.getPresentation();
|
||||
presentation.setEnabled(false);
|
||||
presentation.setVisible(false);
|
||||
presentation.setEnabledAndVisible(false);
|
||||
final PsiFile file = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
|
||||
if (file != null && file.getName().contains(".answer")) {
|
||||
presentation.setEnabled(true);
|
||||
presentation.setVisible(true);
|
||||
presentation.setEnabledAndVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +98,9 @@ public class CCShowPreview extends DumbAwareAction {
|
||||
if (taskFile == null) {
|
||||
return;
|
||||
}
|
||||
if (taskFile.getAnswerPlaceholders().isEmpty()) {
|
||||
Messages.showInfoMessage("Preview is available for task files with answer placeholders only", "No Preview for This File");
|
||||
}
|
||||
final TaskFile taskFileCopy = new TaskFile();
|
||||
TaskFile.copy(taskFile, taskFileCopy);
|
||||
final String taskFileName = CCProjectService.getRealTaskFileName(file.getVirtualFile().getName());
|
||||
|
||||
Reference in New Issue
Block a user