1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
|
From 9bca530de450dda6e2ed818daa7707d29e20a214 Mon Sep 17 00:00:00 2001
From: Nitin Dahyabhai <thatnitind@gmail.com>
Date: Sun, 9 Aug 2020 10:24:17 -0400
Subject: [PATCH] [528191] Replace uses of
org.eclipse.jface.util.Assert and org.eclipse.jface.text.Assert
because of their deletion.
---
upstream link: https://git.eclipse.org/c/sourceediting/webtools.sourceediting.git/commit/?id=9bca530de450dda6e2ed818daa7707d29e20a214
diff --git a/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NamespaceInfoContentBuilder.java b/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NamespaceInfoContentBuilder.java
index a46a2e51f..603fe61dc 100644
--- a/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NamespaceInfoContentBuilder.java
+++ b/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NamespaceInfoContentBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2020 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -12,9 +12,9 @@
*******************************************************************************/
package org.eclipse.wst.xml.ui.internal.wizards;
+import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
-import java.util.Vector;
import org.eclipse.wst.xml.core.internal.contentmodel.CMAnyElement;
import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
@@ -23,8 +23,8 @@ import org.eclipse.wst.xml.core.internal.contentmodel.util.NamespaceInfo;
public class NamespaceInfoContentBuilder extends ContentBuilder {
protected int count = 1;
- public List list = new Vector();
- protected Hashtable table = new Hashtable();
+ public List<NamespaceInfo> list = new ArrayList<>();
+ protected Hashtable<String, NamespaceInfo> table = new Hashtable<>();
public NamespaceInfoContentBuilder() {
super();
diff --git a/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLGenerator.java b/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLGenerator.java
index f75e76d06..a5d327709 100644
--- a/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLGenerator.java
+++ b/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2016 IBM Corporation and others.
+ * Copyright (c) 2001, 2020 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -18,6 +18,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
@@ -26,12 +27,12 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jface.util.Assert;
import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
@@ -66,7 +67,7 @@ public class NewXMLGenerator {
protected String defaultSystemId;
// info for xsd
- public List namespaceInfoList;
+ public List<NamespaceInfo> namespaceInfoList;
public NewXMLGenerator() {
super();
@@ -229,7 +230,7 @@ public class NewXMLGenerator {
// TODO... instead of relying on file extensions, we need to keep
// track of the grammar type
- // better yet we should reate an SSE document so that we can format it
+ // better yet we should create an SSE document so that we can format it
// nicely before saving
// then we won't need the DOMWriter at all
//
@@ -242,14 +243,14 @@ public class NewXMLGenerator {
public void createNamespaceInfoList() {
- List result = new Vector();
+ List<NamespaceInfo> result = new ArrayList<>();
if (cmDocument != null) {
- List result2 = (List) cmDocument.getProperty("http://org.eclipse.wst/cm/properties/completeNamespaceInfo"); //$NON-NLS-1$
+ List<NamespaceInfo> result2 = (List<NamespaceInfo>) cmDocument.getProperty("http://org.eclipse.wst/cm/properties/completeNamespaceInfo"); //$NON-NLS-1$
if (result2 != null) {
result = result2;
int size = result.size();
for (int i = 0; i < size; i++) {
- NamespaceInfo info = (NamespaceInfo) result.get(i);
+ NamespaceInfo info = result.get(i);
if (i == 0) {
String locationInfo = null;
if (xmlCatalogEntry != null) {
@@ -284,8 +285,8 @@ public class NewXMLGenerator {
public boolean isMissingNamespaceLocation() {
boolean result = false;
- for (Iterator i = namespaceInfoList.iterator(); i.hasNext();) {
- NamespaceInfo info = (NamespaceInfo) i.next();
+ for (Iterator<NamespaceInfo> i = namespaceInfoList.iterator(); i.hasNext();) {
+ NamespaceInfo info = i.next();
if (info.locationHint == null) {
result = true;
break;
@@ -376,11 +377,11 @@ public class NewXMLGenerator {
protected class MyExternalCMDocumentSupport implements DOMContentBuilderImpl.ExternalCMDocumentSupport {
- protected List namespaceInfoList1;
+ protected List<NamespaceInfo> namespaceInfoList1;
protected URIResolver idResolver;
protected String resourceLocation;
- protected MyExternalCMDocumentSupport(List namespaceInfoListParam, String resourceLocation) {
+ protected MyExternalCMDocumentSupport(List<NamespaceInfo> namespaceInfoListParam, String resourceLocation) {
this.namespaceInfoList1 = namespaceInfoListParam;
this.resourceLocation = resourceLocation;
idResolver = URIResolverPlugin.createResolver();
diff --git a/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLWizard.java b/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLWizard.java
index 2e0f51ef7..4244145d7 100644
--- a/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLWizard.java
+++ b/org.eclipse.wst.xml.ui/src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLWizard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2012 IBM Corporation and others.
+ * Copyright (c) 2001, 2020 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -15,12 +15,14 @@ package org.eclipse.wst.xml.ui.internal.wizards;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -30,7 +32,6 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardDialog;
@@ -659,17 +660,17 @@ public class NewXMLWizard extends NewModelWizard {
combo.removeAll();
if ((generator.getCMDocument() != null) && (cmDocumentErrorMessage == null)) {
CMNamedNodeMap nameNodeMap = generator.getCMDocument().getElements();
- Vector nameNodeVector = new Vector();
+ List<String> nameNodeList = new ArrayList<>();
for (int i = 0; i < nameNodeMap.getLength(); i++) {
CMElementDeclaration cmElementDeclaration = (CMElementDeclaration) nameNodeMap.item(i);
Object value = cmElementDeclaration.getProperty("Abstract"); //$NON-NLS-1$
if (value != Boolean.TRUE) {
- nameNodeVector.add(cmElementDeclaration.getElementName());
+ nameNodeList.add(cmElementDeclaration.getElementName());
}
}
- Object[] nameNodeArray = nameNodeVector.toArray();
+ String[] nameNodeArray = nameNodeList.toArray(new String[nameNodeList.size()]);
if (nameNodeArray.length > 0) {
Arrays.sort(nameNodeArray, Collator.getInstance());
}
@@ -677,7 +678,7 @@ public class NewXMLWizard extends NewModelWizard {
String defaultRootName = (String) (generator.getCMDocument()).getProperty("http://org.eclipse.wst/cm/properties/defaultRootName"); //$NON-NLS-1$
int defaultRootIndex = -1;
for (int i = 0; i < nameNodeArray.length; i++) {
- String elementName = (String) nameNodeArray[i];
+ String elementName = nameNodeArray[i];
combo.add(elementName);
if ((defaultRootName != null) && defaultRootName.equals(elementName)) {
@@ -700,7 +701,7 @@ public class NewXMLWizard extends NewModelWizard {
// Provide default namespace prefix if none
for (int i = 0; i < generator.namespaceInfoList.size(); i++) {
- NamespaceInfo nsinfo = (NamespaceInfo) generator.namespaceInfoList.get(i);
+ NamespaceInfo nsinfo = generator.namespaceInfoList.get(i);
if (((nsinfo.prefix == null) || (nsinfo.prefix.trim().length() == 0)) && ((nsinfo.uri != null) && (nsinfo.uri.trim().length() != 0))) {
nsinfo.prefix = getDefaultPrefix(generator.namespaceInfoList);
}
@@ -726,15 +727,15 @@ public class NewXMLWizard extends NewModelWizard {
}
}
- private String getDefaultPrefix(List nsInfoList) {
+ private String getDefaultPrefix(List<NamespaceInfo> nsInfoList) {
String defaultPrefix = "p"; //$NON-NLS-1$
if (nsInfoList == null) {
return defaultPrefix;
}
- Vector v = new Vector();
+ Vector<String> v = new Vector<>();
for (int i = 0; i < nsInfoList.size(); i++) {
- NamespaceInfo nsinfo = (NamespaceInfo) nsInfoList.get(i);
+ NamespaceInfo nsinfo = nsInfoList.get(i);
if (nsinfo.prefix != null) {
v.addElement(nsinfo.prefix);
}
--
2.11.0
|