mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
rename method
This commit is contained in:
@@ -145,7 +145,7 @@ public class MacOSApplicationProvider implements ApplicationComponent {
|
||||
ID appMenu = Foundation.invoke(item, Foundation.createSelector("submenu"));
|
||||
|
||||
|
||||
final ID checkForUpdatesClass = Foundation.allocateObjcClassPair(Foundation.getClass("NSMenuItem"), "NSCheckForUpdates");
|
||||
final ID checkForUpdatesClass = Foundation.allocateObjcClassPair(Foundation.getObjcClass("NSMenuItem"), "NSCheckForUpdates");
|
||||
Foundation.addMethod(checkForUpdatesClass, Foundation.createSelector("checkForUpdates"), IMPL, "v");
|
||||
|
||||
Foundation.registerObjcClassPair(checkForUpdatesClass);
|
||||
|
||||
@@ -150,7 +150,7 @@ public class MacFileChooserDialogImpl implements MacFileChooserDialog {
|
||||
invoke(chooser, "setTreatsFilePackagesAsDirectories:", myChooserDescriptor.isChooseFolders());
|
||||
//invoke(chooser, "setCanCreateDirectories:", true);
|
||||
if (Foundation
|
||||
.isClassRespondsToSelector(Foundation.getClass("NSOpenPanel"), Foundation.createSelector("_setIncludeNewFolderButton:"))) {
|
||||
.isClassRespondsToSelector(Foundation.getObjcClass("NSOpenPanel"), Foundation.createSelector("_setIncludeNewFolderButton:"))) {
|
||||
invoke(chooser, "_setIncludeNewFolderButton:", true);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class MacFileChooserDialogImpl implements MacFileChooserDialog {
|
||||
myChooserDescriptor.getUserData(MacFileChooserDialog.NATIVE_MAC_FILE_CHOOSER_SHOW_HIDDEN_FILES_ENABLED.getName());
|
||||
if (Registry.is("ide.mac.filechooser.showhidden.files")
|
||||
|| Boolean.TRUE.equals(showHiddenFiles)) {
|
||||
if (Foundation.isClassRespondsToSelector(Foundation.getClass("NSOpenPanel"), Foundation.createSelector("setShowsHiddenFiles:"))) {
|
||||
if (Foundation.isClassRespondsToSelector(Foundation.getObjcClass("NSOpenPanel"), Foundation.createSelector("setShowsHiddenFiles:"))) {
|
||||
invoke(chooser, "setShowsHiddenFiles:", true);
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ public class MacFileChooserDialogImpl implements MacFileChooserDialog {
|
||||
}
|
||||
|
||||
static {
|
||||
final ID delegateClass = Foundation.allocateObjcClassPair(Foundation.getClass("NSObject"), "NSOpenPanelDelegate_");
|
||||
final ID delegateClass = Foundation.allocateObjcClassPair(Foundation.getObjcClass("NSObject"), "NSOpenPanelDelegate_");
|
||||
if (!Foundation.addMethod(delegateClass, Foundation.createSelector("panel:shouldShowFilename:"), SHOULD_SHOW_FILENAME_CALLBACK, "B*")) {
|
||||
throw new RuntimeException("Unable to add method to objective-c delegate class!");
|
||||
}
|
||||
@@ -288,7 +288,7 @@ public class MacFileChooserDialogImpl implements MacFileChooserDialog {
|
||||
final ID autoReleasePool = createAutoReleasePool();
|
||||
|
||||
try {
|
||||
final ID delegate = invoke(Foundation.getClass("NSOpenPanelDelegate_"), "new");
|
||||
final ID delegate = invoke(Foundation.getObjcClass("NSOpenPanelDelegate_"), "new");
|
||||
|
||||
final ID select = toSelect == null ? null : Foundation.nsString(toSelect.getPath());
|
||||
Foundation.cfRetain(delegate);
|
||||
@@ -304,7 +304,7 @@ public class MacFileChooserDialogImpl implements MacFileChooserDialog {
|
||||
final ID autoReleasePool = createAutoReleasePool();
|
||||
|
||||
try {
|
||||
final ID delegate = invoke(Foundation.getClass("NSOpenPanelDelegate_"), "new");
|
||||
final ID delegate = invoke(Foundation.getObjcClass("NSOpenPanelDelegate_"), "new");
|
||||
|
||||
final ID select = toSelect == null ? null : Foundation.nsString(toSelect.getPath());
|
||||
Foundation.cfRetain(delegate);
|
||||
@@ -385,7 +385,7 @@ public class MacFileChooserDialogImpl implements MacFileChooserDialog {
|
||||
}
|
||||
|
||||
private static ID invoke(@NotNull final String className, @NotNull final String selector, Object... args) {
|
||||
return invoke(Foundation.getClass(className), selector, args);
|
||||
return invoke(Foundation.getObjcClass(className), selector, args);
|
||||
}
|
||||
|
||||
private static ID invoke(@NotNull final ID id, @NotNull final String selector, Object... args) {
|
||||
|
||||
@@ -179,7 +179,7 @@ public class MacMainFrameDecorator implements UISettingsListener, Disposable {
|
||||
} else {
|
||||
// toggle toolbar
|
||||
String className = "IdeaToolbar" + v;
|
||||
final ID ownToolbar = Foundation.allocateObjcClassPair(Foundation.getClass("NSToolbar"), className);
|
||||
final ID ownToolbar = Foundation.allocateObjcClassPair(Foundation.getObjcClass("NSToolbar"), className);
|
||||
Foundation.registerObjcClassPair(ownToolbar);
|
||||
|
||||
ID toolbar = invoke(invoke(className, "alloc"), "initWithIdentifier:", Foundation.nsString(className));
|
||||
|
||||
@@ -188,7 +188,7 @@ public class MacMessagesImpl extends MacMessages {
|
||||
|
||||
static {
|
||||
if (SystemInfo.isMac) {
|
||||
final ID delegateClass = Foundation.allocateObjcClassPair(Foundation.getClass("NSObject"), "NSAlertDelegate_");
|
||||
final ID delegateClass = Foundation.allocateObjcClassPair(Foundation.getObjcClass("NSObject"), "NSAlertDelegate_");
|
||||
if (!Foundation.addMethod(delegateClass, Foundation.createSelector("alertDidEnd:returnCode:contextInfo:"), SHEET_DID_END, "v*")) {
|
||||
throw new RuntimeException("Unable to add method to objective-c delegate class!");
|
||||
}
|
||||
@@ -256,7 +256,7 @@ public class MacMessagesImpl extends MacMessages {
|
||||
|
||||
ID pool = invoke("NSAutoreleasePool", "new");
|
||||
try {
|
||||
final ID delegate = invoke(Foundation.getClass("NSAlertDelegate_"), "new");
|
||||
final ID delegate = invoke(Foundation.getObjcClass("NSAlertDelegate_"), "new");
|
||||
cfRetain(delegate);
|
||||
|
||||
fakeTitle = String.format("MacSheetDialog-%d", delegate.intValue());
|
||||
@@ -424,7 +424,7 @@ public class MacMessagesImpl extends MacMessages {
|
||||
|
||||
ID pool = invoke("NSAutoreleasePool", "new");
|
||||
try {
|
||||
final ID delegate = invoke(Foundation.getClass("NSAlertDelegate_"), "new");
|
||||
final ID delegate = invoke(Foundation.getObjcClass("NSAlertDelegate_"), "new");
|
||||
cfRetain(delegate);
|
||||
|
||||
fakeTitle = String.format("MacSheetDialog-%d", delegate.intValue());
|
||||
|
||||
@@ -126,7 +126,7 @@ public class Growl {
|
||||
}
|
||||
|
||||
private static ID invoke(@NotNull final String className, @NotNull final String selector, Object... args) {
|
||||
return invoke(Foundation.getClass(className), selector, args);
|
||||
return invoke(Foundation.getObjcClass(className), selector, args);
|
||||
}
|
||||
|
||||
private static ID invoke(@NotNull final ID id, @NotNull final String selector, Object... args) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Foundation {
|
||||
/**
|
||||
* Get the ID of the NSClass with className
|
||||
*/
|
||||
public static ID getClass(String className) {
|
||||
public static ID getObjcClass(String className) {
|
||||
return myFoundationLibrary.objc_getClass(className);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class Foundation {
|
||||
}
|
||||
|
||||
public static ID invoke(final String cls, final String selector, Object... args) {
|
||||
return invoke(getClass(cls), createSelector(selector), args);
|
||||
return invoke(getObjcClass(cls), createSelector(selector), args);
|
||||
}
|
||||
|
||||
public static ID invoke(final ID id, final String selector, Object... args) {
|
||||
@@ -229,7 +229,7 @@ public class Foundation {
|
||||
ourMainThreadRunnables.put(String.valueOf(ourCurrentRunnableCount), new RunnableInfo(runnable, withAutoreleasePool));
|
||||
}
|
||||
|
||||
final ID ideaRunnable = getClass("IdeaRunnable");
|
||||
final ID ideaRunnable = getObjcClass("IdeaRunnable");
|
||||
final ID runnableObject = invoke(invoke(ideaRunnable, "alloc"), "init");
|
||||
invoke(runnableObject, "performSelectorOnMainThread:withObject:waitUntilDone:", createSelector("run:"),
|
||||
nsString(String.valueOf(ourCurrentRunnableCount)), Boolean.valueOf(waitUntilDone));
|
||||
@@ -238,7 +238,7 @@ public class Foundation {
|
||||
|
||||
private static void initRunnableSupport() {
|
||||
if (ourRunnableCallback == null) {
|
||||
final ID runnableClass = allocateObjcClassPair(getClass("NSObject"), "IdeaRunnable");
|
||||
final ID runnableClass = allocateObjcClassPair(getObjcClass("NSObject"), "IdeaRunnable");
|
||||
registerObjcClassPair(runnableClass);
|
||||
|
||||
final Callback callback = new Callback() {
|
||||
@@ -275,4 +275,52 @@ public class Foundation {
|
||||
ourRunnableCallback = callback;
|
||||
}
|
||||
}
|
||||
|
||||
public static class NSDictionary {
|
||||
private ID myDelegate;
|
||||
|
||||
public NSDictionary(ID delegate) {
|
||||
myDelegate = delegate;
|
||||
}
|
||||
|
||||
public ID get(ID key) {
|
||||
return invoke(myDelegate, "objectForKey:", key);
|
||||
}
|
||||
|
||||
public ID get(String key) {
|
||||
return get(nsString(key));
|
||||
}
|
||||
|
||||
public int count() {
|
||||
return invoke(myDelegate, "count").intValue();
|
||||
}
|
||||
}
|
||||
|
||||
public static class NSArray {
|
||||
private ID myDelegate;
|
||||
|
||||
public NSArray(ID delegate) {
|
||||
myDelegate = delegate;
|
||||
}
|
||||
|
||||
public int count() {
|
||||
return invoke(myDelegate, "count").intValue();
|
||||
}
|
||||
|
||||
public ID at(int index) {
|
||||
return invoke(myDelegate, "objectAtIndex:", index);
|
||||
}
|
||||
}
|
||||
|
||||
public static class NSAutoreleasePool {
|
||||
private ID myDelegate;
|
||||
|
||||
public NSAutoreleasePool() {
|
||||
myDelegate = invoke(invoke("NSAutoreleasePool", "alloc"), "init");
|
||||
}
|
||||
|
||||
public void drain() {
|
||||
invoke(myDelegate, "drain");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,5 +30,7 @@ public class ID extends NativeLong {
|
||||
public ID(long peer) {
|
||||
super(peer);
|
||||
}
|
||||
|
||||
public final static ID NIL = new ID(0);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user