Changeset 29736 in osm for applications/editors


Ignore:
Timestamp:
2013-07-02T23:50:50+02:00 (11 years ago)
Author:
donvip
Message:

[josm_openstreetbugs] code cleanup before even thinking about bringing it into core for future notes support

Location:
applications/editors/josm/plugins/openstreetbugs
Files:
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/openstreetbugs/.classpath

    r11590 r29736  
    22<classpath>
    33        <classpathentry kind="src" path="src"/>
    4         <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
     4        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
    55        <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
    66        <classpathentry kind="output" path="build"/>
  • applications/editors/josm/plugins/openstreetbugs/.settings/org.eclipse.jdt.core.prefs

    r11568 r29736  
    1 #Fri Oct 31 10:08:06 CET 2008
    21eclipse.preferences.version=1
     2org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
     3org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
     4org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
     5org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
     6org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
     7org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
     8org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
     9org.eclipse.jdt.core.compiler.compliance=1.6
     10org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
     11org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
     12org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
     13org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
     14org.eclipse.jdt.core.compiler.problem.deadCode=warning
     15org.eclipse.jdt.core.compiler.problem.deprecation=warning
     16org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
     17org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
     18org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
     19org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
     20org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
     21org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
     22org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
     23org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
     24org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
     25org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
     26org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
     27org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
     28org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
     29org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
     30org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
     31org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
     32org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
     33org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
     34org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
     35org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
     36org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
     37org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
     38org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
     39org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
     40org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
     41org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
     42org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
     43org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
     44org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
     45org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
     46org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
     47org.eclipse.jdt.core.compiler.problem.nullReference=warning
     48org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
     49org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
     50org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
     51org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
     52org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
     53org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
     54org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
     55org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
     56org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
     57org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
     58org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
     59org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
     60org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
     61org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
     62org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
     63org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
     64org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
     65org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
     66org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
     67org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
     68org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
     69org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
     70org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
     71org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
     72org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
     73org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
     74org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
     75org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
     76org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
     77org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
     78org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
     79org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
     80org.eclipse.jdt.core.compiler.problem.unusedImport=warning
     81org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
     82org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
     83org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
     84org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
     85org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
     86org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
     87org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
     88org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
     89org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
     90org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
     91org.eclipse.jdt.core.compiler.source=1.6
    392org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
    493org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
     
    72161org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
    73162org.eclipse.jdt.core.formatter.indentation.size=4
     163org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
    74164org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
    75 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
     165org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
     166org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
    76167org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
     168org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
    77169org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
    78170org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
  • applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbPlugin.java

    r29373 r29736  
    273273    }
    274274
    275     public void setLayer(OsbLayer layer) {
    276         this.layer = layer;
    277     }
    278 
    279275    public DataSet getDataSet() {
    280276        return dataSet;
    281277    }
    282278
    283     public void setDataSet(DataSet dataSet) {
    284         this.dataSet = dataSet;
    285     }
    286 
    287279    public OsbDialog getDialog() {
    288280        return dialog;
  • applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/CloseAction.java

    r16134 r29736  
    5454            result = "ok";
    5555        } else {
    56             result = HttpUtils.post(uri, null, post, CHARSET);
     56            result = HttpUtils.post(uri, post, CHARSET);
    5757        }
    5858
  • applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/DownloadAction.java

    r19050 r29736  
    6464
    6565        // download the data
    66         String content = HttpUtils.get(uri, null, CHARSET);
     66        String content = HttpUtils.get(uri, CHARSET);
    6767
    6868        // clear dataset
  • applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/EditAction.java

    r16134 r29736  
    5757            result = "ok";
    5858        } else {
    59             result = HttpUtils.post(uri, null, post, CHARSET);
     59            result = HttpUtils.post(uri, post, CHARSET);
    6060        }
    6161
  • applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/NewAction.java

    r26345 r29736  
    6565            result = "ok 12345";
    6666        } else {
    67             result = HttpUtils.post(uri, null, post, CHARSET);
     67            result = HttpUtils.post(uri, post, CHARSET);
    6868        }
    6969
  • applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/util/HttpUtils.java

    r13497 r29736  
    2828package org.openstreetmap.josm.plugins.osb.api.util;
    2929
    30 import static org.openstreetmap.josm.tools.I18n.tr;
    31 
    3230import java.io.ByteArrayOutputStream;
    3331import java.io.IOException;
     
    3634import java.net.URL;
    3735import java.net.URLConnection;
    38 import java.util.Iterator;
    39 import java.util.List;
    40 import java.util.Map;
    41 import java.util.Map.Entry;
     36
     37import org.openstreetmap.josm.tools.Utils;
    4238
    4339public class HttpUtils {
    44     public static String get(String url, Map<String, String> headers, String charset) throws IOException {
    45         URL page = new URL(url);
    46         URLConnection con = page.openConnection();
    47         if(headers != null) {
    48             for (Iterator<Entry<String,String>> iterator = headers.entrySet().iterator(); iterator.hasNext();) {
    49                 Entry<String, String> entry = iterator.next();
    50                 con.setRequestProperty(entry.getKey(), entry.getValue());
    51             }
    52         }
    53 
     40    public static String get(String url, String charset) throws IOException {
    5441        ByteArrayOutputStream bos = new ByteArrayOutputStream();
    5542        int length = -1;
    5643        byte[] b = new byte[1024];
    57         InputStream in = con.getInputStream();
     44        InputStream in = Utils.openURL(new URL(url));
    5845        while( (length = in.read(b)) > 0 ) {
    5946            bos.write(b, 0, length);
    6047        }
     48        Utils.close(in);
    6149
    6250        return new String(bos.toByteArray(), charset);
    63     }
    64 
    65     public static HttpResponse getResponse(String url, Map<String, String> headers, String charset) throws IOException {
    66         URL page = new URL(url);
    67         URLConnection con = page.openConnection();
    68         if(headers != null) {
    69             for (Iterator<Entry<String,String>> iterator = headers.entrySet().iterator(); iterator.hasNext();) {
    70                 Entry<String, String> entry = iterator.next();
    71                 con.setRequestProperty(entry.getKey(), entry.getValue());
    72             }
    73         }
    74 
    75         ByteArrayOutputStream bos = new ByteArrayOutputStream();
    76         int length = -1;
    77         byte[] b = new byte[1024];
    78         InputStream in = con.getInputStream();
    79         while( (length = in.read(b)) > 0 ) {
    80             bos.write(b, 0, length);
    81         }
    82 
    83         HttpResponse response = new HttpResponse(new String(bos.toByteArray(), charset), con.getHeaderFields());
    84         return response;
    8551    }
    8652
     
    8854     *
    8955     * @param url
    90      * @param headers
    9156     * @param content the post body
    9257     * @param responseCharset the expected charset of the response
     
    9459     * @throws IOException
    9560     */
    96     public static String post(String url, Map<String, String> headers, String content, String responseCharset) throws IOException {
     61    public static String post(String url, String content, String responseCharset) throws IOException {
    9762        // initialize the connection
    9863        URL page = new URL(url);
    9964        URLConnection con = page.openConnection();
    10065        con.setDoOutput(true);
    101         if(headers != null) {
    102             for (Iterator<Entry<String,String>> iterator = headers.entrySet().iterator(); iterator.hasNext();) {
    103                 Entry<String, String> entry = iterator.next();
    104                 con.setRequestProperty(entry.getKey(), entry.getValue());
    105             }
    106         }
    10766
    10867        //send the post
     
    11978            bos.write(b, 0, length);
    12079        }
     80        Utils.close(in);
     81        Utils.close(os);
    12182
    12283        return new String(bos.toByteArray(), responseCharset);
    12384    }
    124 
    125     /**
    126      * Adds a parameter to a given URI
    127      * @param uri
    128      * @param param
    129      * @param value
    130      * @return
    131      */
    132     public static String addParameter(String uri, String param, String value) {
    133         StringBuilder sb = new StringBuilder(uri);
    134         if(uri.contains("?")) {
    135             sb.append('&');
    136         } else {
    137             sb.append('?');
    138         }
    139 
    140         sb.append(param);
    141         sb.append('=');
    142         sb.append(value);
    143 
    144         return sb.toString();
    145     }
    146 
    147     public static Map<String, List<String>> head(String url, Map<String, String> headers, String charset) throws IOException {
    148         URL page = new URL(url);
    149         URLConnection con = page.openConnection();
    150         if(headers != null) {
    151             for (Iterator<Entry<String,String>> iterator = headers.entrySet().iterator(); iterator.hasNext();) {
    152                 Entry<String, String> entry = iterator.next();
    153                 con.setRequestProperty(entry.getKey(), entry.getValue());
    154             }
    155         }
    156 
    157         return con.getHeaderFields();
    158     }
    159 
    160     public static String getHeaderField(Map<String, List<String>> headers, String headerField) {
    161         if(!headers.containsKey(headerField)) {
    162             return null;
    163         }
    164 
    165         List<String> value = headers.get(headerField);
    166         if(value.size() == 1) {
    167             return value.get(0);
    168         } else {
    169             throw new RuntimeException(tr("Header contains several values and cannot be mapped to a single string"));
    170         }
    171     }
    17285}
  • applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/dialogs/TextInputDialog.java

    r23191 r29736  
    4949import javax.swing.SwingConstants;
    5050import javax.swing.SwingUtilities;
     51import javax.swing.WindowConstants;
    5152
    5253import org.openstreetmap.josm.gui.widgets.ComboBoxHistory;
     
    153154            }
    154155        }
    155         setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
     156        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    156157    }
    157158
Note: See TracChangeset for help on using the changeset viewer.