Skip to content

Instantly share code, notes, and snippets.

@jorgecc
Created March 5, 2022 22:44
Show Gist options
  • Save jorgecc/c9bec0c17bac4df51b2ac58bc3ff01b3 to your computer and use it in GitHub Desktop.
Save jorgecc/c9bec0c17bac4df51b2ac58bc3ff01b3 to your computer and use it in GitHub Desktop.
fix for phpunit_codecoverage_display
package cc.takacs.php_codeverage_display;
import cc.takacs.php_codeverage_display.toolbar.ToggleIconService;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ApplicationComponent;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.TimeUnit;
/**
* @author Zsolt Takacs <zsolt@takacs.cc>
* hacky fix by Jorge Castro jcastro@eftec.cl
*/
public class ApplicationPlugin implements ApplicationComponent {
@Override
public void initComponent() {
ApplicationManager.getApplication().executeOnPooledThread(() -> {
try {
TimeUnit.SECONDS.sleep(30);
} catch (InterruptedException e) {
}
AnAction toolbarButton = ActionManager.getInstance().getAction("cc.takacs.php_codeverage_display.toolbar.enable");
final boolean enabled = PropertiesComponent.getInstance().getBoolean("cc.takacs.php_codeverage_display.enabled", true);
new ToggleIconService().toggleIcon(toolbarButton.getTemplatePresentation(), enabled);
});
}
@Override
public void disposeComponent() {
}
@NotNull
@Override
public String getComponentName() {
return "ApplicationPlugin";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment