changeset 0:6c0a97ea21c7

first release
author dwinter
date Thu, 16 Jun 2011 16:53:24 +0200
parents
children ff0e3c719b43
files .classpath .project .settings/org.eclipse.jdt.core.prefs META-INF/MANIFEST.MF build.properties plugin.xml src/de/mpg/mpiwg/itgroup/textgrid/digilib/Activator.java src/de/mpg/mpiwg/itgroup/textgrid/digilib/DigilibHandler.java
diffstat 8 files changed, 251 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.classpath	Thu Jun 16 16:53:24 2011 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/de.mpg.mpiwg.itgroup.digilib.plugin"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/info.textgrid.lab.core.model"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/info.textgrid.lab.authn"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.project	Thu Jun 16 16:53:24 2011 +0200
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>de.mpg.mpiwg.itgroup.textgrid.digilib</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.settings/org.eclipse.jdt.core.prefs	Thu Jun 16 16:53:24 2011 +0200
@@ -0,0 +1,8 @@
+#Wed Dec 29 17:55:05 CET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/META-INF/MANIFEST.MF	Thu Jun 16 16:53:24 2011 +0200
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Digilib
+Bundle-SymbolicName: de.mpg.mpiwg.itgroup.textgrid.digilib;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: de.mpg.mpiwg.itgroup.textgrid.digilib.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ de.mpg.mpiwg.itgroup.digilib.plugin;bundle-version="0.0.1",
+ org.eclipse.ui.editors,
+ org.eclipse.ui.views;bundle-version="3.5.0",
+ org.eclipse.ui.ide,
+ org.eclipse.core.resources;bundle-version="3.6.0",
+ info.textgrid.lab.core.swtutils;bundle-version="1.0.2",
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.100",
+ info.textgrid.lab.core.model;bundle-version="0.0.2"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build.properties	Thu Jun 16 16:53:24 2011 +0200
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugin.xml	Thu Jun 16 16:53:24 2011 +0200
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         id="de.mpiwg.itgroup.textgrid.digilib.Viewer"
+         name="digilib viewer"
+         point="org.eclipse.ui.commands">
+      <command
+            description="ShowImage in Digilib"
+            id="de.mpg.mpiwg.itgroup.textgrid.digilib.showImage"
+            name="ShowImage (digilib)">
+      </command>
+   </extension>
+   <extension
+         name="show Images"
+         point="org.eclipse.ui.menus">
+      <menuContribution
+            allPopups="true"
+            locationURI="popup:org.eclipse.ui.popup.any?after=additions">
+         <command
+               commandId="de.mpg.mpiwg.itgroup.textgrid.digilib.showImage"
+               style="push">
+         </command>
+      </menuContribution>
+   </extension>
+   <extension
+         point="org.eclipse.ui.handlers">
+      <handler
+            class="de.mpg.mpiwg.itgroup.textgrid.digilib.DigilibHandler"
+            commandId="de.mpg.mpiwg.itgroup.textgrid.digilib.showImage">
+      </handler>
+   </extension>
+   <extension
+         point="org.eclipse.ui.editors">
+      <editor
+            class="de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorPart"
+            contributorClass="de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorContributor"
+            default="false"
+            id="de.mpg.mpiwg.itgroup.textgrid.digilib.editor1"
+            name="Digilib Link Editor">
+      </editor>
+   </extension>
+   <extension
+         point="org.eclipse.ui.preferencePages">
+      <page
+            class="de.mpg.mpiwg.itgroup.digilib.plugin.preferences.PluginPreferencePage"
+            id="de.mpg.mpiwg.itgroup.textgrid.digilib.page1"
+            name="Digilib viewer">
+      </page>
+   </extension>
+   <extension
+         point="org.eclipse.core.runtime.preferences">
+      <initializer
+            class="de.mpg.mpiwg.itgroup.digilib.plugin.preferences.PluginPreferenceInitializer">
+      </initializer>
+   </extension>
+
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/de/mpg/mpiwg/itgroup/textgrid/digilib/Activator.java	Thu Jun 16 16:53:24 2011 +0200
@@ -0,0 +1,50 @@
+package de.mpg.mpiwg.itgroup.textgrid.digilib;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "de.mpg.mpiwg.itgroup.textgrid.digilib"; //$NON-NLS-1$
+
+	// The shared instance
+	private static Activator plugin;
+	
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 *
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/de/mpg/mpiwg/itgroup/textgrid/digilib/DigilibHandler.java	Thu Jun 16 16:53:24 2011 +0200
@@ -0,0 +1,74 @@
+package de.mpg.mpiwg.itgroup.textgrid.digilib;
+
+import java.net.URI;
+
+import info.textgrid.lab.authn.RBACSession;
+import info.textgrid.lab.core.model.TextGridObject;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+import info.textgrid.lab.core.swtutils.AdapterUtils;
+
+import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorInput;
+import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorPart;
+
+
+public class DigilibHandler implements IHandler {
+
+	public void addHandlerListener(IHandlerListener handlerListener) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void dispose() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
+		if (IStructuredSelection.class.isInstance(currentSelection)) {
+			IStructuredSelection selection = (IStructuredSelection) currentSelection;
+			TextGridObject object = AdapterUtils.getAdapter(selection.getFirstElement(), TextGridObject.class);
+		
+			
+			IFile file = (IFile) object.getAdapter(IFile.class);
+			URI textGridUri = object.getURI();
+			String sid = RBACSession.getInstance().getSID(true);
+			DigilibLinkEditorInput input = new DigilibLinkEditorInput(textGridUri,sid,DigilibLinkEditorInput.TEXTGRID);
+			
+		try {
+			DigilibLinkEditorPart dp = (DigilibLinkEditorPart) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().openEditor(input,"de.mpg.mpiwg.itgroup.digilib.plugin.digilibLinkEditor");
+			return dp;
+		} catch (PartInitException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		}
+		return null;
+	}
+
+	public boolean isEnabled() {
+		
+		return true;
+	}
+
+	public boolean isHandled() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void removeHandlerListener(IHandlerListener handlerListener) {
+		// TODO Auto-generated method stub
+
+	}
+
+}