-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bundle settings button, url fixes (#136)
- Loading branch information
Showing
8 changed files
with
115 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/main/java/com/crowdin/action/BundleSettingsAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.crowdin.action; | ||
|
||
import com.crowdin.service.ProjectService; | ||
import com.crowdin.ui.panel.download.DownloadWindow; | ||
import com.intellij.icons.AllIcons; | ||
import com.intellij.ide.BrowserUtil; | ||
import com.intellij.openapi.actionSystem.AnAction; | ||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
import com.intellij.openapi.project.Project; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import static com.crowdin.Constants.TOOLWINDOW_ID; | ||
|
||
public class BundleSettingsAction extends AnAction { | ||
|
||
private boolean enabled = false; | ||
private boolean visible = false; | ||
private String text = ""; | ||
|
||
public BundleSettingsAction() { | ||
super("Bundle Settings", "Bundle Settings", AllIcons.General.Settings); | ||
} | ||
|
||
@Override | ||
public void update(@NotNull AnActionEvent e) { | ||
if (e.getPlace().equals(TOOLWINDOW_ID)) { | ||
this.enabled = e.getPresentation().isEnabled(); | ||
this.visible = e.getPresentation().isVisible(); | ||
this.text = e.getPresentation().getText(); | ||
} | ||
e.getPresentation().setEnabled(enabled); | ||
e.getPresentation().setVisible(visible); | ||
e.getPresentation().setText(text); | ||
} | ||
|
||
@Override | ||
public void actionPerformed(@NotNull AnActionEvent anActionEvent) { | ||
Project project = anActionEvent.getProject(); | ||
if (project == null) { | ||
return; | ||
} | ||
|
||
DownloadWindow window = project.getService(ProjectService.class).getDownloadWindow(); | ||
if (window == null || window.getSelectedBundle() == null) { | ||
return; | ||
} | ||
|
||
String link = window.buildBundleUrl(); | ||
BrowserUtil.browse(link); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters