mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 12:35:22 +02:00
[192999] Terminal will crashes eclipse.exe when it received too many lines.
Now the limits in the terminal buffer lines preferences take effect
This commit is contained in:
parent
1aeb136766
commit
135be9c970
3 changed files with 55 additions and 9 deletions
|
@ -16,6 +16,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.internal.terminal.view;
|
package org.eclipse.tm.internal.terminal.view;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.Preferences;
|
||||||
import org.eclipse.jface.action.ActionContributionItem;
|
import org.eclipse.jface.action.ActionContributionItem;
|
||||||
import org.eclipse.jface.action.IMenuListener;
|
import org.eclipse.jface.action.IMenuListener;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
|
@ -106,18 +107,35 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
|
||||||
private SettingsStore fStore;
|
private SettingsStore fStore;
|
||||||
|
|
||||||
private CommandInputFieldWithHistory fCommandInputField;
|
private CommandInputFieldWithHistory fCommandInputField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listens to changes in the preferences
|
||||||
|
*/
|
||||||
|
private final IPropertyChangeListener fPreferenceListener=new IPropertyChangeListener() {
|
||||||
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
|
if(event.getProperty().equals(TerminalPreferencePage.PREF_LIMITOUTPUT)
|
||||||
|
|| event.getProperty().equals(TerminalPreferencePage.PREF_BUFFERLINES)) {
|
||||||
|
updatePreferences();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public TerminalView() {
|
public TerminalView() {
|
||||||
Logger
|
Logger
|
||||||
.log("==============================================================="); //$NON-NLS-1$
|
.log("==============================================================="); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
// TODO MSA
|
/**
|
||||||
// private void XXXXX() {
|
* Update the text limits from the preferences
|
||||||
// Preferences preferences = TerminalViewPlugin.getDefault().getPluginPreferences();
|
*/
|
||||||
// boolean bLimitOutput = preferences.getBoolean(TerminalPreferencePage.PREF_LIMITOUTPUT);
|
private void updatePreferences() {
|
||||||
// int bufferLineLimit = preferences.getInt(TerminalPreferencePage.PREF_BUFFERLINES);
|
Preferences preferences = TerminalViewPlugin.getDefault().getPluginPreferences();
|
||||||
//
|
boolean limitOutput = preferences.getBoolean(TerminalPreferencePage.PREF_LIMITOUTPUT);
|
||||||
// }
|
int bufferLineLimit = preferences.getInt(TerminalPreferencePage.PREF_BUFFERLINES);
|
||||||
|
if(!limitOutput)
|
||||||
|
bufferLineLimit=-1;
|
||||||
|
fCtlTerminal.setBufferLineLimit(bufferLineLimit);
|
||||||
|
|
||||||
|
}
|
||||||
// TerminalTarget interface
|
// TerminalTarget interface
|
||||||
public void setState(final TerminalState state) {
|
public void setState(final TerminalState state) {
|
||||||
Runnable runnable=new Runnable() {
|
Runnable runnable=new Runnable() {
|
||||||
|
@ -382,12 +400,11 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
|
||||||
onTerminalStatus();
|
onTerminalStatus();
|
||||||
onTerminalFontChanged();
|
onTerminalFontChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
Logger.log("entered."); //$NON-NLS-1$
|
Logger.log("entered."); //$NON-NLS-1$
|
||||||
|
|
||||||
setPartName("Terminal"); //$NON-NLS-1$
|
setPartName("Terminal"); //$NON-NLS-1$
|
||||||
|
TerminalViewPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPreferenceListener);
|
||||||
|
|
||||||
JFaceResources.getFontRegistry().removeListener(fPropertyChangeHandler);
|
JFaceResources.getFontRegistry().removeListener(fPropertyChangeHandler);
|
||||||
MenuManager menuMgr = getEditMenuManager();
|
MenuManager menuMgr = getEditMenuManager();
|
||||||
|
@ -399,6 +416,7 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
|
||||||
menu.removeMenuListener(fMenuHandlerEdit);
|
menu.removeMenuListener(fMenuHandlerEdit);
|
||||||
|
|
||||||
fCtlTerminal.disposeTerminal();
|
fCtlTerminal.disposeTerminal();
|
||||||
|
super.dispose();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Passing the focus request to the viewer's control.
|
* Passing the focus request to the viewer's control.
|
||||||
|
@ -420,6 +438,9 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
|
||||||
fCtlTerminal.setConnector(connectors[i]);
|
fCtlTerminal.setConnector(connectors[i]);
|
||||||
}
|
}
|
||||||
setCommandInputField("true".equals(fStore.get(STORE_HAS_COMMAND_INPUT_FIELD))); //$NON-NLS-1$
|
setCommandInputField("true".equals(fStore.get(STORE_HAS_COMMAND_INPUT_FIELD))); //$NON-NLS-1$
|
||||||
|
updatePreferences();
|
||||||
|
TerminalViewPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPreferenceListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveSettings(ITerminalConnectorInfo connector) {
|
private void saveSettings(ITerminalConnectorInfo connector) {
|
||||||
|
|
|
@ -60,4 +60,17 @@ public interface ITerminalViewControl {
|
||||||
* @return null or the current input field
|
* @return null or the current input field
|
||||||
*/
|
*/
|
||||||
ICommandInputField getCommandInputField();
|
ICommandInputField getCommandInputField();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the maximum number of lines to display
|
||||||
|
* in the terminal view. -1 means unlimited.
|
||||||
|
*/
|
||||||
|
public int getBufferLineLimit();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bufferLineLimit the maximum number of lines to show
|
||||||
|
* in the terminal view. -1 means unlimited.
|
||||||
|
*/
|
||||||
|
public void setBufferLineLimit(int bufferLineLimit);
|
||||||
|
|
||||||
}
|
}
|
|
@ -844,4 +844,16 @@ public class TerminalControl implements ITerminalControlForText, ITerminalContro
|
||||||
fCommandInputField.createControl(fWndParent, this);
|
fCommandInputField.createControl(fWndParent, this);
|
||||||
fWndParent.layout(true);
|
fWndParent.layout(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBufferLineLimit() {
|
||||||
|
if(getTerminalText().isLimitOutput())
|
||||||
|
return getTerminalText().getBufferLineLimit();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBufferLineLimit(int bufferLineLimit) {
|
||||||
|
getTerminalText().setLimitOutput(bufferLineLimit!=-1);
|
||||||
|
getTerminalText().setBufferLineLimit(bufferLineLimit);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue