1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-09 10:05:24 +02:00

[cleanup] format

This commit is contained in:
David Dykstal 2006-09-22 15:46:18 +00:00
parent b154ebe580
commit cc3a724d41

View file

@ -53,14 +53,11 @@ import org.eclipse.ui.PlatformUI;
* Setting an error message hides a currently displayed message until
* <code>clearErrorMessage</code> is called.
*/
public class SystemMessageLine
extends Composite
implements ISystemMessageLine
{
public class SystemMessageLine extends Composite implements ISystemMessageLine {
private Button moreButton;
private Label image;
private Text widget;
private Text widget;
private Stack messageStack = new Stack();
private static final int ERROR = 3;
private static final int WARNING = 2;
@ -74,28 +71,28 @@ public class SystemMessageLine
Image getImage() {
int type = getType();
switch (type) {
case ERROR:
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_ERROR);
case WARNING:
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_WARNING);
case INFO:
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_INFO);
default:
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_INFO);
case ERROR:
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_ERROR);
case WARNING:
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_WARNING);
case INFO:
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_INFO);
default:
return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_INFO);
}
}
Color getColor() {
int type = getType();
switch (type) {
case ERROR:
return getColor(ISystemThemeConstants.MESSAGE_ERROR_COLOR);
case WARNING:
return getColor(ISystemThemeConstants.MESSAGE_WARNING_COLOR);
case INFO:
return getColor(ISystemThemeConstants.MESSAGE_INFORMATION_COLOR);
default:
return getColor(ISystemThemeConstants.MESSAGE_INFORMATION_COLOR);
case ERROR:
return getColor(ISystemThemeConstants.MESSAGE_ERROR_COLOR);
case WARNING:
return getColor(ISystemThemeConstants.MESSAGE_WARNING_COLOR);
case INFO:
return getColor(ISystemThemeConstants.MESSAGE_INFORMATION_COLOR);
default:
return getColor(ISystemThemeConstants.MESSAGE_INFORMATION_COLOR);
}
}
@ -103,8 +100,7 @@ public class SystemMessageLine
* @param symbolicName the name of the color in the current theme's color registry.
* @return an SWT Color or null.
*/
private Color getColor(String symbolicName)
{
private Color getColor(String symbolicName) {
ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
Color result = registry.get(symbolicName);
return result;
@ -225,19 +221,20 @@ public class SystemMessageLine
int result = NONE;
if (message != null) {
switch (message.getIndicator()) {
case SystemMessage.COMPLETION:
case SystemMessage.INFORMATION:
case SystemMessage.INQUIRY:
result = INFO;
break;
case SystemMessage.ERROR:
case SystemMessage.UNEXPECTED:
result = ERROR;
break;
case SystemMessage.WARNING:
result = WARNING;
break;
default: result = NONE;
case SystemMessage.COMPLETION:
case SystemMessage.INFORMATION:
case SystemMessage.INQUIRY:
result = INFO;
break;
case SystemMessage.ERROR:
case SystemMessage.UNEXPECTED:
result = ERROR;
break;
case SystemMessage.WARNING:
result = WARNING;
break;
default:
result = NONE;
}
}
return result;
@ -278,10 +275,10 @@ public class SystemMessageLine
Object[] data = null;
if (text2 == null) {
id = isError() ? ISystemMessages.MSG_GENERIC_E : ISystemMessages.MSG_GENERIC_I;
data = new Object[] {text1};
data = new Object[] { text1 };
} else {
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);
return result;
@ -340,8 +337,7 @@ public class SystemMessageLine
/**
* Creates a new message line as a child of the given parent.
*/
public SystemMessageLine(Composite parent)
{
public SystemMessageLine(Composite parent) {
super(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
@ -384,6 +380,7 @@ public class SystemMessageLine
public void getName(AccessibleEvent e) {
getHelp(e);
}
public void getHelp(AccessibleEvent e) {
e.result = moreButton.getToolTipText();
}
@ -392,12 +389,13 @@ public class SystemMessageLine
addControlListener(new ControlListener() {
public void controlMoved(ControlEvent e) {
}
public void controlResized(ControlEvent e) {
adjustText();
layout();
}
});
addDisposeListener(new DisposeListener() {
addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
widget.dispose();
moreButton.dispose();
@ -476,14 +474,13 @@ public class SystemMessageLine
/* (non-Javadoc)
* @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);
message.makeSubstitution(throwable);
setErrorMessage(message);
}
/**
/**
* 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.
*/
@ -642,17 +639,17 @@ public class SystemMessageLine
*/
private void logMessage(int type, String text, boolean stackTrace) {
switch (type) {
case ERROR:
Exception e = stackTrace ? new Exception("Stack Trace") : null;
SystemBasePlugin.logError(text, e);
break;
case WARNING:
SystemBasePlugin.logWarning(text);
break;
case INFO:
case NONE:
default:
SystemBasePlugin.logInfo(text);
case ERROR:
Exception e = stackTrace ? new Exception("Stack Trace") : null;
SystemBasePlugin.logError(text, e);
break;
case WARNING:
SystemBasePlugin.logWarning(text);
break;
case INFO:
case NONE:
default:
SystemBasePlugin.logInfo(text);
}
}