Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 86213 Details for
Bug 143457
[Import/Export] How to create Ant task to import/export preferences in headless mode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch
patch.txt (text/plain), 14.87 KB, created by
Krzysztof Daniel
on 2008-01-04 12:25:54 EST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Krzysztof Daniel
Created:
2008-01-04 12:25:54 EST
Size:
14.87 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.ide >Index: build.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/build.properties,v >retrieving revision 1.10 >diff -u -r1.10 build.properties >--- build.properties 8 Jun 2005 19:09:06 -0000 1.10 >+++ build.properties 4 Jan 2008 17:19:02 -0000 >@@ -15,7 +15,8 @@ > about.html,\ > icons/,\ > .,\ >- META-INF/ >+ META-INF/,\ >+ ant_tasks/resources-ant.jar > src.includes = about.html,\ > schema/ > source.. = extensions/,\ >Index: .project >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/.project,v >retrieving revision 1.12 >diff -u -r1.12 .project >--- .project 13 Apr 2006 14:46:59 -0000 1.12 >+++ .project 4 Jan 2008 17:19:02 -0000 >@@ -16,13 +16,22 @@ > </arguments> > </buildCommand> > <buildCommand> >+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> >+ <arguments> >+ <dictionary> >+ <key>LaunchConfigHandle</key> >+ <value><project>/.externalToolBuilders/Build resources-ant.jar.launch</value> >+ </dictionary> >+ </arguments> >+ </buildCommand> >+ <buildCommand> > <name>org.eclipse.pde.SchemaBuilder</name> > <arguments> > </arguments> > </buildCommand> > </buildSpec> > <natures> >- <nature>org.eclipse.pde.PluginNature</nature> > <nature>org.eclipse.jdt.core.javanature</nature> >+ <nature>org.eclipse.pde.PluginNature</nature> > </natures> > </projectDescription> >Index: .classpath >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/.classpath,v >retrieving revision 1.14 >diff -u -r1.14 .classpath >--- .classpath 11 May 2006 21:39:37 -0000 1.14 >+++ .classpath 4 Jan 2008 17:19:02 -0000 >@@ -2,6 +2,7 @@ > <classpath> > <classpathentry kind="src" path="src"/> > <classpathentry kind="src" path="extensions"/> >+ <classpathentry kind="src" path="src_ant"/> > <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> > <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> > <classpathentry kind="output" path="bin"/> >Index: .cvsignore >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/.cvsignore,v >retrieving revision 1.1 >diff -u -r1.1 .cvsignore >--- .cvsignore 29 Oct 2003 17:59:01 -0000 1.1 >+++ .cvsignore 4 Jan 2008 17:19:02 -0000 >@@ -1 +1,2 @@ >-bin >\ No newline at end of file >+bin >+temp.folder >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/plugin.xml,v >retrieving revision 1.253 >diff -u -r1.253 plugin.xml >--- plugin.xml 3 Jan 2008 20:31:59 -0000 1.253 >+++ plugin.xml 4 Jan 2008 17:19:03 -0000 >@@ -2041,5 +2041,30 @@ > type="org.eclipse.ui.internal.views.markers.ExtendedMarkersView"> > </propertyTester> > </extension> >+ <!-- Tasks --> >+ <extension >+ point="org.eclipse.ant.core.antTasks"> >+ <antTask >+ library="ant_tasks/resources-ant.jar" >+ name="eclipse.importPreferences" >+ headless="true" >+ eclipseRuntime="true" >+ class="org.eclipse.ui.ide.anttasks.ImportPreferencesTask"> >+ </antTask> >+ <antTask >+ library="ant_tasks/resources-ant.jar" >+ name="eclipse.exportPreferences" >+ eclipseRuntime="true" >+ headless="true" >+ class="org.eclipse.ui.ide.anttasks.ExportPreferencesTask"> >+ </antTask> >+ </extension> >+<!-- Extra Classpath --> >+ <extension >+ point="org.eclipse.ant.core.extraClasspathEntries"> >+ <extraClasspathEntry >+ library="ant_tasks/resources-ant.jar"> >+ </extraClasspathEntry> >+ </extension> > > </plugin> >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/META-INF/MANIFEST.MF,v >retrieving revision 1.36 >diff -u -r1.36 MANIFEST.MF >--- META-INF/MANIFEST.MF 3 Jan 2008 20:31:59 -0000 1.36 >+++ META-INF/MANIFEST.MF 4 Jan 2008 17:19:03 -0000 >@@ -54,7 +54,9 @@ > org.eclipse.update.core;bundle-version="[3.1.100,4.0.0)", > org.eclipse.update.ui;bundle-version="[3.1.100,4.0.0)", > org.eclipse.jface.text;bundle-version="[3.2.0,4.0.0)", >- org.eclipse.ui.forms;bundle-version="[3.3.0,4.0.0)" >+ org.eclipse.ui.forms;bundle-version="[3.3.0,4.0.0)", >+ org.apache.ant, >+ org.eclipse.ant.core > Eclipse-LazyStart: true > Import-Package: com.ibm.icu.text > Bundle-RequiredExecutionEnvironment: J2SE-1.4 >Index: src_ant/META-INF/eclipse.inf >=================================================================== >RCS file: src_ant/META-INF/eclipse.inf >diff -N src_ant/META-INF/eclipse.inf >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/META-INF/eclipse.inf 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,1 @@ >+jarprocessor.exclude.sign=true >Index: .externalToolBuilders/Build resources-ant.jar.launch >=================================================================== >RCS file: .externalToolBuilders/Build resources-ant.jar.launch >diff -N .externalToolBuilders/Build resources-ant.jar.launch >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .externalToolBuilders/Build resources-ant.jar.launch 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> >+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> >+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> >+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> >+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,clean"/> >+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> >+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> >+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> >+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> >+<booleanAttribute key="org.eclipse.debug.core.capture_output" value="true"/> >+<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS" value="clean,"/> >+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <launchConfigurationWorkingSet factoryID="org.eclipse.ui.internal.WorkingSetFactory" name="workingSet" editPageId="org.eclipse.ui.resourceWorkingSetPage"> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/org.eclipse.ui.ide/scripts/buildExtraJAR.xml" type="1"/> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/org.eclipse.ui.ide/src_ant" type="2"/> </launchConfigurationWorkingSet> }"/> >+<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/> >+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.ui.ide/scripts/buildExtraJAR.xml}"/> >+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_SHOW_CONSOLE" value="true"/> >+</launchConfiguration> >Index: scripts/buildExtraJAR.xml >=================================================================== >RCS file: scripts/buildExtraJAR.xml >diff -N scripts/buildExtraJAR.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ scripts/buildExtraJAR.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,58 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<project name="org.eclipse.ui.ide" default="main" basedir=".."> >+ >+ <target name="main" depends="clean, ant_tasks/resources-ant.jar"> >+ </target> >+ >+ <target name="init" depends="properties"> >+ <property name="plugin" value="org.eclipse.ui.ide"/> >+ <property name="temp.folder" value="${basedir}/temp.folder"/> >+ <property name="plugin.destination" value="${basedir}"/> >+ <property name="build.result.folder" value="${basedir}/ant_tasks"/> >+ <property name="version.suffix" value="_3.1.0"/> >+ </target> >+ >+ <target name="properties" if="eclipse.running"> >+ <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> >+ </target> >+ >+ <target name="ant_tasks/resources-ant.jar" depends="init" unless="ant_tasks/resources-ant.jar"> >+ <property name="destdir" value="${temp.folder}/ant_tasks/resources-ant.jar.bin"/> >+ <delete dir="${temp.folder}/ant_tasks/resources-ant.jar.bin"/> >+ <mkdir dir="${temp.folder}/ant_tasks/resources-ant.jar.bin"/> >+ <!-- compile the source code --> >+ <javac destdir="${temp.folder}/ant_tasks/resources-ant.jar.bin" failonerror="true" verbose="true" debug="on"> >+ <classpath> >+ <dirset dir="${basedir}/.."> >+ <include name="org.eclipse.core.runtime/bin"/> >+ <include name="org.eclipse.equinox.common/bin"/> >+ <include name="org.eclipse.core.jobs/bin"/> >+ <include name="org.eclipse.osgi/bin"/> >+ <include name="org.eclipse.ant.core/bin"/> >+ </dirset> >+ <fileset dir="${eclipse.home}"> >+ <include name="plugins/org.eclipse.core.runtime*.jar"/> >+ <include name="plugins/org.eclipse.equinox.common*.jar"/> >+ <include name="plugins/org.eclipse.equinox.preferences*.jar"/> >+ <include name="plugins/org.eclipse.core.jobs*.jar"/> >+ <include name="plugins/org.eclipse.osgi*.jar"/> >+ <include name="plugins/org.eclipse.ant.core*.jar"/> >+ </fileset> >+ </classpath> >+ <src path="src_ant/"/> >+ </javac> >+ <!-- copy necessary resources --> >+ <copy todir="${temp.folder}/ant_tasks/resources-ant.jar.bin"> >+ <fileset dir="src_ant/" excludes="**/*.java"/> >+ </copy> >+ <mkdir dir="${build.result.folder}"/> >+ <jar jarfile="${build.result.folder}/resources-ant.jar" basedir="${temp.folder}/ant_tasks/resources-ant.jar.bin"/> >+ <delete dir="${temp.folder}/ant_tasks/resources-ant.jar.bin"/> >+ <delete dir="${temp.folder}"/> >+ </target> >+ >+ <target name="clean" depends="init"> >+ <delete file="${build.result.folder}/resources-ant.jar"/> >+ <delete dir="${temp.folder}"/> >+ </target> >+</project> >Index: src_ant/org/eclipse/ui/ide/anttasks/ExportPreferencesTask.java >=================================================================== >RCS file: src_ant/org/eclipse/ui/ide/anttasks/ExportPreferencesTask.java >diff -N src_ant/org/eclipse/ui/ide/anttasks/ExportPreferencesTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/ui/ide/anttasks/ExportPreferencesTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.ide.anttasks; >+ >+import java.io.*; >+import org.apache.tools.ant.BuildException; >+import org.eclipse.ant.core.Task; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.preferences.IPreferencesService; >+ >+/** >+ * An ant task which exports preferences from specified file. >+ * >+ * @see IPreferencesService#importPreferences(InputStream) >+ */ >+public class ExportPreferencesTask extends Task { >+ >+ private String preferencesPath; >+ >+ /** >+ * Sets the path to the preference file. >+ * @param path A string pointing to the file >+ */ >+ public void setPreferencesFile(String path) { >+ preferencesPath = path; >+ } >+ >+ /** >+ * Performs the preferences export. >+ * @throws BuildException thrown if a problem occurs during execution. >+ */ >+ public final void execute() throws BuildException { >+ try { >+ OutputStream os = new BufferedOutputStream(new FileOutputStream(preferencesPath)); >+ IPreferencesService service = Platform.getPreferencesService(); >+ service.exportPreferences(service.getRootNode(), os, null); >+ } catch (FileNotFoundException e) { >+ //should not happen >+ throw new BuildException(e); >+ } catch (CoreException e) { >+ throw new BuildException(e); >+ } >+ } >+} >Index: src_ant/org/eclipse/ui/ide/anttasks/ImportPreferencesTask.java >=================================================================== >RCS file: src_ant/org/eclipse/ui/ide/anttasks/ImportPreferencesTask.java >diff -N src_ant/org/eclipse/ui/ide/anttasks/ImportPreferencesTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/ui/ide/anttasks/ImportPreferencesTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.ide.anttasks; >+ >+import java.io.*; >+import org.apache.tools.ant.BuildException; >+import org.eclipse.ant.core.Task; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.preferences.IPreferencesService; >+ >+/** >+ * An ant task which imports preferences from specified file. >+ * >+ * @see IPreferencesService#importPreferences(InputStream) >+ */ >+public class ImportPreferencesTask extends Task { >+ >+ private String preferencesPath; >+ >+ /** >+ * Sets the path to the preference file. >+ * @param path A string pointing to the file >+ */ >+ public void setPreferencesFile(String path) { >+ preferencesPath = path; >+ } >+ >+ /** >+ * Performs the preferences import. >+ * @throws BuildException thrown if a problem occurs during execution. >+ */ >+ public final void execute() throws BuildException { >+ try { >+ InputStream is = new BufferedInputStream(new FileInputStream(preferencesPath)); >+ IPreferencesService service = Platform.getPreferencesService(); >+ service.importPreferences(is); >+ } catch (FileNotFoundException e) { >+ //should not happen >+ throw new BuildException(e); >+ } catch (CoreException e) { >+ throw new BuildException(e); >+ } >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 143457
: 86213