|
|
|
@ -14,7 +14,6 @@ import com.fr.design.gui.ibutton.UIButton;
|
|
|
|
|
import com.fr.design.gui.imenu.UIMenuItem; |
|
|
|
|
import com.fr.design.gui.imenu.UIPopupMenu; |
|
|
|
|
import com.fr.design.gui.imenu.UIScrollPopUpMenu; |
|
|
|
|
import com.fr.design.i18n.DesignSizeI18nManager; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
@ -31,12 +30,10 @@ import com.fr.third.javax.annotation.Nonnull;
|
|
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
import com.fr.workspace.server.lock.TplOperator; |
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.Icon; |
|
|
|
|
import javax.swing.JButton; |
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
|
import javax.swing.JSeparator; |
|
|
|
|
import javax.swing.MenuElement; |
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
|
import javax.swing.ToolTipManager; |
|
|
|
|
import java.awt.AWTEvent; |
|
|
|
@ -166,26 +163,15 @@ public class MultiTemplateTabPane extends Row {
|
|
|
|
|
int tplIndex = getTemplateIndex(e.getX()); |
|
|
|
|
if (tplIndex > -1) { |
|
|
|
|
UIPopupMenu menu = new UIPopupMenu(); |
|
|
|
|
menu.setBorder(BorderFactory.createEmptyBorder(-3, 3, 3, 0)); |
|
|
|
|
|
|
|
|
|
for (CloseOption option : CloseOption.values()) { |
|
|
|
|
menu.add(new UIMenuItem(new RightMenuCloseAction(option, tplIndex))); |
|
|
|
|
} |
|
|
|
|
menu.add(new CloseMenuItemJSeparator()); |
|
|
|
|
menu.add(new UIMenuItem(new OpenInTemplateTreeAction(tplIndex))); |
|
|
|
|
|
|
|
|
|
int height = 0; |
|
|
|
|
for (MenuElement subElement : menu.getSubElements()) { |
|
|
|
|
if (subElement instanceof CloseMenuItemJSeparator) { |
|
|
|
|
height += 10; |
|
|
|
|
} else { |
|
|
|
|
height += 25; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//根据当前i18n语言环境,动态调整popupMenu的宽度
|
|
|
|
|
menu.setPreferredSize(new Dimension((int) DesignSizeI18nManager.getInstance(). |
|
|
|
|
i18nDimension("com.fr.design.file.MultiTemplateTabPane.popUpMenu").getWidth(), height)); |
|
|
|
|
GUICoreUtils.showPopupMenu(menu, MultiTemplateTabPane.getInstance(), e.getX(), MultiTemplateTabPane.getInstance().getY() - 1 + MultiTemplateTabPane.getInstance().getHeight()); |
|
|
|
|
GUICoreUtils.showPopupMenu(menu, |
|
|
|
|
MultiTemplateTabPane.getInstance(), |
|
|
|
|
e.getX(), |
|
|
|
|
MultiTemplateTabPane.getInstance().getY() + MultiTemplateTabPane.getInstance().getHeight()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|