mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 03:15:33 +02:00
Bug 436407 - Improve the way connections are handled when
removing/adding. Change-Id: I06f08961a0d5981af75ba9939f47ba0979deea1e Signed-off-by: Greg Watson <g.watson@computer.org>
This commit is contained in:
parent
fa67010349
commit
b447139584
3 changed files with 37 additions and 3 deletions
|
@ -44,6 +44,8 @@ public class Messages extends NLS {
|
||||||
|
|
||||||
public static String ConnectionsPreferencePage_Status;
|
public static String ConnectionsPreferencePage_Status;
|
||||||
|
|
||||||
|
public static String ConnectionsPreferencePage_There_are_unsaved_changes;
|
||||||
|
|
||||||
public static String ConnectionsPreferencePage_This_connection_contains_unsaved_changes;
|
public static String ConnectionsPreferencePage_This_connection_contains_unsaved_changes;
|
||||||
|
|
||||||
public static String ConnectionsPreferencePage_User;
|
public static String ConnectionsPreferencePage_User;
|
||||||
|
|
|
@ -19,6 +19,7 @@ ConnectionsPreferencePage_Open=Open
|
||||||
ConnectionsPreferencePage_Remote_Services=Remote Services:
|
ConnectionsPreferencePage_Remote_Services=Remote Services:
|
||||||
ConnectionsPreferencePage_Remove=Remove
|
ConnectionsPreferencePage_Remove=Remove
|
||||||
ConnectionsPreferencePage_Status=Status
|
ConnectionsPreferencePage_Status=Status
|
||||||
|
ConnectionsPreferencePage_There_are_unsaved_changes=There are unsaved changes. Do you wish to save the changes before proceeding?
|
||||||
ConnectionsPreferencePage_This_connection_contains_unsaved_changes=This connection contains unsaved changes. Do you wish to save before opening the connection?
|
ConnectionsPreferencePage_This_connection_contains_unsaved_changes=This connection contains unsaved changes. Do you wish to save before opening the connection?
|
||||||
ConnectionsPreferencePage_User=User
|
ConnectionsPreferencePage_User=User
|
||||||
LocalUIConnectionManager_0=Connection Error
|
LocalUIConnectionManager_0=Connection Error
|
||||||
|
|
|
@ -70,14 +70,17 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
||||||
|
|
||||||
private class ConnectionContentProvider implements IStructuredContentProvider {
|
private class ConnectionContentProvider implements IStructuredContentProvider {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
return fWorkingCopies.values().toArray(new IRemoteConnection[fWorkingCopies.size()]);
|
return fWorkingCopies.values().toArray(new IRemoteConnection[fWorkingCopies.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
}
|
}
|
||||||
|
@ -86,18 +89,22 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
||||||
|
|
||||||
private class ConnectionLabelProvider implements ITableLabelProvider {
|
private class ConnectionLabelProvider implements ITableLabelProvider {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addListener(ILabelProviderListener listener) {
|
public void addListener(ILabelProviderListener listener) {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Image getColumnImage(Object element, int columnIndex) {
|
public Image getColumnImage(Object element, int columnIndex) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getColumnText(Object element, int columnIndex) {
|
public String getColumnText(Object element, int columnIndex) {
|
||||||
IRemoteConnection connection = (IRemoteConnection) element;
|
IRemoteConnection connection = (IRemoteConnection) element;
|
||||||
switch (columnIndex) {
|
switch (columnIndex) {
|
||||||
|
@ -113,10 +120,12 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isLabelProperty(Object element, String property) {
|
public boolean isLabelProperty(Object element, String property) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeListener(ILabelProviderListener listener) {
|
public void removeListener(ILabelProviderListener listener) {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
}
|
}
|
||||||
|
@ -199,9 +208,24 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a service configuration to the set of service configurations
|
* Add a new connection
|
||||||
*/
|
*/
|
||||||
private void addConnection() {
|
private void addConnection() {
|
||||||
|
if (fIsDirty) {
|
||||||
|
MessageDialog dialog = new MessageDialog(getShell(), Messages.ConnectionsPreferencePage_Confirm_Actions, null,
|
||||||
|
Messages.ConnectionsPreferencePage_There_are_unsaved_changes, MessageDialog.QUESTION,
|
||||||
|
new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
|
||||||
|
switch (dialog.open()) {
|
||||||
|
case 0:
|
||||||
|
performOk();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
performDefaults();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
IRemoteUIConnectionWizard wizard = fUIConnectionManager.getConnectionWizard(getShell());
|
IRemoteUIConnectionWizard wizard = fUIConnectionManager.getConnectionWizard(getShell());
|
||||||
if (wizard != null) {
|
if (wizard != null) {
|
||||||
wizard.setConnectionName(initialConnectionName());
|
wizard.setConnectionName(initialConnectionName());
|
||||||
|
@ -267,16 +291,19 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
||||||
fConnectionTable.setFont(parent.getFont());
|
fConnectionTable.setFont(parent.getFont());
|
||||||
fConnectionTable.addSelectionListener(fEventHandler);
|
fConnectionTable.addSelectionListener(fEventHandler);
|
||||||
fConnectionTable.addMouseListener(new MouseListener() {
|
fConnectionTable.addMouseListener(new MouseListener() {
|
||||||
|
@Override
|
||||||
public void mouseDoubleClick(MouseEvent e) {
|
public void mouseDoubleClick(MouseEvent e) {
|
||||||
if (fSelectedConnection != null && !fSelectedConnection.isOpen()) {
|
if (fSelectedConnection != null && !fSelectedConnection.isOpen()) {
|
||||||
editConnection();
|
editConnection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseDown(MouseEvent e) {
|
public void mouseDown(MouseEvent e) {
|
||||||
// Nothing
|
// Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseUp(MouseEvent e) {
|
public void mouseUp(MouseEvent e) {
|
||||||
// Nothing
|
// Nothing
|
||||||
}
|
}
|
||||||
|
@ -362,6 +389,7 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void init(IWorkbench workbench) {
|
public void init(IWorkbench workbench) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
@ -390,6 +418,7 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
||||||
protected void performDefaults() {
|
protected void performDefaults() {
|
||||||
initWorkingConnections();
|
initWorkingConnections();
|
||||||
fIsDirty = false;
|
fIsDirty = false;
|
||||||
|
fConnectionViewer.refresh();
|
||||||
super.performDefaults();
|
super.performDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,6 +448,8 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
||||||
}
|
}
|
||||||
fConnectionViewer.refresh();
|
fConnectionViewer.refresh();
|
||||||
fIsDirty = true;
|
fIsDirty = true;
|
||||||
|
fConnectionTable.deselectAll();
|
||||||
|
fSelectedConnection = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,8 +491,8 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
||||||
if (conn instanceof IRemoteConnectionWorkingCopy) {
|
if (conn instanceof IRemoteConnectionWorkingCopy) {
|
||||||
IRemoteConnectionWorkingCopy wc = (IRemoteConnectionWorkingCopy) conn;
|
IRemoteConnectionWorkingCopy wc = (IRemoteConnectionWorkingCopy) conn;
|
||||||
if (wc.isDirty()) {
|
if (wc.isDirty()) {
|
||||||
MessageDialog dialog = new MessageDialog(getShell(), Messages.ConnectionsPreferencePage_Confirm_Actions, null,
|
MessageDialog dialog = new MessageDialog(getShell(), Messages.ConnectionsPreferencePage_Confirm_Actions,
|
||||||
Messages.ConnectionsPreferencePage_This_connection_contains_unsaved_changes,
|
null, Messages.ConnectionsPreferencePage_This_connection_contains_unsaved_changes,
|
||||||
MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
|
MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
|
||||||
IDialogConstants.CANCEL_LABEL }, 0);
|
IDialogConstants.CANCEL_LABEL }, 0);
|
||||||
switch (dialog.open()) {
|
switch (dialog.open()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue