1 package com.generalrobotix.ui.actions;
3 import org.eclipse.jface.action.ActionContributionItem;
4 import org.eclipse.jface.action.IAction;
5 import org.eclipse.jface.action.IContributionItem;
6 import org.eclipse.jface.action.ICoolBarManager;
7 import org.eclipse.jface.action.IToolBarManager;
8 import org.eclipse.jface.action.ToolBarContributionItem;
9 import org.eclipse.jface.viewers.ISelection;
10 import org.eclipse.jface.window.ApplicationWindow;
11 import org.eclipse.ui.IWorkbenchWindow;
12 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
13 import org.eclipse.ui.PlatformUI;
45 public void run(IAction action) {
55 action_.setEnabled(
false);
58 action_.setEnabled(
false);
60 action_.setEnabled(
true);
67 public void init(IWorkbenchWindow window) {}
85 IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
86 for(IWorkbenchWindow
w : windows){
87 if(!(
w instanceof ApplicationWindow))
89 ApplicationWindow window = (ApplicationWindow)
w;
90 ICoolBarManager coolbar = window.getCoolBarManager2();
93 IContributionItem setitem = coolbar.find(
"com.generalrobotix.ui.actionSet");
94 if(setitem !=
null && setitem instanceof ToolBarContributionItem)
96 IToolBarManager toolbar = ((ToolBarContributionItem)setitem).getToolBarManager();
99 IContributionItem actitem = toolbar.find(
"com.generalrobotix.ui.actions.StartSimulate");
100 if(actitem !=
null && actitem instanceof ActionContributionItem)
101 return ((ActionContributionItem)actitem).getAction();
109 GrxSimulationItem simItem = (GrxSimulationItem) item;
112 if(simItem_!=simItem){
119 if(simItem_==simItem){
132 if(simItem_==plugin){
133 if(
arg[0].equals(
"StartSimulation")){
135 action_.setEnabled(
true);
136 }
else if(
arg[0].equals(
"StopSimulation")){
138 action_.setEnabled(
true);
static final String get(String key)
void selectionChanged(IAction action, ISelection selection)
void itemChange(GrxBaseItem item, int event)
void addObserver(GrxObserver v)
#define null
our own NULL pointer
GrxBaseItem createItem(Class<? extends GrxBaseItem > cls, String name)
アイテムの作成. 指定したアイテムプラグインに、指定したアイテム名で新しいアイテムを作る。 ...
void registerItemChangeListener(GrxItemChangeListener view, Class<? extends GrxBaseItem > cls)
void deleteObserver(GrxObserver v)
static final int ADD_ITEM
void registerItemChange(GrxBaseItem item, int event)
void setActionImage(boolean start)
IAction getStartSimulationAction()
void update(GrxBasePlugin plugin, Object... arg)
static final int SELECTED_ITEM
static Activator getDefault()
void setSelectedItem(GrxBaseItem item, boolean select)
select/unselect item
static final int REMOVE_ITEM
boolean startSimulation(boolean isInteractive)
GrxSimulationItem simItem_
GrxPluginManager manager_
プラグイン管理クラス GrxUIの核になるクラス。プラグインのロード等の、初期化を実行する。 プラグインとそ...
void init(IWorkbenchWindow window)
static final int NOTSELECTED_ITEM
ImageDescriptor getDescriptor(String iconName)