diff options
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal')
6 files changed, 76 insertions, 27 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/CloneableCompatibility.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/CloneableCompatibility.java index 48e3dcc1e9..78e939108f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/CloneableCompatibility.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/CloneableCompatibility.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * + * http://www.eclipse.org/legal/epl-v10.html + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java index ba3b062038..226794e42e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. + * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 + * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * + * http://www.eclipse.org/legal/epl-v10.html + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -12,8 +12,11 @@ package org.eclipse.swt.internal; import java.io.*; +import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; +import java.util.zip.InflaterInputStream; + import org.eclipse.swt.SWT; /** @@ -121,7 +124,7 @@ public static int floor(int p, int q) { * @return the closest integer to the rational number p / q */ public static int round(int p, int q) { - return (int)Math.round((float)p / q); + return Math.round((float)p / q); } /** @@ -166,6 +169,19 @@ public static OutputStream newFileOutputStream(String filename) throws IOExcepti } /** + * Create an InflaterInputStream if such things are supported. + * + * @param stream the input stream + * @return a inflater stream or <code>null</code> + * @exception IOException + * + * @since 3.2.1 + */ +public static InputStream newInflaterInputStream(InputStream stream) throws IOException { + return new InflaterInputStream(stream); +} + +/** * Answers whether the character is a letter. * * @param c the character @@ -272,7 +288,30 @@ public static String getMessage(String key) { } return answer; } + +public static String getMessage(String key, Object[] args) { + String answer = key; + if (key == null || args == null) { + SWT.error (SWT.ERROR_NULL_ARGUMENT); + } + if (msgs == null) { + try { + msgs = ResourceBundle.getBundle("org.eclipse.swt.internal.SWTMessages"); //$NON-NLS-1$ + } catch (MissingResourceException ex) { + answer = key + " (no resource bundle)"; //$NON-NLS-1$ + } + } + if (msgs != null) { + try { + MessageFormat formatter = new MessageFormat(""); + formatter.applyPattern(msgs.getString(key)); + answer = formatter.format(args); + } catch (MissingResourceException ex2) {} + } + return answer; +} + /** * Interrupt the current thread. * <p> diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventListener.java index 35dcb2e14e..f7036a3eb5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventListener.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventListener.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * + * http://www.eclipse.org/legal/epl-v10.html + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventObject.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventObject.java index ccef4c7df4..92ba54f11d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventObject.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTEventObject.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * + * http://www.eclipse.org/legal/epl-v10.html + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -27,6 +27,8 @@ import java.util.EventObject; */ public class SWTEventObject extends EventObject { + static final long serialVersionUID = 3258125873411470903L; + /** * Constructs a new instance of this class. * diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties index 9d8fb7dc28..e7fdf88e62 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties +++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties @@ -1,10 +1,10 @@ ############################################################################### -# Copyright (c) 2000, 2004 IBM Corporation and others. +# Copyright (c) 2000, 2005 IBM Corporation and others. # All rights reserved. This program and the accompanying materials -# are made available under the terms of the Common Public License v1.0 +# are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/cpl-v10.html -# +# http://www.eclipse.org/legal/epl-v10.html +# # Contributors: # IBM Corporation - initial API and implementation ############################################################################### @@ -33,6 +33,7 @@ SWT_NewFont=New Font SWT_Remove=Remove SWT_Up=Up SWT_Down=Down +SWT_Selection=Selection SWT_Charset_Western=western SWT_Charset_EastEuropean=eastern SWT_Charset_SouthEuropean=southern @@ -57,9 +58,16 @@ SWT_Charset_ASCII=ASCII SWT_InputMethods=Input Methods SWT_Password=Password: SWT_Username=User Name: -SWT_Prompt=Prompt +SWT_Switch=Switch +SWT_Press=Press +SWT_Open=Open SWT_Close=Close SWT_Minimize=Minimize SWT_Maximize=Maximize SWT_Restore=Restore SWT_ShowList=Show List +SWT_FileDownload=File Download +SWT_Download_File=Download: {0} +SWT_Download_Location=Saving {0} from {1} +SWT_Download_Started=Downloading... +SWT_Download_Status=Download: {0,number,integer} KB of {1,number,integer} KB diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SerializableCompatibility.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SerializableCompatibility.java index 38cc0b309c..dd5e66ae4f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SerializableCompatibility.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SerializableCompatibility.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * + * http://www.eclipse.org/legal/epl-v10.html + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ |