Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
The resource URI now shows up in the Properties View
  • Loading branch information
egonw committed Jan 7, 2013
1 parent ff2a89b commit 0a5adcf
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
3 changes: 2 additions & 1 deletion plugins/net.bioclipse.icebear/META-INF/MANIFEST.MF
Expand Up @@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.ui,
net.bioclipse.inchi,
net.bioclipse.rdf,
com.hp.hpl.jena.arq;bundle-version="2.8.8",
com.hp.hpl.jena;bundle-version="2.6.4"
com.hp.hpl.jena;bundle-version="2.6.4",
org.eclipse.ui.views
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.apache.log4j
Bundle-ActivationPolicy: lazy
Expand Up @@ -10,10 +10,14 @@
*/
package net.bioclipse.icebear.business;

import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource2;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;

/**
* Class to hold the molecular properties.
*/
public class Entry {
public class Entry implements IPropertySource2 {

// the next two fields are for provenance

Expand All @@ -34,4 +38,54 @@ public String toString() {
return "[" + predicate + ": " + object + "]";
}

@Override
public Object getEditableValue() {
return this;
}

private static final String SOURCE_ID = "isbjorn.source.id";
private static final TextPropertyDescriptor SOURCE_PROPERTY_DESCRIPTOR =
new TextPropertyDescriptor(SOURCE_ID, "Source URI");
static {
SOURCE_PROPERTY_DESCRIPTOR.setCategory("Linked Data");
SOURCE_PROPERTY_DESCRIPTOR.setAlwaysIncompatible(true);
}

private static final IPropertyDescriptor[] DESCRIPTORS = {
SOURCE_PROPERTY_DESCRIPTOR
};

@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
return DESCRIPTORS;
}

@Override
public Object getPropertyValue(Object id) {
if (SOURCE_ID.equals(id)) {
return resource;
}
return null;
}

@Override
public void resetPropertyValue(Object id) {
// nothing to do
}

@Override
public void setPropertyValue(Object id, Object value) {
// nothing to do
}

@Override
public boolean isPropertyResettable(Object id) {
return false;
}

@Override
public boolean isPropertySet(Object id) {
return true; // always true, because there is no reasonable default
}

}

0 comments on commit 0a5adcf

Please sign in to comment.