summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Kriese2011-04-15 02:01:36 (EDT)
committerSteffen Kriese2011-04-15 02:01:36 (EDT)
commit962d57e529f1ace961c3014e09c77cf83947bee8 (patch)
tree61aa9b0236e5557e2a31a04387393abde6c0f2c0
parent9e9b5884b4811d2596b71ddb60eaaf9c021a3606 (diff)
downloadorg.eclipse.riena.toolbox-962d57e529f1ace961c3014e09c77cf83947bee8.zip
org.eclipse.riena.toolbox-962d57e529f1ace961c3014e09c77cf83947bee8.tar.gz
org.eclipse.riena.toolbox-962d57e529f1ace961c3014e09c77cf83947bee8.tar.bz2
code cleaning
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Util.java11
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/AbstractXmlProvider.java3
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/AssemblyDataProvider.java4
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/CodeGenerator.java6
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/PluginXmlParser.java5
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetGenerator.java6
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/SWTControlInstantiationVisitor.java4
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/UIControlVisitor.java17
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/AbstractTypedNode.java21
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/AssemblyNode.java15
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/BundleNode.java15
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/RCPPerspective.java15
-rw-r--r--org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/RCPView.java15
13 files changed, 91 insertions, 46 deletions
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Util.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Util.java
index 89c2c7d..553d7d8 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Util.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/Util.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.riena.toolbox;
+import org.eclipse.core.runtime.Status;
+
import org.eclipse.riena.toolbox.assemblyeditor.model.AbstractAssemblyNode;
public final class Util {
@@ -60,6 +62,15 @@ public final class Util {
return findParentOfType(current.getParent(), type);
}
+ public static void logWarning(final String message) {
+ Activator.getDefault().getLog().log(new Status(Status.WARNING, Activator.PLUGIN_ID, message));
+ }
+
+ public static void logInfo(final String message) {
+ Activator.getDefault().getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, message));
+ System.out.println(message);
+ }
+
private Util() {
// private
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/AbstractXmlProvider.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/AbstractXmlProvider.java
index 19ac5c7..625287a 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/AbstractXmlProvider.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/AbstractXmlProvider.java
@@ -34,6 +34,7 @@ import org.xml.sax.SAXException;
import org.eclipse.core.resources.IFile;
+import org.eclipse.riena.core.util.Nop;
import org.eclipse.riena.toolbox.Util;
import org.eclipse.riena.toolbox.assemblyeditor.model.BundleNode;
@@ -130,7 +131,7 @@ public class AbstractXmlProvider {
try {
transformerFactory.setAttribute("indent-number", new Integer(4)); //$NON-NLS-1$
} catch (final IllegalArgumentException exception) {
- // Ignore
+ Nop.reason("empty"); //$NON-NLS-1$
}
final Transformer transformer = transformerFactory.newTransformer();
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/AssemblyDataProvider.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/AssemblyDataProvider.java
index 1fb9cc2..b675136 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/AssemblyDataProvider.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/AssemblyDataProvider.java
@@ -27,6 +27,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.riena.core.util.Nop;
import org.eclipse.riena.toolbox.assemblyeditor.api.IAssemblyDataProvider;
import org.eclipse.riena.toolbox.assemblyeditor.api.IPluginXmlParser;
import org.eclipse.riena.toolbox.assemblyeditor.api.IPluginXmlRenderer;
@@ -218,8 +219,7 @@ public class AssemblyDataProvider implements IAssemblyDataProvider {
xmlRenderer.saveDocument(bundle);
bundle.setDirty(false);
} else {
- // plugin.xml does not exist, assemblies do not exist
- // DO NOTHING
+ Nop.reason("plugin.xml does not exist, assemblies do not exist DO NOTHING"); //$NON-NLS-1$
}
} else {
if (bundle.getChildren() != null && bundle.getChildren().size() != 0) {
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/CodeGenerator.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/CodeGenerator.java
index afdb06c..d42d2f6 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/CodeGenerator.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/CodeGenerator.java
@@ -15,7 +15,6 @@ import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
@@ -155,8 +154,7 @@ public class CodeGenerator implements ICodeGenerator {
final Template t = velocityEngine.getTemplate(templateName);
final VelocityContext context = new VelocityContext();
- for (final Iterator<Entry<String, String>> it = properties.entrySet().iterator(); it.hasNext();) {
- final Entry<String, String> entry = it.next();
+ for (final Entry<String, String> entry : properties.entrySet()) {
context.put(entry.getKey(), entry.getValue());
}
@@ -196,7 +194,7 @@ public class CodeGenerator implements ICodeGenerator {
private boolean deleteSourceFile(final SubModuleNode subModule, final String className) {
if (!Util.isGiven(className)) {
- System.err.println("ClassName is null subModule " + subModule);
+ Util.logWarning("ClassName is null subModule " + subModule); //$NON-NLS-1$
return false;
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/PluginXmlParser.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/PluginXmlParser.java
index 6b52608..bd3604d 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/PluginXmlParser.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/PluginXmlParser.java
@@ -26,6 +26,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
+import org.eclipse.riena.toolbox.Util;
import org.eclipse.riena.toolbox.assemblyeditor.api.IPluginXmlParser;
import org.eclipse.riena.toolbox.assemblyeditor.model.AbstractAssemblyNode;
import org.eclipse.riena.toolbox.assemblyeditor.model.AbstractTypedNode;
@@ -41,7 +42,7 @@ import org.eclipse.riena.toolbox.assemblyeditor.model.SubModuleNode;
public class PluginXmlParser extends AbstractXmlProvider implements IPluginXmlParser {
/**
- *
+ *
*/
private static final String NODE_SEPARATOR = "."; //$NON-NLS-1$
@@ -320,7 +321,7 @@ public class PluginXmlParser extends AbstractXmlProvider implements IPluginXmlPa
if (null != rcpView) {
sub.setRcpView(rcpView);
} else {
- System.err.println("rcpView not found for subModule " + sub);
+ Util.logInfo("rcpView not found for subModule " + sub); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetGenerator.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetGenerator.java
index 84e6a6a..3a78b02 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetGenerator.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/RidgetGenerator.java
@@ -46,6 +46,8 @@ import org.eclipse.text.edits.TextEdit;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
+import org.eclipse.riena.toolbox.Util;
+
@SuppressWarnings("restriction")
public class RidgetGenerator {
protected static final String NATURE_JAVA = "org.eclipse.jdt.core.javanature"; //$NON-NLS-1$
@@ -142,7 +144,7 @@ public class RidgetGenerator {
final List<SwtControl> controls) {
final ICompilationUnit unit = findICompilationUnit(fullyQualifiedControllerClassName);
if (null == unit) {
- System.err.println("controller not found " + fullyQualifiedControllerClassName);
+ Util.logWarning("controller not found " + fullyQualifiedControllerClassName); //$NON-NLS-1$
return false;
}
@@ -336,7 +338,7 @@ public class RidgetGenerator {
final ICompilationUnit unit = (ICompilationUnit) astNode.getJavaElement();
if (unit == null) {
- System.err.println("iCompilationUnit is null " + astNode);
+ Util.logWarning("iCompilationUnit is null " + astNode); //$NON-NLS-1$
return false;
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/SWTControlInstantiationVisitor.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/SWTControlInstantiationVisitor.java
index 09bdb8d..689220b 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/SWTControlInstantiationVisitor.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/SWTControlInstantiationVisitor.java
@@ -27,6 +27,8 @@ import org.eclipse.jdt.core.dom.MethodInvocation;
import org.eclipse.jdt.core.dom.StringLiteral;
import org.eclipse.jdt.core.dom.VariableDeclaration;
+import org.eclipse.riena.toolbox.Util;
+
public class SWTControlInstantiationVisitor extends ASTVisitor {
private final Set<String> controlBlackList;
@@ -91,7 +93,7 @@ public class SWTControlInstantiationVisitor extends ASTVisitor {
final MethodDeclaration enclosingMethod = findDeclaringMethod(node);
if (null == enclosingMethod) {
- System.err.println("could not detect enclosing method for " + node);
+ Util.logWarning("could not detect enclosing method for " + node); //$NON-NLS-1$
return false;
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/UIControlVisitor.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/UIControlVisitor.java
index c35a8b3..fe65433 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/UIControlVisitor.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/UIControlVisitor.java
@@ -108,7 +108,7 @@ public class UIControlVisitor extends ASTVisitor {
final List<?> args = methodCall.arguments();
if (args.isEmpty()) {
- System.err.println("call to UIControlsFactory without arguments: " + methodCall);
+ System.err.println("call to UIControlsFactory without arguments: " + methodCall); //$NON-NLS-1$
return true;
}
@@ -127,7 +127,7 @@ public class UIControlVisitor extends ASTVisitor {
controls.add(new SwtControl(swtControlClassName, value, ridgetClass));
}
} else {
- System.err.println("Parameter is not a constant " + sm);
+ Util.logWarning("Parameter is not a constant " + sm); //$NON-NLS-1$
}
} else if (lastArgument instanceof org.eclipse.jdt.core.dom.QualifiedName) {
// TODO use the constant in the Controller, instead of extracting the value
@@ -140,7 +140,7 @@ public class UIControlVisitor extends ASTVisitor {
controls.add(new SwtControl(swtControlClassName, value, ridgetClass));
}
} else {
- System.err.println("Parameter is not a constant " + sm);
+ Util.logWarning("Parameter is not a constant " + sm); //$NON-NLS-1$
}
} else if (lastArgument instanceof StringLiteral) {
final StringLiteral sm = (StringLiteral) lastArgument;
@@ -151,13 +151,13 @@ public class UIControlVisitor extends ASTVisitor {
controls.add(new SwtControl(swtControlClassName, sm.getLiteralValue(), ridgetClass));
}
} else {
- System.err.println("unknown arg type " + lastArgument);
+ Util.logWarning("unknown arg type " + lastArgument); //$NON-NLS-1$
}
} else if (METHOD_ADD_UI_CONTROL.equals(methodCall.getName().getIdentifier())) {
final List<?> args = methodCall.arguments();
if (args.size() < 2) {
- System.err.println("call to addUIControl without arguments: " + methodCall);
+ Util.logWarning("call to addUIControl without arguments: " + methodCall); //$NON-NLS-1$
return true;
}
@@ -176,7 +176,7 @@ public class UIControlVisitor extends ASTVisitor {
} else {
if (null != exp) {
if (Platform.inDebugMode()) {
- System.out.println("DEBUG: expression type " + exp.getClass() + " node: " + methodCall);
+ Util.logInfo("DEBUG: expression type " + exp.getClass() + " node: " + methodCall); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
@@ -200,7 +200,10 @@ public class UIControlVisitor extends ASTVisitor {
if (!controlBlacklist.contains(control.getSwtControlClassName())) {
out.add(control);
} else {
- System.out.println("UIControlVisitor.getControls() ignoreControl " + control.getSwtControlClassName());
+ if (Platform.inDebugMode()) {
+ Util.logInfo("UIControlVisitor.getControls() ignoreControl " //$NON-NLS-1$
+ + control.getSwtControlClassName());
+ }
}
}
return out;
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/AbstractTypedNode.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/AbstractTypedNode.java
index 718148d..2ab2086 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/AbstractTypedNode.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/AbstractTypedNode.java
@@ -76,26 +76,33 @@ public abstract class AbstractTypedNode<T extends AbstractTypedNode> extends Abs
@Override
public boolean equals(final Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
final AbstractTypedNode other = (AbstractTypedNode) obj;
final AssemblyNode ass = getAssemblyNode();
final AssemblyNode otherAss = other.getAssemblyNode();
if (ass == null) {
- if (otherAss != null)
+ if (otherAss != null) {
return false;
- } else if (!ass.equals(otherAss))
+ }
+ } else if (!ass.equals(otherAss)) {
return false;
+ }
if (nodeId == null) {
- if (other.nodeId != null)
+ if (other.nodeId != null) {
return false;
- } else if (!nodeId.equals(other.nodeId))
+ }
+ } else if (!nodeId.equals(other.nodeId)) {
return false;
+ }
return true;
}
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/AssemblyNode.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/AssemblyNode.java
index 449bbc8..9e6921b 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/AssemblyNode.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/AssemblyNode.java
@@ -117,18 +117,23 @@ public class AssemblyNode extends AbstractAssemblyNode<AbstractTypedNode> {
@Override
public boolean equals(final Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
final AssemblyNode other = (AssemblyNode) obj;
if (id == null) {
- if (other.id != null)
+ if (other.id != null) {
return false;
- } else if (!id.equals(other.id))
+ }
+ } else if (!id.equals(other.id)) {
return false;
+ }
return true;
}
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/BundleNode.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/BundleNode.java
index 91ff1b8..32bc23b 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/BundleNode.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/BundleNode.java
@@ -166,18 +166,23 @@ public class BundleNode extends AbstractAssemblyNode<AssemblyNode> {
@Override
public boolean equals(final Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
final BundleNode other = (BundleNode) obj;
if (name == null) {
- if (other.name != null)
+ if (other.name != null) {
return false;
- } else if (!name.equals(other.name))
+ }
+ } else if (!name.equals(other.name)) {
return false;
+ }
return true;
}
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/RCPPerspective.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/RCPPerspective.java
index 8f45e70..10ee384 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/RCPPerspective.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/RCPPerspective.java
@@ -63,18 +63,23 @@ public class RCPPerspective {
@Override
public boolean equals(final Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
final RCPPerspective other = (RCPPerspective) obj;
if (id == null) {
- if (other.id != null)
+ if (other.id != null) {
return false;
- } else if (!id.equals(other.id))
+ }
+ } else if (!id.equals(other.id)) {
return false;
+ }
return true;
}
diff --git a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/RCPView.java b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/RCPView.java
index c8c3206..f11e0f6 100644
--- a/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/RCPView.java
+++ b/org.eclipse.riena.toolbox/src/org/eclipse/riena/toolbox/assemblyeditor/model/RCPView.java
@@ -77,18 +77,23 @@ public class RCPView {
@Override
public boolean equals(final Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
final RCPView other = (RCPView) obj;
if (id == null) {
- if (other.id != null)
+ if (other.id != null) {
return false;
- } else if (!id.equals(other.id))
+ }
+ } else if (!id.equals(other.id)) {
return false;
+ }
return true;
}
}