Remove Version number from zips

Change-Id: Ifc9ba2e47a61f2d545b7c4b40c327b661b4f48ba
This commit is contained in:
Patrick Plenefisch
2014-08-29 13:58:17 -04:00
committed by Thomas Clark
parent da2ea9ea87
commit 77dac9bd77
21 changed files with 61 additions and 322 deletions

View File

@@ -157,15 +157,6 @@
</enablement>
</commonWizard>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
category="edu.wpi.first.wpilib.plugins.core.preferences.WPILibPreferencePage"
class="edu.wpi.first.wpilib.plugins.java.preferences.JavaPreferencePage"
id="edu.wpi.first.wpilib.plugins.java.preferences.JavaPreferencePage"
name="Java Preferences">
</page>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer

View File

@@ -78,12 +78,16 @@ public class WPILibJavaPlugin extends AbstractUIPlugin implements IStartup {
return "DEVELOPMENT";
}
}
public String getJavaPath() {
return WPILibCore.getDefault().getWPILibBaseDir()
+ File.separator + "java" + File.separator + "current";
}
public Properties getProjectProperties(IProject project) {
Properties defaults = WPILibCore.getDefault().getProjectProperties(project);
Properties props;
try {
File file = new File(WPILibCore.getDefault().getWPILibBaseDir()+"/java/"+getCurrentVersion()+"/ant/build.properties");
File file = new File(WPILibCore.getDefault().getWPILibBaseDir()+"/java/current/ant/build.properties");
props = new AntPropertiesParser(new FileInputStream(file)).getProperties(defaults);
} catch (Exception e) {
WPILibJavaPlugin.logError("Error getting properties.", e);

View File

@@ -1,11 +1,8 @@
package edu.wpi.first.wpilib.plugins.java.installer;
import java.io.InputStream;
import java.util.Properties;
import org.eclipse.jface.preference.IPreferenceStore;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
import edu.wpi.first.wpilib.plugins.core.installer.AbstractInstaller;
import edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin;
import edu.wpi.first.wpilib.plugins.java.preferences.PreferenceConstants;
@@ -19,7 +16,9 @@ import edu.wpi.first.wpilib.plugins.java.preferences.PreferenceConstants;
public class JavaInstaller extends AbstractInstaller {
public JavaInstaller(String version) {
super(version);
super(version,
WPILibJavaPlugin.getDefault().getPreferenceStore().getString(PreferenceConstants.LIBRARY_INSTALLED),
WPILibJavaPlugin.getDefault().getJavaPath());
}
@Override
@@ -30,14 +29,7 @@ public class JavaInstaller extends AbstractInstaller {
@Override
protected void updateInstalledVersion(String version) {
IPreferenceStore prefs = WPILibJavaPlugin.getDefault().getPreferenceStore();
if (prefs.getBoolean(PreferenceConstants.UPDATE_LIBRARY_VERSION)) {
WPILibJavaPlugin.logInfo("Forcing library version to "+version);
Properties props = WPILibCore.getDefault().getProjectProperties(null);
props.setProperty("version", version);
WPILibCore.getDefault().saveGlobalProperties(props);
prefs.setValue(PreferenceConstants.LIBRARY_VERSION, version);
}
WPILibJavaPlugin.getDefault().updateProjects();
prefs.setValue(PreferenceConstants.LIBRARY_INSTALLED, version);
}
@Override

View File

@@ -1,96 +0,0 @@
package edu.wpi.first.wpilib.plugins.java.preferences;
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.IWorkbench;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
import edu.wpi.first.wpilib.plugins.core.preferences.ComboFieldEditor;
import edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin;
/**
* This class represents a preference page that
* is contributed to the Preferences dialog. By
* subclassing <samp>FieldEditorPreferencePage</samp>, we
* can use the field support built into JFace that allows
* us to create a page that is small and knows how to
* save, restore and apply itself.
* <p>
* This page is used to modify preferences only. They
* are stored in the preference store that belongs to
* the main plug-in class. That way, preferences can
* be accessed directly via the preference store.
*/
public class JavaPreferencePage
extends FieldEditorPreferencePage
implements IWorkbenchPreferencePage {
ComboFieldEditor wpiLibVersionEditor;
BooleanFieldEditor autoUpdateEditor;
public JavaPreferencePage() {
super(GRID);
setPreferenceStore(WPILibJavaPlugin.getDefault().getPreferenceStore());
setDescription("Change workspace level settings for Java.");
}
/**
* Creates the field editors. Field editors are abstractions of
* the common GUI blocks needed to manipulate various types
* of preferences. Each field editor knows how to save and
* restore itself.
*/
public void createFieldEditors() {
wpiLibVersionEditor = new ComboFieldEditor(PreferenceConstants.LIBRARY_VERSION,
"&Library Version:", getFieldEditorParent(), getInstalledVersions());
addField(wpiLibVersionEditor);
autoUpdateEditor = new BooleanFieldEditor(PreferenceConstants.UPDATE_LIBRARY_VERSION,
"&Auto Update Library Version", getFieldEditorParent());
addField(autoUpdateEditor);
}
private List<String> getInstalledVersions() {
File[] dirs = new File(WPILibCore.getDefault().getWPILibBaseDir()+File.separator+"java")
.listFiles(new FileFilter() {
@Override public boolean accept(File f) {
return f.isDirectory();
}
});
List<String> versions = new ArrayList<String>();
for (File dir : dirs) {
versions.add(dir.getName());
}
Collections.sort(versions);
return versions;
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
public void init(IWorkbench workbench) {
WPILibJavaPlugin.logInfo("Preferences initialized.");
Properties props = WPILibCore.getDefault().getProjectProperties(null);
getPreferenceStore().setValue(PreferenceConstants.LIBRARY_VERSION,
props.getProperty("version", WPILibJavaPlugin.getDefault().getCurrentVersion()));
}
@Override public void performApply() {
performOk();
}
@Override public boolean performOk() {
Properties props = WPILibCore.getDefault().getProjectProperties(null);
props.setProperty("version", wpiLibVersionEditor.getChoice());
WPILibCore.getDefault().saveGlobalProperties(props);
WPILibJavaPlugin.getDefault().updateProjects();
return super.performOk();
}
}

View File

@@ -4,6 +4,5 @@ package edu.wpi.first.wpilib.plugins.java.preferences;
* Constant definitions for plug-in preferences
*/
public class PreferenceConstants {
public static final String LIBRARY_VERSION = "libraryVersionPreference";
public static final String UPDATE_LIBRARY_VERSION = "udpateLibraryVersionPreference";
public static final String LIBRARY_INSTALLED = "libraryVersion_current";
}

View File

@@ -18,9 +18,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
*/
public void initializeDefaultPreferences() {
IPreferenceStore store = WPILibJavaPlugin.getDefault().getPreferenceStore();
store.setDefault(PreferenceConstants.LIBRARY_VERSION,
WPILibCore.getDefault().getProjectProperties(null)
.getProperty("version", WPILibJavaPlugin.getDefault().getCurrentVersion()));
store.setDefault(PreferenceConstants.UPDATE_LIBRARY_VERSION, true);
if (!store.contains(PreferenceConstants.LIBRARY_INSTALLED))
store.setValue(PreferenceConstants.LIBRARY_INSTALLED, "none");
}
}