added "explore from here" helper script opens a file browser on the curent selection Change-Id: Ie9207464da7ef96064c3a0a42e81f8d5f5b8657a
diff --git a/JavaScript Snippets/Explore from here.js b/JavaScript Snippets/Explore from here.js new file mode 100644 index 0000000..c745ded --- /dev/null +++ b/JavaScript Snippets/Explore from here.js
@@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2014 Christian Pontesegger and others. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors : Christian Pontesegger - initial API and implementation + * name : Explore from here + * image : platform:/plugin/org.eclipse.ease.ui/icons/eobj16/folder.png + * toolbar : Project Explorer + * popup : enableFor(org.eclipse.core.resources.IResource) + * script-type : JavaScript + * description : Start a file browser using current selection. + ******************************************************************************/ + +loadModule('/System/Platform'); +loadModule('/System/UI'); + +var selection = getSelection(); +if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection) + selection = selection.getFirstElement(); + +if (selection instanceof org.eclipse.core.resources.IFile) + selection = selection.getParent(); + +if (selection instanceof org.eclipse.core.resources.IContainer) + // runProcess("/usr/bin/krusader", ["--left", getSystemProperty("user.home"), "--right", selection.getRawLocation()]); + runProcess("explorer.exe", [ selection.getRawLocation() ]);