Author: dgeraskov
Date: 2009-05-21 11:00:41 -0400 (Thu, 21 May 2009)
New Revision: 15390
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ExtensionManager.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenFileActionUtils.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ReverseEngineeringDefinitionImpl.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/AutoResizeTableLayout.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ClassLoaderHelper.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/DriverClassHelpers.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/xpl/DialogSelectionHelper.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/viewers/xpl/MTreeViewer.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConsoleConfigurationPropertySource.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryPageTabView.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/navigator/PendingJob.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/CollectingSearchRequestor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/BasicWorkbenchAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/PersistentClassWorkbenchAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainer.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainerWorkbenchAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableModelList.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableWorkbenchAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/AbstractGraphViewPart.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/RelationalGraphView.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/layout/ClusterEdgeCreator.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/layout/DirectedGraphLayoutVisitor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/layout/DummyEdgeCreator.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/ConfigurationViewAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/GraphNode.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/PropertyViewAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/TableViewAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/parts/PersistentClassEditPart.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/DisplayStringProposalComparator.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/EclipseHQLCompletionRequestor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCodeScanner.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLPartitionScanner.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/AddPropertyDialog.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationMappingsTab.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterFactoryPropertySource.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterSettingsTab.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/HibernateRefactoringUtil.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/nature/HibernateNature.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/DebugJavaCompletionProposalComputer.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLDetector.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLExpressionCompilerParticipant.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLProblem.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/src/org/hibernate/console/AbstractQueryPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleQueryParameter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/FakeTransactionManagerLookup.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/JavaPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurations.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryInputModel.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPageModel.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/BaseNode.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ClassNode.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/NodeFactory.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PersistentCollectionNode.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/logging/LoggingHelper.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Group.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Groups.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Item.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/TransitionArranger.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ComponentShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ModelElement.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/Shape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ResourceManager.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/ProjectUtil.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/xpl/JavaProjectHelper.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/xpl/EditorTestHelper.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4357
Changed:
ArrayList to List<Type> declaration,
Comparator to Comparator<Type>,
use foreach instead of iterator,
some unused not accessible variables removed
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -39,11 +39,10 @@
private int id;
private Session session;
private final ConsoleConfiguration cfg;
- protected List list;
+ protected List<Object> list;
protected long queryTime = -1; //shows how long query runs
- List pathNames;
protected boolean sticky = true;
- private List exceptions = new ArrayList();
+ private List<Throwable> exceptions = new ArrayList<Throwable>();
/**
* @param i
@@ -66,7 +65,7 @@
/**
*
*/
- public List getExceptions() {
+ public List<Throwable> getExceptions() {
return exceptions;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -37,7 +37,6 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -76,7 +75,7 @@
private ExecutionContext executionContext;
- private Map fakeDrivers = new HashMap();
+ private Map<String, FakeDelegatingDriver> fakeDrivers = new HashMap<String,
FakeDelegatingDriver>();
/* TODO: move this out to the actual users of the configuraiton/sf ? */
private Configuration configuration;
@@ -118,7 +117,7 @@
persistenceUnit = null;
}
try {
- Map overrides = new HashMap();
+ Map<Object,Object> overrides = new HashMap<Object,Object>();
if(properties!=null) {
overrides.putAll( properties );
}
@@ -373,25 +372,23 @@
}
try {
- List errors = new ArrayList();
+ List<Throwable> errors = new ArrayList<Throwable>();
doc = xmlHelper.createSAXReader( resourceName, errors, entityResolver )
.read( new InputSource( stream ) );
if ( errors.size() != 0 ) {
throw new MappingException(
ConsoleMessages.ConsoleConfiguration_invalid_configuration,
- (Throwable) errors.get( 0 )
+ errors.get( 0 )
);
}
- List list =
doc.getRootElement().element("session-factory").elements("mapping");
//$NON-NLS-1$ //$NON-NLS-2$
- Iterator iterator = list.iterator();
- while ( iterator.hasNext() ) {
- Node element = (Node) iterator.next();
+ List<Node> list =
doc.getRootElement().element("session-factory").elements("mapping");
//$NON-NLS-1$ //$NON-NLS-2$
+ for (Node element : list) {
element.getParent().remove(element);
}
-
+
DOMWriter dw = new DOMWriter();
Document document = dw.write(doc);
return localCfg.configure( document );
@@ -455,9 +452,9 @@
if(driverClassName!=null) {
try {
- Class driverClass = ReflectHelper.classForName(driverClassName);
+ Class<Driver> driverClass = ReflectHelper.classForName(driverClassName);
if(!fakeDrivers.containsKey(driverClassName) ) { // To avoid "double
registration"
- FakeDelegatingDriver fakeDelegatingDriver = new FakeDelegatingDriver( (Driver)
driverClass.newInstance() );
+ FakeDelegatingDriver fakeDelegatingDriver = new FakeDelegatingDriver(
driverClass.newInstance() );
DriverManager.registerDriver(fakeDelegatingDriver);
fakeDrivers.put(driverClassName,fakeDelegatingDriver);
}
@@ -512,8 +509,7 @@
int execcount;
- List queryListeners = new ArrayList();
- List consoleCfgListeners = new ArrayList();
+ List<ConsoleConfigurationListener> consoleCfgListeners = new
ArrayList<ConsoleConfigurationListener>();
public QueryPage executeHQLQuery(final String hql) {
return executeHQLQuery(hql, new QueryInputModel());
@@ -554,26 +550,19 @@
private void fireQueryPageCreated(QueryPage qp) {
- Iterator i = consoleCfgListeners.iterator();
- while (i.hasNext() ) {
- ConsoleConfigurationListener view = (ConsoleConfigurationListener) i.next();
+ for (ConsoleConfigurationListener view : consoleCfgListeners) {
view.queryPageCreated(qp);
}
}
-
private void fireFactoryBuilt() {
- Iterator i = consoleCfgListeners.iterator();
- while (i.hasNext() ) {
- ConsoleConfigurationListener view = (ConsoleConfigurationListener) i.next();
+ for (ConsoleConfigurationListener view : consoleCfgListeners) {
view.sessionFactoryBuilt(this, sessionFactory);
}
}
private void fireFactoryClosing(SessionFactory sessionFactory2) {
- Iterator i = consoleCfgListeners.iterator();
- while (i.hasNext() ) {
- ConsoleConfigurationListener view = (ConsoleConfigurationListener) i.next();
+ for (ConsoleConfigurationListener view : consoleCfgListeners) {
view.sessionFactoryClosing(this, sessionFactory2);
}
}
@@ -587,7 +576,7 @@
}
public ConsoleConfigurationListener[] getConsoleConfigurationListeners() {
- return (ConsoleConfigurationListener[]) consoleCfgListeners.toArray(new
ConsoleConfigurationListener[consoleCfgListeners.size()]);
+ return consoleCfgListeners.toArray(new
ConsoleConfigurationListener[consoleCfgListeners.size()]);
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleQueryParameter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleQueryParameter.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleQueryParameter.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -35,13 +35,14 @@
import org.hibernate.Hibernate;
import org.hibernate.mapping.Table;
import org.hibernate.type.NullableType;
+import org.hibernate.type.Type;
public class ConsoleQueryParameter {
static private final Object NULL_MARKER = null; //new Object() { public String
toString() { return "[null]"; } };
- static final Map typeFormats = new HashMap();
+ static final Map<Type, String> typeFormats = new HashMap<Type, String>();
static {
addTypeFormat(Hibernate.BOOLEAN, Boolean.TRUE );
addTypeFormat(Hibernate.BYTE, Byte.valueOf((byte) 42));
@@ -143,7 +144,7 @@
return "<unknown>"; //$NON-NLS-1$
}
- public static Set getPossibleTypes() {
+ public static Set<Type> getPossibleTypes() {
return typeFormats.keySet();
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/FakeTransactionManagerLookup.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/FakeTransactionManagerLookup.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/FakeTransactionManagerLookup.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -111,7 +111,7 @@
int status;
private Connection connection;
- List synchronizations = new ArrayList();
+ List<Synchronization> synchronizations = new ArrayList<Synchronization>();
private FakeTransactionManager transactionManager;
FakeTransaction(FakeTransactionManager transactionManager) {
@@ -141,8 +141,7 @@
else {
status = Status.STATUS_PREPARING;
- for ( int i=0; i<synchronizations.size(); i++ ) {
- Synchronization s = (Synchronization) synchronizations.get(i);
+ for (Synchronization s : synchronizations) {
s.beforeCompletion();
}
@@ -159,8 +158,7 @@
status = Status.STATUS_COMMITTED;
- for ( int i=0; i<synchronizations.size(); i++ ) {
- Synchronization s = (Synchronization) synchronizations.get(i);
+ for (Synchronization s : synchronizations) {
s.afterCompletion(status);
}
@@ -212,8 +210,7 @@
throw new SystemException();
}
- for ( int i=0; i<synchronizations.size(); i++ ) {
- Synchronization s = (Synchronization) synchronizations.get(i);
+ for (Synchronization s : synchronizations) {
s.afterCompletion(status);
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -38,16 +38,16 @@
private String queryString;
private QueryInputModel model;
- public List getList() {
- if (query==null) return Collections.EMPTY_LIST;
+ public List<Object> getList() {
+ if (query==null) return Collections.emptyList();
if (list == null) {
try {
//list = query.list();
- list = new ArrayList();
+ list = new ArrayList<Object>();
setupParameters(query, model);
long startTime = System.currentTimeMillis();
- Iterator iter = query.list().iterator(); // need to be user-controllable to toggle
between iterate, scroll etc.
+ Iterator<?> iter = query.list().iterator(); // need to be user-controllable to
toggle between iterate, scroll etc.
queryTime = System.currentTimeMillis() - startTime;
while (iter.hasNext() ) {
Object element = iter.next();
@@ -56,10 +56,10 @@
pcs.firePropertyChange("list", null, list); //$NON-NLS-1$
}
catch (HibernateException e) {
- list = Collections.EMPTY_LIST;
+ list = Collections.emptyList();
addException(e);
} catch (IllegalArgumentException e) {
- list = Collections.EMPTY_LIST;
+ list = Collections.emptyList();
addException(e);
}
}
@@ -118,8 +118,8 @@
return queryString; // cannot use query since it might be null because of an error!
}
- public List getPathNames() {
- List l = Collections.EMPTY_LIST;
+ public List<String> getPathNames() {
+ List<String> l = Collections.emptyList();
try {
if(query==null) return l;
@@ -137,7 +137,7 @@
t = new Type[] { null };
// ignore -
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2188
}
- l = new ArrayList(t.length);
+ l = new ArrayList<String>(t.length);
for (int i = 0; i < t.length; i++) {
Type type = t[i];
@@ -149,7 +149,7 @@
}
} else {
String[] t = returnAliases;
- l = new ArrayList(t.length);
+ l = new ArrayList<String>(t.length);
for (int i = 0; i < t.length; i++) {
l.add(t[i]);
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/JavaPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/JavaPage.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/JavaPage.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -60,11 +60,12 @@
this.model = model;
}
- public void setSession(Session s) {
+ @SuppressWarnings("unchecked")
+ public void setSession(Session s) {
super.setSession(s);
try {
if(criteriaCode.indexOf( "System.exit" )>=0) { // TODO: externalize
run so we don't need this bogus check! //$NON-NLS-1$
- list = Collections.EMPTY_LIST;
+ list = Collections.emptyList();
addException( new
IllegalArgumentException(ConsoleMessages.JavaPage_not_allowed) );
return;
}
@@ -82,7 +83,7 @@
list = list.subList( 0, Math.min( list.size(),
model.getMaxResults().intValue() ) );
}
} else {
- list = new ArrayList();
+ list = new ArrayList<Object>();
list.add(o);
}
}
@@ -94,20 +95,21 @@
}
}
- private Interpreter setupInterpreter(Session session) throws EvalError,
HibernateException {
+ @SuppressWarnings("unchecked")
+ private Interpreter setupInterpreter(Session session) throws EvalError,
HibernateException {
Interpreter interpreter = new Interpreter();
interpreter.set("session", session); //$NON-NLS-1$
interpreter.setClassLoader( Thread.currentThread().getContextClassLoader() );
SessionImplementor si = (SessionImplementor)session;
- Map map = si.getFactory().getAllClassMetadata();
+ Map<String, ?> map = si.getFactory().getAllClassMetadata();
- Iterator iterator = map.keySet().iterator();
+ Iterator<String> iterator = map.keySet().iterator();
//TODO: filter non classes.
String imports = ""; //$NON-NLS-1$
while (iterator.hasNext() ) {
- String element = (String) iterator.next();
+ String element = iterator.next();
imports += "import " + element + ";\n"; //$NON-NLS-1$
//$NON-NLS-2$
}
@@ -119,7 +121,8 @@
return interpreter;
}
- public List getList() {
+ @SuppressWarnings("unchecked")
+ public List<Object> getList() {
if(list!=null) return list;
try {
if(criteria!=null) {
@@ -128,18 +131,18 @@
queryTime = System.currentTimeMillis() - startTime;
}
else {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
}
catch (HibernateException e) {
- list = Collections.EMPTY_LIST;
+ list = Collections.emptyList();
addException(e);
}
return list;
}
- public List getPathNames() {
- List l = new ArrayList();
+ public List<String> getPathNames() {
+ List<String> l = new ArrayList<String>();
l.add(ConsoleMessages.JavaPage_no_info);
return l;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurations.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurations.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurations.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -65,8 +65,8 @@
// TODO: is the best way for the querypage model ?
private QueryPageModel queryPages = new QueryPageModel();
- private List configurationListeners = new ArrayList();
- private Map configurations;
+ private List<KnownConfigurationsListener> configurationListeners = new
ArrayList<KnownConfigurationsListener>();
+ private Map<String, ConsoleConfiguration> configurations;
private ConsoleConfigurationListener sfListener = new ConsoleConfigurationListener() {
public void sessionFactoryClosing(final ConsoleConfiguration configuration, final
SessionFactory closingFactory) {
@@ -171,7 +171,7 @@
// added forUpdate as a workaround for letting listeners know it is done to update the
configuration so they don't cause removal issues.
public void removeConfiguration(final ConsoleConfiguration configuration, final boolean
forUpdate) {
- ConsoleConfiguration oldConfig = (ConsoleConfiguration)
getRepositoriesMap().remove(configuration.getName() );
+ ConsoleConfiguration oldConfig = getRepositoriesMap().remove(configuration.getName()
);
if (oldConfig != null) {
oldConfig.removeConsoleConfigurationListener(sfListener);
fireNotification(new Notification() {
@@ -200,44 +200,38 @@
* Return a list of the know repository locations
*/
public ConsoleConfiguration[] getConfigurations() {
- return (ConsoleConfiguration[])getRepositoriesMap().values().toArray(new
ConsoleConfiguration[getRepositoriesMap().size()]);
+ return getRepositoriesMap().values().toArray(new
ConsoleConfiguration[getRepositoriesMap().size()]);
}
public ConsoleConfiguration[] getConfigurationsSortedByName() {
- return getConfigurations(new Comparator() {
- public boolean equals(Object obj) {
- return this==obj;
+ return getConfigurations(new Comparator<ConsoleConfiguration>() {
+ public int compare(ConsoleConfiguration o1, ConsoleConfiguration o2) {
+ return o1.getName().compareTo(o2.getName());
}
-
- public int compare(Object o1, Object o2) {
- return ( (ConsoleConfiguration)o1).getName()
- .compareTo(
- ( (ConsoleConfiguration)o2).getName() );
- }
});
}
- public ConsoleConfiguration[] getConfigurations(Comparator c) {
+ public ConsoleConfiguration[] getConfigurations(Comparator<ConsoleConfiguration>
c) {
ConsoleConfiguration[] configurations = getConfigurations();
Arrays.sort(configurations, c);
return configurations;
}
private ConsoleConfiguration internalGetRepository(String location) {
- return (ConsoleConfiguration) getRepositoriesMap().get(location);
+ return getRepositoriesMap().get(location);
}
- private Map getRepositoriesMap() {
+ private Map<String, ConsoleConfiguration> getRepositoriesMap() {
if (configurations == null) {
- configurations = new TreeMap();
+ configurations = new TreeMap<String, ConsoleConfiguration>();
}
return configurations;
}
private KnownConfigurationsListener[] getListeners() {
synchronized(configurationListeners) {
- return (KnownConfigurationsListener[]) configurationListeners.toArray(new
KnownConfigurationsListener[configurationListeners.size()]);
+ return configurationListeners.toArray(new
KnownConfigurationsListener[configurationListeners.size()]);
}
}
@@ -258,9 +252,9 @@
}
// TODO: decouple this logging from Eclipse platform!
- private Map loggingStreams = new HashMap();
+ private Map<String, Object[]> loggingStreams = new HashMap<String,
Object[]>();
public MessageConsoleStream findLoggingStream(String name) {
- Object[] console = (Object[]) loggingStreams.get(name);
+ Object[] console = loggingStreams.get(name);
if(console==null) {
console = new Object[2];
String secondaryId = ConsoleMessages.KnownConfigurations_hibernate_log +
(name==null?ConsoleMessages.KnownConfigurations_unknown:name);
@@ -274,7 +268,7 @@
}
private void removeLoggingStream(ConsoleConfiguration oldConfig) {
- Object[] object = (Object[]) loggingStreams.remove( oldConfig.getName() );
+ Object[] object = loggingStreams.remove( oldConfig.getName() );
if(object!=null) {
MessageConsole mc = (MessageConsole)object[0];
MessageConsoleStream stream = (MessageConsoleStream)object[1];
@@ -288,7 +282,7 @@
public ConsoleConfiguration find(String lastUsedName) {
if(configurations==null) return null;
if(lastUsedName==null) return null;
- return (ConsoleConfiguration) configurations.get(lastUsedName);
+ return configurations.get(lastUsedName);
}
public QueryPageModel getQueryPageModel() {
@@ -302,7 +296,7 @@
Document document = builder.newDocument();
Element element = document.createElement("hibernate-console");
//$NON-NLS-1$
- Node node = document.appendChild(element);
+ document.appendChild(element);
ConsoleConfiguration[] configs = getConfigurations();
for (int i = 0; i < configs.length; i++) {
@@ -336,13 +330,13 @@
xformer.transform(source, result);
}
- List queryParameters = new ArrayList();
+ List<ConsoleQueryParameter> queryParameters = new
ArrayList<ConsoleQueryParameter>();
public ConsoleQueryParameter[] getQueryParameters() {
- return (ConsoleQueryParameter[]) queryParameters.toArray(new
ConsoleQueryParameter[queryParameters.size()]);
+ return queryParameters.toArray(new ConsoleQueryParameter[queryParameters.size()]);
}
- public List getQueryParameterList() {
+ public List<ConsoleQueryParameter> getQueryParameterList() {
return queryParameters;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryInputModel.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryInputModel.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryInputModel.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -41,13 +41,13 @@
*/
public class QueryInputModel extends Observable {
- List parameters;
+ List<ConsoleQueryParameter> parameters;
boolean ignoreParameters = false;
private Integer maxResults;
public QueryInputModel() {
- parameters = new ArrayList();
+ parameters = new ArrayList<ConsoleQueryParameter>();
}
public int getParameterCount() {
@@ -55,21 +55,12 @@
}
public ConsoleQueryParameter[] getQueryParameters() {
- return (ConsoleQueryParameter[]) parameters.toArray(new
ConsoleQueryParameter[parameters.size()]);
+ return parameters.toArray(new ConsoleQueryParameter[parameters.size()]);
}
/** return a copy of the parameters currently in this model */
public ConsoleQueryParameter[] getQueryParametersForQuery() {
- if(ignoreParameters) return new ConsoleQueryParameter[0];
- ConsoleQueryParameter[] result = new ConsoleQueryParameter[parameters.size()];
-
- Iterator iterator = parameters.iterator();
- int i = 0;
- while(iterator.hasNext()) {
- ConsoleQueryParameter cqp=(ConsoleQueryParameter) iterator.next();
- result[i++] = new ConsoleQueryParameter(cqp);
- }
- return result;
+ return ignoreParameters ? new ConsoleQueryParameter[0] : getQueryParameters();
}
public QueryInputModel getCopyForQuery() {
@@ -104,7 +95,7 @@
move(cqp, 1, parameters);
}
- protected void move(Object tf, int shift, List list) {
+ protected <T> void move(T tf, int shift, List<T> list) {
int i = list.indexOf(tf);
if(i>=0) {
@@ -122,20 +113,20 @@
if(parameters.isEmpty()) {
return new ConsoleQueryParameter(paramName, Hibernate.STRING, "");
//$NON-NLS-1$
} else {
- ConsoleQueryParameter cqp = (ConsoleQueryParameter)
parameters.get(parameters.size()-1);
+ ConsoleQueryParameter cqp = parameters.get(parameters.size()-1);
ConsoleQueryParameter c = new ConsoleQueryParameter(cqp);
c.setName(makeUnique(parameters.iterator(), paramName));
return c;
}
}
- private static String makeUnique(Iterator items, String originalPropertyName) {
+ private static String makeUnique(Iterator<ConsoleQueryParameter> items, String
originalPropertyName) {
int cnt = 0;
String propertyName = originalPropertyName;
- Set uniqueNames = new HashSet();
+ Set<String> uniqueNames = new HashSet<String>();
while ( items.hasNext() ) {
- ConsoleQueryParameter element = (ConsoleQueryParameter) items.next();
+ ConsoleQueryParameter element = items.next();
uniqueNames.add( element.getName() );
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPageModel.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPageModel.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPageModel.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -36,13 +36,13 @@
*/
public class QueryPageModel extends AbstractListModel {
- List pages = new ArrayList();
+ List<QueryPage> pages = new ArrayList<QueryPage>();
public int getSize() {
return pages.size();
}
- public Object getElementAt(int index) {
+ public QueryPage getElementAt(int index) {
return pages.get(index);
}
@@ -57,7 +57,7 @@
public void add(QueryPage qp) {
for (int i = pages.size() - 1; i >= 0; i--) {
- QueryPage element = (QueryPage) pages.get(i);
+ QueryPage element = pages.get(i);
if (!element.isSticky() ) {
pages.remove(i);
}
@@ -72,7 +72,7 @@
*/
public void remove(int i) {
- QueryPage qp = (QueryPage) pages.remove(i);
+ QueryPage qp = pages.remove(i);
if(qp!=null) {
qp.removePropertyChangeListener(pcl);
}
@@ -85,7 +85,7 @@
* @return
*/
public QueryPage get(int i) {
- return (QueryPage) getElementAt(i);
+ return getElementAt(i);
}
/**
@@ -95,12 +95,12 @@
fireContentsChanged(pages, index, index);
}
- public Iterator getPages() {
+ public Iterator<QueryPage> getPages() {
return pages.iterator();
}
- public List getPagesAsList() {
- return new ArrayList(pages);
+ public List<QueryPage> getPagesAsList() {
+ return new ArrayList<QueryPage>(pages);
}
public boolean remove(QueryPage page) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/BaseNode.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/BaseNode.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/BaseNode.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -42,7 +42,7 @@
protected BaseNode parent;
protected NodeFactory factory;
- protected List children = new ArrayList();
+ protected List<TreeNode> children = new ArrayList<TreeNode>();
protected String name = "!"; //$NON-NLS-1$
String iconName = ImageConstants.UNKNOWNPROPERTY;
@@ -67,7 +67,7 @@
public TreeNode getChildAt(int childIndex) {
checkChildren();
- return (TreeNode) children.get(childIndex);
+ return children.get(childIndex);
}
public int getChildCount() {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ClassNode.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ClassNode.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ClassNode.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -94,17 +94,16 @@
public String getHQL() {
- List parents = new ArrayList();
+ List<BaseNode> parents = new ArrayList<BaseNode>();
- BaseNode currentParent;
- currentParent = this;
+ BaseNode currentParent = this;
while (currentParent != null && !(currentParent instanceof
ConfigurationEntitiesNode) ) {
parents.add(currentParent);
currentParent = currentParent.parent;
}
if(currentParent instanceof ConfigurationEntitiesNode) {
- currentParent = (BaseNode) parents.get(parents.size()-1);
+ currentParent = parents.get(parents.size()-1);
}
// currentParent is the root
@@ -117,7 +116,7 @@
String path = ""; //$NON-NLS-1$
for (int i = parents.size()-2; i >= 0; i--) {
- path += "." + ( (BaseNode) parents.get(i) ).getName(); //$NON-NLS-1$
+ path += "." + parents.get(i).getName(); //$NON-NLS-1$
}
return "select " + alias + path + " from " + cname + " as
" + alias; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/NodeFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/NodeFactory.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/NodeFactory.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -24,7 +24,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import net.sf.cglib.proxy.Enhancer;
@@ -46,9 +45,9 @@
*/
public class NodeFactory {
- private Map classMetaData;
- private List classes;
- private Map collectionMetaData;
+ private Map<String, ClassMetadata> classMetaData;
+ private List<String> classes;
+ private Map<String, CollectionMetadata> collectionMetaData;
private ConsoleConfiguration consoleConfiguration;
@@ -62,14 +61,14 @@
setConsoleConfiguration(c);
}
+ @SuppressWarnings("unchecked")
private void setConsoleConfiguration(ConsoleConfiguration c) {
consoleConfiguration = c;
SessionFactory sf = c.getSessionFactory();
classMetaData = sf.getAllClassMetadata();
collectionMetaData = sf.getAllCollectionMetadata();
- Set keyset = classMetaData.keySet();
- classes = new ArrayList();
- classes.addAll(keyset);
+ classes = new ArrayList<String>();
+ classes.addAll(classMetaData.keySet());
}
public ConfigurationEntitiesNode createConfigurationEntitiesNode(String name) {
@@ -101,16 +100,15 @@
}
public ClassMetadata getMetaData(String clazz) {
- Object o = classMetaData.get(clazz);
- return (ClassMetadata) o;
+ return classMetaData.get(clazz);
}
- public ClassMetadata getMetaData(Class clazz) {
+ public ClassMetadata getMetaData(Class<?> clazz) {
return getMetaData(clazz.getName() );
}
public CollectionMetadata getCollectionMetaData(String role) {
- return (CollectionMetadata) collectionMetaData.get(role);
+ return collectionMetaData.get(role);
}
public BaseNode createPropertyNode(BaseNode parent, int idx, ClassMetadata metadata) {
@@ -138,7 +136,7 @@
//return new IdentifierNode(this, parent, md);
}
- public BaseNode createNode(BaseNode parent, final Class clazz) {
+ public BaseNode createNode(BaseNode parent, final Class<?> clazz) {
ClassMetadata metadata = getMetaData(clazz);
if(metadata!=null) {
return createClassNode(parent, clazz.getName() );
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PersistentCollectionNode.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PersistentCollectionNode.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PersistentCollectionNode.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -146,7 +146,7 @@
}
- private Object createNode(int idx, Object element, Type type) { // TODO: use a common
way to create these darn nodes!
+ private TreeNode createNode(int idx, Object element, Type type) { // TODO: use a common
way to create these darn nodes!
return new ClassNode(factory, this,type.getReturnedClass().getName(),
factory.getMetaData(type.getReturnedClass() ),element,objectGraph);
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/logging/LoggingHelper.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/logging/LoggingHelper.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/logging/LoggingHelper.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -22,7 +22,6 @@
package org.hibernate.eclipse.logging;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.Plugin;
@@ -32,7 +31,7 @@
private static LoggingHelper helper;
- private List logManagers = new ArrayList();
+ private List<PluginLogManager> logManagers = new
ArrayList<PluginLogManager>();
public LoggingHelper() {
super();
@@ -49,9 +48,7 @@
*/
public void stop(BundleContext context) throws Exception {
synchronized (this.logManagers) {
- Iterator it = this.logManagers.iterator();
- while (it.hasNext()) {
- PluginLogManager logManager = (PluginLogManager) it.next();
+ for (PluginLogManager logManager : logManagers) {
logManager.internalShutdown();
}
this.logManagers.clear();
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ExtensionManager.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ExtensionManager.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ExtensionManager.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -42,6 +42,7 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -64,7 +65,7 @@
public static ExporterDefinition[] findExporterDefinitions ()
{
- ArrayList exporters = new ArrayList();
+ List<ExporterDefinition> exporters = new
ArrayList<ExporterDefinition>();
IExtension[] extensions = findExtensions(EXPORTERS_EXTENSION_ID);
for (int i = 0; i < extensions.length; i++)
@@ -77,14 +78,14 @@
}
}
- return (ExporterDefinition[]) exporters.toArray(new
ExporterDefinition[exporters.size()]);
+ return exporters.toArray(new ExporterDefinition[exporters.size()]);
}
/**
* return map of ExporterDefinitions keyed by id
*/
- public static Map findExporterDefinitionsAsMap() {
- Map result = new HashMap();
+ public static Map<String, ExporterDefinition> findExporterDefinitionsAsMap() {
+ Map<String, ExporterDefinition> result = new HashMap<String,
ExporterDefinition>();
ExporterDefinition[] findExporterDefinitions = findExporterDefinitions();
for (int i = 0; i < findExporterDefinitions.length; i++) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -382,7 +382,7 @@
}
public static IStatus throwableToStatus(Throwable t, int code) {
- List causes = new ArrayList();
+ List<IStatus> causes = new ArrayList<IStatus>();
Throwable temp = t;
while(temp!=null && temp.getCause()!=temp) {
causes.add(new Status(IStatus.ERROR, ID, code, temp.getMessage()==null?temp.toString()
+ HibernateConsoleMessages.HibernateConsolePlugin_no_message_1:temp.toString(), temp) );
@@ -396,7 +396,7 @@
if(causes.isEmpty()) {
return new Status(IStatus.ERROR, ID, code, msg, t);
} else {
- return new MultiStatus(ID, code,(IStatus[]) causes.toArray(new
IStatus[causes.size()]), msg, t);
+ return new MultiStatus(ID, code,causes.toArray(new IStatus[causes.size()]), msg,
t);
}
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenFileActionUtils.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenFileActionUtils.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenFileActionUtils.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -229,7 +229,7 @@
Iterator<Element> classes = getElements(doc, HIBERNATE_TAG_CLASS);
boolean res = false;
while (classes.hasNext()) {
- Element element = (Element)classes.next();
+ Element element = classes.next();
Attribute tableAttr = element.attribute(HIBERNATE_TAG_TABLE);
if (tableAttr != null) {
Attribute catalogAttr = element.attribute(HIBERNATE_TAG_CATALOG);
@@ -346,7 +346,7 @@
HibernateConsolePlugin.getDefault().logErrorMessage("Configuration file not
found", e); //$NON-NLS-1$
}
try {
- List errors = new ArrayList();
+ List<Throwable> errors = new ArrayList<Throwable>();
XMLHelper helper = new XMLHelper();
SAXReader saxReader = helper.createSAXReader(configXMLFile.getPath(), errors,
entityResolver);
doc = saxReader.read(new InputSource( stream));
@@ -359,7 +359,7 @@
}
finally {
try {
- stream.close();
+ if (stream != null) stream.close();
}
catch (IOException ioe) {
HibernateConsolePlugin.getDefault().logErrorMessage("could not close input
stream for", ioe); //$NON-NLS-1$
@@ -377,6 +377,7 @@
* @param element
* @return
*/
+ @SuppressWarnings("unchecked")
public static IFile searchInMappingFiles(ConsoleConfiguration consoleConfiguration,
IJavaProject proj, Object element) {
IFile file = null;
if (consoleConfiguration == null || proj == null) {
@@ -389,9 +390,9 @@
return file;
}
Element sfNode = doc.getRootElement().element(HIBERNATE_TAG_SESSION_FACTORY);
- Iterator elements = sfNode.elements(HIBERNATE_TAG_MAPPING).iterator();
+ Iterator<Element> elements = sfNode.elements(HIBERNATE_TAG_MAPPING).iterator();
while (elements.hasNext() && file == null) {
- Element subelement = (Element)elements.next();
+ Element subelement = elements.next();
Attribute resourceAttr = subelement.attribute(HIBERNATE_TAG_RESOURCE);
if (resourceAttr == null) {
continue;
@@ -703,7 +704,7 @@
testEditors.add((ITextEditor)editors[i]);
}
}
- res = (ITextEditor[])testEditors.toArray(res);
+ res = testEditors.toArray(res);
} else if (editorPart instanceof ITextEditor){
res = new ITextEditor[]{(ITextEditor) editorPart};
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -126,7 +126,7 @@
else if (selection instanceof Property) {
Property p = (Property)selection;
if (p.getPersistentClass() != null) {
- rootClass = (PersistentClass)p.getPersistentClass();
+ rootClass = p.getPersistentClass();
}
}
if (rootClass != null){
@@ -163,7 +163,7 @@
}
if (editorPart == null && parentProperty.isComposite()) {
if (OpenFileActionUtils.hasConfigXMLMappingClassAnnotation(consoleConfiguration,
rootClass)) {
- String fullyQualifiedName =((Component)((Property)
parentProperty).getValue()).getComponentClassName();
+ String fullyQualifiedName
=((Component)parentProperty.getValue()).getComponentClassName();
editorPart = OpenSourceAction.run(compositeProperty, proj, fullyQualifiedName);
}
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -40,20 +40,15 @@
*/
package org.hibernate.eclipse.console.model.impl;
-import java.io.File;
import java.util.HashMap;
import java.util.Map;
-import java.util.Properties;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.HibernateConsoleRuntimeException;
-import org.hibernate.eclipse.HibernatePlugin;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.tool.hbm2x.Exporter;
@@ -73,7 +68,7 @@
final private ImageDescriptor iconDescriptor;
- final private Map properties;
+ final private Map<String, ExporterProperty> properties;
public ExporterDefinition(IConfigurationElement element) {
this(element.getAttribute( "classname" ), //$NON-NLS-1$
@@ -83,7 +78,7 @@
createIcon( element ));
}
- public ExporterDefinition(String className, String description, String id, Map
properties, ImageDescriptor icon) {
+ public ExporterDefinition(String className, String description, String id,
Map<String, ExporterProperty> properties, ImageDescriptor icon) {
this.classname = className;
this.description = description;
this.id = id;
@@ -100,8 +95,8 @@
}
}
- static private Map createProperties(IConfigurationElement element) {
- Map properties = new HashMap();
+ static private Map<String, ExporterProperty>
createProperties(IConfigurationElement element) {
+ Map<String, ExporterProperty> properties = new HashMap<String,
ExporterProperty>();
IConfigurationElement propertyElements[] = element
.getChildren( "property" ); //$NON-NLS-1$
@@ -147,7 +142,7 @@
return iconDescriptor;
}
- public Map getExporterProperties() {
+ public Map<String, ExporterProperty> getExporterProperties() {
return properties;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -34,7 +34,7 @@
private ExporterDefinition definition;
- final Map inputProperties;
+ final Map<String, String> inputProperties;
private boolean enabled = true;
@@ -43,16 +43,15 @@
public ExporterFactory(ExporterDefinition definition, String exporterId) {
this.definition = definition;
this.exporterId = exporterId;
- inputProperties = new HashMap();
+ inputProperties = new HashMap<String, String>();
}
- public Map getDefaultExporterProperties() {
+ public Map<String, ExporterProperty> getDefaultExporterProperties() {
return definition.getExporterProperties();
}
-
public String setProperty(String key, String value) {
- return (String) inputProperties.put( key, value );
+ return inputProperties.put( key, value );
}
public void removeProperty(String propertyName) {
@@ -61,9 +60,9 @@
public String getPropertyValue(String key) {
if(inputProperties.containsKey( key )) {
- return (String) inputProperties.get( key );
+ return inputProperties.get( key );
} else {
- ExporterProperty ep = (ExporterProperty) definition.getExporterProperties().get( key
);
+ ExporterProperty ep = definition.getExporterProperties().get( key );
if(ep!=null) {
return ep.getDefaultValue();
} else {
@@ -93,7 +92,7 @@
boolean enabled = false;
try {
- if(configuration.getAttribute(HibernateLaunchConstants.ATTR_EXPORTERS,
(List)null)==null) {
+ if(configuration.getAttribute(HibernateLaunchConstants.ATTR_EXPORTERS,
(List<String>)null)==null) {
enabled = configuration.getAttribute( getId(), false );
} else {
enabled = configuration.getAttribute( getLaunchAttributePrefix( getId() ), false );
@@ -120,7 +119,7 @@
boolean oldSettings = true;
try {
- if(configuration.getAttribute(HibernateLaunchConstants.ATTR_EXPORTERS,
(List)null)==null) {
+ if(configuration.getAttribute(HibernateLaunchConstants.ATTR_EXPORTERS,
(List<String>)null)==null) {
oldSettings = true;
} else {
oldSettings = false;
@@ -132,7 +131,7 @@
setEnabled(configuration, enabled, oldSettings);
}
- public Map getProperties() {
+ public Map<String, String> getProperties() {
return inputProperties;
}
@@ -140,13 +139,13 @@
return exporterId;
}
- public void setProperties(Map props) {
+ public void setProperties(Map<String, String> props) {
inputProperties.clear();
inputProperties.putAll( props );
}
public ExporterProperty getExporterProperty(String key) {
- return (ExporterProperty) definition.getExporterProperties().get( key );
+ return definition.getExporterProperties().get( key );
}
public boolean hasLocalValueFor(String string) {
@@ -168,7 +167,7 @@
* @throws CoreException in case of resolve variables issues.
*/
public Exporter createConfiguredExporter(Configuration cfg, String
defaultOutputDirectory,
- String customTemplatePath, Properties globalProperties, Set outputDirectories,
ArtifactCollector collector) throws CoreException {
+ String customTemplatePath, Properties globalProperties, Set<String>
outputDirectories, ArtifactCollector collector) throws CoreException {
Exporter exporter = getExporterDefinition().createExporterInstance();
@@ -202,7 +201,7 @@
exporter.setConfiguration(cfg);
- List templatePathList = new ArrayList();
+ List<String> templatePathList = new ArrayList<String>();
if(props.containsKey("template_path")) { //$NON-NLS-1$
String resolveTemplatePath = resolve(props.getProperty("template_path"));
//$NON-NLS-1$
StringTokenizer st = new StringTokenizer(resolveTemplatePath, ";");
//$NON-NLS-1$
@@ -241,7 +240,7 @@
}
}
- exporter.setTemplatePath((String[]) templatePathList.toArray(new
String[templatePathList.size()]));
+ exporter.setTemplatePath(templatePathList.toArray(new
String[templatePathList.size()]));
// special handling for GenericExporter (TODO: be delegated via plugin.xml)
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ReverseEngineeringDefinitionImpl.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ReverseEngineeringDefinitionImpl.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ReverseEngineeringDefinitionImpl.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -57,8 +57,8 @@
return new TableFilterImpl(this);
}
- List tableFilters = new ArrayList();
- private List typeMappings = new ArrayList();
+ List<ITableFilter> tableFilters = new ArrayList<ITableFilter>();
+ private List<ITypeMapping> typeMappings = new ArrayList<ITypeMapping>();
public void addTableFilter(ITableFilter filter) {
tableFilters.add(filter);
@@ -74,7 +74,7 @@
}
public ITableFilter[] getTableFilters() {
- return (ITableFilter[]) tableFilters.toArray(new ITableFilter[tableFilters.size()]);
+ return tableFilters.toArray(new ITableFilter[tableFilters.size()]);
}
public void removeAllTableFilters() {
@@ -96,7 +96,7 @@
}
private void move(Object tf, int shift) {
- List list = tableFilters;
+ List<ITableFilter> list = tableFilters;
String prop = TABLEFILTER_STRUCTURE;
move( tf, shift, list, prop );
}
@@ -115,7 +115,7 @@
}
public ITypeMapping[] getTypeMappings() {
- return (ITypeMapping[]) typeMappings .toArray(new ITypeMapping[typeMappings.size()]);
+ return typeMappings .toArray(new ITypeMapping[typeMappings.size()]);
}
public ITypeMapping createTypeMapping() {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/AutoResizeTableLayout.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/AutoResizeTableLayout.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/AutoResizeTableLayout.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -38,7 +38,7 @@
ControlListener {
private final Table table;
- private List columns = new ArrayList();
+ private List<ColumnLayoutData> columns = new
ArrayList<ColumnLayoutData>();
private boolean autosizing = false;
public AutoResizeTableLayout(Table table) {
@@ -82,7 +82,7 @@
// First calc space occupied by fixed columns.
for (int i = 0; i < size; i++) {
- ColumnLayoutData col = (ColumnLayoutData)columns.get(i);
+ ColumnLayoutData col = columns.get(i);
if (col instanceof ColumnPixelData) {
int pixels = ((ColumnPixelData)col).width;
widths[i] = pixels;
@@ -104,7 +104,7 @@
int rest = width - fixedWidth;
int totalDistributed = 0;
for (int i = 0; i < size; i++) {
- ColumnLayoutData col = (ColumnLayoutData)columns.get(i);
+ ColumnLayoutData col = columns.get(i);
if (col instanceof ColumnWeightData) {
ColumnWeightData cw = (ColumnWeightData)col;
int weight = cw.weight;
@@ -121,7 +121,7 @@
if (i == size) {
i = 0;
}
- ColumnLayoutData col = (ColumnLayoutData)columns.get(i);
+ ColumnLayoutData col = columns.get(i);
if (col instanceof ColumnWeightData) {
++widths[i];
--diff;
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ClassLoaderHelper.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ClassLoaderHelper.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ClassLoaderHelper.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -28,7 +28,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -53,15 +52,15 @@
static public URLClassLoader getProjectClassLoader (IJavaProject project)
{
- List pathElements = getProjectClassPathURLs(project);
- URL urlPaths[] = (URL[]) pathElements.toArray(new URL[pathElements.size()]);
+ List<URL> pathElements = getProjectClassPathURLs(project);
+ URL urlPaths[] = pathElements.toArray(new URL[pathElements.size()]);
return new URLClassLoader(urlPaths, Thread.currentThread().getContextClassLoader() );
}
- static public List getProjectClassPathURLs (IJavaProject project)
+ static public List<URL> getProjectClassPathURLs (IJavaProject project)
{
- List pathElements = new ArrayList();
+ List<URL> pathElements = new ArrayList<URL>();
try {
IClasspathEntry paths[] = project.getResolvedClasspath(true);
@@ -146,7 +145,7 @@
IRuntimeClasspathEntry[] entries = JavaRuntime
.computeUnresolvedRuntimeClasspath(configuration);
entries = JavaRuntime.resolveRuntimeClasspath(entries, configuration);
- List userEntries = new ArrayList(entries.length);
+ List<String> userEntries = new ArrayList<String>(entries.length);
for (int i = 0; i < entries.length; i++) {
IRuntimeClasspathEntry runtimeClasspathEntry = entries[i];
if (runtimeClasspathEntry.getClasspathProperty() ==
IRuntimeClasspathEntry.USER_CLASSES) {
@@ -160,7 +159,7 @@
//System.out.println("Ignored " + runtimeClasspathEntry.getMemento());
}
}
- return (String[]) userEntries.toArray(new String[userEntries.size()]);
+ return userEntries.toArray(new String[userEntries.size()]);
}
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/DriverClassHelpers.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/DriverClassHelpers.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/DriverClassHelpers.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -25,7 +25,6 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -37,9 +36,9 @@
*/
public class DriverClassHelpers {
- private Map dialectNames = new HashMap();
- private Map connectionUrls = new HashMap();
- private Map driverClasses = new HashMap();
+ private Map<String, String> dialectNames = new HashMap<String,
String>();
+ private Map<String, Set<String>> connectionUrls = new HashMap<String,
Set<String>>();
+ private Map<String, Set<String>> driverClasses = new HashMap<String,
Set<String>>();
private Map<String, String> driverToDialect = new HashMap<String,
String>();
public DriverClassHelpers() {
@@ -248,19 +247,19 @@
* @param string
* @param string2
*/
- private void add(Map map, String key, String value) {
- Set existing = (Set) map.get(key);
+ private void add(Map<String, Set<String>> map, String key, String value)
{
+ Set<String> existing = map.get(key);
if(existing==null) {
- existing = new HashSet();
+ existing = new HashSet<String>();
map.put(key,existing);
}
existing.add(value);
}
public String[] getDialectNames() {
- List list = new ArrayList(dialectNames.keySet() );
+ List<String> list = new ArrayList<String>(dialectNames.keySet() );
Collections.sort(list);
- return (String[]) list.toArray(new String[list.size()]);
+ return list.toArray(new String[list.size()]);
}
/**
@@ -269,10 +268,8 @@
* @return short dialect name by corresponding class if available, otherwise return
fullName assuming it is a "raw" classname.
*/
public String getShortDialectName(String fullName) {
- Iterator keyIterator = dialectNames.keySet().iterator();
- while (keyIterator.hasNext()){
- String key = (String)keyIterator.next();
- if (dialectNames.get(key).equals(fullName)) return key;
+ for (Entry<String, String> entry : dialectNames.entrySet()) {
+ if (entry.getValue().equals(fullName)) return entry.getKey();
}
return fullName;
}
@@ -293,26 +290,23 @@
* @return corresponding class name if available, otherwise return dialectName
assuming it is a "raw" classname
*/
public String getDialectClass(String dialectName) {
- if(dialectNames.containsKey(dialectName) ) {
- return (String) dialectNames.get(dialectName);
- } else {
- return dialectName;
- }
+ String dialectClass = dialectNames.get(dialectName);
+ return dialectClass != null ? dialectClass : dialectName;
}
public String[] getDriverClasses(String dialectName) {
- Set result = (Set) (driverClasses.get(dialectName) );
- if(result!=null) {
- return (String[]) result.toArray(new String[result.size()]);
+ Set<String> result = driverClasses.get(dialectName);
+ if(result != null) {
+ return result.toArray(new String[result.size()]);
} else {
return new String[0];
}
}
public String[] getConnectionURLS(String driverclass) {
- Set result = (Set) (connectionUrls.get(driverclass) );
- if(result!=null) {
- return (String[]) result.toArray(new String[result.size()]);
+ Set<String> result = connectionUrls.get(driverclass);
+ if(result != null) {
+ return result.toArray(new String[result.size()]);
} else {
return new String[0];
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/xpl/DialogSelectionHelper.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/xpl/DialogSelectionHelper.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/xpl/DialogSelectionHelper.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -14,6 +14,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -58,7 +59,7 @@
throw new
IllegalArgumentException(HibernateConsoleMessages.DialogSelectionHelper_used_entries_must_be_notnull);
}
- List clazzes = new ArrayList();
+ List<Class<?>> clazzes = new ArrayList<Class<?>>();
if(allowDirectories) {
clazzes.add(IFolder.class);
clazzes.add(IProject.class);
@@ -66,10 +67,10 @@
if(allowFiles) {
clazzes.add(IFile.class);
}
- Class[] acceptedClasses = (Class[]) clazzes.toArray(new Class[clazzes.size()]);
+ Class<?>[] acceptedClasses = clazzes.toArray(new Class[clazzes.size()]);
TypedElementSelectionValidator validator= new
TypedElementSelectionValidator(acceptedClasses, true);
- ArrayList usedFiles= new ArrayList(usedEntries.length);
+ List<IResource> usedFiles= new ArrayList<IResource>(usedEntries.length);
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
for (int i= 0; i < usedEntries.length; i++) {
IResource resource= root.findMember(usedEntries[i]);
@@ -102,11 +103,11 @@
}
public static IPath[] chooseFolderEntries(Shell shell, IPath initialSelection, String
title, String description, boolean allowMultiple) {
- List clazzes = new ArrayList();
+ List<Class<?>> clazzes = new ArrayList<Class<?>>();
clazzes.add(IFolder.class);
clazzes.add(IProject.class);
- Class[] acceptedClasses = (Class[]) clazzes.toArray(new Class[clazzes.size()]);
+ Class<?>[] acceptedClasses = clazzes.toArray(new Class[clazzes.size()]);
TypedElementSelectionValidator validator= new
TypedElementSelectionValidator(acceptedClasses, true);
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/viewers/xpl/MTreeViewer.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/viewers/xpl/MTreeViewer.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/viewers/xpl/MTreeViewer.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -10,9 +10,8 @@
******************************************************************************/
package org.hibernate.eclipse.console.viewers.xpl;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.List;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.AbstractTreeViewer;
@@ -140,9 +139,9 @@
* the element
* @return Widget
*/
- protected ArrayList internalFindItem(Item parent, Object element) {
+ protected List<Item> internalFindItem(Item parent, Object element) {
- ArrayList ret = new ArrayList();
+ List<Item> ret = new ArrayList<Item>();
// compare with node
Object data = parent.getData();
if (data != null) {
@@ -155,7 +154,7 @@
Item[] items = getChildren(parent);
for (int i = 0; i < items.length; i++) {
Item item = items[i];
- ArrayList o = internalFindItem(item, element);
+ List<Item> o = internalFindItem(item, element);
if (null != o) {
ret.addAll(o);
}
@@ -170,17 +169,17 @@
if (null == root) {
return ret;
}
- ArrayList res = new ArrayList();
+ List<Widget> res = new ArrayList<Widget>();
Item[] items = getChildren(getControl());
if (items != null) {
for (int i = 0; i < items.length; i++) {
- ArrayList o = internalFindItem(items[i], element);
+ List<Item> o = internalFindItem(items[i], element);
if (null != o) {
res.addAll(o);
}
}
}
- ret = (Widget[])res.toArray(new Widget[0]);
+ ret = res.toArray(new Widget[0]);
return ret;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConsoleConfigurationPropertySource.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConsoleConfigurationPropertySource.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConsoleConfigurationPropertySource.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -39,14 +39,14 @@
static IPropertyDescriptor[] pd;
static {
- List l = new ArrayList();
+ List<IPropertyDescriptor> l = new ArrayList<IPropertyDescriptor>();
l.add(new TextPropertyDescriptor("name",
HibernateConsoleMessages.ConsoleConfigurationPropertySource_name)); //$NON-NLS-1$
l.add(new PropertyDescriptor("hibernate.cfg.xml",
HibernateConsoleMessages.ConsoleConfigurationPropertySource_config_file)); //$NON-NLS-1$
l.add(new PropertyDescriptor("hibernate.properties",
HibernateConsoleMessages.ConsoleConfigurationPropertySource_properties_file));
//$NON-NLS-1$
l.add(new PropertyDescriptor("mapping.files",
HibernateConsoleMessages.ConsoleConfigurationPropertySource_additional_mapping_files));
//$NON-NLS-1$
- pd = (IPropertyDescriptor[]) l.toArray( new IPropertyDescriptor[l.size()] );
+ pd = l.toArray( new IPropertyDescriptor[l.size()] );
}
public ConsoleConfigurationPropertySource(ConsoleConfiguration cfg) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryPageTabView.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryPageTabView.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryPageTabView.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -41,14 +41,11 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabFolder2Adapter;
-import org.eclipse.swt.custom.CTabFolder2Listener;
import org.eclipse.swt.custom.CTabFolderEvent;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.ViewPart;
@@ -69,9 +66,9 @@
protected CTabFolder tabs = null;
- private Set listeners = Collections.synchronizedSet(new HashSet() );
+ private Set<ISelectionChangedListener> listeners = Collections.synchronizedSet(new
HashSet<ISelectionChangedListener>() );
- protected List pageViewers = Collections.synchronizedList(new ArrayList() );
+ protected List<QueryPageViewer> pageViewers = Collections.synchronizedList(new
ArrayList<QueryPageViewer>() );
ListDataListener dataListener = new ListDataListener() {
public void contentsChanged(ListDataEvent e) {
@@ -108,16 +105,11 @@
protected void rebuild() {
QueryPage selection = getSelectedQueryPage();
- Collection additions = getAddedResultSets();
- for (Iterator i = additions.iterator(); i.hasNext();) {
- QueryPage results = (QueryPage) i.next();
+ for (QueryPage results : getAddedResultSets()) {
this.pageViewers.add(new QueryPageViewer(this, results) );
}
- Collection deletions = getRemovedResultSets();
- for (Iterator i = deletions.iterator(); i.hasNext();) {
- QueryPage results = (QueryPage) i.next();
-
+ for (QueryPage results : getRemovedResultSets()) {
QueryPageViewer viewer = findViewerFor(results);
this.pageViewers.remove(viewer);
viewer.dispose();
@@ -182,8 +174,7 @@
}
public void fireSelectionChangedEvent(ISelection selection) {
- for (Iterator i = this.listeners.iterator(); i.hasNext();) {
- ISelectionChangedListener listener = (ISelectionChangedListener) i.next();
+ for (ISelectionChangedListener listener : listeners) {
listener.selectionChanged(new SelectionChangedEvent(this, selection) );
}
@@ -201,6 +192,7 @@
fireSelectionChangedEvent(selection);
}
+ @SuppressWarnings("unchecked")
public Object getAdapter(Class adapter) {
if (adapter.equals(IPropertySheetPage.class) )
@@ -236,9 +228,9 @@
int index = this.tabs.getSelectionIndex();
if (index >= 0) {
CTabItem item = this.tabs.getItem(index);
- for (Iterator i = this.pageViewers.iterator();
+ for (Iterator<QueryPageViewer> i = this.pageViewers.iterator();
selection == null && i.hasNext();) {
- QueryPageViewer viewer = (QueryPageViewer) i.next();
+ QueryPageViewer viewer = i.next();
if (item == viewer.getTabItem() ) {
selection = viewer;
}
@@ -253,23 +245,22 @@
/**
* @return
*/
- private Collection getRemovedResultSets() {
- Collection collection =
KnownConfigurations.getInstance().getQueryPageModel().getPagesAsList();
- Collection visible = getQueryPages();
+ private Collection<QueryPage> getRemovedResultSets() {
+ Collection<QueryPage> collection =
KnownConfigurations.getInstance().getQueryPageModel().getPagesAsList();
+ Collection<QueryPage> visible = getQueryPages();
visible.removeAll(collection);
return visible;
}
- private Collection getAddedResultSets() {
- Collection collection =
KnownConfigurations.getInstance().getQueryPageModel().getPagesAsList();
+ private Collection<QueryPage> getAddedResultSets() {
+ Collection<QueryPage> collection =
KnownConfigurations.getInstance().getQueryPageModel().getPagesAsList();
collection.removeAll(getQueryPages() );
return collection;
}
- private Collection getQueryPages() {
- List list = new ArrayList();
- for (Iterator i = this.pageViewers.iterator(); i.hasNext();) {
- QueryPageViewer viewer = (QueryPageViewer) i.next();
+ private Collection<QueryPage> getQueryPages() {
+ List<QueryPage> list = new ArrayList<QueryPage>();
+ for (QueryPageViewer viewer : pageViewers) {
list.add(viewer.getQueryPage() );
}
return list;
@@ -277,8 +268,7 @@
private QueryPageViewer findViewerFor(QueryPage results) {
QueryPageViewer viewer = null;
- for (Iterator i = this.pageViewers.iterator(); viewer == null && i.hasNext();)
{
- QueryPageViewer temp = (QueryPageViewer) i.next();
+ for (QueryPageViewer temp : pageViewers) {
if (results != null && results.equals(temp.getQueryPage() ) ) {
viewer = temp;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -190,12 +190,10 @@
}
});
- final List possibleTypes = new ArrayList(ConsoleQueryParameter.getPossibleTypes());
- Collections.sort(possibleTypes, new Comparator() {
+ final List<Type> possibleTypes = new
ArrayList<Type>(ConsoleQueryParameter.getPossibleTypes());
+ Collections.sort(possibleTypes, new Comparator<Type>() {
- public int compare(Object o1, Object o2) {
- Type t1 = (Type) o1;
- Type t2 = (Type) o2;
+ public int compare(Type t1, Type t2) {
return t1.getName().compareTo(t2.getName());
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/navigator/PendingJob.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/navigator/PendingJob.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/navigator/PendingJob.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -24,7 +24,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -68,7 +67,7 @@
PendingUIJob updateUIJob = new PendingUIJob(viewer, placeHolder);
updateUIJob.schedule();
- List children = new ArrayList();
+ List<Object> children = new ArrayList<Object>();
Object[] rootObjects = (contentProvider != null) ? contentProvider.getChildren(parent)
: null;
if (rootObjects != null) {
for (int x=0; x< rootObjects.length ; ++x) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/CollectingSearchRequestor.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/CollectingSearchRequestor.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/CollectingSearchRequestor.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -28,17 +28,17 @@
import org.eclipse.jdt.core.search.SearchRequestor;
public class CollectingSearchRequestor extends SearchRequestor {
- private List found;
+ private List<SearchMatch> found;
public CollectingSearchRequestor() {
- found= new ArrayList();
+ found= new ArrayList<SearchMatch>();
}
public void acceptSearchMatch(SearchMatch match) {
found.add(match);
}
- public List getResults() {
+ public List<SearchMatch> getResults() {
return found;
}
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/BasicWorkbenchAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/BasicWorkbenchAdapter.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/BasicWorkbenchAdapter.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -68,9 +68,10 @@
final static Object[] NO_CHILDREN = new Object[0];
- protected Object[] toArray(Iterator iterator, Class clazz, Comparator comparator) {
- List obj = toList( iterator );
- Object[] array = obj.toArray((Object[]) Array.newInstance(clazz, obj.size()));
+ @SuppressWarnings("unchecked")
+ protected <T> T[] toArray(Iterator<T> iterator, Class<T> clazz,
Comparator<? super T> comparator) {
+ List<T> obj = toList( iterator );
+ T[] array = obj.toArray((T[])Array.newInstance(clazz, obj.size()) );
if(comparator!=null) {
Arrays.sort(array, comparator);
@@ -78,16 +79,16 @@
return array;
}
- private List toList(Iterator iterator) {
- List obj = new ArrayList();
+ private <T> List<T> toList(Iterator<T> iterator) {
+ List<T> obj = new ArrayList<T>();
while ( iterator.hasNext() ) {
obj.add(iterator.next());
}
return obj;
}
- protected Object[] toArray(Enumeration enumeration, Class clazz) {
- List obj = new ArrayList();
+ protected Object[] toArray(Enumeration<Object> enumeration, Class<?> clazz)
{
+ List<Object> obj = new ArrayList<Object>();
while ( enumeration.hasMoreElements() ) {
obj.add(enumeration.nextElement());
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -45,6 +45,7 @@
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.EclipseImages;
+import org.hibernate.mapping.Table;
public class LazyDatabaseSchemaWorkbenchAdapter extends BasicWorkbenchAdapter {
@@ -52,6 +53,7 @@
return getChildren(o, new NullProgressMonitor());
}
+ @SuppressWarnings("unchecked")
public Object[] getChildren(Object o, final IProgressMonitor monitor) {
LazyDatabaseSchema dbs = getLazyDatabaseSchema( o );
final DefaultDatabaseCollector db = new DefaultDatabaseCollector();
@@ -60,18 +62,18 @@
try{
readDatabaseSchema(monitor, db, consoleConfiguration,
dbs.getReverseEngineeringStrategy());
- List result = new ArrayList();
+ List<TableContainer> result = new ArrayList<TableContainer>();
- Iterator qualifierEntries = db.getQualifierEntries();
+ Iterator<Map.Entry<String, List<Table>>> qualifierEntries =
db.getQualifierEntries();
while ( qualifierEntries.hasNext() ) {
- Map.Entry entry = (Map.Entry) qualifierEntries.next();
- result.add(new TableContainer((String) entry.getKey(),(List)entry.getValue()));
+ Map.Entry<String, List<Table>> entry = qualifierEntries.next();
+ result.add(new TableContainer(entry.getKey(), entry.getValue()));
}
- return toArray(result.iterator(), TableContainer.class, new Comparator() {
+ return toArray(result.iterator(), TableContainer.class, new
Comparator<TableContainer>() {
- public int compare(Object arg0, Object arg1) {
+ public int compare(TableContainer arg0, TableContainer arg1) {
- return
((TableContainer)arg0).getName().compareTo(((TableContainer)arg1).getName());
+ return arg0.getName().compareTo(arg1.getName());
}
});
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/PersistentClassWorkbenchAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/PersistentClassWorkbenchAdapter.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/PersistentClassWorkbenchAdapter.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -34,16 +34,17 @@
public class PersistentClassWorkbenchAdapter extends BasicWorkbenchAdapter {
+ @SuppressWarnings("unchecked")
public Object[] getChildren(Object o) {
PersistentClass pc = (PersistentClass) o;
Property identifierProperty = pc.getIdentifierProperty();
- List properties = new ArrayList();
+ List<Property> properties = new ArrayList<Property>();
if(identifierProperty!=null) {
properties.add(identifierProperty);
}
- Iterator propertyClosureIterator = new JoinedIterator(properties.iterator(),
pc.getPropertyClosureIterator());
+ Iterator<Property> propertyClosureIterator = new
JoinedIterator(properties.iterator(), pc.getPropertyClosureIterator());
return toArray(propertyClosureIterator, Property.class, null);
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainer.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainer.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainer.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -23,17 +23,19 @@
import java.util.List;
+import org.hibernate.mapping.Table;
+
public class TableContainer {
- private final List tables;
+ private final List<Table> tables;
private final String name;
- public TableContainer(String name, List tables) {
+ public TableContainer(String name, List<Table> tables) {
this.tables = tables;
this.name = name;
}
- public List getTables() {
+ public List<Table> getTables() {
return tables;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainerWorkbenchAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainerWorkbenchAdapter.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableContainerWorkbenchAdapter.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -33,11 +33,11 @@
public Object[] getChildren(Object o) {
TableContainer tc = getTableContainer( o );
- return toArray(tc.getTables().iterator(), Table.class, new Comparator() {
+ return toArray(tc.getTables().iterator(), Table.class, new Comparator<Table>() {
- public int compare(Object arg0, Object arg1) {
+ public int compare(Table arg0, Table arg1) {
- return ((Table)arg0).getName().compareTo(((Table)arg1).getName());
+ return arg0.getName().compareTo(arg1.getName());
}
});
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableModelList.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableModelList.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableModelList.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -28,13 +28,13 @@
/** simple list to be used in e.g. tables */
public abstract class TableModelList extends Observable {
- final protected List filters;
+ final protected List<Object> filters;
public TableModelList() {
- this(new ArrayList());
+ this(new ArrayList<Object>());
}
- public TableModelList(List queryParameterList) {
+ public TableModelList(List<Object> queryParameterList) {
filters = queryParameterList;
}
@@ -71,7 +71,7 @@
notifyObservers();
}
- public List getList() {
+ public List<Object> getList() {
return filters;
}
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableWorkbenchAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableWorkbenchAdapter.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/TableWorkbenchAdapter.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -37,14 +37,14 @@
public Object[] getChildren(Object o) {
Table t = getTable( o );
- List items = new ArrayList();
+ List<Object> items = new ArrayList<Object>();
PrimaryKey primaryKey = t.getPrimaryKey();
if(primaryKey!=null) {
items.add(primaryKey);
}
- Iterator columnIterator = t.getColumnIterator();
+ Iterator<?> columnIterator = t.getColumnIterator();
while ( columnIterator.hasNext() ) {
Column col = (Column) columnIterator.next();
if(primaryKey==null || !primaryKey.containsColumn(col)) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/AbstractGraphViewPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/AbstractGraphViewPart.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/AbstractGraphViewPart.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -89,7 +89,7 @@
IActionBars actionBars = getViewSite().getActionBars();
this.actionGroup.fillActionBars(actionBars);
- List zoomLevels = new ArrayList(3);
+ List<String> zoomLevels = new ArrayList<String>(3);
zoomLevels.add(ZoomManager.FIT_ALL);
zoomLevels.add(ZoomManager.FIT_WIDTH);
zoomLevels.add(ZoomManager.FIT_HEIGHT);
@@ -127,7 +127,7 @@
public Object getAdapter(Class adapter) {
if(adapter.equals(GraphicalViewer.class)) {
- return (GraphicalViewer)viewer;
+ return viewer;
}
return super.getAdapter( adapter );
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/RelationalGraphView.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/RelationalGraphView.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/RelationalGraphView.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -47,10 +47,10 @@
}
protected void selectionChanged(IStructuredSelection selection) {
- Iterator iterator = selection.iterator();
+ Iterator<Object> iterator = selection.iterator();
- List tables=new ArrayList();
+ List<TableViewAdapter> tables=new ArrayList<TableViewAdapter>();
ConfigurationViewAdapter cv = null;
while(iterator.hasNext()) {
Object o = iterator.next();
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/layout/ClusterEdgeCreator.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/layout/ClusterEdgeCreator.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/layout/ClusterEdgeCreator.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -45,9 +45,8 @@
EdgeList edgeList;
DirectedGraph graph;
- List edgesAdded;
- List encountered = new ArrayList();
- List clusters = new ArrayList();
+ List<Node> encountered = new ArrayList<Node>();
+ List<Cluster> clusters = new ArrayList<Cluster>();
Cluster currentCluster = null;
@@ -68,12 +67,11 @@
this.graph = graph;
this.nodeList = graph.nodes;
this.edgeList = graph.edges;
- edgesAdded = new ArrayList();
//iterate through all of the nodes in the node list
- for (Iterator iter = nodeList.iterator(); iter.hasNext();)
+ for (Iterator<Node> iter = nodeList.iterator(); iter.hasNext();)
{
- Node node = (Node) iter.next();
+ Node node = iter.next();
//check whether we have already come across this node
if (!encountered.contains(node))
@@ -95,13 +93,13 @@
}
}
- //System.out.println("Clusters: ");
- for (Iterator iter = clusters.iterator(); iter.hasNext();)
+ /*System.out.println("Clusters: ");
+ for (Iterator<Cluster> iter = clusters.iterator(); iter.hasNext();)
{
- Cluster cluster = (Cluster) iter.next();
- //System.out.println(cluster);
+ Cluster cluster = iter.next();
+ System.out.println(cluster);
- }
+ }*/
coalesceRemainingClusters();
@@ -136,25 +134,26 @@
Node targetNode = null;
//add an edge from each successive cluster to next
- for (Iterator iter = clusters.iterator(); iter.hasNext();)
+ for (Iterator<Cluster> iter = clusters.iterator(); iter.hasNext();)
{
- Cluster cluster = (Cluster) iter.next();
+ Cluster cluster = iter.next();
if (sourceNode != null)
{
//use first node in set as target node
- targetNode = (Node) cluster.set.get(0);
+ targetNode = cluster.set.get(0);
newDummyEdge(sourceNode, targetNode);
}
//set up source node for the next iteration using last node in
// set
- sourceNode = (Node) cluster.set.get(cluster.set.size() - 1);
+ sourceNode = cluster.set.get(cluster.set.size() - 1);
}
}
}
+
private void recursivelyAddToCluster(Node node, int depth)
{
@@ -164,9 +163,9 @@
{
depth++;
EdgeList incoming = node.incoming;
- for (Iterator iter = incoming.iterator(); iter.hasNext();)
+ for (Iterator<Edge> iter = incoming.iterator(); iter.hasNext();)
{
- Edge edge = (Edge) iter.next();
+ Edge edge = iter.next();
Node incomingNode = edge.source;
if (!encountered.contains(incomingNode))
@@ -228,7 +227,7 @@
static private class Cluster
{
- List set = new ArrayList();
+ List<Node> set = new ArrayList<Node>();
public String toString()
{
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/layout/DirectedGraphLayoutVisitor.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/layout/DirectedGraphLayoutVisitor.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/layout/DirectedGraphLayoutVisitor.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -207,7 +207,7 @@
if (nodes != null)
{
- List bends = new ArrayList();
+ List<AbsoluteBendpoint> bends = new ArrayList<AbsoluteBendpoint>();
for (int i = 0; i < nodes.size(); i++)
{
Node vn = nodes.getNode(i);
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/layout/DummyEdgeCreator.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/layout/DummyEdgeCreator.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/layout/DummyEdgeCreator.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -45,8 +45,8 @@
EdgeList edgeList;
DirectedGraph graph;
- List edgesAdded;
- List candidateList;
+ List<Edge> edgesAdded;
+ List<Node> candidateList;
int targetNodeIndex;
boolean cleanNextTime = false;
@@ -71,7 +71,7 @@
this.graph = graph;
this.nodeList = graph.nodes;
this.edgeList = graph.edges;
- edgesAdded = new ArrayList();
+ edgesAdded = new ArrayList<Edge>();
}
@@ -82,15 +82,13 @@
int nodeCount = nodeList.size();
- boolean addedEdge = false;
-
//if node count is only one then we don't have to worry about whether
// the nodes are connected
if (nodeCount > 1)
{
- for (Iterator iter = nodeList.iterator(); iter.hasNext();)
+ for (Iterator<Node> iter = nodeList.iterator(); iter.hasNext();)
{
- Node sourceNode = (Node) iter.next();
+ Node sourceNode = iter.next();
//we will need to set up a dummy relationship for any table not
// in one already
@@ -111,14 +109,11 @@
*/
private Edge newDummyEdge(Node targetNode, Node sourceNode)
{
- boolean addedEdge;
DummyEdgePart edgePart = new DummyEdgePart();
Edge edge = new Edge(edgePart, sourceNode, targetNode);
edge.weight = 2;
edgeList.add(edge);
- //targetNode = sourceNode;
- addedEdge = true;
return edge;
}
@@ -137,9 +132,9 @@
boolean relationshipFound = false;
//first look for set of targets which are already in relationships
- for (Iterator iter = nodeList.iterator(); iter.hasNext();)
+ for (Iterator<Node> iter = nodeList.iterator(); iter.hasNext();)
{
- Node element = (Node) iter.next();
+ Node element = iter.next();
if ((element.incoming.size() + element.outgoing.size()) >= 1)
{
candidateList.add(element);
@@ -157,13 +152,11 @@
else
{
- Comparator comparator = new Comparator()
+ Comparator<Node> comparator = new Comparator<Node>()
{
- public int compare(Object o1, Object o2)
+ public int compare(Node t1, Node t2)
{
- Node t1 = (Node) o1;
- Node t2 = (Node) o2;
return t1.incoming.size() - (t2.incoming.size());
}
@@ -201,14 +194,14 @@
else
targetNodeIndex++;
- return (Node) candidateList.get(targetNodeIndex);
+ return candidateList.get(targetNodeIndex);
}
protected void removeDummyEdges()
{
- for (Iterator iter = edgesAdded.iterator(); iter.hasNext();)
+ for (Iterator<Edge> iter = edgesAdded.iterator(); iter.hasNext();)
{
- Edge edge = (Edge) iter.next();
+ Edge edge = iter.next();
edgeList.remove(edge);
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/ConfigurationViewAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/ConfigurationViewAdapter.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/ConfigurationViewAdapter.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -34,8 +34,8 @@
public class ConfigurationViewAdapter extends Observable {
private final Configuration cfg;
- private Map persistentClasses; // key: name, value: PersistentClassViewAdapter
- private List selectedTables;
+ private Map<String, PersistentClassViewAdapter> persistentClasses; // key: name,
value: PersistentClassViewAdapter
+ private List<TableViewAdapter> selectedTables;
//private final Map sourceAssociations; // key: name, value: List of
AssociationViewAdapter
//private final Map targetAssociations; // key: name, value: List of
AssociationViewAdapter
@@ -46,30 +46,30 @@
//targetAssociations = new HashMap();
}
- public List getPersistentClasses() {
+ public List<PersistentClassViewAdapter> getPersistentClasses() {
if(persistentClasses==null) {
- Iterator classMappings = cfg.getClassMappings();
- persistentClasses = new HashMap();
+ Iterator<PersistentClass> classMappings = cfg.getClassMappings();
+ persistentClasses = new HashMap<String, PersistentClassViewAdapter>();
while ( classMappings.hasNext() ) {
- PersistentClass clazz = (PersistentClass) classMappings.next();
+ PersistentClass clazz = classMappings.next();
persistentClasses.put( clazz.getEntityName(), new PersistentClassViewAdapter(this,
clazz) );
}
- Iterator iterator = persistentClasses.values().iterator();
+ Iterator<PersistentClassViewAdapter> iterator =
persistentClasses.values().iterator();
while ( iterator.hasNext() ) {
- PersistentClassViewAdapter element = (PersistentClassViewAdapter) iterator.next();
+ PersistentClassViewAdapter element = iterator.next();
element.getSourceAssociations();
}
}
- return new ArrayList(persistentClasses.values());
+ return new ArrayList<PersistentClassViewAdapter>(persistentClasses.values());
}
public PersistentClassViewAdapter getPersistentClassViewAdapter(String
associatedEntityName) {
- return (PersistentClassViewAdapter) persistentClasses.get(associatedEntityName);
+ return persistentClasses.get(associatedEntityName);
}
- public List getSelectedTables() {
+ public List<TableViewAdapter> getSelectedTables() {
return selectedTables;
}
@@ -77,7 +77,7 @@
return cfg;
}
- public void setSelectedTables(List tables) {
+ public void setSelectedTables(List<TableViewAdapter> tables) {
selectedTables = tables;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/GraphNode.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/GraphNode.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/GraphNode.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -28,7 +28,7 @@
import org.eclipse.draw2d.geometry.Rectangle;
/**
- * base class for model elements in our views that are node-like and have a moveable
physical bound.
+ * base class for model elements in our views that are node-like and have a movable
physical bound.
*
* @author Max Rydahl Andersen
*
@@ -37,11 +37,11 @@
public static final String ASSOCIATONS = "ASSOCIATIONS"; //$NON-NLS-1$
private Rectangle bounds = new Rectangle( 0, 0, -1, -1 );
- protected List targetAssociations;
- protected List sourceAssociations;
+ protected List<AssociationViewAdapter> targetAssociations;
+ protected List<AssociationViewAdapter> sourceAssociations;
public GraphNode() {
- targetAssociations = new ArrayList();
+ targetAssociations = new ArrayList<AssociationViewAdapter>();
sourceAssociations = null; //lazily created
}
@@ -60,14 +60,14 @@
abstract public void createAssociations();
- public List getSourceAssociations() {
+ public List<AssociationViewAdapter> getSourceAssociations() {
checkAssociations();
return sourceAssociations;
}
private void checkAssociations() {
if(sourceAssociations==null) {
- sourceAssociations=new ArrayList();
+ sourceAssociations=new ArrayList<AssociationViewAdapter>();
createAssociations();
}
}
@@ -85,7 +85,7 @@
notifyObservers(ASSOCIATONS);
}
- public List getTargetAssociations() {
+ public List<AssociationViewAdapter> getTargetAssociations() {
return targetAssociations;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/PropertyViewAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/PropertyViewAdapter.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/PropertyViewAdapter.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -43,8 +43,8 @@
private final PersistentClassViewAdapter clazz;
- private List sourceAssociations;
- private List targetAssociations;
+ private List<PropertyAssociationViewAdapter> sourceAssociations;
+ private List<PropertyViewAdapter> targetAssociations;
public PropertyViewAdapter(PersistentClassViewAdapter clazz,
Property property) {
@@ -52,7 +52,7 @@
this.property = property;
this.configuration = clazz.getConfiguration();
this.sourceAssociations = null;
- this.targetAssociations = Collections.EMPTY_LIST;
+ this.targetAssociations = Collections.emptyList();
}
@@ -60,19 +60,19 @@
return property;
}
- public List getSourceConnections() {
+ public List<PropertyAssociationViewAdapter> getSourceConnections() {
checkConnections();
return sourceAssociations;
}
private void checkConnections() {
if(sourceAssociations==null) {
- sourceAssociations = new ArrayList();
+ sourceAssociations = new ArrayList<PropertyAssociationViewAdapter>();
createSingleEndedEnityAssociations();
}
}
- public List getTargetConnections() {
+ public List<PropertyViewAdapter> getTargetConnections() {
return targetAssociations;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/TableViewAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/TableViewAdapter.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/TableViewAdapter.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -48,11 +48,12 @@
return table;
}
- public List getColumns() {
- List result = new ArrayList();
- Iterator columnIterator = table.getColumnIterator();
+ @SuppressWarnings("unchecked")
+ public List<ColumnViewAdapter> getColumns() {
+ List<ColumnViewAdapter> result = new ArrayList<ColumnViewAdapter>();
+ Iterator<Column> columnIterator = table.getColumnIterator();
while ( columnIterator.hasNext() ) {
- Column element = (Column) columnIterator.next();
+ Column element = columnIterator.next();
result.add(new ColumnViewAdapter(this,element));
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/parts/PersistentClassEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/parts/PersistentClassEditPart.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/parts/PersistentClassEditPart.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -63,19 +63,20 @@
return
HibernateWorkbenchHelper.getLabelForClassName(getPersistentClass().getEntityName());
}
- protected List getModelChildren() {
+ @SuppressWarnings("unchecked")
+ protected List<PropertyViewAdapter> getModelChildren() {
- List list = new ArrayList();
+ List<PropertyViewAdapter> list = new ArrayList<PropertyViewAdapter>();
Property identifierProperty = getPersistentClass().getIdentifierProperty();
if(identifierProperty!=null) {
list.add( new PropertyViewAdapter(getPersistentClassViewAdapter(), identifierProperty
));
}
- Iterator propertyIterator = getPersistentClass().getPropertyIterator();
+ Iterator<Property> propertyIterator =
getPersistentClass().getPropertyIterator();
while ( propertyIterator.hasNext() ) {
- list.add( new PropertyViewAdapter(getPersistentClassViewAdapter(), (Property)
propertyIterator.next()) );
+ list.add( new PropertyViewAdapter(getPersistentClassViewAdapter(),
propertyIterator.next()) );
}
return list;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/DisplayStringProposalComparator.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/DisplayStringProposalComparator.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/DisplayStringProposalComparator.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -29,13 +29,11 @@
* Sort a comparator according to its display string.
* Use the INSTANCE variable to save memory/time.
*/
-public class DisplayStringProposalComparator implements Comparator {
+public class DisplayStringProposalComparator implements
Comparator<ICompletionProposal> {
- static final public Comparator INSTANCE = new DisplayStringProposalComparator();
+ static final public Comparator<ICompletionProposal> INSTANCE = new
DisplayStringProposalComparator();
- public int compare( Object o1, Object o2 ) {
- ICompletionProposal c1 = (ICompletionProposal) o1;
- ICompletionProposal c2 = (ICompletionProposal) o2;
+ public int compare( ICompletionProposal c1, ICompletionProposal c2 ) {
return c1.getDisplayString().compareTo( c2.getDisplayString() );
}
}
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/EclipseHQLCompletionRequestor.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/EclipseHQLCompletionRequestor.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/EclipseHQLCompletionRequestor.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.swt.graphics.Image;
import org.hibernate.console.ImageConstants;
import org.hibernate.eclipse.console.utils.EclipseImages;
@@ -34,7 +35,7 @@
public class EclipseHQLCompletionRequestor implements IHQLCompletionRequestor {
- private final List result = new ArrayList();
+ private final List<ICompletionProposal> result = new
ArrayList<ICompletionProposal>();
private String lastErrorMessage;
private final int virtualOffset;
@@ -46,7 +47,7 @@
this.virtualOffset = virtualOffset;
}
- public List getCompletionProposals() {
+ public List<ICompletionProposal> getCompletionProposals() {
return result;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCodeScanner.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCodeScanner.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCodeScanner.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -235,7 +235,7 @@
setDefaultReturnToken( otherToken );
- List rules = new ArrayList();
+ List<IRule> rules = new ArrayList<IRule>();
rules.add( new EndOfLineRule( "--", commentToken )); //$NON-NLS-1$
rules.add( new SingleLineRule( "'", "'", stringToken,
'\\' )); //$NON-NLS-1$ //$NON-NLS-2$
@@ -248,7 +248,7 @@
rules.add( wordRule );
- setRules( (IRule[]) rules.toArray( new IRule[ rules.size() ] ) );
+ setRules( rules.toArray( new IRule[ rules.size() ] ) );
}
private void addWordRules(final IToken token, WordRule wordRule, String[] reservedWords)
{
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -49,7 +49,7 @@
private char[] autoActivationChars = { '.' };
protected IContextInformationValidator validator = new
MinimalDiffContextInformationValidator(5);
- private final Comparator completionComparator;
+ private final Comparator<ICompletionProposal> completionComparator;
//private final HQLEditor editor;
private QueryEditor hqlEditor;
private String errorMessage;
@@ -95,7 +95,7 @@
errorMessage = null;
if (doc != null && currentOffset >= 0) {
- List proposalList = new ArrayList();
+ List<ICompletionProposal> proposalList = new
ArrayList<ICompletionProposal>();
String startWord = null;
int startOffset = findNearestWhiteSpace( doc, currentOffset, lineStart );
@@ -126,7 +126,7 @@
//findMatchingWords( currentOffset, proposalList, startWord,
HQLCodeScanner.getHQLKeywords(), "keyword" );
//findMatchingWords( currentOffset, proposalList, startWord,
HQLCodeScanner.getHQLFunctionNames(), "function");
- result = (ICompletionProposal[]) proposalList.toArray(new
ICompletionProposal[proposalList.size()]);
+ result = proposalList.toArray(new ICompletionProposal[proposalList.size()]);
if(result.length==0 && errorMessage==null) {
errorMessage =
HibernateConsoleMessages.HQLCompletionProcessor_no_hql_completions_available;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLPartitionScanner.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLPartitionScanner.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLPartitionScanner.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -116,7 +116,7 @@
public HQLPartitionScanner() {
super();
- List rules= new ArrayList();
+ List<IPredicateRule> rules= new ArrayList<IPredicateRule>();
// Add rules for comments, quoted literals, and delimited identifiers.
rules.add( new EndOfLineRule( "--", new Token( HQL_COMMENT )));
//$NON-NLS-1$
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/AddPropertyDialog.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/AddPropertyDialog.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/AddPropertyDialog.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -158,7 +158,7 @@
public Object[] getElements(Object inputElement) {
Iterator set = localEf.getDefaultExporterProperties().entrySet().iterator();
- List values = new ArrayList(4);
+ List<ExporterProperty> values = new ArrayList<ExporterProperty>(4);
while ( set.hasNext() ) {
Map.Entry element = (Map.Entry) set.next();
//if(!localEf.hasLocalValueFor((String) element.getKey())) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationMappingsTab.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationMappingsTab.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationMappingsTab.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -96,7 +96,7 @@
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
IPath[] mappings = getMappings();
- List l = new ArrayList();
+ List<String> l = new ArrayList<String>();
for (int i = 0; i < mappings.length; i++) {
IPath path = mappings[i];
l.add(path.toPortableString());
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -72,7 +72,7 @@
private String packageName;
private String outputPath;
private String templatePath;
- private List exporterFactories;
+ private List<ExporterFactory> exporterFactories;
private boolean autoManyToManyDetection;
private boolean autoOneToOneDetection;
@@ -120,19 +120,18 @@
return HibernateLaunchConstants.ATTR_EXPORTERS + "." + exporterId;
//$NON-NLS-1$
}
- private List readExporterFactories(ILaunchConfiguration configuration) throws
CoreException {
+ private List<ExporterFactory> readExporterFactories(ILaunchConfiguration
configuration) throws CoreException {
- List exporterNames =
configuration.getAttribute(HibernateLaunchConstants.ATTR_EXPORTERS, (List)null);
+ List<String> exporterNames =
configuration.getAttribute(HibernateLaunchConstants.ATTR_EXPORTERS,
(List<String>)null);
if(exporterNames!=null) {
- Map exDefinitions = ExtensionManager.findExporterDefinitionsAsMap();
- List factories = new ArrayList();
+ Map<String, ExporterDefinition> exDefinitions =
ExtensionManager.findExporterDefinitionsAsMap();
+ List<ExporterFactory> factories = new ArrayList<ExporterFactory>();
- for (Iterator iterator = exporterNames.iterator(); iterator.hasNext();) {
- String exporterId = (String) iterator.next();
+ for (String exporterId : exporterNames) {
String extensionId =
configuration.getAttribute(getLaunchAttributePrefix(exporterId) +
".extension_id", (String)null); //$NON-NLS-1$
- ExporterDefinition expDef = (ExporterDefinition) exDefinitions.get(extensionId);
+ ExporterDefinition expDef = exDefinitions.get(extensionId);
if(expDef==null) {
String out =
NLS.bind(HibernateConsoleMessages.ExporterAttributes_could_not_locate_exporter_for_in,
extensionId, configuration.getName());
throw new HibernateConsoleRuntimeException(out);
@@ -150,7 +149,7 @@
} else {
// fall back to old way of reading if list of exporters does not exist.
ExporterDefinition[] exDefinitions = ExtensionManager.findExporterDefinitions();
- List factories = new ArrayList();
+ List<ExporterFactory> factories = new ArrayList<ExporterFactory>();
for (int i = 0; i < exDefinitions.length; i++) {
ExporterDefinition expDef = exDefinitions[i];
@@ -171,7 +170,7 @@
List exporterFactories, Set enabledExporters, Set deletedExporterIds) {
- List names = new ArrayList();
+ List<String> names = new ArrayList<String>();
for (Iterator iter = exporterFactories.iterator(); iter.hasNext();) {
ExporterFactory ef = (ExporterFactory) iter.next();
configuration.setAttribute(getLaunchAttributePrefix(ef.getId()) +
".extension_id", ef.getExporterDefinition().getId()); //$NON-NLS-1$
@@ -343,7 +342,7 @@
this.useOwnTemplates = useOwnTemplates;
}
- public List getExporterFactories() {
+ public List<ExporterFactory> getExporterFactories() {
return exporterFactories;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterFactoryPropertySource.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterFactoryPropertySource.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterFactoryPropertySource.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -1,15 +1,11 @@
package org.hibernate.eclipse.launch;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.hibernate.eclipse.console.model.impl.ExporterFactory;
import org.hibernate.eclipse.console.model.impl.ExporterProperty;
@@ -28,15 +24,12 @@
}
public IPropertyDescriptor[] getPropertyDescriptors() {
- List descriptors = new ArrayList();
+ List<IPropertyDescriptor> descriptors = new
ArrayList<IPropertyDescriptor>();
- Map values = factory.getProperties();
+ Map<String, String> values = factory.getProperties();
// get the values we explicitly have
- Iterator iterator = values.keySet().iterator();
- while ( iterator.hasNext() ) {
- String key = (String) iterator.next();
-
+ for (String key : values.keySet()) {
ExporterProperty element = factory.getExporterProperty(key);
if(element!=null) {
@@ -60,7 +53,7 @@
}*/
- return (IPropertyDescriptor[]) descriptors.toArray(new IPropertyDescriptor[0]);
+ return descriptors.toArray(new IPropertyDescriptor[0]);
}
public Object getPropertyValue(Object id) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterSettingsTab.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterSettingsTab.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterSettingsTab.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -80,7 +80,6 @@
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySheetEntry;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.IPropertySourceProvider;
import org.eclipse.ui.views.properties.PropertySheetEntry;
@@ -104,9 +103,9 @@
private Button enableJDK5;
- private Set selectedExporters;
+ private Set<ExporterFactory> selectedExporters;
- private Set deletedExporterIds;
+ private Set<String> deletedExporterIds;
//private CheckboxTableViewer exporterTable;
@@ -135,8 +134,8 @@
* @see IDialogPage#createControl(Composite)
*/
public void createControl(Composite parent) {
- selectedExporters = new HashSet();
- deletedExporterIds = new HashSet();
+ selectedExporters = new HashSet<ExporterFactory>();
+ deletedExporterIds = new HashSet<String>();
final ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL |
SWT.V_SCROLL);
sc.setExpandHorizontal(true);
@@ -419,9 +418,7 @@
do {
duplicate = false;
initialCount++;
- Iterator iterator = observableFactoryList.getList().iterator();
- while(iterator.hasNext()) {
- ExporterFactory def = (ExporterFactory) iterator.next();
+ for (ExporterFactory def : observableFactoryList.getList()) {
if(def.getId().equals(""+initialCount)) { //$NON-NLS-1$
duplicate = true;
}
@@ -440,9 +437,8 @@
protected void handleRemove() {
IStructuredSelection selection = (IStructuredSelection)
getTableViewer().getSelection();
if (selection != null) {
- int numSelected= selection.size();
-
- Iterator iterator= selection.iterator();
+
+ Iterator<Object> iterator= selection.iterator();
while (iterator.hasNext() ) {
Object item= iterator.next();
observableFactoryList.remove((ExporterFactory)item);
@@ -465,7 +461,7 @@
int index= indices[i];
if (index < max) {
ExporterFactory data = (ExporterFactory) getTableViewer().getElementAt(index);
- observableFactoryList.moveTo(index + 1, (ExporterFactory)data);
+ observableFactoryList.moveTo(index + 1, data);
newSelection[i]= index + 1;
}
}
@@ -481,7 +477,7 @@
int index= indices[i];
if (index > 0) {
ExporterFactory data = (ExporterFactory) getTableViewer().getElementAt(index);
- observableFactoryList.moveTo(index - 1, (ExporterFactory)data);
+ observableFactoryList.moveTo(index - 1, data);
newSelection[i]= index - 1;
}
}
@@ -663,27 +659,26 @@
// Complete hack to get table to work with arbitrary exporters quickly.
static private class ObservableFactoryList {
- List underlyingList = new ArrayList();
+ List<ExporterFactory> underlyingList = new ArrayList<ExporterFactory>();
PropertyChangeSupport pcs = new PropertyChangeSupport(this);
- public ObservableFactoryList(List exporterFactories) {
+ public ObservableFactoryList(List<ExporterFactory> exporterFactories) {
underlyingList = exporterFactories;
}
public void moveTo(int i, ExporterFactory data) {
- underlyingList.remove((ExporterFactory) data);
+ underlyingList.remove(data);
remove(data);
underlyingList.add(i, data);
pcs.firePropertyChange("insertElement", Integer.valueOf(i), data);
//$NON-NLS-1$
-
}
void addPropertyChangeListener(PropertyChangeListener pcl) {
pcs.addPropertyChangeListener(pcl);
}
- public List getList() {
+ public List<ExporterFactory> getList() {
return Collections.unmodifiableList(underlyingList);
}
@@ -707,12 +702,12 @@
}
static private class ExporterLabelProvider implements ITableLabelProvider,
ILabelProvider {
- Map exp2img = new HashMap(); // not the most optimized but better
+ Map<String, Image> exp2img = new HashMap<String, Image>(); // not the most
optimized but better
// than having a finalize method.
public Image getColumnImage(Object element, int columnIndex) {
ExporterDefinition definition = getExporterDefinition(element);
- Image image = (Image) exp2img.get( definition.getId() );
+ Image image = exp2img.get( definition.getId() );
if ( image == null ) {
image = definition.getIconDescriptor().createImage();
exp2img.put( definition.getId(), image );
@@ -738,11 +733,8 @@
}
public void dispose() {
-
- Iterator iterator = exp2img.values().iterator();
- while ( iterator.hasNext() ) {
- Image img = (Image) iterator.next();
- if ( img != null ) {
+ for (Image img : exp2img.values()) {
+ if (img != null) {
img.dispose();
}
}
@@ -793,10 +785,8 @@
// hard-coded checks: this should be delegated to extension point that knows about the
different exporters.
//Iterator iterator = observableFactoryList.getList().iterator(); // check all
exporters
- Iterator iterator = selectedExporters.iterator(); // check only selected exporters
- while (iterator.hasNext()) {
- ExporterFactory ef = (ExporterFactory) iterator.next();
- String str = (String) ef.getProperties().get("outputdir"); //$NON-NLS-1$
+ for (ExporterFactory ef : selectedExporters) {// check only selected exporters
+ String str = ef.getProperties().get("outputdir"); //$NON-NLS-1$
String msg = null;
if(str!=null) {
msg = PathHelper.checkDirectory(str,
HibernateConsoleMessages.ExporterSettingsTab_output_directory_for + " " +
ef.getExporterDefinition().getDescription(), true); //$NON-NLS-1$
@@ -806,7 +796,7 @@
}
}
- str = (String) ef.getProperties().get("template_path"); //$NON-NLS-1$
+ str = ef.getProperties().get("template_path"); //$NON-NLS-1$
if(str!=null) {
msg = PathHelper.checkDirectory(str,
HibernateConsoleMessages.ExporterSettingsTab_template_directory_for + " " +
ef.getExporterDefinition().getDescription(), true); //$NON-NLS-1$
if(msg!=null) {
@@ -894,11 +884,10 @@
enableEJB3annotations.setSelection( attributes.isEJB3Enabled() );
enableJDK5.setSelection( attributes.isJDK5Enabled() );
- List exporterFactories = attributes.getExporterFactories();
+ List<ExporterFactory> exporterFactories = attributes.getExporterFactories();
observableFactoryList = new ObservableFactoryList(exporterFactories);
getExporterTable().setInput( observableFactoryList );
- for (Iterator iter = exporterFactories.iterator(); iter.hasNext();) {
- ExporterFactory exporterFactory = (ExporterFactory) iter.next();
+ for (ExporterFactory exporterFactory : exporterFactories) {
if ( exporterFactory.isEnabled() ) {
getExporterTable().setChecked( exporterFactory, true );
selectedExporters.add( exporterFactory );
@@ -996,7 +985,7 @@
configuration.setAttribute( HibernateLaunchConstants.ATTR_ENABLE_JDK5,
enableJDK5.getSelection() );
- List exporterFactories =
((ObservableFactoryList)getExporterTable().getInput()).getList();
+ List<ExporterFactory> exporterFactories =
((ObservableFactoryList)getExporterTable().getInput()).getList();
ExporterAttributes.saveExporterFactories(configuration, exporterFactories,
selectedExporters, deletedExporterIds);
deletedExporterIds.clear();
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/HibernateRefactoringUtil.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/HibernateRefactoringUtil.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/HibernateRefactoringUtil.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -378,9 +378,9 @@
if (changes.size() == 0) {
return null;
} else if (changes.size() == 1) {
- return (Change) changes.get(0);
+ return changes.get(0);
} else {
- return new CompositeChange(name, (Change[])changes.toArray(new
Change[changes.size()]));
+ return new CompositeChange(name, changes.toArray(new Change[changes.size()]));
}
}
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/nature/HibernateNature.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/nature/HibernateNature.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/nature/HibernateNature.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -76,10 +76,10 @@
//add builder to project
ICommand command = desc.newCommand();
command.setBuilderName(HibernateBuilder.BUILDER_ID);
- ArrayList list = new ArrayList();
+ List<ICommand> list = new ArrayList<ICommand>();
list.addAll(Arrays.asList(commands) );
list.add(command);
- desc.setBuildSpec( (ICommand[])list.toArray(new ICommand[]{}) );
+ desc.setBuildSpec( list.toArray(new ICommand[]{}) );
project.setDescription(desc, new NullProgressMonitor() );
}
}
@@ -116,13 +116,13 @@
}
}
- List tables = null;
+ List<Table> tables = null;
private ReadDatabaseMetaData job;
- public List getTables() {
+ public List<Table> getTables() {
ConsoleConfiguration ccfg = getDefaultConsoleConfiguration();
- if(ccfg==null) return Collections.EMPTY_LIST;
+ if(ccfg==null) return Collections.emptyList();
if(tables!=null) {
return tables;
@@ -134,7 +134,7 @@
} else if(job.getState()==Job.NONE) {
job.schedule();
}
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
}
@@ -147,6 +147,7 @@
this.ccfg = ccfg;
}
+ @SuppressWarnings("unchecked")
protected IStatus run(IProgressMonitor monitor) {
Configuration cfg = ccfg.buildWith(null, false);
final JDBCMetaDataConfiguration jcfg = new JDBCMetaDataConfiguration();
@@ -161,11 +162,11 @@
});
- List result = new ArrayList();
- Iterator tabs = jcfg.getTableMappings();
+ List<Table> result = new ArrayList<Table>();
+ Iterator<Table> tabs = jcfg.getTableMappings();
while (tabs.hasNext() ) {
- Table table = (Table) tabs.next();
+ Table table = tabs.next();
monitor.subTask(table.getName() );
result.add(table);
}
@@ -180,11 +181,11 @@
}
- public List getMatchingTables(String tableName) {
- List result = new ArrayList();
- Iterator tableMappings = getTables().iterator();
+ public List<Table> getMatchingTables(String tableName) {
+ List<Table> result = new ArrayList<Table>();
+ Iterator<Table> tableMappings = getTables().iterator();
while (tableMappings.hasNext() ) {
- Table table = (Table) tableMappings.next();
+ Table table = tableMappings.next();
if(table.getName().toUpperCase().startsWith(tableName.toUpperCase()) ) {
result.add(table);
}
@@ -195,9 +196,7 @@
public Table getTable(TableIdentifier nearestTableName) {
// TODO: can be made MUCH more efficient with proper indexing of the tables.
// TODO: handle catalog/schema properly
- Iterator tableMappings = getTables().iterator();
- while (tableMappings.hasNext() ) {
- Table table = (Table) tableMappings.next();
+ for (Table table : getTables()) {
if(nearestTableName.getName().equals(table.getName())) {
return table;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/DebugJavaCompletionProposalComputer.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/DebugJavaCompletionProposalComputer.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/DebugJavaCompletionProposalComputer.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -45,8 +45,8 @@
super();
}
- public List computeCompletionProposals(ContentAssistInvocationContext context,
IProgressMonitor monitor) {
- List proposals = new ArrayList();
+ public List<ICompletionProposal>
computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor
monitor) {
+ List<ICompletionProposal> proposals = new
ArrayList<ICompletionProposal>();
proposals.add( new CompletionProposal( "hibernate tools",
context.getInvocationOffset(), 7, context.getInvocationOffset()) ); //$NON-NLS-1$
CharSequence computeIdentifierPrefix = null;
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLDetector.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLDetector.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLDetector.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -23,7 +23,7 @@
public class HQLDetector extends ASTVisitor {
private final IFile resource;
- List problems = new ArrayList();
+ List<HQLProblem> problems = new ArrayList<HQLProblem>();
private final ConsoleConfiguration consoleConfiguration;
private final CompilationUnit cu;
@@ -33,11 +33,12 @@
this.resource = (IFile) resource;
}
+ @SuppressWarnings("unchecked")
public boolean visit(NormalAnnotation node) {
if(node.getTypeName().getFullyQualifiedName().endsWith( "NamedQuery" )) {
//$NON-NLS-1$
- Iterator iterator = node.values().iterator();
+ Iterator<MemberValuePair> iterator = node.values().iterator();
while ( iterator.hasNext() ) {
- MemberValuePair element = (MemberValuePair) iterator.next();
+ MemberValuePair element = iterator.next();
if(element.getName().getIdentifier().equals("query")) { //$NON-NLS-1$
Expression value = element.getValue();
if(value instanceof StringLiteral) {
@@ -115,7 +116,7 @@
}
- public List getProblems() {
+ public List<HQLProblem> getProblems() {
return problems;
}
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLExpressionCompilerParticipant.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLExpressionCompilerParticipant.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLExpressionCompilerParticipant.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -45,7 +45,7 @@
HQLDetector hqlDetector = new HQLDetector(cu, consoleConfiguration,
context.getFile());
node.accept(hqlDetector);
if(!hqlDetector.getProblems().isEmpty()) {
- CategorizedProblem[] toArray = (CategorizedProblem[])
hqlDetector.getProblems().toArray( new CategorizedProblem[0] );
+ CategorizedProblem[] toArray = hqlDetector.getProblems().toArray( new
CategorizedProblem[0] );
context.recordNewProblems( toArray );
}
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -32,6 +32,8 @@
import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContextInformation;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
@@ -63,8 +65,8 @@
return null;
}
}
- public List computeCompletionProposals(ContentAssistInvocationContext context,
IProgressMonitor monitor) {
- List proposals = new ArrayList();
+ public List<ICompletionProposal>
computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor
monitor) {
+ List<ICompletionProposal> proposals = new
ArrayList<ICompletionProposal>();
errorMessage = null;
if (!(context instanceof JavaContentAssistInvocationContext)) {
@@ -136,8 +138,8 @@
return start;
}
- public List computeContextInformation(ContentAssistInvocationContext context,
IProgressMonitor monitor) {
- return Collections.EMPTY_LIST;
+ public List<IContextInformation>
computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor
monitor) {
+ return Collections.emptyList();
}
public String getErrorMessage() {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLProblem.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLProblem.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLProblem.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -5,8 +5,7 @@
import org.eclipse.jdt.core.compiler.IProblem;
import org.hibernate.eclipse.jdt.ui.Activator;
-public class HQLProblem extends CategorizedProblem implements IProblem
-{
+public class HQLProblem extends CategorizedProblem {
private int startingOffset;
private int endingOffset;
private int line;
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 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -546,7 +546,7 @@
}
else if (type.isParameterizedType()) {
ParameterizedType pt = (ParameterizedType)type;
- Type typeP = (Type)pt.getType();
+ Type typeP = pt.getType();
ITypeBinding tb = typeP.resolveBinding();
if (tb != null) {
ITypeBinding[] interfaces = Utils.getAllInterfaces(tb);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -227,7 +227,7 @@
list.add(cps[i].getName());
}
Collections.sort(list);
- return (String[]) list.toArray(new String[list.size()]);
+ return list.toArray(new String[list.size()]);
}
private String getProjectConnectionProfileName() {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Group.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Group.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Group.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -10,12 +10,13 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.veditor.editors.autolayout.impl;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
public class Group {
LayuotConstants constants;
int number;
- List itemList = new ArrayList();
+ List<Integer> itemList = new ArrayList<Integer>();
Item[] allitems = null;
private int[] items = null;
int miny = -1;
@@ -66,7 +67,7 @@
if(items == null) {
items = new int[itemList.size()];
for (int i = 0; i < items.length; i++)
- items[i] = ((Integer)itemList.get(i)).intValue();
+ items[i] = itemList.get(i);
}
return items;
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Groups.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Groups.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Groups.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -15,7 +15,7 @@
public class Groups {
protected LayuotConstants constants;
static int FX = 30, FY = 120;
- List groups = new ArrayList();
+ List<Group> groups = new ArrayList<Group>();
Item[] items;
int[][] field;
int[] yDeltas = null;
@@ -79,7 +79,7 @@
miny = buildYForSingleComments();
boolean isSomethingSet = isSomethingSet();
for (int i = 0; i < groups.size(); i++) {
- Group group = (Group)groups.get(i);
+ Group group = groups.get(i);
if(group.items().length < 2) continue;
Item item = group.getItem(0);
if(item.yAssigned) continue;
@@ -98,7 +98,7 @@
int miny = 0;
int ix = 0;
for (int i = 0; i < groups.size(); i++) {
- Group group = (Group)groups.get(i);
+ Group group = groups.get(i);
if(group.items().length != 1) continue;
Item item = group.getItem(0);
if(!item.isComment()) continue;
@@ -120,7 +120,7 @@
private void buildYForSingles(int miny) {
int ix = 0;
for (int i = 0; i < groups.size(); i++) {
- Group group = (Group)groups.get(i);
+ Group group = groups.get(i);
if(group.items().length != 1 || group.miny >= 0) continue;
group.miny = miny;
Item item = group.getItem(0);
@@ -143,7 +143,7 @@
void buildXDeltasForSingles() {
int[] xDeltas = new int[100];
for (int i = 0; i < groups.size(); i++) {
- Group group = (Group)groups.get(i);
+ Group group = groups.get(i);
if(group.items().length != 1) continue;
group.xDeltas = xDeltas;
Item item = group.getItem(0);
@@ -160,7 +160,7 @@
public void buildDeltas() {
for (int i = 0; i < groups.size(); i++) {
- Group group = (Group)groups.get(i);
+ Group group = groups.get(i);
group.buildXDeltas();
}
buildYDeltas();
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Item.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Item.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Item.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -26,7 +26,7 @@
protected int[] inputs = new int[0];
protected int[] outputs = new int[0];
protected int[] comments = new int[0];
- protected ArrayList inputLinks = new ArrayList();
+ protected ArrayList<ILinkInfo> inputLinks = new ArrayList<ILinkInfo>();
protected boolean isOwned = false;
protected int weight = 0;
protected Group group = null;
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/TransitionArranger.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/TransitionArranger.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/TransitionArranger.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.veditor.editors.autolayout.impl;
-import java.util.ArrayList;
+import java.util.List;
import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.ILinkInfo;
@@ -103,9 +103,9 @@
}
private void apply(Item item, int tg) {
- ArrayList links = item.inputLinks;
+ List<ILinkInfo> links = item.inputLinks;
for (int k = 0; k < links.size(); k++) {
- ILinkInfo io = (ILinkInfo)links.get(k);
+ ILinkInfo io = links.get(k);
io.setLinkShape(new int[]{-1, 8 * (tg + 2)});
}
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ComponentShape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ComponentShape.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ComponentShape.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -36,14 +36,14 @@
protected void setChildsHiden(boolean hiden) {
for (int i = 0; i < getChildren().size(); i++)
- ((Shape)getChildren().get(i)).setHidden(hiden);
+ getChildren().get(i).setHidden(hiden);
}
public void refreshChildsHiden(OrmDiagram ormDiagram) {
refHide = !refHide;
for (int i = 0; i < getChildren().size(); i++)
- ((Shape)getChildren().get(i)).setHidden(!refHide);
+ getChildren().get(i).setHidden(!refHide);
if(refHide)
if(first){
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ModelElement.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ModelElement.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ModelElement.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -44,10 +44,10 @@
}
}
- private List children = new OList();
+ private List<Shape> children = new OList<Shape>();
private ModelElement parent;
- public List getChildren(){
+ public List<Shape> getChildren(){
return children;
}
@@ -129,12 +129,12 @@
// do nothing
}
- class OList extends ArrayList{
+ class OList<E> extends ArrayList<E>{
public OList(){
}
- public boolean add(Object item){
+ public boolean add(E item){
if(item instanceof ModelElement)((ModelElement)item).setParent(ModelElement.this);
return super.add(item);
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -71,10 +71,8 @@
entityNames[0] = ioe.getEntityName();
this.javaProject = javaProject;
- if (ioe instanceof RootClass) {
- String string = ""; //$NON-NLS-1$
- childrenLocations = string.split("#"); //$NON-NLS-1$
- }
+ childrenLocations = new String[]{new String("")}; //$NON-NLS-1$
+
getOrCreatePersistentClass(ormElements[0], null);
expandModel(this);
load();
@@ -91,10 +89,7 @@
entityNames[i] = ormElements[i].getEntityName();
}
this.javaProject = javaProject;
- if (ioe instanceof RootClass[]) {
- String string = ""; //$NON-NLS-1$
- childrenLocations = string.split("#"); //$NON-NLS-1$
- }
+ childrenLocations = new String[]{new String("")}; //$NON-NLS-1$
for (int i = 0; i < ormElements.length; i++) {
getOrCreatePersistentClass(ormElements[i], null);
}
@@ -119,8 +114,9 @@
return consoleConfiguration.getName() + "_" + name; //$NON-NLS-1$
}
- public HashMap getCloneElements() {
- return (HashMap)elements.clone();
+ @SuppressWarnings("unchecked")
+ public HashMap<String,OrmShape> getCloneElements() {
+ return (HashMap<String,OrmShape>)elements.clone();
}
public RootClass getOrmElement(int idx) {
@@ -166,7 +162,7 @@
refreshComponentReferences((ComponentShape)element);
}
for(int i=0; i <element.getChildren().size(); i++){
- expandModel((ModelElement)element.getChildren().get(i));
+ expandModel(element.getChildren().get(i));
}
}
@@ -188,7 +184,7 @@
OrmShape ormShape = null;
if (ormElement instanceof RootClass) {
String key =
HibernateUtils.getPersistentClassName(((RootClass)ormElement).getEntityName());
- ormShape = (OrmShape)elements.get(key);
+ ormShape = elements.get(key);
if (null == ormShape) {
ormShape = new OrmShape(ormElement);
getChildren().add(ormShape);
@@ -196,7 +192,7 @@
}
} else if (ormElement instanceof Table) {
String key = HibernateUtils.getTableName((Table)ormElement);
- ormShape = (OrmShape)elements.get(key);
+ ormShape = elements.get(key);
if (null == ormShape) {
ormShape = new OrmShape(ormElement);
getChildren().add(ormShape);
@@ -205,7 +201,7 @@
} else if (ormElement instanceof Property) {
SpecialRootClass specialRootClass = new SpecialRootClass((Property)ormElement);
String key = HibernateUtils.getPersistentClassName(specialRootClass.getEntityName());
- ormShape = (OrmShape)elements.get(key);
+ ormShape = elements.get(key);
if (null == ormShape) {
ormShape = new SpecialOrmShape(specialRootClass);
getChildren().add(ormShape);
@@ -213,7 +209,7 @@
}
} else if (ormElement instanceof Subclass) {
String key =
HibernateUtils.getPersistentClassName(((Subclass)ormElement).getEntityName());
- ormShape = (OrmShape)elements.get(key);
+ ormShape = elements.get(key);
if (null == ormShape) {
ormShape = new OrmShape(ormElement);
getChildren().add(ormShape);
@@ -239,6 +235,7 @@
}
+ @SuppressWarnings("unchecked")
private OrmShape getOrCreatePersistentClass(PersistentClass persistentClass, Table
componentClassDatabaseTable){
OrmShape classShape = null;
OrmShape shape = null;
@@ -285,12 +282,12 @@
OrmShape ownerTableShape =
getOrCreateDatabaseTable(((Subclass)element).getRootTable());
createConnections(subclassShape, ownerTableShape);
- Iterator joinIterator = subclass.getJoinIterator();
+ Iterator<Join> joinIterator = subclass.getJoinIterator();
while (joinIterator.hasNext()) {
- Join join = (Join)joinIterator.next();
- Iterator iterator = join.getPropertyIterator();
+ Join join = joinIterator.next();
+ Iterator<Property> iterator = join.getPropertyIterator();
while (iterator.hasNext()) {
- Property property = (Property)iterator.next();
+ Property property = iterator.next();
OrmShape tableShape = getOrCreateDatabaseTable(property.getValue().getTable());
createConnections(subclassShape, tableShape);
subclassShape.firePropertyChange(REFRESH, null, null);
@@ -327,9 +324,9 @@
Iterator joinIterator = persistentClass.getJoinIterator();
while (joinIterator.hasNext()) {
Join join = (Join)joinIterator.next();
- Iterator iterator = join.getPropertyIterator();
+ Iterator<Property> iterator = join.getPropertyIterator();
while (iterator.hasNext()) {
- Property property = (Property)iterator.next();
+ Property property = iterator.next();
OrmShape tableShape = getOrCreateDatabaseTable(property.getValue().getTable());
createConnections(classShape, tableShape);
classShape.firePropertyChange(REFRESH, null, null);
@@ -340,11 +337,12 @@
return classShape;
}
+ @SuppressWarnings("unchecked")
private OrmShape getOrCreateDatabaseTable(Table databaseTable){
OrmShape tableShape = null;
if(databaseTable != null) {
String tableName = HibernateUtils.getTableName(databaseTable);
- tableShape = (OrmShape)elements.get(tableName);
+ tableShape = elements.get(tableName);
if(tableShape == null) {
tableShape = createShape(databaseTable);
Iterator iterator = getConfiguration().getClassMappings();
@@ -364,15 +362,16 @@
return tableShape;
}
+ @SuppressWarnings("unchecked")
private void createConnections(ExpandeableShape persistentClass, ExpandeableShape
databaseTable){
int i = 0;
boolean check = (persistentClass.getOrmElement() instanceof SpecialRootClass);
- Iterator persistentFields = persistentClass.getChildren().iterator();
- List databaseColumns = databaseTable.getChildren();
- List databaseColumns2 = new ArrayList();
+ Iterator<Shape> persistentFields = persistentClass.getChildren().iterator();
+ List<Shape> databaseColumns = databaseTable.getChildren();
+ List<Shape> databaseColumns2 = new ArrayList<Shape>();
Iterator iterator = null;
while (persistentFields.hasNext()) {
- Shape shape = (Shape) persistentFields.next();
+ Shape shape = persistentFields.next();
Object element = shape.getOrmElement();
if (element instanceof Property && (!check ||
((SpecialRootClass)persistentClass.getOrmElement()).getParentProperty() != element)) {
Value value = ((Property)element).getValue();
@@ -382,8 +381,8 @@
if (o instanceof Column) {
Column databaseColumn = (Column)o;
for (int j = 0; j < databaseColumns.size(); j++) {
- if
(databaseColumn.getName().equals(((Column)((Shape)databaseColumns.get(j)).getOrmElement()).getName()))
{
- Shape databaseShape = (Shape)databaseColumns.remove(j);
+ if
(databaseColumn.getName().equals(((Column)(databaseColumns.get(j)).getOrmElement()).getName()))
{
+ Shape databaseShape = databaseColumns.remove(j);
if(!isConnectionExist(shape, databaseShape)){
new Connection(shape, databaseShape);
shape.firePropertyChange(REFRESH, null, null);
@@ -403,7 +402,7 @@
Connection conn;
if (source != null && source.getSourceConnections() != null) {
for(int i=0;i<source.getSourceConnections().size();i++){
- conn = (Connection)source.getSourceConnections().get(i);
+ conn = source.getSourceConnections().get(i);
if(conn.getTarget().equals(target)) return true;
}
}
@@ -469,6 +468,7 @@
}
+ @SuppressWarnings("unchecked")
protected void refreshComponentReferences(ComponentShape componentShape) {
OrmShape childShape = null;
Property property = (Property)componentShape.getOrmElement();
@@ -477,70 +477,79 @@
Collection collection = (Collection)property.getValue();
Value component = collection.getElement();
if (component instanceof Component) {// valueType.isComponentType()
- childShape = (OrmShape)elements.get(((Component)component).getComponentClassName());
+ childShape = elements.get(((Component)component).getComponentClassName());
if(childShape == null) childShape = getOrCreateComponentClass(property);
- SimpleValue value =
(SimpleValue)((Shape)componentShape.getChildren().get(0)).getOrmElement();
+ SimpleValue value =
(SimpleValue)(componentShape.getChildren().get(0)).getOrmElement();
OrmShape tableShape = getOrCreateDatabaseTable(value.getTable());
Iterator iterator = value.getColumnIterator();
while (iterator.hasNext()) {
- Column column = (Column)iterator.next();
- Shape colShape = tableShape.getChild(column);
- if(!isConnectionExist((Shape)(componentShape.getChildren().get(0)), colShape)){
- new Connection((Shape)(componentShape.getChildren().get(0)), colShape);
- ((Shape)(componentShape.getChildren().get(0))).firePropertyChange(REFRESH, null,
null);
- childShape.firePropertyChange(REFRESH, null, null);
+ Object o = iterator.next();
+ if (o instanceof Column) {
+ Column column = (Column)o;
+ Shape colShape = tableShape.getChild(column);
+ if(!isConnectionExist(componentShape.getChildren().get(0), colShape)){
+ new Connection(componentShape.getChildren().get(0), colShape);
+ (componentShape.getChildren().get(0)).firePropertyChange(REFRESH, null, null);
+ childShape.firePropertyChange(REFRESH, null, null);
+ }
}
}
- if(!isConnectionExist((Shape)(componentShape.getChildren().get(1)), childShape)){
- new Connection((Shape)(componentShape.getChildren().get(1)), childShape);
- ((Shape)(componentShape.getChildren().get(1))).firePropertyChange(REFRESH, null,
null);
+ if(!isConnectionExist(componentShape.getChildren().get(1), childShape)){
+ new Connection(componentShape.getChildren().get(1), childShape);
+ (componentShape.getChildren().get(1)).firePropertyChange(REFRESH, null, null);
childShape.firePropertyChange(REFRESH, null, null);
}
} else if (collection.isOneToMany()) {
childShape = getOrCreateAssociationClass(property);
if (childShape == null) return;
- if(!isConnectionExist((Shape)(componentShape.getChildren().get(1)), childShape)){
- new Connection((Shape)(componentShape.getChildren().get(1)), childShape);
- ((Shape)(componentShape.getChildren().get(1))).firePropertyChange(REFRESH, null,
null);
+ if(!isConnectionExist(componentShape.getChildren().get(1), childShape)){
+ new Connection(componentShape.getChildren().get(1), childShape);
+ (componentShape.getChildren().get(1)).firePropertyChange(REFRESH, null, null);
childShape.firePropertyChange(REFRESH, null, null);
}
OrmShape keyTableShape = getOrCreateDatabaseTable(collection.getKey().getTable());
Iterator iter = collection.getKey().getColumnIterator();
while (iter.hasNext()) {
- Column col = (Column)iter.next();
- Shape keyColumnShape = keyTableShape.getChild(col);
- if (keyColumnShape != null &&
!isConnectionExist((Shape)(componentShape.getChildren().get(0)), keyColumnShape)){
- new Connection((Shape)(componentShape.getChildren().get(0)), keyColumnShape);
- ((Shape)(componentShape.getChildren().get(0))).firePropertyChange(REFRESH, null,
null);
- keyColumnShape.firePropertyChange(REFRESH, null, null);
+ Object o = iter.next();
+ if (o instanceof Column) {
+ Column col = (Column)o;
+ Shape keyColumnShape = keyTableShape.getChild(col);
+ if (keyColumnShape != null &&
!isConnectionExist(componentShape.getChildren().get(0), keyColumnShape)){
+ new Connection(componentShape.getChildren().get(0), keyColumnShape);
+ (componentShape.getChildren().get(0)).firePropertyChange(REFRESH, null, null);
+ keyColumnShape.firePropertyChange(REFRESH, null, null);
+ }
}
}
} else /* if (collection.isMap() || collection.isSet()) */ {
childShape = getOrCreateDatabaseTable(collection.getCollectionTable());
- Iterator columnIterator =
((DependantValue)((Shape)componentShape.getChildren().get(0)).getOrmElement()).getColumnIterator();
+ Iterator columnIterator =
((DependantValue)componentShape.getChildren().get(0).getOrmElement()).getColumnIterator();
while (columnIterator.hasNext()) {
- Shape keyShape = childShape.getChild((Column)(columnIterator.next()));
- if(!isConnectionExist((Shape)componentShape.getChildren().get(0), keyShape)){
- new Connection((Shape)componentShape.getChildren().get(0), keyShape);
- ((Shape)componentShape.getChildren().get(0)).firePropertyChange(REFRESH, null,
null);
- keyShape.firePropertyChange(REFRESH, null, null);
+ Object o = columnIterator.next();
+ if (o instanceof Column) {
+ Shape keyShape = childShape.getChild((Column)o);
+ if(!isConnectionExist(componentShape.getChildren().get(0), keyShape)){
+ new Connection(componentShape.getChildren().get(0), keyShape);
+ (componentShape.getChildren().get(0)).firePropertyChange(REFRESH, null, null);
+ keyShape.firePropertyChange(REFRESH, null, null);
+ }
}
}
- Iterator iter =
((SimpleValue)((Shape)componentShape.getChildren().get(1)).getOrmElement()).getColumnIterator();
+ Iterator iter =
((SimpleValue)(componentShape.getChildren().get(1)).getOrmElement()).getColumnIterator();
while (iter.hasNext()) {
Object element = iter.next();
if (element instanceof Column) {
Column col = (Column)element;
Shape elementShape = childShape.getChild(col);
- if(!isConnectionExist((Shape)componentShape.getChildren().get(1), elementShape)){
- new Connection((Shape)componentShape.getChildren().get(1), elementShape);
- ((Shape)componentShape.getChildren().get(1)).firePropertyChange(REFRESH, null,
null);
+ if(!isConnectionExist(componentShape.getChildren().get(1), elementShape)){
+ new Connection(componentShape.getChildren().get(1), elementShape);
+ (componentShape.getChildren().get(1)).firePropertyChange(REFRESH, null, null);
elementShape.firePropertyChange(REFRESH, null, null);
}
}
@@ -560,7 +569,7 @@
Component component = (Component)((Collection)property.getValue()).getElement();
if (component != null) {
classShape = createShape(property);
- OrmShape tableShape =
(OrmShape)elements.get(HibernateUtils.getTableName(component.getTable()));
+ OrmShape tableShape =
elements.get(HibernateUtils.getTableName(component.getTable()));
if (tableShape == null) tableShape =
getOrCreateDatabaseTable(component.getTable());
createConnections(classShape, tableShape);
if(!isConnectionExist(classShape, tableShape)){
@@ -570,7 +579,7 @@
}
Shape parentShape = ((SpecialOrmShape)classShape).getParentShape();
if (parentShape != null) {
- OrmShape parentClassShape =
(OrmShape)elements.get(HibernateUtils.getPersistentClassName(((Property)parentShape.getOrmElement()).getPersistentClass().getEntityName()));
+ OrmShape parentClassShape =
elements.get(HibernateUtils.getPersistentClassName(((Property)parentShape.getOrmElement()).getPersistentClass().getEntityName()));
if(!isConnectionExist(parentShape, parentClassShape)){
new Connection(parentShape, parentClassShape);
parentShape.firePropertyChange(REFRESH, null, null);
@@ -579,7 +588,7 @@
}
}
} else if (property.getValue() instanceof Component) {
- classShape =
(OrmShape)elements.get(((Component)property.getValue()).getComponentClassName());
+ classShape = elements.get(((Component)property.getValue()).getComponentClassName());
if (classShape == null) classShape = createShape(property);
}
}
@@ -593,7 +602,7 @@
if (component.getAssociatedClass() instanceof RootClass) {
classShape = getOrCreatePersistentClass(component.getAssociatedClass(), null);
if (classShape == null) classShape = createShape(component.getAssociatedClass());
- OrmShape tableShape =
(OrmShape)elements.get(HibernateUtils.getTableName(component.getAssociatedClass().getTable()));
+ OrmShape tableShape =
elements.get(HibernateUtils.getTableName(component.getAssociatedClass().getTable()));
if (tableShape == null) tableShape =
getOrCreateDatabaseTable(component.getAssociatedClass().getTable());
createConnections(classShape, tableShape);
if(!isConnectionExist(classShape, tableShape)){
@@ -640,7 +649,7 @@
}
for(int i=0;i<shape.getChildren().size();i++){
- propertiesInit(properties, (ModelElement)shape.getChildren().get(i));
+ propertiesInit(properties, shape.getChildren().get(i));
}
}
@@ -657,7 +666,7 @@
setState(properties, (Shape)shape, state);
}
for(int i=0;i<shape.getChildren().size();i++){
- storeProperties(properties, (Shape)shape.getChildren().get(i));
+ storeProperties(properties, shape.getChildren().get(i));
}
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -35,6 +35,7 @@
generate();
}
+ @SuppressWarnings("unchecked")
protected void generate() {
Shape bodyOrmShape;
Object ormElement = getOrmElement();
@@ -49,17 +50,17 @@
if (identifier instanceof Component) {
Component component = (Component)identifier;
if (component.isEmbedded()) {
- Iterator iterator = ((Component)identifier).getPropertyIterator();
+ Iterator<Property> iterator = ((Component)identifier).getPropertyIterator();
while (iterator.hasNext()) {
- Property property = (Property) iterator.next();
+ Property property = iterator.next();
getChildren().add(new Shape(property));
}
}
}
- Iterator iterator = rootClass.getPropertyIterator();
+ Iterator<Property> iterator = rootClass.getPropertyIterator();
while (iterator.hasNext()) {
- Property field = (Property)iterator.next();
+ Property field = iterator.next();
if (!field.isBackRef()) {
if (!field.isComposite()) {
boolean typeIsAccessible = true;
@@ -96,16 +97,16 @@
KeyValue identifier = rootClass.getIdentifier();
if (identifier instanceof Component) {
- Iterator iterator = ((Component)identifier).getPropertyIterator();
+ Iterator<Property> iterator = ((Component)identifier).getPropertyIterator();
while (iterator.hasNext()) {
- Property property = (Property) iterator.next();
+ Property property = iterator.next();
getChildren().add(new Shape(property));
}
}
- Iterator iterator = rootClass.getPropertyIterator();
+ Iterator<Property> iterator = rootClass.getPropertyIterator();
while (iterator.hasNext()) {
- Property field = (Property)iterator.next();
+ Property field = iterator.next();
if (!field.isBackRef()) {
if (!field.isComposite()) {
@@ -135,9 +136,9 @@
}
}
}
- Iterator iter = ((Subclass)ormElement).getPropertyIterator();
+ Iterator<Property> iter = ((Subclass)ormElement).getPropertyIterator();
while (iter.hasNext()) {
- Property property = (Property)iter.next();
+ Property property = iter.next();
if (!property.isBackRef()) {
if (!property.isComposite()) {
@@ -174,37 +175,32 @@
}
public Shape getChild(Column ormElement) {
- Shape shape = null;
- Iterator iter = getChildren().iterator();
- while (iter.hasNext()) {
- Shape child = (Shape)iter.next();
+ for (Shape child : getChildren()) {
Object childElement = child.getOrmElement();
if (childElement instanceof Column &&
ormElement.getName().equals(((Column)childElement).getName())) {
return child;
}
}
- return shape;
+ return null;
}
public Shape getChild(Property ormElement) {
- Shape shape = null;
if (ormElement != null) {
- Iterator iter = getChildren().iterator();
- while (iter.hasNext()) {
- Shape child = (Shape)iter.next();
+ for (Shape child : getChildren()) {
Object childElement = child.getOrmElement();
if (childElement instanceof Property &&
ormElement.getName().equals(((Property)childElement).getName())) {
return child;
}
}
}
- return shape;
+ return null;
}
protected void setHidden(boolean hiden) {
super.setHidden(hiden);
- for (int i = 0; i < getChildren().size(); i++)
- ((Shape)getChildren().get(i)).setHidden(hiden);
+ for (Shape child : getChildren()) {
+ child.setHidden(hiden);
+ }
}
public void refreshHiden() {
@@ -218,9 +214,9 @@
}
private void setElementHidden(ModelElement element, boolean hidden){
- for (int i = 0; i < element.getChildren().size(); i++){
- ((Shape)element.getChildren().get(i)).setHidden(hidden);
- setElementHidden((ModelElement)element.getChildren().get(i), hidden);
+ for (Shape child : element.getChildren()) {
+ child.setHidden(hidden);
+ setElementHidden(child, hidden);
}
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/Shape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/Shape.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/Shape.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -140,9 +140,9 @@
protected void setHidden(boolean hiden) {
for (int i = 0; i < sourceConnections.size(); i++)
- ((Connection)sourceConnections.get(i)).setHidden(hiden);
+ sourceConnections.get(i).setHidden(hiden);
for (int i = 0; i < targetConnections.size(); i++)
- ((Connection)targetConnections.get(i)).setHidden(hiden);
+ targetConnections.get(i).setHidden(hiden);
}
/**
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -279,7 +279,7 @@
class DiagramInfo implements IDiagramInfo {
- ArrayList items = new ArrayList();
+ List<IItemInfo> items = new ArrayList<IItemInfo>();
OrmDiagram diagram;
public DiagramInfo(OrmDiagram diagram) {
@@ -302,7 +302,7 @@
*
*/
public IItemInfo[] getItems() {
- return (IItemInfo[]) items.toArray(new IItemInfo[0]);
+ return items.toArray(new IItemInfo[0]);
}
/**
@@ -317,7 +317,7 @@
class DiagramElementInfo implements IItemInfo {
OrmShape element;
- ArrayList links = new ArrayList();
+ List<ILinkInfo> links = new ArrayList<ILinkInfo>();
/**
*
@@ -326,21 +326,19 @@
public DiagramElementInfo(OrmShape element) {
ILinkInfo link;
this.element = element;
- for (int i = 0; i < element.getSourceConnections().size(); i++) {
- link = new LinkInfo((Connection) element.getSourceConnections()
- .get(i));
+ for (Connection connection : element.getSourceConnections()) {
+ link = new LinkInfo(connection);
addLink(link);
}
Shape child;
for (int j = 0; j < element.getChildren().size(); j++) {
- child = (Shape) element.getChildren().get(j);
+ child = element.getChildren().get(j);
if (child.getSourceConnections().size() == 0) {
link = new LinkInfo(getID());
addLink(link);
}
for (int i = 0; i < child.getSourceConnections().size(); i++) {
- link = new LinkInfo((Connection) child
- .getSourceConnections().get(i));
+ link = new LinkInfo(child.getSourceConnections().get(i));
addLink(link);
}
}
@@ -384,7 +382,7 @@
*
*/
public ILinkInfo[] getLinks() {
- return (ILinkInfo[]) links.toArray(new ILinkInfo[0]);
+ return links.toArray(new ILinkInfo[0]);
}
/**
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -87,7 +87,7 @@
getFigure().setForegroundColor(ResourceManager.getInstance().getColor(new
RGB(0,0,0)));
}
}else if (ExpandeableShape.SHOW_REFERENCES.equals(prop)) {
- refreshReferences((Shape)getCastedModel(),
((ExpandeableShape)getCastedModel()).isReferenceVisible());
+ refreshReferences(getCastedModel(),
((ExpandeableShape)getCastedModel()).isReferenceVisible());
((TitleLabel)getFigure()).setHidden(!((ExpandeableShape)getCastedModel()).isReferenceVisible());
} else {
super.propertyChange(evt);
@@ -137,8 +137,8 @@
OrmEditPart shapePart = (OrmEditPart)getViewer().getEditPartRegistry().get(shape);
for(int i=0;i<shape.getSourceConnections().size();i++){
- link = (Connection)shape.getSourceConnections().get(i);
- refShape = (OrmShape)link.getTarget().getOrmShape();
+ link = shape.getSourceConnections().get(i);
+ refShape = link.getTarget().getOrmShape();
if(refShape == null) continue;
if(!isReferencesCorrect(refShape)) continue;
@@ -157,7 +157,7 @@
referenceList.add(shape.getOrmShape());
for(int i=0;i<shape.getChildren().size();i++){
- refreshReferences((Shape)shape.getChildren().get(i), visible);
+ refreshReferences(shape.getChildren().get(i), visible);
}
referenceList.remove(shape.getOrmShape());
shape.getOrmDiagram().update();
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmEditPart.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmEditPart.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -16,6 +16,7 @@
import java.util.Map;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartListener;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
@@ -52,28 +53,29 @@
protected void createEditPolicies() {
}
+ @SuppressWarnings("unchecked")
protected void refreshSourceConnections() {
int i;
org.eclipse.gef.ConnectionEditPart editPart;
Object model;
- Map modelToEditPart = new HashMap();
- List editParts = getSourceConnections();
+ Map<Object, ConnectionEditPart> modelToEditPart = new HashMap<Object,
ConnectionEditPart>();
+ List<ConnectionEditPart> editParts = getSourceConnections();
for (i = 0; i < editParts.size(); i++) {
- editPart = (ConnectionEditPart) editParts.get(i);
+ editPart = editParts.get(i);
modelToEditPart.put(editPart.getModel(), editPart);
}
- List modelObjects = getModelSourceConnections();
+ List<Object> modelObjects = getModelSourceConnections();
if (modelObjects == null)
- modelObjects = new ArrayList();
+ modelObjects = new ArrayList<Object>();
for (i = 0; i < modelObjects.size(); i++) {
model = modelObjects.get(i);
if (i < editParts.size()) {
- editPart = (ConnectionEditPart) editParts.get(i);
+ editPart = editParts.get(i);
if (editPart.getModel() == model) {
if (editPart.getSource() != this)
editPart.setSource(this);
@@ -81,7 +83,7 @@
}
}
- editPart = (ConnectionEditPart) modelToEditPart.get(model);
+ editPart = modelToEditPart.get(model);
if (editPart != null)
reorderSourceConnection(editPart, i);
else {
@@ -91,36 +93,36 @@
}
// Remove the remaining EditParts
- List trash = new ArrayList();
+ List<ConnectionEditPart> trash = new ArrayList<ConnectionEditPart>();
for (; i < editParts.size(); i++)
trash.add(editParts.get(i));
for (i = 0; i < trash.size(); i++)
- removeSourceConnection((ConnectionEditPart) trash.get(i));
+ removeSourceConnection(trash.get(i));
}
+ @SuppressWarnings("unchecked")
protected void refreshTargetConnections() {
int i;
org.eclipse.gef.ConnectionEditPart editPart;
Object model;
- Map mapModelToEditPart = new HashMap();
- List connections = getTargetConnections();
+ Map<Object, ConnectionEditPart> mapModelToEditPart = new HashMap<Object,
ConnectionEditPart>();
+ List<ConnectionEditPart> connections = getTargetConnections();
for (i = 0; i < connections.size(); i++) {
- editPart = (ConnectionEditPart) connections.get(i);
+ editPart = connections.get(i);
mapModelToEditPart.put(editPart.getModel(), editPart);
}
- List modelObjects = getModelTargetConnections();
+ List<?> modelObjects = getModelTargetConnections();
if (modelObjects == null)
- modelObjects = new ArrayList();
+ modelObjects = new ArrayList<Object>();
for (i = 0; i < modelObjects.size(); i++) {
model = modelObjects.get(i);
if (i < connections.size()) {
- editPart = (org.eclipse.gef.ConnectionEditPart) connections
- .get(i);
+ editPart = connections.get(i);
if (editPart.getModel() == model) {
if (editPart.getTarget() != this)
editPart.setTarget(this);
@@ -128,8 +130,7 @@
}
}
- editPart = (org.eclipse.gef.ConnectionEditPart) mapModelToEditPart
- .get(model);
+ editPart = mapModelToEditPart.get(model);
if (editPart != null)
reorderTargetConnection(editPart, i);
else {
@@ -139,11 +140,11 @@
}
// Remove the remaining Connection EditParts
- List trash = new ArrayList();
+ List<ConnectionEditPart> trash = new ArrayList<ConnectionEditPart>();
for (; i < connections.size(); i++)
trash.add(connections.get(i));
for (i = 0; i < trash.size(); i++)
- removeTargetConnection((ConnectionEditPart) trash.get(i));
+ removeTargetConnection(trash.get(i));
}
protected void removeSourceConnection(ConnectionEditPart connection) {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ResourceManager.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ResourceManager.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ResourceManager.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -34,15 +34,15 @@
private ResourceManager() {};
private void dispose() {
- Iterator e = fColorTable.values().iterator();
+ Iterator<Color> e = fColorTable.values().iterator();
while (e.hasNext())
- ((Color) e.next()).dispose();
- e = fFontTable.values().iterator();
- while (e.hasNext())
- ((Font) e.next()).dispose();
+ e.next().dispose();
+ Iterator<Font> e2 = fFontTable.values().iterator();
+ while (e2.hasNext())
+ e2.next().dispose();
}
public Color getColor(RGB rgb) {
- Color color = (Color) fColorTable.get(rgb);
+ Color color = fColorTable.get(rgb);
if (color == null) {
color = new Color(Display.getCurrent(), rgb);
fColorTable.put(rgb, color);
@@ -51,7 +51,7 @@
}
public Font getFont(FontData fontData) {
- Font font = (Font) fFontTable.get(fontData);
+ Font font = fFontTable.get(fontData);
if (font == null) {
font = new Font(Display.getCurrent(), fontData);
fFontTable.put(fontData, font);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -109,10 +109,10 @@
if(RequestConstants.REQ_OPEN.equals(req.getType())) {
if (getCastedModel().getOrmElement() instanceof Column) {
if(getCastedModel().getTargetConnections().size() > 0)
- ((Connection)getCastedModel().getTargetConnections().get(0)).getSource().setFocus();
+ getCastedModel().getTargetConnections().get(0).getSource().setFocus();
} else {
if(getCastedModel().getSourceConnections().size() > 0)
- ((Connection)getCastedModel().getSourceConnections().get(0)).getTarget().setFocus();
+ getCastedModel().getSourceConnections().get(0).getTarget().setFocus();
}
}
}
@@ -135,11 +135,11 @@
return (Shape) getModel();
}
- protected List getModelSourceConnections() {
+ protected List<Connection> getModelSourceConnections() {
return getCastedModel().getSourceConnections();
}
- protected List getModelTargetConnections() {
+ protected List<Connection> getModelTargetConnections() {
return getCastedModel().getTargetConnections();
}
@@ -272,7 +272,6 @@
protected Object getElement() {
Object element = getCastedModel().getOrmElement();
- if (element instanceof SpecialRootClass) element = (RootClass)element;
return element;
}
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -23,7 +23,7 @@
static class CCListener implements KnownConfigurationsListener {
- List added = new ArrayList();
+ List<ConsoleConfiguration> added = new ArrayList<ConsoleConfiguration>();
public void configurationAdded(ConsoleConfiguration root) {
added.add(root);
@@ -104,11 +104,6 @@
return ConsoleTestMessages.KnownConfigurationsTest_fake_prefs;
}
- public boolean useAnnotations() {
- // TODO Auto-generated method stub
- return false;
- }
-
public String getEntityResolverName() {
// TODO Auto-generated method stub
return null;
@@ -188,11 +183,6 @@
return name;
}
- public boolean useAnnotations() {
- // TODO Auto-generated method stub
- return false;
- }
-
public String getEntityResolverName() {
// TODO Auto-generated method stub
return null;
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/ProjectUtil.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/ProjectUtil.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/ProjectUtil.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -200,14 +200,14 @@
*/
public static ITextEditor[] getTextEditors(IEditorPart editorPart) {
if (editorPart instanceof MultiPageEditorPart) {
- List testEditors = new ArrayList();
+ List<IEditorPart> testEditors = new ArrayList<IEditorPart>();
IEditorPart[] editors = ((MultiPageEditorPart)
editorPart).findEditors(editorPart.getEditorInput());
for (int i = 0; i < editors.length; i++) {
if (editors[i] instanceof ITextEditor){
testEditors.add(editors[i]);
}
}
- return (ITextEditor[])testEditors.toArray(new ITextEditor[0]);
+ return testEditors.toArray(new ITextEditor[0]);
} else if (editorPart instanceof ITextEditor){
return new ITextEditor[]{(ITextEditor) editorPart};
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/xpl/JavaProjectHelper.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/xpl/JavaProjectHelper.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/xpl/JavaProjectHelper.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -20,6 +20,7 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.List;
import java.util.Map;
import java.util.zip.ZipFile;
@@ -506,14 +507,14 @@
public static void removeFromClasspath(IJavaProject jproject, IPath path) throws
JavaModelException {
IClasspathEntry[] oldEntries= jproject.getRawClasspath();
int nEntries= oldEntries.length;
- ArrayList list= new ArrayList(nEntries);
+ List<IClasspathEntry> list= new ArrayList<IClasspathEntry>(nEntries);
for (int i= 0 ; i < nEntries ; i++) {
IClasspathEntry curr= oldEntries[i];
if (!path.equals(curr.getPath())) {
list.add(curr);
}
}
- IClasspathEntry[] newEntries= (IClasspathEntry[])list.toArray(new
IClasspathEntry[list.size()]);
+ IClasspathEntry[] newEntries= list.toArray(new IClasspathEntry[list.size()]);
jproject.setRawClasspath(newEntries, null);
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -158,7 +158,7 @@
assertEquals(1, hqlDetector.getProblems().size());
- HQLProblem hqlProblem = (HQLProblem) hqlDetector.getProblems().get(0);
+ HQLProblem hqlProblem = hqlDetector.getProblems().get(0);
assertTrue(hqlProblem.getMessage().contains("from Unknown")); //$NON-NLS-1$
}
Modified:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java
===================================================================
---
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -55,7 +55,7 @@
IProject[] projects = new IProject[projectPaths.length];
JobUtils.waitForIdle();
for (int i = 0; i < projectPaths.length; i++) {
- projects[i] = (IProject)ResourcesUtils.importProject(bundleName, projectPaths[i]);
+ projects[i] = ResourcesUtils.importProject(bundleName, projectPaths[i]);
JobUtils.waitForIdle();
}
return projects;
Modified:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/xpl/EditorTestHelper.java
===================================================================
---
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/xpl/EditorTestHelper.java 2009-05-21
14:33:31 UTC (rev 15389)
+++
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/xpl/EditorTestHelper.java 2009-05-21
15:00:41 UTC (rev 15390)
@@ -247,14 +247,14 @@
public static IFile[] findFiles(IResource resource) throws CoreException {
- List files= new ArrayList();
+ List<IFile> files= new ArrayList<IFile>();
findFiles(resource, files);
- return (IFile[]) files.toArray(new IFile[files.size()]);
+ return files.toArray(new IFile[files.size()]);
}
- private static void findFiles(IResource resource, List files) throws CoreException {
+ private static void findFiles(IResource resource, List<IFile> files) throws
CoreException {
if (resource instanceof IFile) {
- files.add(resource);
+ files.add((IFile) resource);
return;
}
if (resource instanceof IContainer) {