/*
 * Copyright (c) 2005-2006, Image Matters LLC. All Rights Reserved.
 * 
 * This software is distributed under the terms of the LICENSE file
 * included with the program and available here:
 * 
 * http://www.imagemattersllc.com/legal-notice/LICENSE-userSmartsGX.html
 */
namespace("userSmarts.ui");namespace("userSmarts.ui");namespace("userSmarts.ui");namespace("userSmarts.ui");$namespace.ActionBars=Class.create(userSmarts.wt.widgets.Composite);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{'class':"wt-actionbar",layoutData:{width:"100%",height:"100%"},_layout:new userSmarts.wt.layout.RowLayout({type:"horizontal"})});superClass.call(this,properties);this.statusLineManager=new userSmarts.wt.action.StatusLineManager();};$prototype.initNode=function(){this.node.style.overflow="hidden";this.toolbarManager=new userSmarts.wt.action.ToolbarManager({parent:this,updateOnBoundsChange:true,layoutData:{width:"*",height:"100%"}});this.menuBarManager=new userSmarts.wt.action.MenuBarManager({parent:this,updateOnBoundsChange:true,padding:{top:0,left:5,right:0,bottom:0}});};$prototype.update=function(){this.getNode();var nodes=[];var tbmgr=this.getToolbarManager();tbmgr.update();nodes.push(tbmgr.getNode());var mbmgr=this.getMenuBarManager();mbmgr.close();mbmgr.update();nodes.push(mbmgr.getNode());userSmarts.wt.widgets.Composite.prototype.update.call(this);};$prototype.getToolbarManager=function(){if(!this.node){this.getNode();}
return this.toolbarManager;};$prototype.getMenuBarManager=function(){if(!this.node){this.getNode();}
return this.menuBarManager;};$prototype.getStatusLineManager=function(){return this.statusLineManager;};namespace("userSmarts.ui");userSmarts.ui.PlatformUI=Class.create();$class.createAndRunWorkbench=function(display,advisor){userSmarts.ui.PlatformUI.workbench=new userSmarts.ui.Workbench({display:display});var workbench=userSmarts.ui.PlatformUI.workbench;var wbConfigurer=new userSmarts.ui.application.WorkbenchConfigurer(workbench,advisor);advisor.initialize(wbConfigurer);advisor.preStartup();advisor.openWindows();advisor.postStartup();};$class.createDisplay=function(root){return new userSmarts.wt.widgets.Display(root);};$class.getWorkbench=function(){return userSmarts.ui.PlatformUI.workbench;};$class.isWorkbenchRunning=function(){return!!userSmarts.ui.PlatformUI.workbench;};namespace("userSmarts.ui");userSmarts.ui.WorkbenchPlugin=Class.create();$prototype.initialize=function(superClass){if(userSmarts.ui.WorkbenchPlugin.inst){return userSmarts.ui.WorkbenchPlugin.inst;}
userSmarts.ui.WorkbenchPlugin.inst=this;this.viewRegistry=new userSmarts.ui.ViewRegistry();this.editorRegistry=new userSmarts.ui.EditorRegistry();this.perspectiveRegistry=new userSmarts.ui.PerspectiveRegistry();this.themeManager=new userSmarts.theme.ThemeManager();};$class.inst=null;$class.getDefault=function(){if(!userSmarts.ui.WorkbenchPlugin.inst){userSmarts.ui.WorkbenchPlugin.inst=new userSmarts.ui.WorkbenchPlugin();}
return userSmarts.ui.WorkbenchPlugin.inst;};$class.find=function(path){return userSmarts.runtime.Platform.find('com.usersmarts.rcp.rcp-ui-plugin',path);};$prototype.getPerspectiveRegistry=function(){return this.perspectiveRegistry;};$prototype.getViewRegistry=function(){return this.viewRegistry;};$prototype.getEditorRegistry=function(){return this.editorRegistry;};$prototype.getThemeManager=function(){return this.themeManager;};$prototype.start=function(){};$prototype.stop=function(){};namespace("userSmarts.ui");userSmarts.ui.WorkbenchSite=Class.create(Bean);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);this.actionBars=new userSmarts.ui.ActionBars();};$prototype.getPage=function(){return this.page;};$prototype.getWorkbenchWindow=function(){return this.window;};namespace("userSmarts.ui");namespace("userSmarts.ui");$namespace.WorkbenchPart=Class.create(Bean);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);setdefault(this,{title:"",cacheable:true});};$prototype.dispose=function(){};$prototype.getSite=function(){return this.site;};$prototype.getTitle=function(){return this.label;};$prototype.createPartControl=function(parent){return new userSmarts.wt.widgets.Control();};$prototype.toString=function(){return"[Part: id = '"+this.id+"', label = '"+this.label+"']";};$prototype.setFocus=function(){};$prototype.isVisible=function(){return this.site&&this.site.isPartVisible();};$prototype.isCloseable=function(){return this.closeable||false;};namespace("userSmarts.ui");namespace("userSmarts.ui");$namespace.WorkbenchPartReference=Class.create();$prototype.initialize=function(superClass,page,partDescription){this.page=page;this.partDescription=partDescription;};$prototype.getPart=function(restore){};$prototype.getId=function(){return this.partDescription.getId();};$prototype.getPage=function(){return this.page;};$prototype.getTitle=function(){return this.partDescription.getLabel();};$prototype.getTitleImage=function(){return this.partDescription.icon;};$prototype.getPartName=function(){return this.partDescription.getLabel();};$prototype.isCloseable=function(){return this.partDescription.isCloseable();};$prototype.toString=function(){return"[WorkbenchPartReference "+this.partDescription.getId()+"]";};namespace("userSmarts.ui");userSmarts.ui.WorkbenchPartSite=Class.create(userSmarts.ui.WorkbenchSite);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);};$prototype.getId=function(){return this.id;};$prototype.getPart=function(){return this.part;};$prototype.getPartReference=function(){return this.partReference;};$prototype.getPropertyProvider=function(){return this.propertyProvider;};$prototype.setPropertyProvider=function(provider){this.propertyProvider=provider;this.getPage().setPropertyProvider(this.part,provider);};$prototype.getActionBars=function(){return this.actionBars;};$prototype.getPartControl=function(){if(!this.partControl){this.partControl=this.part.createPartControl();}
return this.partControl;};$prototype.isPartVisible=function(){var result=this.getPage().isPartVisible(this.part);return result;};namespace("userSmarts.ui");namespace("userSmarts.ui");$namespace.WorkbenchPartDescriptor=Class.create(userSmarts.runtime.ExtensionDescriptor);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{closeable:false});superClass.call(this,properties);};$prototype.isCloseable=function(){return(this.closeable===true)||"true"===this.closeable;};$prototype.setCloseable=function(value){this.closeable=value;};namespace("userSmarts.ui");userSmarts.ui.ViewPart=Class.create(userSmarts.ui.WorkbenchPart);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);};$prototype.init=function(site){this.site=site;};namespace("userSmarts.ui");$namespace.ViewReference=Class.create($namespace.WorkbenchPartReference);$prototype.initialize=function(superClass,page,viewDescription){superClass.call(this,page,viewDescription);};$prototype.getPart=function(restore){return this.getView(restore);};$prototype.getView=function(restore){if(!this.view&&restore){var view=this.view=this.partDescription.createView();var window=this.page.getWorkbenchWindow();var site=new userSmarts.ui.ViewSite({page:this.page,id:this.partDescription.id,window:window,part:view,partReference:this});try{this.view.init(site);}catch(e){logError("Error initializing view: "+view);}
signal(this.page,"partOpened",this);}
return this.view;};$prototype.toString=function(){return"[ViewReference "+this.partDescription.id+"]";};namespace("userSmarts.ui");userSmarts.ui.ViewSite=Class.create(userSmarts.ui.WorkbenchPartSite);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);};namespace("userSmarts.ui");userSmarts.ui.ViewDescriptor=Class.create(userSmarts.ui.WorkbenchPartDescriptor);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{label:"",description:""});superClass.call(this,properties);};$prototype.createView=function(){var view;var Ctor=this["class"]||this.ctor;if(typeof Ctor=="string"){view=newInstance(Ctor,this);}else if(typeof Ctor=="function"){view=new Ctor(this);}
return view;};$getAllowMultiple=function(){return this.allowMultiple;};namespace("userSmarts.ui");userSmarts.ui.ViewRegistry=Class.create();$prototype.initialize=function(superClass){this.views=[];this.viewMap={};};$prototype.findViewWithId=function(viewId){return this.viewMap[viewId];};$prototype.addView=function(view){var id=view.id;this.views.push(view);this.viewMap[id]=view;};$prototype.getViews=function(){return this.views;};namespace("userSmarts.ui");userSmarts.ui.EditorInput=Class.create(Bean);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{nameSuffix:""});superClass.call(this,properties);};$prototype.exists=function(){return this.exists;};$prototype.getName=function(){return this.name+this.nameSuffix;};$prototype.getToolTipText=function(){return this.toolTipText;};$prototype.getImage=function(){return this.image;};$prototype.equals=function(other){return this.name=other.getName();};$prototype.setDirty=function(bool){this.dirty=(bool===true);if(this.dirty){this.nameSuffix="*";}else{this.nameSuffix="";}};namespace("userSmarts.ui");userSmarts.ui.EditorPart=Class.create(userSmarts.ui.WorkbenchPart);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{dirty:false,input:null,closeable:true});superClass.call(this,properties);};$prototype.getEditorInput=function(){return this.input;};$prototype.init=function(site,input){this.site=site;this.input=input;};$prototype.askSave=function(){if(userSmarts.wt.dialogs.MessageDialog.openConfirm("Confirm Save","Save changes before closing editor?")){this.doSave();}else{this.doCancel();}};$prototype.doSave=function(){alert("Editor does not implement 'doSave', changes cannot be saved");};$prototype.doCancel=function(){};$prototype.reset=function(){alert("Editor does not implement 'reset', changes cannot be reverted");};$prototype.isDirty=function(){return this.dirty;};$prototype.setDirty=function(bool){this.dirty=(bool===true);this.getEditorInput().setDirty(bool);};$prototype.isSaveOnCloseNeeded=function(){return this.isDirty();};$prototype.getTitle=function(){return this.input.getTitle()||"";};$prototype.updateTab=function(name){var ref=this.getSite().getPartReference();var page=this.getSite().getPage();var persp=page.currentPerspective;var layout=persp.layout.getLayout(userSmarts.ui.PageLayout.ID_EDITOR_AREA);var tab=layout.findTab(ref);if(tab){if(!name){var input=this.getEditorInput();if(input){name=input.getName();}}
tab.setText(name);}};namespace("userSmarts.ui");$namespace.EditorProxyControl=Class.create(userSmarts.wt.widgets.Composite);$prototype.initialize=function(superClass,properties){properties=properties||{};superClass.call(this,properties);};$prototype.getNode=function(){if(!this.node){this.node=DIV();}
if(this.editorArea){this.editorArea.setParent(this.parent);this.editorArea.setLayoutData(this.layoutData);replaceChildNodes(this.node,this.editorArea.getNode());}
return this.node;};$prototype.update=function(){this.getNode();if(this.editorArea){this.editorArea.setParent(this.parent);this.editorArea.setLayoutData(this.layoutData);this.editorArea.update();}};$prototype.setSize=function(width,height){if(this.editorArea){this.editorArea.setSize(width,height);}};$prototype.setLocation=function(left,top){if(this.editorArea){this.editorArea.setLocation(left,top);}};$prototype.setParent=function(parent){if(this.editorArea){this.editorArea.setParent(parent);}
this.parent=parent;};$prototype.getParent=function(){if(this.editorArea){return this.editorArea.getParent();}
return this.parent;};$prototype.dispose=function(){if(this.editorArea){this.editorArea.dispose();}};$prototype.isDisposed=function(){if(this.editorArea){return this.editorArea.isDisposed();}
return false;};$prototype.isVisible=function(){if(this.editorArea){return this.editorArea.isVisible();}
return false;};$prototype.getShell=function(){if(this.editorArea){this.editorArea.getShell();}
return this.getParent().getShell();};$prototype.getSize=function(){if(this.editorArea){return this.editorArea.getSize();}
return this.size;};$prototype.getLocation=function(){if(this.editorArea){return this.editorArea.getLocation();}
return{left:this.left,top:this.y};};$prototype.setBounds=function(left,top,width,height){if(this.editorArea){this.editorArea.setBounds(left,top,width,height);}};$prototype.getBounds=function(){if(this.editorArea){return this.editorArea.getBounds();}
return{x:this.left,y:this.top,width:this.size.width,height:this.size.height};};$prototype.setLayoutData=function(layoutData){if(this.editorArea){this.editorArea.setLayoutData(layoutData);}
this.layoutData=layoutData;};$prototype.getLayoutData=function(){if(this.editorArea){return this.editorArea.getLayoutData();}
return this.layoutData;};$prototype.setVisibility=function(visible){if(this.editorArea){this.editorArea.setVisibility(visible);}};namespace("userSmarts.ui");namespace("userSmarts.ui");$namespace.EditorReference=Class.create($namespace.WorkbenchPartReference);$prototype.initialize=function(superClass,manager,input,editorDescription,page){superClass.call(this,page,editorDescription);this.input=input;this.internalId=userSmarts.ui.EditorReference.nextId++;};$class.nextId=1;$prototype.getEditorInput=function(){return this.input;};$prototype.getFactoryId=function(){return this.factoryId;};$prototype.isDirty=function(){return this.getPart().isDirty();};$prototype.getPart=function(restore){return this.getEditor(restore);};$prototype.getEditor=function(restore){if(!this.editor&&restore){try{this.editor=this.partDescription.createEditor();var site=new userSmarts.ui.EditorSite({page:this.page,id:this.partDescription.id,window:this.page.getWorkbenchWindow(),part:this.editor,partReference:this});this.editor.init(site,this.input);}catch(e){logError("Error realizing editor: "+e);}}
return this.editor;};$prototype.isPinned=function(){return false;};$prototype.getName=function(){return this.getEditorInput().getName();};$prototype.getTitle=function(){return this.getEditorInput().getName();};$prototype.toString=function(){return"[EditorReference ("+this.internalId+")]";};namespace("userSmarts.ui");userSmarts.ui.EditorSite=Class.create(userSmarts.ui.WorkbenchPartSite);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);};namespace("userSmarts.ui");namespace("userSmarts.ui");$namespace.EditorDescriptor=Class.create($namespace.WorkbenchPartDescriptor);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{label:"",description:"",closeable:true});superClass.call(this,properties);};$prototype.createEditor=function(){var result;if(this["class"]){result=newInstance(this["class"],this);}
return result;};namespace("userSmarts.ui");userSmarts.ui.EditorRegistry=Class.create(Bean);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);this.editors=[];this.editorMap={};};$prototype.findEditor=function(editorId){var desc=this.editorMap[editorId];return desc;};$prototype.addEditor=function(editor){var id=editor.id;this.editors.push(editor);this.editorMap[id]=editor;};namespace("userSmarts.ui");$namespace.MultiPageEditorPart=Class.create(userSmarts.ui.EditorPart);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{loadAll:false});superClass.call(this,properties);this.tabItems=[];this.pages=[];this.pageListeners=[];};$prototype.createPartControl=function(parent){if(!this.outer){this.outer=new userSmarts.wt.widgets.Composite({'class':'multi-editor',updateOnBoundsChange:true,layoutData:{width:'100%',height:'100%'}});this.outer.setLayout(new userSmarts.wt.layout.RowLayout({type:"vertical"}));}
this.createPageContainer();if(!this.tabControl){this.tabControl=new userSmarts.wt.widgets.Composite({parent:this.outer,"class":"btabs",layoutData:{width:"100%",height:'25px'}});this.tabControl.setLayout(new userSmarts.wt.layout.RowLayout({type:"horizontal"}));}
if(this.pages.length==0){this.createPages();}
this.outer.update();return this.outer;};$prototype.addPage=function(editor){editor.init(this.site,this.input);var container=this.getContainer();this.pageListeners.push(connect(editor,"dirty",this,this.onPageDirtyChange));editor.parent=this;if(container.getLayout().topControl==null){var control=editor.createPartControl();index=container.add(control);this.pages[index]=editor;this.addTabItem(new userSmarts.ui.MultiPageEditorTabItem({multiPageEditor:this,pageIndex:index}));this.setActivePage(index);}else{var control;if(this.loadAll){control=editor.createPartControl();}else{control=new userSmarts.ui.EditorPlaceHolder({editor:editor});}
index=container.add(control);this.pages[index]=editor;this.addTabItem(new userSmarts.ui.MultiPageEditorTabItem({multiPageEditor:this,pageIndex:index}));}};$prototype.createPageContainer=function(parent){if(!this.composite){this.composite=new userSmarts.wt.widgets.Composite({'class':'page-container',parent:this.outer,updateOnBoundsChange:true,layoutData:{width:"100%",height:'*'}});this.composite.setLayout(new userSmarts.wt.layout.StackLayout());}};$prototype.createPages=function(){};$prototype.doSave=function(){};$prototype.doCancel=function(){};$prototype.dispose=function(){for(var i=0;i<this.pageListeners.length;++i){disconnect(this.pageListeners[i]);this.pageListeners[i]=null;}
this.pageListeners=null;for(var i=0;i<this.pages.length;++i){this.pages[i].dispose();}
this.pages=null;this.composite.dispose();};$prototype.getActiveEditor=function(){return null;};$prototype.getContainer=function(){return this.composite;};$prototype.getEditor=function(pageIndex){return this.pages[pageIndex];};$prototype.getControl=function(pageIndex){return this.getContainer().getChildren()[pageIndex];};$prototype.getPageCount=function(){return this.composite.getChildren().length;};$prototype.getPageImage=function(pageIndex){return null;};$prototype.getPageText=function(pageIndex){var editor=this.getEditor(pageIndex);if(editor){return editor.label;}
return"";};$prototype.hasPages=function(){return this.getPageCount()>0;};$prototype.pageChange=function(newPageIndex){var bars=this.getSite().getActionBars();var tbmgr=bars.getToolbarManager();tbmgr.removeAll();var editor=this.getEditor(newPageIndex);if(editor&&typeof(editor.contributeToActionBars)=="function"){editor.contributeToActionBars(tbmgr);}
tbmgr.update();};$prototype.removePage=function(pageIndex){this.pages.splice(pageIndex,1);this.composite.remove(this.getControl(pageIndex));this.removeTabItem(this.resolve(pageIndex));};$prototype.setActivePage=function(pageIndex){var control=this.getControl(pageIndex);if(control){if(control.isPlaceHolder){var ph=control;control=ph.getEditor().createPartControl();control.setVisibility(false);this.getContainer().replace(control,ph);delete ph.editor;}
this.composite.getLayout().topControl=control;this.composite.update();this.pageChange(pageIndex);}
this.setSelection(pageIndex);};$prototype.setFocus=function(){};$prototype.addTabItem=function(tabItem){this.tabItems.push(tabItem);this.tabControl.add(tabItem);if(!this.selected){this.setSelection(tabItem);}};$prototype.removeTabItem=function(tabItem){tabItem=this.resolve(tabItem);if(tabItem){this.tabItems.remove(tabItem);this.tabControl.remove(tabItem);this.setSelection(0);}
return tabItem;};$prototype.setSelection=function(tabItem){var previous=this.selected;tabItem=this.resolve(tabItem);if(previous!=tabItem){if(previous instanceof userSmarts.wt.widgets.TabItem){previous.setProperty("selected",false);}
if(tabItem instanceof Bean){tabItem.setProperty("selected",true);}
this.setProperty("selected",tabItem);this.updateTabs();}};$prototype.resolve=function(tabItem){if(typeof tabItem=="number"){tabItem=this.tabItems[tabItem];}else if(typeof tabItem=="string"){for(var i=0;i<this.tabItems.length;++i){if(this.tabItems[i].name==tabItem){tabItem=this.tabItems[i];break;}}}else if(!(tabItem instanceof userSmarts.wt.widgets.TabItem)){tabItem=null;}
return tabItem;};$prototype.updateTabs=function(){userSmarts.wt.widgets.Composite.prototype.update.call(this.tabControl);};$prototype.onPageDirtyChange=function(event){if(!this.isDirty()){if(event.newValue==true){this.setDirty(true);}}else{if(event.newValue==false){for(var i=0;i<this.pages.length;++i){if(this.pages[i].isDirty()){return;}}
this.setDirty(false);}}};$namespace.EditorPlaceHolder=Class.create(userSmarts.wt.widgets.Control);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{isPlaceHolder:true});superClass.call(this,properties);this.label=this.editor.label;this['class']=this.label;};$prototype.getEditor=function(){return this.editor;};$namespace.MultiPageEditorTabItem=Class.create(userSmarts.wt.widgets.TabItem);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{layoutData:{width:80,height:18},border:{style:"solid",top:0,bottom:1,left:1,right:1},padding:{top:0,bottom:0,left:0,right:0},margin:{top:0,bottom:0,left:3,right:0}});superClass.call(this,properties);this.text=this.multiPageEditor.getPageText(this.pageIndex);if(!this.text){this.text="Page "+this.pageIndex;}};$prototype.onClick=function(){this.multiPageEditor.setActivePage(this.pageIndex);};$prototype.isCloseable=function(){return false;};$prototype.getEditor=function(){return this.editor;};$prototype.update=function(){userSmarts.wt.widgets.TabItem.prototype.update.call(this);};namespace("userSmarts.ui");userSmarts.ui.Perspective=Class.create();$prototype.initialize=function(superClass,properties){setallp(this,properties);this.factory=newInstance(this.description.factory||this.description["class"]);};$prototype.createInitialLayout=function(layout){this.factory.createInitialLayout(layout);};namespace("userSmarts.ui");userSmarts.ui.PerspectiveDescriptor=Class.create();$prototype.initialize=function(superClass,properties){setallp(this,{label:"",description:""});setallp(this,properties);};$prototype.getId=function(){return this.id;};$prototype.getDescription=function(){return this.description;};$prototype.getLabel=function(){return this.name;};$prototype.getTitleImage=function(){return this.icon;};namespace("userSmarts.ui");userSmarts.ui.PerspectiveRegistry=Class.create();$prototype.initialize=function(superClass){this.perspectives=[];this.perspectiveMap={};};$prototype.findPerspectiveWithId=function(perspectiveId){return this.perspectiveMap[perspectiveId];};$prototype.addPerspective=function(perspective){var id=perspective.id;this.perspectives.push(perspective);this.perspectiveMap[id]=perspective;if(!this.defaultPerspective){this.defaultPerspective=id;}};$prototype.getPerspectives=function(){return this.perspectives;};$prototype.getDefaultPerspective=function(){return this.defaultPerspective||this.perspectives[0];};namespace("userSmarts.ui");userSmarts.ui.Workbench=Class.create(Bean);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);};$class.viewRegistry=new userSmarts.ui.ViewRegistry();$class.editorRegistry=new userSmarts.ui.EditorRegistry();$class.perspectiveRegistry=new userSmarts.ui.PerspectiveRegistry();$prototype.close=function(){};$prototype.getActiveWorkbenchWindow=function(){return this.activeWindow||null;};$prototype.showPerspective=function(perspectiveId,wbWindow){if(!perspectiveId){logError("showPerspective:  no perspective specified");return;}
var perspective=this.getPerspectiveRegistry().findPerspectiveWithId(perspectiveId);if(!perspective){logError("Unknown Perspective: "+perspectiveId);return;}
try{var page=wbWindow.getActivePage();page.setPerspective(perspective);page.doLayout();}catch(e){logError("Error (showPerspective) : "+e.message);}
return this;};$prototype.saveAllEditors=function(confirm){};$prototype.isClosing=function(){return this.isClosing;};$prototype.getPerspectiveRegistry=function(){return userSmarts.ui.WorkbenchPlugin.getDefault().getPerspectiveRegistry();};$prototype.getViewRegistry=function(){return userSmarts.ui.WorkbenchPlugin.getDefault().getViewRegistry();};$prototype.getEditorRegistry=function(){return userSmarts.ui.WorkbenchPlugin.getDefault().getEditorRegistry();};$prototype.getDisplay=function(){return this.display;};namespace("userSmarts.ui");userSmarts.ui.WorkbenchWindow=Class.create(Bean);$prototype.initialize=function(superClass,workbench,shell){this.workbench=workbench;this.shell=shell;this.pageComposite=new userSmarts.wt.widgets.Composite();superClass.call(this);};$prototype.getWorkbench=function(){return this.workbench;};$prototype.setActivePage=function(page){this.activePage=page;};$prototype.getActivePage=function(){return this.activePage;};$prototype.close=function(){logWarning("WorkbenchWindow.close not implemented");};$prototype.getShell=function(){return this.shell;};$prototype.createPageComposite=function(parent){if(this.activePage){this.pageComposite=new userSmarts.wt.widgets.Composite({parent:parent,id:'pageControl',padding:{top:0,left:2,right:2,bottom:0}});this.pageComposite.setLayout(new userSmarts.wt.layout.StackLayout());}
return this.pageComposite;};$prototype.getPageComposite=function(){return this.pageComposite;};namespace("userSmarts.ui");namespace("userSmarts.ui");userSmarts.ui.BoxLayout=Class.create(userSmarts.wt.widgets.Composite);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{orientation:userSmarts.ui.BoxLayout.HORIZONTAL,id:""});superClass.call(this,properties);this.setLayout(new userSmarts.wt.layout.RowLayout({type:properties.orientation}));};$class.HORIZONTAL="horizontal";$class.VERTICAL="vertical";$prototype.toString=function(){return"[BoxLayout "+this.orientation+"]";};namespace("userSmarts.ui");userSmarts.ui.EditorManager=Class.create();$prototype.initialize=function(superClass,window,page,editorPresentation){this.window=window;this.page=page;this.editors=[];};$prototype.containsEditor=function(editorRef){var editors=this.editors;for(var i=0;i<editors.length;++i){if(ref==editors[i]){return true;}}
return false;};$prototype.getEditorReferences=function(){return this.editors;};$prototype.getEditorCount=function(){return this.editors.length;};$prototype.findEditor=function(editorId,input,matchFlags){var refs=this.findEditors(input,editorId,matchFlags);if(refs.length===0){return null;}
return refs[0].getEditor(true);};$prototype.findEditors=function(input,editorId,matchFlags){var result=[];if(matchFlags==userSmarts.ui.WorkbenchPage.MATCH_NONE){return result;}
var editors=this.editors.slice(0);for(var i=0;i<editors.length;++i){var ref=editors[i];var refInput=ref.getEditorInput();if(matchFlags==userSmarts.ui.WorkbenchPage.MATCH_INPUT&&input.equals(refInput)){result.push(ref);}else if(matchFlags==userSmarts.ui.WorkbenchPage.MATCH_ID&&editorId==ref.getId()){result.push(ref);}}
return result;};$prototype.openEditor=function(editorId,input,setVisible){if(editorId===null||input===null){throw"IllegalArgumentException";}
var reg=this.getEditorRegistry();var desc=reg.findEditor(editorId);if(desc===null){throw"PartInitException: "+editorId;}
var result=this.openEditorFromDescriptor(desc,input);return result;};$prototype.openEditorFromDescriptor=function(desc,input){var result=null;result=new userSmarts.ui.EditorReference(this,input,desc,this.page);this.editors.push(result);return result;};$prototype.closeEditor=function(editor){var page=this.page;var result=false;for(var i=0;i<this.editors.length;++i){var e=this.editors[i];if(e==editor){var tbmgr=editor.getEditor(false).getSite().getActionBars().getToolbarManager();tbmgr.removeAll();tbmgr.update();this.editors.splice(i,1);result=true;break;}}
if(page.getReference(page.getActiveEditor())==editor){var newActiveEditor=null;if(this.editors.length>0){newActiveEditor=this.editors[0].getPart();}
this.page.setProperty("activeEditor",newActiveEditor);}
var layout=this.page.getPerspective().layout;if(layout){var editorArea=layout.getLayout(userSmarts.ui.PageLayout.ID_EDITOR_AREA);if(editorArea){editorArea.removePart(editor);}}
return result;};$prototype.getEditorRegistry=function(){return userSmarts.ui.WorkbenchPlugin.getDefault().getEditorRegistry();};namespace("userSmarts.ui");userSmarts.ui.EditorTabItem=Class.create(userSmarts.wt.widgets.TabItem);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);};$prototype.getToolbar=function(){var partRef=this.control.partRef;var part=partRef.getPart(true);var site=part.getSite();var abs=site.getActionBars();return abs;};userSmarts.ui.EditorAreaLayout=Class.create(userSmarts.wt.widgets.Composite);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{layoutData:{width:"*",height:"*"},"class":"ui-folder-layout"});superClass.call(this,properties);this.setLayout(new userSmarts.wt.layout.RowLayout({type:"vertical"}));this.tabFolder=new userSmarts.wt.widgets.TabFolder({parent:this,layoutData:{width:"*",height:"*"}});this.editorTabMap={};};$prototype.activate=function(ref){var part=ref.getPart();this.page.activate(part);};$prototype.showEditor=function(part){var editorTab;if(typeof part=="string"){editorTab=this.editorTabMap[part];}else{editorTab=this.editorTabMap[part.id];}
if(editorTab){this.tabFolder.setSelection(editorTab);}};$prototype.toString=function(){return"[EditorAreaLayout id: "+this.id+"]";};namespace("userSmarts.ui");userSmarts.ui.PartLayout=Class.create(userSmarts.wt.widgets.Composite);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{standalone:false,showTitle:true,closeable:false,moveable:false,width:'100%',height:'100%',valign:'top'});superClass.call(this,properties);};$prototype.getId=function(){return this.id;};$prototype.isStandalone=function(){return this.standalone;};$prototype.getShowTitle=function(){return this.showTitle;};$prototype.isCloseable=function(){return this.closeable;};$prototype.setCloseable=function(closeable){this.closeable=!!closeable;};$prototype.isMoveable=function(){return this.movable;};$prototype.setMoveable=function(moveable){this.movable=!!moveable;};$prototype.getNode=function(){try{var node=userSmarts.wt.widgets.Composite.prototype.getNode.call(this);return node;}catch(e){logError("Error creating view: "+e.message);}};$prototype.initNode=function(){};$prototype.update=function(){var content=null;try{content=this.getPartControl();}catch(e){logError("error creating part control: "+this.view+" error: "+e.message);content=DIV();}
if(content instanceof userSmarts.wt.widgets.Control){var location=content.getLocation();if(location&&this.size.width>0&&this.size.height>0){content.setBounds(location.left,location.top,this.size.width,this.size.height);}
try{var node=content.getNode();replaceChildNodes(this.node,node);}catch(e){replaceChildNodes(this.node,DIV(null,"Error rendering view"));}}else{replaceChildNodes(this.node,content);}};$prototype.getPartControl=function(){if(!this.partControl){var part=this.partRef.getPart(true);this.partControl=part.getSite().getPartControl();if(this.partControl instanceof userSmarts.wt.widgets.Control){this.partControl.parent=this;}}
return this.partControl;};namespace("userSmarts.ui");namespace("userSmarts.ui");$namespace.ViewLayout=Class.create(userSmarts.wt.widgets.Composite);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{standalone:false,showTitle:true,closeable:false,moveable:false,width:'100%',height:'100%',valign:'top'});superClass.call(this,properties);};$prototype.getId=function(){return this.id;};$prototype.isStandalone=function(){return this.standalone;};$prototype.getShowTitle=function(){return this.showTitle;};$prototype.isCloseable=function(){return this.closeable;};$prototype.setCloseable=function(closeable){this.closeable=!!closeable;};$prototype.isMoveable=function(){return this.movable;};$prototype.setMoveable=function(moveable){this.movable=!!moveable;};$prototype.getNode=function(){try{var node=userSmarts.wt.widgets.Composite.prototype.getNode.call(this);return node;}catch(e){logError("Error creating view: "+e.message);}};$prototype.initNode=function(){};$prototype.update=function(){if(!this.view){this.view=this.page.findView(this.id,true);if(!this.view){logWarning("View not found: "+id);return;}}
var content=null;try{content=this.getPartControl();}catch(e){logError("error creating part control: "+this.view+" error: "+e.message);content=DIV();}
if(content instanceof userSmarts.wt.widgets.Control){var location=content.getLocation();if(location&&this.size.width>0&&this.size.height>0){content.setBounds(location.left,location.top,this.size.width,this.size.height);}
try{var node=content.getNode();replaceChildNodes(this.node,node);}catch(e){replaceChildNodes(this.node,DIV(null,"Error rendering view"));}}else{replaceChildNodes(this.node,content);}};$prototype.getPartControl=function(){if(!this.partControl){this.partControl=this.view.getSite().getPartControl();if(this.partControl instanceof userSmarts.wt.widgets.Control){this.partControl.parent=this;}}
return this.partControl;};namespace("userSmarts.ui");$namespace.ViewTabItem=Class.create(userSmarts.wt.widgets.TabItem);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);};$prototype.getToolbar=function(){var partRef=this.control.partRef;var part=partRef.getPart(true);var site=part.getSite();var abs=site.getActionBars();return abs;};$prototype.isCloseable=function(){return this.control.isCloseable();};$namespace.EditorTabItem=Class.create($namespace.ViewTabItem);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);};$prototype.onClick=function(){var page=userSmarts.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();page.activate(this.control.partRef.getPart(false));};$prototype.close=function(){var part=this.control.partRef.getPart(true);if(part instanceof userSmarts.ui.EditorPart){if(part.isCloseable()){part.site.getPage().closeEditor(part,true);}}};$namespace.FolderLayout=Class.create(userSmarts.wt.widgets.Composite);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{layoutData:{width:"*",height:"*"},"class":"ui-folder-layout",border:{style:"solid",left:1,right:1,top:1,bottom:1},margin:{top:0,bottom:0,left:0,right:0}});superClass.call(this,properties);this.setLayout(new userSmarts.wt.layout.RowLayout({type:"vertical"}));this.tabFolder=new userSmarts.wt.widgets.TabFolder({parent:this,layoutData:{width:"*",height:"*"}});this.tabMap={};};$prototype.initNode=function(){this.node.style.overflow="hidden";};$prototype.addView=function(viewId){try{var partRef=this.pageLayout.page.findViewReference(viewId,true);if(partRef){var viewLayout=new userSmarts.ui.PartLayout({parent:null,partRef:partRef,closeable:partRef.isCloseable(),page:this.pageLayout.page,folder:this});this.pageLayout.views[viewId]=viewLayout;var text=partRef.getTitle();var image=partRef.getTitleImage();var tab=new userSmarts.ui.ViewTabItem({parent:this.tabFolder,text:text,image:image,control:viewLayout});this.tabMap[partRef]=tab;}else{logError("ERROR adding view: "+viewId);}}catch(e){logError("ERROR adding view, viewId: "+viewId+", e:"+e.message);}};$prototype.addEditor=function(partRef){var partId=partRef.getId();try{var partLayout=new userSmarts.ui.PartLayout({parent:null,partRef:partRef,closeable:partRef.isCloseable(),id:partId,page:this.pageLayout.page,folder:this});this.pageLayout.views[partId]=partLayout;this.tabMap[partRef]=new userSmarts.ui.EditorTabItem({parent:this.tabFolder,text:partRef.getTitle(),image:partRef.getTitleImage(),closeable:partRef.isCloseable(),control:partLayout});}catch(e){logError("ERROR adding view, viewId: "+partId+", e:"+e.message);}};$prototype.showView=function(view){this.showPart(view);}
$prototype.showEditor=function(editorRef){if(!this.tabMap[editorRef]){this.addEditor(editorRef);}else{var input=editorRef.getEditorInput();}
this.showPart(editorRef);}
$prototype.showPart=function(part){var tab=this.findTab(part);if(tab){this.tabFolder.setSelection(tab);}}
$prototype.removePart=function(partRef){var tab=this.findTab(partRef);delete this.tabMap[partRef];tab=this.tabFolder.removeItem(tab);this.tabFolder.update();}
$prototype.findTab=function(partRef){var tab=null;if(typeof partRef=="string"){tab=this.tabMap[partRef];}else{tab=this.tabMap[partRef];}
return tab;}
$prototype.toString=function(){return"[FolderLayout id: "+this.id+"]";};namespace("userSmarts.ui");userSmarts.ui.PageLayout=Class.create();$prototype.initialize=function(superClass,page){this.page=page;this.layouts={};this.views={};this.control=new userSmarts.ui.BoxLayout({id:userSmarts.ui.PageLayout.ID_ROOT_BOX,parent:page.getClientComposite(),label:userSmarts.ui.PageLayout.ID_ROOT_BOX,orientation:"horizontal",layoutData:{height:"100%",width:"100%"},margin:{left:2,right:0,top:0,bottom:0}});this.control.setLayout(new userSmarts.wt.layout.RowLayout({type:"horizontal",spacing:0}));this.layouts[userSmarts.ui.PageLayout.ID_ROOT_BOX]=this.control;};$class.ID_EDITOR_AREA="EDITOR_AREA";$class.ID_ROOT_BOX="ROOT_BOX";$class.LEFT="left";$class.RIGHT="right";$class.TOP="top";$class.BOTTOM="bottom";$prototype.createBox=function(boxId,parentId,layoutData){var parent=this.layouts[parentId];var box=null;if(!parent){getLogger().logWarning("Cannot create box without a valid parent.");}else{var orientation=layoutData.orientation;var sibling=false;for(var id in this.layouts){if(this.layouts[id]instanceof userSmarts.ui.BoxLayout&&this.layouts[id].parent==parent){sibling=true;break;}}
if(sibling){if(orientation==userSmarts.ui.BoxLayout.VERTICAL){new userSmarts.wt.action.VerticalResizeSeparator({parent:parent});}else{new userSmarts.wt.action.HorizontalResizeSeparator({parent:parent});}}
box=new userSmarts.ui.BoxLayout({parent:parent,layoutData:layoutData,id:boxId,orientation:orientation});box.label=boxId;this.layouts[boxId]=box;}
return box;};$prototype.createFolder=function(folderId,parentId,layoutData){var parent=this.layouts[parentId];if(!parent){logWarning("parent not found: "+referenceId);return;}
if(!(parent instanceof userSmarts.ui.BoxLayout)){logWarning("Error creating folder: "+folderId);return;}
var folder;if(folderId==userSmarts.ui.PageLayout.ID_EDITOR_AREA){if(!this.page.editorFolderInstance){folderProperties={id:folderId,pageLayout:this};folder=new userSmarts.ui.FolderLayout(folderProperties);this.page.editorFolderInstance=folder;}else{folder=this.page.editorFolderInstance;}
var editorProxy=new userSmarts.ui.EditorProxyControl({editorArea:folder,parent:parent,layoutData:layoutData});}else{var sibling=false;for(var id in this.layouts){if((this.layouts[id]instanceof userSmarts.ui.BoxLayout||this.layouts[id]instanceof userSmarts.ui.FolderLayout)&&this.layouts[id].parent==parent){sibling=true;break;}}
if(sibling){if(parent.orientation==userSmarts.ui.BoxLayout.HORIZONTAL){new userSmarts.wt.action.VerticalResizeSeparator({parent:parent});}else{new userSmarts.wt.action.HorizontalResizeSeparator({parent:parent});}}
folderProperties={id:folderId,parent:parent,pageLayout:this,layoutData:layoutData};folder=new userSmarts.ui.FolderLayout(folderProperties);}
this.layouts[folderId]=folder;return folder;};$prototype.getLayout=function(layoutId){return this.layouts[layoutId];};$prototype.getViewLayout=function(viewId){return this.views[viewId];};$prototype.addView=function(viewId,attributes,folderId){try{attributes=setdefault(attributes,{id:viewId,page:this.page,showTitle:false});var viewLayout=new userSmarts.ui.ViewLayout(attributes);var folder=this.layouts[folderId];folder.add(viewLayout);this.views[viewId]=viewLayout;}catch(e){logError("Error adding view ("+viewId+") :"+e.message);}};$prototype.getViews=function(){return this.views;};$prototype.addStandaloneView=function(viewId,attributes,parentId,showTitle){var box=this.layouts[parent];if(!box){logDebug("Error adding standalone view, parent not found: "+parentId);return;}
attributes=setdefault(attributes,{id:viewId,standalone:true,showTitle:showTitle,page:this.page});var viewLayout=new userSmarts.ui.ViewLayout(box,attributes);this.views[viewId]=viewLayout;};$prototype.getControl=function(){var control=this.control;return control;};namespace("userSmarts.ui");userSmarts.ui.PropertyService=Class.create(Bean);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);this.pcsMap={};this.defaultPcs=new PropertyChangeSupport();this.providerMap={};this.listenerMap={};};$prototype.init=function(window){};$prototype.onPropertyChange=function(part,event){this.firePropertyChange(part,event.propertyName,event.oldValue,event.newValue);};$prototype.setPropertyProvider=function(part,provider){var partId=part.getSite().getId();var oldProvider=this.providerMap[partId];var oldListener=this.listenerMap[partId];if(oldProvider){oldProvider.removeChangeListener(oldListener,"*");}
this.providerMap[partId]=provider;this.listenerMap[partId]=bind(this.onPropertyChange,this,part);provider.addChangeListener(this.listenerMap[partId],"*");};$prototype.addPropertyListener=function(listener,propertyName,partId){if(!propertyName||!listener){return;}
var pcs;if(!partId){pcs=this.defaultPcs;}else{pcs=this.pcsMap[partId];if(!pcs){pcs=this.pcsMap[partId]=new PropertyChangeSupport();}}
pcs.addListener(listener,propertyName);var provider=this.providerMap[partId];if(provider){var value=provider.getProperty(propertyName);var part=this.findView(partId);var event=new PropertyChangeEvent(provider,propertyName,value,value);try{listener(event);}catch(e){}}};$prototype.getProperty=function(propertyName,partId){var part;if(partId){part=this.findView(partId);}else{part=this.getActivePart();}
if(!part){return;}
var provider=part.getSite().getPropertyProvider();if(provider){return provider.getProperty(propertyName);}else{return null;}};$prototype.removePropertyListener=function(listener,propertyName,partId){if(!propertyName||!listener){return;}
var pcs;if(!partId){pcs=this.defaultPcs;}else{pcs=this.pcsMap[partId];}
if(pcs){pcs.removeListener(listener,propertyName);}};$prototype.firePropertyChange=function(part,propertyName,oldValue,newValue){if(!part){return;}
var pcs=this.pcsMap[part.getSite().getId()];if(pcs){pcs.firePropertyChange(part,propertyName,oldValue,newValue);}
this.defaultPcs.firePropertyChange(part,propertyName,oldValue,newValue);};$prototype.getActivePart=function(){return null;};namespace("userSmarts.ui");userSmarts.ui.WorkbenchPage=Class.create(userSmarts.ui.PropertyService);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{views:{},visibleViews:[],editors:{},perspectives:{},document:document});superClass.call(this,properties);this.editors=[];userSmarts.runtime.Platform.getPropertyService().setController("page",this);};$class.ID_PAGE_TABLE="page";$class.MATCH_NONE=1;$class.MATCH_INPUT=2;$class.MATCH_ID=4;$prototype.init=function(window){userSmarts.ui.PropertyService.prototype.init.call(this,window);this.window=window;this.editorManager=new userSmarts.ui.EditorManager(window,this);};$prototype.getWorkbenchWindow=function(){return this.window;};$prototype.setPerspective=function(desc){if(this.currentPerspective&&(this.currentPerspective.description.getId()==desc.getId())){return;}
var perspective=this.perspectives[desc.getId()];if(!perspective){perspective=new userSmarts.ui.Perspective({description:desc,layout:new userSmarts.ui.PageLayout(this)});this.perspectives[desc.id]=perspective;this.currentPerspective=perspective;perspective.createInitialLayout(perspective.layout);}else{this.currentPerspective=perspective;}
var viewLayouts=perspective.layout.getViews();this.visibleViews=[];for(var viewId in viewLayouts){if(!this.views[viewId]){var desc=this.workbench.getViewRegistry().findViewWithId(viewId);if(desc){this.views[viewId]=new userSmarts.ui.ViewReference(this,desc);}}
var desc=this.views[viewId];if(desc){this.visibleViews.push(desc);}}
this.touch("currentPerspective");this.doLayout();this.document.title=this.currentPerspective.description.getLabel();};$prototype.showView=function(viewId){var view=this.findView(viewId);if(view){this.activate(view);}};$prototype.findViewReference=function(viewId,create){var viewReference=this.views[viewId];if(!viewReference&&create){var desc=this.workbench.getViewRegistry().findViewWithId(viewId);if(desc){viewReference=this.views[viewId]=new userSmarts.ui.ViewReference(this,desc);}}
if(!viewReference){logWarning("Unable to find view reference: "+viewId);}
return viewReference;};$prototype.findView=function(viewId,create){var viewReference=this.findViewReference(viewId,create);if(viewReference){return viewReference.getView(true);}};$prototype.getViewReferences=function(){return this.visibleViews;};$prototype.activate=function(part){if((part instanceof userSmarts.ui.ViewPart)&&(part.getSite().getPage()==this)){var partId=part.getSite().getId();var layout=this.currentPerspective.layout;var viewLayout=layout.getViewLayout(partId);var folder=viewLayout.folder;var ref=this.findViewReference(partId);this.activePartReference=ref;try{part.setFocus();}catch(e){logError("Error setting focus: "+e.message);}
folder.showView(viewLayout);signal(this,"partActivated",ref);}else if(part instanceof userSmarts.ui.EditorPart&&(part.getSite().getPage()==this)){var layout=this.currentPerspective.layout;var editorLayout=layout.getLayout(userSmarts.ui.PageLayout.ID_EDITOR_AREA);if(editorLayout){var ref=this.getReference(part);editorLayout.showEditor(ref);signal(this,"partActivated",ref);}
this.setProperty("activeEditor",part);}};$prototype.isPartVisible=function(part){var result=false;if((part instanceof userSmarts.ui.ViewPart)&&(part.getSite().getPage()==this)){var partId=part.getSite().getId();var layout=this.currentPerspective.layout;var viewLayout=layout.getViewLayout(partId);result=(viewLayout&&viewLayout.isVisible());}else if(part instanceof userSmarts.ui.EditorPart&&(part.getSite().getPage()==this)){logError("Not Implemented");}
return result;};$prototype.getActivePart=function(){var ref=this.getActivePartReference();if(ref){return ref.getActivePart(true);}
return null;};$prototype.getActivePartReference=function(){return this.activePartReference;};$prototype.getActiveEditor=function(){return this.activeEditor;};$prototype.openEditor=function(input,editorId,activate){var editor=this.getEditorManager().findEditor(editorId,input,userSmarts.ui.WorkbenchPage.MATCH_INPUT);if(editor!==null){if(activate){this.activate(editor);}else{this.bringToTop(editor);}}else{var ref=this.getEditorManager().openEditor(editorId,input,true);if(ref!==null){editor=ref.getEditor(true);}
if(editor!==null){this.setEditorAreaVisible(true);if(activate){this.activate(editor);}else{this.bringToTop(editor);}}}
return editor;};$prototype.closeEditor=function(editor,save){var saveNeeded=save&&editor.isSaveOnCloseNeeded();if(saveNeeded){editor.askSave();}
var editorRef;if(editor instanceof userSmarts.ui.WorkbenchPart){editorRef=this.getReference(editor);}else if(editor instanceof userSmarts.ui.EditorReference){editorRef=editor;}
if(editorRef){this.editorManager.closeEditor(editorRef);}};$prototype.findEditor=function(input){return this.findEditors(input,null,0);};$prototype.findEditors=function(input,editorId,matchFlags){return this.editorManager.findEditors(input,editorId,matchFlags);};$prototype.saveAllEditors=function(confirm){logError("Not Implemented");};$prototype.getEditorReferences=function(){return this.editorManager.getEditorReferences();};$prototype.close=function(confirm){logError("Not Implemented");};$prototype.doLayout=function(){if(!this.currentPerspective||!this.window){return;}
var layout=this.currentPerspective.layout;var control=layout.getControl();this.composite.getLayout().topControl=control;this.composite.update();};$prototype.getWidgetBarManager=function(){return this.widgetBarManager;};$prototype.getClientComposite=function(){if(!this.composite){this.composite=this.window.getPageComposite();}
return this.composite;};$prototype.getEditorManager=function(){if(!this.editorManager){this.editorManager=new userSmarts.ui.EditorManager(this);}
return this.editorManager;};$prototype.getReference=function(part){if(!(part instanceof userSmarts.ui.WorkbenchPart)){return null;}
var site=part.getSite();if(site instanceof userSmarts.ui.WorkbenchPartSite){return site.getPartReference();}
return null;};$prototype.certifyPart=function(part){if((part instanceof userSmarts.ui.WorkbenchPart)&&!(part.getSite()instanceof userSmarts.ui.PartSite)){return false;}
if(part instanceof userSmarts.ui.EditorPart){var ref=this.getReference(part);return ref!==null&&this.getEditorManager().containsEditor(ref);}
if(part instanceof userSmarts.ui.ViewPart){var persp=this.getActivePerspective();return persp!==null&&persp.containsView(part);}
return false;};$prototype.setEditorAreaVisible=function(showEditorArea){};$prototype.bringToTop=function(part){};$prototype.getPerspective=function(){return this.currentPerspective;};namespace("userSmarts.ui");$namespace.Section=Class.create(userSmarts.wt.widgets.Composite);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{title:null,description:null,'class':'section',updateOnBoundsChange:true,collapseable:true});superClass.call(this,properties);if(this.expanded==undefined){this.setExpanded(true);}else{this.setExpanded(this.expanded);}
if(!this.width){this.width="100%";}
if(!this.height){this.height="100%";}
this.layoutData={width:this.width,height:this.height};this.setLayout(new userSmarts.wt.layout.RowLayout({type:"vertical"}));var tbar=new userSmarts.wt.widgets.Control({'class':'section-title',layoutData:{width:"100%",height:"20px"}});this.setTextClient(tbar);var dbar=new userSmarts.wt.widgets.Control({'class':'section-description',layoutData:{top:'0px',width:"100%",height:"100px"}});this.setDescriptionControl(dbar);var client=new userSmarts.wt.widgets.Composite({'class':'section-body',updateOnBoundsChange:true,layoutData:{width:"100%",height:"*"}});var node=client.getNode();this.setClient(client);};$prototype.getText=function(){return this.title;};$prototype.setText=function(title){this.title=title;var textControl=this.getTextClient();if(textControl){if(textControl instanceof userSmarts.ui.SectionTitleBar){textControl.setText(title);}else{replaceChildNodes(textControl.getNode(),title);}}};$prototype.getTextClient=function(){return this.titleControl;};$prototype.setTextClient=function(textClient){if(textClient instanceof userSmarts.wt.widgets.Control){if(this.titleControl){this.replace(textClient,this.titleControl);}else{this.add(textClient);}
this.titleControl=textClient;this.setText(this.title);if(this.expandCollapseListener){disconnect(this.expandCollapseListener);}
this.expandCollapseListener=connect(this.titleControl.getNode(),"onclick",this,this.onTitleBarClicked);}};$prototype.hasTitleBar=function(){return!!this.title;};$prototype.onTitleBarClicked=function(){this.setExpanded(!this.isExpanded());};$prototype.getDescription=function(){return this.description;};$prototype.setDescription=function(description){this.description=description;var descControl=this.getDescriptionControl();if(descControl){replaceChildNodes(descControl.getNode(),description);}};$prototype.getDescriptionControl=function(){return this.descControl;};$prototype.setDescriptionControl=function(descriptionControl){if(descriptionControl instanceof userSmarts.wt.widgets.Control){if(this.descControl){this.replace(descriptionControl,this.descControl);}else{this.add(descriptionControl);}
this.descControl=descriptionControl;this.descControl.setVisibility(this.isExpanded());replaceChildNodes(this.descControl.getNode(),this.getDescription());}};$prototype.getClient=function(){return this.client;};$prototype.setClient=function(client){if(client instanceof userSmarts.wt.widgets.Control){if(this.client){this.replace(client,this.client);}else{this.add(client);}
this.client=client;addElementClass(this.client.getNode(),"section-body");this.client.setVisibility(this.isExpanded());}};$prototype.isExpanded=function(){return this.expanded;};$prototype.setExpanded=function(expanded){if(this.collapseable||this.expanded==undefined){this.expanded=expanded;this.internalSetExpanded(expanded);}};$prototype.internalSetExpanded=function(expanded){var desc=this.getDescriptionControl();if(desc){desc.setVisibility(expanded);}
var client=this.getClient();if(client){client.setVisibility(expanded);}
if(expanded){}else{}};$namespace.SectionTitleBar=Class.create(userSmarts.wt.widgets.Composite);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{'class':'section-title',updateOnBoundsChange:true,layoutData:{width:"100%",height:"20px"}});superClass.call(this,properties);this.setLayout(new userSmarts.wt.layout.RowLayout({type:"horizontal",spacing:0}));this.leftBorder=new userSmarts.wt.widgets.Control({parent:this,'class':'section-title-left',layoutData:{width:"4px",height:"100%"}});this.middle=new userSmarts.wt.widgets.Control({parent:this,'class':'section-title-middle',layoutData:{width:"*",height:"100%"}});this.rightBorder=new userSmarts.wt.widgets.Control({parent:this,'class':'section-title-right',layoutData:{width:"7px",height:"100%"}});};$prototype.setText=function(text){replaceChildNodes(this.middle.getNode(),text);};namespace("userSmarts.ui");$namespace.PerspectiveBar=Class.create(userSmarts.wt.widgets.Composite);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{id:"perspectiveBar",perspectives:[],items:[],layoutData:{width:"100%",height:"100%"},padding:{top:2,left:5,bottom:2,right:5},_layout:new userSmarts.wt.layout.PerspectiveBarLayout()});if(!properties.perspectiveFilter){properties.perspectiveFilter={filter:function(item){return true;}};}
if(!properties.sorter){properties.sorter=function(arr){return arr;};}
superClass.call(this,properties);};$prototype.initNode=function(){var wb=userSmarts.ui.PlatformUI.getWorkbench();var perspectives=wb.getPerspectiveRegistry().getPerspectives();perspectives=perspectives.filter(this.perspectiveFilter.filter,this.perspectiveFilter);perspectives=this.sorter(perspectives);for(var i=0;i<perspectives.length;++i){var perspective=perspectives[i];var len=determineLabelWidth(perspective.getLabel(),"perspective");len+=50;this.add(new userSmarts.wt.widgets.TabItem({'class':'perspective',nodeName:"DIV",parent:this,closeable:false,selectedClassName:"selected",image:perspective.getTitleImage(),text:perspective.getLabel(),id:perspective.getId(),layoutData:{width:len,height:"*"},margin:{top:2,left:2,right:2,bottom:2},border:{style:"solid",top:1,left:1,right:1,bottom:1}}));}
this.layout();this.update();var page=wb.getActiveWorkbenchWindow().getActivePage();this.perspListener=connect(page,"currentPerspective",this,this.update);};$prototype.showPerspective=function(){if(this.selected){var wb=userSmarts.ui.PlatformUI.getWorkbench();wb.showPerspective(this.selected.id,wb.getActiveWorkbenchWindow());}};$prototype.setSelection=function(tabItem){var previous=this.selected;if(previous!=tabItem){if(previous instanceof userSmarts.wt.widgets.TabItem){previous.setProperty("selected",false);}
if(tabItem instanceof Bean){tabItem.setProperty("selected",true);}
this.setProperty("selected",tabItem);this.update();this.showPerspective();}};$prototype.update=function(){var workbench=userSmarts.ui.PlatformUI.getWorkbench();var wdw=workbench.getActiveWorkbenchWindow();var per=wdw.getActivePage().getPerspective();var selected;if(per){selected=per.description.getId();}
var children=this.getChildren();for(var c=0;c<children.length;++c){children[c].setProperty("selected",(selected&&children[c].id==selected));}
userSmarts.wt.widgets.Composite.prototype.update.call(this);};$prototype.dispose=function(){if(this.perspListener){disconnect(this.perspListener);this.perspListener=null;}
userSmarts.wt.widgets.Composite.prototype.dispose.call(this);};$prototype.sort=function(arr){var l=0;var r=0;if(arr&&arr.length){r=arr.length-1;}
this.sortItems(arr,l,r);};$prototype.sortItems=function(data,left,right){var items=data;var l_hold=left;var r_hold=right;var pivot=items[left];while(left<right){while((this.comparator.compare(items[right],pivot)>=0)&&(left<right)){--right;}
if(left!=right){items[left]=items[right];++left;}
while((this.comparator.compare(items[left],pivot)<=0)&&(left<right)){++left;}
if(left!=right){items[right]=items[left];--right;}}
items[left]=pivot;pivot=left;left=l_hold;right=r_hold;if(left<pivot){this.sortItems(data,left,pivot-1);}
if(right>pivot){this.sortItems(data,pivot+1,right);}};namespace("userSmarts.ui.application");namespace("userSmarts.ui.application");namespace("userSmarts.ui.application");userSmarts.ui.application.ActionBarAdvisor=Class.create();$prototype.initialize=function(superClass,configurer){this.configurer=configurer;};$prototype.fillActionBars=function(flags){var menuBar=this.configurer.getMenuManager();var coolBar=this.configurer.getCoolBarManager();var statusLine=this.configurer.getStatusLineManager();if(menuBar){this.fillMenuBar(menuBar);}
if(coolBar){this.fillCoolBar(coolBar);}
if(statusLine){this.fillStatusLine(statusLine);}};$prototype.makeActions=function(action){};$prototype.register=function(action){};$prototype.getAction=function(menuBar){};$prototype.fillMenuBar=function(menuBar){};$prototype.fillCoolBar=function(coolBar){coolBar.addItem(new userSmarts.wt.widgets.Clock(null,{id:"PerspectiveBarClock",'class':'clock'}));coolBar.addItem(SPAN({src:'images/CSSA-Logo.gif',width:'32',height:'16'},"Demo"));coolBar.addItem(new userSmarts.ui.PerspectiveBar());};$prototype.fillStatusLine=function(statusLine){};$prototype.dispose=function(){};$prototype.disposeActions=function(){};$prototype.disposeAction=function(action){};namespace("userSmarts.ui.application");userSmarts.ui.application.ActionBarConfigurer=Class.create();$prototype.initialize=function(superClass,windowConfigurer){this.windowConfigurer=windowConfigurer;};$prototype.getCoolBarManager=function(){var page=this.windowConfigurer.getWindow().getActivePage();var wbm=page.getWidgetBarManager();return wbm;};$prototype.getMenuManager=function(){};$prototype.getStatusLineManager=function(){};$prototype.getWindowConfigurer=function(){return this.windowConfigurer;};$prototype.registerGlobalAction=function(action){};namespace("userSmarts.ui.application");userSmarts.ui.application.WorkbenchAdvisor=Class.create();$prototype.initialize=function(superClass){};$prototype.getDefaultPageInput=function(){return null;};$prototype.getInitialWindowPerspectiveId=function(){var preg=userSmarts.ui.WorkbenchPlugin.getDefault().getPerspectiveRegistry();var pid=preg.getPerspectives()[0].getId();return pid;};$prototype.initialize=function(configurer){this.configurer=configurer;};$prototype.getWorkbenchConfigurer=function(){return this.configurer;};$prototype.preStartup=function(){};$prototype.postStartup=function(){};$prototype.preShutdown=function(){};$prototype.postShutdown=function(){};$prototype.createWorkbenchWindowAdvisor=function(configurer){return new userSmarts.ui.application.WorkbenchWindowAdvisor(configurer);};$prototype.openWindows=function(){this.configurer.openFirstTimeWindow();};namespace("userSmarts.ui.application");userSmarts.ui.application.WorkbenchConfigurer=Class.create();$prototype.initialize=function(superClass,workbench,advisor){this.workbench=workbench;this.advisor=advisor;};$prototype.getWorkbench=function(){return this.workbench;};$prototype.openFirstTimeWindow=function(){var advisor=this.advisor;var perspectiveId=advisor.getInitialWindowPerspectiveId();var input=advisor.getDefaultPageInput();var shell=new userSmarts.wt.widgets.Shell({display:this.workbench.getDisplay()});var wbWindow=new userSmarts.ui.WorkbenchWindow(this.workbench,shell);var windowConfigurer=this.getWindowConfigurer(wbWindow);var wb=this.workbench;wb.activeWindow=wbWindow;var windowAdvisor=advisor.createWorkbenchWindowAdvisor(windowConfigurer);windowConfigurer.windowAdvisor=windowAdvisor;windowConfigurer.advisor=advisor;windowAdvisor.postWindowCreate();windowAdvisor.preWindowOpen();var page=new userSmarts.ui.WorkbenchPage({workbench:wb,window:this.window});page.init(wbWindow);wbWindow.setActivePage(page);windowAdvisor.createWindowContents(wbWindow.getShell());shell.getNode();shell.update();perspectiveId=this.advisor.getInitialWindowPerspectiveId()||wb.getPerspectiveRegistry().getDefaultPerspective();wb.showPerspective(perspectiveId,wbWindow);windowAdvisor.postWindowOpen();window.advisor=windowAdvisor;};$prototype.getWindowConfigurer=function(wbWindow){return new userSmarts.ui.application.WorkbenchWindowConfigurer(wbWindow);};namespace("userSmarts.ui.application");namespace("userSmarts.ui.application");$namespace.WorkbenchWindowAdvisor=Class.create();$prototype.initialize=function(superClass,configurer){this.configurer=configurer;};$prototype.getWindowConfigurer=function(){return this.configurer;};$prototype.preWindowOpen=function(){};$prototype.createActionBarAdvisor=function(configurer){var result=new userSmarts.ui.application.ActionBarAdvisor(configurer);return result;};$prototype.openIntro=function(){};$prototype.postWindowCreate=function(){};$prototype.postWindowClose=function(){};$prototype.postWindowOpen=function(){};$prototype.postWindowRestore=function(){};$prototype.preWindowShellClose=function(){return true;};$prototype.createWindowContents=function(shell){this.getWindowConfigurer().createDefaultContents(shell);};$prototype.dispose=function(){};namespace("userSmarts.ui.application");userSmarts.ui.application.WorkbenchWindowConfigurer=Class.create();$prototype.initialize=function(superClass,window){this.window=window;};$prototype.getWindow=function(){return this.window;};$prototype.createPageComposite=function(parent){this.window.createPageComposite(parent);};$prototype.createDefaultContents=function(shell){shell.setLayout(new userSmarts.wt.layout.RowLayout({type:"vertical"}));var display=shell.getDisplay();shell.setBounds(0,0,display.getWidth(),display.getHeight());var pb=new userSmarts.ui.PerspectiveBar({parent:shell,layoutData:{height:20,width:"100%"}});this.createPageComposite(shell);this.window.getPageComposite().setLayoutData({width:"100%",height:"*"});var fb=new userSmarts.wt.widgets.Control({parent:shell,layoutData:{height:"20px"},node:SPAN({},"Copyright Notice Goes Here!")});shell.layout();};namespace("userSmarts.ui.views");namespace("userSmarts.ui.views");namespace("userSmarts.ui.views");$namespace.TableView=Class.create(userSmarts.ui.ViewPart);$prototype.initialize=function(superClass,desc){superClass.call(this,desc);if(!this.className){this.className='table-view';}
this.table=new userSmarts.wt.widgets.CTable({model:this.model,'class':this.className,cellSpacing:1,cellPadding:2});};$prototype.init=function(site){userSmarts.ui.ViewPart.prototype.init.call(this,site);site.setPropertyProvider(this);this.contributeToActionBars();};$prototype.createPartControl=function(){if(this.model){setTimeout(bind(this.buildTable,this),1000);}
this.selectionListener=connect(this.table,'selected',this,this.onTableSelectionChange);return this.table;};$prototype.buildTable=function(){if(this.model){this.table.setProperty("model",this.model);}};$prototype.contributeToActionBars=function(){var bars=this.getSite().getActionBars();var tbmgr=bars.getToolbarManager();var mbmgr=bars.getMenuBarManager();var action=new userSmarts.wt.action.RefreshTableAction({control:this.table});tbmgr.add(action);mbmgr.add(action);mbmgr.add(new userSmarts.wt.action.ConfigureTableAction({control:this.table}));};$prototype.onTableSelectionChange=function(event){this.setProperty("selected",event.newValue);this.setProperty("resource",event.newValue);};$prototype.dispose=function(){if(this.selectionListener){disconnect(this.selectionListener);this.selectionListener=null;}
userSmarts.ui.ViewPart.prototype.dispose.call(this);};namespace("userSmarts.ui.views");$namespace.ListView=Class.create(userSmarts.ui.ViewPart);$prototype.initialize=function(superClass,desc){desc=setdefault(desc,{async:true});superClass.call(this,desc);if(!this.className){this.className='wt-list';}
this.list=new userSmarts.wt.widgets.List({'class':this.className});this.selectionListener=connect(this.list,'selected',this,this.onSelectionChange);};$prototype.init=function(site){userSmarts.ui.ViewPart.prototype.init.call(this,site);site.setPropertyProvider(this);this.contributeToActionBars();};$prototype.createPartControl=function(){if(this.model){if(this.async){setTimeout(bind(this.buildList,this),1000);}else{this.list.setModel(this.model);this.model.populate(0);}}
return this.list;};$prototype.buildList=function(){if(this.model){this.list.setModel(this.model);}};$prototype.contributeToActionBars=function(){var bars=this.getSite().getActionBars();var tbmgr=bars.getToolbarManager();var mbmgr=bars.getMenuBarManager();mbmgr.add(new userSmarts.wt.action.SortOnColumnAction({control:this.list,showText:true}));mbmgr.add(new userSmarts.wt.action.RefreshListAction({list:this.list,showText:true}));mbmgr.add(new userSmarts.wt.action.ExpandListAction({list:this.list,showText:true}));mbmgr.add(new userSmarts.wt.action.CollapseListAction({list:this.list,showText:true}));};$prototype.onSelectionChange=function(event){this.setProperty("selected",event.newValue);this.setProperty("resource",event.newValue);};$prototype.dispose=function(){if(this.selectionListener){disconnect(this.selectionListener);this.selectionListener=null;}
userSmarts.ui.ViewPart.prototype.dispose.call(this);};