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,14 +53,11 @@ 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;
|
||||||
|
@ -74,28 +71,28 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,8 +100,7 @@ public class SystemMessageLine
|
||||||
* @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;
|
||||||
|
@ -225,19 +221,20 @@ 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;
|
||||||
|
@ -278,10 +275,10 @@ 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;
|
||||||
|
@ -340,8 +337,7 @@ public class SystemMessageLine
|
||||||
/**
|
/**
|
||||||
* 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;
|
||||||
|
@ -384,6 +380,7 @@ public class SystemMessageLine
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
@ -392,12 +389,13 @@ public class SystemMessageLine
|
||||||
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();
|
||||||
|
@ -476,14 +474,13 @@ public class SystemMessageLine
|
||||||
/* (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.
|
||||||
*/
|
*/
|
||||||
|
@ -642,17 +639,17 @@ 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