^1651385558334
@
sname
ThingReferenceDialog
slabel
ThingReferenceDialog
sdescriptors
xworker.swt.widgets.Display,xworker.swt.widgets.Display/@scripts1,xworker.swt.widgets.Display/@Shell,xworker.lang.actions.Actions/@GroovyAction
  @/@shell
  sname
  shell
  stext
  lang:d=模型菜单&en=Model Menu
  sNO_TRIM
  false
  sCLOSE
  true
  sTITLE
  true
  sMIN
  false
  sMAX
  false
  sBORDER
  false
  sRESIZE
  true
  sON_TOP
  false
  sTOOL
  false
  sNO_FOCUS
  false
  swidth
  300
  sheight
  480
  scenterScreen
  true
  spack
  false
  smaximized
  false
  sfullScreen
  false
  sdesign
  true
  sisIde
  false
  sdesignDefaultOpen
  false
  sexitOnDispose
  false
  sH_SCROLL
  false
  sV_SCROLL
  false
  sNO_BACKGROUND
  false
  sNO_MERGE_PAINTS
  false
  sNO_REDRAW_RESIZE
  false
  sNO_RADIO_GROUP
  false
  sEMBEDDED
  false
  sDOUBLE_BUFFERED
  false
  scapture
  false
  senabled
  true
  sredraw
  true
  svisible
  true
  sdescriptors
  xworker.swt.widgets.Display/@Shell
  sid
  shell
    @/@shell/@shellGridLayout
    sname
    shellGridLayout
    smakeColumnsEqualWidth
    false
    smarginWidth
    5
    smarginHeight
    5
    smarginLeft
    0
    smarginTop
    0
    smarginRight
    0
    smarginBottom
    0
    shorizontalSpacing
    5
    sverticalSpacing
    5
    slabel
    shellGridLayout
    sdescriptors
    xworker.swt.Layouts/@GridLayout
    sid
    shellGridLayout
    @/@shell/@progressBar
    sname
    progressBar
    sstyle
    HORIZONTAL
    sSMOOTH
    false
    sINDETERMINATE
    true
    sBORDER
    false
    scapture
    false
    senabled
    true
    sredraw
    true
    svisible
    true
    slabel
    progressBar
    sdescriptors
    xworker.swt.Widgets/@ProgressBar
    sid
    progressBar
      @/@shell/@progressBar/@progressBarGridData
      sname
      progressBarGridData
      sstyle
      FILL_HORIZONTAL
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      BEGINNING
      sverticalAlignment
      CENTER
      shorizontalSpan
      1
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      progressBarGridData
      sdescriptors
      xworker.swt.layout.LayoutDatas/@GridData
      sid
      progressBarGridData
    @/@shell/@menuTree
    sname
    menuTree
    sselectStyle
    SINGLE
    sV_SCROLL
    true
    sH_SCROLL
    true
    sCHECK
    false
    sFULL_SELECTION
    false
    sHIDE_SELECTION
    true
    sBORDER
    true
    slineVisible
    false
    smultipleColumns
    false
    sheaderVisible
    false
    ssortIndicator
    true
    smoveableColumns
    false
    sheadImages
    false
    ssubImages
    false
    scheckSelection
    false
    scapture
    false
    senabled
    true
    sredraw
    true
    stoolTipText
    选择双击可以打开菜单定义
    svisible
    true
    slabel
    menuTree
    sdescriptors
    xworker.swt.Widgets/@Tree
    sid
    menuTree
      @/@shell/@menuTree/@menuTreeGridData
      sname
      menuTreeGridData
      sstyle
      FILL_BOTH
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      BEGINNING
      sverticalAlignment
      CENTER
      shorizontalSpan
      1
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      menuTreeGridData
      sdescriptors
      xworker.swt.layout.LayoutDatas/@GridData
      sid
      menuTreeGridData
      @/@shell/@menuTree/@5808
      sname
      Listeners
      slabel
      Listeners
      sdescriptors
      xworker.swt.widgets.Widget/@Listeners
      sid
      5808
        @/@shell/@menuTree/@5808/@5809
        sname
        menuTreeSelection
        stype
        DefaultSelection
        slabel
        menuTreeSelection
        sdescriptors
        xworker.swt.events.Listeners/@listeners/@Listener
        sid
        5809
          @/@shell/@menuTree/@5808/@5809/@5810
          sname
          menuTreeAction
          sisSynchronized
          false
          sthrowException
          true
          suseOtherAction
          false
          svarScope
          Global
          sdisableGlobalContext
          false
          Scode
#$@text#$@
def path = menuTree.getSelection()[0].getData();
if(path != null){
    def thing = world.getThing(path);
    if(thing != null){
        explorerActions.doAction("openThing", [thing:thing]);
    }
}
#$@text#$@
          sdescriptors
          xworker.lang.actions.Actions/@GroovyAction
          sid
          5810
    @/@shell/@2028
    sname
    buttonComposite
    sBORDER
    false
    sH_SCROLL
    false
    sV_SCROLL
    false
    sNO_BACKGROUND
    false
    sNO_FOCUS
    false
    sNO_MERGE_PAINTS
    false
    sNO_REDRAW_RESIZE
    false
    sNO_RADIO_GROUP
    false
    sEMBEDDED
    false
    sDOUBLE_BUFFERED
    false
    scapture
    false
    senabled
    true
    sredraw
    true
    svisible
    true
    sdescriptors
    xworker.swt.Widgets/@Composite
    sid
    2028
      @/@shell/@2028/@2029
      sname
      buttonCompositeGridData
      sstyle
      FILL_HORIZONTAL
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      END
      sverticalAlignment
      CENTER
      shorizontalSpan
      1
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      buttonCompositeGridData
      sdescriptors
      xworker.swt.layout.LayoutDatas/@GridData
      sid
      2029
      @/@shell/@2028/@2030
      sname
      buttonCompositeRowLayout
      sfill
      false
      sjustify
      false
      smarginWidth
      0
      smarginHeight
      0
      smarginLeft
      3
      smarginTop
      3
      smarginRight
      3
      smarginBottom
      3
      spack
      true
      sspacing
      3
      stype
      SWT.HORIZONTAL
      swrap
      true
      slabel
      buttonCompositeRowLayout
      sdescriptors
      xworker.swt.Layouts/@RowLayout
      sid
      2030
      @/@shell/@2028/@2032
      sname
      closeButton
      stext
      关闭
      stype
      SWT.PUSH
      sflat
      false
      sborder
      false
      sselected
      false
      scapture
      false
      senabled
      true
      sredraw
      true
      svisible
      true
      slabel
      closeButton
      sdescriptors
      xworker.swt.Widgets/@Button
      sid
      2032
        @/@shell/@2028/@2032/@2033
        sname
        RowData
        sexclude
        false
        swidth
        80
        sheight
        -1
        slabel
        RowData
        sdescriptors
        xworker.swt.layout.LayoutDatas/@RowData
        sid
        2033
        @/@shell/@2028/@2032/@2223
        sname
        Listeners
        slabel
        Listeners
        sdescriptors
        xworker.swt.widgets.Widget/@Listeners
        sid
        2223
          @/@shell/@2028/@2032/@2223/@2224
          sname
          closeButtonSelection
          stype
          Selection
          slabel
          closeButtonSelection
          sdescriptors
          xworker.swt.events.Listeners/@listeners/@Listener
          sid
          2224
            @/@shell/@2028/@2032/@2223/@2224/@2225
            sname
            closeButtonAction
            sisSynchronized
            false
            sthrowException
            true
            suseOtherAction
            false
            svarScope
            Global
            sdisableGlobalContext
            false
            scode
            shell.dispose();
            sdescriptors
            xworker.lang.actions.Actions/@GroovyAction
            sid
            2225
    @/@shell/@init
    sname
    init
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    svarScope
    Global
    sdisableGlobalContext
    false
    Scode
#$@text#$@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TreeItem;

