eclipse plugin: Fix some issues for by FindBugs
This commit is contained in:
parent
3929dace88
commit
103fcd5f98
11 changed files with 23 additions and 44 deletions
|
@ -29,18 +29,17 @@ import org.wesnoth.utils.WorkspaceUtils;
|
|||
*/
|
||||
public class Logger {
|
||||
|
||||
private static Logger instance_;
|
||||
private static class LoggerInstance{
|
||||
private static Logger instance_ = new Logger();
|
||||
}
|
||||
|
||||
private Logger() { }
|
||||
|
||||
private BufferedWriter logWriter_;
|
||||
|
||||
public static Logger getInstance()
|
||||
{
|
||||
if (instance_ == null)
|
||||
{
|
||||
instance_ = new Logger();
|
||||
}
|
||||
return instance_;
|
||||
return LoggerInstance.instance_;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,9 +20,6 @@ public abstract class ObjectActionDelegate implements IObjectActionDelegate
|
|||
protected IStructuredSelection structuredSelection_;
|
||||
protected IAction action_;
|
||||
|
||||
@Override
|
||||
public abstract void run(IAction action);
|
||||
|
||||
@Override
|
||||
public void selectionChanged(IAction action, ISelection selection)
|
||||
{
|
||||
|
|
|
@ -16,8 +16,8 @@ import org.eclipse.ui.IPersistableElement;
|
|||
import org.eclipse.ui.model.IWorkbenchAdapter;
|
||||
import org.eclipse.ui.navigator.CommonNavigator;
|
||||
|
||||
public class WesnothProjectsExplorer extends CommonNavigator implements IAdaptable,
|
||||
IPersistableElement, IElementFactory
|
||||
public class WesnothProjectsExplorer extends CommonNavigator implements
|
||||
IPersistableElement, IElementFactory
|
||||
{
|
||||
public static final String ID_PROJECTS_EXPLORER = "org.wesnoth.navigator.WesnothProjectsExplorer"; //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
|||
tblclmnIsDefault.setWidth(70);
|
||||
tblclmnIsDefault.setText("Default?");
|
||||
|
||||
installsTableViewer_.setContentProvider(new ContentProvider());
|
||||
installsTableViewer_.setContentProvider(new ArrayContentProvider());
|
||||
installsTableViewer_.setLabelProvider(new TableLabelProvider());
|
||||
installsTableViewer_.setInput(installs_.values());
|
||||
|
||||
|
@ -605,14 +605,6 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
|||
checkState();
|
||||
}
|
||||
|
||||
private static class ContentProvider extends ArrayContentProvider {
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement)
|
||||
{
|
||||
return super.getElements(inputElement);
|
||||
}
|
||||
}
|
||||
|
||||
private static class TableLabelProvider extends LabelProvider implements ITableLabelProvider {
|
||||
public Image getColumnImage(Object element, int columnIndex) {
|
||||
return null;
|
||||
|
|
|
@ -13,14 +13,13 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.ui.IWorkbenchPropertyPage;
|
||||
import org.eclipse.ui.dialogs.PropertyPage;
|
||||
import org.wesnoth.utils.ProjectCache;
|
||||
import org.wesnoth.utils.ProjectUtils;
|
||||
import org.wesnoth.utils.WesnothInstallsUtils;
|
||||
import org.wesnoth.utils.WesnothInstallsUtils.WesnothInstall;
|
||||
|
||||
public class WesnothProjectPage extends PropertyPage implements IWorkbenchPropertyPage
|
||||
public class WesnothProjectPage extends PropertyPage
|
||||
{
|
||||
private Combo cmbInstall_;
|
||||
private ProjectCache currProjectCache_;
|
||||
|
@ -28,6 +27,7 @@ public class WesnothProjectPage extends PropertyPage implements IWorkbenchProper
|
|||
public WesnothProjectPage()
|
||||
{
|
||||
currProjectCache_ = null;
|
||||
cmbInstall_ = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -65,6 +65,9 @@ public class ExternalToolInvoker
|
|||
|
||||
outputContent_ = new StringBuilder();
|
||||
errorContent_ = new StringBuilder();
|
||||
|
||||
monitorOutputThread_ = null;
|
||||
monitorErrorThread_ = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,7 +32,10 @@ import org.wesnoth.preferences.Preferences.Paths;
|
|||
|
||||
public class PreprocessorUtils
|
||||
{
|
||||
private static PreprocessorUtils instance_;
|
||||
private static class PreprocessorUtilsInstance{
|
||||
private static PreprocessorUtils instance_ = new PreprocessorUtils( );
|
||||
}
|
||||
|
||||
private Map<String, Long> filesTimeStamps_ = new HashMap<String, Long>();
|
||||
|
||||
private PreprocessorUtils()
|
||||
|
@ -43,9 +46,7 @@ public class PreprocessorUtils
|
|||
|
||||
public static PreprocessorUtils getInstance()
|
||||
{
|
||||
if (instance_ == null)
|
||||
instance_ = new PreprocessorUtils();
|
||||
return instance_;
|
||||
return PreprocessorUtilsInstance.instance_;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -253,7 +254,7 @@ public class PreprocessorUtils
|
|||
{
|
||||
timestamps.add(timestamp.toString());
|
||||
}
|
||||
settings.put("timestamps", timestamps.toArray(new String[0])); //$NON-NLS-1$
|
||||
settings.put("timestamps", timestamps.toArray(new String[timestamps.size( )])); //$NON-NLS-1$
|
||||
settings.save(filename);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -218,6 +218,7 @@ public class ProjectCache
|
|||
if (definesFile_.exists() == false)
|
||||
return;
|
||||
defines_ = Define.readDefines(definesFile_.getAbsolutePath());
|
||||
definesTimetamp_ = definesFile_.lastModified( );
|
||||
}
|
||||
|
||||
public void setDefines(Map<String, Define> defines)
|
||||
|
|
|
@ -356,13 +356,12 @@ public class WorkspaceUtils
|
|||
String addonsDir = Preferences.getPaths( null ).getAddonsDir( );
|
||||
String campaignsDir = Preferences.getPaths( null ).getCampaignDir( );
|
||||
|
||||
File[] tmp = null;
|
||||
if (GUIUtils.showMessageBox(Messages.WorkspaceUtils_18 +
|
||||
Messages.WorkspaceUtils_19,
|
||||
SWT.ICON_QUESTION | SWT.YES | SWT.NO) == SWT.YES)
|
||||
{
|
||||
// useraddons/add-ons/data
|
||||
tmp = new File(addonsDir).listFiles();
|
||||
File[] tmp = new File(addonsDir).listFiles();
|
||||
if (tmp != null)
|
||||
files.addAll(Arrays.asList(tmp));
|
||||
}
|
||||
|
@ -372,7 +371,7 @@ public class WorkspaceUtils
|
|||
SWT.ICON_QUESTION | SWT.YES | SWT.NO) == SWT.YES)
|
||||
{
|
||||
// workingdir/data/campaigns
|
||||
tmp = new File(campaignsDir).listFiles();
|
||||
File[] tmp = new File(campaignsDir).listFiles();
|
||||
if (tmp != null)
|
||||
files.addAll(Arrays.asList(tmp));
|
||||
}
|
||||
|
@ -404,7 +403,6 @@ public class WorkspaceUtils
|
|||
{
|
||||
ProjectUtils.createWesnothProject(project, description,
|
||||
true, false, monitor);
|
||||
container = project;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ package org.wesnoth.wizards.campaign;
|
|||
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
|
||||
import org.wesnoth.WesnothPlugin;
|
||||
import org.wesnoth.Messages;
|
||||
import org.wesnoth.WesnothPlugin;
|
||||
|
||||
|
||||
public class CampaignPage0 extends WizardNewProjectCreationPage
|
||||
|
@ -30,10 +30,4 @@ public class CampaignPage0 extends WizardNewProjectCreationPage
|
|||
WesnothPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getShell(),
|
||||
"org.wesnoth.wizardHelp"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFlipToNextPage()
|
||||
{
|
||||
return super.canFlipToNextPage();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,12 +80,6 @@ public class WizardGenerator extends NewWizardTemplate
|
|||
return indent_;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPages()
|
||||
{
|
||||
super.addPages();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performFinish()
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue