diff options
author | Carolyn MacLeod <carolyn> | 2009-05-26 18:36:42 +0000 |
---|---|---|
committer | Carolyn MacLeod <carolyn> | 2009-05-26 18:36:42 +0000 |
commit | fca082e9c9ae676fb3d8fcca2c4d3b3dceadc483 (patch) | |
tree | 2c2109631d8cbbdd324a771e48dd84f6695b5a3f /bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa | |
parent | 2f2704e0d7d19b7098c6f5c3f93c2b26ac0c01da (diff) | |
download | eclipse.platform.swt-fca082e9c9ae676fb3d8fcca2c4d3b3dceadc483.tar.gz eclipse.platform.swt-fca082e9c9ae676fb3d8fcca2c4d3b3dceadc483.tar.xz eclipse.platform.swt-fca082e9c9ae676fb3d8fcca2c4d3b3dceadc483.zip |
tab consistency with all other SWT classes.
(ignore whitespace changes when comparing)
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java | 218 |
1 files changed, 109 insertions, 109 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java index 9e3596a8ea..c5f0b5e021 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java @@ -86,123 +86,123 @@ public class SWT_AWT { } catch (Throwable e) {} } - /** - * Returns a <code>java.awt.Frame</code> which is the embedded frame - * associated with the specified composite. - * - * @param parent the parent <code>Composite</code> of the <code>java.awt.Frame</code> - * @return a <code>java.awt.Frame</code> the embedded frame or <code>null</code>. - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> - * </ul> - * - * @since 3.2 - */ - public static Frame getFrame(Composite parent) { - if (parent == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if ((parent.getStyle() & SWT.EMBEDDED) == 0) return null; - return (Frame) parent.getData(EMBEDDED_FRAME_KEY); - } +/** + * Returns a <code>java.awt.Frame</code> which is the embedded frame + * associated with the specified composite. + * + * @param parent the parent <code>Composite</code> of the <code>java.awt.Frame</code> + * @return a <code>java.awt.Frame</code> the embedded frame or <code>null</code>. + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> + * </ul> + * + * @since 3.2 + */ +public static Frame getFrame(Composite parent) { + if (parent == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if ((parent.getStyle() & SWT.EMBEDDED) == 0) return null; + return (Frame) parent.getData(EMBEDDED_FRAME_KEY); +} - /** - * Creates a new <code>java.awt.Frame</code>. This frame is the root for - * the AWT components that will be embedded within the composite. In order - * for the embedding to succeed, the composite must have been created - * with the SWT.EMBEDDED style. - * <p> - * IMPORTANT: As of JDK1.5, the embedded frame does not receive mouse events. - * When a lightweight component is added as a child of the embedded frame, - * the cursor does not change. In order to work around both these problems, it is - * strongly recommended that a heavyweight component such as <code>java.awt.Panel</code> - * be added to the frame as the root of all components. - * </p> - * - * @param parent the parent <code>Composite</code> of the new <code>java.awt.Frame</code> - * @return a <code>java.awt.Frame</code> to be the parent of the embedded AWT components - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> - * <li>ERROR_INVALID_ARGUMENT - if the parent Composite does not have the SWT.EMBEDDED style</li> - * </ul> - * - * @since 3.0 - */ - public static Frame new_Frame(final Composite parent) { - if (parent == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if ((parent.getStyle() & SWT.EMBEDDED) == 0) { - SWT.error(SWT.ERROR_INVALID_ARGUMENT); - } +/** + * Creates a new <code>java.awt.Frame</code>. This frame is the root for + * the AWT components that will be embedded within the composite. In order + * for the embedding to succeed, the composite must have been created + * with the SWT.EMBEDDED style. + * <p> + * IMPORTANT: As of JDK1.5, the embedded frame does not receive mouse events. + * When a lightweight component is added as a child of the embedded frame, + * the cursor does not change. In order to work around both these problems, it is + * strongly recommended that a heavyweight component such as <code>java.awt.Panel</code> + * be added to the frame as the root of all components. + * </p> + * + * @param parent the parent <code>Composite</code> of the new <code>java.awt.Frame</code> + * @return a <code>java.awt.Frame</code> to be the parent of the embedded AWT components + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> + * <li>ERROR_INVALID_ARGUMENT - if the parent Composite does not have the SWT.EMBEDDED style</li> + * </ul> + * + * @since 3.0 + */ +public static Frame new_Frame(final Composite parent) { + if (parent == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if ((parent.getStyle() & SWT.EMBEDDED) == 0) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } - final int /*long*/ handle = parent.view.id; + final int /*long*/ handle = parent.view.id; - Class clazz = null; - try { - String className = embeddedFrameClass != null ? embeddedFrameClass : "apple.awt.CEmbeddedFrame"; - if (embeddedFrameClass == null) { - clazz = Class.forName(className, true, ClassLoader.getSystemClassLoader()); - } else { - clazz = Class.forName(className); - } - } catch (ClassNotFoundException cne) { - SWT.error (SWT.ERROR_NOT_IMPLEMENTED, cne); - } catch (Throwable e) { - SWT.error (SWT.ERROR_UNSPECIFIED , e, " [Error while starting AWT]"); + Class clazz = null; + try { + String className = embeddedFrameClass != null ? embeddedFrameClass : "apple.awt.CEmbeddedFrame"; + if (embeddedFrameClass == null) { + clazz = Class.forName(className, true, ClassLoader.getSystemClassLoader()); + } else { + clazz = Class.forName(className); } + } catch (ClassNotFoundException cne) { + SWT.error (SWT.ERROR_NOT_IMPLEMENTED, cne); + } catch (Throwable e) { + SWT.error (SWT.ERROR_UNSPECIFIED , e, " [Error while starting AWT]"); + } - Object value = null; - Constructor constructor = null; - try { - constructor = clazz.getConstructor (new Class [] {long.class}); - value = constructor.newInstance (new Object [] {new Long(handle)}); - } catch (Throwable e) { - SWT.error(SWT.ERROR_NOT_IMPLEMENTED, e); - } - final Frame frame = (Frame) value; - parent.setData(EMBEDDED_FRAME_KEY, frame); - - Listener listener = new Listener() { - public void handleEvent(Event e) { - switch (e.type) { - case SWT.Dispose: { - parent.setVisible(false); - EventQueue.invokeLater(new Runnable () { - public void run () { - frame.dispose (); - } - }); - break; - } - } + Object value = null; + Constructor constructor = null; + try { + constructor = clazz.getConstructor (new Class [] {long.class}); + value = constructor.newInstance (new Object [] {new Long(handle)}); + } catch (Throwable e) { + SWT.error(SWT.ERROR_NOT_IMPLEMENTED, e); + } + final Frame frame = (Frame) value; + parent.setData(EMBEDDED_FRAME_KEY, frame); + + Listener listener = new Listener() { + public void handleEvent(Event e) { + switch (e.type) { + case SWT.Dispose: { + parent.setVisible(false); + EventQueue.invokeLater(new Runnable () { + public void run () { + frame.dispose (); + } + }); + break; + } } - }; + } + }; - parent.addListener(SWT.Dispose, listener); + parent.addListener(SWT.Dispose, listener); - return frame; - } + return frame; +} - /** - * Creates a new <code>Shell</code>. This Shell is the root for - * the SWT widgets that will be embedded within the AWT canvas. - * - * @param display the display for the new Shell - * @param parent the parent <code>java.awt.Canvas</code> of the new Shell - * @return a <code>Shell</code> to be the parent of the embedded SWT widgets - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the display is null</li> - * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> - * <li>ERROR_INVALID_ARGUMENT - if the parent's peer is not created</li> - * </ul> - * - * @since 3.0 - */ - public static Shell new_Shell(final Display display, final Canvas parent) { - if (display == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - if (parent == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - SWT.error(SWT.ERROR_NOT_IMPLEMENTED); - return null; +/** + * Creates a new <code>Shell</code>. This Shell is the root for + * the SWT widgets that will be embedded within the AWT canvas. + * + * @param display the display for the new Shell + * @param parent the parent <code>java.awt.Canvas</code> of the new Shell + * @return a <code>Shell</code> to be the parent of the embedded SWT widgets + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the display is null</li> + * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> + * <li>ERROR_INVALID_ARGUMENT - if the parent's peer is not created</li> + * </ul> + * + * @since 3.0 + */ +public static Shell new_Shell(final Display display, final Canvas parent) { + if (display == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + if (parent == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + SWT.error(SWT.ERROR_NOT_IMPLEMENTED); + return null; // TODO: Uncomment this code once Display/Shell related issues are ironed out. // int /*long*/ handle = 0; @@ -235,5 +235,5 @@ public class SWT_AWT { // }); // shell.setVisible (true); // return shell; - } +} }
\ No newline at end of file |