Skip to content

Commit

Permalink
- Some code-cleanup (reference #62)
Browse files Browse the repository at this point in the history
- Expand/collapse branches now restricted to double-click (reference
#83)
  • Loading branch information
rat-moonshine committed Nov 29, 2017
1 parent a86f2ff commit a90aef7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ package actionScripts.ui.renderers
private var sourceControlSystem:Label;
private var loadingIcon:Image;
private var isTooltipListenerAdded:Boolean;
private var newMenuItems:Array = [];
private var inputValidator:StringValidator;

public function FTETreeItemRenderer()
Expand All @@ -90,9 +89,6 @@ package actionScripts.ui.renderers
model = IDEModel.getInstance();
ChangeWatcher.watch(model, 'activeEditor', onActiveEditorChange);

// stores *new* context menu item
generateNewMenuItems();

inputValidator = new StringValidator();
inputValidator.property = "text";
inputValidator.required = true;
Expand All @@ -102,24 +98,6 @@ package actionScripts.ui.renderers
ErrorTipManager.registerValidator(inputValidator);
}

private function generateNewMenuItems():void
{
if (ConstantsCoreVO.IS_AIR)
{
newMenuItems = [];
for each (var fileTemplate:FileLocation in TemplatingPlugin.fileTemplates)
{
var lbl:String = TemplatingHelper.getTemplateLabel(fileTemplate);

// TODO: Do MenuEvent and have data:* for this kind of thing
var eventType:String = "eventNewFileFromTemplate"+lbl;
var newMenu:Object = model.contextMenuCore.getContextMenuItem(lbl, null, Event.SELECT);
newMenu.data = eventType;
newMenuItems.push(newMenu);
}
}
}

private function onActiveEditorChange(event:Event):void
{
invalidateDisplayList();
Expand Down
30 changes: 12 additions & 18 deletions ide/MoonshineSharedCore/src/components/views/project/TreeView.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,6 @@
/*
Custom implementation of editing, instead of using mx:Trees builtin capabilities
*/
private function handleItemRenameCancel(event:TreeMenuItemEvent):void
{
cleanupAfterRename();
Expand Down Expand Up @@ -814,27 +813,23 @@
return null;
}
private function fileClickedInTree(event:ListEvent):void
private function fileDoubleClickedInTree(event:ListEvent):void
{
var item:Object = tree.selectedItem;
if ( tree.dataDescriptor.isBranch(item) )
var item:FileWrapper = tree.selectedItem as FileWrapper;
if (tree.dataDescriptor.isBranch(item))
{
tree.expandItem(item, !tree.isItemOpen(item), true);
}
else
{
if (item.file.fileBridge.isDirectory || item.isWorking) return;
GlobalEventDispatcher.getInstance().dispatchEvent(
new OpenFileEvent(OpenFileEvent.OPEN_FILE, item.file, -1, item)
);
}
refreshActiveProject(item as FileWrapper);
}
private function fileDoubleClickedInTree(event:ListEvent):void
{
var fw:FileWrapper = event.itemRenderer.data as FileWrapper;
if (fw.file.fileBridge.isDirectory || fw.isWorking) return;
refreshActiveProject(fw);
GlobalEventDispatcher.getInstance().dispatchEvent(
new OpenFileEvent(OpenFileEvent.OPEN_FILE, fw.file, -1, fw)
);
refreshActiveProject(item);
}
private function getIconForFile(object:Object):Class
Expand Down Expand Up @@ -897,7 +892,6 @@
iconFunction="{getIconForFile}"
itemRenderer="{new ClassFactory(FTETreeItemRenderer)}"
itemDoubleClick="fileDoubleClickedInTree(event)"
itemClick="fileClickedInTree(event)"
creationComplete="initTree()"/>

</mx:VBox>

0 comments on commit a90aef7

Please sign in to comment.