Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public static void beginSheetModalForWindow(NSObject id, NSWindow window, long h
* Custom message that will be sent when setTheme is called for example from Platform UI code.
*/
public static final long sel_appAppearanceChanged = OS.sel_registerName("appAppearanceChanged");

/**
* Experimental API for dark theme.
* <p>
Expand All @@ -194,7 +194,7 @@ public static void beginSheetModalForWindow(NSObject id, NSWindow window, long h
* On GTK, behavior may be different as the boolean flag doesn't force dark
* theme instead it specify that dark theme is preferred.
* </p>
*
*
* @param isDarkTheme <code>true</code> for dark theme
*/
public static void setTheme(boolean isDarkTheme) {
Expand Down Expand Up @@ -2216,6 +2216,7 @@ public static Selector getSelector (long value) {
public static final int NSEventTypeMagnify = 30;
public static final int NSEventTypeRotate = 18;
public static final int NSEventTypeSwipe = 31;
public static final int NSFileHandlingPanelCancelButton = 0;
public static final int NSFileHandlingPanelOKButton = 1;
public static final int NSFlagsChanged = 12;
public static final int NSFocusRingTypeNone = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ public class OS extends C {
public static final int EP_EDITTEXT = 1;
public static final int ERROR_FILE_NOT_FOUND = 0x2;
public static final int ERROR_NO_MORE_ITEMS = 0x103;
public static final int ERROR_CANCELED = 0x4C7;
public static final int ESB_DISABLE_BOTH = 0x3;
public static final int ESB_ENABLE_BOTH = 0x0;
public static final int ES_AUTOHSCROLL = 0x80;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class FileDialog extends Dialog {
long methodImpl_overwriteExistingFileCheck = 0;
long method_performKeyEquivalent = 0;
long methodImpl_performKeyEquivalent = 0;
boolean canceled;
static final char EXTENSION_SEPARATOR = ';';
private String selectedExtension;
boolean overwrite = (OS.VERSION >= OS.VERSION(10, 15, 0)) ? true : false;
Expand Down Expand Up @@ -333,6 +334,7 @@ void handleResponse (long response) {
}
}
}
canceled = response == OS.NSFileHandlingPanelCancelButton;
releaseHandles();
}

Expand Down Expand Up @@ -446,6 +448,14 @@ public String open () {
return fullPath;
}

/**
* {@return whether the dialog has been canceled when last opened or has not been opened at all}
* @since 3.125
*/
public boolean wasCanceled() {
return canceled;
}

long panel_shouldEnableURL (long id, long sel, long arg0, long arg1) {
if ((style & SWT.SAVE) != 0) {
/* All filenames are always disabled in the NSSavePanel, so return from here. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class FileDialog extends Dialog {
boolean overwrite = false;
boolean uriMode;
long handle;
boolean canceled;
static final char SEPARATOR = File.separatorChar;
static final char EXTENSION_SEPARATOR = ';';
static final char FILE_EXTENSION_SEPARATOR = '.';
Expand Down Expand Up @@ -374,6 +375,7 @@ String openNativeChooserDialog () {
display.externalEventLoop = false;
display.sendPostExternalEventDispatchEvent ();
}
canceled = response == GTK.GTK_RESPONSE_CANCEL;

if ((style & SWT.RIGHT_TO_LEFT) != 0) {
OS.g_signal_remove_emission_hook (signalId, hookId);
Expand All @@ -385,6 +387,14 @@ String openNativeChooserDialog () {
return answer;
}

/**
* {@return whether the dialog has been canceled when last opened or has not been opened at all}
* @since 3.125
*/
public boolean wasCanceled() {
return canceled;
}

void presetChooserDialog () {
/* MULTI is only valid if the native dialog's action is Open */
if ((style & (SWT.SAVE | SWT.MULTI)) == SWT.MULTI) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class FileDialog extends Dialog {
String filterPath = "", fileName = "";
int filterIndex = 0;
boolean overwrite = false;
boolean canceled;
static final String DEFAULT_FILTER = "*.*";
static final String LONG_PATH_PREFIX = "\\\\?\\";

Expand Down Expand Up @@ -322,6 +323,7 @@ public String open () {
display.externalEventLoop = true;
display.sendPreExternalEventDispatchEvent();
hr = fileDialog.Show(parent.handle);
canceled = hr == OS.HRESULT_FROM_WIN32(OS.ERROR_CANCELED);
display.externalEventLoop = false;
display.sendPostExternalEventDispatchEvent();

Expand Down Expand Up @@ -389,6 +391,14 @@ public String open () {
return fullPath;
}

/**
* {@return whether the dialog has been canceled when last opened or has not been opened at all}
* @since 3.125
*/
public boolean wasCanceled() {
return canceled;
}

/**
* Set the initial filename which the dialog will
* select by default when opened to the argument,
Expand Down