connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/wizard/ExportPage.java
changeset 677 d13345e153e8
parent 0 fb279309251b
child 687 593d05f9d5ca
equal deleted inserted replaced
676:7a49747f237a 677:d13345e153e8
    19 package com.nokia.carbide.remoteconnections.wizard;
    19 package com.nokia.carbide.remoteconnections.wizard;
    20 
    20 
    21 import com.nokia.carbide.remoteconnections.Messages;
    21 import com.nokia.carbide.remoteconnections.Messages;
    22 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
    22 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
    23 import com.nokia.carbide.remoteconnections.interfaces.IConnection;
    23 import com.nokia.carbide.remoteconnections.interfaces.IConnection;
       
    24 import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils;
    24 
    25 
    25 import org.eclipse.core.runtime.IPath;
    26 import org.eclipse.core.runtime.IPath;
    26 import org.eclipse.core.runtime.Path;
    27 import org.eclipse.core.runtime.Path;
    27 import org.eclipse.jface.viewers.CheckStateChangedEvent;
    28 import org.eclipse.jface.viewers.CheckStateChangedEvent;
    28 import org.eclipse.jface.viewers.ICheckStateListener;
    29 import org.eclipse.jface.viewers.ICheckStateListener;
    70 		TableColumn[] columns = viewer.getTable().getColumns();
    71 		TableColumn[] columns = viewer.getTable().getColumns();
    71 		for (TableColumn tableColumn : columns) {
    72 		for (TableColumn tableColumn : columns) {
    72 			tableColumn.pack();
    73 			tableColumn.pack();
    73 		}
    74 		}
    74 		viewer.setAllChecked(true);
    75 		viewer.setAllChecked(true);
    75 		connections = new ArrayList(RemoteConnectionsActivator.getConnectionsManager().getConnections());
    76 		connections = new ArrayList<IConnection>(RemoteConnectionsActivator.getConnectionsManager().getConnections());
    76 
    77 
    77 		createBrowseGroup(composite, Messages.getString("ExportPage.BrowseGroupLabel")); //$NON-NLS-1$
    78 		createBrowseGroup(composite, Messages.getString("ExportPage.BrowseGroupLabel")); //$NON-NLS-1$
    78         browseButton.addSelectionListener(new SelectionAdapter() {
    79         browseButton.addSelectionListener(new SelectionAdapter() {
    79 			@Override
    80 			@Override
    80 			public void widgetSelected(SelectionEvent e) {
    81 			public void widgetSelected(SelectionEvent e) {
    81 				FileDialog dialog =  new FileDialog(getShell(), SWT.SAVE);
    82 				FileDialog dialog =  new FileDialog(getShell(), SWT.SAVE);
    82 				dialog.setText(Messages.getString("ExportPage.FileDialogTitle")); //$NON-NLS-1$
    83 				dialog.setText(Messages.getString("ExportPage.FileDialogTitle")); //$NON-NLS-1$
    83 				if (saveAsParent == null)
    84 				if (saveAsParent == null)
    84 					saveAsParent = System.getProperty("user.home"); //$NON-NLS-1$
    85 					saveAsParent = System.getProperty("user.home"); //$NON-NLS-1$
    85 				dialog.setFilterPath(saveAsParent);
    86 				BrowseDialogUtils.initializeFrom(dialog, new Path(saveAsParent).append("exportedConnections.xml")); //$NON-NLS-1$
    86 				dialog.setFileName("exportedConnections.xml"); //$NON-NLS-1$
       
    87 				dialog.setOverwrite(true); // prompt for overwrite
    87 				dialog.setOverwrite(true); // prompt for overwrite
    88 				String path = dialog.open();
    88 				String path = dialog.open();
    89 				if (path != null) {
    89 				if (path != null) {
    90 					IPath saveAsPath = new Path(path);
    90 					IPath saveAsPath = new Path(path);
    91 					saveAsParent = saveAsPath.removeLastSegments(1).toString();
    91 					saveAsParent = saveAsPath.removeLastSegments(1).toString();