1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 02:36:01 +02:00

[168197][terminal] Replace JFace MessagDialog by SWT MessageBox

This commit is contained in:
Martin Oberhuber 2008-04-11 20:38:06 +00:00
parent 6aae228d73
commit 01f2b8e0da
5 changed files with 60 additions and 31 deletions

View file

@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# Copyright (c) 2003, 2007 Wind River Systems, Inc. and others. # Copyright (c) 2003, 2008 Wind River Systems, Inc. and others.
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at # which accompanies this distribution, and is available at
@ -13,6 +13,7 @@
# Contributors: # Contributors:
# Michael Scharf (Wind River) - split into core, view and connector plugins # Michael Scharf (Wind River) - split into core, view and connector plugins
# Martin Oberhuber (Wind River) - fixed copyright headers and beautified # Martin Oberhuber (Wind River) - fixed copyright headers and beautified
# Martin Oberhuber (Wind River) - [168197] Replace JFace MessagDialog by SWT MessageBox
############################################################################### ###############################################################################
PORT_IN_USE = Serial port \''{0}\'' is currently in use\!\nDo you want to close the port? PORT_IN_USE = Serial port \''{0}\'' is currently in use\!\nDo you want to close the port?
PROP_TITLE = Terminal PROP_TITLE = Terminal
@ -29,7 +30,8 @@ Installation:\n\
* Get RXTX binaries from\n\ * Get RXTX binaries from\n\
ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip\n\ ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip\n\
* Copy RXTXcomm.jar into $JRE/lib/ext\n\ * Copy RXTXcomm.jar into $JRE/lib/ext\n\
* Copy the native libs for your Platform (*.so, *.jnilib, *.dll) into the respective native lib folder of your RSE \n\ * Copy the native libs for your Platform (*.so, *.jnilib, *.dll)\n\
into the respective native lib folder of your RSE \n\
* More installation instructions are at\n\ * More installation instructions are at\n\
http://rxtx.qbang.org/wiki/index.php/Main_Page\n\ http://rxtx.qbang.org/wiki/index.php/Main_Page\n\
* More downloads for other platforms (currently about 30)\n\ * More downloads for other platforms (currently about 30)\n\

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2003, 2007 Wind River Systems, Inc. and others. * Copyright (c) 2003, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,6 +13,7 @@
* Contributors: * Contributors:
* Michael Scharf (Wind River) - extracted from TerminalControl * Michael Scharf (Wind River) - extracted from TerminalControl
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
* Martin Oberhuber (Wind River) - [168197] Replace JFace MessagDialog by SWT MessageBox
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.serial; package org.eclipse.tm.internal.terminal.serial;
@ -23,8 +24,9 @@ import gnu.io.SerialPortEventListener;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat; import java.text.MessageFormat;
import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
import org.eclipse.tm.internal.terminal.provisional.api.Logger; import org.eclipse.tm.internal.terminal.provisional.api.Logger;
@ -71,8 +73,12 @@ public class SerialPortHandler implements
public void run() { public void run() {
String[] args = new String[] { fConn.getSerialSettings().getSerialPort() }; String[] args = new String[] { fConn.getSerialSettings().getSerialPort() };
String strMsg = MessageFormat.format(SerialMessages.PORT_IN_USE, args); String strMsg = MessageFormat.format(SerialMessages.PORT_IN_USE, args);
// [168197] Replace JFace MessagDialog by SWT MessageBox
if (!MessageDialog.openQuestion(fControl.getShell(), SerialMessages.PROP_TITLE, strMsg)) //if (!MessageDialog.openQuestion(fControl.getShell(), SerialMessages.PROP_TITLE, strMsg))
MessageBox mb = new MessageBox(fControl.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
mb.setText(SerialMessages.PROP_TITLE);
mb.setMessage(strMsg);
if (mb.open() != SWT.YES)
return; return;
fConn.disconnect(); fConn.disconnect();
} }

View file

@ -15,6 +15,7 @@
* Martin Oberhuber (Wind River) - [155026] Add keepalives for SSH connection * Martin Oberhuber (Wind River) - [155026] Add keepalives for SSH connection
* Johnson Ma (Wind River) - [218880] Add UI setting for ssh keepalives * Johnson Ma (Wind River) - [218880] Add UI setting for ssh keepalives
* Martin Oberhuber (Wind River) - [225792] Rename SshConnector.getTelnetSettings() to getSshSettings() * Martin Oberhuber (Wind River) - [225792] Rename SshConnector.getTelnetSettings() to getSshSettings()
* Martin Oberhuber (Wind River) - [168197] Replace JFace MessagDialog by SWT MessageBox
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.ssh; package org.eclipse.tm.internal.terminal.ssh;
@ -25,10 +26,11 @@ import java.io.InterruptedIOException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.window.Window; import org.eclipse.jface.window.Window;
import org.eclipse.jsch.core.IJSchService; import org.eclipse.jsch.core.IJSchService;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
import org.eclipse.tm.internal.terminal.provisional.api.Logger; import org.eclipse.tm.internal.terminal.provisional.api.Logger;
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
@ -179,7 +181,7 @@ class SshConnection extends Thread {
return display; return display;
} }
private static class MyUserInfo implements UserInfo, UIKeyboardInteractive { private class MyUserInfo implements UserInfo, UIKeyboardInteractive {
private final String fConnectionId; private final String fConnectionId;
private final String fUser; private final String fUser;
private String fPassword; private String fPassword;
@ -199,7 +201,12 @@ class SshConnection extends Thread {
final boolean[] retval = new boolean[1]; final boolean[] retval = new boolean[1];
Display.getDefault().syncExec(new Runnable() { Display.getDefault().syncExec(new Runnable() {
public void run() { public void run() {
retval[0] = MessageDialog.openQuestion(null, SshMessages.WARNING, str); // [168197] Replace JFace MessagDialog by SWT MessageBox
//retval[0] = MessageDialog.openQuestion(null, SshMessages.WARNING, str);
MessageBox mb = new MessageBox(fControl.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
mb.setText(SshMessages.WARNING);
mb.setMessage(str);
retval[0] = (mb.open() == SWT.YES);
} }
}); });
return retval[0]; return retval[0];
@ -237,7 +244,12 @@ class SshConnection extends Thread {
public void showMessage(final String message) { public void showMessage(final String message) {
Display.getDefault().syncExec(new Runnable() { Display.getDefault().syncExec(new Runnable() {
public void run() { public void run() {
MessageDialog.openInformation(null, SshMessages.INFO, message); // [168197] Replace JFace MessagDialog by SWT MessageBox
// MessageDialog.openInformation(null, SshMessages.INFO, message);
MessageBox mb = new MessageBox(null, SWT.ICON_INFORMATION | SWT.OK);
mb.setText(SshMessages.INFO);
mb.setMessage(message);
mb.open();
} }
}); });
} }

View file

@ -13,6 +13,7 @@
* Contributors: * Contributors:
* Michael Scharf (Wind River) - split into core, view and connector plugins * Michael Scharf (Wind River) - split into core, view and connector plugins
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
* Martin Oberhuber (Wind River) - [168197] Replace JFace MessagDialog by SWT MessageBox
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.view; package org.eclipse.tm.internal.terminal.view;
@ -24,7 +25,6 @@ import java.util.List;
import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS; import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
@ -38,6 +38,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage; import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage;
@ -94,11 +95,13 @@ class TerminalSettingsDlg extends Dialog {
String error=NLS.bind(ViewMessages.CONNECTOR_NOT_AVAILABLE,conn.getName()); String error=NLS.bind(ViewMessages.CONNECTOR_NOT_AVAILABLE,conn.getName());
l.setText(error); l.setText(error);
l.setForeground(l.getDisplay().getSystemColor(SWT.COLOR_RED)); l.setForeground(l.getDisplay().getSystemColor(SWT.COLOR_RED));
MessageDialog.openError(getShell(), String msg = NLS.bind(ViewMessages.CANNOT_INITIALIZE, conn.getName(), conn.getInitializationErrorMessage());
error, // [168197] Replace JFace MessagDialog by SWT MessageBox
NLS.bind(ViewMessages.CANNOT_INITIALIZE, //MessageDialog.openError(getShell(), error, msg);
conn.getName(), MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK);
conn.getInitializationErrorMessage())); mb.setText(error);
mb.setMessage(msg);
mb.open();
} }
public void loadSettings() {} public void loadSettings() {}
public void saveSettings() {} public void saveSettings() {}

View file

@ -20,6 +20,7 @@
* Michael Scharf (Wind River) - [209665] Add ability to log byte streams from terminal * Michael Scharf (Wind River) - [209665] Add ability to log byte streams from terminal
* Ruslan Sychev (Xored Software) - [217675] NPE or SWTException when closing Terminal View while connection establishing * Ruslan Sychev (Xored Software) - [217675] NPE or SWTException when closing Terminal View while connection establishing
* Michael Scharf (Wing River) - [196447] The optional terminal input line should be resizeable * Michael Scharf (Wing River) - [196447] The optional terminal input line should be resizeable
* Martin Oberhuber (Wind River) - [168197] Replace JFace MessagDialog by SWT MessageBox
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.emulator; package org.eclipse.tm.internal.terminal.emulator;
@ -32,7 +33,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job; import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.osgi.util.NLS; import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
@ -50,6 +50,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.tm.internal.terminal.control.ICommandInputField; import org.eclipse.tm.internal.terminal.control.ICommandInputField;
import org.eclipse.tm.internal.terminal.control.ITerminalListener; import org.eclipse.tm.internal.terminal.control.ITerminalListener;
@ -386,7 +387,12 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
private void showErrorMessage(String message) { private void showErrorMessage(String message) {
String strTitle = TerminalMessages.TerminalError; String strTitle = TerminalMessages.TerminalError;
MessageDialog.openError( getShell(), strTitle, message); // [168197] Replace JFace MessagDialog by SWT MessageBox
//MessageDialog.openError( getShell(), strTitle, message);
MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText(strTitle);
mb.setMessage(message);
mb.open();
} }
protected void sendString(String string) { protected void sendString(String string) {