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.carbide.remoteconnections.internal.registry.Registry; |
|
25 import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; |
24 |
26 |
25 import org.eclipse.core.runtime.IPath; |
27 import org.eclipse.core.runtime.IPath; |
26 import org.eclipse.core.runtime.Path; |
28 import org.eclipse.core.runtime.Path; |
27 import org.eclipse.jface.viewers.CheckStateChangedEvent; |
29 import org.eclipse.jface.viewers.CheckStateChangedEvent; |
28 import org.eclipse.jface.viewers.ICheckStateListener; |
30 import org.eclipse.jface.viewers.ICheckStateListener; |
64 connections.add((IConnection) checkedElements[i]); |
66 connections.add((IConnection) checkedElements[i]); |
65 } |
67 } |
66 } |
68 } |
67 } |
69 } |
68 }); |
70 }); |
69 viewer.setInput(RemoteConnectionsActivator.getConnectionsManager().getConnections()); |
71 viewer.setInput(Registry.instance().getConnections()); |
70 TableColumn[] columns = viewer.getTable().getColumns(); |
72 TableColumn[] columns = viewer.getTable().getColumns(); |
71 for (TableColumn tableColumn : columns) { |
73 for (TableColumn tableColumn : columns) { |
72 tableColumn.pack(); |
74 tableColumn.pack(); |
73 } |
75 } |
74 viewer.setAllChecked(true); |
76 viewer.setAllChecked(true); |
75 connections = new ArrayList(RemoteConnectionsActivator.getConnectionsManager().getConnections()); |
77 connections = new ArrayList<IConnection>(Registry.instance().getConnections()); |
76 |
78 |
77 createBrowseGroup(composite, Messages.getString("ExportPage.BrowseGroupLabel")); //$NON-NLS-1$ |
79 createBrowseGroup(composite, Messages.getString("ExportPage.BrowseGroupLabel")); //$NON-NLS-1$ |
78 browseButton.addSelectionListener(new SelectionAdapter() { |
80 browseButton.addSelectionListener(new SelectionAdapter() { |
79 @Override |
81 @Override |
80 public void widgetSelected(SelectionEvent e) { |
82 public void widgetSelected(SelectionEvent e) { |
81 FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); |
83 FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); |
82 dialog.setText(Messages.getString("ExportPage.FileDialogTitle")); //$NON-NLS-1$ |
84 dialog.setText(Messages.getString("ExportPage.FileDialogTitle")); //$NON-NLS-1$ |
83 if (saveAsParent == null) |
85 if (saveAsParent == null) |
84 saveAsParent = System.getProperty("user.home"); //$NON-NLS-1$ |
86 saveAsParent = System.getProperty("user.home"); //$NON-NLS-1$ |
85 dialog.setFilterPath(saveAsParent); |
87 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 |
88 dialog.setOverwrite(true); // prompt for overwrite |
88 String path = dialog.open(); |
89 String path = dialog.open(); |
89 if (path != null) { |
90 if (path != null) { |
90 IPath saveAsPath = new Path(path); |
91 IPath saveAsPath = new Path(path); |
91 saveAsParent = saveAsPath.removeLastSegments(1).toString(); |
92 saveAsParent = saveAsPath.removeLastSegments(1).toString(); |