mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-09 10:05:24 +02:00
[cleanup] format
This commit is contained in:
parent
b154ebe580
commit
cc3a724d41
1 changed files with 105 additions and 108 deletions
|
@ -53,20 +53,17 @@ import org.eclipse.ui.PlatformUI;
|
||||||
* Setting an error message hides a currently displayed message until
|
* Setting an error message hides a currently displayed message until
|
||||||
* <code>clearErrorMessage</code> is called.
|
* <code>clearErrorMessage</code> is called.
|
||||||
*/
|
*/
|
||||||
public class SystemMessageLine
|
public class SystemMessageLine extends Composite implements ISystemMessageLine {
|
||||||
extends Composite
|
|
||||||
implements ISystemMessageLine
|
|
||||||
{
|
|
||||||
|
|
||||||
private Button moreButton;
|
private Button moreButton;
|
||||||
private Label image;
|
private Label image;
|
||||||
private Text widget;
|
private Text widget;
|
||||||
private Stack messageStack = new Stack();
|
private Stack messageStack = new Stack();
|
||||||
private static final int ERROR = 3;
|
private static final int ERROR = 3;
|
||||||
private static final int WARNING = 2;
|
private static final int WARNING = 2;
|
||||||
private static final int INFO = 1;
|
private static final int INFO = 1;
|
||||||
private static final int NONE = 0;
|
private static final int NONE = 0;
|
||||||
|
|
||||||
private abstract class MyMessage {
|
private abstract class MyMessage {
|
||||||
/**
|
/**
|
||||||
* @return The Image of the message based on its type.
|
* @return The Image of the message based on its type.
|
||||||
|
@ -74,61 +71,60 @@ public class SystemMessageLine
|
||||||
Image getImage() {
|
Image getImage() {
|
||||||
int type = getType();
|
int type = getType();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ERROR:
|
case ERROR:
|
||||||
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_ERROR);
|
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_ERROR);
|
||||||
case WARNING:
|
case WARNING:
|
||||||
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_WARNING);
|
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_WARNING);
|
||||||
case INFO:
|
case INFO:
|
||||||
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_INFO);
|
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_INFO);
|
||||||
default:
|
default:
|
||||||
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_INFO);
|
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_INFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Color getColor() {
|
Color getColor() {
|
||||||
int type = getType();
|
int type = getType();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ERROR:
|
case ERROR:
|
||||||
return getColor(ISystemThemeConstants.MESSAGE_ERROR_COLOR);
|
return getColor(ISystemThemeConstants.MESSAGE_ERROR_COLOR);
|
||||||
case WARNING:
|
case WARNING:
|
||||||
return getColor(ISystemThemeConstants.MESSAGE_WARNING_COLOR);
|
return getColor(ISystemThemeConstants.MESSAGE_WARNING_COLOR);
|
||||||
case INFO:
|
case INFO:
|
||||||
return getColor(ISystemThemeConstants.MESSAGE_INFORMATION_COLOR);
|
return getColor(ISystemThemeConstants.MESSAGE_INFORMATION_COLOR);
|
||||||
default:
|
default:
|
||||||
return getColor(ISystemThemeConstants.MESSAGE_INFORMATION_COLOR);
|
return getColor(ISystemThemeConstants.MESSAGE_INFORMATION_COLOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param symbolicName the name of the color in the current theme's color registry.
|
* @param symbolicName the name of the color in the current theme's color registry.
|
||||||
* @return an SWT Color or null.
|
* @return an SWT Color or null.
|
||||||
*/
|
*/
|
||||||
private Color getColor(String symbolicName)
|
private Color getColor(String symbolicName) {
|
||||||
{
|
|
||||||
ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
|
ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
|
||||||
Color result = registry.get(symbolicName);
|
Color result = registry.get(symbolicName);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isError() {
|
boolean isError() {
|
||||||
return getType() == ERROR;
|
return getType() == ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The id of the message or null if there is none.
|
* @return The id of the message or null if there is none.
|
||||||
*/
|
*/
|
||||||
abstract String getID();
|
abstract String getID();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The full text of the message to be shown in the message line.
|
* @return The full text of the message to be shown in the message line.
|
||||||
*/
|
*/
|
||||||
abstract String getText();
|
abstract String getText();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The tooltip for the message, to be shown when hovering over the message line.
|
* @return The tooltip for the message, to be shown when hovering over the message line.
|
||||||
*/
|
*/
|
||||||
abstract String getTooltip();
|
abstract String getTooltip();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if there is more text that can be shown in a message details pane.
|
* @return true if there is more text that can be shown in a message details pane.
|
||||||
*/
|
*/
|
||||||
|
@ -138,25 +134,25 @@ public class SystemMessageLine
|
||||||
* @return The SystemMessage version of the message.
|
* @return The SystemMessage version of the message.
|
||||||
*/
|
*/
|
||||||
abstract SystemMessage toSystemMessage();
|
abstract SystemMessage toSystemMessage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The type of the message. One of NONE, INFO, WARNING, or ERROR.
|
* @return The type of the message. One of NONE, INFO, WARNING, or ERROR.
|
||||||
*/
|
*/
|
||||||
abstract int getType();
|
abstract int getType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The data values associated with this message.
|
* @return The data values associated with this message.
|
||||||
*/
|
*/
|
||||||
abstract Object[] getData();
|
abstract Object[] getData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the message resulted form a strange occurence.
|
* @return true if the message resulted form a strange occurence.
|
||||||
*/
|
*/
|
||||||
abstract boolean isStrange();
|
abstract boolean isStrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MySystemMessage extends MyMessage {
|
private class MySystemMessage extends MyMessage {
|
||||||
|
|
||||||
private SystemMessage message = null;
|
private SystemMessage message = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -172,7 +168,7 @@ public class SystemMessageLine
|
||||||
SystemMessage toSystemMessage() {
|
SystemMessage toSystemMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getID()
|
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getID()
|
||||||
*/
|
*/
|
||||||
|
@ -193,7 +189,7 @@ public class SystemMessageLine
|
||||||
String getTooltip() {
|
String getTooltip() {
|
||||||
return message.getFullMessageID() + ": " + getText();
|
return message.getFullMessageID() + ": " + getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#hasMore()
|
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#hasMore()
|
||||||
*/
|
*/
|
||||||
|
@ -201,14 +197,14 @@ public class SystemMessageLine
|
||||||
String text2 = message.getLevelTwoText();
|
String text2 = message.getLevelTwoText();
|
||||||
return (text2 != null) && (text2.length() > 0);
|
return (text2 != null) && (text2.length() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#wasStrange()
|
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#wasStrange()
|
||||||
*/
|
*/
|
||||||
boolean isStrange() {
|
boolean isStrange() {
|
||||||
return message.getIndicator() == SystemMessage.UNEXPECTED;
|
return message.getIndicator() == SystemMessage.UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getData()
|
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getData()
|
||||||
*/
|
*/
|
||||||
|
@ -225,31 +221,32 @@ public class SystemMessageLine
|
||||||
int result = NONE;
|
int result = NONE;
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
switch (message.getIndicator()) {
|
switch (message.getIndicator()) {
|
||||||
case SystemMessage.COMPLETION:
|
case SystemMessage.COMPLETION:
|
||||||
case SystemMessage.INFORMATION:
|
case SystemMessage.INFORMATION:
|
||||||
case SystemMessage.INQUIRY:
|
case SystemMessage.INQUIRY:
|
||||||
result = INFO;
|
result = INFO;
|
||||||
break;
|
break;
|
||||||
case SystemMessage.ERROR:
|
case SystemMessage.ERROR:
|
||||||
case SystemMessage.UNEXPECTED:
|
case SystemMessage.UNEXPECTED:
|
||||||
result = ERROR;
|
result = ERROR;
|
||||||
break;
|
break;
|
||||||
case SystemMessage.WARNING:
|
case SystemMessage.WARNING:
|
||||||
result = WARNING;
|
result = WARNING;
|
||||||
break;
|
break;
|
||||||
default: result = NONE;
|
default:
|
||||||
|
result = NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MyImpromptuMessage extends MyMessage {
|
private class MyImpromptuMessage extends MyMessage {
|
||||||
|
|
||||||
private int type = NONE;
|
private int type = NONE;
|
||||||
private String text1 = "";
|
private String text1 = "";
|
||||||
private String text2 = null;
|
private String text2 = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type The type of the message.
|
* @param type The type of the message.
|
||||||
* @param text1 The first-level text of the message.
|
* @param text1 The first-level text of the message.
|
||||||
|
@ -258,7 +255,7 @@ public class SystemMessageLine
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.text1 = text1;
|
this.text1 = text1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type The type of the message.
|
* @param type The type of the message.
|
||||||
* @param text1 The first-level text of the message.
|
* @param text1 The first-level text of the message.
|
||||||
|
@ -269,7 +266,7 @@ public class SystemMessageLine
|
||||||
this.text1 = text1;
|
this.text1 = text1;
|
||||||
this.text2 = text2;
|
this.text2 = text2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#toSystemMessage()
|
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#toSystemMessage()
|
||||||
*/
|
*/
|
||||||
|
@ -278,57 +275,57 @@ public class SystemMessageLine
|
||||||
Object[] data = null;
|
Object[] data = null;
|
||||||
if (text2 == null) {
|
if (text2 == null) {
|
||||||
id = isError() ? ISystemMessages.MSG_GENERIC_E : ISystemMessages.MSG_GENERIC_I;
|
id = isError() ? ISystemMessages.MSG_GENERIC_E : ISystemMessages.MSG_GENERIC_I;
|
||||||
data = new Object[] {text1};
|
data = new Object[] { text1 };
|
||||||
} else {
|
} else {
|
||||||
id = isError() ? ISystemMessages.MSG_GENERIC_E_HELP : ISystemMessages.MSG_GENERIC_I_HELP;
|
id = isError() ? ISystemMessages.MSG_GENERIC_E_HELP : ISystemMessages.MSG_GENERIC_I_HELP;
|
||||||
data = new Object[] {text1, text2};
|
data = new Object[] { text1, text2 };
|
||||||
}
|
}
|
||||||
SystemMessage result = RSEUIPlugin.getPluginMessage(id, data);
|
SystemMessage result = RSEUIPlugin.getPluginMessage(id, data);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getID()
|
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getID()
|
||||||
*/
|
*/
|
||||||
String getID() {
|
String getID() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getText()
|
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getText()
|
||||||
*/
|
*/
|
||||||
String getText() {
|
String getText() {
|
||||||
return text1;
|
return text1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getTooltip()
|
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getTooltip()
|
||||||
*/
|
*/
|
||||||
String getTooltip() {
|
String getTooltip() {
|
||||||
return text1;
|
return text1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#hasMore()
|
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#hasMore()
|
||||||
*/
|
*/
|
||||||
boolean hasMore() {
|
boolean hasMore() {
|
||||||
return text2 != null;
|
return text2 != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#wasStrange()
|
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#wasStrange()
|
||||||
*/
|
*/
|
||||||
boolean isStrange() {
|
boolean isStrange() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getData()
|
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getData()
|
||||||
*/
|
*/
|
||||||
Object[] getData() {
|
Object[] getData() {
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getType()
|
* @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getType()
|
||||||
*/
|
*/
|
||||||
|
@ -336,12 +333,11 @@ public class SystemMessageLine
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new message line as a child of the given parent.
|
* Creates a new message line as a child of the given parent.
|
||||||
*/
|
*/
|
||||||
public SystemMessageLine(Composite parent)
|
public SystemMessageLine(Composite parent) {
|
||||||
{
|
|
||||||
super(parent, SWT.NONE);
|
super(parent, SWT.NONE);
|
||||||
GridLayout layout = new GridLayout();
|
GridLayout layout = new GridLayout();
|
||||||
layout.numColumns = 3;
|
layout.numColumns = 3;
|
||||||
|
@ -350,15 +346,15 @@ public class SystemMessageLine
|
||||||
layout.marginHeight = 2;
|
layout.marginHeight = 2;
|
||||||
layout.marginWidth = 3;
|
layout.marginWidth = 3;
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
image = new Label(this, SWT.NONE);
|
image = new Label(this, SWT.NONE);
|
||||||
image.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
|
image.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
|
||||||
|
|
||||||
// this is a read-only text field so it is tab enabled and readable by a screen reader.
|
// this is a read-only text field so it is tab enabled and readable by a screen reader.
|
||||||
widget = new Text(this, SWT.READ_ONLY | SWT.SINGLE);
|
widget = new Text(this, SWT.READ_ONLY | SWT.SINGLE);
|
||||||
widget.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
|
widget.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
|
||||||
widget.setBackground(parent.getBackground());
|
widget.setBackground(parent.getBackground());
|
||||||
|
|
||||||
moreButton = new Button(this, SWT.NONE);
|
moreButton = new Button(this, SWT.NONE);
|
||||||
moreButton.setImage(RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_HELP_ID));
|
moreButton.setImage(RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_HELP_ID));
|
||||||
moreButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
|
moreButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
|
||||||
|
@ -377,36 +373,38 @@ public class SystemMessageLine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// add accessibility information to the "more" button
|
// add accessibility information to the "more" button
|
||||||
moreButton.setToolTipText(SystemResources.RESID_MSGLINE_TIP);
|
moreButton.setToolTipText(SystemResources.RESID_MSGLINE_TIP);
|
||||||
moreButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
|
moreButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
|
||||||
public void getName(AccessibleEvent e) {
|
public void getName(AccessibleEvent e) {
|
||||||
getHelp(e);
|
getHelp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getHelp(AccessibleEvent e) {
|
public void getHelp(AccessibleEvent e) {
|
||||||
e.result = moreButton.getToolTipText();
|
e.result = moreButton.getToolTipText();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addControlListener(new ControlListener() {
|
addControlListener(new ControlListener() {
|
||||||
public void controlMoved(ControlEvent e) {
|
public void controlMoved(ControlEvent e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void controlResized(ControlEvent e) {
|
public void controlResized(ControlEvent e) {
|
||||||
adjustText();
|
adjustText();
|
||||||
layout();
|
layout();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addDisposeListener(new DisposeListener() {
|
addDisposeListener(new DisposeListener() {
|
||||||
public void widgetDisposed(DisposeEvent e) {
|
public void widgetDisposed(DisposeEvent e) {
|
||||||
widget.dispose();
|
widget.dispose();
|
||||||
moreButton.dispose();
|
moreButton.dispose();
|
||||||
image.dispose();
|
image.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
showTopMessage();
|
showTopMessage();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -418,7 +416,7 @@ public class SystemMessageLine
|
||||||
popMessage();
|
popMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearMessage()
|
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearMessage()
|
||||||
*/
|
*/
|
||||||
|
@ -428,7 +426,7 @@ public class SystemMessageLine
|
||||||
popMessage();
|
popMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#getErrorMessage()
|
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#getErrorMessage()
|
||||||
*/
|
*/
|
||||||
|
@ -437,7 +435,7 @@ public class SystemMessageLine
|
||||||
if (message != null && message.isError()) return message.getText();
|
if (message != null && message.isError()) return message.getText();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#getMessage()
|
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#getMessage()
|
||||||
*/
|
*/
|
||||||
|
@ -455,7 +453,7 @@ public class SystemMessageLine
|
||||||
if (message != null && message.isError()) return message.toSystemMessage();
|
if (message != null && message.isError()) return message.toSystemMessage();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.String)
|
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@ -463,7 +461,7 @@ public class SystemMessageLine
|
||||||
MyMessage temp = new MyImpromptuMessage(ERROR, message);
|
MyMessage temp = new MyImpromptuMessage(ERROR, message);
|
||||||
pushMessage(temp);
|
pushMessage(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)
|
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)
|
||||||
*/
|
*/
|
||||||
|
@ -472,18 +470,17 @@ public class SystemMessageLine
|
||||||
pushMessage(temp);
|
pushMessage(temp);
|
||||||
logMessage(message);
|
logMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.Throwable)
|
* @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.Throwable)
|
||||||
*/
|
*/
|
||||||
public void setErrorMessage(Throwable throwable)
|
public void setErrorMessage(Throwable throwable) {
|
||||||
{
|
|
||||||
SystemMessage message = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED);
|
SystemMessage message = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED);
|
||||||
message.makeSubstitution(throwable);
|
message.makeSubstitution(throwable);
|
||||||
setErrorMessage(message);
|
setErrorMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the message text. If the message line currently displays an error,
|
* Set the message text. If the message line currently displays an error,
|
||||||
* the message is stored and will be shown after a call to clearErrorMessage.
|
* the message is stored and will be shown after a call to clearErrorMessage.
|
||||||
*/
|
*/
|
||||||
|
@ -505,7 +502,7 @@ public class SystemMessageLine
|
||||||
}
|
}
|
||||||
pushMessage(temp);
|
pushMessage(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pushes a new message onto the stack and shows it.
|
* Pushes a new message onto the stack and shows it.
|
||||||
* @param message The MyMessage to push on the stack.
|
* @param message The MyMessage to push on the stack.
|
||||||
|
@ -514,7 +511,7 @@ public class SystemMessageLine
|
||||||
messageStack.push(message);
|
messageStack.push(message);
|
||||||
showTopMessage();
|
showTopMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pops a message off the message stack and shows the new top message.
|
* Pops a message off the message stack and shows the new top message.
|
||||||
*/
|
*/
|
||||||
|
@ -522,7 +519,7 @@ public class SystemMessageLine
|
||||||
if (!messageStack.isEmpty()) messageStack.pop();
|
if (!messageStack.isEmpty()) messageStack.pop();
|
||||||
showTopMessage();
|
showTopMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the top MyMessage from the stack
|
* Retrieves the top MyMessage from the stack
|
||||||
* @return A MyMessage or null if the stack is empty.
|
* @return A MyMessage or null if the stack is empty.
|
||||||
|
@ -531,7 +528,7 @@ public class SystemMessageLine
|
||||||
if (messageStack.isEmpty()) return null;
|
if (messageStack.isEmpty()) return null;
|
||||||
return (MyMessage) messageStack.peek();
|
return (MyMessage) messageStack.peek();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the top message on the stack. If the stack is empty it will "show" nothing.
|
* Shows the top message on the stack. If the stack is empty it will "show" nothing.
|
||||||
*/
|
*/
|
||||||
|
@ -582,7 +579,7 @@ public class SystemMessageLine
|
||||||
boolean visible = message != null && message.hasMore();
|
boolean visible = message != null && message.hasMore();
|
||||||
moreButton.setVisible(visible);
|
moreButton.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjusts the text in the widget. The full text is stored in the data field of the
|
* Adjusts the text in the widget. The full text is stored in the data field of the
|
||||||
* Text widget. The partial text is shown if the width of the containing control
|
* Text widget. The partial text is shown if the width of the containing control
|
||||||
|
@ -632,7 +629,7 @@ public class SystemMessageLine
|
||||||
}
|
}
|
||||||
logMessage(m.getType(), m.getID(), m.isStrange());
|
logMessage(m.getType(), m.getID(), m.isStrange());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a text message to the log.
|
* Sends a text message to the log.
|
||||||
* @param type The type of the message - NONE, INFO, WARNING or ERROR.
|
* @param type The type of the message - NONE, INFO, WARNING or ERROR.
|
||||||
|
@ -642,18 +639,18 @@ public class SystemMessageLine
|
||||||
*/
|
*/
|
||||||
private void logMessage(int type, String text, boolean stackTrace) {
|
private void logMessage(int type, String text, boolean stackTrace) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ERROR:
|
case ERROR:
|
||||||
Exception e = stackTrace ? new Exception("Stack Trace") : null;
|
Exception e = stackTrace ? new Exception("Stack Trace") : null;
|
||||||
SystemBasePlugin.logError(text, e);
|
SystemBasePlugin.logError(text, e);
|
||||||
break;
|
break;
|
||||||
case WARNING:
|
case WARNING:
|
||||||
SystemBasePlugin.logWarning(text);
|
SystemBasePlugin.logWarning(text);
|
||||||
break;
|
break;
|
||||||
case INFO:
|
case INFO:
|
||||||
case NONE:
|
case NONE:
|
||||||
default:
|
default:
|
||||||
SystemBasePlugin.logInfo(text);
|
SystemBasePlugin.logInfo(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue