Issue #1287 Changes for non-blocking SampleSetDialog.
Change-Id: I6b3eab5386418f9303190892f1a746d63a82ce65 Former-commit-id:fd43dd779d
[formerly538ce87115
] [formerly8af2d4a404
] [formerlyaf299023e2
[formerly8af2d4a404
[formerly 622b739d6e1352aacb96b7dd0f797f2b43fe5847]]] Former-commit-id:af299023e2
Former-commit-id: 468c640cce3635e4a9ef26c218acf616256d3b56 [formerly3eb28edd6c
] Former-commit-id:463e648808
This commit is contained in:
parent
12bc71a4ff
commit
933793a41d
4 changed files with 165 additions and 141 deletions
|
@ -35,10 +35,9 @@ import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.viz.gfe.Activator;
|
|
||||||
import com.raytheon.viz.gfe.constants.StatusConstants;
|
|
||||||
import com.raytheon.viz.gfe.core.DataManager;
|
import com.raytheon.viz.gfe.core.DataManager;
|
||||||
import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
||||||
|
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action for launching delete samples dialog.
|
* Action for launching delete samples dialog.
|
||||||
|
@ -49,6 +48,7 @@ import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 7, 2008 Eric Babin Initial Creation
|
* Mar 7, 2008 Eric Babin Initial Creation
|
||||||
* 22JUL2008 #1275. Eric Babin Remove inadvertent dispose on parent shell.
|
* 22JUL2008 #1275. Eric Babin Remove inadvertent dispose on parent shell.
|
||||||
|
* Oct 24, 2012 #1287 rferrel Changes for non-blocking SampleSetDialog.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -57,7 +57,10 @@ import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ShowDeleteSampleSetDialog extends AbstractHandler {
|
public class ShowDeleteSampleSetDialog extends AbstractHandler {
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(ShowDeleteSampleSetDialog.class);
|
private final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(ShowDeleteSampleSetDialog.class);
|
||||||
|
|
||||||
|
private SampleSetDialog dialog;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
@ -68,44 +71,65 @@ public class ShowDeleteSampleSetDialog extends AbstractHandler {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
ArrayList<SampleId> sampleIdList = DataManager.getCurrentInstance()
|
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
|
||||||
.getSampleSetManager().getInventoryAsList();
|
ArrayList<SampleId> sampleIdList = DataManager.getCurrentInstance()
|
||||||
|
.getSampleSetManager().getInventoryAsList();
|
||||||
|
|
||||||
Collections.sort(sampleIdList, new Comparator<SampleId>() {
|
Collections.sort(sampleIdList, new Comparator<SampleId>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(SampleId o1, SampleId o2) {
|
public int compare(SampleId o1, SampleId o2) {
|
||||||
return o1.getName().compareTo(o2.getName());
|
return o1.getName().compareTo(o2.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
.getShell();
|
.getShell();
|
||||||
|
|
||||||
SampleSetDialog dialog = new SampleSetDialog(shell, sampleIdList,
|
dialog = new SampleSetDialog(shell, sampleIdList,
|
||||||
SampleSetDialog.DELETE);
|
SampleSetDialog.DELETE);
|
||||||
|
|
||||||
dialog.setBlockOnOpen(true);
|
dialog.setBlockOnOpen(false);
|
||||||
dialog.open();
|
dialog.setCloseCallback(new ICloseCallback() {
|
||||||
if (dialog.getReturnCode() != Window.CANCEL
|
|
||||||
|
@Override
|
||||||
|
public void dialogClosed(Object returnValue) {
|
||||||
|
if (returnValue instanceof Integer) {
|
||||||
|
int returnCode = (Integer) returnValue;
|
||||||
|
doDialogClose(returnCode);
|
||||||
|
}
|
||||||
|
dialog = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.open();
|
||||||
|
} else {
|
||||||
|
dialog.bringToTop();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doDialogClose(int returnCode) {
|
||||||
|
if (returnCode != Window.CANCEL
|
||||||
&& dialog.getSelectedSampleIdIndexes() != null) {
|
&& dialog.getSelectedSampleIdIndexes() != null) {
|
||||||
|
ArrayList<SampleId> sampleIdList = dialog.getSamples();
|
||||||
SampleId id = sampleIdList
|
SampleId id = sampleIdList
|
||||||
.get(dialog.getSelectedSampleIdIndexes()[0]);
|
.get(dialog.getSelectedSampleIdIndexes()[0]);
|
||||||
|
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
|
.getShell();
|
||||||
|
|
||||||
if (MessageDialog.openConfirm(shell, "Delete sample set",
|
if (MessageDialog.openConfirm(shell, "Delete sample set",
|
||||||
"Delete selected sample set?")) {
|
"Delete selected sample set?")) {
|
||||||
if (DataManager.getCurrentInstance().getSampleSetManager()
|
if (DataManager.getCurrentInstance().getSampleSetManager()
|
||||||
.deleteSampleSet(id)) {
|
.deleteSampleSet(id)) {
|
||||||
statusHandler.handle(Priority.EVENTA, id.getName()
|
statusHandler.handle(Priority.EVENTA, id.getName()
|
||||||
+ ", Sample set deleted successfully");
|
+ ", Sample set deleted successfully");
|
||||||
} else {
|
} else {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Error deleting sample set, " + id.getName());
|
"Error deleting sample set, " + id.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,14 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId;
|
import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId;
|
||||||
|
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.viz.gfe.GFEException;
|
import com.raytheon.viz.gfe.GFEException;
|
||||||
import com.raytheon.viz.gfe.core.DataManager;
|
import com.raytheon.viz.gfe.core.DataManager;
|
||||||
import com.raytheon.viz.gfe.core.ISampleSetManager;
|
import com.raytheon.viz.gfe.core.ISampleSetManager;
|
||||||
import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
||||||
|
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to launch sampele set dialog.
|
* Action to launch sampele set dialog.
|
||||||
|
@ -45,6 +49,7 @@ import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 7, 2008 Eric Babin Initial Creation
|
* Mar 7, 2008 Eric Babin Initial Creation
|
||||||
* Apr 9, 2009 1288 rjpeter Removed explicit refresh of SpatialDisplayManager.
|
* Apr 9, 2009 1288 rjpeter Removed explicit refresh of SpatialDisplayManager.
|
||||||
|
* Oct 24, 2012 1287 rferrel Changes for non-blocking SampleSetDialog.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -53,14 +58,12 @@ import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ShowLoadSampleSetDialog extends AbstractHandler {
|
public class ShowLoadSampleSetDialog extends AbstractHandler {
|
||||||
|
private final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(ShowLoadSampleSetDialog.class);
|
||||||
|
|
||||||
// SampleRenderable sample;
|
private SampleSetDialog dialog;
|
||||||
|
|
||||||
// public ShowLoadSampleSetDialog() {
|
private DataManager dm;
|
||||||
//
|
|
||||||
// super();
|
|
||||||
// this.sample = new SampleRenderable();
|
|
||||||
// }
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
@ -71,96 +74,80 @@ public class ShowLoadSampleSetDialog extends AbstractHandler {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
|
||||||
DataManager dm = DataManager.getCurrentInstance();
|
dm = DataManager.getCurrentInstance();
|
||||||
if (dm == null) {
|
if (dm == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
|
||||||
.getShell();
|
|
||||||
|
|
||||||
ArrayList<SampleId> sampleIdList = dm.getSampleSetManager()
|
|
||||||
.getInventoryAsList();
|
|
||||||
|
|
||||||
Collections.sort(sampleIdList, new Comparator<SampleId>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compare(SampleId o1, SampleId o2) {
|
|
||||||
return o1.getName().compareTo(o2.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
|
.getShell();
|
||||||
|
|
||||||
SampleSetDialog dialog = new SampleSetDialog(shell, sampleIdList,
|
ArrayList<SampleId> sampleIdList = dm.getSampleSetManager()
|
||||||
SampleSetDialog.LOAD);
|
.getInventoryAsList();
|
||||||
|
|
||||||
dialog.setBlockOnOpen(true);
|
Collections.sort(sampleIdList, new Comparator<SampleId>() {
|
||||||
dialog.open();
|
|
||||||
if (dialog.getReturnCode() != Window.CANCEL
|
@Override
|
||||||
&& dialog.getSelectedSampleIdIndexes() != null) {
|
public int compare(SampleId o1, SampleId o2) {
|
||||||
if (dialog.getReturnCode() == SampleSetDialog.OK) {
|
return o1.getName().compareTo(o2.getName());
|
||||||
if (dialog.getType() == SampleSetDialog.LOAD) {
|
|
||||||
for (int i = 0; i < dialog.getSelectedSampleIdIndexes().length; i++) {
|
|
||||||
SampleId id = sampleIdList.get(dialog
|
|
||||||
.getSelectedSampleIdIndexes()[i]);
|
|
||||||
try {
|
|
||||||
dm.getSampleSetManager().loadSampleSet(id,
|
|
||||||
ISampleSetManager.SampleSetLoadMode.ADD);
|
|
||||||
} catch (GFEException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (dialog.getType() == SampleSetDialog.SAVE) {
|
|
||||||
dm.getSampleSetManager().saveActiveSampleSet(
|
|
||||||
new SampleId(dialog.getSampleName()));
|
|
||||||
}
|
|
||||||
if (dialog.getType() == SampleSetDialog.DELETE) {
|
|
||||||
for (int i = 0; i < dialog.getSelectedSampleIdIndexes().length; i++) {
|
|
||||||
SampleId id = sampleIdList.get(dialog
|
|
||||||
.getSelectedSampleIdIndexes()[i]);
|
|
||||||
dm.getSampleSetManager().deleteSampleSet(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (dialog.getReturnCode() == SampleSetDialog.REMOVE) {
|
|
||||||
for (int i = 0; i < dialog.getSelectedSampleIdIndexes().length; i++) {
|
|
||||||
SampleId id = sampleIdList.get(dialog
|
|
||||||
.getSelectedSampleIdIndexes()[i]);
|
|
||||||
try {
|
|
||||||
dm.getSampleSetManager().loadSampleSet(id,
|
|
||||||
ISampleSetManager.SampleSetLoadMode.REMOVE);
|
|
||||||
} catch (GFEException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (dialog.getReturnCode() == SampleSetDialog.REPLACE) {
|
});
|
||||||
for (int i = 0; i < dialog.getSelectedSampleIdIndexes().length; i++) {
|
|
||||||
SampleId id = sampleIdList.get(dialog
|
dialog = new SampleSetDialog(shell, sampleIdList,
|
||||||
.getSelectedSampleIdIndexes()[i]);
|
SampleSetDialog.LOAD);
|
||||||
try {
|
|
||||||
dm.getSampleSetManager().loadSampleSet(id,
|
dialog.setBlockOnOpen(false);
|
||||||
ISampleSetManager.SampleSetLoadMode.REPLACE);
|
dialog.setCloseCallback(new ICloseCallback() {
|
||||||
} catch (GFEException e) {
|
|
||||||
e.printStackTrace();
|
@Override
|
||||||
|
public void dialogClosed(Object returnValue) {
|
||||||
|
if (returnValue instanceof Integer) {
|
||||||
|
int returnCode = (Integer) returnValue;
|
||||||
|
doDialogClosed(returnCode);
|
||||||
}
|
}
|
||||||
|
dialog = null;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
dialog.open();
|
||||||
|
} else {
|
||||||
|
dialog.bringToTop();
|
||||||
}
|
}
|
||||||
// refresh();
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
private void doDialogClosed(int returnCode) {
|
||||||
* (non-Javadoc)
|
if (returnCode != Window.CANCEL
|
||||||
*
|
&& dialog.getSelectedSampleIdIndexes() != null) {
|
||||||
* @see com.raytheon.viz.ui.tools.AbstractTool#refresh()
|
ArrayList<SampleId> sampleIdList = dialog.getSamples();
|
||||||
*/
|
ISampleSetManager.SampleSetLoadMode mode = null;
|
||||||
// @Override
|
switch (returnCode) {
|
||||||
// protected void refresh() {
|
case SampleSetDialog.OK:
|
||||||
// IEditorPart part = VizApp.getCurrentEditor();
|
mode = ISampleSetManager.SampleSetLoadMode.ADD;
|
||||||
// if (part instanceof AbstractEditor) {
|
break;
|
||||||
// ((AbstractEditor) part).refresh();
|
case SampleSetDialog.REMOVE:
|
||||||
// }
|
mode = ISampleSetManager.SampleSetLoadMode.REMOVE;
|
||||||
// }
|
break;
|
||||||
|
case SampleSetDialog.REPLACE:
|
||||||
|
mode = ISampleSetManager.SampleSetLoadMode.REPLACE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"Load unknow return code: " + returnCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int index : dialog.getSelectedSampleIdIndexes()) {
|
||||||
|
SampleId id = sampleIdList.get(index);
|
||||||
|
try {
|
||||||
|
dm.getSampleSetManager().loadSampleSet(id, mode);
|
||||||
|
} catch (GFEException e) {
|
||||||
|
statusHandler.handle(Priority.ERROR,
|
||||||
|
"Load failed for mode: " + mode.toString(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Comparator;
|
||||||
import org.eclipse.core.commands.AbstractHandler;
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.core.commands.ExecutionException;
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
import org.eclipse.jface.window.Window;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
|
@ -34,6 +33,7 @@ import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId;
|
||||||
import com.raytheon.viz.gfe.core.DataManager;
|
import com.raytheon.viz.gfe.core.DataManager;
|
||||||
import com.raytheon.viz.gfe.core.ISampleSetManager;
|
import com.raytheon.viz.gfe.core.ISampleSetManager;
|
||||||
import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
||||||
|
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to show save sample set dialog.
|
* Action to show save sample set dialog.
|
||||||
|
@ -43,6 +43,7 @@ import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 7, 2008 Eric Babin Initial Creation
|
* Mar 7, 2008 Eric Babin Initial Creation
|
||||||
|
* Oct 24, 2012 1287 rferrel Changes for non-blocking SampleSetDialog.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -51,54 +52,62 @@ import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ShowSaveSampleSetDialog extends AbstractHandler {
|
public class ShowSaveSampleSetDialog extends AbstractHandler {
|
||||||
|
private SampleSetDialog dialog;
|
||||||
|
|
||||||
|
private ISampleSetManager sampleMgr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
|
* @see
|
||||||
|
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
|
||||||
|
* .ExecutionEvent)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
|
||||||
|
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
|
.getShell();
|
||||||
|
|
||||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
sampleMgr = DataManager.getCurrentInstance().getSampleSetManager();
|
||||||
.getShell();
|
|
||||||
|
|
||||||
ISampleSetManager sampleMgr = DataManager.getCurrentInstance()
|
ArrayList<SampleId> sampleIdList = sampleMgr.getInventoryAsList();
|
||||||
.getSampleSetManager();
|
Collections.sort(sampleIdList, new Comparator<SampleId>() {
|
||||||
|
|
||||||
ArrayList<SampleId> sampleIdList = sampleMgr.getInventoryAsList();
|
@Override
|
||||||
Collections.sort(sampleIdList, new Comparator<SampleId>() {
|
public int compare(SampleId o1, SampleId o2) {
|
||||||
|
return o1.getName().compareTo(o2.getName());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
});
|
||||||
public int compare(SampleId o1, SampleId o2) {
|
|
||||||
return o1.getName().compareTo(o2.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
dialog = new SampleSetDialog(shell, sampleIdList,
|
||||||
|
SampleSetDialog.SAVE);
|
||||||
|
|
||||||
SampleSetDialog dialog = new SampleSetDialog(shell, sampleIdList,
|
dialog.setBlockOnOpen(false);
|
||||||
SampleSetDialog.SAVE);
|
dialog.setCloseCallback(new ICloseCallback() {
|
||||||
|
|
||||||
dialog.setBlockOnOpen(true);
|
@Override
|
||||||
dialog.open();
|
public void dialogClosed(Object returnValue) {
|
||||||
|
if (returnValue instanceof Integer) {
|
||||||
if (dialog.getReturnCode() != Window.CANCEL
|
int returnCode = (Integer) returnValue;
|
||||||
&& dialog.getSelectedSampleIdIndexes() != null) {
|
doDialogClose(returnCode);
|
||||||
|
|
||||||
if (dialog.getReturnCode() == SampleSetDialog.OK) {
|
|
||||||
if (dialog.getType() == SampleSetDialog.LOAD) {
|
|
||||||
} else if (dialog.getType() == SampleSetDialog.SAVE) {
|
|
||||||
if (dialog.getSampleName() != null) {
|
|
||||||
sampleMgr.saveActiveSampleSet(new SampleId(dialog
|
|
||||||
.getSampleName()));
|
|
||||||
}
|
}
|
||||||
|
dialog = null;
|
||||||
}
|
}
|
||||||
if (dialog.getType() == SampleSetDialog.DELETE) {
|
});
|
||||||
}
|
dialog.open();
|
||||||
} else if (dialog.getReturnCode() == SampleSetDialog.REMOVE) {
|
} else {
|
||||||
} else if (dialog.getReturnCode() == SampleSetDialog.REPLACE) {
|
dialog.bringToTop();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doDialogClose(int returnCode) {
|
||||||
|
if ((returnCode == SampleSetDialog.OK)
|
||||||
|
&& (dialog.getSelectedSampleIdIndexes() != null)
|
||||||
|
&& (dialog.getSampleName() != null)) {
|
||||||
|
sampleMgr.saveActiveSampleSet(new SampleId(dialog.getSampleName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 7, 2008 Eric Babin Initial Creation
|
* Mar 7, 2008 Eric Babin Initial Creation
|
||||||
|
* Oct 24, 2012 1287 rferrel Code clean up for non-blocking dialog.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -84,11 +85,11 @@ public class SampleSetDialog extends CaveJFACEDialog {
|
||||||
|
|
||||||
private int returnCode = OK;
|
private int returnCode = OK;
|
||||||
|
|
||||||
private int type = 1;
|
private int type = CANCEL;
|
||||||
|
|
||||||
public SampleSetDialog(Shell parent, ArrayList<SampleId> samples, int type) {
|
public SampleSetDialog(Shell parent, ArrayList<SampleId> samples, int type) {
|
||||||
super(parent);
|
super(parent);
|
||||||
this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE);
|
this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS);
|
||||||
this.samples = samples;
|
this.samples = samples;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
@ -221,4 +222,7 @@ public class SampleSetDialog extends CaveJFACEDialog {
|
||||||
this.sampleName = sampleName;
|
this.sampleName = sampleName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<SampleId> getSamples() {
|
||||||
|
return samples;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue