Search in sources :

Example 1 with ThumbnailView

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();
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) ThumbnailManager(org.intellij.images.thumbnail.ThumbnailManager) ThumbnailView(org.intellij.images.thumbnail.ThumbnailView)

Example 2 with ThumbnailView

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();
}
Also used : ThumbnailView(org.intellij.images.thumbnail.ThumbnailView) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 3 with ThumbnailView

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());
}
Also used : Project(com.intellij.openapi.project.Project) ThumbnailView(org.intellij.images.thumbnail.ThumbnailView)

Example 4 with ThumbnailView

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());
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ThumbnailView(org.intellij.images.thumbnail.ThumbnailView)

Example 5 with ThumbnailView

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();
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) ThumbnailView(org.intellij.images.thumbnail.ThumbnailView)

Aggregations

ThumbnailView (org.intellij.images.thumbnail.ThumbnailView)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 Project (com.intellij.openapi.project.Project)3 Presentation (com.intellij.openapi.actionSystem.Presentation)2 ImageFileTypeManager (org.intellij.images.fileTypes.ImageFileTypeManager)1 ThumbnailManager (org.intellij.images.thumbnail.ThumbnailManager)1