Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions build.gradle

This file was deleted.

53 changes: 53 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "1.9.23"
id("org.jetbrains.intellij") version "1.17.4"
}

group = "com.nvlad"
version = "1.0.10"

repositories {
mavenCentral()
}

// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
version.set("2024.1.7")
}

tasks {
// Set the JVM compatibility versions
withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}

patchPluginXml {
sinceBuild.set("232")
untilBuild.set("260")
}

signPlugin {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}

publishPlugin {
token.set(System.getenv("PUBLISH_TOKEN"))
}
}


dependencies {
implementation("com.tinify:tinify:1.8.8")
implementation("io.sentry:sentry:1.7.16") {
exclude(group = "org.slf4j", module = "org.slf4j")
exclude(group = "com.fasterxml.jackson.core", module = "jackson-core")
}
}
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Jan 21 05:15:54 MSK 2019
#Fri Apr 11 07:32:57 CST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
zipStorePath=wrapper/dists
7 changes: 7 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}

rootProject.name = 'tinypng-optimizer'

8 changes: 8 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}

rootProject.name = "tinypng-optimizer"
22 changes: 4 additions & 18 deletions src/main/java/com/nvlad/tinypng/actions/BaseCompressAction.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.nvlad.tinypng.actions;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
Expand All @@ -16,7 +13,7 @@
import java.util.List;

public abstract class BaseCompressAction extends AnAction {
private static final String[] supportedExtensions = {"png", "jpg", "jpeg"};
private static final String[] SUPPORTED_EXTENSIONS = {"png", "jpg", "jpeg"};

@Override
public void actionPerformed(AnActionEvent e) {
Expand All @@ -34,18 +31,6 @@ public void actionPerformed(AnActionEvent e) {
}
}

@Override
public void update(AnActionEvent e) {
PluginGlobalSettings settings = PluginGlobalSettings.getInstance();
if (!settings.checkSupportedFiles) {
return;
}

final List<VirtualFile> list = getSupportedFileList(PlatformDataKeys.VIRTUAL_FILE_ARRAY.getData(e.getDataContext()), true);
final Presentation presentation = e.getPresentation();
presentation.setEnabled(!list.isEmpty());
}

@Override
public boolean isDumbAware() {
return true;
Expand All @@ -59,6 +44,7 @@ List<VirtualFile> getSupportedFileList(VirtualFile[] files, boolean breakOnFirst

for (VirtualFile file : files) {
if (file.isDirectory()) {
//noinspection UnsafeVfsRecursion
result.addAll(getSupportedFileList(file.getChildren(), breakOnFirstFound));
if (breakOnFirstFound && !result.isEmpty()) {
break;
Expand All @@ -68,7 +54,7 @@ List<VirtualFile> getSupportedFileList(VirtualFile[] files, boolean breakOnFirst
}

final String extension = file.getExtension();
if (extension != null && ArrayUtil.contains(extension.toLowerCase(), supportedExtensions)) {
if (extension != null && ArrayUtil.contains(extension.toLowerCase(), SUPPORTED_EXTENSIONS)) {
result.add(file);
if (breakOnFirstFound) {
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.List;

public class CompressDialogAction extends BaseCompressAction {

@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ public String getReportActionText() {
}

@Override
public boolean submit(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo, @NotNull Component parentComponent, @NotNull Consumer<SubmittedReportInfo> consumer) {
public boolean submit(IdeaLoggingEvent @NotNull [] events, @Nullable String additionalInfo, @NotNull Component parentComponent, @NotNull Consumer<? super SubmittedReportInfo> consumer) {
for (IdeaLoggingEvent event : events) {
Throwable throwable = event.getThrowable();
if (event.getData() instanceof AbstractMessage) {
throwable = ((AbstractMessage) event.getData()).getThrowable();
}

SentryErrorReporter.submitErrorReport(throwable, additionalInfo, consumer);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.Map;

class SentryErrorReporter {
static void submitErrorReport(Throwable error, String description, Consumer<SubmittedReportInfo> consumer) {
static void submitErrorReport(Throwable error, String description, Consumer<? super SubmittedReportInfo> consumer) {
final SentryClient sentry = SentryClientFactory.sentryClient("https://f6b3a5fb9f11461ab70f481eb68ed237@sentry.nvlad.com/6");
sentry.addEventSendCallback(new EventSendCallback() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.CheckboxTree;
import com.intellij.ui.JBColor;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.tree.TreeUtil;
import com.nvlad.tinypng.Constants;
Expand Down Expand Up @@ -68,6 +69,7 @@ public ProcessImageDialog(Project project, List<VirtualFile> files, List<Virtual
// call onCancel() when cross is clicked
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
onClose();
}
Expand Down Expand Up @@ -113,14 +115,17 @@ public void propertyChange(PropertyChangeEvent evt) {
}

private void configureUI() {
UIUtil.removeScrollBorder(scrollPanel);
splitPanel.setBackground(UIUtil.getPanelBackground());
splitPanel.setUI(new BasicSplitPaneUI() {
@Override
public BasicSplitPaneDivider createDefaultDivider() {
return new BasicSplitPaneDivider(this) {
private final int dashHeight = 40;
private Color background = UIUtil.getPanelBackground();
private Color dashes = UIUtil.getSeparatorColor();
private Color dashes = JBUI.CurrentTheme.CustomFrameDecorations.separatorForeground();

@Override
public void setBorder(Border b) {
}

Expand Down Expand Up @@ -208,7 +213,6 @@ private void onClose() {

private void createUIComponents() {
// TODO: place custom component creation code here
UIUtil.removeScrollBorder(scrollPanel);
imageBefore = new JImage();
imageAfter = new JImage();
fileTree = new CheckboxTree(new FileCellRenderer(myProject), buildTree());
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/com/nvlad/tinypng/ui/dialogs/Toolbar.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.nvlad.tinypng.ui.dialogs;

import com.intellij.icons.AllIcons;
import com.intellij.ide.actions.AboutAction;
import com.intellij.openapi.actionSystem.*;
import org.intellij.images.actions.ToggleTransparencyChessboardAction;

import javax.swing.*;
import java.awt.*;
Expand All @@ -12,12 +10,6 @@ class Toolbar {
static JPanel create() {
DefaultActionGroup group = new DefaultActionGroup();
group.add(new AboutAction());
// group.add(new AnAction(ToggleTransparencyChessboardAction) {
// @Override
// public void actionPerformed(AnActionEvent e) {
//
// }
// });

ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar("top", group, true);
JPanel toolbar = (JPanel) actionToolbar.getComponent();
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
<depends>com.intellij.modules.lang</depends>
<idea-version since-build="163"/>
<extensions defaultExtensionNs="com.intellij">
<applicationService serviceImplementation="com.nvlad.tinypng.PluginGlobalSettings"/>
<!-- Add your extensions here -->
Expand Down