Skip to content

Commit bce5219

Browse files
committed
Ported the 17.1.1 contour control into the first GSD update to dev_17.3.1
1 parent 36d99fe commit bce5219

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+6735
-3800
lines changed

features/gov.noaa.gsd.viz.ensemble.feature/feature.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<feature
33
id="gov.noaa.gsd.viz.ensemble.feature"
44
label="Ensemble Tool Feature"
5-
version="4.16.2.2"
5+
version="4.17.3.1"
66
provider-name="GSD">
77

88
<description url="http://www.example.com/description">

viz/gov.noaa.gsd.viz.ensemble/plugin.xml

+11-14
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<with
3535
variable="activeEditor">
3636
<instanceof
37-
value="gov.noaa.gsd.viz.ensemble.navigator.ui.viewer.matrix.VizMatrixEditor">
37+
value="com.raytheon.uf.viz.core.maps.display.VizMapEditor">
3838
</instanceof>
3939
</with>
4040
</activeWhen>
@@ -55,17 +55,6 @@
5555

5656
</extension>
5757

58-
<extension
59-
point="org.eclipse.ui.editors">
60-
<editor
61-
class="gov.noaa.gsd.viz.ensemble.navigator.ui.viewer.matrix.VizMatrixEditor"
62-
default="true"
63-
icon="icons/delta-map.gif"
64-
id="gov.noaa.gsd.viz.ensemble.ui.map.MatrixEditor"
65-
name="Matrix">
66-
</editor>
67-
</extension>
68-
6958
<extension
7059
point="org.eclipse.ui.views">
7160
<view
@@ -151,11 +140,19 @@
151140
<extension
152141
point="com.raytheon.uf.viz.core.classContext">
153142
<classContext
154-
class="gov.noaa.gsd.viz.ensemble.navigator.ui.viewer.matrix.VizMatrixEditor">
143+
class="com.raytheon.uf.viz.core.maps.display.VizMapEditor">
155144
<contextId
156145
id="gov.noaa.gsd.viz.ensemble.matrix.navigator.context">
157146
</contextId>
158147
</classContext>
159148
</extension>
160-
149+
<extension
150+
point="com.raytheon.viz.ui.contextualMenu">
151+
<contextualMenu
152+
actionClass="gov.noaa.gsd.viz.ensemble.action.ContourControlSelectionAction"
153+
capabilityClass="gov.noaa.gsd.viz.ensemble.display.control.contour.ContourControlCapability"
154+
name="gov.noaa.gsd.viz.ensemble.controlContourControl"
155+
sortID="553">
156+
</contextualMenu>
157+
</extension>
161158
</plugin>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package gov.noaa.gsd.viz.ensemble.action;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
import com.raytheon.uf.common.status.IUFStatusHandler;
7+
import com.raytheon.uf.common.status.UFStatus;
8+
import com.raytheon.uf.common.status.UFStatus.Priority;
9+
import com.raytheon.uf.common.style.StyleException;
10+
import com.raytheon.uf.viz.core.grid.rsc.AbstractGridResource;
11+
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
12+
import com.raytheon.uf.viz.core.rsc.DisplayType;
13+
import com.raytheon.viz.ui.VizWorkbenchManager;
14+
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
15+
16+
import gov.noaa.gsd.viz.ensemble.control.EnsembleResourceManager;
17+
import gov.noaa.gsd.viz.ensemble.display.control.contour.ContourControlDialog;
18+
19+
/**
20+
*
21+
* This action is for popping up the Contour Control Dialog.
22+
*
23+
* <pre>
24+
*
25+
* SOFTWARE HISTORY
26+
*
27+
* Date Ticket# Engineer Description
28+
* ------------ ---------- ----------- --------------------------
29+
* Mar 14, 2017 DCS19598 polster Initial creation
30+
* Mar 31, 2017 DCS19598 jing Changed dialog creation and added log
31+
*
32+
* </pre>
33+
*
34+
* @author polster
35+
* @author jing
36+
*/
37+
public class ContourControlSelectionAction extends AbstractRightClickAction {
38+
private static final transient IUFStatusHandler statusHandler = UFStatus
39+
.getHandler(ContourControlSelectionAction.class);
40+
@Override
41+
public void run() {
42+
AbstractVizResource<?, ?> rsc = getTopMostSelectedResource();
43+
if (rsc instanceof AbstractGridResource &&
44+
( (AbstractGridResource<?>) rsc).getDisplayType() == DisplayType.CONTOUR) {
45+
List<AbstractGridResource<?>> rscList = new ArrayList<AbstractGridResource<?>>();
46+
rscList.add((AbstractGridResource<?>) rsc);
47+
try {
48+
ContourControlDialog dialog = new ContourControlDialog(
49+
VizWorkbenchManager.getInstance().getCurrentWindow()
50+
.getShell(),
51+
rsc.getName(), rscList);
52+
dialog.open();
53+
} catch (StyleException e) {
54+
statusHandler.handle(Priority.PROBLEM,
55+
e.getLocalizedMessage(), e);
56+
}
57+
}
58+
59+
}
60+
61+
@Override
62+
public String getText() {
63+
return "Contour Control";
64+
}
65+
66+
}

