diff --git a/com.arm.cmsis.config/src/com/arm/cmsis/config/model/ConfigWizardItem.java b/com.arm.cmsis.config/src/com/arm/cmsis/config/model/ConfigWizardItem.java index 7d2b099..725434d 100644 --- a/com.arm.cmsis.config/src/com/arm/cmsis/config/model/ConfigWizardItem.java +++ b/com.arm.cmsis.config/src/com/arm/cmsis/config/model/ConfigWizardItem.java @@ -11,8 +11,9 @@ package com.arm.cmsis.config.model; +import java.util.ArrayList; import java.util.Collection; -import java.util.LinkedList; +import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -47,7 +48,7 @@ public class ConfigWizardItem implements IConfigWizardItem { private boolean fInvertValue; private Map fItems; private Map fStrItems; - private LinkedList fChildren; + private List fChildren; private String fSelStr; /** @@ -69,7 +70,7 @@ public ConfigWizardItem(EItemType itemType, int line, IConfigWizardItem parent) fSpinStep = 0; fItems = new TreeMap<>(); fStrItems = new TreeMap<>(); - fChildren = new LinkedList<>(); + fChildren = new ArrayList<>(); } @Override @@ -312,10 +313,10 @@ public Collection getChildren() { @Override public IConfigWizardItem getLastChild() { - if (fChildren == null || fChildren.size() == 0) { + if (fChildren == null || fChildren.isEmpty()) { return null; } - return fChildren.getLast(); + return fChildren.get(fChildren.size() - 1); } @Override diff --git a/com.arm.cmsis.config/src/com/arm/cmsis/parser/ConfigWizardScanner.java b/com.arm.cmsis.config/src/com/arm/cmsis/parser/ConfigWizardScanner.java index ed3c4a3..857b480 100644 --- a/com.arm.cmsis.config/src/com/arm/cmsis/parser/ConfigWizardScanner.java +++ b/com.arm.cmsis.config/src/com/arm/cmsis/parser/ConfigWizardScanner.java @@ -12,9 +12,9 @@ package com.arm.cmsis.parser; +import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashMap; -import java.util.LinkedList; import java.util.Map; import java.util.regex.Pattern; @@ -69,7 +69,7 @@ protected boolean removeEldestEntry(Map.Entry eldest) { public ConfigWizardScanner(boolean isAsmFile) { isAsm = isAsmFile; - Collection rules = new LinkedList<>(); + Collection rules = new ArrayList<>(); // Comment rules rules.add(new CommentRule("//", new Token(CONFIG_COMMENT))); //$NON-NLS-1$ diff --git a/com.arm.cmsis.pack.build.armcc/src/com/arm/cmsis/pack/build/armcc/ArmccToolChainAdapter.java b/com.arm.cmsis.pack.build.armcc/src/com/arm/cmsis/pack/build/armcc/ArmccToolChainAdapter.java index 154b57c..9f142bd 100644 --- a/com.arm.cmsis.pack.build.armcc/src/com/arm/cmsis/pack/build/armcc/ArmccToolChainAdapter.java +++ b/com.arm.cmsis.pack.build.armcc/src/com/arm/cmsis/pack/build/armcc/ArmccToolChainAdapter.java @@ -11,9 +11,9 @@ package com.arm.cmsis.pack.build.armcc; +import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import org.eclipse.cdt.managedbuilder.core.BuildException; @@ -338,7 +338,7 @@ protected Collection getStringListValue(IBuildSettings buildSettings, in return null; case ARMCC5_ASMDEFINES_OPTION: case IBuildSettings.ADEFINES_OPTION: { - List asmDefines = new LinkedList(); + List asmDefines = new ArrayList(); if (oType == ARMCC5_ASMDEFINES_OPTION) oType = IBuildSettings.RTE_DEFINES; // change to key used in buildSettings Collection defines = buildSettings.getStringListValue(oType); @@ -368,7 +368,7 @@ protected Collection getStringListValue(IBuildSettings buildSettings, in Collection value = super.getStringListValue(buildSettings, oType); if (rteValue != null && !rteValue.isEmpty()) { if (value == null) { - value = new LinkedList<>(); + value = new ArrayList<>(); } for (String s : rteValue) { value.add(CmsisConstants.CMSIS_RTE_VAR + s); @@ -382,7 +382,7 @@ protected Collection getRteStringListValue(IBuildSettings buildSettings, switch (oType) { case IBuildSettings.ADEFINES_OPTION: case ARMCC5_ASMDEFINES_OPTION: { - List asmDefines = new LinkedList(); + List asmDefines = new ArrayList(); if (oType == ARMCC5_ASMDEFINES_OPTION) oType = IBuildSettings.RTE_DEFINES; // change to key used in buildSettings Collection defines = buildSettings.getStringListValue(oType); diff --git a/com.arm.cmsis.pack.build.armgcc/src/com/arm/cmsis/pack/build/armgcc/ArmGccToolChainAdapter.java b/com.arm.cmsis.pack.build.armgcc/src/com/arm/cmsis/pack/build/armgcc/ArmGccToolChainAdapter.java index cc5a2d5..382bd38 100644 --- a/com.arm.cmsis.pack.build.armgcc/src/com/arm/cmsis/pack/build/armgcc/ArmGccToolChainAdapter.java +++ b/com.arm.cmsis.pack.build.armgcc/src/com/arm/cmsis/pack/build/armgcc/ArmGccToolChainAdapter.java @@ -11,8 +11,8 @@ package com.arm.cmsis.pack.build.armgcc; +import java.util.ArrayList; import java.util.Collection; -import java.util.LinkedList; import java.util.List; import org.eclipse.cdt.managedbuilder.core.BuildException; @@ -158,7 +158,7 @@ protected Collection getStringListValue(IBuildSettings buildSettings, in return null; // we add libraries as objects => ignore libs and lib paths } else if (type == IBuildSettings.RTE_OBJECTS) { Collection objs = buildSettings.getStringListValue(IBuildSettings.RTE_OBJECTS); - List value = new LinkedList(); + List value = new ArrayList(); if (objs != null && !objs.isEmpty()) value.addAll(objs); Collection libs = buildSettings.getStringListValue(IBuildSettings.RTE_LIBRARIES); diff --git a/com.arm.cmsis.pack.build.gnuarmeclipse/src/com/arm/cmsis/pack/build/gnuarmeclipse/GnuarmeclipseToolChainAdapter.java b/com.arm.cmsis.pack.build.gnuarmeclipse/src/com/arm/cmsis/pack/build/gnuarmeclipse/GnuarmeclipseToolChainAdapter.java index 00a08e7..23c82fd 100644 --- a/com.arm.cmsis.pack.build.gnuarmeclipse/src/com/arm/cmsis/pack/build/gnuarmeclipse/GnuarmeclipseToolChainAdapter.java +++ b/com.arm.cmsis.pack.build.gnuarmeclipse/src/com/arm/cmsis/pack/build/gnuarmeclipse/GnuarmeclipseToolChainAdapter.java @@ -12,8 +12,8 @@ package com.arm.cmsis.pack.build.gnuarmeclipse; +import java.util.ArrayList; import java.util.Collection; -import java.util.LinkedList; import java.util.List; import org.eclipse.cdt.managedbuilder.core.IOption; @@ -131,7 +131,7 @@ protected Collection getStringListValue(IBuildSettings buildSettings, in } else if (type == IBuildSettings.RTE_DEFINES) { // escape defines by adding "${cmsis_rte}" prefix Collection defines = buildSettings.getStringListValue(IBuildSettings.RTE_DEFINES); - List value = new LinkedList(); + List value = new ArrayList(); if (defines != null && !defines.isEmpty()) { for (String s : defines) { value.add(CmsisConstants.CMSIS_RTE_VAR + s); @@ -141,7 +141,7 @@ protected Collection getStringListValue(IBuildSettings buildSettings, in } else if (type == IBuildSettings.RTE_OBJECTS) { Collection objs = buildSettings.getStringListValue(IBuildSettings.RTE_OBJECTS); - List value = new LinkedList(); + List value = new ArrayList(); if (objs != null && !objs.isEmpty()) value.addAll(objs); // add libraries as objects (gcc does not allow to specify libs with diff --git a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/error/CmsisErrorCollection.java b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/error/CmsisErrorCollection.java index a8175c5..2ef4730 100644 --- a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/error/CmsisErrorCollection.java +++ b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/error/CmsisErrorCollection.java @@ -11,10 +11,10 @@ package com.arm.cmsis.pack.error; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import com.arm.cmsis.pack.common.CmsisConstants; @@ -65,7 +65,7 @@ public void addError(CmsisError e) { if (e == null) return; if (fErrors == null) - fErrors = new LinkedList<>(); + fErrors = new ArrayList<>(); fErrors.add(e); ICmsisConsole console = getCmsisConsole(); if (console != null) { @@ -99,7 +99,7 @@ public CmsisError getFirstError() { @Override public Collection getErrorStrings() { - List errorStrings = new LinkedList<>(); + List errorStrings = new ArrayList<>(); for (ICmsisError e : getErrors()) { errorStrings.add(e.toString()); } diff --git a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/generic/GenericListenerList.java b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/generic/GenericListenerList.java index 5da2248..69c471f 100644 --- a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/generic/GenericListenerList.java +++ b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/generic/GenericListenerList.java @@ -11,10 +11,10 @@ package com.arm.cmsis.pack.generic; +import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashSet; -import java.util.LinkedList; import java.util.List; import java.util.Set; @@ -49,7 +49,7 @@ public synchronized void removeAllListeners() { @Override public synchronized void notifyListeners(E event) { // make a copy to avoid add/remove conflicts - List workingList = new LinkedList<>(listeners); + List workingList = new ArrayList<>(listeners); for (Iterator iterator = workingList.iterator(); iterator.hasNext();) { if (listeners.isEmpty()) return; diff --git a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/generic/ITreeItem.java b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/generic/ITreeItem.java index 85104d7..c32f15d 100644 --- a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/generic/ITreeItem.java +++ b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/generic/ITreeItem.java @@ -14,7 +14,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.LinkedList; /** * Generic template-based interface for tree like structures @@ -124,7 +123,7 @@ default Collection getChildrenOfType(Class type) { if (!hasChildren()) return Collections.emptyList(); - LinkedList typedChildren = new LinkedList<>(); + ArrayList typedChildren = new ArrayList<>(); for (T child : getChildren()) { if (type.isInstance(child)) { typedChildren.add(type.cast(child)); @@ -141,7 +140,7 @@ default Collection getChildrenOfType(Class type) { */ default Collection getAllChildrenOfType(Collection allChildren, Class type) { if (allChildren == null) - allChildren = new LinkedList<>(); + allChildren = new ArrayList<>(); if (hasChildren()) { allChildren.addAll(getChildrenOfType(type)); // add own for (T c : getChildren()) { diff --git a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/item/CmsisMapItem.java b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/item/CmsisMapItem.java index c7f3276..a445eae 100644 --- a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/item/CmsisMapItem.java +++ b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/item/CmsisMapItem.java @@ -11,9 +11,9 @@ package com.arm.cmsis.pack.item; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -109,7 +109,7 @@ public T findChild(List keyPath, boolean useFullPath) { @Override public List getKeyPath() { - List keyPath = new LinkedList<>(); + List keyPath = new ArrayList<>(); T child = getThisItem(); for (T parent = getParent(); parent != null; parent = parent.getParent()) { String key = parent.getItemKey(child); diff --git a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/item/CmsisTreeItem.java b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/item/CmsisTreeItem.java index ae2faec..9d2107d 100644 --- a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/item/CmsisTreeItem.java +++ b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/item/CmsisTreeItem.java @@ -11,10 +11,10 @@ package com.arm.cmsis.pack.item; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; -import java.util.LinkedList; import com.arm.cmsis.pack.common.CmsisConstants; import com.arm.cmsis.pack.utils.WildCards; @@ -169,7 +169,7 @@ protected Collection children() { */ protected Collection createCollection() { // default creates linkedList - return new LinkedList<>(); + return new ArrayList<>(); } @Override diff --git a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/utils/FileChangeWatcher.java b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/utils/FileChangeWatcher.java index 1a59591..eef66a9 100644 --- a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/utils/FileChangeWatcher.java +++ b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/utils/FileChangeWatcher.java @@ -23,9 +23,9 @@ import java.nio.file.WatchKey; import java.nio.file.WatchService; import java.nio.file.attribute.FileTime; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -167,16 +167,20 @@ public synchronized void registerFile(String file) { containsWildcards = true; File f = new File(file); - long modified = 0; - if (f.exists()) { - modified = f.lastModified(); + File parentDir = f.getParentFile(); + if (parentDir == null) { + return; // do not monitor current directory implicitly } - filesToWatch.put(file, modified); - File parentDir = f.getParentFile(); if (!parentDir.exists()) { parentDir.mkdirs(); } + + long modified = 0; + if (f.exists()) { + modified = f.lastModified(); + } + filesToWatch.put(file, modified); registerDir(Paths.get(parentDir.getAbsolutePath())); } @@ -248,7 +252,7 @@ protected synchronized void registerDir(Path path) { } protected WatchEvent.Kind[] getEventKinds() { - List> eventList = new LinkedList<>(); + List> eventList = new ArrayList<>(); if ((watchFlags & CREATE) == CREATE) { eventList.add(StandardWatchEventKinds.ENTRY_CREATE); } diff --git a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/utils/Utils.java b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/utils/Utils.java index 0f1f042..d1e2341 100644 --- a/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/utils/Utils.java +++ b/com.arm.cmsis.pack.common/src/com/arm/cmsis/pack/utils/Utils.java @@ -26,9 +26,9 @@ import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.format.DateTimeFormatter; +import java.util.ArrayList; import java.util.Collection; import java.util.Date; -import java.util.LinkedList; import java.util.Set; import com.arm.cmsis.pack.common.CmsisConstants; @@ -63,7 +63,7 @@ private Utils() { */ public static Collection findFiles(File dir, String ext, Collection files, int depth) { if (files == null) { - files = new LinkedList<>(); + files = new ArrayList<>(); } File[] list = dir.listFiles(); diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/build/BuildSettings.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/build/BuildSettings.java index a3b43e7..72320fb 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/build/BuildSettings.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/build/BuildSettings.java @@ -11,9 +11,9 @@ package com.arm.cmsis.pack.build; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.LinkedList; import java.util.Map; import java.util.TreeMap; import java.util.TreeSet; @@ -149,7 +149,7 @@ protected Collection createList(int type) { case ASMINCPATHS_OPTION: return new TreeSet<>(new AlnumComparator(false, true)); default: - return new LinkedList<>(); + return new ArrayList<>(); } } diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpBoard.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpBoard.java index 4033d03..7022f3e 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpBoard.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpBoard.java @@ -12,7 +12,7 @@ package com.arm.cmsis.pack.data; import java.util.Collection; -import java.util.LinkedList; +import java.util.ArrayList; import com.arm.cmsis.pack.common.CmsisConstants; import com.arm.cmsis.pack.generic.IAttributes; @@ -131,7 +131,7 @@ public Collection getCompatibleDevices() { } protected Collection getDevices(final String requiredTag) { - Collection devices = new LinkedList<>(); + Collection devices = new ArrayList<>(); Collection children = getChildren(); if (children == null) { return devices; diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpCodeTemplate.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpCodeTemplate.java index 4c31d62..1a2d324 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpCodeTemplate.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpCodeTemplate.java @@ -12,7 +12,7 @@ package com.arm.cmsis.pack.data; import java.util.Collection; -import java.util.LinkedList; +import java.util.ArrayList; import com.arm.cmsis.pack.common.CmsisConstants; import com.arm.cmsis.pack.info.ICpComponentInfo; @@ -24,7 +24,7 @@ */ public class CpCodeTemplate extends CpItem implements ICpCodeTemplate { - Collection fCodeTemplates = new LinkedList<>(); + Collection fCodeTemplates = new ArrayList<>(); ICpItemInfo fInfo; /** diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpConditionContext.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpConditionContext.java index ee3aa3c..66bc509 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpConditionContext.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpConditionContext.java @@ -14,7 +14,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.Map; import java.util.Set; @@ -159,7 +159,7 @@ else if (res == EEvaluationResult.ERROR) @Override public Collection filterItems(Collection sourceCollection) { - Collection filtered = new LinkedList(); + Collection filtered = new ArrayList(); if (sourceCollection != null && !sourceCollection.isEmpty()) { for (ICpItem item : sourceCollection) { EEvaluationResult res = item.evaluate(this); diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpDebug.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpDebug.java index 67b825a..b6bb87e 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpDebug.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpDebug.java @@ -12,7 +12,7 @@ package com.arm.cmsis.pack.data; import java.util.Collection; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import com.arm.cmsis.pack.common.CmsisConstants; @@ -44,7 +44,7 @@ public String getSvdFile() { @Override public Collection getDataPacthes() { - List patches = new LinkedList(); + List patches = new ArrayList(); Collection children = getChildren(); if (children != null) { for (ICpItem item : children) { diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpDebugConfiguration.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpDebugConfiguration.java index e153ff8..0202e5b 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpDebugConfiguration.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpDebugConfiguration.java @@ -13,7 +13,7 @@ import java.util.Collection; import java.util.HashMap; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -135,7 +135,7 @@ public Collection getAlgorithms() { @Override public Collection getDefaultAlgorithms() { - List defaultAlgos = new LinkedList(); + List defaultAlgos = new ArrayList(); for (ICpAlgorithm a : algorithms.values()) { if (a.isDefault()) defaultAlgos.add(a); diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpDeviceItem.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpDeviceItem.java index 5606104..39ff71e 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpDeviceItem.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpDeviceItem.java @@ -13,7 +13,7 @@ import java.util.Collection; import java.util.HashMap; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -65,7 +65,7 @@ public void addChild(ICpItem item) { cachedChildArray = null; // invalidate if (item instanceof ICpDeviceItem) { if (deviceItems == null) { - deviceItems = new LinkedList<>(); + deviceItems = new ArrayList<>(); } deviceItems.add((ICpDeviceItem) item); } else { // property @@ -268,7 +268,7 @@ public boolean hasEffectiveChildren() { @Override public Collection getEffectiveChildren() { // combination of direct properties and device children - List effectiveChildren = new LinkedList<>(); + List effectiveChildren = new ArrayList<>(); if (hasChildren()) { effectiveChildren.addAll(getChildren()); } diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpGenerator.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpGenerator.java index b5ebe58..ec9c114 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpGenerator.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpGenerator.java @@ -13,7 +13,7 @@ import java.util.Collection; import java.util.HashSet; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -85,7 +85,7 @@ public ICpItem getCommand(String type) { @Override public Collection getArguments(String type) { - List arguments = new LinkedList<>(); + List arguments = new ArrayList<>(); if (type == null || type.isEmpty()) { return arguments; } diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpItem.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpItem.java index 259687c..d286210 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpItem.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpItem.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -42,7 +42,7 @@ public class CpItem extends CmsisTreeItem implements ICpItem { protected String fURL = null; protected String fId = null; - public static final Collection EMPTY_LIST = new LinkedList<>(); + public static final Collection EMPTY_LIST = new ArrayList<>(); /** * Default hierarchy constructor @@ -230,7 +230,7 @@ public Collection getGrandChildren(String tag) { @Override public Collection getChildren(String tag) { - List tagChildren = new LinkedList<>(); + List tagChildren = new ArrayList<>(); Collection children = getChildren(); if (children != null) { for (ICpItem item : children) { diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpPackFamily.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpPackFamily.java index ed2f1ec..19008cd 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpPackFamily.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/CpPackFamily.java @@ -12,7 +12,7 @@ package com.arm.cmsis.pack.data; import java.util.Collection; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.Map; import java.util.TreeMap; @@ -220,7 +220,7 @@ protected Collection collectPreviousReleases() { @Override protected Object[] createChildArray() { fPreviousReleases = null; - Collection children = new LinkedList<>(); + Collection children = new ArrayList<>(); children.addAll(getPacks()); ICpItem previousReleases = getPreviousReleases(); // refresh previous release info if (previousReleases != null) { diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/ICpBoard.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/ICpBoard.java index 8d46591..20134de 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/ICpBoard.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/ICpBoard.java @@ -86,7 +86,7 @@ static String constructBoardDisplayName(ICpItem item) { name = item.getName(); String rev = item.getRevision(); if (!rev.isEmpty()) { - name += " (" + rev + ")"; + name += " (" + rev + ")"; //$NON-NLS-1$//$NON-NLS-2$ } } return name; diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/ICpItem.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/ICpItem.java index 420118c..5b25a6a 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/ICpItem.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/data/ICpItem.java @@ -12,7 +12,7 @@ package com.arm.cmsis.pack.data; import java.util.Collection; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -31,7 +31,7 @@ public interface ICpItem extends IAttributedItem, ICpItemFactory, ICmsisTreeItem public static final ICpItem NULL_CPITEM = null; // to resolve ambiguity in constructors public static final ICpItem[] EMPTY_CPITEM_ARRAY = new ICpItem[0]; - public static final List EMPTY_CPITEM_LIST = new LinkedList(); + public static final List EMPTY_CPITEM_LIST = new ArrayList(); /** * Returns root item containing this item as ICpRootItem diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/info/CpComponentInfo.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/info/CpComponentInfo.java index 01e5d90..bf64ac2 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/info/CpComponentInfo.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/info/CpComponentInfo.java @@ -225,4 +225,13 @@ public String getGpdsc() { return null; return gpdscItem.getName(); } + + @Override + public String getWorkingDir() { + ICpItem gpdscItem = getFirstChild(CmsisConstants.GPDSC_TAG); + if (gpdscItem == null) + return null; + return gpdscItem.getAttribute(CmsisConstants.WORKING_DIR_TAG); + } + } diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/info/ICpComponentInfo.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/info/ICpComponentInfo.java index 9c5b8c2..97de533 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/info/ICpComponentInfo.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/info/ICpComponentInfo.java @@ -67,4 +67,10 @@ public interface ICpComponentInfo extends ICpComponent, ICpItemInfo, IEvaluation */ String getGpdsc(); + /** + * Returns working directory for gpdsc + * + * @return working directory attribute or null + */ + String getWorkingDir(); } diff --git a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/parser/CpPidxParser.java b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/parser/CpPidxParser.java index d2b9f73..a85e102 100644 --- a/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/parser/CpPidxParser.java +++ b/com.arm.cmsis.pack.data/src/com/arm/cmsis/pack/parser/CpPidxParser.java @@ -18,7 +18,7 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -171,7 +171,7 @@ public static String getPdscFileName(Entry item) { * @return a list of pdsc files (locating in local repositories) */ public static Collection getLocalRepositoryFileNames(String localDir) { - Collection fileNames = new LinkedList<>(); + Collection fileNames = new ArrayList<>(); localDir += '/' + CmsisConstants.LOCAL_REPOSITORY_PIDX; Map map = parsePidx(localDir); diff --git a/com.arm.cmsis.pack.installer.ui/src/com/arm/cmsis/pack/installer/ui/views/PackInstallerView.java b/com.arm.cmsis.pack.installer.ui/src/com/arm/cmsis/pack/installer/ui/views/PackInstallerView.java index 0e23362..a158540 100644 --- a/com.arm.cmsis.pack.installer.ui/src/com/arm/cmsis/pack/installer/ui/views/PackInstallerView.java +++ b/com.arm.cmsis.pack.installer.ui/src/com/arm/cmsis/pack/installer/ui/views/PackInstallerView.java @@ -14,7 +14,7 @@ import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import org.eclipse.jface.action.Action; @@ -95,7 +95,7 @@ public abstract class PackInstallerView extends ViewPart implements IRteEventLis protected StackLayout fStackLayout = null; protected Link fLink = null; protected Listener fLinkListener; - protected List fSelectionPath = new LinkedList<>(); + protected List fSelectionPath = new ArrayList<>(); protected ViewerFilter[] fViewFilters = null; PatternFilter fPatternFilter = null; @@ -211,7 +211,7 @@ protected ICmsisItem getSelectedItem() { } public static List createSelectionPath(ISelection selection) { - List selectionPath = new LinkedList<>(); + List selectionPath = new ArrayList<>(); if (!(selection instanceof ITreeSelection)) return selectionPath; ITreeSelection treeSelection = (ITreeSelection) selection; @@ -692,7 +692,7 @@ protected ICmsisItem selectItem(List selectionPath) { return null; ITreeContentProvider cp = (ITreeContentProvider) fViewer.getContentProvider(); Object[] elements = cp.getElements(fViewer.getInput()); - List path = new LinkedList<>(); + List path = new ArrayList<>(); ICmsisItem selectedItem = null; for (String name : selectionPath) { ICmsisItem cmsisItem = getCmsisItem(elements, name); diff --git a/com.arm.cmsis.pack.installer.ui/src/com/arm/cmsis/pack/installer/ui/views/PackPropertyView.java b/com.arm.cmsis.pack.installer.ui/src/com/arm/cmsis/pack/installer/ui/views/PackPropertyView.java index 4368d9c..dcad37e 100644 --- a/com.arm.cmsis.pack.installer.ui/src/com/arm/cmsis/pack/installer/ui/views/PackPropertyView.java +++ b/com.arm.cmsis.pack.installer.ui/src/com/arm/cmsis/pack/installer/ui/views/PackPropertyView.java @@ -12,7 +12,7 @@ package com.arm.cmsis.pack.installer.ui.views; import java.util.Collection; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.regex.Pattern; import org.eclipse.jface.action.Action; @@ -124,7 +124,7 @@ private Object[] getPackChildren(ICpPack pack) { return ITreeObject.EMPTY_OBJECT_ARRAY; } - Collection result = new LinkedList<>(); + Collection result = new ArrayList<>(); for (ICpItem child : pack.getChildren()) { if (CmsisConstants.DEVICES_TAG.equals(child.getTag()) || CmsisConstants.BOARDS_TAG.equals(child.getTag()) @@ -172,7 +172,7 @@ private Object[] getExamples(ICpItem examples) { return ITreeObject.EMPTY_OBJECT_ARRAY; } - Collection result = new LinkedList<>(); + Collection result = new ArrayList<>(); ICpEnvironmentProvider envProvider = CpPlugIn.getEnvironmentProvider(); for (ICpItem item : examples.getChildren()) { if (!(item instanceof ICpExample)) { @@ -192,7 +192,7 @@ private Object[] getExampleChildren(ICpExample example) { // Only show the board item under the example item ICpBoard board = example.getFirstChildOfType(ICpBoard.class); if (board != null) { - Collection result = new LinkedList<>(); + Collection result = new ArrayList<>(); result.add(board); return result.toArray(); } diff --git a/com.arm.cmsis.pack.installer/src/com/arm/cmsis/pack/installer/CpPackInstaller.java b/com.arm.cmsis.pack.installer/src/com/arm/cmsis/pack/installer/CpPackInstaller.java index 2e92049..5842320 100644 --- a/com.arm.cmsis.pack.installer/src/com/arm/cmsis/pack/installer/CpPackInstaller.java +++ b/com.arm.cmsis.pack.installer/src/com/arm/cmsis/pack/installer/CpPackInstaller.java @@ -29,7 +29,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -296,7 +296,7 @@ public void importPack(String filePath) { @Override public void importFolderPacks(String rootPath) { - List files = new LinkedList<>(); + List files = new ArrayList<>(); Utils.findPdscFiles(new File(rootPath), files, 256); String jobId = files.stream().map(filename -> CpPlugIn.getPackManager().readPack(filename)) .filter(pack -> pack != null).map(pack -> pack.getId()).collect(Collectors.joining(",")); //$NON-NLS-1$ @@ -573,7 +573,7 @@ protected void updatePacks() { if (indexUrl == null || indexUrl.isEmpty()) { indexUrl = CmsisConstants.REPO_KEIL_INDEX_URL; } - List indexList = new LinkedList<>(); + List indexList = new ArrayList<>(); try { boolean needsUpdate = false; diff --git a/com.arm.cmsis.pack.installer/src/com/arm/cmsis/pack/installer/jobs/CpPackImportFolderJob.java b/com.arm.cmsis.pack.installer/src/com/arm/cmsis/pack/installer/jobs/CpPackImportFolderJob.java index fffe515..13ec1e5 100644 --- a/com.arm.cmsis.pack.installer/src/com/arm/cmsis/pack/installer/jobs/CpPackImportFolderJob.java +++ b/com.arm.cmsis.pack.installer/src/com/arm/cmsis/pack/installer/jobs/CpPackImportFolderJob.java @@ -14,7 +14,7 @@ import java.io.File; import java.io.IOException; import java.util.HashSet; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -104,7 +104,7 @@ protected boolean importFolderPacks(File parentFolder, Set copiedFolder, } } } - List files = new LinkedList(); + List files = new ArrayList(); Utils.findPdscFiles(parentFolder, files, 0); if (files.isEmpty()) { // this is a normal folder return true; diff --git a/com.arm.cmsis.pack.installer/src/com/arm/cmsis/pack/installer/jobs/CpPackUnpackJob.java b/com.arm.cmsis.pack.installer/src/com/arm/cmsis/pack/installer/jobs/CpPackUnpackJob.java index e3d1f52..c42011a 100644 --- a/com.arm.cmsis.pack.installer/src/com/arm/cmsis/pack/installer/jobs/CpPackUnpackJob.java +++ b/com.arm.cmsis.pack.installer/src/com/arm/cmsis/pack/installer/jobs/CpPackUnpackJob.java @@ -18,7 +18,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.Collection; -import java.util.LinkedList; +import java.util.ArrayList; import javax.swing.text.BadLocationException; import javax.swing.text.Document; @@ -205,7 +205,7 @@ private boolean unzip(IProgressMonitor monitor) { */ protected ICpPack parsePdscFile(File tempFolder) { // get pdsc file from temporary folder - Collection pdscFiles = new LinkedList<>(); + Collection pdscFiles = new ArrayList<>(); Utils.findPdscFiles(tempFolder, pdscFiles, 1); if (pdscFiles.isEmpty()) { fResult.setErrorString(Messages.CpPackUnpackJob_PdscFileNotFoundInPack + fDownloadedPackPath.toOSString()); diff --git a/com.arm.cmsis.pack.project/src/com/arm/cmsis/pack/configuration/RteConfiguration.java b/com.arm.cmsis.pack.project/src/com/arm/cmsis/pack/configuration/RteConfiguration.java index 6443b0f..bc656b2 100644 --- a/com.arm.cmsis.pack.project/src/com/arm/cmsis/pack/configuration/RteConfiguration.java +++ b/com.arm.cmsis.pack.project/src/com/arm/cmsis/pack/configuration/RteConfiguration.java @@ -11,10 +11,10 @@ package com.arm.cmsis.pack.configuration; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedList; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -191,7 +191,7 @@ public ICpFileInfo getProjectFileInfo(String fileName) { @Override public ICpFileInfo[] getProjectFileInfos(String fileName) { - Collection fileInfos = new LinkedList<>(); + Collection fileInfos = new ArrayList<>(); for (Entry e : fProjectFiles.entrySet()) { if (e.getKey().matches(fileName)) { fileInfos.add(e.getValue()); @@ -813,7 +813,10 @@ protected String getPathRelativeToProject(ICpFileInfo fi, String absPath, String } if (absPath.startsWith(baseDir)) { // the file is within project - return ProjectUtils.makePathRelative(absPath, baseDir); + String relPath = ProjectUtils.makePathRelative(absPath, baseDir); + if (!relPath.startsWith("..")) { //$NON-NLS-1$ + return relPath; + } } } diff --git a/com.arm.cmsis.pack.project/src/com/arm/cmsis/pack/project/RteProjectUpdater.java b/com.arm.cmsis.pack.project/src/com/arm/cmsis/pack/project/RteProjectUpdater.java index 1353f36..7415c28 100644 --- a/com.arm.cmsis.pack.project/src/com/arm/cmsis/pack/project/RteProjectUpdater.java +++ b/com.arm.cmsis.pack.project/src/com/arm/cmsis/pack/project/RteProjectUpdater.java @@ -3,10 +3,10 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -527,7 +527,8 @@ protected void addFile(IRteConfiguration rteConf, String dstFile, ICpFileInfo fi boolean generated = f.isGenerated(); ICpConfigurationInfo cpConf = rteConf.getConfigurationInfo(); String base = cpConf.getDir(true); - boolean local = srcFile.startsWith(base); + String relPath = ProjectUtils.makePathRelative(srcFile, base); + boolean local = !relPath.startsWith("..") && srcFile.startsWith(base); //$NON-NLS-1$ EFileRole role = fi.getRole(); if (generated || local) { role = EFileRole.NONE; // prevent generated files from copy @@ -618,7 +619,7 @@ protected void updateRteComponentsH() throws CoreException { if (rteConf == null) { return; } - List content = new LinkedList<>(); + List content = new ArrayList<>(); // prepend #define CMSIS_device_header String deviceHeader = rteConf.getDeviceHeader(); if (deviceHeader != null && !deviceHeader.isEmpty()) { diff --git a/com.arm.cmsis.pack.project/src/com/arm/cmsis/pack/project/utils/ProjectUtils.java b/com.arm.cmsis.pack.project/src/com/arm/cmsis/pack/project/utils/ProjectUtils.java index f2c5946..5632f5b 100644 --- a/com.arm.cmsis.pack.project/src/com/arm/cmsis/pack/project/utils/ProjectUtils.java +++ b/com.arm.cmsis.pack.project/src/com/arm/cmsis/pack/project/utils/ProjectUtils.java @@ -19,7 +19,7 @@ import java.io.PrintWriter; import java.util.Collection; import java.util.Iterator; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; @@ -942,7 +942,7 @@ public static ICpItem createToolChainInfo(String Tcompiler, String Toutput) { * @return collection of IToolChain object satisfying thr prefix */ public static Collection getToolChainsByIdPrefix(String prefix) { - List toolchains = new LinkedList<>(); + List toolchains = new ArrayList<>(); IToolChain[] toolchainList = ManagedBuildManager.getRealToolChains(); for (IToolChain t : toolchainList) { if (t == null || !t.isSupported()) diff --git a/com.arm.cmsis.pack.ui/src/com/arm/cmsis/pack/ui/LaunchGenerator.java b/com.arm.cmsis.pack.ui/src/com/arm/cmsis/pack/ui/LaunchGenerator.java index daae45b..90ee3e2 100644 --- a/com.arm.cmsis.pack.ui/src/com/arm/cmsis/pack/ui/LaunchGenerator.java +++ b/com.arm.cmsis.pack.ui/src/com/arm/cmsis/pack/ui/LaunchGenerator.java @@ -17,8 +17,8 @@ import java.lang.reflect.MalformedParametersException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.util.ArrayList; import java.util.Collection; -import java.util.LinkedList; import java.util.List; import org.eclipse.core.runtime.Platform; @@ -136,12 +136,12 @@ protected void launchExe() throws IOException { command = commandItem.getAbsolutePath(command); } - List args = new LinkedList<>(); + List args = new ArrayList<>(); args.add(command); for (ICpItem argItem : argItems) { - args.add(argItem.getAttribute(CmsisConstants.SWITCH)); - String arg = ep.expandString(argItem.getText(), fConfigInfo, true); + String arg = argItem.getAttribute(CmsisConstants.SWITCH) + + ep.expandString(argItem.getText(), fConfigInfo, true); args.add(arg); } ProcessBuilder pb = new ProcessBuilder(args); @@ -198,7 +198,7 @@ protected void launchJava() throws ClassNotFoundException, SecurityException, No throw new ClassNotFoundException(NLS.bind(CpStringsUI.LaunchGenerator_ClassNotFound, className)); } - Collection> paraTypes = new LinkedList>(); + Collection> paraTypes = new ArrayList>(); for (int i = 0; i < argItems.size(); i++) { paraTypes.add(String.class); } @@ -219,7 +219,7 @@ protected void launchJava() throws ClassNotFoundException, SecurityException, No } ICpEnvironmentProvider ep = CpPlugIn.getEnvironmentProvider(); - Collection params = new LinkedList(); + Collection params = new ArrayList(); for (ICpItem argItem : argItems) { params.add(ep.expandString(argItem.getText(), fConfigInfo, true)); } diff --git a/com.arm.cmsis.pack.ui/src/com/arm/cmsis/pack/ui/preferences/CpManLocalRepoPage.java b/com.arm.cmsis.pack.ui/src/com/arm/cmsis/pack/ui/preferences/CpManLocalRepoPage.java index e9303fa..b2023a3 100644 --- a/com.arm.cmsis.pack.ui/src/com/arm/cmsis/pack/ui/preferences/CpManLocalRepoPage.java +++ b/com.arm.cmsis.pack.ui/src/com/arm/cmsis/pack/ui/preferences/CpManLocalRepoPage.java @@ -2,7 +2,7 @@ import java.net.URI; import java.util.HashMap; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -151,7 +151,7 @@ public void mouseUp(MouseEvent e) { btnRemove.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1)); btnRemove.setText(CpStringsUI.CpManLocalRepoPage_Remove); - List list = new LinkedList<>(); + List list = new ArrayList<>(); for (Map.Entry item : itemFromFile.entrySet()) { String[] str = new String[2]; str[0] = item.getKey(); diff --git a/com.arm.cmsis.pack.ui/src/com/arm/cmsis/pack/ui/tree/BoardViewContentProvider.java b/com.arm.cmsis.pack.ui/src/com/arm/cmsis/pack/ui/tree/BoardViewContentProvider.java index 81e740f..c11700a 100644 --- a/com.arm.cmsis.pack.ui/src/com/arm/cmsis/pack/ui/tree/BoardViewContentProvider.java +++ b/com.arm.cmsis.pack.ui/src/com/arm/cmsis/pack/ui/tree/BoardViewContentProvider.java @@ -12,7 +12,7 @@ package com.arm.cmsis.pack.ui.tree; import java.util.Collection; -import java.util.LinkedList; +import java.util.ArrayList; import com.arm.cmsis.pack.rte.boards.IRteBoardDeviceItem; import com.arm.cmsis.pack.rte.boards.IRteBoardItem; @@ -57,7 +57,7 @@ public Object[] getChildren(Object parentElement) { return rteBoardItem.getChildArray(); } // Normal board - Collection children = new LinkedList<>(); + Collection children = new ArrayList<>(); // Get mounted devices IRteBoardDeviceItem mountedDevices = rteBoardItem.getMountedDevices(); diff --git a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/CpPackManager.java b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/CpPackManager.java index 39bc318..fce9e1c 100644 --- a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/CpPackManager.java +++ b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/CpPackManager.java @@ -16,9 +16,9 @@ import java.io.File; import java.io.IOException; import java.net.URI; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -419,7 +419,7 @@ public synchronized IRteBoardItem getRteBoards() { @Override public Collection getCompatibleBoards(IAttributes deviceAttributes) { - List boards = new LinkedList<>(); + List boards = new ArrayList<>(); getBoards(); if (fAllBoards == null || fAllBoards.isEmpty()) { return boards; @@ -787,7 +787,7 @@ protected void processPackRemoved(RtePackJobResult jobResult, String topic) { } // Collect the pack collections from which the pack should be removed - Collection packCollections = new LinkedList<>(); + Collection packCollections = new ArrayList<>(); packCollections.add(fAllInstalledPacks); packCollections.add(fAllPacks); if (RteEvent.PACK_DELETE_JOB_FINISHED.equals(topic)) { diff --git a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/preferences/CpPreferenceInitializer.java b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/preferences/CpPreferenceInitializer.java index 708d7c5..db161de 100644 --- a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/preferences/CpPreferenceInitializer.java +++ b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/preferences/CpPreferenceInitializer.java @@ -18,8 +18,8 @@ import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.Arrays; -import java.util.LinkedList; import java.util.List; import java.util.stream.Stream; @@ -246,7 +246,7 @@ public static void setPackRoot(String newPackRoot) { } public static List getCpRepositories() { - List repos = new LinkedList<>(); + List repos = new ArrayList<>(); IEclipsePreferences prefs = ConfigurationScope.INSTANCE.getNode(CpPlugIn.PLUGIN_ID); int i = 0; String key = CMSIS_PACK_REPOSITORY_PREFERENCE + '.' + i; diff --git a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/IRteModel.java b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/IRteModel.java index fc5caff..dba3a3a 100644 --- a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/IRteModel.java +++ b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/IRteModel.java @@ -24,6 +24,7 @@ import com.arm.cmsis.pack.enums.EEvaluationResult; import com.arm.cmsis.pack.enums.IEvaluationResult; import com.arm.cmsis.pack.info.ICpBoardInfo; +import com.arm.cmsis.pack.info.ICpComponentInfo; import com.arm.cmsis.pack.info.ICpConfigurationInfo; import com.arm.cmsis.pack.info.ICpDeviceInfo; import com.arm.cmsis.pack.info.ICpPackInfo; @@ -264,6 +265,27 @@ default Collection getGeneratedPackNames() { */ boolean isGeneratedPackUsed(String gpdsc); + /** + * Returns absolute gpdsc filename from its name and working directory + * + * @param gpdsc gpdsc file name + * @param workingDir working directory defined by generator + * @return extended gpdsc file or null if none + */ + default String getExpandedGpdsc(String gpdsc, String workingDir) { + return gpdsc; // just for compatibility with test environments that (mis)use mocking + } + + /** + * Returns absolute gpdsc filename from its name and working directory + * + * @param ci component info to get gpdsc from + * @return extended gpdsc file or null if none + */ + default String getExpandedGpdsc(ICpComponentInfo ci) { + return ci != null ? getExpandedGpdsc(ci.getGpdsc(), ci.getWorkingDir()) : null; + } + /** * Returns filter context used by the model * diff --git a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/RteModel.java b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/RteModel.java index 70ffa62..b8b62a3 100644 --- a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/RteModel.java +++ b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/RteModel.java @@ -11,6 +11,8 @@ package com.arm.cmsis.pack.rte; +import java.io.File; +import java.io.IOException; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -208,7 +210,6 @@ protected void collectGeneratedPacks() { if (children == null) return; ICpPackManager pm = CpPlugIn.getPackManager(); - ICpEnvironmentProvider ep = CpPlugIn.getEnvironmentProvider(); for (ICpItem item : children) { if (!item.hasAttribute(CmsisConstants.GENERATOR)) continue; @@ -217,10 +218,9 @@ protected void collectGeneratedPacks() { ICpComponentInfo ci = (ICpComponentInfo) item; if (ci.isGenerated()) continue; // consider only bootstrap - String gpdsc = ci.getGpdsc(); + String gpdsc = getExpandedGpdsc(ci); if (gpdsc == null || gpdsc.isEmpty()) continue; - gpdsc = ep.expandString(gpdsc, fConfigurationInfo, true); if (fGeneratedPacks.containsKey(gpdsc)) { ICpPack pack = fGeneratedPacks.get(gpdsc); if (pack != null || !ci.isSaved()) @@ -231,6 +231,69 @@ protected void collectGeneratedPacks() { } } + /** + * Returns absolute gpdsc filename associated with component + * + * @param component {@link IRteComponent} + * @return associated gpdsc file or null if none + */ + protected String getGpdsc(IRteComponent component) { + if (component == null) + return null; + return getGpdsc(component.getActiveCpComponent()); + } + + /** + * Returns absolute gpdsc filename associated with component + * + * @param c {@link ICpComponent} + * @return associated gpdsc file or null if none + */ + protected String getGpdsc(ICpComponent c) { + if (c == null) + return null; + if (c.isGenerated()) { + ICpPack pack = c.getPack(); + if (pack == null) + return null; // should not happen + return pack.getFileName(); + } + ICpGenerator gen = c.getGenerator(); + if (gen != null) { + return getExpandedGpdsc(gen.getGpdsc(), gen.getWorkingDir()); + } + return null; + } + + /** + * Returns absolute gpdsc filename from its name and working directory + * + * @param c {@link ICpComponent} + * @return associated gpdsc file or null if none + */ + @Override + public String getExpandedGpdsc(String gpdsc, String workingDir) { + if (gpdsc == null || gpdsc.isEmpty()) { + return null; + } + ICpEnvironmentProvider ep = CpPlugIn.getEnvironmentProvider(); + String expandedGpdsc = ep.expandString(gpdsc, getConfigurationInfo(), true); + File gpdscFile = new File(expandedGpdsc); + if (gpdscFile.isAbsolute()) { + try { + expandedGpdsc = gpdscFile.getCanonicalPath(); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } else if (workingDir != null && !workingDir.isEmpty()) { + String wd = ep.expandString(workingDir, getConfigurationInfo(), true); + expandedGpdsc = Utils.addTrailingSlash(wd) + expandedGpdsc; + } + + return expandedGpdsc.replace('\\', '/'); + } + protected void filterPacks() { fFilteredPacks = null; if (fAllInstalledPacks != null) { @@ -401,6 +464,7 @@ public void updateComponentInfos() { ICpItem gpdscItem = new CpItem(ci, CmsisConstants.GPDSC_TAG); ci.addChild(gpdscItem); gpdscItem.attributes().setAttribute(CmsisConstants.NAME, gen.getGpdsc()); + gpdscItem.attributes().setAttribute(CmsisConstants.WORKING_DIR_TAG, gen.getWorkingDir()); } } else { ci.setComponent(c); @@ -481,10 +545,16 @@ protected void collectFilteredFiles(ICpComponentInfo ci, ICpComponent c) { if (ci.isGenerated() || !ci.isSaved()) { return; } - - ICpGenerator gen = c.getGenerator(); - if (gen == null) + // get generator from gpdsc + ICpPack generatedPack = getGeneratedPack(getGpdsc(c)); + if (generatedPack == null) { return; + } + ICpItem gen = generatedPack.getGenerator(c.getGeneratorId()); + if (gen == null) { + return; + } + createFileInfos(ci, gen.getGrandChildren(CmsisConstants.PROJECT_FILES_TAG), true); } diff --git a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/RteModelController.java b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/RteModelController.java index 1da481c..8d7088c 100644 --- a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/RteModelController.java +++ b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/RteModelController.java @@ -17,7 +17,6 @@ import java.util.Set; import com.arm.cmsis.pack.CpPlugIn; -import com.arm.cmsis.pack.ICpEnvironmentProvider; import com.arm.cmsis.pack.ICpPackManager; import com.arm.cmsis.pack.common.CmsisConstants; import com.arm.cmsis.pack.data.CpPackFilter; @@ -25,7 +24,6 @@ import com.arm.cmsis.pack.data.ICpComponent; import com.arm.cmsis.pack.data.ICpConditionContext; import com.arm.cmsis.pack.data.ICpDeviceItem; -import com.arm.cmsis.pack.data.ICpGenerator; import com.arm.cmsis.pack.data.ICpItem; import com.arm.cmsis.pack.data.ICpPack; import com.arm.cmsis.pack.data.ICpPackCollection; @@ -306,34 +304,6 @@ public IRtePackCollection getRtePackCollection() { return fRtePackCollection; } - /** - * Returns absolute gpdsc filename associated with component - * - * @param component {@link IRteComponent} - * @return associated gpdsc file or null if none - */ - protected String getGpdsc(IRteComponent component) { - if (component == null) - return null; - ICpComponent c = component.getActiveCpComponent(); - if (c == null) - return null; - - if (c.isGenerated()) { - ICpPack pack = c.getPack(); - if (pack == null) - return null; // should not happen - return pack.getFileName(); - } - ICpGenerator gen = c.getGenerator(); - if (gen != null) { - ICpEnvironmentProvider ep = CpPlugIn.getEnvironmentProvider(); - return ep.expandString(gen.getGpdsc(), getConfigurationInfo(), true); - } - - return null; - } - @Override public void selectComponent(IRteComponent component, int nInstances) { if (component == null) @@ -631,6 +601,11 @@ public boolean isGeneratedPackUsed(String gpdsc) { return fModel.isGeneratedPackUsed(gpdsc); } + @Override + public String getExpandedGpdsc(String gpdsc, String workingDir) { + return fModel.getExpandedGpdsc(gpdsc, workingDir); + } + @Override public ICpConditionContext getFilterContext() { return fModel.getFilterContext(); diff --git a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/components/RteComponent.java b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/components/RteComponent.java index 69a4f77..2fe21df 100644 --- a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/components/RteComponent.java +++ b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/components/RteComponent.java @@ -11,8 +11,8 @@ package com.arm.cmsis.pack.rte.components; +import java.util.ArrayList; import java.util.Collection; -import java.util.LinkedList; import com.arm.cmsis.pack.common.CmsisConstants; import com.arm.cmsis.pack.data.ICpComponent; @@ -308,7 +308,7 @@ public Collection getSelectedComponents(Collection // is we are here => component is active if (isSelected()) { if (components == null) { - components = new LinkedList(); + components = new ArrayList(); } components.add(this); } @@ -321,7 +321,7 @@ public Collection getUsedComponents(Collection com ICpComponentInfo ci = getActiveCpComponentInfo(); if (ci != null) { if (components == null) { - components = new LinkedList(); + components = new ArrayList(); } components.add(this); } @@ -332,7 +332,7 @@ public Collection getUsedComponents(Collection com public Collection getGeneratorComponents(String generatorId, Collection components) { // is we are here => component is active if (components == null) { - components = new LinkedList(); + components = new ArrayList(); } if (!isGenerated() && !isBootStrap()) return components; diff --git a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/components/RteComponentItem.java b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/components/RteComponentItem.java index 498b55a..536902b 100644 --- a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/components/RteComponentItem.java +++ b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/components/RteComponentItem.java @@ -11,8 +11,8 @@ package com.arm.cmsis.pack.rte.components; +import java.util.ArrayList; import java.util.Collection; -import java.util.LinkedList; import java.util.Map; import java.util.Map.Entry; import java.util.TreeMap; @@ -561,7 +561,7 @@ public boolean isActiveChildDefault() { @Override public Collection getSelectedComponents(Collection components) { if (components == null) { - components = new LinkedList(); + components = new ArrayList(); } IRteComponentItem activeChild = getActiveChild(); @@ -580,7 +580,7 @@ public Collection getSelectedComponents(Collection @Override public Collection getUsedComponents(Collection components) { if (components == null) { - components = new LinkedList(); + components = new ArrayList(); } IRteComponentItem activeChild = getActiveChild(); @@ -599,7 +599,7 @@ public Collection getUsedComponents(Collection com @Override public Collection getGeneratorComponents(String generatorId, Collection components) { if (components == null) { - components = new LinkedList(); + components = new ArrayList(); } IRteComponentItem activeChild = getActiveChild(); diff --git a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/dependencies/RteDependencySolver.java b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/dependencies/RteDependencySolver.java index 519b9e9..0c930f8 100644 --- a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/dependencies/RteDependencySolver.java +++ b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/dependencies/RteDependencySolver.java @@ -21,8 +21,6 @@ import java.util.Map.Entry; import java.util.TreeMap; -import com.arm.cmsis.pack.CpPlugIn; -import com.arm.cmsis.pack.ICpEnvironmentProvider; import com.arm.cmsis.pack.common.CmsisConstants; import com.arm.cmsis.pack.data.CpConditionContext; import com.arm.cmsis.pack.data.ICpComponent; @@ -35,7 +33,6 @@ import com.arm.cmsis.pack.generic.IAttributes; import com.arm.cmsis.pack.info.ICpBoardInfo; import com.arm.cmsis.pack.info.ICpComponentInfo; -import com.arm.cmsis.pack.info.ICpConfigurationInfo; import com.arm.cmsis.pack.info.ICpDeviceInfo; import com.arm.cmsis.pack.rte.IRteModel; import com.arm.cmsis.pack.rte.components.IRteComponent; @@ -495,9 +492,6 @@ protected void reportMissingApi(IRteComponentItem componentItem, EEvaluationResu * Evaluates used components and reports missing components and gpdsc files */ protected void evaluateUsedComponents() { - ICpEnvironmentProvider ep = CpPlugIn.getEnvironmentProvider(); - ICpConfigurationInfo configInfo = rteModel.getConfigurationInfo(); - Collection usedComponents = getUsedComponents(); for (IRteComponent component : usedComponents) { if (!component.isSelected()) { @@ -513,12 +507,10 @@ protected void evaluateUsedComponents() { if (ci.isGenerated() || !ci.isSaved()) { continue; } - String gpdsc = ci.getGpdsc(); + String gpdsc = rteModel.getExpandedGpdsc(ci); if (gpdsc == null || gpdsc.isEmpty()) { continue; } - gpdsc = ep.expandString(gpdsc, configInfo, true); - ICpPack pack = rteModel.getGeneratedPack(gpdsc); if (pack != null) { continue; diff --git a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/dependencies/RteMissingBoardResult.java b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/dependencies/RteMissingBoardResult.java index aa5c8a1..d394e02 100644 --- a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/dependencies/RteMissingBoardResult.java +++ b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/dependencies/RteMissingBoardResult.java @@ -57,7 +57,7 @@ public String getDescription() { } reason += ": " + packId; //$NON-NLS-1$ } - return CpStrings.RteMissingBoardResult_Board + " " + state + ". " + reason; //$NON-NLS-2$ //$NON-NLS-3$ + return CpStrings.RteMissingBoardResult_Board + " " + state + ". " + reason; //$NON-NLS-1$ //$NON-NLS-2$ } @Override diff --git a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/packs/RtePackCollection.java b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/packs/RtePackCollection.java index 424c70a..8d1dba0 100644 --- a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/packs/RtePackCollection.java +++ b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/packs/RtePackCollection.java @@ -11,9 +11,9 @@ package com.arm.cmsis.pack.rte.packs; +import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -330,7 +330,7 @@ public Collection getRtePackFamilies() { @Override public Collection getUsedRtePackFamilies() { - List usedFamilies = new LinkedList<>(); + List usedFamilies = new ArrayList<>(); for (IRtePackFamily f : fPackFamilies.values()) { if (f.isUsed()) { usedFamilies.add(f); diff --git a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/packs/RtePackFamily.java b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/packs/RtePackFamily.java index 9b691a8..35f6572 100644 --- a/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/packs/RtePackFamily.java +++ b/com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/packs/RtePackFamily.java @@ -11,10 +11,10 @@ package com.arm.cmsis.pack.rte.packs; +import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedList; import java.util.Map; import java.util.Set; import java.util.TreeMap; @@ -273,7 +273,7 @@ public Set getSelectedVersions() { @Override public Collection getSelectedPacks() { - Collection packs = new LinkedList(); + Collection packs = new ArrayList(); for (IRtePack pack : fPacks.values()) { if (pack.isSelected()) packs.add(pack); diff --git a/com.arm.cmsis.zone.tests/src/com/arm/cmsis/zone/data/CpMpuSetupTest.java b/com.arm.cmsis.zone.tests/src/com/arm/cmsis/zone/data/CpMpuSetupTest.java index 186f3d7..8e315a9 100644 --- a/com.arm.cmsis.zone.tests/src/com/arm/cmsis/zone/data/CpMpuSetupTest.java +++ b/com.arm.cmsis.zone.tests/src/com/arm/cmsis/zone/data/CpMpuSetupTest.java @@ -20,7 +20,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.util.Collection; -import java.util.LinkedList; +import java.util.ArrayList; import org.junit.Test; @@ -88,7 +88,7 @@ public void test96ByteBlock7() { ICpMpuSetup mpuSetup = new CpMpuSetup(null); mpuSetup.setAttribute(CmsisConstants.TYPE, CmsisConstants.V7M); - Collection memoryBlocks = new LinkedList<>(); + Collection memoryBlocks = new ArrayList<>(); memoryBlocks.add(createMemoryBlock("Mem96", 0x00280000, 96, "rwx")); //$NON-NLS-1$ //$NON-NLS-2$ Collection regions = mpuSetup.constructMpuRegions(memoryBlocks); @@ -109,7 +109,7 @@ public void testTwoSmallBlocks7() { ICpMpuSetup mpuSetup = new CpMpuSetup(null); mpuSetup.setAttribute(CmsisConstants.TYPE, CmsisConstants.V7M); - Collection memoryBlocks = new LinkedList<>(); + Collection memoryBlocks = new ArrayList<>(); memoryBlocks.add(createMemoryBlock("Mem32", 0x00280060, 32, "rwx")); //$NON-NLS-1$ //$NON-NLS-2$ memoryBlocks.add(createMemoryBlock("Mem96", 0x00280080, 96, "rwx")); //$NON-NLS-1$ //$NON-NLS-2$ @@ -132,7 +132,7 @@ public void testDifferentSizeBlocks7() { ICpMpuSetup mpuSetup = new CpMpuSetup(null); mpuSetup.setAttribute(CmsisConstants.TYPE, CmsisConstants.V7M); - Collection memoryBlocks = new LinkedList<>(); + Collection memoryBlocks = new ArrayList<>(); memoryBlocks.add(createMemoryBlock("Mem521K", 0x00200000, 0x80000, "rwx")); //$NON-NLS-1$ //$NON-NLS-2$ memoryBlocks.add(createMemoryBlock("Mem96", 0x00280000, 96, "rwx")); //$NON-NLS-1$ //$NON-NLS-2$ memoryBlocks.add(createMemoryBlock("Mem32", 0x00280060, 32, "rwx")); //$NON-NLS-1$ //$NON-NLS-2$ @@ -156,7 +156,7 @@ public void testAdjustedSizeBlocks7() { ICpMpuSetup mpuSetup = new CpMpuSetup(null); mpuSetup.setAttribute(CmsisConstants.TYPE, CmsisConstants.V7M); - Collection memoryBlocks = new LinkedList<>(); + Collection memoryBlocks = new ArrayList<>(); memoryBlocks.add(createMemoryBlock("Mem521K-32", 0x00200000, 0x7FFE0, "rwx")); //$NON-NLS-1$ //$NON-NLS-2$ memoryBlocks.add(createMemoryBlock("Mem32", 0x0027FFE0, 32, "rwx")); //$NON-NLS-1$ //$NON-NLS-2$ @@ -179,7 +179,7 @@ public void testUnalignedSizeBlock7() { ICpMpuSetup mpuSetup = new CpMpuSetup(null); mpuSetup.setAttribute(CmsisConstants.TYPE, CmsisConstants.V7M); - Collection memoryBlocks = new LinkedList<>(); + Collection memoryBlocks = new ArrayList<>(); ICpMemoryBlock mb = createMemoryBlock("Mem521K-32", 0x00200000, 0x7FFE0, "rwx"); //$NON-NLS-1$ //$NON-NLS-2$ memoryBlocks.add(mb); @@ -216,7 +216,7 @@ private ICpMemoryBlock createMemoryBlock(String name, long start, long size, Str * @return collection of */ private Collection createMemoryBlocks2() { - Collection memoryBlocks = new LinkedList<>(); + Collection memoryBlocks = new ArrayList<>(); memoryBlocks.add(createMemoryBlock("Mem2", 8192, 4096, "rwx")); //$NON-NLS-1$ //$NON-NLS-2$ memoryBlocks.add(createMemoryBlock("Mem1", 0x0L, 4096, "rwx")); //$NON-NLS-1$ //$NON-NLS-2$ return memoryBlocks; diff --git a/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/ui/editors/CmsisZoneController.java b/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/ui/editors/CmsisZoneController.java index c8c5d7f..0a5ceba 100644 --- a/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/ui/editors/CmsisZoneController.java +++ b/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/ui/editors/CmsisZoneController.java @@ -14,7 +14,7 @@ import java.io.File; import java.util.Collection; import java.util.Collections; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -219,7 +219,7 @@ protected boolean assignBlocksToNewZone(ICpZone zone) { boolean bSelPeripheral = fRootZone.getZoneOption(CmsisConstants.PERIPHERAL, CmsisConstants.SELECT); boolean bSelROM = fRootZone.getZoneOption(CmsisConstants.ROM, CmsisConstants.SELECT); boolean bSelRAM = fRootZone.getZoneOption(CmsisConstants.RAM, CmsisConstants.SELECT); - List blocks = new LinkedList<>(); + List blocks = new ArrayList<>(); for (ICpMemoryBlock block : fRootZone.getMemoryBlocksAsMap().values()) { if (block instanceof ICpPeripheralGroup) continue; @@ -237,7 +237,7 @@ protected boolean assignBlocksToNewZone(ICpZone zone) { } public Collection getAssignedBlocks(ICpZone zone) { - List assignedBlocks = new LinkedList<>(); + List assignedBlocks = new ArrayList<>(); if (fRootZone == null) { return assignedBlocks; } diff --git a/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/widgets/CmsisZoneContentProvider.java b/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/widgets/CmsisZoneContentProvider.java index 38ef72c..e625eea 100644 --- a/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/widgets/CmsisZoneContentProvider.java +++ b/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/widgets/CmsisZoneContentProvider.java @@ -10,7 +10,7 @@ *******************************************************************************/ package com.arm.cmsis.zone.widgets; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import com.arm.cmsis.pack.common.CmsisConstants; @@ -57,7 +57,7 @@ public Object[] getChildren(Object parentElement) { if (item instanceof ICpRootZone) { ICpRootZone root = (ICpRootZone) item; - List rootChildren = new LinkedList<>(); + List rootChildren = new ArrayList<>(); ICpDeviceUnit du = root.getDeviceUnit(); if (du != null) rootChildren.add(du); diff --git a/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/widgets/CmsisZoneKeyAdapter.java b/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/widgets/CmsisZoneKeyAdapter.java index ddc4b31..d4a0b02 100644 --- a/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/widgets/CmsisZoneKeyAdapter.java +++ b/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/widgets/CmsisZoneKeyAdapter.java @@ -11,7 +11,7 @@ package com.arm.cmsis.zone.widgets; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import org.eclipse.jface.dialogs.MessageDialog; @@ -80,7 +80,7 @@ public void processSpacePressed() { } public List getSelectedBlocks(boolean bDeletable) { - List selectedBlocks = new LinkedList<>(); + List selectedBlocks = new ArrayList<>(); TreeItem[] selection = fTree.getSelection(); for (TreeItem item : selection) { Object obj = item.getData(); @@ -98,7 +98,7 @@ public void assignBlocks(int columntIndex) { ICpZone zone = fAdvisor.getZone(columntIndex); if (zone == null) return; - List selectedBlocks = new LinkedList<>(); + List selectedBlocks = new ArrayList<>(); TreeItem[] selection = fTree.getSelection(); int nChecked = 0; for (TreeItem item : selection) { diff --git a/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/widgets/CmsisZoneTreeWidget.java b/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/widgets/CmsisZoneTreeWidget.java index bced528..850c197 100644 --- a/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/widgets/CmsisZoneTreeWidget.java +++ b/com.arm.cmsis.zone.ui/src/com/arm/cmsis/zone/widgets/CmsisZoneTreeWidget.java @@ -11,7 +11,7 @@ package com.arm.cmsis.zone.widgets; import java.util.Collection; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import org.eclipse.jface.action.Action; @@ -339,7 +339,7 @@ protected ICpItem getSelectedItem() { } public Collection getSelectedItems() { - List selectedItems = new LinkedList<>(); + List selectedItems = new ArrayList<>(); if (getViewer() != null) { IStructuredSelection sel = getViewer().getStructuredSelection(); if (sel != null) { @@ -353,7 +353,7 @@ public Collection getSelectedItems() { } public Collection getSelectedItemsOfType(Class type) { - List selectedItems = new LinkedList<>(); + List selectedItems = new ArrayList<>(); if (getViewer() != null) { IStructuredSelection sel = (IStructuredSelection) getViewer().getSelection(); if (sel != null) { diff --git a/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpPeripheral.java b/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpPeripheral.java index fb6b46f..e2b4bca 100644 --- a/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpPeripheral.java +++ b/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpPeripheral.java @@ -12,7 +12,7 @@ package com.arm.cmsis.zone.data; import java.util.Collection; -import java.util.LinkedList; +import java.util.ArrayList; import com.arm.cmsis.pack.common.CmsisConstants; import com.arm.cmsis.pack.data.ICpItem; @@ -117,7 +117,7 @@ protected IAttributes getAttributesForFtlModel() { @Override public Collection getModifiedSlots() { - Collection modifiedSlots = new LinkedList<>(); + Collection modifiedSlots = new ArrayList<>(); Collection slots = getSlots(); if (slots != null && !slots.isEmpty()) { for (ICpSlot s : slots) { diff --git a/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpResourceContainer.java b/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpResourceContainer.java index a708844..34ef59c 100644 --- a/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpResourceContainer.java +++ b/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpResourceContainer.java @@ -14,7 +14,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -123,7 +123,7 @@ public boolean arrangeBlocks() { @Override public Collection getAllMemoryRegions() { - List regions = new LinkedList<>(); + List regions = new ArrayList<>(); for (ICpMemoryBlock block : getMemoryBlocksAsMap().values()) { if (block instanceof ICpMemoryBlock && !block.isPeripheral()) { regions.add(block); @@ -135,7 +135,7 @@ public Collection getAllMemoryRegions() { @Override public Collection getStarupMemoryRegions() { - Collection regions = new LinkedList<>(); + Collection regions = new ArrayList<>(); for (ICpMemoryBlock block : getMemoryBlocksAsMap().values()) { if (block instanceof ICpMemoryBlock && block.isStartup()) { regions.add(block); @@ -146,7 +146,7 @@ public Collection getStarupMemoryRegions() { @Override public Collection getAllPeripherals() { - Collection peripherals = new LinkedList<>(); + Collection peripherals = new ArrayList<>(); for (ICpMemoryBlock block : getMemoryBlocksAsMap().values()) { if (block instanceof ICpPeripheral) { peripherals.add((ICpPeripheral) block); @@ -157,7 +157,7 @@ public Collection getAllPeripherals() { @Override public Collection getAllPeripheralItems() { - Collection peripheralItems = new LinkedList<>(); + Collection peripheralItems = new ArrayList<>(); for (ICpMemoryBlock block : getMemoryBlocksAsMap().values()) { if (block instanceof ICpPeripheralItem) { peripheralItems.add((ICpPeripheralItem) block); @@ -328,7 +328,7 @@ protected void collectMpcRegions() { fMpcRegions = new TreeMap<>(); ICpResourceGroup memory = getMemoryGroup(); if (memory != null) { - List mpcItems = new LinkedList<>(memory.getChildrenOfType(ICpMpc.class)); + List mpcItems = new ArrayList<>(memory.getChildrenOfType(ICpMpc.class)); Collections.sort(mpcItems, new MemoryStartComparator()); MpcRegion region = null; for (ICpMpc mpc : mpcItems) { diff --git a/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpResourceGroup.java b/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpResourceGroup.java index 9a4e7a1..179e5f9 100644 --- a/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpResourceGroup.java +++ b/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpResourceGroup.java @@ -13,7 +13,7 @@ import java.util.Collection; import java.util.Collections; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -107,7 +107,7 @@ public ICpMemoryBlock[] getMemoryBlocksAsArray() { boolean bShowPeripheral = rootZone.getZoneOption(CmsisConstants.PERIPHERAL, CmsisConstants.SHOW); boolean bShowROM = rootZone.getZoneOption(CmsisConstants.ROM, CmsisConstants.SHOW); boolean bShowRAM = rootZone.getZoneOption(CmsisConstants.RAM, CmsisConstants.SHOW); - List blocks = new LinkedList<>(); + List blocks = new ArrayList<>(); for (ICpMemoryBlock block : getMemoryBlocksAsMap().values()) { if (isShowBlock(block, bShowRAM, bShowROM, bShowPeripheral)) { blocks.add(block); diff --git a/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpZone.java b/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpZone.java index d3fed6a..b1ddf4b 100644 --- a/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpZone.java +++ b/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/CpZone.java @@ -12,7 +12,7 @@ package com.arm.cmsis.zone.data; import java.util.Collection; -import java.util.LinkedList; +import java.util.ArrayList; import com.arm.cmsis.pack.common.CmsisConstants; import com.arm.cmsis.pack.data.ICpItem; @@ -76,7 +76,7 @@ public ICpZoneAssignment getZoneAssignment(String zoneName) { @Override public Collection getAssignedMemoryBlocks() { - Collection memoryBlocks = new LinkedList<>(); + Collection memoryBlocks = new ArrayList<>(); Collection assignments = getZoneAssignments(); if (assignments == null || assignments.isEmpty()) return memoryBlocks; diff --git a/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/PhysicalMemoryRegion.java b/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/PhysicalMemoryRegion.java index 2355a21..4d9d64c 100644 --- a/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/PhysicalMemoryRegion.java +++ b/com.arm.cmsis.zone/src/com/arm/cmsis/zone/data/PhysicalMemoryRegion.java @@ -14,7 +14,7 @@ import java.util.Collection; import java.util.Collections; import java.util.Iterator; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.TreeSet; @@ -152,7 +152,7 @@ public boolean arrangeBlocks() { fMpcRegion.invalidatePermissions(fMpcRegionOffset, getSize()); } - List sortedBlocks = new LinkedList<>(); + List sortedBlocks = new ArrayList<>(); // collect all child blocks and sort them for (ICpMemoryBlock region : fLogicalRegions) {