From 677d68715d57655898169a2e0183aedbb25e34c6 Mon Sep 17 00:00:00 2001 From: Andrew Ferguson Date: Fri, 18 Apr 2008 12:38:06 +0000 Subject: clean up warnings --- .../cdt/core/templateengine/SharedDefaults.java | 5 +--- .../cdt/core/templateengine/TemplateEngine.java | 20 +++++-------- .../core/templateengine/TemplateEngineHelper.java | 35 +++++----------------- .../process/ConditionalProcessGroup.java | 2 -- .../cdt/core/templateengine/process/Process.java | 7 ++--- .../templateengine/process/ProcessArgument.java | 9 ++---- .../process/ProcessRunnerFactory.java | 6 ++-- 7 files changed, 23 insertions(+), 61 deletions(-) (limited to 'core/org.eclipse.cdt.core/templateengine') diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/SharedDefaults.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/SharedDefaults.java index 97ce360ebd1..20a45520ce2 100644 --- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/SharedDefaults.java +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/SharedDefaults.java @@ -75,11 +75,8 @@ public class SharedDefaults extends HashMap { private static SharedDefaults SHAREDDEFAULTS = new SharedDefaults(); /** - * Returns static SharedDefaults Instance - * - * @return + * @return the shared SharedDefaults Instance */ - public static SharedDefaults getInstance() { return SHAREDDEFAULTS; } diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine.java index 0dc2bfd93a4..4d122759972 100644 --- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine.java +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine.java @@ -81,14 +81,14 @@ public class TemplateEngine { } /** - * Returns the TemplateCore for the first template defined for the specified parameters, or null - * if no such definition exists, or if there is an error initializing the template (the error will - * be logged). + * Returns the first template defined for the specified parameters * @param projectType may not be null * @param toolChain may be null to indicate no tool-chain filtering * @param usageFilter a regex in java.util.regex.Pattern format, may be null to indicate no filtering * @see java.util.regex.Pattern - * @return + * @return the TemplateCore for the first template defined for the specified parameters, or null + * if no such definition exists, or if there is an error initializing the template (the error will + * be logged). */ public TemplateCore getFirstTemplate(String projectType, String toolChain, String usageFilter) { TemplateInfo[] infos= getTemplateInfos(projectType, toolChain, usageFilter); @@ -153,9 +153,7 @@ public class TemplateEngine { } /** - * return the SharedDefaults. - * - * @return + * @return the SharedDefaults. */ public static Map getSharedDefaults() { return SharedDefaults.getInstance().getSharedDefaultsMap(); @@ -170,7 +168,6 @@ public class TemplateEngine { * values of IDs in ValueStore, which are also present in PersistTrueIDs * vector. * @param template - * @param aSharedValue */ public void updateSharedDefaults(TemplateCore template) { Map tobePersisted = new HashMap(); @@ -333,8 +330,7 @@ public class TemplateEngine { } /** - * Returns all TemplateInfo objects known to the TemplateEngine - * @return + * @return all TemplateInfo objects known to the TemplateEngine */ public TemplateInfo[] getTemplateInfos() { List infoList = new ArrayList(); @@ -346,9 +342,7 @@ public class TemplateEngine { /** - * Getter for templateInfoMap - * - * @return + * @return the map from project-type ID's to all associated TemplateInfo instances */ public Map> getTemplateInfoMap() { return templateInfoMap; diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngineHelper.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngineHelper.java index 3a97d3d97ef..f60edc24891 100644 --- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngineHelper.java +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngineHelper.java @@ -69,7 +69,6 @@ public class TemplateEngineHelper { */ public static File getSharedDefaultLocation(String sharedLocation) { - File sharedXMLFile = findLocation(sharedLocation); return sharedXMLFile; } @@ -82,14 +81,11 @@ public class TemplateEngineHelper { * * @since 4.0 */ - private static File findLocation(String fileLocation) { - Plugin plugin = CCorePlugin.getDefault(); IPath stateLoc = plugin.getStateLocation(); fileLocation = stateLoc.toString() + File.separator + fileLocation; File file = new File(fileLocation); - return file; } @@ -97,38 +93,23 @@ public class TemplateEngineHelper { * Stores the shareddefaults xml file in * "${workspace}/.metadata/.plugins/${plugin.name}/shareddefaults.xml" path. * - * @param sharedLocation - * @return sharedXMLFile + * @param sharedLocation the relative path within the plug-in + * @return a File object corresponding to the location within the plug-in * * @since 4.0 */ - public static File storeSharedDefaultLocation(String sharedLocation) { - File sharedXMLFile = findLocation(sharedLocation); - try { - createNewFile(sharedXMLFile.getPath()); + if(!sharedXMLFile.exists()) { + sharedXMLFile.createNewFile(); + } } catch (IOException e) { - e.printStackTrace(); + CCorePlugin.log(e); } return sharedXMLFile; } - /** - * This creates a new File, in the Absolute Path given as argument. The File - * name will be part of the path argument. - * - * @param aFileName, - * absoulute File path(including File name) to be created. - * - * @since 4.0 - */ - public static void createNewFile(String fileName) throws IOException { - - (new File(fileName)).createNewFile(); - } - /** * This method returns the workspace path present in the workspace * @@ -146,10 +127,8 @@ public class TemplateEngineHelper { } /** - * given a String of the form $(ID), return ID. - * * @param markerString - * @return + * @return the first content of a region matching $(.*) e.g. given a String of the form "foo $(ID) bar", return ID. * * @since 4.0 */ diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ConditionalProcessGroup.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ConditionalProcessGroup.java index d2e1fd53301..4570f795b50 100644 --- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ConditionalProcessGroup.java +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ConditionalProcessGroup.java @@ -70,7 +70,6 @@ public class ConditionalProcessGroup { /** * Constructs a ConditionalProcess element from the supplied conditionElement (<if>) while building Process * objects out of each of the element's <process> children. - * @throws ProcessFailureException */ public ConditionalProcessGroup(TemplateCore template, Element conditionElement, int id) { this.id = "Condition " + id; //$NON-NLS-1$ @@ -117,7 +116,6 @@ public class ConditionalProcessGroup { * objects out of each of the supplied process elements (<process>). The condition in this case is evaluated to true. * * This Constructor is expected to be used to evaluate all those process elements that are children of the template root element. - * @throws ProcessFailureException */ public ConditionalProcessGroup(TemplateCore template, Element[] processElements) { id = "No Condition"; //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/Process.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/Process.java index fe7a500d8b0..e5910c59715 100644 --- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/Process.java +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/Process.java @@ -143,9 +143,9 @@ public class Process { } /** - * Constructor + * Executes this process * @param monitor - * @return + * @return the result of executing this process * @throws ProcessFailureException */ public IStatus process(IProgressMonitor monitor) throws ProcessFailureException { @@ -175,8 +175,7 @@ public class Process { } /** - * Returns the Macros. - * @return + * @return the macros defined in the context of this process */ public Set getMacros() { Set set = null; diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ProcessArgument.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ProcessArgument.java index b30d7df95fe..37389923218 100644 --- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ProcessArgument.java +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ProcessArgument.java @@ -120,7 +120,7 @@ public class ProcessArgument { } /** - * Adds the marcos based on the value. + * Adds the macros based on the value. * @param value */ private void collectMacros(String value) { @@ -223,8 +223,7 @@ public class ProcessArgument { } /** - * Returns true if All macros are Expandable. - * @return + * @return true if All macros are Expandable. */ public boolean areAllMacrosExpandable() { switch (type) { @@ -311,8 +310,7 @@ public class ProcessArgument { } /** - * Returns the Macros as Set. - * @return Set, contains the Macros. + * @return the macros defined in the context of this argument */ public Set getMacros() { return macros; @@ -371,7 +369,6 @@ public class ProcessArgument { } /* - * (non-Javadoc) * @see java.lang.Object#toString() */ @Override diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ProcessRunnerFactory.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ProcessRunnerFactory.java index fd465c4fc46..ba8c73d9087 100644 --- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ProcessRunnerFactory.java +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ProcessRunnerFactory.java @@ -81,17 +81,15 @@ public class ProcessRunnerFactory { } /** - * Process Runners Factory instance. - * @return + * @return the singleton {@link ProcessRunnerFactory} */ public static ProcessRunnerFactory getDefault() { return instance; } /** - * Return the ProcessRunner based on the ProcessType. * @param processType - * @return + * @return the ProcessRunner based on the ProcessType. */ public ProcessRunner getProcessRunner(String processType) { return processRunnerMap.get(processType); -- cgit v1.2.3