def thing = actionContext.get("thing");
if(thing == null){
    def item = new TreeItem(menuTree, SWT.NONE);
    item.setText("没有指定事物或事物不存在");
}else{
    def world = world;
    def tree = menuTree;
    def path = thing.metadata.path;
    def task = [      
        run:{
            try{
                for(thingManager in world.thingManagers){
                    for(thething in thingManager.iterator("", true)){
                        find(thething, path, shell.display, tree);
                    }
                }
            }catch(Exception e){
                e.printStackTrace();
                if(shell.isDisposed()){
                    return;
                }
            }finally{            
                shell.display.asyncExec([
    		        run:{
    		             progressBar.dispose();
    		        }
    		    ] as Runnable);                
            }
        }
    ] as Runnable;
    new Thread(task).start();
}

def addThingToTree(athing, tree){
    def rootThing = athing.getRoot();
    def rootItem = null;
    for(item in tree.items){
        if(item.getData() == rootThing.metadata.path){
            rootItem = item;
            break;
        }
    }
    if(rootItem == null){
        rootItem = new TreeItem(tree, SWT.NONE);
        rootItem.setText(rootThing.metadata.label);
        rootItem.setData(rootThing.metadata.path);
    }
    
    def item = new TreeItem(rootItem, SWT.NONE);
    item.setText(athing.metadata.label);
    item.setData(athing.metadata.path);
}

def find(athing, path, display, tree) {
        def attrs = athing.getAttributes();
		boolean have = false;
		for (key in attrs.keySet()) {
			def value = attrs.get(key);			
			if (value != null) {
				String str = (String) value.toString();				
				have = (str.indexOf(path) != -1);				
				if(have){
				    break;
				}
			}
		}
		
		//println "" + have + "  " + athing.metadata.path;
		if(have){
		    display.asyncExec([
		        run:{
		             addThingToTree(athing, tree);
		        }
		    ] as Runnable);
		}

		for (child in athing.getChilds()) {
			find(child, path, display, tree);
		}
    }
#$@text#$@
    sinterpretationType
    Action
    screateLocalVarScope
    false
    ssaveReturn
    false
    sswitchResult
    false
    sdebugLog
    false
    sdescriptors
    xworker.swt.Widgets/@Code
    sid
    init
  @/@oepnThingMenuEditor
  sname
  oepnThingReferenceDialog
  sisSynchronized
  false
  sthrowException
  true
  suseOtherAction
  false
  svarScope
  Global
  sdisableGlobalContext
  false
  Scode
#$@text#$@
import org.xmeta.ActionContext;

def ac = new ActionContext();
ac.put("explorerActions", explorerActions);
ac.put("thing", currentThing);

