VLab Issue #5413 - Fixed several issues for PGEN in D2D

1. Open D2D procedure when PGEN is up.
                   2. PGEN interpolation tool exception.
                   3. Clear button does not close PGEN palette.
                   4. PGEN contour circle dialog issue.
                   5. Switch perspective when PGEN is running.

Change-Id: I92f0b71043ab415b088ad933398208fc53287dbc

Former-commit-id: 62d796b74b9ca1b5b0239c4e322808e2300b874e
This commit is contained in:
Bingfan Yin 2015-01-30 11:43:41 -05:00
parent bfcb36eeac
commit b14d970ba7
7 changed files with 103 additions and 7 deletions

View file

@ -59,7 +59,8 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
* ------------ ---------- ----------- --------------------------
* 12/14 R5413 B. Yin Added IPartListener2 and IRenderableDisplayChangedListener
* to make the swapping in D2D work
* 12/14 R5413 B. Yin Added exception handling, perspective id, and endSession.
* 12/14 R5413 B. Yin Added exception handling, perspective id, and endSession.
* 01/15 R5413 B. Yin Added closePalette method.
*
*/
@ -468,5 +469,16 @@ public class PgenSession implements IPartListener2,
public void endSession(){
instance = null;
}
public void closePalette(){
if ( palette != null ){
if ( PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage() != null ){
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().hideView(palette);
removePalette();
}
}
}
}

View file

@ -2078,9 +2078,9 @@ public class PgenUtil {
ResourceList rscList = disp.getDescriptor().getResourceList();
for (ResourcePair rp : rscList) {
AbstractVizResource rsc = rp.getResource();
AbstractVizResource<?, ?> rsc = rp.getResource();
if (rsc.getClass() == rscClass) {
if ( rsc != null && rsc.getClass() == rscClass) {
return rsc;
}
}

View file

@ -116,6 +116,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 05/14 TTR1008 J. Wu Set default contour parameters through settings_tbl.xml.
* 05/14 TTR990 J. Wu Set default attributes for different contour labels.
* 08/14 ? J. Wu "Edit" line color should go to contoursAttrSettings to take effect..
* 01/15 R5413 B. Yin Added open methods for circle and line dialogs.
*
* </pre>
*
@ -2300,6 +2301,19 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
this.close();
}
/**
* Open the dialog if it doesn't exist.
*/
@Override
public int open() {
if (this.getShell() == null || this.getShell().isDisposed()) {
return super.open();
} else {
return CANCEL;
}
}
/**
* closes the line attribute dialog only
*/
@ -2469,6 +2483,19 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
}
this.close();
}
/**
* Open the dialog if it doesn't exist.
*/
@Override
public int open() {
if (this.getShell() == null || this.getShell().isDisposed()) {
return super.open();
} else {
return CANCEL;
}
}
/**
* closes the circle attribute dialog only

View file

@ -9,6 +9,7 @@
package gov.noaa.nws.ncep.ui.pgen.palette;
import gov.noaa.nws.ncep.ui.pgen.PGenRuntimeException;
import gov.noaa.nws.ncep.ui.pgen.PgenSession;
import gov.noaa.nws.ncep.ui.pgen.PgenStaticDataProvider;
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
//import gov.noaa.nws.ncep.viz.ui.display.NCMapEditor;
@ -28,6 +29,8 @@ import org.eclipse.ui.internal.WorkbenchPage;
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
public class PgenPaletteAction extends AbstractHandler {
@ -48,6 +51,26 @@ public class PgenPaletteAction extends AbstractHandler {
return null;
}
AbstractVizPerspectiveManager pMngr = VizPerspectiveListener.getCurrentPerspectiveManager();
if ( pMngr != null && pMngr.getPerspectiveId() != PgenSession.getInstance().getPerspectiveId() ){
if (PgenSession.getInstance().getPgenPalette() == null ){
//if PGEN palette is closed
PgenSession.getInstance().setPerspectiveId(pMngr.getPerspectiveId() );
}
else {
// if PGEN palette is open in another perspective
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING
| SWT.OK);
int idxLastDot = PgenSession.getInstance().getPerspectiveId().lastIndexOf('.');
mb.setMessage( "A PGEN session is alreadly running in perspective " + PgenSession.getInstance().getPerspectiveId().substring(++idxLastDot) + "!");
mb.open();
return null;
}
}
/*
* The viewID string is in the XML file for PGEN extension point.
*/

View file

@ -112,6 +112,7 @@ import com.raytheon.viz.ui.tools.AbstractModalTool;
* 08/13 TTR696/774 J. Wu Reset title/Close product manage dialog.
* 11/13 #1081 B. Yin Get selected DE to change front/line type.
* 12/14 R5413 B. Yin Removed unused variables, loops.
* 01/15 R5413 B. Yin Set perspective ID and editor for PGEN session.
*
* </pre>
*
@ -391,8 +392,15 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
* the PgenSession
*/
PgenResource current = PgenUtil.findPgenResource(null);
if (current != null)
if (current != null) {
PgenSession.getInstance().setResource(current);
PgenUtil.setSelectingMode();
AbstractEditor actEditor = PgenUtil.getActiveEditor();
if ( actEditor != null && !PgenSession.getInstance().getEditors().contains(actEditor)){
PgenSession.getInstance().getEditors().add(actEditor);
}
}
}

View file

@ -44,6 +44,11 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.graphics.Image;
@ -55,6 +60,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType;
@ -73,6 +79,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* @author sgilbert
*
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class PgenResourceData extends AbstractResourceData implements
CommandStackListener {
private static final transient IUFStatusHandler statusHandler = UFStatus
@ -745,6 +753,8 @@ public class PgenResourceData extends AbstractResourceData implements
public synchronized void cleanup(BufferedImage paneImage) {
closeDialogs();
PgenSession.getInstance().closePalette();
numberOfResources--;
if (numberOfResources != 0){
return; // not ready yet
@ -767,10 +777,12 @@ public class PgenResourceData extends AbstractResourceData implements
storeAllProducts();
// saveProducts(autoSaveFilename, multiSave);
if (PgenUtil.getPgenMode() == PgenMode.SINGLE)
if (PgenUtil.getPgenMode() == PgenMode.SINGLE){
PgenUtil.resetResourceData();
}
deactivatePgenTools();
}
/**

View file

@ -43,6 +43,7 @@ import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa;
* 04/11 #? B. Yin Re-factor IAttribute
* 11/12 #? J. Wu Added GFA
* 07/13 #? J. Wu Interpolate GFA's top/bottom
* 01/15 R5413 B. Yin Clear status when de-activate.
* </pre>
*
* @author S. Gilbert
@ -76,7 +77,20 @@ public class PgenInterpolationTool extends AbstractPgenDrawingTool {
verifySymbol = new Symbol(null, new Color[] { new Color(255,0,0) }, 1.0f, 1.0,
false, null, "Marker", "FILLED_BOX" );
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.tools.AbstractModalTool#deactivateTool()
*/
// @Override
public void deactivateTool() {
status = SELECT_STATUS.START;
super.deactivateTool();
}
/**
* Creates and returns the current mouse handler.
* @return