imakerplugin/com.nokia.s60tools.imaker/src/com/nokia/s60tools/imaker/internal/viewers/AddEditFileToTransferDialog.java
author dpodwall
Tue, 12 Jan 2010 13:17:53 -0600
changeset 0 61163b28edca
permissions -rw-r--r--
initial EPL conversion
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     1
/*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     3
* All rights reserved.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     4
* This component and the accompanying materials are made available
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     6
* which accompanies this distribution, and is available
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     8
*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     9
* Initial Contributors:
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    11
*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    12
* Contributors:
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    13
*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    14
* Description:
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    15
*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    16
*/
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    17
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    18
package com.nokia.s60tools.imaker.internal.viewers;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    19
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    20
import java.io.File;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    21
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    22
import org.eclipse.core.runtime.IPath;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    23
import org.eclipse.core.runtime.Path;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    24
import org.eclipse.jface.dialogs.StatusDialog;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    25
import org.eclipse.swt.SWT;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    26
import org.eclipse.swt.events.ModifyEvent;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    27
import org.eclipse.swt.events.ModifyListener;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    28
import org.eclipse.swt.events.SelectionAdapter;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    29
import org.eclipse.swt.events.SelectionEvent;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    30
import org.eclipse.swt.graphics.Point;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    31
import org.eclipse.swt.layout.GridData;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    32
import org.eclipse.swt.layout.GridLayout;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    33
import org.eclipse.swt.widgets.Button;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    34
import org.eclipse.swt.widgets.Composite;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    35
import org.eclipse.swt.widgets.Control;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    36
import org.eclipse.swt.widgets.FileDialog;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    37
import org.eclipse.swt.widgets.Label;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    38
import org.eclipse.swt.widgets.Shell;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    39
import org.eclipse.swt.widgets.Text;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    40
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    41
import com.nokia.s60tools.imaker.IMakerUtils;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    42
import com.nokia.s60tools.imaker.Messages;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    43
import com.nokia.s60tools.imaker.internal.model.FileToImage;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    44
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    45
public class AddEditFileToTransferDialog extends StatusDialog {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    46
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    47
	private FileToImage fFile;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    48
	private Text hostPath;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    49
	private Button hostBrowse;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    50
	private Text targetPath;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    51
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    52
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    53
	 * Create the dialog
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    54
	 * @param parent
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    55
	 * @param file
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    56
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    57
	public AddEditFileToTransferDialog(Shell parent, FileToImage file) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    58
		super(parent);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    59
		setShellStyle(getShellStyle() | SWT.RESIZE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    60
		fFile = file;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    61
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    62
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    63
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    64
	 * @see Windows#configureShell
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    65
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    66
	protected void configureShell(Shell newShell) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    67
		super.configureShell(newShell);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    68
//		PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, LaunchTabHelpIds.RUN_MODE_FILE_TRANSFER_DIALOG);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    69
	}		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    70
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    71
	/* (non-Javadoc)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    72
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    73
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    74
	protected Control createDialogArea(Composite parent) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    75
		initializeDialogUnits(parent);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    76
		Composite composite= (Composite) super.createDialogArea(parent);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    77
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    78
		GridLayout layout = (GridLayout) composite.getLayout();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    79
		layout.numColumns = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    80
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    81
		final Label hostLabel = new Label(composite, SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    82
		hostLabel.setText(Messages.getString("AddEditFileToTransferDialog.1")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    83
		GridData data = new GridData(GridData.FILL, GridData.CENTER, true, false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    84
		data.horizontalSpan = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    85
		hostLabel.setLayoutData(data);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    86
		hostLabel.setToolTipText(Messages.getString("AddEditFileToTransferDialog.2")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    87
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    88
		hostPath = new Text(composite, SWT.BORDER);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    89
		hostPath.setText(fFile.getHostPath());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    90
		data = new GridData(GridData.FILL, GridData.CENTER, true, false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    91
		hostPath.setLayoutData(data);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    92
		hostPath.setToolTipText(Messages.getString("AddEditFileToTransferDialog.2")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    93
		hostPath.addModifyListener(new ModifyListener() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    94
			public void modifyText(ModifyEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    95
				checkValues();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    96
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    97
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    98
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    99
		hostBrowse = new Button(composite, SWT.PUSH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   100
		hostBrowse.setFont(parent.getFont());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   101
		hostBrowse.setText(Messages.getString("AddEditFileToTransferDialog.3")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   102
		data = new GridData();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   103
		hostBrowse.setLayoutData(data);	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   104
		hostBrowse.addSelectionListener(new SelectionAdapter() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   105
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   106
			public void widgetSelected(SelectionEvent evt) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   107
				FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   108
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   109
				dialog.setText(Messages.getString("AddEditFileToTransferDialog.4")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   110
				dialog.setFilterExtensions(new String[] {"*"}); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   111
				dialog.setFilterNames(new String[] {Messages.getString("AddEditFileToTransferDialog.11")}); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   112
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   113
				String result = dialog.open();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   114
				if (result != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   115
					IPath path = new Path(result);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   116
					if (path.toFile().exists()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   117
						hostPath.setText(result);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   118
						
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   119
						// if target path is empty, set it to something useful here.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   120
						if (targetPath.getText().trim().length() < 1) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   121
							String tp = IMakerUtils.getFixedTargetPath(path);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   122
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   123
							targetPath.setText(tp);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   124
						}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   125
					}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   126
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   127
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   128
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   129
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   130
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   131
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   132
		final Label targetLabel = new Label(composite, SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   133
		targetLabel.setText(Messages.getString("AddEditFileToTransferDialog.5")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   134
		data = new GridData(GridData.FILL, GridData.CENTER, true, false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   135
		data.horizontalSpan = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   136
		targetLabel.setLayoutData(data);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   137
		targetLabel.setToolTipText(Messages.getString("AddEditFileToTransferDialog.6")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   138
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   139
		targetPath = new Text(composite, SWT.BORDER);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   140
		targetPath.setText(fFile.getTargetPath());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   141
		data = new GridData(GridData.FILL, GridData.CENTER, true, false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   142
		targetPath.setLayoutData(data);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   143
		targetPath.setToolTipText(Messages.getString("AddEditFileToTransferDialog.6")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   144
		targetPath.addModifyListener(new ModifyListener() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   145
			public void modifyText(ModifyEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   146
				checkValues();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   147
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   148
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   149
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   150
		applyDialogFont(composite);		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   151
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   152
		return composite;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   153
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   154
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   155
	public void create() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   156
		super.create();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   157
		checkValues();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   158
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   159
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   160
	protected void okPressed() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   161
		fFile.setHostPath(hostPath.getText());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   162
		fFile.setTargetPath(targetPath.getText());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   163
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   164
		super.okPressed();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   165
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   166
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   167
	/* (non-Javadoc)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   168
	 * @see org.eclipse.jface.window.Window#getInitialSize()
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   169
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   170
	protected Point getInitialSize() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   171
		Point size = super.getInitialSize();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   172
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   173
		// set the initial size for the add dialog.  note that when editing it
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   174
		// automatically sizes it based on the length of the text in the edit boxes
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   175
		if (hostPath.getText().trim().length() == 0) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   176
			size.x *= 3;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   177
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   178
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   179
		return size;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   180
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   181
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   182
	protected void checkValues() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   183
		StatusInfo status= new StatusInfo();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   184
		status.setOK();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   185
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   186
		String hp = hostPath.getText().trim();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   187
		if (hp.length() > 0) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   188
			if (!new File(hp).exists()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   189
				status.setError(Messages.getString("AddEditFileToTransferDialog.7")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   190
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   191
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   192
		else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   193
			status.setError(Messages.getString("AddEditFileToTransferDialog.8")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   194
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   195
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   196
		// if we already have an error then no need to check the rest of the stuff
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   197
		if (status.isOK()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   198
			String tp = targetPath.getText().trim();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   199
			if (tp.length() > 0) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   200
				if (tp.length() < 3) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   201
					status.setError(Messages.getString("AddEditFileToTransferDialog.9")); //$NON-NLS-1$					
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   202
				} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   203
//					char drive = tp.charAt(0);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   204
//					char colon = tp.charAt(1);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   205
//					if (!Character.isLetter(drive) || colon != ':') { 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   206
//						status.setError(Messages.getString("AddEditFileToTransferDialog.9")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   207
//					}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   208
					
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   209
					// we really want the target file path, not just a directory.  but we do allow directories for
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   210
					// backwards compatibility, but only when they end in a path delimiter.  so if the target path
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   211
					// does not end in a path delimiter, and there is no file extension, warn them that we think
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   212
					// this is just a file without an extension and not a directory.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   213
					IPath path = new Path(tp);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   214
					if (!path.hasTrailingSeparator() && path.getFileExtension() == null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   215
						status.setWarning(Messages.getString("AddEditFileToTransferDialog.12")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   216
					}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   217
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   218
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   219
			else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   220
				status.setError(Messages.getString("AddEditFileToTransferDialog.10")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   221
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   222
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   223
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   224
		updateStatus(status);		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   225
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   226
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   227
}