def shellThing = world.get("xworker.swt.ide.worldexplorer.swt.dialogs.ThingReferenceDialog/@shell");
def shell = shellThing.doAction("create", ac);
shell.open();
#$@text#$@
  sdescriptors
  xworker.lang.actions.Actions/@GroovyAction
  sid
  oepnThingMenuEditor
  @/@shell1
  sname
  shell
  stext
  lang:d=查看模型实例&en=View Model Instance
  sNO_TRIM
  false
  sCLOSE
  true
  sTITLE
  true
  sMIN
  false
  sMAX
  false
  sBORDER
  false
  sRESIZE
  true
  sON_TOP
  false
  sTOOL
  false
  sNO_FOCUS
  false
  swidth
  300
  sheight
  480
  scenterScreen
  true
  spack
  false
  smaximized
  false
  sfullScreen
  false
  sdesign
  true
  sisIde
  false
  sdesignDefaultOpen
  false
  sexitOnDispose
  false
  sH_SCROLL
  false
  sV_SCROLL
  false
  sNO_BACKGROUND
  false
  sNO_MERGE_PAINTS
  false
  sNO_REDRAW_RESIZE
  false
  sNO_RADIO_GROUP
  false
  sEMBEDDED
  false
  sDOUBLE_BUFFERED
  false
  scapture
  false
  senabled
  true
  sredraw
  true
  svisible
  true
  sdescriptors
  xworker.swt.widgets.Display/@Shell
  sid
  shell1
    @/@shell1/@shellGridLayout
    sname
    shellGridLayout
    smakeColumnsEqualWidth
    false
    smarginWidth
    5
    smarginHeight
    5
    smarginLeft
    0
    smarginTop
    0
    smarginRight
    0
    smarginBottom
    0
    shorizontalSpacing
    5
    sverticalSpacing
    5
    slabel
    shellGridLayout
    sdescriptors
    xworker.swt.Layouts/@GridLayout
    sid
    shellGridLayout
    @/@shell1/@progressBar
    sname
    progressBar
    sstyle
    HORIZONTAL
    sSMOOTH
    false
    sINDETERMINATE
    true
    sBORDER
    false
    scapture
    false
    senabled
    true
    sredraw
    true
    svisible
    true
    slabel
    progressBar
    sdescriptors
    xworker.swt.Widgets/@ProgressBar
    sid
    progressBar
      @/@shell1/@progressBar/@progressBarGridData
      sname
      progressBarGridData
      sstyle
      FILL_HORIZONTAL
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      BEGINNING
      sverticalAlignment
      CENTER
      shorizontalSpan
      1
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      progressBarGridData
      sdescriptors
      xworker.swt.layout.LayoutDatas/@GridData
      sid
      progressBarGridData
    @/@shell1/@menuTree
    sname
    menuTree
    sselectStyle
    SINGLE
    sV_SCROLL
    true
    sH_SCROLL
    true
    sCHECK
    false
    sFULL_SELECTION
    false
    sHIDE_SELECTION
    true
    sBORDER
    true
    slineVisible
    false
    smultipleColumns
    false
    sheaderVisible
    false
    ssortIndicator
    true
    smoveableColumns
    false
    sheadImages
    false
    ssubImages
    false
    scheckSelection
    false
    scapture
    false
    senabled
    true
    sredraw
    true
    stoolTipText
    选择双击可以打开菜单定义
    svisible
    true
    slabel
    menuTree
    sdescriptors
    xworker.swt.Widgets/@Tree
    sid
    menuTree
      @/@shell1/@menuTree/@menuTreeGridData
      sname
      menuTreeGridData
      sstyle
      FILL_BOTH
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      BEGINNING
      sverticalAlignment
      CENTER
      shorizontalSpan
      1
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      menuTreeGridData
      sdescriptors
      xworker.swt.layout.LayoutDatas/@GridData
      sid
      menuTreeGridData
      @/@shell1/@menuTree/@5808
      sname
      Listeners
      slabel
      Listeners
      sdescriptors
      xworker.swt.widgets.Widget/@Listeners
      sid
      5808
        @/@shell1/@menuTree/@5808/@5809
        sname
        menuTreeSelection
        stype
        DefaultSelection
        slabel
        menuTreeSelection
        sdescriptors
        xworker.swt.events.Listeners/@listeners/@Listener
        sid
        5809
          @/@shell1/@menuTree/@5808/@5809/@5810
          sname
          menuTreeAction
          sisSynchronized
          false
          sthrowException
          true
          suseOtherAction
          false
          svarScope
          Global
          sdisableGlobalContext
          false
          Scode
