JBoss Tools SVN: r4496 - in trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common: model/ui/dialog and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-10-24 20:21:48 -0400 (Wed, 24 Oct 2007)
New Revision: 4496
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dialog/MessageAndCheckboxDialog.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/ControlDragDrop.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapperExtension.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/AnyElementForm.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Memento.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/MementoDOM.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/XChildrenEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/problem/ResourceProblemManager.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/widgets/DefaultSettings.java
Log:
Code clean up.
new Integer() replaced for Integer.valueOf()
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java 2007-10-25 00:21:39 UTC (rev 4495)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java 2007-10-25 00:21:48 UTC (rev 4496)
@@ -17,6 +17,7 @@
import java.util.Properties;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
+import org.jboss.tools.common.CommonPlugin;
import org.jboss.tools.common.core.resources.XModelObjectEditorInput;
import org.jboss.tools.common.model.util.XModelTreeListenerSWTSync;
import org.jboss.tools.common.model.ui.outline.XModelObjectContentOutlineProvider;
@@ -152,8 +153,10 @@
String q = file.getPersistentProperty(persistentTabQualifiedName);
selectedPageIndex = (q == null) ? 0 : Integer.parseInt(q);
}
- } catch (Exception e) {
+ } catch (NumberFormatException e) {
selectedPageIndex = 0;
+ } catch (CoreException e) {
+ selectedPageIndex = 0;
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dialog/MessageAndCheckboxDialog.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dialog/MessageAndCheckboxDialog.java 2007-10-25 00:21:39 UTC (rev 4495)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dialog/MessageAndCheckboxDialog.java 2007-10-25 00:21:48 UTC (rev 4496)
@@ -58,7 +58,7 @@
String title = p.getProperty("title", "Confirmation");
MessageAndCheckboxDialog dialog = new MessageAndCheckboxDialog(parent, title, QUESTION, p);
int result = dialog.open();
- p.put(RETURN_CODE, new Integer(result));
+ p.put(RETURN_CODE, Integer.valueOf(result));
return result == 0;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/ControlDragDrop.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/ControlDragDrop.java 2007-10-25 00:21:39 UTC (rev 4495)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/dnd/ControlDragDrop.java 2007-10-25 00:21:48 UTC (rev 4496)
@@ -327,8 +327,8 @@
DnDUtil.paste(o, p);
}
if(provider instanceof IControlDropListener) {
- p.put("drop.x", new Integer(event.x));
- p.put("drop.y", new Integer(event.y));
+ p.put("drop.x", Integer.valueOf(event.x));
+ p.put("drop.y", Integer.valueOf(event.y));
if(draggedObject != null) p.put("draggedObject", draggedObject);
((IControlDropListener)provider).drop(p);
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapperExtension.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapperExtension.java 2007-10-25 00:21:39 UTC (rev 4495)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/EditorPartWrapperExtension.java 2007-10-25 00:21:48 UTC (rev 4496)
@@ -93,7 +93,7 @@
int tp = (p == null) ? Integer.MAX_VALUE : p.intValue();
if(priority < tp) {
factories.put(t, f);
- priorities.put(t, new Integer(priority));
+ priorities.put(t, Integer.valueOf(priority));
}
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/AnyElementForm.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/AnyElementForm.java 2007-10-25 00:21:39 UTC (rev 4495)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/AnyElementForm.java 2007-10-25 00:21:48 UTC (rev 4496)
@@ -187,7 +187,7 @@
return attributes == null ? null : attributes[r][c];
}
public Object getDataAt(int r) {
- return new Integer(r);
+ return Integer.valueOf(r);
}
public Color getColor(int r) {
return null;
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Memento.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Memento.java 2007-10-25 00:21:39 UTC (rev 4495)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Memento.java 2007-10-25 00:21:48 UTC (rev 4496)
@@ -133,7 +133,7 @@
* @see org.eclipse.ui.IMemento#putInteger(java.lang.String, int)
*/
public void putInteger(String key, int value) {
- map.put(key, new Integer(value));
+ map.put(key, Integer.valueOf(value));
}
/* (non-Javadoc)
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/MementoDOM.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/MementoDOM.java 2007-10-25 00:21:39 UTC (rev 4495)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/MementoDOM.java 2007-10-25 00:21:48 UTC (rev 4496)
@@ -115,7 +115,7 @@
* @see org.eclipse.ui.IMemento#getInteger(java.lang.String)
*/
public Integer getInteger(String key) {
- return new Integer(element.getAttribute(key));
+ return Integer.valueOf(element.getAttribute(key));
}
/* (non-Javadoc)
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/XChildrenEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/XChildrenEditor.java 2007-10-25 00:21:39 UTC (rev 4495)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/XChildrenEditor.java 2007-10-25 00:21:48 UTC (rev 4496)
@@ -270,7 +270,7 @@
Properties p = new Properties();
p.put("shell", bar.getControl().getShell());
int i = xtable.getSelectionIndex();
- p.put("insertAfter", new Integer(i));
+ p.put("insertAfter", Integer.valueOf(i));
XActionInvoker.invoke(path, o, getTargets(), p);
} catch (Exception e) {
ModelUIPlugin.getPluginLog().logError(e);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/problem/ResourceProblemManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/problem/ResourceProblemManager.java 2007-10-25 00:21:39 UTC (rev 4495)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/problem/ResourceProblemManager.java 2007-10-25 00:21:48 UTC (rev 4496)
@@ -85,12 +85,12 @@
HashMap<String,Object> markerData = new HashMap<String,Object>();
markerData.put(IMarker.MESSAGE, problem.getMessage());
markerData.put(IMarker.LOCATION, resource.getLocation().toOSString());
- markerData.put(IMarker.LINE_NUMBER, new Integer(problem.getLine()));
- markerData.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
+ markerData.put(IMarker.LINE_NUMBER, Integer.valueOf(problem.getLine()));
+ markerData.put(IMarker.SEVERITY, Integer.valueOf(IMarker.SEVERITY_ERROR));
int position = problem.getPosition();
if(position != Problem.NONE) {
- markerData.put(IMarker.CHAR_START, new Integer(position));
- markerData.put(IMarker.CHAR_END, new Integer(position + 1));
+ markerData.put(IMarker.CHAR_START, Integer.valueOf(position));
+ markerData.put(IMarker.CHAR_END, Integer.valueOf(position + 1));
}
this.addMarker(markerData);
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/widgets/DefaultSettings.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/widgets/DefaultSettings.java 2007-10-25 00:21:39 UTC (rev 4495)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/widgets/DefaultSettings.java 2007-10-25 00:21:48 UTC (rev 4496)
@@ -221,7 +221,7 @@
settings.put(key, object);
}
protected void put(String key, int i) {
- settings.put(key, new Integer(i));
+ settings.put(key, Integer.valueOf(i));
}
protected void put(String key, Color color) {
settings.put(key, color);
18 years, 2 months
JBoss Tools SVN: r4495 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor: css and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-10-24 20:21:39 -0400 (Wed, 24 Oct 2007)
New Revision: 4495
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/css/VpeAddReferenceSupport.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeXmlnsCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
Log:
Code clean up.
new Integer() replaced for Integer.valueOf()
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-10-25 00:21:34 UTC (rev 4494)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-10-25 00:21:39 UTC (rev 4495)
@@ -1905,7 +1905,7 @@
String attrName, boolean ns) {
Attr attr = sourceElement.getAttributeNode(attrName);
if (ATTR_XMLNS.equals(attr.getPrefix())) {
- xmlnsMap.put(attr.getNodeName(), new Integer(attr.hashCode()));
+ xmlnsMap.put(attr.getNodeName(), Integer.valueOf(attr.hashCode()));
pageContext.setTaglib(attr.hashCode(), attr.getNodeValue(), attr
.getLocalName(), ns);
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/css/VpeAddReferenceSupport.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/css/VpeAddReferenceSupport.java 2007-10-25 00:21:34 UTC (rev 4494)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/css/VpeAddReferenceSupport.java 2007-10-25 00:21:39 UTC (rev 4495)
@@ -42,7 +42,7 @@
object.setAttributeValue("prefix", css.getProperties());
}
Properties p = new Properties();
- p.put("scope", new Integer(css.getScope()));
+ p.put("scope",Integer.valueOf(css.getScope()));
p.put("list", list);
if(file != null) p.put("file", file);
XActionInvoker.invoke(action, object, p);
@@ -115,7 +115,7 @@
getTarget().setAttributeValue("prefix", p0.getProperty("prefix"));
}
int scope = getSelectedScope(p0);
- getProperties().put("scope", new Integer(scope));
+ getProperties().put("scope", Integer.valueOf(scope));
}
int getSelectedScope(Properties p0) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2007-10-25 00:21:34 UTC (rev 4494)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2007-10-25 00:21:39 UTC (rev 4495)
@@ -86,17 +86,17 @@
}
static private HashMap<String, Integer> tagResizeConstrans = new HashMap<String, Integer>();
static{
- tagResizeConstrans.put("table", new Integer(VpeTagDescription.RESIZE_CONSTRAINS_ALL));
- tagResizeConstrans.put("tr", new Integer(VpeTagDescription.RESIZE_CONSTRAINS_ALL));
- tagResizeConstrans.put("br", new Integer(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
- tagResizeConstrans.put("b", new Integer(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
- tagResizeConstrans.put("i", new Integer(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
- tagResizeConstrans.put("u", new Integer(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
- tagResizeConstrans.put("sub", new Integer(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
- tagResizeConstrans.put("sup", new Integer(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
- tagResizeConstrans.put("strike", new Integer(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
- tagResizeConstrans.put("font", new Integer(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
- tagResizeConstrans.put("a", new Integer(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
+ tagResizeConstrans.put("table", Integer.valueOf(VpeTagDescription.RESIZE_CONSTRAINS_ALL));
+ tagResizeConstrans.put("tr", Integer.valueOf(VpeTagDescription.RESIZE_CONSTRAINS_ALL));
+ tagResizeConstrans.put("br", Integer.valueOf(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
+ tagResizeConstrans.put("b", Integer.valueOf(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
+ tagResizeConstrans.put("i", Integer.valueOf(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
+ tagResizeConstrans.put("u", Integer.valueOf(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
+ tagResizeConstrans.put("sub", Integer.valueOf(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
+ tagResizeConstrans.put("sup", Integer.valueOf(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
+ tagResizeConstrans.put("strike", Integer.valueOf(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
+ tagResizeConstrans.put("font", Integer.valueOf(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
+ tagResizeConstrans.put("a", Integer.valueOf(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
}
static private HashSet<String> breakWithParagraphTags = new HashSet<String>();
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeXmlnsCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeXmlnsCreator.java 2007-10-25 00:21:34 UTC (rev 4494)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeXmlnsCreator.java 2007-10-25 00:21:39 UTC (rev 4495)
@@ -60,7 +60,7 @@
private void addTaglib(VpePageContext pageContext, Element sourceElement, Map visualNodeMap, String attrName) {
Attr attr = sourceElement.getAttributeNode(attrName);
if (ATTR_XMLNS.equals(attr.getPrefix())) {
- visualNodeMap.put(attr.getNodeName(), new Integer(attr.hashCode()));
+ visualNodeMap.put(attr.getNodeName(), Integer.valueOf(attr.hashCode()));
pageContext.setTaglib(attr.hashCode(), attr.getNodeValue(), attr.getLocalName(), true);
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2007-10-25 00:21:34 UTC (rev 4494)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2007-10-25 00:21:39 UTC (rev 4495)
@@ -132,8 +132,8 @@
if (valuePosition >= 0) {
int endPosition = style.indexOf(PX_STRING, valuePosition);
if (endPosition >= 0) {
- return new Integer(style.substring(valuePosition + 1,
- endPosition).trim()).intValue();
+ return Integer.parseInt(style.substring(valuePosition + 1,
+ endPosition).trim());
}
}
}
18 years, 2 months
JBoss Tools SVN: r4494 - in trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui: editor/model/impl and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-10-24 20:21:34 -0400 (Wed, 24 Oct 2007)
New Revision: 4494
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/xpl/JSFConnectionRouter.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/model/impl/JSFModel.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/print/PagesView.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/bean/AddManagedBeanScreenTwo.java
Log:
Code clean up.
new Integer() replaced for Integer.valueOf()
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/xpl/JSFConnectionRouter.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/xpl/JSFConnectionRouter.java 2007-10-25 00:21:28 UTC (rev 4493)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/xpl/JSFConnectionRouter.java 2007-10-25 00:21:34 UTC (rev 4494)
@@ -90,7 +90,7 @@
r--;
Integer i;
while (proximity < r){
- i = new Integer(r + proximity*direction);
+ i = Integer.valueOf(r + proximity*direction);
if (!colsUsed.contains(i)){
colsUsed.add(i);
reserveColumn(conn, i);
@@ -160,7 +160,7 @@
r--;
Integer i;
while (proximity < r){
- i = new Integer(r + proximity*direction);
+ i = Integer.valueOf(r + proximity*direction);
if (!rowsUsed.contains(i)){
rowsUsed.add(i);
reserveRow(connection, i);
@@ -297,7 +297,7 @@
conn.translateToRelative(startPoint);
List<Integer> positions = new ArrayList<Integer>(5);
Ray start = new Ray(startPoint);
- positions.add(new Integer(start.y));
+ positions.add(Integer.valueOf(start.y));
Point endPoint = new Point(startPoint.x+18, startPoint.y);
Ray end = new Ray(endPoint);
@@ -335,12 +335,12 @@
List<Integer> positions = new ArrayList<Integer>(5);
boolean horizontal = true;
// start horizontal segment
- positions.add(new Integer(start.y));
+ positions.add(Integer.valueOf(start.y));
horizontal = !horizontal;
if((start.x > (end.x+20)) && (Math.abs(end.y-start.y) < 100)){
i = startNormal.similarity(start.getAdded(startNormal.getScaled(10)));
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
if(conn.getSourceAnchor().getOwner() == null){
@@ -351,19 +351,19 @@
i = rec.y+rec.height+8;
}
i -= i%STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
i = endNormal.similarity(end.getAdded(endNormal.getScaled(10)));
i -= i%STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
}else{
// vertical segment
if (startNormal.dotProduct(direction) < STEP*2){
i = startNormal.similarity(start.getAdded(startNormal.getScaled(10)));
i -= i%STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
}
@@ -371,19 +371,19 @@
if (horizontal) i = average.y;
else i = average.x;
i -= i%STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
// vertical segment
if (startNormal.dotProduct(direction) < STEP*2){
i = endNormal.similarity(end.getAdded(endNormal.getScaled(10)));
i -= i%STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
}
}
// end horizontal segment
- positions.add(new Integer(end.y));
+ positions.add(Integer.valueOf(end.y));
processPositions(start, end, positions,true, conn);
((ConnectionFigure)conn).setOldPoints(startPoint, endPoint);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/model/impl/JSFModel.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/model/impl/JSFModel.java 2007-10-25 00:21:28 UTC (rev 4493)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/model/impl/JSFModel.java 2007-10-25 00:21:34 UTC (rev 4494)
@@ -578,7 +578,7 @@
public int getVisualGridStep() {
String str = optionsObject.getAttributeValue("Grid Step");
- return new Integer(str).intValue();
+ return Integer.parseInt(str);
}
public Font getLinkPathFont() {
@@ -595,21 +595,19 @@
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2);
if (pos3 < 0)
- size = new Integer(str
- .substring(pos2 + 5, str.length())).intValue();
+ size = Integer.parseInt(str
+ .substring(pos2 + 5, str.length()));
else
- size = new Integer(str.substring(pos2 + 5, pos3))
- .intValue();
+ size = Integer.parseInt(str.substring(pos2 + 5, pos3));
}
pos2 = str.indexOf("style=");
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2);
if (pos3 < 0)
- style = new Integer(str.substring(pos2 + 6, str
- .length())).intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, str
+ .length()));
else
- style = new Integer(str.substring(pos2 + 6, pos3))
- .intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, pos3));
}
}
@@ -640,21 +638,19 @@
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2);
if (pos3 < 0)
- size = new Integer(str
- .substring(pos2 + 5, str.length())).intValue();
+ size = Integer.parseInt(str
+ .substring(pos2 + 5, str.length()));
else
- size = new Integer(str.substring(pos2 + 5, pos3))
- .intValue();
+ size = Integer.parseInt(str.substring(pos2 + 5, pos3));
}
pos2 = str.indexOf("style=");
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2);
if (pos3 < 0)
- style = new Integer(str.substring(pos2 + 6, str
- .length())).intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, str
+ .length()));
else
- style = new Integer(str.substring(pos2 + 6, pos3))
- .intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, pos3));
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/print/PagesView.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/print/PagesView.java 2007-10-25 00:21:28 UTC (rev 4493)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/print/PagesView.java 2007-10-25 00:21:34 UTC (rev 4494)
@@ -284,7 +284,7 @@
.drawLine(zeroX, tmp - pH + zeroY, xmax + zeroX, tmp - pH
+ zeroY);
tmp = tmp - pH;
- yy.add(new Integer(tmp));
+ yy.add(Integer.valueOf(tmp));
}
tmp = xmax;
@@ -294,7 +294,7 @@
.drawLine(tmp - pW + zeroX, zeroY, tmp - pW + zeroX, ymax
+ zeroY);
tmp = tmp - pW;
- xx.add(new Integer(tmp));
+ xx.add(Integer.valueOf(tmp));
}
List<Rectangle> rec = new ArrayList<Rectangle>();
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/bean/AddManagedBeanScreenTwo.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/bean/AddManagedBeanScreenTwo.java 2007-10-25 00:21:28 UTC (rev 4493)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/bean/AddManagedBeanScreenTwo.java 2007-10-25 00:21:34 UTC (rev 4494)
@@ -171,7 +171,7 @@
}
public Object getDataAt(int r) {
- return new Integer(r);
+ return Integer.valueOf(r);
}
public Color getColor(int r) {
18 years, 2 months
JBoss Tools SVN: r4493 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors: model and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-10-24 20:21:28 -0400 (Wed, 24 Oct 2007)
New Revision: 4493
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Group.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
Log:
Code clean up.
new Integer() replaced for Integer.valueOf()
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Group.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Group.java 2007-10-25 00:21:24 UTC (rev 4492)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Group.java 2007-10-25 00:21:28 UTC (rev 4493)
@@ -35,7 +35,7 @@
public void expandGroup(int _item) {
Item item = allitems[_item];
item.group = this;
- itemList.add(new Integer(_item));
+ itemList.add(Integer.valueOf(_item));
int[] is = item.comments;
for (int i = 0; i < is.length; i++) {
Item item2 = allitems[is[i]];
@@ -219,7 +219,7 @@
private void expandGroup2(int _item) {
Item item = allitems[_item];
item.group = this;
- itemList.add(new Integer(_item));
+ itemList.add(Integer.valueOf(_item));
int[] is = item.comments;
for (int i = 0; i < is.length; i++) {
expandGroup2(is[i]);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-10-25 00:21:24 UTC (rev 4492)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-10-25 00:21:28 UTC (rev 4493)
@@ -672,9 +672,9 @@
private Point getPoint(Properties properties, String key){
Point point = new Point(0,0);
String str = properties.getProperty(key+".x","0");
- point.x = new Integer(str).intValue();
+ point.x = Integer.parseInt(str);
String str2 = properties.getProperty(key+".y","0");
- point.y = new Integer(str2).intValue();
+ point.y = Integer.parseInt(str2);
return point;
}
18 years, 2 months
JBoss Tools SVN: r4492 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers/autolayout.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-10-24 20:21:24 -0400 (Wed, 24 Oct 2007)
New Revision: 4492
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers/autolayout/Group.java
Log:
Code clean up.
new Integer() replaced for Integer.valueOf()
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers/autolayout/Group.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers/autolayout/Group.java 2007-10-25 00:21:21 UTC (rev 4491)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/helpers/autolayout/Group.java 2007-10-25 00:21:24 UTC (rev 4492)
@@ -30,7 +30,7 @@
public void expandGroup(int _item) {
Item item = allitems[_item];
item.group = this;
- itemList.add(new Integer(_item));
+ itemList.add(Integer.valueOf(_item));
int[] is = item.comments;
for (int i = 0; i < is.length; i++) {
Item item2 = allitems[is[i]];
@@ -199,7 +199,7 @@
private void expandGroup2(int _item) {
Item item = allitems[_item];
item.group = this;
- itemList.add(new Integer(_item));
+ itemList.add(Integer.valueOf(_item));
int[] is = item.comments;
for (int i = 0; i < is.length; i++) {
expandGroup2(is[i]);
18 years, 2 months
JBoss Tools SVN: r4491 - in trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor: edit/xpl and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-10-24 20:21:21 -0400 (Wed, 24 Oct 2007)
New Revision: 4491
Modified:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/edit/StrutsConnectionRouter.java
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/edit/xpl/DefaultRouter.java
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/model/impl/StrutsModel.java
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/print/PagesView.java
Log:
Code clean up.
new Integer() replaced for Integer.valueOf()
Modified: trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/edit/StrutsConnectionRouter.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/edit/StrutsConnectionRouter.java 2007-10-25 00:21:14 UTC (rev 4490)
+++ trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/edit/StrutsConnectionRouter.java 2007-10-25 00:21:21 UTC (rev 4491)
@@ -55,7 +55,7 @@
conn.translateToRelative(startPoint);
Vector positions = new Vector(5);
Ray start = new Ray(startPoint);
- positions.add(new Integer(start.y));
+ positions.add(Integer.valueOf(start.y));
Point endPoint = new Point(startPoint.x + 18, startPoint.y);
Ray end = new Ray(endPoint);
Modified: trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/edit/xpl/DefaultRouter.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/edit/xpl/DefaultRouter.java 2007-10-25 00:21:14 UTC (rev 4490)
+++ trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/edit/xpl/DefaultRouter.java 2007-10-25 00:21:21 UTC (rev 4491)
@@ -93,7 +93,7 @@
r--;
Integer i;
while (proximity < r){
- i = new Integer(r + proximity*direction);
+ i = Integer.valueOf(r + proximity*direction);
if (!colsUsed.containsKey(i)){
colsUsed.put(i,i);
reserveColumn(conn, i);
@@ -144,12 +144,12 @@
Vector positions = new Vector(5);
boolean horizontal = true;//startNormal.isHorizontal();
// start horizontal segment
- positions.add(new Integer(start.y));
+ positions.add(Integer.valueOf(start.y));
horizontal = !horizontal;
if((start.x > (end.x+20)) && (Math.abs(end.y-start.y) < 100)){
i = startNormal.similarity(start.getAdded(startNormal.getScaled(INTEGER)));
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
if(conn.getSourceAnchor().getOwner() == null){
@@ -160,19 +160,19 @@
i = rec.y+rec.height+8;
}
i -= i%STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
i = endNormal.similarity(end.getAdded(endNormal.getScaled(INTEGER)));
i -= i%STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
}else{
// vertical segment
if (startNormal.dotProduct(direction) < STEP*2){
i = startNormal.similarity(start.getAdded(startNormal.getScaled(INTEGER)));
i -= i%STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
}
@@ -180,19 +180,19 @@
if (horizontal) i = average.y;
else i = average.x;
i -= i%STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
// vertical segment
if (startNormal.dotProduct(direction) < STEP*2){
i = endNormal.similarity(end.getAdded(endNormal.getScaled(INTEGER)));
i -= i%STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
}
}
// end horizontal segment
- positions.add(new Integer(end.y));
+ positions.add(Integer.valueOf(end.y));
postRoute(conn, start, end, startPoint, endPoint, positions);
}
@@ -225,13 +225,13 @@
boolean horizontal = true;// startNormal.isHorizontal();
// start horizontal segment
- positions.add(new Integer(start.y));
+ positions.add(Integer.valueOf(start.y));
horizontal = !horizontal;
if ((start.x > (end.x + 20)) && (Math.abs(end.y - start.y) < 100)) {
i = startNormal.similarity(start.getAdded(startNormal
.getScaled(INTEGER)));
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
if (conn.getSourceAnchor().getOwner() == null) {
@@ -242,13 +242,13 @@
i = rec.y + rec.height + 8;
}
i -= i % STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
i = endNormal
.similarity(end.getAdded(endNormal.getScaled(INTEGER)));
i -= i % STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
} else {
// vertical segment
@@ -256,7 +256,7 @@
i = startNormal.similarity(start.getAdded(startNormal
.getScaled(INTEGER)));
i -= i % STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
}
@@ -266,7 +266,7 @@
else
i = average.x;
i -= i % STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
// vertical segment
@@ -274,12 +274,12 @@
i = endNormal.similarity(end.getAdded(endNormal
.getScaled(INTEGER)));
i -= i % STEP;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
}
}
// end horizontal segment
- positions.add(new Integer(end.y));
+ positions.add(Integer.valueOf(end.y));
}
protected Ray getStartDirection(Connection conn) {
@@ -307,7 +307,7 @@
r--;
Integer i;
while (proximity < r) {
- i = new Integer(r + proximity * direction);
+ i = Integer.valueOf(r + proximity * direction);
if (!rowsUsed.containsKey(i)) {
rowsUsed.put(i, i);
reserveRow(connection, i);
Modified: trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/model/impl/StrutsModel.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/model/impl/StrutsModel.java 2007-10-25 00:21:14 UTC (rev 4490)
+++ trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/model/impl/StrutsModel.java 2007-10-25 00:21:21 UTC (rev 4491)
@@ -530,7 +530,7 @@
public int getGridStep() {
String str = optionsObject.getAttributeValue("Grid Step");
- return new Integer(str).intValue();
+ return Integer.parseInt(str);
}
public Font getActionFont() {
@@ -547,21 +547,19 @@
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2);
if (pos3 < 0)
- size = new Integer(str
- .substring(pos2 + 5, str.length())).intValue();
+ size = Integer.parseInt(str
+ .substring(pos2 + 5, str.length()));
else
- size = new Integer(str.substring(pos2 + 5, pos3))
- .intValue();
+ size = Integer.parseInt(str.substring(pos2 + 5, pos3));
}
pos2 = str.indexOf("style=");
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2);
if (pos3 < 0)
- style = new Integer(str.substring(pos2 + 6, str
- .length())).intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, str
+ .length()));
else
- style = new Integer(str.substring(pos2 + 6, pos3))
- .intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, pos3));
}
}
@@ -592,21 +590,19 @@
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2);
if (pos3 < 0)
- size = new Integer(str
- .substring(pos2 + 5, str.length())).intValue();
+ size = Integer.parseInt(str
+ .substring(pos2 + 5, str.length()));
else
- size = new Integer(str.substring(pos2 + 5, pos3))
- .intValue();
+ size = Integer.parseInt(str.substring(pos2 + 5, pos3));
}
pos2 = str.indexOf("style=");
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2);
if (pos3 < 0)
- style = new Integer(str.substring(pos2 + 6, str
- .length())).intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, str
+ .length()));
else
- style = new Integer(str.substring(pos2 + 6, pos3))
- .intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, pos3));
}
}
@@ -637,21 +633,19 @@
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2);
if (pos3 < 0)
- size = new Integer(str
- .substring(pos2 + 5, str.length())).intValue();
+ size = Integer.parseInt(str
+ .substring(pos2 + 5, str.length()));
else
- size = new Integer(str.substring(pos2 + 5, pos3))
- .intValue();
+ size = Integer.parseInt(str.substring(pos2 + 5, pos3));
}
pos2 = str.indexOf("style=");
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2);
if (pos3 < 0)
- style = new Integer(str.substring(pos2 + 6, str
- .length())).intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, str
+ .length()));
else
- style = new Integer(str.substring(pos2 + 6, pos3))
- .intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, pos3));
}
}
@@ -682,21 +676,19 @@
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2);
if (pos3 < 0)
- size = new Integer(str
- .substring(pos2 + 5, str.length())).intValue();
+ size = Integer.parseInt(str
+ .substring(pos2 + 5, str.length()));
else
- size = new Integer(str.substring(pos2 + 5, pos3))
- .intValue();
+ size = Integer.parseInt(str.substring(pos2 + 5, pos3));
}
pos2 = str.indexOf("style=");
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2);
if (pos3 < 0)
- style = new Integer(str.substring(pos2 + 6, str
- .length())).intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, str
+ .length()));
else
- style = new Integer(str.substring(pos2 + 6, pos3))
- .intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, pos3));
}
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/print/PagesView.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/print/PagesView.java 2007-10-25 00:21:14 UTC (rev 4490)
+++ trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/editor/print/PagesView.java 2007-10-25 00:21:21 UTC (rev 4491)
@@ -313,7 +313,7 @@
while(tmp>0){
g2.drawLine(zeroX,tmp - pH+zeroY,xmax+zeroX,tmp - pH+zeroY);
tmp = tmp - pH;
- yy.add(new Integer(tmp));
+ yy.add(Integer.valueOf(tmp));
}
tmp = xmax;
@@ -321,7 +321,7 @@
while(tmp>0){
g2.drawLine(tmp - pW+zeroX,zeroY,tmp - pW+zeroX,ymax+zeroY);
tmp = tmp - pW;
- xx.add(new Integer(tmp));
+ xx.add(Integer.valueOf(tmp));
}
Vector rec = new Vector();
18 years, 2 months
JBoss Tools SVN: r4490 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-10-24 20:21:14 -0400 (Wed, 24 Oct 2007)
New Revision: 4490
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FileFacesConfigImpl.java
Log:
Code clean up.
new Integer() replaced for Integer.valueOf()
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FileFacesConfigImpl.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FileFacesConfigImpl.java 2007-10-25 00:21:07 UTC (rev 4489)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FileFacesConfigImpl.java 2007-10-25 00:21:14 UTC (rev 4490)
@@ -43,7 +43,7 @@
String path = rs[i].getAttributeValue(ATT_FROM_VIEW_ID);
Integer v = paths.get(path);
is[i] = (v == null) ? 0 : v.intValue() + 1;
- paths.put(path, new Integer(is[i]));
+ paths.put(path, Integer.valueOf(is[i]));
pps.put(rs[i].getPathPart(), rs[i]);
}
boolean success = true;
18 years, 2 months
JBoss Tools SVN: r4489 - in trunk/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor: model/impl and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-10-24 20:21:07 -0400 (Wed, 24 Oct 2007)
New Revision: 4489
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/edit/xpl/TilesConnectionRouter.java
trunk/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/model/impl/TilesModel.java
trunk/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/print/PagesView.java
Log:
Code clean up.
new Integer() replaced for Integer.valueOf()
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/edit/xpl/TilesConnectionRouter.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/edit/xpl/TilesConnectionRouter.java 2007-10-25 00:21:01 UTC (rev 4488)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/edit/xpl/TilesConnectionRouter.java 2007-10-25 00:21:07 UTC (rev 4489)
@@ -73,7 +73,7 @@
r--;
Integer i;
while (proximity < r) {
- i = new Integer(r + proximity * direction);
+ i = Integer.valueOf(r + proximity * direction);
if (!colsUsed.contains(i)) {
colsUsed.add(i);
reserveColumn(connection, i);
@@ -160,7 +160,7 @@
r--;
Integer i;
while (proximity < r) {
- i = new Integer(r + proximity * direction);
+ i = Integer.valueOf(r + proximity * direction);
if (!rowsUsed.contains(i)) {
rowsUsed.add(i);
reserveRow(connection, i);
@@ -306,9 +306,9 @@
List<Integer> positions = new ArrayList<Integer>(5);
boolean horizontal = startNormal.isHorizontal();
if (horizontal)
- positions.add(new Integer(start.y));
+ positions.add(Integer.valueOf(start.y));
else
- positions.add(new Integer(start.x));
+ positions.add(Integer.valueOf(start.x));
horizontal = !horizontal;
if (startNormal.dotProduct(endNormal) == 0) {
@@ -325,7 +325,7 @@
else
i = average.x;
}
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
if (endNormal.dotProduct(direction) > 0)
@@ -336,7 +336,7 @@
else
i = average.x;
}
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
}
} else {
@@ -346,13 +346,13 @@
i = startNormal.similarity(start.getAdded(startNormal.getScaled(10)));
else
i = endNormal.similarity(end.getAdded(endNormal.getScaled(10)));
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
} else {
//3 or 1
if (startNormal.dotProduct(direction) < 0) {
i = startNormal.similarity(start.getAdded(startNormal.getScaled(10)));
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
}
@@ -360,20 +360,20 @@
i = average.y;
else
i = average.x;
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
if (startNormal.dotProduct(direction) < 0) {
i = endNormal.similarity(end.getAdded(endNormal.getScaled(10)));
- positions.add(new Integer(i));
+ positions.add(Integer.valueOf(i));
horizontal = !horizontal;
}
}
}
if (horizontal)
- positions.add(new Integer(end.y));
+ positions.add(Integer.valueOf(end.y));
else
- positions.add(new Integer(end.x));
+ positions.add(Integer.valueOf(end.x));
processPositions(start, end, positions, startNormal.isHorizontal(), conn);
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/model/impl/TilesModel.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/model/impl/TilesModel.java 2007-10-25 00:21:01 UTC (rev 4488)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/model/impl/TilesModel.java 2007-10-25 00:21:07 UTC (rev 4489)
@@ -559,7 +559,7 @@
return DEFAULT_VERTICAL_SPACING;
if (str.indexOf("default") >= 0)return DEFAULT_VERTICAL_SPACING; //$NON-NLS-1$
try {
- return new Integer(str).intValue();
+ return Integer.parseInt(str);
} catch (Exception ex) {
return DEFAULT_VERTICAL_SPACING;
}
@@ -571,7 +571,7 @@
return DEFAULT_HORIZONTAL_SPACING;
if (str.indexOf("default") >= 0)return DEFAULT_HORIZONTAL_SPACING; //$NON-NLS-1$
try {
- return new Integer(str).intValue();
+ return Integer.parseInt(str);
} catch (Exception ex) {
return DEFAULT_HORIZONTAL_SPACING;
}
@@ -603,23 +603,20 @@
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2); //$NON-NLS-1$
if (pos3 < 0)
- size = new Integer(str
- .substring(pos2 + 5, str.length())).intValue();
+ size = Integer.parseInt(str
+ .substring(pos2 + 5, str.length()));
else
- size = new Integer(str.substring(pos2 + 5, pos3))
- .intValue();
+ size = Integer.parseInt(str.substring(pos2 + 5, pos3));
}
pos2 = str.indexOf("style="); //$NON-NLS-1$
if (pos2 >= 0) {
pos3 = str.indexOf(",", pos2); //$NON-NLS-1$
if (pos3 < 0)
- style = new Integer(str.substring(pos2 + 6, str
- .length())).intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, str
+ .length()));
else
- style = new Integer(str.substring(pos2 + 6, pos3))
- .intValue();
+ style = Integer.parseInt(str.substring(pos2 + 6, pos3));
}
-
}
if (definitionNameFont == null) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/print/PagesView.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/print/PagesView.java 2007-10-25 00:21:01 UTC (rev 4488)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.tiles.ui/src/org/jboss/tools/jst/web/tiles/ui/editor/print/PagesView.java 2007-10-25 00:21:07 UTC (rev 4489)
@@ -250,7 +250,7 @@
while(tmp>0){
g2.drawLine(zeroX,tmp - pH+zeroY,xmax+zeroX,tmp - pH+zeroY);
tmp = tmp - pH;
- yy.add(new Integer(tmp));
+ yy.add(Integer.valueOf(tmp));
}
tmp = xmax;
18 years, 2 months
JBoss Tools SVN: r4488 - trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/helpers.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-10-24 20:21:01 -0400 (Wed, 24 Oct 2007)
New Revision: 4488
Modified:
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/helpers/StrutsBreakpointManager.java
Log:
Code clean up.
new Integer() replaced for Integer.valueOf()
Modified: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/helpers/StrutsBreakpointManager.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/helpers/StrutsBreakpointManager.java 2007-10-25 00:20:57 UTC (rev 4487)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/model/helpers/StrutsBreakpointManager.java 2007-10-25 00:21:01 UTC (rev 4488)
@@ -156,7 +156,7 @@
}
if (diagramObject != null) {
- new DiagramChangeHandler(diagramObject, new Integer(newStatus)).start();
+ new DiagramChangeHandler(diagramObject, Integer.valueOf(newStatus)).start();
}
}
}
@@ -463,7 +463,7 @@
public void setStatusAsInt(String markerType, int status, boolean mergeStatuses) {
Integer oldStatus = (Integer)markersStatuses.get(markerType);
if(oldStatus==null || oldStatus.intValue() != status) {
- markersStatuses.put(markerType, mergeStatuses? new Integer(status&oldStatus.intValue()):new Integer(status));
+ markersStatuses.put(markerType, mergeStatuses? Integer.valueOf(status&oldStatus.intValue()):Integer.valueOf(status));
// markersStatuses.put(markerType, new Integer(status));
}
}
@@ -477,7 +477,7 @@
while(keys.hasNext()) {
String key = (String)keys.next();
int oldStatus = getStatus(key);
- markersStatuses.put(key, mergeStatuses? new Integer(status&oldStatus):new Integer(status));
+ markersStatuses.put(key, mergeStatuses? Integer.valueOf(status&oldStatus):Integer.valueOf(status));
// markersStatuses.put(key, new Integer(status));
}
}
18 years, 2 months
JBoss Tools SVN: r4487 - trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-10-24 20:20:57 -0400 (Wed, 24 Oct 2007)
New Revision: 4487
Added:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/JobUtils.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest1.java
Log:
Code clean up.
new Integer() replaced for Integer.valueOf()
Added: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/JobUtils.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/JobUtils.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/JobUtils.java 2007-10-25 00:20:57 UTC (rev 4487)
@@ -0,0 +1,58 @@
+package org.jboss.tools.seam.ui.test.view;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+
+public class JobUtils {
+ public static void waitUsersJobsAreFinished() {
+ Job waitJob = new Job("Waiting while all users jobs are finished") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ return Status.OK_STATUS;
+ }
+ };
+ waitJob.setUser(true);
+ waitJob.schedule(5000);
+
+ try {
+ waitJob.join();
+ } catch (InterruptedException e) {
+ }
+ }
+
+ public static void waitForJobs() {
+ while (!Platform.getJobManager().isIdle())
+ delay(1000);
+ }
+
+ /**
+ * Process UI input but do not return for the
+ * specified time interval.
+ *
+ * @param delayMillis the number of milliseconds
+ */
+ protected static void delay(long delayMillis) {
+ Display currentDisplay = Display.getCurrent();
+
+ // If this is the UI thread
+ if (currentDisplay != null) {
+ long endTimeMillis = System.currentTimeMillis() + delayMillis;
+ while (System.currentTimeMillis() < endTimeMillis) {
+ if (!currentDisplay.readAndDispatch()) currentDisplay.sleep();
+ }
+ currentDisplay.update();
+ } else {
+ // perform a simple sleep
+ try {
+ Thread.sleep(delayMillis);
+ } catch (InterruptedException e) {
+ // Just allow it running
+ }
+ }
+ }
+
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/JobUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest1.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest1.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest1.java 2007-10-25 00:20:57 UTC (rev 4487)
@@ -0,0 +1,643 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+
+******************************************************************************/
+package org.jboss.tools.seam.ui.test.view;
+
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.internal.decorators.DecoratorManager;
+import org.eclipse.ui.navigator.CommonNavigator;
+import org.eclipse.ui.navigator.CommonViewer;
+import org.eclipse.ui.navigator.IExtensionStateModel;
+import org.eclipse.ui.progress.UIJob;
+import org.jboss.tools.common.model.XJob;
+import org.jboss.tools.common.util.ResourcesUtils;
+import org.jboss.tools.common.util.WorkbenchUtils;
+import org.jboss.tools.jst.web.ui.WebDevelopmentPerspectiveFactory;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamPackage;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.ui.ISeamUiConstants;
+import org.jboss.tools.seam.ui.views.ViewConstants;
+import org.jboss.tools.test.util.JUnitUtils;
+
+/**
+ *
+ * @author eskimo
+ *
+ */
+public class SeamComponentsViewTest1 extends TestCase {
+ IProject project;
+ IFile componentsFile;
+ IFile classFile;
+ Tree tree;
+ CommonNavigator navigator;
+ CommonViewer viewer;
+ IExtensionStateModel m2;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ Job.getJobManager().addJobChangeListener(new IJobChangeListener() {
+
+ public void aboutToRun(IJobChangeEvent event) {
+ System.out.println(event.getJob().getName());
+
+ }
+
+ public void awake(IJobChangeEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void done(IJobChangeEvent event) {
+
+
+ }
+
+ public void running(IJobChangeEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void scheduled(IJobChangeEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void sleeping(IJobChangeEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ });
+
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(new IResourceChangeListener() {
+ /* (non-Javadoc)
+ * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
+ */
+ public void resourceChanged(IResourceChangeEvent event) {
+ System.out.println(event.getResource().getLocation().toString());
+ }
+ });
+ WorkbenchUtils.getWorkbench().showPerspective(
+ WebDevelopmentPerspectiveFactory.PERSPECTIVE_ID,
+ WorkbenchUtils.getWorkbench().getActiveWorkbenchWindow());
+
+ project = (IProject)ResourcesPlugin.getWorkspace().getRoot().findMember("TestComponentView");
+
+ if(project==null) {
+ project = ResourcesUtils.importProject(Platform.getBundle("org.jboss.tools.seam.ui.test"), "/projects/TestComponentView", new NullProgressMonitor());
+ }
+ navigator = getSeamComponentsView();
+ viewer = navigator.getCommonViewer();
+ tree = viewer.getTree();
+
+ m2 = navigator.getNavigatorContentService().findStateModel("org.jboss.tools.seam.ui.views.rootContent");
+
+ componentsFile = project.getFile("WebContent/WEB-INF/components.xml");
+ assertTrue("Cannot find components.xml in test project", componentsFile != null && componentsFile.exists());
+
+ }
+
+ public void testFlatSeamPackages() throws InterruptedException{
+ m2.setBooleanProperty(ViewConstants.PACKAGE_STRUCTURE, true);
+ updateView();
+ JobUtils.waitUsersJobsAreFinished();
+ viewer.expandAll();
+ for (Object viewObject : viewer.getExpandedElements()) {
+ if(viewObject instanceof ISeamPackage) {
+ System.out.println(((ISeamPackage)viewObject).getQualifiedName());
+ }
+ }
+ ISeamPackage seamPackage = findSeamPackage(tree, "package1");
+ assertTrue("Expected package 'package1' was not" +
+ " found",seamPackage!=null);
+
+ seamPackage = findSeamPackage(tree, "package1.package2");
+ assertTrue("Expected package 'package1.package2' was not" +
+ " found",seamPackage!=null);
+
+ seamPackage = findSeamPackage(tree, "package1.package2.package3");
+ assertTrue("Expected package 'package1.package2.package3' was not" +
+ " found",seamPackage!=null);
+
+ seamPackage = findSeamPackage(tree, "package1.package2.package3.package4");
+ assertTrue("Expected package 'package1.package2.package3.package4' was not" +
+ " found",seamPackage!=null);
+ }
+
+// public void testHierarchicalSeamPackages() throws InterruptedException{
+// m2.setBooleanProperty(ViewConstants.PACKAGE_STRUCTURE, false);
+// m2.setBooleanProperty(ViewConstants.SCOPE_PRESENTATION, false);
+// updateView();
+// JobUtils.waitUsersJobsAreFinished();
+// ISeamPackage seamPackage = findSeamPackage(tree, "package4");
+// assertTrue("Expected package 'package4' was not" +
+// " found",seamPackage!=null);
+//
+// seamPackage = (ISeamPackage)seamPackage.getParent();
+// assertTrue("For 'package5' expected parent is 'package3' not '" +
+// seamPackage.getName() +"'", "package3".equals(seamPackage.getName()));
+//
+// seamPackage = findSeamPackage(tree, "package3");
+// assertTrue("Expected package 'package3' was not" +
+// " found",seamPackage!=null);
+//
+// seamPackage = (ISeamPackage)seamPackage.getParent();
+// assertTrue("For 'package3' expected parent is 'package2' not '" +
+// seamPackage.getName() +"'", "package2".equals(seamPackage.getName()));
+//
+// seamPackage = findSeamPackage(tree, "package2");
+// assertTrue("Expected package 'package2' was not" +
+// " found",seamPackage!=null);
+//
+// seamPackage = (ISeamPackage)seamPackage.getParent();
+// assertTrue("For 'package2' expected parent is 'package1' not '" +
+// seamPackage.getName() +"'", "package1".equals(seamPackage.getName()));
+// }
+//
+// public void testAddComponentInXmlFile() throws InterruptedException{
+//
+// IFile file1 = project.getFile("WebContent/WEB-INF/components.1");
+// if(file1 == null || !file1.exists()) {
+// fail("Cannot find test data file 'WebContent/WEB-INF/components.1'");
+// }
+//
+// try {
+// System.out.println("--------------------Before set content");
+// componentsFile.setContents(file1.getContents(),
+// true, false, new NullProgressMonitor());
+// System.out.println("--------------------After set content");
+// componentsFile.touch(new NullProgressMonitor());
+// System.out.println("--------------------After touch");
+// } catch (CoreException e) {
+// JUnitUtils.fail("Error in changing 'components.xml' content to " +
+// "'WebContent/WEB-INF/components.1'", e);
+// }
+// JobUtils.waitUsersJobsAreFinished();
+// updateView();
+//
+// ISeamPackage seamPackage = findSeamPackage(tree, "myPackage");
+// assertTrue("Seam model is not updated, expected package 'myPackage'" +
+// " is not found in tree",seamPackage!=null);
+//
+// ISeamComponent component = findSeamComponent(seamPackage,
+// "myPackage.myComponent");
+//
+// assertTrue("Expected component 'myPackage.myStringComponent' was not" +
+// " found",component!=null);
+// }
+//
+// public void testRenameComponentInXmlFile(){
+// m2.setBooleanProperty(ViewConstants.PACKAGE_STRUCTURE, true);
+//
+// IFile file1 = project.getFile("WebContent/WEB-INF/components.2");
+// if(file1 == null || !file1.exists()) {
+// fail("Cannot find test data file 'WebContent/WEB-INF/components.2'");
+// }
+//
+// try{
+// System.out.println("--------------------Before set content");
+// componentsFile.setContents(file1.getContents(), true, false, new NullProgressMonitor());
+// System.out.println("--------------------After set content");
+// componentsFile.touch(new NullProgressMonitor());
+// System.out.println("--------------------After set content");
+// }catch(Exception ex){
+// JUnitUtils.fail("Error in changing 'components.xml' content to " +
+// "'WebContent/WEB-INF/components.2'", ex);
+// }
+//
+// ISeamPackage seamPackage = findSeamPackage(tree, "myRenamedPackage");
+// assertTrue("Expected package 'myRenamedPackage' was not found it tree",
+// seamPackage!=null);
+//
+// ISeamComponent component = findSeamComponent(seamPackage, "myRenamedPackage.myRenamedComponent");
+// assertTrue("Expected component 'myRenamedPackage.myRenamedComponent' not found " +
+// "after renaming",component!=null);
+//
+// seamPackage = findSeamPackage(tree, "package4");
+// assertTrue("Expected package 'myPackage4' was not found it tree",
+// seamPackage!=null);
+//
+// component = findSeamComponent(seamPackage, "package4.component4");
+// assertTrue("Expected component 'package4.component4' not found " +
+// "after renaming",component!=null);
+//
+// seamPackage = findSeamPackage(tree, "package4.package3");
+// assertTrue("Expected package 'package4.package3' was not found it tree",
+// seamPackage!=null);
+//
+// component = findSeamComponent(seamPackage, "package4.package3.component3");
+// assertTrue("Expected component 'package4.package3.component3' not found " +
+// "after renaming",component!=null);
+//
+// seamPackage = findSeamPackage(tree, "package4.package3.package2");
+// assertTrue("Expected package 'package4.package3.package2' was not found it tree",
+// seamPackage!=null);
+//
+// component = findSeamComponent(seamPackage, "package4.package3.package2.component2");
+// assertTrue("Expected component 'package4.package3.package2.component2' not found " +
+// "after renaming",component!=null);
+//
+// seamPackage = findSeamPackage(tree, "package4.package3.package2.package1");
+// assertTrue("Expected package 'package4.package3.package2.package1' was not found it tree",
+// seamPackage!=null);
+//
+// component = findSeamComponent(seamPackage, "package4.package3.package2.package1.component1");
+// assertTrue("Expected component 'package4.package3.package2.package1.component1' not found " +
+// "after renaming",component!=null);
+//
+// }
+
+// public void testDeleteComponentInXmlFile(){
+//
+// IFile file1 = project.getFile("WebContent/WEB-INF/components.3");
+// assertTrue("Cannot find components.2 in test project", file1 != null && file1.exists());
+//
+// try{
+// System.out.println("--------------------Before set content");
+// componentsFile.setContents(file1.getContents(), true, false, new NullProgressMonitor());
+// System.out.println("--------------------After set content");
+// componentsFile.touch(new NullProgressMonitor());
+// System.out.println("--------------------After touch");
+// }catch(Exception ex){
+// JUnitUtils.fail("Cannot read file WebContent/WEB-INF/components.3", ex);
+// }
+//
+// refreshProject(project);
+//
+// ISeamPackage seamPackage = findSeamPackage(tree, "package4");
+// assertTrue("Expected package 'myPackage4' is expected to be deleted",
+// seamPackage==null);
+//
+// seamPackage = findSeamPackage(tree, "package4.package3");
+// assertTrue("Expected package 'package4.package3' is expected to be deleted",
+// seamPackage==null);
+//
+// seamPackage = findSeamPackage(tree, "package4.package3.package2");
+// assertTrue("Expected package 'package4.package3.package2' is expected to be deleted",
+// seamPackage==null);
+//
+// seamPackage = findSeamPackage(tree, "package4.package3.package2.package1");
+// assertTrue("Expected package 'package4.package3.package2.package1' is expected to be deleted",
+// seamPackage==null);
+//
+// }
+
+// public void testAddComponentInClass(){
+//
+// classFile = project.getFile("JavaSource/demo/Person.java");
+// assertTrue("Cannot find Person.java in test project", componentsFile != null);
+//
+// CommonNavigator navigator = getSeamComponentsView();
+// navigator.getCommonViewer().expandAll();
+//
+// Tree tree = navigator.getCommonViewer().getTree();
+//
+// ISeamPackage seamPackage = findSeamPackage(tree, "demo");
+// assertTrue("Package \"demo\" found!",seamPackage==null);
+//
+// IFile file1 = project.getFile("JavaSource/demo/Person.1");
+// assertTrue("Cannot find Person.1 in test project", file1 != null && file1.exists());
+//
+// try{
+// classFile.create(file1.getContents(), false, new NullProgressMonitor());
+// classFile.touch(new NullProgressMonitor());
+// }catch(Exception ex){
+// JUnitUtils.fail("Cannot read file JavaSource/demo/Person.1", ex);
+// }
+//
+// refreshProject(project);
+//
+// seamPackage = findSeamPackage(tree, "demo");
+// assertTrue("Package \"demo\" not found!",seamPackage!=null);
+//
+// ISeamComponent component = findSeamComponent(seamPackage, "demo.John");
+// assertTrue("Component \"demo.John\" not found!",component!=null);
+// }
+
+// public void testRenameComponentInClass(){
+//
+// classFile = project.getFile("JavaSource/demo/Person.java");
+//
+// CommonNavigator navigator = getSeamComponentsView();
+// navigator.getCommonViewer().expandAll();
+//
+// Tree tree = navigator.getCommonViewer().getTree();
+//
+// ISeamPackage seamPackage = findSeamPackage(tree, "demo");
+// assertTrue("Package \"demo\" not found!",seamPackage!=null);
+//
+// ISeamComponent component = findSeamComponent(seamPackage, "demo.John");
+// assertTrue("Component \"demo.John\" not found!",component!=null);
+//
+// IFile file1 = project.getFile("JavaSource/demo/Person.2");
+// assertTrue("Cannot find Person.2 in test project", file1 != null && file1.exists());
+//
+// try{
+// classFile.setContents(file1.getContents(), true, false, new NullProgressMonitor());
+// classFile.touch(new NullProgressMonitor());
+// }catch(Exception ex){
+// JUnitUtils.fail("Cannot read file JavaSource/demo/Person.2", ex);
+// }
+//
+// refreshProject(project);
+//
+// seamPackage = findSeamPackage(tree, "demo");
+// assertTrue("Package \"demo\" not found!",seamPackage!=null);
+//
+// component = findSeamComponent(seamPackage, "demo.John");
+// assertTrue("Component \"demo.John\" found!",component==null);
+//
+// component = findSeamComponent(seamPackage, "demo.Pall");
+// assertTrue("Component \"demo.Pall\" not found!",component!=null);
+//
+// IFile file2 = project.getFile("JavaSource/demo/Person.3");
+// assertTrue("Cannot find Person.3 in test project", file2 != null && file2.exists());
+//
+// try{
+// classFile.setContents(file2.getContents(), true, false, new NullProgressMonitor());
+//
+// classFile.touch(new NullProgressMonitor());
+// }catch(Exception ex){
+// JUnitUtils.fail("Cannot read file JavaSource/demo/Person.3", ex);
+// }
+//
+// refreshProject(project);
+//
+// seamPackage = findSeamPackage(tree, "demo");
+// assertTrue("Package \"demo\" found!",seamPackage==null);
+//
+// seamPackage = findSeamPackage(tree, "beatles");
+// assertTrue("Package \"beatles\" not found!",seamPackage!=null);
+//
+// component = findSeamComponent(seamPackage, "beatles.Pall");
+// assertTrue("Component \"beatles.Pall\" not found!",component!=null);
+// }
+
+// public void testDeleteComponentInClass(){
+// classFile = project.getFile("JavaSource/demo/Person.java");
+//
+// CommonNavigator navigator = getSeamComponentsView();
+// navigator.getCommonViewer().expandAll();
+//
+// Tree tree = navigator.getCommonViewer().getTree();
+//
+// ISeamPackage seamPackage = findSeamPackage(tree, "beatles");
+// assertTrue("Package \"beatles\" not found!",seamPackage!=null);
+//
+// if(seamPackage != null){
+// ISeamComponent component = findSeamComponent(seamPackage, "beatles.Pall");
+// assertTrue("Component \"beatles.Pall\" not found!",component!=null);
+// }
+//
+// try{
+// classFile.delete(true, new NullProgressMonitor());
+// }catch(Exception ex){
+// JUnitUtils.fail("Cannot delete file JavaSource/demo/Person.java", ex);
+// }
+//
+// refreshProject(project);
+//
+// seamPackage = findSeamPackage(tree, "beatles");
+// assertTrue("Package \"beatles\" found!",seamPackage==null);
+// }
+
+// /**
+// *
+// */
+ public void testSeamComponentsViewIsShowedOnPerspective() {
+ IWorkbenchPage page = WorkbenchUtils.getWorkbenchActivePage();
+ IViewPart part = page.findView(ISeamUiConstants.SEAM_COMPONENTS_VIEW_ID);
+ assertNotNull("Cannot show the Seam Components View", part);
+ }
+
+// public void testCreatedProjectIsShownOnTree() {
+// TestProjectProvider provider=null;
+// try {
+// provider = new TestProjectProvider("org.jboss.tools.seam.ui.test", null, "TestComponentView", true);
+// } catch (Exception e1) {
+// JUnitUtils.fail("Cannot create Project Provider", e1);
+// }
+// IProject project = provider.getProject();
+// try {
+// project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+// } catch (Exception e) {
+// JUnitUtils.fail("Cannot refresh created test Project", e);
+// }
+// IStructuredContentProvider content
+// = (IStructuredContentProvider)getSeamComponentsView().getCommonViewer().getContentProvider();
+// assertTrue("Created Seam enabled project haven't been shown in tree",1==content.getElements(ResourcesPlugin.getWorkspace().getRoot()).length);
+//
+// }
+//
+// public void testThatDeletedProjectIsDisappearedFromTree() {
+// try {
+// ResourcesPlugin.getWorkspace().getRoot().findMember("TestComponentView").delete(true, new NullProgressMonitor());
+// } catch (CoreException e) {
+// JUnitUtils.fail(e.getMessage(),e);
+// }
+// IStructuredContentProvider content
+// = (IStructuredContentProvider)getSeamComponentsView().getCommonViewer().getContentProvider();
+// assertTrue("Created Seam enabled project haven't been deleted from tree",0==content.getElements(ResourcesPlugin.getWorkspace().getRoot()).length);
+// }
+
+ private CommonNavigator getSeamComponentsView() {
+ IWorkbenchPage page = WorkbenchUtils.getWorkbenchActivePage();
+ CommonNavigator part = (CommonNavigator)page.findView(ISeamUiConstants.SEAM_COMPONENTS_VIEW_ID);
+ return part;
+ }
+
+ private ISeamComponent findSeamComponent(ISeamPackage seamPackage, String name){
+ ISeamComponent component=null;
+
+ Iterator<ISeamComponent> iter = seamPackage.getComponents().iterator();
+ while(iter.hasNext()){
+ component = iter.next();
+ if(component.getName().equals(name)) return component;
+ }
+
+ return null;
+ }
+
+ private ISeamPackage findSeamPackage(TreeItem item, String name){
+ ISeamPackage seamPackage=null;
+
+ for(int i=0;i<item.getItemCount();i++){
+ TreeItem cur = item.getItem(i);
+ if(cur.getData() instanceof ISeamPackage) {
+ ISeamPackage pkg =(ISeamPackage)cur.getData();
+ if(m2.getBooleanProperty(ViewConstants.PACKAGE_STRUCTURE)
+ && name.equals(pkg.getQualifiedName()) || name.equals(pkg.getName())) {
+ seamPackage = pkg;
+ break;
+ }
+ }
+ seamPackage = findSeamPackage(cur, name);
+ if(seamPackage != null) break;
+ }
+
+ return seamPackage;
+ }
+
+ private ISeamPackage findSeamPackage(Tree tree, String name){
+ ISeamPackage seamPackage=null;
+ TreeItem item;
+
+ for(int i=0;i<tree.getItemCount();i++){
+ item = tree.getItem(i);
+ seamPackage = findSeamPackage(item, name);
+ if(seamPackage != null) return seamPackage;
+ }
+
+ return null;
+ }
+
+ public void waitForJobs() {
+ while (!Job.getJobManager().isIdle())
+ delay(5000);
+ System.out.println("---------------------------------continue----------------------------");
+ }
+
+ /** * Process UI input but do not return for the
+ * specified time interval. *
+ * @param waitTimeMillis the number of milliseconds */
+ protected void delay(long waitTimeMillis) {
+ Display display = Display.getCurrent();
+ // If this is the UI thread,
+ // then process input.
+ if (display != null) {
+ long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
+ while (System.currentTimeMillis() < endTimeMillis){
+ if (!display.readAndDispatch()) display.sleep();
+ } display.update();
+ }
+ // Otherwise, perform a simple sleep.
+ else {
+ try {
+ Thread.sleep(waitTimeMillis);
+ } catch (InterruptedException e) {
+ // Ignored.
+ }
+ }
+ }
+
+ private void refreshProject(IProject project){
+ try {
+ System.out.println("------------------------------brfore refresh");
+ project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ System.out.println("------------------------------abter refresh");
+ } catch (CoreException e) {
+ JUnitUtils.fail(e.getMessage(),e);
+ }
+ System.out.println("------------------------------before waitForJobs");
+ waitForJobs();
+ System.out.println("------------------------------abter waitForJobs");
+ }
+
+ public static void waitForJob() {
+ Object[] o = {
+ XJob.FAMILY_XJOB, ResourcesPlugin.FAMILY_AUTO_REFRESH, ResourcesPlugin.FAMILY_AUTO_BUILD
+ };
+ while(true) {
+ boolean stop = true;
+ for (int i = 0; i < o.length; i++) {
+ Job[] js = Job.getJobManager().find(o[i]);
+ if(js != null && js.length > 0) {
+ System.out.print(js[0].getName());
+ try {
+ Job.getJobManager().join(o[i], new NullProgressMonitor());
+ } catch (OperationCanceledException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ stop = false;
+ }
+ }
+ if(stop) {
+ Job running = getJobRunning(10);
+ if(running != null) {
+ try {
+ running.join();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ stop = false;
+ }
+ }
+ if(stop) break;
+ }
+ }
+
+ public static Job getJobRunning(int iterationLimit) {
+ Job[] js = Job.getJobManager().find(null);
+ Job dm = null;
+ if(js != null) for (int i = 0; i < js.length; i++) {
+ if(js[i].getState() == Job.RUNNING && js[i].getThread() != Thread.currentThread()) {
+ if(js[i] instanceof UIJob) continue;
+ if(js[i].belongsTo(DecoratorManager.FAMILY_DECORATE) || js[i].getName().equals("Task List Saver")) {
+ dm = js[i];
+ continue;
+ }
+ //TODO keep watching
+ System.out.println(js[i].getName());
+ return js[i];
+ }
+ }
+ if(dm != null) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ //ignore
+ }
+ if(iterationLimit > 0)
+ return getJobRunning(iterationLimit - 1);
+ }
+ return null;
+ }
+
+ /**
+ *
+ */
+ private void updateView() {
+ viewer.refresh();
+ viewer.expandAll();
+ Object[] array = viewer.getExpandedElements();
+ for (Object object : array) {
+ System.out.println(object.toString());
+ }
+ }
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest1.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
18 years, 2 months