eclipse plugin: Change the plain fields to getters
This commit is contained in:
parent
3980bafaec
commit
c864bdd259
5 changed files with 35 additions and 20 deletions
|
@ -10,12 +10,20 @@ package org.wesnoth.installs;
|
|||
|
||||
public class WesnothInstall
|
||||
{
|
||||
public String Name;
|
||||
public String Version;
|
||||
public String name_;
|
||||
public String version_;
|
||||
|
||||
public WesnothInstall(String name, String version)
|
||||
{
|
||||
Name = name;
|
||||
Version = version;
|
||||
name_ = name;
|
||||
version_ = version;
|
||||
}
|
||||
|
||||
public String getName( ){
|
||||
return name_;
|
||||
}
|
||||
|
||||
public String getVersion( ) {
|
||||
return version_;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,9 @@ package org.wesnoth.installs;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
@ -24,6 +26,12 @@ import org.wesnoth.utils.WorkspaceUtils;
|
|||
|
||||
public class WesnothInstallsUtils
|
||||
{
|
||||
/**
|
||||
* A map which stores the installs settings
|
||||
*/
|
||||
private static Map< String, WesnothInstall > installs_ =
|
||||
new HashMap< String, WesnothInstall >();
|
||||
|
||||
/**
|
||||
* Returns a list of the current wesnoth installations available
|
||||
* in the preferences store
|
||||
|
@ -63,9 +71,9 @@ public class WesnothInstallsUtils
|
|||
if ( installs.length() > 0 )
|
||||
installs.append( ";" ); //$NON-NLS-1$
|
||||
|
||||
installs.append( install.Name );
|
||||
installs.append( install.getName( ) );
|
||||
installs.append( ":" ); //$NON-NLS-1$
|
||||
installs.append( install.Version );
|
||||
installs.append( install.getVersion( ) );
|
||||
}
|
||||
Preferences.getPreferences().setValue( Constants.P_INST_INSTALL_LIST, installs.toString() );
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
|||
List<WesnothInstall> installs = WesnothInstallsUtils.getInstalls( );
|
||||
for ( WesnothInstall wesnothInstall : installs )
|
||||
{
|
||||
installs_.put( wesnothInstall.Name, wesnothInstall );
|
||||
installs_.put( wesnothInstall.getName( ), wesnothInstall );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
|||
protected void setInstallAsDefault( WesnothInstall install )
|
||||
{
|
||||
if (install != null) {
|
||||
Preferences.setDefaultInstallName( install.Name);
|
||||
Preferences.setDefaultInstallName( install.getName( ) );
|
||||
installsTableViewer_.refresh();
|
||||
}
|
||||
}
|
||||
|
@ -305,12 +305,12 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
|||
protected void removeInstall( WesnothInstall install )
|
||||
{
|
||||
if ( install != null ){
|
||||
installs_.remove( install.Name );
|
||||
installs_.remove( install.getName( ) );
|
||||
installsTableViewer_.refresh();
|
||||
|
||||
// unset all settings.
|
||||
IPreferenceStore prefs = Preferences.getPreferences( );
|
||||
String installPrefix = Preferences.getInstallPrefix( install.Name );
|
||||
String installPrefix = Preferences.getInstallPrefix( install.getName( ) );
|
||||
prefs.setToDefault( installPrefix + Constants.P_WESNOTH_EXEC_PATH );
|
||||
prefs.setToDefault( installPrefix + Constants.P_WESNOTH_USER_DIR );
|
||||
prefs.setToDefault( installPrefix + Constants.P_WESNOTH_WMLTOOLS_DIR );
|
||||
|
@ -318,7 +318,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
|||
|
||||
// unset the default install if this was that
|
||||
// and select another one (the first) - if any - as default
|
||||
if ( install.Name.equals( Preferences.getDefaultInstallName( ) ) ) {
|
||||
if ( install.getName( ).equals( Preferences.getDefaultInstallName( ) ) ) {
|
||||
Preferences.setDefaultInstallName( "" ); //$NON-NLS-1$
|
||||
|
||||
if ( ! installs_.isEmpty( ) ){
|
||||
|
@ -346,13 +346,13 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
|||
*/
|
||||
private void updateInterface(WesnothInstall install)
|
||||
{
|
||||
txtInstallName_.setText( install == null ? "" : install.Name ); //$NON-NLS-1$
|
||||
txtInstallName_.setText( install == null ? "" : install.getName( ) ); //$NON-NLS-1$
|
||||
txtInstallName_.setEditable( install == null ? true : false );
|
||||
|
||||
cmbVersion_.setText( install == null ? "" : install.Version ); //$NON-NLS-1$
|
||||
cmbVersion_.setText( install == null ? "" : install.getVersion( ) ); //$NON-NLS-1$
|
||||
|
||||
setFieldsPreferenceName(
|
||||
install == null ? "" : Preferences.getInstallPrefix( install.Name ),
|
||||
install == null ? "" : Preferences.getInstallPrefix( install.getName( ) ),
|
||||
true );
|
||||
}
|
||||
|
||||
|
@ -623,12 +623,12 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
|||
WesnothInstall install = ( WesnothInstall ) element;
|
||||
|
||||
if (columnIndex == 0) { // name
|
||||
return install.Name;
|
||||
return install.getName( );
|
||||
} else if (columnIndex == 1) { // version
|
||||
return install.Version;
|
||||
return install.getVersion( );
|
||||
} else if ( columnIndex == 2 ) { // is Default ?
|
||||
|
||||
if ( install.Name.equals( Preferences.getDefaultInstallName( ) ) )
|
||||
if ( install.getName( ).equals( Preferences.getDefaultInstallName( ) ) )
|
||||
return "Yes";
|
||||
|
||||
return "";
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.wesnoth.templates.ReplaceableParameter;
|
|||
import org.wesnoth.templates.TemplateProvider;
|
||||
import org.wesnoth.utils.ResourceUtils;
|
||||
|
||||
|
||||
public class ProjectUtils
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -64,10 +64,10 @@ public class WesnothProjectPage extends PropertyPage
|
|||
|
||||
for ( WesnothInstall wesnothInstall : installs )
|
||||
{
|
||||
cmbInstall_.add( wesnothInstall.Name );
|
||||
cmbInstall_.add( wesnothInstall.getName( ) );
|
||||
|
||||
// current install is default?
|
||||
if ( wesnothInstall.Name.equalsIgnoreCase( installName ) )
|
||||
if ( wesnothInstall.getName( ).equalsIgnoreCase( installName ) )
|
||||
{
|
||||
cmbInstall_.select( cmbInstall_.getItemCount( ) - 1 );
|
||||
foundInstallInList = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue