use of org.intellij.images.thumbnail.ThumbnailView in project intellij-community by JetBrains.
the class ShowThumbnailsAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE);
if (project != null && file != null && file.isDirectory()) {
ThumbnailManager thumbnailManager = ThumbnailManager.getManager(project);
ThumbnailView thumbnailView = thumbnailManager.getThumbnailView();
thumbnailView.setRoot(file);
thumbnailView.setVisible(true);
thumbnailView.activate();
}
}
use of org.intellij.images.thumbnail.ThumbnailView in project intellij-community by JetBrains.
the class ThumbnailViewActionUtil method setEnabled.
/**
* Enable or disable current action from event.
*
* @param e Action event
* @return Enabled value
*/
public static boolean setEnabled(AnActionEvent e) {
ThumbnailView thumbnailView = getVisibleThumbnailView(e);
Presentation presentation = e.getPresentation();
presentation.setEnabled(thumbnailView != null);
return presentation.isEnabled();
}
use of org.intellij.images.thumbnail.ThumbnailView in project intellij-community by JetBrains.
the class FilterByThemeComboBoxAction method update.
public void update(final AnActionEvent e) {
Project project = e.getProject();
ThumbnailView view = ThumbnailViewActionUtil.getVisibleThumbnailView(e);
boolean hasApplicableExtension = Arrays.stream(ThemeFilter.EP_NAME.getExtensions()).allMatch(filter -> project != null && filter.isApplicableToProject(project));
e.getPresentation().setVisible(view != null && hasApplicableExtension);
ThemeFilter filter = view != null ? view.getFilter() : null;
e.getPresentation().setText(filter == null ? "All" : filter.getDisplayName());
}
use of org.intellij.images.thumbnail.ThumbnailView in project intellij-community by JetBrains.
the class UpFolderAction method update.
public void update(AnActionEvent e) {
super.update(e);
if (ThumbnailViewActionUtil.setEnabled(e)) {
ThumbnailView view = ThumbnailViewActionUtil.getVisibleThumbnailView(e);
VirtualFile root = view.getRoot();
e.getPresentation().setEnabled(root != null && root.getParent() != null && !view.isRecursive());
}
}
use of org.intellij.images.thumbnail.ThumbnailView in project intellij-community by JetBrains.
the class ThumbnailSelectInTarget method selectIn.
public void selectIn(SelectInContext context, final boolean requestFocus) {
VirtualFile virtualFile = context.getVirtualFile();
VirtualFile parent = virtualFile.getParent();
if (parent != null) {
final Project project = context.getProject();
ThumbnailView thumbnailView = ThumbnailManager.getManager(project).getThumbnailView();
thumbnailView.setRoot(parent);
thumbnailView.setVisible(true);
thumbnailView.setSelected(virtualFile, true);
thumbnailView.scrollToSelection();
}
}
Aggregations