#$@text#$@
def path = menuTree.getSelection()[0].getData();
if(path != null){
    def thing = world.getThing(path);
    if(thing != null){
        explorerActions.doAction("openThing", [thing:thing]);
    }
}
#$@text#$@
          sdescriptors
          xworker.lang.actions.Actions/@GroovyAction
          sid
          5810
    @/@shell1/@2028
    sname
    buttonComposite
    sBORDER
    false
    sH_SCROLL
    false
    sV_SCROLL
    false
    sNO_BACKGROUND
    false
    sNO_FOCUS
    false
    sNO_MERGE_PAINTS
    false
    sNO_REDRAW_RESIZE
    false
    sNO_RADIO_GROUP
    false
    sEMBEDDED
    false
    sDOUBLE_BUFFERED
    false
    scapture
    false
    senabled
    true
    sredraw
    true
    svisible
    true
    sdescriptors
    xworker.swt.Widgets/@Composite
    sid
    2028
      @/@shell1/@2028/@2029
      sname
      buttonCompositeGridData
      sstyle
      FILL_HORIZONTAL
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      END
      sverticalAlignment
      CENTER
      shorizontalSpan
      1
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      buttonCompositeGridData
      sdescriptors
      xworker.swt.layout.LayoutDatas/@GridData
      sid
      2029
      @/@shell1/@2028/@2030
      sname
      buttonCompositeRowLayout
      sfill
      false
      sjustify
      false
      smarginWidth
      0
      smarginHeight
      0
      smarginLeft
      3
      smarginTop
      3
      smarginRight
      3
      smarginBottom
      3
      spack
      true
      sspacing
      3
      stype
      SWT.HORIZONTAL
      swrap
      true
      slabel
      buttonCompositeRowLayout
      sdescriptors
      xworker.swt.Layouts/@RowLayout
      sid
      2030
      @/@shell1/@2028/@2032
      sname
      closeButton
      stext
      关闭
      stype
      SWT.PUSH
      sflat
      false
      sborder
      false
      sselected
      false
      scapture
      false
      senabled
      true
      sredraw
      true
      svisible
      true
      slabel
      closeButton
      sdescriptors
      xworker.swt.Widgets/@Button
      sid
      2032
        @/@shell1/@2028/@2032/@2033
        sname
        RowData
        sexclude
        false
        swidth
        80
        sheight
        -1
        slabel
        RowData
        sdescriptors
        xworker.swt.layout.LayoutDatas/@RowData
        sid
        2033
        @/@shell1/@2028/@2032/@2223
        sname
        Listeners
        slabel
        Listeners
        sdescriptors
        xworker.swt.widgets.Widget/@Listeners
        sid
        2223
          @/@shell1/@2028/@2032/@2223/@2224
          sname
          closeButtonSelection
          stype
          Selection
          slabel
          closeButtonSelection
          sdescriptors
          xworker.swt.events.Listeners/@listeners/@Listener
          sid
          2224
            @/@shell1/@2028/@2032/@2223/@2224/@2225
            sname
            closeButtonAction
            sisSynchronized
            false
            sthrowException
            true
            suseOtherAction
            false
            svarScope
            Global
            sdisableGlobalContext
            false
            scode
            shell.dispose();
            sdescriptors
            xworker.lang.actions.Actions/@GroovyAction
            sid
            2225
    @/@shell1/@init
    sname
    init
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    svarScope
    Global
    sdisableGlobalContext
    false
    Scode
#$@text#$@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TreeItem;

def thing = actionContext.get("thing");
if(thing == null){
    def item = new TreeItem(menuTree, SWT.NONE);
    item.setText("没有指定事物或事物不存在");
}else{
    def world = world;
    def tree = menuTree;
    def path = thing.metadata.path;
    def shell = shell;
    def task = [      
        run:{
            try{
                for(thingManager in world.thingManagers){
                    for(thething in thingManager.iterator("", true)){
                        find(thething, path, shell.display, tree);
                    }
                }
            }catch(Exception e){
                e.printStackTrace();
            }finally{            
                shell.display.asyncExec([
    		        run:{
    		             progressBar.dispose();
    		        }
    		    ] as Runnable);                
            }
        }
    ] as Runnable;
    new Thread(task).start();
}

def addThingToTree(athing, tree){
    def rootThing = athing.getRoot();
    def rootItem = null;
    for(item in tree.items){
        if(item.getData() == rootThing.metadata.path){
            rootItem = item;
            break;
        }
    }
    if(rootItem == null){
        rootItem = new TreeItem(tree, SWT.NONE);
        rootItem.setText(rootThing.metadata.label);
        rootItem.setData(rootThing.metadata.path);
    }
    
    def item = new TreeItem(rootItem, SWT.NONE);
    item.setText(athing.metadata.label);
    item.setData(athing.metadata.path);
}

def find(athing, path, display, tree) {
		boolean have = athing.isThing(path);
		
		//println "" + have + "  " + athing.metadata.path;
		if(have){
		    display.asyncExec([
		        run:{
		             addThingToTree(athing, tree);
		        }
		    ] as Runnable);
		}

		for (child in athing.getChilds()) {
			find(child, path, display, tree);
		}
    }
#$@text#$@
    sinterpretationType
    Action
    screateLocalVarScope
    false
    ssaveReturn
    false
    sdebugLog
    false
    sdescriptors
    xworker.swt.Widgets/@Code
    sid
    init
