Omaha #4588 - Fixed Insert/Overwrite issue.

Former-commit-id: 4f2ba806562a15a2efa8c00ce79ab8623b6c2c34
This commit is contained in:
Slav Korolev 2015-06-26 10:13:36 -04:00
parent ceb159f889
commit 819a164ffa
2 changed files with 10 additions and 90 deletions

View file

@ -25,7 +25,6 @@ import java.util.HashMap;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ExtendedModifyEvent;
import org.eclipse.swt.custom.ExtendedModifyListener;
import org.eclipse.swt.custom.ST;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.events.DisposeEvent;
@ -75,6 +74,7 @@ import com.raytheon.viz.aviation.resource.ResourceConfigMgr.ResourceTag;
* 1/17/2011 7782 rferrel Added qcSkipCheck to mimic A1.
* 3/18/2011 7888 rferrel Added getLargeTF method.
* 02/19/2014 16980 zhao added getter and setter for the Alt flag
* 06/27/2015 4588 skorolev Removed unnecessary insert toggle.
*
* </pre>
*
@ -380,22 +380,6 @@ public class EditorTafTabComp extends Composite {
createCaretImage(insertWidth, size.y);
caret.setImage(caretImage);
tafEditorTxt.setCaret(caret);
/*
* NOTE:
*
* The following code sets the TOGGLE_OVERWRITE for the text editor in
* the editor tabs. In the TafViewerEditorDlg, after the controls are
* initialized it is also set (if insert is false). Removing this code
* or the code in the TafViewerEditorDlg will cause the text editor
* control to not insert/overwrite properly. I do not understand why
* this is but that is why I am documenting this. This may be fixed in
* the future. --- L. Venable
*/
if (configMgr.getResourceAsBoolean(ResourceTag.Insert) == false) {
tafEditorTxt.invokeAction(ST.TOGGLE_OVERWRITE);
}
tafEditorTxt.addMouseListener(new MouseAdapter() {
@Override
@ -1370,11 +1354,11 @@ public class EditorTafTabComp extends Composite {
corRdo.setEnabled(editable);
}
public boolean getAlt() {
return alt;
}
public boolean getAlt() {
return alt;
}
public void setAlt(boolean b) {
alt = b;
}
public void setAlt(boolean b) {
alt = b;
}
}

View file

@ -52,7 +52,6 @@ import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.MouseAdapter;
@ -243,6 +242,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 12/02/2014 #15007 zhao Added restoreFrom() for the "Restore From..." menu option
* 04/07/2015 17332 zhao Added code to handle case of "Cancel" in "Restore From..."
* 06/23/2015 2282 skorolev Corrected "CLEAR" case in updateSettings.
* 06/26/2015 4588 skorolev Fixed Insert/Overwrite issue.
*
* </pre>
*
@ -428,11 +428,6 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
*/
private Color fltCatFontColor;
/**
* Flag indicating if the editor is in overwrite mode.
*/
private boolean overwriteMode = false;
/**
* Indicator of viewer tab selected.
*/
@ -581,12 +576,6 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
return;
}
// If the disposeOnExit is true then return since this dialog
// will be modal and we can't prevent the dialog from disposing.
// if (disposeOnExit == true) {
// return;
// }
// Block the disposal of this dialog.
hideDialog();
event.doit = false;
@ -632,27 +621,6 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
// Initialize all of the controls and layouts
initializeComponents();
/*
* NOTE:
*
* The following code sets the TOGGLE_OVERWRITE for the text editors in
* the editor tabs. In the EditorTafTabComp, when the text controls are
* created it is also set (if insert is false). Removing this code or
* the code in the EditorTafTabComp will cause the text editor control
* to not insert/overwrite properly. I do not understand why this is but
* that is why I am documenting this. This may be fixed in the future.
* --- L. Venable
*/
if (configMgr.getResourceAsBoolean(ResourceTag.Insert) == false) {
for (TabItem editTafTabItem : editorTafTabs) {
EditorTafTabComp tafTabComp = (EditorTafTabComp) editTafTabItem
.getControl();
tafTabComp.getTextEditorControl().invokeAction(
ST.TOGGLE_OVERWRITE);
}
}
confirmSend = configMgr.getDataAsBoolean(ResourceTag.ConfirmSend);
disallowSend = configMgr.getDataAsString(ResourceTag.DisallowSend);
}
@ -1117,8 +1085,6 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
printMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
// PrintDialog pd = new PrintDialog(shell);
// pd.open();
printAllText();
}
});
@ -2349,7 +2315,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
guidanceViewerFolder = new TabFolder(guidanceViewerComp, SWT.NONE);
guidanceViewerFolder.setLayoutData(gd);
guidanceViewerFolder.addSelectionListener(new SelectionListener() {
guidanceViewerFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@ -2371,12 +2337,6 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
currentTab.markTextAsUpdating();
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// TODO Auto-generated method stub
System.out.println("default selection listener event: " + e);
}
});
configMgr.setDefaultColors(guidanceViewerFolder);
@ -2871,30 +2831,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
public void pasteText() {
if (tabFolder.getSelectionIndex() != VIEWER_TAB_SELECTED) {
// Assume editorTafTabComp is for the active tab.
if (overwriteMode == false) {
editorTafTabComp.getTextEditorControl().paste();
} else if (overwriteMode == true
&& editorTafTabComp.getTextEditorControl().getCaretOffset() < editorTafTabComp
.getTextEditorControl().getCharCount()) {
editorTafTabComp.getTextEditorControl().replaceTextRange(
editorTafTabComp.getTextEditorControl()
.getCaretOffset(),
((String) (clipboard).getContents(TextTransfer
.getInstance())).length(),
(String) (clipboard).getContents(TextTransfer
.getInstance()));
editorTafTabComp.getTextEditorControl()
.setCaretOffset(
editorTafTabComp.getTextEditorControl()
.getCaretOffset()
+ ((String) (clipboard)
.getContents(TextTransfer
.getInstance()))
.length());
}
editorTafTabComp.getTextEditorControl().paste();
}
}
@ -3535,7 +3472,6 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
// Change the state of the insert check
insertChk.setSelection(!(insertChk.getSelection()));
}
// Loop and set all of the editors to the update insert state
for (TabItem editTafTabItem : editorTafTabs) {
EditorTafTabComp tafTabComp = (EditorTafTabComp) editTafTabItem