Issue #659 toolbar is in session view now
Former-commit-id:373db85359
[formerly00f55c1d80
] [formerlye43fee4483
[formerly a516cc2073fa33c88f13678a55dda4bdbe3ed120]] Former-commit-id:e43fee4483
Former-commit-id:304970e9a9
This commit is contained in:
parent
dcfbaad52e
commit
f2d8da6b3d
36 changed files with 566 additions and 703 deletions
|
@ -192,6 +192,11 @@
|
|||
id="com.raytheon.uf.viz.collaboration.ui.prefs.collaborationalertwordspreferencepage"
|
||||
name="Significant Words"
|
||||
category="com.raytheon.uf.viz.collaboration.ui.prefs.collaborationpreferencepage"/>
|
||||
<page
|
||||
class="com.raytheon.uf.viz.collaboration.ui.feed.CollaborationSiteFilterPreferencePage"
|
||||
id="com.raytheon.uf.viz.collaboration.ui.prefs.collaborationsitefilterpreferencepage"
|
||||
name="Site Filter"
|
||||
category="com.raytheon.uf.viz.collaboration.ui.prefs.collaborationpreferencepage"/>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.contexts">
|
||||
|
@ -240,7 +245,7 @@
|
|||
<extension
|
||||
point="com.raytheon.uf.viz.core.classContext">
|
||||
<classContext
|
||||
class="com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationDrawingToolbar">
|
||||
class="com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView">
|
||||
<contextId
|
||||
id="com.raytheon.uf.viz.collaboration.tellestrator.context">
|
||||
</contextId>
|
||||
|
|
|
@ -38,7 +38,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationDataManager;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.eclipse.jface.viewers.TreeSelection;
|
|||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.jface.window.ToolTip;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.custom.TreeEditor;
|
||||
import org.eclipse.swt.events.KeyAdapter;
|
||||
import org.eclipse.swt.events.KeyEvent;
|
||||
|
@ -103,13 +104,13 @@ 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.data.AlertWordWrapper;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationGroupContainer;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionGroupContainer;
|
||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.AlertWordWrapper;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationGroupContainer;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.login.ChangeStatusDialog;
|
||||
import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView;
|
||||
|
@ -151,6 +152,10 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
|||
|
||||
private TreeViewer usersTreeViewer;
|
||||
|
||||
private StyledText messages;
|
||||
|
||||
private StyledText composeBox;
|
||||
|
||||
private CollaborationGroupContainer topLevel;
|
||||
|
||||
private Action createSessionAction;
|
||||
|
@ -232,9 +237,28 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
|||
}
|
||||
populateTree();
|
||||
usersTreeViewer.refresh();
|
||||
|
||||
// createRoomFeed(parent);
|
||||
parent.layout();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parent2
|
||||
*/
|
||||
private void createRoomFeed(Composite parent) {
|
||||
Composite child = new Composite(parent, SWT.NONE);
|
||||
child.setLayout(new GridLayout(1, false));
|
||||
child.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
messages = new StyledText(child, SWT.MULTI | SWT.WRAP | SWT.H_SCROLL
|
||||
| SWT.V_SCROLL | SWT.BORDER | SWT.READ_ONLY);
|
||||
messages.setEnabled(false);
|
||||
messages.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
composeBox = new StyledText(child, SWT.MULTI | SWT.WRAP | SWT.H_SCROLL
|
||||
| SWT.V_SCROLL | SWT.BORDER);
|
||||
composeBox.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
|
|
|
@ -56,9 +56,9 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
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.comm.provider.user.UserIdWrapper;
|
||||
import com.raytheon.uf.viz.collaboration.data.AlertWord;
|
||||
import com.raytheon.uf.viz.collaboration.data.AlertWordWrapper;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.AlertWord;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.AlertWordWrapper;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,7 +45,7 @@ import org.eclipse.swt.widgets.Text;
|
|||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.eclipse.ecf.presence.roster.IRosterGroup;
|
|||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationGroupContainer;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionGroupContainer;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationGroupContainer;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
|
|
@ -40,8 +40,8 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
||||
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.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionGroupContainer;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.eclipse.jface.viewers.ViewerSorter;
|
|||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionGroupContainer;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.data;
|
||||
package com.raytheon.uf.viz.collaboration.ui.data;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.data;
|
||||
package com.raytheon.uf.viz.collaboration.ui.data;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.data;
|
||||
package com.raytheon.uf.viz.collaboration.ui.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.data;
|
||||
package com.raytheon.uf.viz.collaboration.ui.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.data;
|
||||
package com.raytheon.uf.viz.collaboration.ui.data;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.data;
|
||||
package com.raytheon.uf.viz.collaboration.ui.data;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.data;
|
||||
package com.raytheon.uf.viz.collaboration.ui.data;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.data;
|
||||
package com.raytheon.uf.viz.collaboration.ui.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
|
@ -0,0 +1,220 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.feed;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.preference.ColorFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.StringFieldEditor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.AlertWord;
|
||||
import com.raytheon.uf.viz.collaboration.ui.prefs.CollaborationPreferenceContentProvider;
|
||||
import com.raytheon.uf.viz.collaboration.ui.prefs.CollaborationPreferencesLabelProvider;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 4, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CollaborationSiteFilterPreferencePage extends
|
||||
FieldEditorPreferencePage implements IWorkbenchPreferencePage {
|
||||
|
||||
private TableViewer viewer;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public CollaborationSiteFilterPreferencePage() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param style
|
||||
*/
|
||||
public CollaborationSiteFilterPreferencePage(int style) {
|
||||
super(style);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title
|
||||
* @param style
|
||||
*/
|
||||
public CollaborationSiteFilterPreferencePage(String title, int style) {
|
||||
super(title, style);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title
|
||||
* @param image
|
||||
* @param style
|
||||
*/
|
||||
public CollaborationSiteFilterPreferencePage(String title,
|
||||
ImageDescriptor image, int style) {
|
||||
super(title, image, style);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected void createFieldEditors() {
|
||||
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
data.horizontalSpan = 3;
|
||||
|
||||
viewer = new TableViewer(getFieldEditorParent());
|
||||
viewer.setContentProvider(new CollaborationPreferenceContentProvider());
|
||||
viewer.setLabelProvider(new CollaborationPreferencesLabelProvider());
|
||||
viewer.getTable().setLayoutData(data);
|
||||
|
||||
final StringFieldEditor stringEditor = new StringFieldEditor(
|
||||
"sitename", "Site Name", getFieldEditorParent()) {
|
||||
@Override
|
||||
protected void doLoad() {
|
||||
super.doLoad();
|
||||
this.setStringValue("");
|
||||
}
|
||||
};
|
||||
this.addField(stringEditor);
|
||||
|
||||
final ColorFieldEditor colorEditor = new ColorFieldEditor(
|
||||
"coloreditor", "Color", getFieldEditorParent());
|
||||
this.addField(colorEditor);
|
||||
colorEditor.loadDefault();
|
||||
|
||||
Composite buttonComp = new Composite(getFieldEditorParent(), SWT.NONE);
|
||||
buttonComp.setLayout(new GridLayout(3, false));
|
||||
data = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
data.horizontalSpan = 3;
|
||||
buttonComp.setLayoutData(data);
|
||||
|
||||
Button saveButton = new Button(buttonComp, SWT.PUSH);
|
||||
saveButton.setText("Save Current");
|
||||
saveButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (!stringEditor.getStringValue().isEmpty()) {
|
||||
AlertWord word = new AlertWord(stringEditor
|
||||
.getStringValue(), colorEditor.getColorSelector()
|
||||
.getColorValue());
|
||||
int index = viewer.getTable().getSelectionIndex();
|
||||
if (index != -1) {
|
||||
((List<AlertWord>) viewer.getInput()).set(index, word);
|
||||
} else {
|
||||
((List<AlertWord>) viewer.getInput()).add(word);
|
||||
}
|
||||
viewer.refresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
data = new GridData(SWT.NONE, SWT.NONE, false, true);
|
||||
saveButton.setLayoutData(data);
|
||||
|
||||
Button addButton = new Button(buttonComp, SWT.PUSH);
|
||||
addButton.setText("Add New");
|
||||
addButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (!stringEditor.getStringValue().isEmpty()) {
|
||||
AlertWord word = new AlertWord(stringEditor
|
||||
.getStringValue(), colorEditor.getColorSelector()
|
||||
.getColorValue());
|
||||
((List<AlertWord>) viewer.getInput()).add(word);
|
||||
viewer.refresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
data = new GridData(SWT.NONE, SWT.NONE, false, true);
|
||||
addButton.setLayoutData(data);
|
||||
|
||||
Button removeButton = new Button(buttonComp, SWT.PUSH);
|
||||
removeButton.setText("Remove Current");
|
||||
removeButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
IStructuredSelection selection = (IStructuredSelection) viewer
|
||||
.getSelection();
|
||||
if (selection != null) {
|
||||
AlertWord word = (AlertWord) selection.getFirstElement();
|
||||
((List<AlertWord>) viewer.getInput()).remove(word);
|
||||
viewer.refresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
data = new GridData(SWT.NONE, SWT.NONE, false, true);
|
||||
removeButton.setLayoutData(data);
|
||||
|
||||
viewer.getTable().addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
AlertWord word = (AlertWord) e.item.getData();
|
||||
colorEditor.getColorSelector()
|
||||
.setColorValue(
|
||||
new RGB(word.getRed(), word.getGreen(), word
|
||||
.getBlue()));
|
||||
stringEditor.setStringValue(word.getText());
|
||||
}
|
||||
});
|
||||
viewer.setInput(CollaborationUtils.getAlertWords());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
|
||||
*/
|
||||
@Override
|
||||
public void init(IWorkbench workbench) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -51,11 +51,11 @@ import com.raytheon.uf.common.localization.LocalizationFile;
|
|||
import com.raytheon.uf.common.localization.PathManager;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
|
||||
import com.raytheon.uf.viz.collaboration.data.AlertWord;
|
||||
import com.raytheon.uf.viz.collaboration.data.AlertWordWrapper;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.AlertWord;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.AlertWordWrapper;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationDataManager;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.eclipse.swt.graphics.Font;
|
|||
import org.eclipse.swt.graphics.FontData;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.data.AlertWord;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.AlertWord;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
|
|
@ -37,11 +37,11 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEv
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.SharedEditorData;
|
||||
import com.raytheon.uf.viz.collaboration.ui.ColorChangeEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.SharedResource;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.event.InputEvent;
|
||||
|
|
|
@ -22,9 +22,9 @@ package com.raytheon.uf.viz.collaboration.ui.role;
|
|||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.input.CollaborationInputHandler;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.event.EventForwardingInputHandler;
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||
|
|
|
@ -26,11 +26,11 @@ 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.user.SharedDisplayRole;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.ReprojectEditor;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.SharedEditorData;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.SharedResource;
|
||||
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationResource;
|
||||
|
|
|
@ -38,9 +38,9 @@ import com.google.common.eventbus.Subscribe;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.FrameDisposed;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IRenderFrameEvent;
|
||||
|
|
|
@ -25,10 +25,10 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
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.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.display.editor.ReprojectEditor;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
|
|
|
@ -62,10 +62,10 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.data.AlertWord;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.AlertWord;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
import com.raytheon.uf.viz.notification.notifier.PopupNotifier;
|
||||
|
|
|
@ -20,6 +20,9 @@ package com.raytheon.uf.viz.collaboration.ui.session;
|
|||
* further licensing information.
|
||||
**/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.ecf.presence.roster.IRosterEntry;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.ActionContributionItem;
|
||||
|
@ -33,7 +36,11 @@ import org.eclipse.swt.widgets.ColorDialog;
|
|||
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.IWorkbenchPart;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
@ -48,14 +55,22 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
|||
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
||||
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.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.ColorChangeEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationDrawingResource;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent.CollaborationEventType;
|
||||
import com.raytheon.uf.viz.core.ContextManager;
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||
import com.raytheon.uf.viz.drawing.DrawingToolLayer;
|
||||
import com.raytheon.uf.viz.drawing.DrawingToolLayer.DrawMode;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -73,7 +88,8 @@ import com.raytheon.uf.viz.drawing.DrawingToolLayer.DrawMode;
|
|||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
public class CollaborationSessionView extends SessionView {
|
||||
public class CollaborationSessionView extends SessionView implements
|
||||
IPartListener {
|
||||
public static final String ID = "com.raytheon.uf.viz.collaboration.CollaborationSession";
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
|
@ -99,6 +115,8 @@ public class CollaborationSessionView extends SessionView {
|
|||
|
||||
private DrawingToolLayer layer;
|
||||
|
||||
private CollaborationDrawingResource resource;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -109,40 +127,49 @@ public class CollaborationSessionView extends SessionView {
|
|||
@Override
|
||||
public void createPartControl(Composite parent) {
|
||||
super.createPartControl(parent);
|
||||
SharedDisplaySessionMgr.getSessionContainer(sessionId).getSession()
|
||||
.getEventPublisher().register(this);
|
||||
assignLayer();
|
||||
}
|
||||
|
||||
// @Subscribe
|
||||
// public void drawingLayerUpdate(DrawingLayerUpdate update) {
|
||||
// IEditorPart part = null;
|
||||
// if (SharedDisplaySessionMgr.getSessionContainer(sessionId)
|
||||
// .getCollaborationEditor() == null) {
|
||||
// for (AbstractEditor editor : SharedDisplaySessionMgr
|
||||
// .getSessionContainer(sessionId).getSharedEditors()) {
|
||||
// part = editor;
|
||||
// }
|
||||
// } else {
|
||||
// part = SharedDisplaySessionMgr.getSessionContainer(sessionId)
|
||||
// .getCollaborationEditor();
|
||||
// }
|
||||
// if (part instanceof AbstractEditor) {
|
||||
// AbstractEditor editor = (AbstractEditor) part;
|
||||
// for (IDisplayPane pane : editor.getDisplayPanes()) {
|
||||
// ResourceList list = pane.getDescriptor().getResourceList();
|
||||
// for (ResourcePair pair : list) {
|
||||
// if (pair.getResource() instanceof CollaborationDrawingResource) {
|
||||
// CollaborationDrawingResource resource = (CollaborationDrawingResource)
|
||||
// pair
|
||||
// .getResource();
|
||||
// layer = resource.getDrawingLayerFor(resource
|
||||
// .getMyUser());
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
public boolean assignLayer() {
|
||||
SessionContainer sc = SharedDisplaySessionMgr
|
||||
.getSessionContainer(sessionId);
|
||||
ResourceList toSearch = null;
|
||||
IEditorPart part = 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()) {
|
||||
part = editor;
|
||||
}
|
||||
} else {
|
||||
part = SharedDisplaySessionMgr.getSessionContainer(sessionId)
|
||||
.getCollaborationEditor();
|
||||
}
|
||||
if (part instanceof AbstractEditor) {
|
||||
AbstractEditor editor = (AbstractEditor) part;
|
||||
for (IDisplayPane pane : editor.getDisplayPanes()) {
|
||||
toSearch = pane.getDescriptor().getResourceList();
|
||||
resource = (CollaborationDrawingResource) toSearch
|
||||
.getResourcesByTypeAsType(
|
||||
CollaborationDrawingResource.class).get(0);
|
||||
layer = resource.getDrawingLayerFor(resource.getMyUser());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void drawingLayerUpdate() {
|
||||
boolean assigned = true;
|
||||
if (layer == null) {
|
||||
assigned = assignLayer();
|
||||
}
|
||||
if (assigned) {
|
||||
updateToolItem();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
@ -152,6 +179,7 @@ public class CollaborationSessionView extends SessionView {
|
|||
@Override
|
||||
public void init(IViewSite site) throws PartInitException {
|
||||
super.init(site);
|
||||
site.getPage().addPartListener(this);
|
||||
}
|
||||
|
||||
protected void createActions() {
|
||||
|
@ -191,7 +219,11 @@ public class CollaborationSessionView extends SessionView {
|
|||
drawAction = new ActionContributionItem(new Action("Draw", SWT.TOGGLE) {
|
||||
@Override
|
||||
public void run() {
|
||||
layer.setDrawMode(DrawMode.DRAW);
|
||||
if (layer.getDrawMode() == DrawMode.DRAW) {
|
||||
layer.setDrawMode(DrawMode.NONE);
|
||||
} else {
|
||||
layer.setDrawMode(DrawMode.DRAW);
|
||||
}
|
||||
updateToolItem();
|
||||
}
|
||||
});
|
||||
|
@ -228,7 +260,12 @@ public class CollaborationSessionView extends SessionView {
|
|||
new Action("Erase", SWT.TOGGLE) {
|
||||
@Override
|
||||
public void run() {
|
||||
layer.setDrawMode(DrawMode.ERASE);
|
||||
if (layer.getDrawMode() == DrawMode.ERASE) {
|
||||
layer.setDrawMode(DrawMode.NONE);
|
||||
} else {
|
||||
layer.setDrawMode(DrawMode.ERASE);
|
||||
}
|
||||
updateToolItem();
|
||||
}
|
||||
});
|
||||
eraseAction.getAction().setImageDescriptor(
|
||||
|
@ -239,6 +276,7 @@ public class CollaborationSessionView extends SessionView {
|
|||
clearAction = new ActionContributionItem(new Action("Clear") {
|
||||
public void run() {
|
||||
layer.clear();
|
||||
updateToolItem();
|
||||
};
|
||||
});
|
||||
clearAction.getAction().setImageDescriptor(
|
||||
|
@ -249,13 +287,14 @@ public class CollaborationSessionView extends SessionView {
|
|||
lockAction = new ActionContributionItem(new Action(
|
||||
"Lock Collaborators", SWT.TOGGLE) {
|
||||
public void run() {
|
||||
System.out.println("Locking");
|
||||
resource.setLockingDrawing(((ToolItem) lockAction.getWidget())
|
||||
.getSelection());
|
||||
updateToolItem();
|
||||
};
|
||||
});
|
||||
lockAction.getAction().setImageDescriptor(
|
||||
IconUtil.getImageDescriptor(Activator.getDefault().getBundle(),
|
||||
"lock.gif"));
|
||||
|
||||
ToolBarManager mgr = (ToolBarManager) getViewSite().getActionBars()
|
||||
.getToolBarManager();
|
||||
mgr.insert(mgr.getSize() - 1, drawAction);
|
||||
|
@ -266,29 +305,51 @@ public class CollaborationSessionView extends SessionView {
|
|||
mgr.insert(mgr.getSize() - 1, eraseAction);
|
||||
mgr.insert(mgr.getSize() - 1, lockAction);
|
||||
mgr.insert(mgr.getSize() - 1, new Separator());
|
||||
|
||||
}
|
||||
|
||||
private void updateToolItem() {
|
||||
drawAction.getAction().setEnabled(true);
|
||||
undoAction.getAction().setEnabled(layer.canUndo());
|
||||
redoAction.getAction().setEnabled(layer.canRedo());
|
||||
clearAction.getAction().setEnabled(layer.canClear());
|
||||
eraseAction.getAction().setEnabled(true);
|
||||
switch (layer.getDrawMode()) {
|
||||
case DRAW:
|
||||
drawAction.getAction().setChecked(true);
|
||||
eraseAction.getAction().setChecked(false);
|
||||
break;
|
||||
case ERASE:
|
||||
drawAction.getAction().setChecked(false);
|
||||
eraseAction.getAction().setChecked(true);
|
||||
break;
|
||||
case NONE:
|
||||
drawAction.getAction().setChecked(false);
|
||||
eraseAction.getAction().setChecked(false);
|
||||
break;
|
||||
boolean assigned = true;
|
||||
if (layer == null) {
|
||||
assigned = assignLayer();
|
||||
}
|
||||
if (assigned) {
|
||||
drawAction.getAction().setEnabled(true);
|
||||
undoAction.getAction().setEnabled(layer.canUndo());
|
||||
redoAction.getAction().setEnabled(layer.canRedo());
|
||||
clearAction.getAction().setEnabled(layer.canClear());
|
||||
eraseAction.getAction().setEnabled(true);
|
||||
switch (layer.getDrawMode()) {
|
||||
case DRAW:
|
||||
drawAction.getAction().setChecked(true);
|
||||
eraseAction.getAction().setChecked(false);
|
||||
break;
|
||||
case ERASE:
|
||||
drawAction.getAction().setChecked(false);
|
||||
eraseAction.getAction().setChecked(true);
|
||||
break;
|
||||
case NONE:
|
||||
drawAction.getAction().setChecked(false);
|
||||
eraseAction.getAction().setChecked(false);
|
||||
break;
|
||||
}
|
||||
if (!resource.isSessionLeader()) {
|
||||
lockAction.getAction().setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the redoAction
|
||||
*/
|
||||
public ActionContributionItem getRedoAction() {
|
||||
return redoAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the undoAction
|
||||
*/
|
||||
public ActionContributionItem getUndoAction() {
|
||||
return undoAction;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -373,6 +434,23 @@ public class CollaborationSessionView extends SessionView {
|
|||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void receiveLocking(CollaborationDrawingEvent event) {
|
||||
if (event.getType() == CollaborationEventType.TOGGLE_LOCK) {
|
||||
if (!resource.isSessionLeader()) {
|
||||
if (drawAction.getAction().isEnabled()) {
|
||||
drawAction.getAction().setEnabled(false);
|
||||
undoAction.getAction().setEnabled(false);
|
||||
redoAction.getAction().setEnabled(false);
|
||||
clearAction.getAction().setEnabled(false);
|
||||
eraseAction.getAction().setEnabled(false);
|
||||
} else {
|
||||
updateToolItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -406,5 +484,85 @@ public class CollaborationSessionView extends SessionView {
|
|||
public void dispose() {
|
||||
SharedDisplaySessionMgr.exitSession(session.getSessionId());
|
||||
super.dispose();
|
||||
getSite().getPage().removePartListener(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.ui.IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
|
||||
*/
|
||||
@Override
|
||||
public void partActivated(IWorkbenchPart part) {
|
||||
// do this only if we care about the part being activated
|
||||
SessionContainer sc = SharedDisplaySessionMgr
|
||||
.getSessionContainer(sessionId);
|
||||
List<IEditorPart> editors = new ArrayList<IEditorPart>();
|
||||
editors.add(sc.getCollaborationEditor());
|
||||
if (sc.getSharedEditors() != null) {
|
||||
editors.addAll(sc.getSharedEditors());
|
||||
}
|
||||
if (this == part || editors.contains(part)) {
|
||||
ContextManager
|
||||
.getInstance(getSite().getPage().getWorkbenchWindow())
|
||||
.activateContexts(this);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.ui.IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
public void partBroughtToTop(IWorkbenchPart part) {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
|
||||
*/
|
||||
@Override
|
||||
public void partClosed(IWorkbenchPart part) {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.ui.IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart
|
||||
* )
|
||||
*/
|
||||
@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>();
|
||||
editors.add(sc.getCollaborationEditor());
|
||||
if (sc.getSharedEditors() != null) {
|
||||
editors.addAll(sc.getSharedEditors());
|
||||
}
|
||||
if (this == part || editors.contains(part)) {
|
||||
ContextManager
|
||||
.getInstance(getSite().getPage().getWorkbenchWindow())
|
||||
.deactivateContexts(this);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.ui.IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
|
||||
*/
|
||||
@Override
|
||||
public void partOpened(IWorkbenchPart part) {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,9 +41,9 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
|||
import com.raytheon.uf.viz.collaboration.comm.provider.session.SharedDisplaySession;
|
||||
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.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationDataManager;
|
||||
|
||||
/**
|
||||
* Generate the Participant's label and icon image.
|
||||
|
|
|
@ -41,7 +41,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.listener.IMessageListener
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||
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.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationDataManager;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
|
|
@ -55,7 +55,7 @@ import com.raytheon.uf.common.localization.exception.LocalizationException;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.SearchComposite.SearchText;
|
||||
|
||||
/**
|
||||
|
|
|
@ -74,8 +74,8 @@ import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
|||
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.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,9 +30,9 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SessionContainer;
|
||||
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent.CollaborationEventType;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
|
@ -43,6 +43,7 @@ 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.core.rsc.capabilities.ColorableCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
|
||||
import com.raytheon.uf.viz.drawing.DrawingToolLayer;
|
||||
|
@ -126,6 +127,9 @@ public class CollaborationDrawingResource extends
|
|||
outline.setLineStyle(LineStyle.SOLID);
|
||||
outline.setOutlineWidth(4);
|
||||
outline.setSuppressingMenuItems(true);
|
||||
|
||||
ColorableCapability colorable = getCapability(ColorableCapability.class);
|
||||
colorable.setSuppressingMenuItems(true);
|
||||
}
|
||||
|
||||
manager = new CollaborationDrawingUIManager(this);
|
||||
|
@ -206,19 +210,23 @@ public class CollaborationDrawingResource extends
|
|||
* @return
|
||||
*/
|
||||
public DrawingToolLayer getDrawingLayerFor(UserId user) {
|
||||
synchronized (layerMap) {
|
||||
DrawingToolLayer layer = layerMap.get(user);
|
||||
if (layer == null) {
|
||||
if (user == myUser) {
|
||||
layer = new CollaborationDrawingToolLayer(
|
||||
descriptor.getGridGeometry(), this);
|
||||
} else {
|
||||
layer = new DrawingToolLayer(descriptor.getGridGeometry());
|
||||
if (layerMap != null) {
|
||||
synchronized (layerMap) {
|
||||
DrawingToolLayer layer = layerMap.get(user);
|
||||
if (layer == null) {
|
||||
if (user == myUser) {
|
||||
layer = new CollaborationDrawingToolLayer(
|
||||
descriptor.getGridGeometry(), this);
|
||||
} else {
|
||||
layer = new DrawingToolLayer(
|
||||
descriptor.getGridGeometry());
|
||||
}
|
||||
layerMap.put(user, layer);
|
||||
}
|
||||
layerMap.put(user, layer);
|
||||
return layer;
|
||||
}
|
||||
return layer;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -295,6 +303,7 @@ public class CollaborationDrawingResource extends
|
|||
UserId user = event.getUserName();
|
||||
if (user.equals(myUser)) {
|
||||
// Early exit case, don't process my own events twice
|
||||
issueRefresh();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -349,6 +358,13 @@ public class CollaborationDrawingResource extends
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the container
|
||||
*/
|
||||
public SessionContainer getContainer() {
|
||||
return container;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -359,5 +375,4 @@ public class CollaborationDrawingResource extends
|
|||
// Though I hate this methods exists, it serves its purpose
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,310 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.telestrator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.ToolBar;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.core.ContextManager;
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.uf.viz.core.IVizEditorChangedListener;
|
||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
import com.raytheon.uf.viz.drawing.DrawingToolbar;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.VizWorkbenchManager;
|
||||
|
||||
/**
|
||||
* Collaboration drawing toolbar, adds locking of collaborators
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 23, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CollaborationDrawingToolbar extends DrawingToolbar implements
|
||||
IVizEditorChangedListener {
|
||||
|
||||
private static CollaborationDrawingToolbar instance;
|
||||
|
||||
private Set<CollaborationDrawingResource> resources = new HashSet<CollaborationDrawingResource>();
|
||||
|
||||
public static CollaborationDrawingToolbar openToolbar(
|
||||
CollaborationDrawingResource resource) {
|
||||
if (instance == null) {
|
||||
instance = new CollaborationDrawingToolbar(VizWorkbenchManager
|
||||
.getInstance().getCurrentWindow());
|
||||
instance.open();
|
||||
}
|
||||
instance.resources.add(resource);
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current instance of the toolbar, will not create if null
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static CollaborationDrawingToolbar getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private ToolItem leaderOnly;
|
||||
|
||||
private List<CollaborationDrawingResource> activeEditorResources = new ArrayList<CollaborationDrawingResource>();
|
||||
|
||||
private IWorkbenchWindow window;
|
||||
|
||||
/**
|
||||
* @param parentShell
|
||||
*/
|
||||
private CollaborationDrawingToolbar(IWorkbenchWindow window) {
|
||||
super(window.getShell());
|
||||
this.window = window;
|
||||
setText("Collaboration Drawing");
|
||||
VizWorkbenchManager.getInstance().addListener(this);
|
||||
IDisplayPaneContainer active = EditorUtil.getActiveVizContainer(window);
|
||||
if (active != null) {
|
||||
editorChanged(active);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#opened()
|
||||
*/
|
||||
@Override
|
||||
protected void opened() {
|
||||
super.opened();
|
||||
ContextManager.getInstance(window).activateContexts(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.drawing.DrawingToolbar#initializeComponents(org.eclipse
|
||||
* .swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
super.initializeComponents(shell);
|
||||
Listener activateDeactivate = new Listener() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
switch (event.type) {
|
||||
case SWT.Activate:
|
||||
ContextManager.getInstance(PlatformUI.getWorkbench())
|
||||
.activateContexts(CollaborationDrawingToolbar.this);
|
||||
break;
|
||||
case SWT.Deactivate:
|
||||
ContextManager.getInstance(PlatformUI.getWorkbench())
|
||||
.deactivateContexts(
|
||||
CollaborationDrawingToolbar.this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
shell.addListener(SWT.Activate, activateDeactivate);
|
||||
shell.addListener(SWT.Deactivate, activateDeactivate);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.drawing.DrawingToolbar#addToolsToToolBar(org.eclipse
|
||||
* .swt.widgets.ToolBar)
|
||||
*/
|
||||
@Override
|
||||
protected void addToolsToToolBar(ToolBar toolbar) {
|
||||
super.addToolsToToolBar(toolbar);
|
||||
undoItem.setToolTipText("Ctrl+Z to Undo");
|
||||
redoItem.setToolTipText("Ctrl+Y to Undo");
|
||||
|
||||
leaderOnly = new ToolItem(toolbar, SWT.CHECK);
|
||||
leaderOnly.setText("Lock Collaborators");
|
||||
leaderOnly.setImage(IconUtil.getImageDescriptor(
|
||||
Activator.getDefault().getBundle(), "multiple_draw.gif")
|
||||
.createImage());
|
||||
leaderOnly.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
for (CollaborationDrawingResource resource : activeEditorResources) {
|
||||
resource.setLockingDrawing(leaderOnly.getSelection());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fuction for notifying the toolbar a resource has changed, will update the
|
||||
* UI if the resource is currently being managed by the toolbar
|
||||
*
|
||||
* @param resource
|
||||
*/
|
||||
public void resourceChanged(CollaborationDrawingResource resource) {
|
||||
if (activeEditorResources.contains(resource)) {
|
||||
updateItemState();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.drawing.DrawingToolbar#nullLayer()
|
||||
*/
|
||||
@Override
|
||||
protected void nullLayer() {
|
||||
super.nullLayer();
|
||||
leaderOnly.setSelection(false);
|
||||
leaderOnly.setEnabled(false);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.drawing.DrawingToolbar#validLayer()
|
||||
*/
|
||||
@Override
|
||||
protected void validLayer() {
|
||||
super.validLayer();
|
||||
for (CollaborationDrawingResource resource : activeEditorResources) {
|
||||
leaderOnly.setEnabled(resource.isSessionLeader());
|
||||
leaderOnly.setSelection(resource.isLockingDrawing());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
super.disposed();
|
||||
resources.clear();
|
||||
VizWorkbenchManager.getInstance().removeListener(this);
|
||||
ContextManager.getInstance(window).deactivateContexts(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for notifying the toolbar a resource has been disposed, toolbar
|
||||
* will close when no resources are left being managed
|
||||
*
|
||||
* @param resource
|
||||
*/
|
||||
public synchronized void disposed(CollaborationDrawingResource resource) {
|
||||
resources.remove(resource);
|
||||
activeEditorResources.remove(resource);
|
||||
if (resources.size() == 0) {
|
||||
close();
|
||||
instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.IVizEditorChangedListener#editorChanged(com.
|
||||
* raytheon.uf.viz.core.IDisplayPaneContainer)
|
||||
*/
|
||||
@Override
|
||||
public void editorChanged(IDisplayPaneContainer container) {
|
||||
List<CollaborationDrawingResource> activeResources = new ArrayList<CollaborationDrawingResource>();
|
||||
for (IDisplayPane pane : container.getDisplayPanes()) {
|
||||
List<CollaborationDrawingResource> paneResources = pane
|
||||
.getDescriptor()
|
||||
.getResourceList()
|
||||
.getResourcesByTypeAsType(
|
||||
CollaborationDrawingResource.class);
|
||||
activeResources.addAll(paneResources);
|
||||
}
|
||||
activeEditorResources = activeResources;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.drawing.DrawingToolbar#undo()
|
||||
*/
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
refresh();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.drawing.DrawingToolbar#redo()
|
||||
*/
|
||||
@Override
|
||||
public void redo() {
|
||||
super.redo();
|
||||
refresh();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.drawing.DrawingToolbar#clear()
|
||||
*/
|
||||
@Override
|
||||
protected void clear() {
|
||||
super.clear();
|
||||
refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the resource to repaint
|
||||
*/
|
||||
private void refresh() {
|
||||
for (CollaborationDrawingResource resource : activeEditorResources) {
|
||||
resource.issueRefresh();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,6 +19,10 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.telestrator;
|
||||
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.drawing.DrawingToolUIManager;
|
||||
|
||||
|
@ -44,7 +48,7 @@ public class CollaborationDrawingUIManager extends DrawingToolUIManager {
|
|||
|
||||
private CollaborationDrawingResource resource;
|
||||
|
||||
private CollaborationDrawingToolbar toolbar;
|
||||
private CollaborationSessionView view;
|
||||
|
||||
public CollaborationDrawingUIManager(CollaborationDrawingResource resource) {
|
||||
super(resource.getDrawingLayerFor(resource.getMyUser()), resource
|
||||
|
@ -54,9 +58,12 @@ public class CollaborationDrawingUIManager extends DrawingToolUIManager {
|
|||
@Override
|
||||
public void run() {
|
||||
CollaborationDrawingResource resource = CollaborationDrawingUIManager.this.resource;
|
||||
toolbar = CollaborationDrawingToolbar.openToolbar(resource);
|
||||
toolbar.setCurrentDrawingLayer(resource
|
||||
.getDrawingLayerFor(resource.getMyUser()));
|
||||
IWorkbenchPage page = PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getActivePage();
|
||||
view = (CollaborationSessionView) page.findViewReference(
|
||||
CollaborationSessionView.ID,
|
||||
resource.getContainer().getSessionId()).getPart(false);
|
||||
view.drawingLayerUpdate();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -69,10 +76,6 @@ public class CollaborationDrawingUIManager extends DrawingToolUIManager {
|
|||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
if (toolbar != null) {
|
||||
// Incase disposed before async exec can run in constructor
|
||||
toolbar.disposed(resource);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -100,7 +103,7 @@ public class CollaborationDrawingUIManager extends DrawingToolUIManager {
|
|||
public boolean handleMouseUp(int x, int y, int mouseButton) {
|
||||
boolean rval = super.handleMouseUp(x, y, mouseButton);
|
||||
if (rval) {
|
||||
toolbar.resourceChanged(resource);
|
||||
view.drawingLayerUpdate();
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,10 @@ import org.eclipse.core.commands.AbstractHandler;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationDrawingToolbar;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationDrawingResource;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.uf.viz.drawing.DrawingToolLayer;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
|
||||
/**
|
||||
* Action for invoking undo/redo on the CollaborationDrawingToolbar
|
||||
|
@ -59,17 +62,19 @@ public class UndoRedoHandler extends AbstractHandler {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
CollaborationDrawingToolbar toolbar = CollaborationDrawingToolbar
|
||||
.getInstance();
|
||||
if (toolbar != null) {
|
||||
String action = event.getParameter(ACTION_ID);
|
||||
if (UNDO_ID.equals(action)) {
|
||||
toolbar.undo();
|
||||
} else if (REDO_ID.equals(action)) {
|
||||
toolbar.redo();
|
||||
}
|
||||
CollaborationDrawingResource resource = (CollaborationDrawingResource) EditorUtil
|
||||
.getActiveEditorAs(IDisplayPaneContainer.class)
|
||||
.getActiveDisplayPane().getDescriptor().getResourceList()
|
||||
.getResourcesByTypeAsType(CollaborationDrawingResource.class)
|
||||
.get(0);
|
||||
DrawingToolLayer layer = resource.getDrawingLayerFor(resource
|
||||
.getMyUser());
|
||||
String action = event.getParameter(ACTION_ID);
|
||||
if (UNDO_ID.equals(action)) {
|
||||
layer.undo();
|
||||
} else if (REDO_ID.equals(action)) {
|
||||
layer.redo();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,259 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.drawing;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.ToolBar;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
|
||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
import com.raytheon.uf.viz.drawing.DrawingToolLayer.DrawMode;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
* Toolbar dialog for DrawingToolLayer
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 23, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DrawingToolbar extends CaveSWTDialog {
|
||||
|
||||
private DrawingToolLayer layer;
|
||||
|
||||
protected ToolItem drawItem;
|
||||
|
||||
protected ToolItem eraserItem;
|
||||
|
||||
protected ToolItem undoItem;
|
||||
|
||||
protected ToolItem redoItem;
|
||||
|
||||
protected ToolItem clearItem;
|
||||
|
||||
/**
|
||||
* @param parentShell
|
||||
*/
|
||||
public DrawingToolbar(Shell parent) {
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT
|
||||
| CAVE.DO_NOT_BLOCK);
|
||||
setText("Drawing Tool");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
Composite comp = new Composite(shell, SWT.NONE);
|
||||
GridLayout layout = new GridLayout();
|
||||
comp.setLayout(layout);
|
||||
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
comp.setLayoutData(data);
|
||||
layout.marginHeight = 0;
|
||||
layout.marginWidth = 0;
|
||||
|
||||
ToolBar toolbar = new ToolBar(comp, SWT.FLAT);
|
||||
layout = new GridLayout();
|
||||
layout.marginHeight = 0;
|
||||
layout.marginWidth = 0;
|
||||
data = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
toolbar.setLayout(layout);
|
||||
toolbar.setLayoutData(data);
|
||||
|
||||
addToolsToToolBar(toolbar);
|
||||
nullLayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param toolbar
|
||||
*/
|
||||
protected void addToolsToToolBar(ToolBar toolbar) {
|
||||
// Draw button
|
||||
drawItem = new ToolItem(toolbar, SWT.CHECK);
|
||||
drawItem.setText("Draw");
|
||||
drawItem.setImage(IconUtil.getImageDescriptor(
|
||||
Activator.getDefault().getBundle(), "draw.gif").createImage());
|
||||
drawItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (drawItem.getSelection()) {
|
||||
layer.setDrawMode(DrawMode.DRAW);
|
||||
} else if (eraserItem.getSelection() == false) {
|
||||
layer.setDrawMode(DrawMode.NONE);
|
||||
}
|
||||
updateItemState();
|
||||
}
|
||||
});
|
||||
|
||||
// Undo button
|
||||
undoItem = new ToolItem(toolbar, SWT.FLAT);
|
||||
undoItem.setText("Undo");
|
||||
undoItem.setImage(IconUtil.getImageDescriptor(
|
||||
Activator.getDefault().getBundle(), "undo.gif").createImage());
|
||||
undoItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
undo();
|
||||
}
|
||||
});
|
||||
|
||||
// Redo button
|
||||
redoItem = new ToolItem(toolbar, SWT.FLAT);
|
||||
redoItem.setText("Redo");
|
||||
redoItem.setImage(IconUtil.getImageDescriptor(
|
||||
Activator.getDefault().getBundle(), "redo.gif").createImage());
|
||||
redoItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
redo();
|
||||
}
|
||||
});
|
||||
|
||||
// Clear button
|
||||
clearItem = new ToolItem(toolbar, SWT.FLAT);
|
||||
clearItem.setText("Clear");
|
||||
clearItem
|
||||
.setImage(IconUtil.getImageDescriptor(
|
||||
Activator.getDefault().getBundle(), "remove.gif")
|
||||
.createImage());
|
||||
clearItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
clear();
|
||||
}
|
||||
});
|
||||
|
||||
// Erase button
|
||||
eraserItem = new ToolItem(toolbar, SWT.CHECK);
|
||||
eraserItem.setText("Eraser");
|
||||
eraserItem
|
||||
.setImage(IconUtil.getImageDescriptor(
|
||||
Activator.getDefault().getBundle(), "eraser.png")
|
||||
.createImage());
|
||||
eraserItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (eraserItem.getSelection()) {
|
||||
layer.setDrawMode(DrawMode.ERASE);
|
||||
} else if (drawItem.getSelection() == false) {
|
||||
layer.setDrawMode(DrawMode.NONE);
|
||||
}
|
||||
updateItemState();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to setup tool items when no layer is active
|
||||
*/
|
||||
protected void nullLayer() {
|
||||
drawItem.setSelection(false);
|
||||
drawItem.setEnabled(false);
|
||||
undoItem.setEnabled(false);
|
||||
redoItem.setEnabled(false);
|
||||
clearItem.setEnabled(false);
|
||||
eraserItem.setEnabled(false);
|
||||
eraserItem.setSelection(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to setup the tool items when there is a valid layer
|
||||
*/
|
||||
protected void validLayer() {
|
||||
drawItem.setEnabled(true);
|
||||
undoItem.setEnabled(layer.canUndo());
|
||||
redoItem.setEnabled(layer.canRedo());
|
||||
clearItem.setEnabled(layer.canClear());
|
||||
eraserItem.setEnabled(true);
|
||||
switch (layer.getDrawMode()) {
|
||||
case DRAW:
|
||||
drawItem.setSelection(true);
|
||||
eraserItem.setSelection(false);
|
||||
break;
|
||||
case ERASE:
|
||||
drawItem.setSelection(false);
|
||||
eraserItem.setSelection(true);
|
||||
break;
|
||||
case NONE:
|
||||
drawItem.setSelection(false);
|
||||
eraserItem.setSelection(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentDrawingLayer(DrawingToolLayer layer) {
|
||||
this.layer = layer;
|
||||
updateItemState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the tool item state based on the layer
|
||||
*/
|
||||
protected final void updateItemState() {
|
||||
if (layer == null) {
|
||||
nullLayer();
|
||||
} else {
|
||||
validLayer();
|
||||
}
|
||||
getShell().layout();
|
||||
}
|
||||
|
||||
protected void undo() {
|
||||
if (layer != null) {
|
||||
layer.undo();
|
||||
updateItemState();
|
||||
}
|
||||
}
|
||||
|
||||
protected void redo() {
|
||||
if (layer != null) {
|
||||
layer.redo();
|
||||
updateItemState();
|
||||
}
|
||||
}
|
||||
|
||||
protected void clear() {
|
||||
if (layer != null) {
|
||||
layer.clear();
|
||||
updateItemState();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -96,6 +96,7 @@ public abstract class CaveFloatingView extends ViewPart {
|
|||
public void run() {
|
||||
// should only run when the user is currently attached to cave
|
||||
// (or detached, but not a floating dialog)
|
||||
this.setToolTipText("Dock");
|
||||
detached = true;
|
||||
WorkbenchPage page = (WorkbenchPage) PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getActivePage();
|
||||
|
@ -121,6 +122,7 @@ public abstract class CaveFloatingView extends ViewPart {
|
|||
run();
|
||||
return;
|
||||
}
|
||||
this.setToolTipText("Float");
|
||||
detached = false;
|
||||
WorkbenchPage page = (WorkbenchPage) PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getActivePage();
|
||||
|
|
Loading…
Add table
Reference in a new issue