~ubuntu-branches/debian/sid/swt-gtk/sid

« back to all changes in this revision

Viewing changes to org/eclipse/swt/browser/FilePicker.java

  • Committer: Bazaar Package Importer
  • Author(s): Adrian Perez
  • Date: 2009-12-07 10:22:24 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20091207102224-70w2tax575mcks1w
Tags: 3.5.1-1
* New upstream release. Closes: #558663.
* debian/control: 
  - Add Vcs-* fields for Git repository.
  - Allow DM-Uploads.
  - Remove "Conflicts", package should live with eclipse.
* debian/rules: Fix default-java path around AWT_LIB_PATH.
* debian/copyright: Minor update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
        return refCount;
113
113
}
114
114
 
 
115
Browser getBrowser (int /*long*/ aDOMWindow) {
 
116
        if (aDOMWindow == 0) return null;
 
117
        nsIDOMWindow window = new nsIDOMWindow (aDOMWindow);
 
118
        return Mozilla.findBrowser (window);
 
119
}
 
120
 
115
121
/*
116
122
 * As of Mozilla 1.8 some of nsIFilePicker's string arguments changed type.  This method
117
123
 * answers a java string based on the type of string that is appropriate for the Mozilla
141
147
        /* picking a file */
142
148
        int style = mode == nsIFilePicker.modeSave ? SWT.SAVE : SWT.OPEN;
143
149
        if (mode == nsIFilePicker.modeOpenMultiple) style |= SWT.MULTI;
144
 
        Display display = Display.getCurrent ();
145
 
        Shell parent = null; // TODO compute parent
146
 
        if (parent == null) {
147
 
                parent = new Shell (display);
 
150
        Browser browser = getBrowser (parentHandle);
 
151
        Shell parent = null;
 
152
        if (browser != null) {
 
153
                parent = browser.getShell ();
 
154
        } else {
 
155
                parent = new Shell ();
148
156
        }
149
157
        FileDialog dialog = new FileDialog (parent, style);
150
158
        if (title != null) dialog.setText (title);
162
170
}
163
171
 
164
172
int showDirectoryPicker () {
165
 
        Display display = Display.getCurrent ();
166
 
        Shell parent = null; // TODO compute parent
167
 
        if (parent == null) {
168
 
                parent = new Shell (display);
 
173
        Browser browser = getBrowser (parentHandle);
 
174
        Shell parent = null;
 
175
        if (browser != null) {
 
176
                parent = browser.getShell ();
 
177
        } else {
 
178
                parent = new Shell ();
169
179
        }
170
180
        DirectoryDialog dialog = new DirectoryDialog (parent, SWT.NONE);
171
181
        if (title != null) dialog.setText (title);