Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-10-18 05:41:00 +0000
committerEike Stepper2011-10-18 05:41:00 +0000
commit194aabd5516fc12b42b6ded13250e2f7d9d6387d (patch)
tree8a7060149a821872464de0fd7faed920920f9696 /plugins/org.eclipse.emf.cdo.releng.winexplorer/src
parent6a31faf9ecce90f9b3af4639810433e589248dfb (diff)
downloadcdo-194aabd5516fc12b42b6ded13250e2f7d9d6387d.tar.gz
cdo-194aabd5516fc12b42b6ded13250e2f7d9d6387d.tar.xz
cdo-194aabd5516fc12b42b6ded13250e2f7d9d6387d.zip
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.releng.winexplorer/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.winexplorer/src/org/eclipse/emf/cdo/releng/winexplorer/Activator.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.winexplorer/src/org/eclipse/emf/cdo/releng/winexplorer/ExplorerAction.java69
2 files changed, 123 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.releng.winexplorer/src/org/eclipse/emf/cdo/releng/winexplorer/Activator.java b/plugins/org.eclipse.emf.cdo.releng.winexplorer/src/org/eclipse/emf/cdo/releng/winexplorer/Activator.java
new file mode 100644
index 0000000000..ce065bf19b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.releng.winexplorer/src/org/eclipse/emf/cdo/releng/winexplorer/Activator.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.releng.winexplorer;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * @author Eike Stepper
+ */
+public class Activator extends AbstractUIPlugin
+{
+ public static final String PLUGIN_ID = "org.eclipse.emf.cdo.releng.winexplorer";
+
+ private static Activator plugin;
+
+ public Activator()
+ {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception
+ {
+ super.start(context);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception
+ {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public static Activator getDefault()
+ {
+ return plugin;
+ }
+
+ public static ImageDescriptor getImageDescriptor(String path)
+ {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.releng.winexplorer/src/org/eclipse/emf/cdo/releng/winexplorer/ExplorerAction.java b/plugins/org.eclipse.emf.cdo.releng.winexplorer/src/org/eclipse/emf/cdo/releng/winexplorer/ExplorerAction.java
new file mode 100644
index 0000000000..00a3eab1ca
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.releng.winexplorer/src/org/eclipse/emf/cdo/releng/winexplorer/ExplorerAction.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.releng.winexplorer;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public class ExplorerAction implements IObjectActionDelegate
+{
+ private IResource resource;
+
+ public ExplorerAction()
+ {
+ }
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart)
+ {
+ }
+
+ public void selectionChanged(IAction action, ISelection selection)
+ {
+ resource = null;
+ if (selection instanceof IStructuredSelection)
+ {
+ IStructuredSelection ssel = (IStructuredSelection)selection;
+ Object element = ssel.getFirstElement();
+ if (element instanceof IResource)
+ {
+ resource = (IResource)element;
+ if (resource instanceof IFile)
+ {
+ resource = resource.getParent();
+ }
+ }
+ }
+ }
+
+ public void run(IAction action)
+ {
+ try
+ {
+ String location = resource.getLocation().toString().replace('/', File.separatorChar);
+ Runtime.getRuntime().exec("explorer.exe \"" + location + "\"");
+ }
+ catch (IOException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+}

Back to the top