Revision: 3545
Author: [email protected]
Date: Thu May 20 14:57:45 2010
Log: Did some code cleanup to get rid of Eclipse warnings.
http://code.google.com/p/power-architect/source/detail?r=3545
Modified:
/trunk/regress/ca/sqlpower/architect/diff/CompareSQLTest.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/CompareDMFormatter.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/CompareDMPanel.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPen.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/TablePane.java
=======================================
--- /trunk/regress/ca/sqlpower/architect/diff/CompareSQLTest.java Wed Feb
24 14:00:05 2010
+++ /trunk/regress/ca/sqlpower/architect/diff/CompareSQLTest.java Thu May
20 14:57:45 2010
@@ -84,7 +84,7 @@
- listWithATable = new ArrayList();
+ listWithATable = new ArrayList<SQLTable>();
listWithATable.add(tableNoColumn1);
}
@@ -106,7 +106,7 @@
public void testDiffListWithTablesOnly() throws SQLObjectException{
//Testing diffchunk with nothing and nothing
- List <SQLTable> list1 = new ArrayList();
+ List<SQLTable> list1 = new ArrayList<SQLTable>();
CompareSQL compare1 = new CompareSQL
((Collection<SQLTable>)list1,
(Collection<SQLTable>)list1, false);
@@ -158,8 +158,8 @@
public void testDiffListWithTableHavingColumn() throws
SQLObjectException{
- List <SQLTable >tableList1 = new ArrayList();
- List <SQLTable >tableList2 = new ArrayList();
+ List<SQLTable> tableList1 = new ArrayList<SQLTable>();
+ List<SQLTable> tableList2 = new ArrayList<SQLTable>();
//Testing table with column and nothing
tableList1.add(table1);
@@ -196,7 +196,7 @@
//Testing table with column against table with no column
SQLTable table1NoColumn = new SQLTable(null,"tableWithColumn1","it's
lying!",
SQLTable.class.toString(), true);
- List<SQLTable> tempList = new ArrayList();
+ List<SQLTable> tempList = new ArrayList<SQLTable>();
tempList.add(table1NoColumn);
CompareSQL worker3 = new
CompareSQL((Collection<SQLTable>)tempList,
(Collection<SQLTable>)tableList1, false);
@@ -652,7 +652,7 @@
boolean first_table = true;
- for (DiffChunk dc : diffs){
+ for (DiffChunk<SQLObject> dc : diffs){
if (dc.getData().getClass().equals(SQLTable.class)){
if(first_table){
assertEquals (DiffType.SAME
,dc.getType());
@@ -696,7 +696,7 @@
boolean first_table = true;
- for (DiffChunk dc : diffs){
+ for (DiffChunk<SQLObject> dc : diffs){
if (dc.getData().getClass().equals(SQLTable.class)){
if(first_table){
assertEquals (DiffType.SAME ,dc.getType());
@@ -740,7 +740,7 @@
boolean first_table = true;
- for (DiffChunk dc : diffs){
+ for (DiffChunk<SQLObject> dc : diffs){
if (dc.getData().getClass().equals(SQLTable.class)){
if(first_table){
assertEquals (DiffType.SAME ,dc.getType());
@@ -781,7 +781,7 @@
boolean first_table = true;
- for (DiffChunk dc : diffs){
+ for (DiffChunk<SQLObject> dc : diffs){
if (dc.getData().getClass().equals(SQLTable.class)){
if(first_table){
assertEquals (DiffType.SAME ,dc.getType());
@@ -824,7 +824,7 @@
boolean first_table = true;
- for (DiffChunk dc : diffs){
+ for (DiffChunk<SQLObject> dc : diffs){
if (dc.getData().getClass().equals(SQLTable.class)){
if(first_table){
assertEquals (DiffType.SAME ,dc.getType());
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/swingui/CompareDMFormatter.java
Fri Mar 5 13:43:34 2010
+++
/trunk/src/main/java/ca/sqlpower/architect/swingui/CompareDMFormatter.java
Thu May 20 14:57:45 2010
@@ -170,7 +170,7 @@
List<DiffChunk<SQLObject>> addRelationships = new
ArrayList<DiffChunk<SQLObject>>();
List<DiffChunk<SQLObject>> dropRelationships = new
ArrayList<DiffChunk<SQLObject>>();
- List<DiffChunk<SQLObject>> nonRelationship = new
ArrayList<DiffChunk<SQLObject>> ();
+ List<DiffChunk<SQLObject>> nonRelationship = new
ArrayList<DiffChunk<SQLObject>>();
for (DiffChunk<SQLObject> d : diff) {
if (logger.isDebugEnabled()) logger.debug(d);
if (d.getData() instanceof SQLRelationship) {
@@ -462,14 +462,12 @@
private boolean hasKey(SQLTable t) throws SQLObjectException {
- boolean hasKey = false;
for (SQLColumn c : t.getColumns()) {
if (c.isPrimaryKey()) {
- hasKey=true;
- break;
+ return true;
}
}
- return hasKey;
+ return false;
}
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/CompareDMPanel.java
Mon May 10 22:46:35 2010
+++ /trunk/src/main/java/ca/sqlpower/architect/swingui/CompareDMPanel.java
Thu May 20 14:57:45 2010
@@ -269,7 +269,7 @@
private Action newConnectionAction = new
AbstractAction(Messages.getString("CompareDMPanel.newConnectionActionName"))
{ //$NON-NLS-1$
public void actionPerformed(ActionEvent e) {
- final DataSourceCollection plDotIni =
session.getDataSources();
+ final DataSourceCollection<JDBCDataSource> plDotIni =
session.getDataSources();
final JDBCDataSource dataSource = new
JDBCDataSource(plDotIni);
Runnable onAccept = new Runnable() {
public void run() {
@@ -475,8 +475,7 @@
public void cleanup() throws
SQLObjectException {
setCleanupExceptionMessage(Messages.getString("CompareDMPanel.couldNotPopulateSchemaDropdown"));
//$NON-NLS-1$
- for (SQLObject item :
(List<SQLObject>) finalSchemaParent
-
.getChildren()) {
+ for (SQLObject item :
finalSchemaParent.getChildren()) {
schemaDropdown.addItem(item);
}
@@ -604,8 +603,7 @@
.getSelectedItem();
if (populatedCat.isSchemaContainer()) {
- for (SQLObject item : (List<SQLObject>)
populatedCat
- .getChildren()) {
+ for (SQLObject item :
populatedCat.getChildren()) {
schemaDropdown.addItem(item);
}
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPen.java Mon May
10 12:57:24 2010
+++ /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPen.java Thu May
20 14:57:45 2010
@@ -725,7 +725,7 @@
protected void addImpl(PlayPenComponent c, Object constraints) {
if (c instanceof Relationship || c instanceof UsageComponent) {
contentPane.addChild(c,
contentPane.getFirstDependentComponentIndex());
- } else if (c instanceof ContainerPane) {
+ } else if (c instanceof ContainerPane<?, ?>) {
if (constraints instanceof Point) {
c.setLocation((Point) constraints);
contentPane.addChild(c, 0);
@@ -1934,17 +1934,14 @@
/**
* Returns a read-only view of the set of selected children in the
PlayPen.
*/
- public List <PlayPenComponent>getSelectedItems() {
+ public List<PlayPenComponent> getSelectedItems() {
// It would be possible to speed this up by maintaining a
// cache of which children are selected, but the need would
// have to be demonstrated first.
- ArrayList selected = new ArrayList();
+ List<PlayPenComponent> selected = new
ArrayList<PlayPenComponent>();
for (PlayPenComponent c : contentPane.getChildren()) {
- if (c instanceof Selectable) {
- Selectable s = (Selectable) c;
- if (s.isSelected()) {
- selected.add(s);
- }
+ if (c.isSelected()) {
+ selected.add(c);
}
}
return Collections.unmodifiableList(selected);
@@ -2350,7 +2347,7 @@
MouseEvent triggerEvent = (MouseEvent)
dge.getTriggerEvent();
PlayPenComponent c =
contentPane.getComponentAt(unzoomPoint(triggerEvent.getPoint()));
- if ( c instanceof ContainerPane ) {
+ if ( c instanceof ContainerPane<?,?> ) {
ContainerPane<?,?> tp = (ContainerPane<?,?>) c;
Point dragOrigin = tp.getPlayPen().unzoomPoint(new
Point(dge.getDragOrigin()));
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/TablePane.java Mon
May 10 17:52:40 2010
+++ /trunk/src/main/java/ca/sqlpower/architect/swingui/TablePane.java Thu
May 20 14:57:45 2010
@@ -72,6 +72,7 @@
import ca.sqlpower.object.annotation.NonBound;
import ca.sqlpower.object.annotation.Transient;
import ca.sqlpower.sql.DataSourceCollection;
+import ca.sqlpower.sql.SPDataSource;
import ca.sqlpower.sqlobject.LockedColumnException;
import ca.sqlpower.sqlobject.SQLColumn;
import ca.sqlpower.sqlobject.SQLIndex;
@@ -80,7 +81,6 @@
import ca.sqlpower.sqlobject.SQLObjectRuntimeException;
import ca.sqlpower.sqlobject.SQLRelationship;
import ca.sqlpower.sqlobject.SQLTable;
-import ca.sqlpower.sqlobject.SQLTable.TransferStyles;
import ca.sqlpower.swingui.ColorIcon;
import ca.sqlpower.swingui.ColourScheme;
import ca.sqlpower.swingui.SPSUtils;
@@ -763,10 +763,6 @@
}
boolean success = false;
- TransferStyles transferStyle =
TransferStyles.REVERSE_ENGINEER;
- if (dtde.getDropAction() == DnDConstants.ACTION_COPY) {
- transferStyle = TransferStyles.COPY;
- }
success = addTransferable(loc, t, importFlavor,
dtde.getDropAction() == DnDConstants.ACTION_MOVE);
if (success) {
dtde.acceptDrop(DnDConstants.ACTION_COPY); // XXX: not
always true
@@ -858,7 +854,7 @@
}
}
- DataSourceCollection dsCollection =
getModel().getParentDatabase().getDataSource().getParentCollection();
+ DataSourceCollection<SPDataSource> dsCollection =
getModel().getParentDatabase().getDataSource().getParentCollection();
// Note that it is safe to assign types to previously
assigned
// columns, they will be ignored.