We have a Java app on the Mac set to where you double click our custom extension, it opens the app, and then the app does work on the file you clicked. The problem is that I cannot get the "open event" that apple uses in OSX, and so I cannot get the filename (and location) to do the work on. I tried everything I could find using Google, so I must be doing something inherently wrong.
Here is the class I call right at the start the application. I just make a new class, and then grab the files a few lines after. I have also tried to put a wait/notify all to see if it was a timing issue, however it would just wait indefinitely so I think it is a problem with the way I am actually capturing the event. Any help at all would be useful.
import java.io.File;
import java.util.List;
import com.apple.eawt.AppEvent.OpenFilesEvent;
import com.apple.eawt.Application;
import com.apple.eawt.OpenFilesHandler;
public class MacFiles implements OpenFilesHandler{
private List<File> files;
public MacFiles() {
Application.getApplication().setOpenFileHandler(this);
}
public List<File> getFiles() {
return files;
}
public void openFiles(OpenFilesEvent event) {
files = event.getFiles();
}
}