Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dde-file-manager and nemo file manager support. #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 1 addition & 1 deletion META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 23 additions & 23 deletions src/openexplorer/actions/AbstractOpenExplorerAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,22 @@
* @author <a href="mailto:[email protected]">Samson Wu</a>
* @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;

protected String systemBrowser;

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()) {
Expand All @@ -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();
Expand All @@ -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();
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/openexplorer/preferences/FMPreferencePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/openexplorer/util/IFileManagerExecutables.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
2 changes: 2 additions & 0 deletions src/openexplorer/util/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/openexplorer/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
2 changes: 2 additions & 0 deletions src/openexplorer/util/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down