Changeset 30717 in osm
- Timestamp:
- 2014-10-13T21:40:00+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/tag2link
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/tag2link/.settings/org.eclipse.jdt.core.prefs
r30416 r30717 1 1 eclipse.preferences.version=1 2 org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled 3 org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore 4 org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull 5 org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault 6 org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable 7 org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled 2 8 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 9 org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 3 10 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve … … 7 14 org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 15 org.eclipse.jdt.core.compiler.debug.sourceFile=generate 16 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning 9 17 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 18 org.eclipse.jdt.core.compiler.problem.autoboxing=ignore 19 org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning 20 org.eclipse.jdt.core.compiler.problem.deadCode=warning 21 org.eclipse.jdt.core.compiler.problem.deprecation=warning 22 org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled 23 org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled 24 org.eclipse.jdt.core.compiler.problem.discouragedReference=warning 25 org.eclipse.jdt.core.compiler.problem.emptyStatement=warning 10 26 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 27 org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning 28 org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore 29 org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled 30 org.eclipse.jdt.core.compiler.problem.fieldHiding=warning 31 org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning 32 org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning 33 org.eclipse.jdt.core.compiler.problem.forbiddenReference=error 34 org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning 35 org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled 36 org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning 37 org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning 38 org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning 39 org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore 40 org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning 41 org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore 42 org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore 43 org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled 44 org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore 45 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning 46 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled 47 org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning 48 org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore 49 org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning 50 org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning 51 org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore 52 org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning 53 org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error 54 org.eclipse.jdt.core.compiler.problem.nullReference=warning 55 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error 56 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning 57 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning 58 org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore 59 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore 60 org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore 61 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore 62 org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning 63 org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning 64 org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore 65 org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning 66 org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore 67 org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore 68 org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore 69 org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled 70 org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning 71 org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled 72 org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled 73 org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled 74 org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore 75 org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning 76 org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled 77 org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning 78 org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning 79 org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore 80 org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning 81 org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore 82 org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore 83 org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore 84 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore 85 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled 86 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled 87 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled 88 org.eclipse.jdt.core.compiler.problem.unusedImport=warning 89 org.eclipse.jdt.core.compiler.problem.unusedLabel=warning 90 org.eclipse.jdt.core.compiler.problem.unusedLocal=warning 91 org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning 92 org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore 93 org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled 94 org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled 95 org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled 96 org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning 97 org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore 98 org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning 99 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning 11 100 org.eclipse.jdt.core.compiler.source=1.7 12 101 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -
applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkRuleChecker.java
r28547 r30717 44 44 public class Tag2LinkRuleChecker implements Tag2LinkConstants { 45 45 46 private static Collection<Source> sources = new ArrayList< Source>();46 private static Collection<Source> sources = new ArrayList<>(); 47 47 48 48 private static boolean initialized = false; … … 149 149 150 150 private static Collection<Link> processEval(EvalResult eval, Rule rule, Source source) { 151 Collection<Link> result = new ArrayList< Link>();151 Collection<Link> result = new ArrayList<>(); 152 152 if (eval.matches()) { 153 153 for (Link link : rule.links) { … … 176 176 */ 177 177 public static Collection<Link> getLinks(IPrimitive p) { 178 Collection<Link> result = new ArrayList< Link>();178 Collection<Link> result = new ArrayList<>(); 179 179 for (Source source : sources) { 180 180 for (Rule rule : source.rules) { … … 191 191 */ 192 192 public static Collection<Link> getLinks(Tag tag) { 193 Collection<Link> result = new ArrayList< Link>();193 Collection<Link> result = new ArrayList<>(); 194 194 for (Source source : sources) { 195 195 for (Rule rule : source.rules) { -
applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenLinkAction.java
r28547 r30717 27 27 import java.net.URL; 28 28 29 import org.openstreetmap.josm.Main; 29 30 import org.openstreetmap.josm.actions.JosmAction; 30 31 import org.openstreetmap.josm.plugins.tag2link.Tag2LinkConstants; … … 71 72 data += param+"="+lp.params.get(param); 72 73 } 73 OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());74 osw.write(data);75 osw.flush();76 osw.close();74 try (OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream())) { 75 osw.write(data); 76 osw.flush(); 77 } 77 78 78 79 String filename = "output.pdf";// FIXME: should work for PDF files only (not even tested) 79 FileOutputStream fos = new FileOutputStream(filename); 80 InputStream is = conn.getInputStream(); 81 byte[] buffer = new byte[2048]; 82 int n = -1; 83 while ((n = is.read(buffer)) > -1) { 84 fos.write(buffer, 0, n); 80 try (FileOutputStream fos = new FileOutputStream(filename); 81 InputStream is = conn.getInputStream()) { 82 byte[] buffer = new byte[2048]; 83 int n = -1; 84 while ((n = is.read(buffer)) > -1) { 85 fos.write(buffer, 0, n); 86 } 85 87 } 86 is.close();87 fos.close();88 88 89 System.out.println("Opening "+filename);89 Main.info("Opening "+filename); 90 90 String result = OpenBrowser.displayUrl("file://"+filename); 91 91 if (result != null) { 92 System.err.println(result);92 Main.error(result); 93 93 } 94 94 95 95 } catch (MalformedURLException ex) { 96 ex.printStackTrace();96 Main.error(ex); 97 97 } catch (IOException ex) { 98 ex.printStackTrace();98 Main.error(ex); 99 99 } 100 100 } else { 101 System.out.println("Opening "+link.url);101 Main.info("Opening "+link.url); 102 102 String result = OpenBrowser.displayUrl(link.url); 103 103 if (result != null) { 104 System.err.println(result);104 Main.error(result); 105 105 } 106 106 } -
applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/LinkPost.java
r28547 r30717 26 26 public LinkPost(LinkPost link) { 27 27 this(new String(link.name), new String(link.url), 28 link.headers == null ? null : new HashMap< String, String>(link.headers),29 link.params == null ? null : new HashMap< String, String>(link.params));28 link.headers == null ? null : new HashMap<>(link.headers), 29 link.params == null ? null : new HashMap<>(link.params)); 30 30 } 31 31 -
applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Rule.java
r28547 r30717 26 26 27 27 public class Rule { 28 public final Collection<Condition> conditions = new ArrayList< Condition>();29 public final Collection<Link> links = new ArrayList< Link>();28 public final Collection<Condition> conditions = new ArrayList<>(); 29 public final Collection<Link> links = new ArrayList<>(); 30 30 31 31 public static class MatchingTag { … … 37 37 this.key = key; 38 38 this.value = value; 39 this.params = new HashMap< String, String>();39 this.params = new HashMap<>(); 40 40 this.prefix = prefix; 41 41 addKeyValueParams(); … … 71 71 this.conditionsNumber = conditionsNumber; 72 72 } 73 public final Collection<MatchingTag> matchingTags = new ArrayList< MatchingTag>();73 public final Collection<MatchingTag> matchingTags = new ArrayList<>(); 74 74 public boolean matches() { 75 75 return conditionsNumber > 0 && matchingTags.size() >= conditionsNumber; … … 117 117 118 118 public EvalResult evaluates(Tag tag) { 119 Map<String, String> map = new HashMap< String, String>();119 Map<String, String> map = new HashMap<>(); 120 120 map.put(tag.getKey(), tag.getValue()); 121 121 return evaluates(map); -
applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Source.java
r28547 r30717 33 33 * The rules applied against an OSM primitive or tag. 34 34 */ 35 public final Collection<Rule> rules = new ArrayList< Rule>();35 public final Collection<Rule> rules = new ArrayList<>(); 36 36 37 37 /** -
applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/io/SourcesReader.java
r28549 r30717 64 64 */ 65 65 public static Collection<Source> readSources() { 66 List<Source> result = new ArrayList< Source>();66 List<Source> result = new ArrayList<>(); 67 67 68 68 try { … … 123 123 124 124 private Collection<Source> parseDoc() throws XMLStreamException { 125 List<Source> result = new ArrayList< Source>();125 List<Source> result = new ArrayList<>(); 126 126 while (parser.hasNext()) { 127 127 int event = parser.next(); … … 140 140 141 141 private Collection<Source> parseRoot() throws XMLStreamException { 142 List<Source> result = new ArrayList< Source>();142 List<Source> result = new ArrayList<>(); 143 143 while (parser.hasNext()) { 144 144 int event = parser.next(); … … 217 217 if (parser.getLocalName().equals("header")) { 218 218 if (headers == null) { 219 headers = new HashMap< String, String>();219 headers = new HashMap<>(); 220 220 } 221 221 headers.put(parser.getAttributeValue(null, "name"), parser.getAttributeValue(null, "value")); 222 222 } else if (parser.getLocalName().equals("param")) { 223 223 if (params == null) { 224 params = new HashMap< String, String>();224 params = new HashMap<>(); 225 225 } 226 226 params.put(parser.getAttributeValue(null, "name"), parser.getAttributeValue(null, "value")); -
applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/AbstractPopupListener.java
r28547 r30717 37 37 protected AbstractPopupListener(MapFrame frame) { 38 38 this.frame = frame; 39 this.itemList = new ArrayList< JMenuItem>();39 this.itemList = new ArrayList<>(); 40 40 } 41 41
Note:
See TracChangeset
for help on using the changeset viewer.