JBoss Tools SVN: r12630 - in trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common: figure and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-12-16 19:25:15 -0500 (Tue, 16 Dec 2008)
New Revision: 12630
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/ConnectionEditPart.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/RoundedRectangleElementFigure.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/registry/ElementRegistry.java
Log:
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/ConnectionEditPart.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/ConnectionEditPart.java 2008-12-16 18:07:05 UTC (rev 12629)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/ConnectionEditPart.java 2008-12-17 00:25:15 UTC (rev 12630)
@@ -21,6 +21,7 @@
import org.eclipse.draw2d.AbsoluteBendpoint;
import org.eclipse.draw2d.BendpointConnectionRouter;
+import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.PolygonDecoration;
import org.eclipse.draw2d.PolylineConnection;
@@ -68,6 +69,7 @@
protected IFigure createFigure() {
PolylineConnection result = new PolylineConnection();
+ result.setForegroundColor(ColorConstants.gray);
result.setConnectionRouter(new BendpointConnectionRouter());
result.setTargetDecoration(new PolygonDecoration());
return result;
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/RoundedRectangleElementFigure.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/RoundedRectangleElementFigure.java 2008-12-16 18:07:05 UTC (rev 12629)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/RoundedRectangleElementFigure.java 2008-12-17 00:25:15 UTC (rev 12630)
@@ -23,15 +23,14 @@
public class RoundedRectangleElementFigure extends AbstractElementFigure {
- private RoundedRectangle rectangle;
+ protected RoundedRectangle rectangle;
protected void customizeFigure() {
rectangle = new RoundedRectangle();
rectangle.setCornerDimensions(new Dimension(25, 25));
add(rectangle, 0);
- rectangle.setBounds(getBounds());
+ setSize(92, 52);
setSelected(false);
- setSize(80, 40);
}
public void setColor(Color color) {
@@ -40,7 +39,8 @@
public void setBounds(Rectangle rectangle) {
super.setBounds(rectangle);
- this.rectangle.setBounds(rectangle);
+ Rectangle bounds = rectangle.getCopy();
+ this.rectangle.setBounds(bounds.translate(6, 6).resize(-12, -12));
}
public void setSelected(boolean b) {
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/registry/ElementRegistry.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/registry/ElementRegistry.java 2008-12-16 18:07:05 UTC (rev 12629)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/registry/ElementRegistry.java 2008-12-17 00:25:15 UTC (rev 12630)
@@ -210,12 +210,17 @@
} else if ("node".equals(type)) {
return createNodeEditPart(configurationElement);
} else if ("connection".equals(type)) {
- return new ConnectionEditPart();
+ return createConnectionEditPart(configurationElement);
} else {
return null;
}
}
+ private static EditPart createConnectionEditPart(final IConfigurationElement configurationElement) {
+ return new ConnectionEditPart() {
+ };
+ }
+
private static EditPart createNodeEditPart(final IConfigurationElement configurationElement) {
return new ElementEditPart() {
protected IFigure createFigure() {
17 years, 4 months
JBoss Tools SVN: r12629 - trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2008-12-16 13:07:05 -0500 (Tue, 16 Dec 2008)
New Revision: 12629
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java
Log:
JBIDE-3199 - small bugfix
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java 2008-12-16 18:04:09 UTC (rev 12628)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java 2008-12-16 18:07:05 UTC (rev 12629)
@@ -346,8 +346,7 @@
// this is candidate for primary id
Iterator itVarNames = list.iterator();
while (itVarNames.hasNext()) {
- VariableDeclarationFragment var = (VariableDeclarationFragment)itVarNames.next();
- String name = var.getName().getIdentifier();
+ String name = (String)itVarNames.next();
entityInfo.addPrimaryIdCandidate(name);
}
}
17 years, 4 months
JBoss Tools SVN: r12628 - trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-12-16 13:04:09 -0500 (Tue, 16 Dec 2008)
New Revision: 12628
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3409
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java 2008-12-16 17:30:32 UTC (rev 12627)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java 2008-12-16 18:04:09 UTC (rev 12628)
@@ -13,10 +13,13 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import org.eclipse.draw2d.ArrowLocator;
import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.ConnectionLocator;
import org.eclipse.draw2d.FreeformViewport;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.PolygonDecoration;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
@@ -56,6 +59,7 @@
PagesEditor.class, "icons/shortcut.gif").createImage();
private static final Font pathFont = SeamPagesPreference.getFont(SeamPagesPreference.LINK_PATH_FONT.getValue(), null);
+
AccessibleEditPart acc;
@@ -118,12 +122,19 @@
new LinkEndpointEditPolicy());
installEditPolicy(EditPolicy.CONNECTION_ROLE, new LinkEditPolicy());
}
+
+ PolygonDecoration arrow;
protected IFigure createFigure() {
if (getLink() == null)
return null;
ConnectionFigure conn = FigureFactory.createNewBendableWire(this,
getLink());
+ arrow = (PolygonDecoration)conn.getChildren().get(0);
+
+ if (getLink().isShortcut())
+ conn.remove(arrow);
+
PointList list = getLink().getPointList();
if (list.size() > 0) {
conn.setManual(true);
@@ -299,9 +310,11 @@
if (shortcut) {
getLinkFigure().add(shortcutLabel, shortcutLocator);
getLinkFigure().remove(pathLabel);
+ getLinkFigure().remove(arrow);
} else {
getLinkFigure().remove(shortcutLabel);
getLinkFigure().add(pathLabel, pathLocator);
+ getLinkFigure().add(arrow, new ArrowLocator(getLinkFigure(), ConnectionLocator.TARGET));
}
refresh();
}
17 years, 4 months
JBoss Tools SVN: r12627 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test: resources/jsfTest/WebContent/pages/JBIDE/3396 and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-12-16 12:30:32 -0500 (Tue, 16 Dec 2008)
New Revision: 12627
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3396/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3396/first.jsp
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3396/second.jsp
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3396Test.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3396, junit test
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3396/first.jsp
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3396/first.jsp (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3396/first.jsp 2008-12-16 17:30:32 UTC (rev 12627)
@@ -0,0 +1,90 @@
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
+<f:loadBundle basename="dataTable.columns.messages" var="msg"/>
+<html>
+ <head>
+ <title>Scrollable Data Tabel</title>
+ <link rel="stylesheet" href="${request.contextPath}pages/scrollableDataTable/main.css"/>
+ <style type="text/css">
+
+ body{
+ font: normal 11px tahoma, sans-serif;
+ }
+
+ .column{
+ width:75px;
+ font: normal 11px tahoma, sans-serif;
+ text-align:center;
+ }
+
+ .column-index{
+ width:75px;
+ font: normal 11px tahoma, sans-serif;
+ text-align:left;
+ }
+
+ .list-row3{
+ background-color:#ececec;
+ }
+
+ .list-row1{
+ background-color:#f1f6fd;
+ }
+
+ .list-row2{
+ background-color:#fff;
+ }
+
+ .list-header{
+ font: bold 11px tahoma, sans-serif;
+ text-align:center;
+ }
+
+ .list-table1{
+ border:1px solid #bed6f8;
+ }
+
+ .list-table2{
+ border:1px solid #bed6f8;
+ }
+ </style>
+ </head>
+ <body style="#{table.style}">
+ <f:view>
+ <rich:scrollableDataTable id="table1" value="#{bookList.bookList}"
+ var="book" width="267" height="181"
+ selectedClass="evenRow" rows="3"
+ rowClasses="evenRow, oddRow"
+ style="#{bookList.stylesForTable}">
+ <f:facet name="header">
+ <h:outputText value="#{msg.pageTitle}"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText value="#{msg.titleColumnName}"/>
+ </f:facet>
+ <rich:column sortBy="#{book.price}" id="col2">
+ <f:facet name="header">
+ <h:outputText value="#{msg.priceColumnName}"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText value="#{msg.priceColumnName}"/>
+ </f:facet>
+ <h:outputText value="#{requestbean}"/>
+ </rich:column>
+ <rich:column id="col3" sortBy="#{book.numOfCopies}" visible="true">
+ <f:facet name="footer">
+ <h:outputText value="#{msg.titleColumnName}"/>
+ </f:facet>
+ <f:facet name="header">
+ <h:outputText value="#{msg.titleColumnName}"/>
+ </f:facet>
+ <h:outputText value="#{book.numOfCopies}"/>
+ </rich:column>
+ </rich:scrollableDataTable>
+ <rich:calendar style="#{bookList.stylesForTable}">
+
+ </rich:calendar>
+ </f:view>
+ </body>
+</html>
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3396/second.jsp
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3396/second.jsp (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3396/second.jsp 2008-12-16 17:30:32 UTC (rev 12627)
@@ -0,0 +1,221 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
+<f:loadBundle basename="dataFilterSlider.messages" var="msg"/>
+<html>
+ <head>
+ <title></title>
+ <link rel="stylesheet" href="/pages/dataTableAndColumns/main.css"/>
+ <style type="text/css">
+
+ body{
+ font: normal 11px tahoma, sans-serif;
+ }
+
+ .column{
+ width:75px;
+ font: normal 11px tahoma, sans-serif;
+ text-align:center;
+ }
+
+ .column-index{
+ width:75px;
+ font: normal 11px tahoma, sans-serif;
+ text-align:left;
+ }
+
+ .list-row3{
+ background-color:#ececec;
+ }
+
+ .list-row1{
+ background-color:#f1f6fd;
+ }
+
+ .list-row2{
+ background-color:#fff;
+ }
+
+ .list-header{
+ font: bold 11px tahoma, sans-serif;
+ text-align:center;
+ }
+
+ .list-table1{
+ border:1px solid #bed6f8;
+ }
+
+ .list-table2{
+ border:1px solid #bed6f8;
+ }
+
+
+
+ </style>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+<!-- rich:columns realization -->
+ <rich:dataTable id="trust" value="#{bookList.bookList}" var="book" border="10" bgcolor="red" style="#{table.style}">
+ <f:facet name="header">
+ <h:outputText value="#{msg.pageTitle}"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText value="#{msg.titleColumnName}"/>
+ </f:facet>
+ <rich:subTable value="#{bookList.bookList}" var="book">
+ <rich:column sortBy="#{book.price}" id="col2" style="#{table.style}">
+ <f:facet name="header">
+ <h:outputText value="#{msg.priceColumnName}"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText value="#{msg.priceColumnName}"/>
+ </f:facet>
+ <h:outputText value="#{book.price}"/>
+ </rich:column>
+ <rich:column id="col3" sortBy="#{book.numOfCopies}" visible="true">
+ <f:facet name="footer">
+ <h:outputText value="#{msg.titleColumnName}"/>
+ </f:facet>
+ <f:facet name="header">
+ <h:outputText value="#{msg.titleColumnName}"/>
+ </f:facet>
+ <h:outputText value="#{book.numOfCopies}"/>
+ </rich:column>
+
+ </rich:subTable>
+
+ </rich:dataTable>
+<!-- end realisation -->
+ <rich:dataTable id="table1" value="#{bookList.bookList}" var="book" style="#{bookList.stylesForTable}"
+ columnClasses="evenRow, oddRow" sortMode="multi" >
+ <f:facet name="header">
+ <h:outputText value="#{msg.pageTitle}"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText value="#{msg.priceColumnName}"/>
+ </f:facet>
+ <rich:column sortBy="#{book.price}" id="col2">
+ <f:facet name="header">
+ <h:outputText value="#{msg.priceColumnName}"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText value="#{msg.priceColumnName}"/>
+ </f:facet>
+ <h:outputText value="#{book.price}"/>
+ </rich:column>
+ <rich:column id="col3" sortBy="#{book.numOfCopies}" visible="false">
+ <f:facet name="footer">
+ <h:outputText value="#{msg.titleColumnName}"/>
+ </f:facet>
+ <f:facet name="header">
+ <h:outputText value="#{msg.titleColumnName}"/>
+ </f:facet>
+ <h:outputText value="#{book.numOfCopies}"/>
+ </rich:column>
+ <rich:column sortBy="#{book.price}" id="col4">
+ <f:facet name="header">
+ <h:outputText value="#{msg.priceColumnName}"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText value="#{msg.priceColumnName}"/>
+ </f:facet>
+ <h:outputText value="#{book.price}"/>
+ </rich:column>
+ <rich:column id="col5" sortBy="#{book.numOfCopies}" visible="false">
+ <f:facet name="footer">
+ <h:outputText value="#{msg.titleColumnName}"/>
+ </f:facet>
+ <f:facet name="header">
+ <h:outputText value="#{msg.titleColumnName}"/>
+ </f:facet>
+ <h:outputText value="#{book.numOfCopies}"/>
+ </rich:column>
+ </rich:dataTable>
+ </h:form>
+ <h:form>
+ <rich:dataTable id="trust" value="#{bookList.bookList}" var="col" border="10" bgcolor="red" style="float:left;height : 146px; width : 150px;">
+ <f:facet name="header">
+ <h:outputText value="#{msg.pageTitle}"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText value="#{msg.titleColumnName}"/>
+ </f:facet>
+
+ </rich:dataTable>
+ </h:form>
+<h:form>
+<rich:dataTable value="#{bookList.bookList}" var="cap" rows="5" footerClass="evenRow" headerClass="oddRow" style="#{table.style}">
+ <f:facet name="header">
+ <rich:columnGroup styleClass="btn">
+ <rich:column rowspan="2">
+ <h:outputText value="State Flag"/>
+ </rich:column>
+ <rich:column colspan="3">
+ <h:outputText value="State Info"/>
+ </rich:column>
+ <rich:column breakBefore="true">
+ <h:outputText value="State Name"/>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="State Capital"/>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="Time Zone"/>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+ <f:facet name="footer"><h:outputText value="This is footer part" /> </f:facet>
+ <rich:column colspan="4">
+ <f:facet name="header">
+ <h:outputText value="Flags"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText value="Countries"/>
+ </f:facet>
+ <h:outputText value="Begin" />
+ </rich:column>
+ <rich:columnGroup style="" columnClasses="">
+ <rich:column>
+ <f:facet name="footer"><h:outputText value="Unvisible footer" /> </f:facet>
+ <f:facet name="header"><h:outputText value="Unvisible header" /> </f:facet>
+ <h:outputText value="#{cap.name}"/>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{cap.price}"/>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{cap.numOfCopies}"/>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{cap.numOfCopies}"/>
+ </rich:column>
+ </rich:columnGroup>
+</rich:dataTable>
+</h:form>
+
+<h:form>
+ <h:dataTable border="2" columnClasses="evenRow, oddRow" value="#{bookList.bookList}" var="book">
+
+ <h:column footerClass="oddRow" headerClass="btn">
+ <f:facet name="header"><h:outputText value="Header"/> </f:facet>
+ <f:facet name="footer"><h:outputText value="Footer"/> </f:facet>
+ <h:outputText value="#{book.name}"/>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{book.price}"/>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{book.numOfCopies}" />
+ </h:column>
+ </h:dataTable>
+ <rich:calendar buttonIcon="/pages/dataTableAndColumns/images/img12.gif"></rich:calendar>
+</h:form>
+ </f:view>
+ <div>
+ ${bookList.message}
+ </div>
+ </body>
+</html>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-12-16 17:10:29 UTC (rev 12626)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-12-16 17:30:32 UTC (rev 12627)
@@ -45,6 +45,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3144Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3163Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3376Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3396Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE675Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE788Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE924Test;
@@ -115,6 +116,7 @@
suite.addTestSuite(JBIDE2354Test.class);
suite.addTestSuite(JBIDE3163Test.class);
suite.addTestSuite(JBIDE3376Test.class);
+ suite.addTestSuite(JBIDE3396Test.class);
// $JUnit-END$
// added by Max Areshkau
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3396Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3396Test.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3396Test.java 2008-12-16 17:30:32 UTC (rev 12627)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * 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.jsf.vpe.jsf.test.jbide;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.common.el.core.ELReferenceList;
+import org.jboss.tools.common.resref.core.ResourceReference;
+import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+
+/**
+ * @author Max Areshkau
+ *
+ */
+public class JBIDE3396Test extends VpeTest{
+
+ private IFile firstPage;
+ private IFile secondPage;
+ private ResourceReference[] firstElValues;
+ private ResourceReference[] secondElValues;
+
+ public JBIDE3396Test(final String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ setException(null);
+ this.firstPage = (IFile) TestUtil.getComponentPath("JBIDE/3396/first.jsp", //$NON-NLS-1$
+ JsfAllTests.IMPORT_PROJECT_NAME);
+ this.secondPage = (IFile) TestUtil.getComponentPath("JBIDE/3396/second.jsp", //$NON-NLS-1$
+ JsfAllTests.IMPORT_PROJECT_NAME);
+
+ this.firstElValues = new ResourceReference[1];
+ this.firstElValues[0] = new ResourceReference("table.style",ResourceReference.PROJECT_SCOPE); //$NON-NLS-1$
+ this.firstElValues[0].setProperties("color:red;"); //$NON-NLS-1$
+
+ this.secondElValues = new ResourceReference[1];
+ this.secondElValues[0] = new ResourceReference("book.style", ResourceReference.PROJECT_SCOPE); //$NON-NLS-1$
+ this.secondElValues[0].setProperties("color:green;"); //$NON-NLS-1$
+
+
+// ELReferenceList.getInstance().setAllResources(this.file,entries);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.vpe.ui.test.VpeTest#tearDown()
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ ELReferenceList.getInstance().setAllResources(this.firstPage, new ResourceReference[0]);
+ ELReferenceList.getInstance().setAllResources(this.secondPage, new ResourceReference[0]);
+ if(getException()!=null) {
+ throw new Exception(getException());
+ }
+ super.tearDown();
+ }
+
+ public void testJBIDE3396() throws Exception{
+ //open first page and set resources
+ final IEditorInput firstInput = new FileEditorInput(this.firstPage);
+ final JSPMultiPageEditor firstEditorPart = openEditor(firstInput);
+ //wait while editor will be initialized
+ TestUtil.getVpeController(firstEditorPart);
+ ELReferenceList.getInstance().setAllResources(this.firstPage, this.firstElValues);
+ //wait for visual refresh
+ TestUtil.delay(1000);
+ TestUtil.waitForJobs();
+ //open second page and
+ final IEditorInput secondInput = new FileEditorInput(this.secondPage);
+ final JSPMultiPageEditor secondEditorPart = openEditor(secondInput);
+ final VpeController secondPageVpeController = TestUtil.getVpeController(secondEditorPart);
+ final int size = secondPageVpeController.getDomMapping().getVisualMap().size();
+ TestUtil.delay(5000);
+ ELReferenceList.getInstance().setAllResources(this.secondPage, this.secondElValues);
+ //wait for visual refresh
+ TestUtil.delay(5000);
+ final ResourceReference[] elResoReferences = ELReferenceList.getInstance().getAllResources(this.secondPage);
+ for (final ResourceReference resourceReference : elResoReferences) {
+ resourceReference.setProperties(resourceReference.getProperties()+'T');
+ }
+ ELReferenceList.getInstance().setAllResources(this.secondPage, elResoReferences);
+ TestUtil.waitForJobs();
+ assertEquals("Size of map before and after appling should be equal",size, secondPageVpeController.getDomMapping().getVisualMap().size()); //$NON-NLS-1$
+ }
+
+}
17 years, 4 months
JBoss Tools SVN: r12626 - in trunk/seam/plugins: org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-12-16 12:10:29 -0500 (Tue, 16 Dec 2008)
New Revision: 12626
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesPreference.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/ExceptionEditPart.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PageEditPart.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesDiagramEditPart.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ExceptionFigure.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/NodeFigure.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3409
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesPreference.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesPreference.java 2008-12-16 15:52:21 UTC (rev 12625)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesPreference.java 2008-12-16 17:10:29 UTC (rev 12626)
@@ -1,5 +1,6 @@
package org.jboss.tools.seam.pages.xml.model;
+import org.eclipse.swt.graphics.Font;
import org.jboss.tools.common.model.options.Preference;
import org.jboss.tools.jst.web.WebPreference;
@@ -11,9 +12,53 @@
public static final Preference SHOW_SHORTCUT_PATH = new SeamPagesPreference(SEAM_PAGES_EDITOR_PATH, "showShortcutPath");
public static final Preference SHOW_GRID = new SeamPagesPreference(SEAM_PAGES_EDITOR_PATH, "Show Grid");
public static final Preference GRID_STEP = new SeamPagesPreference(SEAM_PAGES_EDITOR_PATH, "Grid Step");
+ public static final Preference LINK_PATH_FONT = new SeamPagesPreference(SEAM_PAGES_EDITOR_PATH, "Link Path Font");
+ public static final Preference VIEW_PATH_FONT = new SeamPagesPreference(SEAM_PAGES_EDITOR_PATH, "View Path Font");
protected SeamPagesPreference(String optionPath, String attributeName) {
super(optionPath, attributeName);
}
+
+ public static Font getFont(String preferenceValue, Font font) {
+ String name;
+ int size = 8, style = 1;
+ int pos, pos2, pos3;
+ pos = preferenceValue.indexOf(",");
+ if (pos < 0)
+ name = preferenceValue;
+ else {
+ name = preferenceValue.substring(0, pos);
+ pos2 = preferenceValue.indexOf("size=");
+ if (pos2 >= 0) {
+ pos3 = preferenceValue.indexOf(",", pos2);
+ if (pos3 < 0)
+ size = Integer.parseInt(preferenceValue
+ .substring(pos2 + 5, preferenceValue.length()));
+ else
+ size = Integer.parseInt(preferenceValue.substring(pos2 + 5, pos3));
+ }
+ pos2 = preferenceValue.indexOf("style=");
+ if (pos2 >= 0) {
+ pos3 = preferenceValue.indexOf(",", pos2);
+ if (pos3 < 0)
+ style = Integer.parseInt(preferenceValue.substring(pos2 + 6, preferenceValue
+ .length()));
+ else
+ style = Integer.parseInt(preferenceValue.substring(pos2 + 6, pos3));
+ }
+ }
+
+ if (font == null) {
+ font = new Font(null, name, size, style);
+ } else {
+ if (!font.getFontData()[0].getName().equals(name)
+ || font.getFontData()[0].getHeight() != size
+ || font.getFontData()[0].getStyle() != style) {
+ font = new Font(null, name, size, style);
+ }
+ }
+
+ return font;
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesEditor.java 2008-12-16 15:52:21 UTC (rev 12625)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesEditor.java 2008-12-16 17:10:29 UTC (rev 12626)
@@ -91,7 +91,11 @@
import org.jboss.tools.common.gef.outline.xpl.DiagramContentOutlinePage;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.XModelTransferBuffer;
+import org.jboss.tools.common.model.event.XModelTreeEvent;
+import org.jboss.tools.common.model.event.XModelTreeListener;
+import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.jst.web.model.ReferenceObject;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesPreference;
import org.jboss.tools.seam.pages.xml.model.handlers.SelectOnDiagramHandler;
import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesDiagramStructureHelper;
import org.jboss.tools.seam.ui.pages.SeamUIPagesMessages;
@@ -114,7 +118,7 @@
import org.jboss.tools.seam.ui.pages.editor.figures.NodeFigure;
import org.jboss.tools.seam.ui.pages.editor.palette.PagesPaletteViewerPreferences;
-public class PagesEditor extends GEFEditor implements PagesModelListener{
+public class PagesEditor extends GEFEditor implements PagesModelListener, XModelTreeListener{
protected void createPaletteViewer(Composite parent) {
PaletteViewer viewer = new PaletteViewer();
@@ -291,7 +295,7 @@
}
public void dispose() {
- //model.removeModelListener(this);
+ PreferenceModelUtilities.getPreferenceModel().removeModelTreeListener(this);
super.dispose();
}
@@ -521,12 +525,11 @@
public void setInput(XModelObject input) {
}
- static private boolean switchToSelectionTool = false;
+ static private boolean switchToSelectionTool = SeamPagesPreference.ENABLE_CONTROL_MODE_ON_TRANSITION_COMPLETED.getValue().equals("yes");
public void setPagesModel(PagesModel diagram) {
model = diagram;
- //model.addModelListener(this);
- //switchToSelectionTool = model.getOptions().switchToSelectionTool();
+ PreferenceModelUtilities.getPreferenceModel().addModelTreeListener(this);
}
private void setSavePreviouslyNeeded(boolean value) {
@@ -644,14 +647,16 @@
protected void hookGraphicalViewer() {
getSelectionSynchronizer().addViewer(getGraphicalViewer());
}
-
-
-// public void processChanged(boolean flag) {
-// if (switchToSelectionTool != model.getOptions().switchToSelectionTool()) {
-// switchToSelectionTool = model.getOptions().switchToSelectionTool();
-// connectionCreationTool.setUnloadWhenFinished(switchToSelectionTool);
-// }
-// }
-
+ public void nodeChanged(XModelTreeEvent event){
+ String path = event.getModelObject().getPath();
+ if(path.equals(SeamPagesPreference.SEAM_PAGES_EDITOR_PATH)){
+ switchToSelectionTool = SeamPagesPreference.ENABLE_CONTROL_MODE_ON_TRANSITION_COMPLETED.getValue().equals("yes");
+ connectionCreationTool.setUnloadWhenFinished(switchToSelectionTool);
+ }
+ }
+
+ public void structureChanged(XModelTreeEvent event){
+
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/ExceptionEditPart.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/ExceptionEditPart.java 2008-12-16 15:52:21 UTC (rev 12625)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/ExceptionEditPart.java 2008-12-16 17:10:29 UTC (rev 12626)
@@ -33,13 +33,18 @@
import org.eclipse.gef.requests.DropRequest;
import org.eclipse.swt.accessibility.AccessibleControlEvent;
import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.jboss.tools.common.model.event.XModelTreeEvent;
+import org.jboss.tools.common.model.event.XModelTreeListener;
+import org.jboss.tools.common.model.options.PreferenceModelUtilities;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesPreference;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PageException;
import org.jboss.tools.seam.ui.pages.editor.figures.ExceptionFigure;
import org.jboss.tools.seam.ui.pages.editor.figures.NodeFigure;
import org.jboss.tools.seam.ui.pages.editor.figures.xpl.CompressNameUtil;
-public class ExceptionEditPart extends PagesEditPart implements PropertyChangeListener, EditPartListener, Adapter {
+public class ExceptionEditPart extends PagesEditPart implements PropertyChangeListener, EditPartListener,
+Adapter, XModelTreeListener {
private NodeFigure fig = null;
private boolean single = true;
@@ -129,6 +134,18 @@
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE,
new ViewIDDirectEditPolicy());
}
+
+ public void nodeChanged(XModelTreeEvent event){
+ String path = event.getModelObject().getPath();
+ if(path.equals(SeamPagesPreference.SEAM_PAGES_EDITOR_PATH)){
+ NodeFigure.nodeLabelFont = SeamPagesPreference.getFont(SeamPagesPreference.VIEW_PATH_FONT.getValue(), NodeFigure.nodeLabelFont);
+ refreshVisuals();
+ }
+ }
+
+ public void structureChanged(XModelTreeEvent event){
+
+ }
/**
* Returns a newly created Figure to represent this.
@@ -241,6 +258,7 @@
if (isActive())
return;
((Notifier) getModel()).eAdapters().add(this);
+ PreferenceModelUtilities.getPreferenceModel().addModelTreeListener(this);
super.activate();
if("<initialize>".equals(getExceptionModel().getName())){
getExceptionModel().setName("");
@@ -254,6 +272,7 @@
if (!isActive())
return;
((Notifier) getModel()).eAdapters().remove(this);
+ PreferenceModelUtilities.getPreferenceModel().removeModelTreeListener(this);
super.deactivate();
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java 2008-12-16 15:52:21 UTC (rev 12625)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java 2008-12-16 17:10:29 UTC (rev 12626)
@@ -30,7 +30,6 @@
import org.eclipse.gef.editparts.AbstractConnectionEditPart;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
@@ -38,7 +37,11 @@
import org.jboss.tools.common.gef.figures.GEFLabel;
import org.jboss.tools.common.gef.figures.xpl.CustomLocator;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.event.XModelTreeEvent;
+import org.jboss.tools.common.model.event.XModelTreeListener;
+import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.util.XModelUtil;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesPreference;
import org.jboss.tools.seam.ui.pages.editor.PagesEditor;
import org.jboss.tools.seam.ui.pages.editor.PagesEditor.ModelSelectionProvider;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
@@ -48,11 +51,11 @@
import org.jboss.tools.seam.ui.pages.editor.figures.FigureFactory;
public class LinkEditPart extends AbstractConnectionEditPart implements
- PropertyChangeListener, EditPartListener {
+ PropertyChangeListener, EditPartListener, XModelTreeListener {
private static final Image icon = ImageDescriptor.createFromFile(
PagesEditor.class, "icons/shortcut.gif").createImage();
- private static final Font pathFont = new Font(null, "default", 8, SWT.NONE);
+ private static final Font pathFont = SeamPagesPreference.getFont(SeamPagesPreference.LINK_PATH_FONT.getValue(), null);
AccessibleEditPart acc;
@@ -73,13 +76,22 @@
public void setEditor(PagesEditor editor){
this.editor = editor;
}
+
+ private boolean showShortcutPath(){
+ return SeamPagesPreference.SHOW_SHORTCUT_PATH.getValue().equals("yes");
+ }
+ private boolean showShortcutIcon(){
+ return SeamPagesPreference.SHOW_SHORTCUT_ICON.getValue().equals("yes");
+ }
+
public void activate() {
if (!isActive()) {
((Notifier) getModel()).eAdapters().add(adapter);
}
super.activate();
addEditPartListener(this);
+ PreferenceModelUtilities.getPreferenceModel().addModelTreeListener(this);
Page page=null;
if(getLinkModel().getFromElement() instanceof Page)
page = (Page)getLinkModel().getFromElement();
@@ -133,15 +145,14 @@
conn.add(pathLabel, pathLocator);
String text = "";
-// if (getLink().getJSFModel().getOptions().showShortcutPath())
+ if (showShortcutPath())
if(getLink().getToElement() != null)
text = getLink().getToElement().getName();
shortcutLabel = new GEFLabel(text, FigureFactory.normalColor);
-// if (getLink().getJSFModel().getOptions().showShortcutIcon())
+ if (showShortcutIcon())
shortcutLabel.setIcon(icon);
-// shortcutLabel.setFont(getLink().getJSFModel().getOptions()
-// .getLinkPathFont());
+ shortcutLabel.setFont(pathFont);
shortcutLabel.setTextAlignment(Label.LEFT);
shortcutLabel.setLabelAlignment(Label.LEFT);
shortcutLabel.setIconAlignment(Label.LEFT);
@@ -172,12 +183,23 @@
if(pagePart != null)
pagePart.removeEditPartListener(this);
removeEditPartListener(this);
- //getLink().removePropertyChangeListener(this);
+ PreferenceModelUtilities.getPreferenceModel().removeModelTreeListener(this);
if (isActive()) {
((Notifier) getModel()).eAdapters().remove(this);
}
super.deactivate();
}
+
+ public void nodeChanged(XModelTreeEvent event){
+ String path = event.getModelObject().getPath();
+ if(path.equals(SeamPagesPreference.SEAM_PAGES_EDITOR_PATH)){
+ linkChange(getLink());
+ }
+ }
+
+ public void structureChanged(XModelTreeEvent event){
+
+ }
public void deactivateFigure() {
getFigure().removePropertyChangeListener(
@@ -254,16 +276,22 @@
}
public void linkChange(Link source) {
+ pathLabel.setFont(SeamPagesPreference.getFont(SeamPagesPreference.LINK_PATH_FONT.getValue(), pathFont));
pathLabel.setText(getLink().getName());
-// if (getLinkModel().getJSFModel().getOptions().showShortcutPath())
- if(getLink().getToElement() != null)
- shortcutLabel.setText(getLink().getToElement().getName());
- else
+
+ if (showShortcutPath()){
+ shortcutLabel.setFont(SeamPagesPreference.getFont(SeamPagesPreference.LINK_PATH_FONT.getValue(), pathFont));
+ if(getLink().getToElement() != null)
+ shortcutLabel.setText(getLink().getToElement().getName());
+ else
+ shortcutLabel.setText("");
+ }else
shortcutLabel.setText("");
-// if (getLinkModel().getJSFModel().getOptions().showShortcutIcon())
+
+ if (showShortcutIcon())
shortcutLabel.setIcon(icon);
-// else
-// shortcutLabel.setIcon(null);
+ else
+ shortcutLabel.setIcon(null);
getLinkFigure().refreshFont();
if (shortcut != getLink().isShortcut()) {
@@ -277,9 +305,6 @@
}
refresh();
}
-
-
-
}
public void childAdded(EditPart child, int index) {
@@ -331,7 +356,7 @@
refreshVisuals();
((ConnectionFigure)figure).layout();
}
-
+
/**
* )
*
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PageEditPart.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PageEditPart.java 2008-12-16 15:52:21 UTC (rev 12625)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PageEditPart.java 2008-12-16 17:10:29 UTC (rev 12626)
@@ -40,7 +40,11 @@
import org.jboss.tools.common.meta.action.XAction;
import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.event.XModelTreeEvent;
+import org.jboss.tools.common.model.event.XModelTreeListener;
+import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.ui.dnd.DnDUtil;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesPreference;
import org.jboss.tools.seam.ui.pages.SeamUiPagesPlugin;
import org.jboss.tools.seam.ui.pages.editor.PagesEditor;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
@@ -49,7 +53,7 @@
import org.jboss.tools.seam.ui.pages.editor.figures.PageFigure;
public class PageEditPart extends PagesEditPart implements
- PropertyChangeListener, EditPartListener, Adapter {
+ PropertyChangeListener, EditPartListener, Adapter, XModelTreeListener {
private PageFigure fig = null;
PagesEditor editor;
@@ -98,6 +102,18 @@
}
}
+
+ public void nodeChanged(XModelTreeEvent event){
+ String path = event.getModelObject().getPath();
+ if(path.equals(SeamPagesPreference.SEAM_PAGES_EDITOR_PATH)){
+ NodeFigure.nodeLabelFont = SeamPagesPreference.getFont(SeamPagesPreference.VIEW_PATH_FONT.getValue(), NodeFigure.nodeLabelFont);
+ refreshVisuals();
+ }
+ }
+
+ public void structureChanged(XModelTreeEvent event){
+
+ }
public boolean isGroupListenerEnable() {
return true;
@@ -278,6 +294,7 @@
if (isActive())
return;
((Notifier) getModel()).eAdapters().add(this);
+ PreferenceModelUtilities.getPreferenceModel().addModelTreeListener(this);
super.activate();
if("<initialize>".equals(getPageModel().getName())){
getPageModel().setName("");
@@ -291,6 +308,7 @@
if (!isActive())
return;
((Notifier) getModel()).eAdapters().remove(this);
+ PreferenceModelUtilities.getPreferenceModel().removeModelTreeListener(this);
super.deactivate();
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesDiagramEditPart.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesDiagramEditPart.java 2008-12-16 15:52:21 UTC (rev 12625)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesDiagramEditPart.java 2008-12-16 17:10:29 UTC (rev 12626)
@@ -35,14 +35,11 @@
import org.eclipse.gef.rulers.RulerProvider;
import org.eclipse.gef.tools.DeselectAllTracker;
import org.eclipse.gef.tools.MarqueeDragTracker;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.jboss.tools.common.model.event.XModelTreeEvent;
import org.jboss.tools.common.model.event.XModelTreeListener;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.seam.pages.xml.model.SeamPagesPreference;
-import org.jboss.tools.seam.ui.pages.SeamUiPagesPlugin;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Page;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesModel;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesModelListener;
@@ -78,7 +75,6 @@
*/
public void setModel(Object model) {
super.setModel(model);
- PreferenceModelUtilities.getPreferenceModel().addModelTreeListener(this);
}
/**
@@ -286,6 +282,7 @@
if (isActive())
return;
((Notifier) getModel()).eAdapters().add(this);
+ PreferenceModelUtilities.getPreferenceModel().addModelTreeListener(this);
super.activate();
}
@@ -293,6 +290,7 @@
if (!isActive())
return;
((Notifier) getModel()).eAdapters().remove(this);
+ PreferenceModelUtilities.getPreferenceModel().removeModelTreeListener(this);
super.deactivate();
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ExceptionFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ExceptionFigure.java 2008-12-16 15:52:21 UTC (rev 12625)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ExceptionFigure.java 2008-12-16 17:10:29 UTC (rev 12626)
@@ -24,6 +24,7 @@
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.common.gef.GEFGraphicalViewer;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesPreference;
import org.jboss.tools.seam.ui.pages.editor.PagesEditor;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PageException;
import org.jboss.tools.seam.ui.pages.editor.edit.ExceptionEditPart;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/NodeFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/NodeFigure.java 2008-12-16 15:52:21 UTC (rev 12625)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/NodeFigure.java 2008-12-16 17:10:29 UTC (rev 12626)
@@ -12,12 +12,12 @@
import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.common.gef.figures.xpl.BaseNodeFigure;
import org.jboss.tools.common.model.ui.ModelUIImages;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesPreference;
import org.jboss.tools.seam.ui.pages.editor.figures.xpl.FixedConnectionAnchor;
public class NodeFigure extends
@@ -25,7 +25,7 @@
public final static Color ghostFillColor = new Color(null, 31, 31, 31);
- public static final Font nodeLabelFont = new Font(null, "default", 8, SWT.BOLD); // TODO: use preference font mechanism for this
+ public static Font nodeLabelFont = SeamPagesPreference.getFont(SeamPagesPreference.VIEW_PATH_FONT.getValue(), null);
public static final Color lightGrayColor = new Color(null, 0xf1, 0xf1, 0xf1);
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java 2008-12-16 15:52:21 UTC (rev 12625)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java 2008-12-16 17:10:29 UTC (rev 12626)
@@ -25,6 +25,7 @@
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesPreference;
import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesDiagramStructureHelper;
import org.jboss.tools.seam.ui.pages.editor.PagesEditor;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Page;
17 years, 4 months
JBoss Tools SVN: r12625 - branches/jbosstools-3.0.0.CR1/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-12-16 10:52:21 -0500 (Tue, 16 Dec 2008)
New Revision: 12625
Modified:
branches/jbosstools-3.0.0.CR1/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/build.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-3410, Resources folder was added to bin.includes, src.includes was corrected.
Modified: branches/jbosstools-3.0.0.CR1/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/build.properties
===================================================================
--- branches/jbosstools-3.0.0.CR1/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/build.properties 2008-12-16 15:28:24 UTC (rev 12624)
+++ branches/jbosstools-3.0.0.CR1/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/build.properties 2008-12-16 15:52:21 UTC (rev 12625)
@@ -2,11 +2,12 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
+ resources/,\
templates/,\
plugin.xml
-src.includes = templates/,\
- src/,\
+src.includes = src/,\
+ META-INF/,\
+ resources/,\
+ templates/,\
build.properties,\
- META-INF/,\
- .project,\
- .classpath
+ about.html
17 years, 4 months
JBoss Tools SVN: r12624 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-12-16 10:28:24 -0500 (Tue, 16 Dec 2008)
New Revision: 12624
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/build.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-3410, Resources folder was added to bin.includes, src.includes was corrected.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/build.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/build.properties 2008-12-16 13:55:21 UTC (rev 12623)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/build.properties 2008-12-16 15:28:24 UTC (rev 12624)
@@ -2,11 +2,12 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
+ resources/,\
templates/,\
plugin.xml
-src.includes = templates/,\
- src/,\
+src.includes = src/,\
+ META-INF/,\
+ resources/,\
+ templates/,\
build.properties,\
- META-INF/,\
- .project,\
- .classpath
+ about.html
17 years, 4 months
JBoss Tools SVN: r12623 - in trunk/hibernatetools: plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions and 11 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2008-12-16 08:55:21 -0500 (Tue, 16 Dec 2008)
New Revision: 12623
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AnnotStyle.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Document.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Foto.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Passport.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Person.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Staff.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Document.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Foto.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Passport.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Person.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Staff.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Document.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Foto.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Passport.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Person.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Staff.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Document.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Foto.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Passport.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Person.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Staff.java
Removed:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Document.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Foto.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Passport.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Person.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Staff.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Document.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Foto.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Passport.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Person.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Staff.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.properties
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionDelegate.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionPulldownDelegate.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/EntityInfo.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/JPAConst.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefEntityInfo.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefFieldInfo.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefType.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/Utils.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ProcessEntityInfo.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestUtilsCommon.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java
Log:
JBIDE-3199
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -6,6 +6,10 @@
private static final String BUNDLE_NAME = "org.hibernate.eclipse.jdt.ui.internal.JdtUiMessages"; //$NON-NLS-1$
public static String AllEntitiesProcessor_header;
public static String AllEntitiesProcessor_message;
+ public static String AllEntitiesProcessor_setup_annotation_generation_preference;
+ public static String AllEntitiesProcessor_annotate_fields;
+ public static String AllEntitiesProcessor_annotate_getters;
+ public static String AllEntitiesProcessor_auto_select_from_class_preference;
public static String CriteriaQuickAssistProcessor_copy_to_criteria_editor;
public static String CriteriaQuickAssistProcessor_errormessage;
public static String DebugJavaCompletionProposalComputer_displaystring;
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.properties 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.properties 2008-12-16 13:55:21 UTC (rev 12623)
@@ -10,6 +10,10 @@
##############################################################################/
AllEntitiesProcessor_header=Hibernate: add JPA annotations
AllEntitiesProcessor_message=Add JPA annotations to the related set of entities. The following classes will be changed:
+AllEntitiesProcessor_setup_annotation_generation_preference=Setup annotation generation preference:
+AllEntitiesProcessor_annotate_fields=Annotate fields
+AllEntitiesProcessor_annotate_getters=Annotate getters
+AllEntitiesProcessor_auto_select_from_class_preference=Auto select from class preference
CriteriaQuickAssistProcessor_copy_to_criteria_editor=Copy to Criteria Editor
CriteriaQuickAssistProcessor_errormessage= Could not get document contents for CriteriaQuickAssist
DebugJavaCompletionProposalComputer_displaystring= I wanna show a dialog!
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionDelegate.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionDelegate.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -24,8 +24,8 @@
import org.eclipse.ui.IWorkbenchPart;
/**
+ * Main menu action delegate for "Generate Hibernate/JPA annotations..."
*
- *
* @author Vitali
*/
public class JPAMapToolActionDelegate implements IObjectActionDelegate,
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionPulldownDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionPulldownDelegate.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActionPulldownDelegate.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -29,8 +29,8 @@
import org.hibernate.eclipse.jdt.ui.internal.JdtUiMessages;
/**
+ * Context menu action delegate for "Generate Hibernate/JPA annotations..."
*
- *
* @author Vitali
*/
public class JPAMapToolActionPulldownDelegate implements
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/actions/JPAMapToolActor.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -53,16 +53,34 @@
import org.hibernate.eclipse.jdt.ui.internal.jpa.process.AllEntitiesProcessor;
/**
+ * Actor to execute annotation generation.
+ * It is singleton.
*
- *
* @author Vitali
*/
public class JPAMapToolActor {
- protected static JPAMapToolActor actor = null;
+ /**
+ * instance
+ */
+ protected static JPAMapToolActor actor = null;
+ /**
+ * selection - start point to generate annotations
+ * could be java file, list of files, package, project, some other?
+ */
protected ISelection selection = null;
+ /**
+ * selected compilation units for startup processing,
+ * result of processing selection
+ */
protected Set<ICompilationUnit> selectionCU = new HashSet<ICompilationUnit>();
+ /**
+ * responsible to gather information
+ */
protected AllEntitiesInfoCollector collector = new AllEntitiesInfoCollector();
+ /**
+ * responsible to generate JPA annotations
+ */
protected AllEntitiesProcessor processor = new AllEntitiesProcessor();
protected JPAMapToolActor() {
@@ -94,6 +112,9 @@
}
}
+ /**
+ * updates selected compilation units collection
+ */
public void updateSelected() {
if (selection != null) {
updateSelectedItems(selection);
@@ -135,8 +156,10 @@
collector.collect(icu);
}
collector.resolveRelations();
+ processor.setAnnotationStylePreference(collector.getAnnotationStylePreference());
processor.modify(javaProject, collector.getMapCUs_Info(), true);
}
+ processor.saveAnnotationStylePreference();
}
public void updateOpen() {
@@ -325,6 +348,10 @@
}
}
+ /**
+ * setup source selection node
+ * @param selection
+ */
synchronized public void setSelection(ISelection selection) {
//System.out.println("Blah! " + selection); //$NON-NLS-1$
if (selection instanceof StructuredSelection && selection.isEmpty()) {
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -24,34 +24,57 @@
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.RefFieldInfo;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.RefType;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.Utils;
+import org.hibernate.eclipse.jdt.ui.internal.jpa.process.AnnotStyle;
/**
+ * Collect information about JPA entity and it's dependences.
*
- *
* @author Vitali
*/
public class AllEntitiesInfoCollector {
+ /**
+ * place to search compilation units
+ */
protected IJavaProject javaProject;
- // fullyQualifiedName -> EntityInfo
+ /**
+ * map:
+ * fullyQualifiedName entity name -> EntityInfo
+ * this collection of processed entities
+ */
protected Map<String, EntityInfo> mapCUs_Info = new TreeMap<String, EntityInfo>();
+ /**
+ * annotation style preference
+ */
+ protected AnnotStyle annotationStylePreference = AnnotStyle.FIELDS;
public void initCollector(IJavaProject javaProject) {
+ // setup java project
this.javaProject = javaProject;
+ // clear collection
mapCUs_Info.clear();
}
+ /**
+ * pair of 2 particular fields from 2 particular entities
+ */
protected class ProcessItem {
- //
+ // field names
public String fieldId = null;
public String fieldId2 = null;
- //
+ // information about field from both entities
public RefEntityInfo refEntityInfo = null;
public RefEntityInfo refEntityInfo2 = null;
}
+ /**
+ * abstract interface for connection of entities
+ */
protected abstract class IConnector {
+ /**
+ * object for processing
+ */
protected ProcessItem pi;
public void setProcessItem(ProcessItem processItem) {
@@ -60,6 +83,10 @@
public abstract boolean updateRelation();
}
+ /**
+ * responsible for enumeration all entities pairs which
+ * succeed in recognize
+ */
protected class EntityProcessor {
protected IConnector connector;
@@ -68,6 +95,9 @@
this.connector = connector;
}
+ /**
+ * enumerate function
+ */
public void enumEntityPairs() {
Iterator<Map.Entry<String, EntityInfo>> it = mapCUs_Info.entrySet().iterator();
ProcessItem pi = new ProcessItem();
@@ -119,15 +149,30 @@
}
}
+ /**
+ * process all entities pairs iteratively:
+ * firstly process pairs with more information about and
+ * pairs with small information about - process in last order
+ */
public void resolveRelations() {
Iterator<Map.Entry<String, EntityInfo>> it = null;
+ int fromVariableCounter = 0;
+ int fromMethodCounter = 0;
// generate RefFieldInfoMap (for simple process)
it = mapCUs_Info.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, EntityInfo> entry = it.next();
EntityInfo entryInfo = entry.getValue();
entryInfo.generateRefFieldInfoMap();
+ fromVariableCounter += entryInfo.getFromVariableCounter();
+ fromMethodCounter += entryInfo.getFromMethodCounter();
}
+ if (fromVariableCounter >= fromMethodCounter) {
+ annotationStylePreference = AnnotStyle.FIELDS;
+ }
+ else {
+ annotationStylePreference = AnnotStyle.GETTERS;
+ }
// update relations
EntityProcessor ep = new EntityProcessor();
// 0)
@@ -381,6 +426,12 @@
ei.adjustPrimaryId(parentEI);
}
+ /**
+ * start to collect information from particular entity class and
+ * its dependencies
+ * @param fullyQualifiedName of startup point entity fully qualified name
+ * example: "org.hibernate.eclipse.jdt.ui.internal.jpa.collect.AllEntitiesInfoCollector"
+ */
public void collect(String fullyQualifiedName) {
if (fullyQualifiedName == null) {
@@ -393,6 +444,11 @@
collect(icu);
}
+ /**
+ * start to collect information from particular entity class and
+ * its dependencies
+ * @param icu - startup point entity compilation unit
+ */
public void collect(ICompilationUnit icu) {
if (icu == null) {
@@ -427,7 +483,14 @@
}
}
+ /**
+ * collection of processed entities getter
+ */
public Map<String, EntityInfo> getMapCUs_Info() {
return mapCUs_Info;
}
+
+ public AnnotStyle getAnnotationStylePreference() {
+ return annotationStylePreference;
+ }
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.hibernate.eclipse.jdt.ui.internal.jpa.collect;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -30,6 +31,8 @@
import org.eclipse.jdt.core.dom.ParameterizedType;
import org.eclipse.jdt.core.dom.PrimitiveType;
import org.eclipse.jdt.core.dom.QualifiedType;
+import org.eclipse.jdt.core.dom.ReturnStatement;
+import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jdt.core.dom.TypeDeclaration;
@@ -43,12 +46,15 @@
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.RefType;
/**
+ * Visitor to collect information about JPA entity.
*
- *
* @author Vitali
*/
public class CollectEntityInfo extends ASTVisitor {
+ /**
+ * storage of collected info
+ */
protected EntityInfo entityInfo = new EntityInfo();
public EntityInfo getEntityInfo() {
@@ -174,7 +180,7 @@
VariableDeclarationFragment var = (VariableDeclarationFragment)itVarNames.next();
String name = var.getName().getIdentifier();
entityInfo.updateReference(name, true, type, mappedBy,
- 0 != annNameShort.compareTo(fullyQualifiedName));
+ 0 != annNameShort.compareTo(fullyQualifiedName), true);
}
astNode = astNode.getParent();
if (astNode instanceof TypeDeclaration) {
@@ -184,6 +190,26 @@
}
}
}
+ else if (astNode instanceof MethodDeclaration) {
+ MethodDeclaration md = (MethodDeclaration)astNode;
+ if (md.getName().getIdentifier().startsWith("get")) { //$NON-NLS-1$
+ // the getter - process it
+ String name = getReturnIdentifier(md);
+ // process it like FieldDeclaration
+ entityInfo.updateReference(name, true, type, mappedBy,
+ 0 != annNameShort.compareTo(fullyQualifiedName), false);
+ astNode = astNode.getParent();
+ if (astNode instanceof TypeDeclaration) {
+ astNode = astNode.getParent();
+ if (astNode instanceof CompilationUnit) {
+ cu = (CompilationUnit)astNode;
+ }
+ }
+ }
+ else {
+ // ignore others
+ }
+ }
if (cu != null) {
if (tb == null) {
entityInfo.addRequiredImport(annNameFull);
@@ -250,31 +276,83 @@
return true;
}
+ public String getReturnIdentifier(MethodDeclaration node) {
+ String res = null;
+ List bodyStatemants = node.getBody().statements();
+ Iterator it = bodyStatemants.iterator();
+ for ( ; it.hasNext(); ) {
+ Object obj = it.next();
+ if (obj instanceof ReturnStatement) {
+ ReturnStatement ret_statement = (ReturnStatement)obj;
+ obj = ret_statement.getExpression();
+ if (obj instanceof SimpleName) {
+ SimpleName sn = (SimpleName)obj;
+ res = sn.getIdentifier();
+ }
+ break;
+ }
+ }
+ return res;
+ }
+
public boolean visit(MethodDeclaration node) {
if (node.getName().getFullyQualifiedName().compareTo(entityInfo.getName()) == 0) {
- // this is constructor declaration - process it
+ // this is constructor declaration - process it separately
entityInfo.setImplicitConstructorFlag(false);
if (node.parameters().size() == 0) {
entityInfo.setDefaultConstructorFlag(true);
}
+ return true;
}
- return true;
+ // -) is it setter?
+ if (node.getName().getIdentifier().startsWith("set")) { //$NON-NLS-1$
+ // setter - do not process it
+ return true;
+ }
+ // +) is it getter?
+ if (!node.getName().getIdentifier().startsWith("get")) { //$NON-NLS-1$
+ // not the getter - do not process it
+ return true;
+ }
+ // ?) has it an annotation? - updateAnnotationRelInfo
+ // 4) try to define its return type
+ Type type = node.getReturnType2();
+ // 5) try to define name
+ String returnIdentifier = getReturnIdentifier(node);
+ List<String> list = new ArrayList<String>();
+ list.add(returnIdentifier);
+ // process it as a field declaration
+ boolean res = processFieldOrGetter(type, list);
+ return res;
}
public boolean visit(FieldDeclaration node) {
- if (node.getType().isPrimitiveType()) {
- PrimitiveType pt = (PrimitiveType)node.getType();
+ Type type = node.getType();
+ List<String> list = new ArrayList<String>();
+ Iterator itVarNames = node.fragments().iterator();
+ while (itVarNames.hasNext()) {
+ VariableDeclarationFragment var = (VariableDeclarationFragment)itVarNames.next();
+ String name = var.getName().getIdentifier();
+ list.add(name);
+ }
+ boolean res = processFieldOrGetter(type, list);
+ return res;
+ }
+
+ public boolean processFieldOrGetter(Type type, List<String> list) {
+ if (type.isPrimitiveType()) {
+ PrimitiveType pt = (PrimitiveType)type;
if (!pt.getPrimitiveTypeCode().equals(PrimitiveType.BOOLEAN)) {
// this is candidate for primary id
- Iterator itVarNames = node.fragments().iterator();
+ Iterator itVarNames = list.iterator();
while (itVarNames.hasNext()) {
VariableDeclarationFragment var = (VariableDeclarationFragment)itVarNames.next();
String name = var.getName().getIdentifier();
entityInfo.addPrimaryIdCandidate(name);
}
}
- } else if (node.getType().isSimpleType()) {
- SimpleType st = (SimpleType)node.getType();
+ } else if (type.isSimpleType()) {
+ SimpleType st = (SimpleType)type;
ITypeBinding tb = st.resolveBinding();
if (tb != null) {
String entityFullyQualifiedName = ""; //$NON-NLS-1$
@@ -286,10 +364,9 @@
HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
}
entityInfo.addDependency(entityFullyQualifiedName);
- Iterator itVarNames = node.fragments().iterator();
+ Iterator itVarNames = list.iterator();
while (itVarNames.hasNext()) {
- VariableDeclarationFragment var = (VariableDeclarationFragment)itVarNames.next();
- String name = var.getName().getIdentifier();
+ String name = (String)itVarNames.next();
entityInfo.addReference(name, entityFullyQualifiedName, RefType.MANY2ONE);
}
}
@@ -297,22 +374,21 @@
ITypeBinding tbParent = tb.getTypeDeclaration().getSuperclass();
if (tbParent != null && "java.lang.Number".equals(tbParent.getBinaryName())) { //$NON-NLS-1$
// this is candidate for primary id
- Iterator itVarNames = node.fragments().iterator();
+ Iterator itVarNames = list.iterator();
while (itVarNames.hasNext()) {
- VariableDeclarationFragment var = (VariableDeclarationFragment)itVarNames.next();
- String name = var.getName().getIdentifier();
+ String name = (String)itVarNames.next();
entityInfo.addPrimaryIdCandidate(name);
}
}
}
}
- } else if (node.getType().isArrayType()) {
- ArrayType at = (ArrayType)node.getType();
+ } else if (type.isArrayType()) {
+ ArrayType at = (ArrayType)type;
ITypeBinding tb = at.resolveBinding();
- } else if (node.getType().isParameterizedType()) {
- ParameterizedType pt = (ParameterizedType)node.getType();
- Type type = (Type)pt.getType();
- ITypeBinding tb = type.resolveBinding();
+ } else if (type.isParameterizedType()) {
+ ParameterizedType pt = (ParameterizedType)type;
+ Type typeP = (Type)pt.getType();
+ ITypeBinding tb = typeP.resolveBinding();
if (tb != null) {
ITypeBinding[] interfaces = tb.getTypeDeclaration().getInterfaces();
String fullyQualifiedNameTypeName = ""; //$NON-NLS-1$
@@ -329,8 +405,8 @@
if (fullyQualifiedNameTypeName.length() > 0) {
Iterator typeArgsIt = pt.typeArguments().iterator();
while (typeArgsIt.hasNext()) {
- type = (Type)typeArgsIt.next();
- tb = type.resolveBinding();
+ typeP = (Type)typeArgsIt.next();
+ tb = typeP.resolveBinding();
String entityFullyQualifiedName = ""; //$NON-NLS-1$
if (tb.getJavaElement() instanceof SourceType) {
SourceType sourceT = (SourceType)tb.getJavaElement();
@@ -340,21 +416,20 @@
HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
}
entityInfo.addDependency(entityFullyQualifiedName);
- Iterator itVarNames = node.fragments().iterator();
+ Iterator itVarNames = list.iterator();
while (itVarNames.hasNext()) {
- VariableDeclarationFragment var = (VariableDeclarationFragment)itVarNames.next();
- String name = var.getName().getIdentifier();
+ String name = (String)itVarNames.next();
entityInfo.addReference(name, entityFullyQualifiedName, RefType.ONE2MANY);
}
}
}
}
}
- } else if (node.getType().isQualifiedType()) {
- QualifiedType qt = (QualifiedType)node.getType();
+ } else if (type.isQualifiedType()) {
+ QualifiedType qt = (QualifiedType)type;
ITypeBinding tb = qt.resolveBinding();
- } else if (node.getType().isWildcardType()) {
- WildcardType wt = (WildcardType)node.getType();
+ } else if (type.isWildcardType()) {
+ WildcardType wt = (WildcardType)type;
ITypeBinding tb = wt.resolveBinding();
}
return true;
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/EntityInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/EntityInfo.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/EntityInfo.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -19,8 +19,10 @@
import java.util.TreeSet;
/**
+ * Service place to collect information about entity class.
+ * Then this info has been transformed according annotations
+ * creation assumption.
*
- *
* @author Vitali
*/
public class EntityInfo {
@@ -98,7 +100,13 @@
protected Map<String, Set<RefFieldInfo>> mapRefFieldInfo = null;
/*
*/
- protected List<String> primaryIdCandidates = new ArrayList<String>();
+ protected Set<String> primaryIdCandidates = new TreeSet<String>();
+ /*
+ */
+ protected int fromVariableCounter = 0;
+ /*
+ */
+ protected int fromMethodCounter = 0;
public void generateRefFieldInfoMap() {
mapRefFieldInfo = new TreeMap<String, Set<RefFieldInfo>>();
@@ -143,28 +151,28 @@
}
public RefType getFieldIdRelValue(String fieldId) {
- if (references == null || !references.containsKey(fieldId)) {
+ if (references == null || fieldId == null || !references.containsKey(fieldId)) {
return RefType.UNDEF;
}
return references.get(fieldId).refType;
}
public boolean getFieldIdAnnotatedValue(String fieldId) {
- if (references == null || !references.containsKey(fieldId)) {
+ if (references == null || fieldId == null || !references.containsKey(fieldId)) {
return false;
}
return references.get(fieldId).annotated;
}
public String getFieldIdFQNameValue(String fieldId) {
- if (references == null || !references.containsKey(fieldId)) {
+ if (references == null || fieldId == null || !references.containsKey(fieldId)) {
return ""; //$NON-NLS-1$
}
return references.get(fieldId).fullyQualifiedName;
}
public RefEntityInfo getFieldIdRefEntityInfo(String fieldId) {
- if (references == null || !references.containsKey(fieldId)) {
+ if (references == null || fieldId == null || !references.containsKey(fieldId)) {
return null;
}
return references.get(fieldId);
@@ -307,18 +315,49 @@
}
public void addReference(String fieldId, String fullyQualifiedName, RefType refType) {
+ if (references == null || fieldId == null) {
+ return;
+ }
+ if (references.containsKey(fieldId)) {
+ RefEntityInfo rei = references.get(fieldId);
+ if (rei != null) {
+ if (rei.fullyQualifiedName != null) {
+ assert(rei.fullyQualifiedName.equals(fullyQualifiedName));
+ }
+ if (rei.refType != null) {
+ assert(rei.refType.equals(refType));
+ }
+ }
+ return;
+ }
references.put(fieldId, new RefEntityInfo(fullyQualifiedName, refType));
}
public void updateReference(String fieldId, boolean annotated, RefType refType, String mappedBy,
- boolean resolvedAnnotationName) {
+ boolean resolvedAnnotationName, boolean fromVariable) {
+ if (references == null || fieldId == null || !references.containsKey(fieldId)) {
+ return;
+ }
RefEntityInfo rei = references.get(fieldId);
if (rei != null) {
- rei.annotated = annotated;
- rei.refType = refType;
- rei.mappedBy = mappedBy;
- rei.resolvedAnnotationName = resolvedAnnotationName;
+ if (rei.updateCounter == 0) {
+ rei.annotated = annotated;
+ rei.refType = refType;
+ rei.mappedBy = mappedBy;
+ rei.resolvedAnnotationName = resolvedAnnotationName;
+ }
+ else {
+ // TODO: possible conflicting info - think about it
+ assert(false);
+ }
+ rei.updateCounter++;
}
+ if (fromVariable) {
+ fromVariableCounter++;
+ }
+ else {
+ fromMethodCounter++;
+ }
}
public Set<RefFieldInfo> getRefFieldInfoSet(String fullyQualifiedName) {
@@ -377,4 +416,12 @@
public boolean needImport(String checkImport) {
return (!setExistingImports.contains(checkImport) && setRequiredImports.contains(checkImport));
}
+
+ public int getFromVariableCounter() {
+ return fromVariableCounter;
+ }
+
+ public int getFromMethodCounter() {
+ return fromMethodCounter;
+ }
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/JPAConst.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/JPAConst.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/JPAConst.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -2,6 +2,12 @@
import java.util.Vector;
+/**
+ * Utility class to hold/operate strings constants
+ * of generated JPA annotations.
+ *
+ * @author Vitali
+ */
public class JPAConst {
static public String IMPORT_SERIALIZABLE = "java.io.Serializable"; //$NON-NLS-1$
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefEntityInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefEntityInfo.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefEntityInfo.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -11,8 +11,8 @@
package org.hibernate.eclipse.jdt.ui.internal.jpa.common;
/**
+ * Describes relation between 2 entities
*
- *
* @author Vitali
*/
public class RefEntityInfo implements Comparable<RefEntityInfo> {
@@ -40,6 +40,8 @@
public boolean hasGetter = false;
//
public boolean hasSetter = false;
+ // should count number of update operations - cause it is possible to get conflicting information
+ public int updateCounter = 0;
//
public RefEntityInfo(String fullyQualifiedName, RefType refType) {
this.fullyQualifiedName = fullyQualifiedName;
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefFieldInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefFieldInfo.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefFieldInfo.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -11,8 +11,8 @@
package org.hibernate.eclipse.jdt.ui.internal.jpa.common;
/**
+ * Holds information about field reference annotation
*
- *
* @author Vitali
*/
public class RefFieldInfo implements Comparable<RefFieldInfo> {
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefType.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefType.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefType.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -11,8 +11,8 @@
package org.hibernate.eclipse.jdt.ui.internal.jpa.common;
/**
+ * possible reference types
*
- *
* @author Vitali
*/
public enum RefType {
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/Utils.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/Utils.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/Utils.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -27,8 +27,8 @@
import org.hibernate.eclipse.console.HibernateConsolePlugin;
/**
+ * Compilation unit common functions
*
- *
* @author Vitali
*/
public class Utils {
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -31,17 +31,13 @@
import org.eclipse.jdt.internal.ui.refactoring.RefactoringSaveHelper;
import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter;
import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider;
-import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StyledString;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ltk.core.refactoring.Change;
@@ -52,32 +48,49 @@
import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
import org.eclipse.text.edits.MalformedTreeException;
import org.eclipse.text.edits.TextEdit;
import org.eclipse.text.edits.UndoEdit;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.eclipse.jdt.ui.Activator;
import org.hibernate.eclipse.jdt.ui.internal.JdtUiMessages;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.Utils;
/**
+ * Modify entity classes
*
- *
* @author Vitali
*/
public class AllEntitiesProcessor {
+ /**
+ * place to search compilation units
+ */
protected IJavaProject javaProject;
+ /**
+ * annotation style
+ */
+ protected AnnotStyle annotationStyle = AnnotStyle.FIELDS;
+ /**
+ * annotation style preference of majority
+ */
+ protected AnnotStyle annotationStylePreference = AnnotStyle.FIELDS;
+ /**
+ * group all information about changes of document in one structure
+ */
protected class ChangeStructure {
public String fullyQualifiedName;
public IPath path;
@@ -86,8 +99,41 @@
public ITextFileBuffer textFileBuffer;
public Change change;
};
+ /**
+ * change info storage
+ */
protected ArrayList<ChangeStructure> changes = new ArrayList<ChangeStructure>();
+
+ public AllEntitiesProcessor() {
+ IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
+ int value = preferenceStore.getInt(AllEntitiesProcessor.class.toString());
+ if (value >= AnnotStyle.values().length) {
+ value = 0;
+ }
+ annotationStyle = AnnotStyle.values()[value];
+ }
+
+ public void saveAnnotationStylePreference() {
+ IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
+ int value = 0;
+ while (value < AnnotStyle.values().length) {
+ if (AnnotStyle.values()[value] == annotationStyle) {
+ break;
+ }
+ value++;
+ }
+ if (value >= AnnotStyle.values().length) {
+ value = 0;
+ }
+ preferenceStore.setValue(AllEntitiesProcessor.class.toString(), value);
+ }
+ /**
+ * execute modification for collection of entities
+ * @param project - common java project for collection of entities
+ * @param entities - collection
+ * @param askConfirmation - ask user confirmation (show dialog)
+ */
public void modify(IJavaProject project, Map<String, EntityInfo> entities,
boolean askConfirmation) {
changes.clear();
@@ -141,30 +187,21 @@
// show warning about compiler problems
// ...
// modify accepted items
- it = entities.entrySet().iterator();
- try {
- while (it.hasNext()) {
- Map.Entry<String, EntityInfo> entry = it.next();
- if (entry.getValue().isAbstractFlag()) {
- continue;
- }
- // this is not only errors, but warnings too
- //if (entry.getValue().isCompilerProblemsFlag()) {
- // continue;
- //}
- // modify only non-abstract classes
- collectModification(bufferManager, entry.getKey(), entry.getValue());
- }
- } catch (CoreException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e); //$NON-NLS-1$
+ if (getAnnotationStyle().equals(AnnotStyle.AUTO)) {
+ setAnnotationStyle(getAnnotationStylePreference());
+ reCollectModification(bufferManager, entities);
+ setAnnotationStyle(AnnotStyle.AUTO);
}
+ else {
+ reCollectModification(bufferManager, entities);
+ }
}
else {
performChange = false;
}
//
if (askConfirmation) {
- if (!showRefactoringDialog(entities)) {
+ if (!showRefactoringDialog(entities, bufferManager)) {
performChange = false;
}
}
@@ -207,6 +244,24 @@
}
}
+ public void reCollectModification(ITextFileBufferManager bufferManager,
+ Map<String, EntityInfo> entities) {
+
+ changes.clear();
+ Iterator<Map.Entry<String, EntityInfo>> it = entities.entrySet().iterator();
+ try {
+ while (it.hasNext()) {
+ Map.Entry<String, EntityInfo> entry = it.next();
+ if (entry.getValue().isAbstractFlag()) {
+ continue;
+ }
+ collectModification(bufferManager, entry.getKey(), entry.getValue());
+ }
+ } catch (CoreException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e); //$NON-NLS-1$
+ }
+ }
+
public void collectModification(ITextFileBufferManager bufferManager, String fullyQualifiedName,
EntityInfo entityInfo) throws CoreException {
@@ -224,6 +279,7 @@
ASTRewrite rewriter = ASTRewrite.create(ast);
// ... rewrite
ProcessEntityInfo processor = new ProcessEntityInfo();
+ processor.setAnnotationStyle(annotationStyle);
processor.setEntityInfo(entityInfo);
processor.setASTRewrite(rewriter);
cu.accept(processor);
@@ -238,7 +294,8 @@
}
}
- public boolean showRefactoringDialog(final Map<String, EntityInfo> entities) {
+ public boolean showRefactoringDialog(final Map<String, EntityInfo> entities,
+ final ITextFileBufferManager bufferManager) {
final String wizard_title = JdtUiMessages.AllEntitiesProcessor_header;
@@ -257,7 +314,7 @@
@Override
public Change createChange(IProgressMonitor pm){
- final CompositeChange cc = new CompositeChange("");
+ final CompositeChange cc = new CompositeChange(""); //$NON-NLS-1$
for (int i = 0; i < changes.size(); i++) {
ChangeStructure cs = changes.get(i);
String change_name = cs.fullyQualifiedName;
@@ -276,6 +333,27 @@
}
};
+ final ModifyListener ml = new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ int idx = ((Combo)e.getSource()).getSelectionIndex();
+ if (idx == 0 && !getAnnotationStyle().equals(AnnotStyle.FIELDS)) {
+ setAnnotationStyle(AnnotStyle.FIELDS);
+ reCollectModification(bufferManager, entities);
+ }
+ else if (idx == 1 && !getAnnotationStyle().equals(AnnotStyle.GETTERS)) {
+ setAnnotationStyle(AnnotStyle.GETTERS);
+ reCollectModification(bufferManager, entities);
+ }
+ else if (idx == 2 && !getAnnotationStyle().equals(AnnotStyle.AUTO)) {
+ setAnnotationStyle(getAnnotationStylePreference());
+ reCollectModification(bufferManager, entities);
+ setAnnotationStyle(AnnotStyle.AUTO);
+ }
+ }
+
+ };
+
RefactoringWizard wizard = new RefactoringWizard(ref, RefactoringWizard.DIALOG_BASED_USER_INTERFACE) {
@Override
@@ -344,6 +422,30 @@
.grab(true, true)
.hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),
convertHorizontalDLUsToPixels(2 * IDialogConstants.BUTTON_BAR_HEIGHT)).applyTo(listViewer.getControl());
+ //Button generateChoice = new Button(container, SWT.CHECK);
+ //generateChoice.setText("fdwsdfv");
+ Composite combolabel = new Composite(container, SWT.NULL);
+ layout = new GridLayout();
+ combolabel.setLayout(layout);
+ layout.numColumns = 2;
+ Label labelChoice = new Label(combolabel, SWT.NULL);
+ labelChoice.setText(JdtUiMessages.AllEntitiesProcessor_setup_annotation_generation_preference);
+ Combo generateChoice = new Combo(combolabel, SWT.READ_ONLY);
+ generateChoice.add(JdtUiMessages.AllEntitiesProcessor_annotate_fields);
+ generateChoice.add(JdtUiMessages.AllEntitiesProcessor_annotate_getters);
+ generateChoice.add(JdtUiMessages.AllEntitiesProcessor_auto_select_from_class_preference);
+ int idx = 0;
+ if (getAnnotationStyle().equals(AnnotStyle.FIELDS)) {
+ idx = 0;
+ }
+ else if (getAnnotationStyle().equals(AnnotStyle.GETTERS)) {
+ idx = 1;
+ }
+ else if (getAnnotationStyle().equals(AnnotStyle.AUTO)) {
+ idx = 2;
+ }
+ generateChoice.select(idx);
+ generateChoice.addModifyListener(ml);
setControl(container);
}
};
@@ -362,11 +464,23 @@
return res;
}
- public IJavaProject getJavaProject() {
- return javaProject;
- }
-
protected void setJavaProject(IJavaProject project) {
javaProject = project;
}
+
+ public AnnotStyle getAnnotationStyle() {
+ return annotationStyle;
+ }
+
+ public void setAnnotationStyle(AnnotStyle annotationStyle) {
+ this.annotationStyle = annotationStyle;
+ }
+
+ public AnnotStyle getAnnotationStylePreference() {
+ return annotationStylePreference;
+ }
+
+ public void setAnnotationStylePreference(AnnotStyle annotationStylePreference) {
+ this.annotationStylePreference = annotationStylePreference;
+ }
}
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AnnotStyle.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AnnotStyle.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AnnotStyle.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,7 @@
+package org.hibernate.eclipse.jdt.ui.internal.jpa.process;
+
+public enum AnnotStyle {
+ FIELDS,
+ GETTERS,
+ AUTO,
+}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ProcessEntityInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ProcessEntityInfo.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ProcessEntityInfo.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -14,6 +14,7 @@
import java.util.List;
import java.util.Set;
+import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.Block;
import org.eclipse.jdt.core.dom.CompilationUnit;
@@ -25,9 +26,11 @@
import org.eclipse.jdt.core.dom.Modifier;
import org.eclipse.jdt.core.dom.NormalAnnotation;
import org.eclipse.jdt.core.dom.QualifiedName;
+import org.eclipse.jdt.core.dom.ReturnStatement;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.core.dom.StringLiteral;
+import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
@@ -39,15 +42,26 @@
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.RefType;
/**
+ * Visitor to insert JPA annotations into proper
+ * places of entity class.
*
- *
* @author Vitali
*/
public class ProcessEntityInfo extends ASTVisitor {
+ /**
+ * information about entity's annotations
+ */
protected EntityInfo entityInfo;
+ /**
+ * rewriter to generate new AST blocks
+ */
protected ASTRewrite rewriter;
-
+ /**
+ * annotation style
+ */
+ protected AnnotStyle annotationStyle = AnnotStyle.FIELDS;
+
public void setEntityInfo(EntityInfo entityInfo) {
this.entityInfo = entityInfo;
}
@@ -57,6 +71,8 @@
}
public boolean visit(CompilationUnit node) {
+ // TODO: sort all imports in alphabetic order
+ //ListRewrite lrw = rewriter.getListRewrite(node, CompilationUnit.IMPORTS_PROPERTY);
for (int i = 0; i < JPAConst.ALL_IMPORTS.size(); i++) {
String tmp = JPAConst.ALL_IMPORTS.get(i);
if (entityInfo.needImport(tmp)) {
@@ -81,9 +97,28 @@
}
importDecl.setName(qualifiedName0);
ListRewrite lrw = rewriter.getListRewrite(node, CompilationUnit.IMPORTS_PROPERTY);
- // TODO: insert import declaration in the proper place
+ // insert import declaration in the proper place
// prefer alphabetic order and package separation
- lrw.insertLast(importDecl, null);
+ Iterator it = lrw.getRewrittenList().iterator();
+ ASTNode insertBeforeNode = null;
+ for ( ; it.hasNext(); ) {
+ Object obj = it.next();
+ if (!(obj instanceof ImportDeclaration)) {
+ continue;
+ }
+ ImportDeclaration id = (ImportDeclaration)obj;
+ String idName = id.getName().getFullyQualifiedName();
+ if (idName.compareTo(importDeclaration) > 0) {
+ insertBeforeNode = id;
+ break;
+ }
+ }
+ if (insertBeforeNode == null) {
+ lrw.insertLast(importDecl, null);
+ }
+ else {
+ lrw.insertBefore(importDecl, insertBeforeNode, null);
+ }
return true;
}
@@ -145,7 +180,14 @@
}
public boolean visit(FieldDeclaration node) {
- if (node.getType().isSimpleType() || node.getType().isPrimitiveType()) {
+ if (annotationStyle != AnnotStyle.FIELDS) {
+ return true;
+ }
+ Type type = node.getType();
+ if (type == null) {
+ return true;
+ }
+ if (type.isSimpleType() || type.isPrimitiveType()) {
if (entityInfo.isAddGeneratedValueFlag()) {
String primaryIdName = entityInfo.getPrimaryIdName();
Iterator itVarNames = node.fragments().iterator();
@@ -185,7 +227,7 @@
}
}
}
- if (node.getType().isSimpleType() || node.getType().isParameterizedType()) {
+ if (type.isSimpleType() || type.isParameterizedType()) {
Iterator itVarNames = node.fragments().iterator();
String fieldId = ""; //$NON-NLS-1$
RefType refType = RefType.UNDEF;
@@ -233,6 +275,105 @@
return true;
}
+ public boolean visit(MethodDeclaration node) {
+ if (annotationStyle != AnnotStyle.GETTERS) {
+ return true;
+ }
+ Type type = node.getReturnType2();
+ if (type == null) {
+ return true;
+ }
+ String returnIdentifier = getReturnIdentifier(node);
+ if (type.isSimpleType() || type.isPrimitiveType()) {
+ if (entityInfo.isAddGeneratedValueFlag()) {
+ String primaryIdName = entityInfo.getPrimaryIdName();
+ boolean addGeneratedValueMarker = false;
+ if (primaryIdName.equals(returnIdentifier)) {
+ addGeneratedValueMarker = true;
+ }
+ if (addGeneratedValueMarker) {
+ MarkerAnnotation matd = rewriter.getAST().newMarkerAnnotation();
+ matd.setTypeName(rewriter.getAST().newSimpleName(JPAConst.ANNOTATION_GENERATED_VALUE));
+ ListRewrite lrw = rewriter.getListRewrite(node, MethodDeclaration.MODIFIERS2_PROPERTY);
+ lrw.insertFirst(matd, null);
+ }
+ }
+ if (entityInfo.isAddPrimaryIdFlag()) {
+ String primaryIdName = entityInfo.getPrimaryIdName();
+ boolean addIdMarker = false;
+ if (primaryIdName.equals(returnIdentifier)) {
+ addIdMarker = true;
+ }
+ if (addIdMarker) {
+ MarkerAnnotation matd = rewriter.getAST().newMarkerAnnotation();
+ matd.setTypeName(rewriter.getAST().newSimpleName(JPAConst.ANNOTATION_ID));
+ ListRewrite lrw = rewriter.getListRewrite(node, MethodDeclaration.MODIFIERS2_PROPERTY);
+ lrw.insertFirst(matd, null);
+ }
+ }
+ }
+ if (type.isSimpleType() || type.isParameterizedType()) {
+ String fieldId = ""; //$NON-NLS-1$
+ RefType refType = RefType.UNDEF;
+ boolean annotated = false;
+ String fullyQualifiedName2 = ""; //$NON-NLS-1$
+ fieldId = returnIdentifier;
+ refType = entityInfo.getFieldIdRelValue(fieldId);
+ annotated = entityInfo.getFieldIdAnnotatedValue(fieldId);
+ fullyQualifiedName2 = entityInfo.getFieldIdFQNameValue(fieldId);
+ if (refType != RefType.UNDEF) {
+ }
+ Set<RefFieldInfo> setRFI = entityInfo.getRefFieldInfoSet(fullyQualifiedName2);
+ if (!annotated && setRFI != null) {
+ RefEntityInfo rei = entityInfo.getFieldIdRefEntityInfo(fieldId);
+ // try to process bidirectional relationships:
+ // nRefType == JPAConst.ONE2ONE - OneToOne - the owning side corresponds
+ // to the side that contains the corresponding foreign key
+ // nRefType == JPAConst.MANY2ONE - ManyToOne - owning side is always the "many" side
+ // nRefType == JPAConst.MANY2MANY - ManyToMany bidirectional relationships
+ // either side may be the owning side
+ if (setRFI.size() > 1 && refType != RefType.MANY2ONE) {
+ if (rei.mappedBy == null || rei.mappedBy == "") { //$NON-NLS-1$
+ addSimpleMarkerAnnotation(node, JPAConst.getRefType(refType));
+ }
+ else {
+ // give to the user information about selected mapping
+ addComplexNormalAnnotation(node, JPAConst.getRefType(refType), rei);
+ }
+ }
+ else if (refType == RefType.MANY2ONE || rei.mappedBy == null || rei.mappedBy == "") { //$NON-NLS-1$
+ addSimpleMarkerAnnotation(node, JPAConst.getRefType(refType));
+ }
+ else {
+ // in case of bidirectional OneToOne - mark both sides with mappedBy -
+ // user should select the right decision
+ addComplexNormalAnnotation(node, JPAConst.getRefType(refType), rei);
+ }
+ }
+ }
+ return true;
+ }
+
+ // duplicate method from CollectEntityInfo
+ public String getReturnIdentifier(MethodDeclaration node) {
+ String res = null;
+ List bodyStatemants = node.getBody().statements();
+ Iterator it = bodyStatemants.iterator();
+ for ( ; it.hasNext(); ) {
+ Object obj = it.next();
+ if (obj instanceof ReturnStatement) {
+ ReturnStatement ret_statement = (ReturnStatement)obj;
+ obj = ret_statement.getExpression();
+ if (obj instanceof SimpleName) {
+ SimpleName sn = (SimpleName)obj;
+ res = sn.getIdentifier();
+ }
+ break;
+ }
+ }
+ return res;
+ }
+
public boolean addSimpleMarkerAnnotation(FieldDeclaration node, String name) {
if (name == null || name.length() == 0) {
return false;
@@ -265,5 +406,45 @@
lrw.insertFirst(natd, null);
return true;
}
+
+ public boolean addSimpleMarkerAnnotation(MethodDeclaration node, String name) {
+ if (name == null || name.length() == 0) {
+ return false;
+ }
+ MarkerAnnotation matd = rewriter.getAST().newMarkerAnnotation();
+ matd.setTypeName(rewriter.getAST().newSimpleName(name));
+ ListRewrite lrw = rewriter.getListRewrite(node, MethodDeclaration.MODIFIERS2_PROPERTY);
+ lrw.insertFirst(matd, null);
+ return true;
+ }
+
+ public boolean addComplexNormalAnnotation(MethodDeclaration node, String name, RefEntityInfo rei) {
+ if (name == null || name.length() == 0) {
+ return false;
+ }
+ NormalAnnotation natd = rewriter.getAST().newNormalAnnotation();
+ MemberValuePair mvp = null;
+ if (rei.mappedBy != null) {
+ mvp = rewriter.getAST().newMemberValuePair();
+ mvp.setName(rewriter.getAST().newSimpleName("mappedBy")); //$NON-NLS-1$
+ StringLiteral sl = rewriter.getAST().newStringLiteral();
+ sl.setLiteralValue(rei.mappedBy);
+ mvp.setValue(sl);
+ }
+ natd.setTypeName(rewriter.getAST().newSimpleName(name));
+ if (mvp != null) {
+ natd.values().add(mvp);
+ }
+ ListRewrite lrw = rewriter.getListRewrite(node, MethodDeclaration.MODIFIERS2_PROPERTY);
+ lrw.insertFirst(natd, null);
+ return true;
+ }
+ public AnnotStyle getAnnotationStyle() {
+ return annotationStyle;
+ }
+
+ public void setAnnotationStyle(AnnotStyle annotationStyle) {
+ this.annotationStyle = annotationStyle;
+ }
}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestUtilsCommon.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestUtilsCommon.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/TestUtilsCommon.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -17,6 +17,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -26,6 +27,7 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
@@ -100,10 +102,14 @@
File[] files = src.listFiles(fileFilter);
for (int i = 0; i < files.length; i++) {
File file = files[i];
- if (!file.exists())
+ if (!file.exists()) {
continue;
+ }
IFile iFile = dst.getFile(file.getName());
try {
+ if (iFile.exists()) {
+ iFile.delete(true, null);
+ }
iFile.create(new FileInputStream(file), true, null);
} catch (FileNotFoundException e) {
e.printStackTrace();
@@ -117,11 +123,14 @@
File[] dirs = src.listFiles(dirFilter);
for (int i = 0; i < dirs.length; i++) {
File dir = dirs[i];
- if (!dir.exists())
+ if (!dir.exists()) {
continue;
+ }
IFolder iFolder = dst.getFolder(dir.getName());
try {
- iFolder.create(true, true, null);
+ if (!iFolder.exists()) {
+ iFolder.create(true, true, null);
+ }
recursiveCopyFiles(dir, iFolder);
} catch (CoreException e) {
e.printStackTrace();
@@ -152,7 +161,15 @@
public void createAndOpenProject(IProjectDescription description,
IProject projectHandle) throws CoreException {
- projectHandle.create(description, null);
+ try {
+ projectHandle.create(description, null);
+ } catch (ResourceException re) {
+ // if the project exist - ignore exception
+ if (re.getStatus().getCode() != 374 || re.getStatus().getSeverity() != IStatus.ERROR ||
+ !"org.eclipse.core.resources".equals(re.getStatus().getPlugin())) { //$NON-NLS-1$
+ throw re;
+ }
+ }
projectHandle.open(IResource.BACKGROUND_REFRESH, null);
}
@@ -226,9 +243,13 @@
File[] files = libFolder.listFiles(jarFilter);
for (int i = 0; i < files.length; i++) {
File file = files[i];
- if (!file.exists())
+ if (!file.exists()) {
continue;
+ }
IFile iFile = dst.getFile(file.getName());
+ if (iFile.exists()) {
+ iFile.delete(true, null);
+ }
try {
iFile.create(new FileInputStream(file), true, null);
libs.add(iFile.getFullPath());
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Document.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Document.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Document.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package test.annotated;
-
-import java.util.Set;
-
-(a)javax.persistence.Entity
-public class Document {
-
- @javax.persistence.Id
- protected Long documentId;
-
- protected Person documentOwner;
-
- @javax.persistence.OneToMany
- protected Set<Person> persons;
-
- protected Byte docType = 0;
-
- public Long getDocumentId() {
- return documentId;
- }
-
- public void setDocumentId(Long documentId) {
- this.documentId = documentId;
- }
-
- public Person getDocumentOwner() {
- return documentOwner;
- }
-
- public void setDocumentOwner(Person documentOwner) {
- this.documentOwner = documentOwner;
- }
-
- public Set<Person> getPersons() {
- return persons;
- }
-
- public void setPersons(Set<Person> persons) {
- this.persons = persons;
- }
-
- public Byte getDocType() {
- return docType;
- }
-
- protected void setDocType(Byte docType) {
- this.docType = docType;
- }
-
-}
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Foto.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Foto.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Foto.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package test.annotated;
-
-public class Foto {
-
- protected Long fid;
-
- protected Short id;
-
- protected Person person;
-
- protected Short width_IDtest;
-
- protected Short height_testID;
-
- public Foto() {
- }
-
- public Long getFid() {
- return fid;
- }
-
- public void setFid(Long fid) {
- this.fid = fid;
- }
-
- public Short getId() {
- return id;
- }
-
- public void setId(Short id) {
- this.id = id;
- }
-
- public Person getPerson() {
- return person;
- }
-
- public void setPerson(Person person) {
- this.person = person;
- }
-
- public Short getWidth_IDtest() {
- return width_IDtest;
- }
-
- public void setWidth_IDtest(Short width_IDtest) {
- this.width_IDtest = width_IDtest;
- }
-
- public Short getHeight_testID() {
- return height_testID;
- }
-
- public void setHeight_testID(Short height_testID) {
- this.height_testID = height_testID;
- }
-
-}
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Passport.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Passport.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Passport.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package test.annotated;
-
-public class Passport extends Document {
-
- protected Long fakeId;
-
- public Passport() {
- setDocType((byte)1);
- }
-
-}
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Person.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Person.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Person.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package test.annotated;
-
-import java.util.Set;
-
-public class Person {
-
- protected Long personId;
-
- @OneToMany(mappedBy="documentOwner")
- protected Set<Document> documents;
-
- protected Foto foto;
-
- protected Set someTestSet;
-
- public Long getPersonId() {
- return personId;
- }
-
- public void setPersonId(Long personId) {
- this.personId = personId;
- }
-
- public Set<Document> getDocuments() {
- return documents;
- }
-
- public void setDocuments(Set<Document> documents) {
- this.documents = documents;
- }
-
- public Foto getFoto() {
- return foto;
- }
-
- public void setFoto(Foto foto) {
- this.foto = foto;
- }
-
-}
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Staff.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Staff.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Staff.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package test.annotated;
-
-public class Staff extends Document {
-
- protected Long code;
-
- public Staff(long code) {
- this.code = code;
- setDocType((byte)2);
- }
-}
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Document.java (from rev 10877, trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Document.java)
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Document.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Document.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+import java.util.Set;
+
+(a)javax.persistence.Entity
+public class Document {
+
+ @javax.persistence.Id
+ protected Long documentId;
+
+ protected Person documentOwner;
+
+ @javax.persistence.OneToMany
+ protected Set<Person> persons;
+
+ protected Byte docType = 0;
+
+ public Long getDocumentId() {
+ return documentId;
+ }
+
+ public void setDocumentId(Long documentId) {
+ this.documentId = documentId;
+ }
+
+ public Person getDocumentOwner() {
+ return documentOwner;
+ }
+
+ public void setDocumentOwner(Person documentOwner) {
+ this.documentOwner = documentOwner;
+ }
+
+ public Set<Person> getPersons() {
+ return persons;
+ }
+
+ public void setPersons(Set<Person> persons) {
+ this.persons = persons;
+ }
+
+ public Byte getDocType() {
+ return docType;
+ }
+
+ protected void setDocType(Byte docType) {
+ this.docType = docType;
+ }
+
+}
Property changes on: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Document.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Foto.java (from rev 10877, trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Foto.java)
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Foto.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Foto.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+public class Foto {
+
+ protected Long fid;
+
+ protected Short id;
+
+ protected Person person;
+
+ protected Short width_IDtest;
+
+ protected Short height_testID;
+
+ public Foto() {
+ }
+
+ public Long getFid() {
+ return fid;
+ }
+
+ public void setFid(Long fid) {
+ this.fid = fid;
+ }
+
+ public Short getId() {
+ return id;
+ }
+
+ public void setId(Short id) {
+ this.id = id;
+ }
+
+ public Person getPerson() {
+ return person;
+ }
+
+ public void setPerson(Person person) {
+ this.person = person;
+ }
+
+ public Short getWidth_IDtest() {
+ return width_IDtest;
+ }
+
+ public void setWidth_IDtest(Short width_IDtest) {
+ this.width_IDtest = width_IDtest;
+ }
+
+ public Short getHeight_testID() {
+ return height_testID;
+ }
+
+ public void setHeight_testID(Short height_testID) {
+ this.height_testID = height_testID;
+ }
+
+}
Property changes on: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Foto.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Passport.java (from rev 10877, trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Passport.java)
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Passport.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Passport.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+public class Passport extends Document {
+
+ protected Long fakeId;
+
+ public Passport() {
+ setDocType((byte)1);
+ }
+
+}
Property changes on: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Passport.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Person.java (from rev 10877, trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Person.java)
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Person.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Person.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+import java.util.Set;
+
+public class Person {
+
+ protected Long personId;
+
+ @OneToMany(mappedBy="documentOwner")
+ protected Set<Document> documents;
+
+ protected Foto foto;
+
+ protected Set someTestSet;
+
+ public Long getPersonId() {
+ return personId;
+ }
+
+ public void setPersonId(Long personId) {
+ this.personId = personId;
+ }
+
+ public Set<Document> getDocuments() {
+ return documents;
+ }
+
+ public void setDocuments(Set<Document> documents) {
+ this.documents = documents;
+ }
+
+ public Foto getFoto() {
+ return foto;
+ }
+
+ public void setFoto(Foto foto) {
+ this.foto = foto;
+ }
+
+}
Property changes on: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Person.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Staff.java (from rev 10877, trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/Staff.java)
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Staff.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Staff.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+public class Staff extends Document {
+
+ protected Long code;
+
+ public Staff(long code) {
+ this.code = code;
+ setDocType((byte)2);
+ }
+}
Property changes on: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Staff.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Document.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Document.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Document.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+import java.util.Set;
+
+(a)javax.persistence.Entity
+public class Document {
+
+ private Long documentId;
+
+ private Person documentOwner;
+
+ private Set<Person> persons;
+
+ private Byte docType = 0;
+
+ @javax.persistence.Id
+ public Long getDocumentId() {
+ return documentId;
+ }
+
+ public void setDocumentId(Long documentId) {
+ this.documentId = documentId;
+ }
+
+ public Person getDocumentOwner() {
+ return documentOwner;
+ }
+
+ public void setDocumentOwner(Person documentOwner) {
+ this.documentOwner = documentOwner;
+ }
+
+ @javax.persistence.OneToMany
+ public Set<Person> getPersons() {
+ return persons;
+ }
+
+ public void setPersons(Set<Person> persons) {
+ this.persons = persons;
+ }
+
+ public Byte getDocType() {
+ return docType;
+ }
+
+ protected void setDocType(Byte docType) {
+ this.docType = docType;
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Foto.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Foto.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Foto.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+public class Foto {
+
+ private Long fid;
+
+ private Short id;
+
+ private Person person;
+
+ private Short width_IDtest;
+
+ private Short height_testID;
+
+ public Foto() {
+ }
+
+ public Long getFid() {
+ return fid;
+ }
+
+ public void setFid(Long fid) {
+ this.fid = fid;
+ }
+
+ public Short getId() {
+ return id;
+ }
+
+ public void setId(Short id) {
+ this.id = id;
+ }
+
+ public Person getPerson() {
+ return person;
+ }
+
+ public void setPerson(Person person) {
+ this.person = person;
+ }
+
+ public Short getWidth_IDtest() {
+ return width_IDtest;
+ }
+
+ public void setWidth_IDtest(Short width_IDtest) {
+ this.width_IDtest = width_IDtest;
+ }
+
+ public Short getHeight_testID() {
+ return height_testID;
+ }
+
+ public void setHeight_testID(Short height_testID) {
+ this.height_testID = height_testID;
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Passport.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Passport.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Passport.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+public class Passport extends Document {
+
+ private Long fakeId;
+
+ public Passport() {
+ setDocType((byte)1);
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Person.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Person.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Person.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+import java.util.Set;
+
+import javax.persistence.OneToOne;
+
+public class Person {
+
+ private Long personId;
+
+ private Set<Document> documents;
+
+ private Foto foto;
+
+ private Set someTestSet;
+
+ public Long getPersonId() {
+ return personId;
+ }
+
+ public void setPersonId(Long personId) {
+ this.personId = personId;
+ }
+
+ @OneToMany(mappedBy="documentOwner")
+ public Set<Document> getDocuments() {
+ return documents;
+ }
+
+ public void setDocuments(Set<Document> documents) {
+ this.documents = documents;
+ }
+
+ @OneToOne(mappedBy="person")
+ public Foto getFoto() {
+ return foto;
+ }
+
+ public void setFoto(Foto foto) {
+ this.foto = foto;
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Staff.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Staff.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Staff.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+public class Staff extends Document {
+
+ private Long code;
+
+ public Staff(long code) {
+ this.code = code;
+ setDocType((byte)2);
+ }
+}
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Document.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Document.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Document.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package test.annotated;
-
-import java.util.Set;
-
-import javax.persistence.GeneratedValue;
-import javax.persistence.ManyToOne;
-
-(a)javax.persistence.Entity
-public class Document {
-
- @GeneratedValue @javax.persistence.Id
- protected Long documentId;
-
- @ManyToOne
- protected Person documentOwner;
-
- @javax.persistence.OneToMany
- protected Set<Person> persons;
-
- protected Byte docType = 0;
-
- public Long getDocumentId() {
- return documentId;
- }
-
- public void setDocumentId(Long documentId) {
- this.documentId = documentId;
- }
-
- public Person getDocumentOwner() {
- return documentOwner;
- }
-
- public void setDocumentOwner(Person documentOwner) {
- this.documentOwner = documentOwner;
- }
-
- public Set<Person> getPersons() {
- return persons;
- }
-
- public void setPersons(Set<Person> persons) {
- this.persons = persons;
- }
-
- public Byte getDocType() {
- return docType;
- }
-
- protected void setDocType(Byte docType) {
- this.docType = docType;
- }
-
-}
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Foto.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Foto.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Foto.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package test.annotated;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.OneToOne;
-
-@Entity
-public class Foto {
-
- protected Long fid;
-
- @Id @GeneratedValue
- protected Short id;
-
- @OneToOne(mappedBy="foto")
- protected Person person;
-
- protected Short width_IDtest;
-
- protected Short height_testID;
-
- public Foto() {
- }
-
- public Long getFid() {
- return fid;
- }
-
- public void setFid(Long fid) {
- this.fid = fid;
- }
-
- public Short getId() {
- return id;
- }
-
- public void setId(Short id) {
- this.id = id;
- }
-
- public Person getPerson() {
- return person;
- }
-
- public void setPerson(Person person) {
- this.person = person;
- }
-
- public Short getWidth_IDtest() {
- return width_IDtest;
- }
-
- public void setWidth_IDtest(Short width_IDtest) {
- this.width_IDtest = width_IDtest;
- }
-
- public Short getHeight_testID() {
- return height_testID;
- }
-
- public void setHeight_testID(Short height_testID) {
- this.height_testID = height_testID;
- }
-
-}
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Passport.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Passport.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Passport.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package test.annotated;
-
-import javax.persistence.Entity;
-
-@Entity
-public class Passport extends Document {
-
- protected Long fakeId;
-
- public Passport() {
- setDocType((byte)1);
- }
-
-}
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Person.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Person.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Person.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package test.annotated;
-
-import java.util.Set;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.OneToOne;
-import javax.persistence.OneToMany;
-
-@Entity
-public class Person {
-
- @Id @GeneratedValue
- protected Long personId;
-
- @OneToMany(mappedBy="documentOwner")
- protected Set<Document> documents;
-
- @OneToOne(mappedBy="person")
- protected Foto foto;
-
- protected Set someTestSet;
-
- public Long getPersonId() {
- return personId;
- }
-
- public void setPersonId(Long personId) {
- this.personId = personId;
- }
-
- public Set<Document> getDocuments() {
- return documents;
- }
-
- public void setDocuments(Set<Document> documents) {
- this.documents = documents;
- }
-
- public Foto getFoto() {
- return foto;
- }
-
- public void setFoto(Foto foto) {
- this.foto = foto;
- }
-
-}
Deleted: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Staff.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Staff.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Staff.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package test.annotated;
-
-import javax.persistence.Entity;
-
-@Entity
-public class Staff extends Document {
-
- protected Long code;
-
- protected Staff() {
- }
-
- public Staff(long code) {
- this.code = code;
- setDocType((byte)2);
- }
-}
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Document.java (from rev 10877, trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Document.java)
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Document.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Document.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+import java.util.Set;
+
+import javax.persistence.GeneratedValue;
+import javax.persistence.ManyToOne;
+
+(a)javax.persistence.Entity
+public class Document {
+
+ @GeneratedValue @javax.persistence.Id
+ protected Long documentId;
+
+ @ManyToOne
+ protected Person documentOwner;
+
+ @javax.persistence.OneToMany
+ protected Set<Person> persons;
+
+ protected Byte docType = 0;
+
+ public Long getDocumentId() {
+ return documentId;
+ }
+
+ public void setDocumentId(Long documentId) {
+ this.documentId = documentId;
+ }
+
+ public Person getDocumentOwner() {
+ return documentOwner;
+ }
+
+ public void setDocumentOwner(Person documentOwner) {
+ this.documentOwner = documentOwner;
+ }
+
+ public Set<Person> getPersons() {
+ return persons;
+ }
+
+ public void setPersons(Set<Person> persons) {
+ this.persons = persons;
+ }
+
+ public Byte getDocType() {
+ return docType;
+ }
+
+ protected void setDocType(Byte docType) {
+ this.docType = docType;
+ }
+
+}
Property changes on: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Document.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Foto.java (from rev 11954, trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Foto.java)
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Foto.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Foto.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+
+@Entity
+public class Foto {
+
+ protected Long fid;
+
+ @Id @GeneratedValue
+ protected Short id;
+
+ @OneToOne(mappedBy="foto")
+ protected Person person;
+
+ protected Short width_IDtest;
+
+ protected Short height_testID;
+
+ public Foto() {
+ }
+
+ public Long getFid() {
+ return fid;
+ }
+
+ public void setFid(Long fid) {
+ this.fid = fid;
+ }
+
+ public Short getId() {
+ return id;
+ }
+
+ public void setId(Short id) {
+ this.id = id;
+ }
+
+ public Person getPerson() {
+ return person;
+ }
+
+ public void setPerson(Person person) {
+ this.person = person;
+ }
+
+ public Short getWidth_IDtest() {
+ return width_IDtest;
+ }
+
+ public void setWidth_IDtest(Short width_IDtest) {
+ this.width_IDtest = width_IDtest;
+ }
+
+ public Short getHeight_testID() {
+ return height_testID;
+ }
+
+ public void setHeight_testID(Short height_testID) {
+ this.height_testID = height_testID;
+ }
+
+}
Property changes on: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Foto.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Passport.java (from rev 10877, trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Passport.java)
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Passport.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Passport.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+import javax.persistence.Entity;
+
+@Entity
+public class Passport extends Document {
+
+ protected Long fakeId;
+
+ public Passport() {
+ setDocType((byte)1);
+ }
+
+}
Property changes on: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Passport.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Person.java (from rev 11954, trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Person.java)
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Person.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Person.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+import java.util.Set;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+
+@Entity
+public class Person {
+
+ @Id @GeneratedValue
+ protected Long personId;
+
+ @OneToMany(mappedBy="documentOwner")
+ protected Set<Document> documents;
+
+ @OneToOne(mappedBy="person")
+ protected Foto foto;
+
+ protected Set someTestSet;
+
+ public Long getPersonId() {
+ return personId;
+ }
+
+ public void setPersonId(Long personId) {
+ this.personId = personId;
+ }
+
+ public Set<Document> getDocuments() {
+ return documents;
+ }
+
+ public void setDocuments(Set<Document> documents) {
+ this.documents = documents;
+ }
+
+ public Foto getFoto() {
+ return foto;
+ }
+
+ public void setFoto(Foto foto) {
+ this.foto = foto;
+ }
+
+}
Property changes on: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Person.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Staff.java (from rev 10877, trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/Staff.java)
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Staff.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Staff.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+import javax.persistence.Entity;
+
+@Entity
+public class Staff extends Document {
+
+ protected Long code;
+
+ protected Staff() {
+ }
+
+ public Staff(long code) {
+ this.code = code;
+ setDocType((byte)2);
+ }
+}
Property changes on: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Staff.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Document.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Document.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Document.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+import java.util.Set;
+
+import javax.persistence.GeneratedValue;
+import javax.persistence.ManyToOne;
+
+(a)javax.persistence.Entity
+public class Document {
+
+ private Long documentId;
+
+ private Person documentOwner;
+
+ private Set<Person> persons;
+
+ private Byte docType = 0;
+
+ @GeneratedValue @javax.persistence.Id
+ public Long getDocumentId() {
+ return documentId;
+ }
+
+ public void setDocumentId(Long documentId) {
+ this.documentId = documentId;
+ }
+
+ @ManyToOne
+ public Person getDocumentOwner() {
+ return documentOwner;
+ }
+
+ public void setDocumentOwner(Person documentOwner) {
+ this.documentOwner = documentOwner;
+ }
+
+ @javax.persistence.OneToMany
+ public Set<Person> getPersons() {
+ return persons;
+ }
+
+ public void setPersons(Set<Person> persons) {
+ this.persons = persons;
+ }
+
+ public Byte getDocType() {
+ return docType;
+ }
+
+ protected void setDocType(Byte docType) {
+ this.docType = docType;
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Foto.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Foto.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Foto.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+
+@Entity
+public class Foto {
+
+ private Long fid;
+
+ private Short id;
+
+ private Person person;
+
+ private Short width_IDtest;
+
+ private Short height_testID;
+
+ public Foto() {
+ }
+
+ public Long getFid() {
+ return fid;
+ }
+
+ public void setFid(Long fid) {
+ this.fid = fid;
+ }
+
+ @Id @GeneratedValue
+ public Short getId() {
+ return id;
+ }
+
+ public void setId(Short id) {
+ this.id = id;
+ }
+
+ @OneToOne(mappedBy="foto")
+ public Person getPerson() {
+ return person;
+ }
+
+ public void setPerson(Person person) {
+ this.person = person;
+ }
+
+ public Short getWidth_IDtest() {
+ return width_IDtest;
+ }
+
+ public void setWidth_IDtest(Short width_IDtest) {
+ this.width_IDtest = width_IDtest;
+ }
+
+ public Short getHeight_testID() {
+ return height_testID;
+ }
+
+ public void setHeight_testID(Short height_testID) {
+ this.height_testID = height_testID;
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Passport.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Passport.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Passport.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+import javax.persistence.Entity;
+
+@Entity
+public class Passport extends Document {
+
+ private Long fakeId;
+
+ public Passport() {
+ setDocType((byte)1);
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Person.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Person.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Person.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+import java.util.Set;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+
+@Entity
+public class Person {
+
+ private Long personId;
+
+ private Set<Document> documents;
+
+ private Foto foto;
+
+ private Set someTestSet;
+
+ @Id @GeneratedValue
+ public Long getPersonId() {
+ return personId;
+ }
+
+ public void setPersonId(Long personId) {
+ this.personId = personId;
+ }
+
+ @OneToMany(mappedBy="documentOwner")
+ public Set<Document> getDocuments() {
+ return documents;
+ }
+
+ public void setDocuments(Set<Document> documents) {
+ this.documents = documents;
+ }
+
+ @OneToOne(mappedBy="person")
+ public Foto getFoto() {
+ return foto;
+ }
+
+ public void setFoto(Foto foto) {
+ this.foto = foto;
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Staff.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Staff.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Staff.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+import javax.persistence.Entity;
+
+@Entity
+public class Staff extends Document {
+
+ private Long code;
+
+ protected Staff() {
+ }
+
+ public Staff(long code) {
+ this.code = code;
+ setDocType((byte)2);
+ }
+}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java 2008-12-16 13:53:24 UTC (rev 12622)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java 2008-12-16 13:55:21 UTC (rev 12623)
@@ -38,6 +38,7 @@
import org.hibernate.eclipse.jdt.ui.internal.jpa.collect.AllEntitiesInfoCollector;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.Utils;
import org.hibernate.eclipse.jdt.ui.internal.jpa.process.AllEntitiesProcessor;
+import org.hibernate.eclipse.jdt.ui.internal.jpa.process.AnnotStyle;
import junit.framework.TestCase;
@@ -52,6 +53,8 @@
public static String RESOURCE_PATH = "res/project/"; //$NON-NLS-1$
public static String SPECIMEN_PATH = "res/specimen/"; //$NON-NLS-1$
public static String TESTRESOURCE_PATH = "testresources"; //$NON-NLS-1$
+ public static String TEST_FIELDS = "fields"; //$NON-NLS-1$
+ public static String TEST_GETTERS = "getters"; //$NON-NLS-1$
static {
RESOURCE_PATH.replaceAll("//", File.separator); //$NON-NLS-1$
SPECIMEN_PATH.replaceAll("//", File.separator); //$NON-NLS-1$
@@ -62,19 +65,9 @@
protected IProject project;
protected IJavaProject javaProject;
+ protected String testSelection;
protected void setUp() throws Exception {
- try {
- createTestProject();
- } catch (JavaModelException e1) {
- fail(e1.getMessage());
- } catch (CoreException e1) {
- fail(e1.getMessage());
- } catch (IOException e1) {
- fail(e1.getMessage());
- }
- assertNotNull(project);
- assertNotNull(javaProject);
}
protected void tearDown() throws Exception {
@@ -89,7 +82,31 @@
assertNull(javaProject);
}
- public void testTransformer() {
+ public void testTransformerFields() {
+ testSelection = TEST_FIELDS;
+ processor.setAnnotationStyle(AnnotStyle.FIELDS);
+ startTestTransformer();
+ }
+
+ public void testTransformerGetters() {
+ testSelection = TEST_GETTERS;
+ processor.setAnnotationStyle(AnnotStyle.GETTERS);
+ startTestTransformer();
+ }
+
+ public void startTestTransformer() {
+ try {
+ createTestProject();
+ } catch (JavaModelException e1) {
+ fail(e1.getMessage());
+ } catch (CoreException e1) {
+ fail(e1.getMessage());
+ } catch (IOException e1) {
+ fail(e1.getMessage());
+ }
+ assertNotNull(project);
+ assertNotNull(javaProject);
+ //
javaProject = ProjectUtils.findJavaProject(PROJECT_NAME);
assertNotNull(javaProject);
try {
@@ -97,14 +114,16 @@
} catch (CoreException e) {
fail(e.getMessage());
}
+ //ICompilationUnit icu = Utils.findCompilationUnit(javaProject,
+ // "test.annotated." + testSelection + ".Document"); //$NON-NLS-1$ //$NON-NLS-2$
ICompilationUnit icu = Utils.findCompilationUnit(javaProject,
- "test.annotated.Passport"); //$NON-NLS-1$
+ "test.annotated." + testSelection + ".Passport"); //$NON-NLS-1$ //$NON-NLS-2$
ICompilationUnit icu2 = Utils.findCompilationUnit(javaProject,
- "test.annotated.Staff"); //$NON-NLS-1$
+ "test.annotated." + testSelection + ".Staff"); //$NON-NLS-1$ //$NON-NLS-2$
//ICompilationUnit icu = Utils.findCompilationUnit(javaProject,
- // "test.annotated.Foto"); //$NON-NLS-1$
+ // "test.annotated." + testSelection + ".Foto"); //$NON-NLS-1$ //$NON-NLS-2$
//ICompilationUnit icu2 = Utils.findCompilationUnit(javaProject,
- // "test.annotated.Person"); //$NON-NLS-1$
+ // "test.annotated." + testSelection + ".Person"); //$NON-NLS-1$ //$NON-NLS-2$
assertNotNull(icu);
assertNotNull(icu2);
collector.initCollector(javaProject);
@@ -136,7 +155,8 @@
protected ASTNode getGenerated(String strName) {
ICompilationUnit icu = Utils.findCompilationUnit(javaProject,
- "test.annotated." + strName); //$NON-NLS-1$
+ "test.annotated." + testSelection + //$NON-NLS-1$
+ "." + strName); //$NON-NLS-1$
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(icu);
ASTNode astNode = parser.createAST(null);
@@ -145,7 +165,10 @@
protected ASTNode getSpecimen(String strName) throws IOException {
File resourceFile = getResourceItem(SPECIMEN_PATH
- + "test" + File.separator + "annotated" + File.separator + strName + ".java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ + "test" + File.separator //$NON-NLS-1$
+ + "annotated" + File.separator //$NON-NLS-1$
+ + testSelection + File.separator + strName
+ + ".java"); //$NON-NLS-1$
if (!resourceFile.exists()) {
return null;
}
17 years, 4 months
JBoss Tools SVN: r12622 - in trunk/seam/plugins: org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-12-16 08:53:24 -0500 (Tue, 16 Dec 2008)
New Revision: 12622
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesPreference.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesDiagramEditPart.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3409
Show grid and grid step properties
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesPreference.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesPreference.java 2008-12-16 13:41:24 UTC (rev 12621)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/SeamPagesPreference.java 2008-12-16 13:53:24 UTC (rev 12622)
@@ -9,6 +9,8 @@
public static final Preference ENABLE_CONTROL_MODE_ON_TRANSITION_COMPLETED = new SeamPagesPreference(SEAM_PAGES_EDITOR_PATH, "enableControlModeOnTransitionCompleted");
public static final Preference SHOW_SHORTCUT_ICON = new SeamPagesPreference(SEAM_PAGES_EDITOR_PATH, "showShortcutIcon");
public static final Preference SHOW_SHORTCUT_PATH = new SeamPagesPreference(SEAM_PAGES_EDITOR_PATH, "showShortcutPath");
+ public static final Preference SHOW_GRID = new SeamPagesPreference(SEAM_PAGES_EDITOR_PATH, "Show Grid");
+ public static final Preference GRID_STEP = new SeamPagesPreference(SEAM_PAGES_EDITOR_PATH, "Grid Step");
protected SeamPagesPreference(String optionPath, String attributeName) {
super(optionPath, attributeName);
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesDiagramEditPart.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesDiagramEditPart.java 2008-12-16 13:41:24 UTC (rev 12621)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesDiagramEditPart.java 2008-12-16 13:53:24 UTC (rev 12622)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.seam.ui.pages.editor.edit;
-import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.List;
@@ -36,24 +35,22 @@
import org.eclipse.gef.rulers.RulerProvider;
import org.eclipse.gef.tools.DeselectAllTracker;
import org.eclipse.gef.tools.MarqueeDragTracker;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.jboss.tools.common.model.event.XModelTreeEvent;
+import org.jboss.tools.common.model.event.XModelTreeListener;
+import org.jboss.tools.common.model.options.PreferenceModelUtilities;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesPreference;
+import org.jboss.tools.seam.ui.pages.SeamUiPagesPlugin;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Page;
-import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesElement;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesModel;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesModelListener;
import org.jboss.tools.seam.ui.pages.editor.figures.DiagramFigure;
public class PagesDiagramEditPart extends ContainerEditPart implements
- LayerConstants, PagesModelListener, Adapter {
- /*
- *
- */
- private boolean gridVisual = false;
+ LayerConstants, PagesModelListener, Adapter, XModelTreeListener{
- /*
- *
- */
- private int gridVisualStep = 8;
/*
*
@@ -65,7 +62,7 @@
* @return
*/
public boolean isGridVisible() {
- return gridVisual;
+ return SeamPagesPreference.SHOW_GRID.getValue().equals("yes");
}
/**
@@ -73,7 +70,7 @@
* @return
*/
public int getVisualGridStep() {
- return gridVisualStep;
+ return Integer.parseInt(SeamPagesPreference.GRID_STEP.getValue());
}
/**
@@ -81,9 +78,7 @@
*/
public void setModel(Object model) {
super.setModel(model);
- //((PagesModel) model).addModelListener(this);
- //gridVisual = getPagesModel().getOptions().isGridVisible();
- //gridVisualStep = getPagesModel().getOptions().getVisualGridStep();
+ PreferenceModelUtilities.getPreferenceModel().addModelTreeListener(this);
}
/**
@@ -216,12 +211,17 @@
return null;
}
- /**
- *
- */
- public void propertyChange(PropertyChangeEvent evt) {
+ public void nodeChanged(XModelTreeEvent event){
+ String path = event.getModelObject().getPath();
+ if(path.equals(SeamPagesPreference.SEAM_PAGES_EDITOR_PATH)){
+ refresh();
+ }
}
-
+
+ public void structureChanged(XModelTreeEvent event){
+
+ }
+
/**
*
*/
@@ -325,5 +325,4 @@
*/
public void setTarget(Notifier newTarget) {
}
-
}
17 years, 4 months
JBoss Tools SVN: r12621 - trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/jbide.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2008-12-16 08:41:24 -0500 (Tue, 16 Dec 2008)
New Revision: 12621
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/jbide/JBIDE3280Test.java
Log:
JBIDE-3820: minor changes: unnecessary code removed.
Modified: trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/jbide/JBIDE3280Test.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/jbide/JBIDE3280Test.java 2008-12-16 13:27:33 UTC (rev 12620)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/jbide/JBIDE3280Test.java 2008-12-16 13:41:24 UTC (rev 12621)
@@ -82,12 +82,4 @@
throw getException();
}
}
-
- protected String dump(nsIDOMDocument document) {
- DOMTreeDumper dumper = new DOMTreeDumper(
- VpeDebug.VISUAL_DUMP_PRINT_HASH);
- dumper.setIgnoredAttributes(VpeDebug.VISUAL_DUMP_IGNORED_ATTRIBUTES);
- dumper.dumpToStream(System.out, document);
- return null;
- }
}
17 years, 4 months