Commit b9e0a3f4 authored by Ubbo Veentjer's avatar Ubbo Veentjer
Browse files

create new bolobject works now

parent 2e1e53dd
......@@ -10,6 +10,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.expressions;bundle-version="3.4.300",
info.textgrid.lab.core.model;bundle-version="0.1.2",
info.textgrid.lab.core.swtutils;bundle-version="1.0.2",
info.textgrid.lab.ui.core;bundle-version="1.0.1"
info.textgrid.lab.ui.core;bundle-version="1.0.1",
org.apache.cxf.bundle;bundle-version="2.5.5",
org.apache.servicemix.specs.jsr311-api-1.1.1;bundle-version="1.9.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
package de.blumenbach_online.tglab.sammlungsdb;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import info.textgrid.lab.authn.RBACSession;
import info.textgrid.lab.core.model.TextGridObject;
import info.textgrid.lab.ui.core.dialogs.INewObjectPreparator;
import info.textgrid.lab.ui.core.dialogs.ITextGridWizard;
import info.textgrid.lab.ui.core.dialogs.NewObjectWizard;
import java.io.IOException;
import java.io.InputStream;
import javax.ws.rs.core.Response;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.jaxrs.ext.form.Form;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
import de.blumenbach_online.tglab.sammlungsdb.preferences.PluginPreferencePage;
public class Preparator implements INewObjectPreparator {
......@@ -31,6 +40,35 @@ public class Preparator implements INewObjectPreparator {
@Override
public boolean performFinish(TextGridObject textGridObject) {
try {
String url = Platform.getPreferencesService().getString(Activator.PLUGIN_ID, PluginPreferencePage.boldbUrl_id, "", null);
Form form = new Form();
form.set("tgSID", RBACSession.getInstance().getSID(false));
form.set("tgPID", textGridObject.getProject());
form.set("title", textGridObject.getTitle());
Response res = WebClient.create(url + "/db/create").form(form);
System.out.println(res.getStatus());
InputStream in = ((InputStream)res.getEntity());
IOUtils.copy(in, System.out);
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return true;
/*
// TODO Auto-generated method stub
String inputString = "<RDF>bolbloblob</RDF>";
ByteArrayInputStream contentStream = null;
......@@ -51,7 +89,7 @@ public class Preparator implements INewObjectPreparator {
if (wizard instanceof NewObjectWizard)
return ((NewObjectWizard) wizard).defaultPerformFinish("info.textgrid.lab.welcome.XMLEditorPerspective");
else
return false;
return false;*/
}
}
......@@ -15,6 +15,8 @@ import org.eclipse.swt.SWTError;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swt.browser.StatusTextEvent;
import org.eclipse.swt.browser.StatusTextListener;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.widgets.Composite;
......@@ -146,6 +148,16 @@ public class SammlungsDbEditor extends EditorPart {
}
});
/*browser.addStatusTextListener(new StatusTextListener() {
@Override
public void changed(StatusTextEvent event) {
// TODO Auto-generated method stub
System.out.println("stl: " +event + event.text);
}
});*/
browser.addKeyListener(new KeyListener() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment