mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +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_There_are_unsaved_changes;
|
||||
|
||||
public static String ConnectionsPreferencePage_This_connection_contains_unsaved_changes;
|
||||
|
||||
public static String ConnectionsPreferencePage_User;
|
||||
|
|
|
@ -19,6 +19,7 @@ ConnectionsPreferencePage_Open=Open
|
|||
ConnectionsPreferencePage_Remote_Services=Remote Services:
|
||||
ConnectionsPreferencePage_Remove=Remove
|
||||
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_User=User
|
||||
LocalUIConnectionManager_0=Connection Error
|
||||
|
|
|
@ -70,14 +70,17 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
|
||||
private class ConnectionContentProvider implements IStructuredContentProvider {
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
return fWorkingCopies.values().toArray(new IRemoteConnection[fWorkingCopies.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
// Nothing to do
|
||||
}
|
||||
|
@ -86,18 +89,22 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
|
||||
private class ConnectionLabelProvider implements ITableLabelProvider {
|
||||
|
||||
@Override
|
||||
public void addListener(ILabelProviderListener listener) {
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getColumnImage(Object element, int columnIndex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnText(Object element, int columnIndex) {
|
||||
IRemoteConnection connection = (IRemoteConnection) element;
|
||||
switch (columnIndex) {
|
||||
|
@ -113,10 +120,12 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLabelProperty(Object element, String property) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(ILabelProviderListener listener) {
|
||||
// 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() {
|
||||
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());
|
||||
if (wizard != null) {
|
||||
wizard.setConnectionName(initialConnectionName());
|
||||
|
@ -267,16 +291,19 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
fConnectionTable.setFont(parent.getFont());
|
||||
fConnectionTable.addSelectionListener(fEventHandler);
|
||||
fConnectionTable.addMouseListener(new MouseListener() {
|
||||
@Override
|
||||
public void mouseDoubleClick(MouseEvent e) {
|
||||
if (fSelectedConnection != null && !fSelectedConnection.isOpen()) {
|
||||
editConnection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDown(MouseEvent e) {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseUp(MouseEvent e) {
|
||||
// Nothing
|
||||
}
|
||||
|
@ -362,6 +389,7 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(IWorkbench workbench) {
|
||||
// Do nothing
|
||||
}
|
||||
|
@ -390,6 +418,7 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
protected void performDefaults() {
|
||||
initWorkingConnections();
|
||||
fIsDirty = false;
|
||||
fConnectionViewer.refresh();
|
||||
super.performDefaults();
|
||||
}
|
||||
|
||||
|
@ -419,6 +448,8 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
}
|
||||
fConnectionViewer.refresh();
|
||||
fIsDirty = true;
|
||||
fConnectionTable.deselectAll();
|
||||
fSelectedConnection = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -460,8 +491,8 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
if (conn instanceof IRemoteConnectionWorkingCopy) {
|
||||
IRemoteConnectionWorkingCopy wc = (IRemoteConnectionWorkingCopy) conn;
|
||||
if (wc.isDirty()) {
|
||||
MessageDialog dialog = new MessageDialog(getShell(), Messages.ConnectionsPreferencePage_Confirm_Actions, null,
|
||||
Messages.ConnectionsPreferencePage_This_connection_contains_unsaved_changes,
|
||||
MessageDialog dialog = new MessageDialog(getShell(), Messages.ConnectionsPreferencePage_Confirm_Actions,
|
||||
null, Messages.ConnectionsPreferencePage_This_connection_contains_unsaved_changes,
|
||||
MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
|
||||
IDialogConstants.CANCEL_LABEL }, 0);
|
||||
switch (dialog.open()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue