Issue #697 Fixed session closing issues and null pointer in gfe
Change-Id: Id12a3a15616299aaff4bc6fec72b615f1d79ef10 Former-commit-id:f7dfbc11f1
[formerly0adccb8b12
] [formerly7d5d086fe1
] [formerly6a0ed72e5e
[formerly7d5d086fe1
[formerly 695134c3139868d6e9ace9dca7757368e0bfa5ec]]] Former-commit-id:6a0ed72e5e
Former-commit-id: 6f71405b33f53ae3c5d3ed12feb49683cc8698c2 [formerly70461db99f
] Former-commit-id:57af7d8bdc
This commit is contained in:
parent
32fe5ad6ff
commit
e215aa65cb
8 changed files with 149 additions and 102 deletions
|
@ -30,10 +30,10 @@ import org.eclipse.ui.IWorkbenchPart;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationDrawingResource;
|
|
||||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationDrawingResourceData;
|
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationDrawingResourceData;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
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.drawables.ResourcePair;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||||
|
@ -85,11 +85,10 @@ public abstract class AbstractRoleEventController implements
|
||||||
|
|
||||||
// Orphaned tellestrators, not sure what to do yet about clear
|
// Orphaned tellestrators, not sure what to do yet about clear
|
||||||
for (AbstractEditor editor : resourceEditors) {
|
for (AbstractEditor editor : resourceEditors) {
|
||||||
partClosed(editor);
|
deactivateResources(editor);
|
||||||
}
|
}
|
||||||
for (ResourcePair rp : resourcesAdded) {
|
for (ResourcePair rp : resourcesAdded) {
|
||||||
CollaborationDrawingResource resource = (CollaborationDrawingResource) rp
|
AbstractVizResource<?, ?> resource = rp.getResource();
|
||||||
.getResource();
|
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
resource.getDescriptor().getResourceList()
|
resource.getDescriptor().getResourceList()
|
||||||
.removePostRemoveListener(this);
|
.removePostRemoveListener(this);
|
||||||
|
@ -102,27 +101,30 @@ public abstract class AbstractRoleEventController implements
|
||||||
|
|
||||||
protected void activateResources(AbstractEditor editor) {
|
protected void activateResources(AbstractEditor editor) {
|
||||||
for (IDisplayPane pane : editor.getDisplayPanes()) {
|
for (IDisplayPane pane : editor.getDisplayPanes()) {
|
||||||
try {
|
activateResources(pane.getRenderableDisplay());
|
||||||
IDescriptor descriptor = pane.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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
resourceEditors.add(editor);
|
resourceEditors.add(editor);
|
||||||
editor.getSite().getPage().addPartListener(this);
|
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) {
|
protected void deactivateResources(AbstractEditor editor) {
|
||||||
partClosed(editor);
|
partClosed(editor);
|
||||||
editor.getSite().getPage().removePartListener(this);
|
editor.getSite().getPage().removePartListener(this);
|
||||||
|
|
|
@ -102,7 +102,10 @@ public class DataProviderEventController extends AbstractRoleEventController
|
||||||
try {
|
try {
|
||||||
CollaborationDispatcher dispatcher = new CollaborationDispatcher(
|
CollaborationDispatcher dispatcher = new CollaborationDispatcher(
|
||||||
session, display);
|
session, display);
|
||||||
dispatchers.add(dispatcher);
|
synchronized (dispatchers) {
|
||||||
|
dispatchers.add(dispatcher);
|
||||||
|
dispatcher.setActiveDisplay(activeDisplay);
|
||||||
|
}
|
||||||
return dispatcher;
|
return dispatcher;
|
||||||
} catch (CollaborationException e) {
|
} catch (CollaborationException e) {
|
||||||
throw new InstantiationException(
|
throw new InstantiationException(
|
||||||
|
@ -114,6 +117,8 @@ public class DataProviderEventController extends AbstractRoleEventController
|
||||||
|
|
||||||
private List<CollaborationDispatcher> dispatchers = new LinkedList<CollaborationDispatcher>();
|
private List<CollaborationDispatcher> dispatchers = new LinkedList<CollaborationDispatcher>();
|
||||||
|
|
||||||
|
private IRenderableDisplay activeDisplay;
|
||||||
|
|
||||||
public DataProviderEventController(ISharedDisplaySession session) {
|
public DataProviderEventController(ISharedDisplaySession session) {
|
||||||
super(session);
|
super(session);
|
||||||
}
|
}
|
||||||
|
@ -280,8 +285,11 @@ public class DataProviderEventController extends AbstractRoleEventController
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setActiveDisplay(IRenderableDisplay display) {
|
private void setActiveDisplay(IRenderableDisplay display) {
|
||||||
for (CollaborationDispatcher dispatcher : dispatchers) {
|
synchronized (dispatchers) {
|
||||||
dispatcher.setActiveDisplay(display);
|
this.activeDisplay = display;
|
||||||
|
for (CollaborationDispatcher dispatcher : dispatchers) {
|
||||||
|
dispatcher.setActiveDisplay(display);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ReprojectEditor event = new ReprojectEditor();
|
ReprojectEditor event = new ReprojectEditor();
|
||||||
event.setTargetGeometry(display.getDescriptor().getGridGeometry());
|
event.setTargetGeometry(display.getDescriptor().getGridGeometry());
|
||||||
|
@ -295,7 +303,22 @@ public class DataProviderEventController extends AbstractRoleEventController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleNewDisplay(IDisplayPane pane) {
|
/**
|
||||||
|
* Handles a new display pane
|
||||||
|
*
|
||||||
|
* @param pane
|
||||||
|
* @return true if the pane is not currently being handled by the controller
|
||||||
|
*/
|
||||||
|
private boolean handleNewDisplay(IDisplayPane pane) {
|
||||||
|
boolean newDisplay = false;
|
||||||
|
synchronized (dispatchers) {
|
||||||
|
for (CollaborationDispatcher dispatcher : dispatchers) {
|
||||||
|
if (dispatcher.getDisplay() == pane.getRenderableDisplay()) {
|
||||||
|
// We already have a dispatcher for this display
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (DispatchingGraphicsFactory.injectRemoteFunctionality(pane,
|
if (DispatchingGraphicsFactory.injectRemoteFunctionality(pane,
|
||||||
factory)) {
|
factory)) {
|
||||||
|
@ -306,10 +329,12 @@ public class DataProviderEventController extends AbstractRoleEventController
|
||||||
}
|
}
|
||||||
list.addPreAddListener(wrappingListener);
|
list.addPreAddListener(wrappingListener);
|
||||||
list.addPostRemoveListener(wrappingListener);
|
list.addPostRemoveListener(wrappingListener);
|
||||||
|
newDisplay = true;
|
||||||
}
|
}
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
|
return newDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -407,7 +432,6 @@ public class DataProviderEventController extends AbstractRoleEventController
|
||||||
.getSessionContainer(session.getSessionId());
|
.getSessionContainer(session.getSessionId());
|
||||||
if (sc != null) {
|
if (sc != null) {
|
||||||
for (AbstractEditor editor : sc.getSharedEditors()) {
|
for (AbstractEditor editor : sc.getSharedEditors()) {
|
||||||
super.deactivateResources(editor);
|
|
||||||
for (IDisplayPane pane : editor.getDisplayPanes()) {
|
for (IDisplayPane pane : editor.getDisplayPanes()) {
|
||||||
ResourceList list = pane.getDescriptor().getResourceList();
|
ResourceList list = pane.getDescriptor().getResourceList();
|
||||||
for (ResourcePair rp : list) {
|
for (ResourcePair rp : list) {
|
||||||
|
@ -416,12 +440,16 @@ public class DataProviderEventController extends AbstractRoleEventController
|
||||||
list.removePreAddListener(wrappingListener);
|
list.removePreAddListener(wrappingListener);
|
||||||
list.removePostRemoveListener(wrappingListener);
|
list.removePostRemoveListener(wrappingListener);
|
||||||
}
|
}
|
||||||
|
editor.removeRenderableDisplayChangedListener(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dispatchers created are responsible for display extraction
|
synchronized (dispatchers) {
|
||||||
for (CollaborationDispatcher dispatcher : dispatchers) {
|
// Dispatchers created are responsible for display extraction
|
||||||
dispatcher.dispose();
|
for (CollaborationDispatcher dispatcher : dispatchers) {
|
||||||
|
dispatcher.dispose();
|
||||||
|
}
|
||||||
|
dispatchers.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,8 +485,19 @@ public class DataProviderEventController extends AbstractRoleEventController
|
||||||
public void renderableDisplayChanged(IDisplayPane pane,
|
public void renderableDisplayChanged(IDisplayPane pane,
|
||||||
IRenderableDisplay newRenderableDisplay, DisplayChangeType type) {
|
IRenderableDisplay newRenderableDisplay, DisplayChangeType type) {
|
||||||
if (type == DisplayChangeType.ADD) {
|
if (type == DisplayChangeType.ADD) {
|
||||||
handleNewDisplay(pane);
|
if (handleNewDisplay(pane)) {
|
||||||
setActiveDisplay(newRenderableDisplay);
|
activateResources(newRenderableDisplay);
|
||||||
|
}
|
||||||
|
if (newRenderableDisplay.getGraphicsAdapter() instanceof DispatchingGraphicsFactory) {
|
||||||
|
synchronized (dispatchers) {
|
||||||
|
for (CollaborationDispatcher dispatcher : dispatchers) {
|
||||||
|
if (dispatcher.getDisplay() == newRenderableDisplay) {
|
||||||
|
setActiveDisplay(newRenderableDisplay);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,35 +113,15 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
|
|
||||||
private ISharedDisplaySession session;
|
private ISharedDisplaySession session;
|
||||||
|
|
||||||
private DrawingToolLayer layer;
|
private CollaborationDrawingResource getCurrentResource() {
|
||||||
|
|
||||||
private CollaborationDrawingResource resource;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* com.raytheon.uf.viz.collaboration.ui.session.SessionView#createPartControl
|
|
||||||
* (org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void createPartControl(Composite parent) {
|
|
||||||
super.createPartControl(parent);
|
|
||||||
assignLayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean assignLayer() {
|
|
||||||
SessionContainer sc = SharedDisplaySessionMgr
|
SessionContainer sc = SharedDisplaySessionMgr
|
||||||
.getSessionContainer(sessionId);
|
.getSessionContainer(sessionId);
|
||||||
ResourceList toSearch = null;
|
ResourceList toSearch = null;
|
||||||
IEditorPart part = null;
|
IEditorPart part = null;
|
||||||
if (sc.getCollaborationEditor() == null) {
|
if (sc.getCollaborationEditor() == null) {
|
||||||
// if the editor has not been started in the participant yet
|
|
||||||
if (sc.getSharedEditors() == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (AbstractEditor editor : sc.getSharedEditors()) {
|
for (AbstractEditor editor : sc.getSharedEditors()) {
|
||||||
part = editor;
|
part = editor;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
part = SharedDisplaySessionMgr.getSessionContainer(sessionId)
|
part = SharedDisplaySessionMgr.getSessionContainer(sessionId)
|
||||||
|
@ -151,24 +131,21 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
AbstractEditor editor = (AbstractEditor) part;
|
AbstractEditor editor = (AbstractEditor) part;
|
||||||
for (IDisplayPane pane : editor.getDisplayPanes()) {
|
for (IDisplayPane pane : editor.getDisplayPanes()) {
|
||||||
toSearch = pane.getDescriptor().getResourceList();
|
toSearch = pane.getDescriptor().getResourceList();
|
||||||
resource = (CollaborationDrawingResource) toSearch
|
for (CollaborationDrawingResource rsc : toSearch
|
||||||
.getResourcesByTypeAsType(
|
.getResourcesByTypeAsType(CollaborationDrawingResource.class)) {
|
||||||
CollaborationDrawingResource.class).get(0);
|
return rsc;
|
||||||
layer = resource.getDrawingLayerFor(resource.getMyUser());
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawingLayerUpdate() {
|
private DrawingToolLayer getCurrentLayer() {
|
||||||
boolean assigned = true;
|
CollaborationDrawingResource resource = getCurrentResource();
|
||||||
if (layer == null) {
|
if (resource != null) {
|
||||||
assigned = assignLayer();
|
return resource.getDrawingLayerFor(resource.getMyUser());
|
||||||
}
|
|
||||||
if (assigned) {
|
|
||||||
updateToolItems();
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -219,6 +196,7 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
drawAction = new ActionContributionItem(new Action("Draw", SWT.TOGGLE) {
|
drawAction = new ActionContributionItem(new Action("Draw", SWT.TOGGLE) {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
DrawingToolLayer layer = getCurrentLayer();
|
||||||
if (layer.getDrawMode() == DrawMode.DRAW) {
|
if (layer.getDrawMode() == DrawMode.DRAW) {
|
||||||
layer.setDrawMode(DrawMode.NONE);
|
layer.setDrawMode(DrawMode.NONE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -235,7 +213,10 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
undoAction = new ActionContributionItem(new Action("Undo") {
|
undoAction = new ActionContributionItem(new Action("Undo") {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
layer.undo();
|
DrawingToolLayer layer = getCurrentLayer();
|
||||||
|
if (layer != null) {
|
||||||
|
layer.undo();
|
||||||
|
}
|
||||||
updateToolItems();
|
updateToolItems();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -247,7 +228,10 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
redoAction = new ActionContributionItem(new Action("Redo") {
|
redoAction = new ActionContributionItem(new Action("Redo") {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
layer.redo();
|
DrawingToolLayer layer = getCurrentLayer();
|
||||||
|
if (layer != null) {
|
||||||
|
layer.redo();
|
||||||
|
}
|
||||||
updateToolItems();
|
updateToolItems();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -260,10 +244,13 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
new Action("Erase", SWT.TOGGLE) {
|
new Action("Erase", SWT.TOGGLE) {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (layer.getDrawMode() == DrawMode.ERASE) {
|
DrawingToolLayer layer = getCurrentLayer();
|
||||||
layer.setDrawMode(DrawMode.NONE);
|
if (layer != null) {
|
||||||
} else {
|
if (layer.getDrawMode() == DrawMode.ERASE) {
|
||||||
layer.setDrawMode(DrawMode.ERASE);
|
layer.setDrawMode(DrawMode.NONE);
|
||||||
|
} else {
|
||||||
|
layer.setDrawMode(DrawMode.ERASE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
updateToolItems();
|
updateToolItems();
|
||||||
}
|
}
|
||||||
|
@ -275,7 +262,10 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
|
|
||||||
clearAction = new ActionContributionItem(new Action("Clear") {
|
clearAction = new ActionContributionItem(new Action("Clear") {
|
||||||
public void run() {
|
public void run() {
|
||||||
layer.clear();
|
DrawingToolLayer layer = getCurrentLayer();
|
||||||
|
if (layer != null) {
|
||||||
|
layer.clear();
|
||||||
|
}
|
||||||
updateToolItems();
|
updateToolItems();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -287,9 +277,12 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
lockAction = new ActionContributionItem(new Action(
|
lockAction = new ActionContributionItem(new Action(
|
||||||
"Lock Collaborators", SWT.TOGGLE) {
|
"Lock Collaborators", SWT.TOGGLE) {
|
||||||
public void run() {
|
public void run() {
|
||||||
resource.setLockingDrawing(((ToolItem) lockAction.getWidget())
|
CollaborationDrawingResource resource = getCurrentResource();
|
||||||
.getSelection());
|
if (resource != null) {
|
||||||
updateToolItems();
|
resource.setLockingDrawing(((ToolItem) lockAction
|
||||||
|
.getWidget()).getSelection());
|
||||||
|
updateToolItems();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
lockAction.getAction().setImageDescriptor(
|
lockAction.getAction().setImageDescriptor(
|
||||||
|
@ -308,11 +301,8 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateToolItems() {
|
public void updateToolItems() {
|
||||||
boolean assigned = true;
|
DrawingToolLayer layer = getCurrentLayer();
|
||||||
if (layer == null) {
|
if (layer != null) {
|
||||||
assigned = assignLayer();
|
|
||||||
}
|
|
||||||
if (assigned) {
|
|
||||||
drawAction.getAction().setEnabled(true);
|
drawAction.getAction().setEnabled(true);
|
||||||
undoAction.getAction().setEnabled(layer.canUndo());
|
undoAction.getAction().setEnabled(layer.canUndo());
|
||||||
redoAction.getAction().setEnabled(layer.canRedo());
|
redoAction.getAction().setEnabled(layer.canRedo());
|
||||||
|
@ -332,7 +322,8 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
eraseAction.getAction().setChecked(false);
|
eraseAction.getAction().setChecked(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!resource.isSessionLeader()) {
|
CollaborationDrawingResource resource = getCurrentResource();
|
||||||
|
if (resource != null && !resource.isSessionLeader()) {
|
||||||
lockAction.getAction().setEnabled(false);
|
lockAction.getAction().setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -437,7 +428,8 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void receiveLocking(CollaborationDrawingEvent event) {
|
public void receiveLocking(CollaborationDrawingEvent event) {
|
||||||
if (event.getType() == CollaborationEventType.TOGGLE_LOCK) {
|
if (event.getType() == CollaborationEventType.TOGGLE_LOCK) {
|
||||||
if (!resource.isSessionLeader()) {
|
CollaborationDrawingResource resource = getCurrentResource();
|
||||||
|
if (resource != null && !resource.isSessionLeader()) {
|
||||||
if (drawAction.getAction().isEnabled()) {
|
if (drawAction.getAction().isEnabled()) {
|
||||||
drawAction.getAction().setEnabled(false);
|
drawAction.getAction().setEnabled(false);
|
||||||
undoAction.getAction().setEnabled(false);
|
undoAction.getAction().setEnabled(false);
|
||||||
|
@ -487,6 +479,8 @@ public class CollaborationSessionView extends SessionView implements
|
||||||
getSite().getPage().removePartListener(this);
|
getSite().getPage().removePartListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =================== Context activation code ===================
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
|
@ -130,6 +130,11 @@ public class CollaborationDrawingResource extends
|
||||||
|
|
||||||
ColorableCapability colorable = getCapability(ColorableCapability.class);
|
ColorableCapability colorable = getCapability(ColorableCapability.class);
|
||||||
colorable.setSuppressingMenuItems(true);
|
colorable.setSuppressingMenuItems(true);
|
||||||
|
|
||||||
|
CollaborationDrawingEvent event = new CollaborationDrawingEvent();
|
||||||
|
event.setUserName(myUser);
|
||||||
|
event.setType(CollaborationEventType.CLEAR_ALL);
|
||||||
|
sendEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
manager = new CollaborationDrawingUIManager(this);
|
manager = new CollaborationDrawingUIManager(this);
|
||||||
|
@ -176,9 +181,7 @@ public class CollaborationDrawingResource extends
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void disposeInternal() {
|
protected void disposeInternal() {
|
||||||
for (DrawingToolLayer layer : layerMap.values()) {
|
disposeLayers();
|
||||||
layer.dispose();
|
|
||||||
}
|
|
||||||
layerMap.clear();
|
layerMap.clear();
|
||||||
layerMap = null;
|
layerMap = null;
|
||||||
|
|
||||||
|
@ -186,6 +189,12 @@ public class CollaborationDrawingResource extends
|
||||||
container.getSession().unRegisterEventHandler(this);
|
container.getSession().unRegisterEventHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void disposeLayers() {
|
||||||
|
for (DrawingToolLayer layer : layerMap.values()) {
|
||||||
|
layer.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the myUser
|
* @return the myUser
|
||||||
*/
|
*/
|
||||||
|
@ -346,6 +355,9 @@ public class CollaborationDrawingResource extends
|
||||||
case UNDO:
|
case UNDO:
|
||||||
layer.undo();
|
layer.undo();
|
||||||
break;
|
break;
|
||||||
|
case CLEAR_ALL:
|
||||||
|
disposeLayers();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
issueRefresh();
|
issueRefresh();
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class CollaborationDrawingUIManager extends DrawingToolUIManager {
|
||||||
view = (CollaborationSessionView) page.findViewReference(
|
view = (CollaborationSessionView) page.findViewReference(
|
||||||
CollaborationSessionView.ID,
|
CollaborationSessionView.ID,
|
||||||
resource.getContainer().getSessionId()).getPart(false);
|
resource.getContainer().getSessionId()).getPart(false);
|
||||||
view.drawingLayerUpdate();
|
view.updateToolItems();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -81,16 +81,11 @@ public class CollaborationDrawingUIManager extends DrawingToolUIManager {
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see com.raytheon.uf.viz.drawing.DrawingToolUIManager#canTellestrate(int)
|
||||||
* com.raytheon.uf.viz.drawing.DrawingToolUIManager#handleMouseDown(int,
|
|
||||||
* int, int)
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDown(int x, int y, int mouseButton) {
|
protected boolean canTellestrate(int mouseButton) {
|
||||||
if (resource.canTellestrate() == false) {
|
return super.canTellestrate(mouseButton) && resource.canTellestrate();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return super.handleMouseDown(x, y, mouseButton);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -103,7 +98,7 @@ public class CollaborationDrawingUIManager extends DrawingToolUIManager {
|
||||||
public boolean handleMouseUp(int x, int y, int mouseButton) {
|
public boolean handleMouseUp(int x, int y, int mouseButton) {
|
||||||
boolean rval = super.handleMouseUp(x, y, mouseButton);
|
boolean rval = super.handleMouseUp(x, y, mouseButton);
|
||||||
if (rval) {
|
if (rval) {
|
||||||
view.drawingLayerUpdate();
|
view.updateToolItems();
|
||||||
}
|
}
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
public class CollaborationDrawingEvent {
|
public class CollaborationDrawingEvent {
|
||||||
|
|
||||||
public static enum CollaborationEventType {
|
public static enum CollaborationEventType {
|
||||||
DRAW, ERASE, REDO, UNDO, CLEAR, TOGGLE_LOCK;
|
DRAW, ERASE, REDO, UNDO, CLEAR, TOGGLE_LOCK, CLEAR_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class DrawingToolUIManager extends InputAdapter {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseExit(Event event) {
|
public boolean handleMouseExit(Event event) {
|
||||||
if (!handlingInput) {
|
if (canTellestrate(event.button)) {
|
||||||
if (currentShell != null) {
|
if (currentShell != null) {
|
||||||
currentShell.setCursor(normal);
|
currentShell.setCursor(normal);
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ public class DrawingToolUIManager extends InputAdapter {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseEnter(Event event) {
|
public boolean handleMouseEnter(Event event) {
|
||||||
if (handlingInput == false) {
|
if (canTellestrate(event.button)) {
|
||||||
currentShell = ((Control) event.widget).getShell();
|
currentShell = ((Control) event.widget).getShell();
|
||||||
switch (drawingLayer.getDrawMode()) {
|
switch (drawingLayer.getDrawMode()) {
|
||||||
case DRAW:
|
case DRAW:
|
||||||
|
@ -151,8 +151,7 @@ public class DrawingToolUIManager extends InputAdapter {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMouseDown(int x, int y, int mouseButton) {
|
public boolean handleMouseDown(int x, int y, int mouseButton) {
|
||||||
if (mouseButton != 1 || drawingLayer.getDrawMode() == DrawMode.NONE
|
if (!canTellestrate(mouseButton)) {
|
||||||
|| handlingInput) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
handlingInput = true;
|
handlingInput = true;
|
||||||
|
@ -200,4 +199,8 @@ public class DrawingToolUIManager extends InputAdapter {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean canTellestrate(int mouseButton) {
|
||||||
|
return handlingInput == false && mouseButton == 1
|
||||||
|
&& drawingLayer.getDrawMode() != DrawMode.NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,8 +93,10 @@ public class GFEMapRenderableDisplay extends PlainMapRenderableDisplay
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
Message.unregisterInterest(this, ShowQuickViewDataMsg.class);
|
Message.unregisterInterest(this, ShowQuickViewDataMsg.class);
|
||||||
dataMgr.getSpatialDisplayManager()
|
if (dataMgr != null) {
|
||||||
.removeSpatialEditorTimeChangedListener(this);
|
dataMgr.getSpatialDisplayManager()
|
||||||
|
.removeSpatialEditorTimeChangedListener(this);
|
||||||
|
}
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue