Skip to content

Commit

Permalink
Fix eclipse java related warnings
Browse files Browse the repository at this point in the history
* Removes unnecessary imports

* Removes unnecessary casts
  • Loading branch information
Paul Richardson committed Jul 13, 2012
1 parent 18caec7 commit 62dd150
Show file tree
Hide file tree
Showing 57 changed files with 76 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.eclipse.datatools.connectivity.ui.wizards.ExtensibleNewConnectionProfileWizard;
import org.eclipse.datatools.connectivity.ui.wizards.IDriverUIContributorInformation;
import org.eclipse.datatools.help.HelpUtil;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.layout.GridLayout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package org.teiid.designer.advisor.ui.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.INewWizard;
Expand Down Expand Up @@ -43,9 +42,9 @@ public NewConnectionProfileAction(String categoryId, String text, String tooltip
}

public void execute(String profileCategoryId) {
INewWizard wiz = (INewWizard) new NewTeiidFilteredCPWizard(profileCategoryId);
INewWizard wiz = new NewTeiidFilteredCPWizard(profileCategoryId);

WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(), (Wizard) wiz);
WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
//wizardDialog.setBlockOnOpen(true);
wizardDialog.open();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.Properties;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ public void widgetSelected( final SelectionEvent event ) {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.TitleAreaDialog#createContents(org.eclipse.swt.widgets.Composite)
*/
@SuppressWarnings("javadoc")
@Override
protected Control createContents(Composite parent) {
Control control = super.createContents(parent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourceAttributes;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
Expand Down Expand Up @@ -301,7 +299,7 @@ public static String getName( final ModelResource modelResource ) {
String name = modelResource.getItemName();

try {
name = ((ModelResource)modelResource).getCorrespondingResource().getFullPath().removeFileExtension().lastSegment();
name = modelResource.getCorrespondingResource().getFullPath().removeFileExtension().lastSegment();
} catch (ModelWorkspaceException e) {
ModelerCore.Util.log(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.eclipse.datatools.connectivity.ui.wizards.ExtensibleNewConnectionProfileWizard;
import org.teiid.designer.datatools.ui.DatatoolsUiConstants;
import org.teiid.designer.datatools.ui.DatatoolsUiPlugin;

public class ConnectionProfileWizard extends ExtensibleNewConnectionProfileWizard {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.eclipse.datatools.connectivity.ui.wizards.ConnectionProfileDetailsPage;
import org.eclipse.datatools.connectivity.ui.wizards.ProfileDetailsPropertyPage;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.IPageChangedListener;
import org.eclipse.jface.dialogs.PageChangedEvent;
Expand Down Expand Up @@ -144,7 +143,7 @@ public void controlResized(ControlEvent e) {
boolean inReadOnlyRepository = false;

if (profile.getParentProfile() != null) {
IManagedConnection imc = ((IConnectionProfile) profile.getParentProfile())
IManagedConnection imc = profile.getParentProfile()
.getManagedConnection(IConnectionProfileRepositoryConstants.REPOSITORY_CONNECTION_FACTORY_ID);
if (imc != null && imc.isConnected()) {
IConnectionProfileRepository repo = (IConnectionProfileRepository) imc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected Control createDialogArea( Composite parent ) {
Collection<StringKeyValuePair> propsColl = new ArrayList<StringKeyValuePair>();
for (Object key : properties.keySet()) {
String keyStr = (String)key;
String value = (String)properties.getProperty((String)key);
String value = properties.getProperty((String)key);
propsColl.add(new StringKeyValuePair(keyStr, value));
}
propsViewer.setInput(propsColl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.teiid.designer.datatools.ui.DatatoolsUiConstants;
import org.teiid.designer.datatools.ui.DatatoolsUiPlugin;
import org.teiid.designer.ui.common.util.WidgetFactory;
import org.teiid.designer.ui.common.widget.MessageLabel;


public class SelectConnectionProfileDialog extends ElementTreeSelectionDialog implements ISelectionChangedListener {
private static final String DEFAULT_TITLE = DatatoolsUiConstants.UTIL.getString("SelectConnectionProfileDialog.title"); //$NON-NLS-1$
private static final String NEW_BUTTON_TEXT = DatatoolsUiConstants.UTIL.getString("SelectConnectionProfileDialog.newButton"); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.Properties;

import org.eclipse.datatools.connectivity.IConnectionProfile;
import org.eclipse.datatools.connectivity.drivers.jdbc.IJDBCConnectionProfileConstants;
import org.eclipse.datatools.connectivity.drivers.jdbc.IJDBCDriverDefinitionConstants;
import org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.teiid.designer.ui.common.eventsupport.SelectionUtilities;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.GraphicalViewer;
import org.eclipse.gef.KeyHandler;
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void run() {
ModelWorkspaceDialog vdbDialog = getSelectVdbDialog();

// add filters
((ModelWorkspaceDialog) vdbDialog).addFilter(new ClosedProjectFilter());
vdbDialog.addFilter(new ClosedProjectFilter());

vdbDialog.open();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ private void handleBrowseWorkspaceForObjectPressed() {
ModelWorkspaceDialog sdDialog = createTableOrProcedureSelector();

// add filters
((ModelWorkspaceDialog)sdDialog).addFilter(new ClosedProjectFilter());
((ModelWorkspaceDialog) sdDialog).addFilter(new SingleProjectFilter(this.designerProperties));
sdDialog.addFilter(new ClosedProjectFilter());
sdDialog.addFilter(new SingleProjectFilter(this.designerProperties));

sdDialog.open();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import static org.teiid.designer.runtime.ui.DqpUiConstants.UTIL;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,23 @@
import java.util.Collection;
import java.util.List;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.teiid.core.event.IChangeListener;
import org.teiid.core.event.IChangeNotifier;
import org.teiid.core.util.I18nUtil;
import org.teiid.designer.runtime.DqpPlugin;
import org.teiid.designer.runtime.Server;
import org.teiid.designer.runtime.ui.DqpUiConstants;
import org.teiid.designer.runtime.ui.views.TeiidViewTreeProvider;
import org.teiid.designer.ui.common.util.WidgetFactory;
import org.teiid.designer.ui.common.util.WidgetUtil;
import org.teiid.designer.ui.common.widget.Label;


public class ServerSelectionDialog extends TitleAreaDialog implements
DqpUiConstants, IChangeListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ private void handleBrowseWorkspaceForVdbPressed() {
ModelWorkspaceDialog vdbDialog = createVdbSelector();

// add filters
((ModelWorkspaceDialog) vdbDialog).addFilter(new ClosedProjectFilter());
((ModelWorkspaceDialog) vdbDialog).addFilter(new SingleProjectFilter(this.designerProperties));
vdbDialog.addFilter(new ClosedProjectFilter());
vdbDialog.addFilter(new SingleProjectFilter(this.designerProperties));

vdbDialog.open();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private void handleBrowseWorkspaceForVdbPressed() {
ModelWorkspaceDialog vdbDialog = createVdbSelector();

// add filters
((ModelWorkspaceDialog) vdbDialog).addFilter(new ClosedProjectFilter());
vdbDialog.addFilter(new ClosedProjectFilter());

vdbDialog.open();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import static org.teiid.designer.runtime.DqpPlugin.Util;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
Expand Down Expand Up @@ -348,7 +347,7 @@ public IStatus testJDBCPing(String host, String port, String username, String pa

Admin adminApi = getAdmin().getAdminApi();

adminApi.deployVDB("ping-vdb.xml", (InputStream)new ByteArrayInputStream(ServerUtils.TEST_VDB.getBytes())); //$NON-NLS-1$
adminApi.deployVDB("ping-vdb.xml", new ByteArrayInputStream(ServerUtils.TEST_VDB.getBytes())); //$NON-NLS-1$
try{
String url = "jdbc:teiid:ping@mm://"+host+':'+port+";user="+username+";password="+password+';'; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import org.teiid.designer.jdbc.metadata.JdbcNode;
import org.teiid.designer.metamodels.relational.RelationalPackage;

import org.teiid.designer.jdbc.relational.ModelerJdbcRelationalConstants;

/**
* @since 4.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private static RelationalModelProcessor getProcessor(String key) {
RelationalModelProcessor processor = getProcessor(extension);

if( processor != null) {
return (RelationalModelProcessor)processor;
return processor;
}
}

Expand All @@ -191,7 +191,7 @@ public static String getProcessorNameWithType(String type) {
loadProcessors();

for( String nextKey : processorNameMap.keySet() ) {
String nextValue = (String)processorNameMap.get(nextKey);
String nextValue = processorNameMap.get(nextKey);
if( nextKey.equalsIgnoreCase(type) ) {
return nextValue;
}
Expand All @@ -210,7 +210,7 @@ public static String getProcessorTypeWithName(String nameKey) {
loadProcessors();

for( String nextKey : processorNameMap.keySet() ) {
String nextValue = (String)processorNameMap.get(nextKey);
String nextValue = processorNameMap.get(nextKey);
if( nextValue.equalsIgnoreCase(nameKey) ) {
return nextKey;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ public MappingNode getMappingNode( final Object groupID ) throws TeiidComponentE
}
}

return (MappingNode)mappingNode.clone();
return mappingNode.clone();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public void removeValidationListener( IEditorPreferencesValidationListener liste
public void fireValidationStatus( boolean validationStatus,
String message ) {
for (int i = 0; i < this.validationListeners.size(); i++) {
((IEditorPreferencesValidationListener)this.validationListeners.get(i)).validationStatus(validationStatus, message);
this.validationListeners.get(i).validationStatus(validationStatus, message);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,26 +130,26 @@ protected String refactorUserSql(String sqlStr, Map refactoredPaths) {

for( String key: changedModelNames.keySet() ) {
// Replace all names with ' ' preceeding
String oldName = ' ' + (String)key + '.';
String newName = ' ' + (String)changedModelNames.get(key) + '.';
String oldName = ' ' + key + '.';
String newName = ' ' + changedModelNames.get(key) + '.';
if( copyOfSql.contains(oldName) ) {
copyOfSql = copyOfSql.replaceAll(oldName, newName);
}
// Replace all names with ',' preceeding
oldName = ',' + (String)key + '.';
newName = ',' + (String)changedModelNames.get(key) + '.';
oldName = ',' + key + '.';
newName = ',' + changedModelNames.get(key) + '.';
if( copyOfSql.contains(oldName) ) {
copyOfSql = copyOfSql.replaceAll(oldName, newName);
}
// Replace all names with ',' preceeding
oldName = '\t' + (String)key + '.';
newName = '\t' + (String)changedModelNames.get(key) + '.';
oldName = '\t' + key + '.';
newName = '\t' + changedModelNames.get(key) + '.';
if( copyOfSql.contains(oldName) ) {
copyOfSql = copyOfSql.replaceAll(oldName, newName);
}
// Replace all names with ',' preceeding
oldName = '\n' + (String)key + '.';
newName = '\n' + (String)changedModelNames.get(key) + '.';
oldName = '\n' + key + '.';
newName = '\n' + changedModelNames.get(key) + '.';
if( copyOfSql.contains(oldName) ) {
copyOfSql = copyOfSql.replaceAll(oldName, newName);
}
Expand All @@ -159,8 +159,8 @@ protected String refactorUserSql(String sqlStr, Map refactoredPaths) {
// So we should find all indexes of the old name
StringBuffer sb = new StringBuffer(copyOfSql.length());
for( String key: changedModelNames.keySet() ) {
String oldName = '(' + (String)key + '.';
String newName = '(' + (String)changedModelNames.get(key) + '.';
String oldName = '(' + key + '.';
String newName = '(' + changedModelNames.get(key) + '.';
while( copyOfSql.contains(oldName) ) {
int startIndex = copyOfSql.indexOf(oldName);
int endIndex = startIndex + oldName.length();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package org.teiid.designer.metamodels.relational;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;

/**
* <!-- begin-user-doc -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;


/**
* This loader reads a WSDL file from an input stream and populates a {@link org.teiid.designer.metamodels.wsdl.io.WsdlResourceImpl}
* with the corresponding objects using the {@link WsdlPackage WSDL},{@link SoapPackage SOAP},{@link HttpPackage HTTP}and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private SalesforceField[] getFields( DescribeSObjectResult objectMetadata ) {
SalesforceField[] result = new SalesforceField[fields.size()];

for (int i = 0; i < fields.size(); i++) {
result[i] = new SalesforceFieldImpl((Field)fields.get(i));
result[i] = new SalesforceFieldImpl(fields.get(i));
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ public List<SchemaNode> getSchemaForSelectedOperation(final int type,
if (type == ProcedureInfo.REQUEST) {
this.requestSchemaTreeModel = describe(schema,
elementName,
(XSDElementDeclarationImpl) element,
element,
requestSchemaTreeModel);
}
else {
this.responseSchemaTreeModel = describe(schema,
elementName,
(XSDElementDeclarationImpl) element,
element,
responseSchemaTreeModel);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void createWizardPages( ISelection theSelection ) {
}

// give the WSDL selection page the current workspace selection
((WsdlDefinitionPage)this.selectWsdlPage).setInitialSelection(theSelection);
this.selectWsdlPage.setInitialSelection(theSelection);
}

/**
Expand Down

0 comments on commit 62dd150

Please sign in to comment.