1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-15 12:15:47 +02:00

[444621][local]need ability to disable local natives

This commit is contained in:
Dave McKnight 2014-09-19 14:09:11 -04:00
parent 8bdc68526d
commit 9285a0e508
2 changed files with 60 additions and 11 deletions

View file

@ -56,6 +56,7 @@
* David McKnight (IBM) - [422508] Unable to map A:\ and B:\ as selectable drives in RSE View * David McKnight (IBM) - [422508] Unable to map A:\ and B:\ as selectable drives in RSE View
* David McKnight (IBM) - [420798] Slow performances in RDz 9.0 with opening 7000 files located on a network driver. * David McKnight (IBM) - [420798] Slow performances in RDz 9.0 with opening 7000 files located on a network driver.
* David McKnight (IBM) - [431060][local] RSE performance over local network drives are suboptimal * David McKnight (IBM) - [431060][local] RSE performance over local network drives are suboptimal
* David McKnight (IBM) - [444621][local]need ability to disable local natives
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.services.local.files; package org.eclipse.rse.internal.services.local.files;
@ -163,6 +164,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
private boolean _isWin95 = false; private boolean _isWin95 = false;
private boolean _isWinNT = false; private boolean _isWinNT = false;
private String _osCmdShell = null; private String _osCmdShell = null;
private static boolean _disableLocalNatives = false;
private boolean _getParentCanonicalPath = false; private boolean _getParentCanonicalPath = false;
@ -179,6 +181,15 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
catch (Exception e){ catch (Exception e){
} }
} }
String disableLocalNatives = System.getProperty("disable.local.natives"); //$NON-NLS-1$
if (disableLocalNatives != null){
try {
_disableLocalNatives = Boolean.parseBoolean(disableLocalNatives);
}
catch (Exception e){
}
}
} }
@ -240,9 +251,20 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
File entry = new File(dir, name); File entry = new File(dir, name);
FileInfo info = fetchInfo(entry); FileInfo info = fetchInfo(entry);
if (info.exists()) { boolean isDirectory = false;
boolean isDirectory = info.isDirectory(); boolean isFile = true;
boolean isFile = !isDirectory; boolean exists = false;
if (info != null && info.exists()) {
exists = true;
isDirectory = info.isDirectory();
isFile = !isDirectory;
}
else if (entry.exists()){
exists = true;
isDirectory = entry.isDirectory();
isFile = !isDirectory;
}
if (exists){
if (isFile) { if (isFile) {
result = _matcher.matches(name); result = _matcher.matches(name);
} else if (isDirectory) { } else if (isDirectory) {
@ -251,6 +273,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
} }
} }
} }
return result; return result;
} }
@ -745,9 +768,18 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
boolean isArchive = false; boolean isArchive = false;
boolean isVirtual = false; boolean isVirtual = false;
boolean parentExists = parentInfo.exists(); boolean parentExists = true;
boolean parentIsDirectory = true;
if (parentInfo != null){
parentExists = parentInfo.exists();
parentIsDirectory = parentInfo.isDirectory();
}
else {
parentExists = localParent.exists();
parentIsDirectory = localParent.isDirectory();
}
if (parentExists) { if (parentExists) {
if (!parentInfo.isDirectory()) { if (!parentIsDirectory) {
isArchive = ArchiveHandlerManager.getInstance().isArchive(localParent); isArchive = ArchiveHandlerManager.getInstance().isArchive(localParent);
} }
// if the system type is Windows, we get the canonical path so that we have the correct case in the path // if the system type is Windows, we get the canonical path so that we have the correct case in the path
@ -819,7 +851,14 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
File file = files[i]; File file = files[i];
FileInfo info = fetchInfo(file); FileInfo info = fetchInfo(file);
boolean isDirectory = info.isDirectory(); boolean isDirectory = false;
if (info != null){
isDirectory = info.isDirectory();
}
else {
isDirectory = file.isDirectory();
}
boolean isFile = !isDirectory; boolean isFile = !isDirectory;
if (isDirectory) if (isDirectory)
{ {
@ -842,7 +881,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
results.add(new LocalHostFile(file, false, info)); results.add(new LocalHostFile(file, false, info));
} }
} }
else if (info.exists()) else if (info != null && info.exists())
{ {
results.add(new LocalHostFile(file, false, info)); results.add(new LocalHostFile(file, false, info));
} }
@ -852,7 +891,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
} }
private FileInfo fetchInfo(File file) { private FileInfo fetchInfo(File file) {
if (LocalFileNativesManager.isUsingNatives()) { if (isUsingNatives()) {
FileInfo info = LocalFileNativesManager.fetchFileInfo(file.getAbsolutePath()); FileInfo info = LocalFileNativesManager.fetchFileInfo(file.getAbsolutePath());
//natives don't set the file name on all platforms //natives don't set the file name on all platforms
if (info.getName().length() == 0) { if (info.getName().length() == 0) {
@ -865,6 +904,15 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
return null; return null;
} }
public static boolean isUsingNatives(){
if (_disableLocalNatives){
return false;
}
else {
return LocalFileNativesManager.isUsingNatives();
}
}
public IHostFile getUserHome() public IHostFile getUserHome()
{ {
String userHome =System.getProperty("user.home"); //$NON-NLS-1$ String userHome =System.getProperty("user.home"); //$NON-NLS-1$

View file

@ -17,6 +17,7 @@
* David McKnight (IBM) - [294521] Local "hidden" files and folders are always shown * David McKnight (IBM) - [294521] Local "hidden" files and folders are always shown
* David McKnight (IBM) - [420798] Slow performances in RDz 9.0 with opening 7000 files located on a network driver. * David McKnight (IBM) - [420798] Slow performances in RDz 9.0 with opening 7000 files located on a network driver.
* David McKnight (IBM) - [431060][local] RSE performance over local network drives are suboptimal * David McKnight (IBM) - [431060][local] RSE performance over local network drives are suboptimal
* David McKnight (IBM) - [444621][local]need ability to disable local natives
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.services.local.files; package org.eclipse.rse.internal.services.local.files;
@ -67,7 +68,7 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
} }
private void fetchInfo() { private void fetchInfo() {
if (LocalFileNativesManager.isUsingNatives()) { if (LocalFileService.isUsingNatives()) {
_info = LocalFileNativesManager.fetchFileInfo(_file.getAbsolutePath()); _info = LocalFileNativesManager.fetchFileInfo(_file.getAbsolutePath());
//natives don't set the file name on all platforms //natives don't set the file name on all platforms
if (_info.getName().length() == 0) { if (_info.getName().length() == 0) {
@ -241,7 +242,7 @@ public class LocalHostFile implements IHostFile, IHostFilePermissionsContainer
} }
private boolean needsQuery(){ private boolean needsQuery(){
if (LocalFileNativesManager.isUsingNatives() && _needsQuery){ if (LocalFileService.isUsingNatives() && _needsQuery){
return true; return true;
} }
long t = System.currentTimeMillis(); long t = System.currentTimeMillis();