Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2002, 2008 IBM Corporation and others. |
2 |
* Copyright (c) 2002, 2009 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 15-20
Link Here
|
15 |
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin |
15 |
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin |
16 |
* David McKnight (IBM) - [208951] Use remoteFileTypes extension point to determine file types |
16 |
* David McKnight (IBM) - [208951] Use remoteFileTypes extension point to determine file types |
17 |
* Martin Oberhuber (Wind River) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal |
17 |
* Martin Oberhuber (Wind River) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal |
|
|
18 |
* David McKnight (IBM) - [283033] remoteFileTypes extension point should include "xml" type |
18 |
*******************************************************************************/ |
19 |
*******************************************************************************/ |
19 |
package org.eclipse.rse.internal.subsystems.files.core.model; |
20 |
package org.eclipse.rse.internal.subsystems.files.core.model; |
20 |
|
21 |
|
Lines 73-78
Link Here
|
73 |
private static final String MODE_ATTRIBUTE = "mode"; //$NON-NLS-1$ |
74 |
private static final String MODE_ATTRIBUTE = "mode"; //$NON-NLS-1$ |
74 |
private static final String BINARY_VALUE = "binary"; //$NON-NLS-1$ |
75 |
private static final String BINARY_VALUE = "binary"; //$NON-NLS-1$ |
75 |
private static final String TEXT_VALUE = "text"; //$NON-NLS-1$ |
76 |
private static final String TEXT_VALUE = "text"; //$NON-NLS-1$ |
|
|
77 |
private static final String XML_VALUE = "xml"; //$NON-NLS-1$s |
76 |
private static final String PRIORITY_ATTRIBUTE = "priority"; //$NON-NLS-1$ |
78 |
private static final String PRIORITY_ATTRIBUTE = "priority"; //$NON-NLS-1$ |
77 |
|
79 |
|
78 |
/** |
80 |
/** |
Lines 145-150
Link Here
|
145 |
if (type.equalsIgnoreCase("binary")) { //$NON-NLS-1$ |
147 |
if (type.equalsIgnoreCase("binary")) { //$NON-NLS-1$ |
146 |
mapping.setAsBinary(); |
148 |
mapping.setAsBinary(); |
147 |
} |
149 |
} |
|
|
150 |
|
151 |
// add extension to list of xml types |
152 |
if (type.equalsIgnoreCase("xml")) { //$NON-NLS-1$ |
153 |
mapping.setAsXML(); |
154 |
} |
148 |
|
155 |
|
149 |
int priority = SystemFileTransferModeMapping.DEFAULT_PRIORITY; |
156 |
int priority = SystemFileTransferModeMapping.DEFAULT_PRIORITY; |
150 |
String priorityStr = element.getAttribute("priority"); //$NON-NLS-1$ |
157 |
String priorityStr = element.getAttribute("priority"); //$NON-NLS-1$ |
Lines 302-309
Link Here
|
302 |
return isText(remoteFile.getName()); |
309 |
return isText(remoteFile.getName()); |
303 |
} |
310 |
} |
304 |
|
311 |
|
|
|
312 |
/** |
313 |
* @see ISystemFileTransferModeRegistry#isText(String) |
314 |
*/ |
315 |
public boolean isXML(String fileName) { |
316 |
return getMapping(fileName).isXML(); |
317 |
} |
318 |
|
319 |
|
320 |
/** |
321 |
* @see ISystemFileTransferModeRegistry#isText(File) |
322 |
*/ |
323 |
public boolean isXML(File file) { |
324 |
return isXML(file.getName()); |
325 |
} |
326 |
|
327 |
|
328 |
/** |
329 |
* @see ISystemFileTransferModeRegistry#isText(IFile) |
330 |
*/ |
331 |
public boolean isXML(IFile file) { |
332 |
return isXML(file.getName()); |
333 |
} |
334 |
|
305 |
|
335 |
|
306 |
/** |
336 |
/** |
|
|
337 |
* @see ISystemFileTransferModeRegistry#isText(IRemoteFile) |
338 |
*/ |
339 |
public boolean isXML(IRemoteFile remoteFile) { |
340 |
return isXML(remoteFile.getName()); |
341 |
} |
342 |
|
343 |
/** |
307 |
* Get the mode mapping given a file name |
344 |
* Get the mode mapping given a file name |
308 |
*/ |
345 |
*/ |
309 |
private SystemFileTransferModeMapping getMapping(String fileName) { |
346 |
private SystemFileTransferModeMapping getMapping(String fileName) { |
Lines 357-367
Link Here
|
357 |
{ |
394 |
{ |
358 |
fileMapping.setAsText(); |
395 |
fileMapping.setAsText(); |
359 |
} |
396 |
} |
360 |
else |
397 |
else if (mapping.isXML()) |
|
|
398 |
{ |
399 |
fileMapping.setAsXML(); |
400 |
} |
401 |
else |
361 |
{ |
402 |
{ |
362 |
fileMapping.setAsBinary(); |
403 |
fileMapping.setAsBinary(); |
363 |
} |
404 |
} |
364 |
|
405 |
|
|
|
406 |
|
365 |
return fileMapping; |
407 |
return fileMapping; |
366 |
} |
408 |
} |
367 |
|
409 |
|
Lines 458-463
Link Here
|
458 |
if (mode.equals(TEXT_VALUE)) { |
500 |
if (mode.equals(TEXT_VALUE)) { |
459 |
mapping.setAsText(); |
501 |
mapping.setAsText(); |
460 |
} |
502 |
} |
|
|
503 |
else if (mode.equals(XML_VALUE)){ |
504 |
mapping.setAsXML(); |
505 |
} |
461 |
else { |
506 |
else { |
462 |
mapping.setAsBinary(); |
507 |
mapping.setAsBinary(); |
463 |
} |
508 |
} |
Lines 523-529
Link Here
|
523 |
IMemento infoMemento = memento.createChild(INFO_NODE); |
568 |
IMemento infoMemento = memento.createChild(INFO_NODE); |
524 |
infoMemento.putString(NAME_ATTRIBUTE, mapping.getName()); |
569 |
infoMemento.putString(NAME_ATTRIBUTE, mapping.getName()); |
525 |
infoMemento.putString(EXTENSION_ATTRIBUTE, mapping.getExtension()); |
570 |
infoMemento.putString(EXTENSION_ATTRIBUTE, mapping.getExtension()); |
526 |
infoMemento.putString(MODE_ATTRIBUTE, mapping.isBinary() ? BINARY_VALUE : TEXT_VALUE); |
571 |
|
|
|
572 |
if (mapping.isText()){ |
573 |
infoMemento.putString(MODE_ATTRIBUTE, TEXT_VALUE); |
574 |
} |
575 |
else if (mapping.isXML()){ |
576 |
infoMemento.putString(MODE_ATTRIBUTE, XML_VALUE); |
577 |
} |
578 |
else { |
579 |
infoMemento.putString(MODE_ATTRIBUTE, BINARY_VALUE); |
580 |
} |
581 |
|
527 |
infoMemento.putInteger(PRIORITY_ATTRIBUTE, mapping.getPriority()); |
582 |
infoMemento.putInteger(PRIORITY_ATTRIBUTE, mapping.getPriority()); |
528 |
} |
583 |
} |
529 |
|
584 |
|