You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.7 KiB
73 lines
2.7 KiB
3 years ago
|
package com.fr.plugin.customexplorer.action;
|
||
|
|
||
|
import com.fr.base.BaseUtils;
|
||
|
import com.fr.design.actions.UpdateAction;
|
||
|
import com.fr.design.dialog.BasicDialog;
|
||
|
import com.fr.design.dialog.DialogActionAdapter;
|
||
|
import com.fr.design.i18n.Toolkit;
|
||
|
import com.fr.design.mainframe.DesignerContext;
|
||
|
import com.fr.design.mainframe.DesignerFrame;
|
||
|
import com.fr.design.menu.MenuKeySet;
|
||
|
import com.fr.plugin.context.PluginContext;
|
||
|
import com.fr.plugin.context.PluginMarker;
|
||
|
import com.fr.plugin.customexplorer.ui.ExplorerSettingPane;
|
||
|
import com.fr.plugin.manage.PluginManager;
|
||
|
|
||
|
import javax.swing.*;
|
||
|
import java.awt.*;
|
||
|
import java.awt.event.ActionEvent;
|
||
|
|
||
|
import static javax.swing.JOptionPane.ERROR_MESSAGE;
|
||
|
|
||
|
/**
|
||
|
* @author fr.open
|
||
|
* @create 2019/9/29
|
||
|
* 设置浏览器界面,用于设置本机上已安装的浏览器,用于报表预览时候选择。
|
||
|
*/
|
||
|
public class ExplorerSettingAction extends UpdateAction {
|
||
|
public static final MenuKeySet EXPLORER_SETTING = new MenuKeySet() {
|
||
|
@Override
|
||
|
public char getMnemonic() {
|
||
|
return 'R';
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public String getMenuName() {
|
||
|
return Toolkit.i18nText("Explorer_Setting_Name");
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public KeyStroke getKeyStroke() {
|
||
|
return KeyStroke.getKeyStroke('r');
|
||
|
}
|
||
|
};
|
||
|
|
||
|
public ExplorerSettingAction() {
|
||
|
setMenuKeySet(EXPLORER_SETTING);
|
||
|
setName(getMenuKeySet().getMenuKeySetName() + "...");
|
||
|
setMnemonic(getMenuKeySet().getMnemonic());
|
||
|
setSmallIcon(BaseUtils.readIcon("/com/fr/plugin/customexplorer/icon/customexplorer_setting.png"));
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void actionPerformed(ActionEvent e) {
|
||
|
//PluginContext context = PluginManager.getContext(PluginMarker.create("com.fr.plugin.customexplorer.v10", "1.1"));
|
||
|
PluginContext context = PluginManager.getContext("com.fr.plugin.customexplorer.v10");
|
||
|
if (null == context || !context.isAvailable() || !context.isRunning()) {
|
||
|
JOptionPane.showMessageDialog((Component)null, Toolkit.i18nText("Explorer_Setting_PluginAvailableErrorTips"), "", ERROR_MESSAGE);
|
||
|
return;
|
||
|
}
|
||
|
DesignerFrame localDesignerFrame = DesignerContext.getDesignerFrame();
|
||
|
final ExplorerSettingPane settingPane = new ExplorerSettingPane();
|
||
|
BasicDialog basicDialog = settingPane.showWindow(localDesignerFrame);
|
||
|
basicDialog.setTitle(Toolkit.i18nText("Explorer_Setting_Name"));
|
||
|
basicDialog.addDialogActionListener(new DialogActionAdapter() {
|
||
|
@Override
|
||
|
public void doOk() {
|
||
|
settingPane.doWithProcess();
|
||
|
}
|
||
|
});
|
||
|
basicDialog.setVisible(true);
|
||
|
}
|
||
|
}
|