summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdan Gheorghe <gheorghe>2010-04-22 18:29:02 +0000
committerBogdan Gheorghe <gheorghe>2010-04-22 18:29:02 +0000
commit7fb46ab0dafd9ebc38363092f7df6c8466a283dc (patch)
tree611aa96d9ea593a60c6990c6c3d110ed5391d3b3
parent9b7d88df3143db20609e02dbededa54d6651de22 (diff)
downloadeclipse.platform.swt-7fb46ab0dafd9ebc38363092f7df6c8466a283dc.tar.gz
eclipse.platform.swt-7fb46ab0dafd9ebc38363092f7df6c8466a283dc.tar.xz
eclipse.platform.swt-7fb46ab0dafd9ebc38363092f7df6c8466a283dc.zip
305124 [Program] Eclipse can not open resource files in external editor
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java
index 558564f8a5..a13fe75f61 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java
@@ -583,7 +583,14 @@ static boolean gnome_isExecutable(String fileName) {
int /*long*/ uri = GNOME.gnome_vfs_make_uri_from_input(fileNameBuffer);
int /*long*/ mimeType = GNOME.gnome_vfs_get_mime_type(uri);
GNOME.g_free(uri);
- return GNOME.gnome_vfs_mime_can_be_executable(mimeType);
+
+ byte[] exeType = Converter.wcsToMbcs (null, "application/x-executable", true); //$NON-NLS-1$
+ boolean result = GNOME.gnome_vfs_mime_type_get_equivalence(mimeType, exeType) != GNOME.GNOME_VFS_MIME_UNRELATED;
+ if (!result) {
+ byte [] shellType = Converter.wcsToMbcs (null, "application/x-shellscript", true); //$NON-NLS-1$
+ result = GNOME.gnome_vfs_mime_type_get_equivalence(mimeType, shellType) == GNOME.GNOME_VFS_MIME_IDENTICAL;
+ }
+ return result;
}
/**
@@ -720,7 +727,7 @@ static boolean isExecutable(Display display, String fileName) {
switch(getDesktop(display)) {
case DESKTOP_GNOME_24:
case DESKTOP_GNOME: return gnome_isExecutable(fileName);
- case DESKTOP_CDE: return cde_isExecutable(fileName);
+ case DESKTOP_CDE: return false; //cde_isExecutable(fileName);
}
return false;
}
@@ -776,7 +783,7 @@ static boolean launch (Display display, String fileName, String workingDir) {
Compatibility.exec (new String [] {fileName}, null, workingDir);
return true;
} catch (IOException e) {
- //
+ return false;
}
}
switch (getDesktop (display)) {
@@ -799,7 +806,13 @@ static boolean launch (Display display, String fileName, String workingDir) {
}
break;
}
- return false;
+ /* If the above launch attempts didn't launch the file, then try with exec().*/
+ try {
+ Compatibility.exec (new String [] {fileName}, null, workingDir);
+ return true;
+ } catch (IOException e) {
+ return false;
+ }
}
/**