Issue #2322 - fixed independent perspective issue.
Former-commit-id:47b8d496ae
[formerly 09d68a9c912083738e979b84cf54b138b9624d1b] Former-commit-id:e09ae6a520
This commit is contained in:
parent
85d3dc0567
commit
b023452bc1
1 changed files with 53 additions and 25 deletions
|
@ -225,6 +225,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* 11/05/2012 15477 zhao Trim blank lines in text in Editor when check Syntax
|
||||
* 01/09/2013 15528 zhao Modified saveFile() and restoreFile()
|
||||
* 08/09/2013 2033 mschenke Switched File.separator to IPathManager.SEPARATOR
|
||||
* 04Sep2013 #2322 lvenable Added CAVE style so this dialog is perspective independent
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -542,7 +543,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
|||
public TafViewerEditorDlg(Shell parent, List<String> stationList,
|
||||
int caveStyle) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MODELESS, caveStyle
|
||||
| CAVE.DO_NOT_BLOCK);
|
||||
| CAVE.DO_NOT_BLOCK | CAVE.PERSPECTIVE_INDEPENDENT);
|
||||
|
||||
this.stationList = stationList;
|
||||
|
||||
|
@ -1850,8 +1851,11 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
|||
String bbb = editorTafTabComp.getBBB();
|
||||
String type;
|
||||
|
||||
if (ti.getText().equals(tabFillText) || editorTafTabComp.getTextEditorControl().getText().trim().length() == 0) {
|
||||
MessageBox questionMB = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK );
|
||||
if (ti.getText().equals(tabFillText)
|
||||
|| editorTafTabComp.getTextEditorControl().getText()
|
||||
.trim().length() == 0) {
|
||||
MessageBox questionMB = new MessageBox(shell,
|
||||
SWT.ICON_WARNING | SWT.OK);
|
||||
questionMB.setText("Save TAF");
|
||||
questionMB.setMessage("Cannot save Empty TAF!");
|
||||
questionMB.open();
|
||||
|
@ -2286,7 +2290,8 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
|||
private void saveFile(String filename) {
|
||||
String tempTafPath = "aviation/tmp/";
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext context = pm.getContext(LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
|
||||
LocalizationContext context = pm.getContext(
|
||||
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
|
||||
String path = pm.getFile(context, tempTafPath).getAbsolutePath();
|
||||
String filepath = null;
|
||||
|
||||
|
@ -2306,14 +2311,17 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
|||
if (filepath != null) {
|
||||
try {
|
||||
setWaitCursor(true);
|
||||
String fname = tempTafPath + filepath.substring(filepath.lastIndexOf('/') + 1);
|
||||
String fname = tempTafPath
|
||||
+ filepath.substring(filepath.lastIndexOf('/') + 1);
|
||||
LocalizationFile lFile = pm.getLocalizationFile(context, fname);
|
||||
File file = lFile.getFile();
|
||||
|
||||
if (filename == null && file.exists()) {
|
||||
MessageBox questionMB = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
|
||||
MessageBox questionMB = new MessageBox(shell,
|
||||
SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
|
||||
questionMB.setText("Save TAF");
|
||||
questionMB.setMessage("File already exists. Do you want to overwrite it?");
|
||||
questionMB
|
||||
.setMessage("File already exists. Do you want to overwrite it?");
|
||||
int result = questionMB.open();
|
||||
|
||||
if (result == SWT.CANCEL) {
|
||||
|
@ -2338,14 +2346,17 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
|||
setMessageStatusOK("File " + filepath + " saved successfully.");
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
setMessageStatusError("Unable to open file " + filepath + " for writing.");
|
||||
setMessageStatusError("Unable to open file " + filepath
|
||||
+ " for writing.");
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
setMessageStatusError("An IOException occured while saving file " + filepath);
|
||||
setMessageStatusError("An IOException occured while saving file "
|
||||
+ filepath);
|
||||
} catch (LocalizationOpFailedException e) {
|
||||
e.printStackTrace();
|
||||
setMessageStatusError("A LocalizationOpFailedException occured while saving file " + filepath);
|
||||
setMessageStatusError("A LocalizationOpFailedException occured while saving file "
|
||||
+ filepath);
|
||||
} finally {
|
||||
setWaitCursor(false);
|
||||
}
|
||||
|
@ -2362,10 +2373,14 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
|||
tabFolder.setSelection(editorTab);
|
||||
// Use the current tab
|
||||
if (!(ti.getText().equals(tabFillText))) {
|
||||
if (!editorTafTabComp.isTafSent() && !editorTafTabComp.getTextEditorControl().getText().trim().equals("")) {
|
||||
MessageBox questionMB = new MessageBox(shell,SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
|
||||
if (!editorTafTabComp.isTafSent()
|
||||
&& !editorTafTabComp.getTextEditorControl()
|
||||
.getText().trim().equals("")) {
|
||||
MessageBox questionMB = new MessageBox(shell,
|
||||
SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
|
||||
questionMB.setText("Restore TAF");
|
||||
questionMB.setMessage("Forecast not saved. Do you want to continue?");
|
||||
questionMB
|
||||
.setMessage("Forecast not saved. Do you want to continue?");
|
||||
int result = questionMB.open();
|
||||
|
||||
if (result == SWT.CANCEL) {
|
||||
|
@ -2376,8 +2391,10 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
|||
|
||||
String tempTafPath = "aviation/tmp/";
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext context = pm.getContext(LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
|
||||
String path = pm.getFile(context, tempTafPath).getAbsolutePath();
|
||||
LocalizationContext context = pm.getContext(
|
||||
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
|
||||
String path = pm.getFile(context, tempTafPath)
|
||||
.getAbsolutePath();
|
||||
String filepath = null;
|
||||
|
||||
File tmp = new File(path);
|
||||
|
@ -2398,8 +2415,11 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
|||
|
||||
try {
|
||||
setWaitCursor(true);
|
||||
String fname = tempTafPath + filepath.substring(filepath.lastIndexOf('/') + 1);
|
||||
LocalizationFile lFile = pm.getLocalizationFile(context, fname);
|
||||
String fname = tempTafPath
|
||||
+ filepath
|
||||
.substring(filepath.lastIndexOf('/') + 1);
|
||||
LocalizationFile lFile = pm.getLocalizationFile(
|
||||
context, fname);
|
||||
File file = lFile.getFile();
|
||||
FileReader reader = new FileReader(file);
|
||||
BufferedReader input = new BufferedReader(reader);
|
||||
|
@ -2416,17 +2436,20 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
|||
if (values.length != 3) {
|
||||
errorMsg = "parse error";
|
||||
contents.append(line);
|
||||
contents.append(System.getProperty("line.separator"));
|
||||
contents.append(System
|
||||
.getProperty("line.separator"));
|
||||
} else {
|
||||
editorTafTabComp.setWmoIdLbl(values[0].trim());
|
||||
editorTafTabComp.setWmoSiteLbl(values[1].trim());
|
||||
editorTafTabComp
|
||||
.setWmoSiteLbl(values[1].trim());
|
||||
editorTafTabComp.setLargeTF(values[2].trim());
|
||||
}
|
||||
}
|
||||
|
||||
while ((line = input.readLine()) != null) {
|
||||
contents.append(line);
|
||||
contents.append(System.getProperty("line.separator"));
|
||||
contents.append(System
|
||||
.getProperty("line.separator"));
|
||||
}
|
||||
|
||||
input.close();
|
||||
|
@ -2447,20 +2470,25 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
|||
}
|
||||
|
||||
ti.setText(icao + " " + bbb);
|
||||
editorTafTabComp.getTextEditorControl().setText(tafText);
|
||||
editorTafTabComp.getTextEditorControl()
|
||||
.setText(tafText);
|
||||
|
||||
if (editorTafTabComp.isTafSent()) {
|
||||
editorTafTabComp.updateTafSent(false);
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
setMessageStatusError("File " + filepath + " not found.");
|
||||
setMessageStatusError("File " + filepath
|
||||
+ " not found.");
|
||||
} catch (IOException e) {
|
||||
setMessageStatusError("An IOException occured while opening file " + filepath);
|
||||
setMessageStatusError("An IOException occured while opening file "
|
||||
+ filepath);
|
||||
} finally {
|
||||
if (errorMsg != null) {
|
||||
setMessageStatusError("File " + filepath + ": " + errorMsg);
|
||||
setMessageStatusError("File " + filepath + ": "
|
||||
+ errorMsg);
|
||||
} else {
|
||||
setMessageStatusOK("File " + filepath + " opened successfully.");
|
||||
setMessageStatusOK("File " + filepath
|
||||
+ " opened successfully.");
|
||||
}
|
||||
setWaitCursor(false);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue