import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchPart;
import org.springframework.remoting.RemoteAccessException;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.model.DescriptionHelper;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
private String referencedObjectTitleCache;
private ConversationHolder conversation;
- private final ICdmEntitySession cdmEntitySession;
+ //private final ICdmEntitySession cdmEntitySession;
private UUID actualUuid;
List<CdmBase> referencingObjects = null;
Set<CdmBase> referencingObjectsSet = null;
private Job currentJob = null;
public ReferencingObjectsView() {
- cdmEntitySession = CdmStore.getCurrentSessionManager().bindNullSession();
+ // cdmEntitySession = CdmStore.getCurrentSessionManager().getNullSession();
+
+ //cdmEntitySession = CdmStore.getCurrentSessionManager().bindNullSession();
}
/** {@inheritDoc} */
createColumns(viewer);
viewer.setContentProvider(new ReferencingObjectsContentProvider());
viewer.setLabelProvider(new ReferencingObjectsLabelProvider());
+
viewer.setCellModifier(new ICellModifier() {
@Override
public void modify(Object element, String property, Object value) {
@Override
public void setFocus() {
- cdmEntitySession.bind();
+ // cdmEntitySession.bind();
}
public void updateReferencingObjects(final UUID entityUUID, final Class objectClass) {
}
}
- currentJob = new Job("Update Referencing Objects " + entityUUID) {
+ currentJob = new Job("Update Referencing Objects") {
@Override
- protected IStatus run(IProgressMonitor monitor) {
+ protected IStatus run(final IProgressMonitor monitor) {
monitor.beginTask("Calculating referencing objects", 100);
actualUuid = entityUUID;
}
actualMonitor = monitor;
if (entityUUID != null){
- ICdmEntitySession previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession();
- cdmEntitySession.bind();
+// ICdmEntitySession previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession();
+// cdmEntitySession.bind();
referencingObjectsSet = getReferencingObjects(entityUUID, objectClass);
if(monitor.isCanceled()) {
}
if(monitor.isCanceled()) {
- if(previousCdmEntitySession != null) {
- previousCdmEntitySession.bind();
- }
+// if(previousCdmEntitySession != null) {
+// previousCdmEntitySession.bind();
+// }
return Status.CANCEL_STATUS;
}
monitor.worked(80);
- updateView();
-
- if(previousCdmEntitySession != null) {
- previousCdmEntitySession.bind();
- }
+
+ updateView();
+// if(previousCdmEntitySession != null) {
+// previousCdmEntitySession.bind();
+// }else{
+// CdmStore.getCurrentSessionManager().bind(null);
+// }
// actualUuid = entityUUID;
}
monitor.done();
-
-
+ actualMonitor = null;
+
return Status.OK_STATUS;
currentJob.setUser(true);
currentJob.schedule();
-// final IJobChangeListener listener;
-// listener = new JobChangeAdapter() {
-// @Override
-// public void done(IJobChangeEvent event) {
-// System.err.println("Job is done" + entityUUID);
-// //event.getJob().cancel();
-// }
-//
-// };
-// currentJob.addJobChangeListener(listener);
-
-
-
-
}
private Set<CdmBase> getReferencingObjects(UUID entity, Class objectClass) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
+
if (viewer != null && !viewer.getControl().isDisposed()){
try{
viewer.setInput(referencingObjects);
//enable/disable table
viewer.getControl().setEnabled(referencingObjects!=null);
-
}catch(Exception e){
e.printStackTrace();
logger.debug(e.getStackTrace());
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- if (referencedObjectTitleCache != null){
+ if (referencedObjectTitleCache != null){
setContentDescription(description);
} else {
setContentDescription(description);
}
+
}
});
conversation.close();
selectionService.removePostSelectionListener(this);
selectionService.removeSelectionListener(this);
- cdmEntitySession.dispose();
+ //cdmEntitySession.dispose();
super.dispose();
}