xworker.swt.xwidgets.AutoDemoComposite Maven / Gradle / Ivy
package xworker.swt.xwidgets;
import org.eclipse.swt.widgets.Composite;
import org.xmeta.ActionContext;
import org.xmeta.Thing;
import org.xmeta.World;
import org.xmeta.util.UtilMap;
import xworker.swt.ActionContainer;
public class AutoDemoComposite {
public static Object create(ActionContext actionContext){
Thing self = (Thing) actionContext.get("self");
//原始面板
World world = World.getInstance();
Thing compositeThing = world.getThing("xworker.ide.tools.autodemo.AutoDemoShell/@topComposite");
ActionContext ac = new ActionContext();
ac.put("parent", actionContext.get("parent"));
Composite composite = (Composite) compositeThing.doAction("create", ac);
//创建子事物
actionContext.peek().put("parent", composite);
for(Thing child : self.getChilds()){
child.doAction("create", actionContext);
}
//演示事物
ActionContainer actionContainer = (ActionContainer) ac.get("actions");
Thing demoThing = world.getThing(self.getStringBlankAsNull("autoDemoPath"));
if(demoThing == null){
demoThing = self.getThing("AutoDemo@0");
}
if(demoThing != null){
actionContainer.doAction("setAutoDemo", ac, UtilMap.toMap("thing", demoThing));
AutoDemo demo = (AutoDemo) ac.get("demo");
if(demo != null && self.getBoolean("defaultRunDemo")){
demo.setAuto(true);
}
}
//保存actionContainer
actionContext.getScope(0).put(self.getMetadata().getName(), actionContainer);
//返回composite
return composite;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy