|
|
|
@ -92,15 +92,13 @@ import java.util.Arrays;
|
|
|
|
|
import java.util.Collection; |
|
|
|
|
import java.util.Collections; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.HashSet; |
|
|
|
|
import java.util.Iterator; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Set; |
|
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
|
|
|
|
|
|
public class TableDataTreePane extends BasicTableDataTreePane { |
|
|
|
|
private static Set<AbstractExtraAction> extraActions = new HashSet<>(); |
|
|
|
|
private static Map<String, AbstractExtraAction> extraActions = new HashMap<>(); |
|
|
|
|
private static final TableDataTreePane singleton = new TableDataTreePane(); |
|
|
|
|
|
|
|
|
|
public static final int PLUGIN_LISTENER_PRIORITY = 1; |
|
|
|
@ -226,7 +224,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
|
|
|
|
|
popupMenu.add(pasteAction.createMenuItem()); |
|
|
|
|
popupMenu.add(removeAction.createMenuItem()); |
|
|
|
|
popupMenu.addSeparator(); |
|
|
|
|
for (AbstractExtraAction action : extraActions) { |
|
|
|
|
for (AbstractExtraAction action : extraActions.values()) { |
|
|
|
|
try { |
|
|
|
|
popupMenu.add(action.createMenuItem()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -275,7 +273,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void initExtraAction() { |
|
|
|
|
for (AbstractExtraAction action: extraActions) { |
|
|
|
|
for (AbstractExtraAction action: extraActions.values()) { |
|
|
|
|
try { |
|
|
|
|
toolbarDef.addShortCut(action); |
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -287,19 +285,20 @@ public class TableDataTreePane extends BasicTableDataTreePane {
|
|
|
|
|
/** |
|
|
|
|
* 注册ExtraAction |
|
|
|
|
* |
|
|
|
|
* @param key 标识符 |
|
|
|
|
* @param extraAction TableDataTree工具栏的扩展接口Action |
|
|
|
|
*/ |
|
|
|
|
public static void registerExtraAction(AbstractExtraAction extraAction) { |
|
|
|
|
extraActions.add(extraAction); |
|
|
|
|
public static void registerExtraAction(String key, AbstractExtraAction extraAction) { |
|
|
|
|
extraActions.put(key, extraAction); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 移除ExtraAction |
|
|
|
|
* |
|
|
|
|
* @param extraAction TableDataTree工具栏的扩展接口Action |
|
|
|
|
* @param key 标识符 |
|
|
|
|
*/ |
|
|
|
|
public static void removeExtraAction(AbstractExtraAction extraAction) { |
|
|
|
|
extraActions.remove(extraAction); |
|
|
|
|
public static void removeExtraAction(String key) { |
|
|
|
|
extraActions.remove(key); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -729,7 +728,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
|
|
|
|
|
pasteAction.setEnabled(false); |
|
|
|
|
removeAction.setEnabled(false); |
|
|
|
|
previewTableDataAction.setEnabled(false); |
|
|
|
|
for (AbstractExtraAction action : extraActions) { |
|
|
|
|
for (AbstractExtraAction action : extraActions.values()) { |
|
|
|
|
action.setEnabled(false); |
|
|
|
|
} |
|
|
|
|
if (op == null || op.interceptButtonEnabled()) { |
|
|
|
@ -766,7 +765,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkExtraActionEnable(int dataMode, int selectioncount, boolean hasSelectedIndependentColumns) { |
|
|
|
|
for (AbstractExtraAction action : extraActions) { |
|
|
|
|
for (AbstractExtraAction action : extraActions.values()) { |
|
|
|
|
action.setEnabled(action.checkEnable(dataMode, selectioncount, hasSelectedIndependentColumns)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|