diff --git a/.classpath b/.classpath index f3b093b..5168cee 100755 --- a/.classpath +++ b/.classpath @@ -1,8 +1,8 @@ - - + + diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF index efe6c4b..c8497f1 100644 --- a/META-INF/MANIFEST.MF +++ b/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: OpenExplorer Bundle-SymbolicName: OpenExplorer;singleton:=true -Bundle-Version: 1.5.0.qualifier +Bundle-Version: 1.5.1.qualifier Bundle-Activator: openexplorer.Activator Bundle-Vendor: Samson Wu Bundle-Localization: plugin diff --git a/README.mkd b/README.mkd index da9cdf6..7c31ab4 100644 --- a/README.mkd +++ b/README.mkd @@ -19,6 +19,9 @@ To uninstall, just remove the jar. ## Changelog +### 1.5.1 +* add more linux file manager, dde-file-manager and nemo + ### 1.5.0.v201108051513 * add linux file manager detect support * add preferences page for file manager selection diff --git a/src/openexplorer/actions/AbstractOpenExplorerAction.java b/src/openexplorer/actions/AbstractOpenExplorerAction.java index 4222bac..6b8d933 100644 --- a/src/openexplorer/actions/AbstractOpenExplorerAction.java +++ b/src/openexplorer/actions/AbstractOpenExplorerAction.java @@ -51,10 +51,8 @@ * @author Samson Wu * @version 1.4.0 */ -public abstract class AbstractOpenExplorerAction implements IActionDelegate, - IPropertyChangeListener { - protected IWorkbenchWindow window = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow(); +public abstract class AbstractOpenExplorerAction implements IActionDelegate, IPropertyChangeListener { + protected IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); protected Shell shell; protected ISelection currentSelection; @@ -62,16 +60,13 @@ public abstract class AbstractOpenExplorerAction implements IActionDelegate, public AbstractOpenExplorerAction() { this.systemBrowser = OperatingSystem.INSTANCE.getSystemBrowser(); - Activator.getDefault().getPreferenceStore() - .addPropertyChangeListener(this); + Activator.getDefault().getPreferenceStore().addPropertyChangeListener(this); } /* * (non-Javadoc) * - * @see - * org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse - * .jface.util.PropertyChangeEvent) + * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse .jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { if (OperatingSystem.INSTANCE.isLinux()) { @@ -91,38 +86,44 @@ public void run(IAction action) { for (int i = 0; i < paths.length; i++) { TreePath path = paths[i]; IResource resource = null; + String location = null; + String browser = this.systemBrowser; Object segment = path.getLastSegment(); if ((segment instanceof IResource)) resource = (IResource) segment; else if ((segment instanceof IJavaElement)) { resource = ((IJavaElement) segment).getResource(); + if (resource == null) { + location = ((IJavaElement) segment).getPath().toOSString(); + if (location != null) { + if (OperatingSystem.INSTANCE.isWindows()) { + browser = this.systemBrowser + " /select,"; + } + openInBrowser(browser, location); + continue; + } + } } if (resource == null) { continue; } - String browser = this.systemBrowser; - String location = resource.getLocation().toOSString(); + location = resource.getLocation().toOSString(); if ((resource instanceof IFile)) { - location = ((IFile) resource).getParent().getLocation() - .toOSString(); + location = ((IFile) resource).getParent().getLocation().toOSString(); if (OperatingSystem.INSTANCE.isWindows()) { browser = this.systemBrowser + " /select,"; - location = ((IFile) resource).getLocation() - .toOSString(); + location = ((IFile) resource).getLocation().toOSString(); } } openInBrowser(browser, location); } - } else if (this.currentSelection instanceof ITextSelection - || this.currentSelection instanceof IStructuredSelection) { + } else if (this.currentSelection instanceof ITextSelection || this.currentSelection instanceof IStructuredSelection) { // open current editing file IEditorPart editor = window.getActivePage().getActiveEditor(); if (editor != null) { - IFile current_editing_file = (IFile) editor.getEditorInput() - .getAdapter(IFile.class); + IFile current_editing_file = (IFile) editor.getEditorInput().getAdapter(IFile.class); String browser = this.systemBrowser; - String location = current_editing_file.getParent() - .getLocation().toOSString(); + String location = current_editing_file.getParent().getLocation().toOSString(); if (OperatingSystem.INSTANCE.isWindows()) { browser = this.systemBrowser + " /select,"; location = current_editing_file.getLocation().toOSString(); @@ -140,8 +141,7 @@ protected void openInBrowser(String browser, String location) { Runtime.getRuntime().exec(new String[] { browser, location }); } } catch (IOException e) { - MessageDialog.openError(shell, Messages.OpenExploer_Error, - Messages.Cant_Open + " \"" + location + "\""); + MessageDialog.openError(shell, Messages.OpenExploer_Error, Messages.Cant_Open + " \"" + location + "\""); e.printStackTrace(); } } diff --git a/src/openexplorer/preferences/FMPreferencePage.java b/src/openexplorer/preferences/FMPreferencePage.java index 0d32d7d..7ae6885 100644 --- a/src/openexplorer/preferences/FMPreferencePage.java +++ b/src/openexplorer/preferences/FMPreferencePage.java @@ -159,6 +159,16 @@ protected void createLinuxFMGroup(Composite composite) { createRadioButtonWithSelectionListener(groupComposite, label, value, false); + label = Messages.Deepin_File_Manager; + value = IFileManagerExecutables.DDE_FILE_MANAGER; + createRadioButtonWithSelectionListener(groupComposite, label, value, + false); + + label = Messages.Nemo; + value = IFileManagerExecutables.NEMO; + createRadioButtonWithSelectionListener(groupComposite, label, value, + false); + label = Messages.Xdg_open; value = IFileManagerExecutables.XDG_OPEN; createRadioButtonWithSelectionListener(groupComposite, label, value, diff --git a/src/openexplorer/util/IFileManagerExecutables.java b/src/openexplorer/util/IFileManagerExecutables.java index 371a344..55abe9e 100644 --- a/src/openexplorer/util/IFileManagerExecutables.java +++ b/src/openexplorer/util/IFileManagerExecutables.java @@ -35,6 +35,8 @@ public interface IFileManagerExecutables { public static final String THUNAR = "thunar"; public static final String PCMANFM = "pcmanfm"; public static final String ROX = "rox"; + public static final String NEMO = "nemo"; + public static final String DDE_FILE_MANAGER = "dde-file-manager"; public static final String XDG_OPEN = "xdg-open"; public static final String OTHER = "other"; } diff --git a/src/openexplorer/util/Messages.java b/src/openexplorer/util/Messages.java index eb4fa92..0cca67c 100644 --- a/src/openexplorer/util/Messages.java +++ b/src/openexplorer/util/Messages.java @@ -51,6 +51,8 @@ public class Messages extends NLS { public static String PCManFM; public static String ROX; public static String Xdg_open; + public static String Nemo; + public static String Deepin_File_Manager; public static String Other; public static String Full_Path_Label_Text; diff --git a/src/openexplorer/util/Utils.java b/src/openexplorer/util/Utils.java index 8946e1a..8e5bf53 100644 --- a/src/openexplorer/util/Utils.java +++ b/src/openexplorer/util/Utils.java @@ -52,6 +52,12 @@ public static String detectLinuxSystemBrowser() { if (result == null || result.trim().equals("")) { result = executeCommand("which rox"); } + if (result == null || result.trim().equals("")) { + result = executeCommand("which nemo"); + } + if (result == null || result.trim().equals("")) { + result = executeCommand("which dde-file-manager"); + } if (result == null || result.trim().equals("")) { result = executeCommand("xdg-open"); } diff --git a/src/openexplorer/util/messages.properties b/src/openexplorer/util/messages.properties index a2ef932..916bcf9 100644 --- a/src/openexplorer/util/messages.properties +++ b/src/openexplorer/util/messages.properties @@ -12,6 +12,8 @@ PCManFM=PCMan (LXDE) ROX=ROX-Filer (ROX) Xdg_open=xdg-open (XdgUtils) Other=Other +Nemo=Nemo (Cinnamon) +Deepin_File_Manager=Deepin File Manager (Deepin) Full_Path_Label_Text=Full Path: Browse_Button_Text=Browse...