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

add tester

git-svn-id: https://textgridlab.org/svn/textgrid/trunk/lab/sadepublish@12639 7c539038-3410-0410-b1ec-0f2a7bf1c452
parent 25cba330
package info.textgrid.lab.sadepublish.tester;
import info.textgrid.lab.core.model.TGObjectReference;
import info.textgrid.lab.core.model.TextGridObject;
import info.textgrid.lab.core.swtutils.AdapterUtils;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.runtime.CoreException;
public class IsPublishableObject extends PropertyTester {
@Override
public boolean test(Object receiver, String property, Object[] args,
Object expectedValue) {
System.out.println("test content type");
if (receiver != null && receiver instanceof TGObjectReference) {
return isOK(AdapterUtils.getAdapter(receiver, TextGridObject.class));
}
return true;
}
private boolean isOK(TextGridObject tgo) {
String contentTypeId = "";
// reloadMetadata(tgo);
try {
contentTypeId = tgo.getContentTypeID();
if (contentTypeId.contains("tg.aggregation")) {
return true;
}
} catch (CoreException e) {
info.textgrid.lab.sadepublish.Activator
.handleWarning(e,
"Couldn't get the content type id of the selected textgrid object");
}
return false;
}
}
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