Issue #697 added drawing indicator for shared display for data provider, fixed shutdown issue
Change-Id: Iccfb92e3155e8be5c780e601fb8c31ef2c74f39f Former-commit-id:e92eb6366e
[formerlye92eb6366e
[formerly c00c45f5ba1ae3bb0a0a246d1435bd10b3a8aa51]] Former-commit-id:4c8b468854
Former-commit-id:c2d278d75b
This commit is contained in:
parent
f2e34fe03c
commit
35e332f89a
12 changed files with 189 additions and 296 deletions
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.display;
|
||||
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
||||
|
||||
/**
|
||||
|
@ -86,4 +88,8 @@ public interface IRemoteDisplayContainer {
|
|||
IRemoteDisplayChangedListener listener);
|
||||
|
||||
public RemoteDisplay getActiveDisplay();
|
||||
|
||||
public IEditorPart getActiveDisplayEditor();
|
||||
|
||||
public void disposeContainer();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package com.raytheon.uf.viz.collaboration.display.data;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer;
|
||||
import com.raytheon.uf.viz.collaboration.display.roles.IRoleEventController;
|
||||
|
||||
/**
|
||||
|
@ -54,11 +54,7 @@ public class SessionContainer {
|
|||
|
||||
private SessionColorManager colorManager;
|
||||
|
||||
/**
|
||||
* the editor associated with a session, only valid if not fulfilling the
|
||||
* Data Provider role
|
||||
**/
|
||||
private ICollaborationEditor collaborationEditor;
|
||||
private IRemoteDisplayContainer displayContainer;
|
||||
|
||||
public ISharedDisplaySession getSession() {
|
||||
return session;
|
||||
|
@ -76,12 +72,19 @@ public class SessionContainer {
|
|||
this.roleEventController = roleEventController;
|
||||
}
|
||||
|
||||
public ICollaborationEditor getCollaborationEditor() {
|
||||
return collaborationEditor;
|
||||
/**
|
||||
* @return the displayContainer
|
||||
*/
|
||||
public IRemoteDisplayContainer getDisplayContainer() {
|
||||
return displayContainer;
|
||||
}
|
||||
|
||||
public void setCollaborationEditor(ICollaborationEditor collaborationEditor) {
|
||||
this.collaborationEditor = collaborationEditor;
|
||||
/**
|
||||
* @param displayContainer
|
||||
* the displayContainer to set
|
||||
*/
|
||||
public void setDisplayContainer(IRemoteDisplayContainer displayContainer) {
|
||||
this.displayContainer = displayContainer;
|
||||
}
|
||||
|
||||
public String getSessionId() {
|
||||
|
|
|
@ -19,26 +19,10 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.display.roles;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.eclipse.ui.IPartListener;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.display.Activator;
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
|
||||
|
||||
/**
|
||||
* Abstract role event controller that shares fields and methods that are common
|
||||
|
@ -58,14 +42,12 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class AbstractRoleEventController implements
|
||||
IRoleEventController, IPartListener, RemoveListener {
|
||||
public abstract class AbstractRoleEventController<T extends IRemoteDisplayContainer>
|
||||
implements IRoleEventController {
|
||||
|
||||
protected ISharedDisplaySession session;
|
||||
|
||||
protected List<ResourcePair> resourcesAdded = new ArrayList<ResourcePair>();
|
||||
|
||||
private List<AbstractEditor> resourceEditors = new CopyOnWriteArrayList<AbstractEditor>();
|
||||
protected T container;
|
||||
|
||||
protected AbstractRoleEventController(ISharedDisplaySession session) {
|
||||
this.session = session;
|
||||
|
@ -74,137 +56,18 @@ public abstract class AbstractRoleEventController implements
|
|||
@Override
|
||||
public void startup() {
|
||||
session.registerEventHandler(this);
|
||||
SessionContainer sc = SharedDisplaySessionMgr
|
||||
.getSessionContainer(session.getSessionId());
|
||||
container = createDisplayContainer();
|
||||
sc.setDisplayContainer(container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
session.unregisterEventHandler(this);
|
||||
|
||||
// Orphaned tellestrators, not sure what to do yet about clear
|
||||
for (AbstractEditor editor : resourceEditors) {
|
||||
deactivateResources(editor);
|
||||
}
|
||||
for (ResourcePair rp : resourcesAdded) {
|
||||
AbstractVizResource<?, ?> resource = rp.getResource();
|
||||
if (resource != null) {
|
||||
resource.getDescriptor().getResourceList()
|
||||
.removePostRemoveListener(this);
|
||||
resource.unload();
|
||||
}
|
||||
}
|
||||
resourcesAdded.clear();
|
||||
resourceEditors.clear();
|
||||
container.disposeContainer();
|
||||
}
|
||||
|
||||
protected void activateResources(AbstractEditor editor) {
|
||||
for (IDisplayPane pane : editor.getDisplayPanes()) {
|
||||
activateResources(pane.getRenderableDisplay());
|
||||
}
|
||||
resourceEditors.add(editor);
|
||||
editor.getSite().getPage().addPartListener(this);
|
||||
}
|
||||
|
||||
protected void activateResources(IRenderableDisplay display) {
|
||||
try {
|
||||
IDescriptor descriptor = display.getDescriptor();
|
||||
for (ResourcePair resource : getResourcesToAdd()) {
|
||||
if (resource.getResource() == null) {
|
||||
resource.setResource(resource.getResourceData().construct(
|
||||
resource.getLoadProperties(), descriptor));
|
||||
}
|
||||
descriptor.getResourceList().add(resource);
|
||||
descriptor.getResourceList().addPostRemoveListener(this);
|
||||
resourcesAdded.add(resource);
|
||||
}
|
||||
} catch (VizException e) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
"Error adding drawing resource to pane", e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void deactivateResources(AbstractEditor editor) {
|
||||
partClosed(editor);
|
||||
editor.getSite().getPage().removePartListener(this);
|
||||
}
|
||||
|
||||
protected List<ResourcePair> getResourcesToAdd() {
|
||||
List<ResourcePair> resources = new ArrayList<ResourcePair>();
|
||||
return resources;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener#notifyRemove
|
||||
* (com.raytheon.uf.viz.core.drawables.ResourcePair)
|
||||
*/
|
||||
@Override
|
||||
public void notifyRemove(ResourcePair rp) throws VizException {
|
||||
if (resourcesAdded.contains(rp)) {
|
||||
try {
|
||||
Class<?> clazz = rp.getResource().getClass();
|
||||
Constructor<?> constructor = clazz.getConstructor(clazz);
|
||||
ResourcePair newPair = new ResourcePair();
|
||||
newPair.setLoadProperties(rp.getLoadProperties());
|
||||
newPair.setProperties(rp.getProperties());
|
||||
newPair.setResourceData(rp.getResourceData());
|
||||
newPair.setResource((AbstractVizResource<?, ?>) constructor
|
||||
.newInstance(rp.getResource()));
|
||||
rp.getResource().getDescriptor().getResourceList().add(newPair);
|
||||
} catch (Exception e) {
|
||||
Activator.statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"Cannot manage resources from being unloaded that do not have copy constructor",
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
|
||||
*/
|
||||
@Override
|
||||
public void partClosed(IWorkbenchPart part) {
|
||||
for (AbstractEditor editor : resourceEditors) {
|
||||
if (editor == part) {
|
||||
for (IDisplayPane pane : editor.getDisplayPanes()) {
|
||||
deactivateResources(pane.getRenderableDisplay());
|
||||
}
|
||||
resourceEditors.remove(editor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void deactivateResources(IRenderableDisplay display) {
|
||||
ResourceList list = display.getDescriptor().getResourceList();
|
||||
list.removePostRemoveListener(this);
|
||||
for (ResourcePair rp : list) {
|
||||
if (resourcesAdded.contains(rp)) {
|
||||
resourcesAdded.remove(rp);
|
||||
list.remove(rp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Unneeded part events
|
||||
@Override
|
||||
public void partActivated(IWorkbenchPart part) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partBroughtToTop(IWorkbenchPart part) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partDeactivated(IWorkbenchPart part) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partOpened(IWorkbenchPart part) {
|
||||
}
|
||||
protected abstract T createDisplayContainer();
|
||||
|
||||
}
|
||||
|
|
|
@ -58,7 +58,8 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DataProviderEventController extends AbstractRoleEventController {
|
||||
public class DataProviderEventController extends
|
||||
AbstractRoleEventController<SharedEditorsManager> {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(DataProviderEventController.class);
|
||||
|
@ -72,14 +73,12 @@ public class DataProviderEventController extends AbstractRoleEventController {
|
|||
if (event.getEventType().equals(ParticipantEventType.ARRIVED)
|
||||
&& !event.getParticipant().equals(session.getUserID())) {
|
||||
try {
|
||||
SharedEditorsManager sem = SharedEditorsManager
|
||||
.getManager(session);
|
||||
AbstractEditor active = sem.getActiveSharedEditor();
|
||||
AbstractEditor active = container.getActiveSharedEditor();
|
||||
if (active != null) {
|
||||
IDisplayPane activePane = active.getActiveDisplayPane();
|
||||
if (activePane != null) {
|
||||
ActivateRemoteDisplay arde = new ActivateRemoteDisplay();
|
||||
arde.setDisplayId(sem.getDisplayId(activePane
|
||||
arde.setDisplayId(container.getDisplayId(activePane
|
||||
.getRenderableDisplay()));
|
||||
session.sendObjectToPeer(event.getParticipant(), arde);
|
||||
}
|
||||
|
@ -117,7 +116,7 @@ public class DataProviderEventController extends AbstractRoleEventController {
|
|||
if (active != null
|
||||
&& SharedEditorsManager.isBeingShared(active) == false) {
|
||||
try {
|
||||
SharedEditorsManager.getManager(session).shareEditor(active);
|
||||
container.shareEditor(active);
|
||||
} catch (CollaborationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
|
@ -129,13 +128,12 @@ public class DataProviderEventController extends AbstractRoleEventController {
|
|||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
|
||||
* #shutdown()
|
||||
* com.raytheon.uf.viz.collaboration.display.roles.AbstractRoleEventController
|
||||
* #createDisplayContainer()
|
||||
*/
|
||||
@Override
|
||||
public void shutdown() {
|
||||
super.shutdown();
|
||||
SharedEditorsManager.getManager(session).dispose();
|
||||
protected SharedEditorsManager createDisplayContainer() {
|
||||
return SharedEditorsManager.getManager(session);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@ package com.raytheon.uf.viz.collaboration.display.roles;
|
|||
import org.eclipse.ui.PartInitException;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditorInput;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
|
||||
import com.raytheon.viz.ui.VizWorkbenchManager;
|
||||
|
@ -45,7 +43,8 @@ import com.raytheon.viz.ui.VizWorkbenchManager;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ParticipantEventController extends AbstractRoleEventController {
|
||||
public class ParticipantEventController extends
|
||||
AbstractRoleEventController<ICollaborationEditor> {
|
||||
|
||||
public ParticipantEventController(ISharedDisplaySession session) {
|
||||
super(session);
|
||||
|
@ -55,44 +54,20 @@ public class ParticipantEventController extends AbstractRoleEventController {
|
|||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
|
||||
* #startup()
|
||||
* com.raytheon.uf.viz.collaboration.display.roles.AbstractRoleEventController
|
||||
* #createDisplayContainer()
|
||||
*/
|
||||
@Override
|
||||
public void startup() {
|
||||
super.startup();
|
||||
protected ICollaborationEditor createDisplayContainer() {
|
||||
CollaborationEditorInput input = new CollaborationEditorInput(
|
||||
session.getSessionId(), session.getVenue().getInfo()
|
||||
.getVenueDescription());
|
||||
try {
|
||||
ICollaborationEditor editor = (ICollaborationEditor) VizWorkbenchManager
|
||||
.getInstance().getCurrentWindow().getActivePage()
|
||||
return (ICollaborationEditor) VizWorkbenchManager.getInstance()
|
||||
.getCurrentWindow().getActivePage()
|
||||
.openEditor(input, ICollaborationEditor.EDITOR_ID);
|
||||
SessionContainer sc = SharedDisplaySessionMgr
|
||||
.getSessionContainer(session.getSessionId());
|
||||
sc.setCollaborationEditor(editor);
|
||||
} catch (PartInitException e) {
|
||||
throw new RuntimeException("Unable to open collaboration editor", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
|
||||
* #shutdown()
|
||||
*/
|
||||
@Override
|
||||
public void shutdown() {
|
||||
super.shutdown();
|
||||
SessionContainer sc = SharedDisplaySessionMgr
|
||||
.getSessionContainer(session.getSessionId());
|
||||
if (sc != null) {
|
||||
sc.getCollaborationEditor().getSite().getPage()
|
||||
.closeEditor(sc.getCollaborationEditor(), false);
|
||||
throw new RuntimeException("Error opening collaboration editor", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IPartListener;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
@ -370,11 +371,6 @@ public class SharedEditorsManager implements IRemoteDisplayContainer {
|
|||
+ session.getVenue().getInfo().getVenueDescription() + ")";
|
||||
}
|
||||
|
||||
public void registerRemoteRenderableDisplayChangedListener(
|
||||
IRenderableDisplayChangedListener listener) {
|
||||
|
||||
}
|
||||
|
||||
public int getDisplayId(IRenderableDisplay display) {
|
||||
int displayId = -1;
|
||||
DisplayData data = displayData.get(display);
|
||||
|
@ -480,10 +476,8 @@ public class SharedEditorsManager implements IRemoteDisplayContainer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disposes the object, removes all shared editors
|
||||
*/
|
||||
public void dispose() {
|
||||
@Override
|
||||
public void disposeContainer() {
|
||||
List<AbstractEditor> copy = new ArrayList<AbstractEditor>(sharedEditors);
|
||||
for (AbstractEditor editor : copy) {
|
||||
try {
|
||||
|
@ -500,7 +494,7 @@ public class SharedEditorsManager implements IRemoteDisplayContainer {
|
|||
IRenderableDisplay display = d.display;
|
||||
IDisplayPaneContainer container = display.getContainer();
|
||||
for (IDisplayPane pane : container.getDisplayPanes()) {
|
||||
if (pane.getDisplay() == display) {
|
||||
if (pane.getRenderableDisplay() == display) {
|
||||
removeDisplay(pane);
|
||||
break;
|
||||
}
|
||||
|
@ -508,6 +502,7 @@ public class SharedEditorsManager implements IRemoteDisplayContainer {
|
|||
}
|
||||
|
||||
session.unregisterEventHandler(eventHandler);
|
||||
managerMap.remove(session.getSessionId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -801,4 +796,15 @@ public class SharedEditorsManager implements IRemoteDisplayContainer {
|
|||
.getActiveDisplayPane().getRenderableDisplay());
|
||||
return new RemoteDisplay(data.displayId, data.display);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer#
|
||||
* getActiveDisplayEditor()
|
||||
*/
|
||||
@Override
|
||||
public IEditorPart getActiveDisplayEditor() {
|
||||
return activeSharedEditor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.display.roles.dataprovider.rsc;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -26,15 +27,23 @@ import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
||||
import com.raytheon.uf.viz.collaboration.display.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SessionColorManager;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.ReprojectRemoteDisplay;
|
||||
import com.raytheon.uf.viz.core.DrawableString;
|
||||
import com.raytheon.uf.viz.core.IExtent;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IFont;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.remote.graphics.DispatchGraphicsTarget;
|
||||
|
||||
/**
|
||||
* A resource that is added to an editor that the Data Provider is sharing. It
|
||||
|
@ -64,6 +73,10 @@ public class DataProviderRsc extends
|
|||
|
||||
private ISharedDisplaySession session;
|
||||
|
||||
private SessionColorManager colorManager;
|
||||
|
||||
private IFont font;
|
||||
|
||||
public DataProviderRsc(DataProviderRscData resourceData,
|
||||
LoadProperties loadProperties) {
|
||||
super(resourceData, loadProperties);
|
||||
|
@ -71,6 +84,7 @@ public class DataProviderRsc extends
|
|||
.getSessionContainer(resourceData.getSessionId());
|
||||
if (container != null) {
|
||||
session = container.getSession();
|
||||
colorManager = container.getColorManager();
|
||||
IVenueInfo info = session.getVenue().getInfo();
|
||||
roomName = info.getVenueDescription();
|
||||
subject = info.getVenueDescription();
|
||||
|
@ -79,18 +93,39 @@ public class DataProviderRsc extends
|
|||
|
||||
@Override
|
||||
protected void disposeInternal() {
|
||||
|
||||
font.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintInternal(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
if (target instanceof DispatchGraphicsTarget) {
|
||||
target = ((DispatchGraphicsTarget) target).getWrappedObject();
|
||||
}
|
||||
target.clearClippingPlane();
|
||||
IExtent extent = paintProps.getView().getExtent();
|
||||
RGB color = colorManager.getColorFromUser(session.getUserID());
|
||||
target.drawRect(extent, color, 3.0f, 1.0f);
|
||||
|
||||
DrawableString string = new DrawableString(getName(), color);
|
||||
string.horizontalAlignment = HorizontalAlignment.CENTER;
|
||||
string.verticallAlignment = VerticalAlignment.BOTTOM;
|
||||
string.setCoordinates(extent.getMinX() + extent.getWidth() / 2,
|
||||
extent.getMaxY());
|
||||
string.font = font;
|
||||
string.textStyle = TextStyle.BLANKED;
|
||||
target.drawStrings(string);
|
||||
|
||||
target.setupClippingPlane(paintProps.getClippingPane());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
|
||||
if (target instanceof DispatchGraphicsTarget) {
|
||||
target = ((DispatchGraphicsTarget) target).getWrappedObject();
|
||||
}
|
||||
font = target.getDefaultFont().deriveWithSize(11.0f);
|
||||
font.setScaleFont(true);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -40,8 +40,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.storage.IPersistedEvent;
|
||||
import com.raytheon.uf.viz.collaboration.display.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.FrameDisposed;
|
||||
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.IRenderFrameEvent;
|
||||
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.MouseLocationEvent;
|
||||
|
@ -392,20 +390,16 @@ public class CollaborationResource extends
|
|||
.getRenderableDisplay();
|
||||
final BeginFrameEvent bfe = (BeginFrameEvent) renderable;
|
||||
display.setBackgroundColor(bfe.getColor());
|
||||
final ICollaborationEditor editor = SharedDisplaySessionMgr
|
||||
.getSessionContainer(
|
||||
resourceData.getSession()
|
||||
.getSessionId())
|
||||
.getCollaborationEditor();
|
||||
if (previousBounds == null
|
||||
|| previousBounds.equals(bfe.getBounds()) == false) {
|
||||
previousBounds = bfe.getBounds();
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
editor.setCanvasBounds(
|
||||
bfe.getDisplayId(),
|
||||
bfe.getBounds());
|
||||
resourceData.getEditor()
|
||||
.setCanvasBounds(
|
||||
bfe.getDisplayId(),
|
||||
bfe.getBounds());
|
||||
display.getView().setExtent(
|
||||
bfe.getExtent());
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.uf.viz.collaboration.display.rsc;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||
|
@ -46,6 +47,8 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
|||
|
||||
public class CollaborationResourceData extends AbstractResourceData {
|
||||
|
||||
private ICollaborationEditor editor;
|
||||
|
||||
private ISharedDisplaySession session;
|
||||
|
||||
private int displayId;
|
||||
|
@ -54,10 +57,11 @@ public class CollaborationResourceData extends AbstractResourceData {
|
|||
* @param session2
|
||||
* @param displayId2
|
||||
*/
|
||||
public CollaborationResourceData(ISharedDisplaySession session,
|
||||
int displayId) {
|
||||
public CollaborationResourceData(ICollaborationEditor editor,
|
||||
ISharedDisplaySession session, int displayId) {
|
||||
this.session = session;
|
||||
this.displayId = displayId;
|
||||
this.editor = editor;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -112,6 +116,13 @@ public class CollaborationResourceData extends AbstractResourceData {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the editor
|
||||
*/
|
||||
public ICollaborationEditor getEditor() {
|
||||
return editor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the session
|
||||
*/
|
||||
|
|
|
@ -85,6 +85,7 @@ import org.eclipse.ui.IEditorReference;
|
|||
import org.eclipse.ui.IPartListener;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
import org.eclipse.ui.IViewReference;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
|
@ -109,9 +110,10 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
|||
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.SharedEditorsManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.AlertWordWrapper;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationGroupContainer;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
|
||||
|
@ -127,6 +129,7 @@ import com.raytheon.uf.viz.collaboration.ui.session.SessionMsgArchive;
|
|||
import com.raytheon.uf.viz.collaboration.ui.session.SessionView;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
import com.raytheon.viz.ui.views.CaveFloatingView;
|
||||
|
||||
/**
|
||||
|
@ -1548,26 +1551,37 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
|||
if (linkToEditorAction.isChecked()) {
|
||||
IWorkbenchPage page = PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getActivePage();
|
||||
if (part instanceof ICollaborationEditor) {
|
||||
String sessionId = ((ICollaborationEditor) part).getSessionId();
|
||||
for (IViewReference ref : page.getViewReferences()) {
|
||||
if (ref.getPart(false) instanceof CollaborationSessionView) {
|
||||
CollaborationSessionView view = (CollaborationSessionView) ref
|
||||
.getPart(false);
|
||||
if (view.getSessionId().equals(sessionId)) {
|
||||
page.bringToTop(view);
|
||||
break;
|
||||
}
|
||||
if (part instanceof CollaborationSessionView) {
|
||||
IRemoteDisplayContainer container = ((CollaborationSessionView) part)
|
||||
.getDisplayContainer();
|
||||
if (container != null) {
|
||||
IEditorPart editor = container.getActiveDisplayEditor();
|
||||
if (editor != null) {
|
||||
page.bringToTop(editor);
|
||||
}
|
||||
}
|
||||
} else if (part instanceof CollaborationSessionView) {
|
||||
String sessionId = ((CollaborationSessionView) part)
|
||||
.getSessionId();
|
||||
ICollaborationEditor editor = SharedDisplaySessionMgr
|
||||
.getSessionContainer(sessionId)
|
||||
.getCollaborationEditor();
|
||||
if (editor != null) {
|
||||
page.bringToTop(editor);
|
||||
} else {
|
||||
String sessionId = null;
|
||||
if (part instanceof ICollaborationEditor) {
|
||||
sessionId = ((ICollaborationEditor) part).getSessionId();
|
||||
} else if (part instanceof AbstractEditor) {
|
||||
ISharedDisplaySession session = SharedEditorsManager
|
||||
.getSharedEditorSession((AbstractEditor) part);
|
||||
if (session != null) {
|
||||
sessionId = session.getSessionId();
|
||||
}
|
||||
}
|
||||
if (sessionId != null) {
|
||||
for (IViewReference ref : page.getViewReferences()) {
|
||||
if (CollaborationSessionView.ID.equals(ref.getId())) {
|
||||
CollaborationSessionView view = (CollaborationSessionView) ref
|
||||
.getPart(false);
|
||||
if (sessionId.equals(view.getSessionId())) {
|
||||
page.bringToTop(view);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
|
|||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IEditorSite;
|
||||
import org.eclipse.ui.ISaveablePart2;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
|
@ -140,7 +141,7 @@ public class CollaborationEditor extends EditorPart implements
|
|||
for (ResourcePair rp : display.getDescriptor().getResourceList()) {
|
||||
rp.getProperties().setSystemResource(true);
|
||||
}
|
||||
CollaborationResourceData crd = new CollaborationResourceData(
|
||||
CollaborationResourceData crd = new CollaborationResourceData(this,
|
||||
session, displayId);
|
||||
ResourcePair rp = ResourcePair.constructSystemResourcePair(crd);
|
||||
display.getDescriptor().getResourceList().add(rp);
|
||||
|
@ -401,4 +402,26 @@ public class CollaborationEditor extends EditorPart implements
|
|||
}
|
||||
return new RemoteDisplay(currentActiveDisplay, display);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer#
|
||||
* getActiveDisplayEditor()
|
||||
*/
|
||||
@Override
|
||||
public IEditorPart getActiveDisplayEditor() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer#
|
||||
* disposeContainer()
|
||||
*/
|
||||
@Override
|
||||
public void disposeContainer() {
|
||||
getSite().getPage().closeEditor(this, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,7 @@ package com.raytheon.uf.viz.collaboration.ui.session;
|
|||
* further licensing information.
|
||||
**/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.ecf.presence.roster.IRosterEntry;
|
||||
|
@ -39,10 +37,8 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IPartListener;
|
||||
import org.eclipse.ui.IViewSite;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
|
||||
|
@ -66,8 +62,6 @@ import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer.RemoteD
|
|||
import com.raytheon.uf.viz.collaboration.display.data.ColorChangeEvent;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.SharedEditorsManager;
|
||||
import com.raytheon.uf.viz.collaboration.display.rsc.SelfAddingSystemResourceListener;
|
||||
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingEvent;
|
||||
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingResource;
|
||||
|
@ -80,7 +74,6 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
import com.raytheon.uf.viz.drawing.DrawingToolLayer;
|
||||
import com.raytheon.uf.viz.drawing.DrawingToolLayer.DrawMode;
|
||||
import com.raytheon.viz.ui.VizWorkbenchManager;
|
||||
|
||||
/**
|
||||
* View class for a collaboration session
|
||||
|
@ -140,6 +133,10 @@ public class CollaborationSessionView extends SessionView implements
|
|||
|
||||
private Map<IRenderableDisplay, SelfAddingSystemResourceListener> listeners = new IdentityHashMap<IRenderableDisplay, SelfAddingSystemResourceListener>();
|
||||
|
||||
public IRemoteDisplayContainer getDisplayContainer() {
|
||||
return container;
|
||||
}
|
||||
|
||||
public CollaborationDrawingResource getCurrentDrawingResource() {
|
||||
CollaborationDrawingResource currentResource = null;
|
||||
if (currentDisplay != null) {
|
||||
|
@ -176,16 +173,14 @@ public class CollaborationSessionView extends SessionView implements
|
|||
.getSessionContainer(sessionId);
|
||||
if (sc != null) {
|
||||
session = sc.getSession();
|
||||
if (sc.getCollaborationEditor() != null) {
|
||||
container = sc.getCollaborationEditor();
|
||||
} else {
|
||||
container = SharedEditorsManager.getManager(session);
|
||||
}
|
||||
container.addRemoteDisplayChangedListener(this);
|
||||
RemoteDisplay remoteDisplay = container.getActiveDisplay();
|
||||
if (remoteDisplay != null) {
|
||||
remoteDisplayChanged(container.getActiveDisplay(),
|
||||
RemoteDisplayChangeType.ACTIVATED);
|
||||
container = sc.getDisplayContainer();
|
||||
if (container != null) {
|
||||
container.addRemoteDisplayChangedListener(this);
|
||||
RemoteDisplay remoteDisplay = container.getActiveDisplay();
|
||||
if (remoteDisplay != null) {
|
||||
remoteDisplayChanged(container.getActiveDisplay(),
|
||||
RemoteDisplayChangeType.ACTIVATED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -503,16 +498,6 @@ public class CollaborationSessionView extends SessionView implements
|
|||
|
||||
@Override
|
||||
public void dispose() {
|
||||
ICollaborationEditor assocEditor = SharedDisplaySessionMgr
|
||||
.getSessionContainer(session.getSessionId())
|
||||
.getCollaborationEditor();
|
||||
if (assocEditor != null) {
|
||||
IWorkbenchPage page = VizWorkbenchManager.getInstance()
|
||||
.getCurrentWindow().getActivePage();
|
||||
if (page != null) {
|
||||
page.closeEditor(assocEditor, false);
|
||||
}
|
||||
}
|
||||
SharedDisplaySessionMgr.exitSession(session.getSessionId());
|
||||
session.close();
|
||||
super.dispose();
|
||||
|
@ -533,17 +518,7 @@ public class CollaborationSessionView extends SessionView implements
|
|||
@Override
|
||||
public void partActivated(IWorkbenchPart part) {
|
||||
// only done if we care about the part that was activated
|
||||
SessionContainer sc = SharedDisplaySessionMgr
|
||||
.getSessionContainer(sessionId);
|
||||
List<IEditorPart> editors = new ArrayList<IEditorPart>();
|
||||
if (sc.getCollaborationEditor() == null) {
|
||||
editors.addAll(SharedEditorsManager.getManager(sc.getSession())
|
||||
.getSharedEditors());
|
||||
} else {
|
||||
editors.add(sc.getCollaborationEditor());
|
||||
}
|
||||
|
||||
if (this == part || editors.contains(part)) {
|
||||
if (container != null && container.getActiveDisplayEditor() == part) {
|
||||
ContextManager
|
||||
.getInstance(getSite().getPage().getWorkbenchWindow())
|
||||
.activateContexts(this);
|
||||
|
@ -581,17 +556,7 @@ public class CollaborationSessionView extends SessionView implements
|
|||
@Override
|
||||
public void partDeactivated(IWorkbenchPart part) {
|
||||
// only done if we care about the part that was deactivated
|
||||
SessionContainer sc = SharedDisplaySessionMgr
|
||||
.getSessionContainer(sessionId);
|
||||
List<IEditorPart> editors = new ArrayList<IEditorPart>();
|
||||
if (sc.getCollaborationEditor() == null) {
|
||||
editors.addAll(SharedEditorsManager.getManager(sc.getSession())
|
||||
.getSharedEditors());
|
||||
} else {
|
||||
editors.add(sc.getCollaborationEditor());
|
||||
}
|
||||
|
||||
if (this == part || editors.contains(part)) {
|
||||
if (container != null && container.getActiveDisplayEditor() == part) {
|
||||
ContextManager
|
||||
.getInstance(getSite().getPage().getWorkbenchWindow())
|
||||
.deactivateContexts(this);
|
||||
|
|
Loading…
Add table
Reference in a new issue