viz/gov.noaa.gsd.viz.ensemble/src/gov/noaa/gsd/viz/ensemble/action/EnsembleToolAction.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package gov.noaa.gsd.viz.ensemble.action;
22

3-
import gov.noaa.gsd.viz.ensemble.control.EnsembleTool;
4-
53
import org.eclipse.core.commands.ExecutionEvent;
64
import org.eclipse.core.commands.ExecutionException;
75

86
import com.raytheon.viz.ui.tools.AbstractTool;
97

8+
import gov.noaa.gsd.viz.ensemble.control.EnsembleTool;
9+
1010
/**
1111
* This is how you start the Ensemble Tool. Only allow the Ensemble Tool to be
1212
* started if it is not already started.
@@ -17,7 +17,8 @@
1717
*
1818
* Date Ticket# Engineer Description
1919
* ------------ ---------- ----------- --------------------------
20-
* Dec 7, 2014 5056 polster Initial creation
20+
* Dec 07, 2014 5056 polster Initial creation
21+
* Mar 01, 2017 19443 polster Changed method signature
2122
*
2223
* </pre>
2324
*
@@ -37,7 +38,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
3738
* Only execute the action if an ensemble tool layer is not already in
3839
* the active editor
3940
*/
40-
if (EnsembleTool.isToolNotLoaded()) {
41+
if (!EnsembleTool.isToolLoaded()) {
4142
EnsembleTool.getInstance().execute(event);
4243
}
4344
return null;
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
package gov.noaa.gsd.viz.ensemble.control;
22

3-
import java.util.ArrayList;
4-
import java.util.List;
5-
63
import org.eclipse.ui.IEditorPart;
4+
import org.eclipse.ui.IEditorReference;
75
import org.eclipse.ui.IPartListener2;
8-
import org.eclipse.ui.IWorkbenchPart;
96
import org.eclipse.ui.IWorkbenchPartReference;
10-
import org.eclipse.ui.PlatformUI;
11-
import org.eclipse.ui.internal.EditorReference;
12-
import org.eclipse.ui.part.EditorPart;
137

148
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
15-
import com.raytheon.uf.viz.core.VizApp;
16-
import com.raytheon.viz.ui.editor.AbstractEditor;
9+
import com.raytheon.uf.viz.xy.timeseries.TimeSeriesEditor;
10+
11+
import gov.noaa.gsd.viz.ensemble.control.EnsembleTool.EnsembleToolCompatibility;
12+
import gov.noaa.gsd.viz.ensemble.control.EnsembleTool.EnsembleToolMode;
1713

1814
/**
1915
* This is the part listener for the editors associated with Ensemble Tool.
@@ -25,6 +21,7 @@
2521
* Date Ticket# Engineer Description
2622
* ------------ ---------- ----------- --------------------------
2723
* Nov 17, 2014 5056 polster Initial creation
24+
* Mar 01, 2017 19443 polster handle part opened for time series
2825
*
2926
* </pre>
3027
*
@@ -33,125 +30,107 @@
3330
*/
3431
public class EnsembleEditorPartListener implements IPartListener2 {
3532

36-
private List<IDisplayPaneContainer> editors = null;
33+
private boolean ignorePartActivatedEvent = false;
3734

3835
public EnsembleEditorPartListener() {
39-
editors = new ArrayList<>();
40-
}
41-
42-
public void addEditor(IDisplayPaneContainer e) {
43-
editors.add(e);
44-
}
45-
46-
public void removeEditor(IDisplayPaneContainer e) {
47-
editors.remove(e);
4836
}
4937

5038
@Override
5139
public void partActivated(IWorkbenchPartReference partRef) {
5240

53-
if (containsPart(partRef)) {
54-
IEditorPart editorPart = (EditorPart) partRef.getPart(false);
55-
56-
if (editorPart instanceof IDisplayPaneContainer) {
57-
IDisplayPaneContainer editor = (IDisplayPaneContainer) editorPart;
58-
EnsembleTool.getInstance().setEditor(editor);
59-
EnsembleTool.getInstance().refreshTool(true);
41+
/*
42+
* Ignore the part activated event when ignore flag is set
43+
*/
44+
if (!ignorePartActivatedEvent) {
45+
EnsembleToolCompatibility compatibility = EnsembleTool
46+
.getEditorCompatibility(partRef);
47+
if (compatibility == EnsembleToolCompatibility.COMPATIBLE_CONTAINS_ENSEMBLE_TOOL_LAYER
48+
|| compatibility == EnsembleToolCompatibility.COMPATIBLE_NO_ENSEMBLE_TOOL_LAYER) {
49+
EnsembleTool.getInstance().refreshToolByActiveEditor();
6050
}
6151
}
6252
}
6353

6454
@Override
65-
public void partDeactivated(IWorkbenchPartReference partRef) {
66-
if (containsPart(partRef)) {
67-
// TODO
68-
}
55+
public void partClosed(final IWorkbenchPartReference partRef) {
56+
// Needed only because the interface requires it
6957
}
7058

7159
@Override
72-
public void partBroughtToTop(IWorkbenchPartReference partRef) {
73-
if (containsPart(partRef)) {
74-
// TODO
75-
}
60+
public void partDeactivated(IWorkbenchPartReference partRef) {
61+
// Needed only because the interface requires it
7662
}
7763

7864
@Override
79-
public void partClosed(IWorkbenchPartReference partRef) {
80-
if (containsPart(partRef)) {
81-
82-
EditorPart editorPart = (EditorPart) partRef.getPart(false);
83-
if (editorPart instanceof AbstractEditor) {
84-
VizApp.runSync(new Runnable() {
85-
public void run() {
86-
87-
if (!PlatformUI.getWorkbench().isClosing()) {
88-
EnsembleTool.getInstance()
89-
.verifyCloseActiveToolLayer();
90-
}
91-
92-
}
93-
});
94-
}
95-
}
65+
public void partBroughtToTop(IWorkbenchPartReference partRef) {
66+
// Needed only because the interface requires it
9667
}
9768

98-
@SuppressWarnings("restriction")
9969
@Override
10070
public void partOpened(IWorkbenchPartReference partRef) {
101-
if (containsPart(partRef)) {
102-
/* ignore */
103-
}
10471
/*
10572
* Did another editor open? If so, if there is not already a tool layer
10673
* associated with it the tell the manager about the new editor.
10774
*/
108-
else if (partRef instanceof EditorReference) {
109-
EditorPart openedEditor = (EditorPart) ((EditorReference) partRef)
110-
.getPart(false);
111-
if (openedEditor instanceof IDisplayPaneContainer) {
75+
if (partRef instanceof IEditorReference) {
76+
IEditorPart openedEditor = ((IEditorReference) partRef)
77+
.getEditor(false);
78+
if (openedEditor instanceof TimeSeriesEditor
79+
&& EnsembleTool.isExtant()) {
11280
IDisplayPaneContainer editor = (IDisplayPaneContainer) openedEditor;
113-
EnsembleTool.getInstance().setEditor(editor);
114-
if (!EnsembleTool.getInstance().hasToolLayer(editor)) {
115-
EnsembleTool.getInstance().createToolLayer(editor);
81+
/*
82+
* The time series editor opens automatically when a time series
83+
* product is requested from the Volume Browser. If the ensemble
84+
* tool is editable when the time series editor is opened then
85+
* read the products into the ensemble tool.
86+
*/
87+
if (EnsembleTool.getInstance().isToolEditable()) {
88+
EnsembleTool.getInstance().setEditor(editor);
89+
/*
90+
* Ensemble Tool only allows one time series editor at one
91+
* time to be associated.
92+
*/
93+
if (!EnsembleTool.hasToolLayer(editor)) {
94+
EnsembleTool.getInstance().createToolLayer(editor,
95+
EnsembleToolMode.LEGENDS_TIME_SERIES);
96+
}
97+
EnsembleTool.getInstance().refreshTool(true);
98+
}
99+
/*
100+
* If the ensemble tool was not editable then make sure it gets
101+
* or stays minimized.
102+
*/
103+
else {
104+
EnsembleTool.getInstance().setEditor(null);
105+
EnsembleTool.getInstance().refreshToolByActiveEditor();
116106
}
117-
EnsembleTool.getInstance().refreshTool(true);
118107
}
119108
}
120109
}
121110

122111
@Override
123112
public void partHidden(IWorkbenchPartReference partRef) {
124-
if (containsPart(partRef)) {
125-
// TODO
126-
}
113+
// Needed only because the interface requires it
127114
}
128115

129116
@Override
130117
public void partVisible(IWorkbenchPartReference partRef) {
131-
if (containsPart(partRef)) {
132-
// TODO
133-
}
118+
// Needed only because the interface requires it
134119
}
135120

136121
@Override
137122
public void partInputChanged(IWorkbenchPartReference partRef) {
138-
if (containsPart(partRef)) {
139-
// TODO
140-
}
123+
// Needed only because the interface requires it
141124
}
142125

143-
private boolean containsPart(IWorkbenchPartReference ref) {
144-
boolean containsPart = false;
145-
IWorkbenchPart part = ref.getPart(false);
146-
if (part != null) {
147-
148-
}
149-
for (IDisplayPaneContainer ep : editors) {
150-
if (part.equals(ep)) {
151-
containsPart = true;
152-
break;
153-
}
154-
}
155-
return containsPart;
126+
/**
127+
* Allow this listener to ignore incoming part activated events.
128+
*
129+
* @param ignore
130+
* boolean to turn on/off the "ignore" state
131+
*/
132+
public void ignorePartActivatedEvent(boolean ignore) {
133+
ignorePartActivatedEvent = ignore;
156134
}
135+
157136
}

0 commit comments

Comments
 (0)