diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:49:30 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:49:30 +0200 |
commit | ede215cf93ba81c963ae62d665d0f32c9407551c (patch) | |
tree | 4a6dc80f259bccb8ff8b76d31e6cc8794bd97a2b | |
download | eclipse-poky-kepler-ede215cf93ba81c963ae62d665d0f32c9407551c.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
360 files changed, 35933 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba077a4 --- /dev/null +++ b/.gitignore | |||
@@ -0,0 +1 @@ | |||
bin | |||
diff --git a/features/org.yocto.bc.headless.build/.project b/features/org.yocto.bc.headless.build/.project new file mode 100644 index 0000000..672fcda --- /dev/null +++ b/features/org.yocto.bc.headless.build/.project | |||
@@ -0,0 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.bc.headless.build</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | </buildSpec> | ||
9 | <natures> | ||
10 | </natures> | ||
11 | </projectDescription> | ||
diff --git a/features/org.yocto.bc.headless.build/build.properties b/features/org.yocto.bc.headless.build/build.properties new file mode 100644 index 0000000..9d9a9cc --- /dev/null +++ b/features/org.yocto.bc.headless.build/build.properties | |||
@@ -0,0 +1,262 @@ | |||
1 | ############################################################################### | ||
2 | # Copyright (c) 2003, 2009 IBM Corporation and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # IBM Corporation - initial API and implementation | ||
10 | ############################################################################### | ||
11 | ##################### | ||
12 | # Parameters describing how and where to execute the build. | ||
13 | # Typical users need only update the following properties: | ||
14 | # baseLocation - where things you are building against are installed | ||
15 | # bootclasspath - The base jars to compile against (typicaly rt.jar) | ||
16 | # configs - the list of {os, ws, arch} configurations to build. | ||
17 | # | ||
18 | # Of course any of the settings here can be overridden by spec'ing | ||
19 | # them on the command line (e.g., -DbaseLocation=d:/eclipse | ||
20 | |||
21 | #The type of the top level element we are building, generally "feature" | ||
22 | topLevelElementType = feature | ||
23 | #The id of the top level element we are building | ||
24 | topLevelElementId = org.yocto.bc | ||
25 | |||
26 | ############# PRODUCT/PACKAGING CONTROL ############# | ||
27 | product=/plugin or feature id/path/to/.product | ||
28 | runPackager=true | ||
29 | |||
30 | #Set the name of the archive that will result from the product build. | ||
31 | #archiveNamePrefix= | ||
32 | |||
33 | # The prefix that will be used in the generated archive. | ||
34 | archivePrefix=eclipse | ||
35 | |||
36 | # The location underwhich all of the build output will be collected. | ||
37 | collectingFolder=${archivePrefix} | ||
38 | |||
39 | # The list of {os, ws, arch} configurations to build. This | ||
40 | # value is a '&' separated list of ',' separate triples. For example, | ||
41 | # configs=win32,win32,x86 & linux,motif,x86 | ||
42 | # By default the value is *,*,* | ||
43 | configs = *, *, * | ||
44 | #configs=win32, win32, x86 & \ | ||
45 | # win32,win32,x86_64 & \ | ||
46 | # win32,win32,wpf & \ | ||
47 | # linux, gtk, ppc & \ | ||
48 | # linux, gtk, x86 & \ | ||
49 | # linux, gtk, x86_64 & \ | ||
50 | # linux, motif, x86 & \ | ||
51 | # solaris, motif, sparc & \ | ||
52 | # solaris, gtk, sparc & \ | ||
53 | # aix, motif, ppc & \ | ||
54 | # hpux, motif, ia64_32 & \ | ||
55 | # macosx, carbon, ppc & \ | ||
56 | # macosx, carbon, x86 & \ | ||
57 | # macosx, cocoa, ppc & \ | ||
58 | # macosx, cocoa, x86 & \ | ||
59 | # macosx, cocoa, x86_64 | ||
60 | |||
61 | # By default PDE creates one archive (result) per entry listed in the configs property. | ||
62 | # Setting this value to true will cause PDE to only create one output containing all | ||
63 | # artifacts for all the platforms listed in the configs property. | ||
64 | # To control the output format for the group, add a "group, group, group - <format>" entry to the | ||
65 | # archivesFormat. | ||
66 | #groupConfigurations=true | ||
67 | |||
68 | #The format of the archive. By default a zip is created using antZip. | ||
69 | #The list can only contain the configuration for which the desired format is different than zip. | ||
70 | #archivesFormat=win32, win32, x86 - antZip& \ | ||
71 | # linux, gtk, ppc - antZip &\ | ||
72 | # linux, gtk, x86 - antZip& \ | ||
73 | # linux, gtk, x86_64 - antZip& \ | ||
74 | # linux, motif, x86 - antZip& \ | ||
75 | # solaris, motif, sparc - antZip& \ | ||
76 | # solaris, gtk, sparc - antZip& \ | ||
77 | # aix, motif, ppc - antZip& \ | ||
78 | # hpux, motif, PA_RISC - antZip& \ | ||
79 | # macosx, carbon, ppc - antZip | ||
80 | |||
81 | #Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles. | ||
82 | allowBinaryCycles = true | ||
83 | |||
84 | #Sort bundles depenedencies across all features instead of just within a given feature. | ||
85 | #flattenDependencies = true | ||
86 | |||
87 | #Parallel compilation, requires flattenedDependencies=true | ||
88 | #parallelCompilation=true | ||
89 | #parallelThreadCount= | ||
90 | #parallelThreadsPerProcessor= | ||
91 | |||
92 | #Set to true if you want the output to be ready for an update jar (no site.xml generated) | ||
93 | outputUpdateJars = true | ||
94 | |||
95 | #Set to true for Jnlp generation | ||
96 | #codebase should be a URL that will be used as the root of all relative URLs in the output. | ||
97 | #generateJnlp=false | ||
98 | #jnlp.codebase=<codebase url> | ||
99 | #jnlp.j2se=<j2se version> | ||
100 | #jnlp.locale=<a locale> | ||
101 | #jnlp.generateOfflineAllowed=true or false generate <offlineAllowed/> attribute in the generated features | ||
102 | #jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built | ||
103 | |||
104 | #Set to true if you want to sign jars | ||
105 | #signJars=false | ||
106 | #sign.alias=<alias> | ||
107 | #sign.keystore=<keystore location> | ||
108 | #sign.storepass=<keystore password> | ||
109 | #sign.keypass=<key password> | ||
110 | |||
111 | #Arguments to send to the zip executable | ||
112 | zipargs= | ||
113 | |||
114 | #Arguments to send to the tar executable | ||
115 | tarargs= | ||
116 | |||
117 | #Control the creation of a file containing the version included in each configuration - on by default | ||
118 | #generateVersionsLists=false | ||
119 | |||
120 | ############## BUILD NAMING CONTROL ################ | ||
121 | # The directory into which the build elements are fetched and where | ||
122 | # the build takes place. | ||
123 | #buildDirectory= | ||
124 | |||
125 | # Type of build. Used in naming the build output. Typically this value is | ||
126 | # one of I, N, M, S, ... | ||
127 | buildType=I | ||
128 | |||
129 | # ID of the build. Used in naming the build output. | ||
130 | buildId=TestBuild | ||
131 | |||
132 | # Label for the build. Used in naming the build output | ||
133 | buildLabel=${buildType}.${buildId} | ||
134 | |||
135 | # Timestamp for the build. Used in naming the build output | ||
136 | timestamp=007 | ||
137 | |||
138 | #The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde. | ||
139 | #The value will only be applied to plugin or features indicating build.properties, qualifier = context | ||
140 | #forceContextQualifier=<the value for the qualifier> | ||
141 | |||
142 | #Enable / disable the generation of a suffix for the features that use .qualifier. | ||
143 | #The generated suffix is computed according to the content of the feature | ||
144 | #generateFeatureVersionSuffix=true | ||
145 | |||
146 | ############# BASE CONTROL ############# | ||
147 | # Settings for the base Eclipse components and Java class libraries | ||
148 | # against which you are building. | ||
149 | # Base location for anything the build needs to compile against. For example, | ||
150 | # in most RCP app or a plug-in, the baseLocation should be the location of a previously | ||
151 | # installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack. | ||
152 | |||
153 | #base=<path/to/parent/of/eclipse> | ||
154 | #baseLocation=${base}/eclipse | ||
155 | |||
156 | #Folder containing repositories whose content is needed to compile against | ||
157 | #repoBaseLocation=${base}/repos | ||
158 | #Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against | ||
159 | #transformedRepoLocation=${base}/transformedRepos | ||
160 | |||
161 | #Os/Ws/Arch/nl of the eclipse specified by baseLocation | ||
162 | #baseos=win32 | ||
163 | #basews=win32 | ||
164 | #basearch=x86 | ||
165 | |||
166 | #this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built | ||
167 | filteredDependencyCheck=false | ||
168 | |||
169 | #this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons) | ||
170 | resolution.devMode=false | ||
171 | |||
172 | #pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :) | ||
173 | #a location is one of: | ||
174 | #- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo | ||
175 | #- a directory that contains a /plugins or /features subdirectory | ||
176 | #- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml | ||
177 | #pluginPath= | ||
178 | |||
179 | skipBase=true | ||
180 | eclipseURL=<url for eclipse download site> | ||
181 | eclipseBuildId=<Id of Eclipse build to get> | ||
182 | eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip | ||
183 | |||
184 | |||
185 | ############# MAP FILE CONTROL ################ | ||
186 | # This section defines CVS tags to use when fetching the map files from the repository. | ||
187 | # If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml | ||
188 | |||
189 | skipMaps=true | ||
190 | mapsRepo=:pserver:anonymous@example.com/path/to/repo | ||
191 | mapsRoot=path/to/maps | ||
192 | mapsCheckoutTag=HEAD | ||
193 | |||
194 | #tagMaps=true | ||
195 | mapsTagTag=v${buildId} | ||
196 | |||
197 | |||
198 | ############ REPOSITORY CONTROL ############### | ||
199 | # This section defines properties parameterizing the repositories where plugins, fragments | ||
200 | # bundles and features are being obtained from. | ||
201 | |||
202 | # The tags to use when fetching elements to build. | ||
203 | # By default thebuilder will use whatever is in the maps. | ||
204 | # This value takes the form of a comma separated list of repository identifier (like used in the map files) and the | ||
205 | # overriding value | ||
206 | # For example fetchTag=CVS=HEAD, SVN=v20050101 | ||
207 | # fetchTag=HEAD | ||
208 | skipFetch=true | ||
209 | |||
210 | |||
211 | ############# JAVA COMPILER OPTIONS ############## | ||
212 | # The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE | ||
213 | #bootclasspath=${java.home}/lib/rt.jar | ||
214 | |||
215 | # specific JRE locations to compile against. These values are used to compile bundles specifying a | ||
216 | # Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support | ||
217 | #CDC-1.0/Foundation-1.0= /path/to/rt.jar | ||
218 | #CDC-1.1/Foundation-1.1= | ||
219 | #OSGi/Minimum-1.0= | ||
220 | #OSGi/Minimum-1.1= | ||
221 | #JRE-1.1= | ||
222 | #J2SE-1.2= | ||
223 | #J2SE-1.3= | ||
224 | #J2SE-1.4= | ||
225 | #J2SE-1.5= | ||
226 | #JavaSE-1.6= | ||
227 | #PersonalJava-1.1= | ||
228 | #PersonalJava-1.2= | ||
229 | #CDC-1.0/PersonalBasis-1.0= | ||
230 | #CDC-1.0/PersonalJava-1.0= | ||
231 | #CDC-1.1/PersonalBasis-1.1= | ||
232 | #CDC-1.1/PersonalJava-1.1= | ||
233 | |||
234 | # Specify the output format of the compiler log when eclipse jdt is used | ||
235 | logExtension=.log | ||
236 | |||
237 | # Whether or not to include debug info in the output jars | ||
238 | javacDebugInfo=false | ||
239 | |||
240 | # Whether or not to fail the build if there are compiler errors | ||
241 | javacFailOnError=true | ||
242 | |||
243 | # Enable or disable verbose mode of the compiler | ||
244 | javacVerbose=true | ||
245 | |||
246 | # Extra arguments for the compiler. These are specific to the java compiler being used. | ||
247 | #compilerArg= | ||
248 | |||
249 | # Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties | ||
250 | javacSource=1.6 | ||
251 | |||
252 | # Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties. | ||
253 | javacTarget=1.6 | ||
254 | |||
255 | #individualSourceBundles=true | ||
256 | |||
257 | #p2.gathering=true | ||
258 | p2.compress=true | ||
259 | #p2.category.site=file:${buildDirectory}/site.xml | ||
260 | p2.category.definition=file:${buildDirectory}/category.xml | ||
261 | p2.metadata.repo.name=Yocto Project Update Site | ||
262 | p2.artifact.repo.name=Yocto Project Update Site | ||
diff --git a/features/org.yocto.bc.headless.build/customTargets.xml b/features/org.yocto.bc.headless.build/customTargets.xml new file mode 100644 index 0000000..52e460e --- /dev/null +++ b/features/org.yocto.bc.headless.build/customTargets.xml | |||
@@ -0,0 +1,212 @@ | |||
1 | <project name="Build specific targets and properties" default="noDefault"> | ||
2 | |||
3 | <!-- ===================================================================== --> | ||
4 | <!-- Run a given ${target} on all elements being built --> | ||
5 | <!-- Add on <ant> task for each top level element being built. --> | ||
6 | <!-- ===================================================================== --> | ||
7 | <available property="allElementsFile" file="${builder}/allElements.xml" value="${builder}/allElements.xml"/> | ||
8 | <property name="allElementsFile" location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/> | ||
9 | |||
10 | <import file="${allElementsFile}" /> | ||
11 | <target name="allElements"> | ||
12 | <antcall target="allElementsDelegator" /> | ||
13 | </target> | ||
14 | |||
15 | <!-- ===================================================================== --> | ||
16 | <!-- ===================================================================== --> | ||
17 | <target name="getBaseComponents" depends="checkLocalBase" unless="skipBase"> | ||
18 | <get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" /> | ||
19 | <unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" /> | ||
20 | </target> | ||
21 | |||
22 | <target name="checkLocalBase"> | ||
23 | <available file="${base}" property="skipBase" /> | ||
24 | </target> | ||
25 | |||
26 | <!-- ===================================================================== --> | ||
27 | <!-- Check out map files from correct repository --> | ||
28 | <!-- Replace values for mapsCheckoutTag as desired. --> | ||
29 | <!-- ===================================================================== --> | ||
30 | <target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps"> | ||
31 | <property name="mapsCheckoutTag" value="HEAD" /> | ||
32 | <cvs cvsRoot="${mapsRepo}" package="${mapsRoot}" dest="${buildDirectory}/maps" tag="${mapsCheckoutTag}" /> | ||
33 | </target> | ||
34 | |||
35 | <target name="checkLocalMaps"> | ||
36 | <available property="skipMaps" file="${buildDirectory}/maps" /> | ||
37 | </target> | ||
38 | |||
39 | <target name="tagMapFiles" if="tagMaps"> | ||
40 | <cvs dest="${buildDirectory}/maps/${mapsRoot}" command="tag ${mapsTagTag}" /> | ||
41 | </target> | ||
42 | |||
43 | <!-- ===================================================================== --> | ||
44 | |||
45 | <target name="clean" unless="noclean"> | ||
46 | <antcall target="allElements"> | ||
47 | <param name="target" value="cleanElement" /> | ||
48 | </antcall> | ||
49 | </target> | ||
50 | |||
51 | <target name="gatherLogs"> | ||
52 | <mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" /> | ||
53 | <antcall target="allElements"> | ||
54 | <param name="target" value="gatherLogs" /> | ||
55 | </antcall> | ||
56 | <unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true"> | ||
57 | <fileset dir="${buildDirectory}/features"> | ||
58 | <include name="**/*.log.zip" /> | ||
59 | </fileset> | ||
60 | </unzip> | ||
61 | </target> | ||
62 | |||
63 | <!-- ===================================================================== --> | ||
64 | <!-- Steps to do before setup --> | ||
65 | <!-- ===================================================================== --> | ||
66 | <target name="preSetup"> | ||
67 | <delete dir="${buildDirectory}/plugins"/> | ||
68 | <mkdir dir="${buildDirectory}/plugins"/> | ||
69 | <copy todir="${buildDirectory}/plugins" failonerror="true"> | ||
70 | <fileset dir="${otherSrcDirectory}/plugins"/> | ||
71 | </copy> | ||
72 | <delete dir="${buildDirectory}/features"/> | ||
73 | <copy todir="${buildDirectory}/features" failonerror="true" > | ||
74 | <fileset dir="${otherSrcDirectory}/features"/> | ||
75 | </copy> | ||
76 | <antcall target="prepareForP2" /> | ||
77 | </target> | ||
78 | |||
79 | <target name="prepareForP2" if="p2.gathering"> | ||
80 | <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" /> | ||
81 | <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/category.xml" todir="${buildDirectory}" /> | ||
82 | <xmlproperty file="${otherSrcDirectory}/features/org.yocto.bc/feature.xml" /> | ||
83 | <replace file="${buildDirectory}/category.xml"> | ||
84 | <replacefilter token="@bcfeatureVersion@" value="${feature(version)}"/> | ||
85 | </replace> | ||
86 | </target> | ||
87 | |||
88 | <!-- ===================================================================== --> | ||
89 | <!-- Steps to do after setup but before starting the build proper --> | ||
90 | <!-- ===================================================================== --> | ||
91 | <target name="postSetup"> | ||
92 | <antcall target="getBaseComponents" /> | ||
93 | </target> | ||
94 | |||
95 | <!-- ===================================================================== --> | ||
96 | <!-- Steps to do before fetching the build elements --> | ||
97 | <!-- ===================================================================== --> | ||
98 | <target name="preFetch"> | ||
99 | </target> | ||
100 | |||
101 | <!-- ===================================================================== --> | ||
102 | <!-- Steps to do after fetching the build elements --> | ||
103 | <!-- ===================================================================== --> | ||
104 | <target name="postFetch"> | ||
105 | </target> | ||
106 | |||
107 | <!-- ===================================================================== --> | ||
108 | <!-- Steps to do before the repositories are being processed --> | ||
109 | <!-- ===================================================================== --> | ||
110 | <target name="preProcessRepos"> | ||
111 | </target> | ||
112 | |||
113 | <!-- ===================================================================== --> | ||
114 | <!-- Steps to do after the repositories have been processed --> | ||
115 | <!-- ===================================================================== --> | ||
116 | <target name="postProcessRepos"> | ||
117 | </target> | ||
118 | |||
119 | <!-- ===================================================================== --> | ||
120 | <!-- Steps to do before generating the build scripts. --> | ||
121 | <!-- ===================================================================== --> | ||
122 | <target name="preGenerate"> | ||
123 | </target> | ||
124 | |||
125 | <!-- ===================================================================== --> | ||
126 | <!-- Steps to do after generating the build scripts. --> | ||
127 | <!-- ===================================================================== --> | ||
128 | <target name="postGenerate"> | ||
129 | <antcall target="clean" /> | ||
130 | </target> | ||
131 | |||
132 | <!-- ===================================================================== --> | ||
133 | <!-- Steps to do before running the build.xmls for the elements being built. --> | ||
134 | <!-- ===================================================================== --> | ||
135 | <target name="preProcess"> | ||
136 | </target> | ||
137 | |||
138 | <!-- ===================================================================== --> | ||
139 | <!-- Steps to do after running the build.xmls for the elements being built. --> | ||
140 | <!-- ===================================================================== --> | ||
141 | <target name="postProcess"> | ||
142 | </target> | ||
143 | |||
144 | <!-- ===================================================================== --> | ||
145 | <!-- Steps to do before running assemble. --> | ||
146 | <!-- ===================================================================== --> | ||
147 | <target name="preAssemble"> | ||
148 | </target> | ||
149 | |||
150 | <!-- ===================================================================== --> | ||
151 | <!-- Steps to do after running assemble. --> | ||
152 | <!-- ===================================================================== --> | ||
153 | <target name="postAssemble"> | ||
154 | </target> | ||
155 | |||
156 | <!-- ===================================================================== --> | ||
157 | <!-- Steps to do before running package. --> | ||
158 | <!-- ===================================================================== --> | ||
159 | <target name="prePackage"> | ||
160 | </target> | ||
161 | |||
162 | <!-- ===================================================================== --> | ||
163 | <!-- Steps to do after running package. --> | ||
164 | <!-- ===================================================================== --> | ||
165 | <target name="postPackage"> | ||
166 | </target> | ||
167 | |||
168 | <!-- ===================================================================== --> | ||
169 | <!-- Steps to do after the build is done. --> | ||
170 | <!-- ===================================================================== --> | ||
171 | <target name="postBuild"> | ||
172 | <antcall target="gatherLogs" /> | ||
173 | <antcall target="updateSiteContent" /> | ||
174 | </target> | ||
175 | |||
176 | <target name="updateSiteContent" if="p2.gathering"> | ||
177 | <property file="${buildDirectory}/finalFeaturesVersions.properties" /> | ||
178 | <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" /> | ||
179 | <replace file="${buildDirectory}/site.xml"> | ||
180 | <replacefilter token="@bcGenVersion@" value="${org.yocto.bc}"/> | ||
181 | </replace> | ||
182 | <zip destfile="${buildDirectory}/${buildLabel}/org.yocto.bc-${buildId}-group.group.group.zip" update="true"> | ||
183 | <zipfileset dir="${buildDirectory}"> | ||
184 | <include name="site.xml"/> | ||
185 | </zipfileset> | ||
186 | <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site"> | ||
187 | <include name="index.html"/> | ||
188 | </zipfileset> | ||
189 | <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site/web" prefix="web"/> | ||
190 | </zip> | ||
191 | </target> | ||
192 | |||
193 | <!-- ===================================================================== --> | ||
194 | <!-- Steps to do to test the build results --> | ||
195 | <!-- ===================================================================== --> | ||
196 | <target name="test"> | ||
197 | </target> | ||
198 | |||
199 | <!-- ===================================================================== --> | ||
200 | <!-- Steps to do to publish the build results --> | ||
201 | <!-- ===================================================================== --> | ||
202 | <target name="publish"> | ||
203 | </target> | ||
204 | |||
205 | <!-- ===================================================================== --> | ||
206 | <!-- Default target --> | ||
207 | <!-- ===================================================================== --> | ||
208 | <target name="noDefault"> | ||
209 | <echo message="You must specify a target when invoking this file" /> | ||
210 | </target> | ||
211 | |||
212 | </project> | ||
diff --git a/features/org.yocto.bc/.project b/features/org.yocto.bc/.project new file mode 100644 index 0000000..553c486 --- /dev/null +++ b/features/org.yocto.bc/.project | |||
@@ -0,0 +1,17 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.bc</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | <buildCommand> | ||
9 | <name>org.eclipse.pde.FeatureBuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | </buildSpec> | ||
14 | <natures> | ||
15 | <nature>org.eclipse.pde.FeatureNature</nature> | ||
16 | </natures> | ||
17 | </projectDescription> | ||
diff --git a/features/org.yocto.bc/build.properties b/features/org.yocto.bc/build.properties new file mode 100644 index 0000000..52c3cfc --- /dev/null +++ b/features/org.yocto.bc/build.properties | |||
@@ -0,0 +1,3 @@ | |||
1 | bin.includes = feature.xml,\ | ||
2 | license.html,\ | ||
3 | feature.properties | ||
diff --git a/features/org.yocto.bc/feature.properties b/features/org.yocto.bc/feature.properties new file mode 100644 index 0000000..71cd52d --- /dev/null +++ b/features/org.yocto.bc/feature.properties | |||
@@ -0,0 +1,163 @@ | |||
1 | ############################################################################### | ||
2 | # Copyright (c) 2010 Intel, Inc. and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # Intel - initial implementation | ||
10 | ############################################################################### | ||
11 | |||
12 | # "featureName" property - name of the feature | ||
13 | featureName=Yocto Project Bitbake Commander Plug-in | ||
14 | |||
15 | # "providerName" property - name of the company that provides the feature | ||
16 | providerName=yoctoproject.org | ||
17 | |||
18 | # "updateSiteName" property - label for the update site | ||
19 | updateSiteName=Yocto Project Update Site | ||
20 | |||
21 | # "description" property - description of the feature | ||
22 | description=\ | ||
23 | Eclipse plug-in for developing bitbake commander project using Yocto Project | ||
24 | |||
25 | # copyright | ||
26 | copyright=\ | ||
27 | Copyright (c) 2012 Intel, Inc. and others. \ | ||
28 | All rights reserved. This program and the accompanying materials \ | ||
29 | are made available under the terms of the Eclipse Public License v1.0 \ | ||
30 | which accompanies this distribution, and is available at \ | ||
31 | http://www.eclipse.org/legal/epl-v10.html | ||
32 | ################ end of copyright property #################################### | ||
33 | |||
34 | # "licenseURL" property - URL of the "Feature License" | ||
35 | # do not translate value - just change to point to a locale-specific HTML page | ||
36 | licenseURL=license.html | ||
37 | |||
38 | # "license" property - text of the "Feature Update License" | ||
39 | # should be plain text version of license agreement pointed to be "licenseURL" | ||
40 | license=\ | ||
41 | Eclipse Foundation Software User Agreement\n\ | ||
42 | April 14, 2010\n\ | ||
43 | \n\ | ||
44 | Usage Of Content\n\ | ||
45 | \n\ | ||
46 | THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ | ||
47 | OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ | ||
48 | USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ | ||
49 | AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ | ||
50 | NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ | ||
51 | AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ | ||
52 | AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ | ||
53 | OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ | ||
54 | TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ | ||
55 | OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ | ||
56 | BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ | ||
57 | \n\ | ||
58 | Applicable Licenses\n\ | ||
59 | \n\ | ||
60 | Unless otherwise indicated, all Content made available by the\n\ | ||
61 | Eclipse Foundation is provided to you under the terms and conditions of\n\ | ||
62 | the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ | ||
63 | provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ | ||
64 | For purposes of the EPL, "Program" will mean the Content.\n\ | ||
65 | \n\ | ||
66 | Content includes, but is not limited to, source code, object code,\n\ | ||
67 | documentation and other files maintained in the Eclipse Foundation source code\n\ | ||
68 | repository ("Repository") in software modules ("Modules") and made available\n\ | ||
69 | as downloadable archives ("Downloads").\n\ | ||
70 | \n\ | ||
71 | - Content may be structured and packaged into modules to facilitate delivering,\n\ | ||
72 | extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ | ||
73 | plug-in fragments ("Fragments"), and features ("Features").\n\ | ||
74 | - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ | ||
75 | in a directory named "plugins".\n\ | ||
76 | - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ | ||
77 | Each Feature may be packaged as a sub-directory in a directory named "features".\n\ | ||
78 | Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ | ||
79 | numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ | ||
80 | - Features may also include other Features ("Included Features"). Within a Feature, files\n\ | ||
81 | named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ | ||
82 | \n\ | ||
83 | The terms and conditions governing Plug-ins and Fragments should be\n\ | ||
84 | contained in files named "about.html" ("Abouts"). The terms and\n\ | ||
85 | conditions governing Features and Included Features should be contained\n\ | ||
86 | in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ | ||
87 | Licenses may be located in any directory of a Download or Module\n\ | ||
88 | including, but not limited to the following locations:\n\ | ||
89 | \n\ | ||
90 | - The top-level (root) directory\n\ | ||
91 | - Plug-in and Fragment directories\n\ | ||
92 | - Inside Plug-ins and Fragments packaged as JARs\n\ | ||
93 | - Sub-directories of the directory named "src" of certain Plug-ins\n\ | ||
94 | - Feature directories\n\ | ||
95 | \n\ | ||
96 | Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ | ||
97 | Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ | ||
98 | Update License") during the installation process. If the Feature contains\n\ | ||
99 | Included Features, the Feature Update License should either provide you\n\ | ||
100 | with the terms and conditions governing the Included Features or inform\n\ | ||
101 | you where you can locate them. Feature Update Licenses may be found in\n\ | ||
102 | the "license" property of files named "feature.properties" found within a Feature.\n\ | ||
103 | Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ | ||
104 | terms and conditions (or references to such terms and conditions) that\n\ | ||
105 | govern your use of the associated Content in that directory.\n\ | ||
106 | \n\ | ||
107 | THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ | ||
108 | TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ | ||
109 | SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ | ||
110 | \n\ | ||
111 | - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ | ||
112 | - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ | ||
113 | - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ | ||
114 | - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ | ||
115 | - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ | ||
116 | \n\ | ||
117 | IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ | ||
118 | TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ | ||
119 | is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ | ||
120 | govern that particular Content.\n\ | ||
121 | \n\ | ||
122 | \n\Use of Provisioning Technology\n\ | ||
123 | \n\ | ||
124 | The Eclipse Foundation makes available provisioning software, examples of which include,\n\ | ||
125 | but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ | ||
126 | the purpose of allowing users to install software, documentation, information and/or\n\ | ||
127 | other materials (collectively "Installable Software"). This capability is provided with\n\ | ||
128 | the intent of allowing such users to install, extend and update Eclipse-based products.\n\ | ||
129 | Information about packaging Installable Software is available at\n\ | ||
130 | http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ | ||
131 | \n\ | ||
132 | You may use Provisioning Technology to allow other parties to install Installable Software.\n\ | ||
133 | You shall be responsible for enabling the applicable license agreements relating to the\n\ | ||
134 | Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ | ||
135 | in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ | ||
136 | making it available in accordance with the Specification, you further acknowledge your\n\ | ||
137 | agreement to, and the acquisition of all necessary rights to permit the following:\n\ | ||
138 | \n\ | ||
139 | 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ | ||
140 | the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ | ||
141 | extending or updating the functionality of an Eclipse-based product.\n\ | ||
142 | 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ | ||
143 | Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ | ||
144 | 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ | ||
145 | govern the use of the Installable Software ("Installable Software Agreement") and such\n\ | ||
146 | Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ | ||
147 | with the Specification. Such Installable Software Agreement must inform the user of the\n\ | ||
148 | terms and conditions that govern the Installable Software and must solicit acceptance by\n\ | ||
149 | the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ | ||
150 | indication of agreement by the user, the provisioning Technology will complete installation\n\ | ||
151 | of the Installable Software.\n\ | ||
152 | \n\ | ||
153 | Cryptography\n\ | ||
154 | \n\ | ||
155 | Content may contain encryption software. The country in which you are\n\ | ||
156 | currently may have restrictions on the import, possession, and use,\n\ | ||
157 | and/or re-export to another country, of encryption software. BEFORE\n\ | ||
158 | using any encryption software, please check the country's laws,\n\ | ||
159 | regulations and policies concerning the import, possession, or use, and\n\ | ||
160 | re-export of encryption software, to see if this is permitted.\n\ | ||
161 | \n\ | ||
162 | Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n | ||
163 | ########### end of license property ########################################## | ||
diff --git a/features/org.yocto.bc/feature.xml b/features/org.yocto.bc/feature.xml new file mode 100644 index 0000000..dc31a18 --- /dev/null +++ b/features/org.yocto.bc/feature.xml | |||
@@ -0,0 +1,49 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <feature | ||
3 | id="org.yocto.bc" | ||
4 | label="%featureName" | ||
5 | version="1.4.0.qualifier" | ||
6 | provider-name="%providerName"> | ||
7 | |||
8 | <description> | ||
9 | %description | ||
10 | </description> | ||
11 | |||
12 | <copyright> | ||
13 | %copyright | ||
14 | </copyright> | ||
15 | |||
16 | <license url="%licenseURL"> | ||
17 | %license | ||
18 | </license> | ||
19 | |||
20 | <url> | ||
21 | <update label="%updateSiteName" url="http://yoctoproject.org/downloads/eclipse-plugin/"/> | ||
22 | </url> | ||
23 | |||
24 | <requires> | ||
25 | <import plugin="org.eclipse.ui"/> | ||
26 | <import plugin="org.eclipse.core.runtime"/> | ||
27 | <import plugin="org.eclipse.core.resources"/> | ||
28 | <import plugin="org.eclipse.jface.text"/> | ||
29 | <import plugin="org.eclipse.ui.editors"/> | ||
30 | <import plugin="org.eclipse.ui.ide"/> | ||
31 | <import plugin="org.eclipse.ui.console"/> | ||
32 | <import plugin="org.eclipse.core.filesystem"/> | ||
33 | </requires> | ||
34 | |||
35 | <plugin | ||
36 | id="org.yocto.bc.ui" | ||
37 | download-size="0" | ||
38 | install-size="0" | ||
39 | version="0.0.0" | ||
40 | unpack="false"/> | ||
41 | |||
42 | <plugin | ||
43 | id="org.yocto.remote.utils" | ||
44 | download-size="0" | ||
45 | install-size="0" | ||
46 | version="0.0.0" | ||
47 | unpack="false"/> | ||
48 | |||
49 | </feature> | ||
diff --git a/features/org.yocto.bc/license.html b/features/org.yocto.bc/license.html new file mode 100644 index 0000000..c184ca3 --- /dev/null +++ b/features/org.yocto.bc/license.html | |||
@@ -0,0 +1,107 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1" ?> | ||
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
3 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
4 | <head> | ||
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> | ||
6 | <title>Eclipse Foundation Software User Agreement</title> | ||
7 | </head> | ||
8 | |||
9 | <body lang="EN-US"> | ||
10 | <h2>Eclipse Foundation Software User Agreement</h2> | ||
11 | <p>April 14, 2010</p> | ||
12 | |||
13 | <h3>Usage Of Content</h3> | ||
14 | |||
15 | <p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS | ||
16 | (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND | ||
17 | CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE | ||
18 | OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR | ||
19 | NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND | ||
20 | CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p> | ||
21 | |||
22 | <h3>Applicable Licenses</h3> | ||
23 | |||
24 | <p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 | ||
25 | ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. | ||
26 | For purposes of the EPL, "Program" will mean the Content.</p> | ||
27 | |||
28 | <p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code | ||
29 | repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p> | ||
30 | |||
31 | <ul> | ||
32 | <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li> | ||
33 | <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li> | ||
34 | <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins | ||
35 | and/or Fragments associated with that Feature.</li> | ||
36 | <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li> | ||
37 | </ul> | ||
38 | |||
39 | <p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and | ||
40 | Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module | ||
41 | including, but not limited to the following locations:</p> | ||
42 | |||
43 | <ul> | ||
44 | <li>The top-level (root) directory</li> | ||
45 | <li>Plug-in and Fragment directories</li> | ||
46 | <li>Inside Plug-ins and Fragments packaged as JARs</li> | ||
47 | <li>Sub-directories of the directory named "src" of certain Plug-ins</li> | ||
48 | <li>Feature directories</li> | ||
49 | </ul> | ||
50 | |||
51 | <p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the | ||
52 | installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or | ||
53 | inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. | ||
54 | Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in | ||
55 | that directory.</p> | ||
56 | |||
57 | <p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE | ||
58 | OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p> | ||
59 | |||
60 | <ul> | ||
61 | <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li> | ||
62 | <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li> | ||
63 | <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li> | ||
64 | <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li> | ||
65 | <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li> | ||
66 | </ul> | ||
67 | |||
68 | <p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please | ||
69 | contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p> | ||
70 | |||
71 | |||
72 | <h3>Use of Provisioning Technology</h3> | ||
73 | |||
74 | <p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse | ||
75 | Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or | ||
76 | other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to | ||
77 | install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a | ||
78 | href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a> | ||
79 | ("Specification").</p> | ||
80 | |||
81 | <p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the | ||
82 | applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology | ||
83 | in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the | ||
84 | Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p> | ||
85 | |||
86 | <ol> | ||
87 | <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology | ||
88 | on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based | ||
89 | product.</li> | ||
90 | <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be | ||
91 | accessed and copied to the Target Machine.</li> | ||
92 | <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable | ||
93 | Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target | ||
94 | Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern | ||
95 | the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such | ||
96 | indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li> | ||
97 | </ol> | ||
98 | |||
99 | <h3>Cryptography</h3> | ||
100 | |||
101 | <p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to | ||
102 | another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, | ||
103 | possession, or use, and re-export of encryption software, to see if this is permitted.</p> | ||
104 | |||
105 | <p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p> | ||
106 | </body> | ||
107 | </html> | ||
diff --git a/features/org.yocto.doc.headless.build/.project b/features/org.yocto.doc.headless.build/.project new file mode 100644 index 0000000..106c772 --- /dev/null +++ b/features/org.yocto.doc.headless.build/.project | |||
@@ -0,0 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.doc.headless.build</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | </buildSpec> | ||
9 | <natures> | ||
10 | </natures> | ||
11 | </projectDescription> | ||
diff --git a/features/org.yocto.doc.headless.build/build.properties b/features/org.yocto.doc.headless.build/build.properties new file mode 100644 index 0000000..6a857f8 --- /dev/null +++ b/features/org.yocto.doc.headless.build/build.properties | |||
@@ -0,0 +1,262 @@ | |||
1 | ############################################################################### | ||
2 | # Copyright (c) 2003, 2009 IBM Corporation and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # IBM Corporation - initial API and implementation | ||
10 | ############################################################################### | ||
11 | ##################### | ||
12 | # Parameters describing how and where to execute the build. | ||
13 | # Typical users need only update the following properties: | ||
14 | # baseLocation - where things you are building against are installed | ||
15 | # bootclasspath - The base jars to compile against (typicaly rt.jar) | ||
16 | # configs - the list of {os, ws, arch} configurations to build. | ||
17 | # | ||
18 | # Of course any of the settings here can be overridden by spec'ing | ||
19 | # them on the command line (e.g., -DbaseLocation=d:/eclipse | ||
20 | |||
21 | #The type of the top level element we are building, generally "feature" | ||
22 | topLevelElementType = feature | ||
23 | #The id of the top level element we are building | ||
24 | topLevelElementId = org.yocto.doc | ||
25 | |||
26 | ############# PRODUCT/PACKAGING CONTROL ############# | ||
27 | product=/plugin or feature id/path/to/.product | ||
28 | runPackager=true | ||
29 | |||
30 | #Set the name of the archive that will result from the product build. | ||
31 | #archiveNamePrefix= | ||
32 | |||
33 | # The prefix that will be used in the generated archive. | ||
34 | archivePrefix=eclipse | ||
35 | |||
36 | # The location underwhich all of the build output will be collected. | ||
37 | collectingFolder=${archivePrefix} | ||
38 | |||
39 | # The list of {os, ws, arch} configurations to build. This | ||
40 | # value is a '&' separated list of ',' separate triples. For example, | ||
41 | # configs=win32,win32,x86 & linux,motif,x86 | ||
42 | # By default the value is *,*,* | ||
43 | configs = *, *, * | ||
44 | #configs=win32, win32, x86 & \ | ||
45 | # win32,win32,x86_64 & \ | ||
46 | # win32,win32,wpf & \ | ||
47 | # linux, gtk, ppc & \ | ||
48 | # linux, gtk, x86 & \ | ||
49 | # linux, gtk, x86_64 & \ | ||
50 | # linux, motif, x86 & \ | ||
51 | # solaris, motif, sparc & \ | ||
52 | # solaris, gtk, sparc & \ | ||
53 | # aix, motif, ppc & \ | ||
54 | # hpux, motif, ia64_32 & \ | ||
55 | # macosx, carbon, ppc & \ | ||
56 | # macosx, carbon, x86 & \ | ||
57 | # macosx, cocoa, ppc & \ | ||
58 | # macosx, cocoa, x86 & \ | ||
59 | # macosx, cocoa, x86_64 | ||
60 | |||
61 | # By default PDE creates one archive (result) per entry listed in the configs property. | ||
62 | # Setting this value to true will cause PDE to only create one output containing all | ||
63 | # artifacts for all the platforms listed in the configs property. | ||
64 | # To control the output format for the group, add a "group, group, group - <format>" entry to the | ||
65 | # archivesFormat. | ||
66 | #groupConfigurations=true | ||
67 | |||
68 | #The format of the archive. By default a zip is created using antZip. | ||
69 | #The list can only contain the configuration for which the desired format is different than zip. | ||
70 | #archivesFormat=win32, win32, x86 - antZip& \ | ||
71 | # linux, gtk, ppc - antZip &\ | ||
72 | # linux, gtk, x86 - antZip& \ | ||
73 | # linux, gtk, x86_64 - antZip& \ | ||
74 | # linux, motif, x86 - antZip& \ | ||
75 | # solaris, motif, sparc - antZip& \ | ||
76 | # solaris, gtk, sparc - antZip& \ | ||
77 | # aix, motif, ppc - antZip& \ | ||
78 | # hpux, motif, PA_RISC - antZip& \ | ||
79 | # macosx, carbon, ppc - antZip | ||
80 | |||
81 | #Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles. | ||
82 | allowBinaryCycles = true | ||
83 | |||
84 | #Sort bundles depenedencies across all features instead of just within a given feature. | ||
85 | #flattenDependencies = true | ||
86 | |||
87 | #Parallel compilation, requires flattenedDependencies=true | ||
88 | #parallelCompilation=true | ||
89 | #parallelThreadCount= | ||
90 | #parallelThreadsPerProcessor= | ||
91 | |||
92 | #Set to true if you want the output to be ready for an update jar (no site.xml generated) | ||
93 | outputUpdateJars = true | ||
94 | |||
95 | #Set to true for Jnlp generation | ||
96 | #codebase should be a URL that will be used as the root of all relative URLs in the output. | ||
97 | #generateJnlp=false | ||
98 | #jnlp.codebase=<codebase url> | ||
99 | #jnlp.j2se=<j2se version> | ||
100 | #jnlp.locale=<a locale> | ||
101 | #jnlp.generateOfflineAllowed=true or false generate <offlineAllowed/> attribute in the generated features | ||
102 | #jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built | ||
103 | |||
104 | #Set to true if you want to sign jars | ||
105 | #signJars=false | ||
106 | #sign.alias=<alias> | ||
107 | #sign.keystore=<keystore location> | ||
108 | #sign.storepass=<keystore password> | ||
109 | #sign.keypass=<key password> | ||
110 | |||
111 | #Arguments to send to the zip executable | ||
112 | zipargs= | ||
113 | |||
114 | #Arguments to send to the tar executable | ||
115 | tarargs= | ||
116 | |||
117 | #Control the creation of a file containing the version included in each configuration - on by default | ||
118 | #generateVersionsLists=false | ||
119 | |||
120 | ############## BUILD NAMING CONTROL ################ | ||
121 | # The directory into which the build elements are fetched and where | ||
122 | # the build takes place. | ||
123 | #buildDirectory= | ||
124 | |||
125 | # Type of build. Used in naming the build output. Typically this value is | ||
126 | # one of I, N, M, S, ... | ||
127 | buildType=I | ||
128 | |||
129 | # ID of the build. Used in naming the build output. | ||
130 | buildId=TestBuild | ||
131 | |||
132 | # Label for the build. Used in naming the build output | ||
133 | buildLabel=${buildType}.${buildId} | ||
134 | |||
135 | # Timestamp for the build. Used in naming the build output | ||
136 | timestamp=007 | ||
137 | |||
138 | #The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde. | ||
139 | #The value will only be applied to plugin or features indicating build.properties, qualifier = context | ||
140 | #forceContextQualifier=<the value for the qualifier> | ||
141 | |||
142 | #Enable / disable the generation of a suffix for the features that use .qualifier. | ||
143 | #The generated suffix is computed according to the content of the feature | ||
144 | #generateFeatureVersionSuffix=true | ||
145 | |||
146 | ############# BASE CONTROL ############# | ||
147 | # Settings for the base Eclipse components and Java class libraries | ||
148 | # against which you are building. | ||
149 | # Base location for anything the build needs to compile against. For example, | ||
150 | # in most RCP app or a plug-in, the baseLocation should be the location of a previously | ||
151 | # installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack. | ||
152 | |||
153 | #base=<path/to/parent/of/eclipse> | ||
154 | #baseLocation=${base}/eclipse | ||
155 | |||
156 | #Folder containing repositories whose content is needed to compile against | ||
157 | #repoBaseLocation=${base}/repos | ||
158 | #Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against | ||
159 | #transformedRepoLocation=${base}/transformedRepos | ||
160 | |||
161 | #Os/Ws/Arch/nl of the eclipse specified by baseLocation | ||
162 | #baseos=win32 | ||
163 | #basews=win32 | ||
164 | #basearch=x86 | ||
165 | |||
166 | #this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built | ||
167 | filteredDependencyCheck=false | ||
168 | |||
169 | #this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons) | ||
170 | resolution.devMode=false | ||
171 | |||
172 | #pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :) | ||
173 | #a location is one of: | ||
174 | #- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo | ||
175 | #- a directory that contains a /plugins or /features subdirectory | ||
176 | #- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml | ||
177 | #pluginPath= | ||
178 | |||
179 | skipBase=true | ||
180 | eclipseURL=<url for eclipse download site> | ||
181 | eclipseBuildId=<Id of Eclipse build to get> | ||
182 | eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip | ||
183 | |||
184 | |||
185 | ############# MAP FILE CONTROL ################ | ||
186 | # This section defines CVS tags to use when fetching the map files from the repository. | ||
187 | # If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml | ||
188 | |||
189 | skipMaps=true | ||
190 | mapsRepo=:pserver:anonymous@example.com/path/to/repo | ||
191 | mapsRoot=path/to/maps | ||
192 | mapsCheckoutTag=HEAD | ||
193 | |||
194 | #tagMaps=true | ||
195 | mapsTagTag=v${buildId} | ||
196 | |||
197 | |||
198 | ############ REPOSITORY CONTROL ############### | ||
199 | # This section defines properties parameterizing the repositories where plugins, fragments | ||
200 | # bundles and features are being obtained from. | ||
201 | |||
202 | # The tags to use when fetching elements to build. | ||
203 | # By default thebuilder will use whatever is in the maps. | ||
204 | # This value takes the form of a comma separated list of repository identifier (like used in the map files) and the | ||
205 | # overriding value | ||
206 | # For example fetchTag=CVS=HEAD, SVN=v20050101 | ||
207 | # fetchTag=HEAD | ||
208 | skipFetch=true | ||
209 | |||
210 | |||
211 | ############# JAVA COMPILER OPTIONS ############## | ||
212 | # The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE | ||
213 | #bootclasspath=${java.home}/lib/rt.jar | ||
214 | |||
215 | # specific JRE locations to compile against. These values are used to compile bundles specifying a | ||
216 | # Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support | ||
217 | #CDC-1.0/Foundation-1.0= /path/to/rt.jar | ||
218 | #CDC-1.1/Foundation-1.1= | ||
219 | #OSGi/Minimum-1.0= | ||
220 | #OSGi/Minimum-1.1= | ||
221 | #JRE-1.1= | ||
222 | #J2SE-1.2= | ||
223 | #J2SE-1.3= | ||
224 | #J2SE-1.4= | ||
225 | #J2SE-1.5= | ||
226 | #JavaSE-1.6= | ||
227 | #PersonalJava-1.1= | ||
228 | #PersonalJava-1.2= | ||
229 | #CDC-1.0/PersonalBasis-1.0= | ||
230 | #CDC-1.0/PersonalJava-1.0= | ||
231 | #CDC-1.1/PersonalBasis-1.1= | ||
232 | #CDC-1.1/PersonalJava-1.1= | ||
233 | |||
234 | # Specify the output format of the compiler log when eclipse jdt is used | ||
235 | logExtension=.log | ||
236 | |||
237 | # Whether or not to include debug info in the output jars | ||
238 | javacDebugInfo=false | ||
239 | |||
240 | # Whether or not to fail the build if there are compiler errors | ||
241 | javacFailOnError=true | ||
242 | |||
243 | # Enable or disable verbose mode of the compiler | ||
244 | javacVerbose=true | ||
245 | |||
246 | # Extra arguments for the compiler. These are specific to the java compiler being used. | ||
247 | #compilerArg= | ||
248 | |||
249 | # Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties | ||
250 | javacSource=1.6 | ||
251 | |||
252 | # Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties. | ||
253 | javacTarget=1.6 | ||
254 | |||
255 | #individualSourceBundles=true | ||
256 | |||
257 | #p2.gathering=true | ||
258 | p2.compress=true | ||
259 | #p2.category.site=file:${buildDirectory}/site.xml | ||
260 | p2.category.definition=file:${buildDirectory}/category.xml | ||
261 | p2.metadata.repo.name=Yocto Project Update Site | ||
262 | p2.artifact.repo.name=Yocto Project Update Site | ||
diff --git a/features/org.yocto.doc.headless.build/customTargets.xml b/features/org.yocto.doc.headless.build/customTargets.xml new file mode 100644 index 0000000..8cb505e --- /dev/null +++ b/features/org.yocto.doc.headless.build/customTargets.xml | |||
@@ -0,0 +1,212 @@ | |||
1 | <project name="Build specific targets and properties" default="noDefault"> | ||
2 | |||
3 | <!-- ===================================================================== --> | ||
4 | <!-- Run a given ${target} on all elements being built --> | ||
5 | <!-- Add on <ant> task for each top level element being built. --> | ||
6 | <!-- ===================================================================== --> | ||
7 | <available property="allElementsFile" file="${builder}/allElements.xml" value="${builder}/allElements.xml"/> | ||
8 | <property name="allElementsFile" location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/> | ||
9 | |||
10 | <import file="${allElementsFile}" /> | ||
11 | <target name="allElements"> | ||
12 | <antcall target="allElementsDelegator" /> | ||
13 | </target> | ||
14 | |||
15 | <!-- ===================================================================== --> | ||
16 | <!-- ===================================================================== --> | ||
17 | <target name="getBaseComponents" depends="checkLocalBase" unless="skipBase"> | ||
18 | <get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" /> | ||
19 | <unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" /> | ||
20 | </target> | ||
21 | |||
22 | <target name="checkLocalBase"> | ||
23 | <available file="${base}" property="skipBase" /> | ||
24 | </target> | ||
25 | |||
26 | <!-- ===================================================================== --> | ||
27 | <!-- Check out map files from correct repository --> | ||
28 | <!-- Replace values for mapsCheckoutTag as desired. --> | ||
29 | <!-- ===================================================================== --> | ||
30 | <target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps"> | ||
31 | <property name="mapsCheckoutTag" value="HEAD" /> | ||
32 | <cvs cvsRoot="${mapsRepo}" package="${mapsRoot}" dest="${buildDirectory}/maps" tag="${mapsCheckoutTag}" /> | ||
33 | </target> | ||
34 | |||
35 | <target name="checkLocalMaps"> | ||
36 | <available property="skipMaps" file="${buildDirectory}/maps" /> | ||
37 | </target> | ||
38 | |||
39 | <target name="tagMapFiles" if="tagMaps"> | ||
40 | <cvs dest="${buildDirectory}/maps/${mapsRoot}" command="tag ${mapsTagTag}" /> | ||
41 | </target> | ||
42 | |||
43 | <!-- ===================================================================== --> | ||
44 | |||
45 | <target name="clean" unless="noclean"> | ||
46 | <antcall target="allElements"> | ||
47 | <param name="target" value="cleanElement" /> | ||
48 | </antcall> | ||
49 | </target> | ||
50 | |||
51 | <target name="gatherLogs"> | ||
52 | <mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" /> | ||
53 | <antcall target="allElements"> | ||
54 | <param name="target" value="gatherLogs" /> | ||
55 | </antcall> | ||
56 | <unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true"> | ||
57 | <fileset dir="${buildDirectory}/features"> | ||
58 | <include name="**/*.log.zip" /> | ||
59 | </fileset> | ||
60 | </unzip> | ||
61 | </target> | ||
62 | |||
63 | <!-- ===================================================================== --> | ||
64 | <!-- Steps to do before setup --> | ||
65 | <!-- ===================================================================== --> | ||
66 | <target name="preSetup"> | ||
67 | <delete dir="${buildDirectory}/plugins"/> | ||
68 | <mkdir dir="${buildDirectory}/plugins"/> | ||
69 | <copy todir="${buildDirectory}/plugins" failonerror="true"> | ||
70 | <fileset dir="${otherSrcDirectory}/plugins"/> | ||
71 | </copy> | ||
72 | <delete dir="${buildDirectory}/features"/> | ||
73 | <copy todir="${buildDirectory}/features" failonerror="true" > | ||
74 | <fileset dir="${otherSrcDirectory}/features"/> | ||
75 | </copy> | ||
76 | <antcall target="prepareForP2" /> | ||
77 | </target> | ||
78 | |||
79 | <target name="prepareForP2" if="p2.gathering"> | ||
80 | <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" /> | ||
81 | <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/category.xml" todir="${buildDirectory}" /> | ||
82 | <xmlproperty file="${otherSrcDirectory}/features/org.yocto.doc/feature.xml" /> | ||
83 | <replace file="${buildDirectory}/category.xml"> | ||
84 | <replacefilter token="@docFeatureVersion@" value="${feature(version)}"/> | ||
85 | </replace> | ||
86 | </target> | ||
87 | |||
88 | <!-- ===================================================================== --> | ||
89 | <!-- Steps to do after setup but before starting the build proper --> | ||
90 | <!-- ===================================================================== --> | ||
91 | <target name="postSetup"> | ||
92 | <antcall target="getBaseComponents" /> | ||
93 | </target> | ||
94 | |||
95 | <!-- ===================================================================== --> | ||
96 | <!-- Steps to do before fetching the build elements --> | ||
97 | <!-- ===================================================================== --> | ||
98 | <target name="preFetch"> | ||
99 | </target> | ||
100 | |||
101 | <!-- ===================================================================== --> | ||
102 | <!-- Steps to do after fetching the build elements --> | ||
103 | <!-- ===================================================================== --> | ||
104 | <target name="postFetch"> | ||
105 | </target> | ||
106 | |||
107 | <!-- ===================================================================== --> | ||
108 | <!-- Steps to do before the repositories are being processed --> | ||
109 | <!-- ===================================================================== --> | ||
110 | <target name="preProcessRepos"> | ||
111 | </target> | ||
112 | |||
113 | <!-- ===================================================================== --> | ||
114 | <!-- Steps to do after the repositories have been processed --> | ||
115 | <!-- ===================================================================== --> | ||
116 | <target name="postProcessRepos"> | ||
117 | </target> | ||
118 | |||
119 | <!-- ===================================================================== --> | ||
120 | <!-- Steps to do before generating the build scripts. --> | ||
121 | <!-- ===================================================================== --> | ||
122 | <target name="preGenerate"> | ||
123 | </target> | ||
124 | |||
125 | <!-- ===================================================================== --> | ||
126 | <!-- Steps to do after generating the build scripts. --> | ||
127 | <!-- ===================================================================== --> | ||
128 | <target name="postGenerate"> | ||
129 | <antcall target="clean" /> | ||
130 | </target> | ||
131 | |||
132 | <!-- ===================================================================== --> | ||
133 | <!-- Steps to do before running the build.xmls for the elements being built. --> | ||
134 | <!-- ===================================================================== --> | ||
135 | <target name="preProcess"> | ||
136 | </target> | ||
137 | |||
138 | <!-- ===================================================================== --> | ||
139 | <!-- Steps to do after running the build.xmls for the elements being built. --> | ||
140 | <!-- ===================================================================== --> | ||
141 | <target name="postProcess"> | ||
142 | </target> | ||
143 | |||
144 | <!-- ===================================================================== --> | ||
145 | <!-- Steps to do before running assemble. --> | ||
146 | <!-- ===================================================================== --> | ||
147 | <target name="preAssemble"> | ||
148 | </target> | ||
149 | |||
150 | <!-- ===================================================================== --> | ||
151 | <!-- Steps to do after running assemble. --> | ||
152 | <!-- ===================================================================== --> | ||
153 | <target name="postAssemble"> | ||
154 | </target> | ||
155 | |||
156 | <!-- ===================================================================== --> | ||
157 | <!-- Steps to do before running package. --> | ||
158 | <!-- ===================================================================== --> | ||
159 | <target name="prePackage"> | ||
160 | </target> | ||
161 | |||
162 | <!-- ===================================================================== --> | ||
163 | <!-- Steps to do after running package. --> | ||
164 | <!-- ===================================================================== --> | ||
165 | <target name="postPackage"> | ||
166 | </target> | ||
167 | |||
168 | <!-- ===================================================================== --> | ||
169 | <!-- Steps to do after the build is done. --> | ||
170 | <!-- ===================================================================== --> | ||
171 | <target name="postBuild"> | ||
172 | <antcall target="gatherLogs" /> | ||
173 | <antcall target="updateSiteContent" /> | ||
174 | </target> | ||
175 | |||
176 | <target name="updateSiteContent" if="p2.gathering"> | ||
177 | <property file="${buildDirectory}/finalFeaturesVersions.properties" /> | ||
178 | <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" /> | ||
179 | <replace file="${buildDirectory}/site.xml"> | ||
180 | <replacefilter token="@docGenVersion@" value="${org.yocto.doc}"/> | ||
181 | </replace> | ||
182 | <zip destfile="${buildDirectory}/${buildLabel}/org.yocto.doc-${buildId}-group.group.group.zip" update="true"> | ||
183 | <zipfileset dir="${buildDirectory}"> | ||
184 | <include name="site.xml"/> | ||
185 | </zipfileset> | ||
186 | <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site"> | ||
187 | <include name="index.html"/> | ||
188 | </zipfileset> | ||
189 | <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site/web" prefix="web"/> | ||
190 | </zip> | ||
191 | </target> | ||
192 | |||
193 | <!-- ===================================================================== --> | ||
194 | <!-- Steps to do to test the build results --> | ||
195 | <!-- ===================================================================== --> | ||
196 | <target name="test"> | ||
197 | </target> | ||
198 | |||
199 | <!-- ===================================================================== --> | ||
200 | <!-- Steps to do to publish the build results --> | ||
201 | <!-- ===================================================================== --> | ||
202 | <target name="publish"> | ||
203 | </target> | ||
204 | |||
205 | <!-- ===================================================================== --> | ||
206 | <!-- Default target --> | ||
207 | <!-- ===================================================================== --> | ||
208 | <target name="noDefault"> | ||
209 | <echo message="You must specify a target when invoking this file" /> | ||
210 | </target> | ||
211 | |||
212 | </project> | ||
diff --git a/features/org.yocto.doc/.project b/features/org.yocto.doc/.project new file mode 100644 index 0000000..2ad46a8 --- /dev/null +++ b/features/org.yocto.doc/.project | |||
@@ -0,0 +1,17 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.doc</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | <buildCommand> | ||
9 | <name>org.eclipse.pde.FeatureBuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | </buildSpec> | ||
14 | <natures> | ||
15 | <nature>org.eclipse.pde.FeatureNature</nature> | ||
16 | </natures> | ||
17 | </projectDescription> | ||
diff --git a/features/org.yocto.doc/build.properties b/features/org.yocto.doc/build.properties new file mode 100644 index 0000000..52c3cfc --- /dev/null +++ b/features/org.yocto.doc/build.properties | |||
@@ -0,0 +1,3 @@ | |||
1 | bin.includes = feature.xml,\ | ||
2 | license.html,\ | ||
3 | feature.properties | ||
diff --git a/features/org.yocto.doc/feature.properties b/features/org.yocto.doc/feature.properties new file mode 100644 index 0000000..46883e8 --- /dev/null +++ b/features/org.yocto.doc/feature.properties | |||
@@ -0,0 +1,163 @@ | |||
1 | ############################################################################### | ||
2 | # Copyright (c) 2010 Intel, Inc. and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # Intel - initial implementation | ||
10 | ############################################################################### | ||
11 | |||
12 | # "featureName" property - name of the feature | ||
13 | featureName=Yocto Project Documentation Plug-in | ||
14 | |||
15 | # "providerName" property - name of the company that provides the feature | ||
16 | providerName=yoctoproject.org | ||
17 | |||
18 | # "updateSiteName" property - label for the update site | ||
19 | updateSiteName=Yocto Project Update Site | ||
20 | |||
21 | # "description" property - description of the feature | ||
22 | description=\ | ||
23 | Eclipse plug-in containing the documentation of the Yocto Project | ||
24 | |||
25 | # copyright | ||
26 | copyright=\ | ||
27 | Copyright (c) 2013 Intel, Inc. and others. \ | ||
28 | All rights reserved. This program and the accompanying materials \ | ||
29 | are made available under the terms of the Eclipse Public License v1.0 \ | ||
30 | which accompanies this distribution, and is available at \ | ||
31 | http://www.eclipse.org/legal/epl-v10.html | ||
32 | ################ end of copyright property #################################### | ||
33 | |||
34 | # "licenseURL" property - URL of the "Feature License" | ||
35 | # do not translate value - just change to point to a locale-specific HTML page | ||
36 | licenseURL=license.html | ||
37 | |||
38 | # "license" property - text of the "Feature Update License" | ||
39 | # should be plain text version of license agreement pointed to be "licenseURL" | ||
40 | license=\ | ||
41 | Eclipse Foundation Software User Agreement\n\ | ||
42 | April 14, 2010\n\ | ||
43 | \n\ | ||
44 | Usage Of Content\n\ | ||
45 | \n\ | ||
46 | THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ | ||
47 | OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ | ||
48 | USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ | ||
49 | AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ | ||
50 | NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ | ||
51 | AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ | ||
52 | AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ | ||
53 | OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ | ||
54 | TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ | ||
55 | OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ | ||
56 | BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ | ||
57 | \n\ | ||
58 | Applicable Licenses\n\ | ||
59 | \n\ | ||
60 | Unless otherwise indicated, all Content made available by the\n\ | ||
61 | Eclipse Foundation is provided to you under the terms and conditions of\n\ | ||
62 | the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ | ||
63 | provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ | ||
64 | For purposes of the EPL, "Program" will mean the Content.\n\ | ||
65 | \n\ | ||
66 | Content includes, but is not limited to, source code, object code,\n\ | ||
67 | documentation and other files maintained in the Eclipse Foundation source code\n\ | ||
68 | repository ("Repository") in software modules ("Modules") and made available\n\ | ||
69 | as downloadable archives ("Downloads").\n\ | ||
70 | \n\ | ||
71 | - Content may be structured and packaged into modules to facilitate delivering,\n\ | ||
72 | extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ | ||
73 | plug-in fragments ("Fragments"), and features ("Features").\n\ | ||
74 | - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ | ||
75 | in a directory named "plugins".\n\ | ||
76 | - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ | ||
77 | Each Feature may be packaged as a sub-directory in a directory named "features".\n\ | ||
78 | Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ | ||
79 | numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ | ||
80 | - Features may also include other Features ("Included Features"). Within a Feature, files\n\ | ||
81 | named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ | ||
82 | \n\ | ||
83 | The terms and conditions governing Plug-ins and Fragments should be\n\ | ||
84 | contained in files named "about.html" ("Abouts"). The terms and\n\ | ||
85 | conditions governing Features and Included Features should be contained\n\ | ||
86 | in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ | ||
87 | Licenses may be located in any directory of a Download or Module\n\ | ||
88 | including, but not limited to the following locations:\n\ | ||
89 | \n\ | ||
90 | - The top-level (root) directory\n\ | ||
91 | - Plug-in and Fragment directories\n\ | ||
92 | - Inside Plug-ins and Fragments packaged as JARs\n\ | ||
93 | - Sub-directories of the directory named "src" of certain Plug-ins\n\ | ||
94 | - Feature directories\n\ | ||
95 | \n\ | ||
96 | Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ | ||
97 | Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ | ||
98 | Update License") during the installation process. If the Feature contains\n\ | ||
99 | Included Features, the Feature Update License should either provide you\n\ | ||
100 | with the terms and conditions governing the Included Features or inform\n\ | ||
101 | you where you can locate them. Feature Update Licenses may be found in\n\ | ||
102 | the "license" property of files named "feature.properties" found within a Feature.\n\ | ||
103 | Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ | ||
104 | terms and conditions (or references to such terms and conditions) that\n\ | ||
105 | govern your use of the associated Content in that directory.\n\ | ||
106 | \n\ | ||
107 | THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ | ||
108 | TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ | ||
109 | SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ | ||
110 | \n\ | ||
111 | - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ | ||
112 | - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ | ||
113 | - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ | ||
114 | - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ | ||
115 | - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ | ||
116 | \n\ | ||
117 | IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ | ||
118 | TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ | ||
119 | is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ | ||
120 | govern that particular Content.\n\ | ||
121 | \n\ | ||
122 | \n\Use of Provisioning Technology\n\ | ||
123 | \n\ | ||
124 | The Eclipse Foundation makes available provisioning software, examples of which include,\n\ | ||
125 | but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ | ||
126 | the purpose of allowing users to install software, documentation, information and/or\n\ | ||
127 | other materials (collectively "Installable Software"). This capability is provided with\n\ | ||
128 | the intent of allowing such users to install, extend and update Eclipse-based products.\n\ | ||
129 | Information about packaging Installable Software is available at\n\ | ||
130 | http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ | ||
131 | \n\ | ||
132 | You may use Provisioning Technology to allow other parties to install Installable Software.\n\ | ||
133 | You shall be responsible for enabling the applicable license agreements relating to the\n\ | ||
134 | Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ | ||
135 | in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ | ||
136 | making it available in accordance with the Specification, you further acknowledge your\n\ | ||
137 | agreement to, and the acquisition of all necessary rights to permit the following:\n\ | ||
138 | \n\ | ||
139 | 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ | ||
140 | the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ | ||
141 | extending or updating the functionality of an Eclipse-based product.\n\ | ||
142 | 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ | ||
143 | Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ | ||
144 | 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ | ||
145 | govern the use of the Installable Software ("Installable Software Agreement") and such\n\ | ||
146 | Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ | ||
147 | with the Specification. Such Installable Software Agreement must inform the user of the\n\ | ||
148 | terms and conditions that govern the Installable Software and must solicit acceptance by\n\ | ||
149 | the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ | ||
150 | indication of agreement by the user, the provisioning Technology will complete installation\n\ | ||
151 | of the Installable Software.\n\ | ||
152 | \n\ | ||
153 | Cryptography\n\ | ||
154 | \n\ | ||
155 | Content may contain encryption software. The country in which you are\n\ | ||
156 | currently may have restrictions on the import, possession, and use,\n\ | ||
157 | and/or re-export to another country, of encryption software. BEFORE\n\ | ||
158 | using any encryption software, please check the country's laws,\n\ | ||
159 | regulations and policies concerning the import, possession, or use, and\n\ | ||
160 | re-export of encryption software, to see if this is permitted.\n\ | ||
161 | \n\ | ||
162 | Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n | ||
163 | ########### end of license property ########################################## | ||
diff --git a/features/org.yocto.doc/feature.xml b/features/org.yocto.doc/feature.xml new file mode 100644 index 0000000..ed8687e --- /dev/null +++ b/features/org.yocto.doc/feature.xml | |||
@@ -0,0 +1,35 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <feature | ||
3 | id="org.yocto.doc" | ||
4 | label="%featureName" | ||
5 | version="1.4.0.qualifier" | ||
6 | provider-name="%providerName"> | ||
7 | |||
8 | <description> | ||
9 | %description | ||
10 | </description> | ||
11 | |||
12 | <copyright> | ||
13 | %copyright | ||
14 | </copyright> | ||
15 | |||
16 | <license url="%licenseURL"> | ||
17 | %license | ||
18 | </license> | ||
19 | |||
20 | <url> | ||
21 | <update label="%updateSiteName" url="http://yoctoproject.org/downloads/eclipse-plugin/"/> | ||
22 | </url> | ||
23 | |||
24 | <requires> | ||
25 | <import plugin="org.eclipse.help"/> | ||
26 | </requires> | ||
27 | |||
28 | <plugin | ||
29 | id="org.yocto.doc.user" | ||
30 | download-size="0" | ||
31 | install-size="0" | ||
32 | version="0.0.0" | ||
33 | unpack="false"/> | ||
34 | |||
35 | </feature> | ||
diff --git a/features/org.yocto.doc/license.html b/features/org.yocto.doc/license.html new file mode 100644 index 0000000..c184ca3 --- /dev/null +++ b/features/org.yocto.doc/license.html | |||
@@ -0,0 +1,107 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1" ?> | ||
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
3 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
4 | <head> | ||
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> | ||
6 | <title>Eclipse Foundation Software User Agreement</title> | ||
7 | </head> | ||
8 | |||
9 | <body lang="EN-US"> | ||
10 | <h2>Eclipse Foundation Software User Agreement</h2> | ||
11 | <p>April 14, 2010</p> | ||
12 | |||
13 | <h3>Usage Of Content</h3> | ||
14 | |||
15 | <p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS | ||
16 | (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND | ||
17 | CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE | ||
18 | OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR | ||
19 | NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND | ||
20 | CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p> | ||
21 | |||
22 | <h3>Applicable Licenses</h3> | ||
23 | |||
24 | <p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 | ||
25 | ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. | ||
26 | For purposes of the EPL, "Program" will mean the Content.</p> | ||
27 | |||
28 | <p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code | ||
29 | repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p> | ||
30 | |||
31 | <ul> | ||
32 | <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li> | ||
33 | <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li> | ||
34 | <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins | ||
35 | and/or Fragments associated with that Feature.</li> | ||
36 | <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li> | ||
37 | </ul> | ||
38 | |||
39 | <p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and | ||
40 | Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module | ||
41 | including, but not limited to the following locations:</p> | ||
42 | |||
43 | <ul> | ||
44 | <li>The top-level (root) directory</li> | ||
45 | <li>Plug-in and Fragment directories</li> | ||
46 | <li>Inside Plug-ins and Fragments packaged as JARs</li> | ||
47 | <li>Sub-directories of the directory named "src" of certain Plug-ins</li> | ||
48 | <li>Feature directories</li> | ||
49 | </ul> | ||
50 | |||
51 | <p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the | ||
52 | installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or | ||
53 | inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. | ||
54 | Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in | ||
55 | that directory.</p> | ||
56 | |||
57 | <p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE | ||
58 | OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p> | ||
59 | |||
60 | <ul> | ||
61 | <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li> | ||
62 | <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li> | ||
63 | <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li> | ||
64 | <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li> | ||
65 | <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li> | ||
66 | </ul> | ||
67 | |||
68 | <p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please | ||
69 | contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p> | ||
70 | |||
71 | |||
72 | <h3>Use of Provisioning Technology</h3> | ||
73 | |||
74 | <p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse | ||
75 | Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or | ||
76 | other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to | ||
77 | install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a | ||
78 | href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a> | ||
79 | ("Specification").</p> | ||
80 | |||
81 | <p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the | ||
82 | applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology | ||
83 | in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the | ||
84 | Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p> | ||
85 | |||
86 | <ol> | ||
87 | <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology | ||
88 | on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based | ||
89 | product.</li> | ||
90 | <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be | ||
91 | accessed and copied to the Target Machine.</li> | ||
92 | <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable | ||
93 | Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target | ||
94 | Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern | ||
95 | the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such | ||
96 | indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li> | ||
97 | </ol> | ||
98 | |||
99 | <h3>Cryptography</h3> | ||
100 | |||
101 | <p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to | ||
102 | another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, | ||
103 | possession, or use, and re-export of encryption software, to see if this is permitted.</p> | ||
104 | |||
105 | <p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p> | ||
106 | </body> | ||
107 | </html> | ||
diff --git a/features/org.yocto.sdk.headless.build/.project b/features/org.yocto.sdk.headless.build/.project new file mode 100644 index 0000000..f796e80 --- /dev/null +++ b/features/org.yocto.sdk.headless.build/.project | |||
@@ -0,0 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.sdk.headless.build</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | </buildSpec> | ||
9 | <natures> | ||
10 | </natures> | ||
11 | </projectDescription> | ||
diff --git a/features/org.yocto.sdk.headless.build/build.properties b/features/org.yocto.sdk.headless.build/build.properties new file mode 100644 index 0000000..5a9b637 --- /dev/null +++ b/features/org.yocto.sdk.headless.build/build.properties | |||
@@ -0,0 +1,262 @@ | |||
1 | ############################################################################### | ||
2 | # Copyright (c) 2003, 2009 IBM Corporation and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # IBM Corporation - initial API and implementation | ||
10 | ############################################################################### | ||
11 | ##################### | ||
12 | # Parameters describing how and where to execute the build. | ||
13 | # Typical users need only update the following properties: | ||
14 | # baseLocation - where things you are building against are installed | ||
15 | # bootclasspath - The base jars to compile against (typicaly rt.jar) | ||
16 | # configs - the list of {os, ws, arch} configurations to build. | ||
17 | # | ||
18 | # Of course any of the settings here can be overridden by spec'ing | ||
19 | # them on the command line (e.g., -DbaseLocation=d:/eclipse | ||
20 | |||
21 | #The type of the top level element we are building, generally "feature" | ||
22 | topLevelElementType = feature | ||
23 | #The id of the top level element we are building | ||
24 | topLevelElementId = org.yocto.sdk | ||
25 | |||
26 | ############# PRODUCT/PACKAGING CONTROL ############# | ||
27 | product=/plugin or feature id/path/to/.product | ||
28 | runPackager=true | ||
29 | |||
30 | #Set the name of the archive that will result from the product build. | ||
31 | #archiveNamePrefix= | ||
32 | |||
33 | # The prefix that will be used in the generated archive. | ||
34 | archivePrefix=eclipse | ||
35 | |||
36 | # The location underwhich all of the build output will be collected. | ||
37 | collectingFolder=${archivePrefix} | ||
38 | |||
39 | # The list of {os, ws, arch} configurations to build. This | ||
40 | # value is a '&' separated list of ',' separate triples. For example, | ||
41 | # configs=win32,win32,x86 & linux,motif,x86 | ||
42 | # By default the value is *,*,* | ||
43 | configs = *, *, * | ||
44 | #configs=win32, win32, x86 & \ | ||
45 | # win32,win32,x86_64 & \ | ||
46 | # win32,win32,wpf & \ | ||
47 | # linux, gtk, ppc & \ | ||
48 | # linux, gtk, x86 & \ | ||
49 | # linux, gtk, x86_64 & \ | ||
50 | # linux, motif, x86 & \ | ||
51 | # solaris, motif, sparc & \ | ||
52 | # solaris, gtk, sparc & \ | ||
53 | # aix, motif, ppc & \ | ||
54 | # hpux, motif, ia64_32 & \ | ||
55 | # macosx, carbon, ppc & \ | ||
56 | # macosx, carbon, x86 & \ | ||
57 | # macosx, cocoa, ppc & \ | ||
58 | # macosx, cocoa, x86 & \ | ||
59 | # macosx, cocoa, x86_64 | ||
60 | |||
61 | # By default PDE creates one archive (result) per entry listed in the configs property. | ||
62 | # Setting this value to true will cause PDE to only create one output containing all | ||
63 | # artifacts for all the platforms listed in the configs property. | ||
64 | # To control the output format for the group, add a "group, group, group - <format>" entry to the | ||
65 | # archivesFormat. | ||
66 | #groupConfigurations=true | ||
67 | |||
68 | #The format of the archive. By default a zip is created using antZip. | ||
69 | #The list can only contain the configuration for which the desired format is different than zip. | ||
70 | #archivesFormat=win32, win32, x86 - antZip& \ | ||
71 | # linux, gtk, ppc - antZip &\ | ||
72 | # linux, gtk, x86 - antZip& \ | ||
73 | # linux, gtk, x86_64 - antZip& \ | ||
74 | # linux, motif, x86 - antZip& \ | ||
75 | # solaris, motif, sparc - antZip& \ | ||
76 | # solaris, gtk, sparc - antZip& \ | ||
77 | # aix, motif, ppc - antZip& \ | ||
78 | # hpux, motif, PA_RISC - antZip& \ | ||
79 | # macosx, carbon, ppc - antZip | ||
80 | |||
81 | #Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles. | ||
82 | allowBinaryCycles = true | ||
83 | |||
84 | #Sort bundles depenedencies across all features instead of just within a given feature. | ||
85 | #flattenDependencies = true | ||
86 | |||
87 | #Parallel compilation, requires flattenedDependencies=true | ||
88 | #parallelCompilation=true | ||
89 | #parallelThreadCount= | ||
90 | #parallelThreadsPerProcessor= | ||
91 | |||
92 | #Set to true if you want the output to be ready for an update jar (no site.xml generated) | ||
93 | outputUpdateJars = true | ||
94 | |||
95 | #Set to true for Jnlp generation | ||
96 | #codebase should be a URL that will be used as the root of all relative URLs in the output. | ||
97 | #generateJnlp=false | ||
98 | #jnlp.codebase=<codebase url> | ||
99 | #jnlp.j2se=<j2se version> | ||
100 | #jnlp.locale=<a locale> | ||
101 | #jnlp.generateOfflineAllowed=true or false generate <offlineAllowed/> attribute in the generated features | ||
102 | #jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built | ||
103 | |||
104 | #Set to true if you want to sign jars | ||
105 | #signJars=false | ||
106 | #sign.alias=<alias> | ||
107 | #sign.keystore=<keystore location> | ||
108 | #sign.storepass=<keystore password> | ||
109 | #sign.keypass=<key password> | ||
110 | |||
111 | #Arguments to send to the zip executable | ||
112 | zipargs= | ||
113 | |||
114 | #Arguments to send to the tar executable | ||
115 | tarargs= | ||
116 | |||
117 | #Control the creation of a file containing the version included in each configuration - on by default | ||
118 | #generateVersionsLists=false | ||
119 | |||
120 | ############## BUILD NAMING CONTROL ################ | ||
121 | # The directory into which the build elements are fetched and where | ||
122 | # the build takes place. | ||
123 | #buildDirectory= | ||
124 | |||
125 | # Type of build. Used in naming the build output. Typically this value is | ||
126 | # one of I, N, M, S, ... | ||
127 | buildType=I | ||
128 | |||
129 | # ID of the build. Used in naming the build output. | ||
130 | buildId=TestBuild | ||
131 | |||
132 | # Label for the build. Used in naming the build output | ||
133 | buildLabel=${buildType}.${buildId} | ||
134 | |||
135 | # Timestamp for the build. Used in naming the build output | ||
136 | timestamp=007 | ||
137 | |||
138 | #The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde. | ||
139 | #The value will only be applied to plugin or features indicating build.properties, qualifier = context | ||
140 | #forceContextQualifier=<the value for the qualifier> | ||
141 | |||
142 | #Enable / disable the generation of a suffix for the features that use .qualifier. | ||
143 | #The generated suffix is computed according to the content of the feature | ||
144 | #generateFeatureVersionSuffix=true | ||
145 | |||
146 | ############# BASE CONTROL ############# | ||
147 | # Settings for the base Eclipse components and Java class libraries | ||
148 | # against which you are building. | ||
149 | # Base location for anything the build needs to compile against. For example, | ||
150 | # in most RCP app or a plug-in, the baseLocation should be the location of a previously | ||
151 | # installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack. | ||
152 | |||
153 | #base=<path/to/parent/of/eclipse> | ||
154 | #baseLocation=${base}/eclipse | ||
155 | |||
156 | #Folder containing repositories whose content is needed to compile against | ||
157 | #repoBaseLocation=${base}/repos | ||
158 | #Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against | ||
159 | #transformedRepoLocation=${base}/transformedRepos | ||
160 | |||
161 | #Os/Ws/Arch/nl of the eclipse specified by baseLocation | ||
162 | #baseos=win32 | ||
163 | #basews=win32 | ||
164 | #basearch=x86 | ||
165 | |||
166 | #this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built | ||
167 | filteredDependencyCheck=false | ||
168 | |||
169 | #this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons) | ||
170 | resolution.devMode=false | ||
171 | |||
172 | #pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :) | ||
173 | #a location is one of: | ||
174 | #- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo | ||
175 | #- a directory that contains a /plugins or /features subdirectory | ||
176 | #- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml | ||
177 | #pluginPath= | ||
178 | |||
179 | skipBase=true | ||
180 | eclipseURL=<url for eclipse download site> | ||
181 | eclipseBuildId=<Id of Eclipse build to get> | ||
182 | eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip | ||
183 | |||
184 | |||
185 | ############# MAP FILE CONTROL ################ | ||
186 | # This section defines CVS tags to use when fetching the map files from the repository. | ||
187 | # If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml | ||
188 | |||
189 | skipMaps=true | ||
190 | mapsRepo=:pserver:anonymous@example.com/path/to/repo | ||
191 | mapsRoot=path/to/maps | ||
192 | mapsCheckoutTag=HEAD | ||
193 | |||
194 | #tagMaps=true | ||
195 | mapsTagTag=v${buildId} | ||
196 | |||
197 | |||
198 | ############ REPOSITORY CONTROL ############### | ||
199 | # This section defines properties parameterizing the repositories where plugins, fragments | ||
200 | # bundles and features are being obtained from. | ||
201 | |||
202 | # The tags to use when fetching elements to build. | ||
203 | # By default thebuilder will use whatever is in the maps. | ||
204 | # This value takes the form of a comma separated list of repository identifier (like used in the map files) and the | ||
205 | # overriding value | ||
206 | # For example fetchTag=CVS=HEAD, SVN=v20050101 | ||
207 | # fetchTag=HEAD | ||
208 | skipFetch=true | ||
209 | |||
210 | |||
211 | ############# JAVA COMPILER OPTIONS ############## | ||
212 | # The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE | ||
213 | #bootclasspath=${java.home}/lib/rt.jar | ||
214 | |||
215 | # specific JRE locations to compile against. These values are used to compile bundles specifying a | ||
216 | # Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support | ||
217 | #CDC-1.0/Foundation-1.0= /path/to/rt.jar | ||
218 | #CDC-1.1/Foundation-1.1= | ||
219 | #OSGi/Minimum-1.0= | ||
220 | #OSGi/Minimum-1.1= | ||
221 | #JRE-1.1= | ||
222 | #J2SE-1.2= | ||
223 | #J2SE-1.3= | ||
224 | #J2SE-1.4= | ||
225 | #J2SE-1.5= | ||
226 | #JavaSE-1.6= | ||
227 | #PersonalJava-1.1= | ||
228 | #PersonalJava-1.2= | ||
229 | #CDC-1.0/PersonalBasis-1.0= | ||
230 | #CDC-1.0/PersonalJava-1.0= | ||
231 | #CDC-1.1/PersonalBasis-1.1= | ||
232 | #CDC-1.1/PersonalJava-1.1= | ||
233 | |||
234 | # Specify the output format of the compiler log when eclipse jdt is used | ||
235 | logExtension=.log | ||
236 | |||
237 | # Whether or not to include debug info in the output jars | ||
238 | javacDebugInfo=false | ||
239 | |||
240 | # Whether or not to fail the build if there are compiler errors | ||
241 | javacFailOnError=true | ||
242 | |||
243 | # Enable or disable verbose mode of the compiler | ||
244 | javacVerbose=true | ||
245 | |||
246 | # Extra arguments for the compiler. These are specific to the java compiler being used. | ||
247 | #compilerArg= | ||
248 | |||
249 | # Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties | ||
250 | javacSource=1.6 | ||
251 | |||
252 | # Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties. | ||
253 | javacTarget=1.6 | ||
254 | |||
255 | #individualSourceBundles=true | ||
256 | |||
257 | #p2.gathering=true | ||
258 | p2.compress=true | ||
259 | #p2.category.site=file:${buildDirectory}/site.xml | ||
260 | p2.category.definition=file:${buildDirectory}/category.xml | ||
261 | p2.metadata.repo.name=Yocto Project Update Site | ||
262 | p2.artifact.repo.name=Yocto Project Update Site | ||
diff --git a/features/org.yocto.sdk.headless.build/customTargets.xml b/features/org.yocto.sdk.headless.build/customTargets.xml new file mode 100644 index 0000000..f92454a --- /dev/null +++ b/features/org.yocto.sdk.headless.build/customTargets.xml | |||
@@ -0,0 +1,212 @@ | |||
1 | <project name="Build specific targets and properties" default="noDefault"> | ||
2 | |||
3 | <!-- ===================================================================== --> | ||
4 | <!-- Run a given ${target} on all elements being built --> | ||
5 | <!-- Add on <ant> task for each top level element being built. --> | ||
6 | <!-- ===================================================================== --> | ||
7 | <available property="allElementsFile" file="${builder}/allElements.xml" value="${builder}/allElements.xml"/> | ||
8 | <property name="allElementsFile" location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/> | ||
9 | |||
10 | <import file="${allElementsFile}" /> | ||
11 | <target name="allElements"> | ||
12 | <antcall target="allElementsDelegator" /> | ||
13 | </target> | ||
14 | |||
15 | <!-- ===================================================================== --> | ||
16 | <!-- ===================================================================== --> | ||
17 | <target name="getBaseComponents" depends="checkLocalBase" unless="skipBase"> | ||
18 | <get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" /> | ||
19 | <unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" /> | ||
20 | </target> | ||
21 | |||
22 | <target name="checkLocalBase"> | ||
23 | <available file="${base}" property="skipBase" /> | ||
24 | </target> | ||
25 | |||
26 | <!-- ===================================================================== --> | ||
27 | <!-- Check out map files from correct repository --> | ||
28 | <!-- Replace values for mapsCheckoutTag as desired. --> | ||
29 | <!-- ===================================================================== --> | ||
30 | <target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps"> | ||
31 | <property name="mapsCheckoutTag" value="HEAD" /> | ||
32 | <cvs cvsRoot="${mapsRepo}" package="${mapsRoot}" dest="${buildDirectory}/maps" tag="${mapsCheckoutTag}" /> | ||
33 | </target> | ||
34 | |||
35 | <target name="checkLocalMaps"> | ||
36 | <available property="skipMaps" file="${buildDirectory}/maps" /> | ||
37 | </target> | ||
38 | |||
39 | <target name="tagMapFiles" if="tagMaps"> | ||
40 | <cvs dest="${buildDirectory}/maps/${mapsRoot}" command="tag ${mapsTagTag}" /> | ||
41 | </target> | ||
42 | |||
43 | <!-- ===================================================================== --> | ||
44 | |||
45 | <target name="clean" unless="noclean"> | ||
46 | <antcall target="allElements"> | ||
47 | <param name="target" value="cleanElement" /> | ||
48 | </antcall> | ||
49 | </target> | ||
50 | |||
51 | <target name="gatherLogs"> | ||
52 | <mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" /> | ||
53 | <antcall target="allElements"> | ||
54 | <param name="target" value="gatherLogs" /> | ||
55 | </antcall> | ||
56 | <unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true"> | ||
57 | <fileset dir="${buildDirectory}/features"> | ||
58 | <include name="**/*.log.zip" /> | ||
59 | </fileset> | ||
60 | </unzip> | ||
61 | </target> | ||
62 | |||
63 | <!-- ===================================================================== --> | ||
64 | <!-- Steps to do before setup --> | ||
65 | <!-- ===================================================================== --> | ||
66 | <target name="preSetup"> | ||
67 | <delete dir="${buildDirectory}/plugins"/> | ||
68 | <mkdir dir="${buildDirectory}/plugins"/> | ||
69 | <copy todir="${buildDirectory}/plugins" failonerror="true"> | ||
70 | <fileset dir="${otherSrcDirectory}/plugins"/> | ||
71 | </copy> | ||
72 | <delete dir="${buildDirectory}/features"/> | ||
73 | <copy todir="${buildDirectory}/features" failonerror="true" > | ||
74 | <fileset dir="${otherSrcDirectory}/features"/> | ||
75 | </copy> | ||
76 | <antcall target="prepareForP2" /> | ||
77 | </target> | ||
78 | |||
79 | <target name="prepareForP2" if="p2.gathering"> | ||
80 | <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" /> | ||
81 | <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/category.xml" todir="${buildDirectory}" /> | ||
82 | <xmlproperty file="${otherSrcDirectory}/features/org.yocto.sdk/feature.xml" /> | ||
83 | <replace file="${buildDirectory}/category.xml"> | ||
84 | <replacefilter token="@featureVersion@" value="${feature(version)}"/> | ||
85 | </replace> | ||
86 | </target> | ||
87 | |||
88 | <!-- ===================================================================== --> | ||
89 | <!-- Steps to do after setup but before starting the build proper --> | ||
90 | <!-- ===================================================================== --> | ||
91 | <target name="postSetup"> | ||
92 | <antcall target="getBaseComponents" /> | ||
93 | </target> | ||
94 | |||
95 | <!-- ===================================================================== --> | ||
96 | <!-- Steps to do before fetching the build elements --> | ||
97 | <!-- ===================================================================== --> | ||
98 | <target name="preFetch"> | ||
99 | </target> | ||
100 | |||
101 | <!-- ===================================================================== --> | ||
102 | <!-- Steps to do after fetching the build elements --> | ||
103 | <!-- ===================================================================== --> | ||
104 | <target name="postFetch"> | ||
105 | </target> | ||
106 | |||
107 | <!-- ===================================================================== --> | ||
108 | <!-- Steps to do before the repositories are being processed --> | ||
109 | <!-- ===================================================================== --> | ||
110 | <target name="preProcessRepos"> | ||
111 | </target> | ||
112 | |||
113 | <!-- ===================================================================== --> | ||
114 | <!-- Steps to do after the repositories have been processed --> | ||
115 | <!-- ===================================================================== --> | ||
116 | <target name="postProcessRepos"> | ||
117 | </target> | ||
118 | |||
119 | <!-- ===================================================================== --> | ||
120 | <!-- Steps to do before generating the build scripts. --> | ||
121 | <!-- ===================================================================== --> | ||
122 | <target name="preGenerate"> | ||
123 | </target> | ||
124 | |||
125 | <!-- ===================================================================== --> | ||
126 | <!-- Steps to do after generating the build scripts. --> | ||
127 | <!-- ===================================================================== --> | ||
128 | <target name="postGenerate"> | ||
129 | <antcall target="clean" /> | ||
130 | </target> | ||
131 | |||
132 | <!-- ===================================================================== --> | ||
133 | <!-- Steps to do before running the build.xmls for the elements being built. --> | ||
134 | <!-- ===================================================================== --> | ||
135 | <target name="preProcess"> | ||
136 | </target> | ||
137 | |||
138 | <!-- ===================================================================== --> | ||
139 | <!-- Steps to do after running the build.xmls for the elements being built. --> | ||
140 | <!-- ===================================================================== --> | ||
141 | <target name="postProcess"> | ||
142 | </target> | ||
143 | |||
144 | <!-- ===================================================================== --> | ||
145 | <!-- Steps to do before running assemble. --> | ||
146 | <!-- ===================================================================== --> | ||
147 | <target name="preAssemble"> | ||
148 | </target> | ||
149 | |||
150 | <!-- ===================================================================== --> | ||
151 | <!-- Steps to do after running assemble. --> | ||
152 | <!-- ===================================================================== --> | ||
153 | <target name="postAssemble"> | ||
154 | </target> | ||
155 | |||
156 | <!-- ===================================================================== --> | ||
157 | <!-- Steps to do before running package. --> | ||
158 | <!-- ===================================================================== --> | ||
159 | <target name="prePackage"> | ||
160 | </target> | ||
161 | |||
162 | <!-- ===================================================================== --> | ||
163 | <!-- Steps to do after running package. --> | ||
164 | <!-- ===================================================================== --> | ||
165 | <target name="postPackage"> | ||
166 | </target> | ||
167 | |||
168 | <!-- ===================================================================== --> | ||
169 | <!-- Steps to do after the build is done. --> | ||
170 | <!-- ===================================================================== --> | ||
171 | <target name="postBuild"> | ||
172 | <antcall target="gatherLogs" /> | ||
173 | <antcall target="updateSiteContent" /> | ||
174 | </target> | ||
175 | |||
176 | <target name="updateSiteContent" if="p2.gathering"> | ||
177 | <property file="${buildDirectory}/finalFeaturesVersions.properties" /> | ||
178 | <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" /> | ||
179 | <replace file="${buildDirectory}/site.xml"> | ||
180 | <replacefilter token="@ADTGenVersion@" value="${org.yocto.sdk}"/> | ||
181 | </replace> | ||
182 | <zip destfile="${buildDirectory}/${buildLabel}/org.yocto.sdk-${buildId}-group.group.group.zip" update="true"> | ||
183 | <zipfileset dir="${buildDirectory}"> | ||
184 | <include name="site.xml"/> | ||
185 | </zipfileset> | ||
186 | <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site"> | ||
187 | <include name="index.html"/> | ||
188 | </zipfileset> | ||
189 | <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site/web" prefix="web"/> | ||
190 | </zip> | ||
191 | </target> | ||
192 | |||
193 | <!-- ===================================================================== --> | ||
194 | <!-- Steps to do to test the build results --> | ||
195 | <!-- ===================================================================== --> | ||
196 | <target name="test"> | ||
197 | </target> | ||
198 | |||
199 | <!-- ===================================================================== --> | ||
200 | <!-- Steps to do to publish the build results --> | ||
201 | <!-- ===================================================================== --> | ||
202 | <target name="publish"> | ||
203 | </target> | ||
204 | |||
205 | <!-- ===================================================================== --> | ||
206 | <!-- Default target --> | ||
207 | <!-- ===================================================================== --> | ||
208 | <target name="noDefault"> | ||
209 | <echo message="You must specify a target when invoking this file" /> | ||
210 | </target> | ||
211 | |||
212 | </project> | ||
diff --git a/features/org.yocto.sdk.site/.project b/features/org.yocto.sdk.site/.project new file mode 100644 index 0000000..9f1d10f --- /dev/null +++ b/features/org.yocto.sdk.site/.project | |||
@@ -0,0 +1,17 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.sdk.site</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | <buildCommand> | ||
9 | <name>org.eclipse.pde.UpdateSiteBuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | </buildSpec> | ||
14 | <natures> | ||
15 | <nature>org.eclipse.pde.UpdateSiteNature</nature> | ||
16 | </natures> | ||
17 | </projectDescription> | ||
diff --git a/features/org.yocto.sdk.site/category.xml b/features/org.yocto.sdk.site/category.xml new file mode 100644 index 0000000..4dd0178 --- /dev/null +++ b/features/org.yocto.sdk.site/category.xml | |||
@@ -0,0 +1,18 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <site> | ||
3 | <feature url="features/org.yocto.sdk_@featureVersion@.jar" id="org.yocto.sdk" version="@featureVersion@"> | ||
4 | <category name="Yocto Project ADT"/> | ||
5 | </feature> | ||
6 | <feature url="features/org.yocto.sdk.source_@featureVersion@.jar" id="org.yocto.sdk.source" version="@featureVersion@"> | ||
7 | <category name="Yocto Project ADT"/> | ||
8 | </feature> | ||
9 | <feature url="features/org.yocto.bc_@bcfeatureVersion@.jar" id="org.yocto.bc" version="@bcfeatureVersion@"> | ||
10 | <category name="Yocto Project Bitbake Commander"/> | ||
11 | </feature> | ||
12 | <feature url="features/org.yocto.doc_@docFeatureVersion@.jar" id="org.yocto.doc" version="@docFeatureVersion@"> | ||
13 | <category name="Yocto Project Documentation"/> | ||
14 | </feature> | ||
15 | <category-def name="Yocto Project ADT" label="Yocto Project ADT Plug-in"/> | ||
16 | <category-def name="Yocto Project Bitbake Commander" label="Yocto Project Bitbake Commander Plug-in"/> | ||
17 | <category-def name="Yocto Project Documentation" label="Yocto Project Documentation plug-in"/> | ||
18 | </site> | ||
diff --git a/features/org.yocto.sdk.site/index.html b/features/org.yocto.sdk.site/index.html new file mode 100644 index 0000000..ce46f0e --- /dev/null +++ b/features/org.yocto.sdk.site/index.html | |||
@@ -0,0 +1,60 @@ | |||
1 | <html> | ||
2 | <head> | ||
3 | <title>org.yocto.sdk.site</title> | ||
4 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
5 | <style>@import url("web/site.css");</style> | ||
6 | <script type="text/javascript"> | ||
7 | var returnval = 0; | ||
8 | var stylesheet, xmlFile, cache, doc; | ||
9 | function init(){ | ||
10 | // NSCP 7.1+ / Mozilla 1.4.1+ / Safari | ||
11 | // Use the standard DOM Level 2 technique, if it is supported | ||
12 | if (document.implementation && document.implementation.createDocument) { | ||
13 | xmlFile = document.implementation.createDocument("", "", null); | ||
14 | stylesheet = document.implementation.createDocument("", "", null); | ||
15 | if (xmlFile.load){ | ||
16 | xmlFile.load("site.xml"); | ||
17 | stylesheet.load("web/site.xsl"); | ||
18 | } else { | ||
19 | alert("Document could not be loaded by browser."); | ||
20 | } | ||
21 | xmlFile.addEventListener("load", transform, false); | ||
22 | stylesheet.addEventListener("load", transform, false); | ||
23 | } | ||
24 | //IE 6.0+ solution | ||
25 | else if (window.ActiveXObject) { | ||
26 | xmlFile = new ActiveXObject("msxml2.DOMDocument.3.0"); | ||
27 | xmlFile.async = false; | ||
28 | xmlFile.load("site.xml"); | ||
29 | stylesheet = new ActiveXObject("msxml2.FreeThreadedDOMDocument.3.0"); | ||
30 | stylesheet.async = false; | ||
31 | stylesheet.load("web/site.xsl"); | ||
32 | cache = new ActiveXObject("msxml2.XSLTemplate.3.0"); | ||
33 | cache.stylesheet = stylesheet; | ||
34 | transformData(); | ||
35 | } | ||
36 | } | ||
37 | // separate transformation function for IE 6.0+ | ||
38 | function transformData(){ | ||
39 | var processor = cache.createProcessor(); | ||
40 | processor.input = xmlFile; | ||
41 | processor.transform(); | ||
42 | data.innerHTML = processor.output; | ||
43 | } | ||
44 | // separate transformation function for NSCP 7.1+ and Mozilla 1.4.1+ | ||
45 | function transform(){ | ||
46 | returnval+=1; | ||
47 | if (returnval==2){ | ||
48 | var processor = new XSLTProcessor(); | ||
49 | processor.importStylesheet(stylesheet); | ||
50 | doc = processor.transformToDocument(xmlFile); | ||
51 | document.getElementById("data").innerHTML = doc.documentElement.innerHTML; | ||
52 | } | ||
53 | } | ||
54 | </script> | ||
55 | </head> | ||
56 | <body onload="init();"> | ||
57 | <!--[insert static HTML here]--> | ||
58 | <div id="data"><!-- this is where the transformed data goes --></div> | ||
59 | </body> | ||
60 | </html> | ||
diff --git a/features/org.yocto.sdk.site/site.xml b/features/org.yocto.sdk.site/site.xml new file mode 100644 index 0000000..a087084 --- /dev/null +++ b/features/org.yocto.sdk.site/site.xml | |||
@@ -0,0 +1,22 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <site> | ||
3 | <description name="Yocto Project update site" url="http://yoctoproject.org/downloads/eclipse-plugin/"> | ||
4 | Yocto Project update site | ||
5 | </description> | ||
6 | <feature url="features/org.yocto.sdk_@ADTGenVersion@.jar" id="org.yocto.sdk" version="@ADTGenVersion@"> | ||
7 | <category name="Yocto Project ADT"/> | ||
8 | </feature> | ||
9 | <category-def name="Yocto Project ADT" label="Yocto Project ADT plug-in"/> | ||
10 | <feature url="features/org.yocto.bc_@bcGenVersion@.jar" id="org.yocto.bc" version="@bcGenVersion@"> | ||
11 | <category name="Yocto Project Bitbake Commander"/> | ||
12 | </feature> | ||
13 | <category-def name="Yocto Project Bitbake Commander" label="Yocto Project Bitbake Commander plug-in"/> | ||
14 | <feature url="features/org.yocto.doc_@docGenVersion@.jar" id="org.yocto.doc" version="@docGenVersion@"> | ||
15 | <category name="Yocto Project Documentation"/> | ||
16 | </feature> | ||
17 | <category-def name="Yocto Project Documentation" label="Yocto Project Documentation plug-in"/> | ||
18 | <feature url="features/org.yocto.utils_@utilsGenVersion@.jar" id="org.yocto.utils" version="@utilsGenVersion@"> | ||
19 | <category name="Yocto Project Utils"/> | ||
20 | </feature> | ||
21 | <category-def name="Yocto Project Utils" label="Yocto Project Utils plug-in"/> | ||
22 | </site> | ||
diff --git a/features/org.yocto.sdk.site/web/site.css b/features/org.yocto.sdk.site/web/site.css new file mode 100644 index 0000000..62c6f9f --- /dev/null +++ b/features/org.yocto.sdk.site/web/site.css | |||
@@ -0,0 +1,12 @@ | |||
1 | <STYLE type="text/css"> | ||
2 | td.spacer {padding-bottom: 10px; padding-top: 10px;} | ||
3 | .title { font-family: sans-serif; color: #99AACC;} | ||
4 | .bodyText { font-family: sans-serif; font-size: 9pt; color:#000000; } | ||
5 | .sub-header { font-family: sans-serif; font-style: normal; font-weight: bold; font-size: 9pt; color: white;} | ||
6 | .log-text {font-family: sans-serif; font-style: normal; font-weight: lighter; font-size: 8pt; color:black;} | ||
7 | .big-header { font-family: sans-serif; font-style: normal; font-weight: bold; font-size: 9pt; color: white; border-top:10px solid white;} | ||
8 | .light-row {background:#FFFFFF} | ||
9 | .dark-row {background:#EEEEFF} | ||
10 | .header {background:#99AADD} | ||
11 | #indent {word-wrap : break-word;width :300px;text-indent:10px;} | ||
12 | </STYLE> | ||
diff --git a/features/org.yocto.sdk.site/web/site.xsl b/features/org.yocto.sdk.site/web/site.xsl new file mode 100644 index 0000000..478de48 --- /dev/null +++ b/features/org.yocto.sdk.site/web/site.xsl | |||
@@ -0,0 +1,214 @@ | |||
1 | <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl="urn:schemas-microsoft-com:xslt"> | ||
2 | <xsl:output method="html" encoding="UTF-8"/> | ||
3 | <xsl:key name="cat" match="category" use="@name"/> | ||
4 | <xsl:template match="/"> | ||
5 | <xsl:for-each select="site"> | ||
6 | <html> | ||
7 | <head> | ||
8 | <title>org.yocto.sdk.site</title> | ||
9 | <style>@import url("web/site.css");</style> | ||
10 | </head> | ||
11 | <body> | ||
12 | <h1 class="title">org.yocto.sdk.site</h1> | ||
13 | <p class="bodyText"><xsl:value-of select="description"/></p> | ||
14 | <table width="100%" border="0" cellspacing="1" cellpadding="2"> | ||
15 | <xsl:for-each select="category-def"> | ||
16 | <xsl:sort select="@label" order="ascending" case-order="upper-first"/> | ||
17 | <xsl:sort select="@name" order="ascending" case-order="upper-first"/> | ||
18 | <xsl:if test="count(key('cat',@name)) != 0"> | ||
19 | <tr class="header"> | ||
20 | <td class="sub-header" width="30%"> | ||
21 | <xsl:value-of select="@name"/> | ||
22 | </td> | ||
23 | <td class="sub-header" width="70%"> | ||
24 | <xsl:value-of select="@label"/> | ||
25 | </td> | ||
26 | </tr> | ||
27 | <xsl:for-each select="key('cat',@name)"> | ||
28 | <xsl:sort select="ancestor::feature//@version" order="ascending"/> | ||
29 | <xsl:sort select="ancestor::feature//@id" order="ascending" case-order="upper-first"/> | ||
30 | <tr> | ||
31 | <xsl:choose> | ||
32 | <xsl:when test="(position() mod 2 = 1)"> | ||
33 | <xsl:attribute name="class">dark-row</xsl:attribute> | ||
34 | </xsl:when> | ||
35 | <xsl:otherwise> | ||
36 | <xsl:attribute name="class">light-row</xsl:attribute> | ||
37 | </xsl:otherwise> | ||
38 | </xsl:choose> | ||
39 | <td class="log-text" id="indent"> | ||
40 | <xsl:choose> | ||
41 | <xsl:when test="ancestor::feature//@label"> | ||
42 | <a href="{ancestor::feature//@url}"><xsl:value-of select="ancestor::feature//@label"/></a> | ||
43 | <br/> | ||
44 | <div id="indent"> | ||
45 | (<xsl:value-of select="ancestor::feature//@id"/> - <xsl:value-of select="ancestor::feature//@version"/>) | ||
46 | </div> | ||
47 | </xsl:when> | ||
48 | <xsl:otherwise> | ||
49 | <a href="{ancestor::feature//@url}"><xsl:value-of select="ancestor::feature//@id"/> - <xsl:value-of select="ancestor::feature//@version"/></a> | ||
50 | </xsl:otherwise> | ||
51 | </xsl:choose> | ||
52 | <br /> | ||
53 | </td> | ||
54 | <td> | ||
55 | <table> | ||
56 | <xsl:if test="ancestor::feature//@os"> | ||
57 | <tr><td class="log-text" id="indent">Operating Systems:</td> | ||
58 | <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@os"/></td> | ||
59 | </tr> | ||
60 | </xsl:if> | ||
61 | <xsl:if test="ancestor::feature//@ws"> | ||
62 | <tr><td class="log-text" id="indent">Windows Systems:</td> | ||
63 | <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@ws"/></td> | ||
64 | </tr> | ||
65 | </xsl:if> | ||
66 | <xsl:if test="ancestor::feature//@nl"> | ||
67 | <tr><td class="log-text" id="indent">Languages:</td> | ||
68 | <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@nl"/></td> | ||
69 | </tr> | ||
70 | </xsl:if> | ||
71 | <xsl:if test="ancestor::feature//@arch"> | ||
72 | <tr><td class="log-text" id="indent">Architecture:</td> | ||
73 | <td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@arch"/></td> | ||
74 | </tr> | ||
75 | </xsl:if> | ||
76 | </table> | ||
77 | </td> | ||
78 | </tr> | ||
79 | </xsl:for-each> | ||
80 | <tr><td class="spacer"><br/></td><td class="spacer"><br/></td></tr> | ||
81 | </xsl:if> | ||
82 | </xsl:for-each> | ||
83 | <xsl:if test="count(feature) > count(feature/category)"> | ||
84 | <tr class="header"> | ||
85 | <td class="sub-header" colspan="2"> | ||
86 | Uncategorized | ||
87 | </td> | ||
88 | </tr> | ||
89 | </xsl:if> | ||
90 | <xsl:choose> | ||
91 | <xsl:when test="function-available('msxsl:node-set')"> | ||
92 | <xsl:variable name="rtf-nodes"> | ||
93 | <xsl:for-each select="feature[not(category)]"> | ||
94 | <xsl:sort select="@id" order="ascending" case-order="upper-first"/> | ||
95 | <xsl:sort select="@version" order="ascending" /> | ||
96 | <xsl:value-of select="."/> | ||
97 | <xsl:copy-of select="." /> | ||
98 | </xsl:for-each> | ||
99 | </xsl:variable> | ||
100 | <xsl:variable name="myNodeSet" select="msxsl:node-set($rtf-nodes)/*"/> | ||
101 | <xsl:for-each select="$myNodeSet"> | ||
102 | <tr> | ||
103 | <xsl:choose> | ||
104 | <xsl:when test="position() mod 2 = 1"> | ||
105 | <xsl:attribute name="class">dark-row</xsl:attribute> | ||
106 | </xsl:when> | ||
107 | <xsl:otherwise> | ||
108 | <xsl:attribute name="class">light-row</xsl:attribute> | ||
109 | </xsl:otherwise> | ||
110 | </xsl:choose> | ||
111 | <td class="log-text" id="indent"> | ||
112 | <xsl:choose> | ||
113 | <xsl:when test="@label"> | ||
114 | <a href="{@url}"><xsl:value-of select="@label"/></a> | ||
115 | <br /> | ||
116 | <div id="indent"> | ||
117 | (<xsl:value-of select="@id"/> - <xsl:value-of select="@version"/>) | ||
118 | </div> | ||
119 | </xsl:when> | ||
120 | <xsl:otherwise> | ||
121 | <a href="{@url}"><xsl:value-of select="@id"/> - <xsl:value-of select="@version"/></a> | ||
122 | </xsl:otherwise> | ||
123 | </xsl:choose> | ||
124 | <br /><br /> | ||
125 | </td> | ||
126 | <td> | ||
127 | <table> | ||
128 | <xsl:if test="@os"> | ||
129 | <tr><td class="log-text" id="indent">Operating Systems:</td> | ||
130 | <td class="log-text" id="indent"><xsl:value-of select="@os"/></td> | ||
131 | </tr> | ||
132 | </xsl:if> | ||
133 | <xsl:if test="@ws"> | ||
134 | <tr><td class="log-text" id="indent">Windows Systems:</td> | ||
135 | <td class="log-text" id="indent"><xsl:value-of select="@ws"/></td> | ||
136 | </tr> | ||
137 | </xsl:if> | ||
138 | <xsl:if test="@nl"> | ||
139 | <tr><td class="log-text" id="indent">Languages:</td> | ||
140 | <td class="log-text" id="indent"><xsl:value-of select="@nl"/></td> | ||
141 | </tr> | ||
142 | </xsl:if> | ||
143 | <xsl:if test="@arch"> | ||
144 | <tr><td class="log-text" id="indent">Architecture:</td> | ||
145 | <td class="log-text" id="indent"><xsl:value-of select="@arch"/></td> | ||
146 | </tr> | ||
147 | </xsl:if> | ||
148 | </table> | ||
149 | </td> | ||
150 | </tr> | ||
151 | </xsl:for-each> | ||
152 | </xsl:when> | ||
153 | <xsl:otherwise> | ||
154 | <xsl:for-each select="feature[not(category)]"> | ||
155 | <xsl:sort select="@id" order="ascending" case-order="upper-first"/> | ||
156 | <xsl:sort select="@version" order="ascending" /> | ||
157 | <tr> | ||
158 | <xsl:choose> | ||
159 | <xsl:when test="count(preceding-sibling::feature[not(category)]) mod 2 = 1"> | ||
160 | <xsl:attribute name="class">dark-row</xsl:attribute> | ||
161 | </xsl:when> | ||
162 | <xsl:otherwise> | ||
163 | <xsl:attribute name="class">light-row</xsl:attribute> | ||
164 | </xsl:otherwise> | ||
165 | </xsl:choose> | ||
166 | <td class="log-text" id="indent"> | ||
167 | <xsl:choose> | ||
168 | <xsl:when test="@label"> | ||
169 | <a href="{@url}"><xsl:value-of select="@label"/></a> | ||
170 | <br /> | ||
171 | <div id="indent"> | ||
172 | (<xsl:value-of select="@id"/> - <xsl:value-of select="@version"/>) | ||
173 | </div> | ||
174 | </xsl:when> | ||
175 | <xsl:otherwise> | ||
176 | <a href="{@url}"><xsl:value-of select="@id"/> - <xsl:value-of select="@version"/></a> | ||
177 | </xsl:otherwise> | ||
178 | </xsl:choose> | ||
179 | <br /><br /> | ||
180 | </td> | ||
181 | <td> | ||
182 | <table> | ||
183 | <xsl:if test="@os"> | ||
184 | <tr><td class="log-text" id="indent">Operating Systems:</td> | ||
185 | <td class="log-text" id="indent"><xsl:value-of select="@os"/></td> | ||
186 | </tr> | ||
187 | </xsl:if> | ||
188 | <xsl:if test="@ws"> | ||
189 | <tr><td class="log-text" id="indent">Windows Systems:</td> | ||
190 | <td class="log-text" id="indent"><xsl:value-of select="@ws"/></td> | ||
191 | </tr> | ||
192 | </xsl:if> | ||
193 | <xsl:if test="@nl"> | ||
194 | <tr><td class="log-text" id="indent">Languages:</td> | ||
195 | <td class="log-text" id="indent"><xsl:value-of select="@nl"/></td> | ||
196 | </tr> | ||
197 | </xsl:if> | ||
198 | <xsl:if test="@arch"> | ||
199 | <tr><td class="log-text" id="indent">Architecture:</td> | ||
200 | <td class="log-text" id="indent"><xsl:value-of select="@arch"/></td> | ||
201 | </tr> | ||
202 | </xsl:if> | ||
203 | </table> | ||
204 | </td> | ||
205 | </tr> | ||
206 | </xsl:for-each> | ||
207 | </xsl:otherwise> | ||
208 | </xsl:choose> | ||
209 | </table> | ||
210 | </body> | ||
211 | </html> | ||
212 | </xsl:for-each> | ||
213 | </xsl:template> | ||
214 | </xsl:stylesheet> | ||
diff --git a/features/org.yocto.sdk/.project b/features/org.yocto.sdk/.project new file mode 100644 index 0000000..d4d7e2f --- /dev/null +++ b/features/org.yocto.sdk/.project | |||
@@ -0,0 +1,17 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.sdk</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | <buildCommand> | ||
9 | <name>org.eclipse.pde.FeatureBuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | </buildSpec> | ||
14 | <natures> | ||
15 | <nature>org.eclipse.pde.FeatureNature</nature> | ||
16 | </natures> | ||
17 | </projectDescription> | ||
diff --git a/features/org.yocto.sdk/build.properties b/features/org.yocto.sdk/build.properties new file mode 100644 index 0000000..efef74e --- /dev/null +++ b/features/org.yocto.sdk/build.properties | |||
@@ -0,0 +1,6 @@ | |||
1 | bin.includes = feature.xml,\ | ||
2 | license.html,\ | ||
3 | feature.properties | ||
4 | |||
5 | generate.feature@org.yocto.sdk.source=org.yocto.sdk | ||
6 | |||
diff --git a/features/org.yocto.sdk/feature.properties b/features/org.yocto.sdk/feature.properties new file mode 100644 index 0000000..1a2175d --- /dev/null +++ b/features/org.yocto.sdk/feature.properties | |||
@@ -0,0 +1,163 @@ | |||
1 | ############################################################################### | ||
2 | # Copyright (c) 2010 Intel, Inc. and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # Intel - initial implementation | ||
10 | ############################################################################### | ||
11 | |||
12 | # "featureName" property - name of the feature | ||
13 | featureName=Yocto Project ADT Plug-in | ||
14 | |||
15 | # "providerName" property - name of the company that provides the feature | ||
16 | providerName=yoctoproject.org | ||
17 | |||
18 | # "updateSiteName" property - label for the update site | ||
19 | updateSiteName=Yocto Project Update Site | ||
20 | |||
21 | # "description" property - description of the feature | ||
22 | description=\ | ||
23 | Eclipse plug-ins for developing embedded applications using Yocto Project | ||
24 | |||
25 | # copyright | ||
26 | copyright=\ | ||
27 | Copyright (c) 2010 Intel, Inc. and others. \ | ||
28 | All rights reserved. This program and the accompanying materials \ | ||
29 | are made available under the terms of the Eclipse Public License v1.0 \ | ||
30 | which accompanies this distribution, and is available at \ | ||
31 | http://www.eclipse.org/legal/epl-v10.html | ||
32 | ################ end of copyright property #################################### | ||
33 | |||
34 | # "licenseURL" property - URL of the "Feature License" | ||
35 | # do not translate value - just change to point to a locale-specific HTML page | ||
36 | licenseURL=license.html | ||
37 | |||
38 | # "license" property - text of the "Feature Update License" | ||
39 | # should be plain text version of license agreement pointed to be "licenseURL" | ||
40 | license=\ | ||
41 | Eclipse Foundation Software User Agreement\n\ | ||
42 | April 14, 2010\n\ | ||
43 | \n\ | ||
44 | Usage Of Content\n\ | ||
45 | \n\ | ||
46 | THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ | ||
47 | OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ | ||
48 | USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ | ||
49 | AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ | ||
50 | NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ | ||
51 | AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ | ||
52 | AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ | ||
53 | OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ | ||
54 | TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ | ||
55 | OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ | ||
56 | BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ | ||
57 | \n\ | ||
58 | Applicable Licenses\n\ | ||
59 | \n\ | ||
60 | Unless otherwise indicated, all Content made available by the\n\ | ||
61 | Eclipse Foundation is provided to you under the terms and conditions of\n\ | ||
62 | the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ | ||
63 | provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ | ||
64 | For purposes of the EPL, "Program" will mean the Content.\n\ | ||
65 | \n\ | ||
66 | Content includes, but is not limited to, source code, object code,\n\ | ||
67 | documentation and other files maintained in the Eclipse Foundation source code\n\ | ||
68 | repository ("Repository") in software modules ("Modules") and made available\n\ | ||
69 | as downloadable archives ("Downloads").\n\ | ||
70 | \n\ | ||
71 | - Content may be structured and packaged into modules to facilitate delivering,\n\ | ||
72 | extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ | ||
73 | plug-in fragments ("Fragments"), and features ("Features").\n\ | ||
74 | - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ | ||
75 | in a directory named "plugins".\n\ | ||
76 | - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ | ||
77 | Each Feature may be packaged as a sub-directory in a directory named "features".\n\ | ||
78 | Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ | ||
79 | numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ | ||
80 | - Features may also include other Features ("Included Features"). Within a Feature, files\n\ | ||
81 | named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ | ||
82 | \n\ | ||
83 | The terms and conditions governing Plug-ins and Fragments should be\n\ | ||
84 | contained in files named "about.html" ("Abouts"). The terms and\n\ | ||
85 | conditions governing Features and Included Features should be contained\n\ | ||
86 | in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ | ||
87 | Licenses may be located in any directory of a Download or Module\n\ | ||
88 | including, but not limited to the following locations:\n\ | ||
89 | \n\ | ||
90 | - The top-level (root) directory\n\ | ||
91 | - Plug-in and Fragment directories\n\ | ||
92 | - Inside Plug-ins and Fragments packaged as JARs\n\ | ||
93 | - Sub-directories of the directory named "src" of certain Plug-ins\n\ | ||
94 | - Feature directories\n\ | ||
95 | \n\ | ||
96 | Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ | ||
97 | Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ | ||
98 | Update License") during the installation process. If the Feature contains\n\ | ||
99 | Included Features, the Feature Update License should either provide you\n\ | ||
100 | with the terms and conditions governing the Included Features or inform\n\ | ||
101 | you where you can locate them. Feature Update Licenses may be found in\n\ | ||
102 | the "license" property of files named "feature.properties" found within a Feature.\n\ | ||
103 | Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ | ||
104 | terms and conditions (or references to such terms and conditions) that\n\ | ||
105 | govern your use of the associated Content in that directory.\n\ | ||
106 | \n\ | ||
107 | THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ | ||
108 | TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ | ||
109 | SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ | ||
110 | \n\ | ||
111 | - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ | ||
112 | - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ | ||
113 | - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ | ||
114 | - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ | ||
115 | - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ | ||
116 | \n\ | ||
117 | IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ | ||
118 | TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ | ||
119 | is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ | ||
120 | govern that particular Content.\n\ | ||
121 | \n\ | ||
122 | \n\Use of Provisioning Technology\n\ | ||
123 | \n\ | ||
124 | The Eclipse Foundation makes available provisioning software, examples of which include,\n\ | ||
125 | but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ | ||
126 | the purpose of allowing users to install software, documentation, information and/or\n\ | ||
127 | other materials (collectively "Installable Software"). This capability is provided with\n\ | ||
128 | the intent of allowing such users to install, extend and update Eclipse-based products.\n\ | ||
129 | Information about packaging Installable Software is available at\n\ | ||
130 | http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ | ||
131 | \n\ | ||
132 | You may use Provisioning Technology to allow other parties to install Installable Software.\n\ | ||
133 | You shall be responsible for enabling the applicable license agreements relating to the\n\ | ||
134 | Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ | ||
135 | in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ | ||
136 | making it available in accordance with the Specification, you further acknowledge your\n\ | ||
137 | agreement to, and the acquisition of all necessary rights to permit the following:\n\ | ||
138 | \n\ | ||
139 | 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ | ||
140 | the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ | ||
141 | extending or updating the functionality of an Eclipse-based product.\n\ | ||
142 | 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ | ||
143 | Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ | ||
144 | 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ | ||
145 | govern the use of the Installable Software ("Installable Software Agreement") and such\n\ | ||
146 | Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ | ||
147 | with the Specification. Such Installable Software Agreement must inform the user of the\n\ | ||
148 | terms and conditions that govern the Installable Software and must solicit acceptance by\n\ | ||
149 | the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ | ||
150 | indication of agreement by the user, the provisioning Technology will complete installation\n\ | ||
151 | of the Installable Software.\n\ | ||
152 | \n\ | ||
153 | Cryptography\n\ | ||
154 | \n\ | ||
155 | Content may contain encryption software. The country in which you are\n\ | ||
156 | currently may have restrictions on the import, possession, and use,\n\ | ||
157 | and/or re-export to another country, of encryption software. BEFORE\n\ | ||
158 | using any encryption software, please check the country's laws,\n\ | ||
159 | regulations and policies concerning the import, possession, or use, and\n\ | ||
160 | re-export of encryption software, to see if this is permitted.\n\ | ||
161 | \n\ | ||
162 | Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n | ||
163 | ########### end of license property ########################################## | ||
diff --git a/features/org.yocto.sdk/feature.xml b/features/org.yocto.sdk/feature.xml new file mode 100644 index 0000000..5d8c51b --- /dev/null +++ b/features/org.yocto.sdk/feature.xml | |||
@@ -0,0 +1,109 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!-- | ||
3 | Copyright (c) 2011 Intel, Inc. and others. | ||
4 | All rights reserved. This program and the accompanying materials | ||
5 | are made available under the terms of the Eclipse Public License v1.0 | ||
6 | which accompanies this distribution, and is available at | ||
7 | http://www.eclipse.org/legal/epl-v10.html | ||
8 | |||
9 | Contributors: | ||
10 | Intel - initial API and implementation | ||
11 | BMW Car IT - added user documentation plugin to the feature | ||
12 | --> | ||
13 | <feature | ||
14 | id="org.yocto.sdk" | ||
15 | label="%featureName" | ||
16 | version="1.4.0.qualifier" | ||
17 | provider-name="%providerName"> | ||
18 | |||
19 | <description> | ||
20 | %description | ||
21 | </description> | ||
22 | |||
23 | <copyright> | ||
24 | %copyright | ||
25 | </copyright> | ||
26 | |||
27 | <license url="%licenseURL"> | ||
28 | %license | ||
29 | </license> | ||
30 | |||
31 | <url> | ||
32 | <update label="%updateSiteName" url="http://yoctoproject.org/downloads/eclipse-plugin/"/> | ||
33 | </url> | ||
34 | |||
35 | <includes | ||
36 | id="org.yocto.sdk.source" | ||
37 | version="0.0.0"/> | ||
38 | |||
39 | <requires> | ||
40 | <import plugin="org.eclipse.core.runtime"/> | ||
41 | <import plugin="org.eclipse.osgi"/> | ||
42 | <import plugin="org.eclipse.ui"/> | ||
43 | <import plugin="org.eclipse.rse.core"/> | ||
44 | <import plugin="org.eclipse.rse.ui"/> | ||
45 | <import plugin="org.eclipse.rse.services"/> | ||
46 | <import plugin="org.eclipse.ui.views"/> | ||
47 | <import plugin="org.eclipse.rse.subsystems.files.core"/> | ||
48 | <import plugin="org.eclipse.rse.subsystems.processes.core"/> | ||
49 | <import plugin="org.eclipse.rse.processes.ui"/> | ||
50 | <import plugin="org.eclipse.rse.subsystems.terminals.core"/> | ||
51 | <import plugin="org.eclipse.cdt.ui" version="5.1.2" match="greaterOrEqual"/> | ||
52 | <import plugin="org.eclipse.cdt.core" version="5.1.2" match="greaterOrEqual"/> | ||
53 | <import plugin="org.eclipse.core.resources" version="3.5.1" match="greaterOrEqual"/> | ||
54 | <import plugin="org.eclipse.debug.core" version="3.5.1" match="greaterOrEqual"/> | ||
55 | <import plugin="org.eclipse.cdt.managedbuilder.core"/> | ||
56 | <import plugin="org.eclipse.cdt.autotools.core" version="1.1.0" match="greaterOrEqual"/> | ||
57 | <import plugin="org.eclipse.cdt.autotools.ui" version="1.0.1" match="greaterOrEqual"/> | ||
58 | <import plugin="org.eclipse.cdt.managedbuilder.ui" version="5.1.0" match="greaterOrEqual"/> | ||
59 | <import plugin="org.eclipse.core.expressions" version="3.4.100" match="greaterOrEqual"/> | ||
60 | <import plugin="org.eclipse.rse.files.ui" version="3.1.1" match="greaterOrEqual"/> | ||
61 | <import plugin="org.eclipse.rse.subsystems.shells.core" version="3.1.0" match="greaterOrEqual"/> | ||
62 | <import plugin="org.eclipse.cdt.launch.remote" version="2.2.0" match="greaterOrEqual"/> | ||
63 | <import plugin="org.eclipse.tm.terminal" version="3.0.1" match="greaterOrEqual"/> | ||
64 | <import plugin="org.eclipse.rse.terminals.ui" version="1.0.100" match="greaterOrEqual"/> | ||
65 | <import plugin="org.eclipse.debug.ui"/> | ||
66 | <import plugin="org.eclipse.ui.forms"/> | ||
67 | <import plugin="org.eclipse.jface.text"/> | ||
68 | <import plugin="org.eclipse.ui.editors"/> | ||
69 | <import plugin="org.eclipse.ui.ide"/> | ||
70 | <import plugin="org.eclipse.ui.console"/> | ||
71 | <import plugin="org.eclipse.core.filesystem"/> | ||
72 | </requires> | ||
73 | |||
74 | <plugin | ||
75 | id="org.yocto.sdk.ide" | ||
76 | download-size="0" | ||
77 | install-size="0" | ||
78 | version="0.0.0" | ||
79 | unpack="false"/> | ||
80 | |||
81 | <plugin | ||
82 | id="org.yocto.remote.utils" | ||
83 | download-size="0" | ||
84 | install-size="0" | ||
85 | version="0.0.0" | ||
86 | unpack="false"/> | ||
87 | |||
88 | <plugin | ||
89 | id="org.yocto.sdk.remotetools" | ||
90 | download-size="0" | ||
91 | install-size="0" | ||
92 | version="0.0.0" | ||
93 | unpack="false"/> | ||
94 | |||
95 | <plugin | ||
96 | id="org.yocto.sdk.ide.doc.user" | ||
97 | download-size="0" | ||
98 | install-size="0" | ||
99 | version="0.0.0" | ||
100 | unpack="false"/> | ||
101 | |||
102 | <plugin | ||
103 | id="org.yocto.cmake.managedbuilder" | ||
104 | download-size="0" | ||
105 | install-size="0" | ||
106 | version="0.0.0" | ||
107 | unpack="false"/> | ||
108 | |||
109 | </feature> | ||
diff --git a/features/org.yocto.sdk/license.html b/features/org.yocto.sdk/license.html new file mode 100644 index 0000000..c184ca3 --- /dev/null +++ b/features/org.yocto.sdk/license.html | |||
@@ -0,0 +1,107 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1" ?> | ||
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
3 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
4 | <head> | ||
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> | ||
6 | <title>Eclipse Foundation Software User Agreement</title> | ||
7 | </head> | ||
8 | |||
9 | <body lang="EN-US"> | ||
10 | <h2>Eclipse Foundation Software User Agreement</h2> | ||
11 | <p>April 14, 2010</p> | ||
12 | |||
13 | <h3>Usage Of Content</h3> | ||
14 | |||
15 | <p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS | ||
16 | (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND | ||
17 | CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE | ||
18 | OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR | ||
19 | NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND | ||
20 | CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p> | ||
21 | |||
22 | <h3>Applicable Licenses</h3> | ||
23 | |||
24 | <p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 | ||
25 | ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. | ||
26 | For purposes of the EPL, "Program" will mean the Content.</p> | ||
27 | |||
28 | <p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code | ||
29 | repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p> | ||
30 | |||
31 | <ul> | ||
32 | <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li> | ||
33 | <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li> | ||
34 | <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins | ||
35 | and/or Fragments associated with that Feature.</li> | ||
36 | <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li> | ||
37 | </ul> | ||
38 | |||
39 | <p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and | ||
40 | Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module | ||
41 | including, but not limited to the following locations:</p> | ||
42 | |||
43 | <ul> | ||
44 | <li>The top-level (root) directory</li> | ||
45 | <li>Plug-in and Fragment directories</li> | ||
46 | <li>Inside Plug-ins and Fragments packaged as JARs</li> | ||
47 | <li>Sub-directories of the directory named "src" of certain Plug-ins</li> | ||
48 | <li>Feature directories</li> | ||
49 | </ul> | ||
50 | |||
51 | <p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the | ||
52 | installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or | ||
53 | inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. | ||
54 | Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in | ||
55 | that directory.</p> | ||
56 | |||
57 | <p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE | ||
58 | OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p> | ||
59 | |||
60 | <ul> | ||
61 | <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li> | ||
62 | <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li> | ||
63 | <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li> | ||
64 | <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li> | ||
65 | <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li> | ||
66 | </ul> | ||
67 | |||
68 | <p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please | ||
69 | contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p> | ||
70 | |||
71 | |||
72 | <h3>Use of Provisioning Technology</h3> | ||
73 | |||
74 | <p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse | ||
75 | Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or | ||
76 | other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to | ||
77 | install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a | ||
78 | href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a> | ||
79 | ("Specification").</p> | ||
80 | |||
81 | <p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the | ||
82 | applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology | ||
83 | in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the | ||
84 | Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p> | ||
85 | |||
86 | <ol> | ||
87 | <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology | ||
88 | on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based | ||
89 | product.</li> | ||
90 | <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be | ||
91 | accessed and copied to the Target Machine.</li> | ||
92 | <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable | ||
93 | Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target | ||
94 | Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern | ||
95 | the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such | ||
96 | indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li> | ||
97 | </ol> | ||
98 | |||
99 | <h3>Cryptography</h3> | ||
100 | |||
101 | <p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to | ||
102 | another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, | ||
103 | possession, or use, and re-export of encryption software, to see if this is permitted.</p> | ||
104 | |||
105 | <p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p> | ||
106 | </body> | ||
107 | </html> | ||
diff --git a/features/org.yocto.sdk/sourceTemplateFeature/feature.properties b/features/org.yocto.sdk/sourceTemplateFeature/feature.properties new file mode 100644 index 0000000..f0519b3 --- /dev/null +++ b/features/org.yocto.sdk/sourceTemplateFeature/feature.properties | |||
@@ -0,0 +1,163 @@ | |||
1 | ############################################################################### | ||
2 | # Copyright (c) 2011 Intel, Inc. and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # Intel - initial implementation | ||
10 | ############################################################################### | ||
11 | |||
12 | # "featureName" property - name of the feature | ||
13 | featureName=Yocto Project ADT Plug-in - Source | ||
14 | |||
15 | # "providerName" property - name of the company that provides the feature | ||
16 | providerName=yoctoproject.org | ||
17 | |||
18 | # "updateSiteName" property - label for the update site | ||
19 | updateSiteName=Yocto Project Update Site | ||
20 | |||
21 | # "description" property - description of the feature | ||
22 | description=\ | ||
23 | Eclipse plug-ins for developing embedded applications using Yocto Project | ||
24 | |||
25 | # copyright | ||
26 | copyright=\ | ||
27 | Copyright (c) 2011 Intel, Inc. and others. \ | ||
28 | All rights reserved. This program and the accompanying materials \ | ||
29 | are made available under the terms of the Eclipse Public License v1.0 \ | ||
30 | which accompanies this distribution, and is available at \ | ||
31 | http://www.eclipse.org/legal/epl-v10.html | ||
32 | ################ end of copyright property #################################### | ||
33 | |||
34 | # "licenseURL" property - URL of the "Feature License" | ||
35 | # do not translate value - just change to point to a locale-specific HTML page | ||
36 | licenseURL=license.html | ||
37 | |||
38 | # "license" property - text of the "Feature Update License" | ||
39 | # should be plain text version of license agreement pointed to be "licenseURL" | ||
40 | license=\ | ||
41 | Eclipse Foundation Software User Agreement\n\ | ||
42 | April 14, 2010\n\ | ||
43 | \n\ | ||
44 | Usage Of Content\n\ | ||
45 | \n\ | ||
46 | THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ | ||
47 | OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ | ||
48 | USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ | ||
49 | AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ | ||
50 | NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ | ||
51 | AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ | ||
52 | AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ | ||
53 | OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ | ||
54 | TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ | ||
55 | OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ | ||
56 | BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ | ||
57 | \n\ | ||
58 | Applicable Licenses\n\ | ||
59 | \n\ | ||
60 | Unless otherwise indicated, all Content made available by the\n\ | ||
61 | Eclipse Foundation is provided to you under the terms and conditions of\n\ | ||
62 | the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ | ||
63 | provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ | ||
64 | For purposes of the EPL, "Program" will mean the Content.\n\ | ||
65 | \n\ | ||
66 | Content includes, but is not limited to, source code, object code,\n\ | ||
67 | documentation and other files maintained in the Eclipse Foundation source code\n\ | ||
68 | repository ("Repository") in software modules ("Modules") and made available\n\ | ||
69 | as downloadable archives ("Downloads").\n\ | ||
70 | \n\ | ||
71 | - Content may be structured and packaged into modules to facilitate delivering,\n\ | ||
72 | extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ | ||
73 | plug-in fragments ("Fragments"), and features ("Features").\n\ | ||
74 | - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ | ||
75 | in a directory named "plugins".\n\ | ||
76 | - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ | ||
77 | Each Feature may be packaged as a sub-directory in a directory named "features".\n\ | ||
78 | Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ | ||
79 | numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ | ||
80 | - Features may also include other Features ("Included Features"). Within a Feature, files\n\ | ||
81 | named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ | ||
82 | \n\ | ||
83 | The terms and conditions governing Plug-ins and Fragments should be\n\ | ||
84 | contained in files named "about.html" ("Abouts"). The terms and\n\ | ||
85 | conditions governing Features and Included Features should be contained\n\ | ||
86 | in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ | ||
87 | Licenses may be located in any directory of a Download or Module\n\ | ||
88 | including, but not limited to the following locations:\n\ | ||
89 | \n\ | ||
90 | - The top-level (root) directory\n\ | ||
91 | - Plug-in and Fragment directories\n\ | ||
92 | - Inside Plug-ins and Fragments packaged as JARs\n\ | ||
93 | - Sub-directories of the directory named "src" of certain Plug-ins\n\ | ||
94 | - Feature directories\n\ | ||
95 | \n\ | ||
96 | Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ | ||
97 | Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ | ||
98 | Update License") during the installation process. If the Feature contains\n\ | ||
99 | Included Features, the Feature Update License should either provide you\n\ | ||
100 | with the terms and conditions governing the Included Features or inform\n\ | ||
101 | you where you can locate them. Feature Update Licenses may be found in\n\ | ||
102 | the "license" property of files named "feature.properties" found within a Feature.\n\ | ||
103 | Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ | ||
104 | terms and conditions (or references to such terms and conditions) that\n\ | ||
105 | govern your use of the associated Content in that directory.\n\ | ||
106 | \n\ | ||
107 | THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ | ||
108 | TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ | ||
109 | SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ | ||
110 | \n\ | ||
111 | - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ | ||
112 | - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ | ||
113 | - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ | ||
114 | - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ | ||
115 | - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ | ||
116 | \n\ | ||
117 | IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ | ||
118 | TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ | ||
119 | is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ | ||
120 | govern that particular Content.\n\ | ||
121 | \n\ | ||
122 | \n\Use of Provisioning Technology\n\ | ||
123 | \n\ | ||
124 | The Eclipse Foundation makes available provisioning software, examples of which include,\n\ | ||
125 | but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ | ||
126 | the purpose of allowing users to install software, documentation, information and/or\n\ | ||
127 | other materials (collectively "Installable Software"). This capability is provided with\n\ | ||
128 | the intent of allowing such users to install, extend and update Eclipse-based products.\n\ | ||
129 | Information about packaging Installable Software is available at\n\ | ||
130 | http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ | ||
131 | \n\ | ||
132 | You may use Provisioning Technology to allow other parties to install Installable Software.\n\ | ||
133 | You shall be responsible for enabling the applicable license agreements relating to the\n\ | ||
134 | Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ | ||
135 | in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ | ||
136 | making it available in accordance with the Specification, you further acknowledge your\n\ | ||
137 | agreement to, and the acquisition of all necessary rights to permit the following:\n\ | ||
138 | \n\ | ||
139 | 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ | ||
140 | the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ | ||
141 | extending or updating the functionality of an Eclipse-based product.\n\ | ||
142 | 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ | ||
143 | Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ | ||
144 | 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ | ||
145 | govern the use of the Installable Software ("Installable Software Agreement") and such\n\ | ||
146 | Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ | ||
147 | with the Specification. Such Installable Software Agreement must inform the user of the\n\ | ||
148 | terms and conditions that govern the Installable Software and must solicit acceptance by\n\ | ||
149 | the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ | ||
150 | indication of agreement by the user, the provisioning Technology will complete installation\n\ | ||
151 | of the Installable Software.\n\ | ||
152 | \n\ | ||
153 | Cryptography\n\ | ||
154 | \n\ | ||
155 | Content may contain encryption software. The country in which you are\n\ | ||
156 | currently may have restrictions on the import, possession, and use,\n\ | ||
157 | and/or re-export to another country, of encryption software. BEFORE\n\ | ||
158 | using any encryption software, please check the country's laws,\n\ | ||
159 | regulations and policies concerning the import, possession, or use, and\n\ | ||
160 | re-export of encryption software, to see if this is permitted.\n\ | ||
161 | \n\ | ||
162 | Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n | ||
163 | ########### end of license property ########################################## | ||
diff --git a/features/org.yocto.sdk/sourceTemplateFeature/license.html b/features/org.yocto.sdk/sourceTemplateFeature/license.html new file mode 100644 index 0000000..c184ca3 --- /dev/null +++ b/features/org.yocto.sdk/sourceTemplateFeature/license.html | |||
@@ -0,0 +1,107 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1" ?> | ||
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
3 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
4 | <head> | ||
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> | ||
6 | <title>Eclipse Foundation Software User Agreement</title> | ||
7 | </head> | ||
8 | |||
9 | <body lang="EN-US"> | ||
10 | <h2>Eclipse Foundation Software User Agreement</h2> | ||
11 | <p>April 14, 2010</p> | ||
12 | |||
13 | <h3>Usage Of Content</h3> | ||
14 | |||
15 | <p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS | ||
16 | (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND | ||
17 | CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE | ||
18 | OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR | ||
19 | NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND | ||
20 | CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p> | ||
21 | |||
22 | <h3>Applicable Licenses</h3> | ||
23 | |||
24 | <p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 | ||
25 | ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. | ||
26 | For purposes of the EPL, "Program" will mean the Content.</p> | ||
27 | |||
28 | <p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code | ||
29 | repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p> | ||
30 | |||
31 | <ul> | ||
32 | <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li> | ||
33 | <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li> | ||
34 | <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins | ||
35 | and/or Fragments associated with that Feature.</li> | ||
36 | <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li> | ||
37 | </ul> | ||
38 | |||
39 | <p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and | ||
40 | Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module | ||
41 | including, but not limited to the following locations:</p> | ||
42 | |||
43 | <ul> | ||
44 | <li>The top-level (root) directory</li> | ||
45 | <li>Plug-in and Fragment directories</li> | ||
46 | <li>Inside Plug-ins and Fragments packaged as JARs</li> | ||
47 | <li>Sub-directories of the directory named "src" of certain Plug-ins</li> | ||
48 | <li>Feature directories</li> | ||
49 | </ul> | ||
50 | |||
51 | <p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the | ||
52 | installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or | ||
53 | inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. | ||
54 | Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in | ||
55 | that directory.</p> | ||
56 | |||
57 | <p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE | ||
58 | OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p> | ||
59 | |||
60 | <ul> | ||
61 | <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li> | ||
62 | <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li> | ||
63 | <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li> | ||
64 | <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li> | ||
65 | <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li> | ||
66 | </ul> | ||
67 | |||
68 | <p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please | ||
69 | contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p> | ||
70 | |||
71 | |||
72 | <h3>Use of Provisioning Technology</h3> | ||
73 | |||
74 | <p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse | ||
75 | Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or | ||
76 | other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to | ||
77 | install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a | ||
78 | href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a> | ||
79 | ("Specification").</p> | ||
80 | |||
81 | <p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the | ||
82 | applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology | ||
83 | in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the | ||
84 | Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p> | ||
85 | |||
86 | <ol> | ||
87 | <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology | ||
88 | on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based | ||
89 | product.</li> | ||
90 | <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be | ||
91 | accessed and copied to the Target Machine.</li> | ||
92 | <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable | ||
93 | Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target | ||
94 | Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern | ||
95 | the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such | ||
96 | indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li> | ||
97 | </ol> | ||
98 | |||
99 | <h3>Cryptography</h3> | ||
100 | |||
101 | <p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to | ||
102 | another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, | ||
103 | possession, or use, and re-export of encryption software, to see if this is permitted.</p> | ||
104 | |||
105 | <p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p> | ||
106 | </body> | ||
107 | </html> | ||
diff --git a/features/org.yocto.sdk/sourceTemplatePlugin/license.html b/features/org.yocto.sdk/sourceTemplatePlugin/license.html new file mode 100644 index 0000000..c184ca3 --- /dev/null +++ b/features/org.yocto.sdk/sourceTemplatePlugin/license.html | |||
@@ -0,0 +1,107 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1" ?> | ||
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
3 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
4 | <head> | ||
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> | ||
6 | <title>Eclipse Foundation Software User Agreement</title> | ||
7 | </head> | ||
8 | |||
9 | <body lang="EN-US"> | ||
10 | <h2>Eclipse Foundation Software User Agreement</h2> | ||
11 | <p>April 14, 2010</p> | ||
12 | |||
13 | <h3>Usage Of Content</h3> | ||
14 | |||
15 | <p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS | ||
16 | (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND | ||
17 | CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE | ||
18 | OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR | ||
19 | NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND | ||
20 | CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p> | ||
21 | |||
22 | <h3>Applicable Licenses</h3> | ||
23 | |||
24 | <p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 | ||
25 | ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. | ||
26 | For purposes of the EPL, "Program" will mean the Content.</p> | ||
27 | |||
28 | <p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code | ||
29 | repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p> | ||
30 | |||
31 | <ul> | ||
32 | <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li> | ||
33 | <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li> | ||
34 | <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins | ||
35 | and/or Fragments associated with that Feature.</li> | ||
36 | <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li> | ||
37 | </ul> | ||
38 | |||
39 | <p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and | ||
40 | Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module | ||
41 | including, but not limited to the following locations:</p> | ||
42 | |||
43 | <ul> | ||
44 | <li>The top-level (root) directory</li> | ||
45 | <li>Plug-in and Fragment directories</li> | ||
46 | <li>Inside Plug-ins and Fragments packaged as JARs</li> | ||
47 | <li>Sub-directories of the directory named "src" of certain Plug-ins</li> | ||
48 | <li>Feature directories</li> | ||
49 | </ul> | ||
50 | |||
51 | <p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the | ||
52 | installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or | ||
53 | inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. | ||
54 | Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in | ||
55 | that directory.</p> | ||
56 | |||
57 | <p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE | ||
58 | OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p> | ||
59 | |||
60 | <ul> | ||
61 | <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li> | ||
62 | <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li> | ||
63 | <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li> | ||
64 | <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li> | ||
65 | <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li> | ||
66 | </ul> | ||
67 | |||
68 | <p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please | ||
69 | contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p> | ||
70 | |||
71 | |||
72 | <h3>Use of Provisioning Technology</h3> | ||
73 | |||
74 | <p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse | ||
75 | Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or | ||
76 | other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to | ||
77 | install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a | ||
78 | href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a> | ||
79 | ("Specification").</p> | ||
80 | |||
81 | <p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the | ||
82 | applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology | ||
83 | in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the | ||
84 | Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p> | ||
85 | |||
86 | <ol> | ||
87 | <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology | ||
88 | on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based | ||
89 | product.</li> | ||
90 | <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be | ||
91 | accessed and copied to the Target Machine.</li> | ||
92 | <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable | ||
93 | Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target | ||
94 | Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern | ||
95 | the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such | ||
96 | indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li> | ||
97 | </ol> | ||
98 | |||
99 | <h3>Cryptography</h3> | ||
100 | |||
101 | <p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to | ||
102 | another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, | ||
103 | possession, or use, and re-export of encryption software, to see if this is permitted.</p> | ||
104 | |||
105 | <p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p> | ||
106 | </body> | ||
107 | </html> | ||
diff --git a/features/org.yocto.sdk/sourceTemplatePlugin/plugin.properties b/features/org.yocto.sdk/sourceTemplatePlugin/plugin.properties new file mode 100644 index 0000000..91baf99 --- /dev/null +++ b/features/org.yocto.sdk/sourceTemplatePlugin/plugin.properties | |||
@@ -0,0 +1,163 @@ | |||
1 | ############################################################################### | ||
2 | # Copyright (c) 2011 Intel, Inc. and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # Intel - initial implementation | ||
10 | ############################################################################### | ||
11 | |||
12 | # "featureName" property - name of the feature | ||
13 | pluginName=Yocto Project ADT Plug-in - Source | ||
14 | |||
15 | # "providerName" property - name of the company that provides the feature | ||
16 | providerName=yoctoproject.org | ||
17 | |||
18 | # "updateSiteName" property - label for the update site | ||
19 | updateSiteName=Yocto Project Update Site | ||
20 | |||
21 | # "description" property - description of the feature | ||
22 | description=\ | ||
23 | Eclipse plug-ins for developing embedded applications using Yocto Project | ||
24 | |||
25 | # copyright | ||
26 | copyright=\ | ||
27 | Copyright (c) 2011 Intel, Inc. and others. \ | ||
28 | All rights reserved. This program and the accompanying materials \ | ||
29 | are made available under the terms of the Eclipse Public License v1.0 \ | ||
30 | which accompanies this distribution, and is available at \ | ||
31 | http://www.eclipse.org/legal/epl-v10.html | ||
32 | ################ end of copyright property #################################### | ||
33 | |||
34 | # "licenseURL" property - URL of the "Feature License" | ||
35 | # do not translate value - just change to point to a locale-specific HTML page | ||
36 | licenseURL=license.html | ||
37 | |||
38 | # "license" property - text of the "Feature Update License" | ||
39 | # should be plain text version of license agreement pointed to be "licenseURL" | ||
40 | license=\ | ||
41 | Eclipse Foundation Software User Agreement\n\ | ||
42 | April 14, 2010\n\ | ||
43 | \n\ | ||
44 | Usage Of Content\n\ | ||
45 | \n\ | ||
46 | THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ | ||
47 | OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ | ||
48 | USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ | ||
49 | AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ | ||
50 | NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ | ||
51 | AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ | ||
52 | AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ | ||
53 | OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ | ||
54 | TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ | ||
55 | OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ | ||
56 | BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ | ||
57 | \n\ | ||
58 | Applicable Licenses\n\ | ||
59 | \n\ | ||
60 | Unless otherwise indicated, all Content made available by the\n\ | ||
61 | Eclipse Foundation is provided to you under the terms and conditions of\n\ | ||
62 | the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ | ||
63 | provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ | ||
64 | For purposes of the EPL, "Program" will mean the Content.\n\ | ||
65 | \n\ | ||
66 | Content includes, but is not limited to, source code, object code,\n\ | ||
67 | documentation and other files maintained in the Eclipse Foundation source code\n\ | ||
68 | repository ("Repository") in software modules ("Modules") and made available\n\ | ||
69 | as downloadable archives ("Downloads").\n\ | ||
70 | \n\ | ||
71 | - Content may be structured and packaged into modules to facilitate delivering,\n\ | ||
72 | extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ | ||
73 | plug-in fragments ("Fragments"), and features ("Features").\n\ | ||
74 | - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ | ||
75 | in a directory named "plugins".\n\ | ||
76 | - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ | ||
77 | Each Feature may be packaged as a sub-directory in a directory named "features".\n\ | ||
78 | Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ | ||
79 | numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ | ||
80 | - Features may also include other Features ("Included Features"). Within a Feature, files\n\ | ||
81 | named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ | ||
82 | \n\ | ||
83 | The terms and conditions governing Plug-ins and Fragments should be\n\ | ||
84 | contained in files named "about.html" ("Abouts"). The terms and\n\ | ||
85 | conditions governing Features and Included Features should be contained\n\ | ||
86 | in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ | ||
87 | Licenses may be located in any directory of a Download or Module\n\ | ||
88 | including, but not limited to the following locations:\n\ | ||
89 | \n\ | ||
90 | - The top-level (root) directory\n\ | ||
91 | - Plug-in and Fragment directories\n\ | ||
92 | - Inside Plug-ins and Fragments packaged as JARs\n\ | ||
93 | - Sub-directories of the directory named "src" of certain Plug-ins\n\ | ||
94 | - Feature directories\n\ | ||
95 | \n\ | ||
96 | Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ | ||
97 | Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ | ||
98 | Update License") during the installation process. If the Feature contains\n\ | ||
99 | Included Features, the Feature Update License should either provide you\n\ | ||
100 | with the terms and conditions governing the Included Features or inform\n\ | ||
101 | you where you can locate them. Feature Update Licenses may be found in\n\ | ||
102 | the "license" property of files named "feature.properties" found within a Feature.\n\ | ||
103 | Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ | ||
104 | terms and conditions (or references to such terms and conditions) that\n\ | ||
105 | govern your use of the associated Content in that directory.\n\ | ||
106 | \n\ | ||
107 | THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ | ||
108 | TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ | ||
109 | SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ | ||
110 | \n\ | ||
111 | - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ | ||
112 | - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ | ||
113 | - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ | ||
114 | - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ | ||
115 | - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ | ||
116 | \n\ | ||
117 | IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ | ||
118 | TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ | ||
119 | is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ | ||
120 | govern that particular Content.\n\ | ||
121 | \n\ | ||
122 | \n\Use of Provisioning Technology\n\ | ||
123 | \n\ | ||
124 | The Eclipse Foundation makes available provisioning software, examples of which include,\n\ | ||
125 | but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ | ||
126 | the purpose of allowing users to install software, documentation, information and/or\n\ | ||
127 | other materials (collectively "Installable Software"). This capability is provided with\n\ | ||
128 | the intent of allowing such users to install, extend and update Eclipse-based products.\n\ | ||
129 | Information about packaging Installable Software is available at\n\ | ||
130 | http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ | ||
131 | \n\ | ||
132 | You may use Provisioning Technology to allow other parties to install Installable Software.\n\ | ||
133 | You shall be responsible for enabling the applicable license agreements relating to the\n\ | ||
134 | Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ | ||
135 | in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ | ||
136 | making it available in accordance with the Specification, you further acknowledge your\n\ | ||
137 | agreement to, and the acquisition of all necessary rights to permit the following:\n\ | ||
138 | \n\ | ||
139 | 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ | ||
140 | the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ | ||
141 | extending or updating the functionality of an Eclipse-based product.\n\ | ||
142 | 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ | ||
143 | Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ | ||
144 | 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ | ||
145 | govern the use of the Installable Software ("Installable Software Agreement") and such\n\ | ||
146 | Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ | ||
147 | with the Specification. Such Installable Software Agreement must inform the user of the\n\ | ||
148 | terms and conditions that govern the Installable Software and must solicit acceptance by\n\ | ||
149 | the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ | ||
150 | indication of agreement by the user, the provisioning Technology will complete installation\n\ | ||
151 | of the Installable Software.\n\ | ||
152 | \n\ | ||
153 | Cryptography\n\ | ||
154 | \n\ | ||
155 | Content may contain encryption software. The country in which you are\n\ | ||
156 | currently may have restrictions on the import, possession, and use,\n\ | ||
157 | and/or re-export to another country, of encryption software. BEFORE\n\ | ||
158 | using any encryption software, please check the country's laws,\n\ | ||
159 | regulations and policies concerning the import, possession, or use, and\n\ | ||
160 | re-export of encryption software, to see if this is permitted.\n\ | ||
161 | \n\ | ||
162 | Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n | ||
163 | ########### end of license property ########################################## | ||
diff --git a/features/org.yocto.utils.headless.build/build.properties b/features/org.yocto.utils.headless.build/build.properties new file mode 100644 index 0000000..6043293 --- /dev/null +++ b/features/org.yocto.utils.headless.build/build.properties | |||
@@ -0,0 +1,262 @@ | |||
1 | ############################################################################### | ||
2 | # Copyright (c) 2003, 2009 IBM Corporation and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # IBM Corporation - initial API and implementation | ||
10 | ############################################################################### | ||
11 | ##################### | ||
12 | # Parameters describing how and where to execute the build. | ||
13 | # Typical users need only update the following properties: | ||
14 | # baseLocation - where things you are building against are installed | ||
15 | # bootclasspath - The base jars to compile against (typicaly rt.jar) | ||
16 | # configs - the list of {os, ws, arch} configurations to build. | ||
17 | # | ||
18 | # Of course any of the settings here can be overridden by spec'ing | ||
19 | # them on the command line (e.g., -DbaseLocation=d:/eclipse | ||
20 | |||
21 | #The type of the top level element we are building, generally "feature" | ||
22 | topLevelElementType = feature | ||
23 | #The id of the top level element we are building | ||
24 | topLevelElementId = org.yocto.utils | ||
25 | |||
26 | ############# PRODUCT/PACKAGING CONTROL ############# | ||
27 | product=/plugin or feature id/path/to/.product | ||
28 | runPackager=true | ||
29 | |||
30 | #Set the name of the archive that will result from the product build. | ||
31 | #archiveNamePrefix= | ||
32 | |||
33 | # The prefix that will be used in the generated archive. | ||
34 | archivePrefix=eclipse | ||
35 | |||
36 | # The location underwhich all of the build output will be collected. | ||
37 | collectingFolder=${archivePrefix} | ||
38 | |||
39 | # The list of {os, ws, arch} configurations to build. This | ||
40 | # value is a '&' separated list of ',' separate triples. For example, | ||
41 | # configs=win32,win32,x86 & linux,motif,x86 | ||
42 | # By default the value is *,*,* | ||
43 | configs = *, *, * | ||
44 | #configs=win32, win32, x86 & \ | ||
45 | # win32,win32,x86_64 & \ | ||
46 | # win32,win32,wpf & \ | ||
47 | # linux, gtk, ppc & \ | ||
48 | # linux, gtk, x86 & \ | ||
49 | # linux, gtk, x86_64 & \ | ||
50 | # linux, motif, x86 & \ | ||
51 | # solaris, motif, sparc & \ | ||
52 | # solaris, gtk, sparc & \ | ||
53 | # aix, motif, ppc & \ | ||
54 | # hpux, motif, ia64_32 & \ | ||
55 | # macosx, carbon, ppc & \ | ||
56 | # macosx, carbon, x86 & \ | ||
57 | # macosx, cocoa, ppc & \ | ||
58 | # macosx, cocoa, x86 & \ | ||
59 | # macosx, cocoa, x86_64 | ||
60 | |||
61 | # By default PDE creates one archive (result) per entry listed in the configs property. | ||
62 | # Setting this value to true will cause PDE to only create one output containing all | ||
63 | # artifacts for all the platforms listed in the configs property. | ||
64 | # To control the output format for the group, add a "group, group, group - <format>" entry to the | ||
65 | # archivesFormat. | ||
66 | #groupConfigurations=true | ||
67 | |||
68 | #The format of the archive. By default a zip is created using antZip. | ||
69 | #The list can only contain the configuration for which the desired format is different than zip. | ||
70 | #archivesFormat=win32, win32, x86 - antZip& \ | ||
71 | # linux, gtk, ppc - antZip &\ | ||
72 | # linux, gtk, x86 - antZip& \ | ||
73 | # linux, gtk, x86_64 - antZip& \ | ||
74 | # linux, motif, x86 - antZip& \ | ||
75 | # solaris, motif, sparc - antZip& \ | ||
76 | # solaris, gtk, sparc - antZip& \ | ||
77 | # aix, motif, ppc - antZip& \ | ||
78 | # hpux, motif, PA_RISC - antZip& \ | ||
79 | # macosx, carbon, ppc - antZip | ||
80 | |||
81 | #Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles. | ||
82 | allowBinaryCycles = true | ||
83 | |||
84 | #Sort bundles depenedencies across all features instead of just within a given feature. | ||
85 | #flattenDependencies = true | ||
86 | |||
87 | #Parallel compilation, requires flattenedDependencies=true | ||
88 | #parallelCompilation=true | ||
89 | #parallelThreadCount= | ||
90 | #parallelThreadsPerProcessor= | ||
91 | |||
92 | #Set to true if you want the output to be ready for an update jar (no site.xml generated) | ||
93 | outputUpdateJars = true | ||
94 | |||
95 | #Set to true for Jnlp generation | ||
96 | #codebase should be a URL that will be used as the root of all relative URLs in the output. | ||
97 | #generateJnlp=false | ||
98 | #jnlp.codebase=<codebase url> | ||
99 | #jnlp.j2se=<j2se version> | ||
100 | #jnlp.locale=<a locale> | ||
101 | #jnlp.generateOfflineAllowed=true or false generate <offlineAllowed/> attribute in the generated features | ||
102 | #jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built | ||
103 | |||
104 | #Set to true if you want to sign jars | ||
105 | #signJars=false | ||
106 | #sign.alias=<alias> | ||
107 | #sign.keystore=<keystore location> | ||
108 | #sign.storepass=<keystore password> | ||
109 | #sign.keypass=<key password> | ||
110 | |||
111 | #Arguments to send to the zip executable | ||
112 | zipargs= | ||
113 | |||
114 | #Arguments to send to the tar executable | ||
115 | tarargs= | ||
116 | |||
117 | #Control the creation of a file containing the version included in each configuration - on by default | ||
118 | #generateVersionsLists=false | ||
119 | |||
120 | ############## BUILD NAMING CONTROL ################ | ||
121 | # The directory into which the build elements are fetched and where | ||
122 | # the build takes place. | ||
123 | #buildDirectory= | ||
124 | |||
125 | # Type of build. Used in naming the build output. Typically this value is | ||
126 | # one of I, N, M, S, ... | ||
127 | buildType=I | ||
128 | |||
129 | # ID of the build. Used in naming the build output. | ||
130 | buildId=TestBuild | ||
131 | |||
132 | # Label for the build. Used in naming the build output | ||
133 | buildLabel=${buildType}.${buildId} | ||
134 | |||
135 | # Timestamp for the build. Used in naming the build output | ||
136 | timestamp=007 | ||
137 | |||
138 | #The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde. | ||
139 | #The value will only be applied to plugin or features indicating build.properties, qualifier = context | ||
140 | #forceContextQualifier=<the value for the qualifier> | ||
141 | |||
142 | #Enable / disable the generation of a suffix for the features that use .qualifier. | ||
143 | #The generated suffix is computed according to the content of the feature | ||
144 | #generateFeatureVersionSuffix=true | ||
145 | |||
146 | ############# BASE CONTROL ############# | ||
147 | # Settings for the base Eclipse components and Java class libraries | ||
148 | # against which you are building. | ||
149 | # Base location for anything the build needs to compile against. For example, | ||
150 | # in most RCP app or a plug-in, the baseLocation should be the location of a previously | ||
151 | # installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack. | ||
152 | |||
153 | #base=<path/to/parent/of/eclipse> | ||
154 | #baseLocation=${base}/eclipse | ||
155 | |||
156 | #Folder containing repositories whose content is needed to compile against | ||
157 | #repoBaseLocation=${base}/repos | ||
158 | #Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against | ||
159 | #transformedRepoLocation=${base}/transformedRepos | ||
160 | |||
161 | #Os/Ws/Arch/nl of the eclipse specified by baseLocation | ||
162 | #baseos=win32 | ||
163 | #basews=win32 | ||
164 | #basearch=x86 | ||
165 | |||
166 | #this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built | ||
167 | filteredDependencyCheck=false | ||
168 | |||
169 | #this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons) | ||
170 | resolution.devMode=false | ||
171 | |||
172 | #pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :) | ||
173 | #a location is one of: | ||
174 | #- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo | ||
175 | #- a directory that contains a /plugins or /features subdirectory | ||
176 | #- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml | ||
177 | #pluginPath= | ||
178 | |||
179 | skipBase=true | ||
180 | eclipseURL=<url for eclipse download site> | ||
181 | eclipseBuildId=<Id of Eclipse build to get> | ||
182 | eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip | ||
183 | |||
184 | |||
185 | ############# MAP FILE CONTROL ################ | ||
186 | # This section defines CVS tags to use when fetching the map files from the repository. | ||
187 | # If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml | ||
188 | |||
189 | skipMaps=true | ||
190 | mapsRepo=:pserver:anonymous@example.com/path/to/repo | ||
191 | mapsRoot=path/to/maps | ||
192 | mapsCheckoutTag=HEAD | ||
193 | |||
194 | #tagMaps=true | ||
195 | mapsTagTag=v${buildId} | ||
196 | |||
197 | |||
198 | ############ REPOSITORY CONTROL ############### | ||
199 | # This section defines properties parameterizing the repositories where plugins, fragments | ||
200 | # bundles and features are being obtained from. | ||
201 | |||
202 | # The tags to use when fetching elements to build. | ||
203 | # By default thebuilder will use whatever is in the maps. | ||
204 | # This value takes the form of a comma separated list of repository identifier (like used in the map files) and the | ||
205 | # overriding value | ||
206 | # For example fetchTag=CVS=HEAD, SVN=v20050101 | ||
207 | # fetchTag=HEAD | ||
208 | skipFetch=true | ||
209 | |||
210 | |||
211 | ############# JAVA COMPILER OPTIONS ############## | ||
212 | # The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE | ||
213 | #bootclasspath=${java.home}/lib/rt.jar | ||
214 | |||
215 | # specific JRE locations to compile against. These values are used to compile bundles specifying a | ||
216 | # Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support | ||
217 | #CDC-1.0/Foundation-1.0= /path/to/rt.jar | ||
218 | #CDC-1.1/Foundation-1.1= | ||
219 | #OSGi/Minimum-1.0= | ||
220 | #OSGi/Minimum-1.1= | ||
221 | #JRE-1.1= | ||
222 | #J2SE-1.2= | ||
223 | #J2SE-1.3= | ||
224 | #J2SE-1.4= | ||
225 | #J2SE-1.5= | ||
226 | #JavaSE-1.6= | ||
227 | #PersonalJava-1.1= | ||
228 | #PersonalJava-1.2= | ||
229 | #CDC-1.0/PersonalBasis-1.0= | ||
230 | #CDC-1.0/PersonalJava-1.0= | ||
231 | #CDC-1.1/PersonalBasis-1.1= | ||
232 | #CDC-1.1/PersonalJava-1.1= | ||
233 | |||
234 | # Specify the output format of the compiler log when eclipse jdt is used | ||
235 | logExtension=.log | ||
236 | |||
237 | # Whether or not to include debug info in the output jars | ||
238 | javacDebugInfo=false | ||
239 | |||
240 | # Whether or not to fail the build if there are compiler errors | ||
241 | javacFailOnError=true | ||
242 | |||
243 | # Enable or disable verbose mode of the compiler | ||
244 | javacVerbose=true | ||
245 | |||
246 | # Extra arguments for the compiler. These are specific to the java compiler being used. | ||
247 | #compilerArg= | ||
248 | |||
249 | # Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties | ||
250 | javacSource=1.6 | ||
251 | |||
252 | # Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties. | ||
253 | javacTarget=1.6 | ||
254 | |||
255 | #individualSourceBundles=true | ||
256 | |||
257 | #p2.gathering=true | ||
258 | p2.compress=true | ||
259 | #p2.category.site=file:${buildDirectory}/site.xml | ||
260 | p2.category.definition=file:${buildDirectory}/category.xml | ||
261 | p2.metadata.repo.name=Yocto Project Update Site | ||
262 | p2.artifact.repo.name=Yocto Project Update Site | ||
diff --git a/features/org.yocto.utils.headless.build/customTargets.xml b/features/org.yocto.utils.headless.build/customTargets.xml new file mode 100644 index 0000000..47a1730 --- /dev/null +++ b/features/org.yocto.utils.headless.build/customTargets.xml | |||
@@ -0,0 +1,212 @@ | |||
1 | <project name="Build specific targets and properties" default="noDefault"> | ||
2 | |||
3 | <!-- ===================================================================== --> | ||
4 | <!-- Run a given ${target} on all elements being built --> | ||
5 | <!-- Add on <ant> task for each top level element being built. --> | ||
6 | <!-- ===================================================================== --> | ||
7 | <available property="allElementsFile" file="${builder}/allElements.xml" value="${builder}/allElements.xml"/> | ||
8 | <property name="allElementsFile" location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/> | ||
9 | |||
10 | <import file="${allElementsFile}" /> | ||
11 | <target name="allElements"> | ||
12 | <antcall target="allElementsDelegator" /> | ||
13 | </target> | ||
14 | |||
15 | <!-- ===================================================================== --> | ||
16 | <!-- ===================================================================== --> | ||
17 | <target name="getBaseComponents" depends="checkLocalBase" unless="skipBase"> | ||
18 | <get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" /> | ||
19 | <unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" /> | ||
20 | </target> | ||
21 | |||
22 | <target name="checkLocalBase"> | ||
23 | <available file="${base}" property="skipBase" /> | ||
24 | </target> | ||
25 | |||
26 | <!-- ===================================================================== --> | ||
27 | <!-- Check out map files from correct repository --> | ||
28 | <!-- Replace values for mapsCheckoutTag as desired. --> | ||
29 | <!-- ===================================================================== --> | ||
30 | <target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps"> | ||
31 | <property name="mapsCheckoutTag" value="HEAD" /> | ||
32 | <cvs cvsRoot="${mapsRepo}" package="${mapsRoot}" dest="${buildDirectory}/maps" tag="${mapsCheckoutTag}" /> | ||
33 | </target> | ||
34 | |||
35 | <target name="checkLocalMaps"> | ||
36 | <available property="skipMaps" file="${buildDirectory}/maps" /> | ||
37 | </target> | ||
38 | |||
39 | <target name="tagMapFiles" if="tagMaps"> | ||
40 | <cvs dest="${buildDirectory}/maps/${mapsRoot}" command="tag ${mapsTagTag}" /> | ||
41 | </target> | ||
42 | |||
43 | <!-- ===================================================================== --> | ||
44 | |||
45 | <target name="clean" unless="noclean"> | ||
46 | <antcall target="allElements"> | ||
47 | <param name="target" value="cleanElement" /> | ||
48 | </antcall> | ||
49 | </target> | ||
50 | |||
51 | <target name="gatherLogs"> | ||
52 | <mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" /> | ||
53 | <antcall target="allElements"> | ||
54 | <param name="target" value="gatherLogs" /> | ||
55 | </antcall> | ||
56 | <unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true"> | ||
57 | <fileset dir="${buildDirectory}/features"> | ||
58 | <include name="**/*.log.zip" /> | ||
59 | </fileset> | ||
60 | </unzip> | ||
61 | </target> | ||
62 | |||
63 | <!-- ===================================================================== --> | ||
64 | <!-- Steps to do before setup --> | ||
65 | <!-- ===================================================================== --> | ||
66 | <target name="preSetup"> | ||
67 | <delete dir="${buildDirectory}/plugins"/> | ||
68 | <mkdir dir="${buildDirectory}/plugins"/> | ||
69 | <copy todir="${buildDirectory}/plugins" failonerror="true"> | ||
70 | <fileset dir="${otherSrcDirectory}/plugins"/> | ||
71 | </copy> | ||
72 | <delete dir="${buildDirectory}/features"/> | ||
73 | <copy todir="${buildDirectory}/features" failonerror="true" > | ||
74 | <fileset dir="${otherSrcDirectory}/features"/> | ||
75 | </copy> | ||
76 | <antcall target="prepareForP2" /> | ||
77 | </target> | ||
78 | |||
79 | <target name="prepareForP2" if="p2.gathering"> | ||
80 | <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" /> | ||
81 | <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/category.xml" todir="${buildDirectory}" /> | ||
82 | <xmlproperty file="${otherSrcDirectory}/features/org.yocto.utils/feature.xml" /> | ||
83 | <replace file="${buildDirectory}/category.xml"> | ||
84 | <replacefilter token="@utilsfeatureVersion@" value="${feature(version)}"/> | ||
85 | </replace> | ||
86 | </target> | ||
87 | |||
88 | <!-- ===================================================================== --> | ||
89 | <!-- Steps to do after setup but before starting the build proper --> | ||
90 | <!-- ===================================================================== --> | ||
91 | <target name="postSetup"> | ||
92 | <antcall target="getBaseComponents" /> | ||
93 | </target> | ||
94 | |||
95 | <!-- ===================================================================== --> | ||
96 | <!-- Steps to do before fetching the build elements --> | ||
97 | <!-- ===================================================================== --> | ||
98 | <target name="preFetch"> | ||
99 | </target> | ||
100 | |||
101 | <!-- ===================================================================== --> | ||
102 | <!-- Steps to do after fetching the build elements --> | ||
103 | <!-- ===================================================================== --> | ||
104 | <target name="postFetch"> | ||
105 | </target> | ||
106 | |||
107 | <!-- ===================================================================== --> | ||
108 | <!-- Steps to do before the repositories are being processed --> | ||
109 | <!-- ===================================================================== --> | ||
110 | <target name="preProcessRepos"> | ||
111 | </target> | ||
112 | |||
113 | <!-- ===================================================================== --> | ||
114 | <!-- Steps to do after the repositories have been processed --> | ||
115 | <!-- ===================================================================== --> | ||
116 | <target name="postProcessRepos"> | ||
117 | </target> | ||
118 | |||
119 | <!-- ===================================================================== --> | ||
120 | <!-- Steps to do before generating the build scripts. --> | ||
121 | <!-- ===================================================================== --> | ||
122 | <target name="preGenerate"> | ||
123 | </target> | ||
124 | |||
125 | <!-- ===================================================================== --> | ||
126 | <!-- Steps to do after generating the build scripts. --> | ||
127 | <!-- ===================================================================== --> | ||
128 | <target name="postGenerate"> | ||
129 | <antcall target="clean" /> | ||
130 | </target> | ||
131 | |||
132 | <!-- ===================================================================== --> | ||
133 | <!-- Steps to do before running the build.xmls for the elements being built. --> | ||
134 | <!-- ===================================================================== --> | ||
135 | <target name="preProcess"> | ||
136 | </target> | ||
137 | |||
138 | <!-- ===================================================================== --> | ||
139 | <!-- Steps to do after running the build.xmls for the elements being built. --> | ||
140 | <!-- ===================================================================== --> | ||
141 | <target name="postProcess"> | ||
142 | </target> | ||
143 | |||
144 | <!-- ===================================================================== --> | ||
145 | <!-- Steps to do before running assemble. --> | ||
146 | <!-- ===================================================================== --> | ||
147 | <target name="preAssemble"> | ||
148 | </target> | ||
149 | |||
150 | <!-- ===================================================================== --> | ||
151 | <!-- Steps to do after running assemble. --> | ||
152 | <!-- ===================================================================== --> | ||
153 | <target name="postAssemble"> | ||
154 | </target> | ||
155 | |||
156 | <!-- ===================================================================== --> | ||
157 | <!-- Steps to do before running package. --> | ||
158 | <!-- ===================================================================== --> | ||
159 | <target name="prePackage"> | ||
160 | </target> | ||
161 | |||
162 | <!-- ===================================================================== --> | ||
163 | <!-- Steps to do after running package. --> | ||
164 | <!-- ===================================================================== --> | ||
165 | <target name="postPackage"> | ||
166 | </target> | ||
167 | |||
168 | <!-- ===================================================================== --> | ||
169 | <!-- Steps to do after the build is done. --> | ||
170 | <!-- ===================================================================== --> | ||
171 | <target name="postBuild"> | ||
172 | <antcall target="gatherLogs" /> | ||
173 | <antcall target="updateSiteContent" /> | ||
174 | </target> | ||
175 | |||
176 | <target name="updateSiteContent" if="p2.gathering"> | ||
177 | <property file="${buildDirectory}/finalFeaturesVersions.properties" /> | ||
178 | <copy file="${otherSrcDirectory}/features/org.yocto.sdk.site/site.xml" todir="${buildDirectory}" /> | ||
179 | <replace file="${buildDirectory}/site.xml"> | ||
180 | <replacefilter token="@utilsGenVersion@" value="${org.yocto.utils}"/> | ||
181 | </replace> | ||
182 | <zip destfile="${buildDirectory}/${buildLabel}/org.yocto.utils-${buildId}-group.group.group.zip" update="true"> | ||
183 | <zipfileset dir="${buildDirectory}"> | ||
184 | <include name="site.xml"/> | ||
185 | </zipfileset> | ||
186 | <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site"> | ||
187 | <include name="index.html"/> | ||
188 | </zipfileset> | ||
189 | <zipfileset dir="${otherSrcDirectory}/features/org.yocto.sdk.site/web" prefix="web"/> | ||
190 | </zip> | ||
191 | </target> | ||
192 | |||
193 | <!-- ===================================================================== --> | ||
194 | <!-- Steps to do to test the build results --> | ||
195 | <!-- ===================================================================== --> | ||
196 | <target name="test"> | ||
197 | </target> | ||
198 | |||
199 | <!-- ===================================================================== --> | ||
200 | <!-- Steps to do to publish the build results --> | ||
201 | <!-- ===================================================================== --> | ||
202 | <target name="publish"> | ||
203 | </target> | ||
204 | |||
205 | <!-- ===================================================================== --> | ||
206 | <!-- Default target --> | ||
207 | <!-- ===================================================================== --> | ||
208 | <target name="noDefault"> | ||
209 | <echo message="You must specify a target when invoking this file" /> | ||
210 | </target> | ||
211 | |||
212 | </project> | ||
diff --git a/features/org.yocto.utils/build.properties b/features/org.yocto.utils/build.properties new file mode 100644 index 0000000..52c3cfc --- /dev/null +++ b/features/org.yocto.utils/build.properties | |||
@@ -0,0 +1,3 @@ | |||
1 | bin.includes = feature.xml,\ | ||
2 | license.html,\ | ||
3 | feature.properties | ||
diff --git a/features/org.yocto.utils/feature.properties b/features/org.yocto.utils/feature.properties new file mode 100644 index 0000000..41b365b --- /dev/null +++ b/features/org.yocto.utils/feature.properties | |||
@@ -0,0 +1,163 @@ | |||
1 | ############################################################################### | ||
2 | # Copyright (c) 2013 Intel, Inc. and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # Intel - initial implementation | ||
10 | ############################################################################### | ||
11 | |||
12 | # "featureName" property - name of the feature | ||
13 | featureName=Yocto Project Utils Plug-in | ||
14 | |||
15 | # "providerName" property - name of the company that provides the feature | ||
16 | providerName=yoctoproject.org | ||
17 | |||
18 | # "updateSiteName" property - label for the update site | ||
19 | updateSiteName=Yocto Project Update Site | ||
20 | |||
21 | # "description" property - description of the feature | ||
22 | description=\ | ||
23 | Eclipse plug-in for common utils for Yocto Project plug-ins | ||
24 | |||
25 | # copyright | ||
26 | copyright=\ | ||
27 | Copyright (c) 2013 Intel, Inc. and others. \ | ||
28 | All rights reserved. This program and the accompanying materials \ | ||
29 | are made available under the terms of the Eclipse Public License v1.0 \ | ||
30 | which accompanies this distribution, and is available at \ | ||
31 | http://www.eclipse.org/legal/epl-v10.html | ||
32 | ################ end of copyright property #################################### | ||
33 | |||
34 | # "licenseURL" property - URL of the "Feature License" | ||
35 | # do not translate value - just change to point to a locale-specific HTML page | ||
36 | licenseURL=license.html | ||
37 | |||
38 | # "license" property - text of the "Feature Update License" | ||
39 | # should be plain text version of license agreement pointed to be "licenseURL" | ||
40 | license=\ | ||
41 | Eclipse Foundation Software User Agreement\n\ | ||
42 | April 14, 2010\n\ | ||
43 | \n\ | ||
44 | Usage Of Content\n\ | ||
45 | \n\ | ||
46 | THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ | ||
47 | OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ | ||
48 | USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ | ||
49 | AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ | ||
50 | NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ | ||
51 | AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ | ||
52 | AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ | ||
53 | OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ | ||
54 | TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ | ||
55 | OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ | ||
56 | BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ | ||
57 | \n\ | ||
58 | Applicable Licenses\n\ | ||
59 | \n\ | ||
60 | Unless otherwise indicated, all Content made available by the\n\ | ||
61 | Eclipse Foundation is provided to you under the terms and conditions of\n\ | ||
62 | the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ | ||
63 | provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ | ||
64 | For purposes of the EPL, "Program" will mean the Content.\n\ | ||
65 | \n\ | ||
66 | Content includes, but is not limited to, source code, object code,\n\ | ||
67 | documentation and other files maintained in the Eclipse Foundation source code\n\ | ||
68 | repository ("Repository") in software modules ("Modules") and made available\n\ | ||
69 | as downloadable archives ("Downloads").\n\ | ||
70 | \n\ | ||
71 | - Content may be structured and packaged into modules to facilitate delivering,\n\ | ||
72 | extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ | ||
73 | plug-in fragments ("Fragments"), and features ("Features").\n\ | ||
74 | - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ | ||
75 | in a directory named "plugins".\n\ | ||
76 | - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ | ||
77 | Each Feature may be packaged as a sub-directory in a directory named "features".\n\ | ||
78 | Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ | ||
79 | numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ | ||
80 | - Features may also include other Features ("Included Features"). Within a Feature, files\n\ | ||
81 | named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ | ||
82 | \n\ | ||
83 | The terms and conditions governing Plug-ins and Fragments should be\n\ | ||
84 | contained in files named "about.html" ("Abouts"). The terms and\n\ | ||
85 | conditions governing Features and Included Features should be contained\n\ | ||
86 | in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ | ||
87 | Licenses may be located in any directory of a Download or Module\n\ | ||
88 | including, but not limited to the following locations:\n\ | ||
89 | \n\ | ||
90 | - The top-level (root) directory\n\ | ||
91 | - Plug-in and Fragment directories\n\ | ||
92 | - Inside Plug-ins and Fragments packaged as JARs\n\ | ||
93 | - Sub-directories of the directory named "src" of certain Plug-ins\n\ | ||
94 | - Feature directories\n\ | ||
95 | \n\ | ||
96 | Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ | ||
97 | Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ | ||
98 | Update License") during the installation process. If the Feature contains\n\ | ||
99 | Included Features, the Feature Update License should either provide you\n\ | ||
100 | with the terms and conditions governing the Included Features or inform\n\ | ||
101 | you where you can locate them. Feature Update Licenses may be found in\n\ | ||
102 | the "license" property of files named "feature.properties" found within a Feature.\n\ | ||
103 | Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ | ||
104 | terms and conditions (or references to such terms and conditions) that\n\ | ||
105 | govern your use of the associated Content in that directory.\n\ | ||
106 | \n\ | ||
107 | THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ | ||
108 | TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ | ||
109 | SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ | ||
110 | \n\ | ||
111 | - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ | ||
112 | - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ | ||
113 | - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ | ||
114 | - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ | ||
115 | - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ | ||
116 | \n\ | ||
117 | IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ | ||
118 | TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ | ||
119 | is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ | ||
120 | govern that particular Content.\n\ | ||
121 | \n\ | ||
122 | \n\Use of Provisioning Technology\n\ | ||
123 | \n\ | ||
124 | The Eclipse Foundation makes available provisioning software, examples of which include,\n\ | ||
125 | but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ | ||
126 | the purpose of allowing users to install software, documentation, information and/or\n\ | ||
127 | other materials (collectively "Installable Software"). This capability is provided with\n\ | ||
128 | the intent of allowing such users to install, extend and update Eclipse-based products.\n\ | ||
129 | Information about packaging Installable Software is available at\n\ | ||
130 | http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ | ||
131 | \n\ | ||
132 | You may use Provisioning Technology to allow other parties to install Installable Software.\n\ | ||
133 | You shall be responsible for enabling the applicable license agreements relating to the\n\ | ||
134 | Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ | ||
135 | in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ | ||
136 | making it available in accordance with the Specification, you further acknowledge your\n\ | ||
137 | agreement to, and the acquisition of all necessary rights to permit the following:\n\ | ||
138 | \n\ | ||
139 | 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ | ||
140 | the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ | ||
141 | extending or updating the functionality of an Eclipse-based product.\n\ | ||
142 | 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ | ||
143 | Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ | ||
144 | 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ | ||
145 | govern the use of the Installable Software ("Installable Software Agreement") and such\n\ | ||
146 | Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ | ||
147 | with the Specification. Such Installable Software Agreement must inform the user of the\n\ | ||
148 | terms and conditions that govern the Installable Software and must solicit acceptance by\n\ | ||
149 | the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ | ||
150 | indication of agreement by the user, the provisioning Technology will complete installation\n\ | ||
151 | of the Installable Software.\n\ | ||
152 | \n\ | ||
153 | Cryptography\n\ | ||
154 | \n\ | ||
155 | Content may contain encryption software. The country in which you are\n\ | ||
156 | currently may have restrictions on the import, possession, and use,\n\ | ||
157 | and/or re-export to another country, of encryption software. BEFORE\n\ | ||
158 | using any encryption software, please check the country's laws,\n\ | ||
159 | regulations and policies concerning the import, possession, or use, and\n\ | ||
160 | re-export of encryption software, to see if this is permitted.\n\ | ||
161 | \n\ | ||
162 | Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n | ||
163 | ########### end of license property ########################################## | ||
diff --git a/features/org.yocto.utils/feature.xml b/features/org.yocto.utils/feature.xml new file mode 100644 index 0000000..2306a3a --- /dev/null +++ b/features/org.yocto.utils/feature.xml | |||
@@ -0,0 +1,42 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <feature | ||
3 | id="org.yocto.utils" | ||
4 | label="%featureName" | ||
5 | version="1.4.0.qualifier" | ||
6 | provider-name="%providerName"> | ||
7 | |||
8 | <description> | ||
9 | %description | ||
10 | </description> | ||
11 | |||
12 | <copyright> | ||
13 | %copyright | ||
14 | </copyright> | ||
15 | |||
16 | <license url="%licenseURL"> | ||
17 | %license | ||
18 | </license> | ||
19 | |||
20 | <url> | ||
21 | <update label="%updateSiteName" url="http://yoctoproject.org/downloads/eclipse-plugin/"/> | ||
22 | </url> | ||
23 | |||
24 | <requires> | ||
25 | <import plugin="org.eclipse.ui"/> | ||
26 | <import plugin="org.eclipse.core.runtime"/> | ||
27 | <import plugin="org.eclipse.core.resources"/> | ||
28 | <import plugin="org.eclipse.jface.text"/> | ||
29 | <import plugin="org.eclipse.ui.editors"/> | ||
30 | <import plugin="org.eclipse.ui.ide"/> | ||
31 | <import plugin="org.eclipse.ui.console"/> | ||
32 | <import plugin="org.eclipse.core.filesystem"/> | ||
33 | </requires> | ||
34 | |||
35 | <plugin | ||
36 | id="org.yocto.remote.utils" | ||
37 | download-size="0" | ||
38 | install-size="0" | ||
39 | version="0.0.0" | ||
40 | unpack="false"/> | ||
41 | |||
42 | </feature> | ||
diff --git a/features/org.yocto.utils/license.html b/features/org.yocto.utils/license.html new file mode 100644 index 0000000..c184ca3 --- /dev/null +++ b/features/org.yocto.utils/license.html | |||
@@ -0,0 +1,107 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1" ?> | ||
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
3 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
4 | <head> | ||
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> | ||
6 | <title>Eclipse Foundation Software User Agreement</title> | ||
7 | </head> | ||
8 | |||
9 | <body lang="EN-US"> | ||
10 | <h2>Eclipse Foundation Software User Agreement</h2> | ||
11 | <p>April 14, 2010</p> | ||
12 | |||
13 | <h3>Usage Of Content</h3> | ||
14 | |||
15 | <p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS | ||
16 | (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND | ||
17 | CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE | ||
18 | OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR | ||
19 | NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND | ||
20 | CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p> | ||
21 | |||
22 | <h3>Applicable Licenses</h3> | ||
23 | |||
24 | <p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 | ||
25 | ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. | ||
26 | For purposes of the EPL, "Program" will mean the Content.</p> | ||
27 | |||
28 | <p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code | ||
29 | repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p> | ||
30 | |||
31 | <ul> | ||
32 | <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li> | ||
33 | <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li> | ||
34 | <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins | ||
35 | and/or Fragments associated with that Feature.</li> | ||
36 | <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li> | ||
37 | </ul> | ||
38 | |||
39 | <p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and | ||
40 | Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module | ||
41 | including, but not limited to the following locations:</p> | ||
42 | |||
43 | <ul> | ||
44 | <li>The top-level (root) directory</li> | ||
45 | <li>Plug-in and Fragment directories</li> | ||
46 | <li>Inside Plug-ins and Fragments packaged as JARs</li> | ||
47 | <li>Sub-directories of the directory named "src" of certain Plug-ins</li> | ||
48 | <li>Feature directories</li> | ||
49 | </ul> | ||
50 | |||
51 | <p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the | ||
52 | installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or | ||
53 | inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. | ||
54 | Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in | ||
55 | that directory.</p> | ||
56 | |||
57 | <p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE | ||
58 | OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p> | ||
59 | |||
60 | <ul> | ||
61 | <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li> | ||
62 | <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li> | ||
63 | <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li> | ||
64 | <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li> | ||
65 | <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li> | ||
66 | </ul> | ||
67 | |||
68 | <p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please | ||
69 | contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p> | ||
70 | |||
71 | |||
72 | <h3>Use of Provisioning Technology</h3> | ||
73 | |||
74 | <p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse | ||
75 | Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or | ||
76 | other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to | ||
77 | install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a | ||
78 | href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a> | ||
79 | ("Specification").</p> | ||
80 | |||
81 | <p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the | ||
82 | applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology | ||
83 | in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the | ||
84 | Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p> | ||
85 | |||
86 | <ol> | ||
87 | <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology | ||
88 | on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based | ||
89 | product.</li> | ||
90 | <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be | ||
91 | accessed and copied to the Target Machine.</li> | ||
92 | <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable | ||
93 | Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target | ||
94 | Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern | ||
95 | the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such | ||
96 | indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li> | ||
97 | </ol> | ||
98 | |||
99 | <h3>Cryptography</h3> | ||
100 | |||
101 | <p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to | ||
102 | another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, | ||
103 | possession, or use, and re-export of encryption software, to see if this is permitted.</p> | ||
104 | |||
105 | <p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p> | ||
106 | </body> | ||
107 | </html> | ||
diff --git a/plugins/org.yocto.bc.ui/.classpath b/plugins/org.yocto.bc.ui/.classpath new file mode 100644 index 0000000..121e527 --- /dev/null +++ b/plugins/org.yocto.bc.ui/.classpath | |||
@@ -0,0 +1,7 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <classpath> | ||
3 | <classpathentry kind="src" path="src"/> | ||
4 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
5 | <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
6 | <classpathentry kind="output" path="bin"/> | ||
7 | </classpath> | ||
diff --git a/plugins/org.yocto.bc.ui/.project b/plugins/org.yocto.bc.ui/.project new file mode 100644 index 0000000..6113d0b --- /dev/null +++ b/plugins/org.yocto.bc.ui/.project | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.bc.ui</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | <buildCommand> | ||
9 | <name>org.eclipse.jdt.core.javabuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | <buildCommand> | ||
14 | <name>org.eclipse.pde.ManifestBuilder</name> | ||
15 | <arguments> | ||
16 | </arguments> | ||
17 | </buildCommand> | ||
18 | <buildCommand> | ||
19 | <name>org.eclipse.pde.SchemaBuilder</name> | ||
20 | <arguments> | ||
21 | </arguments> | ||
22 | </buildCommand> | ||
23 | </buildSpec> | ||
24 | <natures> | ||
25 | <nature>org.eclipse.pde.PluginNature</nature> | ||
26 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
27 | </natures> | ||
28 | </projectDescription> | ||
diff --git a/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF b/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000..4c53745 --- /dev/null +++ b/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF | |||
@@ -0,0 +1,33 @@ | |||
1 | Manifest-Version: 1.0 | ||
2 | Bundle-ManifestVersion: 2 | ||
3 | Bundle-Name: %Bundle-Name | ||
4 | Bundle-SymbolicName: org.yocto.bc.ui;singleton:=true | ||
5 | Bundle-Version: 1.4.0.qualifier | ||
6 | Bundle-Activator: org.yocto.bc.ui.Activator | ||
7 | Bundle-Vendor: %Bundle-Vendor | ||
8 | Require-Bundle: org.eclipse.ui, | ||
9 | org.eclipse.core.runtime, | ||
10 | org.eclipse.cdt.core;bundle-version="5.2.0", | ||
11 | org.eclipse.core.resources, | ||
12 | org.eclipse.debug.core;bundle-version="3.6.0", | ||
13 | org.eclipse.jface.text, | ||
14 | org.eclipse.ui.editors, | ||
15 | org.eclipse.ui.ide, | ||
16 | org.eclipse.ui.console, | ||
17 | org.eclipse.core.filesystem, | ||
18 | org.yocto.remote.utils;bundle-version="1.0.0", | ||
19 | org.eclipse.ptp.rdt.ui, | ||
20 | org.eclipse.ptp.remote.ui | ||
21 | Eclipse-LazyStart: true | ||
22 | Bundle-ClassPath: . | ||
23 | Import-Package: org.eclipse.ptp.internal.remote.rse.core, | ||
24 | org.eclipse.ptp.rdt.core.serviceproviders, | ||
25 | org.eclipse.ptp.rdt.ui, | ||
26 | org.eclipse.ptp.rdt.ui.wizards, | ||
27 | org.eclipse.ptp.remote.core, | ||
28 | org.eclipse.ptp.remote.core.exception, | ||
29 | org.eclipse.ptp.remote.ui, | ||
30 | org.eclipse.rse.core.model, | ||
31 | org.eclipse.rse.services.clientserver.messages, | ||
32 | org.eclipse.rse.services.files, | ||
33 | org.eclipse.rse.services.shells | ||
diff --git a/plugins/org.yocto.bc.ui/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.bc.ui/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..c6efee2 --- /dev/null +++ b/plugins/org.yocto.bc.ui/OSGI-INF/l10n/bundle.properties | |||
@@ -0,0 +1,6 @@ | |||
1 | #Properties file for org.yocto.bc.ui | ||
2 | command.name = LaunchHOB | ||
3 | command.label.0 = Launch HOB | ||
4 | command.mnemonic = L | ||
5 | Bundle-Vendor = yoctoproject.org | ||
6 | Bundle-Name = Yocto Bitbake Commander \ No newline at end of file | ||
diff --git a/plugins/org.yocto.bc.ui/build.properties b/plugins/org.yocto.bc.ui/build.properties new file mode 100644 index 0000000..dab151d --- /dev/null +++ b/plugins/org.yocto.bc.ui/build.properties | |||
@@ -0,0 +1,7 @@ | |||
1 | source.. = src/ | ||
2 | output.. = bin/ | ||
3 | bin.includes = plugin.xml,\ | ||
4 | META-INF/,\ | ||
5 | .,\ | ||
6 | icons/,\ | ||
7 | OSGI-INF/ | ||
diff --git a/plugins/org.yocto.bc.ui/icons/BUG_logo_128.jpg b/plugins/org.yocto.bc.ui/icons/BUG_logo_128.jpg new file mode 100644 index 0000000..7ea7219 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/BUG_logo_128.jpg | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/BUG_logo_128.png b/plugins/org.yocto.bc.ui/icons/BUG_logo_128.png new file mode 100644 index 0000000..e67ccc6 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/BUG_logo_128.png | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/OE_logo_128.png b/plugins/org.yocto.bc.ui/icons/OE_logo_128.png new file mode 100644 index 0000000..1af3293 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/OE_logo_128.png | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/OE_logo_64.png b/plugins/org.yocto.bc.ui/icons/OE_logo_64.png new file mode 100644 index 0000000..b31d055 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/OE_logo_64.png | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/OE_logo_96.png b/plugins/org.yocto.bc.ui/icons/OE_logo_96.png new file mode 100644 index 0000000..543a5bc --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/OE_logo_96.png | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/OE_logo_full.png b/plugins/org.yocto.bc.ui/icons/OE_logo_full.png new file mode 100644 index 0000000..efefeca --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/OE_logo_full.png | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/beagle_128.png b/plugins/org.yocto.bc.ui/icons/beagle_128.png new file mode 100644 index 0000000..75b6b4a --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/beagle_128.png | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/binary.gif b/plugins/org.yocto.bc.ui/icons/binary.gif new file mode 100644 index 0000000..e3eeb74 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/binary.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/cf_obj.gif b/plugins/org.yocto.bc.ui/icons/cf_obj.gif new file mode 100644 index 0000000..562d6d4 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/cf_obj.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/cheatsheet_obj.gif b/plugins/org.yocto.bc.ui/icons/cheatsheet_obj.gif new file mode 100644 index 0000000..03ff4bc --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/cheatsheet_obj.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/clean.gif b/plugins/org.yocto.bc.ui/icons/clean.gif new file mode 100644 index 0000000..679ffa5 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/clean.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/details_view.gif b/plugins/org.yocto.bc.ui/icons/details_view.gif new file mode 100644 index 0000000..c81630a --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/details_view.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/function.gif b/plugins/org.yocto.bc.ui/icons/function.gif new file mode 100644 index 0000000..f8277cf --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/function.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/icon16_OE.gif b/plugins/org.yocto.bc.ui/icons/icon16_OE.gif new file mode 100644 index 0000000..f0a6cbc --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/icon16_OE.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/import_wiz.gif b/plugins/org.yocto.bc.ui/icons/import_wiz.gif new file mode 100644 index 0000000..d38085a --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/import_wiz.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/importdir_wiz.png b/plugins/org.yocto.bc.ui/icons/importdir_wiz.png new file mode 100644 index 0000000..dce21ed --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/importdir_wiz.png | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/new_cheatsheet_wiz.gif b/plugins/org.yocto.bc.ui/icons/new_cheatsheet_wiz.gif new file mode 100644 index 0000000..d910b2b --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/new_cheatsheet_wiz.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/oe_decorator.gif b/plugins/org.yocto.bc.ui/icons/oe_decorator.gif new file mode 100644 index 0000000..a368de8 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/oe_decorator.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/poky_128.png b/plugins/org.yocto.bc.ui/icons/poky_128.png new file mode 100644 index 0000000..d7cdde6 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/poky_128.png | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/read_only.gif b/plugins/org.yocto.bc.ui/icons/read_only.gif new file mode 100644 index 0000000..dde3cbd --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/read_only.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/refresh.gif b/plugins/org.yocto.bc.ui/icons/refresh.gif new file mode 100644 index 0000000..e383147 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/refresh.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/releng_gears.gif b/plugins/org.yocto.bc.ui/icons/releng_gears.gif new file mode 100644 index 0000000..81fb7b4 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/releng_gears.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/sample.gif b/plugins/org.yocto.bc.ui/icons/sample.gif new file mode 100644 index 0000000..34fb3c9 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/sample.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/sample_decorator.gif b/plugins/org.yocto.bc.ui/icons/sample_decorator.gif new file mode 100644 index 0000000..b51281b --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/sample_decorator.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/topic.gif b/plugins/org.yocto.bc.ui/icons/topic.gif new file mode 100644 index 0000000..b226e41 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/topic.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/trash.gif b/plugins/org.yocto.bc.ui/icons/trash.gif new file mode 100644 index 0000000..bf961b3 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/trash.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/variable.gif b/plugins/org.yocto.bc.ui/icons/variable.gif new file mode 100644 index 0000000..66fd649 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/variable.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/icons/watchlist_view.gif b/plugins/org.yocto.bc.ui/icons/watchlist_view.gif new file mode 100644 index 0000000..c55cb58 --- /dev/null +++ b/plugins/org.yocto.bc.ui/icons/watchlist_view.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.bc.ui/local.conf b/plugins/org.yocto.bc.ui/local.conf new file mode 100644 index 0000000..de47a9e --- /dev/null +++ b/plugins/org.yocto.bc.ui/local.conf | |||
@@ -0,0 +1,125 @@ | |||
1 | # Where to cache the files Poky downloads | ||
2 | DL_DIR ?= "${OEROOT}/sources" | ||
3 | |||
4 | BBPATH += "${OEROOT}/meta-bug/*/*.bb \ | ||
5 | ${OEROOT}/meta-oe/*/*.bb \ | ||
6 | " | ||
7 | |||
8 | # Poky has various extra metadata collections (openmoko, extras). | ||
9 | # To enable these, uncomment all (or some of) the following lines: | ||
10 | BBFILES = "\ | ||
11 | ${OEROOT}/meta/packages/*/*.bb \ | ||
12 | ${OEROOT}/meta-bug/packages/*/*.bb \ | ||
13 | ${OEROOT}/meta-oe/packages/*/*.bb \ | ||
14 | ${OEROOT}/meta-jalimo/packages/*/*.bb \ | ||
15 | ${OEROOT}/meta-extras/packages/*/*.bb \ | ||
16 | " | ||
17 | BBFILE_COLLECTIONS = "normal bug" | ||
18 | BBFILE_PATTERN_normal = "^${OEROOT}/meta/" | ||
19 | BBFILE_PATTERN_bug = "^${OEROOT}/meta-bug/" | ||
20 | BBFILE_PRIORITY_normal = "5" | ||
21 | BBFILE_PRIORITY_bug = "5" | ||
22 | |||
23 | |||
24 | BBMASK = "" | ||
25 | |||
26 | # The machine to target | ||
27 | MACHINE ?= "bug" | ||
28 | # Other supported machines | ||
29 | #MACHINE ?= "qemux86" | ||
30 | |||
31 | DISTRO ?= "poky" | ||
32 | # For bleeding edge / experimental / unstable package versions | ||
33 | # DISTRO ?= "poky-bleeding" | ||
34 | |||
35 | # EXTRA_IMAGE_FEATURES allows extra packages to be added to the generated images | ||
36 | # (Some of these are automatically added to certain image types) | ||
37 | # "dbg-pkgs" - add -dbg packages for all installed packages | ||
38 | # (adds symbol information for debugging/profiling) | ||
39 | # "dev-pkgs" - add -dev packages for all installed packages | ||
40 | # (useful if you want to develop against libs in the image) | ||
41 | # "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) | ||
42 | # "tools-debug" - add debugging tools (gdb, strace) | ||
43 | # "tools-profile" - add profiling tools (oprofile, exmap, lttng valgrind (x86 only)) | ||
44 | # "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) | ||
45 | # "debug-tweaks" - make an image for suitable of development | ||
46 | # e.g. ssh root access has a blank password | ||
47 | # There are other application targets too, see meta/classes/poky-image.bbclass | ||
48 | # and meta/packages/tasks/task-poky.bb for more details. | ||
49 | |||
50 | EXTRA_IMAGE_FEATURES = "tools-debug tools-profile tools-testapps debug-tweaks" | ||
51 | |||
52 | EXTRA_IMAGE_FEATURES_mx31ads = "tools-testapps debug-tweaks" | ||
53 | |||
54 | # A list of packaging systems used in generated images | ||
55 | # The first package type listed will be used for rootfs generation | ||
56 | # include 'package_deb' for debs | ||
57 | # include 'package_ipk' for ipks | ||
58 | #PACKAGE_CLASSES ?= "package_deb package_ipk" | ||
59 | PACKAGE_CLASSES ?= "package_ipk" | ||
60 | |||
61 | # POKYMODE controls the characteristics of the generated packages/images by | ||
62 | # telling poky which type of toolchain to use. | ||
63 | # | ||
64 | # Options include several different EABI combinations and a compatibility | ||
65 | # mode for the OABI mode poky previously used. | ||
66 | # | ||
67 | # The default is "eabi" | ||
68 | # Use "oabi" for machines with kernels < 2.6.18 on ARM for example. | ||
69 | # Use "external-MODE" to use the precompiled external toolchains where MODE | ||
70 | # is the type of external toolchain to use e.g. eabi. | ||
71 | # POKYMODE = "external-eabi" | ||
72 | |||
73 | # Uncomment this to specify where BitBake should create its temporary files. | ||
74 | # Note that a full build of everything in OpenEmbedded will take GigaBytes of hard | ||
75 | # disk space, so make sure to free enough space. The default TMPDIR is | ||
76 | # <build directory>/tmp | ||
77 | TMPDIR = "${OEROOT}/build/tmp" | ||
78 | |||
79 | # Uncomment and set to allow bitbake to execute multiple tasks at once. | ||
80 | # Note, This option is currently experimental - YMMV. | ||
81 | # BB_NUMBER_THREADS = "1" | ||
82 | # Also, make can be passed flags so it run parallel threads e.g.: | ||
83 | PARALLEL_MAKE = "-j 2" | ||
84 | |||
85 | # Uncomment this if you are using the Openedhand provided qemu deb - see README | ||
86 | # ASSUME_PROVIDED += "qemu-native" | ||
87 | |||
88 | IMAGE_LINGUAS = "en-us" | ||
89 | LIMIT_BUILT_LOCALES = "en_US" | ||
90 | ENABLE_BINARY_LOCALE_GENERATION = "0" | ||
91 | |||
92 | # Comment this out if you don't have a 3.x gcc version available and wish | ||
93 | # poky to build one for you. The 3.x gcc is required to build qemu-native. | ||
94 | # ASSUME_PROVIDED += "gcc3-native" | ||
95 | |||
96 | # Uncomment these two if you want BitBake to build images useful for debugging. | ||
97 | # DEBUG_BUILD = "1" | ||
98 | # INHIBIT_PACKAGE_STRIP = "1" | ||
99 | |||
100 | # Uncomment these to build a package such that you can use gprof to profile it. | ||
101 | # NOTE: This will only work with 'linux' targets, not | ||
102 | # 'linux-uclibc', as uClibc doesn't provide the necessary | ||
103 | # object files. Also, don't build glibc itself with these | ||
104 | # flags, or it'll fail to build. | ||
105 | # | ||
106 | # PROFILE_OPTIMIZATION = "-pg" | ||
107 | # SELECTED_OPTIMIZATION = "${PROFILE_OPTIMIZATION}" | ||
108 | # LDFLAGS =+ "-pg" | ||
109 | |||
110 | # Uncomment this if you want BitBake to emit debugging output | ||
111 | # BBDEBUG = "yes" | ||
112 | # Uncomment this if you want BitBake to emit the log if a build fails. | ||
113 | BBINCLUDELOGS = "yes" | ||
114 | |||
115 | # Specifies a location to search for pre-generated tarballs when fetching | ||
116 | # a cvs:// URI. Uncomment this, if you not want to pull directly from CVS. | ||
117 | # CVS_TARBALL_STASH = "http://folks.o-hand.com/~richard/poky/sources/" | ||
118 | |||
119 | # Set this if you wish to make pkgconfig libraries from your system available | ||
120 | # for native builds. Combined with extra ASSUME_PROVIDEDs this can allow | ||
121 | # native builds of applications like oprofileui-native (unsupported feature). | ||
122 | #EXTRA_NATIVE_PKGCONFIG_PATH = ":/usr/lib/pkgconfig" | ||
123 | #ASSUME_PROVIDED += "gtk+-native libglade-native" | ||
124 | |||
125 | # ENABLE_BINARY_LOCALE_GENERATION = "1" | ||
diff --git a/plugins/org.yocto.bc.ui/plugin.xml b/plugins/org.yocto.bc.ui/plugin.xml new file mode 100644 index 0000000..2e1421f --- /dev/null +++ b/plugins/org.yocto.bc.ui/plugin.xml | |||
@@ -0,0 +1,289 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <?eclipse version="3.2"?> | ||
3 | <plugin> | ||
4 | <extension | ||
5 | point="org.eclipse.ui.newWizards"> | ||
6 | <category | ||
7 | name="Yocto Project BitBake Commander" | ||
8 | id="org.yocto.bc.ui"> | ||
9 | </category> | ||
10 | <wizard | ||
11 | category="org.yocto.bc.ui" | ||
12 | class="org.yocto.bc.ui.wizards.install.InstallWizard" | ||
13 | icon="icons/icon16_OE.gif" | ||
14 | id="org.yocto.bc.ui.wizards.install.InstallWizard" | ||
15 | name="New Yocto Project" | ||
16 | project="true"/> | ||
17 | </extension> | ||
18 | <extension | ||
19 | id="org.yocto.bc.ui.builder.BitbakeCommanderNature" | ||
20 | name="Yocto Bitbake Commander Project Nature" | ||
21 | point="org.eclipse.core.resources.natures"> | ||
22 | <runtime> | ||
23 | <run | ||
24 | class="org.yocto.bc.ui.builder.BitbakeCommanderNature"> | ||
25 | </run> | ||
26 | </runtime> | ||
27 | </extension> | ||
28 | <extension | ||
29 | point="org.eclipse.ui.commands"> | ||
30 | <command | ||
31 | id="org.yocto.bc.ui.command.launchHob" | ||
32 | name="%command.name"> | ||
33 | </command> | ||
34 | </extension> | ||
35 | <extension | ||
36 | point="org.eclipse.ui.handlers"> | ||
37 | <handler | ||
38 | class="org.yocto.bc.ui.actions.LaunchHobHandler" | ||
39 | commandId="org.yocto.bc.ui.command.launchHob"> | ||
40 | </handler> | ||
41 | </extension> | ||
42 | <extension | ||
43 | point="org.eclipse.ui.menus"> | ||
44 | <menuContribution | ||
45 | locationURI="menu:project"> | ||
46 | <command | ||
47 | commandId="org.yocto.bc.ui.command.launchHob" | ||
48 | id="hob" | ||
49 | label="%command.label.0" | ||
50 | mnemonic="%command.mnemonic" | ||
51 | style="push"> | ||
52 | <visibleWhen | ||
53 | checkEnabled="false"> | ||
54 | <and> | ||
55 | <count | ||
56 | value="1"> | ||
57 | </count> | ||
58 | <iterate> | ||
59 | <adapt | ||
60 | type="org.eclipse.core.resources.IResource"> | ||
61 | <test | ||
62 | property="org.eclipse.core.resources.projectNature" | ||
63 | value="org.yocto.bc.ui.builder.BitbakeCommanderNature"> | ||
64 | </test> | ||
65 | </adapt> | ||
66 | </iterate> | ||
67 | </and> | ||
68 | </visibleWhen> | ||
69 | </command> | ||
70 | </menuContribution> | ||
71 | </extension> | ||
72 | <extension | ||
73 | id="xmlProblem" | ||
74 | name="XML Problem" | ||
75 | point="org.eclipse.core.resources.markers"> | ||
76 | <super | ||
77 | type="org.eclipse.core.resources.problemmarker"> | ||
78 | </super> | ||
79 | <persistent | ||
80 | value="true"> | ||
81 | </persistent> | ||
82 | </extension> | ||
83 | <extension | ||
84 | point="org.eclipse.ui.editors"> | ||
85 | <editor | ||
86 | class="org.yocto.bc.ui.editors.bitbake.BitBakeFileEditor" | ||
87 | contributorClass="org.yocto.bc.ui.editors.bitbake.RecipeEditorActionContributor" | ||
88 | default="true" | ||
89 | extensions="bb,inc,bbclass,conf" | ||
90 | icon="icons/topic.gif" | ||
91 | id="org.yocto.bc.ui.editors.BitBakeFileEditor" | ||
92 | name="Yocto Project BitBake Recipe Editor"> | ||
93 | </editor> | ||
94 | </extension> | ||
95 | <extension | ||
96 | point="org.eclipse.ui.newWizards"> | ||
97 | <category | ||
98 | name="Yocto Project BitBake Commander" | ||
99 | id="org.yocto.bc.ui"> | ||
100 | </category> | ||
101 | <wizard | ||
102 | name="BitBake Recipe" | ||
103 | icon="icons/new_cheatsheet_wiz.gif" | ||
104 | category="org.yocto.bc.ui" | ||
105 | class="org.yocto.bc.ui.wizards.NewBitBakeFileRecipeWizard" | ||
106 | id="org.yocto.bc.ui.wizards.NewRecipeWizard"> | ||
107 | </wizard> | ||
108 | </extension> | ||
109 | <extension | ||
110 | point="org.eclipse.ui.perspectives"> | ||
111 | <perspective | ||
112 | class="org.yocto.bc.ui.perspectives.BitbakeCommanderPerspective" | ||
113 | icon="icons/icon16_OE.gif" | ||
114 | id="org.yocto.bc.ui.perspectives.BitbakeCommanderPerspective" | ||
115 | name="BitBake Commander"> | ||
116 | </perspective> | ||
117 | </extension> | ||
118 | <extension | ||
119 | point="org.eclipse.ui.ide.filesystemSupport"> | ||
120 | <filesystemContributor | ||
121 | class="org.yocto.bc.ui.filesystem.OEFileSystemContributor" | ||
122 | label="OpenEmbeddedFS" | ||
123 | scheme="OEFS"> | ||
124 | </filesystemContributor> | ||
125 | </extension> | ||
126 | <extension | ||
127 | point="org.eclipse.core.filesystem.filesystems"> | ||
128 | <filesystem | ||
129 | scheme="OEFS"> | ||
130 | <run | ||
131 | class="org.yocto.bc.ui.filesystem.OEFileSystem"> | ||
132 | </run> | ||
133 | </filesystem> | ||
134 | </extension> | ||
135 | <!-- | ||
136 | <extension | ||
137 | point="org.eclipse.ui.views"> | ||
138 | <category | ||
139 | id="org.yocto.bc.ui" | ||
140 | name="Yocto Bitbake Commander"> | ||
141 | </category> | ||
142 | <view | ||
143 | category="org.yocto.bc.ui" | ||
144 | class="org.yocto.bc.ui.views.RecipeView" | ||
145 | icon="icons/cheatsheet_obj.gif" | ||
146 | id="org.yocto.bc.ui.views.RecipeView" | ||
147 | name="Recipes"> | ||
148 | </view> | ||
149 | </extension> | ||
150 | --> | ||
151 | <extension | ||
152 | point="org.eclipse.ui.actionSets"> | ||
153 | <actionSet | ||
154 | id="org.yocto.bc.ui.actionSet" | ||
155 | label="BitBake UI Action Set" | ||
156 | visible="true"> | ||
157 | <action | ||
158 | class="org.yocto.bc.ui.actions.LaunchNewRecipeWizardAction" | ||
159 | icon="icons/new_cheatsheet_wiz.gif" | ||
160 | id="org.yocto.bc.ui.actions.NewRecipeAction" | ||
161 | label="&New Recipe" | ||
162 | toolbarPath="bbuiGroup" | ||
163 | tooltip="New BitBake Recipe"> | ||
164 | </action> | ||
165 | <action | ||
166 | class="org.yocto.bc.ui.actions.LaunchVariableWizardAction" | ||
167 | icon="icons/watchlist_view.gif" | ||
168 | id="org.yocto.bc.ui.actions.LaunchVariableWizardAction" | ||
169 | label="&BitBake Variable Wizard" | ||
170 | toolbarPath="bbuiGroup2" | ||
171 | tooltip="BitBake Variables"> | ||
172 | </action> | ||
173 | <action | ||
174 | class="org.yocto.bc.ui.actions.LaunchNewBitBakeProjectWizardAction" | ||
175 | icon="icons/cf_obj.gif" | ||
176 | id="org.yocto.bc.ui.wizards.project.NewProjectWizard" | ||
177 | label="New Project" | ||
178 | toolbarPath="bbuiGroup" | ||
179 | tooltip="New BitBake Commander Project"> | ||
180 | </action> | ||
181 | </actionSet> | ||
182 | <!-- | ||
183 | <actionSet | ||
184 | id="org.yocto.bc.ui.actionSet1" | ||
185 | label="Command Action Set" | ||
186 | visible="true"> | ||
187 | <action | ||
188 | class="org.yocto.bc.ui.actions.BitbakeBuildRecipeAction" | ||
189 | enablesFor="+" | ||
190 | icon="icons/binary.gif" | ||
191 | id="org.yocto.bc.ui.BuildPackage" | ||
192 | label="Build Package" | ||
193 | toolbarPath="bbcGroup" | ||
194 | tooltip="Build Package"> | ||
195 | </action> | ||
196 | <action | ||
197 | class="org.yocto.bc.ui.actions.BitbakeCleanRecipeAction" | ||
198 | enablesFor="+" | ||
199 | icon="icons/trash.gif" | ||
200 | id="org.yocto.bc.ui.CleanPackage" | ||
201 | label="Clean Package" | ||
202 | toolbarPath="bbcGroup" | ||
203 | tooltip="Clean Package"> | ||
204 | </action> | ||
205 | <action | ||
206 | class="org.yocto.bc.ui.actions.BitbakeImportAction" | ||
207 | enablesFor="+" | ||
208 | icon="icons/import_wiz.gif" | ||
209 | id="org.yocto.bc.ui.ImportPackage" | ||
210 | label="Import Package" | ||
211 | toolbarPath="bbcGroup" | ||
212 | tooltip="Imports the Package as a Workspace Project"> | ||
213 | </action> | ||
214 | <action | ||
215 | class="org.yocto.bc.ui.actions.BitbakeRebuildRecipeAction" | ||
216 | enablesFor="+" | ||
217 | icon="icons/refresh.gif" | ||
218 | id="org.yocto.bc.ui.RebuildPackage" | ||
219 | label="Rebuild Package" | ||
220 | toolbarPath="bbcGroup" | ||
221 | tooltip="Rebuild Package"> | ||
222 | </action> | ||
223 | </actionSet> | ||
224 | --> | ||
225 | </extension> | ||
226 | <!-- | ||
227 | <extension | ||
228 | point="org.eclipse.ui.importWizards"> | ||
229 | <category | ||
230 | id="org.yocto.bc.ui.importWizards.sampleCategory" | ||
231 | name="Yocto BitBake Commander"> | ||
232 | </category> | ||
233 | <wizard | ||
234 | category="org.yocto.bc.ui.importWizards.sampleCategory" | ||
235 | class="org.yocto.bc.ui.wizards.importProject.ImportYoctoProjectWizard" | ||
236 | icon="icons/icon16_OE.gif" | ||
237 | id="org.yocto.bc.ui.importWizards.ImportWizard" | ||
238 | name="Import Yocto Project"> | ||
239 | <description> | ||
240 | Import an existing install of Yocto Project into your workspace. | ||
241 | </description> | ||
242 | </wizard> | ||
243 | </extension> | ||
244 | --> | ||
245 | <extension | ||
246 | point="org.eclipse.ui.decorators"> | ||
247 | <decorator | ||
248 | adaptable="true" | ||
249 | class="org.yocto.bc.ui.decorators.ReadOnly" | ||
250 | id="org.yocto.bc.ui.decorators.ReadOnly" | ||
251 | label="Read-only Decorator" | ||
252 | lightweight="true" | ||
253 | state="true"> | ||
254 | <enablement> | ||
255 | <and> | ||
256 | <objectClass | ||
257 | name="org.eclipse.core.resources.IResource"> | ||
258 | </objectClass> | ||
259 | <or> | ||
260 | <objectClass | ||
261 | name="org.eclipse.core.resources.IFolder"> | ||
262 | </objectClass> | ||
263 | <objectClass | ||
264 | name="org.eclipse.core.resources.IFile"> | ||
265 | </objectClass> | ||
266 | </or> | ||
267 | </and> | ||
268 | </enablement> | ||
269 | </decorator> | ||
270 | <decorator | ||
271 | adaptable="true" | ||
272 | icon="icons/oe_decorator.gif" | ||
273 | id="org.yocto.bc.ui.decorator.project" | ||
274 | label="BBC Project Decorator" | ||
275 | lightweight="true" | ||
276 | location="TOP_RIGHT" | ||
277 | class="org.yocto.bc.ui.decorators.ProjectDecorator" | ||
278 | state="true"> | ||
279 | <enablement> | ||
280 | <or> | ||
281 | <objectClass | ||
282 | name="org.eclipse.core.resources.IProject"> | ||
283 | </objectClass> | ||
284 | </or> | ||
285 | </enablement> | ||
286 | </decorator> | ||
287 | </extension> | ||
288 | |||
289 | </plugin> | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBCommonVars.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBCommonVars.java new file mode 100644 index 0000000..d905e50 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBCommonVars.java | |||
@@ -0,0 +1,24 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.bitbake; | ||
12 | |||
13 | /** | ||
14 | * Constants for commonly used bitbake variables. | ||
15 | * @author kgilmer | ||
16 | * | ||
17 | */ | ||
18 | public class BBCommonVars { | ||
19 | public final static String WORKDIR = "WORKDIR"; | ||
20 | public static final String PN = "PN"; | ||
21 | public static final String S = "S"; | ||
22 | public static final String PV = "PV"; | ||
23 | |||
24 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBLanguageHelper.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBLanguageHelper.java new file mode 100644 index 0000000..8ebe134 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBLanguageHelper.java | |||
@@ -0,0 +1,62 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Lianhao Lu (Intel) - add more bitbake keywords and functions | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.bitbake; | ||
13 | |||
14 | import java.util.Comparator; | ||
15 | import java.util.Map; | ||
16 | import java.util.TreeMap; | ||
17 | |||
18 | /** | ||
19 | * Here is where all BitBake-related information is centralized. | ||
20 | * @author kgilmer | ||
21 | * | ||
22 | */ | ||
23 | public class BBLanguageHelper { | ||
24 | |||
25 | public static final String[] BITBAKE_KEYWORDS = new String[] { "inherit", "require", "export", "addtask", "python", "include", "fakeroot", "addhandler", "def"}; | ||
26 | public static final String[] SHELL_KEYWORDS = new String[] { "while", "do", "if", "fi", "ln", "export", "install", "oe_libinstall", "for", "in", "done", "echo", "then", "cat", "rm", "rmdir", "mkdir", "printf", "exit", "test", "cd", "cp"}; | ||
27 | public static final String[] BITBAKE_STANDARD_FUNCTIONS = new String[] { "fetch", "unpack", "patch", "configure", "compile", "install", "populate_sysroot", "package"}; | ||
28 | public static final String BITBAKE_RECIPE_FILE_EXTENSION = "bb"; | ||
29 | |||
30 | /** | ||
31 | * @return A map of names and descriptions of commonly used BitBake variables. | ||
32 | */ | ||
33 | public static Map<String, String> getCommonBitbakeVariables() { | ||
34 | Map<String, String> m = new TreeMap<String, String>(new Comparator<Object>() { | ||
35 | |||
36 | public int compare(Object o1, Object o2) { | ||
37 | |||
38 | return ((String) o1).compareTo(((String) o2)); | ||
39 | } | ||
40 | |||
41 | }); | ||
42 | |||
43 | m.put("SECTION", "Category of package"); | ||
44 | m.put("PR", "Package Release Number"); | ||
45 | m.put("SRC_URI", "Location of package sources"); | ||
46 | m.put("DESCRIPTION", "Description of package"); | ||
47 | m.put("EXTRA_OEMAKE", "Extra flags to pass to the package makefile"); | ||
48 | m.put("EXTRA_OECONF", "Extra configuration flags for the package makefile"); | ||
49 | m.put("DEPENDS", "The set of build-time dependent packages"); | ||
50 | m.put("RDEPENDS", "The set of run-time dependent packages"); | ||
51 | m.put("HOMEPAGE", "Homepage of the package"); | ||
52 | m.put("LICENSE", "License of the package"); | ||
53 | m.put("FILES_${PN}", "Full file path of files on target."); | ||
54 | m.put("S", "Package source directory"); | ||
55 | m.put("PV", "Package version"); | ||
56 | m.put("AUTHOR", "Author or maintainer of package"); | ||
57 | m.put("PRIORITY", "Priority of package"); | ||
58 | |||
59 | return m; | ||
60 | } | ||
61 | |||
62 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBRecipe.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBRecipe.java new file mode 100644 index 0000000..9092759 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBRecipe.java | |||
@@ -0,0 +1,45 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer, 2013 Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.bitbake; | ||
13 | |||
14 | import java.io.IOException; | ||
15 | import java.net.URI; | ||
16 | |||
17 | /** | ||
18 | * Represents the bitbake environment of a recipe package. | ||
19 | * @author kgilmer | ||
20 | * | ||
21 | */ | ||
22 | public class BBRecipe extends BBSession { | ||
23 | private final BBSession session; | ||
24 | private final URI fileURI; | ||
25 | |||
26 | public BBRecipe(BBSession session, URI filePath) throws IOException { | ||
27 | super(session.shell, session.pinfo.getOriginalURI()); | ||
28 | this.session = session; | ||
29 | this.fileURI = filePath; | ||
30 | this.parsingCmd = "DISABLE_SANITY_CHECKS=\"1\" bitbake -e -b " + filePath.getPath() + " >& " + BB_ENV_FILE; | ||
31 | } | ||
32 | |||
33 | @Override | ||
34 | public void initialize() throws Exception { | ||
35 | if (this.size() == 0) { | ||
36 | //System.out.println("Failed to parse " + fileURI); | ||
37 | //throw new IOException("Failed to parse " + filePath); | ||
38 | } | ||
39 | } | ||
40 | |||
41 | @Override | ||
42 | protected URI getDefaultDepends() { | ||
43 | return this.fileURI; | ||
44 | } | ||
45 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java new file mode 100644 index 0000000..4434df8 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java | |||
@@ -0,0 +1,785 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer, 2013 Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.bitbake; | ||
13 | |||
14 | import java.io.BufferedReader; | ||
15 | import java.io.File; | ||
16 | import java.io.FileFilter; | ||
17 | import java.io.IOException; | ||
18 | import java.io.StringReader; | ||
19 | import java.io.InputStream; | ||
20 | import java.io.InputStreamReader; | ||
21 | import java.net.URI; | ||
22 | import java.util.ArrayList; | ||
23 | import java.util.Arrays; | ||
24 | import java.util.Collection; | ||
25 | import java.util.Hashtable; | ||
26 | import java.util.Iterator; | ||
27 | import java.util.List; | ||
28 | import java.util.Map; | ||
29 | import java.util.Set; | ||
30 | import java.util.Stack; | ||
31 | import java.util.concurrent.locks.ReentrantReadWriteLock; | ||
32 | import java.util.concurrent.locks.Lock; | ||
33 | |||
34 | import org.eclipse.core.resources.IFile; | ||
35 | import org.eclipse.core.resources.IProject; | ||
36 | import org.eclipse.core.resources.IResource; | ||
37 | import org.eclipse.core.runtime.IProgressMonitor; | ||
38 | import org.eclipse.core.runtime.IStatus; | ||
39 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
40 | import org.eclipse.core.runtime.Status; | ||
41 | import org.eclipse.jface.preference.JFacePreferences; | ||
42 | import org.eclipse.jface.resource.JFaceResources; | ||
43 | import org.eclipse.rse.core.model.IHost; | ||
44 | import org.eclipse.ui.console.ConsolePlugin; | ||
45 | import org.eclipse.ui.console.IConsole; | ||
46 | import org.eclipse.ui.console.IConsoleManager; | ||
47 | import org.eclipse.ui.console.MessageConsole; | ||
48 | import org.eclipse.ui.console.MessageConsoleStream; | ||
49 | import org.eclipse.ui.progress.WorkbenchJob; | ||
50 | |||
51 | import org.yocto.bc.ui.model.IModelElement; | ||
52 | import org.yocto.bc.ui.model.ProjectInfo; | ||
53 | import org.yocto.remote.utils.RemoteHelper; | ||
54 | import org.yocto.remote.utils.YoctoCommand; | ||
55 | |||
56 | /** | ||
57 | * BBSession encapsulates a global bitbake configuration and is the primary interface | ||
58 | * for actions against a BitBake installation. | ||
59 | * | ||
60 | * @author kgilmer | ||
61 | * | ||
62 | */ | ||
63 | public class BBSession implements IBBSessionListener, IModelElement, Map { | ||
64 | public static final int TYPE_VARIABLE_ASSIGNMENT = 1; | ||
65 | public static final int TYPE_UNKNOWN = 2; | ||
66 | public static final int TYPE_STATEMENT = 3; | ||
67 | public static final int TYPE_FLAG = 4; | ||
68 | |||
69 | public static final String BB_ENV_FILE = "bitbake.env"; | ||
70 | |||
71 | public static final String CONF_DIR = "conf"; | ||
72 | public static final String BUILDDIR_INDICATORS [] = { | ||
73 | "local.conf", | ||
74 | "bblayers.conf", | ||
75 | }; | ||
76 | |||
77 | protected final ProjectInfo pinfo; | ||
78 | protected final ShellSession shell; | ||
79 | protected Map<?,?> properties = null; | ||
80 | protected List <URI> depends = null; | ||
81 | protected boolean initialized = false; | ||
82 | protected boolean errorOccured = false; | ||
83 | protected MessageConsole sessionConsole; | ||
84 | private final ReentrantReadWriteLock rwlock = new ReentrantReadWriteLock(); | ||
85 | private final Lock rlock = rwlock.readLock(); | ||
86 | private final Lock wlock = rwlock.writeLock(); | ||
87 | protected String parsingCmd; | ||
88 | private boolean silent = false; | ||
89 | private String errorLines = ""; | ||
90 | |||
91 | public BBSession(ShellSession ssession, URI projectRoot) throws IOException { | ||
92 | shell = ssession; | ||
93 | this.pinfo = new ProjectInfo(); | ||
94 | pinfo.setLocationURI(projectRoot); | ||
95 | pinfo.setInitScriptPath(ProjectInfoHelper.getInitScriptPath(projectRoot)); | ||
96 | this.parsingCmd = "DISABLE_SANITY_CHECKS=\"1\" bitbake -e >& " + BB_ENV_FILE; | ||
97 | } | ||
98 | |||
99 | public BBSession(ShellSession ssession, URI projectRoot, boolean silent) throws IOException { | ||
100 | this(ssession, projectRoot); | ||
101 | this.silent = silent; | ||
102 | } | ||
103 | |||
104 | private Collection adapttoIPath(List<File> asList, IProject project) { | ||
105 | |||
106 | List pathList = new ArrayList(); | ||
107 | |||
108 | for (Iterator i = asList.iterator(); i.hasNext();) { | ||
109 | File f = (File) i.next(); | ||
110 | IFile ff = project.getFile(stripLeading(f.toString(), project.getLocationURI().getPath())); | ||
111 | if (ff.exists()) { | ||
112 | pathList.add(ff); | ||
113 | } | ||
114 | } | ||
115 | |||
116 | return pathList; | ||
117 | } | ||
118 | |||
119 | private String appendAll(String[] elems, int st) { | ||
120 | StringBuffer sb = new StringBuffer(); | ||
121 | |||
122 | for (int i = st; i < elems.length; ++i) { | ||
123 | sb.append(elems[i]); | ||
124 | } | ||
125 | |||
126 | return sb.toString(); | ||
127 | } | ||
128 | |||
129 | private int charCount(String trimmed, char c) { | ||
130 | int i = 0; | ||
131 | int p = 0; | ||
132 | |||
133 | while ((p = trimmed.indexOf(c, p)) > -1) { | ||
134 | i++; | ||
135 | p++; | ||
136 | } | ||
137 | |||
138 | return i; | ||
139 | } | ||
140 | |||
141 | public void clear() { | ||
142 | throw new RuntimeException("BB configuration is read-only."); | ||
143 | } | ||
144 | |||
145 | public boolean containsKey(Object arg0) { | ||
146 | try { | ||
147 | checkValidAndLock(true); | ||
148 | return properties.containsKey(arg0); | ||
149 | } catch (Exception e) { | ||
150 | e.printStackTrace(); | ||
151 | return false; | ||
152 | }finally { | ||
153 | rlock.unlock(); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | public boolean containsValue(Object arg0) { | ||
158 | try { | ||
159 | checkValidAndLock(true); | ||
160 | return properties.containsValue(arg0); | ||
161 | } catch (Exception e) { | ||
162 | e.printStackTrace(); | ||
163 | return false; | ||
164 | }finally { | ||
165 | rlock.unlock(); | ||
166 | } | ||
167 | } | ||
168 | |||
169 | public Set entrySet() { | ||
170 | try { | ||
171 | checkValidAndLock(true); | ||
172 | return properties.entrySet(); | ||
173 | } catch (Exception e) { | ||
174 | e.printStackTrace(); | ||
175 | return null; | ||
176 | }finally { | ||
177 | rlock.unlock(); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | @Override | ||
182 | public boolean equals(Object arg0) { | ||
183 | try { | ||
184 | checkValidAndLock(true); | ||
185 | return properties.equals(arg0); | ||
186 | } catch (Exception e) { | ||
187 | e.printStackTrace(); | ||
188 | return false; | ||
189 | }finally { | ||
190 | rlock.unlock(); | ||
191 | } | ||
192 | } | ||
193 | |||
194 | public ShellSession getShell() { | ||
195 | return shell; | ||
196 | } | ||
197 | |||
198 | public URI getProjInfoRoot() { | ||
199 | return pinfo.getOriginalURI(); | ||
200 | } | ||
201 | |||
202 | /** | ||
203 | * Recursively generate list of Recipe files from a root directory. | ||
204 | * | ||
205 | * @param rootDir | ||
206 | * @param recipes | ||
207 | * @param fileExtension | ||
208 | * @param project | ||
209 | */ | ||
210 | private void findRecipes(File rootDir, List recipes, final String fileExtension, IProject project) { | ||
211 | File[] children = rootDir.listFiles(new FileFilter() { | ||
212 | |||
213 | public boolean accept(File pathname) { | ||
214 | return pathname.isFile() && pathname.getName().endsWith(fileExtension); | ||
215 | } | ||
216 | |||
217 | }); | ||
218 | |||
219 | if (children != null && children.length > 0) { | ||
220 | recipes.addAll(adapttoIPath(Arrays.asList(children), project)); | ||
221 | } | ||
222 | |||
223 | File[] childDirs = rootDir.listFiles(new FileFilter() { | ||
224 | |||
225 | public boolean accept(File pathname) { | ||
226 | return pathname.isDirectory(); | ||
227 | } | ||
228 | |||
229 | }); | ||
230 | |||
231 | if (childDirs != null && childDirs.length > 0) { | ||
232 | for (int i = 0; i < childDirs.length; ++i) { | ||
233 | findRecipes(childDirs[i], recipes, fileExtension, project); | ||
234 | } | ||
235 | } | ||
236 | } | ||
237 | |||
238 | private Collection findRecipes(List paths, IProject project) { | ||
239 | List recipes = new ArrayList(); | ||
240 | |||
241 | for (Iterator i = paths.iterator(); i.hasNext();) { | ||
242 | String rawPath = (String) i.next(); | ||
243 | String[] elems = rawPath.split("\\*/\\*"); | ||
244 | |||
245 | if (elems.length == 2) { | ||
246 | |||
247 | File rootDir = new File(elems[0]); | ||
248 | |||
249 | findRecipes(rootDir, recipes, elems[1], project); | ||
250 | } | ||
251 | } | ||
252 | |||
253 | return recipes; | ||
254 | } | ||
255 | |||
256 | public Object get(Object arg0) { | ||
257 | try { | ||
258 | checkValidAndLock(true); | ||
259 | return properties.get(arg0); | ||
260 | } catch (Exception e) { | ||
261 | e.printStackTrace(); | ||
262 | return null; | ||
263 | }finally { | ||
264 | rlock.unlock(); | ||
265 | } | ||
266 | } | ||
267 | |||
268 | private List getBitBakeKeywords() { | ||
269 | return Arrays.asList(BBLanguageHelper.BITBAKE_KEYWORDS); | ||
270 | } | ||
271 | |||
272 | /** | ||
273 | * @return A MessageConsole for this BB session. | ||
274 | */ | ||
275 | public MessageConsole getConsole() { | ||
276 | if (sessionConsole == null) { | ||
277 | String cName = ProjectInfoHelper.getProjectName(pinfo.getOriginalURI()) + " Console"; | ||
278 | IConsoleManager conMan = ConsolePlugin.getDefault().getConsoleManager(); | ||
279 | IConsole[] existing = conMan.getConsoles(); | ||
280 | for (int i = 0; i < existing.length; i++) | ||
281 | if (cName.equals(existing[i].getName())) { | ||
282 | sessionConsole = (MessageConsole) existing[i]; | ||
283 | break; | ||
284 | } | ||
285 | if (sessionConsole == null) { | ||
286 | sessionConsole = new MessageConsole(cName, null); | ||
287 | conMan.addConsoles(new IConsole[] { sessionConsole }); | ||
288 | } | ||
289 | } | ||
290 | |||
291 | ConsolePlugin.getDefault().getConsoleManager().showConsoleView(sessionConsole); | ||
292 | |||
293 | return sessionConsole; | ||
294 | } | ||
295 | |||
296 | private int getLineType(String line) { | ||
297 | |||
298 | if (line.contains("=")) { | ||
299 | return TYPE_VARIABLE_ASSIGNMENT; | ||
300 | } | ||
301 | |||
302 | for (Iterator i = getBitBakeKeywords().iterator(); i.hasNext();) { | ||
303 | if (line.startsWith((String) i.next())) { | ||
304 | return TYPE_STATEMENT; | ||
305 | } | ||
306 | } | ||
307 | |||
308 | if (line.contains(":")) { | ||
309 | return TYPE_FLAG; | ||
310 | } | ||
311 | |||
312 | return TYPE_UNKNOWN; | ||
313 | } | ||
314 | |||
315 | public Collection getRecipeFiles(IProject project) { | ||
316 | try { | ||
317 | checkValidAndLock(true); | ||
318 | if (!initialized) { | ||
319 | throw new RuntimeException(this.getClass().getName() + " is not initialized."); | ||
320 | } | ||
321 | String bbfiles = (String) this.properties.get("BBFILES"); | ||
322 | List paths = parseBBFiles(bbfiles); | ||
323 | return findRecipes(paths, project); | ||
324 | } catch (Exception e) { | ||
325 | return null; | ||
326 | } | ||
327 | finally { | ||
328 | rlock.unlock(); | ||
329 | } | ||
330 | } | ||
331 | |||
332 | @Override | ||
333 | public int hashCode() { | ||
334 | try { | ||
335 | checkValidAndLock(true); | ||
336 | return properties.hashCode(); | ||
337 | } catch (Exception e) { | ||
338 | e.printStackTrace(); | ||
339 | return 0; | ||
340 | }finally { | ||
341 | rlock.unlock(); | ||
342 | } | ||
343 | } | ||
344 | |||
345 | protected void checkExecuteError(String result, boolean hasErrors) { | ||
346 | URI recipeURI = getDefaultDepends(); | ||
347 | String text = "Parsing " + ((recipeURI != null) ? ("recipe " + recipeURI) : "base configurations"); | ||
348 | if (hasErrors) { | ||
349 | text = text + " ERROR!\n" + result; | ||
350 | }else { | ||
351 | text = text + " SUCCESS.\n"; | ||
352 | } | ||
353 | if(!silent) { | ||
354 | displayInConsole(text, -1, false); | ||
355 | } | ||
356 | } | ||
357 | |||
358 | protected void displayInConsole(final String result, final int code, boolean clear) { | ||
359 | MessageConsole console = getConsole(); | ||
360 | final MessageConsoleStream info = console.newMessageStream(); | ||
361 | if(clear) | ||
362 | console.clearConsole(); | ||
363 | new WorkbenchJob("Display parsing result") { | ||
364 | public IStatus runInUIThread(IProgressMonitor monitor) { | ||
365 | if(code != 0) { | ||
366 | info.setColor(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR)); | ||
367 | } | ||
368 | try { | ||
369 | info.println(result); | ||
370 | info.close(); | ||
371 | }catch (Exception e) { | ||
372 | e.printStackTrace(); | ||
373 | } | ||
374 | return Status.OK_STATUS; | ||
375 | } | ||
376 | }.schedule(); | ||
377 | } | ||
378 | |||
379 | private void checkValidAndLock(boolean rdlck) throws Exception { | ||
380 | if(rdlck) | ||
381 | rlock.lock(); | ||
382 | else | ||
383 | wlock.lock(); | ||
384 | if(!initialized) { | ||
385 | //upgrade lock manually | ||
386 | if(rdlck) { | ||
387 | rlock.unlock(); | ||
388 | wlock.lock(); | ||
389 | } | ||
390 | try { | ||
391 | if(!initialized) { //recheck | ||
392 | boolean hasErrors = false; | ||
393 | String result = shell.execute(parsingCmd, hasErrors); | ||
394 | |||
395 | properties = parseBBEnvironment(result); | ||
396 | |||
397 | if (properties.size() == 0) { // there was an error in sourcing bitbake environment | ||
398 | shell.printError(errorLines); | ||
399 | errorOccured = true; | ||
400 | } else { | ||
401 | errorLines = ""; | ||
402 | errorOccured = false; | ||
403 | initialized = true; | ||
404 | } | ||
405 | RemoteHelper.handleRunCommandRemote(this.pinfo.getConnection(), new YoctoCommand("rm -rf " + result + BB_ENV_FILE, result, ""), new NullProgressMonitor()); | ||
406 | } | ||
407 | } finally { | ||
408 | //downgrade lock | ||
409 | if(rdlck) { | ||
410 | rlock.lock(); | ||
411 | wlock.unlock(); | ||
412 | } | ||
413 | } | ||
414 | } | ||
415 | //not release lock | ||
416 | } | ||
417 | |||
418 | public void initialize() throws Exception { | ||
419 | try { | ||
420 | checkValidAndLock(false); | ||
421 | }finally { | ||
422 | wlock.unlock(); | ||
423 | } | ||
424 | } | ||
425 | |||
426 | private boolean isBlockEnd(String trimmed) { | ||
427 | return charCount(trimmed, '}') > charCount(trimmed, '{'); | ||
428 | // return trimmed.indexOf('}') > -1 && trimmed.indexOf('{') == -1; | ||
429 | } | ||
430 | |||
431 | private boolean isBlockStart(String trimmed) { | ||
432 | return charCount(trimmed, '{') > charCount(trimmed, '}'); | ||
433 | // return trimmed.indexOf('{') > -1 && trimmed.indexOf('}') == -1; | ||
434 | } | ||
435 | |||
436 | public boolean isEmpty() { | ||
437 | try { | ||
438 | checkValidAndLock(true); | ||
439 | return properties.isEmpty(); | ||
440 | } catch (Exception e) { | ||
441 | e.printStackTrace(); | ||
442 | return true; | ||
443 | }finally { | ||
444 | rlock.unlock(); | ||
445 | } | ||
446 | } | ||
447 | |||
448 | public Set keySet() { | ||
449 | try { | ||
450 | checkValidAndLock(true); | ||
451 | return properties.keySet(); | ||
452 | } catch (Exception e) { | ||
453 | e.printStackTrace(); | ||
454 | return null; | ||
455 | }finally { | ||
456 | rlock.unlock(); | ||
457 | } | ||
458 | } | ||
459 | |||
460 | protected void parse(String bbOutfilePath, Map outMap) throws Exception { | ||
461 | IHost connection = shell.getProjectInfo().getConnection(); | ||
462 | InputStream is = RemoteHelper.getRemoteInputStream(connection, bbOutfilePath, BB_ENV_FILE, new NullProgressMonitor()); | ||
463 | RemoteHelper.getRemoteHostFile(connection, bbOutfilePath + BB_ENV_FILE, new NullProgressMonitor()); | ||
464 | BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | ||
465 | String line; | ||
466 | boolean inLine = false; | ||
467 | StringBuffer sb = null; | ||
468 | Stack blockStack = new Stack(); | ||
469 | |||
470 | while ((line = reader.readLine()) != null) { | ||
471 | errorLines += line; | ||
472 | String trimmed = line.trim(); | ||
473 | if (trimmed.length() == 0 || line.startsWith("#")) { | ||
474 | // weed out the blank and comment lines | ||
475 | continue; | ||
476 | } | ||
477 | // Now we look for block start ends, and ignore all code within | ||
478 | // blocks. | ||
479 | if (isBlockStart(trimmed)) { | ||
480 | blockStack.push(trimmed); | ||
481 | } else if (isBlockEnd(trimmed)) { | ||
482 | blockStack.pop(); | ||
483 | |||
484 | } | ||
485 | |||
486 | if (!blockStack.isEmpty()) { | ||
487 | // we are in a code block, continue until we break into global | ||
488 | // scope. | ||
489 | continue; | ||
490 | } | ||
491 | if (trimmed.endsWith("\\")) { | ||
492 | if (!inLine) { | ||
493 | inLine = true; | ||
494 | sb = new StringBuffer(trimmed.substring(0, trimmed.length() - 1)); | ||
495 | } else { | ||
496 | sb.append(trimmed.substring(0, trimmed.length() - 1)); | ||
497 | } | ||
498 | // Only parse the line when we have the complete contents. | ||
499 | continue; | ||
500 | } else if (inLine) { | ||
501 | inLine = false; | ||
502 | line = sb.toString(); | ||
503 | } | ||
504 | |||
505 | parseLine(line, outMap); | ||
506 | } | ||
507 | } | ||
508 | |||
509 | private void parseAdditiveAssignment(String line, String operator, Map mo) throws Exception { | ||
510 | String[] elems = splitAssignment(line, "\\+="); | ||
511 | |||
512 | if (elems.length != 2) { | ||
513 | throw new Exception("Unable to parse additive variable assignment in line: " + line); | ||
514 | } | ||
515 | |||
516 | if (!mo.containsKey(elems[0])) { | ||
517 | mo.put(elems[0].trim(), elems[1]); | ||
518 | } else { | ||
519 | String existing = (String) mo.get(elems[0]); | ||
520 | if (operator.equals("+=")) { | ||
521 | mo.put(elems[0], existing + elems[1]); | ||
522 | } else { | ||
523 | mo.put(elems[0], elems[1] + existing); | ||
524 | } | ||
525 | } | ||
526 | } | ||
527 | |||
528 | protected URI getDefaultDepends() { | ||
529 | return null; | ||
530 | } | ||
531 | |||
532 | protected Map parseBBEnvironment(String bbOutFilePath) throws Exception { | ||
533 | Map env = new Hashtable(); | ||
534 | this.depends = new ArrayList<URI>(); | ||
535 | |||
536 | parse(bbOutFilePath, env); | ||
537 | |||
538 | String included = (String) env.get("BBINCLUDED"); | ||
539 | if(getDefaultDepends() != null) { | ||
540 | this.depends.add(getDefaultDepends()); | ||
541 | } | ||
542 | if(included != null) { | ||
543 | String[] includedSplitted = included.split(" "); | ||
544 | for (String incl : includedSplitted){ | ||
545 | if (!incl.contains("${")) { | ||
546 | this.depends.add(new URI(incl)); | ||
547 | } | ||
548 | } | ||
549 | } | ||
550 | |||
551 | return env; | ||
552 | } | ||
553 | |||
554 | |||
555 | private List parseBBFiles(String bbfiles) { | ||
556 | return Arrays.asList(bbfiles.split(" ")); | ||
557 | } | ||
558 | |||
559 | //Map delegate methods | ||
560 | |||
561 | private void parseConditionalAssignment(String line, Map mo) throws Exception { | ||
562 | String[] elems = splitAssignment(line, "\\?="); | ||
563 | |||
564 | if (elems.length != 2) { | ||
565 | throw new Exception("Unable to parse conditional variable assignment in line: " + line); | ||
566 | } | ||
567 | |||
568 | if (!mo.containsKey(elems[0].trim())) { | ||
569 | mo.put(elems[0].trim(), elems[1].trim()); | ||
570 | } | ||
571 | } | ||
572 | |||
573 | private void parseImmediateAssignment(String line, String delimiter, Map mo) throws Exception { | ||
574 | String[] elems = splitAssignment(line, delimiter); | ||
575 | |||
576 | mo.put(elems[0], substitute(elems[1], mo)); | ||
577 | } | ||
578 | |||
579 | private void parseKeyValue(String line, String delimiter, Map mo) throws Exception { | ||
580 | String[] elems = splitAssignment(line, delimiter); | ||
581 | |||
582 | mo.put(elems[0], elems[1]); | ||
583 | } | ||
584 | |||
585 | private void parseLine(String line, Map mo) throws Exception { | ||
586 | |||
587 | switch (getLineType(line)) { | ||
588 | case TYPE_VARIABLE_ASSIGNMENT: | ||
589 | parseVariableAssignment(line, mo); | ||
590 | break; | ||
591 | case TYPE_STATEMENT: | ||
592 | case TYPE_FLAG: | ||
593 | // for now ignore statements | ||
594 | break; | ||
595 | case TYPE_UNKNOWN: | ||
596 | // we'll gloss over unknown lines as well; | ||
597 | break; | ||
598 | default: | ||
599 | throw new Exception("Unable to parse line: " + line); | ||
600 | } | ||
601 | } | ||
602 | |||
603 | private void parseVariableAssignment(String line, Map mo) throws Exception { | ||
604 | if (line.contains("?=")) { | ||
605 | parseConditionalAssignment(line, mo); | ||
606 | } else if (line.contains("+=")) { | ||
607 | parseAdditiveAssignment(line, "+=", mo); | ||
608 | } else if (line.contains("=+")) { | ||
609 | parseAdditiveAssignment(line, "=+", mo); | ||
610 | } else if (line.contains(":=")) { | ||
611 | parseImmediateAssignment(line, ":=", mo); | ||
612 | } else { | ||
613 | parseKeyValue(line, "=", mo); | ||
614 | } | ||
615 | |||
616 | } | ||
617 | |||
618 | private List parseVars(String line) { | ||
619 | List l = new ArrayList(); | ||
620 | |||
621 | int i = 0; | ||
622 | |||
623 | while ((i = line.indexOf("${", i)) > -1) { | ||
624 | int i2 = line.indexOf("}", i); | ||
625 | |||
626 | l.add(line.subSequence(i + 2, i2)); | ||
627 | i++; | ||
628 | } | ||
629 | |||
630 | return l; | ||
631 | } | ||
632 | |||
633 | public Object put(Object arg0, Object arg1) { | ||
634 | throw new RuntimeException("BB configuration is read-only."); | ||
635 | } | ||
636 | |||
637 | public void putAll(Map arg0) { | ||
638 | throw new RuntimeException("BB configuration is read-only."); | ||
639 | } | ||
640 | |||
641 | public Object remove(Object arg0) { | ||
642 | throw new RuntimeException("BB configuration is read-only."); | ||
643 | } | ||
644 | |||
645 | private String removeQuotes(String line) { | ||
646 | line = line.trim(); | ||
647 | |||
648 | if (line.startsWith("\"")) { | ||
649 | line = line.substring(1); | ||
650 | } | ||
651 | |||
652 | if (line.endsWith("\"")) { | ||
653 | line = line.substring(0, line.length() - 1); | ||
654 | } | ||
655 | |||
656 | return line; | ||
657 | } | ||
658 | |||
659 | public int size() { | ||
660 | try { | ||
661 | checkValidAndLock(true); | ||
662 | return properties.size(); | ||
663 | }catch (Exception e) { | ||
664 | e.printStackTrace(); | ||
665 | return 0; | ||
666 | }finally { | ||
667 | rlock.unlock(); | ||
668 | } | ||
669 | } | ||
670 | |||
671 | private String[] splitAssignment(String line, String seperator) throws Exception { | ||
672 | String[] elems = line.split(seperator); | ||
673 | |||
674 | if (elems.length < 2) { | ||
675 | throw new Exception("Unable to parse assignment in line: " + line); | ||
676 | } else if (elems.length == 2) { | ||
677 | |||
678 | elems[0] = elems[0].trim(); // Clean up trailing or leading spaces. | ||
679 | if (elems[0].startsWith("export ")) { | ||
680 | elems[0] = elems[0].substring("export ".length()).trim(); | ||
681 | } | ||
682 | elems[1] = removeQuotes(elems[1]); // Evaluate variables | ||
683 | |||
684 | return elems; | ||
685 | } else { | ||
686 | String[] retVal = new String[2]; | ||
687 | |||
688 | retVal[0] = elems[0]; | ||
689 | if (retVal[0].startsWith("export ")) { | ||
690 | retVal[0] = retVal[0].substring("export ".length()).trim(); | ||
691 | } | ||
692 | retVal[1] = appendAll(elems, 1); | ||
693 | |||
694 | return retVal; | ||
695 | } | ||
696 | } | ||
697 | |||
698 | private String stripLeading(String target, String leading) { | ||
699 | if (target.startsWith(leading)) { | ||
700 | target = target.substring(leading.length()); | ||
701 | } | ||
702 | |||
703 | return target; | ||
704 | } | ||
705 | |||
706 | /** | ||
707 | * Return a string with variable substitutions in place. | ||
708 | * | ||
709 | * @param expression | ||
710 | * @return Input string with any substitutions from this file. | ||
711 | */ | ||
712 | public String substitute(String expression, Map mo) { | ||
713 | |||
714 | List vars = parseVars(expression); | ||
715 | |||
716 | for (Iterator i = vars.iterator(); i.hasNext();) { | ||
717 | String varName = (String) i.next(); | ||
718 | String varToken = "${" + varName + "}"; | ||
719 | |||
720 | if (mo.containsKey(varName)) { | ||
721 | expression = expression.replace(varToken, (String) mo.get(varName)); | ||
722 | } else if (System.getProperty(varName) != null) { | ||
723 | expression = expression.replace(varToken, System.getProperty(varName)); | ||
724 | } else if (varName.toUpperCase().equals("HOME")) { | ||
725 | expression = expression.replace(varToken, System.getProperty("user.home")); | ||
726 | } | ||
727 | } | ||
728 | |||
729 | return expression; | ||
730 | } | ||
731 | |||
732 | public Collection values() { | ||
733 | try { | ||
734 | checkValidAndLock(true); | ||
735 | return properties.values(); | ||
736 | } catch (Exception e) { | ||
737 | e.printStackTrace(); | ||
738 | return null; | ||
739 | }finally { | ||
740 | rlock.unlock(); | ||
741 | } | ||
742 | } | ||
743 | |||
744 | public void changeNotified(IResource[] added, IResource[] removed, IResource[] changed) { | ||
745 | wlock.lock(); | ||
746 | try { | ||
747 | if (initialized && (removed != null || changed != null)) { | ||
748 | for(int i=0;removed != null && i<removed.length;i++) { | ||
749 | if (this.depends.contains(removed[i].getLocationURI())) { | ||
750 | initialized = false; | ||
751 | return; | ||
752 | } | ||
753 | } | ||
754 | if (!depends.isEmpty()) { | ||
755 | for(int i=0;changed != null && i<changed.length;i++) { | ||
756 | if (changed[i].getLocation() != null && this.depends.contains(changed[i].getLocation().toString())) { | ||
757 | initialized = false; | ||
758 | return; | ||
759 | } | ||
760 | } | ||
761 | } | ||
762 | } | ||
763 | } | ||
764 | finally { | ||
765 | wlock.unlock(); | ||
766 | } | ||
767 | } | ||
768 | |||
769 | public Map<String, String> getProperties() { | ||
770 | return (Map<String, String>) properties; | ||
771 | } | ||
772 | |||
773 | public ProjectInfo getProjectInfo() { | ||
774 | return pinfo; | ||
775 | } | ||
776 | |||
777 | public boolean hasErrorOccured() { | ||
778 | return errorOccured; | ||
779 | } | ||
780 | |||
781 | public String getErrorLines() { | ||
782 | return errorLines; | ||
783 | } | ||
784 | |||
785 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/IBBSessionListener.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/IBBSessionListener.java new file mode 100644 index 0000000..4d0054f --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/IBBSessionListener.java | |||
@@ -0,0 +1,18 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2012 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | |||
12 | package org.yocto.bc.bitbake; | ||
13 | |||
14 | import org.eclipse.core.resources.IResource; | ||
15 | |||
16 | public interface IBBSessionListener { | ||
17 | public void changeNotified(IResource[] added, IResource[] removed, IResource[] changed); | ||
18 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java new file mode 100644 index 0000000..800fe2b --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java | |||
@@ -0,0 +1,64 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.bitbake; | ||
13 | |||
14 | import java.io.BufferedReader; | ||
15 | import java.io.File; | ||
16 | import java.io.FileOutputStream; | ||
17 | import java.io.FileReader; | ||
18 | import java.io.IOException; | ||
19 | import java.net.URI; | ||
20 | |||
21 | import org.eclipse.core.resources.IProject; | ||
22 | import org.eclipse.core.resources.ResourcesPlugin; | ||
23 | |||
24 | import org.yocto.bc.ui.model.ProjectInfo; | ||
25 | |||
26 | /** | ||
27 | * A helper class for ProjectInfo related tasks. | ||
28 | * | ||
29 | * @author kgilmer | ||
30 | * | ||
31 | */ | ||
32 | public class ProjectInfoHelper { | ||
33 | public static final String OEFS_SCHEME = "OEFS://"; | ||
34 | public static final String FILE_SCHEME = "file"; | ||
35 | public static final String RSE_SCHEME = "rse"; | ||
36 | |||
37 | protected static final String DEFAULT_INIT_SCRIPT = "oe-init-build-env"; | ||
38 | /** | ||
39 | * @param path | ||
40 | * @return The path to bitbake init script | ||
41 | * @throws IOException | ||
42 | */ | ||
43 | public static String getInitScriptPath(URI uri) throws IOException { | ||
44 | String val = uri.getPath() + "/" + DEFAULT_INIT_SCRIPT; | ||
45 | return val; | ||
46 | } | ||
47 | |||
48 | public static String getProjectName(URI projectRoot) { | ||
49 | IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); | ||
50 | for (int i = 0; i < projects.length; ++i) { | ||
51 | try { | ||
52 | if (projects[i].getLocationURI().equals(projectRoot)) { | ||
53 | return projects[i].getName(); | ||
54 | } | ||
55 | |||
56 | } catch (Exception e) { | ||
57 | // TODO Auto-generated catch block | ||
58 | e.printStackTrace(); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | return null; | ||
63 | } | ||
64 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java new file mode 100644 index 0000000..0e262b1 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java | |||
@@ -0,0 +1,209 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.bitbake; | ||
13 | |||
14 | import java.io.BufferedReader; | ||
15 | import java.io.File; | ||
16 | import java.io.IOException; | ||
17 | import java.io.InputStream; | ||
18 | import java.io.InputStreamReader; | ||
19 | import java.io.OutputStream; | ||
20 | import java.io.Writer; | ||
21 | |||
22 | import org.eclipse.core.runtime.IProgressMonitor; | ||
23 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
24 | import org.eclipse.rse.core.model.IHost; | ||
25 | import org.eclipse.rse.services.files.IHostFile; | ||
26 | import org.yocto.bc.ui.model.ProjectInfo; | ||
27 | import org.yocto.remote.utils.ICommandResponseHandler; | ||
28 | import org.yocto.remote.utils.RemoteHelper; | ||
29 | import org.yocto.remote.utils.YoctoCommand; | ||
30 | |||
31 | /** | ||
32 | * A class for Linux shell sessions. | ||
33 | * @author kgilmer | ||
34 | * | ||
35 | */ | ||
36 | public class ShellSession { | ||
37 | private volatile boolean interrupt = false; | ||
38 | /** | ||
39 | * String used to isolate command execution | ||
40 | */ | ||
41 | public static final String TERMINATOR = "#234o987dsfkcqiuwey18837032843259d"; | ||
42 | public static final String LT = System.getProperty("line.separator"); | ||
43 | public static final String exportCmd = "export BB_ENV_EXTRAWHITE=\\\"DISABLE_SANITY_CHECKS $BB_ENV_EXTRAWHITE\\\""; | ||
44 | public static final String exportColumnsCmd = "export COLUMNS=1000"; | ||
45 | private static final String BUILD_DIR = "/build/"; | ||
46 | |||
47 | |||
48 | public static String getFilePath(String file) throws IOException { | ||
49 | File f = new File(file); | ||
50 | |||
51 | if (!f.exists() || f.isDirectory()) { | ||
52 | throw new IOException("Path passed is not a file: " + file); | ||
53 | } | ||
54 | |||
55 | StringBuffer sb = new StringBuffer(); | ||
56 | |||
57 | String elems[] = file.split("//"); | ||
58 | |||
59 | for (int i = 0; i < elems.length - 1; ++i) { | ||
60 | sb.append(elems[i]); | ||
61 | sb.append("//"); | ||
62 | } | ||
63 | |||
64 | return sb.toString(); | ||
65 | } | ||
66 | private Process process; | ||
67 | |||
68 | private OutputStream pos = null; | ||
69 | private String shellPath = null; | ||
70 | private final String initCmd; | ||
71 | private final IHostFile root; | ||
72 | private ProjectInfo projectInfo; | ||
73 | |||
74 | public ProjectInfo getProjectInfo() { | ||
75 | return projectInfo; | ||
76 | } | ||
77 | |||
78 | public void setProjectInfo(ProjectInfo projectInfo) { | ||
79 | this.projectInfo = projectInfo; | ||
80 | } | ||
81 | |||
82 | public ShellSession(ProjectInfo pInfo, IHostFile root, String initCmd) throws IOException { | ||
83 | this.projectInfo = pInfo; | ||
84 | this.root = root; | ||
85 | this.initCmd = initCmd; | ||
86 | |||
87 | initializeShell(new NullProgressMonitor()); | ||
88 | } | ||
89 | |||
90 | private void initializeShell(IProgressMonitor monitor) throws IOException { | ||
91 | try { | ||
92 | if (root != null) { | ||
93 | IHost connection = projectInfo.getConnection(); | ||
94 | RemoteHelper.handleRunCommandRemote(connection, new YoctoCommand("source " + initCmd, root.getAbsolutePath(), ""), monitor); | ||
95 | RemoteHelper.handleRunCommandRemote(connection, new YoctoCommand(exportCmd, root.getAbsolutePath(), ""), monitor); | ||
96 | } else { | ||
97 | throw new Exception("Root file not found!"); | ||
98 | } | ||
99 | } catch (Exception e) { | ||
100 | e.printStackTrace(); | ||
101 | } | ||
102 | } | ||
103 | |||
104 | synchronized | ||
105 | public String execute(String command) throws IOException { | ||
106 | return execute(command, false); | ||
107 | } | ||
108 | |||
109 | synchronized | ||
110 | public String execute(String command, boolean hasErrors) throws IOException { | ||
111 | try { | ||
112 | if (projectInfo.getConnection() != null) { | ||
113 | command = getInitCmd() + command; | ||
114 | RemoteHelper.handleRunCommandRemote(projectInfo.getConnection(), new YoctoCommand(command, getBuildDirAbsolutePath(), ""), new NullProgressMonitor()); | ||
115 | return getBuildDirAbsolutePath(); | ||
116 | } | ||
117 | return null; | ||
118 | } catch (Exception e) { | ||
119 | e.printStackTrace(); | ||
120 | } | ||
121 | return null; | ||
122 | } | ||
123 | |||
124 | private String getBuildDirAbsolutePath() { | ||
125 | return root.getAbsolutePath() + BUILD_DIR; | ||
126 | } | ||
127 | |||
128 | private String getInitCmd() { | ||
129 | return "source " + initCmd + " " + getBuildDirAbsolutePath() | ||
130 | + " > tempsf; rm -rf tempsf;" + exportCmd + ";" | ||
131 | + exportColumnsCmd + ";" + "cd " + getBuildDirAbsolutePath() | ||
132 | + ";"; | ||
133 | } | ||
134 | |||
135 | synchronized | ||
136 | public void execute(String command, String terminator, ICommandResponseHandler handler) throws IOException { | ||
137 | interrupt = false; | ||
138 | InputStream errIs = process.getErrorStream(); | ||
139 | if (errIs.available() > 0) { | ||
140 | clearErrorStream(errIs); | ||
141 | } | ||
142 | sendToProcessAndTerminate(command); | ||
143 | |||
144 | BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); | ||
145 | String std = null; | ||
146 | |||
147 | do { | ||
148 | if (errIs.available() > 0) { | ||
149 | byte[] msg = new byte[errIs.available()]; | ||
150 | |||
151 | errIs.read(msg, 0, msg.length); | ||
152 | handler.response(new String(msg), true); | ||
153 | } | ||
154 | |||
155 | std = br.readLine(); | ||
156 | |||
157 | if (std != null && !std.endsWith(terminator)) { | ||
158 | handler.response(std, false); | ||
159 | } | ||
160 | |||
161 | } while (std != null && !std.endsWith(terminator) && !interrupt); | ||
162 | |||
163 | if (interrupt) { | ||
164 | process.destroy(); | ||
165 | initializeShell(null); | ||
166 | interrupt = false; | ||
167 | } | ||
168 | } | ||
169 | |||
170 | private void clearErrorStream(InputStream is) { | ||
171 | |||
172 | try { | ||
173 | byte b[] = new byte[is.available()]; | ||
174 | is.read(b); | ||
175 | System.out.println("clearing: " + new String(b)); | ||
176 | } catch (IOException e) { | ||
177 | e.printStackTrace(); | ||
178 | //Ignore any error | ||
179 | } | ||
180 | } | ||
181 | |||
182 | /** | ||
183 | * Send command string to shell process and add special terminator string so | ||
184 | * reader knows when output is complete. | ||
185 | * | ||
186 | * @param command | ||
187 | * @throws IOException | ||
188 | */ | ||
189 | private void sendToProcessAndTerminate(String command) throws IOException { | ||
190 | pos.write(command.getBytes()); | ||
191 | pos.write(LT.getBytes()); | ||
192 | pos.flush(); | ||
193 | pos.write("echo $?".getBytes()); | ||
194 | pos.write(TERMINATOR.getBytes()); | ||
195 | pos.write(LT.getBytes()); | ||
196 | pos.flush(); | ||
197 | } | ||
198 | |||
199 | /** | ||
200 | * Interrupt any running processes. | ||
201 | */ | ||
202 | public void interrupt() { | ||
203 | interrupt = true; | ||
204 | } | ||
205 | |||
206 | public void printError(String errorLines) { | ||
207 | RemoteHelper.getCommandHandler(projectInfo.getConnection()).response(errorLines, true); | ||
208 | } | ||
209 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ConsoleWriter.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ConsoleWriter.java new file mode 100644 index 0000000..779ffa2 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ConsoleWriter.java | |||
@@ -0,0 +1,46 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ioana Grigoropol(Intel) - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.remote.utils; | ||
12 | |||
13 | import java.io.IOException; | ||
14 | import java.io.Writer; | ||
15 | |||
16 | public class ConsoleWriter extends Writer { | ||
17 | |||
18 | private StringBuffer sb; | ||
19 | |||
20 | public ConsoleWriter() { | ||
21 | sb = new StringBuffer(); | ||
22 | } | ||
23 | |||
24 | @Override | ||
25 | public void close() throws IOException { | ||
26 | } | ||
27 | |||
28 | public String getContents() { | ||
29 | return sb.toString(); | ||
30 | } | ||
31 | |||
32 | @Override | ||
33 | public void flush() throws IOException { | ||
34 | } | ||
35 | |||
36 | @Override | ||
37 | public void write(char[] cbuf, int off, int len) throws IOException { | ||
38 | sb.append(cbuf); | ||
39 | } | ||
40 | |||
41 | @Override | ||
42 | public void write(String str) throws IOException { | ||
43 | sb.append(str); | ||
44 | } | ||
45 | |||
46 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java new file mode 100644 index 0000000..9654cb3 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java | |||
@@ -0,0 +1,220 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ioana Grigoropol(Intel) - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.remote.utils; | ||
12 | |||
13 | import java.io.IOException; | ||
14 | import java.lang.reflect.InvocationTargetException; | ||
15 | import java.util.regex.Matcher; | ||
16 | import java.util.regex.Pattern; | ||
17 | |||
18 | import org.eclipse.core.runtime.CoreException; | ||
19 | import org.eclipse.core.runtime.IProgressMonitor; | ||
20 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
21 | import org.eclipse.jface.operation.IRunnableWithProgress; | ||
22 | import org.eclipse.ptp.remote.core.IRemoteConnection; | ||
23 | import org.eclipse.ptp.remote.core.IRemoteServices; | ||
24 | import org.eclipse.ptp.remote.core.exception.RemoteConnectionException; | ||
25 | import org.eclipse.rse.core.model.IHost; | ||
26 | import org.eclipse.rse.services.shells.IHostShell; | ||
27 | import org.eclipse.swt.widgets.Display; | ||
28 | import org.yocto.remote.utils.CommandResponseHandler; | ||
29 | import org.yocto.remote.utils.OutputProcessor; | ||
30 | import org.yocto.remote.utils.RemoteHelper; | ||
31 | import org.yocto.remote.utils.YoctoCommand; | ||
32 | |||
33 | public class YoctoRunnableWithProgress implements IRunnableWithProgress { | ||
34 | |||
35 | private String taskName; | ||
36 | private IRemoteConnection remoteConnection; | ||
37 | private IRemoteServices remoteServices; | ||
38 | private IProgressMonitor monitor; | ||
39 | private final ICalculatePercentage calculator; | ||
40 | private int reportedWorkload; | ||
41 | |||
42 | private final YoctoCommand command; | ||
43 | |||
44 | public YoctoRunnableWithProgress(YoctoCommand command) throws IOException { | ||
45 | this.command = command; | ||
46 | this.calculator = new GitCalculatePercentage(); | ||
47 | } | ||
48 | |||
49 | private interface ICalculatePercentage { | ||
50 | public float calWorkloadDone(String info) throws IllegalArgumentException; | ||
51 | } | ||
52 | |||
53 | private class GitCalculatePercentage implements ICalculatePercentage { | ||
54 | final Pattern pattern = Pattern.compile("^Receiving objects:\\s*(\\d+)%.*"); | ||
55 | @Override | ||
56 | public float calWorkloadDone(String info) throws IllegalArgumentException { | ||
57 | Matcher m = pattern.matcher(info.trim()); | ||
58 | if(m.matches()) { | ||
59 | return new Float(m.group(1)) / 100; | ||
60 | }else { | ||
61 | throw new IllegalArgumentException(); | ||
62 | } | ||
63 | } | ||
64 | } | ||
65 | |||
66 | @Override | ||
67 | public void run(IProgressMonitor monitor) throws InvocationTargetException, | ||
68 | InterruptedException { | ||
69 | try { | ||
70 | this.monitor = monitor; | ||
71 | this.monitor.beginTask(taskName, RemoteHelper.TOTALWORKLOAD); | ||
72 | |||
73 | if (!remoteConnection.isOpen()) { | ||
74 | try { | ||
75 | remoteConnection.open(monitor); | ||
76 | } catch (RemoteConnectionException e1) { | ||
77 | e1.printStackTrace(); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | remoteServices.initialize(new NullProgressMonitor()); | ||
82 | |||
83 | try { | ||
84 | IHost connection = RemoteHelper.getRemoteConnectionByName(remoteConnection.getName()); | ||
85 | YoctoThread th = new YoctoThread(connection, command); | ||
86 | th.run(); | ||
87 | } catch (Exception e) { | ||
88 | e.printStackTrace(); | ||
89 | } finally { | ||
90 | monitor.done(); | ||
91 | } | ||
92 | } catch (Exception e) { | ||
93 | e.printStackTrace(); | ||
94 | } | ||
95 | } | ||
96 | class YoctoRunnableOutputProcessor extends OutputProcessor{ | ||
97 | |||
98 | public YoctoRunnableOutputProcessor(IProgressMonitor monitor, | ||
99 | IHostShell hostShell, CommandResponseHandler cmdHandler, | ||
100 | String task) { | ||
101 | super(monitor, hostShell, cmdHandler, task); | ||
102 | } | ||
103 | @Override | ||
104 | protected boolean isErrChStop(char ch) { | ||
105 | return (ch == '\n' || ch == '\r'); | ||
106 | } | ||
107 | |||
108 | @Override | ||
109 | protected boolean isOutChStop(char ch) { | ||
110 | return (ch == '\n'); | ||
111 | } | ||
112 | |||
113 | @Override | ||
114 | protected void processOutputBufferLine(char ch, String str) { | ||
115 | processBuffer.addOutputLine(str); | ||
116 | } | ||
117 | |||
118 | @Override | ||
119 | protected void processErrorBufferLine(char ch, String str) { | ||
120 | processBuffer.addOutputLine(str); | ||
121 | if (ch == '\r') | ||
122 | reportProgress(str); | ||
123 | } | ||
124 | |||
125 | } | ||
126 | |||
127 | class YoctoThread implements Runnable{ | ||
128 | private final IHost connection; | ||
129 | private final YoctoCommand command; | ||
130 | private final CommandResponseHandler cmdHandler; | ||
131 | private IHostShell hostShell; | ||
132 | |||
133 | YoctoThread(IHost connection, YoctoCommand command){ | ||
134 | this.connection = connection; | ||
135 | this.cmdHandler = RemoteHelper.getCommandHandler(connection); | ||
136 | this.command = command; | ||
137 | } | ||
138 | |||
139 | @Override | ||
140 | public void run() { | ||
141 | try { | ||
142 | hostShell = RemoteHelper.runCommandRemote(this.connection, command, monitor); | ||
143 | command.setProcessBuffer(new YoctoRunnableOutputProcessor(monitor, hostShell, cmdHandler, taskName).processOutput()); | ||
144 | } catch (CoreException e) { | ||
145 | e.printStackTrace(); | ||
146 | } catch (Exception e) { | ||
147 | e.printStackTrace(); | ||
148 | } | ||
149 | } | ||
150 | } | ||
151 | private void updateMonitor(final int work){ | ||
152 | |||
153 | Display.getDefault().asyncExec(new Runnable() { | ||
154 | |||
155 | @Override | ||
156 | public void run() { | ||
157 | if (monitor != null) { | ||
158 | monitor.worked(work); | ||
159 | } | ||
160 | } | ||
161 | |||
162 | }); | ||
163 | } | ||
164 | |||
165 | private void doneMonitor(){ | ||
166 | Display.getDefault().asyncExec(new Runnable() { | ||
167 | @Override | ||
168 | public void run() { | ||
169 | monitor.done(); | ||
170 | } | ||
171 | }); | ||
172 | } | ||
173 | |||
174 | public void reportProgress(String info) { | ||
175 | if(calculator == null) { | ||
176 | updateMonitor(1); | ||
177 | } else { | ||
178 | float percentage; | ||
179 | try { | ||
180 | percentage = calculator.calWorkloadDone(info); | ||
181 | } catch (IllegalArgumentException e) { | ||
182 | System.out.println(info); | ||
183 | //can't get percentage | ||
184 | return; | ||
185 | } | ||
186 | int delta = (int) (RemoteHelper.TOTALWORKLOAD * percentage - reportedWorkload); | ||
187 | if( delta > 0 ) { | ||
188 | updateMonitor(delta); | ||
189 | reportedWorkload += delta; | ||
190 | } | ||
191 | |||
192 | if (reportedWorkload == RemoteHelper.TOTALWORKLOAD) | ||
193 | doneMonitor(); | ||
194 | } | ||
195 | } | ||
196 | |||
197 | public IRemoteConnection getRemoteConnection() { | ||
198 | return remoteConnection; | ||
199 | } | ||
200 | |||
201 | public void setRemoteConnection(IRemoteConnection remoteConnection) { | ||
202 | this.remoteConnection = remoteConnection; | ||
203 | } | ||
204 | |||
205 | public String getTaskName() { | ||
206 | return taskName; | ||
207 | } | ||
208 | |||
209 | public void setTaskName(String taskName) { | ||
210 | this.taskName = taskName; | ||
211 | } | ||
212 | |||
213 | public IRemoteServices getRemoteServices() { | ||
214 | return remoteServices; | ||
215 | } | ||
216 | |||
217 | public void setRemoteServices(IRemoteServices remoteServices) { | ||
218 | this.remoteServices = remoteServices; | ||
219 | } | ||
220 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java new file mode 100644 index 0000000..f53592c --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java | |||
@@ -0,0 +1,254 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui; | ||
13 | |||
14 | import java.io.File; | ||
15 | import java.io.IOException; | ||
16 | import java.io.Writer; | ||
17 | import java.lang.reflect.InvocationTargetException; | ||
18 | import java.net.URI; | ||
19 | import java.util.Hashtable; | ||
20 | import java.util.Iterator; | ||
21 | import java.util.Map; | ||
22 | |||
23 | import org.eclipse.core.resources.IProject; | ||
24 | import org.eclipse.core.resources.IResource; | ||
25 | import org.eclipse.core.resources.IResourceChangeEvent; | ||
26 | import org.eclipse.core.resources.IResourceChangeListener; | ||
27 | import org.eclipse.core.resources.ResourcesPlugin; | ||
28 | import org.eclipse.core.runtime.CoreException; | ||
29 | import org.eclipse.core.runtime.IProgressMonitor; | ||
30 | import org.eclipse.jface.resource.ImageDescriptor; | ||
31 | import org.eclipse.jface.resource.ImageRegistry; | ||
32 | import org.eclipse.rse.services.files.IHostFile; | ||
33 | import org.eclipse.ui.plugin.AbstractUIPlugin; | ||
34 | import org.osgi.framework.BundleContext; | ||
35 | |||
36 | import org.yocto.bc.bitbake.BBRecipe; | ||
37 | import org.yocto.bc.bitbake.BBSession; | ||
38 | import org.yocto.bc.bitbake.ProjectInfoHelper; | ||
39 | import org.yocto.bc.bitbake.ShellSession; | ||
40 | import org.yocto.bc.ui.model.ProjectInfo; | ||
41 | import org.yocto.bc.ui.wizards.newproject.CreateBBCProjectOperation; | ||
42 | import org.yocto.remote.utils.RemoteHelper; | ||
43 | |||
44 | public class Activator extends AbstractUIPlugin { | ||
45 | |||
46 | // The plug-in ID | ||
47 | public static final String PLUGIN_ID = "org.yocto.bc.ui"; | ||
48 | public static final String IMAGE_VARIABLE = "IMAGE_VARIABLE"; | ||
49 | public static final String IMAGE_FUNCTION = "IMAGE_FUNCTION"; | ||
50 | |||
51 | // The shared instance | ||
52 | private static Activator plugin; | ||
53 | private static Map shellMap; | ||
54 | private static Map<URI, ProjectInfo> projInfoMap; | ||
55 | private static Hashtable bbSessionMap; | ||
56 | private static Hashtable bbRecipeMap; | ||
57 | |||
58 | private IResourceChangeListener listener = new BCResourceChangeListener(); | ||
59 | |||
60 | public static BBRecipe getBBRecipe(BBSession session, URI fileURI) throws IOException { | ||
61 | if (bbRecipeMap == null) { | ||
62 | bbRecipeMap = new Hashtable(); | ||
63 | } | ||
64 | |||
65 | URI key = session.getProjInfoRoot(); | ||
66 | BBRecipe recipe = (BBRecipe) bbRecipeMap.get(key); | ||
67 | if (recipe == null) { | ||
68 | recipe = new BBRecipe(session, fileURI); | ||
69 | bbRecipeMap.put(key, recipe); | ||
70 | } | ||
71 | |||
72 | return recipe; | ||
73 | } | ||
74 | |||
75 | /** | ||
76 | * Get or create a BitBake session passing in ProjectInfo | ||
77 | * @param pinfo | ||
78 | * @return | ||
79 | * @throws IOException | ||
80 | */ | ||
81 | public static BBSession getBBSession(ProjectInfo projectInfo, Writer out, IProgressMonitor monitor) throws IOException { | ||
82 | URI projectRoot = projectInfo.getOriginalURI(); | ||
83 | if (bbSessionMap == null) { | ||
84 | bbSessionMap = new Hashtable(); | ||
85 | } | ||
86 | |||
87 | BBSession bbs = (BBSession) bbSessionMap.get(projectRoot); | ||
88 | |||
89 | if (bbs == null) { | ||
90 | bbs = new BBSession(getShellSession(projectInfo, out, monitor), projectRoot); | ||
91 | bbSessionMap.put(projectRoot, bbs); | ||
92 | } | ||
93 | |||
94 | return bbs; | ||
95 | } | ||
96 | |||
97 | /** | ||
98 | * Get or create a BitBake session passing in ProjectInfo | ||
99 | * @param pinfo | ||
100 | * @return | ||
101 | * @throws IOException | ||
102 | */ | ||
103 | public static BBSession getBBSession(ProjectInfo projectInfo, IProgressMonitor monitor) throws Exception { | ||
104 | URI projectRoot = projectInfo.getOriginalURI(); | ||
105 | if (bbSessionMap == null) { | ||
106 | bbSessionMap = new Hashtable(); | ||
107 | } | ||
108 | |||
109 | BBSession bbs = (BBSession) bbSessionMap.get(projectRoot); | ||
110 | |||
111 | if (bbs == null || bbs.getShell() == null) { | ||
112 | bbs = new BBSession(getShellSession(projectInfo, null, monitor), projectRoot); | ||
113 | bbSessionMap.put(projectRoot, bbs); | ||
114 | } | ||
115 | |||
116 | return bbs; | ||
117 | } | ||
118 | |||
119 | /** | ||
120 | * Returns the shared instance | ||
121 | * | ||
122 | * @return the shared instance | ||
123 | */ | ||
124 | public static Activator getDefault() { | ||
125 | return plugin; | ||
126 | } | ||
127 | |||
128 | /** | ||
129 | * Returns an image descriptor for the image file at the given | ||
130 | * plug-in relative path | ||
131 | * | ||
132 | * @param path the path | ||
133 | * @return the image descriptor | ||
134 | */ | ||
135 | public static ImageDescriptor getImageDescriptor(String path) { | ||
136 | return imageDescriptorFromPlugin(PLUGIN_ID, path); | ||
137 | } | ||
138 | |||
139 | public static ProjectInfo getProjInfo(URI location) throws CoreException, InvocationTargetException, InterruptedException { | ||
140 | if (projInfoMap == null) { | ||
141 | projInfoMap = new Hashtable<URI, ProjectInfo>(); | ||
142 | } | ||
143 | if (location != null) { | ||
144 | ProjectInfo pi = projInfoMap.get(location); | ||
145 | if (pi == null) { | ||
146 | pi = new ProjectInfo(); | ||
147 | pi.setLocationURI(location); | ||
148 | try { | ||
149 | pi.setInitScriptPath(ProjectInfoHelper.getInitScriptPath(location)); | ||
150 | } catch (IOException e) { | ||
151 | throw new InvocationTargetException(e); | ||
152 | } | ||
153 | |||
154 | projInfoMap.put(location, pi); | ||
155 | } | ||
156 | return pi; | ||
157 | } | ||
158 | return null; | ||
159 | } | ||
160 | |||
161 | public static void notifyAllBBSession(IResource[] added, IResource[] removed, IResource[] changed) { | ||
162 | Iterator iter; | ||
163 | if(bbRecipeMap != null) { | ||
164 | iter = bbRecipeMap.values().iterator(); | ||
165 | while(iter.hasNext()) { | ||
166 | BBRecipe p = (BBRecipe)iter.next(); | ||
167 | p.changeNotified(added, removed, changed); | ||
168 | } | ||
169 | } | ||
170 | |||
171 | if(bbSessionMap != null) { | ||
172 | iter= bbSessionMap.values().iterator(); | ||
173 | while(iter.hasNext()) { | ||
174 | BBSession p = (BBSession)iter.next(); | ||
175 | p.changeNotified(added, removed, changed); | ||
176 | } | ||
177 | } | ||
178 | } | ||
179 | |||
180 | /** | ||
181 | * @param absolutePath | ||
182 | * @return a cached shell session for a given project root. | ||
183 | * @throws IOException | ||
184 | */ | ||
185 | private static ShellSession getShellSession(ProjectInfo projInfo, Writer out, IProgressMonitor monitor) throws IOException { | ||
186 | URI absolutePath = projInfo.getOriginalURI(); | ||
187 | if (shellMap == null) { | ||
188 | shellMap = new Hashtable(); | ||
189 | } | ||
190 | |||
191 | ShellSession ss = (ShellSession) shellMap.get(absolutePath); | ||
192 | |||
193 | if (ss == null && RemoteHelper.isInitialized(projInfo.getOriginalURI())) { | ||
194 | IHostFile remoteHostFile = RemoteHelper.getRemoteHostFile(projInfo.getConnection(), absolutePath.getPath(), monitor); | ||
195 | ss = new ShellSession(projInfo, remoteHostFile, ProjectInfoHelper.getInitScriptPath(absolutePath)); | ||
196 | } | ||
197 | |||
198 | return ss; | ||
199 | } | ||
200 | |||
201 | public static void putProjInfo(URI location, ProjectInfo pinfo) { | ||
202 | if (projInfoMap == null) { | ||
203 | projInfoMap = new Hashtable(); | ||
204 | } | ||
205 | |||
206 | |||
207 | |||
208 | projInfoMap.put(location, pinfo); | ||
209 | } | ||
210 | |||
211 | /** | ||
212 | * The constructor | ||
213 | */ | ||
214 | public Activator() { | ||
215 | } | ||
216 | |||
217 | /* | ||
218 | * (non-Javadoc) | ||
219 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) | ||
220 | */ | ||
221 | @Override | ||
222 | public void start(BundleContext context) throws Exception { | ||
223 | super.start(context); | ||
224 | plugin = this; | ||
225 | ResourcesPlugin.getWorkspace().addResourceChangeListener( | ||
226 | listener, IResourceChangeEvent.POST_CHANGE); | ||
227 | } | ||
228 | |||
229 | /* | ||
230 | * (non-Javadoc) | ||
231 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) | ||
232 | */ | ||
233 | @Override | ||
234 | public void stop(BundleContext context) throws Exception { | ||
235 | ResourcesPlugin.getWorkspace().removeResourceChangeListener( | ||
236 | listener); | ||
237 | plugin = null; | ||
238 | super.stop(context); | ||
239 | } | ||
240 | |||
241 | /** | ||
242 | * Reset a configuration | ||
243 | * @param path | ||
244 | */ | ||
245 | public static void resetBBSession(String path) { | ||
246 | shellMap.remove(path); | ||
247 | bbSessionMap.remove(path); | ||
248 | } | ||
249 | |||
250 | protected void initializeImageRegistry(ImageRegistry reg) { | ||
251 | reg.put(IMAGE_VARIABLE, Activator.getImageDescriptor("icons/variable.gif")); | ||
252 | reg.put(IMAGE_FUNCTION, Activator.getImageDescriptor("icons/function.gif")); | ||
253 | } | ||
254 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/BCResourceChangeListener.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/BCResourceChangeListener.java new file mode 100644 index 0000000..8a2bfdd --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/BCResourceChangeListener.java | |||
@@ -0,0 +1,64 @@ | |||
1 | package org.yocto.bc.ui; | ||
2 | |||
3 | import java.util.HashSet; | ||
4 | |||
5 | import org.eclipse.core.resources.IFile; | ||
6 | import org.eclipse.core.resources.IProject; | ||
7 | import org.eclipse.core.resources.IResourceChangeEvent; | ||
8 | import org.eclipse.core.resources.IResourceChangeListener; | ||
9 | import org.eclipse.core.resources.IResource; | ||
10 | import org.eclipse.core.resources.IResourceDelta; | ||
11 | import org.eclipse.core.resources.IResourceDeltaVisitor; | ||
12 | import org.eclipse.core.runtime.*; | ||
13 | import org.yocto.bc.ui.builder.BitbakeCommanderNature; | ||
14 | |||
15 | public class BCResourceChangeListener implements IResourceChangeListener { | ||
16 | |||
17 | public void resourceChanged(IResourceChangeEvent event) { | ||
18 | final HashSet<IResource> removed = new HashSet<IResource>(); | ||
19 | final HashSet<IResource> changed = new HashSet<IResource>(); | ||
20 | switch (event.getType()) { | ||
21 | case IResourceChangeEvent.POST_CHANGE: | ||
22 | try { | ||
23 | event.getDelta().accept(new IResourceDeltaVisitor() { | ||
24 | public boolean visit(IResourceDelta delta) throws CoreException { | ||
25 | IResource res = delta.getResource(); | ||
26 | Boolean visit= true; | ||
27 | if (res instanceof IProject) { | ||
28 | visit = false; | ||
29 | try { | ||
30 | if(((IProject) res).isOpen() && | ||
31 | ((IProject) res).hasNature(BitbakeCommanderNature.NATURE_ID)){ | ||
32 | visit = true; | ||
33 | } | ||
34 | }catch (CoreException e) { | ||
35 | } | ||
36 | } | ||
37 | if (visit && (res instanceof IFile)) | ||
38 | { | ||
39 | switch (delta.getKind()) { | ||
40 | case IResourceDelta.REMOVED: | ||
41 | removed.add(res); | ||
42 | break; | ||
43 | case IResourceDelta.CHANGED: | ||
44 | changed.add(res); | ||
45 | break; | ||
46 | } | ||
47 | } | ||
48 | return visit; // visit the children | ||
49 | } | ||
50 | }); | ||
51 | //notify all the sessions | ||
52 | Activator.notifyAllBBSession(null, | ||
53 | removed.toArray(new IResource[removed.size()]), | ||
54 | changed.toArray(new IResource[changed.size()])); | ||
55 | |||
56 | }catch (CoreException e) { | ||
57 | e.printStackTrace(); | ||
58 | } | ||
59 | break; | ||
60 | default: | ||
61 | break; | ||
62 | } | ||
63 | } | ||
64 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobAction.java new file mode 100644 index 0000000..e92fac0 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobAction.java | |||
@@ -0,0 +1,84 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2011 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.actions; | ||
12 | |||
13 | import org.eclipse.ui.PlatformUI; | ||
14 | import org.eclipse.ui.IWorkbench; | ||
15 | import org.eclipse.ui.IWorkbenchPage; | ||
16 | import org.eclipse.ui.IWorkbenchWindow; | ||
17 | |||
18 | import org.eclipse.core.resources.IProject; | ||
19 | import org.eclipse.core.resources.IResource; | ||
20 | import org.eclipse.core.runtime.IAdaptable; | ||
21 | import org.eclipse.jface.action.IAction; | ||
22 | import org.eclipse.jface.viewers.ISelection; | ||
23 | import org.eclipse.jface.viewers.IStructuredSelection; | ||
24 | |||
25 | import org.eclipse.swt.widgets.Shell; | ||
26 | |||
27 | import org.yocto.bc.ui.builder.BitbakeCommanderNature; | ||
28 | |||
29 | |||
30 | public class LaunchHobAction { | ||
31 | private static final String DIALOG_TITLE = "Launch HOB"; | ||
32 | |||
33 | public void run(IAction action) { | ||
34 | IResource resource = getSelectedResource(); | ||
35 | if (resource == null) | ||
36 | return; | ||
37 | |||
38 | IProject project = resource.getProject(); | ||
39 | LaunchHobDialog hobDialog = new LaunchHobDialog(new Shell(), DIALOG_TITLE, project); | ||
40 | hobDialog.open(); | ||
41 | String buildDir = hobDialog.getBuildDir(); | ||
42 | |||
43 | if (buildDir != null) { | ||
44 | try { | ||
45 | BitbakeCommanderNature.launchHob(project,buildDir); | ||
46 | } catch (Exception e){ | ||
47 | System.out.println(e.getMessage()); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | } | ||
52 | |||
53 | public void dispose() { | ||
54 | |||
55 | } | ||
56 | |||
57 | private IResource getSelectedResource() { | ||
58 | IWorkbench iworkbench = PlatformUI.getWorkbench(); | ||
59 | if (iworkbench == null){ | ||
60 | return null; | ||
61 | } | ||
62 | IWorkbenchWindow iworkbenchwindow = iworkbench.getActiveWorkbenchWindow(); | ||
63 | if (iworkbenchwindow == null) { | ||
64 | return null; | ||
65 | } | ||
66 | IWorkbenchPage iworkbenchpage = iworkbenchwindow.getActivePage(); | ||
67 | if (iworkbenchpage == null) { | ||
68 | return null; | ||
69 | } | ||
70 | ISelection sel = iworkbenchpage.getSelection(); | ||
71 | |||
72 | if (!(sel instanceof IStructuredSelection)) | ||
73 | return null; | ||
74 | IStructuredSelection ss = (IStructuredSelection) sel; | ||
75 | Object element = ss.getFirstElement(); | ||
76 | if (element instanceof IResource) | ||
77 | return (IResource) element; | ||
78 | if (!(element instanceof IAdaptable)) | ||
79 | return null; | ||
80 | IAdaptable adaptable = (IAdaptable)element; | ||
81 | Object adapter = adaptable.getAdapter(IResource.class); | ||
82 | return (IResource) adapter; | ||
83 | } | ||
84 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobDialog.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobDialog.java new file mode 100644 index 0000000..861360d --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobDialog.java | |||
@@ -0,0 +1,328 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2011 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.actions; | ||
12 | |||
13 | import java.util.Map; | ||
14 | import java.util.Iterator; | ||
15 | import java.util.Map.Entry; | ||
16 | import java.util.ArrayList; | ||
17 | import java.util.HashMap; | ||
18 | import java.util.HashSet; | ||
19 | import java.io.File; | ||
20 | import java.io.IOException; | ||
21 | |||
22 | import org.eclipse.jface.dialogs.Dialog; | ||
23 | import org.eclipse.jface.dialogs.IDialogConstants; | ||
24 | |||
25 | import org.eclipse.swt.SWT; | ||
26 | import org.eclipse.swt.events.ModifyEvent; | ||
27 | import org.eclipse.swt.events.ModifyListener; | ||
28 | import org.eclipse.swt.events.SelectionAdapter; | ||
29 | import org.eclipse.swt.events.SelectionEvent; | ||
30 | import org.eclipse.swt.events.SelectionListener; | ||
31 | import org.eclipse.swt.layout.GridData; | ||
32 | import org.eclipse.swt.layout.GridLayout; | ||
33 | import org.eclipse.swt.widgets.Button; | ||
34 | import org.eclipse.swt.widgets.Combo; | ||
35 | import org.eclipse.swt.widgets.Composite; | ||
36 | import org.eclipse.swt.widgets.Control; | ||
37 | import org.eclipse.swt.widgets.DirectoryDialog; | ||
38 | import org.eclipse.swt.widgets.Display; | ||
39 | import org.eclipse.swt.widgets.Label; | ||
40 | import org.eclipse.swt.widgets.MessageBox; | ||
41 | import org.eclipse.swt.widgets.Shell; | ||
42 | import org.eclipse.swt.widgets.Widget; | ||
43 | |||
44 | import org.eclipse.core.resources.IProject; | ||
45 | import org.eclipse.core.resources.IProjectDescription; | ||
46 | import org.eclipse.core.resources.ICommand; | ||
47 | |||
48 | import org.yocto.bc.ui.builder.BitbakeBuilder; | ||
49 | import org.yocto.bc.ui.builder.BitbakeCommanderNature; | ||
50 | |||
51 | public class LaunchHobDialog extends Dialog { | ||
52 | private String title; | ||
53 | private Button buildButton; | ||
54 | private SelectionListener fSelectionListener; | ||
55 | private ModifyListener fModifyListener; | ||
56 | private Combo build_dir_combo; | ||
57 | |||
58 | private IProject project; | ||
59 | private Shell shell; | ||
60 | private String build_dir; | ||
61 | |||
62 | public LaunchHobDialog(Shell parentShell, String dialogTitle, IProject project) { | ||
63 | super(parentShell); | ||
64 | this.shell = parentShell; | ||
65 | this.project = project; | ||
66 | this.title = dialogTitle; | ||
67 | setShellStyle(getShellStyle() | SWT.RESIZE); | ||
68 | |||
69 | fSelectionListener= new SelectionListener() { | ||
70 | public void widgetDefaultSelected(SelectionEvent e) {} | ||
71 | |||
72 | public void widgetSelected(SelectionEvent e) { | ||
73 | controlChanged(e.widget); | ||
74 | } | ||
75 | }; | ||
76 | |||
77 | fModifyListener= new ModifyListener() { | ||
78 | public void modifyText(ModifyEvent e) { | ||
79 | controlModified(e.widget); | ||
80 | } | ||
81 | }; | ||
82 | |||
83 | } | ||
84 | |||
85 | public String getBuildDir() { | ||
86 | return build_dir; | ||
87 | } | ||
88 | @Override | ||
89 | protected Control createDialogArea(Composite parent) { | ||
90 | final Composite result = (Composite) super.createDialogArea(parent); | ||
91 | |||
92 | try { | ||
93 | createComposite(result); | ||
94 | } catch (Exception e) { | ||
95 | // TODO Auto-generated catch block | ||
96 | System.out.println("Have you ever set the project specific Yocto Settings?"); | ||
97 | System.out.println(e.getMessage()); | ||
98 | } | ||
99 | |||
100 | return result; | ||
101 | } | ||
102 | |||
103 | private void createComposite(Composite composite) throws Exception{ | ||
104 | Label root_label, sysroot_label; | ||
105 | |||
106 | GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); | ||
107 | GridLayout layout = new GridLayout(2, false); | ||
108 | composite.setLayout(layout); | ||
109 | |||
110 | gd= new GridData(SWT.FILL, SWT.CENTER, true, false); | ||
111 | gd.horizontalSpan= 2; | ||
112 | composite.setLayoutData(gd); | ||
113 | |||
114 | Label build_dir_label = new Label(composite, SWT.NONE); | ||
115 | build_dir_label.setText("Bitbake build directory: "); | ||
116 | Composite textContainer = new Composite(composite, SWT.NONE); | ||
117 | textContainer.setLayout(new GridLayout(2, false)); | ||
118 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
119 | |||
120 | build_dir_combo = new Combo(textContainer, SWT.DROP_DOWN); | ||
121 | build_dir_combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); | ||
122 | initializeBuildCombo(); | ||
123 | |||
124 | Button buildButton = addDirSelectButton(textContainer, build_dir_combo); | ||
125 | |||
126 | //we add the listener at the end for avoiding the useless event trigger when control | ||
127 | //changed or modified. | ||
128 | buildButton.addSelectionListener(fSelectionListener); | ||
129 | build_dir_combo.addModifyListener(fModifyListener); | ||
130 | } | ||
131 | |||
132 | private Button addDirSelectButton(final Composite parent, final Combo combo) { | ||
133 | Button button = new Button(parent, SWT.PUSH | SWT.LEAD); | ||
134 | button.setText("Browse"); | ||
135 | button.addSelectionListener(new SelectionAdapter() { | ||
136 | @Override | ||
137 | public void widgetSelected(SelectionEvent event) { | ||
138 | String dirName = new DirectoryDialog(parent.getShell()).open(); | ||
139 | |||
140 | if (dirName != null) { | ||
141 | combo.add(dirName); | ||
142 | combo.setText(dirName); | ||
143 | } | ||
144 | } | ||
145 | }); | ||
146 | return button; | ||
147 | } | ||
148 | @Override | ||
149 | protected void configureShell(Shell newShell) { | ||
150 | super.configureShell(newShell); | ||
151 | newShell.setText(title); | ||
152 | } | ||
153 | |||
154 | protected void buttonPressed(int buttonId) { | ||
155 | if (buttonId == IDialogConstants.OK_ID) { | ||
156 | try { | ||
157 | build_dir = build_dir_combo.getText().toString(); | ||
158 | updateBuildSpec(build_dir); | ||
159 | super.buttonPressed(buttonId); | ||
160 | } catch (Exception e) { | ||
161 | // TODO Auto-generated catch block | ||
162 | System.out.println(e.getMessage()); | ||
163 | } | ||
164 | } | ||
165 | else if (buttonId == IDialogConstants.CANCEL_ID) | ||
166 | { | ||
167 | super.buttonPressed(buttonId); | ||
168 | } | ||
169 | } | ||
170 | |||
171 | private boolean validateInput() { | ||
172 | boolean valid = false; | ||
173 | String build_dir = build_dir_combo.getText().toString(); | ||
174 | if ((build_dir == null) || build_dir.isEmpty()) { | ||
175 | Display display = Display.getCurrent(); | ||
176 | Shell shell = new Shell(display); | ||
177 | MessageBox msgBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK); | ||
178 | msgBox.setText("Yocto Configuration Error"); | ||
179 | msgBox.setMessage("The specified build directory is empty!"); | ||
180 | msgBox.open(); | ||
181 | if (shell != null) | ||
182 | shell.dispose(); | ||
183 | return valid; | ||
184 | } | ||
185 | String project_path = project.getLocation().toString(); | ||
186 | File project_dir_file = new File(project_path); | ||
187 | File build_dir_file = new File(build_dir); | ||
188 | try { | ||
189 | if (isSubDirectory(project_dir_file, build_dir_file)) { | ||
190 | Display display = Display.getCurrent(); | ||
191 | Shell shell = new Shell(display); | ||
192 | MessageBox msgBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK); | ||
193 | msgBox.setText("Yocto Configuration Error"); | ||
194 | msgBox.setMessage("The specified build directory is a sub-dir of project path: " + project_path); | ||
195 | msgBox.open(); | ||
196 | if (shell != null) | ||
197 | shell.dispose(); | ||
198 | } else | ||
199 | valid = true; | ||
200 | } catch (IOException e) { | ||
201 | System.out.println(e.getMessage()); | ||
202 | } | ||
203 | return valid; | ||
204 | } | ||
205 | |||
206 | private boolean isSubDirectory(File baseDir, File subDir) throws IOException { | ||
207 | baseDir = baseDir.getCanonicalFile(); | ||
208 | subDir = subDir.getCanonicalFile(); | ||
209 | |||
210 | File parentFile = subDir; | ||
211 | while (parentFile != null) { | ||
212 | if (baseDir.equals(parentFile)) { | ||
213 | return true; | ||
214 | } | ||
215 | parentFile = parentFile.getParentFile(); | ||
216 | } | ||
217 | return false; | ||
218 | } | ||
219 | |||
220 | private void controlChanged(Widget widget) { | ||
221 | |||
222 | if (widget == buildButton) | ||
223 | { | ||
224 | } | ||
225 | } | ||
226 | |||
227 | private void controlModified(Widget widget) { | ||
228 | if (widget == build_dir_combo) | ||
229 | { | ||
230 | |||
231 | } | ||
232 | } | ||
233 | |||
234 | private void initializeBuildCombo() | ||
235 | { | ||
236 | ArrayList<String> items = new ArrayList<String> (); | ||
237 | |||
238 | try { | ||
239 | IProjectDescription desc = project.getDescription(); | ||
240 | |||
241 | ICommand[] buildSpec = desc.getBuildSpec(); | ||
242 | if ((buildSpec != null) && (buildSpec.length != 0)) | ||
243 | { | ||
244 | for (int i = 0; i < buildSpec.length; i++) { | ||
245 | ICommand cmd = buildSpec[i]; | ||
246 | if (cmd.getBuilderName().equalsIgnoreCase(BitbakeBuilder.HOB_BUILD_ID)) | ||
247 | { | ||
248 | Map<String, String> args = cmd.getArguments(); | ||
249 | if ((args != null) && !args.isEmpty()) | ||
250 | { | ||
251 | Iterator entries = args.entrySet().iterator(); | ||
252 | while (entries.hasNext()) { | ||
253 | Entry thisEntry = (Entry) entries.next(); | ||
254 | String key = (String)thisEntry.getKey(); | ||
255 | if (key.equalsIgnoreCase(BitbakeCommanderNature.BUILD_DIR_KEY)) { | ||
256 | build_dir_combo.removeAll(); | ||
257 | build_dir_combo.setItems(getValues((String)thisEntry.getValue())); | ||
258 | } | ||
259 | } | ||
260 | } | ||
261 | } | ||
262 | } | ||
263 | } | ||
264 | } catch (Exception e) { | ||
265 | System.out.println(e.getMessage()); | ||
266 | } | ||
267 | } | ||
268 | |||
269 | private String[] getValues(String value) { | ||
270 | |||
271 | if ((value != null) && !value.isEmpty()) | ||
272 | { | ||
273 | String[] pieces = value.split(","); | ||
274 | for (int i = 0; i < pieces.length; i++) | ||
275 | { | ||
276 | int start = pieces[i].indexOf("["); | ||
277 | if (start >= 0) | ||
278 | pieces[i] = pieces[i].substring(start+1); | ||
279 | int end = pieces[i].indexOf("]"); | ||
280 | if (end >= 0) | ||
281 | pieces[i] = pieces[i].substring(0, end); | ||
282 | pieces[i] = pieces[i].trim(); | ||
283 | } | ||
284 | return pieces; | ||
285 | } | ||
286 | return null; | ||
287 | } | ||
288 | |||
289 | private void updateBuildSpec(String build_dir) | ||
290 | { | ||
291 | try { | ||
292 | String[] items = build_dir_combo.getItems(); | ||
293 | HashSet values = new HashSet(); | ||
294 | Map<String, String> args = new HashMap<String, String>(); | ||
295 | values.add(build_dir); | ||
296 | for (int i = 0; i < items.length; i++) { | ||
297 | values.add(items[i]); | ||
298 | } | ||
299 | args.put(BitbakeCommanderNature.BUILD_DIR_KEY, values.toString()); | ||
300 | IProjectDescription desc = project.getDescription(); | ||
301 | ICommand[] buildSpec = desc.getBuildSpec(); | ||
302 | boolean found = false; | ||
303 | if ((buildSpec != null) || (buildSpec.length != 0)) { | ||
304 | for (int i = 0; i < buildSpec.length; i++) { | ||
305 | ICommand cmd = buildSpec[i]; | ||
306 | if (cmd.getBuilderName().equalsIgnoreCase(BitbakeBuilder.HOB_BUILD_ID)) { | ||
307 | cmd.setArguments(args); | ||
308 | desc.setBuildSpec(buildSpec); | ||
309 | found = true; | ||
310 | break; | ||
311 | } | ||
312 | } | ||
313 | } | ||
314 | if (!found) { | ||
315 | ICommand[] newBuildSpec = new ICommand[buildSpec.length + 1]; | ||
316 | System.arraycopy(buildSpec, 0, newBuildSpec, 0, buildSpec.length); | ||
317 | ICommand cmd = desc.newCommand(); | ||
318 | cmd.setBuilderName(BitbakeBuilder.HOB_BUILD_ID); | ||
319 | cmd.setArguments(args); | ||
320 | newBuildSpec[newBuildSpec.length - 1] = cmd; | ||
321 | desc.setBuildSpec(newBuildSpec); | ||
322 | } | ||
323 | project.setDescription(desc, null); | ||
324 | } catch (Exception e) { | ||
325 | System.out.println(e.getMessage()); | ||
326 | } | ||
327 | } | ||
328 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobHandler.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobHandler.java new file mode 100644 index 0000000..002075a --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchHobHandler.java | |||
@@ -0,0 +1,50 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2011 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.actions; | ||
12 | |||
13 | import org.eclipse.core.commands.ExecutionEvent; | ||
14 | import org.eclipse.core.commands.ExecutionException; | ||
15 | import org.eclipse.core.commands.IHandlerListener; | ||
16 | import org.eclipse.core.commands.IHandler; | ||
17 | |||
18 | public class LaunchHobHandler implements IHandler { | ||
19 | |||
20 | public Object execute(ExecutionEvent event) throws ExecutionException { | ||
21 | LaunchHobAction a = new LaunchHobAction(); | ||
22 | a.run(null); | ||
23 | return null; | ||
24 | } | ||
25 | |||
26 | public void addHandlerListener(IHandlerListener handlerListener) { | ||
27 | // TODO Auto-generated method stub | ||
28 | |||
29 | } | ||
30 | |||
31 | public void dispose() { | ||
32 | // TODO Auto-generated method stub | ||
33 | |||
34 | } | ||
35 | |||
36 | public boolean isEnabled() { | ||
37 | // TODO Auto-generated method stub | ||
38 | return true; | ||
39 | } | ||
40 | |||
41 | public boolean isHandled() { | ||
42 | // TODO Auto-generated method stub | ||
43 | return true; | ||
44 | } | ||
45 | |||
46 | public void removeHandlerListener(IHandlerListener handlerListener) { | ||
47 | // TODO Auto-generated method stub | ||
48 | |||
49 | } | ||
50 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewBitBakeProjectWizardAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewBitBakeProjectWizardAction.java new file mode 100644 index 0000000..b8b3144 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewBitBakeProjectWizardAction.java | |||
@@ -0,0 +1,48 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.actions; | ||
12 | |||
13 | import org.eclipse.jface.action.IAction; | ||
14 | import org.eclipse.jface.viewers.ISelection; | ||
15 | import org.eclipse.jface.viewers.IStructuredSelection; | ||
16 | import org.eclipse.jface.wizard.WizardDialog; | ||
17 | import org.eclipse.ui.IWorkbenchWindow; | ||
18 | import org.eclipse.ui.IWorkbenchWindowActionDelegate; | ||
19 | |||
20 | import org.yocto.bc.ui.wizards.importProject.ImportYoctoProjectWizard; | ||
21 | |||
22 | public class LaunchNewBitBakeProjectWizardAction implements IWorkbenchWindowActionDelegate { | ||
23 | |||
24 | private IWorkbenchWindow window; | ||
25 | private IStructuredSelection selection; | ||
26 | |||
27 | public void dispose() { | ||
28 | } | ||
29 | |||
30 | public void init(IWorkbenchWindow window) { | ||
31 | this.window = window; | ||
32 | } | ||
33 | |||
34 | public void run(IAction action) { | ||
35 | ImportYoctoProjectWizard wizard = new ImportYoctoProjectWizard(); | ||
36 | |||
37 | wizard.init(window.getWorkbench(), selection); | ||
38 | WizardDialog wd = new WizardDialog(window.getShell(), wizard); | ||
39 | wd.create(); | ||
40 | wd.open(); | ||
41 | } | ||
42 | |||
43 | public void selectionChanged(IAction action, ISelection selection) { | ||
44 | if (selection instanceof IStructuredSelection) { | ||
45 | this.selection = (IStructuredSelection) selection; | ||
46 | } | ||
47 | } | ||
48 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewRecipeWizardAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewRecipeWizardAction.java new file mode 100644 index 0000000..d30d37b --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchNewRecipeWizardAction.java | |||
@@ -0,0 +1,48 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.actions; | ||
12 | |||
13 | import org.eclipse.jface.action.IAction; | ||
14 | import org.eclipse.jface.viewers.ISelection; | ||
15 | import org.eclipse.jface.viewers.IStructuredSelection; | ||
16 | import org.eclipse.jface.wizard.WizardDialog; | ||
17 | import org.eclipse.ui.IWorkbenchWindow; | ||
18 | import org.eclipse.ui.IWorkbenchWindowActionDelegate; | ||
19 | |||
20 | import org.yocto.bc.ui.wizards.NewBitBakeFileRecipeWizard; | ||
21 | |||
22 | public class LaunchNewRecipeWizardAction implements IWorkbenchWindowActionDelegate { | ||
23 | |||
24 | private IWorkbenchWindow window; | ||
25 | private IStructuredSelection selection; | ||
26 | |||
27 | public void dispose() { | ||
28 | } | ||
29 | |||
30 | public void init(IWorkbenchWindow window) { | ||
31 | this.window = window; | ||
32 | } | ||
33 | |||
34 | public void run(IAction action) { | ||
35 | NewBitBakeFileRecipeWizard wizard = new NewBitBakeFileRecipeWizard(); | ||
36 | |||
37 | wizard.init(window.getWorkbench(), selection); | ||
38 | WizardDialog wd = new WizardDialog(window.getShell(), wizard); | ||
39 | wd.create(); | ||
40 | wd.open(); | ||
41 | } | ||
42 | |||
43 | public void selectionChanged(IAction action, ISelection selection) { | ||
44 | if (selection instanceof IStructuredSelection) { | ||
45 | this.selection = (IStructuredSelection) selection; | ||
46 | } | ||
47 | } | ||
48 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchVariableWizardAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchVariableWizardAction.java new file mode 100644 index 0000000..3104564 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/actions/LaunchVariableWizardAction.java | |||
@@ -0,0 +1,89 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.actions; | ||
13 | |||
14 | import java.io.IOException; | ||
15 | import java.lang.reflect.InvocationTargetException; | ||
16 | import java.util.Map; | ||
17 | |||
18 | import org.eclipse.core.resources.IProject; | ||
19 | import org.eclipse.core.resources.IResource; | ||
20 | import org.eclipse.core.runtime.CoreException; | ||
21 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
22 | import org.eclipse.jface.action.IAction; | ||
23 | import org.eclipse.jface.viewers.ISelection; | ||
24 | import org.eclipse.jface.viewers.IStructuredSelection; | ||
25 | import org.eclipse.jface.wizard.WizardDialog; | ||
26 | import org.eclipse.ui.IWorkbenchWindow; | ||
27 | import org.eclipse.ui.IWorkbenchWindowActionDelegate; | ||
28 | import org.yocto.bc.ui.Activator; | ||
29 | import org.yocto.bc.ui.builder.BitbakeCommanderNature; | ||
30 | import org.yocto.bc.ui.model.ProjectInfo; | ||
31 | import org.yocto.bc.ui.wizards.variable.VariableWizard; | ||
32 | |||
33 | /** | ||
34 | * Action to launch the Variable Wizard. | ||
35 | * @author kgilmer | ||
36 | * | ||
37 | */ | ||
38 | public class LaunchVariableWizardAction implements IWorkbenchWindowActionDelegate { | ||
39 | |||
40 | private IWorkbenchWindow window; | ||
41 | private Map session; | ||
42 | |||
43 | public void dispose() { | ||
44 | } | ||
45 | |||
46 | public void init(IWorkbenchWindow window) { | ||
47 | this.window = window; | ||
48 | } | ||
49 | |||
50 | public void run(IAction action) { | ||
51 | VariableWizard wizard = new VariableWizard(session); | ||
52 | |||
53 | WizardDialog wd = new WizardDialog(window.getShell(), wizard); | ||
54 | wd.create(); | ||
55 | wd.open(); | ||
56 | } | ||
57 | |||
58 | public void selectionChanged(IAction action, ISelection selection) { | ||
59 | session = null; | ||
60 | |||
61 | if (selection instanceof IStructuredSelection) { | ||
62 | Object element = ((IStructuredSelection)selection).getFirstElement(); | ||
63 | |||
64 | if (element instanceof IResource) { | ||
65 | IProject p = ((IResource)element).getProject(); | ||
66 | |||
67 | try { | ||
68 | if (p.isAccessible() && p.isOpen() && p.hasNature(BitbakeCommanderNature.NATURE_ID)) { | ||
69 | IProject proj = ((IResource)element).getProject(); | ||
70 | ProjectInfo projInfo = Activator.getProjInfo(proj.getLocationURI()); | ||
71 | session = Activator.getBBSession(projInfo, new NullProgressMonitor()); | ||
72 | } | ||
73 | } catch (IOException e) { | ||
74 | e.printStackTrace(); | ||
75 | } catch (CoreException e) { | ||
76 | e.printStackTrace(); | ||
77 | } catch (InvocationTargetException e) { | ||
78 | e.printStackTrace(); | ||
79 | } catch (InterruptedException e) { | ||
80 | e.printStackTrace(); | ||
81 | } catch (Exception e) { | ||
82 | e.printStackTrace(); | ||
83 | } | ||
84 | } | ||
85 | } | ||
86 | |||
87 | action.setEnabled(session != null); | ||
88 | } | ||
89 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeBuilder.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeBuilder.java new file mode 100644 index 0000000..3705d9b --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeBuilder.java | |||
@@ -0,0 +1,177 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.builder; | ||
12 | |||
13 | import java.util.Map; | ||
14 | |||
15 | import javax.xml.parsers.ParserConfigurationException; | ||
16 | import javax.xml.parsers.SAXParser; | ||
17 | import javax.xml.parsers.SAXParserFactory; | ||
18 | |||
19 | import org.eclipse.core.resources.IFile; | ||
20 | import org.eclipse.core.resources.IMarker; | ||
21 | import org.eclipse.core.resources.IProject; | ||
22 | import org.eclipse.core.resources.IResource; | ||
23 | import org.eclipse.core.resources.IResourceDelta; | ||
24 | import org.eclipse.core.resources.IResourceDeltaVisitor; | ||
25 | import org.eclipse.core.resources.IncrementalProjectBuilder; | ||
26 | import org.eclipse.core.runtime.CoreException; | ||
27 | import org.eclipse.core.runtime.IProgressMonitor; | ||
28 | import org.xml.sax.SAXException; | ||
29 | |||
30 | public class BitbakeBuilder extends IncrementalProjectBuilder { | ||
31 | |||
32 | class SampleDeltaVisitor implements IResourceDeltaVisitor { | ||
33 | /* | ||
34 | * (non-Javadoc) | ||
35 | * | ||
36 | * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta) | ||
37 | */ | ||
38 | public boolean visit(IResourceDelta delta) throws CoreException { | ||
39 | IResource resource = delta.getResource(); | ||
40 | switch (delta.getKind()) { | ||
41 | case IResourceDelta.ADDED: | ||
42 | // handle added resource | ||
43 | //checkXML(resource); | ||
44 | break; | ||
45 | case IResourceDelta.REMOVED: | ||
46 | // handle removed resource | ||
47 | break; | ||
48 | case IResourceDelta.CHANGED: | ||
49 | // handle changed resource | ||
50 | //checkXML(resource); | ||
51 | break; | ||
52 | } | ||
53 | //return true to continue visiting children. | ||
54 | return true; | ||
55 | } | ||
56 | } | ||
57 | /* | ||
58 | class SampleResourceVisitor implements IResourceVisitor { | ||
59 | public boolean visit(IResource resource) { | ||
60 | |||
61 | return true; | ||
62 | } | ||
63 | } | ||
64 | */ | ||
65 | /* class XMLErrorHandler extends DefaultHandler { | ||
66 | |||
67 | private IFile file; | ||
68 | |||
69 | public XMLErrorHandler(IFile file) { | ||
70 | this.file = file; | ||
71 | } | ||
72 | |||
73 | private void addMarker(SAXParseException e, int severity) { | ||
74 | BitbakeBuilder.this.addMarker(file, e.getMessage(), e | ||
75 | .getLineNumber(), severity); | ||
76 | } | ||
77 | |||
78 | @Override | ||
79 | public void error(SAXParseException exception) throws SAXException { | ||
80 | addMarker(exception, IMarker.SEVERITY_ERROR); | ||
81 | } | ||
82 | |||
83 | @Override | ||
84 | public void fatalError(SAXParseException exception) throws SAXException { | ||
85 | addMarker(exception, IMarker.SEVERITY_ERROR); | ||
86 | } | ||
87 | |||
88 | @Override | ||
89 | public void warning(SAXParseException exception) throws SAXException { | ||
90 | addMarker(exception, IMarker.SEVERITY_WARNING); | ||
91 | } | ||
92 | } | ||
93 | */ | ||
94 | public static final String BUILDER_ID = "org.yocto.bc.ui.builder.BitbakeBuilder"; | ||
95 | public static final String HOB_BUILD_ID = "org.yocto.bc.ui.builder.HOB"; | ||
96 | |||
97 | private static final String MARKER_TYPE = "org.yocto.bc.ui.xmlProblem"; | ||
98 | |||
99 | private SAXParserFactory parserFactory; | ||
100 | |||
101 | private void addMarker(IFile file, String message, int lineNumber, | ||
102 | int severity) { | ||
103 | try { | ||
104 | IMarker marker = file.createMarker(MARKER_TYPE); | ||
105 | marker.setAttribute(IMarker.MESSAGE, message); | ||
106 | marker.setAttribute(IMarker.SEVERITY, severity); | ||
107 | if (lineNumber == -1) { | ||
108 | lineNumber = 1; | ||
109 | } | ||
110 | marker.setAttribute(IMarker.LINE_NUMBER, lineNumber); | ||
111 | } catch (CoreException e) { | ||
112 | } | ||
113 | } | ||
114 | |||
115 | /* | ||
116 | * (non-Javadoc) | ||
117 | * | ||
118 | * @see org.eclipse.core.internal.events.InternalBuilder#build(int, | ||
119 | * java.util.Map, org.eclipse.core.runtime.IProgressMonitor) | ||
120 | */ | ||
121 | @Override | ||
122 | protected IProject[] build(int kind, Map args, IProgressMonitor monitor) | ||
123 | throws CoreException { | ||
124 | if (kind == FULL_BUILD) { | ||
125 | fullBuild(monitor); | ||
126 | } else { | ||
127 | IResourceDelta delta = getDelta(getProject()); | ||
128 | if (delta == null) { | ||
129 | fullBuild(monitor); | ||
130 | } else { | ||
131 | incrementalBuild(delta, monitor); | ||
132 | } | ||
133 | } | ||
134 | return null; | ||
135 | } | ||
136 | |||
137 | /*void checkXML(IResource resource) { | ||
138 | if (resource instanceof IFile && resource.getName().endsWith(".xml")) { | ||
139 | IFile file = (IFile) resource; | ||
140 | deleteMarkers(file); | ||
141 | XMLErrorHandler reporter = new XMLErrorHandler(file); | ||
142 | try { | ||
143 | getParser().parse(file.getContents(), reporter); | ||
144 | } catch (Exception e1) { | ||
145 | } | ||
146 | } | ||
147 | }*/ | ||
148 | |||
149 | private void deleteMarkers(IFile file) { | ||
150 | try { | ||
151 | file.deleteMarkers(MARKER_TYPE, false, IResource.DEPTH_ZERO); | ||
152 | } catch (CoreException ce) { | ||
153 | } | ||
154 | } | ||
155 | |||
156 | protected void fullBuild(final IProgressMonitor monitor) | ||
157 | throws CoreException { | ||
158 | /*try { | ||
159 | getProject().accept(new SampleResourceVisitor()); | ||
160 | } catch (CoreException e) { | ||
161 | }*/ | ||
162 | } | ||
163 | |||
164 | private SAXParser getParser() throws ParserConfigurationException, | ||
165 | SAXException { | ||
166 | if (parserFactory == null) { | ||
167 | parserFactory = SAXParserFactory.newInstance(); | ||
168 | } | ||
169 | return parserFactory.newSAXParser(); | ||
170 | } | ||
171 | |||
172 | protected void incrementalBuild(IResourceDelta delta, | ||
173 | IProgressMonitor monitor) throws CoreException { | ||
174 | // the visitor does the work. | ||
175 | delta.accept(new SampleDeltaVisitor()); | ||
176 | } | ||
177 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeCommanderNature.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeCommanderNature.java new file mode 100644 index 0000000..25f7894 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/BitbakeCommanderNature.java | |||
@@ -0,0 +1,119 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Jessica Zhang - extend to support HOB build | ||
11 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
12 | *******************************************************************************/ | ||
13 | package org.yocto.bc.ui.builder; | ||
14 | |||
15 | import java.util.ArrayList; | ||
16 | |||
17 | import org.eclipse.core.resources.ICommand; | ||
18 | import org.eclipse.core.resources.IProject; | ||
19 | import org.eclipse.core.resources.IProjectDescription; | ||
20 | import org.eclipse.core.resources.IProjectNature; | ||
21 | import org.eclipse.core.runtime.CoreException; | ||
22 | import org.eclipse.debug.core.DebugPlugin; | ||
23 | import org.eclipse.debug.core.ILaunchConfigurationType; | ||
24 | import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; | ||
25 | import org.eclipse.debug.core.ILaunchManager; | ||
26 | |||
27 | |||
28 | public class BitbakeCommanderNature implements IProjectNature { | ||
29 | |||
30 | /** | ||
31 | * ID of this project nature | ||
32 | */ | ||
33 | public static final String NATURE_ID = "org.yocto.bc.ui.builder.BitbakeCommanderNature"; | ||
34 | public static final String BUILD_DIR_KEY = "org.yocto.bc.ui.builder.BitbakeCommander.BuildDir"; | ||
35 | private IProject project; | ||
36 | |||
37 | public static void launchHob(IProject project, String buildDir) { | ||
38 | try { | ||
39 | ILaunchManager lManager = DebugPlugin.getDefault().getLaunchManager(); | ||
40 | ILaunchConfigurationType configType = | ||
41 | lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"); | ||
42 | ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(null, "hob"); | ||
43 | ArrayList<String> listValue = new ArrayList<String>(); | ||
44 | listValue.add(new String("org.eclipse.ui.externaltools.launchGroup")); | ||
45 | w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue); | ||
46 | w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", "/usr/bin/xterm"); | ||
47 | |||
48 | String init_script = project.getLocationURI().getPath() + "/oe-init-build-env "; | ||
49 | String argument = "-e \"source " + init_script + buildDir + ";hob";// + ";bash\""; | ||
50 | |||
51 | w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", argument); | ||
52 | w_copy.launch(ILaunchManager.RUN_MODE, null); | ||
53 | |||
54 | } catch (CoreException e) { | ||
55 | System.out.println(e.getMessage()); | ||
56 | } | ||
57 | } | ||
58 | /* | ||
59 | * (non-Javadoc) | ||
60 | * | ||
61 | * @see org.eclipse.core.resources.IProjectNature#configure() | ||
62 | */ | ||
63 | public void configure() throws CoreException { | ||
64 | IProjectDescription desc = project.getDescription(); | ||
65 | ICommand[] commands = desc.getBuildSpec(); | ||
66 | |||
67 | for (int i = 0; i < commands.length; ++i) { | ||
68 | if (commands[i].getBuilderName().equals(BitbakeBuilder.BUILDER_ID)) { | ||
69 | return; | ||
70 | } | ||
71 | } | ||
72 | |||
73 | ICommand[] newCommands = new ICommand[commands.length + 1]; | ||
74 | System.arraycopy(commands, 0, newCommands, 0, commands.length); | ||
75 | ICommand command = desc.newCommand(); | ||
76 | command.setBuilderName(BitbakeBuilder.BUILDER_ID); | ||
77 | newCommands[newCommands.length - 1] = command; | ||
78 | desc.setBuildSpec(newCommands); | ||
79 | project.setDescription(desc, null); | ||
80 | } | ||
81 | |||
82 | /* | ||
83 | * (non-Javadoc) | ||
84 | * | ||
85 | * @see org.eclipse.core.resources.IProjectNature#deconfigure() | ||
86 | */ | ||
87 | public void deconfigure() throws CoreException { | ||
88 | IProjectDescription description = getProject().getDescription(); | ||
89 | ICommand[] commands = description.getBuildSpec(); | ||
90 | for (int i = 0; i < commands.length; ++i) { | ||
91 | if (commands[i].getBuilderName().equals(BitbakeBuilder.BUILDER_ID)) { | ||
92 | ICommand[] newCommands = new ICommand[commands.length - 1]; | ||
93 | System.arraycopy(commands, 0, newCommands, 0, i); | ||
94 | System.arraycopy(commands, i + 1, newCommands, i, | ||
95 | commands.length - i - 1); | ||
96 | description.setBuildSpec(newCommands); | ||
97 | return; | ||
98 | } | ||
99 | } | ||
100 | } | ||
101 | |||
102 | /* | ||
103 | * (non-Javadoc) | ||
104 | * | ||
105 | * @see org.eclipse.core.resources.IProjectNature#getProject() | ||
106 | */ | ||
107 | public IProject getProject() { | ||
108 | return project; | ||
109 | } | ||
110 | |||
111 | /* | ||
112 | * (non-Javadoc) | ||
113 | * | ||
114 | * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject) | ||
115 | */ | ||
116 | public void setProject(IProject project) { | ||
117 | this.project = project; | ||
118 | } | ||
119 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/ToggleNatureAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/ToggleNatureAction.java new file mode 100644 index 0000000..f25148d --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/builder/ToggleNatureAction.java | |||
@@ -0,0 +1,106 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.builder; | ||
12 | |||
13 | import java.util.Iterator; | ||
14 | |||
15 | import org.eclipse.core.resources.IProject; | ||
16 | import org.eclipse.core.resources.IProjectDescription; | ||
17 | import org.eclipse.core.runtime.CoreException; | ||
18 | import org.eclipse.core.runtime.IAdaptable; | ||
19 | import org.eclipse.jface.action.IAction; | ||
20 | import org.eclipse.jface.viewers.ISelection; | ||
21 | import org.eclipse.jface.viewers.IStructuredSelection; | ||
22 | import org.eclipse.ui.IObjectActionDelegate; | ||
23 | import org.eclipse.ui.IWorkbenchPart; | ||
24 | |||
25 | public class ToggleNatureAction implements IObjectActionDelegate { | ||
26 | |||
27 | private ISelection selection; | ||
28 | |||
29 | /* | ||
30 | * (non-Javadoc) | ||
31 | * | ||
32 | * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) | ||
33 | */ | ||
34 | public void run(IAction action) { | ||
35 | if (selection instanceof IStructuredSelection) { | ||
36 | for (Iterator it = ((IStructuredSelection) selection).iterator(); it | ||
37 | .hasNext();) { | ||
38 | Object element = it.next(); | ||
39 | IProject project = null; | ||
40 | if (element instanceof IProject) { | ||
41 | project = (IProject) element; | ||
42 | } else if (element instanceof IAdaptable) { | ||
43 | project = (IProject) ((IAdaptable) element) | ||
44 | .getAdapter(IProject.class); | ||
45 | } | ||
46 | if (project != null) { | ||
47 | toggleNature(project); | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | } | ||
52 | |||
53 | /* | ||
54 | * (non-Javadoc) | ||
55 | * | ||
56 | * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, | ||
57 | * org.eclipse.jface.viewers.ISelection) | ||
58 | */ | ||
59 | public void selectionChanged(IAction action, ISelection selection) { | ||
60 | this.selection = selection; | ||
61 | } | ||
62 | |||
63 | /* | ||
64 | * (non-Javadoc) | ||
65 | * | ||
66 | * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, | ||
67 | * org.eclipse.ui.IWorkbenchPart) | ||
68 | */ | ||
69 | public void setActivePart(IAction action, IWorkbenchPart targetPart) { | ||
70 | } | ||
71 | |||
72 | /** | ||
73 | * Toggles sample nature on a project | ||
74 | * | ||
75 | * @param project | ||
76 | * to have sample nature added or removed | ||
77 | */ | ||
78 | private void toggleNature(IProject project) { | ||
79 | try { | ||
80 | IProjectDescription description = project.getDescription(); | ||
81 | String[] natures = description.getNatureIds(); | ||
82 | |||
83 | for (int i = 0; i < natures.length; ++i) { | ||
84 | if (BitbakeCommanderNature.NATURE_ID.equals(natures[i])) { | ||
85 | // Remove the nature | ||
86 | String[] newNatures = new String[natures.length - 1]; | ||
87 | System.arraycopy(natures, 0, newNatures, 0, i); | ||
88 | System.arraycopy(natures, i + 1, newNatures, i, | ||
89 | natures.length - i - 1); | ||
90 | description.setNatureIds(newNatures); | ||
91 | project.setDescription(description, null); | ||
92 | return; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | // Add the nature | ||
97 | String[] newNatures = new String[natures.length + 1]; | ||
98 | System.arraycopy(natures, 0, newNatures, 0, natures.length); | ||
99 | newNatures[natures.length] = BitbakeCommanderNature.NATURE_ID; | ||
100 | description.setNatureIds(newNatures); | ||
101 | project.setDescription(description, null); | ||
102 | } catch (CoreException e) { | ||
103 | } | ||
104 | } | ||
105 | |||
106 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ProjectDecorator.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ProjectDecorator.java new file mode 100644 index 0000000..5901ee1 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ProjectDecorator.java | |||
@@ -0,0 +1,48 @@ | |||
1 | package org.yocto.bc.ui.decorators; | ||
2 | |||
3 | import org.eclipse.core.resources.IProject; | ||
4 | import org.eclipse.core.runtime.CoreException; | ||
5 | import org.eclipse.jface.resource.ImageDescriptor; | ||
6 | import org.eclipse.jface.viewers.IDecoration; | ||
7 | import org.eclipse.jface.viewers.ILabelProviderListener; | ||
8 | import org.eclipse.jface.viewers.ILightweightLabelDecorator; | ||
9 | |||
10 | import org.yocto.bc.ui.Activator; | ||
11 | import org.yocto.bc.ui.builder.BitbakeCommanderNature; | ||
12 | |||
13 | public class ProjectDecorator implements ILightweightLabelDecorator { | ||
14 | |||
15 | private ImageDescriptor image; | ||
16 | |||
17 | public ProjectDecorator() { | ||
18 | image = Activator.getImageDescriptor("icons/oe_decorator.gif"); | ||
19 | } | ||
20 | |||
21 | |||
22 | public void decorate(Object element, IDecoration decoration) { | ||
23 | IProject p = (IProject) element; | ||
24 | |||
25 | try { | ||
26 | if (p.isOpen() && p.hasNature(BitbakeCommanderNature.NATURE_ID)) { | ||
27 | decoration.addOverlay(image, IDecoration.TOP_RIGHT); | ||
28 | } | ||
29 | } catch (CoreException e) { | ||
30 | e.printStackTrace(); | ||
31 | } | ||
32 | } | ||
33 | |||
34 | public void addListener(ILabelProviderListener arg0) { | ||
35 | } | ||
36 | |||
37 | public void dispose() { | ||
38 | } | ||
39 | |||
40 | public boolean isLabelProperty(Object arg0, String arg1) { | ||
41 | return false; | ||
42 | } | ||
43 | |||
44 | |||
45 | public void removeListener(ILabelProviderListener arg0) { | ||
46 | } | ||
47 | |||
48 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ReadOnly.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ReadOnly.java new file mode 100644 index 0000000..0bb3c20 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/decorators/ReadOnly.java | |||
@@ -0,0 +1,107 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2006 IBM Corporation and others. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * IBM Corporation - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.decorators; | ||
12 | |||
13 | import java.net.URL; | ||
14 | |||
15 | import org.eclipse.core.resources.IResource; | ||
16 | import org.eclipse.core.resources.ResourceAttributes; | ||
17 | import org.eclipse.core.runtime.Path; | ||
18 | import org.eclipse.core.runtime.Platform; | ||
19 | import org.eclipse.jface.resource.ImageDescriptor; | ||
20 | import org.eclipse.jface.viewers.IDecoration; | ||
21 | import org.eclipse.jface.viewers.ILabelProviderListener; | ||
22 | import org.eclipse.jface.viewers.ILightweightLabelDecorator; | ||
23 | |||
24 | /** | ||
25 | * An example showing how to control when an element is decorated. This example | ||
26 | * decorates only elements that are instances of IResource and whose attribute | ||
27 | * is 'Read-only'. | ||
28 | * | ||
29 | * @see ILightweightLabelDecorator | ||
30 | */ | ||
31 | public class ReadOnly implements ILightweightLabelDecorator { | ||
32 | /** | ||
33 | * String constants for the various icon placement options from the template | ||
34 | * wizard. | ||
35 | */ | ||
36 | public static final String TOP_RIGHT = "TOP_RIGHT"; | ||
37 | |||
38 | public static final String TOP_LEFT = "TOP_LEFT"; | ||
39 | |||
40 | public static final String BOTTOM_RIGHT = "BOTTOM_RIGHT"; | ||
41 | |||
42 | public static final String BOTTOM_LEFT = "BOTTOM_LEFT"; | ||
43 | |||
44 | public static final String UNDERLAY = "UNDERLAY"; | ||
45 | |||
46 | /** The integer value representing the placement options */ | ||
47 | private int quadrant; | ||
48 | |||
49 | /** The icon image location in the project folder */ | ||
50 | private String iconPath = "icons/read_only.gif"; //NON-NLS-1 | ||
51 | |||
52 | /** | ||
53 | * The image description used in | ||
54 | * <code>addOverlay(ImageDescriptor, int)</code> | ||
55 | */ | ||
56 | private ImageDescriptor descriptor; | ||
57 | |||
58 | /* (non-Javadoc) | ||
59 | * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration) | ||
60 | */ | ||
61 | public void decorate(Object element, IDecoration decoration) { | ||
62 | /** | ||
63 | * Checks that the element is an IResource with the 'Read-only' attribute | ||
64 | * and adds the decorator based on the specified image description and the | ||
65 | * integer representation of the placement option. | ||
66 | */ | ||
67 | IResource resource = (IResource) element; | ||
68 | ResourceAttributes attrs = resource.getResourceAttributes(); | ||
69 | if(attrs!=null) { | ||
70 | if (attrs.isReadOnly()){ | ||
71 | URL url = Platform.find( | ||
72 | Platform.getBundle("org.yocto.bc.ui"), new Path(iconPath)); //NON-NLS-1 | ||
73 | |||
74 | if (url == null) | ||
75 | return; | ||
76 | descriptor = ImageDescriptor.createFromURL(url); | ||
77 | quadrant = IDecoration.TOP_RIGHT; | ||
78 | decoration.addOverlay(descriptor,quadrant); | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | |||
83 | /* (non-Javadoc) | ||
84 | * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener) | ||
85 | */ | ||
86 | public void addListener(ILabelProviderListener listener) { | ||
87 | } | ||
88 | |||
89 | /* (non-Javadoc) | ||
90 | * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() | ||
91 | */ | ||
92 | public void dispose() { | ||
93 | } | ||
94 | |||
95 | /* (non-Javadoc) | ||
96 | * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String) | ||
97 | */ | ||
98 | public boolean isLabelProperty(Object element, String property) { | ||
99 | return false; | ||
100 | } | ||
101 | |||
102 | /* (non-Javadoc) | ||
103 | * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener) | ||
104 | */ | ||
105 | public void removeListener(ILabelProviderListener listener) { | ||
106 | } | ||
107 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BBVariableTextHover.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BBVariableTextHover.java new file mode 100644 index 0000000..5a90fca --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BBVariableTextHover.java | |||
@@ -0,0 +1,127 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.editors.bitbake; | ||
12 | |||
13 | import java.net.URI; | ||
14 | import java.util.Map; | ||
15 | |||
16 | import org.eclipse.core.runtime.IProgressMonitor; | ||
17 | import org.eclipse.core.runtime.IStatus; | ||
18 | import org.eclipse.core.runtime.Status; | ||
19 | import org.eclipse.core.runtime.jobs.Job; | ||
20 | import org.eclipse.jface.text.IRegion; | ||
21 | import org.eclipse.jface.text.ITextHover; | ||
22 | import org.eclipse.jface.text.ITextViewer; | ||
23 | import org.eclipse.jface.text.Region; | ||
24 | import org.yocto.bc.bitbake.BBRecipe; | ||
25 | import org.yocto.bc.bitbake.BBSession; | ||
26 | import org.yocto.bc.ui.Activator; | ||
27 | |||
28 | /** | ||
29 | * Maps BB Variables in the editor to BBSession | ||
30 | * @author kgilmer | ||
31 | * | ||
32 | */ | ||
33 | class BBVariableTextHover implements ITextHover { | ||
34 | private final BBSession session; | ||
35 | private volatile Map<String, String> envMap; | ||
36 | |||
37 | public BBVariableTextHover(BBSession session, URI file) { | ||
38 | this.session = session; | ||
39 | envMap = getEnvironmentMap(); | ||
40 | LoadRecipeJob loadRecipeJob = new LoadRecipeJob(getFilename(file), file); | ||
41 | loadRecipeJob.schedule(); | ||
42 | } | ||
43 | |||
44 | private Map<String, String> getEnvironmentMap() { | ||
45 | if (envMap == null) | ||
46 | envMap = this.session.getProperties(); | ||
47 | return envMap; | ||
48 | } | ||
49 | |||
50 | private String getFilename(URI uri) { | ||
51 | return uri.getPath(); | ||
52 | } | ||
53 | |||
54 | public IRegion getHoverRegion(ITextViewer tv, int off) { | ||
55 | return new Region(off, 0); | ||
56 | } | ||
57 | |||
58 | public String getHoverInfo(ITextViewer tv, IRegion r) { | ||
59 | try { | ||
60 | IRegion lineRegion = tv.getDocument().getLineInformationOfOffset(r.getOffset()); | ||
61 | |||
62 | return getBBVariable(tv.getDocument().get(lineRegion.getOffset(), lineRegion.getLength()).toCharArray(), r.getOffset() - lineRegion.getOffset()); | ||
63 | } catch (Exception e) { | ||
64 | return ""; | ||
65 | } | ||
66 | } | ||
67 | |||
68 | private String getBBVariable(char[] line, int offset) { | ||
69 | // Find start of word. | ||
70 | int i = offset; | ||
71 | |||
72 | while (line[i] != ' ' && line[i] != '$' && i > 0) { | ||
73 | i--; | ||
74 | } | ||
75 | |||
76 | if (i < 0 || line[i] != '$') { | ||
77 | return ""; //this is not a BB variable. | ||
78 | } | ||
79 | |||
80 | // find end of word | ||
81 | int start = i; | ||
82 | i = offset; | ||
83 | |||
84 | while (line[i] != ' ' && line[i] != '}' && i <= line.length) { | ||
85 | i++; | ||
86 | } | ||
87 | |||
88 | if (line[i] != '}') { | ||
89 | return ""; //this bb variable didn't terminate as expected | ||
90 | } | ||
91 | |||
92 | String key = new String(line, start + 2, i - start - 2); | ||
93 | String val = (String) getEnvironmentMap().get(key); | ||
94 | |||
95 | if (val == null) { | ||
96 | val = ""; | ||
97 | } | ||
98 | |||
99 | if (val.length() > 64) { | ||
100 | val = val.substring(0, 64) + '\n' + val.substring(65); | ||
101 | } | ||
102 | |||
103 | return val; | ||
104 | } | ||
105 | |||
106 | private class LoadRecipeJob extends Job { | ||
107 | private final URI filePath; | ||
108 | |||
109 | public LoadRecipeJob(String name, URI filePath) { | ||
110 | super("Extracting BitBake environment for " + name); | ||
111 | this.filePath = filePath; | ||
112 | } | ||
113 | |||
114 | @Override | ||
115 | protected IStatus run(IProgressMonitor mon) { | ||
116 | try { | ||
117 | BBRecipe recipe = Activator.getBBRecipe(session, filePath); | ||
118 | recipe.initialize(); | ||
119 | envMap = recipe; | ||
120 | } catch (Exception e) { | ||
121 | return new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Unable to load session for " + filePath, e); | ||
122 | } | ||
123 | |||
124 | return Status.OK_STATUS; | ||
125 | } | ||
126 | } | ||
127 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeDocumentProvider.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeDocumentProvider.java new file mode 100644 index 0000000..140a3da --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeDocumentProvider.java | |||
@@ -0,0 +1,101 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.editors.bitbake; | ||
13 | |||
14 | import java.net.URI; | ||
15 | import java.net.URISyntaxException; | ||
16 | |||
17 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
18 | import org.eclipse.jface.text.IDocument; | ||
19 | import org.eclipse.jface.text.IDocumentExtension3; | ||
20 | import org.eclipse.jface.text.IDocumentPartitioner; | ||
21 | import org.eclipse.jface.text.rules.FastPartitioner; | ||
22 | import org.eclipse.jface.text.rules.IPredicateRule; | ||
23 | import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; | ||
24 | import org.eclipse.jface.text.rules.SingleLineRule; | ||
25 | import org.eclipse.jface.text.rules.Token; | ||
26 | import org.eclipse.rse.core.model.IHost; | ||
27 | import org.eclipse.ui.IFileEditorInput; | ||
28 | import org.eclipse.ui.editors.text.FileDocumentProvider; | ||
29 | import org.yocto.remote.utils.RemoteHelper; | ||
30 | |||
31 | /** | ||
32 | * Document provider for BB recipe. | ||
33 | * @author kgilmer | ||
34 | * | ||
35 | */ | ||
36 | public class BitBakeDocumentProvider extends FileDocumentProvider { | ||
37 | /** | ||
38 | * The recipe partitioning. It contains two partition types: {@link #RECIPE_CODE} and | ||
39 | * {@link #RECIPE_COMMENT}. | ||
40 | */ | ||
41 | public static final String RECIPE_PARTITIONING= "org.recipeeditor.recipepartitioning"; //$NON-NLS-1$ | ||
42 | |||
43 | public static final String RECIPE_CODE= IDocument.DEFAULT_CONTENT_TYPE; | ||
44 | public static final String RECIPE_COMMENT= "RECIPE_COMMENT"; //$NON-NLS-1$ | ||
45 | |||
46 | private IHost connection; | ||
47 | |||
48 | private final BitBakeSourceViewerConfiguration viewerConfiguration; | ||
49 | |||
50 | private static final String[] CONTENT_TYPES= { | ||
51 | RECIPE_CODE, | ||
52 | RECIPE_COMMENT | ||
53 | }; | ||
54 | |||
55 | public BitBakeDocumentProvider(BitBakeSourceViewerConfiguration viewerConfiguration) { | ||
56 | this.viewerConfiguration = viewerConfiguration; | ||
57 | } | ||
58 | |||
59 | private IDocumentPartitioner createRecipePartitioner() { | ||
60 | IPredicateRule[] rules= { new SingleLineRule("#", null, new Token(RECIPE_COMMENT), (char) 0, true, false) }; //$NON-NLS-1$ | ||
61 | |||
62 | RuleBasedPartitionScanner scanner= new RuleBasedPartitionScanner(); | ||
63 | scanner.setPredicateRules(rules); | ||
64 | |||
65 | return new FastPartitioner(scanner, CONTENT_TYPES); | ||
66 | } | ||
67 | |||
68 | @Override | ||
69 | protected void setupDocument(Object element,IDocument document) { | ||
70 | if (document instanceof IDocumentExtension3) { | ||
71 | IDocumentExtension3 ext= (IDocumentExtension3) document; | ||
72 | IDocumentPartitioner partitioner= createRecipePartitioner(); | ||
73 | ext.setDocumentPartitioner(RECIPE_PARTITIONING, partitioner); | ||
74 | partitioner.connect(document); | ||
75 | } | ||
76 | } | ||
77 | |||
78 | @Override | ||
79 | public boolean isDeleted(Object element) { | ||
80 | if (element instanceof IFileEditorInput) { | ||
81 | IFileEditorInput input= (IFileEditorInput) element; | ||
82 | |||
83 | URI root = viewerConfiguration.getBBSession().getProjInfoRoot(); | ||
84 | String relPath = input.getFile().getProjectRelativePath().toPortableString(); | ||
85 | try { | ||
86 | URI fileURI = new URI(root.getScheme(), root.getHost(), root.getPath() + "/" + relPath, root.getFragment()); | ||
87 | if (connection == null) | ||
88 | connection = viewerConfiguration.getBBSession().getProjectInfo().getConnection(); | ||
89 | return !RemoteHelper.fileExistsRemote(connection, new NullProgressMonitor(), fileURI.getPath()); | ||
90 | } catch (URISyntaxException e) { | ||
91 | e.printStackTrace(); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | return super.isDeleted(element); | ||
96 | } | ||
97 | |||
98 | public void setActiveConnection(IHost connection) { | ||
99 | this.connection = connection; | ||
100 | } | ||
101 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeFileEditor.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeFileEditor.java new file mode 100644 index 0000000..11dd335 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeFileEditor.java | |||
@@ -0,0 +1,89 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.editors.bitbake; | ||
13 | |||
14 | import java.io.IOException; | ||
15 | import java.lang.reflect.InvocationTargetException; | ||
16 | import java.util.ResourceBundle; | ||
17 | |||
18 | import org.eclipse.core.resources.IFile; | ||
19 | import org.eclipse.core.resources.IProject; | ||
20 | import org.eclipse.core.runtime.CoreException; | ||
21 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
22 | import org.eclipse.core.runtime.Status; | ||
23 | import org.eclipse.ui.IEditorInput; | ||
24 | import org.eclipse.ui.IEditorSite; | ||
25 | import org.eclipse.ui.PartInitException; | ||
26 | import org.eclipse.ui.part.FileEditorInput; | ||
27 | import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor; | ||
28 | import org.eclipse.ui.texteditor.ContentAssistAction; | ||
29 | import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; | ||
30 | import org.yocto.bc.ui.Activator; | ||
31 | import org.yocto.bc.ui.model.ProjectInfo; | ||
32 | |||
33 | /** | ||
34 | * Editor for BB Recipe | ||
35 | * @author kgilmer | ||
36 | * | ||
37 | */ | ||
38 | public class BitBakeFileEditor extends AbstractDecoratedTextEditor { | ||
39 | |||
40 | public static final String EDITOR_ID = "org.yocto.bc.ui.editors.BitBakeFileEditor"; | ||
41 | static final String CONTENT_ASSIST= "ContentAssist"; | ||
42 | private BitBakeSourceViewerConfiguration viewerConfiguration; | ||
43 | private IFile targetFile; | ||
44 | |||
45 | public BitBakeFileEditor() { | ||
46 | super(); | ||
47 | viewerConfiguration = new BitBakeSourceViewerConfiguration(getSharedColors(), getPreferenceStore()); | ||
48 | setSourceViewerConfiguration(viewerConfiguration); | ||
49 | setDocumentProvider(new BitBakeDocumentProvider(viewerConfiguration)); | ||
50 | } | ||
51 | |||
52 | @Override | ||
53 | protected void createActions() { | ||
54 | super.createActions(); | ||
55 | |||
56 | ResourceBundle bundle= RecipeEditorMessages.getBundle(); | ||
57 | ContentAssistAction action= new ContentAssistAction(bundle, "contentAssist.", this); //$NON-NLS-1$ | ||
58 | action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); | ||
59 | setAction(CONTENT_ASSIST, action); | ||
60 | } | ||
61 | |||
62 | @Override | ||
63 | public void init(IEditorSite site, IEditorInput input) throws PartInitException { | ||
64 | |||
65 | if (input instanceof FileEditorInput) { | ||
66 | IProject p = ((FileEditorInput)input).getFile().getProject(); | ||
67 | targetFile = ((FileEditorInput)input).getFile(); | ||
68 | viewerConfiguration.setTargetFile(targetFile); | ||
69 | |||
70 | try { | ||
71 | ProjectInfo projInfo = Activator.getProjInfo(p.getLocationURI()); | ||
72 | ((BitBakeDocumentProvider)getDocumentProvider()).setActiveConnection(projInfo.getConnection()); | ||
73 | viewerConfiguration.setBBSession(Activator.getBBSession(projInfo, new NullProgressMonitor())); | ||
74 | } catch (IOException e) { | ||
75 | e.printStackTrace(); | ||
76 | throw new PartInitException(Status.CANCEL_STATUS); | ||
77 | } catch (InvocationTargetException e) { | ||
78 | e.printStackTrace(); | ||
79 | } catch (CoreException e) { | ||
80 | e.printStackTrace(); | ||
81 | } catch (InterruptedException e) { | ||
82 | e.printStackTrace(); | ||
83 | } catch (Exception e) { | ||
84 | e.printStackTrace(); | ||
85 | } | ||
86 | } | ||
87 | super.init(site, input); | ||
88 | } | ||
89 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeSourceViewerConfiguration.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeSourceViewerConfiguration.java new file mode 100644 index 0000000..87a51d2 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BitBakeSourceViewerConfiguration.java | |||
@@ -0,0 +1,210 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.editors.bitbake; | ||
13 | |||
14 | import java.net.URI; | ||
15 | import java.net.URISyntaxException; | ||
16 | |||
17 | import org.eclipse.core.resources.IFile; | ||
18 | import org.eclipse.jface.preference.IPreferenceStore; | ||
19 | import org.eclipse.jface.text.ITextHover; | ||
20 | import org.eclipse.jface.text.TextAttribute; | ||
21 | import org.eclipse.jface.text.contentassist.ContentAssistant; | ||
22 | import org.eclipse.jface.text.contentassist.IContentAssistant; | ||
23 | import org.eclipse.jface.text.presentation.IPresentationReconciler; | ||
24 | import org.eclipse.jface.text.presentation.PresentationReconciler; | ||
25 | import org.eclipse.jface.text.reconciler.IReconciler; | ||
26 | import org.eclipse.jface.text.rules.DefaultDamagerRepairer; | ||
27 | import org.eclipse.jface.text.rules.IRule; | ||
28 | import org.eclipse.jface.text.rules.IToken; | ||
29 | import org.eclipse.jface.text.rules.IWordDetector; | ||
30 | import org.eclipse.jface.text.rules.RuleBasedScanner; | ||
31 | import org.eclipse.jface.text.rules.SingleLineRule; | ||
32 | import org.eclipse.jface.text.rules.Token; | ||
33 | import org.eclipse.jface.text.rules.WordRule; | ||
34 | import org.eclipse.jface.text.source.ISharedTextColors; | ||
35 | import org.eclipse.jface.text.source.ISourceViewer; | ||
36 | import org.eclipse.swt.SWT; | ||
37 | import org.eclipse.swt.graphics.Color; | ||
38 | import org.eclipse.swt.graphics.RGB; | ||
39 | import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; | ||
40 | import org.yocto.bc.bitbake.BBLanguageHelper; | ||
41 | import org.yocto.bc.bitbake.BBSession; | ||
42 | |||
43 | public class BitBakeSourceViewerConfiguration extends TextSourceViewerConfiguration { | ||
44 | |||
45 | private static final class WordDetector implements IWordDetector { | ||
46 | public boolean isWordPart(char c) { | ||
47 | return !Character.isWhitespace(c); | ||
48 | } | ||
49 | |||
50 | public boolean isWordStart(char c) { | ||
51 | return !Character.isWhitespace(c); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | private final ISharedTextColors fSharedColors; | ||
56 | private BBSession session; | ||
57 | private IFile targetFile; | ||
58 | private BBVariableTextHover textHover = null; | ||
59 | |||
60 | public BitBakeSourceViewerConfiguration(ISharedTextColors sharedColors, IPreferenceStore store) { | ||
61 | super(store); | ||
62 | fSharedColors = sharedColors; | ||
63 | } | ||
64 | |||
65 | protected void setTargetFile(IFile targetFile) { | ||
66 | this.targetFile = targetFile; | ||
67 | } | ||
68 | |||
69 | public ITextHover getTextHover(ISourceViewer sv, String contentType) { | ||
70 | //only .bb file support Text Hover. | ||
71 | if (textHover == null && targetFile.getFileExtension().equals(BBLanguageHelper.BITBAKE_RECIPE_FILE_EXTENSION)) { | ||
72 | URI root = session.getProjInfoRoot(); | ||
73 | try { | ||
74 | String targetFileProjPath = targetFile.getProjectRelativePath().toPortableString(); | ||
75 | URI targetFileURI = new URI(root.getScheme(), root.getHost(), root.getPath() + "/" + | ||
76 | targetFileProjPath, root.getFragment()); | ||
77 | textHover = new BBVariableTextHover(session, targetFileURI); | ||
78 | } catch (URISyntaxException e) { | ||
79 | e.printStackTrace(); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | return textHover; | ||
84 | } | ||
85 | |||
86 | private void addDamagerRepairer(PresentationReconciler reconciler, RuleBasedScanner commentScanner, String contentType) { | ||
87 | DefaultDamagerRepairer commentDamagerRepairer = new DefaultDamagerRepairer(commentScanner); | ||
88 | reconciler.setDamager(commentDamagerRepairer, contentType); | ||
89 | reconciler.setRepairer(commentDamagerRepairer, contentType); | ||
90 | } | ||
91 | |||
92 | private RuleBasedScanner createCommentScanner() { | ||
93 | Color green = fSharedColors.getColor(new RGB(16, 96, 16)); | ||
94 | RuleBasedScanner commentScanner = new RuleBasedScanner(); | ||
95 | commentScanner.setDefaultReturnToken(new Token(new TextAttribute(green, null, SWT.ITALIC))); | ||
96 | return commentScanner; | ||
97 | } | ||
98 | |||
99 | private IRule createCustomFunctionRule() { | ||
100 | Color blue = fSharedColors.getColor(new RGB(130, 0, 0)); | ||
101 | IRule rule = new CustomFunctionRule(new Token(new TextAttribute(blue, null, SWT.BOLD))); | ||
102 | |||
103 | return rule; | ||
104 | } | ||
105 | |||
106 | private SingleLineRule createFunctionNameRule() { | ||
107 | Color red = fSharedColors.getColor(new RGB(150, 0, 96)); | ||
108 | SingleLineRule stepRule = new SingleLineRule("do_", ")", new Token(new TextAttribute(red, null, SWT.BOLD))); //$NON-NLS-1$ //$NON-NLS-2$ | ||
109 | stepRule.setColumnConstraint(0); | ||
110 | return stepRule; | ||
111 | } | ||
112 | |||
113 | private SingleLineRule createInlineVariableRule() { | ||
114 | Color blue = fSharedColors.getColor(new RGB(50, 50, 100)); | ||
115 | SingleLineRule stepRule = new SingleLineRule("${", "}", new Token(new TextAttribute(blue, null, SWT.BOLD))); //$NON-NLS-1$ //$NON-NLS-2$ | ||
116 | return stepRule; | ||
117 | } | ||
118 | |||
119 | private WordRule createKeywordRule() { | ||
120 | WordRule keywordRule = new WordRule(new WordDetector()); | ||
121 | IToken token = new Token(new TextAttribute(fSharedColors.getColor(new RGB(96, 96, 0)), null, SWT.NONE)); | ||
122 | |||
123 | for (int i = 0; i < BBLanguageHelper.BITBAKE_KEYWORDS.length; ++i) { | ||
124 | |||
125 | keywordRule.addWord(BBLanguageHelper.BITBAKE_KEYWORDS[i], token); | ||
126 | keywordRule.setColumnConstraint(0); | ||
127 | } | ||
128 | |||
129 | return keywordRule; | ||
130 | } | ||
131 | |||
132 | private RuleBasedScanner createRecipeScanner() { | ||
133 | RuleBasedScanner recipeScanner = new RuleBasedScanner(); | ||
134 | |||
135 | IRule[] rules = { createKeywordRule(), createShellKeywordRule(), createStringLiteralRule(), createVariableRule(), createFunctionNameRule(), createCustomFunctionRule(), | ||
136 | createInlineVariableRule() }; | ||
137 | recipeScanner.setRules(rules); | ||
138 | return recipeScanner; | ||
139 | } | ||
140 | |||
141 | private WordRule createShellKeywordRule() { | ||
142 | WordRule keywordRule = new WordRule(new WordDetector()); | ||
143 | IToken token = new Token(new TextAttribute(fSharedColors.getColor(new RGB(0, 64, 92)), null, SWT.NONE)); | ||
144 | |||
145 | for (int i = 0; i < BBLanguageHelper.SHELL_KEYWORDS.length; ++i) { | ||
146 | keywordRule.addWord(BBLanguageHelper.SHELL_KEYWORDS[i], token); | ||
147 | } | ||
148 | |||
149 | return keywordRule; | ||
150 | } | ||
151 | |||
152 | private SingleLineRule createStringLiteralRule() { | ||
153 | Color red = fSharedColors.getColor(new RGB(50, 50, 100)); | ||
154 | SingleLineRule rule = new SingleLineRule("\"", "\"", new Token(new TextAttribute(red, null, SWT.NONE)), '\\'); | ||
155 | |||
156 | return rule; | ||
157 | } | ||
158 | |||
159 | private IRule createVariableRule() { | ||
160 | Color blue = fSharedColors.getColor(new RGB(0, 0, 200)); | ||
161 | IRule rule = new VariableRule(new Token(new TextAttribute(blue, null, SWT.NONE))); | ||
162 | |||
163 | return rule; | ||
164 | } | ||
165 | |||
166 | @Override | ||
167 | public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { | ||
168 | return new String[] { BitBakeDocumentProvider.RECIPE_CODE, BitBakeDocumentProvider.RECIPE_COMMENT }; | ||
169 | } | ||
170 | |||
171 | @Override | ||
172 | public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) { | ||
173 | return BitBakeDocumentProvider.RECIPE_PARTITIONING; | ||
174 | } | ||
175 | |||
176 | @Override | ||
177 | public IContentAssistant getContentAssistant(final ISourceViewer sourceViewer) { | ||
178 | ContentAssistant assistant = new ContentAssistant(); | ||
179 | assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer)); | ||
180 | |||
181 | // assistant.setContentAssistProcessor(new HippieProposalProcessor(), | ||
182 | // BitBakeDocumentProvider.RECIPE_COMMENT); | ||
183 | assistant.setContentAssistProcessor(new RecipeCompletionProcessor(), BitBakeDocumentProvider.RECIPE_CODE); | ||
184 | |||
185 | return assistant; | ||
186 | } | ||
187 | |||
188 | public IReconciler getReconciler(ISourceViewer sourceViewer) { | ||
189 | return null; | ||
190 | } | ||
191 | |||
192 | @Override | ||
193 | public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { | ||
194 | PresentationReconciler reconciler = new PresentationReconciler(); | ||
195 | reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer)); | ||
196 | |||
197 | addDamagerRepairer(reconciler, createCommentScanner(), BitBakeDocumentProvider.RECIPE_COMMENT); | ||
198 | addDamagerRepairer(reconciler, createRecipeScanner(), BitBakeDocumentProvider.RECIPE_CODE); | ||
199 | |||
200 | return reconciler; | ||
201 | } | ||
202 | |||
203 | public void setBBSession(BBSession session) { | ||
204 | this.session = session; | ||
205 | } | ||
206 | |||
207 | public BBSession getBBSession() { | ||
208 | return this.session; | ||
209 | } | ||
210 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/CustomFunctionRule.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/CustomFunctionRule.java new file mode 100644 index 0000000..223a25d --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/CustomFunctionRule.java | |||
@@ -0,0 +1,94 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.editors.bitbake; | ||
12 | |||
13 | import org.eclipse.jface.text.rules.ICharacterScanner; | ||
14 | import org.eclipse.jface.text.rules.IRule; | ||
15 | import org.eclipse.jface.text.rules.IToken; | ||
16 | import org.eclipse.jface.text.rules.Token; | ||
17 | |||
18 | /** | ||
19 | * Rule for def_ BB Recipe functions | ||
20 | * @author kgilmer | ||
21 | * | ||
22 | */ | ||
23 | final class CustomFunctionRule implements IRule { | ||
24 | |||
25 | /** Token to return for this rule */ | ||
26 | private final IToken fToken; | ||
27 | |||
28 | /** | ||
29 | * Creates a new operator rule. | ||
30 | * | ||
31 | * @param token | ||
32 | * Token to use for this rule | ||
33 | */ | ||
34 | public CustomFunctionRule(IToken token) { | ||
35 | fToken = token; | ||
36 | } | ||
37 | |||
38 | public IToken evaluate(ICharacterScanner scanner) { | ||
39 | if (scanner.getColumn() > 0) { | ||
40 | return Token.UNDEFINED; | ||
41 | } | ||
42 | |||
43 | int i = scanner.read(); | ||
44 | int c = 1; | ||
45 | |||
46 | if (!Character.isLetter(i) && i != 10) { | ||
47 | scanner.unread(); | ||
48 | return Token.UNDEFINED; | ||
49 | } | ||
50 | |||
51 | if (i == 'd' && scanAhead(scanner, "o_".toCharArray())) { | ||
52 | scanner.unread(); | ||
53 | return Token.UNDEFINED; | ||
54 | } | ||
55 | |||
56 | while (i != ICharacterScanner.EOF && i != 10) { | ||
57 | i = scanner.read(); | ||
58 | c++; | ||
59 | |||
60 | if (i == '(') { | ||
61 | readUntil(scanner, ')'); | ||
62 | |||
63 | return fToken; | ||
64 | } | ||
65 | } | ||
66 | |||
67 | for (int t = 0; t < c; t++) { | ||
68 | scanner.unread(); | ||
69 | } | ||
70 | |||
71 | return Token.UNDEFINED; | ||
72 | } | ||
73 | |||
74 | private void readUntil(ICharacterScanner scanner, int c) { | ||
75 | int i; | ||
76 | do { | ||
77 | i = scanner.read(); | ||
78 | } while (! (i == ICharacterScanner.EOF) && ! (i == c)); | ||
79 | } | ||
80 | |||
81 | private boolean scanAhead(ICharacterScanner scanner, char [] chars) { | ||
82 | boolean v = true; | ||
83 | for (int i = 0; i < chars.length; ++i) { | ||
84 | if (! (scanner.read() == chars[i])) { | ||
85 | v = false; | ||
86 | for (int j = 0; j < i; ++j) { | ||
87 | scanner.unread(); | ||
88 | } | ||
89 | break; | ||
90 | } | ||
91 | } | ||
92 | return v; | ||
93 | } | ||
94 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeCompletionProcessor.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeCompletionProcessor.java new file mode 100644 index 0000000..034187a --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeCompletionProcessor.java | |||
@@ -0,0 +1,127 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Lianhao Lu (Intel) - remove compile warnings | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.editors.bitbake; | ||
13 | |||
14 | import java.util.ArrayList; | ||
15 | import java.util.Arrays; | ||
16 | import java.util.Iterator; | ||
17 | import java.util.List; | ||
18 | import java.util.Map; | ||
19 | |||
20 | import org.eclipse.jface.text.IDocument; | ||
21 | import org.eclipse.jface.text.ITextViewer; | ||
22 | import org.eclipse.jface.text.Region; | ||
23 | import org.eclipse.jface.text.contentassist.ICompletionProposal; | ||
24 | import org.eclipse.jface.text.contentassist.IContentAssistProcessor; | ||
25 | import org.eclipse.jface.text.contentassist.IContextInformation; | ||
26 | import org.eclipse.jface.text.contentassist.IContextInformationValidator; | ||
27 | import org.eclipse.jface.text.templates.DocumentTemplateContext; | ||
28 | import org.eclipse.jface.text.templates.Template; | ||
29 | import org.eclipse.jface.text.templates.TemplateContext; | ||
30 | import org.eclipse.jface.text.templates.TemplateContextType; | ||
31 | import org.eclipse.jface.text.templates.TemplateProposal; | ||
32 | import org.eclipse.swt.graphics.Image; | ||
33 | import org.eclipse.ui.ide.IDE.SharedImages; | ||
34 | import org.eclipse.ui.PlatformUI; | ||
35 | |||
36 | import org.yocto.bc.bitbake.BBLanguageHelper; | ||
37 | import org.yocto.bc.ui.Activator; | ||
38 | |||
39 | class RecipeCompletionProcessor implements IContentAssistProcessor { | ||
40 | |||
41 | private static final String CONTEXT_ID= "bitbake_variables"; //$NON-NLS-1$ | ||
42 | private final TemplateContextType fContextType= new TemplateContextType(CONTEXT_ID, "Common BitBake Variables"); //$NON-NLS-1$ | ||
43 | //private final TemplateContextType fKeywordContextType= new TemplateContextType("bitbake_keywords", "BitBake Keywords"); //$NON-NLS-1$ | ||
44 | private final TemplateContextType fFunctionContextType = new TemplateContextType("bitbake_functions", "BitBake Functions"); | ||
45 | |||
46 | RecipeCompletionProcessor() { | ||
47 | } | ||
48 | |||
49 | public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { | ||
50 | IDocument document= viewer.getDocument(); | ||
51 | Region region= new Region(offset, 0); | ||
52 | |||
53 | TemplateContext templateContext= new DocumentTemplateContext(fContextType, document, offset, 0); | ||
54 | //TemplateContext keywordContext = new DocumentTemplateContext(fKeywordContextType, document, offset, 0); | ||
55 | TemplateContext functionContext = new DocumentTemplateContext(fFunctionContextType, document, offset, 0); | ||
56 | |||
57 | List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>(); | ||
58 | |||
59 | getVariableTemplateProposals(templateContext, region, proposals); | ||
60 | // getKeywordTemplateProposals(keywordContext, region, proposals); | ||
61 | getAddTaskTemplateProposals(templateContext, region, proposals); | ||
62 | getFunctionTemplateProposals(functionContext, region, proposals); | ||
63 | |||
64 | return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]); | ||
65 | } | ||
66 | |||
67 | public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { | ||
68 | return null; | ||
69 | } | ||
70 | |||
71 | private Template generateVariableTemplate(String name, String description) { | ||
72 | |||
73 | return new Template(name, description, CONTEXT_ID, name + " = \"${" + name.toLowerCase() + "}\"", false); | ||
74 | } | ||
75 | |||
76 | private void getAddTaskTemplateProposals(TemplateContext templateContext, Region region, List<ICompletionProposal> p) { | ||
77 | p.add(new TemplateProposal(new Template("addtask", "addtask statement", CONTEXT_ID, "addtask ${task_name} after ${do_previous_task} before ${do_next_task}", false),templateContext, region, PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OBJS_BKMRK_TSK))); | ||
78 | } | ||
79 | |||
80 | |||
81 | public char[] getCompletionProposalAutoActivationCharacters() { | ||
82 | return null; | ||
83 | } | ||
84 | |||
85 | public char[] getContextInformationAutoActivationCharacters() { | ||
86 | return null; | ||
87 | } | ||
88 | |||
89 | public IContextInformationValidator getContextInformationValidator() { | ||
90 | return null; | ||
91 | } | ||
92 | |||
93 | public String getErrorMessage() { | ||
94 | return null; | ||
95 | } | ||
96 | |||
97 | private void getFunctionTemplateProposals(TemplateContext templateContext, Region region, List<ICompletionProposal> p) { | ||
98 | String [] keywords = BBLanguageHelper.BITBAKE_STANDARD_FUNCTIONS; | ||
99 | Image img = Activator.getDefault().getImageRegistry().get(Activator.IMAGE_FUNCTION); | ||
100 | Arrays.sort(keywords); | ||
101 | |||
102 | for (int i = 0; i < keywords.length; ++i) { | ||
103 | p.add(new TemplateProposal(new Template(keywords[i], keywords[i] + " function", CONTEXT_ID, "do_" + keywords[i] + "() {\n\n}", false), templateContext, region, img)); | ||
104 | } | ||
105 | } | ||
106 | /* | ||
107 | private void getKeywordTemplateProposals(TemplateContext templateContext, Region region, List<TemplateProposal> p) { | ||
108 | String [] keywords = BBLanguageHelper.BITBAKE_KEYWORDS; | ||
109 | |||
110 | Arrays.sort(keywords); | ||
111 | |||
112 | for (int i = 0; i < keywords.length; ++i) { | ||
113 | p.add(new TemplateProposal(new Template(keywords[i], keywords[i] + " keyword", CONTEXT_ID, keywords[i] + " ", false),templateContext, region, null)); | ||
114 | } | ||
115 | } | ||
116 | */ | ||
117 | |||
118 | private void getVariableTemplateProposals(TemplateContext templateContext, Region region, List<ICompletionProposal> p) { | ||
119 | Map<String, String> n = BBLanguageHelper.getCommonBitbakeVariables(); | ||
120 | Image img = Activator.getDefault().getImageRegistry().get(Activator.IMAGE_VARIABLE); | ||
121 | for (Iterator<String> i = n.keySet().iterator(); i.hasNext();) { | ||
122 | String name = (String) i.next(); | ||
123 | String description = (String) n.get(name); | ||
124 | p.add(new TemplateProposal(generateVariableTemplate(name, description), templateContext, region, img)); | ||
125 | } | ||
126 | } | ||
127 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorActionContributor.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorActionContributor.java new file mode 100644 index 0000000..f27951b --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorActionContributor.java | |||
@@ -0,0 +1,47 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.editors.bitbake; | ||
12 | |||
13 | import org.eclipse.jface.action.IMenuManager; | ||
14 | import org.eclipse.ui.IEditorPart; | ||
15 | import org.eclipse.ui.IWorkbenchActionConstants; | ||
16 | import org.eclipse.ui.editors.text.TextEditorActionContributor; | ||
17 | import org.eclipse.ui.texteditor.ITextEditor; | ||
18 | import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; | ||
19 | import org.eclipse.ui.texteditor.RetargetTextEditorAction; | ||
20 | |||
21 | public class RecipeEditorActionContributor extends TextEditorActionContributor { | ||
22 | |||
23 | private RetargetTextEditorAction fContentAssist; | ||
24 | |||
25 | public RecipeEditorActionContributor() { | ||
26 | fContentAssist= new RetargetTextEditorAction(RecipeEditorMessages.getBundle(), "contentAssist."); //$NON-NLS-1$ | ||
27 | fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); | ||
28 | } | ||
29 | |||
30 | @Override | ||
31 | public void contributeToMenu(IMenuManager menu) { | ||
32 | super.contributeToMenu(menu); | ||
33 | |||
34 | IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); | ||
35 | if (editMenu != null) { | ||
36 | editMenu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fContentAssist); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | @Override | ||
41 | public void setActiveEditor(IEditorPart part) { | ||
42 | super.setActiveEditor(part); | ||
43 | if (part instanceof ITextEditor) { | ||
44 | fContentAssist.setAction(getAction((ITextEditor) part, BitBakeFileEditor.CONTENT_ASSIST)); | ||
45 | } | ||
46 | } | ||
47 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.java new file mode 100644 index 0000000..020a25a --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.java | |||
@@ -0,0 +1,21 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.editors.bitbake; | ||
12 | |||
13 | import java.util.ResourceBundle; | ||
14 | |||
15 | public class RecipeEditorMessages { | ||
16 | |||
17 | public static ResourceBundle getBundle() { | ||
18 | return ResourceBundle.getBundle(RecipeEditorMessages.class.getName()); | ||
19 | } | ||
20 | |||
21 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.properties b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.properties new file mode 100644 index 0000000..76c670b --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/RecipeEditorMessages.properties | |||
@@ -0,0 +1,14 @@ | |||
1 | ######################################################### | ||
2 | # Copyright (c) 2006 IBM Corporation and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Common Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/cpl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # IBM Corporation - initial API and implementation | ||
10 | ########################################################## | ||
11 | contentAssist.label=Content Assist | ||
12 | contentAssist.tooltip=Content Assist | ||
13 | contentAssist.image= | ||
14 | contentAssist.description= Invokes content assist \ No newline at end of file | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/VariableRule.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/VariableRule.java new file mode 100644 index 0000000..750705a --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/VariableRule.java | |||
@@ -0,0 +1,69 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.editors.bitbake; | ||
12 | |||
13 | import org.eclipse.jface.text.rules.ICharacterScanner; | ||
14 | import org.eclipse.jface.text.rules.IRule; | ||
15 | import org.eclipse.jface.text.rules.IToken; | ||
16 | import org.eclipse.jface.text.rules.Token; | ||
17 | |||
18 | final class VariableRule implements IRule { | ||
19 | |||
20 | /** Token to return for this rule */ | ||
21 | private final IToken fToken; | ||
22 | |||
23 | /** | ||
24 | * Creates a new operator rule. | ||
25 | * | ||
26 | * @param token | ||
27 | * Token to use for this rule | ||
28 | */ | ||
29 | public VariableRule(IToken token) { | ||
30 | fToken = token; | ||
31 | } | ||
32 | |||
33 | public IToken evaluate(ICharacterScanner scanner) { | ||
34 | if (scanner.getColumn() > 0) { | ||
35 | return Token.UNDEFINED; | ||
36 | } | ||
37 | |||
38 | int i = scanner.read(); | ||
39 | int c = 1; | ||
40 | |||
41 | if (!Character.isLetter(i) && i != 10) { | ||
42 | scanner.unread(); | ||
43 | return Token.UNDEFINED; | ||
44 | } | ||
45 | |||
46 | int p = i; | ||
47 | |||
48 | while (i != ICharacterScanner.EOF && i != 10) { | ||
49 | p = i; | ||
50 | i = scanner.read(); | ||
51 | c++; | ||
52 | |||
53 | if (i == '=') { | ||
54 | scanner.unread(); | ||
55 | |||
56 | if (p == '?' || p == '+') { | ||
57 | scanner.unread(); | ||
58 | } | ||
59 | return fToken; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | for (int t = 0; t < c; t++) { | ||
64 | scanner.unread(); | ||
65 | } | ||
66 | |||
67 | return Token.UNDEFINED; | ||
68 | } | ||
69 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/CustomLocalFile.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/CustomLocalFile.java new file mode 100644 index 0000000..b62a1da --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/CustomLocalFile.java | |||
@@ -0,0 +1,13 @@ | |||
1 | package org.yocto.bc.ui.filesystem; | ||
2 | |||
3 | import java.io.File; | ||
4 | |||
5 | import org.eclipse.core.internal.filesystem.local.LocalFile; | ||
6 | import org.yocto.remote.utils.RemoteHelper; | ||
7 | |||
8 | public class CustomLocalFile extends LocalFile{ | ||
9 | |||
10 | public CustomLocalFile(String projName, File file) { | ||
11 | super(new File(RemoteHelper.retrieveProjRootFromMetaArea(projName))); | ||
12 | } | ||
13 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Messages.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Messages.java new file mode 100644 index 0000000..0a82fdd --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Messages.java | |||
@@ -0,0 +1,48 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.filesystem; | ||
12 | |||
13 | import org.eclipse.osgi.util.NLS; | ||
14 | |||
15 | /** | ||
16 | * Provides translatable messages for the file system bundle | ||
17 | */ | ||
18 | public class Messages extends NLS { | ||
19 | private static final String BUNDLE_NAME = "org.eclipse.core.internal.filesystem.messages"; //$NON-NLS-1$ | ||
20 | |||
21 | public static String copying; | ||
22 | public static String couldnotDelete; | ||
23 | public static String couldnotDeleteReadOnly; | ||
24 | public static String couldNotLoadLibrary; | ||
25 | public static String couldNotMove; | ||
26 | public static String couldNotRead; | ||
27 | public static String couldNotWrite; | ||
28 | public static String deleteProblem; | ||
29 | public static String deleting; | ||
30 | public static String failedCreateWrongType; | ||
31 | public static String failedMove; | ||
32 | public static String failedReadDuringWrite; | ||
33 | public static String fileExists; | ||
34 | public static String fileNotFound; | ||
35 | public static String moving; | ||
36 | public static String noFileSystem; | ||
37 | public static String noImplDelete; | ||
38 | public static String noImplWrite; | ||
39 | public static String noScheme; | ||
40 | public static String notAFile; | ||
41 | public static String readOnlyParent; | ||
42 | |||
43 | static { | ||
44 | // initialize resource bundles | ||
45 | NLS.initializeMessages(BUNDLE_NAME, Messages.class); | ||
46 | } | ||
47 | |||
48 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFile.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFile.java new file mode 100644 index 0000000..afcd372 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFile.java | |||
@@ -0,0 +1,375 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2005, 2006 IBM Corporation, 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * IBM Corporation - initial API and implementation | ||
10 | * Ken Gilmer - adaptation from internal class. | ||
11 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
12 | *******************************************************************************/ | ||
13 | package org.yocto.bc.ui.filesystem; | ||
14 | |||
15 | import java.io.File; | ||
16 | import java.io.FileInputStream; | ||
17 | import java.io.FileNotFoundException; | ||
18 | import java.io.FileOutputStream; | ||
19 | import java.io.IOException; | ||
20 | import java.io.InputStream; | ||
21 | import java.io.OutputStream; | ||
22 | import java.net.URI; | ||
23 | import java.util.List; | ||
24 | |||
25 | import org.eclipse.core.filesystem.EFS; | ||
26 | import org.eclipse.core.filesystem.IFileInfo; | ||
27 | import org.eclipse.core.filesystem.IFileStore; | ||
28 | import org.eclipse.core.filesystem.IFileSystem; | ||
29 | import org.eclipse.core.filesystem.URIUtil; | ||
30 | import org.eclipse.core.filesystem.provider.FileInfo; | ||
31 | import org.eclipse.core.filesystem.provider.FileStore; | ||
32 | import org.eclipse.core.runtime.CoreException; | ||
33 | import org.eclipse.core.runtime.IPath; | ||
34 | import org.eclipse.core.runtime.IProgressMonitor; | ||
35 | import org.eclipse.core.runtime.IStatus; | ||
36 | import org.eclipse.core.runtime.MultiStatus; | ||
37 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
38 | import org.eclipse.core.runtime.Status; | ||
39 | import org.eclipse.osgi.util.NLS; | ||
40 | import org.eclipse.rse.services.clientserver.messages.SystemMessageException; | ||
41 | import org.eclipse.rse.services.files.IFileService; | ||
42 | import org.eclipse.rse.services.files.IHostFile; | ||
43 | import org.yocto.bc.bitbake.BBSession; | ||
44 | import org.yocto.bc.bitbake.ProjectInfoHelper; | ||
45 | import org.yocto.bc.bitbake.ShellSession; | ||
46 | import org.yocto.bc.ui.Activator; | ||
47 | import org.yocto.bc.ui.model.ProjectInfo; | ||
48 | import org.yocto.bc.ui.model.YoctoHostFile; | ||
49 | |||
50 | /** | ||
51 | * File system implementation based on storage of files in the local | ||
52 | * operating system's file system. | ||
53 | */ | ||
54 | public class OEFile extends FileStore { | ||
55 | private static int attributes(File aFile) { | ||
56 | if (!aFile.exists() || aFile.canWrite()) | ||
57 | return EFS.NONE; | ||
58 | return EFS.ATTRIBUTE_READ_ONLY; | ||
59 | } | ||
60 | |||
61 | |||
62 | protected final YoctoHostFile file; | ||
63 | |||
64 | private List<Object> ignoredPaths; | ||
65 | |||
66 | /** | ||
67 | * The absolute file system path of the file represented by this store. | ||
68 | */ | ||
69 | protected final String filePath; | ||
70 | |||
71 | private final URI root; | ||
72 | |||
73 | /** | ||
74 | * Creates a new local file. | ||
75 | * | ||
76 | * @param file The file this local file represents | ||
77 | * @param root | ||
78 | */ | ||
79 | public OEFile(URI fileURI, List<Object> ignoredPaths, URI root, ProjectInfo projInfo, IProgressMonitor monitor) throws SystemMessageException { | ||
80 | this.ignoredPaths = ignoredPaths; | ||
81 | this.root = root; | ||
82 | this.file = new YoctoHostFile(projInfo, fileURI, monitor); | ||
83 | this.filePath = file.getAbsolutePath(); | ||
84 | } | ||
85 | |||
86 | @Override | ||
87 | public String[] childNames(int options, IProgressMonitor monitor) { | ||
88 | return file.getChildNames(monitor); | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * detect if the path is potential builddir | ||
93 | */ | ||
94 | private boolean isPotentialBuildDir(String path) { | ||
95 | String parentPath = path.substring(0, path.lastIndexOf("/")); | ||
96 | String name = path.substring(path.lastIndexOf("/") + 1); | ||
97 | boolean ret = true; | ||
98 | try { | ||
99 | IFileService fs = file.getFileService(); | ||
100 | IHostFile hostFile = fs.getFile(parentPath, name, new NullProgressMonitor()); | ||
101 | if (!hostFile.isDirectory()) | ||
102 | return false; | ||
103 | IHostFile confDir = fs.getFile(path, BBSession.CONF_DIR, new NullProgressMonitor()); | ||
104 | if (!confDir.exists() || !confDir.isDirectory()) | ||
105 | return false; | ||
106 | for (int i = 0; i < BBSession.BUILDDIR_INDICATORS.length && ret == true; i++) { | ||
107 | IHostFile child = fs.getFile(path + "/" + BBSession.CONF_DIR, BBSession.BUILDDIR_INDICATORS[i], new NullProgressMonitor()); | ||
108 | if(!child.exists() || !child.isFile()) { | ||
109 | ret = false; | ||
110 | break; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | } catch (SystemMessageException e) { | ||
115 | e.printStackTrace(); | ||
116 | } | ||
117 | return ret; | ||
118 | } | ||
119 | |||
120 | /* | ||
121 | * try to find items for ignoreList | ||
122 | */ | ||
123 | private void updateIgnorePaths(String path, List<Object> list, IProgressMonitor monitor) { | ||
124 | if(isPotentialBuildDir(path)) { | ||
125 | BBSession config = null; | ||
126 | try { | ||
127 | config = Activator.getBBSession(Activator.getProjInfo(root), monitor); | ||
128 | config.initialize(); | ||
129 | } catch(Exception e) { | ||
130 | e.printStackTrace(); | ||
131 | return; | ||
132 | } | ||
133 | if (config.get("TMPDIR") == null || config.get("DL_DIR") == null || config.get("SSTATE_DIR") == null) { | ||
134 | //wrong guess about the buildDir | ||
135 | return; | ||
136 | }else { | ||
137 | if(!list.contains(config.get("TMPDIR"))) { | ||
138 | list.add(config.get("TMPDIR")); | ||
139 | } | ||
140 | if(!list.contains(config.get("DL_DIR"))) { | ||
141 | list.add(config.get("DL_DIR")); | ||
142 | } | ||
143 | if(!list.contains(config.get("SSTATE_DIR"))) { | ||
144 | list.add(config.get("SSTATE_DIR")); | ||
145 | } | ||
146 | } | ||
147 | } | ||
148 | } | ||
149 | |||
150 | @Override | ||
151 | public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException { | ||
152 | String[] children = childNames(options, monitor); | ||
153 | IFileStore[] wrapped = new IFileStore[children.length]; | ||
154 | |||
155 | for (int i = 0; i < wrapped.length; i++) { | ||
156 | String fullPath = file.getAbsolutePath() + "/" + children[i]; | ||
157 | updateIgnorePaths(fullPath, ignoredPaths, monitor); | ||
158 | if (ignoredPaths.contains(fullPath)) { | ||
159 | wrapped[i] = getDeadChild(children[i]); | ||
160 | } else { | ||
161 | wrapped[i] = getChild(children[i]); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | return wrapped; | ||
166 | } | ||
167 | |||
168 | @Override | ||
169 | public void copy(IFileStore destFileStore, int options, IProgressMonitor monitor) throws CoreException { | ||
170 | if (destFileStore instanceof OEFile) { | ||
171 | file.copy(destFileStore, monitor); | ||
172 | } | ||
173 | } | ||
174 | |||
175 | @Override | ||
176 | public void delete(int options, IProgressMonitor monitor) throws CoreException { | ||
177 | if (monitor == null) | ||
178 | monitor = new NullProgressMonitor(); | ||
179 | else | ||
180 | monitor = new NullProgressMonitor(); | ||
181 | try { | ||
182 | monitor.beginTask(NLS.bind(Messages.deleting, this), 200); | ||
183 | String message = Messages.deleteProblem; | ||
184 | MultiStatus result = new MultiStatus(Policy.PI_FILE_SYSTEM, EFS.ERROR_DELETE, message, null); | ||
185 | |||
186 | //don't allow Eclipse to delete entire OE directory | ||
187 | |||
188 | if (!isProject()) { | ||
189 | internalDelete(file, filePath, result, monitor); | ||
190 | } | ||
191 | |||
192 | if (!result.isOK()) | ||
193 | throw new CoreException(result); | ||
194 | } finally { | ||
195 | monitor.done(); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | @Override | ||
200 | public boolean equals(Object obj) { | ||
201 | if (!(obj instanceof OEFile)) | ||
202 | return false; | ||
203 | |||
204 | OEFile otherFile = (OEFile) obj; | ||
205 | |||
206 | return file.equals(otherFile.file); | ||
207 | } | ||
208 | |||
209 | @Override | ||
210 | public IFileInfo fetchInfo(int options, IProgressMonitor monitor) { | ||
211 | //in-lined non-native implementation | ||
212 | FileInfo info = new FileInfo(file.getName()); | ||
213 | final long lastModified = file.getModifiedDate(); | ||
214 | if (lastModified <= 0) { | ||
215 | //if the file doesn't exist, all other attributes should be default values | ||
216 | info.setExists(false); | ||
217 | return info; | ||
218 | } | ||
219 | info.setLastModified(lastModified); | ||
220 | info.setExists(true); | ||
221 | info.setLength(file.getSize()); | ||
222 | info.setDirectory(file.isDirectory()); | ||
223 | info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, file.exists() && !file.canWrite()); | ||
224 | info.setAttribute(EFS.ATTRIBUTE_HIDDEN, file.isHidden()); | ||
225 | return info; | ||
226 | } | ||
227 | |||
228 | @Override | ||
229 | public IFileStore getChild(IPath path) { | ||
230 | try { | ||
231 | return new OEFile(file.getChildURIformPath(path), ignoredPaths, root, file.getProjectInfo(), new NullProgressMonitor()); | ||
232 | } catch (SystemMessageException e) { | ||
233 | e.printStackTrace(); | ||
234 | return null; | ||
235 | } | ||
236 | } | ||
237 | |||
238 | @Override | ||
239 | public IFileStore getChild(String name) { | ||
240 | |||
241 | try { | ||
242 | return new OEFile(file.getChildURI(name), ignoredPaths, root, file.getProjectInfo(), new NullProgressMonitor()); | ||
243 | } catch (SystemMessageException e) { | ||
244 | e.printStackTrace(); | ||
245 | } | ||
246 | return null; | ||
247 | |||
248 | } | ||
249 | |||
250 | private IFileStore getDeadChild(String name) { | ||
251 | return new OEIgnoreFile(file.getChildHostFile(name)); | ||
252 | } | ||
253 | |||
254 | /* | ||
255 | * (non-Javadoc) | ||
256 | * @see org.eclipse.core.filesystem.IFileStore#getFileSystem() | ||
257 | */ | ||
258 | @Override | ||
259 | public IFileSystem getFileSystem() { | ||
260 | return OEFileSystem.getInstance(); | ||
261 | } | ||
262 | |||
263 | @Override | ||
264 | public String getName() { | ||
265 | return file.getName(); | ||
266 | } | ||
267 | |||
268 | @Override | ||
269 | public IFileStore getParent() { | ||
270 | URI parentURI = file.getParentFile(); | ||
271 | try { | ||
272 | return parentURI == null ? null : new OEFile(parentURI, ignoredPaths, root, file.getProjectInfo(), new NullProgressMonitor()); | ||
273 | } catch (SystemMessageException e) { | ||
274 | e.printStackTrace(); | ||
275 | return null; | ||
276 | } | ||
277 | } | ||
278 | |||
279 | @Override | ||
280 | public int hashCode() { | ||
281 | return file.hashCode(); | ||
282 | } | ||
283 | |||
284 | /** | ||
285 | * Deletes the given file recursively, adding failure info to | ||
286 | * the provided status object. The filePath is passed as a parameter | ||
287 | * to optimize java.io.File object creation. | ||
288 | */ | ||
289 | private boolean internalDelete(YoctoHostFile target, String pathToDelete, MultiStatus status, IProgressMonitor monitor) { | ||
290 | target.delete(monitor); | ||
291 | return false; | ||
292 | } | ||
293 | |||
294 | @Override | ||
295 | public boolean isParentOf(IFileStore other) { | ||
296 | if (!(other instanceof OEFile)) | ||
297 | return false; | ||
298 | String thisPath = filePath; | ||
299 | String thatPath = ((OEFile) other).filePath; | ||
300 | int thisLength = thisPath.length(); | ||
301 | int thatLength = thatPath.length(); | ||
302 | //if equal then not a parent | ||
303 | if (thisLength >= thatLength) | ||
304 | return false; | ||
305 | if (getFileSystem().isCaseSensitive()) { | ||
306 | if (thatPath.indexOf(thisPath) != 0) | ||
307 | return false; | ||
308 | } else { | ||
309 | if (thatPath.toLowerCase().indexOf(thisPath.toLowerCase()) != 0) | ||
310 | return false; | ||
311 | } | ||
312 | //The common portion must end with a separator character for this to be a parent of that | ||
313 | return thisPath.charAt(thisLength - 1) == File.separatorChar || thatPath.charAt(thisLength) == File.separatorChar; | ||
314 | } | ||
315 | |||
316 | /** | ||
317 | * @return | ||
318 | */ | ||
319 | private boolean isProject() { | ||
320 | return this.file.toString().equals(root); | ||
321 | } | ||
322 | |||
323 | @Override | ||
324 | public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException { | ||
325 | file.mkdir(options); | ||
326 | return this; | ||
327 | } | ||
328 | |||
329 | @Override | ||
330 | public void move(IFileStore destFile, int options, IProgressMonitor monitor) throws CoreException { | ||
331 | file.move(destFile, monitor); | ||
332 | } | ||
333 | |||
334 | @Override | ||
335 | public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException { | ||
336 | return file.getInputStream(options, monitor); | ||
337 | } | ||
338 | |||
339 | @Override | ||
340 | public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException { | ||
341 | return file.getOutputStream(options, monitor); | ||
342 | } | ||
343 | |||
344 | @Override | ||
345 | public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException { | ||
346 | file.putInfo(info, options, monitor); | ||
347 | } | ||
348 | |||
349 | /* (non-Javadoc) | ||
350 | * @see org.eclipse.core.filesystem.provider.FileStore#toLocalFile(int, org.eclipse.core.runtime.IProgressMonitor) | ||
351 | */ | ||
352 | @Override | ||
353 | public File toLocalFile(int options, IProgressMonitor monitor) throws CoreException { | ||
354 | return file.toLocalFile(); | ||
355 | } | ||
356 | |||
357 | /* (non-Javadoc) | ||
358 | * @see org.eclipse.core.filesystem.IFileStore#toString() | ||
359 | */ | ||
360 | @Override | ||
361 | public String toString() { | ||
362 | return file.toString(); | ||
363 | } | ||
364 | |||
365 | /* (non-Javadoc) | ||
366 | * @see org.eclipse.core.filesystem.IFileStore#toURI() | ||
367 | */ | ||
368 | @Override | ||
369 | public URI toURI() { | ||
370 | return URIUtil.toURI(filePath); | ||
371 | } | ||
372 | public String getParentPath() { | ||
373 | return filePath.substring(0, filePath.lastIndexOf("/")); | ||
374 | } | ||
375 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java new file mode 100644 index 0000000..a9712d3 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java | |||
@@ -0,0 +1,103 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.filesystem; | ||
13 | |||
14 | import java.io.File; | ||
15 | import java.lang.reflect.InvocationTargetException; | ||
16 | import java.net.URI; | ||
17 | import java.util.ArrayList; | ||
18 | import java.util.Hashtable; | ||
19 | import java.util.List; | ||
20 | import java.util.Map; | ||
21 | |||
22 | import org.eclipse.core.filesystem.IFileStore; | ||
23 | import org.eclipse.core.filesystem.IFileSystem; | ||
24 | import org.eclipse.core.filesystem.provider.FileSystem; | ||
25 | import org.eclipse.core.runtime.CoreException; | ||
26 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
27 | import org.eclipse.rse.services.clientserver.messages.SystemMessageException; | ||
28 | import org.yocto.bc.bitbake.BBSession; | ||
29 | import org.yocto.bc.ui.Activator; | ||
30 | import org.yocto.bc.ui.model.ProjectInfo; | ||
31 | |||
32 | /** | ||
33 | * A filesystem that ignores specific OE directories that contain derived information. | ||
34 | * @author kgilmer | ||
35 | * | ||
36 | */ | ||
37 | public class OEFileSystem extends FileSystem { | ||
38 | |||
39 | private static IFileSystem ref; | ||
40 | private ProjectInfo projInfo; | ||
41 | |||
42 | public static IFileSystem getInstance() { | ||
43 | return ref; | ||
44 | } | ||
45 | |||
46 | private Map fileStoreCache; | ||
47 | |||
48 | public OEFileSystem() { | ||
49 | ref = this; | ||
50 | fileStoreCache = new Hashtable(); | ||
51 | } | ||
52 | |||
53 | @Override | ||
54 | public IFileStore getStore(URI uri) { | ||
55 | |||
56 | OEFile uf = (OEFile) fileStoreCache.get(uri); | ||
57 | setProjInfo(uri); | ||
58 | |||
59 | if (uf == null) { | ||
60 | BBSession config = null; | ||
61 | try { | ||
62 | config = Activator.getBBSession(projInfo, new NullProgressMonitor()); | ||
63 | config.initialize(); | ||
64 | } catch (Exception e) { | ||
65 | return new CustomLocalFile(projInfo.getProjectName(), new File(uri.getPath())); | ||
66 | } | ||
67 | |||
68 | if (config.get("TMPDIR") == null || config.get("DL_DIR") == null || config.get("SSTATE_DIR")== null) { | ||
69 | throw new RuntimeException("Invalid local.conf: TMPDIR or DL_DIR or SSTATE_DIR undefined."); | ||
70 | } | ||
71 | |||
72 | List ignoreList = new ArrayList(); | ||
73 | |||
74 | //These directories are ignored because they contain too many files for Eclipse to handle efficiently. | ||
75 | ignoreList.add(config.get("TMPDIR")); | ||
76 | ignoreList.add(config.get("DL_DIR")); | ||
77 | ignoreList.add(config.get("SSTATE_DIR")); | ||
78 | |||
79 | //FIXME: add project info | ||
80 | try { | ||
81 | uf = new OEFile(uri, ignoreList, uri, projInfo, new NullProgressMonitor()); | ||
82 | fileStoreCache.put(uri, uf); | ||
83 | } catch (SystemMessageException e) { | ||
84 | e.printStackTrace(); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | return uf; | ||
89 | } | ||
90 | |||
91 | private void setProjInfo(URI uri) { | ||
92 | try { | ||
93 | if(projInfo == null) | ||
94 | projInfo = Activator.getProjInfo(uri); | ||
95 | } catch (CoreException e) { | ||
96 | e.printStackTrace(); | ||
97 | } catch (InvocationTargetException e) { | ||
98 | e.printStackTrace(); | ||
99 | } catch (InterruptedException e) { | ||
100 | e.printStackTrace(); | ||
101 | } | ||
102 | } | ||
103 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java new file mode 100644 index 0000000..cfff7d6 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java | |||
@@ -0,0 +1,34 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol(Intel) - initial API and implementation | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.filesystem; | ||
13 | |||
14 | import java.net.URI; | ||
15 | |||
16 | import org.eclipse.swt.widgets.Shell; | ||
17 | import org.eclipse.ui.ide.fileSystem.FileSystemContributor; | ||
18 | |||
19 | public class OEFileSystemContributor extends FileSystemContributor { | ||
20 | |||
21 | public OEFileSystemContributor() { | ||
22 | } | ||
23 | |||
24 | @Override | ||
25 | public URI browseFileSystem(String initialPath, Shell shell) { | ||
26 | return null; | ||
27 | } | ||
28 | |||
29 | @Override | ||
30 | public URI getURI(String string) { | ||
31 | return super.getURI(string); | ||
32 | } | ||
33 | |||
34 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEIgnoreFile.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEIgnoreFile.java new file mode 100644 index 0000000..2434347 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEIgnoreFile.java | |||
@@ -0,0 +1,135 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.filesystem; | ||
13 | |||
14 | import java.io.File; | ||
15 | import java.io.InputStream; | ||
16 | import java.io.OutputStream; | ||
17 | import java.net.URI; | ||
18 | |||
19 | import org.eclipse.core.filesystem.IFileInfo; | ||
20 | import org.eclipse.core.filesystem.IFileStore; | ||
21 | import org.eclipse.core.filesystem.IFileSystem; | ||
22 | import org.eclipse.core.filesystem.provider.FileInfo; | ||
23 | import org.eclipse.core.runtime.CoreException; | ||
24 | import org.eclipse.core.runtime.IPath; | ||
25 | import org.eclipse.core.runtime.IProgressMonitor; | ||
26 | import org.yocto.bc.ui.model.YoctoHostFile; | ||
27 | |||
28 | public class OEIgnoreFile implements IFileStore { | ||
29 | |||
30 | private final YoctoHostFile file; | ||
31 | |||
32 | public OEIgnoreFile(YoctoHostFile file) { | ||
33 | this.file = file; | ||
34 | } | ||
35 | |||
36 | public IFileInfo[] childInfos(int options, IProgressMonitor monitor) throws CoreException { | ||
37 | |||
38 | return new IFileInfo[0]; | ||
39 | } | ||
40 | |||
41 | public String[] childNames(int options, IProgressMonitor monitor) throws CoreException { | ||
42 | return new String[0]; | ||
43 | } | ||
44 | |||
45 | public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException { | ||
46 | |||
47 | return new IFileStore[0]; | ||
48 | } | ||
49 | |||
50 | public void copy(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException { | ||
51 | // TODO Auto-generated method stub | ||
52 | |||
53 | } | ||
54 | |||
55 | public void delete(int options, IProgressMonitor monitor) throws CoreException { | ||
56 | // TODO Auto-generated method stub | ||
57 | |||
58 | } | ||
59 | |||
60 | public IFileInfo fetchInfo() { | ||
61 | // TODO Auto-generated method stub | ||
62 | return new FileInfo(file.getName()); | ||
63 | } | ||
64 | |||
65 | public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException { | ||
66 | return new FileInfo(file.getName()); | ||
67 | } | ||
68 | |||
69 | public Object getAdapter(Class adapter) { | ||
70 | // TODO Auto-generated method stub | ||
71 | return null; | ||
72 | } | ||
73 | |||
74 | public IFileStore getChild(IPath path) { | ||
75 | // TODO Auto-generated method stub | ||
76 | return null; | ||
77 | } | ||
78 | |||
79 | |||
80 | |||
81 | public IFileStore getChild(String name) { | ||
82 | return null; | ||
83 | } | ||
84 | |||
85 | public IFileSystem getFileSystem() { | ||
86 | // TODO Auto-generated method stub | ||
87 | return OEFileSystem.getInstance(); | ||
88 | } | ||
89 | |||
90 | public String getName() { | ||
91 | return file.getName(); | ||
92 | } | ||
93 | |||
94 | public IFileStore getParent() { | ||
95 | // TODO Auto-generated method stub | ||
96 | return null; | ||
97 | } | ||
98 | |||
99 | public boolean isParentOf(IFileStore other) { | ||
100 | // TODO Auto-generated method stub | ||
101 | return false; | ||
102 | } | ||
103 | |||
104 | public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException { | ||
105 | return null; | ||
106 | } | ||
107 | |||
108 | public void move(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException { | ||
109 | } | ||
110 | |||
111 | public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException { | ||
112 | return null; | ||
113 | } | ||
114 | |||
115 | public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException { | ||
116 | return null; | ||
117 | } | ||
118 | |||
119 | public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException { | ||
120 | } | ||
121 | |||
122 | public File toLocalFile(int options, IProgressMonitor monitor) throws CoreException { | ||
123 | return file.toLocalFile(); | ||
124 | } | ||
125 | |||
126 | public URI toURI() { | ||
127 | return file.toURI(); | ||
128 | } | ||
129 | |||
130 | public IFileStore getFileStore(IPath path) { | ||
131 | return null; | ||
132 | } | ||
133 | |||
134 | |||
135 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Policy.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Policy.java new file mode 100644 index 0000000..84c0f32 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/Policy.java | |||
@@ -0,0 +1,108 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2000, 2007 IBM Corporation and others. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * IBM Corporation - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.filesystem; | ||
12 | |||
13 | import java.io.IOException; | ||
14 | import java.io.InputStream; | ||
15 | import java.io.OutputStream; | ||
16 | import java.util.Date; | ||
17 | |||
18 | import org.eclipse.core.runtime.CoreException; | ||
19 | import org.eclipse.core.runtime.IProgressMonitor; | ||
20 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
21 | import org.eclipse.core.runtime.OperationCanceledException; | ||
22 | import org.eclipse.core.runtime.Status; | ||
23 | import org.eclipse.core.runtime.SubProgressMonitor; | ||
24 | |||
25 | import org.yocto.bc.ui.Activator; | ||
26 | |||
27 | /** | ||
28 | * Grab bag of utility methods for the file system plugin | ||
29 | */ | ||
30 | public class Policy { | ||
31 | |||
32 | /** | ||
33 | * General debug flag for the plugin | ||
34 | */ | ||
35 | public static boolean DEBUG = false; | ||
36 | |||
37 | public static final String PI_FILE_SYSTEM = "org.eclipse.core.filesystem"; //$NON-NLS-1$ | ||
38 | |||
39 | public static void checkCanceled(IProgressMonitor monitor) { | ||
40 | if (monitor.isCanceled()) | ||
41 | throw new OperationCanceledException(); | ||
42 | } | ||
43 | |||
44 | /** | ||
45 | * Print a debug message to the console. | ||
46 | * Pre-pend the message with the current date and the name of the current thread. | ||
47 | */ | ||
48 | public static void debug(String message) { | ||
49 | StringBuffer buffer = new StringBuffer(); | ||
50 | buffer.append(new Date(System.currentTimeMillis())); | ||
51 | buffer.append(" - ["); //$NON-NLS-1$ | ||
52 | buffer.append(Thread.currentThread().getName()); | ||
53 | buffer.append("] "); //$NON-NLS-1$ | ||
54 | buffer.append(message); | ||
55 | System.out.println(buffer.toString()); | ||
56 | } | ||
57 | |||
58 | public static void error(int code, String message) throws CoreException { | ||
59 | error(code, message, null); | ||
60 | } | ||
61 | |||
62 | public static void error(int code, String message, Throwable exception) throws CoreException { | ||
63 | int severity = code == 0 ? 0 : 1 << (code % 100 / 33); | ||
64 | throw new CoreException(new Status(severity, PI_FILE_SYSTEM, code, message, exception)); | ||
65 | } | ||
66 | |||
67 | public static void log(int severity, String message, Throwable t) { | ||
68 | if (message == null) | ||
69 | message = ""; //$NON-NLS-1$ | ||
70 | Activator.getDefault().getLog().log(new Status(severity, PI_FILE_SYSTEM, 1, message, t)); | ||
71 | } | ||
72 | |||
73 | public static IProgressMonitor monitorFor(IProgressMonitor monitor) { | ||
74 | return monitor == null ? new NullProgressMonitor() : monitor; | ||
75 | } | ||
76 | |||
77 | /** | ||
78 | * Closes a stream and ignores any resulting exception. | ||
79 | */ | ||
80 | public static void safeClose(InputStream in) { | ||
81 | try { | ||
82 | if (in != null) | ||
83 | in.close(); | ||
84 | } catch (IOException e) { | ||
85 | //ignore | ||
86 | } | ||
87 | } | ||
88 | |||
89 | /** | ||
90 | * Closes a stream and ignores any resulting exception. | ||
91 | */ | ||
92 | public static void safeClose(OutputStream out) { | ||
93 | try { | ||
94 | if (out != null) | ||
95 | out.close(); | ||
96 | } catch (IOException e) { | ||
97 | //ignore | ||
98 | } | ||
99 | } | ||
100 | |||
101 | public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) { | ||
102 | if (monitor == null) | ||
103 | return new NullProgressMonitor(); | ||
104 | if (monitor instanceof NullProgressMonitor) | ||
105 | return monitor; | ||
106 | return new SubProgressMonitor(monitor, ticks); | ||
107 | } | ||
108 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/YoctoLocation.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/YoctoLocation.java new file mode 100755 index 0000000..40d9345 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/YoctoLocation.java | |||
@@ -0,0 +1,44 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ioana Grigoropol(Intel) - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.filesystem; | ||
12 | |||
13 | import java.net.URI; | ||
14 | import java.net.URISyntaxException; | ||
15 | |||
16 | public class YoctoLocation{ | ||
17 | URI oefsURI; | ||
18 | URI originalURI; | ||
19 | |||
20 | public YoctoLocation(){ | ||
21 | try { | ||
22 | oefsURI = new URI(""); | ||
23 | originalURI = new URI(""); | ||
24 | } catch (URISyntaxException e) { | ||
25 | e.printStackTrace(); | ||
26 | } | ||
27 | } | ||
28 | |||
29 | public URI getOEFSURI() { | ||
30 | return oefsURI; | ||
31 | } | ||
32 | |||
33 | public URI getOriginalURI() { | ||
34 | return originalURI; | ||
35 | } | ||
36 | |||
37 | public void setOriginalURI(URI originalURI) { | ||
38 | this.originalURI = originalURI; | ||
39 | } | ||
40 | |||
41 | public void setOEFSURI(URI uri) { | ||
42 | this.oefsURI = uri; | ||
43 | } | ||
44 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/IModelElement.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/IModelElement.java new file mode 100644 index 0000000..2892df5 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/IModelElement.java | |||
@@ -0,0 +1,15 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.model; | ||
12 | |||
13 | public interface IModelElement { | ||
14 | public void initialize() throws Exception; | ||
15 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java new file mode 100644 index 0000000..119782d --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java | |||
@@ -0,0 +1,117 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.model; | ||
13 | |||
14 | import java.net.URI; | ||
15 | import java.net.URISyntaxException; | ||
16 | |||
17 | import org.eclipse.core.runtime.IProgressMonitor; | ||
18 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
19 | import org.eclipse.ptp.remote.core.IRemoteServices; | ||
20 | import org.eclipse.rse.core.model.IHost; | ||
21 | import org.eclipse.rse.services.files.IFileService; | ||
22 | import org.yocto.bc.bitbake.ProjectInfoHelper; | ||
23 | import org.yocto.bc.ui.filesystem.YoctoLocation; | ||
24 | import org.yocto.remote.utils.RemoteHelper; | ||
25 | |||
26 | public class ProjectInfo implements IModelElement { | ||
27 | private String name; | ||
28 | private YoctoLocation location; | ||
29 | private String init; | ||
30 | private IHost connection; | ||
31 | private IRemoteServices remoteServices; | ||
32 | |||
33 | public ProjectInfo() { | ||
34 | } | ||
35 | |||
36 | public String getInitScriptPath() { | ||
37 | return init; | ||
38 | } | ||
39 | public String getProjectName() { | ||
40 | return name; | ||
41 | } | ||
42 | public URI getOriginalURI() { | ||
43 | return location.getOriginalURI(); | ||
44 | } | ||
45 | |||
46 | public URI getOEFSURI() { | ||
47 | return location.getOEFSURI(); | ||
48 | } | ||
49 | |||
50 | @Override | ||
51 | public void initialize() throws Exception { | ||
52 | name = new String(); | ||
53 | location = new YoctoLocation(); | ||
54 | init = new String(); | ||
55 | } | ||
56 | |||
57 | public void setInitScriptPath(String init) { | ||
58 | this.init = init; | ||
59 | } | ||
60 | |||
61 | public void setLocationURI(URI location) { | ||
62 | if (this.location == null) | ||
63 | this.location = new YoctoLocation(); | ||
64 | if (location.getScheme().equalsIgnoreCase("oefs")) { | ||
65 | if (this.name == null) { | ||
66 | String path = location.getPath(); | ||
67 | this.name = path.substring(path.lastIndexOf("/") + 1); | ||
68 | } | ||
69 | location = RemoteHelper.retrieveURIFromMetaArea(this.name); | ||
70 | } | ||
71 | this.location.setOriginalURI(location); | ||
72 | try { | ||
73 | this.location.setOEFSURI(new URI(ProjectInfoHelper.OEFS_SCHEME + location.getPath() )); | ||
74 | } catch (URISyntaxException e) { | ||
75 | try { | ||
76 | this.location.setOEFSURI(new URI("")); | ||
77 | } catch (URISyntaxException e1) { | ||
78 | e1.printStackTrace(); | ||
79 | } | ||
80 | e.printStackTrace(); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | public void setName(String name) { | ||
85 | this.name = name; | ||
86 | } | ||
87 | |||
88 | public IHost getConnection() { | ||
89 | if (connection == null && RemoteHelper.isInitialized(getOriginalURI())) { | ||
90 | connection = RemoteHelper.getRemoteConnectionForURI(location.getOriginalURI(), new NullProgressMonitor()); | ||
91 | } | ||
92 | return connection; | ||
93 | } | ||
94 | |||
95 | public void setConnection(IHost connection) { | ||
96 | this.connection = connection; | ||
97 | } | ||
98 | |||
99 | public IRemoteServices getRemoteServices() { | ||
100 | return remoteServices; | ||
101 | } | ||
102 | |||
103 | public void setRemoteServices(IRemoteServices remoteServices) { | ||
104 | this.remoteServices = remoteServices; | ||
105 | } | ||
106 | |||
107 | public IFileService getFileService(IProgressMonitor monitor){ | ||
108 | try { | ||
109 | if (!RemoteHelper.isInitialized(getOriginalURI())) | ||
110 | return null; | ||
111 | return RemoteHelper.getConnectedRemoteFileService(connection, monitor); | ||
112 | } catch (Exception e) { | ||
113 | e.printStackTrace(); | ||
114 | return null; | ||
115 | } | ||
116 | } | ||
117 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/YoctoHostFile.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/YoctoHostFile.java new file mode 100644 index 0000000..7113efb --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/YoctoHostFile.java | |||
@@ -0,0 +1,326 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ioana Grigoropol(Intel) - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.model; | ||
12 | |||
13 | import java.io.File; | ||
14 | import java.io.InputStream; | ||
15 | import java.io.OutputStream; | ||
16 | import java.net.URI; | ||
17 | import java.net.URISyntaxException; | ||
18 | import java.util.ArrayList; | ||
19 | |||
20 | import org.eclipse.core.filesystem.EFS; | ||
21 | import org.eclipse.core.filesystem.IFileInfo; | ||
22 | import org.eclipse.core.filesystem.IFileStore; | ||
23 | import org.eclipse.core.runtime.CoreException; | ||
24 | import org.eclipse.core.runtime.IPath; | ||
25 | import org.eclipse.core.runtime.IProgressMonitor; | ||
26 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
27 | import org.eclipse.osgi.util.NLS; | ||
28 | import org.eclipse.rse.core.model.IHost; | ||
29 | import org.eclipse.rse.services.clientserver.messages.SystemMessageException; | ||
30 | import org.eclipse.rse.services.files.IFileService; | ||
31 | import org.eclipse.rse.services.files.IHostFile; | ||
32 | import org.yocto.bc.ui.filesystem.Messages; | ||
33 | import org.yocto.bc.ui.filesystem.OEFile; | ||
34 | import org.yocto.bc.ui.filesystem.Policy; | ||
35 | import org.yocto.remote.utils.RemoteHelper; | ||
36 | |||
37 | public class YoctoHostFile implements IHostFile{ | ||
38 | private IHostFile file; | ||
39 | private final URI fileURI; | ||
40 | private ProjectInfo projectInfo; | ||
41 | private IFileService fileService; | ||
42 | |||
43 | public YoctoHostFile(ProjectInfo pInfo, URI fileURI, IProgressMonitor monitor) throws SystemMessageException { | ||
44 | this.projectInfo = pInfo; | ||
45 | this.fileURI = fileURI; | ||
46 | String path = fileURI.getPath(); | ||
47 | fileService = projectInfo.getFileService(monitor); | ||
48 | file = RemoteHelper.getRemoteHostFile(projectInfo.getConnection(), path, monitor); | ||
49 | } | ||
50 | |||
51 | public YoctoHostFile(ProjectInfo projectInfo, URI uri) { | ||
52 | this.fileURI = uri; | ||
53 | this.projectInfo = projectInfo; | ||
54 | } | ||
55 | |||
56 | public IHostFile getFile() { | ||
57 | return file; | ||
58 | } | ||
59 | public void setFile(IHostFile file) { | ||
60 | this.file = file; | ||
61 | } | ||
62 | public ProjectInfo getProjectInfo() { | ||
63 | return projectInfo; | ||
64 | } | ||
65 | public void setProjectInfo(ProjectInfo projectInfo) { | ||
66 | this.projectInfo = projectInfo; | ||
67 | } | ||
68 | @Override | ||
69 | public String getAbsolutePath() { | ||
70 | return file.getAbsolutePath(); | ||
71 | } | ||
72 | @Override | ||
73 | public String getName() { | ||
74 | return file.getName(); | ||
75 | } | ||
76 | public URI getProjectLocationURI() { | ||
77 | return projectInfo.getOriginalURI(); | ||
78 | } | ||
79 | public URI getLocationURI() { | ||
80 | projectInfo.getOriginalURI().getPath().indexOf(file.getAbsolutePath()); | ||
81 | return projectInfo.getOriginalURI(); | ||
82 | } | ||
83 | @Override | ||
84 | public boolean isDirectory() { | ||
85 | return file.isDirectory(); | ||
86 | } | ||
87 | @Override | ||
88 | public String getParentPath() { | ||
89 | return file.getParentPath(); | ||
90 | } | ||
91 | public boolean copy(IFileStore destFileStore, IProgressMonitor monitor) { | ||
92 | IHostFile destFile; | ||
93 | try { | ||
94 | OEFile oeFile = (OEFile)destFileStore; | ||
95 | String parentPath = oeFile.getParentPath(); | ||
96 | destFile = fileService.createFile(parentPath, destFileStore.getName(), monitor); | ||
97 | fileService.copy(file.getParentPath(), file.getName(), destFile.getParentPath(), destFile.getName(), monitor); | ||
98 | } catch (SystemMessageException e) { | ||
99 | e.printStackTrace(); | ||
100 | return false; | ||
101 | } | ||
102 | return true; | ||
103 | } | ||
104 | @Override | ||
105 | public boolean exists() { | ||
106 | return file.exists(); | ||
107 | } | ||
108 | @Override | ||
109 | public boolean canRead() { | ||
110 | return file.canRead(); | ||
111 | } | ||
112 | @Override | ||
113 | public boolean canWrite() { | ||
114 | return file.canWrite(); | ||
115 | } | ||
116 | @Override | ||
117 | public long getModifiedDate() { | ||
118 | return file.getModifiedDate(); | ||
119 | } | ||
120 | @Override | ||
121 | public long getSize() { | ||
122 | return file.getSize(); | ||
123 | } | ||
124 | @Override | ||
125 | public boolean isArchive() { | ||
126 | return file.isArchive(); | ||
127 | } | ||
128 | @Override | ||
129 | public boolean isFile() { | ||
130 | return file.isFile(); | ||
131 | } | ||
132 | @Override | ||
133 | public boolean isHidden() { | ||
134 | return file.isHidden(); | ||
135 | } | ||
136 | @Override | ||
137 | public boolean isRoot() { | ||
138 | return file.isRoot(); | ||
139 | } | ||
140 | @Override | ||
141 | public void renameTo(String newName) { | ||
142 | file.renameTo(newName); | ||
143 | } | ||
144 | public URI getParentFile() { | ||
145 | if (file.getParentPath().isEmpty()) | ||
146 | return null; | ||
147 | try { | ||
148 | return new URI(fileURI.getScheme(), fileURI.getHost(), file.getParentPath(), fileURI.getFragment()); | ||
149 | } catch (URISyntaxException e) { | ||
150 | e.printStackTrace(); | ||
151 | return null; | ||
152 | } | ||
153 | } | ||
154 | public boolean delete(IProgressMonitor monitor) { | ||
155 | try { | ||
156 | fileService.delete(file.getParentPath(), file.getName(), monitor); | ||
157 | } catch (SystemMessageException e) { | ||
158 | e.printStackTrace(); | ||
159 | return false; | ||
160 | } | ||
161 | return true; | ||
162 | } | ||
163 | |||
164 | /** | ||
165 | * This method is called after a failure to modify a file or directory. | ||
166 | * Check to see if the parent is read-only and if so then | ||
167 | * throw an exception with a more specific message and error code. | ||
168 | * | ||
169 | * @param target The file that we failed to modify | ||
170 | * @param exception The low level exception that occurred, or <code>null</code> | ||
171 | * @throws CoreException A more specific exception if the parent is read-only | ||
172 | */ | ||
173 | private void checkReadOnlyParent() throws CoreException { | ||
174 | String parent = file.getParentPath(); | ||
175 | String parentOfParent = parent.substring(0, parent.lastIndexOf("/")); | ||
176 | IHostFile parentFile; | ||
177 | try { | ||
178 | parentFile = fileService.getFile(parentOfParent, parent, new NullProgressMonitor()); | ||
179 | if (parentFile == null || !parentFile.canRead() || !parentFile.canWrite()) { | ||
180 | String message = NLS.bind(Messages.readOnlyParent, parent); | ||
181 | Policy.error(EFS.ERROR_PARENT_READ_ONLY, message, null); | ||
182 | } | ||
183 | } catch (SystemMessageException e) { | ||
184 | e.printStackTrace(); | ||
185 | } | ||
186 | |||
187 | } | ||
188 | |||
189 | public void mkdir(int options) { | ||
190 | try { | ||
191 | |||
192 | if (!file.isDirectory()) { | ||
193 | file = fileService.createFolder(file.getParentPath(), file.getName(), new NullProgressMonitor()); | ||
194 | if (!file.isDirectory()) { | ||
195 | checkReadOnlyParent(); | ||
196 | String message = NLS.bind(Messages.failedCreateWrongType, file.getAbsolutePath()); | ||
197 | Policy.error(EFS.ERROR_WRONG_TYPE, message); | ||
198 | } | ||
199 | } | ||
200 | } catch (SystemMessageException e1) { | ||
201 | e1.printStackTrace(); | ||
202 | } catch (CoreException e) { | ||
203 | e.printStackTrace(); | ||
204 | } | ||
205 | |||
206 | } | ||
207 | |||
208 | public String[] getChildNames(IProgressMonitor monitor) { | ||
209 | if (file.isDirectory()) { | ||
210 | IHostFile[] files; | ||
211 | try { | ||
212 | files = fileService.list(file.getAbsolutePath(), "*", IFileService.FILE_TYPE_FILES_AND_FOLDERS, monitor); | ||
213 | ArrayList<String> names = new ArrayList<String>(); | ||
214 | |||
215 | for (IHostFile f : files) { | ||
216 | names.add(f.getName()); | ||
217 | } | ||
218 | |||
219 | String[] arrNames = new String[names.size()]; | ||
220 | names.toArray(arrNames); | ||
221 | return arrNames; | ||
222 | } catch (SystemMessageException e) { | ||
223 | e.printStackTrace(); | ||
224 | } | ||
225 | } | ||
226 | return new String[]{}; | ||
227 | } | ||
228 | public IHost getConnection() { | ||
229 | return projectInfo.getConnection(); | ||
230 | } | ||
231 | |||
232 | public URI getChildURI(String name) { | ||
233 | try { | ||
234 | return new URI(fileURI.getScheme(), fileURI.getHost(), fileService.getFile(file.getAbsolutePath(), name, null).getAbsolutePath(), fileURI.getFragment()); | ||
235 | } catch (URISyntaxException e) { | ||
236 | e.printStackTrace(); | ||
237 | } catch (SystemMessageException e) { | ||
238 | e.printStackTrace(); | ||
239 | } | ||
240 | return null; | ||
241 | } | ||
242 | public File toLocalFile() { | ||
243 | //TODO | ||
244 | //fileService.getFile(file.getParentPath(), file.getName(), null); | ||
245 | return null; | ||
246 | } | ||
247 | public URI toURI() { | ||
248 | return fileURI; | ||
249 | } | ||
250 | public YoctoHostFile getChildHostFile(String name) { | ||
251 | try { | ||
252 | return new YoctoHostFile(projectInfo, getChildURI(name), new NullProgressMonitor()); | ||
253 | } catch (SystemMessageException e) { | ||
254 | e.printStackTrace(); | ||
255 | return null; | ||
256 | } | ||
257 | } | ||
258 | |||
259 | public URI getChildURIformPath(IPath path) { | ||
260 | try { | ||
261 | String fileName = path.lastSegment(); | ||
262 | path = path.removeLastSegments(1); | ||
263 | String newPath = fileService.getFile(file.getAbsolutePath() + "/" + path.toPortableString(), fileName, null).getAbsolutePath(); | ||
264 | return new URI(fileURI.getScheme(), fileURI.getHost(), newPath, fileURI.getFragment()); | ||
265 | } catch (URISyntaxException e) { | ||
266 | e.printStackTrace(); | ||
267 | return null; | ||
268 | } catch (SystemMessageException e) { | ||
269 | e.printStackTrace(); | ||
270 | return null; | ||
271 | } | ||
272 | } | ||
273 | |||
274 | public void move(IFileStore destFile, IProgressMonitor monitor) { | ||
275 | try { | ||
276 | fileService.move(file.getParentPath(), file.getName(), destFile.getParent().toURI().getPath(), destFile.getName(), monitor); | ||
277 | } catch (SystemMessageException e) { | ||
278 | e.printStackTrace(); | ||
279 | } | ||
280 | } | ||
281 | |||
282 | public OutputStream getOutputStream(int options, IProgressMonitor monitor) { | ||
283 | try { | ||
284 | return fileService.getOutputStream(file.getParentPath(), file.getName(), options, monitor); | ||
285 | } catch (SystemMessageException e) { | ||
286 | e.printStackTrace(); | ||
287 | return null; | ||
288 | } | ||
289 | } | ||
290 | |||
291 | public InputStream getInputStream(int options, IProgressMonitor monitor) { | ||
292 | try { | ||
293 | return fileService.getInputStream(file.getParentPath(), file.getName(), false, monitor); | ||
294 | } catch (SystemMessageException e) { | ||
295 | e.printStackTrace(); | ||
296 | return null; | ||
297 | } | ||
298 | } | ||
299 | |||
300 | public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) { | ||
301 | try { | ||
302 | if ((options & EFS.SET_LAST_MODIFIED) != 0) | ||
303 | fileService.setLastModified(file.getParentPath(), file.getName(), info.getLastModified(), monitor); | ||
304 | } catch (SystemMessageException e) { | ||
305 | e.printStackTrace(); | ||
306 | } | ||
307 | } | ||
308 | |||
309 | public IFileService getFileService() { | ||
310 | return fileService; | ||
311 | } | ||
312 | |||
313 | public void setFileService(IFileService fileService) { | ||
314 | this.fileService = fileService; | ||
315 | } | ||
316 | |||
317 | @Override | ||
318 | public String toString() { | ||
319 | URI uri = this.projectInfo.getOriginalURI(); | ||
320 | try { | ||
321 | return new URI(uri.getScheme(), uri.getHost(), fileURI.getPath(), uri.getFragment()).toString(); | ||
322 | } catch (URISyntaxException e) { | ||
323 | return fileURI.toString(); | ||
324 | } | ||
325 | } | ||
326 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/perspectives/BitbakeCommanderPerspective.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/perspectives/BitbakeCommanderPerspective.java new file mode 100644 index 0000000..b9ddcb6 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/perspectives/BitbakeCommanderPerspective.java | |||
@@ -0,0 +1,89 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.perspectives; | ||
12 | |||
13 | import org.eclipse.ui.IFolderLayout; | ||
14 | import org.eclipse.ui.IPageLayout; | ||
15 | import org.eclipse.ui.IPerspectiveFactory; | ||
16 | import org.eclipse.ui.console.IConsoleConstants; | ||
17 | |||
18 | import org.yocto.bc.ui.views.RecipeView; | ||
19 | |||
20 | public class BitbakeCommanderPerspective implements IPerspectiveFactory { | ||
21 | |||
22 | private IPageLayout factory; | ||
23 | |||
24 | public BitbakeCommanderPerspective() { | ||
25 | super(); | ||
26 | } | ||
27 | |||
28 | private void addActionSets() { | ||
29 | factory.addActionSet("org.yocto.bc.ui.actionSet"); | ||
30 | factory.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET); // NON-NLS-1 | ||
31 | } | ||
32 | |||
33 | private void addNewWizardShortcuts() { | ||
34 | factory.addNewWizardShortcut("org.yocto.bc.ui.wizards.NewRecipeWizard");// NON-NLS-1 | ||
35 | //factory.addNewWizardShortcut("org.yocto.bc.ui.wizards.newproject.NewBBCProjectWizard");// NON-NLS-1 | ||
36 | factory.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");// NON-NLS-1 | ||
37 | } | ||
38 | |||
39 | private void addPerspectiveShortcuts() { | ||
40 | // factory.addPerspectiveShortcut("org.eclipse.team.ui.TeamSynchronizingPerspective"); | ||
41 | // //NON-NLS-1 | ||
42 | // factory.addPerspectiveShortcut("org.eclipse.team.cvs.ui.cvsPerspective"); | ||
43 | // //NON-NLS-1 | ||
44 | factory.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective"); // NON-NLS-1 | ||
45 | } | ||
46 | |||
47 | private void addViews() { | ||
48 | IFolderLayout bottom = factory.createFolder("bottomRight", // NON-NLS-1 | ||
49 | IPageLayout.BOTTOM, 0.75f, factory.getEditorArea()); | ||
50 | |||
51 | bottom.addView(IPageLayout.ID_PROBLEM_VIEW); | ||
52 | bottom.addView("org.eclipse.team.ui.GenericHistoryView"); // NON-NLS-1 | ||
53 | bottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW); | ||
54 | |||
55 | IFolderLayout topLeft = factory.createFolder("topLeft", // NON-NLS-1 | ||
56 | IPageLayout.LEFT, 0.25f, factory.getEditorArea()); | ||
57 | topLeft.addView(IPageLayout.ID_RES_NAV); | ||
58 | //llu detach RecipeView | ||
59 | //topLeft.addView(RecipeView.ID_VIEW); // NON-NLS-1 | ||
60 | |||
61 | } | ||
62 | |||
63 | private void addViewShortcuts() { | ||
64 | // factory.addShowViewShortcut("org.eclipse.ant.ui.views.AntView"); | ||
65 | // //NON-NLS-1 | ||
66 | // factory.addShowViewShortcut("org.eclipse.team.ccvs.ui.AnnotateView"); | ||
67 | // //NON-NLS-1 | ||
68 | // factory.addShowViewShortcut("org.eclipse.pde.ui.DependenciesView"); | ||
69 | // //NON-NLS-1 | ||
70 | // factory.addShowViewShortcut("org.eclipse.jdt.junit.ResultView"); | ||
71 | // //NON-NLS-1 | ||
72 | factory.addShowViewShortcut("org.eclipse.team.ui.GenericHistoryView"); // NON-NLS-1 | ||
73 | factory.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW); | ||
74 | // factory.addShowViewShortcut(JavaUI.ID_PACKAGES); | ||
75 | factory.addShowViewShortcut(IPageLayout.ID_RES_NAV); | ||
76 | // factory.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW); | ||
77 | // factory.addShowViewShortcut(IPageLayout.ID_OUTLINE); | ||
78 | } | ||
79 | |||
80 | public void createInitialLayout(IPageLayout factory) { | ||
81 | this.factory = factory; | ||
82 | addViews(); | ||
83 | addActionSets(); | ||
84 | addNewWizardShortcuts(); | ||
85 | addPerspectiveShortcuts(); | ||
86 | addViewShortcuts(); | ||
87 | } | ||
88 | |||
89 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/popup/actions/NewAction.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/popup/actions/NewAction.java new file mode 100644 index 0000000..3bdf5d3 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/popup/actions/NewAction.java | |||
@@ -0,0 +1,43 @@ | |||
1 | package org.yocto.bc.ui.popup.actions; | ||
2 | |||
3 | import org.eclipse.jface.action.IAction; | ||
4 | import org.eclipse.jface.dialogs.MessageDialog; | ||
5 | import org.eclipse.jface.viewers.ISelection; | ||
6 | import org.eclipse.swt.widgets.Shell; | ||
7 | import org.eclipse.ui.IActionDelegate; | ||
8 | import org.eclipse.ui.IObjectActionDelegate; | ||
9 | import org.eclipse.ui.IWorkbenchPart; | ||
10 | |||
11 | public class NewAction implements IObjectActionDelegate { | ||
12 | |||
13 | /** | ||
14 | * Constructor for Action1. | ||
15 | */ | ||
16 | public NewAction() { | ||
17 | super(); | ||
18 | } | ||
19 | |||
20 | /** | ||
21 | * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) | ||
22 | */ | ||
23 | public void setActivePart(IAction action, IWorkbenchPart targetPart) { | ||
24 | } | ||
25 | |||
26 | /** | ||
27 | * @see IActionDelegate#run(IAction) | ||
28 | */ | ||
29 | public void run(IAction action) { | ||
30 | Shell shell = new Shell(); | ||
31 | MessageDialog.openInformation( | ||
32 | shell, | ||
33 | "Yocto Project BitBake Commander UI Plug-in", | ||
34 | "New Action was executed."); | ||
35 | } | ||
36 | |||
37 | /** | ||
38 | * @see IActionDelegate#selectionChanged(IAction, ISelection) | ||
39 | */ | ||
40 | public void selectionChanged(IAction action, ISelection selection) { | ||
41 | } | ||
42 | |||
43 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java new file mode 100644 index 0000000..2346031 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeContentProvider.java | |||
@@ -0,0 +1,61 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.views; | ||
13 | |||
14 | import java.util.ArrayList; | ||
15 | import java.util.Collection; | ||
16 | import java.util.List; | ||
17 | |||
18 | import org.eclipse.core.resources.IProject; | ||
19 | import org.eclipse.core.resources.IProjectNature; | ||
20 | import org.eclipse.core.resources.ResourcesPlugin; | ||
21 | import org.eclipse.core.runtime.CoreException; | ||
22 | import org.eclipse.jface.viewers.IStructuredContentProvider; | ||
23 | import org.eclipse.jface.viewers.Viewer; | ||
24 | |||
25 | import org.yocto.bc.bitbake.BBSession; | ||
26 | import org.yocto.bc.ui.Activator; | ||
27 | import org.yocto.bc.ui.builder.BitbakeCommanderNature; | ||
28 | |||
29 | class RecipeContentProvider implements IStructuredContentProvider { | ||
30 | public void dispose() { | ||
31 | } | ||
32 | |||
33 | public Object[] getElements(Object parent) { | ||
34 | List recipes = new ArrayList(); | ||
35 | IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); | ||
36 | IProjectNature nature = null; | ||
37 | for (int i = 0; i < projects.length; ++i) { | ||
38 | try { | ||
39 | if (projects[i].isOpen() && projects[i].hasNature(BitbakeCommanderNature.NATURE_ID)) { | ||
40 | recipes.addAll(getRecipesFromProject(projects[i])); | ||
41 | } | ||
42 | } catch (CoreException e) { | ||
43 | // TODO Auto-generated catch block | ||
44 | e.printStackTrace(); | ||
45 | } catch (Exception e) { | ||
46 | // TODO Auto-generated catch block | ||
47 | e.printStackTrace(); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | return recipes.toArray(); | ||
52 | } | ||
53 | |||
54 | private Collection getRecipesFromProject(IProject project) throws Exception { | ||
55 | BBSession session = Activator.getBBSession(Activator.getProjInfo(project.getLocationURI()), null); | ||
56 | return session.getRecipeFiles(project); | ||
57 | } | ||
58 | |||
59 | public void inputChanged(Viewer v, Object oldInput, Object newInput) { | ||
60 | } | ||
61 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeView.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeView.java new file mode 100644 index 0000000..fdbd8e0 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/views/RecipeView.java | |||
@@ -0,0 +1,165 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.views; | ||
12 | |||
13 | import org.eclipse.core.resources.IFile; | ||
14 | import org.eclipse.jface.action.Action; | ||
15 | import org.eclipse.jface.action.IMenuListener; | ||
16 | import org.eclipse.jface.action.IMenuManager; | ||
17 | import org.eclipse.jface.action.IToolBarManager; | ||
18 | import org.eclipse.jface.action.MenuManager; | ||
19 | import org.eclipse.jface.action.Separator; | ||
20 | import org.eclipse.jface.viewers.DoubleClickEvent; | ||
21 | import org.eclipse.jface.viewers.IDoubleClickListener; | ||
22 | import org.eclipse.jface.viewers.ISelection; | ||
23 | import org.eclipse.jface.viewers.IStructuredSelection; | ||
24 | import org.eclipse.jface.viewers.ITableLabelProvider; | ||
25 | import org.eclipse.jface.viewers.LabelProvider; | ||
26 | import org.eclipse.jface.viewers.TableViewer; | ||
27 | import org.eclipse.jface.viewers.ViewerSorter; | ||
28 | import org.eclipse.swt.SWT; | ||
29 | import org.eclipse.swt.graphics.Image; | ||
30 | import org.eclipse.swt.widgets.Composite; | ||
31 | import org.eclipse.swt.widgets.Menu; | ||
32 | import org.eclipse.ui.IActionBars; | ||
33 | import org.eclipse.ui.ISharedImages; | ||
34 | import org.eclipse.ui.IWorkbenchActionConstants; | ||
35 | import org.eclipse.ui.PartInitException; | ||
36 | import org.eclipse.ui.PlatformUI; | ||
37 | import org.eclipse.ui.part.FileEditorInput; | ||
38 | import org.eclipse.ui.part.ViewPart; | ||
39 | |||
40 | import org.yocto.bc.ui.editors.bitbake.BitBakeFileEditor; | ||
41 | |||
42 | public class RecipeView extends ViewPart { | ||
43 | class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { | ||
44 | public Image getColumnImage(Object obj, int index) { | ||
45 | return getImage(obj); | ||
46 | } | ||
47 | |||
48 | public String getColumnText(Object obj, int index) { | ||
49 | |||
50 | if (obj instanceof IFile) { | ||
51 | return ((IFile) obj).getName(); | ||
52 | } | ||
53 | |||
54 | return getText(obj); | ||
55 | } | ||
56 | |||
57 | @Override | ||
58 | public Image getImage(Object obj) { | ||
59 | return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE); | ||
60 | } | ||
61 | } | ||
62 | public static final String ID_VIEW = "org.yocto.bc.ui.views.RecipeView"; | ||
63 | private TableViewer viewer; | ||
64 | |||
65 | /* private Action action1; | ||
66 | private Action action2; | ||
67 | */ private Action doubleClickAction; | ||
68 | |||
69 | private void contributeToActionBars() { | ||
70 | IActionBars bars = getViewSite().getActionBars(); | ||
71 | fillLocalPullDown(bars.getMenuManager()); | ||
72 | fillLocalToolBar(bars.getToolBarManager()); | ||
73 | } | ||
74 | |||
75 | @Override | ||
76 | public void createPartControl(Composite parent) { | ||
77 | viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); | ||
78 | viewer.setContentProvider(new RecipeContentProvider()); | ||
79 | viewer.setLabelProvider(new ViewLabelProvider()); | ||
80 | viewer.setSorter(new ViewerSorter()); | ||
81 | viewer.setInput(getViewSite()); | ||
82 | makeActions(); | ||
83 | hookContextMenu(); | ||
84 | hookDoubleClickAction(); | ||
85 | contributeToActionBars(); | ||
86 | } | ||
87 | |||
88 | private void fillContextMenu(IMenuManager manager) { | ||
89 | /* manager.add(action1); | ||
90 | manager.add(action2); | ||
91 | */ // Other plug-ins can contribute there actions here | ||
92 | manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); | ||
93 | } | ||
94 | |||
95 | private void fillLocalPullDown(IMenuManager manager) { | ||
96 | /* manager.add(action1); | ||
97 | manager.add(new Separator()); | ||
98 | manager.add(action2); | ||
99 | */ } | ||
100 | |||
101 | private void fillLocalToolBar(IToolBarManager manager) { | ||
102 | /* manager.add(action1); | ||
103 | manager.add(action2); | ||
104 | */ } | ||
105 | |||
106 | private void hookContextMenu() { | ||
107 | MenuManager menuMgr = new MenuManager("#PopupMenu"); | ||
108 | menuMgr.setRemoveAllWhenShown(true); | ||
109 | menuMgr.addMenuListener(new IMenuListener() { | ||
110 | public void menuAboutToShow(IMenuManager manager) { | ||
111 | RecipeView.this.fillContextMenu(manager); | ||
112 | } | ||
113 | }); | ||
114 | Menu menu = menuMgr.createContextMenu(viewer.getControl()); | ||
115 | viewer.getControl().setMenu(menu); | ||
116 | getSite().registerContextMenu(menuMgr, viewer); | ||
117 | } | ||
118 | |||
119 | private void hookDoubleClickAction() { | ||
120 | viewer.addDoubleClickListener(new IDoubleClickListener() { | ||
121 | public void doubleClick(DoubleClickEvent event) { | ||
122 | doubleClickAction.run(); | ||
123 | } | ||
124 | }); | ||
125 | } | ||
126 | |||
127 | private void makeActions() { | ||
128 | /* action1 = new Action() { | ||
129 | public void run() { | ||
130 | } | ||
131 | }; | ||
132 | action1.setText("Action 1"); | ||
133 | action1.setToolTipText("Action 1 tooltip"); | ||
134 | action1.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK)); | ||
135 | |||
136 | action2 = new Action() { | ||
137 | public void run() { | ||
138 | } | ||
139 | }; | ||
140 | action2.setText("Action 2"); | ||
141 | action2.setToolTipText("Action 2 tooltip"); | ||
142 | action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK)); | ||
143 | */ doubleClickAction = new Action() { | ||
144 | @Override | ||
145 | public void run() { | ||
146 | ISelection selection = viewer.getSelection(); | ||
147 | Object obj = ((IStructuredSelection) selection).getFirstElement(); | ||
148 | |||
149 | if (obj instanceof IFile) { | ||
150 | try { | ||
151 | RecipeView.this.getViewSite().getPage().openEditor(new FileEditorInput((IFile) obj), BitBakeFileEditor.EDITOR_ID); | ||
152 | } catch (PartInitException e) { | ||
153 | // TODO Auto-generated catch block | ||
154 | e.printStackTrace(); | ||
155 | } | ||
156 | } | ||
157 | } | ||
158 | }; | ||
159 | } | ||
160 | |||
161 | @Override | ||
162 | public void setFocus() { | ||
163 | viewer.getControl().setFocus(); | ||
164 | } | ||
165 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/BitbakeRecipeUIElement.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/BitbakeRecipeUIElement.java new file mode 100644 index 0000000..c8eea71 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/BitbakeRecipeUIElement.java | |||
@@ -0,0 +1,153 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.wizards; | ||
13 | |||
14 | import org.eclipse.jface.viewers.ISelection; | ||
15 | import org.eclipse.swt.widgets.Text; | ||
16 | |||
17 | import java.net.URI; | ||
18 | import java.net.URISyntaxException; | ||
19 | import java.util.ArrayList; | ||
20 | |||
21 | public class BitbakeRecipeUIElement { | ||
22 | |||
23 | private String container; | ||
24 | private String file; | ||
25 | private String description; | ||
26 | private String license; | ||
27 | private String checksum; | ||
28 | private String homepage; | ||
29 | private String author; | ||
30 | private String section; | ||
31 | private String srcuri; | ||
32 | private String md5sum; | ||
33 | private String sha256sum; | ||
34 | private URI metaDir; | ||
35 | private ArrayList inheritance; | ||
36 | |||
37 | public BitbakeRecipeUIElement() | ||
38 | { | ||
39 | this.container = ""; | ||
40 | this.file = ""; | ||
41 | this.description = ""; | ||
42 | this.license = ""; | ||
43 | this.checksum = ""; | ||
44 | this.homepage = ""; | ||
45 | this.author = ""; | ||
46 | this.section = ""; | ||
47 | this.srcuri = ""; | ||
48 | this.md5sum = ""; | ||
49 | this.sha256sum = ""; | ||
50 | this.inheritance = new ArrayList(); | ||
51 | try { | ||
52 | this.metaDir = new URI(""); | ||
53 | } catch (URISyntaxException e) { | ||
54 | e.printStackTrace(); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | public String getContainer() { | ||
59 | return container; | ||
60 | } | ||
61 | public void setContainer(String value) { | ||
62 | this.container = value; | ||
63 | } | ||
64 | public String getFile() { | ||
65 | return file; | ||
66 | } | ||
67 | public void setFile(String value) { | ||
68 | this.file = value; | ||
69 | } | ||
70 | public String getDescription() { | ||
71 | return description; | ||
72 | } | ||
73 | |||
74 | public void setDescription(String value) { | ||
75 | this.description = value; | ||
76 | } | ||
77 | |||
78 | public String getLicense() { | ||
79 | return license; | ||
80 | } | ||
81 | |||
82 | public void setLicense(String value) { | ||
83 | this.license = value; | ||
84 | } | ||
85 | |||
86 | public String getChecksum() { | ||
87 | return checksum; | ||
88 | } | ||
89 | public void setChecksum(String value) { | ||
90 | this.checksum = value; | ||
91 | } | ||
92 | |||
93 | public String getHomePage() { | ||
94 | return homepage; | ||
95 | } | ||
96 | |||
97 | public void setHomePage(String value) { | ||
98 | this.homepage = value; | ||
99 | } | ||
100 | |||
101 | public String getAuthor() { | ||
102 | return author; | ||
103 | } | ||
104 | |||
105 | public void setAuthor(String value) { | ||
106 | this.author = value; | ||
107 | } | ||
108 | |||
109 | public String getSection() { | ||
110 | return section; | ||
111 | } | ||
112 | public void setSection(String value) { | ||
113 | this.section = value; | ||
114 | } | ||
115 | public String getSrcuri() { | ||
116 | return srcuri; | ||
117 | } | ||
118 | public void setSrcuri(String value) { | ||
119 | this.srcuri = value; | ||
120 | } | ||
121 | |||
122 | public String getMd5sum() { | ||
123 | return md5sum; | ||
124 | } | ||
125 | |||
126 | public void setMd5sum(String value) { | ||
127 | this.md5sum = value; | ||
128 | } | ||
129 | |||
130 | public String getsha256sum() { | ||
131 | return sha256sum; | ||
132 | } | ||
133 | |||
134 | public void setSha256sum(String value) { | ||
135 | this.sha256sum = value; | ||
136 | } | ||
137 | |||
138 | public ArrayList<String> getInheritance() { | ||
139 | return inheritance; | ||
140 | } | ||
141 | |||
142 | public void setInheritance(ArrayList<String> value) { | ||
143 | this.inheritance = value; | ||
144 | } | ||
145 | |||
146 | public URI getMetaDir() { | ||
147 | return metaDir; | ||
148 | } | ||
149 | |||
150 | public void setMetaDir(URI value) { | ||
151 | metaDir = value; | ||
152 | } | ||
153 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizard.java new file mode 100644 index 0000000..8b47498 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizard.java | |||
@@ -0,0 +1,56 @@ | |||
1 | package org.yocto.bc.ui.wizards; | ||
2 | import java.util.Map; | ||
3 | |||
4 | import org.eclipse.jface.wizard.Wizard; | ||
5 | import org.eclipse.swt.widgets.Composite; | ||
6 | |||
7 | |||
8 | |||
9 | public abstract class FiniteStateWizard extends Wizard { | ||
10 | private boolean finishable = false; | ||
11 | private boolean canFinish = false; | ||
12 | |||
13 | public FiniteStateWizard() { | ||
14 | } | ||
15 | |||
16 | public abstract boolean performFinish(); | ||
17 | |||
18 | /** | ||
19 | * @return Returns if the wizard is finishable in its current state. | ||
20 | */ | ||
21 | public boolean isFinishable() { | ||
22 | return finishable; | ||
23 | } | ||
24 | /** | ||
25 | * @param finishable Change the finish state of the wizard. | ||
26 | */ | ||
27 | public void setFinishable(boolean finishable) { | ||
28 | this.finishable = finishable; | ||
29 | } | ||
30 | |||
31 | /* (non-Javadoc) | ||
32 | * @see org.eclipse.jface.wizard.IWizard#createPageControls(org.eclipse.swt.widgets.Composite) | ||
33 | */ | ||
34 | public void createPageControls(Composite pageContainer) { | ||
35 | super.createPageControls(pageContainer); | ||
36 | } | ||
37 | |||
38 | /* | ||
39 | * (non-Javadoc) Method declared on IWizard. | ||
40 | */ | ||
41 | public boolean canFinish() { | ||
42 | if (canFinish) | ||
43 | return true; | ||
44 | return super.canFinish(); | ||
45 | } | ||
46 | |||
47 | public void setCanFinish(boolean canFinish) { | ||
48 | this.canFinish = canFinish; | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * Retrive the model object from the wizard. | ||
53 | * @return | ||
54 | */ | ||
55 | public abstract Map getModel(); | ||
56 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java new file mode 100644 index 0000000..a83a389 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java | |||
@@ -0,0 +1,149 @@ | |||
1 | package org.yocto.bc.ui.wizards; | ||
2 | import java.util.Map; | ||
3 | |||
4 | import org.eclipse.jface.viewers.ISelectionChangedListener; | ||
5 | import org.eclipse.jface.viewers.SelectionChangedEvent; | ||
6 | import org.eclipse.jface.wizard.WizardPage; | ||
7 | import org.eclipse.swt.events.ModifyEvent; | ||
8 | import org.eclipse.swt.events.ModifyListener; | ||
9 | import org.eclipse.swt.events.SelectionEvent; | ||
10 | import org.eclipse.swt.events.SelectionListener; | ||
11 | import org.eclipse.swt.widgets.Composite; | ||
12 | import org.eclipse.swt.widgets.Event; | ||
13 | import org.eclipse.swt.widgets.Listener; | ||
14 | |||
15 | public abstract class FiniteStateWizardPage extends WizardPage { | ||
16 | protected Map model = null; | ||
17 | protected FiniteStateWizard wizard = null; | ||
18 | private static boolean previousState = false; | ||
19 | /** | ||
20 | * @param pageName | ||
21 | */ | ||
22 | protected FiniteStateWizardPage(String name, Map model) { | ||
23 | super(name); | ||
24 | this.model = model; | ||
25 | this.setPageComplete(false); | ||
26 | } | ||
27 | |||
28 | /* | ||
29 | * (non-Javadoc) | ||
30 | * | ||
31 | * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) | ||
32 | */ | ||
33 | public abstract void createControl(Composite parent); | ||
34 | |||
35 | protected void setModelWizard() { | ||
36 | if (wizard == null) { | ||
37 | wizard = (FiniteStateWizard)FiniteStateWizardPage.this.getWizard(); | ||
38 | } | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * Add page validation logic here. Returning <code>true</code> means that | ||
43 | * the page is complete and the user can go to the next page. | ||
44 | * | ||
45 | * @return | ||
46 | */ | ||
47 | protected abstract boolean validatePage(); | ||
48 | |||
49 | /** | ||
50 | * This method should be implemented by ModelWizardPage classes. This method | ||
51 | * is called after the <code>validatePage()</code> returns successfully. | ||
52 | * Update the model with the contents of the controls on the page. | ||
53 | */ | ||
54 | protected abstract void updateModel(); | ||
55 | |||
56 | /** | ||
57 | * Helper method to see if a field has some sort of text in it. | ||
58 | * @param value | ||
59 | * @return | ||
60 | */ | ||
61 | protected boolean hasContents(String value) { | ||
62 | if (value == null || value.length() == 0) { | ||
63 | return false; | ||
64 | } | ||
65 | |||
66 | return true; | ||
67 | } | ||
68 | |||
69 | /** | ||
70 | * This method is called right before a page is displayed. | ||
71 | * This occurs on user action (Next/Back buttons). | ||
72 | */ | ||
73 | public abstract void pageDisplay(); | ||
74 | |||
75 | /** | ||
76 | * This method is called on the concrete WizardPage after the user has | ||
77 | * gone to the page after. | ||
78 | */ | ||
79 | public abstract void pageCleanup(); | ||
80 | |||
81 | /* (non-Javadoc) | ||
82 | * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean) | ||
83 | */ | ||
84 | public void setVisible(boolean arg0) { | ||
85 | |||
86 | if (!arg0 && previousState) { | ||
87 | pageCleanup(); | ||
88 | } else if (arg0 && !previousState) { | ||
89 | pageDisplay(); | ||
90 | } else if (arg0 && previousState) { | ||
91 | pageDisplay(); | ||
92 | } | ||
93 | |||
94 | previousState = arg0; | ||
95 | |||
96 | super.setVisible(arg0); | ||
97 | } | ||
98 | |||
99 | public class ValidationListener implements SelectionListener, ModifyListener, Listener, ISelectionChangedListener { | ||
100 | |||
101 | /* | ||
102 | * (non-Javadoc) | ||
103 | * | ||
104 | * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) | ||
105 | */ | ||
106 | public void widgetSelected(SelectionEvent e) { | ||
107 | validate(); | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * (non-Javadoc) | ||
112 | * | ||
113 | * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) | ||
114 | */ | ||
115 | public void widgetDefaultSelected(SelectionEvent e) { | ||
116 | } | ||
117 | |||
118 | /* | ||
119 | * (non-Javadoc) | ||
120 | * | ||
121 | * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) | ||
122 | */ | ||
123 | public void modifyText(ModifyEvent e) { | ||
124 | validate(); | ||
125 | } | ||
126 | |||
127 | public void validate() { | ||
128 | if (validatePage()) { | ||
129 | updateModel(); | ||
130 | setPageComplete(true); | ||
131 | return; | ||
132 | } | ||
133 | |||
134 | setPageComplete(false); | ||
135 | } | ||
136 | |||
137 | /* (non-Javadoc) | ||
138 | * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) | ||
139 | */ | ||
140 | public void handleEvent(Event event) { | ||
141 | |||
142 | validate(); | ||
143 | } | ||
144 | |||
145 | public void selectionChanged(SelectionChangedEvent event) { | ||
146 | validate(); | ||
147 | } | ||
148 | } | ||
149 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java new file mode 100644 index 0000000..3a2ac71 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java | |||
@@ -0,0 +1,231 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Jessica Zhang (Intel) - Extend to support auto-fill base on src_uri value | ||
11 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
12 | *******************************************************************************/ | ||
13 | package org.yocto.bc.ui.wizards; | ||
14 | |||
15 | import java.io.ByteArrayInputStream; | ||
16 | import java.io.IOException; | ||
17 | import java.io.InputStream; | ||
18 | import java.io.File; | ||
19 | import java.lang.reflect.InvocationTargetException; | ||
20 | import java.util.ArrayList; | ||
21 | |||
22 | import org.eclipse.core.resources.IContainer; | ||
23 | import org.eclipse.core.resources.IFile; | ||
24 | import org.eclipse.core.resources.IProject; | ||
25 | import org.eclipse.core.resources.IResource; | ||
26 | import org.eclipse.core.resources.IWorkspaceRoot; | ||
27 | import org.eclipse.core.resources.ResourcesPlugin; | ||
28 | import org.eclipse.core.runtime.CoreException; | ||
29 | import org.eclipse.core.runtime.IProgressMonitor; | ||
30 | import org.eclipse.core.runtime.IStatus; | ||
31 | import org.eclipse.core.runtime.Path; | ||
32 | import org.eclipse.core.runtime.Status; | ||
33 | import org.eclipse.jface.dialogs.MessageDialog; | ||
34 | import org.eclipse.jface.operation.IRunnableWithProgress; | ||
35 | import org.eclipse.jface.viewers.ISelection; | ||
36 | import org.eclipse.jface.viewers.IStructuredSelection; | ||
37 | import org.eclipse.jface.wizard.Wizard; | ||
38 | import org.eclipse.rse.core.model.IHost; | ||
39 | import org.eclipse.ui.INewWizard; | ||
40 | import org.eclipse.ui.IWorkbench; | ||
41 | import org.eclipse.ui.IWorkbenchPage; | ||
42 | import org.eclipse.ui.IWorkbenchWizard; | ||
43 | import org.eclipse.ui.PartInitException; | ||
44 | import org.eclipse.ui.PlatformUI; | ||
45 | import org.eclipse.ui.ide.IDE; | ||
46 | |||
47 | import org.yocto.bc.bitbake.BBLanguageHelper; | ||
48 | import org.yocto.bc.ui.Activator; | ||
49 | import org.yocto.bc.ui.model.ProjectInfo; | ||
50 | import org.yocto.remote.utils.RemoteHelper; | ||
51 | import org.yocto.remote.utils.YoctoCommand; | ||
52 | |||
53 | public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard { | ||
54 | private NewBitBakeFileRecipeWizardPage page; | ||
55 | private ISelection selection; | ||
56 | private IHost connection; | ||
57 | |||
58 | public NewBitBakeFileRecipeWizard() { | ||
59 | super(); | ||
60 | setNeedsProgressMonitor(true); | ||
61 | } | ||
62 | |||
63 | @Override | ||
64 | public void addPages() { | ||
65 | page = new NewBitBakeFileRecipeWizardPage(selection, connection); | ||
66 | addPage(page); | ||
67 | } | ||
68 | |||
69 | private void doFinish(BitbakeRecipeUIElement element, IProgressMonitor monitor) throws CoreException { | ||
70 | String fileName = element.getFile(); | ||
71 | monitor.beginTask("Creating " + fileName, 2); | ||
72 | IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); | ||
73 | IResource resource = root.findMember(new Path(element.getContainer())); | ||
74 | if (!resource.exists() || !(resource instanceof IContainer)) { | ||
75 | throwCoreException("Container \"" + element.getContainer() + "\" does not exist."); | ||
76 | } | ||
77 | IContainer container = (IContainer) resource; | ||
78 | |||
79 | // If the extension wasn't specified, assume .bb | ||
80 | if (!fileName.endsWith(".bb") && !fileName.endsWith(".inc") && !fileName.endsWith(".conf")) { | ||
81 | fileName = fileName + ".bb"; | ||
82 | } | ||
83 | |||
84 | final IFile file = container.getFile(new Path(fileName)); | ||
85 | try { | ||
86 | InputStream stream = openContentStream(element); | ||
87 | if (file.exists()) { | ||
88 | file.setContents(stream, true, true, monitor); | ||
89 | } else { | ||
90 | file.create(stream, true, monitor); | ||
91 | } | ||
92 | stream.close(); | ||
93 | } catch (IOException e) { | ||
94 | } | ||
95 | monitor.worked(1); | ||
96 | monitor.setTaskName("Opening file for editing..."); | ||
97 | getShell().getDisplay().asyncExec(new Runnable() { | ||
98 | public void run() { | ||
99 | IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); | ||
100 | try { | ||
101 | IDE.openEditor(page, file, true); | ||
102 | } catch (PartInitException e) { | ||
103 | } | ||
104 | } | ||
105 | }); | ||
106 | monitor.worked(1); | ||
107 | } | ||
108 | |||
109 | /** | ||
110 | * We will accept the selection in the workbench to see if we can initialize | ||
111 | * from it. | ||
112 | * | ||
113 | * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) | ||
114 | */ | ||
115 | public void init(IWorkbench workbench, IStructuredSelection selection) { | ||
116 | this.selection = selection; | ||
117 | if (selection instanceof IStructuredSelection) { | ||
118 | Object element = selection.getFirstElement(); | ||
119 | |||
120 | if (element instanceof IResource) { | ||
121 | IProject p = ((IResource)element).getProject(); | ||
122 | try { | ||
123 | ProjectInfo projInfo = Activator.getProjInfo(p.getLocationURI()); | ||
124 | this.connection = projInfo.getConnection(); | ||
125 | } catch (CoreException e) { | ||
126 | e.printStackTrace(); | ||
127 | } catch (InvocationTargetException e) { | ||
128 | e.printStackTrace(); | ||
129 | } catch (InterruptedException e) { | ||
130 | e.printStackTrace(); | ||
131 | } | ||
132 | |||
133 | } | ||
134 | } | ||
135 | } | ||
136 | |||
137 | /** | ||
138 | * We will initialize file contents with a sample text. | ||
139 | * @param srcuri | ||
140 | * @param author | ||
141 | * @param homepage | ||
142 | * @param license | ||
143 | * @param description | ||
144 | * @param fileName | ||
145 | * @param newPage | ||
146 | */ | ||
147 | |||
148 | private InputStream openContentStream(BitbakeRecipeUIElement element) { | ||
149 | |||
150 | StringBuffer sb = new StringBuffer(); | ||
151 | |||
152 | sb.append("DESCRIPTION = \"" + element.getDescription() + "\"\n"); | ||
153 | |||
154 | if (element.getAuthor().length() > 0) { | ||
155 | sb.append("AUTHOR = \"" + element.getAuthor() + "\"\n"); | ||
156 | } | ||
157 | |||
158 | if (element.getHomePage().length() > 0) { | ||
159 | sb.append("HOMEPAGE = \"" + element.getHomePage() + "\"\n"); | ||
160 | } | ||
161 | |||
162 | if (element.getSection().length() > 0) { | ||
163 | sb.append("SECTION = \"" + element.getSection() + "\"\n"); | ||
164 | } | ||
165 | |||
166 | if (element.getLicense().length() > 0) { | ||
167 | sb.append("LICENSE = \"" + element.getLicense() + "\"\n"); | ||
168 | } | ||
169 | |||
170 | if (element.getChecksum().length() > 0) { | ||
171 | sb.append("LIC_FILES_CHKSUM = \"" + element.getChecksum() + "\"\n"); | ||
172 | } | ||
173 | |||
174 | if (element.getSrcuri().length() > 0) { | ||
175 | sb.append("SRC_URI = \"" + element.getSrcuri() + "\"\n"); | ||
176 | } | ||
177 | |||
178 | if (element.getMd5sum().length() > 0) { | ||
179 | sb.append("SRC_URI[md5sum] = \"" + element.getMd5sum() + "\"\n"); | ||
180 | } | ||
181 | |||
182 | if (element.getsha256sum().length() > 0) { | ||
183 | sb.append("SRC_URI[sha256sum] = \"" + element.getsha256sum() + "\"\n"); | ||
184 | } | ||
185 | |||
186 | ArrayList<String> inheritance = element.getInheritance(); | ||
187 | if (!inheritance.isEmpty()) { | ||
188 | Object ia[] = inheritance.toArray(); | ||
189 | String inheritance_str = "inherit "; | ||
190 | for(int i=0; i<ia.length; i++) | ||
191 | inheritance_str += ((String) ia[i]) + " "; | ||
192 | sb.append(inheritance_str); | ||
193 | } | ||
194 | sb.append("\n"); | ||
195 | |||
196 | return new ByteArrayInputStream(sb.toString().getBytes()); | ||
197 | } | ||
198 | |||
199 | @Override | ||
200 | public boolean performFinish() { | ||
201 | final BitbakeRecipeUIElement element = page.populateUIElement(); | ||
202 | |||
203 | IRunnableWithProgress op = new IRunnableWithProgress() { | ||
204 | public void run(IProgressMonitor monitor) throws InvocationTargetException { | ||
205 | try { | ||
206 | doFinish(element, monitor); | ||
207 | RemoteHelper.handleRunCommandRemote(connection, new YoctoCommand("rm -rf " + element.getMetaDir() + "/temp", "", ""), monitor); | ||
208 | } catch (Exception e) { | ||
209 | throw new InvocationTargetException(e); | ||
210 | } finally { | ||
211 | monitor.done(); | ||
212 | } | ||
213 | } | ||
214 | }; | ||
215 | try { | ||
216 | getContainer().run(true, false, op); | ||
217 | } catch (InterruptedException e) { | ||
218 | return false; | ||
219 | } catch (InvocationTargetException e) { | ||
220 | Throwable realException = e.getTargetException(); | ||
221 | MessageDialog.openError(getShell(), "Error", realException.getMessage()); | ||
222 | return false; | ||
223 | } | ||
224 | return true; | ||
225 | } | ||
226 | |||
227 | private void throwCoreException(String message) throws CoreException { | ||
228 | IStatus status = new Status(IStatus.ERROR, "org.yocto.bc.ui", IStatus.OK, message, null); | ||
229 | throw new CoreException(status); | ||
230 | } | ||
231 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java new file mode 100644 index 0000000..3bdcffd --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java | |||
@@ -0,0 +1,592 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Jessica Zhang (Intel) - Extend to support auto-fill base on src_uri value | ||
11 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
12 | *******************************************************************************/ | ||
13 | package org.yocto.bc.ui.wizards; | ||
14 | |||
15 | import java.util.List; | ||
16 | import org.eclipse.core.resources.IContainer; | ||
17 | import org.eclipse.core.resources.IProject; | ||
18 | import org.eclipse.core.resources.IResource; | ||
19 | import org.eclipse.core.resources.ResourcesPlugin; | ||
20 | import org.eclipse.core.runtime.CoreException; | ||
21 | import org.eclipse.core.runtime.IProgressMonitor; | ||
22 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
23 | import org.eclipse.core.runtime.Path; | ||
24 | import org.eclipse.core.runtime.IPath; | ||
25 | import org.eclipse.core.runtime.SubProgressMonitor; | ||
26 | import org.eclipse.jface.operation.IRunnableWithProgress; | ||
27 | import org.eclipse.jface.viewers.ISelection; | ||
28 | import org.eclipse.jface.viewers.IStructuredSelection; | ||
29 | import org.eclipse.jface.window.Window; | ||
30 | import org.eclipse.jface.wizard.WizardPage; | ||
31 | import org.eclipse.rse.core.model.IHost; | ||
32 | import org.eclipse.rse.services.files.IFileService; | ||
33 | import org.eclipse.rse.services.files.IHostFile; | ||
34 | import org.eclipse.swt.SWT; | ||
35 | import org.eclipse.swt.events.ModifyEvent; | ||
36 | import org.eclipse.swt.events.ModifyListener; | ||
37 | import org.eclipse.swt.events.SelectionAdapter; | ||
38 | import org.eclipse.swt.events.SelectionEvent; | ||
39 | import org.eclipse.swt.layout.GridData; | ||
40 | import org.eclipse.swt.layout.GridLayout; | ||
41 | import org.eclipse.swt.widgets.Button; | ||
42 | import org.eclipse.swt.widgets.Composite; | ||
43 | import org.eclipse.swt.widgets.DirectoryDialog; | ||
44 | import org.eclipse.swt.widgets.FileDialog; | ||
45 | import org.eclipse.swt.widgets.Label; | ||
46 | import org.eclipse.swt.widgets.Text; | ||
47 | import org.eclipse.ui.dialogs.ContainerSelectionDialog; | ||
48 | import org.yocto.bc.ui.Activator; | ||
49 | import org.yocto.bc.ui.model.ProjectInfo; | ||
50 | import org.yocto.remote.utils.ProcessStreamBuffer; | ||
51 | import org.yocto.remote.utils.RemoteHelper; | ||
52 | import org.yocto.remote.utils.YoctoCommand; | ||
53 | |||
54 | import java.util.HashMap; | ||
55 | import java.util.Hashtable; | ||
56 | import java.util.Set; | ||
57 | import java.util.ArrayList; | ||
58 | import java.util.Enumeration; | ||
59 | import java.util.Iterator; | ||
60 | import java.util.regex.Pattern; | ||
61 | |||
62 | import java.io.BufferedReader; | ||
63 | import java.io.InputStreamReader; | ||
64 | import java.io.File; | ||
65 | import java.io.FileReader; | ||
66 | import java.io.IOException; | ||
67 | import java.io.FileInputStream; | ||
68 | import java.io.InputStream; | ||
69 | import java.io.FilenameFilter; | ||
70 | import java.security.MessageDigest; | ||
71 | import java.lang.reflect.InvocationTargetException; | ||
72 | import java.math.BigInteger; | ||
73 | import java.net.URI; | ||
74 | import java.net.URISyntaxException; | ||
75 | |||
76 | public class NewBitBakeFileRecipeWizardPage extends WizardPage { | ||
77 | private Text containerText; | ||
78 | private Text fileText; | ||
79 | |||
80 | private Text descriptionText; | ||
81 | private Text licenseText; | ||
82 | private Text checksumText; | ||
83 | private Text homepageText; | ||
84 | private Text authorText; | ||
85 | private Text sectionText; | ||
86 | private Text txtSrcURI; | ||
87 | private Text md5sumText; | ||
88 | private Text sha256sumText; | ||
89 | private Button btnPopulate; | ||
90 | |||
91 | private BitbakeRecipeUIElement element; | ||
92 | |||
93 | private ISelection selection; | ||
94 | private URI metaDirLoc; | ||
95 | private ArrayList inheritance; | ||
96 | private final IHost connection; | ||
97 | |||
98 | private String tempFolderPath; | ||
99 | private String srcFileNameExt; | ||
100 | private String srcFileName; | ||
101 | |||
102 | public static final String TEMP_FOLDER_NAME = "temp"; | ||
103 | public static final String TAR_BZ2_EXT = ".tar.bz2"; | ||
104 | public static final String TAR_GZ_EXT = ".tar.gz"; | ||
105 | public static final String HTTP = "http"; | ||
106 | public static final String FTP ="ftp"; | ||
107 | public static final String BB_RECIPE_EXT =".bb"; | ||
108 | private static final String COPYING_FILE = "COPYING"; | ||
109 | |||
110 | private static final String CMAKE_LIST = "cmakelists.txt"; | ||
111 | private static final String CMAKE = "cmake"; | ||
112 | private static final String SETUP_SCRIPT = "setup.py"; | ||
113 | private static final String DISUTILS = "disutils"; | ||
114 | private static final String CONFIGURE_IN = "configure.in"; | ||
115 | private static final String CONFIGURE_AC = "configure.ac"; | ||
116 | private static final String AUTOTOOLS = "autotools"; | ||
117 | |||
118 | private static final String md5Pattern = "^[0-9a-f]{32}$"; | ||
119 | protected static final String sha256Pattern = "^[0-9a-f]{64}$"; | ||
120 | |||
121 | private static final String MIRRORS_FILE = "mirrors.bbclass"; | ||
122 | private static final String CLASSES_FOLDER = "classes"; | ||
123 | |||
124 | private HashMap<String, String> mirrorTable; | ||
125 | private URI extractDir; | ||
126 | |||
127 | protected ProcessStreamBuffer md5Buffer; | ||
128 | protected ProcessStreamBuffer sha256Buffer; | ||
129 | protected ProcessStreamBuffer md5CopyingBuffer; | ||
130 | |||
131 | public NewBitBakeFileRecipeWizardPage(ISelection selection, IHost connection) { | ||
132 | super("wizardPage"); | ||
133 | setTitle("BitBake Recipe"); | ||
134 | setDescription("Create a new BitBake recipe."); | ||
135 | this.selection = selection; | ||
136 | this.connection = connection; | ||
137 | element = new BitbakeRecipeUIElement(); | ||
138 | inheritance = new ArrayList(); | ||
139 | } | ||
140 | |||
141 | public void createControl(Composite parent) { | ||
142 | final Composite container = new Composite(parent, SWT.NULL); | ||
143 | GridLayout layout = new GridLayout(); | ||
144 | container.setLayout(layout); | ||
145 | layout.numColumns = 3; | ||
146 | layout.verticalSpacing = 9; | ||
147 | |||
148 | Label label = new Label(container, SWT.NULL); | ||
149 | GridData gd = new GridData(); | ||
150 | gd.horizontalSpan = 3; | ||
151 | label.setLayoutData(gd); | ||
152 | |||
153 | label = new Label(container, SWT.NULL); | ||
154 | label.setText("Recipe &Directory:"); | ||
155 | |||
156 | containerText = new Text(container, SWT.BORDER | SWT.SINGLE); | ||
157 | gd = new GridData(GridData.FILL_HORIZONTAL); | ||
158 | containerText.setLayoutData(gd); | ||
159 | containerText.addModifyListener(new ModifyListener() { | ||
160 | public void modifyText(ModifyEvent e) { | ||
161 | dialogChanged(); | ||
162 | } | ||
163 | }); | ||
164 | |||
165 | Button buttonBrowse = new Button(container, SWT.PUSH); | ||
166 | buttonBrowse.setText("Browse..."); | ||
167 | buttonBrowse.addSelectionListener(new SelectionAdapter() { | ||
168 | @Override | ||
169 | public void widgetSelected(SelectionEvent e) { | ||
170 | handleBrowse(container, containerText); | ||
171 | } | ||
172 | }); | ||
173 | |||
174 | label = new Label(container, SWT.NULL); | ||
175 | gd = new GridData(); | ||
176 | gd.horizontalSpan = 3; | ||
177 | label.setLayoutData(gd); | ||
178 | |||
179 | label = new Label(container, SWT.NULL); | ||
180 | label.setText("SRC_&URI:"); | ||
181 | |||
182 | txtSrcURI = new Text(container, SWT.BORDER | SWT.SINGLE); | ||
183 | gd = new GridData(GridData.FILL_HORIZONTAL); | ||
184 | txtSrcURI.setLayoutData(gd); | ||
185 | txtSrcURI.addModifyListener(new ModifyListener() { | ||
186 | public void modifyText(ModifyEvent e) { | ||
187 | if (txtSrcURI.getText().trim().isEmpty()) { | ||
188 | if (btnPopulate != null) | ||
189 | btnPopulate.setEnabled(false); | ||
190 | } else if (btnPopulate != null){ | ||
191 | btnPopulate.setEnabled(true); | ||
192 | } | ||
193 | dialogChanged(); | ||
194 | } | ||
195 | }); | ||
196 | |||
197 | btnPopulate = new Button(container, SWT.PUSH); | ||
198 | btnPopulate.setText("Populate..."); | ||
199 | btnPopulate.setEnabled(false); | ||
200 | btnPopulate.addSelectionListener(new SelectionAdapter() { | ||
201 | @Override | ||
202 | public void widgetSelected(SelectionEvent e) { | ||
203 | handlePopulate(); | ||
204 | } | ||
205 | }); | ||
206 | |||
207 | createField(container, "&Recipe Name:", (fileText = new Text(container, SWT.BORDER | SWT.SINGLE))); | ||
208 | createField(container, "SRC_URI[&md5sum]:", (md5sumText = new Text(container, SWT.BORDER | SWT.SINGLE))); | ||
209 | createField(container, "SRC_URI[&sha256sum]:", (sha256sumText = new Text(container, SWT.BORDER | SWT.SINGLE))); | ||
210 | createField(container, "License File &Checksum:", (checksumText = new Text(container, SWT.BORDER | SWT.SINGLE))); | ||
211 | createField(container, "&Package Description:", (descriptionText = new Text(container, SWT.BORDER | SWT.SINGLE))); | ||
212 | createField(container, "&License:", (licenseText = new Text(container, SWT.BORDER | SWT.SINGLE))); | ||
213 | |||
214 | createField(container, "&Homepage:", (homepageText = new Text(container, SWT.BORDER | SWT.SINGLE))); | ||
215 | createField(container, "Package &Author:", (authorText = new Text(container, SWT.BORDER | SWT.SINGLE))); | ||
216 | createField(container, "&Section:", (sectionText = new Text(container, SWT.BORDER | SWT.SINGLE))); | ||
217 | |||
218 | initialize(); | ||
219 | dialogChanged(); | ||
220 | setControl(container); | ||
221 | } | ||
222 | |||
223 | private void createField(Composite container, String title, Text control) { | ||
224 | Label label = new Label(container, SWT.NONE); | ||
225 | label.setText(title); | ||
226 | label.moveAbove(control); | ||
227 | |||
228 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
229 | gd.horizontalSpan = 2; | ||
230 | control.setLayoutData(gd); | ||
231 | control.addModifyListener(new ModifyListener() { | ||
232 | |||
233 | public void modifyText(ModifyEvent e) { | ||
234 | dialogChanged(); | ||
235 | } | ||
236 | |||
237 | }); | ||
238 | } | ||
239 | |||
240 | private void dialogChanged() { | ||
241 | String containerName = containerText.getText(); | ||
242 | IResource container = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(containerName)); | ||
243 | String fileName = fileText.getText(); | ||
244 | |||
245 | if (containerName.length() == 0) { | ||
246 | updateStatus("Directory must be specified"); | ||
247 | return; | ||
248 | } | ||
249 | |||
250 | if (container == null || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) { | ||
251 | updateStatus("File container must exist"); | ||
252 | return; | ||
253 | } | ||
254 | if (!container.isAccessible()) { | ||
255 | updateStatus("Project must be writable"); | ||
256 | return; | ||
257 | } | ||
258 | |||
259 | IProject project = container.getProject(); | ||
260 | ProjectInfo projInfo = null; | ||
261 | try { | ||
262 | projInfo = Activator.getProjInfo(project.getLocationURI()); | ||
263 | } catch (InvocationTargetException e) { | ||
264 | e.printStackTrace(); | ||
265 | } catch (CoreException e) { | ||
266 | e.printStackTrace(); | ||
267 | } catch (InterruptedException e) { | ||
268 | e.printStackTrace(); | ||
269 | } | ||
270 | metaDirLoc = RemoteHelper.createNewURI(projInfo.getOriginalURI(), "meta"); | ||
271 | |||
272 | if (fileName.length() == 0) { | ||
273 | updateStatus("File name must be specified"); | ||
274 | return; | ||
275 | } | ||
276 | if (fileName.contains(" ")) { | ||
277 | updateStatus("File name must be valid with no space in it"); | ||
278 | return; | ||
279 | } | ||
280 | if (fileName.replace('\\', '/').indexOf('/', 1) > 0) { | ||
281 | updateStatus("File name must be valid"); | ||
282 | return; | ||
283 | } | ||
284 | |||
285 | if (descriptionText.getText().length() == 0) { | ||
286 | updateStatus("Recipe must have a description"); | ||
287 | return; | ||
288 | } | ||
289 | |||
290 | if (licenseText.getText().length() == 0) { | ||
291 | updateStatus("Recipe must have a license"); | ||
292 | return; | ||
293 | } | ||
294 | |||
295 | if (txtSrcURI.getText().length() == 0) { | ||
296 | updateStatus("SRC_URI can't be empty"); | ||
297 | } | ||
298 | |||
299 | updateStatus(null); | ||
300 | } | ||
301 | |||
302 | public BitbakeRecipeUIElement populateUIElement() { | ||
303 | element.setAuthor(authorText.getText()); | ||
304 | element.setChecksum(checksumText.getText()); | ||
305 | element.setContainer(containerText.getText()); | ||
306 | element.setDescription(descriptionText.getText()); | ||
307 | element.setFile(fileText.getText()); | ||
308 | element.setHomePage(homepageText.getText()); | ||
309 | element.setLicense(licenseText.getText()); | ||
310 | element.setMd5sum(md5sumText.getText()); | ||
311 | element.setSection(sectionText.getText()); | ||
312 | element.setSha256sum(sha256sumText.getText()); | ||
313 | element.setSrcuri(txtSrcURI.getText()); | ||
314 | element.setInheritance(inheritance); | ||
315 | element.setMetaDir(metaDirLoc); | ||
316 | |||
317 | return element; | ||
318 | } | ||
319 | |||
320 | private void handleBrowse(final Composite parent, final Text text) { | ||
321 | ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, "Select project directory"); | ||
322 | if (dialog.open() == Window.OK) { | ||
323 | Object[] result = dialog.getResult(); | ||
324 | if (result.length == 1) { | ||
325 | text.setText(((Path) result[0]).toString()); | ||
326 | } | ||
327 | } | ||
328 | } | ||
329 | |||
330 | private void handlePopulate() { | ||
331 | try { | ||
332 | IProgressMonitor monitor = new NullProgressMonitor(); | ||
333 | URI srcURI = new URI(txtSrcURI.getText().trim()); | ||
334 | String scheme = srcURI.getScheme(); | ||
335 | this.srcFileNameExt = getSrcFileName(true); | ||
336 | this.srcFileName = getSrcFileName(false); | ||
337 | if ((scheme.equals(HTTP) || scheme.equals(FTP)) | ||
338 | && (srcFileNameExt.endsWith(TAR_GZ_EXT) || srcFileNameExt.endsWith(TAR_BZ2_EXT))) { | ||
339 | handleRemotePopulate(srcURI, monitor); | ||
340 | } else { | ||
341 | String packageName = srcFileName.replace("-", "_"); | ||
342 | fileText.setText(packageName + BB_RECIPE_EXT); | ||
343 | |||
344 | handleLocalPopulate(srcURI, monitor); | ||
345 | } | ||
346 | } catch (URISyntaxException e) { | ||
347 | e.printStackTrace(); | ||
348 | } catch (InvocationTargetException e) { | ||
349 | e.printStackTrace(); | ||
350 | } catch (InterruptedException e) { | ||
351 | e.printStackTrace(); | ||
352 | } | ||
353 | } | ||
354 | |||
355 | private String getSrcFileName(boolean withExt){ | ||
356 | URI srcURI; | ||
357 | try { | ||
358 | srcURI = new URI(txtSrcURI.getText().trim()); | ||
359 | String path = srcURI.getPath(); | ||
360 | String fileName = path.substring(path.lastIndexOf("/") + 1); | ||
361 | if (withExt) | ||
362 | return fileName; | ||
363 | else { | ||
364 | if (fileName.endsWith(TAR_BZ2_EXT)) { | ||
365 | return fileName.substring(0, fileName.indexOf(TAR_BZ2_EXT)); | ||
366 | } else if(fileName.endsWith(TAR_GZ_EXT)){ | ||
367 | return fileName.substring(0, fileName.indexOf(TAR_GZ_EXT)); | ||
368 | } | ||
369 | } | ||
370 | } catch (URISyntaxException e) { | ||
371 | e.printStackTrace(); | ||
372 | } | ||
373 | return ""; | ||
374 | } | ||
375 | private void handleRemotePopulate(final URI srcURI, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { | ||
376 | populateRecipeName(); | ||
377 | |||
378 | this.getContainer().run(true, true, new IRunnableWithProgress() { | ||
379 | |||
380 | @Override | ||
381 | public void run(IProgressMonitor monitor) throws InvocationTargetException, | ||
382 | InterruptedException { | ||
383 | monitor.beginTask("Populating recipe fields ... ", 100); | ||
384 | try { | ||
385 | String metaDirLocPath = metaDirLoc.getPath(); | ||
386 | monitor.subTask("Cleaning environment"); | ||
387 | YoctoCommand rmYCmd = new YoctoCommand("rm -rf " + TEMP_FOLDER_NAME, metaDirLocPath, ""); | ||
388 | RemoteHelper.handleRunCommandRemote(connection, rmYCmd, new SubProgressMonitor(monitor, 5)); | ||
389 | |||
390 | YoctoCommand mkdirYCmd = new YoctoCommand( "mkdir " + TEMP_FOLDER_NAME, metaDirLocPath, ""); | ||
391 | RemoteHelper.handleRunCommandRemote(connection, mkdirYCmd, new SubProgressMonitor(monitor, 5)); | ||
392 | |||
393 | updateTempFolderPath(); | ||
394 | monitor.worked(10); | ||
395 | |||
396 | monitor.subTask("Downloading package sources"); | ||
397 | |||
398 | updateTempFolderPath(); | ||
399 | |||
400 | YoctoCommand wgetYCmd = new YoctoCommand("wget " + srcURI.toURL(), tempFolderPath, ""); | ||
401 | RemoteHelper.handleRunCommandRemote(connection, wgetYCmd, new SubProgressMonitor(monitor, 40)); | ||
402 | |||
403 | monitor.worked(50); | ||
404 | |||
405 | monitor.subTask("Compute package checksums"); | ||
406 | String md5Cmd = "md5sum " + srcFileNameExt; | ||
407 | YoctoCommand md5YCmd = new YoctoCommand(md5Cmd, tempFolderPath, ""); | ||
408 | |||
409 | RemoteHelper.handleRunCommandRemote(connection, md5YCmd, new SubProgressMonitor(monitor, 10)); | ||
410 | md5Buffer = md5YCmd.getProcessBuffer(); | ||
411 | |||
412 | monitor.worked(60); | ||
413 | |||
414 | String sha256Cmd = "sha256sum " + srcFileNameExt; | ||
415 | YoctoCommand sha256YCmd = new YoctoCommand(sha256Cmd, tempFolderPath, ""); | ||
416 | RemoteHelper.handleRunCommandRemote(connection, sha256YCmd, new SubProgressMonitor(monitor, 10)); | ||
417 | sha256Buffer = sha256YCmd.getProcessBuffer(); | ||
418 | |||
419 | monitor.worked(70); | ||
420 | |||
421 | monitor.subTask("Extracting package"); | ||
422 | extractDir = extractPackage(srcURI, new SubProgressMonitor(monitor, 0)); | ||
423 | monitor.worked(80); | ||
424 | |||
425 | YoctoCommand licenseChecksumCmd = populateLicenseFileChecksum(extractDir, new SubProgressMonitor(monitor, 10)); | ||
426 | md5CopyingBuffer = licenseChecksumCmd.getProcessBuffer(); | ||
427 | |||
428 | monitor.subTask("Creating mirror lookup table"); | ||
429 | mirrorTable = createMirrorLookupTable(new SubProgressMonitor(monitor, 10)); | ||
430 | |||
431 | monitor.worked(90); | ||
432 | monitor.done(); | ||
433 | } catch (Exception e) { | ||
434 | e.printStackTrace(); | ||
435 | } | ||
436 | } | ||
437 | }); | ||
438 | updateSrcUri(mirrorTable, srcURI); | ||
439 | populateInheritance(extractDir, monitor); | ||
440 | |||
441 | String md5Val = md5Buffer.getOutputLineContaining(srcFileNameExt, md5Pattern); | ||
442 | md5sumText.setText(Pattern.matches(md5Pattern, md5Val) ? md5Val : ""); | ||
443 | String sha256Val = sha256Buffer.getOutputLineContaining(srcFileNameExt, sha256Pattern); | ||
444 | sha256sumText.setText(Pattern.matches(sha256Pattern, sha256Val) ? sha256Val : ""); | ||
445 | String checkSumVal = md5CopyingBuffer.getOutputLineContaining(COPYING_FILE, md5Pattern); | ||
446 | checksumText.setText(RemoteHelper.createNewURI(extractDir, COPYING_FILE).toString() + ";md5=" + (Pattern.matches(md5Pattern, checkSumVal) ? checkSumVal : "")); | ||
447 | } | ||
448 | |||
449 | private void updateTempFolderPath(){ | ||
450 | this.tempFolderPath = getMetaFolderPath() + TEMP_FOLDER_NAME + "/"; | ||
451 | } | ||
452 | |||
453 | private String getMetaFolderPath(){ | ||
454 | String sep = metaDirLoc.getPath().endsWith("/")? "" : "/"; | ||
455 | return metaDirLoc.getPath() + sep; | ||
456 | } | ||
457 | |||
458 | private void handleLocalPopulate(URI srcURI, IProgressMonitor monitor) { | ||
459 | populateLicenseFileChecksum(srcURI, monitor); | ||
460 | populateInheritance(srcURI, monitor); | ||
461 | } | ||
462 | |||
463 | private URI extractPackage(URI srcURI, IProgressMonitor monitor) { | ||
464 | try { | ||
465 | String path = srcFileNameExt; | ||
466 | String tarCmd = "tar "; | ||
467 | if (path.endsWith(TAR_BZ2_EXT)) { | ||
468 | tarCmd += "-zxvf "; | ||
469 | } else if(path.endsWith(TAR_GZ_EXT)){ | ||
470 | tarCmd += "-xvf "; | ||
471 | } | ||
472 | |||
473 | RemoteHelper.handleRunCommandRemote(connection, new YoctoCommand(tarCmd + path, tempFolderPath, ""), monitor); | ||
474 | |||
475 | return RemoteHelper.createNewURI(metaDirLoc, TEMP_FOLDER_NAME + "/" + srcFileName); | ||
476 | |||
477 | } catch (Exception e) { | ||
478 | e.printStackTrace(); | ||
479 | } | ||
480 | return null; | ||
481 | } | ||
482 | |||
483 | private void populateInheritance(URI extractDir, IProgressMonitor monitor) { | ||
484 | IHostFile[] hostFiles = RemoteHelper.getRemoteDirContent(connection, metaDirLoc.getPath(), "", IFileService.FILE_TYPE_FILES, monitor); | ||
485 | if (hostFiles == null) | ||
486 | return; | ||
487 | |||
488 | for (IHostFile file: hostFiles) { | ||
489 | String fileName = file.getName(); | ||
490 | if (fileName.equalsIgnoreCase(CMAKE_LIST)){ | ||
491 | inheritance.add(CMAKE); | ||
492 | } else if (fileName.equalsIgnoreCase(SETUP_SCRIPT)) { | ||
493 | inheritance.add(DISUTILS); | ||
494 | } else if (fileName.equalsIgnoreCase(CONFIGURE_AC) || file.getName().equalsIgnoreCase(CONFIGURE_IN)) { | ||
495 | inheritance.add(AUTOTOOLS); | ||
496 | } | ||
497 | } | ||
498 | } | ||
499 | |||
500 | private YoctoCommand populateLicenseFileChecksum(URI extractDir, IProgressMonitor monitor) { | ||
501 | if (extractDir == null) | ||
502 | throw new RuntimeException("Something went wrong during source extraction!"); | ||
503 | |||
504 | try { | ||
505 | YoctoCommand catCmd = new YoctoCommand("md5sum " + COPYING_FILE, extractDir.getPath(), ""); | ||
506 | RemoteHelper.handleRunCommandRemote(connection, catCmd, monitor); | ||
507 | return catCmd; | ||
508 | } catch (Exception e) { | ||
509 | throw new RuntimeException("Unable to process file for MD5 calculation", e); | ||
510 | } | ||
511 | |||
512 | } | ||
513 | |||
514 | private HashMap<String, String> createMirrorLookupTable(IProgressMonitor monitor) throws Exception { | ||
515 | HashMap<String, String> mirrorMap = new HashMap<String, String>(); | ||
516 | |||
517 | YoctoCommand cmd = new YoctoCommand("cat " + MIRRORS_FILE, getMetaFolderPath() + CLASSES_FOLDER, ""); | ||
518 | RemoteHelper.handleRunCommandRemote(connection, cmd, monitor); | ||
519 | |||
520 | if (!cmd.getProcessBuffer().hasErrors()){ | ||
521 | String delims = "[\\t]+"; | ||
522 | List<String> outputLines = cmd.getProcessBuffer().getOutputLines(); | ||
523 | for (String outLine : outputLines) { | ||
524 | String[] tokens = outLine.split(delims); | ||
525 | if (tokens.length < 2) | ||
526 | continue; | ||
527 | String endingStr = " \\n \\"; | ||
528 | int idx = tokens[1].lastIndexOf(endingStr); | ||
529 | String key = tokens[1].substring(0, idx); | ||
530 | mirrorMap.put(key, tokens[0]); | ||
531 | } | ||
532 | } | ||
533 | return mirrorMap; | ||
534 | } | ||
535 | |||
536 | private void populateRecipeName() { | ||
537 | String fileName = fileText.getText(); | ||
538 | if (!fileName.isEmpty()) | ||
539 | return; | ||
540 | |||
541 | String recipeFile = srcFileName.replace("-", "_"); | ||
542 | recipeFile += BB_RECIPE_EXT; | ||
543 | if (recipeFile != null) | ||
544 | fileText.setText(recipeFile); | ||
545 | } | ||
546 | |||
547 | private void updateSrcUri(HashMap<String, String> mirrorsMap, URI srcUri) { | ||
548 | Set<String> mirrors = mirrorsMap.keySet(); | ||
549 | Iterator<String> iter = mirrors.iterator(); | ||
550 | String mirror_key = null; | ||
551 | String srcURL = srcUri.toString(); | ||
552 | |||
553 | while (iter.hasNext()) { | ||
554 | String value = iter.next(); | ||
555 | if (srcURL.startsWith(value)) { | ||
556 | mirror_key = value; | ||
557 | break; | ||
558 | } | ||
559 | } | ||
560 | |||
561 | if (mirror_key != null) { | ||
562 | String replace_string = mirrorsMap.get(mirror_key); | ||
563 | if (replace_string != null) | ||
564 | srcURL = replace_string + srcURL.substring(mirror_key.length()); | ||
565 | } | ||
566 | int idx = srcURL.lastIndexOf("-"); | ||
567 | String new_src_uri = srcURL.substring(0, idx)+"-${PV}" + TAR_GZ_EXT; | ||
568 | txtSrcURI.setText(new_src_uri); | ||
569 | } | ||
570 | |||
571 | private void initialize() { | ||
572 | if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) { | ||
573 | IStructuredSelection ssel = (IStructuredSelection) selection; | ||
574 | if (ssel.size() > 1) | ||
575 | return; | ||
576 | Object obj = ssel.getFirstElement(); | ||
577 | if (obj instanceof IResource) { | ||
578 | IContainer container; | ||
579 | if (obj instanceof IContainer) | ||
580 | container = (IContainer) obj; | ||
581 | else | ||
582 | container = ((IResource) obj).getParent(); | ||
583 | containerText.setText(container.getFullPath().toString()); | ||
584 | } | ||
585 | } | ||
586 | } | ||
587 | |||
588 | private void updateStatus(String message) { | ||
589 | setErrorMessage(message); | ||
590 | setPageComplete(message == null); | ||
591 | } | ||
592 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/BBCProjectPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/BBCProjectPage.java new file mode 100644 index 0000000..71ea70c --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/BBCProjectPage.java | |||
@@ -0,0 +1,236 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2009 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.wizards.importProject; | ||
12 | |||
13 | import java.io.File; | ||
14 | import java.util.Map; | ||
15 | |||
16 | import org.eclipse.core.resources.IProject; | ||
17 | import org.eclipse.core.resources.IResource; | ||
18 | import org.eclipse.core.resources.IWorkspaceRoot; | ||
19 | import org.eclipse.core.resources.ResourcesPlugin; | ||
20 | import org.eclipse.core.runtime.IStatus; | ||
21 | import org.eclipse.swt.SWT; | ||
22 | import org.eclipse.swt.events.SelectionAdapter; | ||
23 | import org.eclipse.swt.events.SelectionEvent; | ||
24 | import org.eclipse.swt.layout.GridData; | ||
25 | import org.eclipse.swt.layout.GridLayout; | ||
26 | import org.eclipse.swt.widgets.Button; | ||
27 | import org.eclipse.swt.widgets.Composite; | ||
28 | import org.eclipse.swt.widgets.DirectoryDialog; | ||
29 | import org.eclipse.swt.widgets.FileDialog; | ||
30 | import org.eclipse.swt.widgets.Label; | ||
31 | import org.eclipse.swt.widgets.Text; | ||
32 | import org.eclipse.ui.PlatformUI; | ||
33 | |||
34 | import org.yocto.bc.ui.wizards.FiniteStateWizardPage; | ||
35 | |||
36 | /** | ||
37 | * Main property page for new project wizard. | ||
38 | * @author kgilmer | ||
39 | * | ||
40 | */ | ||
41 | public class BBCProjectPage extends FiniteStateWizardPage { | ||
42 | |||
43 | private class FileOpenSelectionAdapter extends SelectionAdapter { | ||
44 | @Override | ||
45 | public void widgetSelected(SelectionEvent e) { | ||
46 | FileDialog fd = new FileDialog(PlatformUI.getWorkbench() | ||
47 | .getDisplay().getActiveShell(), SWT.OPEN); | ||
48 | |||
49 | fd.setText("Open Configuration Script"); | ||
50 | fd.setFilterPath(txtProjectLocation.getText()); | ||
51 | |||
52 | String selected = fd.open(); | ||
53 | |||
54 | if (selected != null) { | ||
55 | txtInit.setText(selected); | ||
56 | updateModel(); | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | public static final String PAGE_TITLE = "Yocto Project BitBake Commander Project"; | ||
61 | private Text txtProjectLocation; | ||
62 | |||
63 | private Text txtInit; | ||
64 | private ValidationListener validationListener; | ||
65 | private Text txtProjectName; | ||
66 | |||
67 | public BBCProjectPage(Map model) { | ||
68 | super(PAGE_TITLE, model); | ||
69 | setTitle("Create new Yocto Project BitBake Commander project"); | ||
70 | setMessage("Enter information to create a BitBake Commander project."); | ||
71 | } | ||
72 | |||
73 | public void createControl(Composite parent) { | ||
74 | GridData gdFillH = new GridData(GridData.FILL_HORIZONTAL); | ||
75 | GridData gdVU = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); | ||
76 | |||
77 | Composite top = new Composite(parent, SWT.NONE); | ||
78 | top.setLayoutData(new GridData(GridData.FILL_BOTH)); | ||
79 | top.setLayout(new GridLayout()); | ||
80 | |||
81 | Composite projectNameComp = new Composite(top, SWT.NONE); | ||
82 | GridData gdProjName = new GridData(GridData.FILL_HORIZONTAL); | ||
83 | projectNameComp.setLayoutData(gdProjName); | ||
84 | projectNameComp.setLayout(new GridLayout(2, false)); | ||
85 | Label lblProjectName = new Label(projectNameComp, SWT.NONE); | ||
86 | lblProjectName.setText("N&ame:"); | ||
87 | |||
88 | txtProjectName = new Text(projectNameComp, SWT.BORDER); | ||
89 | txtProjectName.setLayoutData(gdFillH); | ||
90 | txtProjectName.setFocus(); | ||
91 | validationListener = new ValidationListener(); | ||
92 | |||
93 | txtProjectName.addModifyListener(validationListener); | ||
94 | |||
95 | Label lblProjectLocation = new Label(projectNameComp, SWT.None); | ||
96 | lblProjectLocation.setText("&Location:"); | ||
97 | |||
98 | Composite locComposite = new Composite(projectNameComp, SWT.NONE); | ||
99 | GridData gd = new GridData(GridData.VERTICAL_ALIGN_END | ||
100 | | GridData.FILL_HORIZONTAL); | ||
101 | gd.horizontalIndent = 0; | ||
102 | locComposite.setLayoutData(gd); | ||
103 | GridLayout gl = new GridLayout(2, false); | ||
104 | gl.marginWidth = 0; | ||
105 | locComposite.setLayout(gl); | ||
106 | |||
107 | txtProjectLocation = new Text(locComposite, SWT.BORDER); | ||
108 | txtProjectLocation.setLayoutData(gdFillH); | ||
109 | txtProjectLocation.addModifyListener(validationListener); | ||
110 | |||
111 | Button button = new Button(locComposite, SWT.PUSH); | ||
112 | button.setText("Browse..."); | ||
113 | button.addSelectionListener(new SelectionAdapter() { | ||
114 | @Override | ||
115 | public void widgetSelected(SelectionEvent e) { | ||
116 | handleBrowse(); | ||
117 | } | ||
118 | }); | ||
119 | |||
120 | Label lblInit = new Label(projectNameComp, SWT.NONE); | ||
121 | lblInit.setText("Init Script:"); | ||
122 | |||
123 | Composite initComposite = new Composite(projectNameComp, SWT.NONE); | ||
124 | gd = new GridData(GridData.VERTICAL_ALIGN_END | ||
125 | | GridData.FILL_HORIZONTAL); | ||
126 | gd.horizontalIndent = 0; | ||
127 | initComposite.setLayoutData(gd); | ||
128 | gl = new GridLayout(2, false); | ||
129 | gl.marginWidth = 0; | ||
130 | initComposite.setLayout(gl); | ||
131 | |||
132 | txtInit = new Text(initComposite, SWT.BORDER); | ||
133 | GridData gdi = new GridData(GridData.FILL_HORIZONTAL); | ||
134 | txtInit.setLayoutData(gdi); | ||
135 | txtInit.addModifyListener(validationListener); | ||
136 | |||
137 | Button btnLoadInit = new Button(initComposite, SWT.PUSH); | ||
138 | btnLoadInit.setLayoutData(gdVU); | ||
139 | btnLoadInit.setText("Choose..."); | ||
140 | btnLoadInit.addSelectionListener(new FileOpenSelectionAdapter()); | ||
141 | |||
142 | if (System.getenv("OEROOT") != null) { | ||
143 | txtProjectLocation.setText(System.getenv("OEROOT")); | ||
144 | } | ||
145 | |||
146 | setControl(top); | ||
147 | } | ||
148 | |||
149 | private void handleBrowse() { | ||
150 | DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.None); | ||
151 | String dir = dialog.open(); | ||
152 | if (dir != null) { | ||
153 | txtProjectLocation.setText(dir); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | private String getFileSegment(String initScriptPath) { | ||
158 | //return the first segment of " " seperated array, or full string if no " " exists | ||
159 | return initScriptPath.split(" ")[0]; | ||
160 | } | ||
161 | |||
162 | private boolean isValidProjectName(String projectName) { | ||
163 | if (projectName.indexOf('$') > -1) { | ||
164 | return false; | ||
165 | } | ||
166 | |||
167 | return true; | ||
168 | } | ||
169 | |||
170 | |||
171 | @Override | ||
172 | public void pageCleanup() { | ||
173 | // TODO Auto-generated method stub | ||
174 | |||
175 | } | ||
176 | |||
177 | @Override | ||
178 | public void pageDisplay() { | ||
179 | // TODO Auto-generated method stub | ||
180 | |||
181 | } | ||
182 | |||
183 | @Override | ||
184 | protected void updateModel() { | ||
185 | model.put(ImportYoctoProjectWizard.KEY_NAME, txtProjectName.getText()); | ||
186 | model.put(ImportYoctoProjectWizard.KEY_LOCATION, txtProjectLocation.getText()); | ||
187 | model.put(ImportYoctoProjectWizard.KEY_INITPATH, txtInit.getText()); | ||
188 | } | ||
189 | |||
190 | |||
191 | @Override | ||
192 | protected boolean validatePage() { | ||
193 | IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); | ||
194 | |||
195 | IStatus validate = ResourcesPlugin.getWorkspace().validateName(txtProjectName.getText(), IResource.PROJECT); | ||
196 | |||
197 | if (!validate.isOK() || !isValidProjectName(txtProjectName.getText())) { | ||
198 | setErrorMessage("Invalid project name: " + txtProjectName.getText()); | ||
199 | return false; | ||
200 | } | ||
201 | |||
202 | IProject proj = wsroot.getProject(txtProjectName.getText()); | ||
203 | if (proj.exists()) { | ||
204 | setErrorMessage("A project with the name " + txtProjectName.getText() | ||
205 | + " already exists"); | ||
206 | return false; | ||
207 | } | ||
208 | |||
209 | if (txtProjectLocation.getText().trim().length() == 0) { | ||
210 | setErrorMessage("Set directory that contains Poky tree"); | ||
211 | return false; | ||
212 | } | ||
213 | |||
214 | File f = new File(txtProjectLocation.getText()); | ||
215 | if (!f.exists() || !f.isDirectory()) { | ||
216 | setErrorMessage("Invalid Directory"); | ||
217 | return false; | ||
218 | } | ||
219 | |||
220 | if (txtInit.getText().length() == 0) { | ||
221 | setErrorMessage("Set configuration file before BitBake is launched."); | ||
222 | return false; | ||
223 | } | ||
224 | |||
225 | File f2 = new File(getFileSegment(txtInit.getText())); | ||
226 | if (!f2.exists() || f2.isDirectory()) { | ||
227 | setErrorMessage("The configuration file is invalid."); | ||
228 | return false; | ||
229 | } | ||
230 | |||
231 | setErrorMessage(null); | ||
232 | setMessage("All the entries are valid, press \"Finish\" to create the new yocto bitbake project,"+ | ||
233 | "this will take a while. Please don't interrupt till there's output in the Yocto Console window..."); | ||
234 | return true; | ||
235 | } | ||
236 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/ImportYoctoProjectWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/ImportYoctoProjectWizard.java new file mode 100644 index 0000000..75f1763 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/importProject/ImportYoctoProjectWizard.java | |||
@@ -0,0 +1,166 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.wizards.importProject; | ||
13 | |||
14 | import java.io.IOException; | ||
15 | import java.io.Writer; | ||
16 | import java.net.URI; | ||
17 | import java.util.Hashtable; | ||
18 | import java.util.Map; | ||
19 | |||
20 | import org.eclipse.core.runtime.IStatus; | ||
21 | import org.eclipse.core.runtime.Status; | ||
22 | import org.eclipse.jface.viewers.IStructuredSelection; | ||
23 | import org.eclipse.ui.IImportWizard; | ||
24 | import org.eclipse.ui.IWorkbench; | ||
25 | import org.eclipse.ui.IWorkbenchPage; | ||
26 | import org.eclipse.ui.IWorkbenchWindow; | ||
27 | import org.eclipse.ui.PlatformUI; | ||
28 | import org.eclipse.ui.console.ConsolePlugin; | ||
29 | import org.eclipse.ui.console.IConsole; | ||
30 | import org.eclipse.ui.console.IConsoleConstants; | ||
31 | import org.eclipse.ui.console.IConsoleManager; | ||
32 | import org.eclipse.ui.console.IConsoleView; | ||
33 | import org.eclipse.ui.console.MessageConsole; | ||
34 | import org.yocto.bc.ui.Activator; | ||
35 | import org.yocto.bc.ui.model.ProjectInfo; | ||
36 | import org.yocto.bc.ui.wizards.FiniteStateWizard; | ||
37 | import org.yocto.bc.ui.wizards.newproject.BBConfigurationInitializeOperation; | ||
38 | import org.yocto.bc.ui.wizards.newproject.CreateBBCProjectOperation; | ||
39 | |||
40 | public class ImportYoctoProjectWizard extends FiniteStateWizard implements IImportWizard { | ||
41 | protected final static String KEY_OEROOT = "OEROOT"; | ||
42 | public static final String KEY_NAME = "NAME"; | ||
43 | public static final String KEY_LOCATION = "LOCATION"; | ||
44 | public static final String KEY_INITPATH = "INITPATH"; | ||
45 | protected static final String KEY_PINFO = "PINFO"; | ||
46 | |||
47 | private Map projectModel; | ||
48 | private IWorkbench workbench; | ||
49 | private IStructuredSelection selection; | ||
50 | |||
51 | private MessageConsole myConsole; | ||
52 | |||
53 | public ImportYoctoProjectWizard() { | ||
54 | projectModel = new Hashtable(); | ||
55 | } | ||
56 | |||
57 | public Map getModel() { | ||
58 | return projectModel; | ||
59 | } | ||
60 | |||
61 | @Override | ||
62 | public void addPages() { | ||
63 | addPage(new BBCProjectPage(projectModel)); | ||
64 | //addPage(new ConsolePage(projectModel)); | ||
65 | } | ||
66 | |||
67 | |||
68 | public boolean performFinish() { | ||
69 | ProjectInfo pinfo = new ProjectInfo(); | ||
70 | pinfo.setInitScriptPath((String) projectModel.get(ImportYoctoProjectWizard.KEY_INITPATH)); | ||
71 | pinfo.setLocationURI((URI) projectModel.get(ImportYoctoProjectWizard.KEY_LOCATION)); | ||
72 | pinfo.setName((String) projectModel.get(ImportYoctoProjectWizard.KEY_NAME)); | ||
73 | |||
74 | try { | ||
75 | ConsoleWriter cw = new ConsoleWriter(); | ||
76 | this.getContainer().run(false, false, new BBConfigurationInitializeOperation(pinfo, cw)); | ||
77 | myConsole.newMessageStream().println(cw.getContents()); | ||
78 | } catch (Exception e) { | ||
79 | Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e)); | ||
80 | this.getContainer().getCurrentPage().setDescription("Failed to create project: " + e.getMessage()); | ||
81 | //valid = false; | ||
82 | //setPageComplete(valid); | ||
83 | return false; | ||
84 | } | ||
85 | |||
86 | //valid = true; | ||
87 | projectModel.put(ImportYoctoProjectWizard.KEY_PINFO, pinfo); | ||
88 | //setPageComplete(valid); | ||
89 | //ProjectInfo pinfo = (ProjectInfo) projectModel.get(KEY_PINFO); | ||
90 | Activator.putProjInfo(pinfo.getOEFSURI(), pinfo); | ||
91 | try { | ||
92 | getContainer().run(false, false, new CreateBBCProjectOperation(pinfo)); | ||
93 | } catch (Exception e) { | ||
94 | Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e)); | ||
95 | this.getContainer().getCurrentPage().setDescription("Failed to create project: " + e.getMessage()); | ||
96 | return false; | ||
97 | } | ||
98 | |||
99 | return true; | ||
100 | } | ||
101 | |||
102 | public void init(IWorkbench workbench, IStructuredSelection selection) { | ||
103 | this.workbench = workbench; | ||
104 | this.selection = selection; | ||
105 | this.setNeedsProgressMonitor(true); | ||
106 | setWindowTitle("BitBake Commander Project"); | ||
107 | |||
108 | myConsole = findConsole("Yocto Console"); | ||
109 | IWorkbench wb = PlatformUI.getWorkbench(); | ||
110 | IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); | ||
111 | IWorkbenchPage page = win.getActivePage(); | ||
112 | String id = IConsoleConstants.ID_CONSOLE_VIEW; | ||
113 | try { | ||
114 | IConsoleView view = (IConsoleView) page.showView(id); | ||
115 | view.display(myConsole); | ||
116 | } catch (Exception e) { | ||
117 | e.printStackTrace(); | ||
118 | } | ||
119 | } | ||
120 | |||
121 | private MessageConsole findConsole(String name) { | ||
122 | ConsolePlugin plugin = ConsolePlugin.getDefault(); | ||
123 | IConsoleManager conMan = plugin.getConsoleManager(); | ||
124 | IConsole[] existing = conMan.getConsoles(); | ||
125 | for (int i = 0; i < existing.length; i++) | ||
126 | if (name.equals(existing[i].getName())) | ||
127 | return (MessageConsole) existing[i]; | ||
128 | // no console found, so create a new one | ||
129 | MessageConsole myConsole = new MessageConsole(name, null); | ||
130 | conMan.addConsoles(new IConsole[] { myConsole }); | ||
131 | return myConsole; | ||
132 | } | ||
133 | |||
134 | private class ConsoleWriter extends Writer { | ||
135 | |||
136 | private StringBuffer sb; | ||
137 | |||
138 | public ConsoleWriter() { | ||
139 | sb = new StringBuffer(); | ||
140 | } | ||
141 | @Override | ||
142 | public void close() throws IOException { | ||
143 | } | ||
144 | |||
145 | public String getContents() { | ||
146 | return sb.toString(); | ||
147 | } | ||
148 | |||
149 | @Override | ||
150 | public void flush() throws IOException { | ||
151 | } | ||
152 | |||
153 | @Override | ||
154 | public void write(char[] cbuf, int off, int len) throws IOException { | ||
155 | //txtConsole.getText().concat(new String(cbuf)); | ||
156 | sb.append(cbuf); | ||
157 | } | ||
158 | |||
159 | @Override | ||
160 | public void write(String str) throws IOException { | ||
161 | sb.append(str); | ||
162 | } | ||
163 | |||
164 | } | ||
165 | |||
166 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/BBCRemoteProjectContentsLocationArea.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/BBCRemoteProjectContentsLocationArea.java new file mode 100644 index 0000000..6d7c440 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/BBCRemoteProjectContentsLocationArea.java | |||
@@ -0,0 +1,371 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation and others. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - Initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.bc.ui.wizards.install; | ||
12 | |||
13 | import java.net.URI; | ||
14 | |||
15 | import org.eclipse.core.filesystem.URIUtil; | ||
16 | import org.eclipse.core.resources.IProject; | ||
17 | import org.eclipse.core.runtime.Path; | ||
18 | import org.eclipse.core.runtime.Platform; | ||
19 | import org.eclipse.jface.operation.IRunnableContext; | ||
20 | import org.eclipse.ptp.rdt.ui.wizards.RemoteProjectContentsLocationArea; | ||
21 | import org.eclipse.ptp.remote.core.IRemoteFileManager; | ||
22 | import org.eclipse.swt.SWT; | ||
23 | import org.eclipse.swt.events.ModifyEvent; | ||
24 | import org.eclipse.swt.events.ModifyListener; | ||
25 | import org.eclipse.swt.events.SelectionAdapter; | ||
26 | import org.eclipse.swt.events.SelectionEvent; | ||
27 | import org.eclipse.swt.layout.GridData; | ||
28 | import org.eclipse.swt.layout.GridLayout; | ||
29 | import org.eclipse.swt.widgets.Button; | ||
30 | import org.eclipse.swt.widgets.Composite; | ||
31 | import org.eclipse.swt.widgets.Control; | ||
32 | import org.eclipse.swt.widgets.Group; | ||
33 | import org.eclipse.swt.widgets.Label; | ||
34 | import org.eclipse.swt.widgets.Text; | ||
35 | import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; | ||
36 | import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; | ||
37 | |||
38 | import java.net.URI; | ||
39 | |||
40 | import org.eclipse.core.filesystem.URIUtil; | ||
41 | import org.eclipse.core.resources.IProject; | ||
42 | import org.eclipse.core.runtime.Path; | ||
43 | import org.eclipse.core.runtime.Platform; | ||
44 | import org.eclipse.jface.operation.IRunnableContext; | ||
45 | import org.eclipse.ptp.rdt.ui.messages.Messages; | ||
46 | //import org.eclipse.ptp.rdt.ui.serviceproviders.RemoteBuildServiceProvider; | ||
47 | //import org.eclipse.ptp.rdt.core.serviceproviders. | ||
48 | import org.eclipse.ptp.remote.core.IRemoteConnection; | ||
49 | import org.eclipse.ptp.remote.core.IRemoteFileManager; | ||
50 | import org.eclipse.ptp.remote.core.IRemoteServices; | ||
51 | import org.eclipse.ptp.remote.ui.IRemoteUIConnectionManager; | ||
52 | import org.eclipse.ptp.remote.ui.IRemoteUIConstants; | ||
53 | import org.eclipse.ptp.remote.ui.IRemoteUIFileManager; | ||
54 | import org.eclipse.ptp.remote.ui.IRemoteUIServices; | ||
55 | import org.eclipse.ptp.remote.ui.RemoteUIServices; | ||
56 | import org.eclipse.ptp.remote.ui.widgets.RemoteConnectionWidget; | ||
57 | import org.eclipse.swt.SWT; | ||
58 | import org.eclipse.swt.events.ModifyEvent; | ||
59 | import org.eclipse.swt.events.ModifyListener; | ||
60 | import org.eclipse.swt.events.SelectionAdapter; | ||
61 | import org.eclipse.swt.events.SelectionEvent; | ||
62 | import org.eclipse.swt.layout.GridData; | ||
63 | import org.eclipse.swt.layout.GridLayout; | ||
64 | import org.eclipse.swt.widgets.Button; | ||
65 | import org.eclipse.swt.widgets.Composite; | ||
66 | import org.eclipse.swt.widgets.Control; | ||
67 | import org.eclipse.swt.widgets.Group; | ||
68 | import org.eclipse.swt.widgets.Label; | ||
69 | import org.eclipse.swt.widgets.Text; | ||
70 | import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; | ||
71 | import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; | ||
72 | |||
73 | |||
74 | public class BBCRemoteProjectContentsLocationArea { | ||
75 | |||
76 | /** | ||
77 | * IErrorMessageReporter is an interface for type that allow message | ||
78 | * reporting. | ||
79 | * | ||
80 | */ | ||
81 | public interface IErrorMessageReporter { | ||
82 | /** | ||
83 | * Report the error message | ||
84 | * | ||
85 | * @param errorMessage | ||
86 | * String or <code>null</code>. If the errorMessage is null | ||
87 | * then clear any error state. | ||
88 | * @param infoOnly | ||
89 | * the message is an informational message, but the dialog | ||
90 | * cannot continue | ||
91 | * | ||
92 | */ | ||
93 | public void reportError(String errorMessage, boolean infoOnly); | ||
94 | } | ||
95 | |||
96 | private static final String FILE_SCHEME = "file"; //$NON-NLS-1$ | ||
97 | |||
98 | private IProject fExistingProject; | ||
99 | |||
100 | private final IErrorMessageReporter fErrorReporter; | ||
101 | |||
102 | private final IRunnableContext fContext; | ||
103 | |||
104 | //private RemoteBuildServiceProvider fProvider; | ||
105 | |||
106 | private IRemoteConnection fSelectedConnection; | ||
107 | |||
108 | private String fProjectName = IDEResourceInfoUtils.EMPTY_STRING; | ||
109 | |||
110 | private Button fBrowseButton; | ||
111 | |||
112 | private Text fLocationText; | ||
113 | |||
114 | private RemoteConnectionWidget fRemoteConnectionWidget; | ||
115 | |||
116 | // public RemoteProjectContentsLocationArea(IServiceProvider provider, | ||
117 | // Composite composite) { | ||
118 | // if(provider instanceof RemoteBuildServiceProvider) | ||
119 | // fProvider = (RemoteBuildServiceProvider) provider; | ||
120 | // else | ||
121 | // throw new IllegalArgumentException(); // should never happen | ||
122 | // createContents(composite); | ||
123 | // } | ||
124 | /** | ||
125 | * @since 3.1 | ||
126 | */ | ||
127 | public BBCRemoteProjectContentsLocationArea(IErrorMessageReporter reporter, Composite composite, IRunnableContext context) { | ||
128 | fErrorReporter = reporter; | ||
129 | fContext = context; | ||
130 | createContents(composite); | ||
131 | } | ||
132 | |||
133 | /** | ||
134 | * Check if the entry in the widget location is valid. If it is valid return | ||
135 | * null. Otherwise return a string that indicates the problem. | ||
136 | * | ||
137 | * @return String | ||
138 | */ | ||
139 | public String checkValidLocation() { | ||
140 | |||
141 | String locationFieldContents = fLocationText.getText(); | ||
142 | if (locationFieldContents.length() == 0) { | ||
143 | return IDEWorkbenchMessages.WizardNewProjectCreationPage_projectLocationEmpty; | ||
144 | } | ||
145 | |||
146 | URI newPath = getProjectLocationURI(); | ||
147 | if (newPath == null) { | ||
148 | return IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationError; | ||
149 | } | ||
150 | |||
151 | if (fExistingProject != null) { | ||
152 | URI projectPath = fExistingProject.getLocationURI(); | ||
153 | if (projectPath != null && URIUtil.equals(projectPath, newPath)) { | ||
154 | return IDEWorkbenchMessages.ProjectLocationSelectionDialog_locationIsSelf; | ||
155 | } | ||
156 | } | ||
157 | |||
158 | return null; | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * Return the browse button. Usually referenced in order to set the layout | ||
163 | * data for a dialog. | ||
164 | * | ||
165 | * @return Button | ||
166 | */ | ||
167 | public Button[] getButtons() { | ||
168 | return new Button[] { fBrowseButton, fRemoteConnectionWidget.getButton() }; | ||
169 | } | ||
170 | |||
171 | /** | ||
172 | * Returns the name of the selected connection. | ||
173 | */ | ||
174 | public IRemoteConnection getConnection() { | ||
175 | return fSelectedConnection; | ||
176 | } | ||
177 | |||
178 | /** | ||
179 | * Return the location for the project. | ||
180 | * | ||
181 | * @return String | ||
182 | */ | ||
183 | public String getProjectLocation() { | ||
184 | return fLocationText.getText(); | ||
185 | } | ||
186 | |||
187 | /** | ||
188 | * Get the URI for the location field if possible. | ||
189 | * | ||
190 | * @return URI or <code>null</code> if it is not valid. | ||
191 | */ | ||
192 | public URI getProjectLocationURI() { | ||
193 | if (fSelectedConnection == null) | ||
194 | return null; | ||
195 | return fSelectedConnection.getRemoteServices().getFileManager(fSelectedConnection).toURI(fLocationText.getText()); | ||
196 | } | ||
197 | |||
198 | public IRemoteConnection getRemoteConnection() { | ||
199 | return fSelectedConnection; | ||
200 | } | ||
201 | |||
202 | public IRemoteServices getRemoteServices() { | ||
203 | if (fSelectedConnection != null) | ||
204 | return fSelectedConnection.getRemoteServices(); | ||
205 | return null; | ||
206 | } | ||
207 | |||
208 | /** | ||
209 | * Return whether or not we are currently showing the default location for | ||
210 | * the project. | ||
211 | * | ||
212 | * @return boolean | ||
213 | */ | ||
214 | public boolean isDefault() { | ||
215 | // return useDefaultsButton.getSelection(); | ||
216 | return false; | ||
217 | } | ||
218 | |||
219 | /** | ||
220 | * Set the project to base the contents off of. | ||
221 | * | ||
222 | * @param existingProject | ||
223 | */ | ||
224 | public void setExistingProject(IProject existingProject) { | ||
225 | fProjectName = existingProject.getName(); | ||
226 | fExistingProject = existingProject; | ||
227 | } | ||
228 | |||
229 | /** | ||
230 | * Set the text to the default or clear it if not using the defaults. | ||
231 | * | ||
232 | * @param newName | ||
233 | * the name of the project to use. If <code>null</code> use the | ||
234 | * existing project name. | ||
235 | */ | ||
236 | public void updateProjectName(String newName) { | ||
237 | fProjectName = newName; | ||
238 | if (isDefault()) { | ||
239 | fLocationText.setText(getDefaultPathDisplayString()); | ||
240 | } | ||
241 | |||
242 | } | ||
243 | |||
244 | /** | ||
245 | * Attempt to open a connection. | ||
246 | */ | ||
247 | private void checkConnection() { | ||
248 | IRemoteUIConnectionManager mgr = getUIConnectionManager(); | ||
249 | if (mgr != null) { | ||
250 | mgr.openConnectionWithProgress(fRemoteConnectionWidget.getShell(), fContext, fSelectedConnection); | ||
251 | } | ||
252 | } | ||
253 | |||
254 | /** | ||
255 | * Return the path we are going to display. If it is a file URI then remove | ||
256 | * the file prefix. | ||
257 | * | ||
258 | * Only do this if the connection is open. Otherwise we will attempt to | ||
259 | * connect to the first machine in the list, which is annoying. | ||
260 | * | ||
261 | * @return String | ||
262 | */ | ||
263 | private String getDefaultPathDisplayString() { | ||
264 | if (getRemoteConnection() != null && getRemoteConnection().isOpen()) { | ||
265 | IRemoteFileManager fileMgr = fSelectedConnection.getRemoteServices().getFileManager(getRemoteConnection()); | ||
266 | URI defaultURI = fileMgr.toURI(getRemoteConnection().getWorkingDirectory()); | ||
267 | |||
268 | // Handle files specially. Assume a file if there is no project to | ||
269 | // query | ||
270 | if (defaultURI != null && defaultURI.getScheme().equals(FILE_SCHEME)) { | ||
271 | return Platform.getLocation().append(fProjectName).toOSString(); | ||
272 | } | ||
273 | if (defaultURI == null) { | ||
274 | return ""; //$NON-NLS-1$ | ||
275 | } | ||
276 | return new Path(defaultURI.getPath()).append(fProjectName).toOSString(); | ||
277 | } | ||
278 | return ""; //$NON-NLS-1$ | ||
279 | } | ||
280 | |||
281 | /** | ||
282 | * @return | ||
283 | */ | ||
284 | private IRemoteUIConnectionManager getUIConnectionManager() { | ||
285 | IRemoteUIConnectionManager connectionManager = RemoteUIServices.getRemoteUIServices(fSelectedConnection.getRemoteServices()) | ||
286 | .getUIConnectionManager(); | ||
287 | return connectionManager; | ||
288 | } | ||
289 | |||
290 | private void handleConnectionSelected() { | ||
291 | fSelectedConnection = fRemoteConnectionWidget.getConnection(); | ||
292 | fLocationText.setText(getDefaultPathDisplayString()); | ||
293 | } | ||
294 | |||
295 | protected Control createContents(Composite parent) { | ||
296 | Group container = new Group(parent, SWT.SHADOW_ETCHED_IN); | ||
297 | |||
298 | GridLayout layout = new GridLayout(); | ||
299 | layout.numColumns = 3; | ||
300 | container.setLayout(layout); | ||
301 | GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); | ||
302 | container.setLayoutData(gd); | ||
303 | |||
304 | fRemoteConnectionWidget = new RemoteConnectionWidget(container, SWT.NONE, null, RemoteConnectionWidget.FLAG_FORCE_PROVIDER_SELECTION, null); | ||
305 | gd = new GridData(); | ||
306 | gd.horizontalSpan = 3; | ||
307 | fRemoteConnectionWidget.setLayoutData(gd); | ||
308 | fRemoteConnectionWidget.addSelectionListener(new SelectionAdapter() { | ||
309 | @Override | ||
310 | public void widgetSelected(SelectionEvent e) { | ||
311 | handleConnectionSelected(); | ||
312 | } | ||
313 | }); | ||
314 | |||
315 | Label locationLabel = new Label(container, SWT.LEFT); | ||
316 | locationLabel.setText(Messages.getString("RemoteProjectContentsLocationArea.3")); //$NON-NLS-1$ | ||
317 | |||
318 | fLocationText = new Text(container, SWT.SINGLE | SWT.BORDER); | ||
319 | gd = new GridData(GridData.FILL_HORIZONTAL); | ||
320 | gd.horizontalSpan = 1; | ||
321 | gd.grabExcessHorizontalSpace = true; | ||
322 | gd.widthHint = 250; | ||
323 | fLocationText.setLayoutData(gd); | ||
324 | fLocationText.addModifyListener(new ModifyListener() { | ||
325 | public void modifyText(ModifyEvent e) { | ||
326 | fErrorReporter.reportError(checkValidLocation(), false); | ||
327 | } | ||
328 | }); | ||
329 | |||
330 | // new connection button | ||
331 | fBrowseButton = new Button(container, SWT.PUSH); | ||
332 | fBrowseButton.setText(Messages.getString("RemoteProjectContentsLocationArea.4")); //$NON-NLS-1$ | ||
333 | fBrowseButton.addSelectionListener(new SelectionAdapter() { | ||
334 | @Override | ||
335 | public void widgetSelected(SelectionEvent e) { | ||
336 | if (fSelectedConnection != null) { | ||
337 | checkConnection(); | ||
338 | if (fSelectedConnection.isOpen()) { | ||
339 | IRemoteUIServices remoteUIServices = RemoteUIServices.getRemoteUIServices(fSelectedConnection.getRemoteServices()); | ||
340 | if (remoteUIServices != null) { | ||
341 | IRemoteUIFileManager fileMgr = remoteUIServices.getUIFileManager(); | ||
342 | if (fileMgr != null) { | ||
343 | fileMgr.setConnection(fSelectedConnection); | ||
344 | String correctPath = fLocationText.getText(); | ||
345 | String selectedPath = fileMgr.browseDirectory( | ||
346 | fLocationText.getShell(), | ||
347 | Messages.getString("RemoteProjectContentsLocationArea.5", fSelectedConnection.getName()), correctPath, IRemoteUIConstants.NONE); //$NON-NLS-1$ | ||
348 | if (selectedPath != null) { | ||
349 | fLocationText.setText(selectedPath); | ||
350 | } | ||
351 | } | ||
352 | } | ||
353 | } | ||
354 | } | ||
355 | } | ||
356 | }); | ||
357 | |||
358 | return container; | ||
359 | } | ||
360 | |||
361 | /* | ||
362 | * (non-Javadoc) | ||
363 | * | ||
364 | * @see org.eclipse.jface.dialogs.Dialog#okPressed() | ||
365 | */ | ||
366 | protected void okPressed() { | ||
367 | // set the connection | ||
368 | //fProvider.setRemoteToolsConnection(fSelectedConnection); | ||
369 | |||
370 | } | ||
371 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java new file mode 100644 index 0000000..f64401c --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java | |||
@@ -0,0 +1,213 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.wizards.install; | ||
13 | |||
14 | import java.io.BufferedReader; | ||
15 | import java.io.File; | ||
16 | import java.io.IOException; | ||
17 | import java.io.InputStreamReader; | ||
18 | import java.io.Writer; | ||
19 | import java.lang.reflect.InvocationTargetException; | ||
20 | import java.net.URI; | ||
21 | import java.util.Hashtable; | ||
22 | import java.util.Map; | ||
23 | import java.util.regex.Matcher; | ||
24 | import java.util.regex.Pattern; | ||
25 | |||
26 | import org.eclipse.core.runtime.IProgressMonitor; | ||
27 | import org.eclipse.core.runtime.IStatus; | ||
28 | import org.eclipse.core.runtime.Status; | ||
29 | import org.eclipse.jface.operation.IRunnableWithProgress; | ||
30 | import org.eclipse.jface.viewers.IStructuredSelection; | ||
31 | import org.eclipse.jface.wizard.IWizardContainer; | ||
32 | import org.eclipse.jface.wizard.WizardPage; | ||
33 | import org.eclipse.ptp.remote.core.IRemoteConnection; | ||
34 | import org.eclipse.ptp.remote.core.IRemoteServices; | ||
35 | import org.eclipse.rse.core.model.IHost; | ||
36 | import org.eclipse.ui.IWorkbench; | ||
37 | import org.eclipse.ui.IWorkbenchPage; | ||
38 | import org.eclipse.ui.IWorkbenchWindow; | ||
39 | import org.eclipse.ui.IWorkbenchWizard; | ||
40 | import org.eclipse.ui.PlatformUI; | ||
41 | import org.eclipse.ui.console.ConsolePlugin; | ||
42 | import org.eclipse.ui.console.IConsole; | ||
43 | import org.eclipse.ui.console.IConsoleConstants; | ||
44 | import org.eclipse.ui.console.IConsoleManager; | ||
45 | import org.eclipse.ui.console.IConsoleView; | ||
46 | import org.eclipse.ui.console.MessageConsole; | ||
47 | import org.eclipse.ui.console.MessageConsoleStream; | ||
48 | import org.yocto.bc.remote.utils.YoctoRunnableWithProgress; | ||
49 | import org.yocto.bc.ui.Activator; | ||
50 | import org.yocto.bc.ui.model.ProjectInfo; | ||
51 | import org.yocto.bc.ui.wizards.FiniteStateWizard; | ||
52 | import org.yocto.bc.ui.wizards.newproject.BBConfigurationInitializeOperation; | ||
53 | import org.yocto.bc.ui.wizards.newproject.CreateBBCProjectOperation; | ||
54 | import org.yocto.remote.utils.CommandResponseHandler; | ||
55 | import org.yocto.remote.utils.ICommandResponseHandler; | ||
56 | import org.yocto.remote.utils.RemoteHelper; | ||
57 | import org.yocto.remote.utils.YoctoCommand; | ||
58 | import org.yocto.bc.remote.utils.ConsoleWriter; | ||
59 | |||
60 | /** | ||
61 | * A wizard for installing a fresh copy of an OE system. | ||
62 | * | ||
63 | * @author kgilmer | ||
64 | * | ||
65 | * A Wizard for creating a fresh Yocto bitbake project and new poky build tree from git | ||
66 | * | ||
67 | * @modified jzhang | ||
68 | * | ||
69 | */ | ||
70 | public class InstallWizard extends FiniteStateWizard implements | ||
71 | IWorkbenchWizard { | ||
72 | |||
73 | static final String KEY_PINFO = "KEY_PINFO"; | ||
74 | protected static final String OPTION_MAP = "OPTION_MAP"; | ||
75 | protected static final String INSTALL_SCRIPT = "INSTALL_SCRIPT"; | ||
76 | protected static final String INSTALL_DIRECTORY = "Install Directory"; | ||
77 | protected static final String INIT_SCRIPT = "Init Script"; | ||
78 | |||
79 | protected static final String SELECTED_CONNECTION = "SEL_CONNECTION"; | ||
80 | protected static final String SELECTED_REMOTE_SERVICE = "SEL_REMOTE_SERVICE"; | ||
81 | |||
82 | protected static final String PROJECT_NAME = "Project Name"; | ||
83 | protected static final String DEFAULT_INIT_SCRIPT = "oe-init-build-env"; | ||
84 | protected static final String DEFAULT_INSTALL_DIR = "~/yocto"; | ||
85 | |||
86 | protected static final String GIT_CLONE = "Git Clone"; | ||
87 | public static final String VALIDATION_FILE = DEFAULT_INIT_SCRIPT; | ||
88 | |||
89 | private Map model; | ||
90 | private MessageConsole myConsole; | ||
91 | private OptionsPage optionsPage; | ||
92 | |||
93 | public InstallWizard() { | ||
94 | this.model = new Hashtable(); | ||
95 | model.put(INSTALL_DIRECTORY, DEFAULT_INSTALL_DIR); | ||
96 | model.put(INIT_SCRIPT, DEFAULT_INIT_SCRIPT); | ||
97 | |||
98 | setWindowTitle("Yocto Project BitBake Commander"); | ||
99 | setNeedsProgressMonitor(true); | ||
100 | } | ||
101 | |||
102 | |||
103 | |||
104 | public InstallWizard(IStructuredSelection selection) { | ||
105 | model = new Hashtable(); | ||
106 | } | ||
107 | |||
108 | /* | ||
109 | * @Override public IWizardPage getNextPage(IWizardPage page) { if (page | ||
110 | * instanceof WelcomePage) { if (model.containsKey(WelcomePage.ACTION_USE)) | ||
111 | * { return bbcProjectPage; } } else if (page instanceof ProgressPage) { | ||
112 | * return bitbakePage; } | ||
113 | * | ||
114 | * if (super.getNextPage(page) != null) { System.out.println("next page: " + | ||
115 | * super.getNextPage(page).getClass().getName()); } else { | ||
116 | * System.out.println("end page"); } | ||
117 | * | ||
118 | * return super.getNextPage(page); } | ||
119 | * | ||
120 | * @Override public boolean canFinish() { System.out.println("can finish: " | ||
121 | * + super.canFinish()); return super.canFinish(); } | ||
122 | */ | ||
123 | @Override | ||
124 | public void addPages() { | ||
125 | optionsPage = new OptionsPage(model); | ||
126 | addPage(optionsPage); | ||
127 | } | ||
128 | |||
129 | @Override | ||
130 | public Map getModel() { | ||
131 | return model; | ||
132 | } | ||
133 | |||
134 | @Override | ||
135 | public boolean performFinish() { | ||
136 | WizardPage page = (WizardPage) getPage("Options"); | ||
137 | page.setPageComplete(true); | ||
138 | Map<String, Object> options = model; | ||
139 | |||
140 | try { | ||
141 | URI uri = new URI(""); | ||
142 | if (options.containsKey(INSTALL_DIRECTORY)) { | ||
143 | uri = (URI) options.get(INSTALL_DIRECTORY); | ||
144 | } | ||
145 | IRemoteConnection remoteConnection = ((IRemoteConnection)model.get(InstallWizard.SELECTED_CONNECTION)); | ||
146 | IRemoteServices remoteServices = ((IRemoteServices)model.get(InstallWizard.SELECTED_REMOTE_SERVICE)); | ||
147 | IHost connection = RemoteHelper.getRemoteConnectionByName(remoteConnection.getName()); | ||
148 | CommandResponseHandler cmdHandler = new CommandResponseHandler(RemoteHelper.getConsole(connection)); | ||
149 | IWizardContainer container = this.getContainer(); | ||
150 | if (((Boolean)options.get(GIT_CLONE)).booleanValue()) { | ||
151 | String cmd = "git clone --progress git://git.yoctoproject.org/poky.git " + uri.getPath(); | ||
152 | String taskName = "Checking out Yocto git repository"; | ||
153 | |||
154 | YoctoRunnableWithProgress adapter = new YoctoRunnableWithProgress(new YoctoCommand(cmd, "", "")); | ||
155 | |||
156 | adapter.setRemoteConnection(remoteConnection); | ||
157 | adapter.setRemoteServices(remoteServices); | ||
158 | adapter.setTaskName(taskName); | ||
159 | try { | ||
160 | container.run(true, true, adapter); | ||
161 | } catch (InvocationTargetException e) { | ||
162 | e.printStackTrace(); | ||
163 | } catch (InterruptedException e) { | ||
164 | e.printStackTrace(); | ||
165 | } | ||
166 | } | ||
167 | if (!cmdHandler.hasError()) { | ||
168 | String initPath = ""; | ||
169 | if (uri.getPath() != null) { | ||
170 | initPath = uri.getPath() + "/" + (String) options.get(INIT_SCRIPT); | ||
171 | } else { | ||
172 | initPath = uri.getFragment() + "/" + (String) options.get(INIT_SCRIPT); | ||
173 | } | ||
174 | String prjName = (String) options.get(PROJECT_NAME); | ||
175 | ProjectInfo pinfo = new ProjectInfo(); | ||
176 | pinfo.setInitScriptPath(initPath); | ||
177 | pinfo.setLocationURI(uri); | ||
178 | pinfo.setName(prjName); | ||
179 | pinfo.setConnection(connection); | ||
180 | pinfo.setRemoteServices(remoteServices); | ||
181 | |||
182 | final ConsoleWriter cw = new ConsoleWriter(); | ||
183 | BBConfigurationInitializeOperation configInitOp = new BBConfigurationInitializeOperation(pinfo, null); | ||
184 | container.run(false, false, configInitOp); | ||
185 | myConsole = RemoteHelper.getConsole(connection); | ||
186 | myConsole.newMessageStream().println(cw.getContents()); | ||
187 | |||
188 | if (configInitOp.hasErrorOccured()) { | ||
189 | optionsPage.setErrorMessage(configInitOp.getErrorMessage()); | ||
190 | return false; | ||
191 | } | ||
192 | |||
193 | model.put(InstallWizard.KEY_PINFO, pinfo); | ||
194 | Activator.putProjInfo(pinfo.getOEFSURI(), pinfo); | ||
195 | |||
196 | container.run(false, false, new CreateBBCProjectOperation(pinfo)); | ||
197 | RemoteHelper.storeURIInMetaArea(pinfo.getProjectName(), uri); | ||
198 | RemoteHelper.storeProjDescrInMetaArea(pinfo.getConnection(), pinfo.getProjectName(), pinfo.getOriginalURI().getPath()); | ||
199 | return true; | ||
200 | } | ||
201 | } catch (Exception e) { | ||
202 | Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, | ||
203 | IStatus.ERROR, e.getMessage(), e)); | ||
204 | this.getContainer().getCurrentPage().setDescription( | ||
205 | "Failed to create project: " + e.getMessage()); | ||
206 | } | ||
207 | return false; | ||
208 | } | ||
209 | |||
210 | public void init(IWorkbench workbench, IStructuredSelection selection) { | ||
211 | } | ||
212 | |||
213 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java new file mode 100644 index 0000000..75d9f99 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java | |||
@@ -0,0 +1,327 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.wizards.install; | ||
13 | |||
14 | import java.io.IOException; | ||
15 | import java.io.File; | ||
16 | import java.net.URI; | ||
17 | import java.net.URISyntaxException; | ||
18 | import java.util.ArrayList; | ||
19 | import java.util.Hashtable; | ||
20 | import java.util.Iterator; | ||
21 | import java.util.List; | ||
22 | import java.util.Map; | ||
23 | import java.util.regex.Matcher; | ||
24 | import java.util.regex.Pattern; | ||
25 | |||
26 | import org.eclipse.core.resources.IProject; | ||
27 | import org.eclipse.core.resources.IProjectDescription; | ||
28 | import org.eclipse.core.resources.IResource; | ||
29 | import org.eclipse.core.resources.IWorkspaceRoot; | ||
30 | import org.eclipse.core.resources.ResourcesPlugin; | ||
31 | import org.eclipse.core.runtime.CoreException; | ||
32 | import org.eclipse.core.runtime.IStatus; | ||
33 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
34 | import org.eclipse.ptp.rdt.ui.wizards.RemoteProjectContentsLocationArea; | ||
35 | import org.eclipse.ptp.rdt.ui.wizards.RemoteProjectContentsLocationArea.IErrorMessageReporter; | ||
36 | import org.eclipse.ptp.remote.core.IRemoteConnection; | ||
37 | import org.eclipse.ptp.internal.remote.rse.core.RSEConnection; | ||
38 | import org.eclipse.rse.core.model.IHost; | ||
39 | import org.eclipse.rse.services.files.IFileService; | ||
40 | import org.eclipse.rse.services.files.IHostFile; | ||
41 | import org.eclipse.swt.SWT; | ||
42 | import org.eclipse.swt.events.SelectionAdapter; | ||
43 | import org.eclipse.swt.events.SelectionEvent; | ||
44 | import org.eclipse.swt.layout.GridData; | ||
45 | import org.eclipse.swt.layout.GridLayout; | ||
46 | import org.eclipse.swt.widgets.Button; | ||
47 | import org.eclipse.swt.widgets.Composite; | ||
48 | import org.eclipse.swt.widgets.Control; | ||
49 | import org.eclipse.swt.widgets.DirectoryDialog; | ||
50 | import org.eclipse.swt.widgets.FileDialog; | ||
51 | import org.eclipse.swt.widgets.Label; | ||
52 | import org.eclipse.swt.widgets.Text; | ||
53 | import org.eclipse.ui.PlatformUI; | ||
54 | |||
55 | import org.yocto.bc.ui.wizards.FiniteStateWizard; | ||
56 | import org.yocto.bc.ui.wizards.FiniteStateWizardPage; | ||
57 | import org.yocto.bc.ui.wizards.FiniteStateWizardPage.ValidationListener; | ||
58 | import org.yocto.remote.utils.RemoteHelper; | ||
59 | |||
60 | /** | ||
61 | * Select which flavor of OE is to be installed. | ||
62 | * | ||
63 | * @author kgilmer | ||
64 | * | ||
65 | * Setting up the parameters for creating the new Yocto Bitbake project | ||
66 | * | ||
67 | * @modified jzhang | ||
68 | */ | ||
69 | public class OptionsPage extends FiniteStateWizardPage { | ||
70 | |||
71 | public static final String URI_SEPARATOR = "/"; | ||
72 | public static final String LOCALHOST = "LOCALHOST"; | ||
73 | |||
74 | private Composite top; | ||
75 | |||
76 | private RemoteProjectContentsLocationArea locationArea; | ||
77 | |||
78 | private ValidationListener validationListener; | ||
79 | private Text txtProjectName; | ||
80 | private Button btnGit; | ||
81 | |||
82 | protected OptionsPage(Map model) { | ||
83 | super("Options", model); | ||
84 | //setTitle("Create new yocto bitbake project"); | ||
85 | setMessage("Enter these parameters to create new Yocto Project BitBake commander project"); | ||
86 | } | ||
87 | |||
88 | @Override | ||
89 | public void createControl(Composite parent) { | ||
90 | top = new Composite(parent, SWT.None); | ||
91 | top.setLayout(new GridLayout()); | ||
92 | top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); | ||
93 | |||
94 | GridData gdFillH = new GridData(GridData.FILL_HORIZONTAL); | ||
95 | |||
96 | Composite projectNameComp = new Composite(top, SWT.NONE); | ||
97 | GridData gdProjName = new GridData(GridData.FILL_HORIZONTAL); | ||
98 | projectNameComp.setLayoutData(gdProjName); | ||
99 | projectNameComp.setLayout(new GridLayout(2, false)); | ||
100 | Label lblProjectName = new Label(projectNameComp, SWT.NONE); | ||
101 | lblProjectName.setText("Project N&ame:"); | ||
102 | |||
103 | txtProjectName = new Text(projectNameComp, SWT.BORDER); | ||
104 | txtProjectName.setLayoutData(gdFillH); | ||
105 | txtProjectName.setFocus(); | ||
106 | validationListener = new ValidationListener(); | ||
107 | |||
108 | txtProjectName.addModifyListener(validationListener); | ||
109 | |||
110 | IErrorMessageReporter errorReporter = new IErrorMessageReporter() { | ||
111 | |||
112 | @Override | ||
113 | public void reportError(String errorMessage, boolean infoOnly) { | ||
114 | setMessage(errorMessage); | ||
115 | if (validatePage()) { | ||
116 | updateModel(); | ||
117 | setPageComplete(true); | ||
118 | return; | ||
119 | } | ||
120 | |||
121 | setPageComplete(false); | ||
122 | } | ||
123 | }; | ||
124 | |||
125 | locationArea = new RemoteProjectContentsLocationArea(errorReporter, top, null); | ||
126 | |||
127 | btnGit = new Button(top, SWT.CHECK); | ||
128 | btnGit.setText("Clone from Yocto Project &Git Repository into new location"); | ||
129 | btnGit.setEnabled(true); | ||
130 | btnGit.setSelection(true); | ||
131 | btnGit.addSelectionListener(validationListener); | ||
132 | GridData gd = new GridData(GridData.VERTICAL_ALIGN_END | GridData.FILL_HORIZONTAL); | ||
133 | btnGit.setLayoutData(gd); | ||
134 | |||
135 | setControl(top); | ||
136 | } | ||
137 | |||
138 | @Override | ||
139 | public void pageCleanup() { | ||
140 | |||
141 | } | ||
142 | |||
143 | @Override | ||
144 | public void pageDisplay() { | ||
145 | } | ||
146 | |||
147 | @Override | ||
148 | |||
149 | protected void updateModel() { | ||
150 | try { | ||
151 | URI uri = getProjectLocationURI(); | ||
152 | if (uri != null) | ||
153 | model.put(InstallWizard.INSTALL_DIRECTORY, getProjectLocationURI()); | ||
154 | } catch (Exception e){ | ||
155 | e.printStackTrace(); | ||
156 | } | ||
157 | model.put(InstallWizard.PROJECT_NAME, txtProjectName.getText()); | ||
158 | model.put(InstallWizard.GIT_CLONE, new Boolean(btnGit.getSelection())); | ||
159 | model.put(InstallWizard.SELECTED_CONNECTION, locationArea.getRemoteConnection()); | ||
160 | model.put(InstallWizard.SELECTED_REMOTE_SERVICE, locationArea.getRemoteServices()); | ||
161 | } | ||
162 | |||
163 | public URI getProjectLocationURI() throws URISyntaxException { | ||
164 | URI uri = locationArea.getProjectLocationURI(); | ||
165 | |||
166 | if (uri != null) { | ||
167 | String location = locationArea.getProjectLocation(); | ||
168 | if (!uri.getPath().isEmpty()) { | ||
169 | String separator = uri.getPath().endsWith(URI_SEPARATOR) ? "" : URI_SEPARATOR; | ||
170 | |||
171 | return new URI( uri.getScheme(), | ||
172 | uri.getHost(), | ||
173 | uri.getPath() + separator + txtProjectName.getText(), | ||
174 | uri.getFragment()); | ||
175 | } else { | ||
176 | return null; | ||
177 | } | ||
178 | } else { | ||
179 | String location = locationArea.getProjectLocation(); | ||
180 | String separator = location.endsWith(URI_SEPARATOR) ? "" : URI_SEPARATOR; | ||
181 | |||
182 | IRemoteConnection conn = locationArea.getConnection(); | ||
183 | if (conn instanceof RSEConnection) { | ||
184 | RSEConnection rseConn = (RSEConnection)conn; | ||
185 | return new URI("rse", rseConn.getHost().getHostName(), location); | ||
186 | } else { | ||
187 | return new URI( "file", location + separator + txtProjectName.getText(),""); | ||
188 | } | ||
189 | } | ||
190 | } | ||
191 | |||
192 | private boolean isValidProjectName(String projectName) { | ||
193 | if (projectName.indexOf('$') > -1) { | ||
194 | return false; | ||
195 | } | ||
196 | |||
197 | return true; | ||
198 | } | ||
199 | |||
200 | private boolean validateProjectName() { | ||
201 | IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); | ||
202 | |||
203 | IStatus validate = ResourcesPlugin.getWorkspace().validateName(txtProjectName.getText(), IResource.PROJECT); | ||
204 | |||
205 | if (txtProjectName.getText().trim().isEmpty()) { | ||
206 | setErrorMessage("Project name cannot be empty!"); | ||
207 | return false; | ||
208 | } | ||
209 | |||
210 | if (!validate.isOK() || !isValidProjectName(txtProjectName.getText())) { | ||
211 | setErrorMessage("Invalid project name: " + txtProjectName.getText()); | ||
212 | return false; | ||
213 | } | ||
214 | |||
215 | IProject proj = wsroot.getProject(txtProjectName.getText()); | ||
216 | if (proj.exists()) { | ||
217 | setErrorMessage("A project with the name " + txtProjectName.getText() + " already exists"); | ||
218 | return false; | ||
219 | } | ||
220 | return true; | ||
221 | } | ||
222 | private String convertToRealPath(String path) { | ||
223 | String patternStr = File.separator + File.separator; | ||
224 | if (patternStr.equals(URI_SEPARATOR)) | ||
225 | return path; | ||
226 | String replaceStr = URI_SEPARATOR; | ||
227 | String convertedpath; | ||
228 | |||
229 | //Compile regular expression | ||
230 | Pattern pattern = Pattern.compile(patternStr); //pattern to look for | ||
231 | |||
232 | //replace all occurance of percentage character to file separator | ||
233 | Matcher matcher = pattern.matcher(path); | ||
234 | convertedpath = matcher.replaceAll(replaceStr); | ||
235 | |||
236 | return convertedpath; | ||
237 | } | ||
238 | |||
239 | public String getProjectName(){ | ||
240 | return txtProjectName.getText().trim(); | ||
241 | } | ||
242 | |||
243 | protected boolean validateProjectLocation() { | ||
244 | |||
245 | String projectLoc = locationArea.getProjectLocation().trim(); | ||
246 | |||
247 | IRemoteConnection remoteConnection = locationArea.getRemoteConnection(); | ||
248 | if (remoteConnection == null) | ||
249 | return false; | ||
250 | |||
251 | if (projectLoc.isEmpty()) | ||
252 | return true; | ||
253 | |||
254 | IHost connection = RemoteHelper.getRemoteConnectionByName(remoteConnection.getName()); | ||
255 | |||
256 | projectLoc = convertToRealPath(projectLoc); | ||
257 | String separator = projectLoc.endsWith(URI_SEPARATOR) ? "" : URI_SEPARATOR; | ||
258 | String projectPath = projectLoc + separator + getProjectName(); | ||
259 | IHostFile repoDest = RemoteHelper.getRemoteHostFile(connection, projectPath, new NullProgressMonitor()); | ||
260 | |||
261 | if(!btnGit.getSelection()) { | ||
262 | if (repoDest == null || !repoDest.exists()) { | ||
263 | setErrorMessage("Directory " + projectPath + " does not exist, please select git clone."); | ||
264 | return false; | ||
265 | } | ||
266 | |||
267 | IHostFile validationFile = RemoteHelper.getRemoteHostFile(connection, projectPath + URI_SEPARATOR + InstallWizard.VALIDATION_FILE, new NullProgressMonitor()); | ||
268 | if (validationFile == null || !validationFile.exists()) { | ||
269 | setErrorMessage("Directory " + projectPath + " seems invalid, please use other directory or project name."); | ||
270 | return false; | ||
271 | } | ||
272 | } else { //git clone | ||
273 | if (repoDest != null && repoDest.exists() && repoDest.isDirectory()) { | ||
274 | IHostFile[] hostFiles = RemoteHelper.getRemoteDirContent(connection, repoDest.getAbsolutePath(), "", IFileService.FILE_TYPE_FILES_AND_FOLDERS, new NullProgressMonitor()); | ||
275 | if (hostFiles.length != 0) { | ||
276 | setErrorMessage("Directory " + projectPath + " is not empty, please choose another location."); | ||
277 | return false; | ||
278 | } | ||
279 | IHostFile gitDescr = RemoteHelper.getRemoteHostFile(connection, projectPath + "/.git", new NullProgressMonitor()); | ||
280 | if (gitDescr != null && gitDescr.exists()) { | ||
281 | setErrorMessage("Directory " + projectPath + " contains a repository, please choose another location or skip cloning the repository."); | ||
282 | return false; | ||
283 | } | ||
284 | } | ||
285 | } | ||
286 | |||
287 | try { | ||
288 | String projName = txtProjectName.getText(); | ||
289 | if (!projName.trim().isEmpty() && validateProjectName()) { | ||
290 | IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); | ||
291 | IProject proj = wsroot.getProject(); | ||
292 | if (proj != null && proj.exists()) { | ||
293 | setErrorMessage("A project with the name " + projName + " already exists"); | ||
294 | return false; | ||
295 | } | ||
296 | URI location = new URI("file:" + URI_SEPARATOR + URI_SEPARATOR + convertToRealPath(projectLoc) + URI_SEPARATOR + txtProjectName.getText()); | ||
297 | |||
298 | IStatus status = ResourcesPlugin.getWorkspace().validateProjectLocationURI(proj, location); | ||
299 | if (!status.isOK()) { | ||
300 | setErrorMessage(status.getMessage()); | ||
301 | return false; | ||
302 | } | ||
303 | } | ||
304 | } catch (Exception e) { | ||
305 | e.printStackTrace(); | ||
306 | setErrorMessage("Run into error while trying to validate entries!"); | ||
307 | return false; | ||
308 | } | ||
309 | |||
310 | setErrorMessage(null); | ||
311 | return true; | ||
312 | } | ||
313 | @Override | ||
314 | protected boolean validatePage() { | ||
315 | if (!validateProjectName()) | ||
316 | return false; | ||
317 | |||
318 | if (!validateProjectLocation()) | ||
319 | return false; | ||
320 | |||
321 | setErrorMessage(null); | ||
322 | setMessage("All the entries are valid, press \"Finish\" to start the process, "+ | ||
323 | "this will take a while. Please don't interrupt till there's output in the Yocto Console window..."); | ||
324 | return true; | ||
325 | } | ||
326 | |||
327 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java new file mode 100644 index 0000000..c44b7b5 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java | |||
@@ -0,0 +1,69 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.wizards.newproject; | ||
13 | |||
14 | import java.io.Writer; | ||
15 | import java.lang.reflect.InvocationTargetException; | ||
16 | |||
17 | import org.eclipse.core.runtime.IProgressMonitor; | ||
18 | import org.eclipse.jface.operation.IRunnableWithProgress; | ||
19 | |||
20 | import org.yocto.bc.bitbake.BBSession; | ||
21 | import org.yocto.bc.bitbake.ProjectInfoHelper; | ||
22 | import org.yocto.bc.ui.Activator; | ||
23 | import org.yocto.bc.ui.model.ProjectInfo; | ||
24 | import org.yocto.remote.utils.RemoteHelper; | ||
25 | |||
26 | public class BBConfigurationInitializeOperation implements IRunnableWithProgress { | ||
27 | |||
28 | private final ProjectInfo pinfo; | ||
29 | private final Writer writer; | ||
30 | private boolean errorOccured = false; | ||
31 | private String errorMessage = ""; | ||
32 | |||
33 | public BBConfigurationInitializeOperation(ProjectInfo pinfo) { | ||
34 | this.pinfo = pinfo; | ||
35 | writer = null; | ||
36 | } | ||
37 | public boolean hasErrorOccured() { | ||
38 | return errorOccured; | ||
39 | } | ||
40 | public BBConfigurationInitializeOperation(ProjectInfo pinfo, Writer writer) { | ||
41 | this.pinfo = pinfo; | ||
42 | this.writer = writer; | ||
43 | } | ||
44 | |||
45 | public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { | ||
46 | BBSession session; | ||
47 | try { | ||
48 | System.out.println("Initialize bitbake session ..."); | ||
49 | monitor.beginTask("Initialize bitbake session ...", RemoteHelper.TOTALWORKLOAD); | ||
50 | session = Activator.getBBSession(pinfo, writer, monitor); | ||
51 | session.initialize(); | ||
52 | monitor.worked(90); | ||
53 | monitor.done(); | ||
54 | errorOccured = session.hasErrorOccured(); | ||
55 | errorMessage = session.getErrorLines(); | ||
56 | if (!errorOccured) { | ||
57 | System.out.println("Bitbake session initialized successfully."); | ||
58 | errorMessage = ""; | ||
59 | } else | ||
60 | System.out.println("An error occured and Bitbake session was not initialized."); | ||
61 | } catch (Exception e) { | ||
62 | throw new InvocationTargetException(e); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | public String getErrorMessage() { | ||
67 | return errorMessage; | ||
68 | } | ||
69 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java new file mode 100644 index 0000000..54f16c3 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java | |||
@@ -0,0 +1,93 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - adapt class for remote support | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.bc.ui.wizards.newproject; | ||
13 | |||
14 | import java.io.IOException; | ||
15 | import java.lang.reflect.InvocationTargetException; | ||
16 | import java.net.URI; | ||
17 | import java.net.URISyntaxException; | ||
18 | import java.util.Arrays; | ||
19 | import java.util.Vector; | ||
20 | |||
21 | import org.eclipse.core.resources.IProject; | ||
22 | import org.eclipse.core.resources.IProjectDescription; | ||
23 | import org.eclipse.core.resources.IWorkspace; | ||
24 | import org.eclipse.core.resources.IWorkspaceRoot; | ||
25 | import org.eclipse.core.resources.ResourcesPlugin; | ||
26 | import org.eclipse.core.runtime.CoreException; | ||
27 | import org.eclipse.core.runtime.IProgressMonitor; | ||
28 | import org.eclipse.core.runtime.IStatus; | ||
29 | import org.eclipse.core.runtime.QualifiedName; | ||
30 | import org.eclipse.core.runtime.Status; | ||
31 | import org.eclipse.ui.actions.WorkspaceModifyOperation; | ||
32 | |||
33 | import org.yocto.bc.bitbake.ProjectInfoHelper; | ||
34 | import org.yocto.bc.ui.Activator; | ||
35 | import org.yocto.bc.ui.builder.BitbakeCommanderNature; | ||
36 | import org.yocto.bc.ui.model.ProjectInfo; | ||
37 | |||
38 | |||
39 | /** | ||
40 | * Creates a bbc project | ||
41 | * @author kgilmer | ||
42 | * | ||
43 | */ | ||
44 | public class CreateBBCProjectOperation extends WorkspaceModifyOperation { | ||
45 | |||
46 | public static final String OEFS_SCHEME = "OEFS://"; | ||
47 | public static final QualifiedName BBC_PROJECT_INIT = new QualifiedName(null, "BBC_PROJECT_INIT"); | ||
48 | public static void addNatureToProject(IProject proj, String nature_id, IProgressMonitor monitor) throws CoreException { | ||
49 | IProjectDescription desc = proj.getDescription(); | ||
50 | Vector natureIds = new Vector(); | ||
51 | |||
52 | natureIds.add(nature_id); | ||
53 | natureIds.addAll(Arrays.asList(desc.getNatureIds())); | ||
54 | desc.setNatureIds((String[]) natureIds.toArray(new String[natureIds.size()])); | ||
55 | |||
56 | proj.setDescription(desc, monitor); | ||
57 | } | ||
58 | |||
59 | private ProjectInfo projInfo; | ||
60 | |||
61 | public CreateBBCProjectOperation(ProjectInfo projInfo) { | ||
62 | this.projInfo = projInfo; | ||
63 | } | ||
64 | |||
65 | protected void addNatures(IProject proj, IProgressMonitor monitor) throws CoreException { | ||
66 | addNatureToProject(proj, BitbakeCommanderNature.NATURE_ID, monitor); | ||
67 | } | ||
68 | |||
69 | private IProjectDescription createProjectDescription(IWorkspace workspace, ProjectInfo projInfo) throws CoreException { | ||
70 | IProjectDescription desc = workspace.newProjectDescription(projInfo.getProjectName()); | ||
71 | |||
72 | desc.setLocationURI(projInfo.getOEFSURI()); | ||
73 | return desc; | ||
74 | } | ||
75 | |||
76 | @Override | ||
77 | protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { | ||
78 | IProjectDescription desc = createProjectDescription(ResourcesPlugin.getWorkspace(), projInfo); | ||
79 | |||
80 | IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); | ||
81 | |||
82 | IProject proj = wsroot.getProject(projInfo.getProjectName()); | ||
83 | proj.create(desc, monitor); | ||
84 | |||
85 | proj.open(monitor); | ||
86 | |||
87 | addNatures(proj, monitor); | ||
88 | } | ||
89 | |||
90 | public ProjectInfo getProjectInfo() { | ||
91 | return projInfo; | ||
92 | } | ||
93 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariablePage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariablePage.java new file mode 100644 index 0000000..810a014 --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariablePage.java | |||
@@ -0,0 +1,262 @@ | |||
1 | package org.yocto.bc.ui.wizards.variable; | ||
2 | |||
3 | import java.util.Comparator; | ||
4 | import java.util.Map; | ||
5 | |||
6 | import org.eclipse.jface.viewers.ILabelProviderListener; | ||
7 | import org.eclipse.jface.viewers.IStructuredContentProvider; | ||
8 | import org.eclipse.jface.viewers.ITableLabelProvider; | ||
9 | import org.eclipse.jface.viewers.TableViewer; | ||
10 | import org.eclipse.jface.viewers.Viewer; | ||
11 | import org.eclipse.jface.viewers.ViewerFilter; | ||
12 | import org.eclipse.jface.viewers.ViewerSorter; | ||
13 | import org.eclipse.swt.SWT; | ||
14 | import org.eclipse.swt.events.SelectionAdapter; | ||
15 | import org.eclipse.swt.events.SelectionEvent; | ||
16 | import org.eclipse.swt.graphics.Image; | ||
17 | import org.eclipse.swt.layout.GridData; | ||
18 | import org.eclipse.swt.layout.GridLayout; | ||
19 | import org.eclipse.swt.widgets.Composite; | ||
20 | import org.eclipse.swt.widgets.Table; | ||
21 | import org.eclipse.swt.widgets.TableColumn; | ||
22 | import org.eclipse.swt.widgets.Text; | ||
23 | |||
24 | import org.yocto.bc.ui.wizards.FiniteStateWizardPage; | ||
25 | |||
26 | /** | ||
27 | * The wizard page for the Variable Wizard. | ||
28 | * @author kgilmer | ||
29 | * | ||
30 | */ | ||
31 | public class VariablePage extends FiniteStateWizardPage { | ||
32 | |||
33 | private Text txtName; | ||
34 | private Text txtValue; | ||
35 | private TableViewer viewer; | ||
36 | private TableColumn c1; | ||
37 | private TableColumn c2; | ||
38 | |||
39 | protected VariablePage(Map model) { | ||
40 | super("Yocto Project BitBake Commander", model); | ||
41 | setTitle("Yocto Project BitBake Variable Viewer"); | ||
42 | setDescription("Sort and fitler global BitBake variables by name or value."); | ||
43 | } | ||
44 | |||
45 | @Override | ||
46 | public void createControl(Composite parent) { | ||
47 | Composite top = new Composite(parent, SWT.None); | ||
48 | top.setLayout(new GridLayout(2, true)); | ||
49 | top.setLayoutData(new GridData(GridData.FILL_BOTH)); | ||
50 | |||
51 | ValidationListener listener = new ValidationListener(); | ||
52 | |||
53 | txtName = new Text(top, SWT.BORDER); | ||
54 | txtName.addModifyListener(listener); | ||
55 | txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); | ||
56 | |||
57 | txtValue = new Text(top, SWT.BORDER); | ||
58 | txtValue.addModifyListener(listener); | ||
59 | txtValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); | ||
60 | |||
61 | viewer = new TableViewer(top); | ||
62 | |||
63 | Table table = viewer.getTable(); | ||
64 | table.setLinesVisible(true); | ||
65 | table.setHeaderVisible(true); | ||
66 | GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); | ||
67 | data.heightHint = 200; | ||
68 | data.horizontalSpan = 2; | ||
69 | table.setLayoutData(data); | ||
70 | c1 = new TableColumn(table, SWT.NONE); | ||
71 | c1.setText("Name"); | ||
72 | c1.setWidth(200); | ||
73 | c1.addSelectionListener(new SelectionAdapter() { | ||
74 | public void widgetSelected(SelectionEvent event) { | ||
75 | ((VariableViewerSorter) viewer.getSorter()).doSort(0); | ||
76 | viewer.refresh(); | ||
77 | } | ||
78 | }); | ||
79 | |||
80 | c2 = new TableColumn(table, SWT.NONE); | ||
81 | c2.setText("Value"); | ||
82 | c2.setWidth(200); | ||
83 | c2.addSelectionListener(new SelectionAdapter() { | ||
84 | public void widgetSelected(SelectionEvent event) { | ||
85 | ((VariableViewerSorter) viewer.getSorter()).doSort(1); | ||
86 | viewer.refresh(); | ||
87 | } | ||
88 | }); | ||
89 | |||
90 | viewer.setContentProvider(new VariableContentProvider()); | ||
91 | viewer.setLabelProvider(new VariableLabelProvider()); | ||
92 | viewer.setSorter(new VariableViewerSorter()); | ||
93 | |||
94 | viewer.setFilters(new ViewerFilter[] {new MapViewerFilter()}); | ||
95 | setControl(top); | ||
96 | } | ||
97 | |||
98 | @Override | ||
99 | public void pageCleanup() { | ||
100 | |||
101 | } | ||
102 | |||
103 | @Override | ||
104 | public void pageDisplay() { | ||
105 | viewer.setInput(model); | ||
106 | } | ||
107 | |||
108 | @Override | ||
109 | protected void updateModel() { | ||
110 | viewer.refresh(); | ||
111 | } | ||
112 | |||
113 | @Override | ||
114 | protected boolean validatePage() { | ||
115 | return true; | ||
116 | } | ||
117 | |||
118 | /** | ||
119 | * A content provider for the variable wizard dialog. | ||
120 | * @author kgilmer | ||
121 | * | ||
122 | */ | ||
123 | private class VariableContentProvider implements IStructuredContentProvider { | ||
124 | |||
125 | public Object[] getElements(Object inputElement) { | ||
126 | return model.keySet().toArray(); | ||
127 | } | ||
128 | |||
129 | public void dispose() { | ||
130 | |||
131 | } | ||
132 | |||
133 | public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { | ||
134 | |||
135 | } | ||
136 | } | ||
137 | |||
138 | /** | ||
139 | * A label provider for variable wizard dialog. | ||
140 | * @author kgilmer | ||
141 | * | ||
142 | */ | ||
143 | private class VariableLabelProvider implements ITableLabelProvider { | ||
144 | |||
145 | public Image getColumnImage(Object element, int columnIndex) { | ||
146 | return null; | ||
147 | } | ||
148 | |||
149 | public String getColumnText(Object element, int columnIndex) { | ||
150 | String val; | ||
151 | |||
152 | switch (columnIndex) { | ||
153 | case 0: | ||
154 | val = element.toString(); | ||
155 | break; | ||
156 | case 1: | ||
157 | val = (String) model.get(element); | ||
158 | break; | ||
159 | default: | ||
160 | val = ""; | ||
161 | break; | ||
162 | } | ||
163 | |||
164 | return val; | ||
165 | } | ||
166 | |||
167 | public void addListener(ILabelProviderListener listener) { | ||
168 | |||
169 | } | ||
170 | |||
171 | public void dispose() { | ||
172 | |||
173 | } | ||
174 | |||
175 | public boolean isLabelProperty(Object element, String property) { | ||
176 | return false; | ||
177 | } | ||
178 | |||
179 | public void removeListener(ILabelProviderListener listener) { | ||
180 | |||
181 | } | ||
182 | |||
183 | } | ||
184 | |||
185 | /** | ||
186 | * | ||
187 | * A tableviewer sorter found on the internet. | ||
188 | * | ||
189 | */ | ||
190 | class VariableViewerSorter extends ViewerSorter { | ||
191 | private static final int ASCENDING = 0; | ||
192 | |||
193 | private static final int DESCENDING = 1; | ||
194 | |||
195 | private int column; | ||
196 | |||
197 | private int direction; | ||
198 | |||
199 | public void doSort(int column) { | ||
200 | if (column == this.column) { | ||
201 | // Same column as last sort; toggle the direction | ||
202 | direction = 1 - direction; | ||
203 | } else { | ||
204 | // New column; do an ascending sort | ||
205 | this.column = column; | ||
206 | direction = ASCENDING; | ||
207 | } | ||
208 | } | ||
209 | |||
210 | public int compare(Viewer viewer, Object e1, Object e2) { | ||
211 | int rc = 0; | ||
212 | Comparator c = this.getComparator(); | ||
213 | // Determine which column and do the appropriate sort | ||
214 | switch (column) { | ||
215 | case 0: | ||
216 | rc = c.compare(e1, e2); | ||
217 | break; | ||
218 | case 1: | ||
219 | rc = c.compare(model.get(e1), model.get(e2)); | ||
220 | break; | ||
221 | } | ||
222 | |||
223 | // If descending order, flip the direction | ||
224 | if (direction == DESCENDING) | ||
225 | rc = -rc; | ||
226 | |||
227 | return rc; | ||
228 | } | ||
229 | } | ||
230 | |||
231 | /** | ||
232 | * A filter for the name/value model. | ||
233 | * @author kgilmer | ||
234 | * | ||
235 | */ | ||
236 | private class MapViewerFilter extends ViewerFilter { | ||
237 | |||
238 | public MapViewerFilter() { | ||
239 | } | ||
240 | |||
241 | @Override | ||
242 | public boolean select(Viewer viewer, Object parentElement, Object element) { | ||
243 | String keyFilter = txtName.getText(); | ||
244 | String valFilter = txtValue.getText(); | ||
245 | |||
246 | String elem = (String) element; | ||
247 | String val = (String) model.get(element); | ||
248 | |||
249 | if (keyFilter.length() > 0 && elem.indexOf(keyFilter) == -1 ) { | ||
250 | return false; | ||
251 | } | ||
252 | |||
253 | if (valFilter.length() > 0 && val.indexOf(valFilter) == -1 ) { | ||
254 | return false; | ||
255 | } | ||
256 | |||
257 | return true; | ||
258 | } | ||
259 | |||
260 | } | ||
261 | |||
262 | } | ||
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariableWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariableWizard.java new file mode 100644 index 0000000..d1bee1a --- /dev/null +++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/variable/VariableWizard.java | |||
@@ -0,0 +1,43 @@ | |||
1 | package org.yocto.bc.ui.wizards.variable; | ||
2 | |||
3 | import java.util.Hashtable; | ||
4 | import java.util.Map; | ||
5 | |||
6 | import org.eclipse.jface.viewers.IStructuredSelection; | ||
7 | |||
8 | import org.yocto.bc.ui.wizards.FiniteStateWizard; | ||
9 | |||
10 | /** | ||
11 | * This wizard is used to view, filter, and search for BitBake variables and variable contents. | ||
12 | * @author kgilmer | ||
13 | * | ||
14 | */ | ||
15 | public class VariableWizard extends FiniteStateWizard { | ||
16 | |||
17 | private Map model; | ||
18 | |||
19 | public VariableWizard(Map model) { | ||
20 | this.model = model; | ||
21 | setWindowTitle("Yocto Project BitBake Commander"); | ||
22 | } | ||
23 | |||
24 | public VariableWizard(IStructuredSelection selection) { | ||
25 | model = new Hashtable(); | ||
26 | } | ||
27 | |||
28 | @Override | ||
29 | public void addPages() { | ||
30 | addPage(new VariablePage(model)); | ||
31 | } | ||
32 | |||
33 | @Override | ||
34 | public Map getModel() { | ||
35 | return model; | ||
36 | } | ||
37 | |||
38 | @Override | ||
39 | public boolean performFinish() { | ||
40 | return true; | ||
41 | } | ||
42 | |||
43 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/.classpath b/plugins/org.yocto.cmake.managedbuilder/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/.classpath | |||
@@ -0,0 +1,7 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <classpath> | ||
3 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
4 | <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
5 | <classpathentry kind="src" path="src"/> | ||
6 | <classpathentry kind="output" path="bin"/> | ||
7 | </classpath> | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/.project b/plugins/org.yocto.cmake.managedbuilder/.project new file mode 100644 index 0000000..67c7f68 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/.project | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.cmake.managedbuilder</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | <buildCommand> | ||
9 | <name>org.eclipse.jdt.core.javabuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | <buildCommand> | ||
14 | <name>org.eclipse.pde.ManifestBuilder</name> | ||
15 | <arguments> | ||
16 | </arguments> | ||
17 | </buildCommand> | ||
18 | <buildCommand> | ||
19 | <name>org.eclipse.pde.SchemaBuilder</name> | ||
20 | <arguments> | ||
21 | </arguments> | ||
22 | </buildCommand> | ||
23 | </buildSpec> | ||
24 | <natures> | ||
25 | <nature>org.eclipse.pde.PluginNature</nature> | ||
26 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
27 | </natures> | ||
28 | </projectDescription> | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/.settings/org.eclipse.jdt.core.prefs b/plugins/org.yocto.cmake.managedbuilder/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c1a4ce9 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/.settings/org.eclipse.jdt.core.prefs | |||
@@ -0,0 +1,8 @@ | |||
1 | #Wed Jul 14 11:43:59 CEST 2010 | ||
2 | eclipse.preferences.version=1 | ||
3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
5 | org.eclipse.jdt.core.compiler.compliance=1.6 | ||
6 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
8 | org.eclipse.jdt.core.compiler.source=1.6 | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/META-INF/MANIFEST.MF b/plugins/org.yocto.cmake.managedbuilder/META-INF/MANIFEST.MF new file mode 100644 index 0000000..2ed5451 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/META-INF/MANIFEST.MF | |||
@@ -0,0 +1,16 @@ | |||
1 | Manifest-Version: 1.0 | ||
2 | Bundle-ManifestVersion: 2 | ||
3 | Bundle-Name: %Bundle-Name | ||
4 | Bundle-SymbolicName: org.yocto.cmake.managedbuilder;singleton:=true | ||
5 | Bundle-Version: 1.4.0.qualifier | ||
6 | Bundle-Activator: org.yocto.cmake.managedbuilder.Activator | ||
7 | Bundle-Vendor: %Bundle-Vendor | ||
8 | Require-Bundle: org.eclipse.cdt.managedbuilder.core, | ||
9 | org.eclipse.cdt.core;bundle-version="5.2.1", | ||
10 | org.eclipse.core.resources;bundle-version="3.6.0", | ||
11 | org.eclipse.core.runtime;bundle-version="3.6.0", | ||
12 | org.eclipse.ui.console;bundle-version="3.5.0", | ||
13 | org.eclipse.ui;bundle-version="3.6.2", | ||
14 | org.yocto.sdk.ide | ||
15 | Bundle-RequiredExecutionEnvironment: JavaSE-1.6 | ||
16 | Bundle-ActivationPolicy: lazy | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.cmake.managedbuilder/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..b2c067f --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/OSGI-INF/l10n/bundle.properties | |||
@@ -0,0 +1,40 @@ | |||
1 | #/******************************************************************************* | ||
2 | # * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | # * All rights reserved. This program and the accompanying materials | ||
4 | # * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # * which accompanies this distribution, and is available at | ||
6 | # * http://www.eclipse.org/legal/epl-v10.html | ||
7 | # * | ||
8 | # * Contributors: | ||
9 | # * BMW Car IT - initial implementation | ||
10 | # *******************************************************************************/ | ||
11 | |||
12 | Bundle-Vendor = yoctoproject.org | ||
13 | Bundle-Name = Yocto CMake Plugin | ||
14 | |||
15 | # Artefact type | ||
16 | yocto.cmake.artefactType=Yocto Project ADT CMake Project | ||
17 | |||
18 | # Extension name | ||
19 | extension.name=Yocto CMake Managed Builder | ||
20 | |||
21 | # Builder | ||
22 | builder.name=Yocto CMake Environment Builder | ||
23 | |||
24 | # Toolchain | ||
25 | toolchain=Yocto CMake Build (Toolchain) | ||
26 | |||
27 | # Configuration names | ||
28 | config.debug.name=Debug | ||
29 | config.debug.description=Builds a version of the project which is ready for debugging | ||
30 | |||
31 | # CMake configure | ||
32 | cmakeconfigure.name=CMake configure | ||
33 | cmakeconfigure.options=CMake Options | ||
34 | cmakeconfigure.sourcepath=Relative source path | ||
35 | cmakeconfigure.toolchaincmakefilepath=Relative toolchain.cmake path | ||
36 | cmakeconfigure.debugsymbols=Compile with debug symbols | ||
37 | cmakeconfigure.verbosemakefile=Generate verbose Makefiles | ||
38 | cmakeconfigure.wdev=Enable developer warnings (-Wdev) | ||
39 | cmakeconfigure.wnodev=Suppress developer warnings (-Wno-dev) | ||
40 | cmakeconfigure.otherflags=Other flags | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/build.properties b/plugins/org.yocto.cmake.managedbuilder/build.properties new file mode 100644 index 0000000..3945652 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/build.properties | |||
@@ -0,0 +1,7 @@ | |||
1 | source.. = src/ | ||
2 | output.. = bin/ | ||
3 | bin.includes = META-INF/,\ | ||
4 | .,\ | ||
5 | plugin.xml,\ | ||
6 | templates/,\ | ||
7 | OSGI-INF/ | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/plugin.xml b/plugins/org.yocto.cmake.managedbuilder/plugin.xml new file mode 100644 index 0000000..7aa6671 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/plugin.xml | |||
@@ -0,0 +1,283 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <?eclipse version="3.4"?> | ||
3 | <plugin> | ||
4 | <extension | ||
5 | point="org.eclipse.cdt.managedbuilder.core.buildProperties"> | ||
6 | <propertyValue | ||
7 | id="org.yocto.sdk.ide.buildArtefact.cmake.exe" | ||
8 | name="%yocto.cmake.artefactType" | ||
9 | property="org.eclipse.cdt.build.core.buildArtefactType"> | ||
10 | </propertyValue> | ||
11 | </extension> | ||
12 | <extension | ||
13 | id="org.yocto.cmake.managedbuilder" | ||
14 | name="%extension.name" | ||
15 | point="org.eclipse.cdt.managedbuilder.core.buildDefinitions"> | ||
16 | <managedBuildRevision | ||
17 | fileVersion="4.0.0"> | ||
18 | </managedBuildRevision> | ||
19 | <builder | ||
20 | id="org.yocto.cmake.managedbuilder.builder" | ||
21 | name="%builder.name" | ||
22 | buildfileGenerator="org.yocto.cmake.managedbuilder.YoctoCMakeMakefileGenerator" | ||
23 | cleanBuildTarget="clean" | ||
24 | command="make" | ||
25 | isVariableCaseSensitive="false" | ||
26 | supportsManagedBuild="true"> | ||
27 | </builder> | ||
28 | <tool | ||
29 | id="org.yocto.cmake.managedbuilder.cmakeconfigure" | ||
30 | name="%cmakeconfigure.name" | ||
31 | command="cmake" | ||
32 | commandLinePattern="${COMMAND} ${FLAGS} " | ||
33 | natureFilter="both"> | ||
34 | <optionCategory | ||
35 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
36 | name="%cmakeconfigure.options"> | ||
37 | </optionCategory> | ||
38 | <option | ||
39 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
40 | defaultValue="${OECMAKE_SOURCEPATH}" | ||
41 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.sourcepath" | ||
42 | isAbstract="false" | ||
43 | name="%cmakeconfigure.sourcepath" | ||
44 | resourceFilter="all" | ||
45 | valueType="string"> | ||
46 | </option> | ||
47 | <option | ||
48 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
49 | defaultValue="-DCMAKE_TOOLCHAIN_FILE=${OECMAKE_SOURCEPATH}/toolchain.cmake" | ||
50 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.toolchaincmakefilepath" | ||
51 | isAbstract="false" | ||
52 | name="%cmakeconfigure.toolchaincmakefilepath" | ||
53 | resourceFilter="all" | ||
54 | valueType="string"> | ||
55 | </option> | ||
56 | <option | ||
57 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
58 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols" | ||
59 | name="%cmakeconfigure.debugsymbols" | ||
60 | isAbstract="false" | ||
61 | resourceFilter="all" | ||
62 | valueType="enumerated"> | ||
63 | <enumeratedOptionValue | ||
64 | command="-DCMAKE_BUILD_TYPE=DEBUG" | ||
65 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols.eOV1" | ||
66 | isDefault="true" | ||
67 | name="Yes (-DCMAKE_BUILD_TYPE=DEBUG)"> | ||
68 | </enumeratedOptionValue> | ||
69 | <enumeratedOptionValue | ||
70 | command="" | ||
71 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols.eOV2" | ||
72 | name="No"> | ||
73 | </enumeratedOptionValue> | ||
74 | </option> | ||
75 | <option | ||
76 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
77 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile" | ||
78 | name="%cmakeconfigure.verbosemakefile" | ||
79 | isAbstract="false" | ||
80 | resourceFilter="all" | ||
81 | valueType="enumerated"> | ||
82 | <enumeratedOptionValue | ||
83 | command="-DCMAKE_VERBOSE_MAKEFILE=1" | ||
84 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile.eOV1" | ||
85 | isDefault="true" | ||
86 | name="Yes (-DCMAKE_VERBOSE_MAKEFILE=1)"> | ||
87 | </enumeratedOptionValue> | ||
88 | <enumeratedOptionValue | ||
89 | command="-DCMAKE_VERBOSE_MAKEFILE=0" | ||
90 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile.eOV2" | ||
91 | name="No (-DCMAKE_VERBOSE_MAKEFILE=0)"> | ||
92 | </enumeratedOptionValue> | ||
93 | </option> | ||
94 | <option | ||
95 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
96 | command="-Wdev" | ||
97 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.enabledevwarn" | ||
98 | isAbstract="false" | ||
99 | name="%cmakeconfigure.wdev" | ||
100 | resourceFilter="all" | ||
101 | valueType="boolean"> | ||
102 | </option> | ||
103 | <option | ||
104 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
105 | command="-Wno-dev" | ||
106 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.suppressdevwarn" | ||
107 | isAbstract="false" | ||
108 | name="%cmakeconfigure.wnodev" | ||
109 | resourceFilter="all" | ||
110 | valueType="boolean"> | ||
111 | </option> | ||
112 | <option | ||
113 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
114 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.otherflags" | ||
115 | isAbstract="false" | ||
116 | name="%cmakeconfigure.otherflags" | ||
117 | resourceFilter="all" | ||
118 | tip="e.g.: --warn-unused-vars --debug-output -DCMAKE_SOME_OPTION=something" | ||
119 | valueType="string"> | ||
120 | </option> | ||
121 | </tool> | ||
122 | <toolChain | ||
123 | id="org.yocto.cmake.managedbuilder.toolchain.gnu.exe" | ||
124 | name="%toolchain" | ||
125 | supportsManagedBuild="true"> | ||
126 | <targetPlatform | ||
127 | id="org.yocto.cmake.managedbuilder.target.gnu.exe" | ||
128 | isAbstract="false" | ||
129 | superClass="cdt.managedbuild.target.gnu.platform.base"> | ||
130 | </targetPlatform> | ||
131 | <builder | ||
132 | id="org.yocto.cmake.managedbuilder.builder.gnu.exe" | ||
133 | isAbstract="false" | ||
134 | isVariableCaseSensitive="false" | ||
135 | superClass="org.yocto.cmake.managedbuilder.builder"> | ||
136 | </builder> | ||
137 | <tool | ||
138 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.gnu.exe" | ||
139 | isAbstract="false" | ||
140 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure"> | ||
141 | </tool> | ||
142 | <tool | ||
143 | id="org.yocto.cmake.managedbuilder.compiler.gnu.exe" | ||
144 | isAbstract="false" | ||
145 | natureFilter="ccnature" | ||
146 | superClass="cdt.managedbuild.tool.gnu.cpp.compiler"> | ||
147 | </tool> | ||
148 | <tool | ||
149 | id="org.yocto.cmake.managedbuilder.linker.gnu.exe" | ||
150 | isAbstract="false" | ||
151 | natureFilter="ccnature" | ||
152 | superClass="cdt.managedbuild.tool.gnu.cpp.linker"> | ||
153 | </tool> | ||
154 | <tool | ||
155 | id="org.yocto.cmake.managedbuilder.compiler.gnu.c.exe" | ||
156 | isAbstract="false" | ||
157 | natureFilter="cnature" | ||
158 | superClass="cdt.managedbuild.tool.gnu.c.compiler"> | ||
159 | </tool> | ||
160 | <tool | ||
161 | id="org.yocto.cmake.managedbuilder.linker.gnu.c.exe" | ||
162 | isAbstract="false" | ||
163 | natureFilter="cnature" | ||
164 | superClass="cdt.managedbuild.tool.gnu.c.linker"> | ||
165 | </tool> | ||
166 | </toolChain> | ||
167 | <projectType | ||
168 | buildArtefactType="org.yocto.sdk.ide.buildArtefact.cmake.exe" | ||
169 | id="org.yocto.sdk.ide.projectTypeCMake" | ||
170 | isAbstract="false" | ||
171 | isTest="false"> | ||
172 | <configuration | ||
173 | buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" | ||
174 | buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" | ||
175 | cleanCommand="rm -rf" | ||
176 | description="%config.debug.description" | ||
177 | id="org.yocto.cmake.managedbuilder.configuration.gnu.exe.debug" | ||
178 | name="%config.debug.name" | ||
179 | parent="cdt.managedbuild.config.gnu.base"> | ||
180 | <toolChain | ||
181 | id="org.yocto.cmake.managedbuilder.toolchain.gnu.exe.debug" | ||
182 | superClass="org.yocto.cmake.managedbuilder.toolchain.gnu.exe" | ||
183 | supportsManagedBuild="true"> | ||
184 | <targetPlatform | ||
185 | id="org.yocto.cmake.managedbuilder.target.gnu.exe.debug" | ||
186 | isAbstract="false" | ||
187 | superClass="org.yocto.cmake.managedbuilder.target.gnu.exe"> | ||
188 | </targetPlatform> | ||
189 | <builder | ||
190 | cleanBuildTarget="clean" | ||
191 | id="org.yocto.cmake.managedbuilder.builder.gnu.exe.debug" | ||
192 | isVariableCaseSensitive="false" | ||
193 | superClass="org.yocto.cmake.managedbuilder.builder.gnu.exe"> | ||
194 | </builder> | ||
195 | <tool | ||
196 | commandLinePattern="${COMMAND} ${FLAGS} " | ||
197 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.gnu.exe.debug" | ||
198 | isAbstract="false" | ||
199 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.gnu.exe"> | ||
200 | <option | ||
201 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.sourcepath.gnu.exe.debug" | ||
202 | isAbstract="false" | ||
203 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.sourcepath"> | ||
204 | </option> | ||
205 | <option | ||
206 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.toolchaincmakefilepath.gnu.exe.debug" | ||
207 | isAbstract="false" | ||
208 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.toolchaincmakefilepath"> | ||
209 | </option> | ||
210 | <option | ||
211 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols.gnu.exe.debug" | ||
212 | isAbstract="false" | ||
213 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols"> | ||
214 | </option> | ||
215 | <option | ||
216 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile.gnu.exe.debug" | ||
217 | isAbstract="false" | ||
218 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile"> | ||
219 | </option> | ||
220 | <option | ||
221 | defaultValue="FALSE" | ||
222 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.enabledevwarn.gnu.exe.debug" | ||
223 | isAbstract="false" | ||
224 | resourceFilter="all" | ||
225 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.enabledevwarn" | ||
226 | valueType="boolean"> | ||
227 | </option> | ||
228 | <option | ||
229 | defaultValue="TRUE" | ||
230 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.suppressdevwarn.gnu.exe.debug" | ||
231 | isAbstract="false" | ||
232 | resourceFilter="all" | ||
233 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.suppressdevwarn" | ||
234 | valueType="boolean"> | ||
235 | </option> | ||
236 | <option | ||
237 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.otherflags.gnu.exe.debug" | ||
238 | isAbstract="false" | ||
239 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.otherflags"> | ||
240 | </option> | ||
241 | </tool> | ||
242 | <tool | ||
243 | id="org.yocto.cmake.managedbuilder.compiler.gnu.exe.debug" | ||
244 | isAbstract="false" | ||
245 | superClass="org.yocto.cmake.managedbuilder.compiler.gnu.exe"> | ||
246 | </tool> | ||
247 | <tool | ||
248 | id="org.yocto.cmake.managedbuilder.linker.gnu.exe.debug" | ||
249 | isAbstract="false" | ||
250 | superClass="org.yocto.cmake.managedbuilder.linker.gnu.exe"> | ||
251 | </tool> | ||
252 | <tool | ||
253 | id="org.yocto.cmake.managedbuilder.compiler.gnu.exe.c.debug" | ||
254 | isAbstract="false" | ||
255 | superClass="org.yocto.cmake.managedbuilder.compiler.gnu.c.exe"> | ||
256 | </tool> | ||
257 | <tool | ||
258 | id="org.yocto.cmake.managedbuilder.linker.gnu.exe.c.debug" | ||
259 | isAbstract="false" | ||
260 | superClass="org.yocto.cmake.managedbuilder.linker.gnu.c.exe"> | ||
261 | </tool> | ||
262 | </toolChain> | ||
263 | </configuration> | ||
264 | </projectType> | ||
265 | </extension> | ||
266 | <extension | ||
267 | point="org.eclipse.cdt.core.templates"> | ||
268 | <template | ||
269 | filterPattern=".*gcc" | ||
270 | id="org.yocto.cmake.managedbuilder.template.helloWorldCCMakeProject" | ||
271 | isCategory="false" | ||
272 | location="templates/projecttemplates/HelloWorldCCMakeProject/template.xml" | ||
273 | projectType="org.yocto.sdk.ide.buildArtefact.cmake.exe"> | ||
274 | </template> | ||
275 | <template | ||
276 | filterPattern=".*g\+\+" | ||
277 | id="org.yocto.cmake.managedbuilder.template.helloWorldCPPCMakeProject" | ||
278 | isCategory="false" | ||
279 | location="templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml" | ||
280 | projectType="org.yocto.sdk.ide.buildArtefact.cmake.exe"> | ||
281 | </template> | ||
282 | </extension> | ||
283 | </plugin> | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/Activator.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/Activator.java new file mode 100644 index 0000000..6d4e28f --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/Activator.java | |||
@@ -0,0 +1,50 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.cmake.managedbuilder; | ||
12 | |||
13 | import org.eclipse.core.runtime.Plugin; | ||
14 | import org.osgi.framework.BundleContext; | ||
15 | |||
16 | public class Activator extends Plugin { | ||
17 | |||
18 | /** The plug-in ID. */ | ||
19 | public static final String PLUGIN_ID = "org.yocto.cmake.managedbuilder"; //$NON-NLS-1$ | ||
20 | |||
21 | /** The shared activator instance. */ | ||
22 | private static Activator plugin; | ||
23 | |||
24 | /* | ||
25 | * (non-Javadoc) | ||
26 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) | ||
27 | */ | ||
28 | @Override | ||
29 | public void start(BundleContext context) throws Exception { | ||
30 | super.start(context); | ||
31 | plugin = this; | ||
32 | } | ||
33 | |||
34 | /* | ||
35 | * (non-Javadoc) | ||
36 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) | ||
37 | */ | ||
38 | @Override | ||
39 | public void stop(BundleContext context) throws Exception { | ||
40 | plugin = null; | ||
41 | super.stop(context); | ||
42 | } | ||
43 | |||
44 | /** | ||
45 | * @return the shared instance of the Activator | ||
46 | */ | ||
47 | public static Activator getDefault() { | ||
48 | return plugin; | ||
49 | } | ||
50 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMakefileGenerator.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMakefileGenerator.java new file mode 100644 index 0000000..b77ae9e --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMakefileGenerator.java | |||
@@ -0,0 +1,281 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.cmake.managedbuilder; | ||
12 | |||
13 | import java.io.ByteArrayInputStream; | ||
14 | import java.io.InputStream; | ||
15 | |||
16 | import org.eclipse.cdt.managedbuilder.core.IBuilder; | ||
17 | import org.eclipse.cdt.managedbuilder.core.IConfiguration; | ||
18 | import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; | ||
19 | import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; | ||
20 | import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; | ||
21 | import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator2; | ||
22 | import org.eclipse.core.resources.IFile; | ||
23 | import org.eclipse.core.resources.IProject; | ||
24 | import org.eclipse.core.resources.IResource; | ||
25 | import org.eclipse.core.resources.IResourceDelta; | ||
26 | import org.eclipse.core.runtime.CoreException; | ||
27 | import org.eclipse.core.runtime.IPath; | ||
28 | import org.eclipse.core.runtime.IProgressMonitor; | ||
29 | import org.eclipse.core.runtime.IStatus; | ||
30 | import org.eclipse.core.runtime.MultiStatus; | ||
31 | import org.eclipse.core.runtime.jobs.Job; | ||
32 | import org.yocto.cmake.managedbuilder.job.ExecuteConfigureJob; | ||
33 | import org.yocto.sdk.ide.utils.YoctoSDKUtils; | ||
34 | |||
35 | public class YoctoCMakeMakefileGenerator implements IManagedBuilderMakefileGenerator2 { | ||
36 | |||
37 | private static final String TOOLCHAINCMAKE_FILE_NAME = "toolchain.cmake"; //$NON-NLS-1$ | ||
38 | private static final String MAKEFILE_NAME = "Makefile"; //$NON-NLS-1$ | ||
39 | private static final String CMAKE_FILE_NAME = "CMakeLists.txt"; //$NON-NLS-1$ | ||
40 | private static final String CMAKECACHE_FILE_NAME = "CMakeCache.txt"; //$NON-NLS-1$ | ||
41 | |||
42 | private IProject project; | ||
43 | private int lastBuildInfoChecksum = 0; | ||
44 | private IConfiguration configuration; | ||
45 | private IProgressMonitor monitor; | ||
46 | private IPath buildDir = null; | ||
47 | |||
48 | @Override | ||
49 | public String getMakefileName() { | ||
50 | return MAKEFILE_NAME; | ||
51 | } | ||
52 | |||
53 | @Override | ||
54 | public IPath getBuildWorkingDir() { | ||
55 | IPath buildWorkingDir = null; | ||
56 | |||
57 | if (buildDir != null) { | ||
58 | buildWorkingDir = buildDir.removeFirstSegments(1); | ||
59 | } | ||
60 | |||
61 | return buildWorkingDir; | ||
62 | } | ||
63 | |||
64 | @Override | ||
65 | public boolean isGeneratedResource(IResource resource) { | ||
66 | return false; | ||
67 | } | ||
68 | |||
69 | @Override | ||
70 | public void initialize(IProject project, IManagedBuildInfo info, | ||
71 | IProgressMonitor monitor) { | ||
72 | this.project = project; | ||
73 | this.configuration = info.getDefaultConfiguration(); | ||
74 | this.monitor = monitor; | ||
75 | |||
76 | if (info.getDefaultConfiguration() != null) { | ||
77 | buildDir = project.getFolder(info.getConfigurationName()).getFullPath(); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | @Override | ||
82 | public void initialize(int buildKind, IConfiguration configuration, IBuilder builder, | ||
83 | IProgressMonitor monitor) { | ||
84 | this.project = configuration.getOwner().getProject(); | ||
85 | this.configuration = configuration; | ||
86 | this.monitor = monitor; | ||
87 | this.buildDir = project.getFolder(configuration.getName()).getFullPath(); | ||
88 | } | ||
89 | |||
90 | @Override | ||
91 | public void generateDependencies() throws CoreException { | ||
92 | // nothing to do here | ||
93 | } | ||
94 | |||
95 | @Override | ||
96 | public void regenerateDependencies(boolean force) throws CoreException { | ||
97 | generateDependencies(); | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | public MultiStatus generateMakefiles(IResourceDelta delta) | ||
102 | throws CoreException { | ||
103 | int currentBuildInfoChecksum = ManagedBuildManager.getBuildInfo(project).hashCode(); | ||
104 | |||
105 | IFile cmakeFile = project.getFile(CMAKE_FILE_NAME); | ||
106 | IResourceDelta cmakeDelta = delta.findMember(cmakeFile.getProjectRelativePath()); | ||
107 | IResourceDelta[] deltas = delta | ||
108 | .getAffectedChildren(IResourceDelta.ADDED | IResourceDelta.REMOVED); | ||
109 | |||
110 | if (deltas.length > 0 || cmakeDelta != null || currentBuildInfoChecksum != lastBuildInfoChecksum) { | ||
111 | lastBuildInfoChecksum = currentBuildInfoChecksum; | ||
112 | return regenerateMakefiles(); | ||
113 | } else { | ||
114 | // CMake is not needed to run prior to building | ||
115 | // just return that makefile generation is completed | ||
116 | return new MultiStatus( | ||
117 | ManagedBuilderCorePlugin.getUniqueIdentifier(), IStatus.OK, | ||
118 | new String(YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.ok.makefilesStillValid")), null); //$NON-NLS-1$ | ||
119 | } | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public MultiStatus regenerateMakefiles() throws CoreException { | ||
124 | String taskName = | ||
125 | YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.configure.creatingMakefiles"); //$NON-NLS-1$ | ||
126 | monitor.beginTask(taskName, 20); | ||
127 | |||
128 | IFile cmakeFile = project.getFile(CMAKE_FILE_NAME); | ||
129 | if (!cmakeFile.exists()) { | ||
130 | return new MultiStatus(ManagedBuilderCorePlugin.getUniqueIdentifier(), IStatus.CANCEL, | ||
131 | new String(YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.cancel.missingCMakeList")), null); //$NON-NLS-1$ | ||
132 | } | ||
133 | |||
134 | // Retrieve Build directory | ||
135 | IPath workingDir = getBuildWorkingDir(); | ||
136 | IPath location = project.getLocation().append(workingDir); | ||
137 | monitor.worked(1); | ||
138 | |||
139 | // Create build directory if it doesn't exist | ||
140 | if (!location.toFile().exists()) { | ||
141 | monitor.subTask( | ||
142 | YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.creatingBuildDirectory")); //$NON-NLS-1$ | ||
143 | location.toFile().mkdirs(); | ||
144 | } else { | ||
145 | monitor.subTask( | ||
146 | YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.removingCacheFiles")); //$NON-NLS-1$ | ||
147 | IFile cmakeCache = project.getFile(workingDir.append(CMAKECACHE_FILE_NAME)); | ||
148 | cmakeCache.delete(true, monitor); | ||
149 | } | ||
150 | monitor.setTaskName(taskName); | ||
151 | |||
152 | createToolchainCMakeFile(workingDir); | ||
153 | |||
154 | // Create the Makefiles by executing cmake | ||
155 | ExecuteConfigureJob job = | ||
156 | new ExecuteConfigureJob( | ||
157 | YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.configureJob.name"), //$NON-NLS-1$ | ||
158 | project, configuration, location); | ||
159 | job.setPriority(Job.BUILD); | ||
160 | job.setUser(false); | ||
161 | |||
162 | job.schedule(); | ||
163 | try { | ||
164 | job.join(); | ||
165 | monitor.done(); | ||
166 | return new MultiStatus( | ||
167 | Activator.PLUGIN_ID, job.getResult().getSeverity(), | ||
168 | job.getResult().getMessage(), null); | ||
169 | } catch (InterruptedException e) { | ||
170 | return new MultiStatus( | ||
171 | Activator.PLUGIN_ID, | ||
172 | IStatus.ERROR, new String( | ||
173 | YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.error.makeFileGenerationFailed")), null); //$NON-NLS-1$ | ||
174 | } | ||
175 | } | ||
176 | |||
177 | private String createCMakeSetStatement(String variable, String value, String cacheOption) { | ||
178 | String setStatement = "set("; //$NON-NLS-1$ | ||
179 | setStatement += variable + " " + value; //$NON-NLS-1$ | ||
180 | if(cacheOption != null && !cacheOption.equals("")) { //$NON-NLS-1$ | ||
181 | setStatement += " " + cacheOption; //$NON-NLS-1$ | ||
182 | } | ||
183 | setStatement += ")\n"; //$NON-NLS-1$ | ||
184 | return setStatement; | ||
185 | } | ||
186 | |||
187 | // Considered poky's cmake.bbclass for this method | ||
188 | private void createToolchainCMakeFile(IPath workingDir) { | ||
189 | String toolchainCMakeFileContentAsString = "# CMake system name must be something like \"Linux\".\n" + //$NON-NLS-1$ | ||
190 | "# This is important for cross-compiling.\n"; //$NON-NLS-1$ | ||
191 | |||
192 | String targetArchValue = YoctoSDKUtils.getEnvValue(project, "TARGET_ARCH"); //$NON-NLS-1$ | ||
193 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_SYSTEM_PROCESSOR", targetArchValue, null); //$NON-NLS-1$ | ||
194 | |||
195 | String oeCMakeCCompilerValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_COMPILER"); //$NON-NLS-1$ | ||
196 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_COMPILER", oeCMakeCCompilerValue, null); //$NON-NLS-1$ | ||
197 | |||
198 | String oeCMakeCXXCompilerValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_COMPILER"); //$NON-NLS-1$ | ||
199 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_COMPILER", oeCMakeCXXCompilerValue, null); //$NON-NLS-1$ | ||
200 | |||
201 | String oeCMakeCFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_FLAGS"); //$NON-NLS-1$ | ||
202 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_FLAGS", //$NON-NLS-1$ | ||
203 | "\"" + oeCMakeCFlagsValue + "\"", "CACHE STRING \"CFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
204 | |||
205 | String oeCMakeCXXFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_FLAGS"); //$NON-NLS-1$ | ||
206 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_FLAGS", //$NON-NLS-1$ | ||
207 | "\"" + oeCMakeCXXFlagsValue + "\"", "CACHE STRING \"CXXFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
208 | |||
209 | String oeCMakeCFlagsReleaseValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_FLAGS_RELEASE"); //$NON-NLS-1$ | ||
210 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_FLAGS_RELEASE", //$NON-NLS-1$ | ||
211 | "\"" + oeCMakeCFlagsReleaseValue + "\"", "CACHE STRING \"CFLAGS for release\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
212 | |||
213 | String oeCMakeCXXFlagsReleaseValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_FLAGS_RELEASE"); //$NON-NLS-1$ | ||
214 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_FLAGS_RELEASE", //$NON-NLS-1$ | ||
215 | "\"" + oeCMakeCXXFlagsReleaseValue + "\"", "CACHE STRING \"CXXFLAGS for release\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
216 | |||
217 | String oeCMakeCLinkFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_LINK_FLAGS"); //$NON-NLS-1$ | ||
218 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_LINK_FLAGS", //$NON-NLS-1$ | ||
219 | "\"" + oeCMakeCLinkFlagsValue + "\"", "CACHE STRING \"LDFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
220 | |||
221 | String oeCMakeCXXLinkFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_LINK_FLAGS"); //$NON-NLS-1$ | ||
222 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_LINK_FLAGS", //$NON-NLS-1$ | ||
223 | "\"" + oeCMakeCXXLinkFlagsValue + "\"", "CACHE STRING \"LDFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
224 | |||
225 | toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ | ||
226 | toolchainCMakeFileContentAsString += "# only search in the paths provided so cmake doesnt pick\n"; //$NON-NLS-1$ | ||
227 | toolchainCMakeFileContentAsString += "# up libraries and tools from the native build machine\n"; //$NON-NLS-1$ | ||
228 | |||
229 | String findRootPathValue = YoctoSDKUtils.getEnvValue(project, "STAGING_DIR_HOST"); //$NON-NLS-1$ | ||
230 | findRootPathValue += " "; //$NON-NLS-1$ | ||
231 | findRootPathValue += YoctoSDKUtils.getEnvValue(project, "STAGING_DIR_NATIVE"); //$NON-NLS-1$ | ||
232 | findRootPathValue += " "; //$NON-NLS-1$ | ||
233 | findRootPathValue += YoctoSDKUtils.getEnvValue(project, "CROSS_DIR"); //$NON-NLS-1$ | ||
234 | findRootPathValue += " "; //$NON-NLS-1$ | ||
235 | findRootPathValue += YoctoSDKUtils.getEnvValue(project, "OECMAKE_PERLNATIVE_DIR"); //$NON-NLS-1$ | ||
236 | findRootPathValue += " "; //$NON-NLS-1$ | ||
237 | findRootPathValue += YoctoSDKUtils.getEnvValue(project, "OECMAKE_EXTRA_ROOT_PATH"); //$NON-NLS-1$ | ||
238 | findRootPathValue += " "; //$NON-NLS-1$ | ||
239 | findRootPathValue += YoctoSDKUtils.getEnvValue(project, "EXTERNAL_TOOLCHAIN"); //$NON-NLS-1$ | ||
240 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH", findRootPathValue, null); //$NON-NLS-1$ | ||
241 | |||
242 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH_MODE_PROGRAM", "ONLY", null); //$NON-NLS-1$ //$NON-NLS-2$ | ||
243 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH_MODE_LIBRARY", "ONLY", null); //$NON-NLS-1$ //$NON-NLS-2$ | ||
244 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH_MODE_INCLUDE", "ONLY", null); //$NON-NLS-1$ //$NON-NLS-2$ | ||
245 | toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ | ||
246 | |||
247 | toolchainCMakeFileContentAsString += "# Use qt.conf settings\n"; //$NON-NLS-1$ | ||
248 | toolchainCMakeFileContentAsString += createCMakeSetStatement("ENV{QT_CONF_PATH}", "qt.conf", null); //$NON-NLS-1$ //$NON-NLS-2$ | ||
249 | toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ | ||
250 | |||
251 | toolchainCMakeFileContentAsString += "# We need to set the rpath to the correct directory as cmake does not provide any\n"; //$NON-NLS-1$ | ||
252 | toolchainCMakeFileContentAsString += "# directory as rpath by default\n"; //$NON-NLS-1$ | ||
253 | |||
254 | String oeCMakeRPathValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_RPATH"); //$NON-NLS-1$ | ||
255 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_INSTALL_RPATH", oeCMakeRPathValue, null); //$NON-NLS-1$ | ||
256 | |||
257 | toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ | ||
258 | toolchainCMakeFileContentAsString += "# Use native cmake modules\n"; //$NON-NLS-1$ | ||
259 | |||
260 | String stagingDatadirValue = YoctoSDKUtils.getEnvValue(project, "STAGING_DATADIR"); //$NON-NLS-1$ | ||
261 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_MODULE_PATH", //$NON-NLS-1$ | ||
262 | stagingDatadirValue + "/cmake/Modules/", null); //$NON-NLS-1$ | ||
263 | |||
264 | toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ | ||
265 | toolchainCMakeFileContentAsString += "# add for non /usr/lib libdir, e.g. /usr/lib64\n"; //$NON-NLS-1$ | ||
266 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_LIBRARY_PATH", //$NON-NLS-1$ | ||
267 | "${libdir} ${base_libdir}", null); //$NON-NLS-1$ | ||
268 | |||
269 | InputStream toolchainCMakeFileContent = new ByteArrayInputStream(toolchainCMakeFileContentAsString.getBytes()); | ||
270 | |||
271 | IFile toolchainCMakeFile = project.getFile(TOOLCHAINCMAKE_FILE_NAME); | ||
272 | try { | ||
273 | if (toolchainCMakeFile.exists()) { | ||
274 | toolchainCMakeFile.delete(true, monitor); | ||
275 | } | ||
276 | toolchainCMakeFile.create(toolchainCMakeFileContent, true, monitor); | ||
277 | } catch (CoreException e) { | ||
278 | e.printStackTrace(); | ||
279 | } | ||
280 | } | ||
281 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.java new file mode 100644 index 0000000..1bd8b46 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.java | |||
@@ -0,0 +1,57 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.cmake.managedbuilder; | ||
12 | |||
13 | import java.text.MessageFormat; | ||
14 | import java.util.MissingResourceException; | ||
15 | import java.util.ResourceBundle; | ||
16 | |||
17 | public class YoctoCMakeMessages { | ||
18 | |||
19 | private static final String RESOURCE_BUNDLE= YoctoCMakeMessages.class.getName(); | ||
20 | private static ResourceBundle fgResourceBundle; | ||
21 | static { | ||
22 | try { | ||
23 | fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE); | ||
24 | } catch (MissingResourceException x) { | ||
25 | fgResourceBundle = null; | ||
26 | } | ||
27 | } | ||
28 | |||
29 | private YoctoCMakeMessages() { | ||
30 | } | ||
31 | |||
32 | public static String getString(String key) { | ||
33 | try { | ||
34 | return fgResourceBundle.getString(key); | ||
35 | } catch (MissingResourceException e) { | ||
36 | return '!' + key + '!'; | ||
37 | } catch (NullPointerException e) { | ||
38 | return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$ | ||
39 | } | ||
40 | } | ||
41 | |||
42 | /** | ||
43 | * Gets a string from the resource bundle and formats it with the argument | ||
44 | * | ||
45 | * @param key the string used to get the bundle value, must not be null | ||
46 | */ | ||
47 | public static String getFormattedString(String key, Object arg) { | ||
48 | return MessageFormat.format(getString(key), new Object[] { arg }); | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * Gets a string from the resource bundle and formats it with arguments | ||
53 | */ | ||
54 | public static String getFormattedString(String key, Object[] args) { | ||
55 | return MessageFormat.format(getString(key), args); | ||
56 | } | ||
57 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties new file mode 100644 index 0000000..55773ac --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties | |||
@@ -0,0 +1,29 @@ | |||
1 | #/******************************************************************************* | ||
2 | # * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | # * All rights reserved. This program and the accompanying materials | ||
4 | # * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # * which accompanies this distribution, and is available at | ||
6 | # * http://www.eclipse.org/legal/epl-v10.html | ||
7 | # * | ||
8 | # * Contributors: | ||
9 | # * BMW Car IT - initial implementation | ||
10 | # *******************************************************************************/ | ||
11 | |||
12 | # Job | ||
13 | ExecuteConfigureJob.runConfigure=Running configure | ||
14 | ExecuteConfigureJob.consoleName=Configure using CMake [{0}] | ||
15 | ExecuteConfigureJob.buildingMakefile=Building Makefile | ||
16 | ExecuteConfigureJob.warning.aborted=Build of project has been aborted | ||
17 | ExecuteConfigureJob.error.couldNotStart=Build of project could not be started | ||
18 | ExecuteConfigureJob.error.buildFailed=Build of project failed | ||
19 | ExecuteConfigureJob.cmakeWarning.dialogTitle=Unable to run command "cmake" | ||
20 | ExecuteConfigureJob.cmakeWarning.dialogMessage=Please make sure that cmake is installed properly on this machine. | ||
21 | |||
22 | # File generator | ||
23 | YoctoCMakeMakefileGenerator.configureJob.name=Configuring project | ||
24 | YoctoCMakeMakefileGenerator.configure.creatingMakefiles=Generating Makefiles using CMake | ||
25 | YoctoCMakeMakefileGenerator.cancel.missingCMakeList=CMakeLists.txt file is missing | ||
26 | YoctoCMakeMakefileGenerator.creatingBuildDirectory=Creating build directory | ||
27 | YoctoCMakeMakefileGenerator.error.makeFileGenerationFailed=Makefile generation failed during configuration process | ||
28 | YoctoCMakeMakefileGenerator.ok.makefilesStillValid=Makefiles are still valid. | ||
29 | YoctoCMakeMakefileGenerator.removingCacheFiles=Removing cache files | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java new file mode 100644 index 0000000..354d930 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java | |||
@@ -0,0 +1,186 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.cmake.managedbuilder.job; | ||
12 | |||
13 | import java.io.IOException; | ||
14 | import java.util.Arrays; | ||
15 | import java.util.HashMap; | ||
16 | import java.util.LinkedList; | ||
17 | import java.util.Map; | ||
18 | |||
19 | import org.eclipse.cdt.core.CCorePlugin; | ||
20 | import org.eclipse.cdt.core.envvar.IContributedEnvironment; | ||
21 | import org.eclipse.cdt.core.envvar.IEnvironmentVariable; | ||
22 | import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager; | ||
23 | import org.eclipse.cdt.core.model.CoreModel; | ||
24 | import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; | ||
25 | import org.eclipse.cdt.core.settings.model.ICProjectDescription; | ||
26 | import org.eclipse.cdt.managedbuilder.core.BuildException; | ||
27 | import org.eclipse.cdt.managedbuilder.core.IConfiguration; | ||
28 | import org.eclipse.cdt.managedbuilder.core.ITool; | ||
29 | import org.eclipse.core.resources.IProject; | ||
30 | import org.eclipse.core.runtime.IPath; | ||
31 | import org.eclipse.core.runtime.IProgressMonitor; | ||
32 | import org.eclipse.core.runtime.IStatus; | ||
33 | import org.eclipse.core.runtime.Status; | ||
34 | import org.eclipse.core.runtime.jobs.Job; | ||
35 | import org.eclipse.jface.dialogs.MessageDialog; | ||
36 | import org.eclipse.swt.widgets.Display; | ||
37 | import org.eclipse.ui.console.IOConsoleOutputStream; | ||
38 | import org.yocto.cmake.managedbuilder.Activator; | ||
39 | import org.yocto.cmake.managedbuilder.YoctoCMakeMessages; | ||
40 | import org.yocto.cmake.managedbuilder.util.ConsoleUtility; | ||
41 | import org.yocto.cmake.managedbuilder.util.SystemProcess; | ||
42 | |||
43 | |||
44 | public class ExecuteConfigureJob extends Job { | ||
45 | private SystemProcess configureProcess; | ||
46 | private LinkedList<String> configureCommand; | ||
47 | private IProject project; | ||
48 | private IConfiguration configuration; | ||
49 | private IPath location; | ||
50 | |||
51 | |||
52 | public ExecuteConfigureJob(String name, | ||
53 | IProject project, IConfiguration configuration, IPath location) { | ||
54 | super(name); | ||
55 | this.project = project; | ||
56 | this.configuration = configuration; | ||
57 | this.location = location; | ||
58 | createCommands(); | ||
59 | createProcesses(); | ||
60 | } | ||
61 | |||
62 | protected void createCommands() { | ||
63 | configureCommand = new LinkedList<String>(); | ||
64 | |||
65 | ITool[] configure = configuration | ||
66 | .getToolsBySuperClassId("org.yocto.cmake.managedbuilder.cmakeconfigure.gnu.exe"); //$NON-NLS-1$ | ||
67 | |||
68 | addCommand(configure[0]); | ||
69 | |||
70 | try { | ||
71 | addFlags(configure[0]); | ||
72 | } catch (BuildException e) { | ||
73 | // ignore this exception | ||
74 | } | ||
75 | } | ||
76 | |||
77 | private void addCommand(ITool configure) { | ||
78 | String command = configuration.getToolCommand(configure); | ||
79 | configureCommand.add(command); | ||
80 | } | ||
81 | |||
82 | private void addFlags(ITool configure) throws BuildException { | ||
83 | String[] flags = configure.getToolCommandFlags( | ||
84 | project.getLocation(), location); | ||
85 | for (String flag : flags) { | ||
86 | if (flag.contains(" ")) { //$NON-NLS-1$ | ||
87 | String[] separatedFlags = flag.trim().split(" "); //$NON-NLS-1$ | ||
88 | configureCommand.addAll(Arrays.asList(separatedFlags)); | ||
89 | } else { | ||
90 | configureCommand.add(flag); | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | |||
95 | protected void createProcesses() { | ||
96 | configureProcess = | ||
97 | new SystemProcess(configureCommand, location.toFile(), getEnvVariablesAsMap(project)); | ||
98 | } | ||
99 | |||
100 | private Map<String,String> getEnvVariablesAsMap (IProject project) { | ||
101 | Map<String, String> result = new HashMap<String, String>(); | ||
102 | |||
103 | ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true); | ||
104 | ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration(); | ||
105 | IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager(); | ||
106 | IContributedEnvironment env = manager.getContributedEnvironment(); | ||
107 | |||
108 | for(IEnvironmentVariable var : env.getVariables(ccdesc)) { | ||
109 | result.put(var.getName(), var.getValue()); | ||
110 | } | ||
111 | |||
112 | return result; | ||
113 | } | ||
114 | |||
115 | /* (non-Javadoc) | ||
116 | * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) | ||
117 | */ | ||
118 | @Override | ||
119 | protected IStatus run(IProgressMonitor monitor) { | ||
120 | monitor.beginTask( | ||
121 | YoctoCMakeMessages.getString("ExecuteConfigureJob.runConfigure"), 20); //$NON-NLS-1$ | ||
122 | |||
123 | IOConsoleOutputStream cos = | ||
124 | ConsoleUtility.getConsoleOutput(YoctoCMakeMessages.getFormattedString("ExecuteConfigureJob.consoleName", //$NON-NLS-1$ | ||
125 | project.getName())); | ||
126 | monitor.worked(1); | ||
127 | |||
128 | try { | ||
129 | return buildProject(monitor, cos); | ||
130 | } catch (IOException e) { | ||
131 | if(e.getMessage().startsWith("Cannot run program \"cmake\"")) { //$NON-NLS-1$ | ||
132 | Display.getDefault().asyncExec(new Runnable() { | ||
133 | @Override | ||
134 | public void run() { | ||
135 | MessageDialog.openWarning(null, | ||
136 | YoctoCMakeMessages.getString("ExecuteConfigureJob.cmakeWarning.dialogTitle"), //$NON-NLS-1$ | ||
137 | YoctoCMakeMessages.getString("ExecuteConfigureJob.cmakeWarning.dialogMessage")); //$NON-NLS-1$ | ||
138 | } | ||
139 | }); | ||
140 | return Status.OK_STATUS; | ||
141 | } else { | ||
142 | return new Status(Status.ERROR, | ||
143 | Activator.PLUGIN_ID, Status.OK, | ||
144 | YoctoCMakeMessages.getString("ExecuteConfigureJob.error.couldNotStart"), e); //$NON-NLS-1$ | ||
145 | } | ||
146 | } catch (InterruptedException e) { | ||
147 | return new Status(Status.WARNING, | ||
148 | Activator.PLUGIN_ID, | ||
149 | YoctoCMakeMessages.getString("ExecuteConfigureJob.warning.aborted")); //$NON-NLS-1$ | ||
150 | } finally { | ||
151 | try { | ||
152 | cos.close(); | ||
153 | } catch (IOException e) { | ||
154 | cos = null; | ||
155 | } | ||
156 | } | ||
157 | } | ||
158 | |||
159 | private IStatus buildProject(IProgressMonitor monitor, | ||
160 | IOConsoleOutputStream cos) throws IOException, InterruptedException { | ||
161 | monitor.subTask( | ||
162 | YoctoCMakeMessages.getString("ExecuteConfigureJob.buildingMakefile")); //$NON-NLS-1$ | ||
163 | configureProcess.start(cos); | ||
164 | int exitValue = configureProcess.waitForResultAndStop(); | ||
165 | monitor.worked(15); | ||
166 | |||
167 | if (exitValue != 0) { | ||
168 | return new Status(Status.ERROR, Activator.PLUGIN_ID, | ||
169 | YoctoCMakeMessages.getString("ExecuteConfigureJob.error.buildFailed") + " " + exitValue); //$NON-NLS-1$ //$NON-NLS-2$ | ||
170 | } | ||
171 | |||
172 | return Status.OK_STATUS; | ||
173 | } | ||
174 | |||
175 | /* (non-Javadoc) | ||
176 | * @see org.eclipse.core.runtime.jobs.Job#canceling() | ||
177 | */ | ||
178 | /** | ||
179 | * Cancels the job and interrupts the system process. | ||
180 | * {@inheritDoc} | ||
181 | */ | ||
182 | @Override | ||
183 | protected void canceling() { | ||
184 | configureProcess.interrupt(); | ||
185 | } | ||
186 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java new file mode 100644 index 0000000..9fb31e5 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java | |||
@@ -0,0 +1,49 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.cmake.managedbuilder.util; | ||
12 | |||
13 | import org.eclipse.ui.console.ConsolePlugin; | ||
14 | import org.eclipse.ui.console.IConsole; | ||
15 | import org.eclipse.ui.console.IOConsoleOutputStream; | ||
16 | import org.eclipse.ui.console.MessageConsole; | ||
17 | |||
18 | |||
19 | public class ConsoleUtility { | ||
20 | |||
21 | public static IOConsoleOutputStream getConsoleOutput(String consoleName) { | ||
22 | return getConsole(consoleName).newOutputStream(); | ||
23 | } | ||
24 | |||
25 | public static MessageConsole getConsole(String consoleName) { | ||
26 | MessageConsole foundConsole = findConsole(consoleName); | ||
27 | if (foundConsole != null) { | ||
28 | foundConsole.clearConsole(); | ||
29 | } else { | ||
30 | foundConsole = new MessageConsole(consoleName, null); | ||
31 | ConsolePlugin.getDefault(). | ||
32 | getConsoleManager().addConsoles(new IConsole[] { foundConsole }); | ||
33 | } | ||
34 | |||
35 | return foundConsole; | ||
36 | } | ||
37 | |||
38 | public static MessageConsole findConsole(String consoleName) { | ||
39 | IConsole[] consoles = | ||
40 | ConsolePlugin.getDefault().getConsoleManager().getConsoles(); | ||
41 | for (IConsole console : consoles) { | ||
42 | if (console.getName().equals(consoleName)) { | ||
43 | return (MessageConsole) console; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | return null; | ||
48 | } | ||
49 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java new file mode 100644 index 0000000..9ca6e60 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java | |||
@@ -0,0 +1,118 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.cmake.managedbuilder.util; | ||
12 | |||
13 | import java.io.File; | ||
14 | import java.io.IOException; | ||
15 | import java.io.InputStream; | ||
16 | import java.io.OutputStream; | ||
17 | import java.util.LinkedList; | ||
18 | import java.util.Map; | ||
19 | |||
20 | public class SystemProcess { | ||
21 | |||
22 | private LinkedList<String> command = new LinkedList<String>(); | ||
23 | private File workingDirectory; | ||
24 | private ProcessBuilder builder; | ||
25 | private Process process; | ||
26 | private StreamPipe outputRedirector; | ||
27 | |||
28 | public SystemProcess(LinkedList<String> command) { | ||
29 | this(command, null); | ||
30 | } | ||
31 | |||
32 | public SystemProcess(LinkedList<String> command, File directory) { | ||
33 | this(command, directory, null); | ||
34 | } | ||
35 | |||
36 | public SystemProcess(LinkedList<String> command, File directory, Map<String, String> additionalEnvironmentVariables) { | ||
37 | super(); | ||
38 | this.command = command; | ||
39 | if (directory != null) { | ||
40 | this.workingDirectory = directory; | ||
41 | } | ||
42 | setUpProcessBuilder(additionalEnvironmentVariables); | ||
43 | } | ||
44 | |||
45 | private void setUpProcessBuilder(Map<String, String> additionalEnvironmentVariables) { | ||
46 | builder = new ProcessBuilder(command); | ||
47 | if (workingDirectory != null) { | ||
48 | builder.directory(workingDirectory); | ||
49 | } | ||
50 | builder.redirectErrorStream(true); | ||
51 | |||
52 | if(additionalEnvironmentVariables != null && !additionalEnvironmentVariables.isEmpty()) { | ||
53 | builder.environment().putAll(additionalEnvironmentVariables); | ||
54 | } | ||
55 | } | ||
56 | |||
57 | public void start(OutputStream out) throws IOException { | ||
58 | if (builder != null) { | ||
59 | process = builder.start(); | ||
60 | outputRedirector = redirectOutput(process, out); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | public int waitForResultAndStop() throws InterruptedException { | ||
65 | if (process == null) { | ||
66 | return -1; | ||
67 | } | ||
68 | |||
69 | process.waitFor(); | ||
70 | outputRedirector.interrupt(); | ||
71 | |||
72 | return process.exitValue(); | ||
73 | } | ||
74 | |||
75 | public void interrupt() { | ||
76 | process.destroy(); | ||
77 | } | ||
78 | |||
79 | private StreamPipe redirectOutput(Process process, OutputStream out) { | ||
80 | InputStream in = process.getInputStream(); | ||
81 | StreamPipe stdoutPipe = new StreamPipe(in, out); | ||
82 | stdoutPipe.start(); | ||
83 | |||
84 | return stdoutPipe; | ||
85 | } | ||
86 | |||
87 | |||
88 | private class StreamPipe extends Thread { | ||
89 | private InputStream in; | ||
90 | private OutputStream out; | ||
91 | boolean shutdown = false; | ||
92 | |||
93 | public StreamPipe(InputStream in, OutputStream out) { | ||
94 | this.in = in; | ||
95 | this.out = out; | ||
96 | } | ||
97 | |||
98 | @Override | ||
99 | public void run() { | ||
100 | byte[] buffer = new byte[1024]; | ||
101 | int length = 0; | ||
102 | |||
103 | try { | ||
104 | while(!shutdown && ((length = in.read(buffer)) > -1)) { | ||
105 | out.write(buffer, 0, length); | ||
106 | } | ||
107 | } catch (IOException e) { | ||
108 | e.printStackTrace(); | ||
109 | } | ||
110 | } | ||
111 | |||
112 | @Override | ||
113 | public void interrupt() { | ||
114 | shutdown = true; | ||
115 | super.interrupt(); | ||
116 | } | ||
117 | } | ||
118 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/CMakeLists.txt b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/CMakeLists.txt new file mode 100644 index 0000000..e6482a7 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/CMakeLists.txt | |||
@@ -0,0 +1,34 @@ | |||
1 | cmake_minimum_required (VERSION 2.8.1) | ||
2 | |||
3 | ######## Project settings ######## | ||
4 | PROJECT($(projectName)) | ||
5 | SET(LICENSE "TBD") | ||
6 | |||
7 | ######## Build and include settings ######## | ||
8 | include_directories( | ||
9 | inc | ||
10 | ) | ||
11 | |||
12 | link_directories( | ||
13 | ${LINK_DIRECTORIES} | ||
14 | ) | ||
15 | |||
16 | |||
17 | file(GLOB SOURCES | ||
18 | "src/*.c" | ||
19 | ) | ||
20 | |||
21 | add_executable( | ||
22 | $(projectName) | ||
23 | |||
24 | ${SOURCES} | ||
25 | ) | ||
26 | |||
27 | TARGET_LINK_LIBRARIES( | ||
28 | $(projectName) | ||
29 | ) | ||
30 | |||
31 | ######## Install targets ######## | ||
32 | INSTALL(TARGETS $(projectName) | ||
33 | RUNTIME DESTINATION usr/bin | ||
34 | ) | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/main.c b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/main.c new file mode 100644 index 0000000..78b4e23 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/main.c | |||
@@ -0,0 +1,21 @@ | |||
1 | /** @mainpage $(projectName) - $(vendor) | ||
2 | * | ||
3 | * @author $(author) <$(email)> | ||
4 | * @version $(projectVersion) | ||
5 | **/ | ||
6 | |||
7 | |||
8 | #include <stdio.h> | ||
9 | /** | ||
10 | * Main class of project $(projectName) | ||
11 | * | ||
12 | * @param argc the number of arguments | ||
13 | * @param argv the arguments from the commandline | ||
14 | * @returns exit code of the application | ||
15 | */ | ||
16 | int main(int argc, char **argv) { | ||
17 | // print a greeting to the console | ||
18 | printf("Hello World!\n"); | ||
19 | |||
20 | return 0; | ||
21 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.properties b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.properties new file mode 100644 index 0000000..bc37c1c --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.properties | |||
@@ -0,0 +1,31 @@ | |||
1 | #/******************************************************************************* | ||
2 | # * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | # * All rights reserved. This program and the accompanying materials | ||
4 | # * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # * which accompanies this distribution, and is available at | ||
6 | # * http://www.eclipse.org/legal/epl-v10.html | ||
7 | # * | ||
8 | # * Contributors: | ||
9 | # * BMW Car IT - initial implementation | ||
10 | # *******************************************************************************/ | ||
11 | |||
12 | # Template | ||
13 | template.vendor=Yocto Project | ||
14 | template.name=Hello World C CMake Project | ||
15 | template.description=A simple C hello world project based on CMake | ||
16 | |||
17 | # General Settings | ||
18 | general.name=General settings | ||
19 | general.description=Author properties of the project | ||
20 | general.author.name=Author | ||
21 | general.author.description=The author of the project | ||
22 | general.author.default=anonymous | ||
23 | general.email.name=Email address | ||
24 | general.email.description=The email address of the project's author | ||
25 | general.email.default=anony@mo.us | ||
26 | general.vendor.name=Vendor | ||
27 | general.vendor.description=The vendor of the project | ||
28 | general.vendor.default=None | ||
29 | general.projectVersion.name=Version | ||
30 | general.projectVersion.description=The version of the project | ||
31 | general.projectVersion.default=1.0.0 | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.xml b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.xml new file mode 100644 index 0000000..7c3774e --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.xml | |||
@@ -0,0 +1,61 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
2 | <template type="ProjTempl" | ||
3 | version="1.0" supplier="%template.vendor" revision="1.0" author="Atanas Gegov" | ||
4 | id="org.yocto.cmake.template.exe.helloWorldCCMakeProject" label="%template.name" | ||
5 | description="%template.description"> | ||
6 | |||
7 | <property-group id="general_settings" label="%general.name" | ||
8 | description="%general.description" type="PAGES-ONLY"> | ||
9 | <property id="author" label="%general.author.name" description="%general.author.description" | ||
10 | default="%general.author.default" type="input" hidden="false" mandatory="false" | ||
11 | persist="true" /> | ||
12 | |||
13 | <property id="email" label="%general.email.name" | ||
14 | description="%general.email.description" default="%general.email.default" | ||
15 | type="input" hidden="false" mandatory="false" persist="true" /> | ||
16 | |||
17 | <property id="vendor" label="%general.vendor.name" | ||
18 | description="%general.vendor.description" default="%general.vendor.default" | ||
19 | type="input" hidden="false" mandatory="false" persist="true" /> | ||
20 | |||
21 | <property id="projectVersion" label="%general.projectVersion.name" | ||
22 | description="%general.projectVersion.description" checkproject="false" | ||
23 | default="%general.projectVersion.default" type="input" | ||
24 | pattern="([0-9]\.){2}[0-9]" hidden="false" mandatory="false" persist="true" /> | ||
25 | </property-group> | ||
26 | |||
27 | <process type="org.yocto.sdk.ide.NewYoctoProject"> | ||
28 | <simple name="name" value="$(projectName)" /> | ||
29 | <simple name="artifactExtension" value="exe" /> | ||
30 | <simple name="isCProject" value="true" /> | ||
31 | <simple name="isEmptyProject" value="false" /> | ||
32 | <simple name="isAutotoolsProject" value="false" /> | ||
33 | <simple name="isCMakeProject" value="true" /> | ||
34 | </process> | ||
35 | |||
36 | <process type="org.eclipse.cdt.core.CreateSourceFolder"> | ||
37 | <simple name="projectName" value="$(projectName)" /> | ||
38 | <simple name="path" value="src" /> | ||
39 | </process> | ||
40 | |||
41 | <process type="org.eclipse.cdt.managedbuilder.core.CreateIncludeFolder"> | ||
42 | <simple name="projectName" value="$(projectName)" /> | ||
43 | <simple name="path" value="inc" /> | ||
44 | </process> | ||
45 | |||
46 | <process type="org.eclipse.cdt.core.AddFiles"> | ||
47 | <simple name="projectName" value="$(projectName)" /> | ||
48 | <complex-array name="files"> | ||
49 | <element> | ||
50 | <simple name="source" value="src/main.c" /> | ||
51 | <simple name="target" value="src/main.c" /> | ||
52 | <simple name="replaceable" value="true" /> | ||
53 | </element> | ||
54 | <element> | ||
55 | <simple name="source" value="src/CMakeLists.txt" /> | ||
56 | <simple name="target" value="CMakeLists.txt" /> | ||
57 | <simple name="replaceable" value="true" /> | ||
58 | </element> | ||
59 | </complex-array> | ||
60 | </process> | ||
61 | </template> | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/CMakeLists.txt b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/CMakeLists.txt new file mode 100644 index 0000000..0436959 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/CMakeLists.txt | |||
@@ -0,0 +1,34 @@ | |||
1 | cmake_minimum_required (VERSION 2.8.1) | ||
2 | |||
3 | ######## Project settings ######## | ||
4 | PROJECT($(projectName)) | ||
5 | SET(LICENSE "TBD") | ||
6 | |||
7 | ######## Build and include settings ######## | ||
8 | include_directories( | ||
9 | inc | ||
10 | ) | ||
11 | |||
12 | link_directories( | ||
13 | ${LINK_DIRECTORIES} | ||
14 | ) | ||
15 | |||
16 | |||
17 | file(GLOB SOURCES | ||
18 | "src/*.cpp" | ||
19 | ) | ||
20 | |||
21 | add_executable( | ||
22 | $(projectName) | ||
23 | |||
24 | ${SOURCES} | ||
25 | ) | ||
26 | |||
27 | TARGET_LINK_LIBRARIES( | ||
28 | $(projectName) | ||
29 | ) | ||
30 | |||
31 | ######## Install targets ######## | ||
32 | INSTALL(TARGETS $(projectName) | ||
33 | RUNTIME DESTINATION usr/bin | ||
34 | ) | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/main.cpp b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/main.cpp new file mode 100644 index 0000000..78b4e23 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/main.cpp | |||
@@ -0,0 +1,21 @@ | |||
1 | /** @mainpage $(projectName) - $(vendor) | ||
2 | * | ||
3 | * @author $(author) <$(email)> | ||
4 | * @version $(projectVersion) | ||
5 | **/ | ||
6 | |||
7 | |||
8 | #include <stdio.h> | ||
9 | /** | ||
10 | * Main class of project $(projectName) | ||
11 | * | ||
12 | * @param argc the number of arguments | ||
13 | * @param argv the arguments from the commandline | ||
14 | * @returns exit code of the application | ||
15 | */ | ||
16 | int main(int argc, char **argv) { | ||
17 | // print a greeting to the console | ||
18 | printf("Hello World!\n"); | ||
19 | |||
20 | return 0; | ||
21 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.properties b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.properties new file mode 100644 index 0000000..99e7047 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.properties | |||
@@ -0,0 +1,31 @@ | |||
1 | #/******************************************************************************* | ||
2 | # * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | # * All rights reserved. This program and the accompanying materials | ||
4 | # * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # * which accompanies this distribution, and is available at | ||
6 | # * http://www.eclipse.org/legal/epl-v10.html | ||
7 | # * | ||
8 | # * Contributors: | ||
9 | # * BMW Car IT - initial implementation | ||
10 | # *******************************************************************************/ | ||
11 | |||
12 | # Template | ||
13 | template.vendor=Yocto Project | ||
14 | template.name=Hello World C++ CMake Project | ||
15 | template.description=A simple C++ hello world project based on CMake | ||
16 | |||
17 | # General Settings | ||
18 | general.name=General settings | ||
19 | general.description=Author properties of the project | ||
20 | general.author.name=Author | ||
21 | general.author.description=The author of the project | ||
22 | general.author.default=anonymous | ||
23 | general.email.name=Email address | ||
24 | general.email.description=The email address of the project's author | ||
25 | general.email.default=anony@mo.us | ||
26 | general.vendor.name=Vendor | ||
27 | general.vendor.description=The vendor of the project | ||
28 | general.vendor.default=None | ||
29 | general.projectVersion.name=Version | ||
30 | general.projectVersion.description=The version of the project | ||
31 | general.projectVersion.default=1.0.0 | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml new file mode 100644 index 0000000..a664d8a --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml | |||
@@ -0,0 +1,61 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
2 | <template type="ProjTempl" | ||
3 | version="1.0" supplier="%template.vendor" revision="1.0" author="Atanas Gegov" | ||
4 | id="org.yocto.cmake.template.exe.helloWorldCPPCMakeProject" label="%template.name" | ||
5 | description="%template.description"> | ||
6 | |||
7 | <property-group id="general_settings" label="%general.name" | ||
8 | description="%general.description" type="PAGES-ONLY"> | ||
9 | <property id="author" label="%general.author.name" description="%general.author.description" | ||
10 | default="%general.author.default" type="input" hidden="false" mandatory="false" | ||
11 | persist="true" /> | ||
12 | |||
13 | <property id="email" label="%general.email.name" | ||
14 | description="%general.email.description" default="%general.email.default" | ||
15 | type="input" hidden="false" mandatory="false" persist="true" /> | ||
16 | |||
17 | <property id="vendor" label="%general.vendor.name" | ||
18 | description="%general.vendor.description" default="%general.vendor.default" | ||
19 | type="input" hidden="false" mandatory="false" persist="true" /> | ||
20 | |||
21 | <property id="projectVersion" label="%general.projectVersion.name" | ||
22 | description="%general.projectVersion.description" checkproject="false" | ||
23 | default="%general.projectVersion.default" type="input" | ||
24 | pattern="([0-9]\.){2}[0-9]" hidden="false" mandatory="false" persist="true" /> | ||
25 | </property-group> | ||
26 | |||
27 | <process type="org.yocto.sdk.ide.NewYoctoProject"> | ||
28 | <simple name="name" value="$(projectName)" /> | ||
29 | <simple name="artifactExtension" value="exe" /> | ||
30 | <simple name="isCProject" value="false" /> | ||
31 | <simple name="isEmptyProject" value="false" /> | ||
32 | <simple name="isAutotoolsProject" value="false" /> | ||
33 | <simple name="isCMakeProject" value="true" /> | ||
34 | </process> | ||
35 | |||
36 | <process type="org.eclipse.cdt.core.CreateSourceFolder"> | ||
37 | <simple name="projectName" value="$(projectName)" /> | ||
38 | <simple name="path" value="src" /> | ||
39 | </process> | ||
40 | |||
41 | <process type="org.eclipse.cdt.managedbuilder.core.CreateIncludeFolder"> | ||
42 | <simple name="projectName" value="$(projectName)" /> | ||
43 | <simple name="path" value="inc" /> | ||
44 | </process> | ||
45 | |||
46 | <process type="org.eclipse.cdt.core.AddFiles"> | ||
47 | <simple name="projectName" value="$(projectName)" /> | ||
48 | <complex-array name="files"> | ||
49 | <element> | ||
50 | <simple name="source" value="src/main.cpp" /> | ||
51 | <simple name="target" value="src/main.cpp" /> | ||
52 | <simple name="replaceable" value="true" /> | ||
53 | </element> | ||
54 | <element> | ||
55 | <simple name="source" value="src/CMakeLists.txt" /> | ||
56 | <simple name="target" value="CMakeLists.txt" /> | ||
57 | <simple name="replaceable" value="true" /> | ||
58 | </element> | ||
59 | </complex-array> | ||
60 | </process> | ||
61 | </template> | ||
diff --git a/plugins/org.yocto.doc.user/.classpath b/plugins/org.yocto.doc.user/.classpath new file mode 100644 index 0000000..bc74aab --- /dev/null +++ b/plugins/org.yocto.doc.user/.classpath | |||
@@ -0,0 +1,6 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <classpath> | ||
3 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
4 | <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
5 | <classpathentry kind="output" path="bin"/> | ||
6 | </classpath> | ||
diff --git a/plugins/org.yocto.doc.user/.project b/plugins/org.yocto.doc.user/.project new file mode 100644 index 0000000..d46bf21 --- /dev/null +++ b/plugins/org.yocto.doc.user/.project | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.doc.user</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | <buildCommand> | ||
9 | <name>org.eclipse.jdt.core.javabuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | <buildCommand> | ||
14 | <name>org.eclipse.pde.ManifestBuilder</name> | ||
15 | <arguments> | ||
16 | </arguments> | ||
17 | </buildCommand> | ||
18 | <buildCommand> | ||
19 | <name>org.eclipse.pde.SchemaBuilder</name> | ||
20 | <arguments> | ||
21 | </arguments> | ||
22 | </buildCommand> | ||
23 | </buildSpec> | ||
24 | <natures> | ||
25 | <nature>org.eclipse.pde.PluginNature</nature> | ||
26 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
27 | </natures> | ||
28 | </projectDescription> | ||
diff --git a/plugins/org.yocto.doc.user/META-INF/MANIFEST.MF b/plugins/org.yocto.doc.user/META-INF/MANIFEST.MF new file mode 100644 index 0000000..83c597c --- /dev/null +++ b/plugins/org.yocto.doc.user/META-INF/MANIFEST.MF | |||
@@ -0,0 +1,8 @@ | |||
1 | Manifest-Version: 1.0 | ||
2 | Bundle-ManifestVersion: 2 | ||
3 | Bundle-Name: %Bundle-Name | ||
4 | Bundle-SymbolicName: org.yocto.doc.user;singleton:=true | ||
5 | Bundle-Version: 1.4.0.qualifier | ||
6 | Bundle-Vendor: %Bundle-Vendor | ||
7 | Bundle-RequiredExecutionEnvironment: JavaSE-1.6 | ||
8 | Require-Bundle: org.eclipse.help | ||
diff --git a/plugins/org.yocto.doc.user/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.doc.user/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..b602cbd --- /dev/null +++ b/plugins/org.yocto.doc.user/OSGI-INF/l10n/bundle.properties | |||
@@ -0,0 +1,3 @@ | |||
1 | #Properties file for org.yocto.doc.user | ||
2 | Bundle-Vendor = yoctoproject.org | ||
3 | Bundle-Name = Yocto Project Documentation | ||
diff --git a/plugins/org.yocto.doc.user/about.html.in b/plugins/org.yocto.doc.user/about.html.in new file mode 100644 index 0000000..3040859 --- /dev/null +++ b/plugins/org.yocto.doc.user/about.html.in | |||
@@ -0,0 +1,189 @@ | |||
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
3 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
4 | <head> | ||
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> | ||
6 | <title>About</title> | ||
7 | </head> | ||
8 | <body lang="EN-US"> | ||
9 | <h2>About This Content</h2> | ||
10 | |||
11 | <p> | ||
12 | <em>December, 2012</em> | ||
13 | </p> | ||
14 | <h3>License</h3> | ||
15 | |||
16 | <p> | ||
17 | Copyright (c) 2010 Intel, Inc. and others. | ||
18 | All rights reserved. This program and the accompanying materials | ||
19 | are made available under the terms of the Eclipse Public License v1.0 | ||
20 | which accompanies this distribution, and is available at <br /> | ||
21 | <a href="http://www.eclipse.org/legal/epl-v10.html"> | ||
22 | http://www.eclipse.org/legal/epl-v10.html | ||
23 | </a> | ||
24 | </p> | ||
25 | |||
26 | <h3>Third Party Content</h3> | ||
27 | <p>The Content includes items that have been sourced from the Yocto project | ||
28 | as set out below. If you did not receive this Content directly | ||
29 | from the Linux Foundation, the following is provided for | ||
30 | informational purposes only, and you should look to the | ||
31 | Redistributor's license for terms and conditions of use.</p> | ||
32 | <p> | ||
33 | <strong> | ||
34 | Yocto Project Quick Start | ||
35 | </strong> | ||
36 | <br /> | ||
37 | <br /> | ||
38 | This short document lets you get started with the Yocto Project | ||
39 | quickly and start building an image. | ||
40 | <br /> | ||
41 | <br /> | ||
42 | <em>License:</em> | ||
43 | <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode"> | ||
44 | http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode | ||
45 | </a> | ||
46 | <br /> | ||
47 | <em>Source Code Repository:</em> | ||
48 | <a href="git://git.yoctoproject.org/yocto-docs"> | ||
49 | git://git.yoctoproject.org/yocto-docs | ||
50 | </a> | ||
51 | <br /> | ||
52 | <em>Commit:</em> @COMMIT_ID-yocto-project-qs@ | ||
53 | <br /> | ||
54 | <br /> | ||
55 | <strong> | ||
56 | Yocto Project Application Developer's Guide: | ||
57 | </strong> | ||
58 | <br /> | ||
59 | <br /> | ||
60 | This manual shows you how to setup and use the Application Development | ||
61 | Toolkit (ADT) and stand-alone cross-development toolchains so you can | ||
62 | develop user-space applications. | ||
63 | <br /> | ||
64 | <br /> | ||
65 | <em>License:</em> | ||
66 | <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode"> | ||
67 | http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode | ||
68 | </a> | ||
69 | <br /> | ||
70 | <em>Source Code Repository:</em> | ||
71 | <a href="git://git.yoctoproject.org/yocto-docs"> | ||
72 | git://git.yoctoproject.org/yocto-docs | ||
73 | </a> | ||
74 | <br /> | ||
75 | <em>Commit:</em> @COMMIT_ID-adt-manual@ | ||
76 | <br /> | ||
77 | <br /> | ||
78 | <strong> | ||
79 | Yocto Project Development Manual: | ||
80 | </strong> | ||
81 | <br /> | ||
82 | <br /> | ||
83 | This manual describes how to use the Yocto Project to develop | ||
84 | embedded Linux images and user-space applications to run on | ||
85 | targeted devices. | ||
86 | <br /> | ||
87 | <br /> | ||
88 | <em>License:</em> | ||
89 | <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode"> | ||
90 | http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode | ||
91 | </a> | ||
92 | <br /> | ||
93 | <em>Source Code Repository:</em> | ||
94 | <a href="git://git.yoctoproject.org/yocto-docs"> | ||
95 | git://git.yoctoproject.org/yocto-docs | ||
96 | </a> | ||
97 | <br /> | ||
98 | <em>Commit:</em> @COMMIT_ID-dev-manual@ | ||
99 | <br /> | ||
100 | <br /> | ||
101 | <strong> | ||
102 | Yocto Project Reference Manual: | ||
103 | </strong> | ||
104 | <br /> | ||
105 | <br /> | ||
106 | This manual is the complete reference guide to the Poky component. | ||
107 | It also contains a chapter on Board Support Package (BSP) development. | ||
108 | <br /> | ||
109 | <br /> | ||
110 | <em>License:</em> | ||
111 | <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode"> | ||
112 | http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode | ||
113 | </a> | ||
114 | <br /> | ||
115 | <em>Source Code Repository:</em> | ||
116 | <a href="git://git.yoctoproject.org/yocto-docs"> | ||
117 | git://git.yoctoproject.org/yocto-docs | ||
118 | </a> | ||
119 | <br /> | ||
120 | <em>Commit:</em> @COMMIT_ID-ref-manual@ | ||
121 | <br /> | ||
122 | <br /> | ||
123 | <strong> | ||
124 | Yocto Project Board Support Package (BSP) Developer's Guide: | ||
125 | </strong> | ||
126 | <br /> | ||
127 | <br /> | ||
128 | This brief document defines a structure for BSP components. | ||
129 | Having a commonly understood layout encourages standardization. | ||
130 | <br /> | ||
131 | <br /> | ||
132 | <em>License:</em> | ||
133 | <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode"> | ||
134 | http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode | ||
135 | </a> | ||
136 | <br /> | ||
137 | <em>Source Code Repository:</em> | ||
138 | <a href="git://git.yoctoproject.org/yocto-docs"> | ||
139 | git://git.yoctoproject.org/yocto-docs | ||
140 | </a> | ||
141 | <br /> | ||
142 | <em>Commit:</em> @COMMIT_ID-bsp-guide@ | ||
143 | <br /> | ||
144 | <br /> | ||
145 | <strong> | ||
146 | Yocto Project Linux Kernel Development Manual: | ||
147 | </strong> | ||
148 | <br /> | ||
149 | <br /> | ||
150 | This document describes the architecture of the Yocto Project | ||
151 | kernel and provides some work flow examples. | ||
152 | <br /> | ||
153 | <br /> | ||
154 | <em>License:</em> | ||
155 | <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode"> | ||
156 | http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode | ||
157 | </a> | ||
158 | <br /> | ||
159 | <em>Source Code Repository:</em> | ||
160 | <a href="git://git.yoctoproject.org/yocto-docs"> | ||
161 | git://git.yoctoproject.org/yocto-docs | ||
162 | </a> | ||
163 | <br /> | ||
164 | <em>Commit:</em> @COMMIT_ID-kernel-dev@ | ||
165 | <br /> | ||
166 | <br /> | ||
167 | <strong> | ||
168 | Yocto Project Profiling and Tracing Manual: | ||
169 | </strong> | ||
170 | <br /> | ||
171 | <br /> | ||
172 | This manual presents a set of common and generally useful | ||
173 | tracing and profiling schemes along with their application | ||
174 | (as appropriate) to each tool. | ||
175 | <br /> | ||
176 | <br /> | ||
177 | <em>License:</em> | ||
178 | <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode"> | ||
179 | http://creativecommons.org/licenses/by-sa/2.0/uk/legalcode | ||
180 | </a> | ||
181 | <br /> | ||
182 | <em>Source Code Repository:</em> | ||
183 | <a href="git://git.yoctoproject.org/yocto-docs"> | ||
184 | git://git.yoctoproject.org/yocto-docs | ||
185 | </a> | ||
186 | <br /> | ||
187 | <em>Commit:</em> @COMMIT_ID-profile-manual@ | ||
188 | </p> | ||
189 | </body> | ||
diff --git a/plugins/org.yocto.doc.user/build.properties b/plugins/org.yocto.doc.user/build.properties new file mode 100644 index 0000000..cbceb14 --- /dev/null +++ b/plugins/org.yocto.doc.user/build.properties | |||
@@ -0,0 +1,9 @@ | |||
1 | bin.includes = plugin.xml,\ | ||
2 | .,\ | ||
3 | META-INF/,\ | ||
4 | OSGI-INF/,\ | ||
5 | html/,\ | ||
6 | toc.xml,\ | ||
7 | about.html | ||
8 | src.includes = html/,\ | ||
9 | about.html | ||
diff --git a/plugins/org.yocto.doc.user/html/book.css b/plugins/org.yocto.doc.user/html/book.css new file mode 100644 index 0000000..e248f5a --- /dev/null +++ b/plugins/org.yocto.doc.user/html/book.css | |||
@@ -0,0 +1 @@ | |||
@import "PLUGINS_ROOT/PRODUCT_PLUGIN/book.css"; | |||
diff --git a/plugins/org.yocto.doc.user/plugin.xml b/plugins/org.yocto.doc.user/plugin.xml new file mode 100644 index 0000000..8e87ce7 --- /dev/null +++ b/plugins/org.yocto.doc.user/plugin.xml | |||
@@ -0,0 +1,39 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <?eclipse version="3.4"?> | ||
3 | <plugin> | ||
4 | <extension | ||
5 | point="org.eclipse.help.toc"> | ||
6 | <toc | ||
7 | file="toc.xml" | ||
8 | primary="true"> | ||
9 | </toc> | ||
10 | <toc | ||
11 | file="html/adt-manual-toc.xml" | ||
12 | primary="false"> | ||
13 | </toc> | ||
14 | <toc | ||
15 | file="html/yocto-project-qs-toc.xml" | ||
16 | primary="false"> | ||
17 | </toc> | ||
18 | <toc | ||
19 | file="html/dev-manual-toc.xml" | ||
20 | primary="false"> | ||
21 | </toc> | ||
22 | <toc | ||
23 | file="html/ref-manual-toc.xml" | ||
24 | primary="false"> | ||
25 | </toc> | ||
26 | <toc | ||
27 | file="html/bsp-guide-toc.xml" | ||
28 | primary="false"> | ||
29 | </toc> | ||
30 | <toc | ||
31 | file="html/kernel-dev-toc.xml" | ||
32 | primary="false"> | ||
33 | </toc> | ||
34 | <toc | ||
35 | file="html/profile-manual-toc.xml" | ||
36 | primary="false"> | ||
37 | </toc> | ||
38 | </extension> | ||
39 | </plugin> | ||
diff --git a/plugins/org.yocto.doc.user/toc.xml b/plugins/org.yocto.doc.user/toc.xml new file mode 100644 index 0000000..86fbe29 --- /dev/null +++ b/plugins/org.yocto.doc.user/toc.xml | |||
@@ -0,0 +1,24 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <toc label="Yocto Project Documentation"> | ||
3 | <topic label="Yocto Project Quick Start"> | ||
4 | <link toc="html/yocto-project-qs-toc.xml"/> | ||
5 | </topic> | ||
6 | <topic label="Yocto·Project·Application·Developer's·Guide"> | ||
7 | <link toc="html/adt-manual-toc.xml"/> | ||
8 | </topic> | ||
9 | <topic label="Yocto Project Development Manual"> | ||
10 | <link toc="html/dev-manual-toc.xml"/> | ||
11 | </topic> | ||
12 | <topic label="Yocto Project Reference Manual"> | ||
13 | <link toc="html/ref-manual-toc.xml"/> | ||
14 | </topic> | ||
15 | <topic label="Yocto Project Board Support Package Developer's Guide"> | ||
16 | <link toc="html/bsp-guide-toc.xml"/> | ||
17 | </topic> | ||
18 | <topic label="Yocto Project Linux Kernel Development Manual"> | ||
19 | <link toc="html/kernel-dev-toc.xml"/> | ||
20 | </topic> | ||
21 | <topic label="Yocto Project Tracing and Profiling Manual"> | ||
22 | <link toc="html/profile-manual-toc.xml"/> | ||
23 | </topic> | ||
24 | </toc> | ||
diff --git a/plugins/org.yocto.remote.utils/.classpath b/plugins/org.yocto.remote.utils/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/plugins/org.yocto.remote.utils/.classpath | |||
@@ -0,0 +1,7 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <classpath> | ||
3 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
4 | <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
5 | <classpathentry kind="src" path="src"/> | ||
6 | <classpathentry kind="output" path="bin"/> | ||
7 | </classpath> | ||
diff --git a/plugins/org.yocto.remote.utils/.project b/plugins/org.yocto.remote.utils/.project new file mode 100644 index 0000000..29a2a5a --- /dev/null +++ b/plugins/org.yocto.remote.utils/.project | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.remote.utils</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | <buildCommand> | ||
9 | <name>org.eclipse.jdt.core.javabuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | <buildCommand> | ||
14 | <name>org.eclipse.pde.ManifestBuilder</name> | ||
15 | <arguments> | ||
16 | </arguments> | ||
17 | </buildCommand> | ||
18 | <buildCommand> | ||
19 | <name>org.eclipse.pde.SchemaBuilder</name> | ||
20 | <arguments> | ||
21 | </arguments> | ||
22 | </buildCommand> | ||
23 | </buildSpec> | ||
24 | <natures> | ||
25 | <nature>org.eclipse.pde.PluginNature</nature> | ||
26 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
27 | </natures> | ||
28 | </projectDescription> | ||
diff --git a/plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.prefs b/plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c537b63 --- /dev/null +++ b/plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.prefs | |||
@@ -0,0 +1,7 @@ | |||
1 | eclipse.preferences.version=1 | ||
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
4 | org.eclipse.jdt.core.compiler.compliance=1.6 | ||
5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
7 | org.eclipse.jdt.core.compiler.source=1.6 | ||
diff --git a/plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF b/plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF new file mode 100644 index 0000000..f1530f3 --- /dev/null +++ b/plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF | |||
@@ -0,0 +1,39 @@ | |||
1 | Manifest-Version: 1.0 | ||
2 | Bundle-ManifestVersion: 2 | ||
3 | Bundle-Name: Utils | ||
4 | Bundle-SymbolicName: org.yocto.remote.utils | ||
5 | Bundle-Version: 1.4.0.qualifier | ||
6 | Bundle-Activator: org.yocto.remote.utils.Activator | ||
7 | Require-Bundle: org.eclipse.ui, | ||
8 | org.eclipse.core.runtime | ||
9 | Bundle-ActivationPolicy: lazy | ||
10 | Bundle-RequiredExecutionEnvironment: JavaSE-1.6 | ||
11 | Import-Package: org.eclipse.core.internal.filesystem, | ||
12 | org.eclipse.core.internal.resources, | ||
13 | org.eclipse.core.resources, | ||
14 | org.eclipse.rse.core, | ||
15 | org.eclipse.rse.core.model, | ||
16 | org.eclipse.rse.core.subsystems, | ||
17 | org.eclipse.rse.internal.core, | ||
18 | org.eclipse.rse.internal.services.local.shells, | ||
19 | org.eclipse.rse.internal.services.shells, | ||
20 | org.eclipse.rse.internal.terminals.ui, | ||
21 | org.eclipse.rse.internal.terminals.ui.views, | ||
22 | org.eclipse.rse.internal.ui.view, | ||
23 | org.eclipse.rse.services, | ||
24 | org.eclipse.rse.services.clientserver.messages, | ||
25 | org.eclipse.rse.services.files, | ||
26 | org.eclipse.rse.services.shells, | ||
27 | org.eclipse.rse.services.terminals, | ||
28 | org.eclipse.rse.subsystems.files.core.model, | ||
29 | org.eclipse.rse.subsystems.files.core.servicesubsystem, | ||
30 | org.eclipse.rse.subsystems.files.core.subsystems, | ||
31 | org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem, | ||
32 | org.eclipse.rse.subsystems.terminals.core, | ||
33 | org.eclipse.rse.subsystems.terminals.core.elements, | ||
34 | org.eclipse.rse.ui, | ||
35 | org.eclipse.rse.ui.model, | ||
36 | org.eclipse.tm.internal.terminal.control, | ||
37 | org.eclipse.tm.internal.terminal.provisional.api, | ||
38 | org.eclipse.ui.console | ||
39 | Export-Package: org.yocto.remote.utils | ||
diff --git a/plugins/org.yocto.remote.utils/build.properties b/plugins/org.yocto.remote.utils/build.properties new file mode 100644 index 0000000..c3d44a1 --- /dev/null +++ b/plugins/org.yocto.remote.utils/build.properties | |||
@@ -0,0 +1,5 @@ | |||
1 | source.. = src/ | ||
2 | output.. = bin/ | ||
3 | bin.includes = META-INF/,\ | ||
4 | resources/,\ | ||
5 | . | ||
diff --git a/plugins/org.yocto.remote.utils/resources/ust_tar.sh b/plugins/org.yocto.remote.utils/resources/ust_tar.sh new file mode 100755 index 0000000..20a8039 --- /dev/null +++ b/plugins/org.yocto.remote.utils/resources/ust_tar.sh | |||
@@ -0,0 +1,19 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | #set PATH to include sbin dirs | ||
4 | export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin" | ||
5 | |||
6 | if [ ! -d "$@" ] || [ -z "$@" ]; then | ||
7 | exit 1 | ||
8 | fi | ||
9 | |||
10 | DATESTRING="$(date +%Y%m%d%H%M%S%N)" | ||
11 | BASENAME=`basename $@` | ||
12 | DATAFILE=/tmp/${BASENAME}-${DATESTRING}.tar | ||
13 | cd $@ | ||
14 | cd .. | ||
15 | |||
16 | tar -cf ${DATAFILE} ${BASENAME} &> /dev/null || exit $? | ||
17 | |||
18 | echo -e "ustfile:$DATAFILE\n" | ||
19 | |||
diff --git a/plugins/org.yocto.remote.utils/resources/yocto_tool.sh b/plugins/org.yocto.remote.utils/resources/yocto_tool.sh new file mode 100755 index 0000000..099e481 --- /dev/null +++ b/plugins/org.yocto.remote.utils/resources/yocto_tool.sh | |||
@@ -0,0 +1,125 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | help () | ||
4 | { | ||
5 | echo "Usage $0 command [options] application [application argument]" | ||
6 | echo "command:" | ||
7 | echo " start - start an application" | ||
8 | echo " stop - stop an application" | ||
9 | echo " restart - restart an application" | ||
10 | echo "" | ||
11 | echo "options: -d | -l <log file>" | ||
12 | echo " -d - start an application as a singleton daemon" | ||
13 | echo " -l <log file name> - redirect the standard output/error in the the file" | ||
14 | echo " note: Option -d and -l are exclusive to each other" | ||
15 | exit 1 | ||
16 | } | ||
17 | |||
18 | killproc() { # kill the named process(es) | ||
19 | pid=`/bin/pidof $1` | ||
20 | [ "x$pid" != "x" ] && kill $pid | ||
21 | } | ||
22 | |||
23 | start () | ||
24 | { | ||
25 | pid=`/bin/pidof $APP` | ||
26 | [ "x$pid" != "x" ] && return 0 | ||
27 | |||
28 | if [ "x$DAEMON" != "x" ]; then | ||
29 | if [ "x$APPARG" != "x" ]; then | ||
30 | start-stop-daemon -S -b --oknodo -x $APP -- $APPARG | ||
31 | else | ||
32 | start-stop-daemon -S -b --oknodo -x $APP | ||
33 | fi | ||
34 | |||
35 | #wait for sometime for the backend app to bring up & daemonzie | ||
36 | ret=$? | ||
37 | if [ $ret -eq 0 ]; then | ||
38 | sleep 1 | ||
39 | fi | ||
40 | return $ret | ||
41 | elif [ "x$LOGFILE" != "x" ]; then | ||
42 | $APP $APPARG $>${LOGFILE} | ||
43 | else | ||
44 | $APP $APPARG | ||
45 | fi | ||
46 | } | ||
47 | |||
48 | stop () | ||
49 | { | ||
50 | if [ "x$DAEMON" != "x" ]; then | ||
51 | start-stop-daemon -K -x $APP | ||
52 | else | ||
53 | count=0 | ||
54 | while [ -n "`/bin/pidof $APP`" -a $count -lt 10 ] ; do | ||
55 | killproc $APP >& /dev/null | ||
56 | sleep 1 | ||
57 | RETVAL=$? | ||
58 | if [ $RETVAL != 0 -o -n "`/bin/pidof $APP`" ] ; then | ||
59 | sleep 3 | ||
60 | fi | ||
61 | count=`expr $count + 1` | ||
62 | done | ||
63 | fi | ||
64 | } | ||
65 | |||
66 | restart () | ||
67 | { | ||
68 | stop | ||
69 | sleep 1 | ||
70 | start | ||
71 | } | ||
72 | |||
73 | #set PATH to include sbin dirs | ||
74 | export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin" | ||
75 | |||
76 | #get command | ||
77 | case $1 in | ||
78 | start) CMD=$1; shift 1 | ||
79 | ;; | ||
80 | stop) CMD=$1; shift 1 | ||
81 | ;; | ||
82 | *) help | ||
83 | ;; | ||
84 | esac | ||
85 | |||
86 | #get options | ||
87 | while [ $# -gt 0 ]; do | ||
88 | case $1 in | ||
89 | -d) DAEMON=true; shift 1 | ||
90 | ;; | ||
91 | -l) LOGFILE=$2; shift 2 | ||
92 | ;; | ||
93 | *) break | ||
94 | ;; | ||
95 | esac | ||
96 | done | ||
97 | |||
98 | #get application | ||
99 | APP=$1 | ||
100 | shift 1 | ||
101 | |||
102 | #get app argument | ||
103 | APPARG="$@" | ||
104 | |||
105 | #validate options | ||
106 | if [ "x$DAEMON" != "x" -a "x$LOGFILE" != "x" ]; then | ||
107 | help | ||
108 | fi | ||
109 | if [ "x$DAEMON" != "x" ]; then | ||
110 | APP=`which $APP` | ||
111 | fi | ||
112 | if [ "x$APP" == "x" ]; then | ||
113 | help | ||
114 | fi | ||
115 | |||
116 | #run script | ||
117 | case $CMD in | ||
118 | start) start | ||
119 | ;; | ||
120 | stop) stop | ||
121 | ;; | ||
122 | restart) | ||
123 | restart | ||
124 | ;; | ||
125 | esac | ||
diff --git a/plugins/org.yocto.remote.utils/resources/yocto_ust.sh b/plugins/org.yocto.remote.utils/resources/yocto_ust.sh new file mode 100755 index 0000000..a1637db --- /dev/null +++ b/plugins/org.yocto.remote.utils/resources/yocto_ust.sh | |||
@@ -0,0 +1,35 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | #set PATH to include sbin dirs | ||
4 | export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin" | ||
5 | |||
6 | DATESTRING="$(date +%Y%m%d%H%M%S%N)" | ||
7 | TEMPFILE="/tmp/yocto-ust-tmp-$DATESTRING" | ||
8 | |||
9 | rm -f ${TEMPFILE} | ||
10 | usttrace $@ &> ${TEMPFILE} | ||
11 | ret=$? | ||
12 | |||
13 | if [ $ret -ne 0 ]; then | ||
14 | cat $TEMPFILE | ||
15 | rm -f $TEMPFILE | ||
16 | exit $ret | ||
17 | fi | ||
18 | |||
19 | #search for output dir | ||
20 | USTDIR=`cat ${TEMPFILE} | awk '/^Trace was output in:/ { print $5}'` | ||
21 | rm -f ${TEMPFILE} | ||
22 | |||
23 | if [ -z "$USTDIR" ]; then | ||
24 | exit 1 | ||
25 | fi | ||
26 | |||
27 | BASENAME=`basename $USTDIR` | ||
28 | DATAFILE=/tmp/${BASENAME}.tar | ||
29 | cd $USTDIR | ||
30 | cd .. | ||
31 | |||
32 | tar -cf ${DATAFILE} ${BASENAME} &> /dev/null || exit $? | ||
33 | |||
34 | echo -e "ustfile:$DATAFILE\n" | ||
35 | |||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java new file mode 100644 index 0000000..da66a3e --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java | |||
@@ -0,0 +1,62 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | import org.eclipse.ui.plugin.AbstractUIPlugin; | ||
14 | import org.osgi.framework.BundleContext; | ||
15 | |||
16 | /** | ||
17 | * The activator class controls the plug-in life cycle | ||
18 | */ | ||
19 | public class Activator extends AbstractUIPlugin { | ||
20 | |||
21 | // The plug-in ID | ||
22 | public static final String PLUGIN_ID = "org.yocto.remote.utils"; //$NON-NLS-1$ | ||
23 | |||
24 | // The shared instance | ||
25 | private static Activator plugin; | ||
26 | |||
27 | /** | ||
28 | * The constructor | ||
29 | */ | ||
30 | public Activator() { | ||
31 | } | ||
32 | |||
33 | /* | ||
34 | * (non-Javadoc) | ||
35 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) | ||
36 | */ | ||
37 | @Override | ||
38 | public void start(BundleContext context) throws Exception { | ||
39 | super.start(context); | ||
40 | plugin = this; | ||
41 | } | ||
42 | |||
43 | /* | ||
44 | * (non-Javadoc) | ||
45 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) | ||
46 | */ | ||
47 | @Override | ||
48 | public void stop(BundleContext context) throws Exception { | ||
49 | plugin = null; | ||
50 | super.stop(context); | ||
51 | } | ||
52 | |||
53 | /** | ||
54 | * Returns the shared instance | ||
55 | * | ||
56 | * @return the shared instance | ||
57 | */ | ||
58 | public static Activator getDefault() { | ||
59 | return plugin; | ||
60 | } | ||
61 | |||
62 | } | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandOutputProcessor.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandOutputProcessor.java new file mode 100644 index 0000000..081e6d4 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandOutputProcessor.java | |||
@@ -0,0 +1,43 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ioana Grigoropol(Intel) - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | import org.eclipse.core.runtime.IProgressMonitor; | ||
14 | import org.eclipse.rse.services.shells.IHostShell; | ||
15 | |||
16 | public class CommandOutputProcessor extends OutputProcessor { | ||
17 | |||
18 | public CommandOutputProcessor(IProgressMonitor monitor, | ||
19 | IHostShell hostShell, CommandResponseHandler cmdHandler, String task) { | ||
20 | super(monitor, hostShell, cmdHandler, task); | ||
21 | } | ||
22 | |||
23 | @Override | ||
24 | protected boolean isErrChStop(char ch) { | ||
25 | return (ch == '\n'); | ||
26 | } | ||
27 | |||
28 | @Override | ||
29 | protected boolean isOutChStop(char ch) { | ||
30 | return (ch == '\n'); | ||
31 | } | ||
32 | |||
33 | @Override | ||
34 | protected void processOutputBufferLine(char ch, String str) { | ||
35 | processBuffer.addOutputLine(str); | ||
36 | } | ||
37 | |||
38 | @Override | ||
39 | protected void processErrorBufferLine(char ch, String str) { | ||
40 | processBuffer.addErrorLine(str); | ||
41 | } | ||
42 | |||
43 | } | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandResponseHandler.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandResponseHandler.java new file mode 100644 index 0000000..f02fbfa --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandResponseHandler.java | |||
@@ -0,0 +1,44 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ioana Grigoropol(Intel) - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | import org.eclipse.ui.console.MessageConsole; | ||
14 | import org.eclipse.ui.console.MessageConsoleStream; | ||
15 | |||
16 | public class CommandResponseHandler implements ICommandResponseHandler { | ||
17 | private MessageConsoleStream consoleStream; | ||
18 | private Boolean errorOccured = false; | ||
19 | |||
20 | public CommandResponseHandler(MessageConsole console) { | ||
21 | try { | ||
22 | this.consoleStream = console.newMessageStream(); | ||
23 | } catch (Exception e) { | ||
24 | e.printStackTrace(); | ||
25 | } | ||
26 | } | ||
27 | |||
28 | public Boolean hasError() { | ||
29 | return errorOccured; | ||
30 | } | ||
31 | |||
32 | @Override | ||
33 | public void response(String line, boolean isError) { | ||
34 | try { | ||
35 | if (isError) { | ||
36 | errorOccured = true; | ||
37 | } | ||
38 | consoleStream.println(line); | ||
39 | } catch (Exception e) { | ||
40 | e.printStackTrace(); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandRunnable.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandRunnable.java new file mode 100644 index 0000000..8cbda18 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommandRunnable.java | |||
@@ -0,0 +1,44 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ioana Grigoropol(Intel) - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | import org.eclipse.core.runtime.CoreException; | ||
14 | import org.eclipse.core.runtime.IProgressMonitor; | ||
15 | import org.eclipse.rse.core.model.IHost; | ||
16 | import org.eclipse.rse.services.shells.IHostShell; | ||
17 | |||
18 | public class CommandRunnable implements Runnable{ | ||
19 | private IHostShell hostShell; | ||
20 | private final IHost connection; | ||
21 | private final YoctoCommand cmd; | ||
22 | private final IProgressMonitor monitor; | ||
23 | private final CommandResponseHandler cmdHandler; | ||
24 | |||
25 | CommandRunnable(IHost connection, YoctoCommand cmd, IProgressMonitor monitor){ | ||
26 | this.connection = connection; | ||
27 | this.cmdHandler = RemoteHelper.getCommandHandler(connection); | ||
28 | this.cmd = cmd; | ||
29 | this.monitor = monitor; | ||
30 | this.hostShell = null; | ||
31 | } | ||
32 | @Override | ||
33 | public void run() { | ||
34 | try { | ||
35 | hostShell = RemoteHelper.runCommandRemote(connection, cmd, monitor); | ||
36 | cmd.setProcessBuffer(RemoteHelper.processOutput(monitor, hostShell, cmdHandler)); | ||
37 | } catch (CoreException e) { | ||
38 | e.printStackTrace(); | ||
39 | } catch (Exception e) { | ||
40 | e.printStackTrace(); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | } | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommonHelper.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommonHelper.java new file mode 100644 index 0000000..23afd38 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommonHelper.java | |||
@@ -0,0 +1,46 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | import org.eclipse.core.runtime.IStatus; | ||
14 | import org.eclipse.core.runtime.Status; | ||
15 | import org.eclipse.jface.dialogs.ErrorDialog; | ||
16 | import org.eclipse.swt.widgets.Display; | ||
17 | |||
18 | public class CommonHelper { | ||
19 | |||
20 | static public boolean isExecAvail(String exec) { | ||
21 | boolean ret = false; | ||
22 | try { | ||
23 | Process p = Runtime.getRuntime().exec(new String[] {"which", exec}); | ||
24 | p.waitFor(); | ||
25 | if(p.exitValue() == 0) { | ||
26 | ret = true; | ||
27 | } | ||
28 | } catch (Exception e) { | ||
29 | e.printStackTrace(); | ||
30 | } | ||
31 | return ret; | ||
32 | } | ||
33 | |||
34 | public static void showErrorDialog(final String dialogTitle, final String errorMessage, final String reason) { | ||
35 | //needs to be run in the ui thread otherwise swt throws invalid thread access | ||
36 | Display.getDefault().syncExec(new Runnable() { | ||
37 | @Override | ||
38 | public void run() { | ||
39 | ErrorDialog.openError(null, dialogTitle, errorMessage, | ||
40 | new Status(IStatus.ERROR,Activator.PLUGIN_ID,reason)); | ||
41 | } | ||
42 | }); | ||
43 | |||
44 | } | ||
45 | |||
46 | } | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ConsoleHelper.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ConsoleHelper.java new file mode 100644 index 0000000..9c5c244 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ConsoleHelper.java | |||
@@ -0,0 +1,38 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ioana Grigoropol(Intel) - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | import org.eclipse.swt.widgets.Display; | ||
14 | import org.eclipse.ui.console.ConsolePlugin; | ||
15 | import org.eclipse.ui.console.IConsole; | ||
16 | import org.eclipse.ui.console.IConsoleManager; | ||
17 | import org.eclipse.ui.console.MessageConsole; | ||
18 | |||
19 | public class ConsoleHelper { | ||
20 | public static final String YOCTO_CONSOLE = "Yocto Project Console"; | ||
21 | |||
22 | public static MessageConsole findConsole(String name) { | ||
23 | ConsolePlugin plugin = ConsolePlugin.getDefault(); | ||
24 | IConsoleManager conMan = plugin.getConsoleManager(); | ||
25 | IConsole[] existing = conMan.getConsoles(); | ||
26 | for (int i = 0; i < existing.length; i++) | ||
27 | if (name.equals(existing[i].getName())) | ||
28 | return (MessageConsole) existing[i]; | ||
29 | // no console found, so create a new one | ||
30 | MessageConsole myConsole = new MessageConsole(name, null); | ||
31 | conMan.addConsoles(new IConsole[] { myConsole }); | ||
32 | return myConsole; | ||
33 | } | ||
34 | |||
35 | public static void showConsole(MessageConsole console){ | ||
36 | Display.getDefault().syncExec(new ConsoleRunnable(console)); | ||
37 | } | ||
38 | } | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ConsoleRunnable.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ConsoleRunnable.java new file mode 100644 index 0000000..e5fe666 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ConsoleRunnable.java | |||
@@ -0,0 +1,47 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ioana Grigoropol(Intel) - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | import org.eclipse.ui.IWorkbench; | ||
14 | import org.eclipse.ui.IWorkbenchPage; | ||
15 | import org.eclipse.ui.IWorkbenchWindow; | ||
16 | import org.eclipse.ui.PlatformUI; | ||
17 | import org.eclipse.ui.console.IConsoleConstants; | ||
18 | import org.eclipse.ui.console.IConsoleView; | ||
19 | import org.eclipse.ui.console.MessageConsole; | ||
20 | |||
21 | public class ConsoleRunnable implements Runnable{ | ||
22 | MessageConsole console; | ||
23 | ConsoleRunnable (MessageConsole console){ | ||
24 | this.console = console; | ||
25 | } | ||
26 | @Override | ||
27 | public void run() { | ||
28 | IWorkbench wb = PlatformUI.getWorkbench(); | ||
29 | if (wb == null) | ||
30 | return; | ||
31 | IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); | ||
32 | if (win == null) | ||
33 | return; | ||
34 | IWorkbenchPage page = win.getActivePage(); | ||
35 | if (page == null) | ||
36 | return; | ||
37 | String id = IConsoleConstants.ID_CONSOLE_VIEW; | ||
38 | try { | ||
39 | IConsoleView view = (IConsoleView) page.showView(id); | ||
40 | if (view == null) | ||
41 | return; | ||
42 | view.display(console); | ||
43 | } catch (Exception e) { | ||
44 | e.printStackTrace(); | ||
45 | } | ||
46 | } | ||
47 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/DialogRunnable.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/DialogRunnable.java new file mode 100644 index 0000000..5fbab76 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/DialogRunnable.java | |||
@@ -0,0 +1,26 @@ | |||
1 | package org.yocto.remote.utils; | ||
2 | |||
3 | import org.eclipse.jface.dialogs.MessageDialog; | ||
4 | |||
5 | public class DialogRunnable implements Runnable{ | ||
6 | int type = 0; | ||
7 | boolean result; | ||
8 | public static final int QUESTION = 1; | ||
9 | public static final int ERROR = 2; | ||
10 | String title; | ||
11 | String message; | ||
12 | |||
13 | DialogRunnable(String title, String message, int type){ | ||
14 | this.title = title; | ||
15 | this.message = message; | ||
16 | this.type = type; | ||
17 | } | ||
18 | @Override | ||
19 | public void run() { | ||
20 | if (type == QUESTION) { | ||
21 | result = MessageDialog.openQuestion(null, title, message); | ||
22 | } else if (type == ERROR) { | ||
23 | MessageDialog.openError(null, title, message); | ||
24 | } | ||
25 | } | ||
26 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ICommandResponseHandler.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ICommandResponseHandler.java new file mode 100644 index 0000000..193d57c --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ICommandResponseHandler.java | |||
@@ -0,0 +1,16 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer, Intel Corporation | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Ioana Grigoropol (Intel) - move to separate remote utilities plugin | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.remote.utils; | ||
13 | |||
14 | public interface ICommandResponseHandler { | ||
15 | public void response(String line, boolean isError); | ||
16 | } | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Messages.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Messages.java new file mode 100644 index 0000000..fc696d6 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Messages.java | |||
@@ -0,0 +1,35 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | import org.eclipse.osgi.util.NLS; | ||
14 | |||
15 | public class Messages extends NLS { | ||
16 | |||
17 | private static final String BUNDLE_NAME = "org.yocto.remote.utils.messages"; //$NON-NLS-1$ | ||
18 | |||
19 | public static String ErrorNoSubsystem; | ||
20 | public static String ErrorConnectSubsystem; | ||
21 | |||
22 | public static String InfoDownload; | ||
23 | public static String InfoUpload; | ||
24 | |||
25 | public static String RemoteShellExec_1; | ||
26 | public static String RemoteShellExec_2; | ||
27 | |||
28 | static { | ||
29 | // initialize resource bundle | ||
30 | NLS.initializeMessages(BUNDLE_NAME, Messages.class); | ||
31 | } | ||
32 | |||
33 | private Messages() { | ||
34 | } | ||
35 | } | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/OutputProcessor.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/OutputProcessor.java new file mode 100644 index 0000000..401a782 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/OutputProcessor.java | |||
@@ -0,0 +1,112 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ioana Grigoropol(Intel) - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | import java.io.BufferedReader; | ||
14 | import java.io.IOException; | ||
15 | import java.io.InputStreamReader; | ||
16 | import java.util.concurrent.locks.Lock; | ||
17 | |||
18 | import org.eclipse.core.runtime.IProgressMonitor; | ||
19 | import org.eclipse.rse.internal.services.local.shells.LocalHostShell; | ||
20 | import org.eclipse.rse.internal.services.shells.TerminalServiceHostShell; | ||
21 | import org.eclipse.rse.services.shells.HostShellProcessAdapter; | ||
22 | import org.eclipse.rse.services.shells.IHostShell; | ||
23 | |||
24 | public abstract class OutputProcessor{ | ||
25 | private static final int ERROR_BUFFER = 1; | ||
26 | private static final int OUTPUT_BUFFER = 2; | ||
27 | protected String task; | ||
28 | protected ProcessStreamBuffer processBuffer; | ||
29 | protected IHostShell hostShell; | ||
30 | protected CommandResponseHandler cmdHandler; | ||
31 | protected IProgressMonitor monitor; | ||
32 | |||
33 | public OutputProcessor(IProgressMonitor monitor, IHostShell hostShell, CommandResponseHandler cmdHandler, String task){ | ||
34 | this.monitor = monitor; | ||
35 | this.hostShell = hostShell; | ||
36 | this.processBuffer = new ProcessStreamBuffer(hostShell instanceof TerminalServiceHostShell); | ||
37 | this.cmdHandler = cmdHandler; | ||
38 | this.task = task; | ||
39 | } | ||
40 | public ProcessStreamBuffer processOutput() throws Exception{ | ||
41 | if (hostShell == null) | ||
42 | throw new Exception("An error has occured while trying to run remote command!"); | ||
43 | monitor.beginTask(this.task, RemoteHelper.TOTALWORKLOAD); | ||
44 | Lock lock = null; | ||
45 | if (hostShell instanceof LocalHostShell) { | ||
46 | lock = ((LocalHostShell)hostShell).getLock(); | ||
47 | lock.lock(); | ||
48 | } | ||
49 | BufferedReader inbr = null; | ||
50 | BufferedReader errbr = null; | ||
51 | |||
52 | if (hostShell instanceof LocalHostShell) { | ||
53 | inbr = ((LocalHostShell)hostShell).getReader(false); | ||
54 | errbr = ((LocalHostShell)hostShell).getReader(true); | ||
55 | } else { | ||
56 | Process p = new HostShellProcessAdapter(hostShell); | ||
57 | inbr = new BufferedReader(new InputStreamReader(p.getInputStream())); | ||
58 | errbr = new BufferedReader(new InputStreamReader(p.getErrorStream())); | ||
59 | } | ||
60 | boolean cancel = false; | ||
61 | while (!cancel) { | ||
62 | if(monitor.isCanceled()) { | ||
63 | cancel = true; | ||
64 | if (lock != null) | ||
65 | lock.unlock(); | ||
66 | throw new InterruptedException("User Cancelled"); | ||
67 | } | ||
68 | processBuffer(errbr, ERROR_BUFFER); | ||
69 | processBuffer(inbr, OUTPUT_BUFFER); | ||
70 | cancel = true; | ||
71 | } | ||
72 | if (lock != null) | ||
73 | lock.unlock(); | ||
74 | return processBuffer; | ||
75 | } | ||
76 | protected abstract boolean isErrChStop(char ch); | ||
77 | protected abstract boolean isOutChStop(char ch); | ||
78 | protected boolean isChStop(char ch, int type){ | ||
79 | if (type == ERROR_BUFFER) | ||
80 | return isErrChStop(ch); | ||
81 | else if(type == OUTPUT_BUFFER) | ||
82 | return isOutChStop(ch); | ||
83 | return false; | ||
84 | } | ||
85 | protected abstract void processOutputBufferLine(char ch, String str); | ||
86 | protected abstract void processErrorBufferLine(char ch, String str); | ||
87 | protected void processBufferLine(String str, char ch, int type){ | ||
88 | if (type == ERROR_BUFFER) | ||
89 | processErrorBufferLine(ch, str); | ||
90 | else if(type == OUTPUT_BUFFER) | ||
91 | processOutputBufferLine(ch, str); | ||
92 | } | ||
93 | protected void processBuffer(BufferedReader br, int type) throws IOException{ | ||
94 | StringBuffer buffer = new StringBuffer(); | ||
95 | int c; | ||
96 | if (br != null) | ||
97 | while ((c = br.read()) != -1) { | ||
98 | char ch = (char) c; | ||
99 | buffer.append(ch); | ||
100 | if (isChStop(ch, type)){ | ||
101 | String str = buffer.toString(); | ||
102 | processBufferLine(str, ch, type); | ||
103 | System.out.println(str); | ||
104 | if (str.trim().equals(RemoteHelper.TERMINATOR)) { | ||
105 | break; | ||
106 | } | ||
107 | cmdHandler.response(str, false); | ||
108 | buffer.delete(0, buffer.length()); | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ProcessStreamBuffer.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ProcessStreamBuffer.java new file mode 100644 index 0000000..111f607 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ProcessStreamBuffer.java | |||
@@ -0,0 +1,87 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | import java.util.ArrayList; | ||
14 | import java.util.List; | ||
15 | import java.util.regex.Pattern; | ||
16 | |||
17 | public class ProcessStreamBuffer { | ||
18 | private static final String WHITESPACES = "\\s+"; | ||
19 | List<String> errorLines; | ||
20 | List<String> outputLines; | ||
21 | boolean isTerminal; | ||
22 | |||
23 | ProcessStreamBuffer(boolean isTerminal){ | ||
24 | this.isTerminal = isTerminal; | ||
25 | errorLines = new ArrayList<String>(); | ||
26 | outputLines = new ArrayList<String>(); | ||
27 | } | ||
28 | |||
29 | public void addErrorLine(String line){ | ||
30 | errorLines.add(line); | ||
31 | } | ||
32 | public void addOutputLine(String line){ | ||
33 | outputLines.add(line); | ||
34 | } | ||
35 | |||
36 | public List<String> getOutputLines(){ | ||
37 | return outputLines; | ||
38 | } | ||
39 | |||
40 | public List<String> getErrorLines(){ | ||
41 | return errorLines; | ||
42 | } | ||
43 | |||
44 | public String getMergedOutputLines(){ | ||
45 | String returnVal = ""; | ||
46 | for (int i = 0; i < outputLines.size(); i++) { | ||
47 | String line = outputLines.get(i); | ||
48 | returnVal += line; | ||
49 | if (outputLines.size() > 1 && i != outputLines.size() - 1) | ||
50 | returnVal += "\n"; | ||
51 | } | ||
52 | return returnVal; | ||
53 | } | ||
54 | |||
55 | public boolean hasErrors() { | ||
56 | return errorLines.size() != 0; | ||
57 | } | ||
58 | |||
59 | public String getLastOutputLineContaining(String str) { | ||
60 | if (!errorLines.isEmpty()) | ||
61 | return null; | ||
62 | for (int i = outputLines.size() - 1; i >= 0; i--){ | ||
63 | String line = outputLines.get(i); | ||
64 | if (line.replaceAll(WHITESPACES, "").contains(str.replaceAll(WHITESPACES, ""))) | ||
65 | return line; | ||
66 | } | ||
67 | return null; | ||
68 | } | ||
69 | |||
70 | public String getOutputLineContaining(String arg, String pattern) { | ||
71 | List<String> lines = null; | ||
72 | if (isTerminal) | ||
73 | lines = errorLines; | ||
74 | else | ||
75 | lines = outputLines; | ||
76 | for (int i = lines.size() - 1; i >= 0; i--){ | ||
77 | String line = lines.get(i); | ||
78 | if (line.contains(arg)) { | ||
79 | String[] tokens = line.split("\\s+"); | ||
80 | if (Pattern.matches(pattern, tokens[0])) { | ||
81 | return tokens[0]; | ||
82 | } | ||
83 | } | ||
84 | } | ||
85 | return ""; | ||
86 | } | ||
87 | } | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteHelper.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteHelper.java new file mode 100644 index 0000000..e0097ec --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteHelper.java | |||
@@ -0,0 +1,680 @@ | |||
1 | /******************************************************************************** | ||
2 | * Copyright (c) 2013 MontaVista Software, Inc and Others. | ||
3 | * This program and the accompanying materials are made available under the terms | ||
4 | * of the Eclipse Public License v1.0 which accompanies this distribution, and is | ||
5 | * available at http://www.eclipse.org/legal/epl-v10.html | ||
6 | * | ||
7 | * Contributors: | ||
8 | * Anna Dushistova (MontaVista) - initial API and implementation | ||
9 | * Lianhao Lu (Intel) - Modified to add other file operations. | ||
10 | * Ioana Grigoropol (Intel) - Separated remote functionality | ||
11 | ********************************************************************************/ | ||
12 | package org.yocto.remote.utils; | ||
13 | |||
14 | import java.io.BufferedInputStream; | ||
15 | import java.io.BufferedOutputStream; | ||
16 | import java.io.BufferedReader; | ||
17 | import java.io.File; | ||
18 | import java.io.FileInputStream; | ||
19 | import java.io.FileNotFoundException; | ||
20 | import java.io.FileOutputStream; | ||
21 | import java.io.FileReader; | ||
22 | import java.io.IOException; | ||
23 | import java.io.InputStream; | ||
24 | import java.io.PrintWriter; | ||
25 | import java.net.URI; | ||
26 | import java.net.URISyntaxException; | ||
27 | import java.nio.file.Files; | ||
28 | import java.util.ArrayList; | ||
29 | import java.util.Arrays; | ||
30 | import java.util.HashMap; | ||
31 | import java.util.Iterator; | ||
32 | import java.util.List; | ||
33 | import java.util.Map; | ||
34 | |||
35 | import org.eclipse.core.internal.filesystem.InternalFileSystemCore; | ||
36 | import org.eclipse.core.internal.resources.LocalMetaArea; | ||
37 | import org.eclipse.core.internal.resources.Workspace; | ||
38 | import org.eclipse.core.resources.ResourcesPlugin; | ||
39 | import org.eclipse.core.runtime.CoreException; | ||
40 | import org.eclipse.core.runtime.FileLocator; | ||
41 | import org.eclipse.core.runtime.IPath; | ||
42 | import org.eclipse.core.runtime.IProgressMonitor; | ||
43 | import org.eclipse.core.runtime.IStatus; | ||
44 | import org.eclipse.core.runtime.MultiStatus; | ||
45 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
46 | import org.eclipse.core.runtime.Path; | ||
47 | import org.eclipse.core.runtime.Status; | ||
48 | import org.eclipse.core.runtime.SubProgressMonitor; | ||
49 | import org.eclipse.osgi.util.NLS; | ||
50 | import org.eclipse.rse.core.IRSECoreStatusCodes; | ||
51 | import org.eclipse.rse.core.IRSEInitListener; | ||
52 | import org.eclipse.rse.core.IRSESystemType; | ||
53 | import org.eclipse.rse.core.IRSEUserIdConstants; | ||
54 | import org.eclipse.rse.core.RSECorePlugin; | ||
55 | import org.eclipse.rse.core.model.IHost; | ||
56 | import org.eclipse.rse.core.model.ISubSystemConfigurationCategories; | ||
57 | import org.eclipse.rse.core.model.ISubSystemConfigurator; | ||
58 | import org.eclipse.rse.core.model.ISystemHostPool; | ||
59 | import org.eclipse.rse.core.model.ISystemRegistry; | ||
60 | import org.eclipse.rse.core.IRSECoreRegistry; | ||
61 | import org.eclipse.rse.core.subsystems.ISubSystem; | ||
62 | import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; | ||
63 | import org.eclipse.rse.internal.core.RSEInitJob; | ||
64 | import org.eclipse.rse.internal.ui.view.SystemPerspectiveHelpers; | ||
65 | import org.eclipse.rse.services.IService; | ||
66 | import org.eclipse.rse.services.clientserver.messages.SystemMessageException; | ||
67 | import org.eclipse.rse.services.files.IFileService; | ||
68 | import org.eclipse.rse.services.files.IHostFile; | ||
69 | import org.eclipse.rse.services.shells.HostShellProcessAdapter; | ||
70 | import org.eclipse.rse.services.shells.IHostShell; | ||
71 | import org.eclipse.rse.services.shells.IShellService; | ||
72 | import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; | ||
73 | import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; | ||
74 | import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; | ||
75 | import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; | ||
76 | import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; | ||
77 | import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem; | ||
78 | import org.eclipse.rse.ui.RSEUIPlugin; | ||
79 | import org.eclipse.rse.ui.SystemBasePlugin; | ||
80 | import org.eclipse.rse.ui.SystemConnectionForm; | ||
81 | import org.eclipse.ui.console.MessageConsole; | ||
82 | |||
83 | public class RemoteHelper { | ||
84 | private final static String EXIT_CMD = "exit"; //$NON-NLS-1$ | ||
85 | private final static String CMD_DELIMITER = ";"; //$NON-NLS-1$ | ||
86 | private final static String LOCAL_CONN_NAME = "Local"; | ||
87 | private final static String CONNECTION_NAME = "127.0.0.1"; | ||
88 | private final static String HOST_NAME = "LOCALHOST"; | ||
89 | public static final String TERMINATOR = "234o987dsfkcqiuwey18837032843259d";//$NON-NLS-1$ | ||
90 | public static final int TOTALWORKLOAD = 100; | ||
91 | private static Map<IHost, RemoteMachine> machines; | ||
92 | |||
93 | public static IPath getWorkspaceMetaArea(){ | ||
94 | Workspace workspace = (Workspace)ResourcesPlugin.getWorkspace(); | ||
95 | LocalMetaArea metaDataArea = workspace.getMetaArea(); | ||
96 | return metaDataArea.getLocation(); | ||
97 | } | ||
98 | public static void storeProjDescrInMetaArea(IHost conn, String projName, String remoteSrc){ | ||
99 | IPath path = getWorkspaceMetaArea(); | ||
100 | String sep = File.separator; | ||
101 | String localDest = path.toString() + sep + ".projects" + sep + projName + sep + ".project"; | ||
102 | try { | ||
103 | getRemoteFile(conn, localDest, remoteSrc + sep + ".project", new NullProgressMonitor()); | ||
104 | } catch (Exception e) { | ||
105 | e.printStackTrace(); | ||
106 | } | ||
107 | } | ||
108 | public static String retrieveProjRootFromMetaArea(String projName){ | ||
109 | IPath path = getWorkspaceMetaArea(); | ||
110 | String sep = File.separator; | ||
111 | return path.toString() + sep + ".projects" + sep + projName + sep; | ||
112 | } | ||
113 | public static void storeURIInMetaArea(String projName, URI uri){ | ||
114 | IPath path = getWorkspaceMetaArea(); | ||
115 | String sep = File.separator; | ||
116 | File f = new File(path.toString() + sep + ".projects" + sep + projName + sep + ".originalURI"); | ||
117 | PrintWriter writer; | ||
118 | try { | ||
119 | writer = new PrintWriter(f); | ||
120 | writer.println(uri.getScheme()); | ||
121 | writer.println(uri.getHost()); | ||
122 | writer.println(uri.getPath()); | ||
123 | writer.println(uri.getFragment()); | ||
124 | writer.close(); | ||
125 | } catch (FileNotFoundException e) { | ||
126 | e.printStackTrace(); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | public static URI retrieveURIFromMetaArea(String projName){ | ||
131 | IPath path = getWorkspaceMetaArea(); | ||
132 | String sep = File.separator; | ||
133 | File f = new File(path.toString() + sep + ".projects" + sep + projName + sep + ".originalURI"); | ||
134 | try { | ||
135 | BufferedReader buf = new BufferedReader(new FileReader(f)); | ||
136 | String line = null; | ||
137 | List<String> elems = new ArrayList<String>(); | ||
138 | while((line = buf.readLine()) != null){ | ||
139 | if (line.equals("null")) | ||
140 | line = null; | ||
141 | elems.add(line); | ||
142 | } | ||
143 | buf.close(); | ||
144 | if (elems.size() == 4){ | ||
145 | URI uri = new URI(elems.get(0), elems.get(1), elems.get(2), elems.get(3)); | ||
146 | return uri; | ||
147 | } | ||
148 | } catch (IOException e) { | ||
149 | e.printStackTrace(); | ||
150 | } catch (URISyntaxException e) { | ||
151 | e.printStackTrace(); | ||
152 | } | ||
153 | return null; | ||
154 | } | ||
155 | |||
156 | public static boolean isInitialized(final URI uri){ | ||
157 | boolean init = RSECorePlugin.isInitComplete(RSECorePlugin.INIT_MODEL); | ||
158 | if (!init) { | ||
159 | RSEInitJob.getInstance().addInitListener(new IRSEInitListener() { | ||
160 | @Override | ||
161 | public void phaseComplete(int arg0) { | ||
162 | try { | ||
163 | InternalFileSystemCore.getInstance().getStore(uri); | ||
164 | } catch (CoreException e) { | ||
165 | e.printStackTrace(); | ||
166 | } | ||
167 | } | ||
168 | }); | ||
169 | } | ||
170 | return init; | ||
171 | } | ||
172 | |||
173 | public static IHost getRemoteConnectionByName(String remoteConnection) { | ||
174 | if (remoteConnection == null) | ||
175 | return null; | ||
176 | IHost[] connections = RSECorePlugin.getTheSystemRegistry().getHosts(); | ||
177 | for (int i = 0; i < connections.length; i++) | ||
178 | if (connections[i].getAliasName().equals(remoteConnection)) | ||
179 | return connections[i]; | ||
180 | return null; | ||
181 | } | ||
182 | |||
183 | public static ISubSystem getFileSubsystem(IHost host) { | ||
184 | if (host == null) | ||
185 | return null; | ||
186 | ISubSystem[] subSystems = host.getSubSystems(); | ||
187 | for (int i = 0; i < subSystems.length; i++) { | ||
188 | if (subSystems[i] instanceof IFileServiceSubSystem) | ||
189 | return subSystems[i]; | ||
190 | } | ||
191 | return null; | ||
192 | } | ||
193 | |||
194 | public static ISubSystem getShellSubsystem(IHost host) { | ||
195 | if (host == null) | ||
196 | return null; | ||
197 | ISubSystem[] subSystems = host.getSubSystems(); | ||
198 | for (int i = 0; i < subSystems.length; i++) { | ||
199 | if (subSystems[i] instanceof IShellServiceSubSystem) | ||
200 | return subSystems[i]; | ||
201 | } | ||
202 | return null; | ||
203 | } | ||
204 | |||
205 | public static IHost[] getSuitableConnections() { | ||
206 | |||
207 | //we only get RSE connections with files&cmds subsystem | ||
208 | ArrayList <IHost> filConnections = new ArrayList <IHost>(Arrays.asList(RSECorePlugin.getTheSystemRegistry() | ||
209 | .getHostsBySubSystemConfigurationCategory(ISubSystemConfigurationCategories.SUBSYSTEM_CATEGORY_FILES))); //$NON-NLS-1$ | ||
210 | |||
211 | ArrayList <IHost> terminalConnections = new ArrayList <IHost>(Arrays.asList(RSECorePlugin.getTheSystemRegistry() | ||
212 | .getHostsBySubSystemConfigurationCategory("terminal")));//$NON-NLS-1$ | ||
213 | |||
214 | ArrayList <IHost> shellConnections = new ArrayList <IHost>(Arrays.asList(RSECorePlugin.getTheSystemRegistry() | ||
215 | .getHostsBySubSystemConfigurationCategory("shells"))); //$NON-NLS-1$ | ||
216 | |||
217 | Iterator <IHost>iter = filConnections.iterator(); | ||
218 | while(iter.hasNext()){ | ||
219 | IHost fileConnection = iter.next(); | ||
220 | if(!terminalConnections.contains(fileConnection) && !shellConnections.contains(fileConnection)){ | ||
221 | iter.remove(); | ||
222 | } | ||
223 | IRSESystemType sysType = fileConnection.getSystemType(); | ||
224 | if (sysType == null || !sysType.isEnabled()) { | ||
225 | iter.remove(); | ||
226 | } | ||
227 | } | ||
228 | |||
229 | return filConnections.toArray(new IHost[filConnections.size()]); | ||
230 | } | ||
231 | |||
232 | public static void putRemoteFileInPlugin(IHost connection, String locaPathInPlugin, String remoteExePath, | ||
233 | IProgressMonitor monitor) throws Exception { | ||
234 | |||
235 | assert(connection != null); | ||
236 | monitor.beginTask(Messages.InfoUpload, 100); | ||
237 | |||
238 | IFileService fileService; | ||
239 | try { | ||
240 | fileService = getConnectedRemoteFileService( | ||
241 | connection, | ||
242 | new SubProgressMonitor(monitor, 5)); | ||
243 | InputStream inputStream = FileLocator.openStream( | ||
244 | Activator.getDefault().getBundle(), new Path(locaPathInPlugin), false); | ||
245 | Path remotePath = new Path(remoteExePath); | ||
246 | |||
247 | //TODO workaround for now | ||
248 | //in case the underlying scp file service doesn't support inputStream upload | ||
249 | BufferedInputStream bis = new BufferedInputStream(inputStream); | ||
250 | File tempFile = File.createTempFile("scp", "temp"); //$NON-NLS-1$ //$NON-NLS-2$ | ||
251 | FileOutputStream os = new FileOutputStream(tempFile); | ||
252 | BufferedOutputStream bos = new BufferedOutputStream(os); | ||
253 | byte[] buffer = new byte[1024]; | ||
254 | int readCount; | ||
255 | while( (readCount = bis.read(buffer)) > 0) | ||
256 | { | ||
257 | bos.write(buffer, 0, readCount); | ||
258 | } | ||
259 | bos.close(); | ||
260 | fileService.upload(tempFile, remotePath.removeLastSegments(1) | ||
261 | .toString(), remotePath.lastSegment(), true, null, null, | ||
262 | new SubProgressMonitor(monitor, 80)); | ||
263 | // Need to change the permissions to match the original file | ||
264 | // permissions because of a bug in upload | ||
265 | remoteShellExec( | ||
266 | connection, | ||
267 | "", "chmod", "+x " + spaceEscapify(remotePath.toString()), new SubProgressMonitor(monitor, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
268 | |||
269 | } finally { | ||
270 | monitor.done(); | ||
271 | } | ||
272 | return; | ||
273 | } | ||
274 | |||
275 | public static void getRemoteFile(IHost connection, String localExePath, String remoteExePath, | ||
276 | IProgressMonitor monitor) throws Exception { | ||
277 | |||
278 | assert(connection!=null); | ||
279 | monitor.beginTask(Messages.InfoDownload, 100); | ||
280 | |||
281 | IFileService fileService; | ||
282 | try { | ||
283 | fileService = getConnectedRemoteFileService( | ||
284 | connection, | ||
285 | new SubProgressMonitor(monitor, 10)); | ||
286 | File file = new File(localExePath); | ||
287 | monitor.worked(5); | ||
288 | Path remotePath = new Path(remoteExePath); | ||
289 | fileService.download(remotePath.removeLastSegments(1).toString(), | ||
290 | remotePath.lastSegment(),file,true, null, | ||
291 | new SubProgressMonitor(monitor, 85)); | ||
292 | // Need to change the permissions to match the original file | ||
293 | // permissions because of a bug in upload | ||
294 | //RemoteApplication p = remoteShellExec( | ||
295 | // config, | ||
296 | // "", "chmod", "+x " + spaceEscapify(remotePath.toString()), new SubProgressMonitor(monitor, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
297 | //Thread.sleep(500); | ||
298 | //p.destroy(); | ||
299 | |||
300 | } finally { | ||
301 | monitor.done(); | ||
302 | } | ||
303 | return; | ||
304 | } | ||
305 | |||
306 | public static ITerminalServiceSubSystem getTerminalSubSystem( | ||
307 | IHost connection) { | ||
308 | ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry(); | ||
309 | ISubSystem[] subsystems = systemRegistry.getSubSystems(connection); | ||
310 | for (int i = 0; i < subsystems.length; i++) { | ||
311 | if (subsystems[i] instanceof ITerminalServiceSubSystem) { | ||
312 | ITerminalServiceSubSystem subSystem = (ITerminalServiceSubSystem) subsystems[i]; | ||
313 | return subSystem; | ||
314 | } | ||
315 | } | ||
316 | return null; | ||
317 | } | ||
318 | |||
319 | public static String spaceEscapify(String inputString) { | ||
320 | if (inputString == null) | ||
321 | return null; | ||
322 | |||
323 | return inputString.replaceAll(" ", "\\\\ "); //$NON-NLS-1$ //$NON-NLS-2$ | ||
324 | } | ||
325 | |||
326 | public static Process remoteShellExec(IHost connection, | ||
327 | String prelaunchCmd, String remoteCommandPath, String arguments, | ||
328 | IProgressMonitor monitor) throws CoreException { | ||
329 | |||
330 | monitor.beginTask(NLS.bind(Messages.RemoteShellExec_1, | ||
331 | remoteCommandPath, arguments), 10); | ||
332 | String realRemoteCommand = arguments == null ? spaceEscapify(remoteCommandPath) | ||
333 | : spaceEscapify(remoteCommandPath) + " " + arguments; //$NON-NLS-1$ | ||
334 | |||
335 | String remoteCommand = realRemoteCommand + CMD_DELIMITER + EXIT_CMD; | ||
336 | |||
337 | if(prelaunchCmd != null) { | ||
338 | if (!prelaunchCmd.trim().equals("")) //$NON-NLS-1$ | ||
339 | remoteCommand = prelaunchCmd + CMD_DELIMITER + remoteCommand; | ||
340 | } | ||
341 | |||
342 | IShellService shellService; | ||
343 | Process p = null; | ||
344 | try { | ||
345 | shellService = (IShellService) getConnectedShellService( | ||
346 | connection, | ||
347 | new SubProgressMonitor(monitor, 7)); | ||
348 | |||
349 | // This is necessary because runCommand does not actually run the | ||
350 | // command right now. | ||
351 | String env[] = new String[0]; | ||
352 | try { | ||
353 | IHostShell hostShell = shellService.launchShell( | ||
354 | "", env, new SubProgressMonitor(monitor, 3)); //$NON-NLS-1$ | ||
355 | hostShell.writeToShell(remoteCommand); | ||
356 | p = new HostShellProcessAdapter(hostShell); | ||
357 | } catch (Exception e) { | ||
358 | if (p != null) { | ||
359 | p.destroy(); | ||
360 | } | ||
361 | abort(Messages.RemoteShellExec_2, e, | ||
362 | IRSECoreStatusCodes.EXCEPTION_OCCURRED); | ||
363 | } | ||
364 | } catch (Exception e1) { | ||
365 | abort(e1.getMessage(), e1, | ||
366 | IRSECoreStatusCodes.EXCEPTION_OCCURRED); | ||
367 | } | ||
368 | |||
369 | monitor.done(); | ||
370 | return p; | ||
371 | } | ||
372 | |||
373 | /** | ||
374 | * Throws a core exception with an error status object built from the given | ||
375 | * message, lower level exception, and error code. | ||
376 | * | ||
377 | * @param message | ||
378 | * the status message | ||
379 | * @param exception | ||
380 | * lower level exception associated with the error, or | ||
381 | * <code>null</code> if none | ||
382 | * @param code | ||
383 | * error code | ||
384 | */ | ||
385 | public static void abort(String message, Throwable exception, int code) throws CoreException { | ||
386 | IStatus status; | ||
387 | if (exception != null) { | ||
388 | MultiStatus multiStatus = new MultiStatus(Activator.PLUGIN_ID, code, message, exception); | ||
389 | multiStatus.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, exception.getLocalizedMessage(), exception)); | ||
390 | status = multiStatus; | ||
391 | } else { | ||
392 | status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, message, null); | ||
393 | } | ||
394 | throw new CoreException(status); | ||
395 | } | ||
396 | /** | ||
397 | * Checks whether a IHost associated system's is enabled and not a local one | ||
398 | * @param host | ||
399 | * @return | ||
400 | */ | ||
401 | public static boolean isHostViable(IHost host) { | ||
402 | IRSESystemType sysType = host.getSystemType(); | ||
403 | if (sysType != null && sysType.isEnabled() && !sysType.isLocal()) | ||
404 | return true; | ||
405 | return false; | ||
406 | } | ||
407 | |||
408 | /** | ||
409 | * Ensures that RSECorePlugin is initialized before performing any actions | ||
410 | */ | ||
411 | public static void waitForRSEInitCompletition() { | ||
412 | if (!RSECorePlugin.isInitComplete(RSECorePlugin.INIT_MODEL)) | ||
413 | try { | ||
414 | RSECorePlugin.waitForInitCompletion(RSECorePlugin.INIT_MODEL); | ||
415 | } catch (InterruptedException e) { | ||
416 | return; | ||
417 | } | ||
418 | } | ||
419 | public static RemoteMachine getRemoteMachine(IHost connection){ | ||
420 | if (!getMachines().containsKey(connection)) | ||
421 | getMachines().put(connection, new RemoteMachine(connection)); | ||
422 | return getMachines().get(connection); | ||
423 | } | ||
424 | |||
425 | private static Map<IHost, RemoteMachine> getMachines() { | ||
426 | if (machines == null) | ||
427 | machines = new HashMap<IHost, RemoteMachine>(); | ||
428 | return machines; | ||
429 | } | ||
430 | |||
431 | public static MessageConsole getConsole(IHost connection) { | ||
432 | return getRemoteMachine(connection).getConsole(); | ||
433 | } | ||
434 | |||
435 | public static CommandResponseHandler getCommandHandler(IHost connection) { | ||
436 | return getRemoteMachine(connection).getCmdHandler(); | ||
437 | } | ||
438 | |||
439 | public static ProcessStreamBuffer processOutput(IProgressMonitor monitor, IHostShell hostShell, CommandResponseHandler cmdHandler) throws Exception { | ||
440 | return new CommandOutputProcessor(monitor, hostShell, cmdHandler, "").processOutput(); | ||
441 | } | ||
442 | |||
443 | public static IHost getRemoteConnectionForURI(URI uri, IProgressMonitor monitor) { | ||
444 | if (uri == null) | ||
445 | return null; | ||
446 | |||
447 | String host = uri.getHost(); | ||
448 | if (host == null) { | ||
449 | // this is a local connection | ||
450 | ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); | ||
451 | IHost local = null; | ||
452 | while (local == null) { | ||
453 | local = sr.getLocalHost(); | ||
454 | } | ||
455 | return local; | ||
456 | } | ||
457 | ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); | ||
458 | IHost[] connections = sr.getHosts(); | ||
459 | |||
460 | IHost unconnected = null; | ||
461 | for (IHost conn : connections) { | ||
462 | if (host.equalsIgnoreCase(conn.getHostName())) { | ||
463 | IRemoteFileSubSystem fss = getRemoteFileSubSystem(conn); | ||
464 | if (fss != null && fss.isConnected()) | ||
465 | return conn; | ||
466 | unconnected = conn; | ||
467 | } | ||
468 | } | ||
469 | |||
470 | return unconnected; | ||
471 | } | ||
472 | |||
473 | public static IRemoteFileSubSystem getRemoteFileSubSystem(IHost host) { | ||
474 | IRemoteFileSubSystem candidate = null; | ||
475 | IRemoteFileSubSystem otherServiceCandidate = null; | ||
476 | IRemoteFileSubSystem[] subSystems = RemoteFileUtility.getFileSubSystems(host); | ||
477 | |||
478 | for (IRemoteFileSubSystem subSystem : subSystems) { | ||
479 | if (subSystem instanceof FileServiceSubSystem) { | ||
480 | if (subSystem.isConnected()) | ||
481 | return subSystem; | ||
482 | |||
483 | if (otherServiceCandidate == null) | ||
484 | otherServiceCandidate = subSystem; | ||
485 | |||
486 | } else if (candidate == null || (subSystem.isConnected() && !candidate.isConnected())) | ||
487 | candidate = subSystem; | ||
488 | |||
489 | } | ||
490 | if (candidate != null && candidate.isConnected()) | ||
491 | return candidate; | ||
492 | if (otherServiceCandidate != null) | ||
493 | return otherServiceCandidate; | ||
494 | return null; | ||
495 | } | ||
496 | |||
497 | public static IFileService getConnectedRemoteFileService(IHost connection, IProgressMonitor monitor) throws Exception { | ||
498 | return getRemoteMachine(connection).getRemoteFileService(monitor); | ||
499 | } | ||
500 | |||
501 | public static IHostFile[] getRemoteDirContent(IHost connection, String remoteParent, String fileFilter, int fileType, IProgressMonitor monitor){ | ||
502 | |||
503 | try { | ||
504 | IFileService fileServ = getConnectedRemoteFileService(connection, monitor); | ||
505 | return fileServ.list(remoteParent, fileFilter, fileType, monitor); | ||
506 | } catch (SystemMessageException e) { | ||
507 | e.printStackTrace(); | ||
508 | } catch (Exception e) { | ||
509 | e.printStackTrace(); | ||
510 | } | ||
511 | return null; | ||
512 | } | ||
513 | |||
514 | public static IService getConnectedShellService(IHost connection, IProgressMonitor monitor) throws Exception { | ||
515 | return getRemoteMachine(connection).getShellService(monitor); | ||
516 | } | ||
517 | |||
518 | public static void handleRunCommandRemote(IHost connection, YoctoCommand cmd, IProgressMonitor monitor){ | ||
519 | try { | ||
520 | CommandRunnable cmdRun = new CommandRunnable(connection, cmd, monitor); | ||
521 | cmdRun.run(); | ||
522 | } catch (Exception e) { | ||
523 | e.printStackTrace(); | ||
524 | } | ||
525 | } | ||
526 | |||
527 | public static IHostShell runCommandRemote(IHost connection, YoctoCommand cmd, | ||
528 | IProgressMonitor monitor) throws CoreException { | ||
529 | |||
530 | monitor.beginTask(NLS.bind(Messages.RemoteShellExec_1, | ||
531 | cmd, cmd.getArguments()), 10); | ||
532 | |||
533 | String remoteCommand = cmd.getCommand() + " " + cmd.getArguments() + " ; echo " + TERMINATOR + "; exit ;"; | ||
534 | |||
535 | IShellService shellService; | ||
536 | try { | ||
537 | shellService = (IShellService) getConnectedShellService(connection, new SubProgressMonitor(monitor, 7)); | ||
538 | |||
539 | String env[] = getRemoteMachine(connection).prepareEnvString(monitor); | ||
540 | |||
541 | try { | ||
542 | IHostShell hostShell = shellService.runCommand(cmd.getInitialDirectory(), remoteCommand, env, new SubProgressMonitor(monitor, 3)); | ||
543 | return hostShell; | ||
544 | } catch (Exception e) { | ||
545 | e.printStackTrace(); | ||
546 | } | ||
547 | } catch (Exception e1) { | ||
548 | e1.printStackTrace(); | ||
549 | } | ||
550 | return null; | ||
551 | } | ||
552 | |||
553 | public static IHostFile getRemoteHostFile(IHost connection, String remoteFilePath, IProgressMonitor monitor){ | ||
554 | assert(connection != null); | ||
555 | monitor.beginTask(Messages.InfoDownload, 100); | ||
556 | |||
557 | try { | ||
558 | IFileService fileService = getConnectedRemoteFileService(connection, new SubProgressMonitor(monitor, 10)); | ||
559 | Path remotePath = new Path(remoteFilePath); | ||
560 | IHostFile remoteFile = fileService.getFile(remotePath.removeLastSegments(1).toString(), remotePath.lastSegment(), new SubProgressMonitor(monitor, 5)); | ||
561 | return remoteFile; | ||
562 | } catch (Exception e) { | ||
563 | e.printStackTrace(); | ||
564 | }finally { | ||
565 | monitor.done(); | ||
566 | } | ||
567 | return null; | ||
568 | } | ||
569 | |||
570 | public static InputStream getRemoteInputStream(IHost connection, String parentPath, String remoteFilePath, IProgressMonitor monitor){ | ||
571 | assert(connection != null); | ||
572 | monitor.beginTask(Messages.InfoDownload, 100); | ||
573 | |||
574 | try { | ||
575 | IFileService fileService = getConnectedRemoteFileService(connection, new SubProgressMonitor(monitor, 10)); | ||
576 | |||
577 | return fileService.getInputStream(parentPath, remoteFilePath, false, monitor); | ||
578 | } catch (Exception e) { | ||
579 | e.printStackTrace(); | ||
580 | }finally { | ||
581 | monitor.done(); | ||
582 | } | ||
583 | return null; | ||
584 | } | ||
585 | |||
586 | public static URI createNewURI(URI oldURI, String name) { | ||
587 | try { | ||
588 | String sep = oldURI.getPath().endsWith("/") ? "" : "/"; | ||
589 | return new URI(oldURI.getScheme(), oldURI.getHost(), oldURI.getPath() + sep + name, oldURI.getFragment()); | ||
590 | } catch (URISyntaxException e) { | ||
591 | e.printStackTrace(); | ||
592 | return null; | ||
593 | } | ||
594 | } | ||
595 | |||
596 | public static boolean fileExistsRemote(IHost conn, IProgressMonitor monitor, String path) { | ||
597 | try { | ||
598 | IFileService fs = getConnectedRemoteFileService(conn, monitor); | ||
599 | int nameStart = path.lastIndexOf("/"); | ||
600 | String parentPath = path.substring(0, nameStart); | ||
601 | String name = path.substring(nameStart + 1); | ||
602 | IHostFile hostFile = fs.getFile(parentPath, name, monitor); | ||
603 | |||
604 | return hostFile.exists(); | ||
605 | } catch (Exception e) { | ||
606 | e.printStackTrace(); | ||
607 | } | ||
608 | return false; | ||
609 | } | ||
610 | |||
611 | public static IHost createLocalConnection() { | ||
612 | IHost createdHost = null; | ||
613 | try { | ||
614 | |||
615 | ISubSystemConfigurator[] configurators = getSubSystemConfigurators(); | ||
616 | |||
617 | IRSESystemType systemType = getSSHSystemType(); | ||
618 | ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); | ||
619 | IHost[] connections = sr.getHosts(); | ||
620 | for (IHost conn : connections) { | ||
621 | if (conn.getName().equals(LOCAL_CONN_NAME)) { | ||
622 | ISystemHostPool pool = conn.getHostPool(); | ||
623 | createdHost = sr.createHost(pool.getSystemProfile().getName(), systemType, CONNECTION_NAME, HOST_NAME, "", "",IRSEUserIdConstants.USERID_LOCATION_NOTSET,configurators); | ||
624 | break; | ||
625 | } | ||
626 | } | ||
627 | |||
628 | // a tweak that is the result of UCD feedback. Phil | ||
629 | if ((createdHost != null) && SystemPerspectiveHelpers.isRSEPerspectiveActive()) { | ||
630 | if (systemType.getId().equals(IRSESystemType.SYSTEMTYPE_ISERIES_ID)) { | ||
631 | ISubSystem[] objSubSystems = sr.getSubSystemsBySubSystemConfigurationCategory("nativefiles", createdHost); //$NON-NLS-1$ | ||
632 | if ((objSubSystems != null) && (objSubSystems.length > 0))// might be in product that doesn't have iSeries plugins | ||
633 | RSEUIPlugin.getTheSystemRegistryUI().expandSubSystem(objSubSystems[0]); | ||
634 | else | ||
635 | RSEUIPlugin.getTheSystemRegistryUI().expandHost(createdHost); | ||
636 | } else | ||
637 | RSEUIPlugin.getTheSystemRegistryUI().expandHost(createdHost); | ||
638 | } | ||
639 | } catch (Exception exc) { | ||
640 | exc.printStackTrace(); | ||
641 | } | ||
642 | return createdHost; | ||
643 | } | ||
644 | |||
645 | private static IRSESystemType getSSHSystemType() { | ||
646 | IRSECoreRegistry coreReg = RSECorePlugin.getTheCoreRegistry(); | ||
647 | return coreReg.getSystemTypeById("org.eclipse.rse.systemtype.ssh"); | ||
648 | } | ||
649 | |||
650 | private static ISubSystemConfigurator[] getSubSystemConfigurators() | ||
651 | { | ||
652 | // what kind of subsystems do we have here? | ||
653 | ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); | ||
654 | ISubSystemConfiguration[] configurations = sr.getSubSystemConfigurationsBySystemType(getSSHSystemType(), true); | ||
655 | |||
656 | ArrayList configList = new ArrayList(); | ||
657 | for (int i = 0; i < configurations.length; i++){ | ||
658 | ISubSystemConfiguration configuration = configurations[i]; | ||
659 | |||
660 | class DefaultConfigurator implements ISubSystemConfigurator { | ||
661 | private ISubSystemConfiguration _configuration; | ||
662 | public DefaultConfigurator(ISubSystemConfiguration configuration){ | ||
663 | _configuration = configuration; | ||
664 | } | ||
665 | |||
666 | public boolean applyValues(ISubSystem ss) { | ||
667 | return true; | ||
668 | } | ||
669 | |||
670 | public ISubSystemConfiguration getSubSystemConfiguration() { | ||
671 | return _configuration; | ||
672 | } | ||
673 | } | ||
674 | configList.add(new DefaultConfigurator(configuration)); | ||
675 | } | ||
676 | |||
677 | return (ISubSystemConfigurator[])configList.toArray(new ISubSystemConfigurator[configList.size()]); | ||
678 | |||
679 | } | ||
680 | } | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteMachine.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteMachine.java new file mode 100644 index 0000000..92cfc15 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteMachine.java | |||
@@ -0,0 +1,202 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ioana Grigoropol(Intel) - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | import java.util.ArrayList; | ||
14 | import java.util.HashMap; | ||
15 | import java.util.List; | ||
16 | import java.util.Map; | ||
17 | |||
18 | import org.eclipse.core.runtime.CoreException; | ||
19 | import org.eclipse.core.runtime.IProgressMonitor; | ||
20 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
21 | import org.eclipse.core.runtime.OperationCanceledException; | ||
22 | import org.eclipse.core.runtime.Status; | ||
23 | import org.eclipse.core.runtime.SubProgressMonitor; | ||
24 | import org.eclipse.rse.core.model.IHost; | ||
25 | import org.eclipse.rse.core.subsystems.ISubSystem; | ||
26 | import org.eclipse.rse.internal.services.local.shells.LocalShellService; | ||
27 | import org.eclipse.rse.services.clientserver.messages.SystemMessageException; | ||
28 | import org.eclipse.rse.services.files.IFileService; | ||
29 | import org.eclipse.rse.services.shells.IHostShell; | ||
30 | import org.eclipse.rse.services.shells.IShellService; | ||
31 | import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; | ||
32 | import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; | ||
33 | import org.eclipse.ui.console.MessageConsole; | ||
34 | |||
35 | public class RemoteMachine { | ||
36 | public static final String PROXY = "proxy"; | ||
37 | |||
38 | private Map<String, String> environment; | ||
39 | private MessageConsole console; | ||
40 | private CommandResponseHandler cmdHandler; | ||
41 | private IShellService shellService; | ||
42 | private IHost connection; | ||
43 | |||
44 | private ISubSystem fileSubSystem; | ||
45 | private IFileService fileService; | ||
46 | |||
47 | public RemoteMachine(IHost connection) { | ||
48 | setConnection(connection); | ||
49 | } | ||
50 | |||
51 | public String[] prepareEnvString(IProgressMonitor monitor){ | ||
52 | String[] env = null; | ||
53 | try { | ||
54 | if (shellService instanceof LocalShellService) { | ||
55 | env = shellService.getHostEnvironment(); | ||
56 | } else { | ||
57 | List<String> envList = new ArrayList<String>(); | ||
58 | getRemoteEnvProxyVars(monitor); | ||
59 | String value = ""; | ||
60 | for (String varName : environment.keySet()){ | ||
61 | value = varName + "=" + environment.get(varName); | ||
62 | envList.add(value); | ||
63 | } | ||
64 | env = envList.toArray(new String[envList.size()]); | ||
65 | } | ||
66 | } catch (Exception e) { | ||
67 | e.printStackTrace(); | ||
68 | } | ||
69 | |||
70 | return env; | ||
71 | } | ||
72 | public void getRemoteEnvProxyVars(IProgressMonitor monitor){ | ||
73 | try { | ||
74 | if (environment != null && !environment.isEmpty()) | ||
75 | return; | ||
76 | |||
77 | environment = new HashMap<String, String>(); | ||
78 | |||
79 | IShellService shellService = getShellService(new SubProgressMonitor(monitor, 7)); | ||
80 | |||
81 | ProcessStreamBuffer buffer = null; | ||
82 | try { | ||
83 | SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 3); | ||
84 | IHostShell hostShell = shellService.runCommand("", "env" + " ; echo " + RemoteHelper.TERMINATOR + "; exit;", new String[]{}, subMonitor); | ||
85 | buffer = RemoteHelper.processOutput(subMonitor, hostShell, cmdHandler); | ||
86 | for(int i = 0; i < buffer.getOutputLines().size(); i++) { | ||
87 | String out = buffer.getOutputLines().get(i); | ||
88 | String[] tokens = out.split("="); | ||
89 | if (tokens.length != 2) | ||
90 | continue; | ||
91 | String varName = tokens[0]; | ||
92 | String varValue = tokens[1]; | ||
93 | if (varName.contains(PROXY)) | ||
94 | environment.put(varName, varValue); | ||
95 | } | ||
96 | } catch (Exception e) { | ||
97 | e.printStackTrace(); | ||
98 | } | ||
99 | |||
100 | } catch (Exception e) { | ||
101 | e.printStackTrace(); | ||
102 | } | ||
103 | } | ||
104 | |||
105 | public Map<String, String> getEnvironment() { | ||
106 | return environment; | ||
107 | } | ||
108 | public void setEnvironment(Map<String, String> environment) { | ||
109 | this.environment = environment; | ||
110 | } | ||
111 | public MessageConsole getConsole() { | ||
112 | if (console == null) | ||
113 | console = ConsoleHelper.findConsole(ConsoleHelper.YOCTO_CONSOLE); | ||
114 | |||
115 | ConsoleHelper.showConsole(console); | ||
116 | return console; | ||
117 | } | ||
118 | public CommandResponseHandler getCmdHandler() { | ||
119 | if (cmdHandler == null) | ||
120 | cmdHandler = new CommandResponseHandler(getConsole()); | ||
121 | return cmdHandler; | ||
122 | } | ||
123 | |||
124 | public IShellService getShellService(IProgressMonitor monitor) throws Exception { | ||
125 | if (shellService != null) | ||
126 | return shellService; | ||
127 | |||
128 | final ISubSystem subsystem = getShellSubsystem(); | ||
129 | |||
130 | if (subsystem == null) | ||
131 | throw new Exception(Messages.ErrorNoSubsystem); | ||
132 | |||
133 | try { | ||
134 | subsystem.connect(monitor, false); | ||
135 | } catch (CoreException e) { | ||
136 | throw e; | ||
137 | } catch (OperationCanceledException e) { | ||
138 | throw new CoreException(Status.CANCEL_STATUS); | ||
139 | } | ||
140 | |||
141 | if (!subsystem.isConnected()) | ||
142 | throw new Exception(Messages.ErrorConnectSubsystem); | ||
143 | |||
144 | shellService = ((IShellServiceSubSystem) subsystem).getShellService(); | ||
145 | return shellService; | ||
146 | } | ||
147 | |||
148 | private ISubSystem getShellSubsystem() { | ||
149 | if (connection == null) | ||
150 | return null; | ||
151 | ISubSystem[] subSystems = connection.getSubSystems(); | ||
152 | for (int i = 0; i < subSystems.length; i++) { | ||
153 | if (subSystems[i] instanceof IShellServiceSubSystem) | ||
154 | return subSystems[i]; | ||
155 | } | ||
156 | return null; | ||
157 | } | ||
158 | |||
159 | public IHost getConnection() { | ||
160 | return connection; | ||
161 | } | ||
162 | public void setConnection(IHost connection) { | ||
163 | this.connection = connection; | ||
164 | } | ||
165 | |||
166 | public IFileService getRemoteFileService(IProgressMonitor monitor) throws Exception { | ||
167 | if (fileService == null) { | ||
168 | |||
169 | while(getFileSubsystem() == null) | ||
170 | Thread.sleep(2); | ||
171 | try { | ||
172 | getFileSubsystem().connect(monitor, false); | ||
173 | } catch (CoreException e) { | ||
174 | throw e; | ||
175 | } catch (OperationCanceledException e) { | ||
176 | throw new CoreException(Status.CANCEL_STATUS); | ||
177 | } | ||
178 | |||
179 | if (!getFileSubsystem().isConnected()) | ||
180 | throw new Exception(Messages.ErrorConnectSubsystem); | ||
181 | |||
182 | fileService = ((IFileServiceSubSystem) getFileSubsystem()).getFileService(); | ||
183 | } | ||
184 | return fileService; | ||
185 | } | ||
186 | |||
187 | public ISubSystem getFileSubsystem() { | ||
188 | if (fileSubSystem == null) { | ||
189 | if (connection == null) | ||
190 | return null; | ||
191 | ISubSystem[] subSystems = connection.getSubSystems(); | ||
192 | for (int i = 0; i < subSystems.length; i++) { | ||
193 | if (subSystems[i] instanceof IFileServiceSubSystem) { | ||
194 | fileSubSystem = subSystems[i]; | ||
195 | break; | ||
196 | } | ||
197 | } | ||
198 | } | ||
199 | return fileSubSystem; | ||
200 | } | ||
201 | |||
202 | } | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteShellExec.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteShellExec.java new file mode 100644 index 0000000..711088c --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteShellExec.java | |||
@@ -0,0 +1,140 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | import java.io.BufferedReader; | ||
14 | import java.io.IOException; | ||
15 | import java.io.InputStream; | ||
16 | import java.io.InputStreamReader; | ||
17 | import java.io.OutputStream; | ||
18 | |||
19 | import org.eclipse.core.runtime.IProgressMonitor; | ||
20 | import org.eclipse.rse.core.model.IHost; | ||
21 | |||
22 | public class RemoteShellExec { | ||
23 | |||
24 | public static final int | ||
25 | STATE_NULL = 0, | ||
26 | STATE_RUNNING = 1, | ||
27 | STATE_EXITED = 2; | ||
28 | |||
29 | private final String command; | ||
30 | private final IHost host; | ||
31 | |||
32 | private InputStream fInStream; | ||
33 | private OutputStream fOutStream; | ||
34 | private InputStream fErrStream; | ||
35 | private Process remoteShellProcess; | ||
36 | |||
37 | private int exitCode = 0; | ||
38 | private int status = STATE_NULL; | ||
39 | |||
40 | private final String RETURN_VALUE_TAG = "org.yocto.sdk.remotetools.RVTAG"; | ||
41 | private final String RETURN_VALUE_CMD = ";echo \"" + RETURN_VALUE_TAG + "$?\""; | ||
42 | |||
43 | public RemoteShellExec(IHost host, String command) { | ||
44 | assert(host != null); | ||
45 | this.host = host; | ||
46 | this.command = command; | ||
47 | } | ||
48 | |||
49 | public int getStatus() { | ||
50 | return status; | ||
51 | } | ||
52 | |||
53 | public int getExitCode() { | ||
54 | return exitCode; | ||
55 | } | ||
56 | |||
57 | private void reset() { | ||
58 | fInStream = null; | ||
59 | fOutStream = null; | ||
60 | fErrStream = null; | ||
61 | |||
62 | remoteShellProcess = null; | ||
63 | exitCode = 0; | ||
64 | status = STATE_NULL; | ||
65 | } | ||
66 | |||
67 | public InputStream getInputStream() { | ||
68 | return fInStream; | ||
69 | } | ||
70 | |||
71 | public OutputStream getOutputStream() { | ||
72 | return fOutStream; | ||
73 | } | ||
74 | |||
75 | public InputStream getErrStream() { | ||
76 | return fErrStream; | ||
77 | } | ||
78 | |||
79 | public synchronized void start(String prelaunchCmd, String argument, IProgressMonitor monitor) throws Exception { | ||
80 | if(status == STATE_RUNNING) | ||
81 | return; | ||
82 | |||
83 | reset(); | ||
84 | argument = (argument == null ? RETURN_VALUE_CMD : argument + RETURN_VALUE_CMD); | ||
85 | remoteShellProcess = RemoteHelper.remoteShellExec(this.host, prelaunchCmd, this.command, argument, monitor); | ||
86 | fInStream = remoteShellProcess.getInputStream(); | ||
87 | fOutStream = remoteShellProcess.getOutputStream(); | ||
88 | fErrStream = remoteShellProcess.getErrorStream(); | ||
89 | status = STATE_RUNNING; | ||
90 | } | ||
91 | |||
92 | public synchronized void terminate() throws Exception { | ||
93 | if(status != STATE_RUNNING || remoteShellProcess != null) | ||
94 | return; | ||
95 | |||
96 | remoteShellProcess.destroy(); | ||
97 | reset(); | ||
98 | } | ||
99 | |||
100 | public int waitFor(IProgressMonitor monitor) throws InterruptedException { | ||
101 | while(status == STATE_RUNNING) { | ||
102 | if(monitor != null) { | ||
103 | if(monitor.isCanceled()) { | ||
104 | throw new InterruptedException("User Cancelled"); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | try { | ||
109 | remoteShellProcess.waitFor(); | ||
110 | }catch(InterruptedException e){ | ||
111 | //get the return value | ||
112 | try { | ||
113 | if(fInStream.available() != 0) { | ||
114 | BufferedReader in = new BufferedReader(new InputStreamReader(fInStream)); | ||
115 | String thisline; | ||
116 | int idx; | ||
117 | while((thisline = in.readLine()) != null) { | ||
118 | if(thisline.indexOf(RETURN_VALUE_CMD) == -1) { | ||
119 | idx = thisline.indexOf(RETURN_VALUE_TAG); | ||
120 | if(idx != -1) { | ||
121 | try { | ||
122 | exitCode=(new Integer(thisline.substring(idx+RETURN_VALUE_TAG.length()))).intValue(); | ||
123 | }catch(NumberFormatException e2) { | ||
124 | } | ||
125 | break; | ||
126 | } | ||
127 | } | ||
128 | } | ||
129 | } | ||
130 | }catch(IOException e1) { | ||
131 | //do nothing | ||
132 | } | ||
133 | }finally { | ||
134 | status=STATE_EXITED; | ||
135 | } | ||
136 | } | ||
137 | return exitCode; | ||
138 | } | ||
139 | } | ||
140 | |||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ShellSession.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ShellSession.java new file mode 100644 index 0000000..0922824 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ShellSession.java | |||
@@ -0,0 +1,332 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright (c) 2013 Ken Gilmer | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ken Gilmer - initial API and implementation | ||
10 | * Jessica Zhang - Adopt for Yocto Tools plugin | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.remote.utils; | ||
13 | |||
14 | import java.io.BufferedReader; | ||
15 | import java.io.File; | ||
16 | import java.io.IOException; | ||
17 | import java.io.InputStream; | ||
18 | import java.io.InputStreamReader; | ||
19 | import java.io.OutputStream; | ||
20 | import java.io.OutputStreamWriter; | ||
21 | import java.lang.reflect.InvocationTargetException; | ||
22 | import java.util.regex.Matcher; | ||
23 | import java.util.regex.Pattern; | ||
24 | |||
25 | import org.eclipse.swt.widgets.Display; | ||
26 | |||
27 | public class ShellSession { | ||
28 | /** | ||
29 | * Bash shell | ||
30 | */ | ||
31 | public static final int SHELL_TYPE_BASH = 1; | ||
32 | /** | ||
33 | * sh shell | ||
34 | */ | ||
35 | public static final int SHELL_TYPE_SH = 2; | ||
36 | private volatile boolean interrupt = false; | ||
37 | /** | ||
38 | * String used to isolate command execution | ||
39 | */ | ||
40 | public static final String TERMINATOR = "build$"; | ||
41 | public static final String LT = System.getProperty("line.separator"); | ||
42 | private Process process; | ||
43 | |||
44 | private OutputStream pos = null; | ||
45 | |||
46 | private String shellPath = null; | ||
47 | private final String initCmd; | ||
48 | private final File root; | ||
49 | private final File builddir; | ||
50 | |||
51 | private OutputStreamWriter out; | ||
52 | |||
53 | public static String getFilePath(String file) throws IOException { | ||
54 | File f = new File(file); | ||
55 | |||
56 | if (!f.exists() || f.isDirectory()) { | ||
57 | throw new IOException("Path passed is not a file: " + file); | ||
58 | } | ||
59 | |||
60 | StringBuffer sb = new StringBuffer(); | ||
61 | |||
62 | String elems[] = file.split(File.separator); | ||
63 | |||
64 | for (int i = 0; i < elems.length - 1; ++i) { | ||
65 | sb.append(elems[i]); | ||
66 | sb.append(File.separator); | ||
67 | } | ||
68 | |||
69 | return sb.toString(); | ||
70 | } | ||
71 | |||
72 | public ShellSession(int shellType, File root, File builddir, String initCmd, OutputStream out) throws IOException { | ||
73 | this.root = root; | ||
74 | this.builddir = builddir; | ||
75 | this.initCmd = initCmd; | ||
76 | if (out == null) { | ||
77 | this.out = new OutputStreamWriter(null); | ||
78 | } else { | ||
79 | this.out = new OutputStreamWriter(out); | ||
80 | } | ||
81 | if (shellType == SHELL_TYPE_SH) { | ||
82 | shellPath = "/bin/sh"; | ||
83 | } | ||
84 | shellPath = "/bin/bash"; | ||
85 | |||
86 | initializeShell(); | ||
87 | } | ||
88 | |||
89 | private void initializeShell() throws IOException { | ||
90 | process = Runtime.getRuntime().exec(shellPath); | ||
91 | pos = process.getOutputStream(); | ||
92 | |||
93 | if (root != null) { | ||
94 | execute("cd " + root.getAbsolutePath()); | ||
95 | } | ||
96 | |||
97 | if (initCmd != null) { | ||
98 | execute("source " + initCmd + " " + builddir.getAbsolutePath()); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | synchronized | ||
103 | public String execute(String command, int[] retCode) throws IOException { | ||
104 | String errorMessage = null; | ||
105 | |||
106 | interrupt = false; | ||
107 | out.write(command); | ||
108 | out.write(LT); | ||
109 | |||
110 | sendToProcessAndTerminate(command); | ||
111 | |||
112 | if (process.getErrorStream().available() > 0) { | ||
113 | byte[] msg = new byte[process.getErrorStream().available()]; | ||
114 | |||
115 | process.getErrorStream().read(msg, 0, msg.length); | ||
116 | String msg_str = new String(msg); | ||
117 | out.write(msg_str); | ||
118 | out.write(LT); | ||
119 | if (!msg_str.contains("WARNING")) | ||
120 | errorMessage = "Error while executing: " + command + LT + new String(msg); | ||
121 | } | ||
122 | |||
123 | BufferedReader br = new BufferedReader(new InputStreamReader(process | ||
124 | .getInputStream())); | ||
125 | |||
126 | StringBuffer sb = new StringBuffer(); | ||
127 | String line = null; | ||
128 | |||
129 | while (true) { | ||
130 | line = br.readLine(); | ||
131 | if (line != null) { | ||
132 | sb.append(line); | ||
133 | sb.append(LT); | ||
134 | out.write(line); | ||
135 | out.write(LT); | ||
136 | } | ||
137 | if (line.endsWith(TERMINATOR)) | ||
138 | break; | ||
139 | } | ||
140 | if (interrupt) { | ||
141 | process.destroy(); | ||
142 | initializeShell(); | ||
143 | interrupt = false; | ||
144 | }else if (line != null && retCode != null) { | ||
145 | try { | ||
146 | retCode[0]=Integer.parseInt(line.substring(0,line.lastIndexOf(TERMINATOR))); | ||
147 | }catch (NumberFormatException e) { | ||
148 | throw new IOException("Can NOT get return code" + command + LT + line); | ||
149 | } | ||
150 | } | ||
151 | out.flush(); | ||
152 | if (errorMessage != null) { | ||
153 | throw new IOException(errorMessage); | ||
154 | } | ||
155 | return sb.toString(); | ||
156 | } | ||
157 | |||
158 | synchronized | ||
159 | public void execute(String command) throws IOException { | ||
160 | interrupt = false; | ||
161 | String errorMessage = null; | ||
162 | |||
163 | sendToProcessAndTerminate(command); | ||
164 | boolean cancel = false; | ||
165 | try { | ||
166 | InputStream is = process.getInputStream(); | ||
167 | InputStream es = process.getErrorStream(); | ||
168 | String info; | ||
169 | while (!cancel) { | ||
170 | info = null; | ||
171 | StringBuffer buffer = new StringBuffer(); | ||
172 | int c; | ||
173 | while (is.available() > 0) { | ||
174 | c = is.read(); | ||
175 | char ch = (char) c; | ||
176 | buffer.append(ch); | ||
177 | if (ch == '\n') { | ||
178 | info = buffer.toString(); | ||
179 | if (!info.trim().endsWith(TERMINATOR)) { | ||
180 | out.write(info); | ||
181 | out.write(LT); | ||
182 | buffer.delete(0, buffer.length()); | ||
183 | } else { | ||
184 | cancel = true; | ||
185 | break; | ||
186 | } | ||
187 | } | ||
188 | } | ||
189 | while (es.available() > 0) { | ||
190 | c = es.read(); | ||
191 | char ch = (char) c; | ||
192 | buffer.append(ch); | ||
193 | if (ch == '\n') { | ||
194 | info = buffer.toString(); | ||
195 | if (!info.contains("WARNING")) | ||
196 | errorMessage += info; | ||
197 | out.write(info); | ||
198 | out.write(LT); | ||
199 | buffer.delete(0, buffer.length()); | ||
200 | } | ||
201 | } | ||
202 | } | ||
203 | } catch (IOException e) { | ||
204 | try { | ||
205 | throw new InvocationTargetException(e); | ||
206 | } catch (InvocationTargetException e1) { | ||
207 | e1.printStackTrace(); | ||
208 | } | ||
209 | } | ||
210 | out.flush(); | ||
211 | if (errorMessage != null) { | ||
212 | throw new IOException(errorMessage); | ||
213 | } | ||
214 | if (interrupt) { | ||
215 | process.destroy(); | ||
216 | initializeShell(); | ||
217 | interrupt = false; | ||
218 | } | ||
219 | } | ||
220 | synchronized | ||
221 | public boolean ensureKnownHostKey(String user, String host) throws IOException { | ||
222 | |||
223 | boolean loadKeysMatch = false; | ||
224 | boolean accepted = false; | ||
225 | Process proc = Runtime.getRuntime().exec("ssh -o LogLevel=DEBUG3 " + user + "@" + host); | ||
226 | Pattern patternLoad = Pattern.compile("^debug3: load_hostkeys: loaded (\\d+) keys"); | ||
227 | Pattern patternAuthSucceeded = Pattern.compile("^debug1: Authentication succeeded.*"); | ||
228 | |||
229 | try { | ||
230 | InputStream es = proc.getErrorStream(); | ||
231 | String info; | ||
232 | while (!loadKeysMatch) { | ||
233 | info = null; | ||
234 | StringBuffer buffer = new StringBuffer(); | ||
235 | int c; | ||
236 | while (es.available() > 0) { | ||
237 | c = es.read(); | ||
238 | char ch = (char) c; | ||
239 | buffer.append(ch); | ||
240 | if (ch == '\r') { | ||
241 | info = buffer.toString().trim(); | ||
242 | Matcher m = patternLoad.matcher(info); | ||
243 | if(m.matches()) { | ||
244 | int keys = new Integer(m.group(1)); | ||
245 | if (keys == 0) { | ||
246 | proc.destroy(); | ||
247 | DialogRunnable runnable = new DialogRunnable("Host authenticity", "The authenticity of host '" + host + "(" + host + ")' can't be established.\nAre you sure you want to continue connecting ?", DialogRunnable.QUESTION); | ||
248 | Display.getDefault().syncExec(runnable); | ||
249 | accepted = runnable.result; | ||
250 | if (accepted){ | ||
251 | proc = Runtime.getRuntime().exec("ssh -o StrictHostKeyChecking=no " + user + "@" + host);//add host key to known_hosts | ||
252 | try { | ||
253 | Thread.sleep(2000); //wait for process to finish | ||
254 | } catch (InterruptedException e) { | ||
255 | e.printStackTrace(); | ||
256 | } | ||
257 | proc.destroy(); | ||
258 | } else { | ||
259 | Display.getDefault().syncExec( new DialogRunnable("Host authenticity", "Host key verification failed.", DialogRunnable.ERROR)); | ||
260 | } | ||
261 | } else { | ||
262 | String errorMsg = ""; | ||
263 | // wait to check if key is the same and authentication succeeds | ||
264 | while (es.available() > 0) { | ||
265 | c = es.read(); | ||
266 | ch = (char) c; | ||
267 | buffer.append(ch); | ||
268 | if (ch == '\r') { | ||
269 | info = buffer.toString().trim(); | ||
270 | Matcher mAuthS = patternAuthSucceeded.matcher(info); | ||
271 | if(mAuthS.matches()) { | ||
272 | accepted = true; | ||
273 | break; | ||
274 | } else { | ||
275 | if (!info.startsWith("debug")) | ||
276 | errorMsg += info + "\n"; | ||
277 | } | ||
278 | try { | ||
279 | Thread.sleep(100); | ||
280 | } catch (InterruptedException e) { | ||
281 | // TODO Auto-generated catch block | ||
282 | e.printStackTrace(); | ||
283 | } | ||
284 | buffer.delete(0, buffer.length()); | ||
285 | } | ||
286 | } | ||
287 | if (!accepted && !errorMsg.isEmpty()) { | ||
288 | Display.getDefault().syncExec( new DialogRunnable("Host authenticity", errorMsg, DialogRunnable.ERROR)); | ||
289 | } | ||
290 | } | ||
291 | loadKeysMatch = true; | ||
292 | break; | ||
293 | } | ||
294 | buffer.delete(0, buffer.length()); | ||
295 | } | ||
296 | } | ||
297 | } | ||
298 | es.close(); | ||
299 | } catch (IOException e) { | ||
300 | try { | ||
301 | throw new InvocationTargetException(e); | ||
302 | } catch (InvocationTargetException e1) { | ||
303 | e1.printStackTrace(); | ||
304 | } | ||
305 | } | ||
306 | return accepted; | ||
307 | } | ||
308 | |||
309 | /** | ||
310 | * Send command string to shell process and add special terminator string so | ||
311 | * reader knows when output is complete. | ||
312 | * | ||
313 | * @param command | ||
314 | * @throws IOException | ||
315 | */ | ||
316 | private void sendToProcessAndTerminate(String command) throws IOException { | ||
317 | pos.write(command.getBytes()); | ||
318 | pos.write(LT.getBytes()); | ||
319 | pos.flush(); | ||
320 | pos.write("echo $?".getBytes()); | ||
321 | pos.write(TERMINATOR.getBytes()); | ||
322 | pos.write(LT.getBytes()); | ||
323 | pos.flush(); | ||
324 | } | ||
325 | |||
326 | /** | ||
327 | * Interrupt any running processes. | ||
328 | */ | ||
329 | public void interrupt() { | ||
330 | interrupt = true; | ||
331 | } | ||
332 | } | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/TerminalHandler.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/TerminalHandler.java new file mode 100644 index 0000000..af5a5da --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/TerminalHandler.java | |||
@@ -0,0 +1,132 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | import org.eclipse.core.commands.AbstractHandler; | ||
14 | import org.eclipse.core.commands.ExecutionException; | ||
15 | import org.eclipse.core.runtime.IProgressMonitor; | ||
16 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
17 | import org.eclipse.core.runtime.OperationCanceledException; | ||
18 | import org.eclipse.jface.dialogs.ProgressMonitorDialog; | ||
19 | import org.eclipse.jface.operation.IRunnableWithProgress; | ||
20 | import org.eclipse.rse.core.model.IHost; | ||
21 | import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper; | ||
22 | import org.eclipse.rse.internal.terminals.ui.views.RSETerminalConnector; | ||
23 | import org.eclipse.rse.internal.terminals.ui.views.TerminalViewTab; | ||
24 | import org.eclipse.rse.internal.terminals.ui.views.TerminalViewer; | ||
25 | import org.eclipse.rse.internal.terminals.ui.views.TerminalsUI; | ||
26 | import org.eclipse.rse.services.terminals.ITerminalShell; | ||
27 | import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem; | ||
28 | import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement; | ||
29 | import org.eclipse.rse.ui.SystemBasePlugin; | ||
30 | import org.eclipse.swt.custom.CTabItem; | ||
31 | import org.eclipse.swt.events.DisposeEvent; | ||
32 | import org.eclipse.swt.events.DisposeListener; | ||
33 | import org.eclipse.swt.widgets.Shell; | ||
34 | import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; | ||
35 | import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; | ||
36 | |||
37 | abstract public class TerminalHandler extends AbstractHandler { | ||
38 | |||
39 | |||
40 | protected Shell shell; | ||
41 | |||
42 | protected String changeTerm = "export TERM=vt100;"; | ||
43 | |||
44 | abstract protected String getInitCmd(); | ||
45 | abstract protected String getConnnectionName(); | ||
46 | abstract protected String getDialogTitle(); | ||
47 | |||
48 | protected String changeTerm() { | ||
49 | return changeTerm; | ||
50 | } | ||
51 | |||
52 | protected ITerminalShell getTerminalShellFromTab(CTabItem item) { | ||
53 | ITerminalShell terminalShell = null; | ||
54 | ITerminalViewControl terminalViewControl = (ITerminalViewControl) item | ||
55 | .getData(TerminalViewTab.DATA_KEY_CONTROL); | ||
56 | ITerminalConnector terminalConnector = terminalViewControl | ||
57 | .getTerminalConnector(); | ||
58 | if (terminalConnector instanceof RSETerminalConnector) { | ||
59 | RSETerminalConnector rseTerminalConnector = (RSETerminalConnector) terminalConnector; | ||
60 | terminalShell = rseTerminalConnector.getTerminalHostShell(); | ||
61 | } | ||
62 | return terminalShell; | ||
63 | } | ||
64 | |||
65 | protected boolean preProcess(final ITerminalServiceSubSystem terminalSubSystem) { | ||
66 | if (!terminalSubSystem.isConnected()) { | ||
67 | try { | ||
68 | ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell); | ||
69 | dialog.run(true, true, new IRunnableWithProgress(){ | ||
70 | @Override | ||
71 | public void run(IProgressMonitor monitor) { | ||
72 | monitor.beginTask("Connecting to remote target ...", 100); | ||
73 | try { | ||
74 | terminalSubSystem.connect(new NullProgressMonitor(), false); | ||
75 | monitor.done(); | ||
76 | } catch (Exception e) { | ||
77 | CommonHelper.showErrorDialog("Connection failure", null, e.getMessage()); | ||
78 | monitor.done(); | ||
79 | |||
80 | } | ||
81 | } | ||
82 | }); | ||
83 | } catch (OperationCanceledException e) { | ||
84 | // user canceled, return silently | ||
85 | return false; | ||
86 | } catch (Exception e) { | ||
87 | SystemBasePlugin.logError(e.getLocalizedMessage(), e); | ||
88 | return false; | ||
89 | } | ||
90 | } else | ||
91 | return true; | ||
92 | return false; | ||
93 | } | ||
94 | |||
95 | public void execute(IHost host) throws ExecutionException { | ||
96 | |||
97 | final ITerminalServiceSubSystem terminalSubSystem = RemoteHelper.getTerminalSubSystem(host); | ||
98 | |||
99 | if (terminalSubSystem != null) { | ||
100 | TerminalsUI terminalsUI = TerminalsUI.getInstance(); | ||
101 | TerminalViewer viewer = terminalsUI.activateTerminalsView(); | ||
102 | if (preProcess(terminalSubSystem)) { | ||
103 | CTabItem tab = viewer.getTabFolder().createTabItem( | ||
104 | terminalSubSystem.getHost(), changeTerm() + getInitCmd()); | ||
105 | //since RSETerminalConnector not exit the shell during the diconnection, | ||
106 | //we have manually exit it here | ||
107 | try { | ||
108 | tab.addDisposeListener(new DisposeListener() { | ||
109 | @Override | ||
110 | public void widgetDisposed(DisposeEvent e) { | ||
111 | Object source = e.getSource(); | ||
112 | if (source instanceof CTabItem) { | ||
113 | CTabItem currentItem = (CTabItem) source; | ||
114 | ITerminalShell shell=getTerminalShellFromTab(currentItem); | ||
115 | if(shell!=null) { | ||
116 | shell.exit(); | ||
117 | } | ||
118 | } | ||
119 | } | ||
120 | }); | ||
121 | }catch(Exception e) { | ||
122 | e.printStackTrace(); | ||
123 | } | ||
124 | TerminalElement element = TerminalServiceHelper | ||
125 | .createTerminalElement(tab, terminalSubSystem); | ||
126 | terminalSubSystem.addChild(element); | ||
127 | |||
128 | } | ||
129 | } | ||
130 | } | ||
131 | |||
132 | } | ||
diff --git a/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/YoctoCommand.java b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/YoctoCommand.java new file mode 100644 index 0000000..23292d8 --- /dev/null +++ b/plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/YoctoCommand.java | |||
@@ -0,0 +1,63 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ioana Grigoropol(Intel) - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.remote.utils; | ||
12 | |||
13 | |||
14 | public class YoctoCommand { | ||
15 | private String command; | ||
16 | private String initialDirectory; | ||
17 | private String arguments; | ||
18 | private ProcessStreamBuffer processBuffer; | ||
19 | |||
20 | public YoctoCommand(String command, String initialDirectory, String arguments){ | ||
21 | this.setCommand(command); | ||
22 | this.setInitialDirectory(initialDirectory); | ||
23 | this.setArguments(arguments); | ||
24 | this.setProcessBuffer(new ProcessStreamBuffer(false)); | ||
25 | } | ||
26 | |||
27 | public String getCommand() { | ||
28 | return command; | ||
29 | } | ||
30 | |||
31 | public void setCommand(String command) { | ||
32 | this.command = "bash -l -c \"" + command + "\""; | ||
33 | } | ||
34 | |||
35 | public String getInitialDirectory() { | ||
36 | return initialDirectory; | ||
37 | } | ||
38 | |||
39 | public void setInitialDirectory(String initialDirectory) { | ||
40 | this.initialDirectory = initialDirectory; | ||
41 | } | ||
42 | |||
43 | public String getArguments() { | ||
44 | return arguments; | ||
45 | } | ||
46 | |||
47 | public void setArguments(String arguments) { | ||
48 | this.arguments = arguments; | ||
49 | } | ||
50 | |||
51 | public ProcessStreamBuffer getProcessBuffer() { | ||
52 | return processBuffer; | ||
53 | } | ||
54 | |||
55 | public void setProcessBuffer(ProcessStreamBuffer processBuffer) { | ||
56 | this.processBuffer = processBuffer; | ||
57 | } | ||
58 | |||
59 | @Override | ||
60 | public String toString() { | ||
61 | return command + " " + arguments; | ||
62 | } | ||
63 | } | ||
diff --git a/plugins/org.yocto.sdk.ide.doc.user/.classpath b/plugins/org.yocto.sdk.ide.doc.user/.classpath new file mode 100644 index 0000000..bc74aab --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/.classpath | |||
@@ -0,0 +1,6 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <classpath> | ||
3 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
4 | <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
5 | <classpathentry kind="output" path="bin"/> | ||
6 | </classpath> | ||
diff --git a/plugins/org.yocto.sdk.ide.doc.user/.project b/plugins/org.yocto.sdk.ide.doc.user/.project new file mode 100644 index 0000000..ccc3e39 --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/.project | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.sdk.ide.doc.user</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | <buildCommand> | ||
9 | <name>org.eclipse.jdt.core.javabuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | <buildCommand> | ||
14 | <name>org.eclipse.pde.ManifestBuilder</name> | ||
15 | <arguments> | ||
16 | </arguments> | ||
17 | </buildCommand> | ||
18 | <buildCommand> | ||
19 | <name>org.eclipse.pde.SchemaBuilder</name> | ||
20 | <arguments> | ||
21 | </arguments> | ||
22 | </buildCommand> | ||
23 | </buildSpec> | ||
24 | <natures> | ||
25 | <nature>org.eclipse.pde.PluginNature</nature> | ||
26 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
27 | </natures> | ||
28 | </projectDescription> | ||
diff --git a/plugins/org.yocto.sdk.ide.doc.user/.settings/org.eclipse.jdt.core.prefs b/plugins/org.yocto.sdk.ide.doc.user/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..f90fa9c --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/.settings/org.eclipse.jdt.core.prefs | |||
@@ -0,0 +1,8 @@ | |||
1 | #Fri Mar 04 13:59:33 CET 2011 | ||
2 | eclipse.preferences.version=1 | ||
3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
5 | org.eclipse.jdt.core.compiler.compliance=1.6 | ||
6 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
8 | org.eclipse.jdt.core.compiler.source=1.6 | ||
diff --git a/plugins/org.yocto.sdk.ide.doc.user/META-INF/MANIFEST.MF b/plugins/org.yocto.sdk.ide.doc.user/META-INF/MANIFEST.MF new file mode 100644 index 0000000..efb0865 --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/META-INF/MANIFEST.MF | |||
@@ -0,0 +1,8 @@ | |||
1 | Manifest-Version: 1.0 | ||
2 | Bundle-ManifestVersion: 2 | ||
3 | Bundle-Name: %Bundle-Name | ||
4 | Bundle-SymbolicName: org.yocto.sdk.ide.doc.user;singleton:=true | ||
5 | Bundle-Version: 1.4.0.qualifier | ||
6 | Bundle-Vendor: %Bundle-Vendor | ||
7 | Bundle-RequiredExecutionEnvironment: JavaSE-1.6 | ||
8 | Require-Bundle: org.eclipse.ui.cheatsheets | ||
diff --git a/plugins/org.yocto.sdk.ide.doc.user/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.sdk.ide.doc.user/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..2cf9956 --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/OSGI-INF/l10n/bundle.properties | |||
@@ -0,0 +1,7 @@ | |||
1 | #Properties file for org.yocto.sdk.ide.doc.user | ||
2 | Bundle-Vendor = yoctoproject.org | ||
3 | Bundle-Name = Yocto User Help | ||
4 | |||
5 | category.name = Yocto Project | ||
6 | |||
7 | cheatsheet.name = Creating a Hello World ANSI C or C++ Autotools Project | ||
diff --git a/plugins/org.yocto.sdk.ide.doc.user/build.properties b/plugins/org.yocto.sdk.ide.doc.user/build.properties new file mode 100644 index 0000000..caf850b --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/build.properties | |||
@@ -0,0 +1,6 @@ | |||
1 | bin.includes = plugin.xml,\ | ||
2 | .,\ | ||
3 | META-INF/,\ | ||
4 | OSGI-INF/,\ | ||
5 | cheatsheets/ | ||
6 | src.includes = cheatsheets/ | ||
diff --git a/plugins/org.yocto.sdk.ide.doc.user/cheatsheets/createNewHelloWorldProject.xml b/plugins/org.yocto.sdk.ide.doc.user/cheatsheets/createNewHelloWorldProject.xml new file mode 100644 index 0000000..310dce6 --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/cheatsheets/createNewHelloWorldProject.xml | |||
@@ -0,0 +1,222 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!-- | ||
3 | /******************************************************************************* | ||
4 | * Copyright (c) 2012 BMW Car IT GmbH. | ||
5 | * All rights reserved. This program and the accompanying materials | ||
6 | * are made available under the terms of the Eclipse Public License v1.0 | ||
7 | * which accompanies this distribution, and is available at | ||
8 | * http://www.eclipse.org/legal/epl-v10.html | ||
9 | * | ||
10 | * Contributors: | ||
11 | * Atanas Gegov - initial cheat sheet for creating the hello world project. | ||
12 | ******************************************************************************* | ||
13 | --> | ||
14 | <cheatsheet title="Creating a Hello World ANSI C or C++ Autotools Project"> | ||
15 | <intro> | ||
16 | <description> | ||
17 | This cheat sheet will guide you through the process of creating and | ||
18 | building a "Hello World ANSI C Autotools Project" or | ||
19 | a "Hello World C++ Autotools Project" | ||
20 | application that uses a Yocto Project template. | ||
21 | </description> | ||
22 | </intro> | ||
23 | <item title="Open the C/C++ Perspective" dialog="false" skip="true"> | ||
24 | <description> | ||
25 | Select <b>Window</b> > <b>Open Perspective</b> > | ||
26 | <b>Other...</b> from the menu bar.<br/> | ||
27 | Choose <b>C/C++</b> from the <b>Open Perspective</b> dialog. | ||
28 | Click <b>OK</b>. | ||
29 | </description> | ||
30 | <command | ||
31 | required="false" | ||
32 | serialization="org.eclipse.ui.perspectives.showPerspective(org.eclipse.ui.perspectives.showPerspective.perspectiveId=org.eclipse.cdt.ui.CPerspective)"> | ||
33 | </command> | ||
34 | </item> | ||
35 | <item title="Specify a toolchain and sysroot location" dialog="true" skip="true"> | ||
36 | <description> | ||
37 | You need to specify a toolchain and sysroot location before | ||
38 | building any project in the workspace. | ||
39 | </description> | ||
40 | <subitem> | ||
41 | <description> | ||
42 | The global settings can be modified in the <b>Yocto Project ADT</b> | ||
43 | section of the eclipse preferences. Select <b>Window</b> > | ||
44 | <b>Preferences</b> from the menu bar and then select the section | ||
45 | <b>Yocto Project ADT</b>. These settings are the default ones for | ||
46 | every project you create in the workspace. | ||
47 | </description> | ||
48 | <command | ||
49 | required="false" | ||
50 | serialization="org.eclipse.ui.window.preferences(preferencePageId=org.yocto.sdk.ide.preferences.YoctoSDKPreferencePage)"> | ||
51 | </command> | ||
52 | </subitem> | ||
53 | <subitem> | ||
54 | <description> | ||
55 | Choose in the <b>Cross Compiler Options</b> the | ||
56 | <b>Standalone pre-built toolchain</b>. | ||
57 | </description> | ||
58 | </subitem> | ||
59 | <subitem> | ||
60 | <description> | ||
61 | Provide a <b>Toolchain Root Location</b> (e.g. | ||
62 | /opt/poky/1.3 or some other location on the filesystem). | ||
63 | </description> | ||
64 | </subitem> | ||
65 | <subitem> | ||
66 | <description> | ||
67 | Provide a <b>Sysroot Location</b>. This is the filesystem | ||
68 | containing libraries, headers etc. used while cross-building | ||
69 | binaries for the target. | ||
70 | </description> | ||
71 | </subitem> | ||
72 | <subitem> | ||
73 | <description> | ||
74 | If more than one toolchain is found in the <b>Toolchain | ||
75 | Root Location</b>, use the drop-down box to select the <b>Target | ||
76 | Architecture</b>. Make sure that the selected sysroot matches | ||
77 | the toolchain. | ||
78 | </description> | ||
79 | </subitem> | ||
80 | <subitem> | ||
81 | <description> | ||
82 | Choose in the <b>Target Options</b> whether the target is a QEMU | ||
83 | emulation (kernel location required) or an external hardware. | ||
84 | The target is used for running or remote debugging the binaries | ||
85 | created for it. | ||
86 | </description> | ||
87 | </subitem> | ||
88 | <subitem> | ||
89 | <description> | ||
90 | Save the settings with <b>Apply</b> and <b>OK</b>. You can later | ||
91 | change these settings for any project from the menu | ||
92 | <b>Project</b> > <b>Change Yocto Project Settings</b>. | ||
93 | </description> | ||
94 | </subitem> | ||
95 | </item> | ||
96 | <item title="Choose the programming language for the project" dialog="true"> | ||
97 | <description> | ||
98 | Choose between the available "Hello World ANSI C Autotools | ||
99 | Project" or the "Hello World C++ Autotools Project" | ||
100 | template projects. | ||
101 | </description> | ||
102 | <command returns="progLanguage" | ||
103 | serialization="org.eclipse.ui.dialogs.openMessageDialog(title=Select Programming Language,buttonLabel0=C++,message=Select the programming language for the Hello World Autotools Project project,buttonLabel1=C)"/> | ||
104 | <onCompletion> You selected ${progLanguage}.</onCompletion> | ||
105 | </item> | ||
106 | <item title="Create a Hello World Autotools Project"> | ||
107 | <description> | ||
108 | Create a Yocto Project ADT Project "Hello World ANSI C Autotools | ||
109 | Project" or "Hello World C++ Autotools Project" | ||
110 | by using the appropriate Project wizard. | ||
111 | </description> | ||
112 | <conditional-subitem condition="${progLanguage}"> | ||
113 | <subitem when="C++"> | ||
114 | <description> | ||
115 | Click <b>File</b> > <b>New</b> > <b>C++ Project</b> to | ||
116 | launch the C++ Project wizard. | ||
117 | </description> | ||
118 | <command | ||
119 | required="false" | ||
120 | serialization="org.eclipse.ui.newWizard(newWizardId=org.eclipse.cdt.ui.wizards.NewCWizard1)"> | ||
121 | </command> | ||
122 | </subitem> | ||
123 | <subitem when="C"> | ||
124 | <description> | ||
125 | Click <b>File</b> > <b>New</b> > <b>C Project</b> to | ||
126 | launch the C Project wizard. | ||
127 | </description> | ||
128 | <command | ||
129 | required="false" | ||
130 | serialization="org.eclipse.ui.newWizard(newWizardId=org.eclipse.cdt.ui.wizards.NewCWizard2)"> | ||
131 | </command> | ||
132 | </subitem> | ||
133 | </conditional-subitem> | ||
134 | <conditional-subitem condition="${progLanguage}"> | ||
135 | <subitem when="C++"> | ||
136 | <description> | ||
137 | Enter <b>HelloWorld</b> as the project name, then select | ||
138 | <b>Yocto Project ADT Project</b> > | ||
139 | <b>Hello World C++ Autotools Project</b> from the Project type | ||
140 | list and click <b>Next</b>. | ||
141 | </description> | ||
142 | </subitem> | ||
143 | <subitem when="C"> | ||
144 | <description> | ||
145 | Enter <b>HelloWorld</b> as the project name, then select | ||
146 | <b>Yocto Project ADT Project</b> > | ||
147 | <b>Hello World ANSI C Autotools Project</b> from the Project type | ||
148 | list and click <b>Next</b>. | ||
149 | </description> | ||
150 | </subitem> | ||
151 | </conditional-subitem> | ||
152 | <subitem skip="true"> | ||
153 | <description> | ||
154 | Fill in the name of the <b>Author</b>. Make some changes in the | ||
155 | other fields if needed. Possibly change the <b>License</b> from | ||
156 | the drop-down box and click <b>Next</b>. | ||
157 | </description> | ||
158 | </subitem> | ||
159 | <subitem skip="true"> | ||
160 | <description> | ||
161 | If needed make some Advanced settings. Confirm them with | ||
162 | <b>Apply</b> and <b>OK</b>. | ||
163 | </description> | ||
164 | </subitem> | ||
165 | <subitem> | ||
166 | <description> | ||
167 | Click <b>Finish</b> to create the project in your workspace. You | ||
168 | will find the created project in the <b>Project Explorer</b> view. | ||
169 | </description> | ||
170 | </subitem> | ||
171 | </item> | ||
172 | <item title="Build the project" dialog="true"> | ||
173 | <description> | ||
174 | Create the project's binary using a specified toolchain and | ||
175 | sysroot. | ||
176 | </description> | ||
177 | <subitem> | ||
178 | <description> | ||
179 | Make sure that the project is on focus in the | ||
180 | <b>Project Explorer</b> view. | ||
181 | </description> | ||
182 | </subitem> | ||
183 | <subitem> | ||
184 | <description> | ||
185 | If you want to change the default settings for toolchain and | ||
186 | sysroot location go to <b>Project</b> > | ||
187 | <b>Change Yocto Project Settings</b> in the menu bar. Finish the | ||
188 | editing by pressing <b>OK</b>. | ||
189 | </description> | ||
190 | </subitem> | ||
191 | <subitem> | ||
192 | <description> | ||
193 | If you have changed the settings in the previous step, call | ||
194 | <b>Project</b> > <b>Reconfigure Project</b> to reconfigure the | ||
195 | project with these new settings (e.g. create the correct Makefiles | ||
196 | that make use of the selected toolchain and sysroot). | ||
197 | </description> | ||
198 | </subitem> | ||
199 | <subitem> | ||
200 | <description> | ||
201 | Build the project with a click on the hammer symbol in the | ||
202 | Toolbar. Alternatively, go to <b>Project</b> > | ||
203 | <b>Build Project</b>. If you didn't change the default | ||
204 | toolchain and sysroot, now the configuring step will be executed | ||
205 | at first, followed by the build step itself. | ||
206 | </description> | ||
207 | </subitem> | ||
208 | <subitem> | ||
209 | <description> | ||
210 | Observe the output in the different consoles (e.g. | ||
211 | <b>Configure [HelloWorld]</b> and | ||
212 | <b>CDT Build Console [HelloWorld]</b>) to check if everything | ||
213 | was successful. | ||
214 | </description> | ||
215 | </subitem> | ||
216 | <onCompletion> | ||
217 | Congratulations, you have completed this cheat sheet! You may | ||
218 | continue with editing, rebuilding or debugging the | ||
219 | Hello World Autotools Project. | ||
220 | </onCompletion> | ||
221 | </item> | ||
222 | </cheatsheet> | ||
diff --git a/plugins/org.yocto.sdk.ide.doc.user/plugin.xml b/plugins/org.yocto.sdk.ide.doc.user/plugin.xml new file mode 100644 index 0000000..24c539d --- /dev/null +++ b/plugins/org.yocto.sdk.ide.doc.user/plugin.xml | |||
@@ -0,0 +1,13 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <?eclipse version="3.4"?> | ||
3 | <plugin> | ||
4 | <extension point="org.eclipse.ui.cheatsheets.cheatSheetContent"> | ||
5 | <category id="org.yocto.sdk.ide.doc.user.cheatsheets" name="%category.name"> | ||
6 | </category> | ||
7 | <cheatsheet category="org.yocto.sdk.ide.doc.user.cheatsheets" | ||
8 | composite="false" contentFile="cheatsheets/createNewHelloWorldProject.xml" | ||
9 | id="org.yocto.sdk.ide.doc.user.cheatsheet.helloworldProject" | ||
10 | name="%cheatsheet.name"> | ||
11 | </cheatsheet> | ||
12 | </extension> | ||
13 | </plugin> | ||
diff --git a/plugins/org.yocto.sdk.ide/.classpath b/plugins/org.yocto.sdk.ide/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/.classpath | |||
@@ -0,0 +1,7 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <classpath> | ||
3 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
4 | <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
5 | <classpathentry kind="src" path="src"/> | ||
6 | <classpathentry kind="output" path="bin"/> | ||
7 | </classpath> | ||
diff --git a/plugins/org.yocto.sdk.ide/.project b/plugins/org.yocto.sdk.ide/.project new file mode 100644 index 0000000..643f947 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/.project | |||
@@ -0,0 +1,32 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.sdk.ide</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | <project>org.eclipse.tm.tcf</project> | ||
7 | <project>org.eclipse.tm.tcf.core</project> | ||
8 | <project>org.eclipse.tm.tcf.rse</project> | ||
9 | <project>org.eclipse.tm.tcf.terminals</project> | ||
10 | </projects> | ||
11 | <buildSpec> | ||
12 | <buildCommand> | ||
13 | <name>org.eclipse.jdt.core.javabuilder</name> | ||
14 | <arguments> | ||
15 | </arguments> | ||
16 | </buildCommand> | ||
17 | <buildCommand> | ||
18 | <name>org.eclipse.pde.ManifestBuilder</name> | ||
19 | <arguments> | ||
20 | </arguments> | ||
21 | </buildCommand> | ||
22 | <buildCommand> | ||
23 | <name>org.eclipse.pde.SchemaBuilder</name> | ||
24 | <arguments> | ||
25 | </arguments> | ||
26 | </buildCommand> | ||
27 | </buildSpec> | ||
28 | <natures> | ||
29 | <nature>org.eclipse.pde.PluginNature</nature> | ||
30 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
31 | </natures> | ||
32 | </projectDescription> | ||
diff --git a/plugins/org.yocto.sdk.ide/.settings/org.eclipse.jdt.core.prefs b/plugins/org.yocto.sdk.ide/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..6745823 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/.settings/org.eclipse.jdt.core.prefs | |||
@@ -0,0 +1,8 @@ | |||
1 | #Mon May 03 15:24:21 PDT 2010 | ||
2 | eclipse.preferences.version=1 | ||
3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
5 | org.eclipse.jdt.core.compiler.compliance=1.6 | ||
6 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
8 | org.eclipse.jdt.core.compiler.source=1.6 | ||
diff --git a/plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF b/plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF new file mode 100644 index 0000000..294af38 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/META-INF/MANIFEST.MF | |||
@@ -0,0 +1,36 @@ | |||
1 | Manifest-Version: 1.0 | ||
2 | Bundle-ManifestVersion: 2 | ||
3 | Bundle-Name: %Bundle-Name | ||
4 | Bundle-SymbolicName: org.yocto.sdk.ide;singleton:=true | ||
5 | Bundle-Version: 1.4.0.qualifier | ||
6 | Bundle-Activator: org.yocto.sdk.ide.YoctoSDKPlugin | ||
7 | Bundle-Vendor: %Bundle-Vendor | ||
8 | Require-Bundle: org.eclipse.ui, | ||
9 | org.eclipse.core.runtime, | ||
10 | org.eclipse.cdt.managedbuilder.core, | ||
11 | org.eclipse.rse.files.ui;bundle-version="3.2.200", | ||
12 | org.eclipse.rse.services;bundle-version="3.2.200", | ||
13 | org.eclipse.rse.core;bundle-version="3.3.100", | ||
14 | org.eclipse.rse.ui;bundle-version="3.3.100", | ||
15 | org.eclipse.rse.subsystems.files.core;bundle-version="3.3.1", | ||
16 | org.eclipse.cdt.launch.remote;bundle-version="2.4.0", | ||
17 | org.eclipse.cdt.debug.mi.core;bundle-version="7.3.0", | ||
18 | org.eclipse.cdt.debug.core;bundle-version="7.3.0", | ||
19 | org.eclipse.cdt.debug.ui;bundle-version="7.3.0", | ||
20 | org.eclipse.ui.ide;bundle-version="3.9.0", | ||
21 | org.eclipse.cdt.ui;bundle-version="5.6.0", | ||
22 | org.eclipse.cdt.core;bundle-version="5.5.0", | ||
23 | org.eclipse.core.resources;bundle-version="3.8.100", | ||
24 | org.eclipse.debug.core;bundle-version="3.8.0", | ||
25 | org.eclipse.cdt.autotools.core;bundle-version="1.2.0", | ||
26 | org.eclipse.cdt.autotools.ui;bundle-version="1.0.1", | ||
27 | org.eclipse.cdt.managedbuilder.ui;bundle-version="8.2.0", | ||
28 | org.eclipse.core.expressions;bundle-version="3.4.500" | ||
29 | Bundle-RequiredExecutionEnvironment: JavaSE-1.6 | ||
30 | Bundle-ActivationPolicy: lazy | ||
31 | Export-Package: org.yocto.sdk.ide, | ||
32 | org.yocto.sdk.ide.natures, | ||
33 | org.yocto.sdk.ide.utils, | ||
34 | org.yocto.sdk.ide.actions, | ||
35 | org.yocto.sdk.ide.preferences, | ||
36 | org.yocto.sdk.ide.wizard | ||
diff --git a/plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..2031154 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/OSGI-INF/l10n/bundle.properties | |||
@@ -0,0 +1,16 @@ | |||
1 | #Properties file for org.Yocto.sdk.ide | ||
2 | page.name.0 = Yocto Project ADT | ||
3 | extension.name.0 = YoctoSDKNature | ||
4 | extension.name.1 = YoctoSDKAutotoolsNature | ||
5 | extension.name.2 = YoctoSDKCMakeNature | ||
6 | command.name = ReconfigureYoctoProject | ||
7 | command.label.0 = Change Yocto Project Settings | ||
8 | command.mnemonic = C | ||
9 | command.targetProfileSwitch.name = Change Target Profile | ||
10 | command.targetProfileSwitch.label = Target Profiles | ||
11 | command.targetProfileSwitch.description = Changes the target profile of a selected project | ||
12 | command.targetProfileSwitch.parameter.name = Selected Target Profile | ||
13 | projectType.name.0 = Yocto Project ADT Autotools Project | ||
14 | projectProperties.label.0 = Yocto Project Settings | ||
15 | Bundle-Vendor = yoctoproject.org | ||
16 | Bundle-Name = Yocto Plugin IDE | ||
diff --git a/plugins/org.yocto.sdk.ide/build.properties b/plugins/org.yocto.sdk.ide/build.properties new file mode 100644 index 0000000..e763a45 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/build.properties | |||
@@ -0,0 +1,9 @@ | |||
1 | source.. = src/ | ||
2 | output.. = bin/ | ||
3 | bin.includes = META-INF/,\ | ||
4 | .,\ | ||
5 | plugin.xml,\ | ||
6 | templates/,\ | ||
7 | OSGI-INF/ | ||
8 | src.includes = templates/,\ | ||
9 | OSGI-INF/ | ||
diff --git a/plugins/org.yocto.sdk.ide/plugin.xml b/plugins/org.yocto.sdk.ide/plugin.xml new file mode 100644 index 0000000..c082c3a --- /dev/null +++ b/plugins/org.yocto.sdk.ide/plugin.xml | |||
@@ -0,0 +1,327 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <?eclipse version="3.4"?> | ||
3 | <plugin> | ||
4 | <extension | ||
5 | point="org.eclipse.ui.preferencePages"> | ||
6 | <page | ||
7 | class="org.yocto.sdk.ide.preferences.YoctoSDKPreferencePage" | ||
8 | id="org.yocto.sdk.ide.preferences.YoctoSDKPreferencePage" | ||
9 | name="%page.name.0"> | ||
10 | </page> | ||
11 | </extension> | ||
12 | <extension | ||
13 | point="org.eclipse.core.runtime.preferences"> | ||
14 | <initializer | ||
15 | class="org.yocto.sdk.ide.preferences.PreferenceInitializer"> | ||
16 | </initializer> | ||
17 | </extension> | ||
18 | <extension | ||
19 | id="YoctoSDKNature" | ||
20 | name="%extension.name.0" | ||
21 | point="org.eclipse.core.resources.natures"> | ||
22 | <runtime> | ||
23 | <run | ||
24 | class="org.yocto.sdk.ide.natures.YoctoSDKProjectNature"> | ||
25 | </run> | ||
26 | </runtime> | ||
27 | </extension> | ||
28 | <extension | ||
29 | id="YoctoSDKAutotoolsNature" | ||
30 | name="%extension.name.1" | ||
31 | point="org.eclipse.core.resources.natures"> | ||
32 | <requires-nature | ||
33 | id="org.yocto.sdk.ide.YoctoSDKNature"> | ||
34 | </requires-nature> | ||
35 | <requires-nature | ||
36 | id="org.eclipse.cdt.autotools.core.autotoolsNatureV2"> | ||
37 | </requires-nature> | ||
38 | <runtime> | ||
39 | <run | ||
40 | class="org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature"> | ||
41 | </run> | ||
42 | </runtime> | ||
43 | <one-of-nature | ||
44 | id="org.yocto.sdk.ide.buildsystemNaturesSet"> | ||
45 | </one-of-nature> | ||
46 | <builder | ||
47 | id="org.eclipse.cdt.autotools.core.genmakebuilderV2"> | ||
48 | </builder> | ||
49 | </extension> | ||
50 | <extension | ||
51 | id="YoctoSDKCMakeNature" | ||
52 | name="%extension.name.2" | ||
53 | point="org.eclipse.core.resources.natures"> | ||
54 | <requires-nature | ||
55 | id="org.yocto.sdk.ide.YoctoSDKNature"> | ||
56 | </requires-nature> | ||
57 | <runtime> | ||
58 | <run | ||
59 | class="org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature"> | ||
60 | </run> | ||
61 | </runtime> | ||
62 | <one-of-nature | ||
63 | id="org.yocto.sdk.ide.buildsystemNaturesSet"> | ||
64 | </one-of-nature> | ||
65 | </extension> | ||
66 | <extension | ||
67 | id="YoctoSDKEmptyNature" | ||
68 | point="org.eclipse.core.resources.natures"> | ||
69 | <requires-nature | ||
70 | id="org.yocto.sdk.ide.YoctoSDKNature"> | ||
71 | </requires-nature> | ||
72 | <runtime> | ||
73 | <run | ||
74 | class="org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature"> | ||
75 | </run> | ||
76 | </runtime> | ||
77 | </extension> | ||
78 | <extension | ||
79 | point="org.eclipse.ui.commands"> | ||
80 | <command | ||
81 | id="org.yocto.sdk.ide.command.reconfigYocto" | ||
82 | name="%command.name"> | ||
83 | </command> | ||
84 | <command | ||
85 | id="org.yocto.sdk.ide.command.disabled" | ||
86 | name="DisabledCommand"> | ||
87 | </command> | ||
88 | </extension> | ||
89 | <extension | ||
90 | point="org.eclipse.ui.handlers"> | ||
91 | <handler | ||
92 | class="org.yocto.sdk.ide.actions.ReconfigYoctoHandler" | ||
93 | commandId="org.yocto.sdk.ide.command.reconfigYocto"> | ||
94 | </handler> | ||
95 | </extension> | ||
96 | <extension | ||
97 | point="org.eclipse.ui.menus"> | ||
98 | <menuContribution | ||
99 | locationURI="menu:project"> | ||
100 | <command | ||
101 | commandId="org.yocto.sdk.ide.command.reconfigYocto" | ||
102 | id="reconfigure" | ||
103 | label="%command.label.0" | ||
104 | mnemonic="%command.mnemonic" | ||
105 | style="push"> | ||
106 | <visibleWhen | ||
107 | checkEnabled="false"> | ||
108 | <and> | ||
109 | <count | ||
110 | value="1"> | ||
111 | </count> | ||
112 | <iterate> | ||
113 | <adapt | ||
114 | type="org.eclipse.core.resources.IResource"> | ||
115 | <test | ||
116 | property="org.eclipse.core.resources.projectNature" | ||
117 | value="org.yocto.sdk.ide.YoctoSDKAutotoolsNature"> | ||
118 | </test> | ||
119 | </adapt> | ||
120 | </iterate> | ||
121 | </and> | ||
122 | </visibleWhen> | ||
123 | </command> | ||
124 | </menuContribution> | ||
125 | </extension> | ||
126 | <extension | ||
127 | point="org.eclipse.cdt.core.templates"> | ||
128 | <template | ||
129 | filterPattern=".*gcc" | ||
130 | id="org.yocto.sdk.ide.template.emptyCProject" | ||
131 | location="templates/projecttemplates/EmptyCAutotoolsProject/template.xml" | ||
132 | projectType="org.yocto.sdk.ide.projectType"> | ||
133 | </template> | ||
134 | <template | ||
135 | filterPattern=".*g\+\+" | ||
136 | id="org.yocto.sdk.ide.template.emptyCPPProject" | ||
137 | location="templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml" | ||
138 | projectType="org.yocto.sdk.ide.projectType"> | ||
139 | </template> | ||
140 | <template | ||
141 | filterPattern=".*gcc" | ||
142 | id="org.yocto.sdk.ide.template.helloWorldCProject" | ||
143 | location="templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml" | ||
144 | projectType="org.yocto.sdk.ide.projectType"> | ||
145 | </template> | ||
146 | <template | ||
147 | filterPattern=".*g\+\+" | ||
148 | id="org.yocto.sdk.ide.template.helloWorldCPPProject" | ||
149 | location="templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml" | ||
150 | projectType="org.yocto.sdk.ide.projectType"> | ||
151 | </template> | ||
152 | <template | ||
153 | filterPattern=".*gcc" | ||
154 | id="org.yocto.sdk.ide.template.helloWorldCGTKProject" | ||
155 | location="templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml" | ||
156 | projectType="org.yocto.sdk.ide.projectType"> | ||
157 | </template> | ||
158 | </extension> | ||
159 | <extension | ||
160 | point="org.eclipse.cdt.core.templateProcessTypes"> | ||
161 | <processType | ||
162 | name="NewYoctoProject" | ||
163 | processRunner="org.yocto.sdk.ide.wizard.NewYoctoProjectTemplateProcess"> | ||
164 | <simple | ||
165 | name="name"> | ||
166 | </simple> | ||
167 | <simple | ||
168 | external="true" | ||
169 | name="location" | ||
170 | nullable="true"> | ||
171 | </simple> | ||
172 | <simple | ||
173 | external="true" | ||
174 | name="artifactExtension"> | ||
175 | </simple> | ||
176 | <simple | ||
177 | external="true" | ||
178 | name="isCProject"> | ||
179 | </simple> | ||
180 | <simple | ||
181 | external="true" | ||
182 | name="isEmptyProject"> | ||
183 | </simple> | ||
184 | <simple | ||
185 | external="true" | ||
186 | name="isAutotoolsProject"> | ||
187 | </simple> | ||
188 | <simple | ||
189 | external="true" | ||
190 | name="isCMakeProject"> | ||
191 | </simple> | ||
192 | </processType> | ||
193 | <processType | ||
194 | name="NewYoctoAutotoolsProjectPostProcess" | ||
195 | processRunner="org.yocto.sdk.ide.wizard.NewYoctoAutotoolsProjectPostProcess"> | ||
196 | <simple | ||
197 | name="projectName"> | ||
198 | </simple> | ||
199 | </processType> | ||
200 | </extension> | ||
201 | <extension | ||
202 | point="org.eclipse.cdt.managedbuilder.core.buildDefinitions"> | ||
203 | <projectType | ||
204 | id="org.yocto.sdk.ide.projectType" | ||
205 | isAbstract="true" | ||
206 | name="%projectType.name.0" | ||
207 | superClass="org.eclipse.linuxtools.cdt.autotools.core.projectType"> | ||
208 | </projectType> | ||
209 | </extension> | ||
210 | <extension | ||
211 | id="org.yocto.sdk.ide.actions.YoctoConsole" | ||
212 | point="org.eclipse.cdt.core.CBuildConsole"> | ||
213 | <CBuildConsole | ||
214 | class="org.yocto.sdk.ide.actions.YoctoConsole" | ||
215 | id="org.yocto.sdk.ide.YoctoConsole"> | ||
216 | </CBuildConsole> | ||
217 | </extension> | ||
218 | <extension | ||
219 | point="org.eclipse.ui.propertyPages"> | ||
220 | <page | ||
221 | adaptable="true" | ||
222 | class="org.yocto.sdk.ide.preferences.YoctoSDKProjectPropertyPage" | ||
223 | id="org.yocto.sdk.ide.page" | ||
224 | name="%projectProperties.label.0" | ||
225 | objectClass="org.eclipse.core.resources.IProject"> | ||
226 | <filter | ||
227 | name="projectNature" | ||
228 | value="org.yocto.sdk.ide.YoctoSDKNature"> | ||
229 | </filter> | ||
230 | </page> | ||
231 | </extension> | ||
232 | <extension | ||
233 | point="org.eclipse.ui.commands"> | ||
234 | <command | ||
235 | defaultHandler="org.yocto.sdk.ide.actions.ProfileSwitchHandler" | ||
236 | description="%command.targetProfileSwitch.description" | ||
237 | id="org.yocto.sdk.ide.targetProfile.switch" | ||
238 | name="%command.targetProfileSwitch.name"> | ||
239 | <commandParameter | ||
240 | id="org.eclipse.ui.commands.radioStateParameter" | ||
241 | name="%command.targetProfileSwitch.parameter.name" | ||
242 | optional="false"> | ||
243 | </commandParameter> | ||
244 | <state | ||
245 | class="org.eclipse.ui.handlers.RadioState:project-specific" | ||
246 | id="org.eclipse.ui.commands.radioState"> | ||
247 | </state> | ||
248 | </command> | ||
249 | </extension> | ||
250 | <extension | ||
251 | point="org.eclipse.ui.menus"> | ||
252 | <menuContribution | ||
253 | allPopups="true" | ||
254 | locationURI="menu:project"> | ||
255 | <menu | ||
256 | id="org.yocto.sdk.ide.profiles.menu" | ||
257 | label="%command.targetProfileSwitch.label" | ||
258 | tooltip="%command.targetProfileSwitch.description"> | ||
259 | </menu> | ||
260 | </menuContribution> | ||
261 | <menuContribution | ||
262 | allPopups="true" | ||
263 | locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions"> | ||
264 | <toolbar | ||
265 | id="org.yocto.sdk.ide.profiles.toolbar"> | ||
266 | <command | ||
267 | commandId="org.yocto.sdk.ide.command.reconfigYocto" | ||
268 | id="org.yocto.sdk.ide.profiles.toolbar.dropdown" | ||
269 | label="%command.targetProfileSwitch.label" | ||
270 | mode="FORCE_TEXT" | ||
271 | style="pulldown" | ||
272 | tooltip="%command.targetProfileSwitch.description"> | ||
273 | <visibleWhen | ||
274 | checkEnabled="false"> | ||
275 | <and> | ||
276 | <count | ||
277 | value="1"> | ||
278 | </count> | ||
279 | <iterate | ||
280 | operator="and"> | ||
281 | <adapt | ||
282 | type="org.eclipse.core.resources.IResource"> | ||
283 | <test | ||
284 | property="org.eclipse.core.resources.projectNature" | ||
285 | value="org.yocto.sdk.ide.YoctoSDKNature"> | ||
286 | </test> | ||
287 | </adapt> | ||
288 | </iterate> | ||
289 | </and> | ||
290 | </visibleWhen> | ||
291 | </command> | ||
292 | </toolbar> | ||
293 | </menuContribution> | ||
294 | <menuContribution | ||
295 | allPopups="false" | ||
296 | locationURI="menu:org.yocto.sdk.ide.profiles.menu"> | ||
297 | <dynamic | ||
298 | class="org.yocto.sdk.ide.ProjectSpecificContributionItem" | ||
299 | id="org.yocto.sdk.ide.dynamic.projectSpecific.targetProfile"> | ||
300 | </dynamic> | ||
301 | <separator | ||
302 | name="org.yocto.sdk.ide.profiles.separator" | ||
303 | visible="true"> | ||
304 | </separator> | ||
305 | <dynamic | ||
306 | class="org.yocto.sdk.ide.TargetProfileContributionItem" | ||
307 | id="org.yocto.sdk.ide.dynamic.targetProfile"> | ||
308 | </dynamic> | ||
309 | </menuContribution> | ||
310 | <menuContribution | ||
311 | allPopups="false" | ||
312 | locationURI="menu:org.yocto.sdk.ide.profiles.toolbar.dropdown"> | ||
313 | <dynamic | ||
314 | class="org.yocto.sdk.ide.ProjectSpecificContributionItem" | ||
315 | id="org.yocto.sdk.ide.dynamic.projectSpecific.targetProfile"> | ||
316 | </dynamic> | ||
317 | <separator | ||
318 | name="org.yocto.sdk.ide.profiles.separator" | ||
319 | visible="true"> | ||
320 | </separator> | ||
321 | <dynamic | ||
322 | class="org.yocto.sdk.ide.TargetProfileContributionItem" | ||
323 | id="org.yocto.sdk.ide.dynamic.targetProfile"> | ||
324 | </dynamic> | ||
325 | </menuContribution> | ||
326 | </extension> | ||
327 | </plugin> | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java new file mode 100644 index 0000000..7ba7df1 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/ProjectSpecificContributionItem.java | |||
@@ -0,0 +1,71 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial implementation | ||
10 | *******************************************************************************/ | ||
11 | |||
12 | package org.yocto.sdk.ide; | ||
13 | |||
14 | import java.util.ArrayList; | ||
15 | |||
16 | import org.eclipse.core.resources.IProject; | ||
17 | import org.eclipse.jface.action.IContributionItem; | ||
18 | import org.eclipse.ui.menus.CommandContributionItem; | ||
19 | import org.eclipse.ui.menus.CommandContributionItemParameter; | ||
20 | import org.eclipse.ui.services.IServiceLocator; | ||
21 | import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; | ||
22 | import org.yocto.sdk.ide.actions.ProfileSwitchHandler; | ||
23 | import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; | ||
24 | |||
25 | public class ProjectSpecificContributionItem extends TargetProfileContributionItem { | ||
26 | private static final String PROJECT_SPECIFIC_PROFILE = | ||
27 | "Preferences.Profile.ProjectSpecific.Profile.Label"; //$NON-NLS-N$ | ||
28 | private static final String DISABLED_COMMAND_ID = "org.yocto.sdk.ide.command.disabled"; //$NON-NLS-N$ | ||
29 | |||
30 | private IServiceLocator serviceLocator; | ||
31 | |||
32 | public ProjectSpecificContributionItem() {} | ||
33 | |||
34 | public ProjectSpecificContributionItem(String id) { | ||
35 | super(id); | ||
36 | } | ||
37 | |||
38 | @Override | ||
39 | protected IContributionItem[] getContributionItems() { | ||
40 | ArrayList<IContributionItem> items = new ArrayList<IContributionItem>(); | ||
41 | |||
42 | IProject project = getSelectedProject(serviceLocator); | ||
43 | if (project != null) { | ||
44 | YoctoUIElement yoctoUIElement = ProjectPreferenceUtils.getElem(project); | ||
45 | SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(yoctoUIElement); | ||
46 | |||
47 | if ((result != SDKCheckResults.SDK_PASS)) { | ||
48 | CommandContributionItemParameter parameter = new CommandContributionItemParameter(serviceLocator, | ||
49 | null, | ||
50 | DISABLED_COMMAND_ID, | ||
51 | CommandContributionItem.STYLE_PUSH); | ||
52 | |||
53 | parameter.label = YoctoSDKMessages.getString(PROJECT_SPECIFIC_PROFILE); | ||
54 | |||
55 | items.add(new CommandContributionItem(parameter)); | ||
56 | } else { | ||
57 | items.add(super.createProfileItem(serviceLocator, ProfileSwitchHandler.PROJECT_SPECIFIC_PARAMETER, | ||
58 | YoctoSDKMessages.getString(PROJECT_SPECIFIC_PROFILE))); | ||
59 | } | ||
60 | |||
61 | updateSelection(serviceLocator); | ||
62 | } | ||
63 | |||
64 | return items.toArray(new IContributionItem[items.size()]); | ||
65 | } | ||
66 | |||
67 | @Override | ||
68 | public void initialize(IServiceLocator serviceLocator) { | ||
69 | this.serviceLocator = serviceLocator; | ||
70 | } | ||
71 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java new file mode 100644 index 0000000..1206e19 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/TargetProfileContributionItem.java | |||
@@ -0,0 +1,128 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide; | ||
12 | |||
13 | import java.util.ArrayList; | ||
14 | import java.util.HashMap; | ||
15 | import java.util.TreeSet; | ||
16 | |||
17 | import org.eclipse.cdt.core.model.ICElement; | ||
18 | import org.eclipse.cdt.core.model.ICProject; | ||
19 | import org.eclipse.core.commands.Command; | ||
20 | import org.eclipse.core.commands.ExecutionException; | ||
21 | import org.eclipse.core.resources.IProject; | ||
22 | import org.eclipse.core.resources.IResource; | ||
23 | import org.eclipse.core.runtime.IAdaptable; | ||
24 | import org.eclipse.jface.action.IContributionItem; | ||
25 | import org.eclipse.jface.viewers.ISelection; | ||
26 | import org.eclipse.jface.viewers.ITreeSelection; | ||
27 | import org.eclipse.ui.ISelectionService; | ||
28 | import org.eclipse.ui.actions.CompoundContributionItem; | ||
29 | import org.eclipse.ui.commands.ICommandService; | ||
30 | import org.eclipse.ui.handlers.HandlerUtil; | ||
31 | import org.eclipse.ui.handlers.RadioState; | ||
32 | import org.eclipse.ui.menus.CommandContributionItem; | ||
33 | import org.eclipse.ui.menus.CommandContributionItemParameter; | ||
34 | import org.eclipse.ui.menus.IWorkbenchContribution; | ||
35 | import org.eclipse.ui.services.IServiceLocator; | ||
36 | import org.yocto.sdk.ide.actions.ProfileSwitchHandler; | ||
37 | import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; | ||
38 | import org.yocto.sdk.ide.utils.YoctoSDKUtils; | ||
39 | |||
40 | public class TargetProfileContributionItem extends CompoundContributionItem implements IWorkbenchContribution { | ||
41 | private IServiceLocator serviceLocator; | ||
42 | |||
43 | public TargetProfileContributionItem() {} | ||
44 | |||
45 | public TargetProfileContributionItem(String id) { | ||
46 | super(id); | ||
47 | } | ||
48 | |||
49 | protected CommandContributionItem createProfileItem(IServiceLocator serviceLocator, | ||
50 | String parameter, String label) { | ||
51 | CommandContributionItemParameter itemParameter; | ||
52 | itemParameter = new CommandContributionItemParameter(serviceLocator, | ||
53 | null, | ||
54 | ProfileSwitchHandler.PROFILE_SWITCH_COMMAND, | ||
55 | CommandContributionItem.STYLE_RADIO); | ||
56 | |||
57 | HashMap<String, String> params = new HashMap<String, String>(); | ||
58 | params.put(RadioState.PARAMETER_ID, parameter); | ||
59 | |||
60 | itemParameter.label = label; | ||
61 | itemParameter.parameters = params; | ||
62 | |||
63 | return new CommandContributionItem(itemParameter); | ||
64 | } | ||
65 | |||
66 | @Override | ||
67 | protected IContributionItem[] getContributionItems() { | ||
68 | TreeSet<String> profiles = YoctoSDKUtils.getProfilesFromDefaultStore().getProfiles(); | ||
69 | ArrayList<IContributionItem> items = new ArrayList<IContributionItem>(); | ||
70 | |||
71 | for (String profile : profiles) { | ||
72 | items.add(createProfileItem(serviceLocator, profile, profile)); | ||
73 | } | ||
74 | |||
75 | updateSelection(serviceLocator); | ||
76 | |||
77 | return items.toArray(new IContributionItem[profiles.size()]); | ||
78 | } | ||
79 | |||
80 | public IProject getSelectedProject(IServiceLocator serviceLocator) { | ||
81 | ISelectionService selectionService = (ISelectionService) serviceLocator.getService(ISelectionService.class); | ||
82 | ISelection selection = selectionService.getSelection(); | ||
83 | |||
84 | if (selection instanceof ITreeSelection) { | ||
85 | Object selectedItem = ((ITreeSelection) selection).getFirstElement(); | ||
86 | if (selectedItem instanceof IResource) { | ||
87 | return ((IResource) selectedItem).getProject(); | ||
88 | } else if (selectedItem instanceof ICElement) { | ||
89 | ICProject cProject = ((ICElement) selectedItem).getCProject(); | ||
90 | if (cProject != null) { | ||
91 | return cProject.getProject(); | ||
92 | } | ||
93 | } else if (selectedItem instanceof IAdaptable) { | ||
94 | Object projectObject = ((IAdaptable) selectedItem).getAdapter(IProject.class); | ||
95 | if (projectObject != null && projectObject instanceof IProject) { | ||
96 | return ((IProject) projectObject); | ||
97 | } | ||
98 | } | ||
99 | } | ||
100 | |||
101 | return null; | ||
102 | } | ||
103 | |||
104 | @Override | ||
105 | public void initialize(IServiceLocator serviceLocator) { | ||
106 | this.serviceLocator = serviceLocator; | ||
107 | } | ||
108 | |||
109 | protected void updateSelection(IServiceLocator serviceLocator) { | ||
110 | ICommandService commandService = (ICommandService) serviceLocator.getService(ICommandService.class); | ||
111 | Command command = commandService.getCommand(ProfileSwitchHandler.PROFILE_SWITCH_COMMAND); | ||
112 | IProject project = getSelectedProject(serviceLocator); | ||
113 | if (project == null) { | ||
114 | return; | ||
115 | } | ||
116 | try { | ||
117 | if (ProjectPreferenceUtils.getUseProjectSpecificOption(project)) { | ||
118 | HandlerUtil.updateRadioState(command, ProfileSwitchHandler.PROJECT_SPECIFIC_PARAMETER); | ||
119 | return; | ||
120 | } | ||
121 | |||
122 | String selectedProfile = ProjectPreferenceUtils.getProfiles(project).getSelectedProfile(); | ||
123 | HandlerUtil.updateRadioState(command, selectedProfile); | ||
124 | } catch (ExecutionException e) { | ||
125 | // ignore | ||
126 | } | ||
127 | } | ||
128 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoGeneralException.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoGeneralException.java new file mode 100644 index 0000000..971425c --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoGeneralException.java | |||
@@ -0,0 +1,32 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide; | ||
12 | |||
13 | /* All specific exceptions raised from yocto project should use | ||
14 | * this specific exception class. | ||
15 | * Currently we only use it for message printing | ||
16 | */ | ||
17 | |||
18 | public class YoctoGeneralException extends Exception { | ||
19 | |||
20 | /** | ||
21 | * | ||
22 | */ | ||
23 | private static final long serialVersionUID = 6600798490815526253L; | ||
24 | /** | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | public YoctoGeneralException(String message) | ||
29 | { | ||
30 | super(message); | ||
31 | } | ||
32 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java new file mode 100644 index 0000000..02626ad --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileElement.java | |||
@@ -0,0 +1,104 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2012 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide; | ||
12 | |||
13 | import java.util.Comparator; | ||
14 | import java.util.StringTokenizer; | ||
15 | import java.util.TreeSet; | ||
16 | |||
17 | import org.yocto.sdk.ide.preferences.PreferenceConstants; | ||
18 | |||
19 | public class YoctoProfileElement { | ||
20 | private TreeSet<String> profiles = new TreeSet<String>(new Comparator<String>() { | ||
21 | |||
22 | @Override | ||
23 | public int compare(String o1, String o2) { | ||
24 | int strcompare = o1.compareTo(o2); | ||
25 | |||
26 | if (strcompare == 0) { | ||
27 | return strcompare; | ||
28 | } | ||
29 | |||
30 | // Standard profile always less than anything else | ||
31 | if (o1.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) { | ||
32 | return -1; | ||
33 | } | ||
34 | |||
35 | if (o2.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) { | ||
36 | return 1; | ||
37 | } | ||
38 | |||
39 | return strcompare; | ||
40 | } | ||
41 | }); | ||
42 | |||
43 | private String selectedProfile; | ||
44 | |||
45 | public YoctoProfileElement(String profilesString, String selectedProfile) { | ||
46 | setProfilesFromString(profilesString); | ||
47 | this.selectedProfile = selectedProfile; | ||
48 | } | ||
49 | |||
50 | public void addProfile(String profile) { | ||
51 | this.profiles.add(profile); | ||
52 | } | ||
53 | |||
54 | public boolean contains(String newText) { | ||
55 | return profiles.contains(newText); | ||
56 | } | ||
57 | |||
58 | public TreeSet<String> getProfiles() { | ||
59 | return profiles; | ||
60 | } | ||
61 | |||
62 | public String getProfilesAsString() { | ||
63 | String profileString = ""; | ||
64 | |||
65 | for (String profile : profiles) { | ||
66 | profileString += "\"" + profile + "\","; | ||
67 | } | ||
68 | return profileString.substring(0, profileString.length() - 1); | ||
69 | } | ||
70 | |||
71 | public String getSelectedProfile() { | ||
72 | return selectedProfile; | ||
73 | } | ||
74 | |||
75 | public void remove(String profile) { | ||
76 | this.profiles.remove(profile); | ||
77 | } | ||
78 | |||
79 | public void rename(String oldProfileName, String newProfileName) { | ||
80 | this.remove(oldProfileName); | ||
81 | this.addProfile(newProfileName); | ||
82 | |||
83 | if (selectedProfile.equals(oldProfileName)) { | ||
84 | selectedProfile = newProfileName; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | public void setProfiles(TreeSet<String> profiles) { | ||
89 | this.profiles = profiles; | ||
90 | } | ||
91 | |||
92 | public void setProfilesFromString(String profilesString) { | ||
93 | StringTokenizer tokenizer = new StringTokenizer(profilesString, ","); | ||
94 | |||
95 | while (tokenizer.hasMoreElements()) { | ||
96 | String config = (String) tokenizer.nextElement(); | ||
97 | profiles.add(config.replace("\"", "")); | ||
98 | } | ||
99 | } | ||
100 | |||
101 | public void setSelectedProfile(String selectedProfile) { | ||
102 | this.selectedProfile = selectedProfile; | ||
103 | } | ||
104 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java new file mode 100644 index 0000000..f56fea4 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProfileSetting.java | |||
@@ -0,0 +1,245 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2012 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide; | ||
12 | |||
13 | import org.eclipse.jface.dialogs.IDialogConstants; | ||
14 | import org.eclipse.jface.dialogs.InputDialog; | ||
15 | import org.eclipse.jface.dialogs.MessageDialog; | ||
16 | import org.eclipse.jface.preference.PreferencePage; | ||
17 | import org.eclipse.swt.SWT; | ||
18 | import org.eclipse.swt.events.MouseAdapter; | ||
19 | import org.eclipse.swt.events.MouseEvent; | ||
20 | import org.eclipse.swt.layout.GridData; | ||
21 | import org.eclipse.swt.layout.GridLayout; | ||
22 | import org.eclipse.swt.widgets.Button; | ||
23 | import org.eclipse.swt.widgets.Combo; | ||
24 | import org.eclipse.swt.widgets.Composite; | ||
25 | import org.eclipse.swt.widgets.Event; | ||
26 | import org.eclipse.swt.widgets.Group; | ||
27 | import org.eclipse.swt.widgets.Listener; | ||
28 | import org.yocto.sdk.ide.preferences.PreferenceConstants; | ||
29 | import org.yocto.sdk.ide.preferences.ProfileNameInputValidator; | ||
30 | import org.yocto.sdk.ide.preferences.YoctoSDKPreferencePage; | ||
31 | import org.yocto.sdk.ide.preferences.YoctoSDKProjectPropertyPage; | ||
32 | |||
33 | public class YoctoProfileSetting { | ||
34 | private static final String PROFILES_TITLE = "Preferences.Profiles.Title"; | ||
35 | private static final String NEW_PROFILE_TITLE = "Preferences.Profile.New.Title"; | ||
36 | private static final String RENAME_PROFILE_TITLE = "Preferences.Profile.Rename.Title"; | ||
37 | private static final String RENAME_DIALOG_TITLE = "Preferences.Profile.Rename.Dialog.Title"; | ||
38 | private static final String RENAME_DIALOG_MESSAGE = "Preferences.Profile.Rename.Dialog.Message"; | ||
39 | private static final String REMOVE_PROFILE_TITLE = "Preferences.Profile.Remove.Title"; | ||
40 | private static final String REMOVE_DIALOG_TITLE = "Preferences.Profile.Remove.Dialog.Title"; | ||
41 | private static final String REMOVE_DIALOG_MESSAGE = "Preferences.Profile.Remove.Dialog.Message"; | ||
42 | private static final String MODIFY_STANDARD_TITLE = "Preferences.Profile.Standard.Modification.Title"; | ||
43 | private static final String MODIFY_STANDARD_MESSAGE = "Preferences.Profile.Standard.Modification.Message"; | ||
44 | |||
45 | private Combo sdkConfigsCombo; | ||
46 | private Button btnConfigRename; | ||
47 | private Button btnConfigRemove; | ||
48 | private Button btnConfigSaveAs; | ||
49 | |||
50 | private YoctoProfileElement profileElement; | ||
51 | private PreferencePage preferencePage; | ||
52 | private final boolean editable; | ||
53 | |||
54 | public YoctoProfileSetting(YoctoProfileElement profileElement, PreferencePage preferencePage, final boolean editable) { | ||
55 | this.profileElement = profileElement; | ||
56 | this.preferencePage = preferencePage; | ||
57 | this.editable = editable; | ||
58 | } | ||
59 | |||
60 | public void createComposite(Composite composite) { | ||
61 | GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); | ||
62 | GridLayout layout = new GridLayout(2, false); | ||
63 | |||
64 | Group storeYoctoConfigurationsGroup = new Group (composite, SWT.NONE); | ||
65 | layout = new GridLayout(1, false); | ||
66 | if (isEditable()) { | ||
67 | layout.numColumns = 3; | ||
68 | } | ||
69 | |||
70 | storeYoctoConfigurationsGroup.setLayout(layout); | ||
71 | gd = new GridData(SWT.FILL, SWT.CENTER, true, false); | ||
72 | gd.horizontalSpan = 2; | ||
73 | storeYoctoConfigurationsGroup.setLayoutData(gd); | ||
74 | storeYoctoConfigurationsGroup.setText(YoctoSDKMessages.getString(PROFILES_TITLE)); | ||
75 | |||
76 | sdkConfigsCombo = new Combo(storeYoctoConfigurationsGroup, SWT.READ_ONLY); | ||
77 | addConfigs(sdkConfigsCombo); | ||
78 | sdkConfigsCombo.select(sdkConfigsCombo.indexOf(profileElement.getSelectedProfile())); | ||
79 | sdkConfigsCombo.setLayout(new GridLayout(2, false)); | ||
80 | sdkConfigsCombo.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); | ||
81 | |||
82 | Listener selectionListener = new Listener() { | ||
83 | @Override | ||
84 | public void handleEvent(Event event) { | ||
85 | Object source = event.widget; | ||
86 | if (!(source instanceof Combo)) { | ||
87 | return; | ||
88 | } | ||
89 | |||
90 | Combo sdkCombo = (Combo) source; | ||
91 | if (sdkCombo.getSelectionIndex() < 0) { | ||
92 | return; | ||
93 | } | ||
94 | |||
95 | String selectedItem = sdkCombo.getItem(sdkCombo.getSelectionIndex()); | ||
96 | profileElement.setSelectedProfile(selectedItem); | ||
97 | |||
98 | if (preferencePage instanceof YoctoSDKPreferencePage) { | ||
99 | ((YoctoSDKPreferencePage) preferencePage).switchProfile(selectedItem); | ||
100 | } else if (preferencePage instanceof YoctoSDKProjectPropertyPage) { | ||
101 | ((YoctoSDKProjectPropertyPage) preferencePage).switchProfile(selectedItem); | ||
102 | } | ||
103 | } | ||
104 | }; | ||
105 | |||
106 | sdkConfigsCombo.addListener(SWT.Selection, selectionListener); | ||
107 | sdkConfigsCombo.addListener(SWT.Modify, selectionListener); | ||
108 | |||
109 | if (isEditable()) { | ||
110 | createSaveAsProfileButton(storeYoctoConfigurationsGroup); | ||
111 | createRenameButton(storeYoctoConfigurationsGroup); | ||
112 | createRemoveButton(storeYoctoConfigurationsGroup); | ||
113 | } | ||
114 | } | ||
115 | |||
116 | private void createSaveAsProfileButton(Group storeYoctoConfigurationsGroup) { | ||
117 | btnConfigSaveAs = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD); | ||
118 | btnConfigSaveAs.setText(YoctoSDKMessages.getString(NEW_PROFILE_TITLE)); | ||
119 | btnConfigSaveAs.addMouseListener(new MouseAdapter() { | ||
120 | @Override | ||
121 | public void mouseDown(MouseEvent e) { | ||
122 | if (preferencePage instanceof YoctoSDKPreferencePage) { | ||
123 | ((YoctoSDKPreferencePage) preferencePage).performSaveAs(); | ||
124 | } | ||
125 | } | ||
126 | }); | ||
127 | } | ||
128 | |||
129 | private void createRemoveButton(Group storeYoctoConfigurationsGroup) { | ||
130 | btnConfigRemove = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD); | ||
131 | btnConfigRemove.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, false, 3, 1)); | ||
132 | btnConfigRemove.setText(YoctoSDKMessages.getString(REMOVE_PROFILE_TITLE)); | ||
133 | btnConfigRemove.addMouseListener(new MouseAdapter() { | ||
134 | @Override | ||
135 | public void mouseDown(MouseEvent e) { | ||
136 | saveChangesOnCurrentProfile(); | ||
137 | int selectionIndex = sdkConfigsCombo.getSelectionIndex(); | ||
138 | String selectedItem = sdkConfigsCombo.getItem(selectionIndex); | ||
139 | |||
140 | if (selectedItem.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) { | ||
141 | MessageDialog.openInformation(null, | ||
142 | YoctoSDKMessages.getString(MODIFY_STANDARD_TITLE), | ||
143 | YoctoSDKMessages.getString(MODIFY_STANDARD_MESSAGE)); | ||
144 | return; | ||
145 | } | ||
146 | |||
147 | boolean deleteConfirmed = | ||
148 | MessageDialog.openConfirm(null, | ||
149 | YoctoSDKMessages.getString(REMOVE_DIALOG_TITLE), | ||
150 | YoctoSDKMessages.getFormattedString(REMOVE_DIALOG_MESSAGE, selectedItem)); | ||
151 | |||
152 | if (!deleteConfirmed) { | ||
153 | return; | ||
154 | } | ||
155 | |||
156 | sdkConfigsCombo.select(0); | ||
157 | sdkConfigsCombo.remove(selectionIndex); | ||
158 | profileElement.remove(selectedItem); | ||
159 | |||
160 | if (preferencePage instanceof YoctoSDKPreferencePage) { | ||
161 | ((YoctoSDKPreferencePage) preferencePage).deleteProfile(selectedItem); | ||
162 | } | ||
163 | } | ||
164 | }); | ||
165 | } | ||
166 | |||
167 | private void createRenameButton(Group storeYoctoConfigurationsGroup) { | ||
168 | btnConfigRename = new Button(storeYoctoConfigurationsGroup, SWT.PUSH | SWT.LEAD); | ||
169 | btnConfigRename.setText(YoctoSDKMessages.getString(RENAME_PROFILE_TITLE)); | ||
170 | btnConfigRename.addMouseListener(new MouseAdapter() { | ||
171 | @Override | ||
172 | public void mouseDown(MouseEvent e) { | ||
173 | saveChangesOnCurrentProfile(); | ||
174 | int selectedIndex = sdkConfigsCombo.getSelectionIndex(); | ||
175 | final String selectedItem = sdkConfigsCombo.getItem(selectedIndex); | ||
176 | |||
177 | if (selectedItem.equals(PreferenceConstants.STANDARD_PROFILE_NAME)) { | ||
178 | MessageDialog.openInformation(null, | ||
179 | YoctoSDKMessages.getString(MODIFY_STANDARD_TITLE), | ||
180 | YoctoSDKMessages.getString(MODIFY_STANDARD_MESSAGE)); | ||
181 | return; | ||
182 | } | ||
183 | |||
184 | InputDialog profileNameDialog = | ||
185 | new InputDialog(null, | ||
186 | YoctoSDKMessages.getString(RENAME_DIALOG_TITLE), | ||
187 | YoctoSDKMessages.getString(RENAME_DIALOG_MESSAGE), | ||
188 | null, | ||
189 | new ProfileNameInputValidator(profileElement, selectedItem)); | ||
190 | |||
191 | int returnCode = profileNameDialog.open(); | ||
192 | if (returnCode == IDialogConstants.CANCEL_ID) { | ||
193 | return; | ||
194 | } | ||
195 | |||
196 | String newProfileName = profileNameDialog.getValue(); | ||
197 | profileElement.rename(selectedItem, profileNameDialog.getValue()); | ||
198 | |||
199 | if (preferencePage instanceof YoctoSDKPreferencePage) { | ||
200 | ((YoctoSDKPreferencePage) preferencePage).renameProfile(selectedItem, newProfileName); | ||
201 | } | ||
202 | |||
203 | sdkConfigsCombo.setItem(selectedIndex, newProfileName); | ||
204 | sdkConfigsCombo.select(selectedIndex); | ||
205 | } | ||
206 | }); | ||
207 | } | ||
208 | |||
209 | private void saveChangesOnCurrentProfile() { | ||
210 | preferencePage.performOk(); | ||
211 | } | ||
212 | |||
213 | private void addConfigs(Combo combo) { | ||
214 | for (String profile : profileElement.getProfiles()) { | ||
215 | combo.add(profile); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | public void addProfile(String profileName) { | ||
220 | int index = sdkConfigsCombo.getItemCount(); | ||
221 | sdkConfigsCombo.add(profileName, index); | ||
222 | sdkConfigsCombo.select(index); | ||
223 | } | ||
224 | |||
225 | public void setUIFormEnabledState(boolean isEnabled) { | ||
226 | setButtonsEnabledState(isEnabled); | ||
227 | sdkConfigsCombo.setEnabled(isEnabled); | ||
228 | } | ||
229 | |||
230 | public YoctoProfileElement getCurrentInput() { | ||
231 | return profileElement; | ||
232 | } | ||
233 | |||
234 | public void setButtonsEnabledState(boolean isEnabled) { | ||
235 | if (isEditable()) { | ||
236 | btnConfigRename.setEnabled(isEnabled); | ||
237 | btnConfigRemove.setEnabled(isEnabled); | ||
238 | btnConfigSaveAs.setEnabled(isEnabled); | ||
239 | } | ||
240 | } | ||
241 | |||
242 | private boolean isEditable() { | ||
243 | return editable; | ||
244 | } | ||
245 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java new file mode 100644 index 0000000..2a55a64 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoProjectSpecificSetting.java | |||
@@ -0,0 +1,88 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2012 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide; | ||
12 | |||
13 | import org.eclipse.jface.preference.PreferencePage; | ||
14 | import org.eclipse.swt.SWT; | ||
15 | import org.eclipse.swt.events.SelectionEvent; | ||
16 | import org.eclipse.swt.events.SelectionListener; | ||
17 | import org.eclipse.swt.layout.GridData; | ||
18 | import org.eclipse.swt.layout.GridLayout; | ||
19 | import org.eclipse.swt.widgets.Button; | ||
20 | import org.eclipse.swt.widgets.Composite; | ||
21 | import org.eclipse.swt.widgets.Group; | ||
22 | import org.yocto.sdk.ide.preferences.YoctoSDKProjectPropertyPage; | ||
23 | |||
24 | public class YoctoProjectSpecificSetting { | ||
25 | private static final String PROJECT_SPECIFIC_TITLE = "Preferences.Profile.ProjectSpecific.Title"; | ||
26 | private static final String PROJECT_SPECIFIC_GROUP_TITLE = "Preferences.Profile.ProjectSpecific.Group.Title"; | ||
27 | |||
28 | private YoctoProfileSetting yoctoConfigurationsSetting; | ||
29 | private YoctoUISetting yoctoUISetting; | ||
30 | |||
31 | private Button btnUseProjectSpecificSettingsCheckbox; | ||
32 | private PreferencePage preferencePage; | ||
33 | |||
34 | public YoctoProjectSpecificSetting(YoctoProfileSetting yoctoConfigurationsSetting, | ||
35 | YoctoUISetting yoctoUISetting, PreferencePage preferencePage) { | ||
36 | this.yoctoConfigurationsSetting = yoctoConfigurationsSetting; | ||
37 | this.yoctoUISetting = yoctoUISetting; | ||
38 | this.preferencePage = preferencePage; | ||
39 | } | ||
40 | |||
41 | public void createComposite(Composite composite) { | ||
42 | GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); | ||
43 | GridLayout layout = new GridLayout(2, false); | ||
44 | |||
45 | Group storeYoctoConfigurationsGroup = new Group (composite, SWT.NONE); | ||
46 | layout = new GridLayout(2, false); | ||
47 | storeYoctoConfigurationsGroup.setLayout(layout); | ||
48 | gd = new GridData(SWT.FILL, SWT.CENTER, true, false); | ||
49 | gd.horizontalSpan = 2; | ||
50 | storeYoctoConfigurationsGroup.setLayoutData(gd); | ||
51 | storeYoctoConfigurationsGroup.setText(YoctoSDKMessages.getString(PROJECT_SPECIFIC_GROUP_TITLE)); | ||
52 | |||
53 | btnUseProjectSpecificSettingsCheckbox = new Button(storeYoctoConfigurationsGroup, SWT.CHECK); | ||
54 | btnUseProjectSpecificSettingsCheckbox.setText(YoctoSDKMessages.getString(PROJECT_SPECIFIC_TITLE)); | ||
55 | btnUseProjectSpecificSettingsCheckbox.addSelectionListener(new SelectionListener() { | ||
56 | @Override | ||
57 | public void widgetSelected(SelectionEvent e) { | ||
58 | if (btnUseProjectSpecificSettingsCheckbox.getSelection()){ | ||
59 | yoctoConfigurationsSetting.setUIFormEnabledState(false); | ||
60 | yoctoUISetting.setUIFormEnabledState(true); | ||
61 | |||
62 | if (preferencePage instanceof YoctoSDKProjectPropertyPage) { | ||
63 | ((YoctoSDKProjectPropertyPage) preferencePage).switchToProjectSpecificProfile(); | ||
64 | } | ||
65 | } else { | ||
66 | yoctoConfigurationsSetting.setUIFormEnabledState(true); | ||
67 | yoctoConfigurationsSetting.setButtonsEnabledState(false); | ||
68 | yoctoUISetting.setUIFormEnabledState(false); | ||
69 | |||
70 | if (preferencePage instanceof YoctoSDKProjectPropertyPage) { | ||
71 | ((YoctoSDKProjectPropertyPage) preferencePage).switchToSelectedProfile(); | ||
72 | } | ||
73 | } | ||
74 | } | ||
75 | |||
76 | @Override | ||
77 | public void widgetDefaultSelected(SelectionEvent e) {} | ||
78 | }); | ||
79 | } | ||
80 | |||
81 | public void setUseProjectSpecificSettings(boolean isUsingProjectSpecificSettings) { | ||
82 | btnUseProjectSpecificSettingsCheckbox.setSelection(isUsingProjectSpecificSettings); | ||
83 | } | ||
84 | |||
85 | public boolean isUsingProjectSpecificSettings() { | ||
86 | return btnUseProjectSpecificSettingsCheckbox.getSelection(); | ||
87 | } | ||
88 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java new file mode 100644 index 0000000..714470b --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKChecker.java | |||
@@ -0,0 +1,291 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
4 | * | ||
5 | * All rights reserved. This program and the accompanying materials | ||
6 | * are made available under the terms of the Eclipse Public License v1.0 | ||
7 | * which accompanies this distribution, and is available at | ||
8 | * http://www.eclipse.org/legal/epl-v10.html | ||
9 | * | ||
10 | * Contributors: | ||
11 | * Intel - initial API and implementation | ||
12 | * BMW Car IT - include error and advice messages with check results | ||
13 | *******************************************************************************/ | ||
14 | package org.yocto.sdk.ide; | ||
15 | |||
16 | import java.io.BufferedReader; | ||
17 | import java.io.File; | ||
18 | import java.io.FileReader; | ||
19 | import java.io.FilenameFilter; | ||
20 | import java.io.IOException; | ||
21 | import java.io.InputStream; | ||
22 | import java.io.InputStreamReader; | ||
23 | |||
24 | import org.eclipse.jface.preference.IPreferenceStore; | ||
25 | import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; | ||
26 | import org.yocto.sdk.ide.utils.YoctoSDKUtils; | ||
27 | import org.yocto.sdk.ide.utils.YoctoSDKUtilsConstants; | ||
28 | |||
29 | public class YoctoSDKChecker { | ||
30 | private static final String[] saInvalidVer = {"1.0", "0.9", "0.9+"}; | ||
31 | private static final String SYSROOTS_DIR = "sysroots"; | ||
32 | private static final String SDK_VERSION = "OECORE_SDK_VERSION"; | ||
33 | |||
34 | public static enum SDKCheckResults { | ||
35 | SDK_PASS("", false), | ||
36 | TOOLCHAIN_LOCATION_EMPTY( | ||
37 | "Poky.SDK.Location.Empty", true), | ||
38 | TOOLCHAIN_LOCATION_NONEXIST( | ||
39 | "Poky.SDK.Location.Nonexist", true), | ||
40 | SDK_TARGET_EMPTY( | ||
41 | "Poky.SDK.Target.Empty", true), | ||
42 | SDK_NO_TARGET_SELECTED( | ||
43 | "Poky.SDK.No.Target.Selected", false), | ||
44 | SYSROOT_EMPTY( | ||
45 | "Poky.Sysroot.Empty", true), | ||
46 | SYSROOT_NONEXIST( | ||
47 | "Poky.Sysroot.Nonexist", true), | ||
48 | QEMU_KERNEL_EMPTY( | ||
49 | "Poky.Qemu.Kernel.Empty", true), | ||
50 | QEMU_KERNEL_NONEXIST( | ||
51 | "Poky.Qemu.Kernel.Nonexist", true), | ||
52 | WRONG_ADT_VERSION( | ||
53 | "Poky.ADT.Sysroot.Wrongversion", false), | ||
54 | ENV_SETUP_SCRIPT_NONEXIST( | ||
55 | "Poky.Env.Script.Nonexist", false), | ||
56 | TOOLCHAIN_NO_SYSROOT( | ||
57 | "Poky.Toolchain.No.Sysroot", false), | ||
58 | TOOLCHAIN_HOST_MISMATCH( | ||
59 | "Poky.Toolchain.Host.Mismatch", false); | ||
60 | |||
61 | private static final String DEFAULT_ADVICE = "Default.Advice"; | ||
62 | private static final String ADVICE_SUFFIX = ".Advice"; | ||
63 | |||
64 | private final String messageID; | ||
65 | private final boolean addDefaultAdvice; | ||
66 | |||
67 | private SDKCheckResults(final String messageID, final boolean addDefaultAdvice) { | ||
68 | this.messageID = messageID; | ||
69 | this.addDefaultAdvice = addDefaultAdvice; | ||
70 | } | ||
71 | |||
72 | public String getMessage() { | ||
73 | return YoctoSDKMessages.getString(messageID); | ||
74 | } | ||
75 | |||
76 | public String getAdvice() { | ||
77 | String advice = YoctoSDKMessages.getString(messageID + ADVICE_SUFFIX); | ||
78 | |||
79 | if (addDefaultAdvice) { | ||
80 | advice += YoctoSDKMessages.getString(DEFAULT_ADVICE); | ||
81 | } | ||
82 | |||
83 | return advice; | ||
84 | } | ||
85 | }; | ||
86 | |||
87 | public static enum SDKCheckRequestFrom { | ||
88 | Wizard("Poky.SDK.Error.Origin.Wizard"), | ||
89 | Menu("Poky.SDK.Error.Origin.Menu"), | ||
90 | Preferences("Poky.SDK.Error.Origin.Preferences"), | ||
91 | Other("Poky.SDK.Error.Origin.Other"); | ||
92 | |||
93 | private final String errorMessageID; | ||
94 | |||
95 | private SDKCheckRequestFrom(final String errorMessageID) { | ||
96 | this.errorMessageID = errorMessageID; | ||
97 | } | ||
98 | |||
99 | public String getErrorMessage() { | ||
100 | return YoctoSDKMessages.getString(errorMessageID); | ||
101 | } | ||
102 | }; | ||
103 | |||
104 | public static void checkIfGloballySelectedYoctoProfileIsValid() throws YoctoGeneralException { | ||
105 | YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore(); | ||
106 | IPreferenceStore selectedProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile()); | ||
107 | YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selectedProfileStore); | ||
108 | |||
109 | SDKCheckResults result = checkYoctoSDK(elem); | ||
110 | if (result != SDKCheckResults.SDK_PASS){ | ||
111 | String strErrorMsg = getErrorMessage(result, SDKCheckRequestFrom.Wizard); | ||
112 | throw new YoctoGeneralException(strErrorMsg); | ||
113 | } | ||
114 | } | ||
115 | |||
116 | public static SDKCheckResults checkYoctoSDK(YoctoUIElement elem) { | ||
117 | if (elem.getStrToolChainRoot().isEmpty()) | ||
118 | return SDKCheckResults.TOOLCHAIN_LOCATION_EMPTY; | ||
119 | else { | ||
120 | File fToolChain = new File(elem.getStrToolChainRoot()); | ||
121 | if (!fToolChain.exists()) | ||
122 | return SDKCheckResults.TOOLCHAIN_LOCATION_NONEXIST; | ||
123 | } | ||
124 | |||
125 | if (elem.getStrSysrootLoc().isEmpty()) { | ||
126 | return SDKCheckResults.SYSROOT_EMPTY; | ||
127 | } else { | ||
128 | File fSysroot = new File(elem.getStrSysrootLoc()); | ||
129 | if (!fSysroot.exists()) | ||
130 | return SDKCheckResults.SYSROOT_NONEXIST; | ||
131 | } | ||
132 | |||
133 | if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { | ||
134 | //Check for SDK compatible with the host arch | ||
135 | String platform = getPlatformArch(); | ||
136 | String sysroot_dir_str = elem.getStrToolChainRoot() + "/" + SYSROOTS_DIR; | ||
137 | File sysroot_dir = new File(sysroot_dir_str); | ||
138 | if (!sysroot_dir.exists()) | ||
139 | return SDKCheckResults.TOOLCHAIN_NO_SYSROOT; | ||
140 | |||
141 | String toolchain_host_arch = null; | ||
142 | |||
143 | try { | ||
144 | toolchain_host_arch = findHostArch(sysroot_dir); | ||
145 | } catch(NullPointerException e) { | ||
146 | return SDKCheckResults.TOOLCHAIN_NO_SYSROOT; | ||
147 | } | ||
148 | |||
149 | if (!toolchain_host_arch.equalsIgnoreCase(platform)) { | ||
150 | if (!platform.matches("i\\d86") || !toolchain_host_arch.matches("i\\d86")) | ||
151 | return SDKCheckResults.TOOLCHAIN_HOST_MISMATCH; | ||
152 | } | ||
153 | } | ||
154 | |||
155 | if (elem.getStrTarget().isEmpty() && elem.getStrTargetsArray().length > 0) { | ||
156 | return SDKCheckResults.SDK_NO_TARGET_SELECTED; | ||
157 | } | ||
158 | |||
159 | if (elem.getIntTargetIndex() < 0 || elem.getStrTarget().isEmpty()) { | ||
160 | //if this is poky tree mode, prompt user whether bitbake meta-ide-support is executed? | ||
161 | if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_TREE_MODE) | ||
162 | return SDKCheckResults.ENV_SETUP_SCRIPT_NONEXIST; | ||
163 | else | ||
164 | return SDKCheckResults.SDK_TARGET_EMPTY; | ||
165 | } else { | ||
166 | String sFileName; | ||
167 | |||
168 | if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { | ||
169 | sFileName = elem.getStrToolChainRoot()+"/" + YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget(); | ||
170 | } else { | ||
171 | //POKY TREE Mode | ||
172 | sFileName = elem.getStrToolChainRoot() + YoctoSDKUtilsConstants.DEFAULT_TMP_PREFIX + | ||
173 | YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget(); | ||
174 | } | ||
175 | |||
176 | try { | ||
177 | File file = new File(sFileName); | ||
178 | boolean bVersion = false; | ||
179 | |||
180 | if (file.exists()) { | ||
181 | BufferedReader input = new BufferedReader(new FileReader(file)); | ||
182 | |||
183 | try { | ||
184 | String line = null; | ||
185 | |||
186 | while ((line = input.readLine()) != null) { | ||
187 | if (line.startsWith("export "+ SDK_VERSION)) { | ||
188 | int beginIndex = 2; | ||
189 | String sVersion = ""; | ||
190 | for (;;) { | ||
191 | char cValue = line.charAt(line.indexOf('=') + beginIndex++); | ||
192 | |||
193 | if ((cValue != '.') && (!Character.isDigit(cValue)) && (cValue != '+')) | ||
194 | break; | ||
195 | else | ||
196 | sVersion += String.valueOf(cValue); | ||
197 | } | ||
198 | |||
199 | for (int i = 0; i < saInvalidVer.length; i++) { | ||
200 | if (!sVersion.equals(saInvalidVer[i])) { | ||
201 | bVersion = true; | ||
202 | break; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | break; | ||
207 | } | ||
208 | } | ||
209 | } finally { | ||
210 | input.close(); | ||
211 | } | ||
212 | |||
213 | if (!bVersion) | ||
214 | return SDKCheckResults.WRONG_ADT_VERSION; | ||
215 | } | ||
216 | } catch (IOException e) { | ||
217 | e.printStackTrace(); | ||
218 | } | ||
219 | } | ||
220 | |||
221 | if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) { | ||
222 | if (elem.getStrQemuKernelLoc().isEmpty()) { | ||
223 | return SDKCheckResults.QEMU_KERNEL_EMPTY; | ||
224 | } else { | ||
225 | File fQemuKernel = new File(elem.getStrQemuKernelLoc()); | ||
226 | if (!fQemuKernel.exists()) | ||
227 | return SDKCheckResults.QEMU_KERNEL_NONEXIST; | ||
228 | } | ||
229 | } | ||
230 | |||
231 | return SDKCheckResults.SDK_PASS; | ||
232 | } | ||
233 | |||
234 | public static String getErrorMessage(SDKCheckResults result, SDKCheckRequestFrom from) { | ||
235 | String strErrorMsg; | ||
236 | strErrorMsg = from.getErrorMessage(); | ||
237 | strErrorMsg += "\n" + result.getMessage(); | ||
238 | strErrorMsg += "\n" + result.getAdvice(); | ||
239 | |||
240 | return strErrorMsg; | ||
241 | } | ||
242 | |||
243 | private static String getPlatformArch() { | ||
244 | String value = null; | ||
245 | try | ||
246 | { | ||
247 | Runtime rt = Runtime.getRuntime(); | ||
248 | Process proc = rt.exec("uname -m"); | ||
249 | InputStream stdin = proc.getInputStream(); | ||
250 | InputStreamReader isr = new InputStreamReader(stdin); | ||
251 | BufferedReader br = new BufferedReader(isr); | ||
252 | String line = null; | ||
253 | |||
254 | while ( (line = br.readLine()) != null) { | ||
255 | value = line; | ||
256 | } | ||
257 | proc.waitFor(); | ||
258 | |||
259 | } catch (Throwable t) { | ||
260 | t.printStackTrace(); | ||
261 | } | ||
262 | return value; | ||
263 | } | ||
264 | |||
265 | private static String findHostArch(File sysroot_dir) { | ||
266 | FilenameFilter nativeFilter = new FilenameFilter() { | ||
267 | public boolean accept(File dir, String name) { | ||
268 | if (name.endsWith("sdk-linux")) { | ||
269 | return true; | ||
270 | } else { | ||
271 | return false; | ||
272 | } | ||
273 | } | ||
274 | }; | ||
275 | |||
276 | File[] files = sysroot_dir.listFiles(nativeFilter); | ||
277 | String arch = null; | ||
278 | |||
279 | for (File file : files) { | ||
280 | if (file.isDirectory()) { | ||
281 | String path = file.getName(); | ||
282 | String[] subPath = path.split("-"); | ||
283 | arch = subPath[0]; | ||
284 | } else { | ||
285 | continue; | ||
286 | } | ||
287 | } | ||
288 | |||
289 | return arch; | ||
290 | } | ||
291 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.java new file mode 100644 index 0000000..8fe40d3 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.java | |||
@@ -0,0 +1,56 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide; | ||
12 | |||
13 | import java.text.MessageFormat; | ||
14 | import java.util.MissingResourceException; | ||
15 | import java.util.ResourceBundle; | ||
16 | |||
17 | public class YoctoSDKMessages { | ||
18 | private static final String RESOURCE_BUNDLE= YoctoSDKMessages.class.getName(); | ||
19 | private static ResourceBundle fgResourceBundle; | ||
20 | static { | ||
21 | try { | ||
22 | fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE); | ||
23 | } catch (MissingResourceException x) { | ||
24 | fgResourceBundle = null; | ||
25 | } | ||
26 | } | ||
27 | |||
28 | private YoctoSDKMessages() { | ||
29 | } | ||
30 | |||
31 | public static String getString(String key) { | ||
32 | try { | ||
33 | return fgResourceBundle.getString(key); | ||
34 | } catch (MissingResourceException e) { | ||
35 | return '!' + key + '!'; | ||
36 | } catch (NullPointerException e) { | ||
37 | return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$ | ||
38 | } | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * Gets a string from the resource bundle and formats it with the argument | ||
43 | * | ||
44 | * @param key the string used to get the bundle value, must not be null | ||
45 | */ | ||
46 | public static String getFormattedString(String key, Object arg) { | ||
47 | return MessageFormat.format(getString(key), new Object[] { arg }); | ||
48 | } | ||
49 | |||
50 | /** | ||
51 | * Gets a string from the resource bundle and formats it with arguments | ||
52 | */ | ||
53 | public static String getFormattedString(String key, Object[] args) { | ||
54 | return MessageFormat.format(getString(key), args); | ||
55 | } | ||
56 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties new file mode 100644 index 0000000..e3f3308 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKMessages.properties | |||
@@ -0,0 +1,107 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | * BMW Car IT - added keys for target profiles | ||
11 | *******************************************************************************/ | ||
12 | Wizard.SDK.Warning.Title = Invalid Yocto Project ADT Location | ||
13 | Wizard.SDK.Error.ProjectName = Project name "{0}" is invalid! \nNone of these characters are accepted inside project names: whitespaces, {1} | ||
14 | |||
15 | Poky.SDK.Location.Empty = Specified Toolchain Root Location is empty. | ||
16 | Poky.SDK.Location.Empty.Advice = You need specify Toolchain Root Location before building any project. | ||
17 | Poky.SDK.Location.Nonexist = Specified SDK toolchain directory does not exist. | ||
18 | Poky.SDK.Location.Nonexist.Advice = Please specify a valid toolchain directory. | ||
19 | Poky.SDK.Target.Empty = Specified location does not contain environment script file. | ||
20 | Poky.SDK.Target.Empty.Advice = You need specify Target Architecture before building any project. | ||
21 | Poky.SDK.No.Target.Selected = Target Architecture is not defined. | ||
22 | Poky.SDK.No.Target.Selected.Advice = Please choose a Target Architecture. | ||
23 | Poky.Sysroot.Empty = Specified Sysroot Location is empty. | ||
24 | Poky.Sysroot.Empty.Advice = You need specify Sysroot Location before building any project. | ||
25 | Poky.Sysroot.Nonexist = Specified Sysroot Location does not exist. | ||
26 | Poky.Sysroot.Nonexist.Advice = You need specify a valid Sysroot Location before building any project. | ||
27 | Poky.Qemu.Kernel.Empty = Specified QEMU kernel location is emtpy. | ||
28 | Poky.Qemu.Kernel.Empty.Advice = You need specify QEMU kernel image file Location before building any project. | ||
29 | Poky.Qemu.Kernel.Nonexist = Specified QEMU kernel image file does not exist. | ||
30 | Poky.Qemu.Kernel.Empty.Advice = You need specify a valid QEMU kernel image file before building any project. | ||
31 | Poky.ADT.Sysroot.Wrongversion = The ADT version you're using is too old. | ||
32 | Poky.ADT.Sysroot.Wrongversion.Advice = OECORE related items are not found in environment setup files.\nPlease upgrade to our latest ADT Version! | ||
33 | Poky.Env.Script.Nonexist = Specified toolchain directory does not contain a toolchain generated with "bitbake meta-ide-support". | ||
34 | Poky.Env.Script.Nonexist.Advice = Please run "bitbake meta-ide-support" to build the toolchain. | ||
35 | Poky.Toolchain.No.Sysroot = Specified Toolchain Root Location does not contain a sysroot directory. | ||
36 | Poky.Toolchain.No.Sysroot.Advice = Please install a valid toolchain sysroot. | ||
37 | Poky.Toolchain.Host.Mismatch = Toolchain and host arch mismatch. | ||
38 | Poky.Toolchain.Host.Mismatch.Advice = Make sure you use 32bit toolchain for 32bit host and same for 64bit machines! | ||
39 | |||
40 | Default.Advice = \nDo IDE-wide settings from Window > Preferences > Yocto Project ADT\nOr do Project-wide settings from Project > Change Yocto Project Settings. | ||
41 | Poky.SDK.Revalidation.Message = Please apply the changes to revalidate. | ||
42 | |||
43 | Poky.SDK.Error.Origin.Wizard = Yocto Wizard Configuration Error: | ||
44 | Poky.SDK.Error.Origin.Menu = Yocto Menu Configuration Error: | ||
45 | Poky.SDK.Error.Origin.Preferences = Yocto Preferences Configuration Error: | ||
46 | Poky.SDK.Error.Origin.Other = Yocto Configuration Error: | ||
47 | |||
48 | Menu.SDK.Console.Configure.Message = The Yocto Project ADT has been successfully set up for this project.\nTo see the environment variables created during setup,\ngo to Project > Properties > C/C++ Build > Environment. | ||
49 | Menu.SDK.Console.Deploy.Action.Message = \nDeploying {0} to {1} ...\n | ||
50 | Menu.SDK.Console.Deploy.Extract.Message = \nExtracting {0} into {1} ...\n | ||
51 | Menu.SDK.Console.Deploy.Success.Message = \nThe project {0} has been successfully deployed to {1}\n | ||
52 | Menu.SDK.Console.Deploy.Fail.Message = \nDeploying the project {0} to {1} failed!\n | ||
53 | Menu.SDK.Console.Undeploy.Success.Message = \nThe project {0} has been successfully undeployed from {1}\n | ||
54 | Menu.SDK.Console.Undeploy.Fail.Message = \nUndeploying the project {0} from {1} failed!\n | ||
55 | |||
56 | |||
57 | Menu.Deploy.Title = Deploy {0} to ... | ||
58 | Menu.Deploy.Message = Please specify a directory: | ||
59 | |||
60 | Menu.Undeploy.Title = Undeploy {0} from ... | ||
61 | Menu.Undeploy.Message = Please specify a directory: | ||
62 | |||
63 | |||
64 | Preferences.Yocto.Config.Name = Preferences: | ||
65 | Preferences.SDK.Target.name = Target Preferences: | ||
66 | Preferences.SDK.Informing.Title = Yocto Project ADT has been successfully set up. | ||
67 | Preferences.SDK.Informing.Message = You might need to reconfigure your existing Yocto Project Autotools Projects to use the Yocto Project ADT. Do this from Project > Reconfigure Project! | ||
68 | |||
69 | Preferences.Profile.Validator.InvalidName.Comma = Warning: The profile name cannot contain a comma (,). | ||
70 | Preferences.Profile.Validator.InvalidName.Quote = Warning: The profile name cannot contain a double quote (\"). | ||
71 | Preferences.Profile.Validator.InvalidName.Empty = Please provide a new profile name. | ||
72 | Preferences.Profile.Validator.InvalidName.Exists = Warning: The profile already exists. | ||
73 | |||
74 | Preferences.Profiles.Title = Cross development profiles: | ||
75 | Preferences.Profile.New.Title = Save as ... | ||
76 | Preferences.Profile.New.Dialog.Title = Save as new cross development profile | ||
77 | Preferences.Profile.New.Dialog.Message = Please input a profile name. | ||
78 | Preferences.Profile.Rename.Title = Rename | ||
79 | Preferences.Profile.Rename.Dialog.Title = Rename cross development profile | ||
80 | Preferences.Profile.Rename.Dialog.Message = Please input a new profile name. | ||
81 | Preferences.Profile.Remove.Title = Remove | ||
82 | Preferences.Profile.Remove.Dialog.Title = Remove cross development profile | ||
83 | Preferences.Profile.Remove.Dialog.Message = Do you really want to the remove the cross development profile "{0}"?\nProjects using this cross development profile will be reconfigured to use the standard profile. | ||
84 | Preferences.Profile.Update.Dialog.Title = Update cross development profile | ||
85 | Preferences.Profile.Update.Dialog.Message = Do you really want to the update the cross development profile "{0}"?\nProjects using this cross development profile will be reconfigured. | ||
86 | Preferences.Profile.Standard.Modification.Title = Modify standard cross development profile | ||
87 | Preferences.Profile.Standard.Modification.Message = Standard cross development profile cannot be removed or renamed. | ||
88 | |||
89 | Preferences.Profile.ProjectSpecific.Title = Use project specific settings | ||
90 | Preferences.Profile.ProjectSpecific.Group.Title = Project specific settings: | ||
91 | Preferences.Profile.ProjectSpecific.Profile.Label = Project specific profile | ||
92 | |||
93 | Preferences.Profile.ProjectSpecific.Error.Title = Could not change to project specific target profile | ||
94 | Preferences.Profile.ProjectSpecific.Error.Message = The project specific target profile is not defined for the project "{0}".\nYou can define it in the project's property page. | ||
95 | |||
96 | Console.SDK.Name = Yocto Project Console | ||
97 | |||
98 | LaunchConfig.Type.Name = org.eclipse.ui.externaltools.ProgramLaunchConfigurationType | ||
99 | LaunchConfig.LaunchGroup.Value = org.eclipse.ui.externaltools.launchGroup | ||
100 | LaunchConfig.LaunchGroup.Attr = org.eclipse.debug.ui.favoriteGroups | ||
101 | LaunchConfig.BuildScope.Attr = org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE | ||
102 | LaunchConfig.BuildScope.Value = ${projects:} | ||
103 | LaunchConfig.Location.Attr = org.eclipse.ui.externaltools.ATTR_LOCATION | ||
104 | LaunchConfig.Arguments.Attr = org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS; | ||
105 | |||
106 | AutotoolsProjectPostProcess.WrongProjectNature = {0} is not an Autotools project | ||
107 | AutotoolsProjectPostProcess.ChmodFailure = Failed to make autogen.sh executable for project: {0} | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKPlugin.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKPlugin.java new file mode 100644 index 0000000..9777396 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKPlugin.java | |||
@@ -0,0 +1,116 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide; | ||
12 | |||
13 | import java.lang.reflect.InvocationTargetException; | ||
14 | |||
15 | import org.eclipse.core.resources.ResourcesPlugin; | ||
16 | import org.eclipse.core.runtime.CoreException; | ||
17 | import org.eclipse.core.runtime.IStatus; | ||
18 | import org.eclipse.core.runtime.Status; | ||
19 | import org.eclipse.core.runtime.preferences.InstanceScope; | ||
20 | import org.eclipse.jface.preference.IPreferenceStore; | ||
21 | import org.eclipse.swt.widgets.Shell; | ||
22 | import org.eclipse.ui.IWorkbenchWindow; | ||
23 | import org.eclipse.ui.plugin.AbstractUIPlugin; | ||
24 | import org.eclipse.ui.preferences.ScopedPreferenceStore; | ||
25 | import org.osgi.framework.BundleContext; | ||
26 | |||
27 | /** | ||
28 | * The activator class controls the plug-in life cycle | ||
29 | */ | ||
30 | public class YoctoSDKPlugin extends AbstractUIPlugin { | ||
31 | |||
32 | // The plug-in ID | ||
33 | public static final String PLUGIN_ID = "org.yocto.sdk.ide"; | ||
34 | |||
35 | // The shared instance | ||
36 | private static YoctoSDKPlugin plugin; | ||
37 | |||
38 | /** | ||
39 | * The constructor | ||
40 | */ | ||
41 | public YoctoSDKPlugin() { | ||
42 | } | ||
43 | |||
44 | /* | ||
45 | * (non-Javadoc) | ||
46 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) | ||
47 | */ | ||
48 | public void start(BundleContext context) throws Exception { | ||
49 | super.start(context); | ||
50 | plugin = this; | ||
51 | } | ||
52 | |||
53 | /* | ||
54 | * (non-Javadoc) | ||
55 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) | ||
56 | */ | ||
57 | public void stop(BundleContext context) throws Exception { | ||
58 | plugin = null; | ||
59 | super.stop(context); | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * Returns the shared instance | ||
64 | * | ||
65 | * @return the shared instance | ||
66 | */ | ||
67 | public static YoctoSDKPlugin getDefault() { | ||
68 | return plugin; | ||
69 | } | ||
70 | |||
71 | public static IPreferenceStore getProfilePreferenceStore(String profileName) { | ||
72 | int profileIdentifier = profileName.hashCode(); | ||
73 | |||
74 | return new ScopedPreferenceStore(InstanceScope.INSTANCE,getUniqueIdentifier() + "." + profileIdentifier); | ||
75 | } | ||
76 | |||
77 | public static void log(IStatus status) { | ||
78 | ResourcesPlugin.getPlugin().getLog().log(status); | ||
79 | } | ||
80 | |||
81 | public static void log(Throwable e) { | ||
82 | if (e instanceof InvocationTargetException) | ||
83 | e = ((InvocationTargetException) e).getTargetException(); | ||
84 | IStatus status = null; | ||
85 | if (e instanceof CoreException) | ||
86 | status = ((CoreException) e).getStatus(); | ||
87 | else | ||
88 | status = new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.OK, e.getMessage(), e); | ||
89 | log(status); | ||
90 | } | ||
91 | |||
92 | public static void logErrorMessage(String message) { | ||
93 | log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, message, null)); | ||
94 | } | ||
95 | |||
96 | /** | ||
97 | * Returns active shell. | ||
98 | */ | ||
99 | public static Shell getActiveWorkbenchShell() { | ||
100 | IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow(); | ||
101 | if (window != null) { | ||
102 | return window.getShell(); | ||
103 | } | ||
104 | return null; | ||
105 | } | ||
106 | |||
107 | public static String getUniqueIdentifier() { | ||
108 | if (getDefault() == null) { | ||
109 | // If the default instance is not yet initialized, | ||
110 | // return a static identifier. This identifier must | ||
111 | // match the plugin id defined in plugin.xml | ||
112 | return PLUGIN_ID; | ||
113 | } | ||
114 | return getDefault().getBundle().getSymbolicName(); | ||
115 | } | ||
116 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUIElement.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUIElement.java new file mode 100644 index 0000000..de3e905 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUIElement.java | |||
@@ -0,0 +1,161 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide; | ||
12 | |||
13 | public class YoctoUIElement { | ||
14 | public enum PokyMode | ||
15 | { | ||
16 | POKY_SDK_MODE, | ||
17 | POKY_TREE_MODE | ||
18 | }; | ||
19 | public enum DeviceMode | ||
20 | { | ||
21 | QEMU_MODE, | ||
22 | DEVICE_MODE | ||
23 | }; | ||
24 | |||
25 | private String strTarget; | ||
26 | private String[] strTargetsArray; | ||
27 | private DeviceMode enumDeviceMode; | ||
28 | private String strQemuKernelLoc; | ||
29 | private String strQemuOption; | ||
30 | private String strSysrootLoc; | ||
31 | private PokyMode enumPokyMode; | ||
32 | private String strToolChainRoot; | ||
33 | private int intTargetIndex; | ||
34 | |||
35 | public YoctoUIElement() | ||
36 | { | ||
37 | this.enumDeviceMode = DeviceMode.QEMU_MODE; | ||
38 | this.enumPokyMode = PokyMode.POKY_SDK_MODE; | ||
39 | this.strToolChainRoot = ""; | ||
40 | this.strQemuKernelLoc = ""; | ||
41 | this.strQemuOption = ""; | ||
42 | this.strSysrootLoc = ""; | ||
43 | this.intTargetIndex = -1; | ||
44 | this.strTarget = ""; | ||
45 | } | ||
46 | |||
47 | public PokyMode getEnumPokyMode() { | ||
48 | return enumPokyMode; | ||
49 | } | ||
50 | public void setEnumPokyMode(PokyMode enumPokyMode) { | ||
51 | this.enumPokyMode = enumPokyMode; | ||
52 | } | ||
53 | public String getStrToolChainRoot() { | ||
54 | return strToolChainRoot; | ||
55 | } | ||
56 | public void setStrToolChainRoot(String strToolChainRoot) { | ||
57 | this.strToolChainRoot = strToolChainRoot; | ||
58 | } | ||
59 | public int getIntTargetIndex() { | ||
60 | if ((this.strTargetsArray != null) && (this.strTargetsArray.length == 1)) | ||
61 | return 0; | ||
62 | return intTargetIndex; | ||
63 | } | ||
64 | public void setIntTargetIndex(int intTargetIndex) { | ||
65 | this.intTargetIndex = intTargetIndex; | ||
66 | } | ||
67 | public String getStrTarget() { | ||
68 | return strTarget; | ||
69 | } | ||
70 | public void setStrTarget(String strTarget) { | ||
71 | this.strTarget = strTarget; | ||
72 | } | ||
73 | public String[] getStrTargetsArray() { | ||
74 | return strTargetsArray; | ||
75 | } | ||
76 | public void setStrTargetsArray(String[] strTargetsArray) { | ||
77 | this.strTargetsArray = strTargetsArray; | ||
78 | } | ||
79 | public DeviceMode getEnumDeviceMode() { | ||
80 | return enumDeviceMode; | ||
81 | } | ||
82 | public void setEnumDeviceMode(DeviceMode enumDeviceMode) { | ||
83 | this.enumDeviceMode = enumDeviceMode; | ||
84 | } | ||
85 | public String getStrQemuKernelLoc() { | ||
86 | return strQemuKernelLoc; | ||
87 | } | ||
88 | public void setStrQemuKernelLoc(String strQemuKernelLoc) { | ||
89 | this.strQemuKernelLoc = strQemuKernelLoc; | ||
90 | } | ||
91 | public String getStrQemuOption() { | ||
92 | return strQemuOption; | ||
93 | } | ||
94 | public void setStrQemuOption(String strQemuOption) { | ||
95 | this.strQemuOption = strQemuOption; | ||
96 | } | ||
97 | public String getStrSysrootLoc() { | ||
98 | return strSysrootLoc; | ||
99 | } | ||
100 | public void setStrSysrootLoc(String strSysrootLoc) { | ||
101 | this.strSysrootLoc = strSysrootLoc; | ||
102 | } | ||
103 | |||
104 | @Override | ||
105 | public int hashCode() { | ||
106 | final int prime = 31; | ||
107 | int result = 1; | ||
108 | result = prime * result + ((enumDeviceMode == null) ? 0 : enumDeviceMode.hashCode()); | ||
109 | result = prime * result + ((enumPokyMode == null) ? 0 : enumPokyMode.hashCode()); | ||
110 | result = prime * result + intTargetIndex; | ||
111 | result = prime * result + ((strQemuKernelLoc == null) ? 0 : strQemuKernelLoc.hashCode()); | ||
112 | result = prime * result + ((strQemuOption == null) ? 0 : strQemuOption.hashCode()); | ||
113 | result = prime * result + ((strSysrootLoc == null) ? 0 : strSysrootLoc.hashCode()); | ||
114 | result = prime * result + ((strTarget == null) ? 0 : strTarget.hashCode()); | ||
115 | result = prime * result + ((strToolChainRoot == null) ? 0 : strToolChainRoot.hashCode()); | ||
116 | return result; | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public boolean equals(Object obj) { | ||
121 | if (this == obj) | ||
122 | return true; | ||
123 | if (obj == null) | ||
124 | return false; | ||
125 | if (getClass() != obj.getClass()) | ||
126 | return false; | ||
127 | YoctoUIElement other = (YoctoUIElement) obj; | ||
128 | if (enumDeviceMode != other.enumDeviceMode) | ||
129 | return false; | ||
130 | if (enumPokyMode != other.enumPokyMode) | ||
131 | return false; | ||
132 | if (intTargetIndex != other.intTargetIndex) | ||
133 | return false; | ||
134 | if (strQemuKernelLoc == null) { | ||
135 | if (other.strQemuKernelLoc != null) | ||
136 | return false; | ||
137 | } else if (!strQemuKernelLoc.equals(other.strQemuKernelLoc)) | ||
138 | return false; | ||
139 | if (strQemuOption == null) { | ||
140 | if (other.strQemuOption != null) | ||
141 | return false; | ||
142 | } else if (!strQemuOption.equals(other.strQemuOption)) | ||
143 | return false; | ||
144 | if (strSysrootLoc == null) { | ||
145 | if (other.strSysrootLoc != null) | ||
146 | return false; | ||
147 | } else if (!strSysrootLoc.equals(other.strSysrootLoc)) | ||
148 | return false; | ||
149 | if (strTarget == null) { | ||
150 | if (other.strTarget != null) | ||
151 | return false; | ||
152 | } else if (!strTarget.equals(other.strTarget)) | ||
153 | return false; | ||
154 | if (strToolChainRoot == null) { | ||
155 | if (other.strToolChainRoot != null) | ||
156 | return false; | ||
157 | } else if (!strToolChainRoot.equals(other.strToolChainRoot)) | ||
158 | return false; | ||
159 | return true; | ||
160 | } | ||
161 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java new file mode 100644 index 0000000..d192538 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoUISetting.java | |||
@@ -0,0 +1,555 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide; | ||
12 | |||
13 | import java.io.File; | ||
14 | import java.util.ArrayList; | ||
15 | |||
16 | import org.eclipse.cdt.ui.templateengine.uitree.InputUIElement; | ||
17 | import org.eclipse.core.runtime.Status; | ||
18 | import org.eclipse.jface.dialogs.ErrorDialog; | ||
19 | import org.eclipse.jface.preference.IPreferenceStore; | ||
20 | import org.eclipse.swt.SWT; | ||
21 | import org.eclipse.swt.events.ModifyEvent; | ||
22 | import org.eclipse.swt.events.ModifyListener; | ||
23 | import org.eclipse.swt.events.SelectionAdapter; | ||
24 | import org.eclipse.swt.events.SelectionEvent; | ||
25 | import org.eclipse.swt.events.SelectionListener; | ||
26 | import org.eclipse.swt.layout.GridData; | ||
27 | import org.eclipse.swt.layout.GridLayout; | ||
28 | import org.eclipse.swt.widgets.Button; | ||
29 | import org.eclipse.swt.widgets.Combo; | ||
30 | import org.eclipse.swt.widgets.Composite; | ||
31 | import org.eclipse.swt.widgets.Control; | ||
32 | import org.eclipse.swt.widgets.DirectoryDialog; | ||
33 | import org.eclipse.swt.widgets.Display; | ||
34 | import org.eclipse.swt.widgets.Event; | ||
35 | import org.eclipse.swt.widgets.FileDialog; | ||
36 | import org.eclipse.swt.widgets.Group; | ||
37 | import org.eclipse.swt.widgets.Label; | ||
38 | import org.eclipse.swt.widgets.Text; | ||
39 | import org.eclipse.swt.widgets.Widget; | ||
40 | import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom; | ||
41 | import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; | ||
42 | import org.yocto.sdk.ide.preferences.PreferenceConstants; | ||
43 | |||
44 | public class YoctoUISetting { | ||
45 | private static final String ENV_SCRIPT_FILE_PREFIX = "environment-setup-"; | ||
46 | |||
47 | private SelectionListener fSelectionListener; | ||
48 | private ModifyListener fModifyListener; | ||
49 | private YoctoUIElement yoctoUIElement; | ||
50 | |||
51 | private Group crossCompilerGroup; | ||
52 | |||
53 | private Button btnSDKRoot; | ||
54 | private Button btnQemu; | ||
55 | private Button btnPokyRoot; | ||
56 | private Button btnDevice; | ||
57 | |||
58 | private Button btnKernelLoc; | ||
59 | private Button btnSysrootLoc; | ||
60 | private Button btnToolChainLoc; | ||
61 | |||
62 | private Text textKernelLoc; | ||
63 | private Text textQemuOption; | ||
64 | private Text textSysrootLoc; | ||
65 | private Text textRootLoc; | ||
66 | private Combo targetArchCombo; | ||
67 | |||
68 | private Label root_label; | ||
69 | private Label sysroot_label; | ||
70 | private Label targetArchLabel; | ||
71 | private Label kernel_label; | ||
72 | private Label option_label; | ||
73 | |||
74 | public YoctoUISetting(YoctoUIElement elem) | ||
75 | { | ||
76 | yoctoUIElement = elem; | ||
77 | elem.setStrTargetsArray(getTargetArray(elem)); | ||
78 | |||
79 | fSelectionListener= new SelectionListener() { | ||
80 | public void widgetDefaultSelected(SelectionEvent e) {} | ||
81 | |||
82 | public void widgetSelected(SelectionEvent e) { | ||
83 | controlChanged(e.widget); | ||
84 | relayEvent(e); | ||
85 | } | ||
86 | |||
87 | private void relayEvent(SelectionEvent e) { | ||
88 | Event event = new Event(); | ||
89 | event.data = e.data; | ||
90 | event.detail = e.detail; | ||
91 | event.display = e.display; | ||
92 | event.doit = e.doit; | ||
93 | event.height = e.height; | ||
94 | event.item = e.item; | ||
95 | event.stateMask = e.stateMask; | ||
96 | event.text = e.text; | ||
97 | event.time = e.time; | ||
98 | event.widget = e.widget; | ||
99 | event.width = e.width; | ||
100 | event.x = e.x; | ||
101 | event.y = e.y; | ||
102 | crossCompilerGroup.getParent().notifyListeners(SWT.Selection, event); | ||
103 | } | ||
104 | }; | ||
105 | |||
106 | fModifyListener= new ModifyListener() { | ||
107 | public void modifyText(ModifyEvent e) { | ||
108 | controlModified(e.widget); | ||
109 | relayEvent(e); | ||
110 | } | ||
111 | |||
112 | private void relayEvent(ModifyEvent e) { | ||
113 | Event event = new Event(); | ||
114 | event.data = e.data; | ||
115 | event.display = e.display; | ||
116 | event.time = e.time; | ||
117 | event.widget = e.widget; | ||
118 | crossCompilerGroup.getParent().notifyListeners(SWT.Modify, event); | ||
119 | } | ||
120 | }; | ||
121 | } | ||
122 | |||
123 | private Control addControls(Control fControl, final String sKey, String sValue) | ||
124 | { | ||
125 | fControl.setData(new String[]{sKey,sValue}); | ||
126 | return fControl; | ||
127 | } | ||
128 | |||
129 | private Control addRadioButton(Composite parent, String label, String key, boolean bSelected) { | ||
130 | GridData gd= new GridData(SWT.FILL, SWT.CENTER, true, false); | ||
131 | String sValue; | ||
132 | Button button= new Button(parent, SWT.RADIO); | ||
133 | |||
134 | gd.horizontalSpan= 2; | ||
135 | button.setText(label); | ||
136 | button.setLayoutData(gd); | ||
137 | button.setSelection(bSelected); | ||
138 | |||
139 | if (bSelected) | ||
140 | sValue = IPreferenceStore.TRUE; | ||
141 | else | ||
142 | sValue = IPreferenceStore.FALSE; | ||
143 | return addControls((Control)button, key, sValue); | ||
144 | |||
145 | } | ||
146 | |||
147 | private Control addTextControl(final Composite parent, String key, String value) { | ||
148 | final Text text; | ||
149 | |||
150 | text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER); | ||
151 | text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
152 | text.setText(value); | ||
153 | text.setSize(10, 150); | ||
154 | |||
155 | return addControls((Control)text, key, value); | ||
156 | } | ||
157 | |||
158 | private Button addFileSelectButton(final Composite parent, final Text text, final String key) { | ||
159 | Button button = new Button(parent, SWT.PUSH | SWT.LEAD); | ||
160 | button.setText(InputUIElement.BROWSELABEL); | ||
161 | button.addSelectionListener(new SelectionAdapter() { | ||
162 | @Override | ||
163 | public void widgetSelected(SelectionEvent event) { | ||
164 | String dirName; | ||
165 | if (key.equals(PreferenceConstants.TOOLCHAIN_ROOT)|| key.equals(PreferenceConstants.SYSROOT)) | ||
166 | dirName = new DirectoryDialog(parent.getShell()).open(); | ||
167 | else | ||
168 | dirName = new FileDialog(parent.getShell()).open(); | ||
169 | if (dirName != null) { | ||
170 | text.setText(dirName); | ||
171 | } | ||
172 | } | ||
173 | }); | ||
174 | return button; | ||
175 | } | ||
176 | |||
177 | private void createQemuSetup(final Group targetGroup) | ||
178 | { | ||
179 | //QEMU Setup | ||
180 | kernel_label= new Label(targetGroup, SWT.NONE); | ||
181 | kernel_label.setText("Kernel: "); | ||
182 | kernel_label.setAlignment(SWT.RIGHT); | ||
183 | |||
184 | Composite textContainer = new Composite(targetGroup, SWT.NONE); | ||
185 | textContainer.setLayout(new GridLayout(2, false)); | ||
186 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); | ||
187 | textKernelLoc= (Text)addTextControl(textContainer, PreferenceConstants.QEMU_KERNEL, yoctoUIElement.getStrQemuKernelLoc()); | ||
188 | btnKernelLoc = addFileSelectButton(textContainer, textKernelLoc, PreferenceConstants.QEMU_KERNEL); | ||
189 | |||
190 | |||
191 | option_label = new Label(targetGroup, SWT.NONE); | ||
192 | option_label.setText("Custom Option: "); | ||
193 | option_label.setAlignment(SWT.RIGHT); | ||
194 | |||
195 | textContainer = new Composite(targetGroup, SWT.NONE); | ||
196 | textContainer.setLayout(new GridLayout(2, false)); | ||
197 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); | ||
198 | textQemuOption = (Text)addTextControl(textContainer, PreferenceConstants.QEMU_OPTION, yoctoUIElement.getStrQemuOption()); | ||
199 | |||
200 | /* | ||
201 | rootfs_label= new Label(targetGroup, SWT.NONE); | ||
202 | rootfs_label.setText("Root Filesystem: "); | ||
203 | rootfs_label.setAlignment(SWT.RIGHT); | ||
204 | |||
205 | textContainer = new Composite(targetGroup, SWT.NONE); | ||
206 | textContainer.setLayout(new GridLayout(2, false)); | ||
207 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); | ||
208 | textRootFSLoc= (Text)addTextControl(textContainer, PreferenceConstants.QEMU_ROOTFS, yoctoUIElement.getStrQemuRootFSLoc()); | ||
209 | btnRootFSLoc = addFileSelectButton(textContainer, textRootFSLoc, PreferenceConstants.QEMU_ROOTFS); | ||
210 | */ | ||
211 | |||
212 | } | ||
213 | public void createComposite(Composite composite) | ||
214 | { | ||
215 | GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); | ||
216 | GridLayout layout = new GridLayout(2, false); | ||
217 | |||
218 | crossCompilerGroup = new Group(composite, SWT.NONE); | ||
219 | layout= new GridLayout(2, false); | ||
220 | crossCompilerGroup.setLayout(layout); | ||
221 | gd= new GridData(SWT.FILL, SWT.CENTER, true, false); | ||
222 | gd.horizontalSpan= 2; | ||
223 | crossCompilerGroup.setLayoutData(gd); | ||
224 | crossCompilerGroup.setText("Cross Compiler Options:"); | ||
225 | |||
226 | if (yoctoUIElement.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { | ||
227 | |||
228 | btnSDKRoot = (Button)addRadioButton(crossCompilerGroup, "Standalone pre-built toolchain", PreferenceConstants.SDK_MODE + "_1", true); | ||
229 | btnPokyRoot = (Button)addRadioButton(crossCompilerGroup, "Build system derived toolchain", PreferenceConstants.SDK_MODE + "_2", false); | ||
230 | } | ||
231 | else { | ||
232 | btnSDKRoot = (Button)addRadioButton(crossCompilerGroup, "Standalone pre-built toolchain", PreferenceConstants.SDK_MODE + "_1", false); | ||
233 | btnPokyRoot = (Button)addRadioButton(crossCompilerGroup, "Build system derived toolchain", PreferenceConstants.SDK_MODE + "_2", true); | ||
234 | } | ||
235 | |||
236 | root_label = new Label(crossCompilerGroup, SWT.NONE); | ||
237 | root_label.setText("Toolchain Root Location: "); | ||
238 | Composite textContainer = new Composite(crossCompilerGroup, SWT.NONE); | ||
239 | textContainer.setLayout(new GridLayout(2, false)); | ||
240 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
241 | textRootLoc = (Text)addTextControl(textContainer, | ||
242 | PreferenceConstants.TOOLCHAIN_ROOT, yoctoUIElement.getStrToolChainRoot()); | ||
243 | btnToolChainLoc = addFileSelectButton(textContainer, textRootLoc, PreferenceConstants.TOOLCHAIN_ROOT); | ||
244 | |||
245 | sysroot_label= new Label(crossCompilerGroup, SWT.NONE); | ||
246 | sysroot_label.setText("Sysroot Location: "); | ||
247 | sysroot_label.setAlignment(SWT.RIGHT); | ||
248 | |||
249 | textContainer = new Composite(crossCompilerGroup, SWT.NONE); | ||
250 | textContainer.setLayout(new GridLayout(2, false)); | ||
251 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); | ||
252 | textSysrootLoc= (Text)addTextControl(textContainer, PreferenceConstants.SYSROOT, yoctoUIElement.getStrSysrootLoc()); | ||
253 | btnSysrootLoc = addFileSelectButton(textContainer, textSysrootLoc, PreferenceConstants.SYSROOT); | ||
254 | |||
255 | updateSDKControlState(); | ||
256 | targetArchLabel = new Label(crossCompilerGroup, SWT.NONE); | ||
257 | targetArchLabel.setText("Target Architecture: "); | ||
258 | |||
259 | targetArchCombo= new Combo(crossCompilerGroup, SWT.READ_ONLY); | ||
260 | if (yoctoUIElement.getStrTargetsArray() != null) | ||
261 | { | ||
262 | targetArchCombo.setItems(yoctoUIElement.getStrTargetsArray()); | ||
263 | targetArchCombo.select(yoctoUIElement.getIntTargetIndex()); | ||
264 | } | ||
265 | targetArchCombo.setLayout(new GridLayout(2, false)); | ||
266 | targetArchCombo.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false)); | ||
267 | this.addControls((Control)targetArchCombo, | ||
268 | PreferenceConstants.TOOLCHAIN_TRIPLET, String.valueOf(yoctoUIElement.getIntTargetIndex())); | ||
269 | |||
270 | |||
271 | //Target Options | ||
272 | GridData gd2= new GridData(SWT.FILL, SWT.LEFT, true, false); | ||
273 | gd2.horizontalSpan= 2; | ||
274 | Group targetGroup= new Group(composite, SWT.NONE); | ||
275 | layout= new GridLayout(); | ||
276 | layout.numColumns= 2; | ||
277 | targetGroup.setLayout(layout); | ||
278 | targetGroup.setLayoutData(gd2); | ||
279 | targetGroup.setText("Target Options:"); | ||
280 | |||
281 | if (yoctoUIElement.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) { | ||
282 | btnQemu = (Button)addRadioButton(targetGroup, "QEMU", PreferenceConstants.TARGET_MODE + "_1", true); | ||
283 | createQemuSetup(targetGroup); | ||
284 | |||
285 | btnDevice = (Button)addRadioButton(targetGroup, "External HW", PreferenceConstants.TARGET_MODE + "_2", false); | ||
286 | } | ||
287 | else { | ||
288 | btnQemu = (Button)addRadioButton(targetGroup, "QEMU", PreferenceConstants.TARGET_MODE + "_1", false); | ||
289 | createQemuSetup(targetGroup); | ||
290 | |||
291 | btnDevice = (Button)addRadioButton(targetGroup, "External HW", PreferenceConstants.TARGET_MODE + "_2", true); | ||
292 | } | ||
293 | |||
294 | updateQemuControlState(); | ||
295 | |||
296 | //we add the listener at the end for avoiding the useless event trigger when control | ||
297 | //changed or modified. | ||
298 | btnSDKRoot.addSelectionListener(fSelectionListener); | ||
299 | btnPokyRoot.addSelectionListener(fSelectionListener); | ||
300 | btnQemu.addSelectionListener(fSelectionListener); | ||
301 | btnDevice.addSelectionListener(fSelectionListener); | ||
302 | targetArchCombo.addSelectionListener(fSelectionListener); | ||
303 | textRootLoc.addModifyListener(fModifyListener); | ||
304 | textKernelLoc.addModifyListener(fModifyListener); | ||
305 | textQemuOption.addModifyListener(fModifyListener); | ||
306 | textSysrootLoc.addModifyListener(fModifyListener); | ||
307 | } | ||
308 | |||
309 | //Load all Control values into the YoctoUIElement | ||
310 | public YoctoUIElement getCurrentInput() | ||
311 | { | ||
312 | YoctoUIElement elem = new YoctoUIElement(); | ||
313 | if (btnSDKRoot.getSelection()) | ||
314 | elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE); | ||
315 | else | ||
316 | elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE); | ||
317 | |||
318 | if (btnQemu.getSelection()) | ||
319 | { | ||
320 | elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE); | ||
321 | } | ||
322 | else { | ||
323 | elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE); | ||
324 | } | ||
325 | elem.setStrToolChainRoot(textRootLoc.getText()); | ||
326 | elem.setIntTargetIndex(targetArchCombo.getSelectionIndex()); | ||
327 | elem.setStrTargetsArray(targetArchCombo.getItems()); | ||
328 | elem.setStrTarget(targetArchCombo.getText()); | ||
329 | elem.setStrQemuKernelLoc(textKernelLoc.getText()); | ||
330 | elem.setStrQemuOption(textQemuOption.getText()); | ||
331 | elem.setStrSysrootLoc(textSysrootLoc.getText()); | ||
332 | return elem; | ||
333 | } | ||
334 | |||
335 | public void setCurrentInput(YoctoUIElement elem){ | ||
336 | elem.setStrTargetsArray(getTargetArray(elem)); | ||
337 | |||
338 | btnSDKRoot.setSelection(false); | ||
339 | btnPokyRoot.setSelection(false); | ||
340 | if(elem.getEnumPokyMode().equals(YoctoUIElement.PokyMode.POKY_SDK_MODE)){ | ||
341 | btnSDKRoot.setSelection(true); | ||
342 | } | ||
343 | else if(elem.getEnumPokyMode().equals(YoctoUIElement.PokyMode.POKY_TREE_MODE)){ | ||
344 | btnPokyRoot.setSelection(true); | ||
345 | } | ||
346 | |||
347 | btnQemu.setSelection(false); | ||
348 | btnDevice.setSelection(false); | ||
349 | if(elem.getEnumDeviceMode().equals(YoctoUIElement.DeviceMode.QEMU_MODE)){ | ||
350 | btnQemu.setSelection(true); | ||
351 | } | ||
352 | else if(elem.getEnumDeviceMode().equals(YoctoUIElement.DeviceMode.DEVICE_MODE)){ | ||
353 | btnDevice.setSelection(true); | ||
354 | } | ||
355 | |||
356 | textRootLoc.setText(elem.getStrToolChainRoot()); | ||
357 | targetArchCombo.select(elem.getIntTargetIndex()); | ||
358 | if(elem.getStrTargetsArray() == null){ | ||
359 | targetArchCombo.setItems(new String[]{}); | ||
360 | } | ||
361 | else { | ||
362 | targetArchCombo.setItems(elem.getStrTargetsArray()); | ||
363 | } | ||
364 | targetArchCombo.setText(elem.getStrTarget()); | ||
365 | textKernelLoc.setText(elem.getStrQemuKernelLoc()); | ||
366 | textQemuOption.setText(elem.getStrQemuOption()); | ||
367 | textSysrootLoc.setText(elem.getStrSysrootLoc()); | ||
368 | } | ||
369 | |||
370 | public SDKCheckResults validateInput(SDKCheckRequestFrom from, boolean showErrorDialog) { | ||
371 | SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(getCurrentInput()); | ||
372 | |||
373 | //Show Error Message on the Label to help users. | ||
374 | if ((result != SDKCheckResults.SDK_PASS) && showErrorDialog) { | ||
375 | Display display = Display.getCurrent(); | ||
376 | ErrorDialog.openError(display.getActiveShell(), | ||
377 | YoctoSDKChecker.SDKCheckRequestFrom.Other.getErrorMessage(), | ||
378 | YoctoSDKChecker.getErrorMessage(result, from), | ||
379 | new Status(Status.ERROR, YoctoSDKPlugin.PLUGIN_ID, result.getMessage())); | ||
380 | |||
381 | } | ||
382 | |||
383 | return result; | ||
384 | } | ||
385 | |||
386 | public void setUIFormEnabledState(boolean isEnabled) { | ||
387 | btnSDKRoot.setEnabled(isEnabled); | ||
388 | btnPokyRoot.setEnabled(isEnabled); | ||
389 | |||
390 | root_label.setEnabled(isEnabled); | ||
391 | textRootLoc.setEnabled(isEnabled); | ||
392 | btnToolChainLoc.setEnabled(isEnabled); | ||
393 | |||
394 | sysroot_label.setEnabled(isEnabled); | ||
395 | textSysrootLoc.setEnabled(isEnabled); | ||
396 | btnSysrootLoc.setEnabled(isEnabled); | ||
397 | |||
398 | targetArchLabel.setEnabled(isEnabled); | ||
399 | targetArchCombo.setEnabled(isEnabled); | ||
400 | |||
401 | btnQemu.setEnabled(isEnabled); | ||
402 | |||
403 | if(isEnabled) { | ||
404 | /* enabling widgets regarding | ||
405 | * Kernel and Custom Options | ||
406 | * depends on the state of the QEMU button */ | ||
407 | kernel_label.setEnabled(isEnabled); | ||
408 | option_label.setEnabled(isEnabled); | ||
409 | |||
410 | if(btnQemu.getSelection()) { | ||
411 | textKernelLoc.setEnabled(isEnabled); | ||
412 | btnKernelLoc.setEnabled(isEnabled); | ||
413 | |||
414 | textQemuOption.setEnabled(isEnabled); | ||
415 | } | ||
416 | } else { | ||
417 | /* disable all widgets regarding | ||
418 | * Kernel and Custom Options */ | ||
419 | kernel_label.setEnabled(isEnabled); | ||
420 | textKernelLoc.setEnabled(isEnabled); | ||
421 | btnKernelLoc.setEnabled(isEnabled); | ||
422 | |||
423 | option_label.setEnabled(isEnabled); | ||
424 | textQemuOption.setEnabled(isEnabled); | ||
425 | } | ||
426 | |||
427 | btnDevice.setEnabled(isEnabled); | ||
428 | } | ||
429 | |||
430 | private void updateQemuControlState() | ||
431 | { | ||
432 | boolean bQemuMode = btnQemu.getSelection(); | ||
433 | |||
434 | textKernelLoc.setEnabled(bQemuMode); | ||
435 | //textRootFSLoc.setEnabled(bQemuMode); | ||
436 | btnKernelLoc.setEnabled(bQemuMode); | ||
437 | //btnRootFSLoc.setEnabled(bQemuMode); | ||
438 | textQemuOption.setEnabled(bQemuMode); | ||
439 | } | ||
440 | |||
441 | private void updateSDKControlState() | ||
442 | { | ||
443 | if (btnSDKRoot.getSelection()) | ||
444 | { | ||
445 | } | ||
446 | else { | ||
447 | if (!yoctoUIElement.getStrToolChainRoot().startsWith("/opt/poky")) | ||
448 | { | ||
449 | textRootLoc.setText(yoctoUIElement.getStrToolChainRoot()); | ||
450 | } | ||
451 | textRootLoc.setEnabled(true); | ||
452 | btnToolChainLoc.setEnabled(true); | ||
453 | } | ||
454 | } | ||
455 | |||
456 | private void controlChanged(Widget widget) { | ||
457 | |||
458 | if (widget == btnSDKRoot || widget == btnPokyRoot) | ||
459 | { | ||
460 | |||
461 | setTargetCombo(targetArchCombo); | ||
462 | updateSDKControlState(); | ||
463 | } | ||
464 | |||
465 | if (widget == btnDevice || widget == btnQemu) | ||
466 | updateQemuControlState(); | ||
467 | } | ||
468 | |||
469 | private void controlModified(Widget widget) { | ||
470 | if (widget == textRootLoc) | ||
471 | { | ||
472 | setTargetCombo(targetArchCombo); | ||
473 | } | ||
474 | } | ||
475 | |||
476 | /* Search current supported Target triplet from the toolchain root | ||
477 | * by parsing ENV script file name | ||
478 | */ | ||
479 | private static ArrayList<String> getTargetTripletList(String strFileName) | ||
480 | { | ||
481 | File fFile = new File(strFileName); | ||
482 | if (!fFile.exists()) | ||
483 | return null; | ||
484 | |||
485 | ArrayList<String> arrTarget = new ArrayList<String>(); | ||
486 | String[] strFileArray = fFile.list(); | ||
487 | for (int i = 0; i < strFileArray.length; i++) | ||
488 | { | ||
489 | if (strFileArray[i].startsWith(ENV_SCRIPT_FILE_PREFIX)) { | ||
490 | arrTarget.add(strFileArray[i].substring(ENV_SCRIPT_FILE_PREFIX.length())); | ||
491 | } | ||
492 | } | ||
493 | return arrTarget; | ||
494 | |||
495 | } | ||
496 | |||
497 | private static String[] getTargetArray(YoctoUIElement elem) | ||
498 | { | ||
499 | ArrayList<String> arrTarget; | ||
500 | String sEnvFilePath = elem.getStrToolChainRoot(); | ||
501 | |||
502 | if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) | ||
503 | { | ||
504 | arrTarget = getTargetTripletList(sEnvFilePath); | ||
505 | } | ||
506 | else | ||
507 | { | ||
508 | arrTarget = getTargetTripletList(sEnvFilePath + "/tmp"); | ||
509 | } | ||
510 | if (arrTarget == null || arrTarget.size() <= 0) | ||
511 | return null; | ||
512 | |||
513 | String [] strTargetArray = new String[arrTarget.size()]; | ||
514 | for (int i = 0; i < arrTarget.size(); i++) | ||
515 | strTargetArray[i] = arrTarget.get(i); | ||
516 | |||
517 | return strTargetArray; | ||
518 | |||
519 | } | ||
520 | |||
521 | private void setTargetCombo(Combo targetCombo) | ||
522 | { | ||
523 | YoctoUIElement elem = getCurrentInput(); | ||
524 | //re-get Combo box items according to latest input! | ||
525 | elem.setStrTargetsArray(getTargetArray(elem)); | ||
526 | targetCombo.removeAll(); | ||
527 | if (elem.getStrTargetsArray() != null) | ||
528 | { | ||
529 | targetCombo.setItems(elem.getStrTargetsArray()); | ||
530 | for (int i = 0; i < targetCombo.getItemCount(); i++) | ||
531 | { | ||
532 | if(elem.getStrTarget().equalsIgnoreCase(targetCombo.getItem(i))) | ||
533 | { | ||
534 | targetCombo.select(i); | ||
535 | return; | ||
536 | } | ||
537 | if (elem.getStrTargetsArray().length == 1) | ||
538 | targetCombo.select(0); | ||
539 | targetCombo.select(-1); | ||
540 | } | ||
541 | } | ||
542 | //prompt user,if he use tree mode, maybe he hasn't bitbake meta-ide-support yet. | ||
543 | else if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_TREE_MODE) | ||
544 | { | ||
545 | if (elem.getStrToolChainRoot().isEmpty()) | ||
546 | return; | ||
547 | else { | ||
548 | File fToolChain = new File(elem.getStrToolChainRoot()); | ||
549 | if (!fToolChain.exists()) | ||
550 | return; | ||
551 | } | ||
552 | } | ||
553 | |||
554 | } | ||
555 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/InvokeSyncAction.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/InvokeSyncAction.java new file mode 100644 index 0000000..f39d5fd --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/InvokeSyncAction.java | |||
@@ -0,0 +1,110 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.actions; | ||
12 | |||
13 | import java.io.IOException; | ||
14 | import java.io.OutputStream; | ||
15 | import java.util.ArrayList; | ||
16 | |||
17 | import org.eclipse.cdt.core.CommandLauncher; | ||
18 | import org.eclipse.cdt.core.ConsoleOutputStream; | ||
19 | import org.eclipse.cdt.core.envvar.IEnvironmentVariable; | ||
20 | import org.eclipse.cdt.core.resources.IConsole; | ||
21 | import org.eclipse.cdt.managedbuilder.core.IConfiguration; | ||
22 | import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; | ||
23 | import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; | ||
24 | import org.eclipse.core.resources.IProject; | ||
25 | import org.eclipse.core.runtime.CoreException; | ||
26 | import org.eclipse.core.runtime.IPath; | ||
27 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
28 | import org.eclipse.core.runtime.Path; | ||
29 | import org.eclipse.cdt.internal.autotools.core.AutotoolsNewMakeGenerator; | ||
30 | import org.eclipse.cdt.internal.autotools.ui.actions.InvokeAction; | ||
31 | import org.eclipse.cdt.internal.autotools.ui.actions.InvokeMessages; | ||
32 | |||
33 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
34 | |||
35 | @SuppressWarnings("restriction") | ||
36 | public class InvokeSyncAction extends InvokeAction { | ||
37 | protected void executeLocalConsoleCommand(final IConsole console, final String actionName, final String command, | ||
38 | final String[] argumentList, final IPath execDir, final String password) throws CoreException, IOException { | ||
39 | |||
40 | String errMsg = null; | ||
41 | IProject project = getSelectedContainer().getProject(); | ||
42 | // Get a build console for the project | ||
43 | ConsoleOutputStream consoleOutStream = console.getOutputStream(); | ||
44 | // FIXME: we want to remove need for ManagedBuilderManager, but how do we | ||
45 | // get environment variables. | ||
46 | IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); | ||
47 | IConfiguration cfg = info.getDefaultConfiguration(); | ||
48 | |||
49 | StringBuffer buf = new StringBuffer(); | ||
50 | String[] consoleHeader = new String[3]; | ||
51 | |||
52 | consoleHeader[0] = actionName; | ||
53 | consoleHeader[1] = cfg.getName(); | ||
54 | consoleHeader[2] = project.getName(); | ||
55 | buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$ | ||
56 | String invokeMsg = InvokeMessages.getFormattedString("InvokeAction.console.message", //$NON-NLS-1$ | ||
57 | new String[]{actionName, execDir.toString()}); //$NON-NLS-1$ | ||
58 | buf.append(invokeMsg); | ||
59 | buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$ | ||
60 | buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$ | ||
61 | consoleOutStream.write(buf.toString().getBytes()); | ||
62 | consoleOutStream.flush(); | ||
63 | |||
64 | ArrayList<String> additionalEnvs = new ArrayList<String>(); | ||
65 | String strippedCommand = AutotoolsNewMakeGenerator.stripEnvVars(command, additionalEnvs); | ||
66 | // Get a launcher for the config command | ||
67 | CommandLauncher launcher = new CommandLauncher(); | ||
68 | // Set the environment | ||
69 | IEnvironmentVariable variables[] = ManagedBuildManager | ||
70 | .getEnvironmentVariableProvider().getVariables(cfg, true); | ||
71 | String[] env = null; | ||
72 | ArrayList<String> envList = new ArrayList<String>(); | ||
73 | if (variables != null) { | ||
74 | for (int i = 0; i < variables.length; i++) { | ||
75 | envList.add(variables[i].getName() | ||
76 | + "=" + variables[i].getValue()); //$NON-NLS-1$ | ||
77 | } | ||
78 | // add any additional environment variables specified ahead of script | ||
79 | if (additionalEnvs.size() > 0) | ||
80 | envList.addAll(additionalEnvs); | ||
81 | env = (String[]) envList.toArray(new String[envList.size()]); | ||
82 | } | ||
83 | OutputStream stdout = consoleOutStream; | ||
84 | OutputStream stderr = consoleOutStream; | ||
85 | |||
86 | launcher.showCommand(true); | ||
87 | // Run the shell script via shell command. | ||
88 | Process proc = launcher.execute(new Path(strippedCommand), argumentList, env, | ||
89 | execDir, new NullProgressMonitor()); | ||
90 | |||
91 | if (proc != null) { | ||
92 | // Close the input of the process since we will never write to it | ||
93 | OutputStream out = proc.getOutputStream(); | ||
94 | if (!password.isEmpty()) { | ||
95 | out.write(password.getBytes()); | ||
96 | out.write("\n".getBytes()); | ||
97 | } | ||
98 | out.close(); | ||
99 | |||
100 | if (launcher.waitAndRead(stdout, stderr) != CommandLauncher.OK) { | ||
101 | errMsg = launcher.getErrorMessage(); | ||
102 | } | ||
103 | } else { | ||
104 | errMsg = launcher.getErrorMessage(); | ||
105 | } | ||
106 | |||
107 | if (errMsg != null) | ||
108 | YoctoSDKPlugin.logErrorMessage(errMsg); | ||
109 | } | ||
110 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java new file mode 100644 index 0000000..e3e7e60 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ProfileSwitchHandler.java | |||
@@ -0,0 +1,134 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.actions; | ||
12 | |||
13 | import java.util.Map; | ||
14 | |||
15 | import org.eclipse.cdt.core.model.ICElement; | ||
16 | import org.eclipse.cdt.core.model.ICProject; | ||
17 | import org.eclipse.core.commands.AbstractHandler; | ||
18 | import org.eclipse.core.commands.Command; | ||
19 | import org.eclipse.core.commands.ExecutionEvent; | ||
20 | import org.eclipse.core.commands.ExecutionException; | ||
21 | import org.eclipse.core.commands.State; | ||
22 | import org.eclipse.core.resources.IProject; | ||
23 | import org.eclipse.core.resources.IResource; | ||
24 | import org.eclipse.core.runtime.IAdaptable; | ||
25 | import org.eclipse.core.runtime.Status; | ||
26 | import org.eclipse.jface.dialogs.ErrorDialog; | ||
27 | import org.eclipse.jface.preference.IPreferenceStore; | ||
28 | import org.eclipse.jface.viewers.ISelection; | ||
29 | import org.eclipse.jface.viewers.ITreeSelection; | ||
30 | import org.eclipse.swt.widgets.Display; | ||
31 | import org.eclipse.ui.commands.ICommandService; | ||
32 | import org.eclipse.ui.commands.IElementUpdater; | ||
33 | import org.eclipse.ui.handlers.HandlerUtil; | ||
34 | import org.eclipse.ui.handlers.RadioState; | ||
35 | import org.eclipse.ui.menus.UIElement; | ||
36 | import org.yocto.sdk.ide.YoctoProfileElement; | ||
37 | import org.yocto.sdk.ide.YoctoSDKChecker; | ||
38 | import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; | ||
39 | import org.yocto.sdk.ide.YoctoSDKMessages; | ||
40 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
41 | import org.yocto.sdk.ide.YoctoUIElement; | ||
42 | import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; | ||
43 | import org.yocto.sdk.ide.utils.YoctoSDKUtils; | ||
44 | |||
45 | public class ProfileSwitchHandler extends AbstractHandler implements IElementUpdater { | ||
46 | private static final String PROJECT_SPECIFIC_ERROR = "Preferences.Profile.ProjectSpecific.Error.Title"; | ||
47 | private static final String PROJECT_SPECIFIC_ERROR_MESSAGE = "Preferences.Profile.ProjectSpecific.Error.Message"; | ||
48 | |||
49 | public static final String PROFILE_SWITCH_COMMAND = "org.yocto.sdk.ide.targetProfile.switch"; //$NON-NLS-N$ | ||
50 | public static final String PROJECT_SPECIFIC_PARAMETER = "##PROJECT_SPECIFIC_PROFILE##"; //$NON-NLS-N$ | ||
51 | |||
52 | @Override | ||
53 | public Object execute(ExecutionEvent event) throws ExecutionException { | ||
54 | if(HandlerUtil.matchesRadioState(event)) { | ||
55 | return null; | ||
56 | } | ||
57 | |||
58 | String currentState = event.getParameter(RadioState.PARAMETER_ID); | ||
59 | HandlerUtil.updateRadioState(event.getCommand(), currentState); | ||
60 | |||
61 | switchProfile(getSelectedProject(event), currentState); | ||
62 | |||
63 | return null; | ||
64 | } | ||
65 | |||
66 | public IProject getSelectedProject(ExecutionEvent event) { | ||
67 | ISelection selection = HandlerUtil.getCurrentSelection(event); | ||
68 | |||
69 | if (selection instanceof ITreeSelection) { | ||
70 | Object selectedItem = ((ITreeSelection) selection).getFirstElement(); | ||
71 | if (selectedItem instanceof IResource) { | ||
72 | return ((IResource) selectedItem).getProject(); | ||
73 | } else if (selectedItem instanceof ICElement) { | ||
74 | ICProject cProject = ((ICElement) selectedItem).getCProject(); | ||
75 | if (cProject != null) { | ||
76 | return cProject.getProject(); | ||
77 | } | ||
78 | } else if (selectedItem instanceof IAdaptable) { | ||
79 | Object projectObject = ((IAdaptable) selectedItem).getAdapter(IProject.class); | ||
80 | if (projectObject != null && projectObject instanceof IProject) { | ||
81 | return ((IProject) projectObject); | ||
82 | } | ||
83 | } | ||
84 | } | ||
85 | |||
86 | return null; | ||
87 | } | ||
88 | |||
89 | private void switchProfile(IProject project, String selectedProfile) { | ||
90 | if (PROJECT_SPECIFIC_PARAMETER.equals(selectedProfile)) { | ||
91 | YoctoUIElement yoctoUIElement = ProjectPreferenceUtils.getElem(project); | ||
92 | SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(yoctoUIElement); | ||
93 | |||
94 | if ((result != SDKCheckResults.SDK_PASS)) { | ||
95 | Display display = Display.getCurrent(); | ||
96 | ErrorDialog.openError(display.getActiveShell(), | ||
97 | YoctoSDKMessages.getString(PROJECT_SPECIFIC_ERROR), | ||
98 | YoctoSDKMessages.getFormattedString(PROJECT_SPECIFIC_ERROR_MESSAGE, | ||
99 | project.getName()), | ||
100 | new Status(Status.ERROR, YoctoSDKPlugin.PLUGIN_ID, result.getMessage())); | ||
101 | return; | ||
102 | } | ||
103 | |||
104 | ProjectPreferenceUtils.saveElemToProjectEnv(yoctoUIElement, project); | ||
105 | ProjectPreferenceUtils.saveUseProjectSpecificOption(project, true); | ||
106 | } else { | ||
107 | IPreferenceStore store = YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile); | ||
108 | YoctoUIElement yoctoUIElement = YoctoSDKUtils.getElemFromStore(store); | ||
109 | ProjectPreferenceUtils.saveElemToProjectEnv(yoctoUIElement, project); | ||
110 | ProjectPreferenceUtils.saveUseProjectSpecificOption(project, false); | ||
111 | |||
112 | YoctoProfileElement profileSettings = ProjectPreferenceUtils.getProfiles(project); | ||
113 | profileSettings.setSelectedProfile(selectedProfile); | ||
114 | ProjectPreferenceUtils.saveProfiles(profileSettings, project); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | /* | ||
119 | * Workaround for BUG 398647 to allow checking radio items | ||
120 | * in a dynamic contribution | ||
121 | * | ||
122 | * https://bugs.eclipse.org/bugs/show_bug.cgi?id=398647 | ||
123 | */ | ||
124 | @Override | ||
125 | public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { | ||
126 | ICommandService service = (ICommandService) element.getServiceLocator().getService(ICommandService.class); | ||
127 | String state = (String) parameters.get(RadioState.PARAMETER_ID); | ||
128 | Command command = service.getCommand(PROFILE_SWITCH_COMMAND); | ||
129 | State commandState = command.getState(RadioState.STATE_ID); | ||
130 | if (commandState.getValue().equals(state)) { | ||
131 | element.setChecked(true); | ||
132 | } | ||
133 | } | ||
134 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java new file mode 100644 index 0000000..e255fd1 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoAction.java | |||
@@ -0,0 +1,44 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.actions; | ||
12 | |||
13 | import org.eclipse.cdt.internal.autotools.ui.actions.InvokeAction; | ||
14 | import org.eclipse.core.resources.IContainer; | ||
15 | import org.eclipse.core.resources.IProject; | ||
16 | import org.eclipse.jface.action.IAction; | ||
17 | import org.eclipse.jface.preference.PreferenceDialog; | ||
18 | import org.eclipse.ui.dialogs.PreferencesUtil; | ||
19 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
20 | |||
21 | |||
22 | @SuppressWarnings("restriction") | ||
23 | public class ReconfigYoctoAction extends InvokeAction { | ||
24 | |||
25 | public void run(IAction action) { | ||
26 | IContainer container = getSelectedContainer(); | ||
27 | if (container == null) | ||
28 | return; | ||
29 | |||
30 | IProject project = container.getProject(); | ||
31 | |||
32 | PreferenceDialog dialog = | ||
33 | PreferencesUtil.createPropertyDialogOn(YoctoSDKPlugin.getActiveWorkbenchShell(), | ||
34 | project, | ||
35 | "org.yocto.sdk.ide.page", | ||
36 | null, | ||
37 | null); | ||
38 | dialog.open(); | ||
39 | } | ||
40 | |||
41 | public void dispose() { | ||
42 | |||
43 | } | ||
44 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoHandler.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoHandler.java new file mode 100644 index 0000000..6d508d3 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/ReconfigYoctoHandler.java | |||
@@ -0,0 +1,78 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.actions; | ||
12 | |||
13 | import java.lang.reflect.Method; | ||
14 | |||
15 | import org.eclipse.core.commands.ExecutionEvent; | ||
16 | import org.eclipse.core.commands.ExecutionException; | ||
17 | import org.eclipse.core.expressions.IEvaluationContext; | ||
18 | import org.eclipse.core.resources.IContainer; | ||
19 | import org.eclipse.core.runtime.IStatus; | ||
20 | import org.eclipse.core.runtime.Status; | ||
21 | import org.eclipse.jface.dialogs.ErrorDialog; | ||
22 | import org.eclipse.cdt.internal.autotools.ui.actions.AbstractAutotoolsHandler; | ||
23 | import org.eclipse.cdt.internal.autotools.ui.actions.InvokeAction; | ||
24 | import org.eclipse.swt.widgets.Display; | ||
25 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
26 | |||
27 | |||
28 | @SuppressWarnings("restriction") | ||
29 | public class ReconfigYoctoHandler extends AbstractAutotoolsHandler { | ||
30 | |||
31 | public Object execute(ExecutionEvent event) throws ExecutionException { | ||
32 | ReconfigYoctoAction action = new ReconfigYoctoAction(); | ||
33 | Method method = null; | ||
34 | |||
35 | try { | ||
36 | /* | ||
37 | * This is hack to workaround upstream eclipse bug #370288 | ||
38 | */ | ||
39 | Class [] params = {ExecutionEvent.class, InvokeAction.class}; | ||
40 | method = AbstractAutotoolsHandler.class.getDeclaredMethod("execute",params ); | ||
41 | } catch (NoSuchMethodException e) { | ||
42 | //no such method, old version of plugin org.eclipse.linuxtools.autotools.ui | ||
43 | method = null; | ||
44 | } catch (Exception e) { | ||
45 | throw new ExecutionException(e.getMessage(), e); | ||
46 | } | ||
47 | |||
48 | if (method != null) { | ||
49 | //new version | ||
50 | Object [] params = {event, action}; | ||
51 | try { | ||
52 | return method.invoke(this, params); | ||
53 | }catch (Exception e) { | ||
54 | throw new ExecutionException(e.getMessage(), e); | ||
55 | } | ||
56 | } else { | ||
57 | //old version | ||
58 | //display a dialog to warn the user | ||
59 | Display.getDefault().syncExec(new Runnable() { | ||
60 | public void run() { | ||
61 | ErrorDialog.openError(null, "Change Yocto Project Settings", "Please update the plugin of \"Autotools support for CDT\"!", | ||
62 | new Status(IStatus.WARNING,YoctoSDKPlugin.PLUGIN_ID,"old version of plugin \"Autotools support for CDT\" detected.")); | ||
63 | } | ||
64 | }); | ||
65 | //try to display the dialog in the old way | ||
66 | Object o = event.getApplicationContext(); | ||
67 | if (o instanceof IEvaluationContext) { | ||
68 | IContainer container = getContainer((IEvaluationContext)o); | ||
69 | if (container != null) { | ||
70 | action.setSelectedContainer(container); | ||
71 | action.run(null); | ||
72 | } | ||
73 | } | ||
74 | } | ||
75 | |||
76 | return null; | ||
77 | } | ||
78 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/YoctoConsole.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/YoctoConsole.java new file mode 100644 index 0000000..4b25d94 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/actions/YoctoConsole.java | |||
@@ -0,0 +1,24 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.actions; | ||
12 | |||
13 | import org.eclipse.cdt.internal.autotools.ui.Console; | ||
14 | import org.yocto.sdk.ide.YoctoSDKMessages; | ||
15 | |||
16 | @SuppressWarnings("restriction") | ||
17 | public class YoctoConsole extends Console { | ||
18 | private static final String CONTEXT_MENU_ID = "YoctoConsole"; | ||
19 | private static final String CONSOLE_NAME = YoctoSDKMessages.getString("Console.SDK.Name"); | ||
20 | |||
21 | public YoctoConsole() { | ||
22 | super(CONSOLE_NAME, CONTEXT_MENU_ID); | ||
23 | } | ||
24 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java new file mode 100644 index 0000000..ce80d77 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKAutotoolsProjectNature.java | |||
@@ -0,0 +1,79 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.natures; | ||
12 | |||
13 | import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager; | ||
14 | import org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration; | ||
15 | import org.eclipse.cdt.managedbuilder.core.IConfiguration; | ||
16 | import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; | ||
17 | import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; | ||
18 | import org.eclipse.core.resources.IProject; | ||
19 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
20 | import org.yocto.sdk.ide.YoctoUIElement; | ||
21 | import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; | ||
22 | import org.yocto.sdk.ide.utils.YoctoSDKUtils; | ||
23 | |||
24 | public class YoctoSDKAutotoolsProjectNature extends YoctoSDKProjectNature { | ||
25 | public static final String YoctoSDK_AUTOTOOLS_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKAutotoolsNature"; | ||
26 | |||
27 | private static final String DEFAULT_HOST_STR = "host"; | ||
28 | private static final String DEFAULT_TARGET_STR = "target"; | ||
29 | private static final String DEFAULT_BUILD_STR = "build"; | ||
30 | private static final String DEFAULT_AUTOGEN_OPT_STR = "autogenOpts"; | ||
31 | |||
32 | private static final String DEFAULT_CONFIGURE_STR = "configure"; | ||
33 | private static final String DEFAULT_AUTOGEN_STR = "autogen"; | ||
34 | private static final String DEFAULT_LIBTOOL_SYSROOT_PREFIX = " --with-libtool-sysroot="; | ||
35 | |||
36 | public static void configureAutotoolsOptions(IProject project) { | ||
37 | IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); | ||
38 | IConfiguration icfg = info.getDefaultConfiguration(); | ||
39 | YoctoUIElement elem = ProjectPreferenceUtils.getElemFromProjectEnv(project); | ||
40 | String sysroot_str = elem.getStrSysrootLoc(); | ||
41 | String id = icfg.getId(); | ||
42 | String CFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CFLAGS"); | ||
43 | String CXXFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CXXFLAGS"); | ||
44 | String CPPFLAGS_str = YoctoSDKUtils.getEnvValue(project, "CPPFLAGS"); | ||
45 | String LDFLAGS_str = YoctoSDKUtils.getEnvValue(project, "LDFLAGS"); | ||
46 | |||
47 | String command_prefix = "CFLAGS=\" -g -O0 " + CFLAGS_str + "\" CXXFLAGS=\" -g -O0 " | ||
48 | + CXXFLAGS_str + "\" LDFLAGS=\"" + LDFLAGS_str + "\" CPPFLAGS=\"" + CPPFLAGS_str + "\""; | ||
49 | String autogen_setting = command_prefix+" autogen.sh" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str; | ||
50 | String configure_setting = command_prefix + " configure" + DEFAULT_LIBTOOL_SYSROOT_PREFIX + sysroot_str; | ||
51 | IAConfiguration cfg = AutotoolsConfigurationManager.getInstance().getConfiguration(project, id); | ||
52 | String strConfigure = YoctoSDKUtils.getEnvValue(project, "CONFIGURE_FLAGS"); | ||
53 | |||
54 | cfg.setOption(DEFAULT_CONFIGURE_STR, configure_setting); | ||
55 | cfg.setOption(DEFAULT_BUILD_STR, splitString(strConfigure, "--build=")); | ||
56 | cfg.setOption(DEFAULT_HOST_STR, splitString(strConfigure, "--host=")); | ||
57 | cfg.setOption(DEFAULT_TARGET_STR, splitString(strConfigure, "--target=")); | ||
58 | cfg.setOption(DEFAULT_AUTOGEN_STR, autogen_setting); | ||
59 | cfg.setOption(DEFAULT_AUTOGEN_OPT_STR, strConfigure); | ||
60 | |||
61 | AutotoolsConfigurationManager.getInstance().addConfiguration(project, cfg); | ||
62 | AutotoolsConfigurationManager.getInstance().saveConfigs(project); | ||
63 | } | ||
64 | |||
65 | private static String splitString(String strValue, String strDelim) { | ||
66 | int iBeginIndex = strValue.indexOf(strDelim); | ||
67 | |||
68 | if (iBeginIndex < 0) { | ||
69 | return ""; | ||
70 | } | ||
71 | int iEndIndex = strValue.indexOf(' ', iBeginIndex + 1); | ||
72 | |||
73 | if (iEndIndex < 0) { | ||
74 | return strValue.substring(iBeginIndex + strDelim.length()); | ||
75 | } else { | ||
76 | return strValue.substring(iBeginIndex + strDelim.length(), iEndIndex); | ||
77 | } | ||
78 | } | ||
79 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java new file mode 100644 index 0000000..b3d0f2c --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java | |||
@@ -0,0 +1,92 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.natures; | ||
12 | |||
13 | import org.eclipse.cdt.core.CCorePlugin; | ||
14 | import org.eclipse.cdt.core.envvar.IContributedEnvironment; | ||
15 | import org.eclipse.cdt.core.envvar.IEnvironmentVariable; | ||
16 | import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager; | ||
17 | import org.eclipse.cdt.core.model.CoreModel; | ||
18 | import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; | ||
19 | import org.eclipse.cdt.core.settings.model.ICProjectDescription; | ||
20 | import org.eclipse.core.resources.IProject; | ||
21 | import org.eclipse.core.runtime.CoreException; | ||
22 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
23 | import org.yocto.sdk.ide.utils.YoctoSDKUtils; | ||
24 | |||
25 | public class YoctoSDKCMakeProjectNature extends YoctoSDKProjectNature { | ||
26 | public static final String YoctoSDK_CMAKE_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKCMakeNature"; | ||
27 | |||
28 | // Considered poky's cmake.bbclass for this method | ||
29 | public static void extendProjectEnvironmentForCMake(IProject project) { | ||
30 | ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true); | ||
31 | ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration(); | ||
32 | IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager(); | ||
33 | IContributedEnvironment env = manager.getContributedEnvironment(); | ||
34 | String delimiter = manager.getDefaultDelimiter(); | ||
35 | |||
36 | env.addVariable("CCACHE", "", IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
37 | |||
38 | env.addVariable("OECMAKE_SOURCEPATH", "..", | ||
39 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
40 | |||
41 | String oecmakeBuildPathString = ""; | ||
42 | env.addVariable("OECMAKE_BUILDPATH", oecmakeBuildPathString, | ||
43 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
44 | env.addVariable("EXTRA_OEMAKE", "-C " + oecmakeBuildPathString, | ||
45 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
46 | |||
47 | String ccString = YoctoSDKUtils.getEnvValue(project, "CC"); | ||
48 | |||
49 | if (!ccString.equals("") && !ccString.equals(" ")) { | ||
50 | ccString.trim(); | ||
51 | ccString = ccString.split(" ")[0]; | ||
52 | } | ||
53 | |||
54 | env.addVariable("OECMAKE_C_COMPILER", ccString, | ||
55 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
56 | String cxxString = YoctoSDKUtils.getEnvValue(project, "CXX"); | ||
57 | |||
58 | if (!cxxString.equals("") && !cxxString.equals(" ")) { | ||
59 | cxxString.trim(); | ||
60 | cxxString = cxxString.split(" ")[0]; | ||
61 | } | ||
62 | |||
63 | env.addVariable("OECMAKE_CXX_COMPILER", cxxString, | ||
64 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
65 | |||
66 | String hostCCArchString = YoctoSDKUtils.getEnvValue(project, "HOST_CC_ARCH"); | ||
67 | String toolchainOptionsString = YoctoSDKUtils.getEnvValue(project, "TOOLCHAIN_OPTIONS"); | ||
68 | String cppFlagsString = YoctoSDKUtils.getEnvValue(project, "CPPFLAGS"); | ||
69 | String cxxFlagsString = YoctoSDKUtils.getEnvValue(project, "CXXFLAGS"); | ||
70 | String selectedOptimizationString = YoctoSDKUtils.getEnvValue(project, "SELECTED_OPTIMIZATION"); | ||
71 | env.addVariable("OECMAKE_C_FLAGS", hostCCArchString + " " + toolchainOptionsString + " " + cppFlagsString, | ||
72 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
73 | env.addVariable("OECMAKE_CXX_FLAGS", hostCCArchString + " " + toolchainOptionsString + " " + cxxFlagsString | ||
74 | + " -fpermissive", | ||
75 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
76 | env.addVariable("OECMAKE_C_FLAGS_RELEASE", selectedOptimizationString + " " + cppFlagsString + " -DNDEBUG", | ||
77 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
78 | env.addVariable("OECMAKE_CXX_FLAGS_RELEASE", selectedOptimizationString + " " + cxxFlagsString + " -DNDEBUG", | ||
79 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
80 | |||
81 | env.addVariable("OECMAKE_RPATH", "", | ||
82 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
83 | env.addVariable("OECMAKE_PERLNATIVE_DIR", "", | ||
84 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
85 | |||
86 | try { | ||
87 | CoreModel.getDefault().setProjectDescription(project, cpdesc); | ||
88 | } catch (CoreException e) { | ||
89 | e.printStackTrace(); | ||
90 | } | ||
91 | } | ||
92 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java new file mode 100644 index 0000000..e1b847a --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKEmptyProjectNature.java | |||
@@ -0,0 +1,8 @@ | |||
1 | package org.yocto.sdk.ide.natures; | ||
2 | |||
3 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
4 | |||
5 | public class YoctoSDKEmptyProjectNature extends YoctoSDKProjectNature { | ||
6 | |||
7 | public static final String YoctoSDK_EMPTY_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKEmptyNature"; | ||
8 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java new file mode 100644 index 0000000..5a2a6b1 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKNatureUtils.java | |||
@@ -0,0 +1,39 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | * BMW Car IT - extracted in an own class | ||
11 | *******************************************************************************/ | ||
12 | package org.yocto.sdk.ide.natures; | ||
13 | |||
14 | import org.eclipse.core.resources.IProject; | ||
15 | import org.eclipse.core.resources.IProjectDescription; | ||
16 | import org.eclipse.core.runtime.CoreException; | ||
17 | import org.eclipse.core.runtime.IProgressMonitor; | ||
18 | |||
19 | public class YoctoSDKNatureUtils { | ||
20 | |||
21 | public static void addNature(IProject project, String natureId, IProgressMonitor monitor) throws CoreException | ||
22 | { | ||
23 | IProjectDescription description = project.getDescription(); | ||
24 | String[] natures = description.getNatureIds(); | ||
25 | |||
26 | for (int i = 0; i < natures.length; ++i) { | ||
27 | if (natureId.equals(natures[i])) | ||
28 | return; | ||
29 | } | ||
30 | |||
31 | String[] newNatures = new String[natures.length + 1]; | ||
32 | System.arraycopy(natures, 0, newNatures, 0, natures.length); | ||
33 | newNatures[natures.length] = natureId; | ||
34 | description.setNatureIds(newNatures); | ||
35 | project.setDescription(description, monitor); | ||
36 | |||
37 | } | ||
38 | |||
39 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java new file mode 100644 index 0000000..e3f6a35 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKProjectNature.java | |||
@@ -0,0 +1,36 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.natures; | ||
12 | |||
13 | import org.eclipse.core.resources.IProject; | ||
14 | import org.eclipse.core.resources.IProjectNature; | ||
15 | import org.eclipse.core.runtime.CoreException; | ||
16 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
17 | |||
18 | public class YoctoSDKProjectNature implements IProjectNature { | ||
19 | public static final String YoctoSDK_NATURE_ID = YoctoSDKPlugin.getUniqueIdentifier() + ".YoctoSDKNature"; | ||
20 | |||
21 | private IProject proj; | ||
22 | |||
23 | public void configure() throws CoreException { | ||
24 | } | ||
25 | |||
26 | public void deconfigure() throws CoreException { | ||
27 | } | ||
28 | |||
29 | public IProject getProject() { | ||
30 | return proj; | ||
31 | } | ||
32 | |||
33 | public void setProject(IProject project) { | ||
34 | this.proj = project; | ||
35 | } | ||
36 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java new file mode 100644 index 0000000..0ebbe99 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceConstants.java | |||
@@ -0,0 +1,43 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.preferences; | ||
12 | |||
13 | /** | ||
14 | * Constant definitions for plug-in preferences | ||
15 | */ | ||
16 | public class PreferenceConstants { | ||
17 | |||
18 | public static final String TOOLCHAIN_ROOT = "toolChainRoot"; | ||
19 | |||
20 | public static final String TARGET_MODE = "TargetMode"; | ||
21 | |||
22 | public static final String SDK_MODE = "SDKMode"; | ||
23 | |||
24 | public static final String TARGET_ARCH_INDEX = "targeArchIndex"; | ||
25 | |||
26 | public static final String TOOLCHAIN_TRIPLET = "toolchainTriplet"; | ||
27 | |||
28 | public static final String QEMU_KERNEL = "QemuKernel"; | ||
29 | |||
30 | public static final String QEMU_OPTION = "QemuOption"; | ||
31 | |||
32 | public static final String SYSROOT = "Sysroot"; | ||
33 | |||
34 | public static final String IP_ADDR = "IPAddr"; | ||
35 | |||
36 | public static final String STANDARD_PROFILE_NAME = "Standard Profile"; | ||
37 | |||
38 | public static final String PROFILES = "profiles"; | ||
39 | |||
40 | public static final String SELECTED_PROFILE = "selectedProfile"; | ||
41 | |||
42 | public static final String PROJECT_SPECIFIC_PROFILE = "##PROJECT_SPECIFIC_PROFILE##"; | ||
43 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceInitializer.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceInitializer.java new file mode 100644 index 0000000..40f37d0 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/PreferenceInitializer.java | |||
@@ -0,0 +1,44 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.preferences; | ||
12 | |||
13 | import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; | ||
14 | import org.eclipse.jface.preference.IPreferenceStore; | ||
15 | |||
16 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
17 | |||
18 | import static org.yocto.sdk.ide.preferences.PreferenceConstants.*; | ||
19 | |||
20 | /** | ||
21 | * Class used to initialize default preference values. | ||
22 | */ | ||
23 | public class PreferenceInitializer extends AbstractPreferenceInitializer { | ||
24 | /* | ||
25 | * (non-Javadoc) | ||
26 | * | ||
27 | * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() | ||
28 | */ | ||
29 | public void initializeDefaultPreferences() { | ||
30 | IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore(); | ||
31 | store.setDefault(TOOLCHAIN_ROOT, ""); | ||
32 | store.setDefault(SDK_MODE, true); | ||
33 | store.setDefault(TARGET_MODE, false); | ||
34 | store.setDefault(TARGET_ARCH_INDEX, -1); | ||
35 | store.setDefault(IP_ADDR, ""); | ||
36 | store.setDefault(QEMU_KERNEL, ""); | ||
37 | store.setDefault(QEMU_OPTION, ""); | ||
38 | store.setDefault(SYSROOT, ""); | ||
39 | store.setDefault(TOOLCHAIN_TRIPLET, ""); | ||
40 | store.setDefault(PROFILES, "\"" + STANDARD_PROFILE_NAME + "\""); | ||
41 | store.setDefault(SELECTED_PROFILE, STANDARD_PROFILE_NAME); | ||
42 | } | ||
43 | |||
44 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java new file mode 100644 index 0000000..38e38b1 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/ProfileNameInputValidator.java | |||
@@ -0,0 +1,63 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2012 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.preferences; | ||
12 | |||
13 | import org.eclipse.jface.dialogs.IInputValidator; | ||
14 | import org.yocto.sdk.ide.YoctoProfileElement; | ||
15 | import org.yocto.sdk.ide.YoctoSDKMessages; | ||
16 | |||
17 | public class ProfileNameInputValidator implements IInputValidator { | ||
18 | private static final String WARNING_CONTAINS_COMMA = "Preferences.Profile.Validator.InvalidName.Comma"; | ||
19 | private static final String WARNING_CONTAINS_DOUBLEQUOTE = "Preferences.Profile.Validator.InvalidName.Quote"; | ||
20 | private static final String PROFILE_NAME_IS_EMPTY = "Preferences.Profile.Validator.InvalidName.Empty"; | ||
21 | private static final String WARNING_ALREADY_EXISTS = "Preferences.Profile.Validator.InvalidName.Exists"; | ||
22 | |||
23 | private final String selectedItem; | ||
24 | private final YoctoProfileElement profileSetting; | ||
25 | |||
26 | public ProfileNameInputValidator(YoctoProfileElement profileSetting) { | ||
27 | this(profileSetting, ""); | ||
28 | } | ||
29 | |||
30 | public ProfileNameInputValidator(YoctoProfileElement profileSetting, String selectedItem) { | ||
31 | this.selectedItem = selectedItem; | ||
32 | this.profileSetting = profileSetting; | ||
33 | } | ||
34 | |||
35 | @Override | ||
36 | public String isValid(String newText) { | ||
37 | if (newText.contains(",")) { | ||
38 | return YoctoSDKMessages.getString(WARNING_CONTAINS_COMMA); | ||
39 | } | ||
40 | |||
41 | if (newText.contains("\"")) { | ||
42 | return YoctoSDKMessages.getString(WARNING_CONTAINS_DOUBLEQUOTE); | ||
43 | } | ||
44 | |||
45 | if (newText.isEmpty()) { | ||
46 | return YoctoSDKMessages.getString(PROFILE_NAME_IS_EMPTY); | ||
47 | } | ||
48 | |||
49 | if (selectedItemEquals(newText)) { | ||
50 | return null; | ||
51 | } | ||
52 | |||
53 | if (profileSetting.contains(newText)) { | ||
54 | return YoctoSDKMessages.getString(WARNING_ALREADY_EXISTS); | ||
55 | } | ||
56 | |||
57 | return null; | ||
58 | } | ||
59 | |||
60 | private boolean selectedItemEquals(String newText) { | ||
61 | return !selectedItem.isEmpty() && newText.equals(selectedItem); | ||
62 | } | ||
63 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java new file mode 100644 index 0000000..4e6ca2a --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKPreferencePage.java | |||
@@ -0,0 +1,307 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.preferences; | ||
12 | |||
13 | import java.util.HashSet; | ||
14 | |||
15 | import org.eclipse.core.resources.IProject; | ||
16 | import org.eclipse.core.resources.ResourcesPlugin; | ||
17 | import org.eclipse.core.runtime.CoreException; | ||
18 | import org.eclipse.jface.dialogs.Dialog; | ||
19 | import org.eclipse.jface.dialogs.IDialogConstants; | ||
20 | import org.eclipse.jface.dialogs.InputDialog; | ||
21 | import org.eclipse.jface.dialogs.MessageDialog; | ||
22 | import org.eclipse.jface.preference.IPreferenceStore; | ||
23 | import org.eclipse.jface.preference.PreferencePage; | ||
24 | import org.eclipse.swt.SWT; | ||
25 | import org.eclipse.swt.layout.GridLayout; | ||
26 | import org.eclipse.swt.widgets.Composite; | ||
27 | import org.eclipse.swt.widgets.Control; | ||
28 | import org.eclipse.swt.widgets.Event; | ||
29 | import org.eclipse.swt.widgets.Listener; | ||
30 | import org.eclipse.ui.IWorkbench; | ||
31 | import org.eclipse.ui.IWorkbenchPreferencePage; | ||
32 | import org.yocto.sdk.ide.YoctoProfileElement; | ||
33 | import org.yocto.sdk.ide.YoctoProfileSetting; | ||
34 | import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom; | ||
35 | import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; | ||
36 | import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; | ||
37 | import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; | ||
38 | import org.yocto.sdk.ide.utils.YoctoSDKUtils; | ||
39 | import org.yocto.sdk.ide.YoctoSDKMessages; | ||
40 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
41 | import org.yocto.sdk.ide.YoctoUIElement; | ||
42 | import org.yocto.sdk.ide.YoctoUISetting; | ||
43 | |||
44 | public class YoctoSDKPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { | ||
45 | |||
46 | private static final String NEW_DIALOG_TITLE = "Preferences.Profile.New.Dialog.Title"; | ||
47 | private static final String NEW_DIALOG_MESSAGE = "Preferences.Profile.New.Dialog.Message"; | ||
48 | private static final String UPDATE_DIALOG_TITLE = "Preferences.Profile.Update.Dialog.Title"; | ||
49 | private static final String UPDATE_DIALOG_MESSAGE = "Preferences.Profile.Update.Dialog.Message"; | ||
50 | private static final String REVALIDATION_MESSAGE = "Poky.SDK.Revalidation.Message"; | ||
51 | |||
52 | private YoctoProfileSetting yoctoProfileSetting; | ||
53 | private YoctoUISetting yoctoUISetting; | ||
54 | |||
55 | private Listener changeListener; | ||
56 | |||
57 | public YoctoSDKPreferencePage() { | ||
58 | //super(GRID); | ||
59 | IPreferenceStore defaultStore = YoctoSDKPlugin.getDefault().getPreferenceStore(); | ||
60 | String profiles = defaultStore.getString(PreferenceConstants.PROFILES); | ||
61 | String selectedProfile = defaultStore.getString(PreferenceConstants.SELECTED_PROFILE); | ||
62 | |||
63 | if (profiles.isEmpty()) { | ||
64 | profiles = defaultStore.getDefaultString(PreferenceConstants.PROFILES); | ||
65 | selectedProfile = defaultStore.getDefaultString(PreferenceConstants.SELECTED_PROFILE); | ||
66 | } | ||
67 | |||
68 | setPreferenceStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile)); | ||
69 | //setDescription(YoctoSDKMessages.getString(PREFERENCES_Yocto_CONFIG)); | ||
70 | YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(getPreferenceStore()); | ||
71 | this.yoctoUISetting = new YoctoUISetting(elem); | ||
72 | |||
73 | YoctoProfileElement profileElement = new YoctoProfileElement(profiles, selectedProfile); | ||
74 | this.yoctoProfileSetting = new YoctoProfileSetting(profileElement, this, true); | ||
75 | |||
76 | changeListener = new Listener() { | ||
77 | @Override | ||
78 | public void handleEvent(Event event) { | ||
79 | setErrorMessage(null); | ||
80 | setMessage(YoctoSDKMessages.getString(REVALIDATION_MESSAGE), INFORMATION); | ||
81 | } | ||
82 | }; | ||
83 | } | ||
84 | |||
85 | /* | ||
86 | * @see IWorkbenchPreferencePage#init(IWorkbench) | ||
87 | */ | ||
88 | public void init(IWorkbench workbench) { | ||
89 | } | ||
90 | |||
91 | protected Control createContents(Composite parent) { | ||
92 | initializeDialogUnits(parent); | ||
93 | final Composite composite= new Composite(parent, SWT.NONE); | ||
94 | composite.setLayout(new GridLayout(2, false)); | ||
95 | |||
96 | yoctoProfileSetting.createComposite(composite); | ||
97 | yoctoUISetting.createComposite(composite); | ||
98 | |||
99 | composite.addListener(SWT.Modify, changeListener); | ||
100 | composite.addListener(SWT.Selection, changeListener); | ||
101 | |||
102 | SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false); | ||
103 | if (result != SDKCheckResults.SDK_PASS) { | ||
104 | } | ||
105 | |||
106 | Dialog.applyDialogFont(composite); | ||
107 | return composite; | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * @see IPreferencePage#performOk() | ||
112 | */ | ||
113 | public boolean performOk() { | ||
114 | clearMessages(); | ||
115 | |||
116 | SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false); | ||
117 | if (result != SDKCheckResults.SDK_PASS) { | ||
118 | setErrorMessage(result.getMessage()); | ||
119 | return false; | ||
120 | } | ||
121 | |||
122 | YoctoUIElement savedElement = YoctoSDKUtils.getElemFromStore(getPreferenceStore()); | ||
123 | YoctoUIElement modifiedElement = yoctoUISetting.getCurrentInput(); | ||
124 | |||
125 | YoctoProfileElement savedProfileElement = YoctoSDKUtils.getProfilesFromDefaultStore(); | ||
126 | YoctoProfileElement profileElement = yoctoProfileSetting.getCurrentInput(); | ||
127 | |||
128 | if (savedElement.equals(modifiedElement) && | ||
129 | profileElement.getSelectedProfile().equals(savedProfileElement.getSelectedProfile())) { | ||
130 | return true; | ||
131 | } | ||
132 | |||
133 | HashSet<IProject> yoctoProjects = getAffectedProjects(profileElement.getSelectedProfile()); | ||
134 | |||
135 | if (!yoctoProjects.isEmpty()) { | ||
136 | boolean deleteConfirmed = | ||
137 | MessageDialog.openConfirm(null, YoctoSDKMessages.getString(UPDATE_DIALOG_TITLE), | ||
138 | YoctoSDKMessages.getFormattedString(UPDATE_DIALOG_MESSAGE, profileElement.getSelectedProfile())); | ||
139 | |||
140 | if (!deleteConfirmed) { | ||
141 | return false; | ||
142 | } | ||
143 | } | ||
144 | |||
145 | saveElemToStore(modifiedElement, getPreferenceStore()); | ||
146 | YoctoSDKUtils.saveProfilesToDefaultStore(profileElement); | ||
147 | |||
148 | updateProjects(yoctoProjects, modifiedElement); | ||
149 | |||
150 | return super.performOk(); | ||
151 | } | ||
152 | |||
153 | private void clearMessages() { | ||
154 | setErrorMessage(null); | ||
155 | setMessage(null); | ||
156 | setTitle(getTitle()); | ||
157 | } | ||
158 | |||
159 | /* | ||
160 | * @see PreferencePage#performDefaults() | ||
161 | */ | ||
162 | protected void performDefaults() { | ||
163 | YoctoUIElement defaultElement = YoctoSDKUtils.getDefaultElemFromDefaultStore(); | ||
164 | yoctoUISetting.setCurrentInput(defaultElement); | ||
165 | super.performDefaults(); | ||
166 | } | ||
167 | |||
168 | public void performSaveAs() { | ||
169 | YoctoProfileElement profileElement = yoctoProfileSetting.getCurrentInput(); | ||
170 | YoctoUIElement uiElement = yoctoUISetting.getCurrentInput(); | ||
171 | |||
172 | SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, true); | ||
173 | if (result != SDKCheckResults.SDK_PASS) { | ||
174 | setErrorMessage(result.getMessage()); | ||
175 | return; | ||
176 | } | ||
177 | |||
178 | InputDialog profileNameDialog = | ||
179 | new InputDialog(null, | ||
180 | YoctoSDKMessages.getString(NEW_DIALOG_TITLE), | ||
181 | YoctoSDKMessages.getString(NEW_DIALOG_MESSAGE), | ||
182 | null, | ||
183 | new ProfileNameInputValidator(profileElement)); | ||
184 | |||
185 | int returnCode = profileNameDialog.open(); | ||
186 | if (returnCode == IDialogConstants.CANCEL_ID) { | ||
187 | return; | ||
188 | } | ||
189 | |||
190 | profileElement.addProfile(profileNameDialog.getValue()); | ||
191 | yoctoProfileSetting.addProfile(profileNameDialog.getValue()); | ||
192 | |||
193 | yoctoUISetting.setCurrentInput(uiElement); | ||
194 | performOk(); | ||
195 | } | ||
196 | |||
197 | public void switchProfile(String selectedProfile) { | ||
198 | setPreferenceStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile)); | ||
199 | YoctoUIElement profileElement = YoctoSDKUtils.getElemFromStore(getPreferenceStore()); | ||
200 | yoctoUISetting.setCurrentInput(profileElement); | ||
201 | } | ||
202 | |||
203 | public void renameProfile(String oldProfileName, String newProfileName) { | ||
204 | YoctoUIElement oldProfileElement = YoctoSDKUtils.getElemFromStore(YoctoSDKPlugin.getProfilePreferenceStore(oldProfileName)); | ||
205 | saveElemToStore(oldProfileElement, YoctoSDKPlugin.getProfilePreferenceStore(newProfileName)); | ||
206 | |||
207 | renameProfileInAffectedProjects(oldProfileName, newProfileName); | ||
208 | } | ||
209 | |||
210 | public void deleteProfile(String selectedProfile) | ||
211 | { | ||
212 | resetProfileInAffectedProjects(selectedProfile); | ||
213 | } | ||
214 | |||
215 | /* Save IDE wide POKY Preference settings to a specific preference store */ | ||
216 | private void saveElemToStore(YoctoUIElement elem, IPreferenceStore store) { | ||
217 | store.setValue(PreferenceConstants.TARGET_ARCH_INDEX, elem.getIntTargetIndex()); | ||
218 | |||
219 | if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { | ||
220 | store.setValue(PreferenceConstants.SDK_MODE, IPreferenceStore.TRUE); | ||
221 | } else { | ||
222 | store.setValue(PreferenceConstants.SDK_MODE, IPreferenceStore.FALSE); | ||
223 | } | ||
224 | store.setValue(PreferenceConstants.QEMU_KERNEL, elem.getStrQemuKernelLoc()); | ||
225 | store.setValue(PreferenceConstants.QEMU_OPTION, elem.getStrQemuOption()); | ||
226 | store.setValue(PreferenceConstants.SYSROOT, elem.getStrSysrootLoc()); | ||
227 | if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) { | ||
228 | store.setValue(PreferenceConstants.TARGET_MODE, IPreferenceStore.TRUE); | ||
229 | } else { | ||
230 | store.setValue(PreferenceConstants.TARGET_MODE, IPreferenceStore.FALSE); | ||
231 | } | ||
232 | store.setValue(PreferenceConstants.TOOLCHAIN_ROOT, elem.getStrToolChainRoot()); | ||
233 | store.setValue(PreferenceConstants.TOOLCHAIN_TRIPLET, elem.getStrTarget()); | ||
234 | } | ||
235 | |||
236 | private void resetProfileInAffectedProjects(String usedProfile) | ||
237 | { | ||
238 | HashSet<IProject> yoctoProjects = getAffectedProjects(usedProfile); | ||
239 | YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore(); | ||
240 | profileElement.setSelectedProfile(PreferenceConstants.STANDARD_PROFILE_NAME); | ||
241 | |||
242 | for (IProject project : yoctoProjects) | ||
243 | { | ||
244 | ProjectPreferenceUtils.saveProfiles(profileElement, project); | ||
245 | YoctoUIElement elem = YoctoSDKUtils.getElemFromStore( | ||
246 | YoctoSDKPlugin.getProfilePreferenceStore(PreferenceConstants.STANDARD_PROFILE_NAME)); | ||
247 | ProjectPreferenceUtils.saveElemToProjectEnv(elem, project); | ||
248 | } | ||
249 | } | ||
250 | |||
251 | private void renameProfileInAffectedProjects(String oldProfileName, String newProfileName) { | ||
252 | HashSet<IProject> yoctoProjects = getAffectedProjects(oldProfileName); | ||
253 | YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore(); | ||
254 | profileElement.setSelectedProfile(newProfileName); | ||
255 | |||
256 | for (IProject project : yoctoProjects) | ||
257 | { | ||
258 | ProjectPreferenceUtils.saveProfiles(profileElement, project); | ||
259 | } | ||
260 | } | ||
261 | |||
262 | private void updateProjects(HashSet<IProject> yoctoProjects, YoctoUIElement elem) { | ||
263 | for (IProject project : yoctoProjects) | ||
264 | { | ||
265 | ProjectPreferenceUtils.saveElemToProjectEnv(elem, project); | ||
266 | } | ||
267 | } | ||
268 | |||
269 | private HashSet<IProject> getAffectedProjects(String usedProfile) | ||
270 | { | ||
271 | HashSet<IProject> yoctoProjects = new HashSet<IProject>(); | ||
272 | |||
273 | IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); | ||
274 | |||
275 | for (IProject project : projects) | ||
276 | { | ||
277 | try | ||
278 | { | ||
279 | if (!project.hasNature(YoctoSDKProjectNature.YoctoSDK_NATURE_ID)) { | ||
280 | continue; | ||
281 | } | ||
282 | } catch (CoreException e) | ||
283 | { | ||
284 | // project is closed or does not exist so don't update | ||
285 | continue; | ||
286 | } | ||
287 | |||
288 | if (!projectUsesProfile(project, usedProfile)) { | ||
289 | continue; | ||
290 | } | ||
291 | |||
292 | yoctoProjects.add(project); | ||
293 | } | ||
294 | return yoctoProjects; | ||
295 | } | ||
296 | |||
297 | private boolean projectUsesProfile(IProject project, String profile) | ||
298 | { | ||
299 | YoctoProfileElement profileElement = ProjectPreferenceUtils.getProfiles(project); | ||
300 | |||
301 | if (!profileElement.getSelectedProfile().equals(profile)) { | ||
302 | return false; | ||
303 | } | ||
304 | |||
305 | return true; | ||
306 | } | ||
307 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java new file mode 100644 index 0000000..a85cbd9 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/preferences/YoctoSDKProjectPropertyPage.java | |||
@@ -0,0 +1,202 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2012 BMW Car IT GmbH. | ||
3 | * Copyright (c) 2010 Intel. | ||
4 | * All rights reserved. This program and the accompanying materials | ||
5 | * are made available under the terms of the Eclipse Public License v1.0 | ||
6 | * which accompanies this distribution, and is available at | ||
7 | * http://www.eclipse.org/legal/epl-v10.html | ||
8 | * | ||
9 | * Contributors: | ||
10 | * BMW Car IT GmbH - initial implementation | ||
11 | * Intel - initial API implementation (copied from YoctoSDKPreferencePage) | ||
12 | *******************************************************************************/ | ||
13 | package org.yocto.sdk.ide.preferences; | ||
14 | |||
15 | import org.eclipse.core.resources.IProject; | ||
16 | import org.eclipse.core.runtime.IAdaptable; | ||
17 | import org.eclipse.jface.dialogs.Dialog; | ||
18 | import org.eclipse.swt.SWT; | ||
19 | import org.eclipse.swt.layout.GridLayout; | ||
20 | import org.eclipse.swt.widgets.Composite; | ||
21 | import org.eclipse.swt.widgets.Control; | ||
22 | import org.eclipse.swt.widgets.Event; | ||
23 | import org.eclipse.swt.widgets.Listener; | ||
24 | import org.eclipse.ui.IWorkbenchPropertyPage; | ||
25 | import org.eclipse.ui.dialogs.PropertyPage; | ||
26 | import org.yocto.sdk.ide.YoctoProfileElement; | ||
27 | import org.yocto.sdk.ide.YoctoProfileSetting; | ||
28 | import org.yocto.sdk.ide.YoctoProjectSpecificSetting; | ||
29 | import org.yocto.sdk.ide.YoctoSDKChecker; | ||
30 | import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckRequestFrom; | ||
31 | import org.yocto.sdk.ide.YoctoSDKChecker.SDKCheckResults; | ||
32 | import org.yocto.sdk.ide.YoctoSDKMessages; | ||
33 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
34 | import org.yocto.sdk.ide.YoctoUIElement; | ||
35 | import org.yocto.sdk.ide.YoctoUISetting; | ||
36 | import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; | ||
37 | import org.yocto.sdk.ide.utils.YoctoSDKUtils; | ||
38 | |||
39 | public class YoctoSDKProjectPropertyPage extends PropertyPage implements | ||
40 | IWorkbenchPropertyPage { | ||
41 | |||
42 | private static final String REVALIDATION_MESSAGE = "Poky.SDK.Revalidation.Message"; | ||
43 | |||
44 | private YoctoProfileSetting yoctoProfileSetting; | ||
45 | private YoctoProjectSpecificSetting yoctoProjectSpecificSetting; | ||
46 | private YoctoUISetting yoctoUISetting; | ||
47 | private IProject project = null; | ||
48 | |||
49 | private Listener changeListener; | ||
50 | |||
51 | public YoctoSDKProjectPropertyPage() { | ||
52 | changeListener = new Listener() { | ||
53 | @Override | ||
54 | public void handleEvent(Event event) { | ||
55 | if (getErrorMessage() != null) { | ||
56 | setErrorMessage(null); | ||
57 | setMessage(YoctoSDKMessages.getString(REVALIDATION_MESSAGE), INFORMATION); | ||
58 | } | ||
59 | } | ||
60 | }; | ||
61 | } | ||
62 | |||
63 | @Override | ||
64 | protected Control createContents(Composite parent) { | ||
65 | IProject project = getProject(); | ||
66 | |||
67 | YoctoProfileElement globalProfileElement= YoctoSDKUtils.getProfilesFromDefaultStore(); | ||
68 | YoctoProfileElement profileElement = ProjectPreferenceUtils.getProfiles(project); | ||
69 | |||
70 | String selectedProfile = profileElement.getSelectedProfile(); | ||
71 | if (!globalProfileElement.contains(selectedProfile)) { | ||
72 | selectedProfile = globalProfileElement.getSelectedProfile(); | ||
73 | } | ||
74 | |||
75 | yoctoProfileSetting = new YoctoProfileSetting( | ||
76 | new YoctoProfileElement(globalProfileElement.getProfilesAsString(), selectedProfile), this, false); | ||
77 | boolean useProjectSpecificSetting = ProjectPreferenceUtils.getUseProjectSpecificOption(project); | ||
78 | |||
79 | if (useProjectSpecificSetting) { | ||
80 | yoctoUISetting = new YoctoUISetting(ProjectPreferenceUtils.getElem(project)); | ||
81 | } else { | ||
82 | yoctoUISetting = new YoctoUISetting(YoctoSDKUtils.getElemFromStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile))); | ||
83 | } | ||
84 | |||
85 | yoctoProjectSpecificSetting = new YoctoProjectSpecificSetting(yoctoProfileSetting, yoctoUISetting, this); | ||
86 | |||
87 | initializeDialogUnits(parent); | ||
88 | final Composite composite = new Composite(parent, SWT.NONE); | ||
89 | composite.setLayout(new GridLayout(2, false)); | ||
90 | |||
91 | yoctoProfileSetting.createComposite(composite); | ||
92 | yoctoProjectSpecificSetting.createComposite(composite); | ||
93 | yoctoUISetting.createComposite(composite); | ||
94 | |||
95 | if (useProjectSpecificSetting) { | ||
96 | yoctoProfileSetting.setUIFormEnabledState(false); | ||
97 | yoctoProjectSpecificSetting.setUseProjectSpecificSettings(true); | ||
98 | yoctoUISetting.setUIFormEnabledState(true); | ||
99 | |||
100 | SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false); | ||
101 | if (result != SDKCheckResults.SDK_PASS) { | ||
102 | setErrorMessage(result.getMessage()); | ||
103 | } | ||
104 | } else { | ||
105 | yoctoProfileSetting.setUIFormEnabledState(true); | ||
106 | yoctoProjectSpecificSetting.setUseProjectSpecificSettings(false); | ||
107 | yoctoUISetting.setUIFormEnabledState(false); | ||
108 | } | ||
109 | |||
110 | composite.addListener(SWT.Modify, changeListener); | ||
111 | composite.addListener(SWT.Selection, changeListener); | ||
112 | |||
113 | Dialog.applyDialogFont(composite); | ||
114 | return composite; | ||
115 | } | ||
116 | |||
117 | private IProject getProject() { | ||
118 | if (project != null) { | ||
119 | return project; | ||
120 | } | ||
121 | |||
122 | IAdaptable adaptable = getElement(); | ||
123 | if (adaptable == null) { | ||
124 | throw new IllegalStateException("Project can only be retrieved after properties page has been set up."); | ||
125 | } | ||
126 | |||
127 | project = (IProject) adaptable.getAdapter(IProject.class); | ||
128 | return project; | ||
129 | } | ||
130 | |||
131 | /* | ||
132 | * @see PreferencePage#performDefaults() | ||
133 | */ | ||
134 | @Override | ||
135 | protected void performDefaults() { | ||
136 | YoctoUIElement defaultElement = YoctoSDKUtils.getDefaultElemFromDefaultStore(); | ||
137 | yoctoUISetting.setCurrentInput(defaultElement); | ||
138 | yoctoProjectSpecificSetting.setUseProjectSpecificSettings(true); | ||
139 | super.performDefaults(); | ||
140 | } | ||
141 | |||
142 | /* | ||
143 | * @see IPreferencePage#performOk() | ||
144 | */ | ||
145 | @Override | ||
146 | public boolean performOk() { | ||
147 | clearMessages(); | ||
148 | |||
149 | IProject project = getProject(); | ||
150 | |||
151 | if (yoctoProjectSpecificSetting.isUsingProjectSpecificSettings()) { | ||
152 | SDKCheckResults result = yoctoUISetting.validateInput(SDKCheckRequestFrom.Preferences, false); | ||
153 | if (result != SDKCheckResults.SDK_PASS) { | ||
154 | setErrorMessage(result.getMessage()); | ||
155 | return false; | ||
156 | } | ||
157 | |||
158 | ProjectPreferenceUtils.saveUseProjectSpecificOption(project, true); | ||
159 | ProjectPreferenceUtils.saveProfiles(yoctoProfileSetting.getCurrentInput(), project); | ||
160 | ProjectPreferenceUtils.saveElem(yoctoUISetting.getCurrentInput(), project); | ||
161 | } else { | ||
162 | ProjectPreferenceUtils.saveUseProjectSpecificOption(project, false); | ||
163 | ProjectPreferenceUtils.saveProfiles(yoctoProfileSetting.getCurrentInput(), project); | ||
164 | } | ||
165 | |||
166 | ProjectPreferenceUtils.saveElemToProjectEnv(yoctoUISetting.getCurrentInput(), getProject()); | ||
167 | |||
168 | return super.performOk(); | ||
169 | } | ||
170 | |||
171 | private void clearMessages() { | ||
172 | setErrorMessage(null); | ||
173 | setMessage(null); | ||
174 | setTitle(getTitle()); | ||
175 | } | ||
176 | |||
177 | public void switchProfile(String selectedProfile) | ||
178 | { | ||
179 | YoctoUIElement profileElement = YoctoSDKUtils.getElemFromStore(YoctoSDKPlugin.getProfilePreferenceStore(selectedProfile)); | ||
180 | yoctoUISetting.setCurrentInput(profileElement); | ||
181 | } | ||
182 | |||
183 | public void switchToProjectSpecificProfile() | ||
184 | { | ||
185 | YoctoUIElement profileElement = ProjectPreferenceUtils.getElem(getProject()); | ||
186 | SDKCheckResults result = YoctoSDKChecker.checkYoctoSDK(profileElement); | ||
187 | |||
188 | if ((result != SDKCheckResults.SDK_PASS)) { | ||
189 | /* Project specific profile has not yet been defined, | ||
190 | * leave settings from previously selected profile | ||
191 | */ | ||
192 | return; | ||
193 | } | ||
194 | |||
195 | yoctoUISetting.setCurrentInput(profileElement); | ||
196 | } | ||
197 | |||
198 | public void switchToSelectedProfile() | ||
199 | { | ||
200 | switchProfile(yoctoProfileSetting.getCurrentInput().getSelectedProfile()); | ||
201 | } | ||
202 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java new file mode 100644 index 0000000..a06a03c --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/ProjectPreferenceUtils.java | |||
@@ -0,0 +1,240 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * Copyright (c) 2010 Intel Corporation. | ||
4 | * All rights reserved. This program and the accompanying materials | ||
5 | * are made available under the terms of the Eclipse Public License v1.0 | ||
6 | * which accompanies this distribution, and is available at | ||
7 | * http://www.eclipse.org/legal/epl-v10.html | ||
8 | * | ||
9 | * Contributors: | ||
10 | * Intel - initial implementation | ||
11 | * BMW Car IT - initial implementation and refactoring | ||
12 | *******************************************************************************/ | ||
13 | package org.yocto.sdk.ide.utils; | ||
14 | |||
15 | import java.io.IOException; | ||
16 | |||
17 | import org.eclipse.cdt.core.CCorePlugin; | ||
18 | import org.eclipse.cdt.core.ConsoleOutputStream; | ||
19 | import org.eclipse.cdt.core.resources.IConsole; | ||
20 | import org.eclipse.core.resources.IProject; | ||
21 | import org.eclipse.core.resources.ProjectScope; | ||
22 | import org.eclipse.core.runtime.CoreException; | ||
23 | import org.eclipse.core.runtime.preferences.IEclipsePreferences; | ||
24 | import org.eclipse.core.runtime.preferences.IScopeContext; | ||
25 | import org.eclipse.jface.preference.IPreferenceStore; | ||
26 | import org.osgi.service.prefs.BackingStoreException; | ||
27 | import org.yocto.sdk.ide.YoctoGeneralException; | ||
28 | import org.yocto.sdk.ide.YoctoProfileElement; | ||
29 | import org.yocto.sdk.ide.YoctoSDKMessages; | ||
30 | import org.yocto.sdk.ide.YoctoUIElement; | ||
31 | import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature; | ||
32 | import org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature; | ||
33 | import org.yocto.sdk.ide.preferences.PreferenceConstants; | ||
34 | |||
35 | public class ProjectPreferenceUtils { | ||
36 | private static final String CONSOLE_MESSAGE = "Menu.SDK.Console.Configure.Message"; | ||
37 | |||
38 | /* Get POKY Preference settings from project's preference store */ | ||
39 | public static YoctoUIElement getElem(IProject project) { | ||
40 | IScopeContext projectScope = new ProjectScope(project); | ||
41 | IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE); | ||
42 | if (projectNode == null) { | ||
43 | return getElemFromProjectEnv(project); | ||
44 | } | ||
45 | |||
46 | YoctoUIElement elem = new YoctoUIElement(); | ||
47 | elem.setStrToolChainRoot(projectNode.get(PreferenceConstants.TOOLCHAIN_ROOT,"")); | ||
48 | elem.setStrTarget(projectNode.get(PreferenceConstants.TOOLCHAIN_TRIPLET,"")); | ||
49 | elem.setStrQemuKernelLoc(projectNode.get(PreferenceConstants.QEMU_KERNEL,"")); | ||
50 | elem.setStrSysrootLoc(projectNode.get(PreferenceConstants.SYSROOT,"")); | ||
51 | elem.setStrQemuOption(projectNode.get(PreferenceConstants.QEMU_OPTION,"")); | ||
52 | String sTemp = projectNode.get(PreferenceConstants.TARGET_ARCH_INDEX,""); | ||
53 | if (!sTemp.isEmpty()) { | ||
54 | elem.setIntTargetIndex(Integer.valueOf(sTemp).intValue()); | ||
55 | } | ||
56 | |||
57 | if (projectNode.get(PreferenceConstants.SDK_MODE,"").equalsIgnoreCase(IPreferenceStore.TRUE)) { | ||
58 | elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE); | ||
59 | } else { | ||
60 | elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE); | ||
61 | } | ||
62 | |||
63 | if(projectNode.get(PreferenceConstants.TARGET_MODE,"").equalsIgnoreCase(IPreferenceStore.TRUE)) { | ||
64 | elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE); | ||
65 | } else { | ||
66 | elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE); | ||
67 | } | ||
68 | return elem; | ||
69 | } | ||
70 | |||
71 | /* Get POKY Preference settings from project's environment */ | ||
72 | public static YoctoUIElement getElemFromProjectEnv(IProject project) { | ||
73 | YoctoUIElement elem = new YoctoUIElement(); | ||
74 | elem.setStrToolChainRoot(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.TOOLCHAIN_ROOT)); | ||
75 | elem.setStrTarget(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.TOOLCHAIN_TRIPLET)); | ||
76 | elem.setStrQemuKernelLoc(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.QEMU_KERNEL)); | ||
77 | elem.setStrSysrootLoc(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.SYSROOT)); | ||
78 | elem.setStrQemuOption(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.QEMU_OPTION)); | ||
79 | String sTemp = YoctoSDKUtils.getEnvValue(project, PreferenceConstants.TARGET_ARCH_INDEX); | ||
80 | |||
81 | if (!sTemp.isEmpty()) { | ||
82 | elem.setIntTargetIndex(Integer.valueOf(sTemp).intValue()); | ||
83 | } | ||
84 | |||
85 | if (YoctoSDKUtils.getEnvValue(project, PreferenceConstants.SDK_MODE).equalsIgnoreCase(IPreferenceStore.TRUE)) { | ||
86 | elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE); | ||
87 | } else { | ||
88 | elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE); | ||
89 | } | ||
90 | |||
91 | if(YoctoSDKUtils.getEnvValue(project, PreferenceConstants.TARGET_MODE).equalsIgnoreCase(IPreferenceStore.TRUE)) { | ||
92 | elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE); | ||
93 | } else { | ||
94 | elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE); | ||
95 | } | ||
96 | |||
97 | return elem; | ||
98 | } | ||
99 | |||
100 | /* Get profiles and selected profile from the project's preference store */ | ||
101 | public static YoctoProfileElement getProfiles(IProject project) { | ||
102 | IScopeContext projectScope = new ProjectScope(project); | ||
103 | IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE); | ||
104 | |||
105 | if (projectNode == null) { | ||
106 | return YoctoSDKUtils.getProfilesFromDefaultStore(); | ||
107 | } | ||
108 | |||
109 | String profiles = projectNode.get(PreferenceConstants.PROFILES, ""); | ||
110 | String selectedProfile = projectNode.get(PreferenceConstants.SELECTED_PROFILE, ""); | ||
111 | |||
112 | return new YoctoProfileElement(profiles, selectedProfile); | ||
113 | } | ||
114 | |||
115 | public static boolean getUseProjectSpecificOption(IProject project) { | ||
116 | IScopeContext projectScope = new ProjectScope(project); | ||
117 | IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE); | ||
118 | if (projectNode == null) { | ||
119 | return false; | ||
120 | } | ||
121 | |||
122 | String useProjectSpecificSettingString = projectNode.get(PreferenceConstants.PROJECT_SPECIFIC_PROFILE, | ||
123 | IPreferenceStore.FALSE); | ||
124 | |||
125 | if (useProjectSpecificSettingString.equals(IPreferenceStore.FALSE)) { | ||
126 | return false; | ||
127 | } | ||
128 | |||
129 | return true; | ||
130 | } | ||
131 | |||
132 | /* Save POKY Preference settings to project's preference store */ | ||
133 | public static void saveElem(YoctoUIElement elem, IProject project) { | ||
134 | IScopeContext projectScope = new ProjectScope(project); | ||
135 | IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE); | ||
136 | if (projectNode == null) { | ||
137 | return; | ||
138 | } | ||
139 | |||
140 | projectNode.putInt(PreferenceConstants.TARGET_ARCH_INDEX, elem.getIntTargetIndex()); | ||
141 | if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { | ||
142 | projectNode.put(PreferenceConstants.SDK_MODE, IPreferenceStore.TRUE); | ||
143 | } else { | ||
144 | projectNode.put(PreferenceConstants.SDK_MODE, IPreferenceStore.FALSE); | ||
145 | } | ||
146 | projectNode.put(PreferenceConstants.QEMU_KERNEL, elem.getStrQemuKernelLoc()); | ||
147 | projectNode.put(PreferenceConstants.QEMU_OPTION, elem.getStrQemuOption()); | ||
148 | projectNode.put(PreferenceConstants.SYSROOT, elem.getStrSysrootLoc()); | ||
149 | if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) { | ||
150 | projectNode.put(PreferenceConstants.TARGET_MODE, IPreferenceStore.TRUE); | ||
151 | } else { | ||
152 | projectNode.put(PreferenceConstants.TARGET_MODE, IPreferenceStore.FALSE); | ||
153 | } | ||
154 | projectNode.put(PreferenceConstants.TOOLCHAIN_ROOT, elem.getStrToolChainRoot()); | ||
155 | projectNode.put(PreferenceConstants.TOOLCHAIN_TRIPLET, elem.getStrTarget()); | ||
156 | |||
157 | try { | ||
158 | projectNode.flush(); | ||
159 | } catch (BackingStoreException e) { | ||
160 | e.printStackTrace(); | ||
161 | } | ||
162 | } | ||
163 | |||
164 | /* Save POKY Preference settings to project's environment */ | ||
165 | public static void saveElemToProjectEnv(YoctoUIElement elem, IProject project) { | ||
166 | ConsoleOutputStream consoleOutStream = null; | ||
167 | |||
168 | try { | ||
169 | YoctoSDKUtils.setEnvironmentVariables(project, elem); | ||
170 | YoctoSDKUtils.createRemoteDebugAndQemuLaunchers(project, elem); | ||
171 | |||
172 | if (project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID)) { | ||
173 | YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project); | ||
174 | } else if (project.hasNature(YoctoSDKCMakeProjectNature.YoctoSDK_CMAKE_NATURE_ID)) { | ||
175 | YoctoSDKCMakeProjectNature.extendProjectEnvironmentForCMake(project); | ||
176 | } | ||
177 | |||
178 | IConsole console = CCorePlugin.getDefault().getConsole("org.yocto.sdk.ide.YoctoConsole"); | ||
179 | console.start(project); | ||
180 | consoleOutStream = console.getOutputStream(); | ||
181 | String messages = YoctoSDKMessages.getString(CONSOLE_MESSAGE); | ||
182 | consoleOutStream.write(messages.getBytes()); | ||
183 | } catch (CoreException e) { | ||
184 | System.out.println(e.getMessage()); | ||
185 | } catch (IOException e) { | ||
186 | System.out.println(e.getMessage()); | ||
187 | } catch (YoctoGeneralException e) { | ||
188 | System.out.println(e.getMessage()); | ||
189 | } finally { | ||
190 | if (consoleOutStream != null) { | ||
191 | try { | ||
192 | consoleOutStream.flush(); | ||
193 | consoleOutStream.close(); | ||
194 | } catch (IOException e) { | ||
195 | // ignore | ||
196 | } | ||
197 | } | ||
198 | } | ||
199 | } | ||
200 | |||
201 | /* Save profiles and selected profile to the project's preference store */ | ||
202 | public static void saveProfiles(YoctoProfileElement profileElement, IProject project) { | ||
203 | IScopeContext projectScope = new ProjectScope(project); | ||
204 | IEclipsePreferences projectPreferences = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE); | ||
205 | |||
206 | if (projectPreferences == null) { | ||
207 | return; | ||
208 | } | ||
209 | |||
210 | projectPreferences.put(PreferenceConstants.PROFILES, profileElement.getProfilesAsString()); | ||
211 | projectPreferences.put(PreferenceConstants.SELECTED_PROFILE, profileElement.getSelectedProfile()); | ||
212 | |||
213 | try { | ||
214 | projectPreferences.flush(); | ||
215 | } catch (BackingStoreException e) { | ||
216 | // TODO Auto-generated catch block | ||
217 | e.printStackTrace(); | ||
218 | } | ||
219 | } | ||
220 | |||
221 | public static void saveUseProjectSpecificOption(IProject project, boolean useProjectSpecificSetting) { | ||
222 | IScopeContext projectScope = new ProjectScope(project); | ||
223 | IEclipsePreferences projectNode = projectScope.getNode(YoctoSDKUtilsConstants.PROJECT_SCOPE); | ||
224 | if (projectNode == null) { | ||
225 | return; | ||
226 | } | ||
227 | |||
228 | if (useProjectSpecificSetting) { | ||
229 | projectNode.put(PreferenceConstants.PROJECT_SPECIFIC_PROFILE, IPreferenceStore.TRUE); | ||
230 | } else { | ||
231 | projectNode.put(PreferenceConstants.PROJECT_SPECIFIC_PROFILE, IPreferenceStore.FALSE); | ||
232 | } | ||
233 | |||
234 | try { | ||
235 | projectNode.flush(); | ||
236 | } catch (BackingStoreException e) { | ||
237 | e.printStackTrace(); | ||
238 | } | ||
239 | } | ||
240 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java new file mode 100644 index 0000000..cd27a61 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | |||
@@ -0,0 +1,463 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | * BMW Car IT - add methods to use different preference stores | ||
11 | * Atanas Gegov (BMW Car IT) - add method to get the project environment | ||
12 | *******************************************************************************/ | ||
13 | package org.yocto.sdk.ide.utils; | ||
14 | |||
15 | import java.io.BufferedReader; | ||
16 | import java.io.File; | ||
17 | import java.io.FileReader; | ||
18 | import java.io.FileWriter; | ||
19 | import java.io.IOException; | ||
20 | import java.util.ArrayList; | ||
21 | import java.util.HashMap; | ||
22 | import java.util.HashSet; | ||
23 | import java.util.Iterator; | ||
24 | import java.util.Set; | ||
25 | import java.util.StringTokenizer; | ||
26 | |||
27 | import org.eclipse.cdt.core.CCorePlugin; | ||
28 | import org.eclipse.cdt.core.envvar.IContributedEnvironment; | ||
29 | import org.eclipse.cdt.core.envvar.IEnvironmentVariable; | ||
30 | import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager; | ||
31 | import org.eclipse.cdt.core.model.CoreModel; | ||
32 | import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; | ||
33 | import org.eclipse.cdt.core.settings.model.ICProjectDescription; | ||
34 | import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; | ||
35 | import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; | ||
36 | import org.eclipse.core.resources.IProject; | ||
37 | import org.eclipse.core.runtime.CoreException; | ||
38 | import org.eclipse.debug.core.DebugPlugin; | ||
39 | import org.eclipse.debug.core.ILaunchConfiguration; | ||
40 | import org.eclipse.debug.core.ILaunchConfigurationType; | ||
41 | import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; | ||
42 | import org.eclipse.debug.core.ILaunchManager; | ||
43 | import org.eclipse.jface.preference.IPreferenceStore; | ||
44 | import org.yocto.sdk.ide.YoctoGeneralException; | ||
45 | import org.yocto.sdk.ide.YoctoProfileElement; | ||
46 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
47 | import org.yocto.sdk.ide.YoctoUIElement; | ||
48 | import org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature; | ||
49 | import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature; | ||
50 | import org.yocto.sdk.ide.preferences.PreferenceConstants; | ||
51 | |||
52 | public class YoctoSDKUtils { | ||
53 | |||
54 | private static final String DEFAULT_SYSROOT_PREFIX = "--sysroot="; | ||
55 | private static final String LIBTOOL_SYSROOT_PREFIX = "--with-libtool-sysroot="; | ||
56 | |||
57 | private static final String DEFAULT_USR_BIN = "/usr/bin/"; | ||
58 | private static final String NATIVE_SYSROOT = "OECORE_NATIVE_SYSROOT"; | ||
59 | |||
60 | public static String getEnvValue(IProject project, String strKey) | ||
61 | { | ||
62 | ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true); | ||
63 | ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration(); | ||
64 | IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager(); | ||
65 | IContributedEnvironment env = manager.getContributedEnvironment(); | ||
66 | IEnvironmentVariable var = env.getVariable(strKey, ccdesc); | ||
67 | |||
68 | if (var == null) | ||
69 | { | ||
70 | System.out.printf("ENV key %s is NULL\n", strKey); | ||
71 | return ""; | ||
72 | } | ||
73 | |||
74 | else | ||
75 | return var.getValue(); | ||
76 | } | ||
77 | |||
78 | /* Save project wide settings into ENV VARs including POKY preference settings | ||
79 | * and Environment Script File export VARs | ||
80 | */ | ||
81 | private static void setEnvVars(ICProjectDescription cpdesc, | ||
82 | YoctoUIElement elem, HashMap<String, String> envMap) { | ||
83 | ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration(); | ||
84 | IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager(); | ||
85 | IContributedEnvironment env = manager.getContributedEnvironment(); | ||
86 | String delimiter = manager.getDefaultDelimiter(); | ||
87 | |||
88 | if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) | ||
89 | env.addVariable(PreferenceConstants.SDK_MODE, IPreferenceStore.TRUE, | ||
90 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
91 | else | ||
92 | env.addVariable(PreferenceConstants.SDK_MODE, IPreferenceStore.FALSE, | ||
93 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
94 | |||
95 | env.addVariable(PreferenceConstants.TOOLCHAIN_ROOT, elem.getStrToolChainRoot(), | ||
96 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
97 | env.addVariable(PreferenceConstants.TOOLCHAIN_TRIPLET, elem.getStrTarget(), | ||
98 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
99 | env.addVariable(PreferenceConstants.TARGET_ARCH_INDEX, String.valueOf(elem.getIntTargetIndex()), | ||
100 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
101 | |||
102 | if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) | ||
103 | env.addVariable(PreferenceConstants.TARGET_MODE, IPreferenceStore.TRUE, | ||
104 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
105 | else | ||
106 | env.addVariable(PreferenceConstants.TARGET_MODE, IPreferenceStore.FALSE, | ||
107 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
108 | |||
109 | env.addVariable(PreferenceConstants.QEMU_KERNEL, elem.getStrQemuKernelLoc(), | ||
110 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
111 | env.addVariable(PreferenceConstants.QEMU_OPTION, elem.getStrQemuOption(), | ||
112 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
113 | env.addVariable(PreferenceConstants.SYSROOT, elem.getStrSysrootLoc(), | ||
114 | IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
115 | |||
116 | if (envMap == null) | ||
117 | { | ||
118 | System.out.println("ENV var hasmap is NULL, Please check ENV script File!"); | ||
119 | return; | ||
120 | } | ||
121 | Iterator<String> iter = envMap.keySet().iterator(); | ||
122 | while (iter.hasNext()) | ||
123 | { | ||
124 | String sKey = (String)iter.next(); | ||
125 | String sValue = (String)envMap.get(sKey); | ||
126 | String targetFilePath; | ||
127 | File targetFile; | ||
128 | //replace --sysroot | ||
129 | if (sKey.matches("CFLAGS") || sKey.matches("CXXFLAGS") || sKey.matches("CXXFLAGS") || sKey.matches("LDFLAGS") || | ||
130 | sKey.matches("CPPFLAGS")) { | ||
131 | |||
132 | int SYSROOT_idx = sValue.lastIndexOf(DEFAULT_SYSROOT_PREFIX); | ||
133 | if (SYSROOT_idx >=0 ) | ||
134 | sValue = sValue.substring(0, SYSROOT_idx) + DEFAULT_SYSROOT_PREFIX + elem.getStrSysrootLoc(); | ||
135 | else | ||
136 | sValue = " " + DEFAULT_SYSROOT_PREFIX + elem.getStrSysrootLoc(); | ||
137 | targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget(); | ||
138 | targetFile = new File(targetFilePath); | ||
139 | if (targetFile.exists()) | ||
140 | sValue = sValue + "/" + elem.getStrTarget(); | ||
141 | } else if (sKey.matches("CONFIGURE_FLAGS")) { | ||
142 | int LIBTOOL_idx = sValue.lastIndexOf(LIBTOOL_SYSROOT_PREFIX); | ||
143 | if (LIBTOOL_idx >= 0) | ||
144 | sValue = sValue.substring(0, LIBTOOL_idx) + LIBTOOL_SYSROOT_PREFIX + elem.getStrSysrootLoc(); | ||
145 | else | ||
146 | sValue = " " + LIBTOOL_SYSROOT_PREFIX + elem.getStrSysrootLoc(); | ||
147 | targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget(); | ||
148 | targetFile = new File(targetFilePath); | ||
149 | if (targetFile.exists()) | ||
150 | sValue = sValue + "/" + elem.getStrTarget(); | ||
151 | } else if(sKey.matches("PKG_CONFIG_SYSROOT_DIR") || sKey.matches("OECORE_TARGET_SYSROOT")) { | ||
152 | sValue = elem.getStrSysrootLoc(); | ||
153 | targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget(); | ||
154 | targetFile = new File(targetFilePath); | ||
155 | if (targetFile.exists()) | ||
156 | sValue = sValue + "/" + elem.getStrTarget(); | ||
157 | } else if (sKey.matches("PKG_CONFIG_PATH")) { | ||
158 | sValue = elem.getStrSysrootLoc(); | ||
159 | targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget(); | ||
160 | targetFile = new File(targetFilePath); | ||
161 | if (targetFile.exists()) | ||
162 | sValue = sValue + "/" + elem.getStrTarget(); | ||
163 | sValue = sValue + "/usr/lib/pkgconfig"; | ||
164 | } | ||
165 | // env.addVariable(sKey, elem.getStrSysrootLoc(), IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
166 | /* | ||
167 | else if (sKey.matches("PKG_CONFIG_PATH")) | ||
168 | env.addVariable(sKey, elem.getStrSysrootLoc()+"/"+elem.getStrTarget()+"/usr/lib/pkgconfig", IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
169 | //env.addVariable(sKey, sValue, IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
170 | else if (sKey.matches("PKG_CONFIG_SYSROOT_DIR")) | ||
171 | env.addVariable(sKey, elem.getStrSysrootLoc()+"/"+elem.getStrTarget(), IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
172 | */ | ||
173 | env.addVariable(sKey, sValue, IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); | ||
174 | } | ||
175 | //add ACLOCAL OPTS for libtool 2.4 support | ||
176 | env.addVariable("OECORE_ACLOCAL_OPTS", | ||
177 | "-I " + env.getVariable(NATIVE_SYSROOT, ccdesc).getValue() + "/usr/share/aclocal", | ||
178 | IEnvironmentVariable.ENVVAR_REPLACE, | ||
179 | delimiter, | ||
180 | ccdesc); | ||
181 | return; | ||
182 | |||
183 | } | ||
184 | |||
185 | private static String getEnvironmentSetupFileFullPath(YoctoUIElement elem) { | ||
186 | String envSetupFile = ""; | ||
187 | |||
188 | if (elem.getEnumPokyMode() == YoctoUIElement.PokyMode.POKY_SDK_MODE) { | ||
189 | envSetupFile = elem.getStrToolChainRoot() + "/"; | ||
190 | } else { | ||
191 | //POKY TREE Mode | ||
192 | envSetupFile = elem.getStrToolChainRoot() + YoctoSDKUtilsConstants.DEFAULT_TMP_PREFIX; | ||
193 | } | ||
194 | envSetupFile += YoctoSDKUtilsConstants.DEFAULT_ENV_FILE_PREFIX + elem.getStrTarget(); | ||
195 | return envSetupFile; | ||
196 | } | ||
197 | |||
198 | private static HashMap<String, String> parseEnvScript(String sFileName) { | ||
199 | try { | ||
200 | HashMap<String, String> envMap = new HashMap<String, String>(); | ||
201 | File file = new File(sFileName); | ||
202 | |||
203 | if (file.exists()) { | ||
204 | BufferedReader input = new BufferedReader(new FileReader(file)); | ||
205 | |||
206 | try { | ||
207 | String line = null; | ||
208 | |||
209 | while ((line = input.readLine()) != null) { | ||
210 | if (!line.startsWith("export")) { | ||
211 | continue; | ||
212 | } | ||
213 | String sKey = line.substring("export".length() + 1, line.indexOf('=')); | ||
214 | String sValue = line.substring(line.indexOf('=') + 1); | ||
215 | if (sValue.startsWith("\"") && sValue.endsWith("\"")) | ||
216 | sValue = sValue.substring(sValue.indexOf('"') + 1, sValue.lastIndexOf('"')); | ||
217 | /* If PATH ending with $PATH, we need to join with current system path */ | ||
218 | if (sKey.equalsIgnoreCase("PATH")) { | ||
219 | if (sValue.lastIndexOf("$PATH") >= 0) | ||
220 | sValue = sValue.substring(0, sValue.lastIndexOf("$PATH")) + System.getenv("PATH"); | ||
221 | } | ||
222 | envMap.put(sKey, sValue); | ||
223 | System.out.printf("get env key %s value %s\n", sKey, sValue); | ||
224 | } | ||
225 | } finally { | ||
226 | input.close(); | ||
227 | } | ||
228 | } | ||
229 | |||
230 | return envMap; | ||
231 | |||
232 | } catch (IOException e) { | ||
233 | e.printStackTrace(); | ||
234 | return null; | ||
235 | } | ||
236 | } | ||
237 | |||
238 | public static void setEnvironmentVariables(IProject project, YoctoUIElement elem) { | ||
239 | ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true); | ||
240 | |||
241 | String sFileName = getEnvironmentSetupFileFullPath(elem); | ||
242 | HashMap<String, String> envMap = parseEnvScript(sFileName); | ||
243 | |||
244 | setEnvVars(cpdesc, elem, envMap); | ||
245 | try { | ||
246 | CoreModel.getDefault().setProjectDescription(project,cpdesc); | ||
247 | } catch (CoreException e) { | ||
248 | e.printStackTrace(); | ||
249 | } | ||
250 | } | ||
251 | |||
252 | public static void createRemoteDebugAndQemuLaunchers(IProject project, YoctoUIElement elem) throws YoctoGeneralException { | ||
253 | ILaunchManager lManager = DebugPlugin.getDefault().getLaunchManager(); | ||
254 | ILaunchConfigurationType configType = | ||
255 | lManager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"); | ||
256 | ILaunchConfigurationType debug_configType = | ||
257 | lManager.getLaunchConfigurationType("org.eclipse.cdt.launch.remoteApplicationLaunchType"); | ||
258 | |||
259 | String sPath = getEnvValue(project, "PATH"); | ||
260 | String sDebugName = getEnvValue(project, "GDB"); | ||
261 | String sysroot_str = elem.getStrSysrootLoc(); | ||
262 | String target_prefix_str = getEnvValue(project,"TARGET_PREFIX"); | ||
263 | String target_str = target_prefix_str.substring(0, target_prefix_str.length() - 1); | ||
264 | |||
265 | if (configType == null || debug_configType == null) { | ||
266 | throw new YoctoGeneralException("Failed to get program or remote debug launcher!"); | ||
267 | } | ||
268 | |||
269 | createRemoteDebugLauncher(project, lManager, debug_configType, target_str, sPath, sDebugName, sysroot_str); | ||
270 | ArrayList<String> listValue = new ArrayList<String>(); | ||
271 | listValue.add(new String("org.eclipse.ui.externaltools.launchGroup")); | ||
272 | |||
273 | if (elem.getEnumDeviceMode() == YoctoUIElement.DeviceMode.QEMU_MODE) { | ||
274 | String sFileName = getEnvironmentSetupFileFullPath(elem); | ||
275 | createQemuLauncher(project, configType, listValue, sFileName, elem); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | protected static void createRemoteDebugLauncher(IProject project, | ||
280 | ILaunchManager lManager, ILaunchConfigurationType configType, | ||
281 | String sTargetTriplet, String strPath, String sDebugName, String sSysroot) { | ||
282 | try { | ||
283 | |||
284 | String sDebugSubDir = DEFAULT_USR_BIN + sTargetTriplet; | ||
285 | StringTokenizer token = new StringTokenizer(strPath, ":"); | ||
286 | String strDebugger = ""; | ||
287 | while (token.hasMoreTokens()) | ||
288 | { | ||
289 | String sTemp = token.nextToken(); | ||
290 | if (sTemp.endsWith(sDebugSubDir)) { | ||
291 | strDebugger = sTemp + "/" + sDebugName; | ||
292 | break; | ||
293 | } | ||
294 | } | ||
295 | if (strDebugger.isEmpty()) | ||
296 | return; | ||
297 | //If get default Debugger successfully, go ahead! | ||
298 | |||
299 | //create the gdbinit file | ||
300 | String sDebugInitFile = project.getLocation().toString() + "/.gdbinit"; | ||
301 | FileWriter out = new FileWriter(new File(sDebugInitFile)); | ||
302 | out.write("set sysroot " + sSysroot); | ||
303 | out.flush(); | ||
304 | out.close(); | ||
305 | |||
306 | //set the launch configuration | ||
307 | String projectName = project.getName(); | ||
308 | String configName = projectName+"_gdb_"+sTargetTriplet; | ||
309 | int i; | ||
310 | ILaunchConfiguration[] configs=lManager.getLaunchConfigurations(configType); | ||
311 | for(i=0; i<configs.length; i++) | ||
312 | { //delete the old configuration | ||
313 | ILaunchConfiguration config=configs[i]; | ||
314 | if(config.getName().equals(configName)) { | ||
315 | config.delete(); | ||
316 | break; | ||
317 | } | ||
318 | } | ||
319 | ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(project, configName); | ||
320 | Set<String> modes=new HashSet<String>(); | ||
321 | modes.add("debug"); | ||
322 | w_copy.setPreferredLaunchDelegate(modes, "org.eclipse.rse.remotecdt.launch"); | ||
323 | w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, sDebugInitFile); | ||
324 | w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, false); | ||
325 | w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, strDebugger); | ||
326 | w_copy.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); | ||
327 | //TWEAK avoid loading default values in org.eclipse.cdt.launch.remote.tabs.RemoteCDebuggerTab | ||
328 | w_copy.setAttribute("org.eclipse.cdt.launch.remote.RemoteCDSFDebuggerTab.DEFAULTS_SET",true); | ||
329 | w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName); | ||
330 | if (!project.hasNature(YoctoSDKEmptyProjectNature.YoctoSDK_EMPTY_NATURE_ID)) { | ||
331 | String pathToCompiledBinary = ""; | ||
332 | if (project.hasNature(YoctoSDKCMakeProjectNature.YoctoSDK_CMAKE_NATURE_ID)) { | ||
333 | pathToCompiledBinary = "Debug/"; | ||
334 | } else { | ||
335 | pathToCompiledBinary = "src/"; | ||
336 | } | ||
337 | pathToCompiledBinary += projectName; | ||
338 | w_copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, pathToCompiledBinary); | ||
339 | } | ||
340 | |||
341 | w_copy.doSave(); | ||
342 | } | ||
343 | catch (CoreException e) | ||
344 | { | ||
345 | System.out.println(e.getMessage()); | ||
346 | } | ||
347 | catch (IOException e) | ||
348 | { | ||
349 | System.out.println("Failed to generate debug init file!"); | ||
350 | System.out.println(e.getMessage()); | ||
351 | } | ||
352 | } | ||
353 | |||
354 | protected static void createQemuLauncher(IProject project, | ||
355 | ILaunchConfigurationType configType, | ||
356 | ArrayList<String> listValue, String sScriptFile, | ||
357 | YoctoUIElement elem) { | ||
358 | try { | ||
359 | |||
360 | ILaunchConfigurationWorkingCopy w_copy = configType.newInstance(null, "qemu_"+elem.getStrTarget()); | ||
361 | |||
362 | w_copy.setAttribute("org.eclipse.debug.ui.favoriteGroups", listValue); | ||
363 | w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", "/usr/bin/xterm"); | ||
364 | |||
365 | String argument = "-e \"source " + sScriptFile + ";runqemu " + qemuTargetTranslate(elem.getStrTarget()) + " " + | ||
366 | elem.getStrQemuKernelLoc() + " " + elem.getStrSysrootLoc() + " " + elem.getStrQemuOption() + ";bash\""; | ||
367 | |||
368 | w_copy.setAttribute("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", argument); | ||
369 | w_copy.doSave(); | ||
370 | } catch (CoreException e) { | ||
371 | } | ||
372 | |||
373 | } | ||
374 | |||
375 | private static String qemuTargetTranslate(String strTargetArch) { | ||
376 | String qemu_target = ""; | ||
377 | if (strTargetArch.indexOf("i586") != -1) { | ||
378 | qemu_target = "qemux86"; | ||
379 | } else if (strTargetArch.indexOf("x86_64") != -1) { | ||
380 | qemu_target = "qemux86-64"; | ||
381 | } else if (strTargetArch.indexOf("arm") != -1) { | ||
382 | qemu_target = "qemuarm"; | ||
383 | } else if (strTargetArch.indexOf("mips") != -1) { | ||
384 | qemu_target = "qemumips"; | ||
385 | } else if (strTargetArch.indexOf("ppc") != -1) { | ||
386 | qemu_target = "qemuppc"; | ||
387 | } | ||
388 | return qemu_target; | ||
389 | } | ||
390 | |||
391 | /* Get IDE wide POKY Preference settings from a specific preference store */ | ||
392 | public static YoctoUIElement getElemFromStore(IPreferenceStore store) { | ||
393 | YoctoUIElement elem = new YoctoUIElement(); | ||
394 | if (store.getString(PreferenceConstants.SDK_MODE).equals(IPreferenceStore.TRUE)) | ||
395 | elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE); | ||
396 | else | ||
397 | elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE); | ||
398 | |||
399 | elem.setStrToolChainRoot(store.getString(PreferenceConstants.TOOLCHAIN_ROOT)); | ||
400 | elem.setStrTarget(store.getString(PreferenceConstants.TOOLCHAIN_TRIPLET)); | ||
401 | elem.setIntTargetIndex(store.getInt(PreferenceConstants.TARGET_ARCH_INDEX)); | ||
402 | elem.setStrQemuKernelLoc(store.getString(PreferenceConstants.QEMU_KERNEL)); | ||
403 | elem.setStrQemuOption(store.getString(PreferenceConstants.QEMU_OPTION)); | ||
404 | elem.setStrSysrootLoc(store.getString(PreferenceConstants.SYSROOT)); | ||
405 | |||
406 | if (store.getString(PreferenceConstants.TARGET_MODE).equals(IPreferenceStore.TRUE)) | ||
407 | elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE); | ||
408 | else | ||
409 | elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE); | ||
410 | |||
411 | return elem; | ||
412 | } | ||
413 | |||
414 | /* Get default POKY Preference settings from the default preference store */ | ||
415 | public static YoctoUIElement getDefaultElemFromDefaultStore() | ||
416 | { | ||
417 | IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore(); | ||
418 | YoctoUIElement elem = new YoctoUIElement(); | ||
419 | if (store.getDefaultString(PreferenceConstants.SDK_MODE).equals(IPreferenceStore.TRUE)) | ||
420 | elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_SDK_MODE); | ||
421 | else | ||
422 | elem.setEnumPokyMode(YoctoUIElement.PokyMode.POKY_TREE_MODE); | ||
423 | |||
424 | elem.setStrToolChainRoot(store.getDefaultString(PreferenceConstants.TOOLCHAIN_ROOT)); | ||
425 | elem.setStrTarget(store.getDefaultString(PreferenceConstants.TOOLCHAIN_TRIPLET)); | ||
426 | elem.setIntTargetIndex(store.getDefaultInt(PreferenceConstants.TARGET_ARCH_INDEX)); | ||
427 | elem.setStrQemuKernelLoc(store.getDefaultString(PreferenceConstants.QEMU_KERNEL)); | ||
428 | elem.setStrQemuOption(store.getDefaultString(PreferenceConstants.QEMU_OPTION)); | ||
429 | elem.setStrSysrootLoc(store.getDefaultString(PreferenceConstants.SYSROOT)); | ||
430 | |||
431 | if (store.getDefaultString(PreferenceConstants.TARGET_MODE).equals(IPreferenceStore.TRUE)) | ||
432 | elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.QEMU_MODE); | ||
433 | else | ||
434 | elem.setEnumDeviceMode(YoctoUIElement.DeviceMode.DEVICE_MODE); | ||
435 | |||
436 | return elem; | ||
437 | } | ||
438 | |||
439 | /* Save profiles and selected profile to the default preference store */ | ||
440 | public static void saveProfilesToDefaultStore(YoctoProfileElement profileElement) { | ||
441 | saveProfilesToStore(profileElement, YoctoSDKPlugin.getDefault().getPreferenceStore()); | ||
442 | } | ||
443 | |||
444 | /* Save profiles and selected profile to a specific preference store */ | ||
445 | private static void saveProfilesToStore(YoctoProfileElement profileElement, IPreferenceStore store) { | ||
446 | store.setValue(PreferenceConstants.PROFILES, profileElement.getProfilesAsString()); | ||
447 | store.setValue(PreferenceConstants.SELECTED_PROFILE, profileElement.getSelectedProfile()); | ||
448 | } | ||
449 | |||
450 | /* Get profiles and selected profile from the default preference store */ | ||
451 | public static YoctoProfileElement getProfilesFromDefaultStore() | ||
452 | { | ||
453 | return getProfilesFromStore(YoctoSDKPlugin.getDefault().getPreferenceStore()); | ||
454 | } | ||
455 | |||
456 | /* Get profiles and selected profile from a specific preference store */ | ||
457 | private static YoctoProfileElement getProfilesFromStore(IPreferenceStore store) { | ||
458 | String profiles = store.getString(PreferenceConstants.PROFILES); | ||
459 | String selectedProfile = store.getString(PreferenceConstants.SELECTED_PROFILE); | ||
460 | |||
461 | return new YoctoProfileElement(profiles, selectedProfile); | ||
462 | } | ||
463 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java new file mode 100644 index 0000000..65dfce8 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtilsConstants.java | |||
@@ -0,0 +1,18 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.utils; | ||
12 | |||
13 | public class YoctoSDKUtilsConstants { | ||
14 | |||
15 | public static final String DEFAULT_ENV_FILE_PREFIX = "environment-setup-"; | ||
16 | public static final String DEFAULT_TMP_PREFIX = "/tmp/"; | ||
17 | public static final String PROJECT_SCOPE = "org.yocto.sdk.ide"; | ||
18 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java new file mode 100644 index 0000000..f467dac --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoAutotoolsProjectPostProcess.java | |||
@@ -0,0 +1,81 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2012 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.wizard; | ||
12 | |||
13 | import java.io.BufferedReader; | ||
14 | import java.io.File; | ||
15 | import java.io.InputStream; | ||
16 | import java.io.InputStreamReader; | ||
17 | |||
18 | import org.eclipse.cdt.core.templateengine.TemplateCore; | ||
19 | import org.eclipse.cdt.core.templateengine.process.ProcessArgument; | ||
20 | import org.eclipse.cdt.core.templateengine.process.ProcessFailureException; | ||
21 | import org.eclipse.cdt.core.templateengine.process.ProcessRunner; | ||
22 | import org.eclipse.cdt.core.templateengine.process.processes.Messages; | ||
23 | import org.eclipse.core.resources.IProject; | ||
24 | import org.eclipse.core.resources.ResourcesPlugin; | ||
25 | import org.eclipse.core.runtime.IPath; | ||
26 | import org.eclipse.core.runtime.IProgressMonitor; | ||
27 | import org.yocto.sdk.ide.YoctoSDKMessages; | ||
28 | import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature; | ||
29 | |||
30 | public class NewYoctoAutotoolsProjectPostProcess extends ProcessRunner { | ||
31 | |||
32 | public static final String CHMOD_COMMAND = "chmod +x "; //$NON-NLS-1$ | ||
33 | public static final String AUTOGEN_SCRIPT_NAME = "autogen.sh"; //$NON-NLS-1$ | ||
34 | |||
35 | public NewYoctoAutotoolsProjectPostProcess() {} | ||
36 | |||
37 | public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException { | ||
38 | |||
39 | String projectName = args[0].getSimpleValue(); | ||
40 | |||
41 | IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); | ||
42 | try { | ||
43 | if (!project.exists()) { | ||
44 | throw new ProcessFailureException(Messages.getString("NewManagedProject.4") + projectName); //$NON-NLS-1$ | ||
45 | } else if (!project.hasNature(YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID)) { | ||
46 | throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + //$NON-NLS-1$ | ||
47 | YoctoSDKMessages.getFormattedString("AutotoolsProjectPostProcess.WrongProjectNature", //$NON-NLS-1$ | ||
48 | projectName)); | ||
49 | } else { | ||
50 | IPath path = project.getLocation(); | ||
51 | String path_str = path.toString(); | ||
52 | String autogen_cmd = CHMOD_COMMAND + path_str + File.separator + AUTOGEN_SCRIPT_NAME; | ||
53 | try { | ||
54 | Runtime rt = Runtime.getRuntime(); | ||
55 | Process proc = rt.exec(autogen_cmd); | ||
56 | InputStream stdin = proc.getInputStream(); | ||
57 | InputStreamReader isr = new InputStreamReader(stdin); | ||
58 | BufferedReader br = new BufferedReader(isr); | ||
59 | String line = null; | ||
60 | String error_message = ""; //$NON-NLS-1$ | ||
61 | |||
62 | while ( (line = br.readLine()) != null) { | ||
63 | error_message = error_message + line; | ||
64 | } | ||
65 | |||
66 | int exitVal = proc.waitFor(); | ||
67 | if (exitVal != 0) { | ||
68 | throw new ProcessFailureException( | ||
69 | YoctoSDKMessages.getFormattedString("AutotoolsProjectPostProcess.ChmodFailure", //$NON-NLS-1$ | ||
70 | projectName)); | ||
71 | } | ||
72 | } catch (Throwable t) { | ||
73 | t.printStackTrace(); | ||
74 | |||
75 | } | ||
76 | } | ||
77 | } catch (Exception e) { | ||
78 | throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage(), e); //$NON-NLS-1$ | ||
79 | } | ||
80 | } | ||
81 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java new file mode 100644 index 0000000..d8c1232 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/wizard/NewYoctoProjectTemplateProcess.java | |||
@@ -0,0 +1,270 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.ide.wizard; | ||
12 | |||
13 | import java.util.Arrays; | ||
14 | import java.util.LinkedHashMap; | ||
15 | import java.util.List; | ||
16 | import java.util.regex.Matcher; | ||
17 | import java.util.regex.Pattern; | ||
18 | |||
19 | import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature; | ||
20 | import org.eclipse.cdt.core.CCorePlugin; | ||
21 | import org.eclipse.cdt.core.templateengine.TemplateCore; | ||
22 | import org.eclipse.cdt.core.templateengine.process.ProcessArgument; | ||
23 | import org.eclipse.cdt.core.templateengine.process.ProcessFailureException; | ||
24 | import org.eclipse.cdt.core.templateengine.process.ProcessRunner; | ||
25 | import org.eclipse.cdt.core.templateengine.process.processes.Messages; | ||
26 | import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager; | ||
27 | import org.eclipse.cdt.make.core.MakeCorePlugin; | ||
28 | import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager; | ||
29 | import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo; | ||
30 | import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo; | ||
31 | import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry; | ||
32 | import org.eclipse.cdt.managedbuilder.core.BuildException; | ||
33 | import org.eclipse.cdt.managedbuilder.core.IConfiguration; | ||
34 | import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; | ||
35 | import org.eclipse.cdt.managedbuilder.core.IOption; | ||
36 | import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; | ||
37 | import org.eclipse.cdt.managedbuilder.templateengine.ProjectCreatedActions; | ||
38 | import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager; | ||
39 | import org.eclipse.jface.wizard.IWizardPage; | ||
40 | import org.eclipse.cdt.ui.wizards.CDTMainWizardPage; | ||
41 | import org.eclipse.cdt.internal.ui.wizards.ICDTCommonProjectWizard; | ||
42 | import org.eclipse.core.resources.IProject; | ||
43 | import org.eclipse.core.resources.IWorkspace; | ||
44 | import org.eclipse.core.resources.IWorkspaceDescription; | ||
45 | import org.eclipse.core.resources.ResourcesPlugin; | ||
46 | import org.eclipse.core.runtime.CoreException; | ||
47 | import org.eclipse.core.runtime.IPath; | ||
48 | import org.eclipse.core.runtime.IProgressMonitor; | ||
49 | import org.eclipse.core.runtime.OperationCanceledException; | ||
50 | import org.eclipse.core.runtime.Path; | ||
51 | import org.eclipse.jface.preference.IPreferenceStore; | ||
52 | import org.yocto.sdk.ide.YoctoGeneralException; | ||
53 | import org.yocto.sdk.ide.YoctoProfileElement; | ||
54 | import org.yocto.sdk.ide.YoctoSDKChecker; | ||
55 | import org.yocto.sdk.ide.YoctoSDKMessages; | ||
56 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
57 | import org.yocto.sdk.ide.YoctoUIElement; | ||
58 | import org.yocto.sdk.ide.natures.YoctoSDKAutotoolsProjectNature; | ||
59 | import org.yocto.sdk.ide.natures.YoctoSDKCMakeProjectNature; | ||
60 | import org.yocto.sdk.ide.natures.YoctoSDKEmptyProjectNature; | ||
61 | import org.yocto.sdk.ide.natures.YoctoSDKNatureUtils; | ||
62 | import org.yocto.sdk.ide.natures.YoctoSDKProjectNature; | ||
63 | import org.yocto.sdk.ide.utils.ProjectPreferenceUtils; | ||
64 | import org.yocto.sdk.ide.utils.YoctoSDKUtils; | ||
65 | |||
66 | @SuppressWarnings("restriction") | ||
67 | public class NewYoctoProjectTemplateProcess extends ProcessRunner { | ||
68 | protected boolean savedAutoBuildingValue; | ||
69 | protected ProjectCreatedActions pca; | ||
70 | protected IManagedBuildInfo info; | ||
71 | protected List<Character> illegalChars = Arrays.asList('$', '"','#','%','&','\'','(',')','*', '+', ',','.','/',':',';','<','=','>','?','@','[','\\',']','^','`','{','|','}','~'); | ||
72 | private static final String PROJECT_NAME_ERROR = "Wizard.SDK.Error.ProjectName"; | ||
73 | |||
74 | private boolean isCProject; | ||
75 | private boolean isEmptyProject; | ||
76 | private boolean isAutotoolsProject; | ||
77 | private boolean isCMakeProject; | ||
78 | |||
79 | public NewYoctoProjectTemplateProcess() { | ||
80 | pca = new ProjectCreatedActions(); | ||
81 | |||
82 | isCProject = false; | ||
83 | isEmptyProject = false; | ||
84 | isAutotoolsProject = false; | ||
85 | isCMakeProject = false; | ||
86 | } | ||
87 | |||
88 | private String printIllegalChars(){ | ||
89 | String print = ""; | ||
90 | for (Character ch : illegalChars) | ||
91 | print += ch + ", "; | ||
92 | print = print.substring(0, print.length() - 2); | ||
93 | return print; | ||
94 | } | ||
95 | |||
96 | public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException { | ||
97 | |||
98 | String projectName = args[0].getSimpleValue(); | ||
99 | String location = args[1].getSimpleValue(); | ||
100 | String artifactExtension = args[2].getSimpleValue(); | ||
101 | String isCProjectValue = args[3].getSimpleValue(); | ||
102 | String isEmptyProjetValue = args[4].getSimpleValue(); | ||
103 | String isAutotoolsProjectValue = args[5].getSimpleValue(); | ||
104 | String isCMakeProjectValue = args[6].getSimpleValue(); | ||
105 | |||
106 | isCProject = Boolean.valueOf(isCProjectValue).booleanValue(); | ||
107 | isEmptyProject = Boolean.valueOf(isEmptyProjetValue).booleanValue(); | ||
108 | isAutotoolsProject = Boolean.valueOf(isAutotoolsProjectValue).booleanValue(); | ||
109 | isCMakeProject = Boolean.valueOf(isCMakeProjectValue).booleanValue(); | ||
110 | |||
111 | IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); | ||
112 | try { | ||
113 | if (!isValidProjectName(projectName)) { | ||
114 | |||
115 | IWizardPage[] pages = MBSCustomPageManager.getPages(); | ||
116 | if(pages != null && pages.length > 0) { | ||
117 | CDTMainWizardPage cdtMainPage = (CDTMainWizardPage)pages[0]; | ||
118 | cdtMainPage.setPageComplete(false); | ||
119 | ICDTCommonProjectWizard wizard = (ICDTCommonProjectWizard) pages[0].getWizard(); | ||
120 | wizard.performCancel(); | ||
121 | |||
122 | project.delete(true, null); | ||
123 | } | ||
124 | throw new ProcessFailureException(YoctoSDKMessages.getFormattedString(PROJECT_NAME_ERROR, new Object[]{projectName, printIllegalChars()})); | ||
125 | } | ||
126 | |||
127 | if (!project.exists()) { | ||
128 | IWorkspace workspace = ResourcesPlugin.getWorkspace(); | ||
129 | turnOffAutoBuild(workspace); | ||
130 | |||
131 | IPath locationPath = null; | ||
132 | if (location != null && !location.trim().equals("")) { //$NON-NLS-1$ | ||
133 | locationPath = Path.fromPortableString(location); | ||
134 | } | ||
135 | |||
136 | List<?> configs = template.getTemplateInfo().getConfigurations(); | ||
137 | |||
138 | if (configs == null || configs.size() == 0) { | ||
139 | throw new ProcessFailureException(Messages.getString("NewManagedProject.4") + projectName); //$NON-NLS-1$ | ||
140 | } | ||
141 | |||
142 | pca.setProject(project); | ||
143 | pca.setProjectLocation(locationPath); | ||
144 | pca.setConfigs((IConfiguration[]) configs.toArray(new IConfiguration[configs.size()])); | ||
145 | pca.setArtifactExtension(artifactExtension); | ||
146 | info = pca.createProject(monitor, CCorePlugin.DEFAULT_INDEXER, isCProject); | ||
147 | |||
148 | addNatures(project, false, monitor); | ||
149 | |||
150 | info.setValid(true); | ||
151 | ManagedBuildManager.saveBuildInfo(project, true); | ||
152 | |||
153 | restoreAutoBuild(workspace); | ||
154 | } else { | ||
155 | |||
156 | IWorkspace workspace = ResourcesPlugin.getWorkspace(); | ||
157 | turnOffAutoBuild(workspace); | ||
158 | |||
159 | YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid(); | ||
160 | |||
161 | addNatures(project, true, monitor); | ||
162 | |||
163 | //restoreAutoBuild(workspace); | ||
164 | IDiscoveredPathManager manager = MakeCorePlugin.getDefault().getDiscoveryManager(); | ||
165 | IDiscoveredPathInfo pathInfo = manager.getDiscoveredInfo(project); | ||
166 | |||
167 | if (pathInfo instanceof IPerProjectDiscoveredPathInfo) { | ||
168 | IPerProjectDiscoveredPathInfo projectPathInfo = | ||
169 | (IPerProjectDiscoveredPathInfo) pathInfo; | ||
170 | projectPathInfo.setIncludeMap(new LinkedHashMap<String, Boolean>()); | ||
171 | projectPathInfo.setSymbolMap(new LinkedHashMap<String, SymbolEntry>()); | ||
172 | manager.removeDiscoveredInfo(project); | ||
173 | } | ||
174 | } | ||
175 | } | ||
176 | catch (CoreException e) | ||
177 | { | ||
178 | throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage(), e); //$NON-NLS-1$ | ||
179 | } | ||
180 | catch (BuildException e) | ||
181 | { | ||
182 | throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage()); //$NON-NLS-1$ | ||
183 | } | ||
184 | catch (YoctoGeneralException e) | ||
185 | { | ||
186 | try { | ||
187 | project.delete(true, monitor); | ||
188 | } catch (CoreException err) { | ||
189 | throw new ProcessFailureException(Messages.getString("NewManagedProject.3") + e.getMessage() //$NON-NLS-1$ | ||
190 | + " " + err.getMessage()); //$NON-NLS-1$ | ||
191 | } | ||
192 | throw new OperationCanceledException(Messages.getString("NewManagedProject.3") + e.getMessage()); //$NON-NLS-1$ | ||
193 | } | ||
194 | } | ||
195 | |||
196 | private boolean isValidProjectName(String projectName) { | ||
197 | Pattern pattern = Pattern.compile("^[a-zA-Z][a-zA-Z0-9_\\-]*$"); //$NON-NLS-1$ | ||
198 | Matcher matcher = pattern.matcher(projectName); | ||
199 | return matcher.find(); | ||
200 | } | ||
201 | |||
202 | private void addNatures(IProject project, boolean projectExists, IProgressMonitor monitor) | ||
203 | throws CoreException, YoctoGeneralException { | ||
204 | YoctoSDKNatureUtils.addNature(project, YoctoSDKProjectNature.YoctoSDK_NATURE_ID, monitor); | ||
205 | |||
206 | YoctoSDKChecker.checkIfGloballySelectedYoctoProfileIsValid(); | ||
207 | |||
208 | YoctoProfileElement profileElement = YoctoSDKUtils.getProfilesFromDefaultStore(); | ||
209 | ProjectPreferenceUtils.saveProfiles(profileElement, project); | ||
210 | |||
211 | IPreferenceStore selecteProfileStore = YoctoSDKPlugin.getProfilePreferenceStore(profileElement.getSelectedProfile()); | ||
212 | YoctoUIElement elem = YoctoSDKUtils.getElemFromStore(selecteProfileStore); | ||
213 | YoctoSDKUtils.setEnvironmentVariables(project, elem); | ||
214 | |||
215 | if (isEmptyProject) { | ||
216 | YoctoSDKNatureUtils.addNature(project, YoctoSDKEmptyProjectNature.YoctoSDK_EMPTY_NATURE_ID, monitor); | ||
217 | } | ||
218 | |||
219 | if (isAutotoolsProject) { | ||
220 | AutotoolsNewProjectNature.addAutotoolsNature(project, monitor); | ||
221 | |||
222 | if (!projectExists) { | ||
223 | // For each IConfiguration, create a corresponding Autotools Configuration | ||
224 | for (IConfiguration cfg : pca.getConfigs()) { | ||
225 | AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfg.getName(), true); | ||
226 | } | ||
227 | AutotoolsConfigurationManager.getInstance().saveConfigs(project); | ||
228 | } | ||
229 | |||
230 | YoctoSDKNatureUtils.addNature(project, YoctoSDKAutotoolsProjectNature.YoctoSDK_AUTOTOOLS_NATURE_ID, monitor); | ||
231 | YoctoSDKAutotoolsProjectNature.configureAutotoolsOptions(project); | ||
232 | } else if (isCMakeProject) { | ||
233 | YoctoSDKNatureUtils.addNature(project, YoctoSDKCMakeProjectNature.YoctoSDK_CMAKE_NATURE_ID, monitor); | ||
234 | YoctoSDKCMakeProjectNature.extendProjectEnvironmentForCMake(project); | ||
235 | } | ||
236 | |||
237 | YoctoSDKUtils.createRemoteDebugAndQemuLaunchers(project, elem); | ||
238 | } | ||
239 | |||
240 | protected final void turnOffAutoBuild(IWorkspace workspace) throws CoreException { | ||
241 | IWorkspaceDescription workspaceDesc = workspace.getDescription(); | ||
242 | savedAutoBuildingValue = workspaceDesc.isAutoBuilding(); | ||
243 | workspaceDesc.setAutoBuilding(false); | ||
244 | workspace.setDescription(workspaceDesc); | ||
245 | } | ||
246 | |||
247 | protected final void restoreAutoBuild(IWorkspace workspace) throws CoreException { | ||
248 | IWorkspaceDescription workspaceDesc = workspace.getDescription(); | ||
249 | workspaceDesc.setAutoBuilding(savedAutoBuildingValue); | ||
250 | workspace.setDescription(workspaceDesc); | ||
251 | } | ||
252 | |||
253 | /** | ||
254 | * setOptionValue | ||
255 | * @param config | ||
256 | * @param option | ||
257 | * @param val | ||
258 | * @throws BuildException | ||
259 | */ | ||
260 | protected void setOptionValue(IConfiguration config, IOption option, String val) throws BuildException { | ||
261 | if (val != null) { | ||
262 | if (!option.isExtensionElement()) { | ||
263 | option.setValue(val); | ||
264 | } else { | ||
265 | IOption newOption = config.getToolChain().createOption(option, option.getId() + "." + ManagedBuildManager.getRandomNumber(), option.getName(), false); //$NON-NLS-1$ | ||
266 | newOption.setValue(val); | ||
267 | } | ||
268 | } | ||
269 | } | ||
270 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.properties b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.properties new file mode 100644 index 0000000..c7e7867 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.properties | |||
@@ -0,0 +1,14 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - Initial implementation | ||
10 | *******************************************************************************/ | ||
11 | |||
12 | #Template Default Values | ||
13 | EmptyProject.template.label=Empty C Autotools Project | ||
14 | EmptyProject.template.description=An empty C Yocto Project autotools project template | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.xml new file mode 100644 index 0000000..e1c1abc --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCAutotoolsProject/template.xml | |||
@@ -0,0 +1,17 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
2 | <template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation" | ||
3 | copyright="Copyright (c) 2007 Intel 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" | ||
4 | |||
5 | id="YoctoEmptyCAutotoolsProject" label="%EmptyProject.template.label" description="%EmptyProject.template.description" | ||
6 | help="help.html"> | ||
7 | |||
8 | <process type="org.yocto.sdk.ide.NewYoctoProject"> | ||
9 | <simple name="name" value="$(projectName)" /> | ||
10 | <simple name="artifactExtension" value="exe" /> | ||
11 | <simple name="isCProject" value="true" /> | ||
12 | <simple name="isEmptyProject" value="true" /> | ||
13 | <simple name="isAutotoolsProject" value="true" /> | ||
14 | <simple name="isCMakeProject" value="false" /> | ||
15 | </process> | ||
16 | |||
17 | </template> | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.properties b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.properties new file mode 100644 index 0000000..416e2ef --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.properties | |||
@@ -0,0 +1,14 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - Initial implementation | ||
10 | *******************************************************************************/ | ||
11 | |||
12 | #Template Default Values | ||
13 | EmptyProject.template.label=Empty C++ Autotools Project | ||
14 | EmptyProject.template.description=An empty CPP Yocto Project autotools project template | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml new file mode 100644 index 0000000..9f1d46b --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/EmptyCPPAutotoolsProject/template.xml | |||
@@ -0,0 +1,16 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
2 | <template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation" | ||
3 | copyright="Copyright (c) 2007 Intel 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" | ||
4 | id="YoctoEmptyCppAutotoolsProject" label="%EmptyProject.template.label" description="%EmptyProject.template.description" | ||
5 | help="help.html"> | ||
6 | |||
7 | <process type="org.yocto.sdk.ide.NewYoctoProject"> | ||
8 | <simple name="name" value="$(projectName)" /> | ||
9 | <simple name="artifactExtension" value="exe" /> | ||
10 | <simple name="isCProject" value="false" /> | ||
11 | <simple name="isEmptyProject" value="true" /> | ||
12 | <simple name="isAutotoolsProject" value="true" /> | ||
13 | <simple name="isCMakeProject" value="false" /> | ||
14 | </process> | ||
15 | |||
16 | </template> | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.c b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.c new file mode 100644 index 0000000..862467a --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.c | |||
@@ -0,0 +1,9 @@ | |||
1 | |||
2 | |||
3 | #include <stdlib.h> | ||
4 | #include <stdio.h> | ||
5 | |||
6 | int main(void) { | ||
7 | puts("Hello World"); /* prints Hello World */ | ||
8 | return 0; | ||
9 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.desktop.in.src b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.desktop.in.src new file mode 100644 index 0000000..e96420f --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Basename.desktop.in.src | |||
@@ -0,0 +1,9 @@ | |||
1 | [Desktop Entry] | ||
2 | Version=@VERSION@ | ||
3 | Encoding=UTF-8 | ||
4 | Name=$(projectName) | ||
5 | Comment=A "$(message)" | ||
6 | Type=Application | ||
7 | Categories=Application | ||
8 | Exec=$(projectName) | ||
9 | Name[en_US]=$(message) | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/ChangeLog b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/ChangeLog new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/ChangeLog | |||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/INSTALL b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/INSTALL new file mode 100644 index 0000000..b8b0535 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/INSTALL | |||
@@ -0,0 +1,9 @@ | |||
1 | Building: | ||
2 | $ ./autogen.sh [--enable-gtk-doc] [--prefix=/usr] | ||
3 | $ make | ||
4 | |||
5 | Installing: | ||
6 | $ sudo make install | ||
7 | |||
8 | Running: | ||
9 | $ $(projectName) \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.src b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.src new file mode 100644 index 0000000..fc3bc8c --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.src | |||
@@ -0,0 +1,8 @@ | |||
1 | |||
2 | bin_PROGRAMS = $(projectName) | ||
3 | $(projectName)_SOURCES = $(projectName).c | ||
4 | |||
5 | AM_CFLAGS = @$(projectName)_CFLAGS@ | ||
6 | AM_LDFLAGS = @$(projectName)_LIBS@ | ||
7 | |||
8 | CLEANFILES = *~ | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.top b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.top new file mode 100644 index 0000000..7bee2b7 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/Makefile.am.top | |||
@@ -0,0 +1,7 @@ | |||
1 | SUBDIRS = $(sourceDir) | ||
2 | |||
3 | MAINTAINERCLEANFILES = aclocal.m4 compile config.guess \ | ||
4 | config.sub configure depcomp install-sh \ | ||
5 | ltmain.sh Makefile.in missing | ||
6 | |||
7 | |||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/NEWS b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/NEWS new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/NEWS | |||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/README b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/README new file mode 100644 index 0000000..ec15541 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/README | |||
@@ -0,0 +1,25 @@ | |||
1 | $(projectName) | ||
2 | Copyright (C) $(copyright). | ||
3 | |||
4 | Brief description of project.... | ||
5 | |||
6 | ----------------------------------------------------------------------------- | ||
7 | Build | ||
8 | ----------------------------------------------------------------------------- | ||
9 | $ ./autogen.sh $CONFIGURE_FLAGS | ||
10 | $ make | ||
11 | |||
12 | ----------------------------------------------------------------------------- | ||
13 | Build with documentation generated (usually for libraries) | ||
14 | ----------------------------------------------------------------------------- | ||
15 | $ ./autogen.sh --enable-gtk-doc | ||
16 | $ make | ||
17 | |||
18 | ( If built with the --enable-gtk-doc flag above you can view the index.html | ||
19 | file in your web browser. ) | ||
20 | $ firefox ./docs/reference/index.html | ||
21 | |||
22 | ----------------------------------------------------------------------------- | ||
23 | Install | ||
24 | ----------------------------------------------------------------------------- | ||
25 | $ sudo make install | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/autogen.sh b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/autogen.sh new file mode 100755 index 0000000..7fd81e2 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/autogen.sh | |||
@@ -0,0 +1,10 @@ | |||
1 | #! /bin/sh | ||
2 | [ -e config.cache ] && rm -f config.cache | ||
3 | |||
4 | libtoolize --automake | ||
5 | aclocal ${OECORE_ACLOCAL_OPTS} | ||
6 | autoconf | ||
7 | autoheader | ||
8 | automake -a | ||
9 | ./configure $@ | ||
10 | exit | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/configure.ac.top b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/configure.ac.top new file mode 100644 index 0000000..234ab99 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/src/configure.ac.top | |||
@@ -0,0 +1,37 @@ | |||
1 | AC_PREREQ(2.61) | ||
2 | |||
3 | # package version number (not shared library version) | ||
4 | # odd micro numbers indicate in-progress development | ||
5 | # even micro numbers indicate released versions | ||
6 | m4_define($(projectName)_version_major, 0) | ||
7 | m4_define($(projectName)_version_minor, 1) | ||
8 | m4_define($(projectName)_version_micro, 0) | ||
9 | |||
10 | m4_define([$(projectName)_version], | ||
11 | [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro]) | ||
12 | m4_define([$(projectName)_api_version], | ||
13 | [$(projectName)_version_major.$(projectName)_version_minor]) | ||
14 | |||
15 | AC_INIT($(projectName), $(projectName)_version) | ||
16 | AM_INIT_AUTOMAKE($(projectName), $(projectName)_version) | ||
17 | AC_CONFIG_HEADERS(config.h) | ||
18 | |||
19 | # Checks for programs. | ||
20 | AC_PROG_LIBTOOL | ||
21 | AM_PROG_CC_C_O | ||
22 | AC_PROG_INSTALL | ||
23 | |||
24 | AC_SUBST($(projectName)_CFLAGS) | ||
25 | AC_SUBST($(projectName)_LIBS) | ||
26 | |||
27 | AC_OUTPUT([ | ||
28 | Makefile | ||
29 | $(sourceDir)/Makefile | ||
30 | ]) | ||
31 | |||
32 | echo "" | ||
33 | echo " $(projectName) $VERSION" | ||
34 | echo " =====================" | ||
35 | echo "" | ||
36 | echo " To build the project, run \"make\"" | ||
37 | echo "" | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.properties b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.properties new file mode 100644 index 0000000..12830ea --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.properties | |||
@@ -0,0 +1,28 @@ | |||
1 | ############################################################################### | ||
2 | # Copyright (c) 2007, 2009 Symbian Software Private Ltd. and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # Bala Torati (Symbian) - initial API and implementation | ||
10 | # Red Hat Inc - modification to use with Autotools project | ||
11 | ############################################################################### | ||
12 | |||
13 | #Template Default Values | ||
14 | HelloWorld.CAnsitemplate.label=Hello World ANSI C Autotools Project | ||
15 | HelloWorld.CAnsitemplate.description=A skeletal C Hello World project. Creates a folder for sources and autogen artifacts. | ||
16 | HelloWorld.basics.label=Basic Settings | ||
17 | HelloWorld.basics.description=Basic properties of a project | ||
18 | HelloWorld.author.label=Author | ||
19 | HelloWorld.author.description=Name of the author | ||
20 | HelloWorld.copyright.label=Copyright notice | ||
21 | HelloWorld.copyright.description=The name of the copyright holder (e.g. XYZ Corporation) | ||
22 | HelloWorld.copyright.default=Your copyright | ||
23 | HelloWorld.message.default=Hello World | ||
24 | HelloWorld.message.description=Your hello world greeting message | ||
25 | HelloWorld.message.label=Hello world greeting | ||
26 | HelloWorld.sourceDir.label=Source | ||
27 | HelloWorld.sourceDir.description=Directory for hello world project source files | ||
28 | HelloWorld.sourceDir.default=src | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml new file mode 100644 index 0000000..ca154ca --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCAutotoolsProject/template.xml | |||
@@ -0,0 +1,143 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
2 | <template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Bala Torati (Symbian)" | ||
3 | copyright="Copyright (c) 2007,2009 Symbian Software Limited 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 athttp://www.eclipse.org/legal/epl-v10.html" | ||
4 | id="YoctoHelloWorldCAutotoolsProject" label="%HelloWorld.CAnsitemplate.label" description="%HelloWorld.CAnsitemplate.description" | ||
5 | help="help.html"> | ||
6 | |||
7 | <property-group id="basics" label="%HelloWorld.basics.label" description="%HelloWorld.basics.description" type="PAGES-ONLY" help="help.html"> | ||
8 | <property id="author" | ||
9 | label="%HelloWorld.author.label" | ||
10 | description="%HelloWorld.author.description" | ||
11 | type="input" | ||
12 | pattern=".+" | ||
13 | default="" | ||
14 | hidden="false" | ||
15 | mandatory="true" | ||
16 | persist="true"/> | ||
17 | <property id="copyright" | ||
18 | label="%HelloWorld.copyright.label" | ||
19 | description="%HelloWorld.copyright.description" | ||
20 | type="input" | ||
21 | pattern=".+" | ||
22 | default="%HelloWorld.copyright.default" | ||
23 | hidden="false" | ||
24 | mandatory="true" | ||
25 | persist="true"/> | ||
26 | <property id="message" | ||
27 | label="%HelloWorld.message.label" | ||
28 | description="%HelloWorld.message.description" | ||
29 | type="input" | ||
30 | pattern=".+" | ||
31 | default="%HelloWorld.message.default" | ||
32 | hidden="false" | ||
33 | mandatory="true" | ||
34 | persist="true"/> | ||
35 | <property id="sourceDir" | ||
36 | label="%HelloWorld.sourceDir.label" | ||
37 | description="%HelloWorld.sourceDir.description" | ||
38 | type="input" | ||
39 | default="%HelloWorld.sourceDir.default" | ||
40 | pattern="[a-zA-Z0-9]+" | ||
41 | mandatory="true" | ||
42 | persist="true"/> | ||
43 | <property id="license" label="License" description="License" type="select" default="BSD" mandatory="false" persist="true"> | ||
44 | <item label="BSD License" name="BSD"/> | ||
45 | <item label="MIT License" name="MIT"/> | ||
46 | <item label="GNU General Public License v2.0" name="GPLv2"/> | ||
47 | <item label="GNU General Public License v2.0_or_later" name="GPLv2_or_later"/> | ||
48 | <item label="GNU General Public License v3.0" name="GPLv3"/> | ||
49 | <item label="Other" name="Other"/> | ||
50 | </property> | ||
51 | </property-group> | ||
52 | |||
53 | <process type="org.yocto.sdk.ide.NewYoctoProject"> | ||
54 | <simple name="name" value="$(projectName)" /> | ||
55 | <simple name="artifactExtension" value="exe" /> | ||
56 | <simple name="isCProject" value="true" /> | ||
57 | <simple name="isEmptyProject" value="false" /> | ||
58 | <simple name="isAutotoolsProject" value="true" /> | ||
59 | <simple name="isCMakeProject" value="false" /> | ||
60 | </process> | ||
61 | |||
62 | <process type="org.eclipse.cdt.core.CreateSourceFolder"> | ||
63 | <simple name="projectName" value="$(projectName)"/> | ||
64 | <simple name="path" value="$(sourceDir)"/> | ||
65 | </process> | ||
66 | |||
67 | <process type="org.eclipse.cdt.core.AddFiles"> | ||
68 | <simple name="projectName" value="$(projectName)"/> | ||
69 | <complex-array name="files"> | ||
70 | <element> | ||
71 | <simple name="source" value="../Licenses/AUTHORS"/> | ||
72 | <simple name="target" value="AUTHORS"/> | ||
73 | <simple name="replaceable" value="true"/> | ||
74 | </element> | ||
75 | <element> | ||
76 | <simple name="source" value="../Licenses/COPYING_$(license)"/> | ||
77 | <simple name="target" value="COPYING"/> | ||
78 | <simple name="replaceable" value="true"/> | ||
79 | </element> | ||
80 | <element> | ||
81 | <simple name="source" value="../Licenses/Header_$(license)"/> | ||
82 | <simple name="target" value="$(sourceDir)/$(projectName).c"/> | ||
83 | <simple name="replaceable" value="true"/> | ||
84 | </element> | ||
85 | <element> | ||
86 | <simple name="source" value="src/autogen.sh"/> | ||
87 | <simple name="target" value="autogen.sh"/> | ||
88 | <simple name="replaceable" value="true"/> | ||
89 | </element> | ||
90 | <element> | ||
91 | <simple name="source" value="src/ChangeLog"/> | ||
92 | <simple name="target" value="ChangeLog"/> | ||
93 | <simple name="replaceable" value="true"/> | ||
94 | </element> | ||
95 | <element> | ||
96 | <simple name="source" value="src/configure.ac.top"/> | ||
97 | <simple name="target" value="configure.ac"/> | ||
98 | <simple name="replaceable" value="true"/> | ||
99 | </element> | ||
100 | <element> | ||
101 | <simple name="source" value="src/INSTALL"/> | ||
102 | <simple name="target" value="INSTALL"/> | ||
103 | <simple name="replaceable" value="true"/> | ||
104 | </element> | ||
105 | <element> | ||
106 | <simple name="source" value="src/Makefile.am.src"/> | ||
107 | <simple name="target" value="$(sourceDir)/Makefile.am"/> | ||
108 | <simple name="replaceable" value="true"/> | ||
109 | </element> | ||
110 | <element> | ||
111 | <simple name="source" value="src/Makefile.am.top"/> | ||
112 | <simple name="target" value="Makefile.am"/> | ||
113 | <simple name="replaceable" value="true"/> | ||
114 | </element> | ||
115 | <element> | ||
116 | <simple name="source" value="src/NEWS"/> | ||
117 | <simple name="target" value="NEWS"/> | ||
118 | <simple name="replaceable" value="true"/> | ||
119 | </element> | ||
120 | <element> | ||
121 | <simple name="source" value="src/README"/> | ||
122 | <simple name="target" value="README"/> | ||
123 | <simple name="replaceable" value="true"/> | ||
124 | </element> | ||
125 | </complex-array> | ||
126 | </process> | ||
127 | |||
128 | <process type="org.eclipse.cdt.core.AppendCreate"> | ||
129 | <simple name="projectName" value="$(projectName)"/> | ||
130 | <complex-array name="files"> | ||
131 | <element> | ||
132 | <simple name="source" value="src/Basename.c"/> | ||
133 | <simple name="target" value="$(sourceDir)/$(projectName).c"/> | ||
134 | <simple name="replaceable" value="true"/> | ||
135 | </element> | ||
136 | </complex-array> | ||
137 | </process> | ||
138 | |||
139 | <process type="org.yocto.sdk.ide.NewYoctoAutotoolsProjectPostProcess"> | ||
140 | <simple name="projectName" value="$(projectName)" /> | ||
141 | </process> | ||
142 | |||
143 | </template> | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.c b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.c new file mode 100644 index 0000000..e40fd64 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.c | |||
@@ -0,0 +1,50 @@ | |||
1 | #include <gtk/gtk.h> | ||
2 | |||
3 | static void | ||
4 | hello (GtkWidget * widget, gpointer data) | ||
5 | { | ||
6 | g_print ("Hello World!\n"); | ||
7 | } | ||
8 | |||
9 | static gboolean | ||
10 | delete_event (GtkWidget * widget, GdkEvent * event, gpointer data) | ||
11 | { | ||
12 | g_print ("delete event occurred\n"); | ||
13 | return TRUE; | ||
14 | } | ||
15 | |||
16 | static void | ||
17 | destroy (GtkWidget * widget, gpointer data) | ||
18 | { | ||
19 | gtk_main_quit (); | ||
20 | } | ||
21 | |||
22 | int | ||
23 | main (int argc, char *argv[]) | ||
24 | { | ||
25 | GtkWidget *window; | ||
26 | GtkWidget *button; | ||
27 | |||
28 | gtk_init (&argc, &argv); | ||
29 | window = gtk_window_new (GTK_WINDOW_TOPLEVEL); | ||
30 | |||
31 | g_signal_connect (G_OBJECT (window), "delete_event", | ||
32 | G_CALLBACK (delete_event), NULL); | ||
33 | g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy), NULL); | ||
34 | |||
35 | gtk_container_set_border_width (GTK_CONTAINER (window), 10); | ||
36 | button = gtk_button_new_with_label ("Hello World!"); | ||
37 | |||
38 | g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (hello), NULL); | ||
39 | g_signal_connect_swapped (G_OBJECT (button), "clicked", | ||
40 | G_CALLBACK (gtk_widget_destroy), | ||
41 | G_OBJECT (window)); | ||
42 | |||
43 | gtk_container_add (GTK_CONTAINER (window), button); | ||
44 | gtk_widget_show (button); | ||
45 | gtk_widget_show (window); | ||
46 | |||
47 | gtk_main (); | ||
48 | |||
49 | return 0; | ||
50 | } | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.desktop.in.src b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.desktop.in.src new file mode 100644 index 0000000..e96420f --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Basename.desktop.in.src | |||
@@ -0,0 +1,9 @@ | |||
1 | [Desktop Entry] | ||
2 | Version=@VERSION@ | ||
3 | Encoding=UTF-8 | ||
4 | Name=$(projectName) | ||
5 | Comment=A "$(message)" | ||
6 | Type=Application | ||
7 | Categories=Application | ||
8 | Exec=$(projectName) | ||
9 | Name[en_US]=$(message) | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/ChangeLog b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/ChangeLog new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/ChangeLog | |||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/INSTALL b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/INSTALL new file mode 100644 index 0000000..b8b0535 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/INSTALL | |||
@@ -0,0 +1,9 @@ | |||
1 | Building: | ||
2 | $ ./autogen.sh [--enable-gtk-doc] [--prefix=/usr] | ||
3 | $ make | ||
4 | |||
5 | Installing: | ||
6 | $ sudo make install | ||
7 | |||
8 | Running: | ||
9 | $ $(projectName) \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.src b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.src new file mode 100644 index 0000000..5ac2885 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.src | |||
@@ -0,0 +1,8 @@ | |||
1 | |||
2 | bin_PROGRAMS = $(projectName) | ||
3 | $(projectName)_SOURCES = $(projectName).c | ||
4 | |||
5 | AM_CFLAGS = @$(projectName)_CFLAGS@ | ||
6 | AM_LDFLAGS = @$(projectName)_LIBS@ | ||
7 | |||
8 | CLEANFILES = *~ | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.top b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.top new file mode 100644 index 0000000..7bee2b7 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/Makefile.am.top | |||
@@ -0,0 +1,7 @@ | |||
1 | SUBDIRS = $(sourceDir) | ||
2 | |||
3 | MAINTAINERCLEANFILES = aclocal.m4 compile config.guess \ | ||
4 | config.sub configure depcomp install-sh \ | ||
5 | ltmain.sh Makefile.in missing | ||
6 | |||
7 | |||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/NEWS b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/NEWS new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/NEWS | |||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/README b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/README new file mode 100644 index 0000000..ec15541 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/README | |||
@@ -0,0 +1,25 @@ | |||
1 | $(projectName) | ||
2 | Copyright (C) $(copyright). | ||
3 | |||
4 | Brief description of project.... | ||
5 | |||
6 | ----------------------------------------------------------------------------- | ||
7 | Build | ||
8 | ----------------------------------------------------------------------------- | ||
9 | $ ./autogen.sh $CONFIGURE_FLAGS | ||
10 | $ make | ||
11 | |||
12 | ----------------------------------------------------------------------------- | ||
13 | Build with documentation generated (usually for libraries) | ||
14 | ----------------------------------------------------------------------------- | ||
15 | $ ./autogen.sh --enable-gtk-doc | ||
16 | $ make | ||
17 | |||
18 | ( If built with the --enable-gtk-doc flag above you can view the index.html | ||
19 | file in your web browser. ) | ||
20 | $ firefox ./docs/reference/index.html | ||
21 | |||
22 | ----------------------------------------------------------------------------- | ||
23 | Install | ||
24 | ----------------------------------------------------------------------------- | ||
25 | $ sudo make install | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/autogen.sh b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/autogen.sh new file mode 100755 index 0000000..7fd81e2 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/autogen.sh | |||
@@ -0,0 +1,10 @@ | |||
1 | #! /bin/sh | ||
2 | [ -e config.cache ] && rm -f config.cache | ||
3 | |||
4 | libtoolize --automake | ||
5 | aclocal ${OECORE_ACLOCAL_OPTS} | ||
6 | autoconf | ||
7 | autoheader | ||
8 | automake -a | ||
9 | ./configure $@ | ||
10 | exit | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top new file mode 100644 index 0000000..508bc13 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top | |||
@@ -0,0 +1,49 @@ | |||
1 | AC_PREREQ(2.61) | ||
2 | |||
3 | # package version number (not shared library version) | ||
4 | # odd micro numbers indicate in-progress development | ||
5 | # even micro numbers indicate released versions | ||
6 | m4_define($(projectName)_version_major, 0) | ||
7 | m4_define($(projectName)_version_minor, 1) | ||
8 | m4_define($(projectName)_version_micro, 0) | ||
9 | |||
10 | m4_define([$(projectName)_version], | ||
11 | [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro]) | ||
12 | m4_define([$(projectName)_api_version], | ||
13 | [$(projectName)_version_major.$(projectName)_version_minor]) | ||
14 | |||
15 | AC_INIT($(projectName), $(projectName)_version) | ||
16 | AM_INIT_AUTOMAKE($(projectName), $(projectName)_version) | ||
17 | AC_CONFIG_HEADERS(config.h) | ||
18 | |||
19 | # Checks for programs. | ||
20 | AC_PROG_LIBTOOL | ||
21 | AM_PROG_CC_C_O | ||
22 | AC_PROG_INSTALL | ||
23 | |||
24 | #enable pkg-config | ||
25 | PKG_PROG_PKG_CONFIG | ||
26 | |||
27 | #GTK_REQUIRED_VERSION=2.0.0 | ||
28 | #GLIB_REQUIRED_VERSION=$GTK_REQUIRED_VERSION | ||
29 | |||
30 | #AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION,, | ||
31 | # [AC_MSG_ERROR(Test for GLib failed.)], gobject) | ||
32 | #AM_PATH_GTK_2_0($GTK_REQUIRED_VERSION,, | ||
33 | # [AC_MSG_ERROR(Test for GTK failed.)]) | ||
34 | PKG_CHECK_MODULES($(projectName), glib-2.0 gtk+-2.0) | ||
35 | |||
36 | AC_SUBST($(projectName)_CFLAGS) | ||
37 | AC_SUBST($(projectName)_LIBS) | ||
38 | |||
39 | AC_OUTPUT([ | ||
40 | Makefile | ||
41 | $(sourceDir)/Makefile | ||
42 | ]) | ||
43 | |||
44 | echo "" | ||
45 | echo " $(projectName) $VERSION" | ||
46 | echo " =====================" | ||
47 | echo "" | ||
48 | echo " To build the project, run \"make\"" | ||
49 | echo "" | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top.old b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top.old new file mode 100644 index 0000000..234ab99 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/src/configure.ac.top.old | |||
@@ -0,0 +1,37 @@ | |||
1 | AC_PREREQ(2.61) | ||
2 | |||
3 | # package version number (not shared library version) | ||
4 | # odd micro numbers indicate in-progress development | ||
5 | # even micro numbers indicate released versions | ||
6 | m4_define($(projectName)_version_major, 0) | ||
7 | m4_define($(projectName)_version_minor, 1) | ||
8 | m4_define($(projectName)_version_micro, 0) | ||
9 | |||
10 | m4_define([$(projectName)_version], | ||
11 | [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro]) | ||
12 | m4_define([$(projectName)_api_version], | ||
13 | [$(projectName)_version_major.$(projectName)_version_minor]) | ||
14 | |||
15 | AC_INIT($(projectName), $(projectName)_version) | ||
16 | AM_INIT_AUTOMAKE($(projectName), $(projectName)_version) | ||
17 | AC_CONFIG_HEADERS(config.h) | ||
18 | |||
19 | # Checks for programs. | ||
20 | AC_PROG_LIBTOOL | ||
21 | AM_PROG_CC_C_O | ||
22 | AC_PROG_INSTALL | ||
23 | |||
24 | AC_SUBST($(projectName)_CFLAGS) | ||
25 | AC_SUBST($(projectName)_LIBS) | ||
26 | |||
27 | AC_OUTPUT([ | ||
28 | Makefile | ||
29 | $(sourceDir)/Makefile | ||
30 | ]) | ||
31 | |||
32 | echo "" | ||
33 | echo " $(projectName) $VERSION" | ||
34 | echo " =====================" | ||
35 | echo "" | ||
36 | echo " To build the project, run \"make\"" | ||
37 | echo "" | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.properties b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.properties new file mode 100644 index 0000000..430c04d --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.properties | |||
@@ -0,0 +1,28 @@ | |||
1 | ############################################################################### | ||
2 | # Copyright (c) 2007, 2009 Symbian Software Private Ltd. and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # Bala Torati (Symbian) - initial API and implementation | ||
10 | # Red Hat Inc - modification to use with Autotools project | ||
11 | ############################################################################### | ||
12 | |||
13 | #Template Default Values | ||
14 | HelloWorld.CAnsitemplate.label=Hello World GTK C Autotools Project | ||
15 | HelloWorld.CAnsitemplate.description=A skeletal C GTK Hello World project. Creates a folder for sources and autogen artifacts. | ||
16 | HelloWorld.basics.label=Basic Settings | ||
17 | HelloWorld.basics.description=Basic properties of a project | ||
18 | HelloWorld.author.label=Author | ||
19 | HelloWorld.author.description=Name of the author | ||
20 | HelloWorld.copyright.label=Copyright notice | ||
21 | HelloWorld.copyright.description=The name of the copyright holder (e.g. XYZ Corporation) | ||
22 | HelloWorld.copyright.default=Your copyright | ||
23 | HelloWorld.message.default=Hello World | ||
24 | HelloWorld.message.description=Your hello world greeting message | ||
25 | HelloWorld.message.label=Hello world greeting | ||
26 | HelloWorld.sourceDir.label=Source | ||
27 | HelloWorld.sourceDir.description=Directory for hello world project source files | ||
28 | HelloWorld.sourceDir.default=src | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml new file mode 100644 index 0000000..4234ff4 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCGTKAutotoolsProject/template.xml | |||
@@ -0,0 +1,142 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
2 | <template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Bala Torati (Symbian)" | ||
3 | copyright="Copyright (c) 2007,2009 Symbian Software Limited 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 athttp://www.eclipse.org/legal/epl-v10.html" | ||
4 | id="YoctoHelloWorldCGTKAutotoolsProject" label="%HelloWorld.CAnsitemplate.label" description="%HelloWorld.CAnsitemplate.description" | ||
5 | help="help.html"> | ||
6 | |||
7 | <property-group id="basics" label="%HelloWorld.basics.label" description="%HelloWorld.basics.description" type="PAGES-ONLY" help="help.html"> | ||
8 | <property id="author" | ||
9 | label="%HelloWorld.author.label" | ||
10 | description="%HelloWorld.author.description" | ||
11 | type="input" | ||
12 | pattern=".+" | ||
13 | default="" | ||
14 | hidden="false" | ||
15 | mandatory="true" | ||
16 | persist="true"/> | ||
17 | <property id="copyright" | ||
18 | label="%HelloWorld.copyright.label" | ||
19 | description="%HelloWorld.copyright.description" | ||
20 | type="input" | ||
21 | pattern=".+" | ||
22 | default="%HelloWorld.copyright.default" | ||
23 | hidden="false" | ||
24 | mandatory="true" | ||
25 | persist="true"/> | ||
26 | <property id="message" | ||
27 | label="%HelloWorld.message.label" | ||
28 | description="%HelloWorld.message.description" | ||
29 | type="input" | ||
30 | pattern=".+" | ||
31 | default="%HelloWorld.message.default" | ||
32 | hidden="false" | ||
33 | mandatory="true" | ||
34 | persist="true"/> | ||
35 | <property id="sourceDir" | ||
36 | label="%HelloWorld.sourceDir.label" | ||
37 | description="%HelloWorld.sourceDir.description" | ||
38 | type="input" | ||
39 | default="%HelloWorld.sourceDir.default" | ||
40 | pattern="[a-zA-Z0-9]+" | ||
41 | mandatory="true" | ||
42 | persist="true"/> | ||
43 | <property id="license" label="License" description="License" type="select" default="BSD" mandatory="false" persist="true"> | ||
44 | <item label="BSD License" name="BSD"/> | ||
45 | <item label="MIT License" name="MIT"/> | ||
46 | <item label="GNU General Public License v2.0" name="GPLv2"/> | ||
47 | <item label="GNU General Public License v2.0_or_later" name="GPLv2_or_later"/> | ||
48 | <item label="GNU General Public License v3.0" name="GPLv3"/> | ||
49 | <item label="Other" name="Other"/> | ||
50 | </property> | ||
51 | </property-group> | ||
52 | |||
53 | <process type="org.yocto.sdk.ide.NewYoctoProject"> | ||
54 | <simple name="name" value="$(projectName)" /> | ||
55 | <simple name="artifactExtension" value="exe" /> | ||
56 | <simple name="isCProject" value="true" /> | ||
57 | <simple name="isEmptyProject" value="false" /> | ||
58 | <simple name="isAutotoolsProject" value="true" /> | ||
59 | <simple name="isCMakeProject" value="false" /> | ||
60 | </process> | ||
61 | |||
62 | <process type="org.eclipse.cdt.core.CreateSourceFolder"> | ||
63 | <simple name="projectName" value="$(projectName)"/> | ||
64 | <simple name="path" value="$(sourceDir)"/> | ||
65 | </process> | ||
66 | |||
67 | <process type="org.eclipse.cdt.core.AddFiles"> | ||
68 | <simple name="projectName" value="$(projectName)"/> | ||
69 | <complex-array name="files"> | ||
70 | <element> | ||
71 | <simple name="source" value="../Licenses/AUTHORS"/> | ||
72 | <simple name="target" value="AUTHORS"/> | ||
73 | <simple name="replaceable" value="true"/> | ||
74 | </element> | ||
75 | <element> | ||
76 | <simple name="source" value="../Licenses/COPYING_$(license)"/> | ||
77 | <simple name="target" value="COPYING"/> | ||
78 | <simple name="replaceable" value="true"/> | ||
79 | </element> | ||
80 | <element> | ||
81 | <simple name="source" value="../Licenses/Header_$(license)"/> | ||
82 | <simple name="target" value="$(sourceDir)/$(projectName).c"/> | ||
83 | <simple name="replaceable" value="true"/> | ||
84 | </element> | ||
85 | <element> | ||
86 | <simple name="source" value="src/autogen.sh"/> | ||
87 | <simple name="target" value="autogen.sh"/> | ||
88 | <simple name="replaceable" value="true"/> | ||
89 | </element> | ||
90 | <element> | ||
91 | <simple name="source" value="src/ChangeLog"/> | ||
92 | <simple name="target" value="ChangeLog"/> | ||
93 | <simple name="replaceable" value="true"/> | ||
94 | </element> | ||
95 | <element> | ||
96 | <simple name="source" value="src/configure.ac.top"/> | ||
97 | <simple name="target" value="configure.ac"/> | ||
98 | <simple name="replaceable" value="true"/> | ||
99 | </element> | ||
100 | <element> | ||
101 | <simple name="source" value="src/INSTALL"/> | ||
102 | <simple name="target" value="INSTALL"/> | ||
103 | <simple name="replaceable" value="true"/> | ||
104 | </element> | ||
105 | <element> | ||
106 | <simple name="source" value="src/Makefile.am.src"/> | ||
107 | <simple name="target" value="$(sourceDir)/Makefile.am"/> | ||
108 | <simple name="replaceable" value="true"/> | ||
109 | </element> | ||
110 | <element> | ||
111 | <simple name="source" value="src/Makefile.am.top"/> | ||
112 | <simple name="target" value="Makefile.am"/> | ||
113 | <simple name="replaceable" value="true"/> | ||
114 | </element> | ||
115 | <element> | ||
116 | <simple name="source" value="src/NEWS"/> | ||
117 | <simple name="target" value="NEWS"/> | ||
118 | <simple name="replaceable" value="true"/> | ||
119 | </element> | ||
120 | <element> | ||
121 | <simple name="source" value="src/README"/> | ||
122 | <simple name="target" value="README"/> | ||
123 | <simple name="replaceable" value="true"/> | ||
124 | </element> | ||
125 | </complex-array> | ||
126 | </process> | ||
127 | |||
128 | <process type="org.eclipse.cdt.core.AppendCreate"> | ||
129 | <simple name="projectName" value="$(projectName)"/> | ||
130 | <complex-array name="files"> | ||
131 | <element> | ||
132 | <simple name="source" value="src/Basename.c"/> | ||
133 | <simple name="target" value="$(sourceDir)/$(projectName).c"/> | ||
134 | <simple name="replaceable" value="true"/> | ||
135 | </element> | ||
136 | </complex-array> | ||
137 | </process> | ||
138 | |||
139 | <process type="org.yocto.sdk.ide.NewYoctoAutotoolsProjectPostProcess"> | ||
140 | <simple name="projectName" value="$(projectName)" /> | ||
141 | </process> | ||
142 | </template> | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Basename.cpp b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Basename.cpp new file mode 100644 index 0000000..986dd35 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Basename.cpp | |||
@@ -0,0 +1,11 @@ | |||
1 | |||
2 | |||
3 | #include <iostream> | ||
4 | |||
5 | using namespace std; | ||
6 | |||
7 | int main(void) { | ||
8 | cout << "Hello World" << endl; /* prints Hello World */ | ||
9 | return 0; | ||
10 | } | ||
11 | |||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/ChangeLog b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/ChangeLog new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/ChangeLog | |||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/INSTALL b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/INSTALL new file mode 100644 index 0000000..b8b0535 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/INSTALL | |||
@@ -0,0 +1,9 @@ | |||
1 | Building: | ||
2 | $ ./autogen.sh [--enable-gtk-doc] [--prefix=/usr] | ||
3 | $ make | ||
4 | |||
5 | Installing: | ||
6 | $ sudo make install | ||
7 | |||
8 | Running: | ||
9 | $ $(projectName) \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.src b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.src new file mode 100644 index 0000000..1ea3308 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.src | |||
@@ -0,0 +1,8 @@ | |||
1 | |||
2 | bin_PROGRAMS = $(projectName) | ||
3 | $(projectName)_SOURCES = $(projectName).cpp | ||
4 | |||
5 | AM_CXXFLAGS = @$(projectName)_CFLAGS@ | ||
6 | AM_LDFLAGS = @$(projectName)_LIBS@ | ||
7 | |||
8 | CLEANFILES = *~ | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.top b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.top new file mode 100644 index 0000000..6060599 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/Makefile.am.top | |||
@@ -0,0 +1,6 @@ | |||
1 | EXTRA_DIST = autogen.sh | ||
2 | SUBDIRS = $(sourceDir) | ||
3 | |||
4 | DISTCHECK_CONFIGURE_FLAGS= | ||
5 | |||
6 | CLEANFILES = *~ \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/NEWS b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/NEWS new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/NEWS | |||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/README b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/README new file mode 100644 index 0000000..ec15541 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/README | |||
@@ -0,0 +1,25 @@ | |||
1 | $(projectName) | ||
2 | Copyright (C) $(copyright). | ||
3 | |||
4 | Brief description of project.... | ||
5 | |||
6 | ----------------------------------------------------------------------------- | ||
7 | Build | ||
8 | ----------------------------------------------------------------------------- | ||
9 | $ ./autogen.sh $CONFIGURE_FLAGS | ||
10 | $ make | ||
11 | |||
12 | ----------------------------------------------------------------------------- | ||
13 | Build with documentation generated (usually for libraries) | ||
14 | ----------------------------------------------------------------------------- | ||
15 | $ ./autogen.sh --enable-gtk-doc | ||
16 | $ make | ||
17 | |||
18 | ( If built with the --enable-gtk-doc flag above you can view the index.html | ||
19 | file in your web browser. ) | ||
20 | $ firefox ./docs/reference/index.html | ||
21 | |||
22 | ----------------------------------------------------------------------------- | ||
23 | Install | ||
24 | ----------------------------------------------------------------------------- | ||
25 | $ sudo make install | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/autogen.sh b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/autogen.sh new file mode 100755 index 0000000..7fd81e2 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/autogen.sh | |||
@@ -0,0 +1,10 @@ | |||
1 | #! /bin/sh | ||
2 | [ -e config.cache ] && rm -f config.cache | ||
3 | |||
4 | libtoolize --automake | ||
5 | aclocal ${OECORE_ACLOCAL_OPTS} | ||
6 | autoconf | ||
7 | autoheader | ||
8 | automake -a | ||
9 | ./configure $@ | ||
10 | exit | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/configure.ac.top b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/configure.ac.top new file mode 100644 index 0000000..5cc622b --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/src/configure.ac.top | |||
@@ -0,0 +1,47 @@ | |||
1 | AC_PREREQ(2.61) | ||
2 | |||
3 | # package version number (not shared library version) | ||
4 | # odd micro numbers indicate in-progress development | ||
5 | # even micro numbers indicate released versions | ||
6 | m4_define($(projectName)_version_major, 0) | ||
7 | m4_define($(projectName)_version_minor, 1) | ||
8 | m4_define($(projectName)_version_micro, 0) | ||
9 | |||
10 | m4_define([$(projectName)_version], | ||
11 | [$(projectName)_version_major.$(projectName)_version_minor.$(projectName)_version_micro]) | ||
12 | m4_define([$(projectName)_api_version], | ||
13 | [$(projectName)_version_major.$(projectName)_version_minor]) | ||
14 | |||
15 | AC_INIT($(projectName), $(projectName)_version) | ||
16 | AM_INIT_AUTOMAKE($(projectName), $(projectName)_version) | ||
17 | AC_CONFIG_HEADERS(config.h) | ||
18 | |||
19 | # Checks for programs. | ||
20 | AC_PROG_LIBTOOL | ||
21 | AC_PROG_CXX | ||
22 | AC_PROG_INSTALL | ||
23 | |||
24 | # enable pkg-config | ||
25 | PKG_PROG_PKG_CONFIG | ||
26 | |||
27 | # Checks for library functions. | ||
28 | #AC_CHECK_FUNCS([memset]) | ||
29 | |||
30 | AC_SUBST($(projectName)_CFLAGS) | ||
31 | AC_SUBST($(projectName)_LIBS) | ||
32 | |||
33 | |||
34 | #icondir=${datadir}/icons/hicolor/32x32/apps | ||
35 | #AC_SUBST(icondir) | ||
36 | |||
37 | AC_OUTPUT([ | ||
38 | Makefile | ||
39 | $(sourceDir)/Makefile | ||
40 | ]) | ||
41 | |||
42 | echo "" | ||
43 | echo " $(projectName) $VERSION" | ||
44 | echo " =====================" | ||
45 | echo "" | ||
46 | echo " To build the project, run \"make\"" | ||
47 | echo "" | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.properties b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.properties new file mode 100644 index 0000000..0534ca6 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.properties | |||
@@ -0,0 +1,28 @@ | |||
1 | ############################################################################### | ||
2 | # Copyright (c) 2007, 2009 Symbian Software Private Ltd. and others. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # Bala Torati (Symbian) - initial API and implementation | ||
10 | # Red Hat Inc - modification to use with Autotools project | ||
11 | ############################################################################### | ||
12 | |||
13 | #Template Default Values | ||
14 | HelloWorld.CCtemplate.label= Hello World C++ Autotools Project | ||
15 | HelloWorld.CCtemplate.description=A skeletal C++ Hello World project. Creates a folder for sources and autogen artifacts. | ||
16 | HelloWorld.basics.label=Basic Settings | ||
17 | HelloWorld.basics.description=Basic properties of a project | ||
18 | HelloWorld.author.label=Author | ||
19 | HelloWorld.author.description=Name of the author | ||
20 | HelloWorld.copyright.label=Copyright notice | ||
21 | HelloWorld.copyright.description=The name of the copyright holder (e.g. XYZ Corporation) | ||
22 | HelloWorld.copyright.default=Your copyright notice | ||
23 | HelloWorld.message.default=Hello World | ||
24 | HelloWorld.message.description=Your hello world greeting message | ||
25 | HelloWorld.message.label=Hello world greeting | ||
26 | HelloWorld.sourceDir.label=Source | ||
27 | HelloWorld.sourceDir.description=Directory for hello world project source files | ||
28 | HelloWorld.sourceDir.default=src | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml new file mode 100644 index 0000000..2bf76bf --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/HelloWorldCPPAutotoolsProject/template.xml | |||
@@ -0,0 +1,142 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
2 | <template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Bala Torati (Symbian)" | ||
3 | copyright="Copyright (c) 2007,2009 Symbian Software Limited 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 athttp://www.eclipse.org/legal/epl-v10.html" | ||
4 | id="YoctoHelloWorldCPPAutotoolsProject" label="%HelloWorld.CCtemplate.label" description="%HelloWorld.CCtemplate.description" | ||
5 | help="help.html"> | ||
6 | |||
7 | <property-group id="basics" label="%HelloWorld.basics.label" description="%HelloWorld.basics.description" type="PAGES-ONLY" help="help.html"> | ||
8 | <property id="author" | ||
9 | label="%HelloWorld.author.label" | ||
10 | description="%HelloWorld.author.description" | ||
11 | type="input" | ||
12 | pattern=".+" | ||
13 | default="" | ||
14 | hidden="false" | ||
15 | mandatory="true" | ||
16 | persist="true"/> | ||
17 | <property id="copyright" | ||
18 | label="%HelloWorld.copyright.label" | ||
19 | description="%HelloWorld.copyright.description" | ||
20 | type="input" | ||
21 | pattern=".+" | ||
22 | default="%HelloWorld.copyright.default" | ||
23 | hidden="false" | ||
24 | mandatory="true" | ||
25 | persist="true"/> | ||
26 | <property id="message" | ||
27 | label="%HelloWorld.message.label" | ||
28 | description="%HelloWorld.message.description" | ||
29 | type="input" | ||
30 | pattern=".+" | ||
31 | default="%HelloWorld.message.default" | ||
32 | hidden="false" | ||
33 | mandatory="true" | ||
34 | persist="true"/> | ||
35 | <property id="sourceDir" | ||
36 | label="%HelloWorld.sourceDir.label" | ||
37 | description="%HelloWorld.sourceDir.description" | ||
38 | type="input" | ||
39 | default="%HelloWorld.sourceDir.default" | ||
40 | pattern="[a-zA-Z0-9]+" | ||
41 | mandatory="true" | ||
42 | persist="true"/> | ||
43 | <property id="license" label="License" description="License" type="select" default="BSD" mandatory="false" persist="true"> | ||
44 | <item label="BSD License" name="BSD"/> | ||
45 | <item label="MIT License" name="MIT"/> | ||
46 | <item label="GNU General Public License v2.0" name="GPLv2"/> | ||
47 | <item label="GNU General Public License v2.0_or_later" name="GPLv2_or_later"/> | ||
48 | <item label="GNU General Public License v3.0" name="GPLv3"/> | ||
49 | <item label="Other" name="Other"/> | ||
50 | </property> | ||
51 | </property-group> | ||
52 | |||
53 | <process type="org.yocto.sdk.ide.NewYoctoProject"> | ||
54 | <simple name="name" value="$(projectName)" /> | ||
55 | <simple name="artifactExtension" value="exe" /> | ||
56 | <simple name="isCProject" value="false" /> | ||
57 | <simple name="isEmptyProject" value="false" /> | ||
58 | <simple name="isAutotoolsProject" value="true" /> | ||
59 | <simple name="isCMakeProject" value="false" /> | ||
60 | </process> | ||
61 | |||
62 | <process type="org.eclipse.cdt.core.CreateSourceFolder"> | ||
63 | <simple name="projectName" value="$(projectName)"/> | ||
64 | <simple name="path" value="$(sourceDir)"/> | ||
65 | </process> | ||
66 | |||
67 | <process type="org.eclipse.cdt.core.AddFiles"> | ||
68 | <simple name="projectName" value="$(projectName)"/> | ||
69 | <complex-array name="files"> | ||
70 | <element> | ||
71 | <simple name="source" value="../Licenses/AUTHORS"/> | ||
72 | <simple name="target" value="AUTHORS"/> | ||
73 | <simple name="replaceable" value="true"/> | ||
74 | </element> | ||
75 | <element> | ||
76 | <simple name="source" value="../Licenses/COPYING_$(license)"/> | ||
77 | <simple name="target" value="COPYING"/> | ||
78 | <simple name="replaceable" value="true"/> | ||
79 | </element> | ||
80 | <element> | ||
81 | <simple name="source" value="../Licenses/Header_$(license)"/> | ||
82 | <simple name="target" value="$(sourceDir)/$(projectName).cpp"/> | ||
83 | <simple name="replaceable" value="true"/> | ||
84 | </element> | ||
85 | <element> | ||
86 | <simple name="source" value="src/autogen.sh"/> | ||
87 | <simple name="target" value="autogen.sh"/> | ||
88 | <simple name="replaceable" value="true"/> | ||
89 | </element> | ||
90 | <element> | ||
91 | <simple name="source" value="src/ChangeLog"/> | ||
92 | <simple name="target" value="ChangeLog"/> | ||
93 | <simple name="replaceable" value="true"/> | ||
94 | </element> | ||
95 | <element> | ||
96 | <simple name="source" value="src/configure.ac.top"/> | ||
97 | <simple name="target" value="configure.ac"/> | ||
98 | <simple name="replaceable" value="true"/> | ||
99 | </element> | ||
100 | <element> | ||
101 | <simple name="source" value="src/INSTALL"/> | ||
102 | <simple name="target" value="INSTALL"/> | ||
103 | <simple name="replaceable" value="true"/> | ||
104 | </element> | ||
105 | <element> | ||
106 | <simple name="source" value="src/Makefile.am.src"/> | ||
107 | <simple name="target" value="$(sourceDir)/Makefile.am"/> | ||
108 | <simple name="replaceable" value="true"/> | ||
109 | </element> | ||
110 | <element> | ||
111 | <simple name="source" value="src/Makefile.am.top"/> | ||
112 | <simple name="target" value="Makefile.am"/> | ||
113 | <simple name="replaceable" value="true"/> | ||
114 | </element> | ||
115 | <element> | ||
116 | <simple name="source" value="src/NEWS"/> | ||
117 | <simple name="target" value="NEWS"/> | ||
118 | <simple name="replaceable" value="true"/> | ||
119 | </element> | ||
120 | <element> | ||
121 | <simple name="source" value="src/README"/> | ||
122 | <simple name="target" value="README"/> | ||
123 | <simple name="replaceable" value="true"/> | ||
124 | </element> | ||
125 | </complex-array> | ||
126 | </process> | ||
127 | |||
128 | <process type="org.eclipse.cdt.core.AppendCreate"> | ||
129 | <simple name="projectName" value="$(projectName)"/> | ||
130 | <complex-array name="files"> | ||
131 | <element> | ||
132 | <simple name="source" value="src/Basename.cpp"/> | ||
133 | <simple name="target" value="$(sourceDir)/$(projectName).cpp"/> | ||
134 | <simple name="replaceable" value="true"/> | ||
135 | </element> | ||
136 | </complex-array> | ||
137 | </process> | ||
138 | |||
139 | <process type="org.yocto.sdk.ide.NewYoctoAutotoolsProjectPostProcess"> | ||
140 | <simple name="projectName" value="$(projectName)" /> | ||
141 | </process> | ||
142 | </template> | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/AUTHORS b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/AUTHORS new file mode 100644 index 0000000..9d38b85 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/AUTHORS | |||
@@ -0,0 +1 @@ | |||
$(author) | |||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_BSD b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_BSD new file mode 100644 index 0000000..064c1cc --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_BSD | |||
@@ -0,0 +1,24 @@ | |||
1 | All rights reserved. | ||
2 | |||
3 | Redistribution and use in source and binary forms, with or without | ||
4 | modification, are permitted provided that the following conditions are met: | ||
5 | |||
6 | * Redistributions of source code must retain the above copyright | ||
7 | notice, this list of conditions and the following disclaimer. | ||
8 | * Redistributions in binary form must reproduce the above copyright | ||
9 | notice, this list of conditions and the following disclaimer in the | ||
10 | documentation and/or other materials provided with the distribution. | ||
11 | * Neither the name of PG_ORGANIZATION nor the | ||
12 | names of its contributors may be used to endorse or promote products | ||
13 | derived from this software without specific prior written permission. | ||
14 | |||
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2 new file mode 100644 index 0000000..c6eecf2 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2 | |||
@@ -0,0 +1,339 @@ | |||
1 | GNU GENERAL PUBLIC LICENSE | ||
2 | Version 2, June 1991 | ||
3 | |||
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. | ||
5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
6 | Everyone is permitted to copy and distribute verbatim copies | ||
7 | of this license document, but changing it is not allowed. | ||
8 | |||
9 | Preamble | ||
10 | |||
11 | The licenses for most software are designed to take away your | ||
12 | freedom to share and change it. By contrast, the GNU General Public | ||
13 | License is intended to guarantee your freedom to share and change free | ||
14 | software--to make sure the software is free for all its users. This | ||
15 | General Public License applies to most of the Free Software | ||
16 | Foundation's software and to any other program whose authors commit to | ||
17 | using it. (Some other Free Software Foundation software is covered by | ||
18 | the GNU Library General Public License instead.) You can apply it to | ||
19 | your programs, too. | ||
20 | |||
21 | When we speak of free software, we are referring to freedom, not | ||
22 | price. Our General Public Licenses are designed to make sure that you | ||
23 | have the freedom to distribute copies of free software (and charge for | ||
24 | this service if you wish), that you receive source code or can get it | ||
25 | if you want it, that you can change the software or use pieces of it | ||
26 | in new free programs; and that you know you can do these things. | ||
27 | |||
28 | To protect your rights, we need to make restrictions that forbid | ||
29 | anyone to deny you these rights or to ask you to surrender the rights. | ||
30 | These restrictions translate to certain responsibilities for you if you | ||
31 | distribute copies of the software, or if you modify it. | ||
32 | |||
33 | For example, if you distribute copies of such a program, whether | ||
34 | gratis or for a fee, you must give the recipients all the rights that | ||
35 | you have. You must make sure that they, too, receive or can get the | ||
36 | source code. And you must show them these terms so they know their | ||
37 | rights. | ||
38 | |||
39 | We protect your rights with two steps: (1) copyright the software, and | ||
40 | (2) offer you this license which gives you legal permission to copy, | ||
41 | distribute and/or modify the software. | ||
42 | |||
43 | Also, for each author's protection and ours, we want to make certain | ||
44 | that everyone understands that there is no warranty for this free | ||
45 | software. If the software is modified by someone else and passed on, we | ||
46 | want its recipients to know that what they have is not the original, so | ||
47 | that any problems introduced by others will not reflect on the original | ||
48 | authors' reputations. | ||
49 | |||
50 | Finally, any free program is threatened constantly by software | ||
51 | patents. We wish to avoid the danger that redistributors of a free | ||
52 | program will individually obtain patent licenses, in effect making the | ||
53 | program proprietary. To prevent this, we have made it clear that any | ||
54 | patent must be licensed for everyone's free use or not licensed at all. | ||
55 | |||
56 | The precise terms and conditions for copying, distribution and | ||
57 | modification follow. | ||
58 | |||
59 | GNU GENERAL PUBLIC LICENSE | ||
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
61 | |||
62 | 0. This License applies to any program or other work which contains | ||
63 | a notice placed by the copyright holder saying it may be distributed | ||
64 | under the terms of this General Public License. The "Program", below, | ||
65 | refers to any such program or work, and a "work based on the Program" | ||
66 | means either the Program or any derivative work under copyright law: | ||
67 | that is to say, a work containing the Program or a portion of it, | ||
68 | either verbatim or with modifications and/or translated into another | ||
69 | language. (Hereinafter, translation is included without limitation in | ||
70 | the term "modification".) Each licensee is addressed as "you". | ||
71 | |||
72 | Activities other than copying, distribution and modification are not | ||
73 | covered by this License; they are outside its scope. The act of | ||
74 | running the Program is not restricted, and the output from the Program | ||
75 | is covered only if its contents constitute a work based on the | ||
76 | Program (independent of having been made by running the Program). | ||
77 | Whether that is true depends on what the Program does. | ||
78 | |||
79 | 1. You may copy and distribute verbatim copies of the Program's | ||
80 | source code as you receive it, in any medium, provided that you | ||
81 | conspicuously and appropriately publish on each copy an appropriate | ||
82 | copyright notice and disclaimer of warranty; keep intact all the | ||
83 | notices that refer to this License and to the absence of any warranty; | ||
84 | and give any other recipients of the Program a copy of this License | ||
85 | along with the Program. | ||
86 | |||
87 | You may charge a fee for the physical act of transferring a copy, and | ||
88 | you may at your option offer warranty protection in exchange for a fee. | ||
89 | |||
90 | 2. You may modify your copy or copies of the Program or any portion | ||
91 | of it, thus forming a work based on the Program, and copy and | ||
92 | distribute such modifications or work under the terms of Section 1 | ||
93 | above, provided that you also meet all of these conditions: | ||
94 | |||
95 | a) You must cause the modified files to carry prominent notices | ||
96 | stating that you changed the files and the date of any change. | ||
97 | |||
98 | b) You must cause any work that you distribute or publish, that in | ||
99 | whole or in part contains or is derived from the Program or any | ||
100 | part thereof, to be licensed as a whole at no charge to all third | ||
101 | parties under the terms of this License. | ||
102 | |||
103 | c) If the modified program normally reads commands interactively | ||
104 | when run, you must cause it, when started running for such | ||
105 | interactive use in the most ordinary way, to print or display an | ||
106 | announcement including an appropriate copyright notice and a | ||
107 | notice that there is no warranty (or else, saying that you provide | ||
108 | a warranty) and that users may redistribute the program under | ||
109 | these conditions, and telling the user how to view a copy of this | ||
110 | License. (Exception: if the Program itself is interactive but | ||
111 | does not normally print such an announcement, your work based on | ||
112 | the Program is not required to print an announcement.) | ||
113 | |||
114 | These requirements apply to the modified work as a whole. If | ||
115 | identifiable sections of that work are not derived from the Program, | ||
116 | and can be reasonably considered independent and separate works in | ||
117 | themselves, then this License, and its terms, do not apply to those | ||
118 | sections when you distribute them as separate works. But when you | ||
119 | distribute the same sections as part of a whole which is a work based | ||
120 | on the Program, the distribution of the whole must be on the terms of | ||
121 | this License, whose permissions for other licensees extend to the | ||
122 | entire whole, and thus to each and every part regardless of who wrote it. | ||
123 | |||
124 | Thus, it is not the intent of this section to claim rights or contest | ||
125 | your rights to work written entirely by you; rather, the intent is to | ||
126 | exercise the right to control the distribution of derivative or | ||
127 | collective works based on the Program. | ||
128 | |||
129 | In addition, mere aggregation of another work not based on the Program | ||
130 | with the Program (or with a work based on the Program) on a volume of | ||
131 | a storage or distribution medium does not bring the other work under | ||
132 | the scope of this License. | ||
133 | |||
134 | 3. You may copy and distribute the Program (or a work based on it, | ||
135 | under Section 2) in object code or executable form under the terms of | ||
136 | Sections 1 and 2 above provided that you also do one of the following: | ||
137 | |||
138 | a) Accompany it with the complete corresponding machine-readable | ||
139 | source code, which must be distributed under the terms of Sections | ||
140 | 1 and 2 above on a medium customarily used for software interchange; or, | ||
141 | |||
142 | b) Accompany it with a written offer, valid for at least three | ||
143 | years, to give any third party, for a charge no more than your | ||
144 | cost of physically performing source distribution, a complete | ||
145 | machine-readable copy of the corresponding source code, to be | ||
146 | distributed under the terms of Sections 1 and 2 above on a medium | ||
147 | customarily used for software interchange; or, | ||
148 | |||
149 | c) Accompany it with the information you received as to the offer | ||
150 | to distribute corresponding source code. (This alternative is | ||
151 | allowed only for noncommercial distribution and only if you | ||
152 | received the program in object code or executable form with such | ||
153 | an offer, in accord with Subsection b above.) | ||
154 | |||
155 | The source code for a work means the preferred form of the work for | ||
156 | making modifications to it. For an executable work, complete source | ||
157 | code means all the source code for all modules it contains, plus any | ||
158 | associated interface definition files, plus the scripts used to | ||
159 | control compilation and installation of the executable. However, as a | ||
160 | special exception, the source code distributed need not include | ||
161 | anything that is normally distributed (in either source or binary | ||
162 | form) with the major components (compiler, kernel, and so on) of the | ||
163 | operating system on which the executable runs, unless that component | ||
164 | itself accompanies the executable. | ||
165 | |||
166 | If distribution of executable or object code is made by offering | ||
167 | access to copy from a designated place, then offering equivalent | ||
168 | access to copy the source code from the same place counts as | ||
169 | distribution of the source code, even though third parties are not | ||
170 | compelled to copy the source along with the object code. | ||
171 | |||
172 | 4. You may not copy, modify, sublicense, or distribute the Program | ||
173 | except as expressly provided under this License. Any attempt | ||
174 | otherwise to copy, modify, sublicense or distribute the Program is | ||
175 | void, and will automatically terminate your rights under this License. | ||
176 | However, parties who have received copies, or rights, from you under | ||
177 | this License will not have their licenses terminated so long as such | ||
178 | parties remain in full compliance. | ||
179 | |||
180 | 5. You are not required to accept this License, since you have not | ||
181 | signed it. However, nothing else grants you permission to modify or | ||
182 | distribute the Program or its derivative works. These actions are | ||
183 | prohibited by law if you do not accept this License. Therefore, by | ||
184 | modifying or distributing the Program (or any work based on the | ||
185 | Program), you indicate your acceptance of this License to do so, and | ||
186 | all its terms and conditions for copying, distributing or modifying | ||
187 | the Program or works based on it. | ||
188 | |||
189 | 6. Each time you redistribute the Program (or any work based on the | ||
190 | Program), the recipient automatically receives a license from the | ||
191 | original licensor to copy, distribute or modify the Program subject to | ||
192 | these terms and conditions. You may not impose any further | ||
193 | restrictions on the recipients' exercise of the rights granted herein. | ||
194 | You are not responsible for enforcing compliance by third parties to | ||
195 | this License. | ||
196 | |||
197 | 7. If, as a consequence of a court judgment or allegation of patent | ||
198 | infringement or for any other reason (not limited to patent issues), | ||
199 | conditions are imposed on you (whether by court order, agreement or | ||
200 | otherwise) that contradict the conditions of this License, they do not | ||
201 | excuse you from the conditions of this License. If you cannot | ||
202 | distribute so as to satisfy simultaneously your obligations under this | ||
203 | License and any other pertinent obligations, then as a consequence you | ||
204 | may not distribute the Program at all. For example, if a patent | ||
205 | license would not permit royalty-free redistribution of the Program by | ||
206 | all those who receive copies directly or indirectly through you, then | ||
207 | the only way you could satisfy both it and this License would be to | ||
208 | refrain entirely from distribution of the Program. | ||
209 | |||
210 | If any portion of this section is held invalid or unenforceable under | ||
211 | any particular circumstance, the balance of the section is intended to | ||
212 | apply and the section as a whole is intended to apply in other | ||
213 | circumstances. | ||
214 | |||
215 | It is not the purpose of this section to induce you to infringe any | ||
216 | patents or other property right claims or to contest validity of any | ||
217 | such claims; this section has the sole purpose of protecting the | ||
218 | integrity of the free software distribution system, which is | ||
219 | implemented by public license practices. Many people have made | ||
220 | generous contributions to the wide range of software distributed | ||
221 | through that system in reliance on consistent application of that | ||
222 | system; it is up to the author/donor to decide if he or she is willing | ||
223 | to distribute software through any other system and a licensee cannot | ||
224 | impose that choice. | ||
225 | |||
226 | This section is intended to make thoroughly clear what is believed to | ||
227 | be a consequence of the rest of this License. | ||
228 | |||
229 | 8. If the distribution and/or use of the Program is restricted in | ||
230 | certain countries either by patents or by copyrighted interfaces, the | ||
231 | original copyright holder who places the Program under this License | ||
232 | may add an explicit geographical distribution limitation excluding | ||
233 | those countries, so that distribution is permitted only in or among | ||
234 | countries not thus excluded. In such case, this License incorporates | ||
235 | the limitation as if written in the body of this License. | ||
236 | |||
237 | 9. The Free Software Foundation may publish revised and/or new versions | ||
238 | of the General Public License from time to time. Such new versions will | ||
239 | be similar in spirit to the present version, but may differ in detail to | ||
240 | address new problems or concerns. | ||
241 | |||
242 | Each version is given a distinguishing version number. If the Program | ||
243 | specifies a version number of this License which applies to it and "any | ||
244 | later version", you have the option of following the terms and conditions | ||
245 | either of that version or of any later version published by the Free | ||
246 | Software Foundation. If the Program does not specify a version number of | ||
247 | this License, you may choose any version ever published by the Free Software | ||
248 | Foundation. | ||
249 | |||
250 | 10. If you wish to incorporate parts of the Program into other free | ||
251 | programs whose distribution conditions are different, write to the author | ||
252 | to ask for permission. For software which is copyrighted by the Free | ||
253 | Software Foundation, write to the Free Software Foundation; we sometimes | ||
254 | make exceptions for this. Our decision will be guided by the two goals | ||
255 | of preserving the free status of all derivatives of our free software and | ||
256 | of promoting the sharing and reuse of software generally. | ||
257 | |||
258 | NO WARRANTY | ||
259 | |||
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY | ||
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN | ||
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES | ||
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED | ||
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS | ||
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE | ||
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, | ||
268 | REPAIR OR CORRECTION. | ||
269 | |||
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | ||
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR | ||
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, | ||
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING | ||
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED | ||
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY | ||
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER | ||
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE | ||
278 | POSSIBILITY OF SUCH DAMAGES. | ||
279 | |||
280 | END OF TERMS AND CONDITIONS | ||
281 | |||
282 | How to Apply These Terms to Your New Programs | ||
283 | |||
284 | If you develop a new program, and you want it to be of the greatest | ||
285 | possible use to the public, the best way to achieve this is to make it | ||
286 | free software which everyone can redistribute and change under these terms. | ||
287 | |||
288 | To do so, attach the following notices to the program. It is safest | ||
289 | to attach them to the start of each source file to most effectively | ||
290 | convey the exclusion of warranty; and each file should have at least | ||
291 | the "copyright" line and a pointer to where the full notice is found. | ||
292 | |||
293 | <one line to give the program's name and a brief idea of what it does.> | ||
294 | Copyright (C) <year> <name of author> | ||
295 | |||
296 | This program is free software; you can redistribute it and/or modify | ||
297 | it under the terms of the GNU General Public License as published by | ||
298 | the Free Software Foundation; version 2 of the License. | ||
299 | |||
300 | This program is distributed in the hope that it will be useful, | ||
301 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
302 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
303 | GNU General Public License for more details. | ||
304 | |||
305 | You should have received a copy of the GNU General Public License | ||
306 | along with this program; if not, write to the Free Software | ||
307 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
308 | |||
309 | |||
310 | Also add information on how to contact you by electronic and paper mail. | ||
311 | |||
312 | If the program is interactive, make it output a short notice like this | ||
313 | when it starts in an interactive mode: | ||
314 | |||
315 | Gnomovision version 69, Copyright (C) year name of author | ||
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | ||
317 | This is free software, and you are welcome to redistribute it | ||
318 | under certain conditions; type `show c' for details. | ||
319 | |||
320 | The hypothetical commands `show w' and `show c' should show the appropriate | ||
321 | parts of the General Public License. Of course, the commands you use may | ||
322 | be called something other than `show w' and `show c'; they could even be | ||
323 | mouse-clicks or menu items--whatever suits your program. | ||
324 | |||
325 | You should also get your employer (if you work as a programmer) or your | ||
326 | school, if any, to sign a "copyright disclaimer" for the program, if | ||
327 | necessary. Here is a sample; alter the names: | ||
328 | |||
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program | ||
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. | ||
331 | |||
332 | <signature of Ty Coon>, 1 April 1989 | ||
333 | Ty Coon, President of Vice | ||
334 | |||
335 | This General Public License does not permit incorporating your program into | ||
336 | proprietary programs. If your program is a subroutine library, you may | ||
337 | consider it more useful to permit linking proprietary applications with the | ||
338 | library. If this is what you want to do, use the GNU Library General | ||
339 | Public License instead of this License. \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2_or_later b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2_or_later new file mode 100644 index 0000000..0f70665 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv2_or_later | |||
@@ -0,0 +1,340 @@ | |||
1 | GNU GENERAL PUBLIC LICENSE | ||
2 | Version 2, June 1991 | ||
3 | |||
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. | ||
5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
6 | Everyone is permitted to copy and distribute verbatim copies | ||
7 | of this license document, but changing it is not allowed. | ||
8 | |||
9 | Preamble | ||
10 | |||
11 | The licenses for most software are designed to take away your | ||
12 | freedom to share and change it. By contrast, the GNU General Public | ||
13 | License is intended to guarantee your freedom to share and change free | ||
14 | software--to make sure the software is free for all its users. This | ||
15 | General Public License applies to most of the Free Software | ||
16 | Foundation's software and to any other program whose authors commit to | ||
17 | using it. (Some other Free Software Foundation software is covered by | ||
18 | the GNU Library General Public License instead.) You can apply it to | ||
19 | your programs, too. | ||
20 | |||
21 | When we speak of free software, we are referring to freedom, not | ||
22 | price. Our General Public Licenses are designed to make sure that you | ||
23 | have the freedom to distribute copies of free software (and charge for | ||
24 | this service if you wish), that you receive source code or can get it | ||
25 | if you want it, that you can change the software or use pieces of it | ||
26 | in new free programs; and that you know you can do these things. | ||
27 | |||
28 | To protect your rights, we need to make restrictions that forbid | ||
29 | anyone to deny you these rights or to ask you to surrender the rights. | ||
30 | These restrictions translate to certain responsibilities for you if you | ||
31 | distribute copies of the software, or if you modify it. | ||
32 | |||
33 | For example, if you distribute copies of such a program, whether | ||
34 | gratis or for a fee, you must give the recipients all the rights that | ||
35 | you have. You must make sure that they, too, receive or can get the | ||
36 | source code. And you must show them these terms so they know their | ||
37 | rights. | ||
38 | |||
39 | We protect your rights with two steps: (1) copyright the software, and | ||
40 | (2) offer you this license which gives you legal permission to copy, | ||
41 | distribute and/or modify the software. | ||
42 | |||
43 | Also, for each author's protection and ours, we want to make certain | ||
44 | that everyone understands that there is no warranty for this free | ||
45 | software. If the software is modified by someone else and passed on, we | ||
46 | want its recipients to know that what they have is not the original, so | ||
47 | that any problems introduced by others will not reflect on the original | ||
48 | authors' reputations. | ||
49 | |||
50 | Finally, any free program is threatened constantly by software | ||
51 | patents. We wish to avoid the danger that redistributors of a free | ||
52 | program will individually obtain patent licenses, in effect making the | ||
53 | program proprietary. To prevent this, we have made it clear that any | ||
54 | patent must be licensed for everyone's free use or not licensed at all. | ||
55 | |||
56 | The precise terms and conditions for copying, distribution and | ||
57 | modification follow. | ||
58 | |||
59 | GNU GENERAL PUBLIC LICENSE | ||
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
61 | |||
62 | 0. This License applies to any program or other work which contains | ||
63 | a notice placed by the copyright holder saying it may be distributed | ||
64 | under the terms of this General Public License. The "Program", below, | ||
65 | refers to any such program or work, and a "work based on the Program" | ||
66 | means either the Program or any derivative work under copyright law: | ||
67 | that is to say, a work containing the Program or a portion of it, | ||
68 | either verbatim or with modifications and/or translated into another | ||
69 | language. (Hereinafter, translation is included without limitation in | ||
70 | the term "modification".) Each licensee is addressed as "you". | ||
71 | |||
72 | Activities other than copying, distribution and modification are not | ||
73 | covered by this License; they are outside its scope. The act of | ||
74 | running the Program is not restricted, and the output from the Program | ||
75 | is covered only if its contents constitute a work based on the | ||
76 | Program (independent of having been made by running the Program). | ||
77 | Whether that is true depends on what the Program does. | ||
78 | |||
79 | 1. You may copy and distribute verbatim copies of the Program's | ||
80 | source code as you receive it, in any medium, provided that you | ||
81 | conspicuously and appropriately publish on each copy an appropriate | ||
82 | copyright notice and disclaimer of warranty; keep intact all the | ||
83 | notices that refer to this License and to the absence of any warranty; | ||
84 | and give any other recipients of the Program a copy of this License | ||
85 | along with the Program. | ||
86 | |||
87 | You may charge a fee for the physical act of transferring a copy, and | ||
88 | you may at your option offer warranty protection in exchange for a fee. | ||
89 | |||
90 | 2. You may modify your copy or copies of the Program or any portion | ||
91 | of it, thus forming a work based on the Program, and copy and | ||
92 | distribute such modifications or work under the terms of Section 1 | ||
93 | above, provided that you also meet all of these conditions: | ||
94 | |||
95 | a) You must cause the modified files to carry prominent notices | ||
96 | stating that you changed the files and the date of any change. | ||
97 | |||
98 | b) You must cause any work that you distribute or publish, that in | ||
99 | whole or in part contains or is derived from the Program or any | ||
100 | part thereof, to be licensed as a whole at no charge to all third | ||
101 | parties under the terms of this License. | ||
102 | |||
103 | c) If the modified program normally reads commands interactively | ||
104 | when run, you must cause it, when started running for such | ||
105 | interactive use in the most ordinary way, to print or display an | ||
106 | announcement including an appropriate copyright notice and a | ||
107 | notice that there is no warranty (or else, saying that you provide | ||
108 | a warranty) and that users may redistribute the program under | ||
109 | these conditions, and telling the user how to view a copy of this | ||
110 | License. (Exception: if the Program itself is interactive but | ||
111 | does not normally print such an announcement, your work based on | ||
112 | the Program is not required to print an announcement.) | ||
113 | |||
114 | These requirements apply to the modified work as a whole. If | ||
115 | identifiable sections of that work are not derived from the Program, | ||
116 | and can be reasonably considered independent and separate works in | ||
117 | themselves, then this License, and its terms, do not apply to those | ||
118 | sections when you distribute them as separate works. But when you | ||
119 | distribute the same sections as part of a whole which is a work based | ||
120 | on the Program, the distribution of the whole must be on the terms of | ||
121 | this License, whose permissions for other licensees extend to the | ||
122 | entire whole, and thus to each and every part regardless of who wrote it. | ||
123 | |||
124 | Thus, it is not the intent of this section to claim rights or contest | ||
125 | your rights to work written entirely by you; rather, the intent is to | ||
126 | exercise the right to control the distribution of derivative or | ||
127 | collective works based on the Program. | ||
128 | |||
129 | In addition, mere aggregation of another work not based on the Program | ||
130 | with the Program (or with a work based on the Program) on a volume of | ||
131 | a storage or distribution medium does not bring the other work under | ||
132 | the scope of this License. | ||
133 | |||
134 | 3. You may copy and distribute the Program (or a work based on it, | ||
135 | under Section 2) in object code or executable form under the terms of | ||
136 | Sections 1 and 2 above provided that you also do one of the following: | ||
137 | |||
138 | a) Accompany it with the complete corresponding machine-readable | ||
139 | source code, which must be distributed under the terms of Sections | ||
140 | 1 and 2 above on a medium customarily used for software interchange; or, | ||
141 | |||
142 | b) Accompany it with a written offer, valid for at least three | ||
143 | years, to give any third party, for a charge no more than your | ||
144 | cost of physically performing source distribution, a complete | ||
145 | machine-readable copy of the corresponding source code, to be | ||
146 | distributed under the terms of Sections 1 and 2 above on a medium | ||
147 | customarily used for software interchange; or, | ||
148 | |||
149 | c) Accompany it with the information you received as to the offer | ||
150 | to distribute corresponding source code. (This alternative is | ||
151 | allowed only for noncommercial distribution and only if you | ||
152 | received the program in object code or executable form with such | ||
153 | an offer, in accord with Subsection b above.) | ||
154 | |||
155 | The source code for a work means the preferred form of the work for | ||
156 | making modifications to it. For an executable work, complete source | ||
157 | code means all the source code for all modules it contains, plus any | ||
158 | associated interface definition files, plus the scripts used to | ||
159 | control compilation and installation of the executable. However, as a | ||
160 | special exception, the source code distributed need not include | ||
161 | anything that is normally distributed (in either source or binary | ||
162 | form) with the major components (compiler, kernel, and so on) of the | ||
163 | operating system on which the executable runs, unless that component | ||
164 | itself accompanies the executable. | ||
165 | |||
166 | If distribution of executable or object code is made by offering | ||
167 | access to copy from a designated place, then offering equivalent | ||
168 | access to copy the source code from the same place counts as | ||
169 | distribution of the source code, even though third parties are not | ||
170 | compelled to copy the source along with the object code. | ||
171 | |||
172 | 4. You may not copy, modify, sublicense, or distribute the Program | ||
173 | except as expressly provided under this License. Any attempt | ||
174 | otherwise to copy, modify, sublicense or distribute the Program is | ||
175 | void, and will automatically terminate your rights under this License. | ||
176 | However, parties who have received copies, or rights, from you under | ||
177 | this License will not have their licenses terminated so long as such | ||
178 | parties remain in full compliance. | ||
179 | |||
180 | 5. You are not required to accept this License, since you have not | ||
181 | signed it. However, nothing else grants you permission to modify or | ||
182 | distribute the Program or its derivative works. These actions are | ||
183 | prohibited by law if you do not accept this License. Therefore, by | ||
184 | modifying or distributing the Program (or any work based on the | ||
185 | Program), you indicate your acceptance of this License to do so, and | ||
186 | all its terms and conditions for copying, distributing or modifying | ||
187 | the Program or works based on it. | ||
188 | |||
189 | 6. Each time you redistribute the Program (or any work based on the | ||
190 | Program), the recipient automatically receives a license from the | ||
191 | original licensor to copy, distribute or modify the Program subject to | ||
192 | these terms and conditions. You may not impose any further | ||
193 | restrictions on the recipients' exercise of the rights granted herein. | ||
194 | You are not responsible for enforcing compliance by third parties to | ||
195 | this License. | ||
196 | |||
197 | 7. If, as a consequence of a court judgment or allegation of patent | ||
198 | infringement or for any other reason (not limited to patent issues), | ||
199 | conditions are imposed on you (whether by court order, agreement or | ||
200 | otherwise) that contradict the conditions of this License, they do not | ||
201 | excuse you from the conditions of this License. If you cannot | ||
202 | distribute so as to satisfy simultaneously your obligations under this | ||
203 | License and any other pertinent obligations, then as a consequence you | ||
204 | may not distribute the Program at all. For example, if a patent | ||
205 | license would not permit royalty-free redistribution of the Program by | ||
206 | all those who receive copies directly or indirectly through you, then | ||
207 | the only way you could satisfy both it and this License would be to | ||
208 | refrain entirely from distribution of the Program. | ||
209 | |||
210 | If any portion of this section is held invalid or unenforceable under | ||
211 | any particular circumstance, the balance of the section is intended to | ||
212 | apply and the section as a whole is intended to apply in other | ||
213 | circumstances. | ||
214 | |||
215 | It is not the purpose of this section to induce you to infringe any | ||
216 | patents or other property right claims or to contest validity of any | ||
217 | such claims; this section has the sole purpose of protecting the | ||
218 | integrity of the free software distribution system, which is | ||
219 | implemented by public license practices. Many people have made | ||
220 | generous contributions to the wide range of software distributed | ||
221 | through that system in reliance on consistent application of that | ||
222 | system; it is up to the author/donor to decide if he or she is willing | ||
223 | to distribute software through any other system and a licensee cannot | ||
224 | impose that choice. | ||
225 | |||
226 | This section is intended to make thoroughly clear what is believed to | ||
227 | be a consequence of the rest of this License. | ||
228 | |||
229 | 8. If the distribution and/or use of the Program is restricted in | ||
230 | certain countries either by patents or by copyrighted interfaces, the | ||
231 | original copyright holder who places the Program under this License | ||
232 | may add an explicit geographical distribution limitation excluding | ||
233 | those countries, so that distribution is permitted only in or among | ||
234 | countries not thus excluded. In such case, this License incorporates | ||
235 | the limitation as if written in the body of this License. | ||
236 | |||
237 | 9. The Free Software Foundation may publish revised and/or new versions | ||
238 | of the General Public License from time to time. Such new versions will | ||
239 | be similar in spirit to the present version, but may differ in detail to | ||
240 | address new problems or concerns. | ||
241 | |||
242 | Each version is given a distinguishing version number. If the Program | ||
243 | specifies a version number of this License which applies to it and "any | ||
244 | later version", you have the option of following the terms and conditions | ||
245 | either of that version or of any later version published by the Free | ||
246 | Software Foundation. If the Program does not specify a version number of | ||
247 | this License, you may choose any version ever published by the Free Software | ||
248 | Foundation. | ||
249 | |||
250 | 10. If you wish to incorporate parts of the Program into other free | ||
251 | programs whose distribution conditions are different, write to the author | ||
252 | to ask for permission. For software which is copyrighted by the Free | ||
253 | Software Foundation, write to the Free Software Foundation; we sometimes | ||
254 | make exceptions for this. Our decision will be guided by the two goals | ||
255 | of preserving the free status of all derivatives of our free software and | ||
256 | of promoting the sharing and reuse of software generally. | ||
257 | |||
258 | NO WARRANTY | ||
259 | |||
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY | ||
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN | ||
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES | ||
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED | ||
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS | ||
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE | ||
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, | ||
268 | REPAIR OR CORRECTION. | ||
269 | |||
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | ||
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR | ||
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, | ||
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING | ||
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED | ||
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY | ||
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER | ||
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE | ||
278 | POSSIBILITY OF SUCH DAMAGES. | ||
279 | |||
280 | END OF TERMS AND CONDITIONS | ||
281 | |||
282 | How to Apply These Terms to Your New Programs | ||
283 | |||
284 | If you develop a new program, and you want it to be of the greatest | ||
285 | possible use to the public, the best way to achieve this is to make it | ||
286 | free software which everyone can redistribute and change under these terms. | ||
287 | |||
288 | To do so, attach the following notices to the program. It is safest | ||
289 | to attach them to the start of each source file to most effectively | ||
290 | convey the exclusion of warranty; and each file should have at least | ||
291 | the "copyright" line and a pointer to where the full notice is found. | ||
292 | |||
293 | <one line to give the program's name and a brief idea of what it does.> | ||
294 | Copyright (C) <year> <name of author> | ||
295 | |||
296 | This program is free software; you can redistribute it and/or modify | ||
297 | it under the terms of the GNU General Public License as published by | ||
298 | the Free Software Foundation; either version 2 of the License, or | ||
299 | (at your option) any later version. | ||
300 | |||
301 | This program is distributed in the hope that it will be useful, | ||
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
304 | GNU General Public License for more details. | ||
305 | |||
306 | You should have received a copy of the GNU General Public License | ||
307 | along with this program; if not, write to the Free Software | ||
308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
309 | |||
310 | |||
311 | Also add information on how to contact you by electronic and paper mail. | ||
312 | |||
313 | If the program is interactive, make it output a short notice like this | ||
314 | when it starts in an interactive mode: | ||
315 | |||
316 | Gnomovision version 69, Copyright (C) year name of author | ||
317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | ||
318 | This is free software, and you are welcome to redistribute it | ||
319 | under certain conditions; type `show c' for details. | ||
320 | |||
321 | The hypothetical commands `show w' and `show c' should show the appropriate | ||
322 | parts of the General Public License. Of course, the commands you use may | ||
323 | be called something other than `show w' and `show c'; they could even be | ||
324 | mouse-clicks or menu items--whatever suits your program. | ||
325 | |||
326 | You should also get your employer (if you work as a programmer) or your | ||
327 | school, if any, to sign a "copyright disclaimer" for the program, if | ||
328 | necessary. Here is a sample; alter the names: | ||
329 | |||
330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program | ||
331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. | ||
332 | |||
333 | <signature of Ty Coon>, 1 April 1989 | ||
334 | Ty Coon, President of Vice | ||
335 | |||
336 | This General Public License does not permit incorporating your program into | ||
337 | proprietary programs. If your program is a subroutine library, you may | ||
338 | consider it more useful to permit linking proprietary applications with the | ||
339 | library. If this is what you want to do, use the GNU Library General | ||
340 | Public License instead of this License. \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv3 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv3 new file mode 100644 index 0000000..20d40b6 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_GPLv3 | |||
@@ -0,0 +1,674 @@ | |||
1 | GNU GENERAL PUBLIC LICENSE | ||
2 | Version 3, 29 June 2007 | ||
3 | |||
4 | Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | ||
5 | Everyone is permitted to copy and distribute verbatim copies | ||
6 | of this license document, but changing it is not allowed. | ||
7 | |||
8 | Preamble | ||
9 | |||
10 | The GNU General Public License is a free, copyleft license for | ||
11 | software and other kinds of works. | ||
12 | |||
13 | The licenses for most software and other practical works are designed | ||
14 | to take away your freedom to share and change the works. By contrast, | ||
15 | the GNU General Public License is intended to guarantee your freedom to | ||
16 | share and change all versions of a program--to make sure it remains free | ||
17 | software for all its users. We, the Free Software Foundation, use the | ||
18 | GNU General Public License for most of our software; it applies also to | ||
19 | any other work released this way by its authors. You can apply it to | ||
20 | your programs, too. | ||
21 | |||
22 | When we speak of free software, we are referring to freedom, not | ||
23 | price. Our General Public Licenses are designed to make sure that you | ||
24 | have the freedom to distribute copies of free software (and charge for | ||
25 | them if you wish), that you receive source code or can get it if you | ||
26 | want it, that you can change the software or use pieces of it in new | ||
27 | free programs, and that you know you can do these things. | ||
28 | |||
29 | To protect your rights, we need to prevent others from denying you | ||
30 | these rights or asking you to surrender the rights. Therefore, you have | ||
31 | certain responsibilities if you distribute copies of the software, or if | ||
32 | you modify it: responsibilities to respect the freedom of others. | ||
33 | |||
34 | For example, if you distribute copies of such a program, whether | ||
35 | gratis or for a fee, you must pass on to the recipients the same | ||
36 | freedoms that you received. You must make sure that they, too, receive | ||
37 | or can get the source code. And you must show them these terms so they | ||
38 | know their rights. | ||
39 | |||
40 | Developers that use the GNU GPL protect your rights with two steps: | ||
41 | (1) assert copyright on the software, and (2) offer you this License | ||
42 | giving you legal permission to copy, distribute and/or modify it. | ||
43 | |||
44 | For the developers' and authors' protection, the GPL clearly explains | ||
45 | that there is no warranty for this free software. For both users' and | ||
46 | authors' sake, the GPL requires that modified versions be marked as | ||
47 | changed, so that their problems will not be attributed erroneously to | ||
48 | authors of previous versions. | ||
49 | |||
50 | Some devices are designed to deny users access to install or run | ||
51 | modified versions of the software inside them, although the manufacturer | ||
52 | can do so. This is fundamentally incompatible with the aim of | ||
53 | protecting users' freedom to change the software. The systematic | ||
54 | pattern of such abuse occurs in the area of products for individuals to | ||
55 | use, which is precisely where it is most unacceptable. Therefore, we | ||
56 | have designed this version of the GPL to prohibit the practice for those | ||
57 | products. If such problems arise substantially in other domains, we | ||
58 | stand ready to extend this provision to those domains in future versions | ||
59 | of the GPL, as needed to protect the freedom of users. | ||
60 | |||
61 | Finally, every program is threatened constantly by software patents. | ||
62 | States should not allow patents to restrict development and use of | ||
63 | software on general-purpose computers, but in those that do, we wish to | ||
64 | avoid the special danger that patents applied to a free program could | ||
65 | make it effectively proprietary. To prevent this, the GPL assures that | ||
66 | patents cannot be used to render the program non-free. | ||
67 | |||
68 | The precise terms and conditions for copying, distribution and | ||
69 | modification follow. | ||
70 | |||
71 | TERMS AND CONDITIONS | ||
72 | |||
73 | 0. Definitions. | ||
74 | |||
75 | "This License" refers to version 3 of the GNU General Public License. | ||
76 | |||
77 | "Copyright" also means copyright-like laws that apply to other kinds of | ||
78 | works, such as semiconductor masks. | ||
79 | |||
80 | "The Program" refers to any copyrightable work licensed under this | ||
81 | License. Each licensee is addressed as "you". "Licensees" and | ||
82 | "recipients" may be individuals or organizations. | ||
83 | |||
84 | To "modify" a work means to copy from or adapt all or part of the work | ||
85 | in a fashion requiring copyright permission, other than the making of an | ||
86 | exact copy. The resulting work is called a "modified version" of the | ||
87 | earlier work or a work "based on" the earlier work. | ||
88 | |||
89 | A "covered work" means either the unmodified Program or a work based | ||
90 | on the Program. | ||
91 | |||
92 | To "propagate" a work means to do anything with it that, without | ||
93 | permission, would make you directly or secondarily liable for | ||
94 | infringement under applicable copyright law, except executing it on a | ||
95 | computer or modifying a private copy. Propagation includes copying, | ||
96 | distribution (with or without modification), making available to the | ||
97 | public, and in some countries other activities as well. | ||
98 | |||
99 | To "convey" a work means any kind of propagation that enables other | ||
100 | parties to make or receive copies. Mere interaction with a user through | ||
101 | a computer network, with no transfer of a copy, is not conveying. | ||
102 | |||
103 | An interactive user interface displays "Appropriate Legal Notices" | ||
104 | to the extent that it includes a convenient and prominently visible | ||
105 | feature that (1) displays an appropriate copyright notice, and (2) | ||
106 | tells the user that there is no warranty for the work (except to the | ||
107 | extent that warranties are provided), that licensees may convey the | ||
108 | work under this License, and how to view a copy of this License. If | ||
109 | the interface presents a list of user commands or options, such as a | ||
110 | menu, a prominent item in the list meets this criterion. | ||
111 | |||
112 | 1. Source Code. | ||
113 | |||
114 | The "source code" for a work means the preferred form of the work | ||
115 | for making modifications to it. "Object code" means any non-source | ||
116 | form of a work. | ||
117 | |||
118 | A "Standard Interface" means an interface that either is an official | ||
119 | standard defined by a recognized standards body, or, in the case of | ||
120 | interfaces specified for a particular programming language, one that | ||
121 | is widely used among developers working in that language. | ||
122 | |||
123 | The "System Libraries" of an executable work include anything, other | ||
124 | than the work as a whole, that (a) is included in the normal form of | ||
125 | packaging a Major Component, but which is not part of that Major | ||
126 | Component, and (b) serves only to enable use of the work with that | ||
127 | Major Component, or to implement a Standard Interface for which an | ||
128 | implementation is available to the public in source code form. A | ||
129 | "Major Component", in this context, means a major essential component | ||
130 | (kernel, window system, and so on) of the specific operating system | ||
131 | (if any) on which the executable work runs, or a compiler used to | ||
132 | produce the work, or an object code interpreter used to run it. | ||
133 | |||
134 | The "Corresponding Source" for a work in object code form means all | ||
135 | the source code needed to generate, install, and (for an executable | ||
136 | work) run the object code and to modify the work, including scripts to | ||
137 | control those activities. However, it does not include the work's | ||
138 | System Libraries, or general-purpose tools or generally available free | ||
139 | programs which are used unmodified in performing those activities but | ||
140 | which are not part of the work. For example, Corresponding Source | ||
141 | includes interface definition files associated with source files for | ||
142 | the work, and the source code for shared libraries and dynamically | ||
143 | linked subprograms that the work is specifically designed to require, | ||
144 | such as by intimate data communication or control flow between those | ||
145 | subprograms and other parts of the work. | ||
146 | |||
147 | The Corresponding Source need not include anything that users | ||
148 | can regenerate automatically from other parts of the Corresponding | ||
149 | Source. | ||
150 | |||
151 | The Corresponding Source for a work in source code form is that | ||
152 | same work. | ||
153 | |||
154 | 2. Basic Permissions. | ||
155 | |||
156 | All rights granted under this License are granted for the term of | ||
157 | copyright on the Program, and are irrevocable provided the stated | ||
158 | conditions are met. This License explicitly affirms your unlimited | ||
159 | permission to run the unmodified Program. The output from running a | ||
160 | covered work is covered by this License only if the output, given its | ||
161 | content, constitutes a covered work. This License acknowledges your | ||
162 | rights of fair use or other equivalent, as provided by copyright law. | ||
163 | |||
164 | You may make, run and propagate covered works that you do not | ||
165 | convey, without conditions so long as your license otherwise remains | ||
166 | in force. You may convey covered works to others for the sole purpose | ||
167 | of having them make modifications exclusively for you, or provide you | ||
168 | with facilities for running those works, provided that you comply with | ||
169 | the terms of this License in conveying all material for which you do | ||
170 | not control copyright. Those thus making or running the covered works | ||
171 | for you must do so exclusively on your behalf, under your direction | ||
172 | and control, on terms that prohibit them from making any copies of | ||
173 | your copyrighted material outside their relationship with you. | ||
174 | |||
175 | Conveying under any other circumstances is permitted solely under | ||
176 | the conditions stated below. Sublicensing is not allowed; section 10 | ||
177 | makes it unnecessary. | ||
178 | |||
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. | ||
180 | |||
181 | No covered work shall be deemed part of an effective technological | ||
182 | measure under any applicable law fulfilling obligations under article | ||
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or | ||
184 | similar laws prohibiting or restricting circumvention of such | ||
185 | measures. | ||
186 | |||
187 | When you convey a covered work, you waive any legal power to forbid | ||
188 | circumvention of technological measures to the extent such circumvention | ||
189 | is effected by exercising rights under this License with respect to | ||
190 | the covered work, and you disclaim any intention to limit operation or | ||
191 | modification of the work as a means of enforcing, against the work's | ||
192 | users, your or third parties' legal rights to forbid circumvention of | ||
193 | technological measures. | ||
194 | |||
195 | 4. Conveying Verbatim Copies. | ||
196 | |||
197 | You may convey verbatim copies of the Program's source code as you | ||
198 | receive it, in any medium, provided that you conspicuously and | ||
199 | appropriately publish on each copy an appropriate copyright notice; | ||
200 | keep intact all notices stating that this License and any | ||
201 | non-permissive terms added in accord with section 7 apply to the code; | ||
202 | keep intact all notices of the absence of any warranty; and give all | ||
203 | recipients a copy of this License along with the Program. | ||
204 | |||
205 | You may charge any price or no price for each copy that you convey, | ||
206 | and you may offer support or warranty protection for a fee. | ||
207 | |||
208 | 5. Conveying Modified Source Versions. | ||
209 | |||
210 | You may convey a work based on the Program, or the modifications to | ||
211 | produce it from the Program, in the form of source code under the | ||
212 | terms of section 4, provided that you also meet all of these conditions: | ||
213 | |||
214 | a) The work must carry prominent notices stating that you modified | ||
215 | it, and giving a relevant date. | ||
216 | |||
217 | b) The work must carry prominent notices stating that it is | ||
218 | released under this License and any conditions added under section | ||
219 | 7. This requirement modifies the requirement in section 4 to | ||
220 | "keep intact all notices". | ||
221 | |||
222 | c) You must license the entire work, as a whole, under this | ||
223 | License to anyone who comes into possession of a copy. This | ||
224 | License will therefore apply, along with any applicable section 7 | ||
225 | additional terms, to the whole of the work, and all its parts, | ||
226 | regardless of how they are packaged. This License gives no | ||
227 | permission to license the work in any other way, but it does not | ||
228 | invalidate such permission if you have separately received it. | ||
229 | |||
230 | d) If the work has interactive user interfaces, each must display | ||
231 | Appropriate Legal Notices; however, if the Program has interactive | ||
232 | interfaces that do not display Appropriate Legal Notices, your | ||
233 | work need not make them do so. | ||
234 | |||
235 | A compilation of a covered work with other separate and independent | ||
236 | works, which are not by their nature extensions of the covered work, | ||
237 | and which are not combined with it such as to form a larger program, | ||
238 | in or on a volume of a storage or distribution medium, is called an | ||
239 | "aggregate" if the compilation and its resulting copyright are not | ||
240 | used to limit the access or legal rights of the compilation's users | ||
241 | beyond what the individual works permit. Inclusion of a covered work | ||
242 | in an aggregate does not cause this License to apply to the other | ||
243 | parts of the aggregate. | ||
244 | |||
245 | 6. Conveying Non-Source Forms. | ||
246 | |||
247 | You may convey a covered work in object code form under the terms | ||
248 | of sections 4 and 5, provided that you also convey the | ||
249 | machine-readable Corresponding Source under the terms of this License, | ||
250 | in one of these ways: | ||
251 | |||
252 | a) Convey the object code in, or embodied in, a physical product | ||
253 | (including a physical distribution medium), accompanied by the | ||
254 | Corresponding Source fixed on a durable physical medium | ||
255 | customarily used for software interchange. | ||
256 | |||
257 | b) Convey the object code in, or embodied in, a physical product | ||
258 | (including a physical distribution medium), accompanied by a | ||
259 | written offer, valid for at least three years and valid for as | ||
260 | long as you offer spare parts or customer support for that product | ||
261 | model, to give anyone who possesses the object code either (1) a | ||
262 | copy of the Corresponding Source for all the software in the | ||
263 | product that is covered by this License, on a durable physical | ||
264 | medium customarily used for software interchange, for a price no | ||
265 | more than your reasonable cost of physically performing this | ||
266 | conveying of source, or (2) access to copy the | ||
267 | Corresponding Source from a network server at no charge. | ||
268 | |||
269 | c) Convey individual copies of the object code with a copy of the | ||
270 | written offer to provide the Corresponding Source. This | ||
271 | alternative is allowed only occasionally and noncommercially, and | ||
272 | only if you received the object code with such an offer, in accord | ||
273 | with subsection 6b. | ||
274 | |||
275 | d) Convey the object code by offering access from a designated | ||
276 | place (gratis or for a charge), and offer equivalent access to the | ||
277 | Corresponding Source in the same way through the same place at no | ||
278 | further charge. You need not require recipients to copy the | ||
279 | Corresponding Source along with the object code. If the place to | ||
280 | copy the object code is a network server, the Corresponding Source | ||
281 | may be on a different server (operated by you or a third party) | ||
282 | that supports equivalent copying facilities, provided you maintain | ||
283 | clear directions next to the object code saying where to find the | ||
284 | Corresponding Source. Regardless of what server hosts the | ||
285 | Corresponding Source, you remain obligated to ensure that it is | ||
286 | available for as long as needed to satisfy these requirements. | ||
287 | |||
288 | e) Convey the object code using peer-to-peer transmission, provided | ||
289 | you inform other peers where the object code and Corresponding | ||
290 | Source of the work are being offered to the general public at no | ||
291 | charge under subsection 6d. | ||
292 | |||
293 | A separable portion of the object code, whose source code is excluded | ||
294 | from the Corresponding Source as a System Library, need not be | ||
295 | included in conveying the object code work. | ||
296 | |||
297 | A "User Product" is either (1) a "consumer product", which means any | ||
298 | tangible personal property which is normally used for personal, family, | ||
299 | or household purposes, or (2) anything designed or sold for incorporation | ||
300 | into a dwelling. In determining whether a product is a consumer product, | ||
301 | doubtful cases shall be resolved in favor of coverage. For a particular | ||
302 | product received by a particular user, "normally used" refers to a | ||
303 | typical or common use of that class of product, regardless of the status | ||
304 | of the particular user or of the way in which the particular user | ||
305 | actually uses, or expects or is expected to use, the product. A product | ||
306 | is a consumer product regardless of whether the product has substantial | ||
307 | commercial, industrial or non-consumer uses, unless such uses represent | ||
308 | the only significant mode of use of the product. | ||
309 | |||
310 | "Installation Information" for a User Product means any methods, | ||
311 | procedures, authorization keys, or other information required to install | ||
312 | and execute modified versions of a covered work in that User Product from | ||
313 | a modified version of its Corresponding Source. The information must | ||
314 | suffice to ensure that the continued functioning of the modified object | ||
315 | code is in no case prevented or interfered with solely because | ||
316 | modification has been made. | ||
317 | |||
318 | If you convey an object code work under this section in, or with, or | ||
319 | specifically for use in, a User Product, and the conveying occurs as | ||
320 | part of a transaction in which the right of possession and use of the | ||
321 | User Product is transferred to the recipient in perpetuity or for a | ||
322 | fixed term (regardless of how the transaction is characterized), the | ||
323 | Corresponding Source conveyed under this section must be accompanied | ||
324 | by the Installation Information. But this requirement does not apply | ||
325 | if neither you nor any third party retains the ability to install | ||
326 | modified object code on the User Product (for example, the work has | ||
327 | been installed in ROM). | ||
328 | |||
329 | The requirement to provide Installation Information does not include a | ||
330 | requirement to continue to provide support service, warranty, or updates | ||
331 | for a work that has been modified or installed by the recipient, or for | ||
332 | the User Product in which it has been modified or installed. Access to a | ||
333 | network may be denied when the modification itself materially and | ||
334 | adversely affects the operation of the network or violates the rules and | ||
335 | protocols for communication across the network. | ||
336 | |||
337 | Corresponding Source conveyed, and Installation Information provided, | ||
338 | in accord with this section must be in a format that is publicly | ||
339 | documented (and with an implementation available to the public in | ||
340 | source code form), and must require no special password or key for | ||
341 | unpacking, reading or copying. | ||
342 | |||
343 | 7. Additional Terms. | ||
344 | |||
345 | "Additional permissions" are terms that supplement the terms of this | ||
346 | License by making exceptions from one or more of its conditions. | ||
347 | Additional permissions that are applicable to the entire Program shall | ||
348 | be treated as though they were included in this License, to the extent | ||
349 | that they are valid under applicable law. If additional permissions | ||
350 | apply only to part of the Program, that part may be used separately | ||
351 | under those permissions, but the entire Program remains governed by | ||
352 | this License without regard to the additional permissions. | ||
353 | |||
354 | When you convey a copy of a covered work, you may at your option | ||
355 | remove any additional permissions from that copy, or from any part of | ||
356 | it. (Additional permissions may be written to require their own | ||
357 | removal in certain cases when you modify the work.) You may place | ||
358 | additional permissions on material, added by you to a covered work, | ||
359 | for which you have or can give appropriate copyright permission. | ||
360 | |||
361 | Notwithstanding any other provision of this License, for material you | ||
362 | add to a covered work, you may (if authorized by the copyright holders of | ||
363 | that material) supplement the terms of this License with terms: | ||
364 | |||
365 | a) Disclaiming warranty or limiting liability differently from the | ||
366 | terms of sections 15 and 16 of this License; or | ||
367 | |||
368 | b) Requiring preservation of specified reasonable legal notices or | ||
369 | author attributions in that material or in the Appropriate Legal | ||
370 | Notices displayed by works containing it; or | ||
371 | |||
372 | c) Prohibiting misrepresentation of the origin of that material, or | ||
373 | requiring that modified versions of such material be marked in | ||
374 | reasonable ways as different from the original version; or | ||
375 | |||
376 | d) Limiting the use for publicity purposes of names of licensors or | ||
377 | authors of the material; or | ||
378 | |||
379 | e) Declining to grant rights under trademark law for use of some | ||
380 | trade names, trademarks, or service marks; or | ||
381 | |||
382 | f) Requiring indemnification of licensors and authors of that | ||
383 | material by anyone who conveys the material (or modified versions of | ||
384 | it) with contractual assumptions of liability to the recipient, for | ||
385 | any liability that these contractual assumptions directly impose on | ||
386 | those licensors and authors. | ||
387 | |||
388 | All other non-permissive additional terms are considered "further | ||
389 | restrictions" within the meaning of section 10. If the Program as you | ||
390 | received it, or any part of it, contains a notice stating that it is | ||
391 | governed by this License along with a term that is a further | ||
392 | restriction, you may remove that term. If a license document contains | ||
393 | a further restriction but permits relicensing or conveying under this | ||
394 | License, you may add to a covered work material governed by the terms | ||
395 | of that license document, provided that the further restriction does | ||
396 | not survive such relicensing or conveying. | ||
397 | |||
398 | If you add terms to a covered work in accord with this section, you | ||
399 | must place, in the relevant source files, a statement of the | ||
400 | additional terms that apply to those files, or a notice indicating | ||
401 | where to find the applicable terms. | ||
402 | |||
403 | Additional terms, permissive or non-permissive, may be stated in the | ||
404 | form of a separately written license, or stated as exceptions; | ||
405 | the above requirements apply either way. | ||
406 | |||
407 | 8. Termination. | ||
408 | |||
409 | You may not propagate or modify a covered work except as expressly | ||
410 | provided under this License. Any attempt otherwise to propagate or | ||
411 | modify it is void, and will automatically terminate your rights under | ||
412 | this License (including any patent licenses granted under the third | ||
413 | paragraph of section 11). | ||
414 | |||
415 | However, if you cease all violation of this License, then your | ||
416 | license from a particular copyright holder is reinstated (a) | ||
417 | provisionally, unless and until the copyright holder explicitly and | ||
418 | finally terminates your license, and (b) permanently, if the copyright | ||
419 | holder fails to notify you of the violation by some reasonable means | ||
420 | prior to 60 days after the cessation. | ||
421 | |||
422 | Moreover, your license from a particular copyright holder is | ||
423 | reinstated permanently if the copyright holder notifies you of the | ||
424 | violation by some reasonable means, this is the first time you have | ||
425 | received notice of violation of this License (for any work) from that | ||
426 | copyright holder, and you cure the violation prior to 30 days after | ||
427 | your receipt of the notice. | ||
428 | |||
429 | Termination of your rights under this section does not terminate the | ||
430 | licenses of parties who have received copies or rights from you under | ||
431 | this License. If your rights have been terminated and not permanently | ||
432 | reinstated, you do not qualify to receive new licenses for the same | ||
433 | material under section 10. | ||
434 | |||
435 | 9. Acceptance Not Required for Having Copies. | ||
436 | |||
437 | You are not required to accept this License in order to receive or | ||
438 | run a copy of the Program. Ancillary propagation of a covered work | ||
439 | occurring solely as a consequence of using peer-to-peer transmission | ||
440 | to receive a copy likewise does not require acceptance. However, | ||
441 | nothing other than this License grants you permission to propagate or | ||
442 | modify any covered work. These actions infringe copyright if you do | ||
443 | not accept this License. Therefore, by modifying or propagating a | ||
444 | covered work, you indicate your acceptance of this License to do so. | ||
445 | |||
446 | 10. Automatic Licensing of Downstream Recipients. | ||
447 | |||
448 | Each time you convey a covered work, the recipient automatically | ||
449 | receives a license from the original licensors, to run, modify and | ||
450 | propagate that work, subject to this License. You are not responsible | ||
451 | for enforcing compliance by third parties with this License. | ||
452 | |||
453 | An "entity transaction" is a transaction transferring control of an | ||
454 | organization, or substantially all assets of one, or subdividing an | ||
455 | organization, or merging organizations. If propagation of a covered | ||
456 | work results from an entity transaction, each party to that | ||
457 | transaction who receives a copy of the work also receives whatever | ||
458 | licenses to the work the party's predecessor in interest had or could | ||
459 | give under the previous paragraph, plus a right to possession of the | ||
460 | Corresponding Source of the work from the predecessor in interest, if | ||
461 | the predecessor has it or can get it with reasonable efforts. | ||
462 | |||
463 | You may not impose any further restrictions on the exercise of the | ||
464 | rights granted or affirmed under this License. For example, you may | ||
465 | not impose a license fee, royalty, or other charge for exercise of | ||
466 | rights granted under this License, and you may not initiate litigation | ||
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that | ||
468 | any patent claim is infringed by making, using, selling, offering for | ||
469 | sale, or importing the Program or any portion of it. | ||
470 | |||
471 | 11. Patents. | ||
472 | |||
473 | A "contributor" is a copyright holder who authorizes use under this | ||
474 | License of the Program or a work on which the Program is based. The | ||
475 | work thus licensed is called the contributor's "contributor version". | ||
476 | |||
477 | A contributor's "essential patent claims" are all patent claims | ||
478 | owned or controlled by the contributor, whether already acquired or | ||
479 | hereafter acquired, that would be infringed by some manner, permitted | ||
480 | by this License, of making, using, or selling its contributor version, | ||
481 | but do not include claims that would be infringed only as a | ||
482 | consequence of further modification of the contributor version. For | ||
483 | purposes of this definition, "control" includes the right to grant | ||
484 | patent sublicenses in a manner consistent with the requirements of | ||
485 | this License. | ||
486 | |||
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free | ||
488 | patent license under the contributor's essential patent claims, to | ||
489 | make, use, sell, offer for sale, import and otherwise run, modify and | ||
490 | propagate the contents of its contributor version. | ||
491 | |||
492 | In the following three paragraphs, a "patent license" is any express | ||
493 | agreement or commitment, however denominated, not to enforce a patent | ||
494 | (such as an express permission to practice a patent or covenant not to | ||
495 | sue for patent infringement). To "grant" such a patent license to a | ||
496 | party means to make such an agreement or commitment not to enforce a | ||
497 | patent against the party. | ||
498 | |||
499 | If you convey a covered work, knowingly relying on a patent license, | ||
500 | and the Corresponding Source of the work is not available for anyone | ||
501 | to copy, free of charge and under the terms of this License, through a | ||
502 | publicly available network server or other readily accessible means, | ||
503 | then you must either (1) cause the Corresponding Source to be so | ||
504 | available, or (2) arrange to deprive yourself of the benefit of the | ||
505 | patent license for this particular work, or (3) arrange, in a manner | ||
506 | consistent with the requirements of this License, to extend the patent | ||
507 | license to downstream recipients. "Knowingly relying" means you have | ||
508 | actual knowledge that, but for the patent license, your conveying the | ||
509 | covered work in a country, or your recipient's use of the covered work | ||
510 | in a country, would infringe one or more identifiable patents in that | ||
511 | country that you have reason to believe are valid. | ||
512 | |||
513 | If, pursuant to or in connection with a single transaction or | ||
514 | arrangement, you convey, or propagate by procuring conveyance of, a | ||
515 | covered work, and grant a patent license to some of the parties | ||
516 | receiving the covered work authorizing them to use, propagate, modify | ||
517 | or convey a specific copy of the covered work, then the patent license | ||
518 | you grant is automatically extended to all recipients of the covered | ||
519 | work and works based on it. | ||
520 | |||
521 | A patent license is "discriminatory" if it does not include within | ||
522 | the scope of its coverage, prohibits the exercise of, or is | ||
523 | conditioned on the non-exercise of one or more of the rights that are | ||
524 | specifically granted under this License. You may not convey a covered | ||
525 | work if you are a party to an arrangement with a third party that is | ||
526 | in the business of distributing software, under which you make payment | ||
527 | to the third party based on the extent of your activity of conveying | ||
528 | the work, and under which the third party grants, to any of the | ||
529 | parties who would receive the covered work from you, a discriminatory | ||
530 | patent license (a) in connection with copies of the covered work | ||
531 | conveyed by you (or copies made from those copies), or (b) primarily | ||
532 | for and in connection with specific products or compilations that | ||
533 | contain the covered work, unless you entered into that arrangement, | ||
534 | or that patent license was granted, prior to 28 March 2007. | ||
535 | |||
536 | Nothing in this License shall be construed as excluding or limiting | ||
537 | any implied license or other defenses to infringement that may | ||
538 | otherwise be available to you under applicable patent law. | ||
539 | |||
540 | 12. No Surrender of Others' Freedom. | ||
541 | |||
542 | If conditions are imposed on you (whether by court order, agreement or | ||
543 | otherwise) that contradict the conditions of this License, they do not | ||
544 | excuse you from the conditions of this License. If you cannot convey a | ||
545 | covered work so as to satisfy simultaneously your obligations under this | ||
546 | License and any other pertinent obligations, then as a consequence you may | ||
547 | not convey it at all. For example, if you agree to terms that obligate you | ||
548 | to collect a royalty for further conveying from those to whom you convey | ||
549 | the Program, the only way you could satisfy both those terms and this | ||
550 | License would be to refrain entirely from conveying the Program. | ||
551 | |||
552 | 13. Use with the GNU Affero General Public License. | ||
553 | |||
554 | Notwithstanding any other provision of this License, you have | ||
555 | permission to link or combine any covered work with a work licensed | ||
556 | under version 3 of the GNU Affero General Public License into a single | ||
557 | combined work, and to convey the resulting work. The terms of this | ||
558 | License will continue to apply to the part which is the covered work, | ||
559 | but the special requirements of the GNU Affero General Public License, | ||
560 | section 13, concerning interaction through a network will apply to the | ||
561 | combination as such. | ||
562 | |||
563 | 14. Revised Versions of this License. | ||
564 | |||
565 | The Free Software Foundation may publish revised and/or new versions of | ||
566 | the GNU General Public License from time to time. Such new versions will | ||
567 | be similar in spirit to the present version, but may differ in detail to | ||
568 | address new problems or concerns. | ||
569 | |||
570 | Each version is given a distinguishing version number. If the | ||
571 | Program specifies that a certain numbered version of the GNU General | ||
572 | Public License "or any later version" applies to it, you have the | ||
573 | option of following the terms and conditions either of that numbered | ||
574 | version or of any later version published by the Free Software | ||
575 | Foundation. If the Program does not specify a version number of the | ||
576 | GNU General Public License, you may choose any version ever published | ||
577 | by the Free Software Foundation. | ||
578 | |||
579 | If the Program specifies that a proxy can decide which future | ||
580 | versions of the GNU General Public License can be used, that proxy's | ||
581 | public statement of acceptance of a version permanently authorizes you | ||
582 | to choose that version for the Program. | ||
583 | |||
584 | Later license versions may give you additional or different | ||
585 | permissions. However, no additional obligations are imposed on any | ||
586 | author or copyright holder as a result of your choosing to follow a | ||
587 | later version. | ||
588 | |||
589 | 15. Disclaimer of Warranty. | ||
590 | |||
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | ||
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | ||
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY | ||
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, | ||
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM | ||
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF | ||
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | ||
599 | |||
600 | 16. Limitation of Liability. | ||
601 | |||
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | ||
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS | ||
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY | ||
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE | ||
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF | ||
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD | ||
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), | ||
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | ||
610 | SUCH DAMAGES. | ||
611 | |||
612 | 17. Interpretation of Sections 15 and 16. | ||
613 | |||
614 | If the disclaimer of warranty and limitation of liability provided | ||
615 | above cannot be given local legal effect according to their terms, | ||
616 | reviewing courts shall apply local law that most closely approximates | ||
617 | an absolute waiver of all civil liability in connection with the | ||
618 | Program, unless a warranty or assumption of liability accompanies a | ||
619 | copy of the Program in return for a fee. | ||
620 | |||
621 | END OF TERMS AND CONDITIONS | ||
622 | |||
623 | How to Apply These Terms to Your New Programs | ||
624 | |||
625 | If you develop a new program, and you want it to be of the greatest | ||
626 | possible use to the public, the best way to achieve this is to make it | ||
627 | free software which everyone can redistribute and change under these terms. | ||
628 | |||
629 | To do so, attach the following notices to the program. It is safest | ||
630 | to attach them to the start of each source file to most effectively | ||
631 | state the exclusion of warranty; and each file should have at least | ||
632 | the "copyright" line and a pointer to where the full notice is found. | ||
633 | |||
634 | <one line to give the program's name and a brief idea of what it does.> | ||
635 | Copyright (C) <year> <name of author> | ||
636 | |||
637 | This program is free software: you can redistribute it and/or modify | ||
638 | it under the terms of the GNU General Public License as published by | ||
639 | the Free Software Foundation, either version 3 of the License, or | ||
640 | (at your option) any later version. | ||
641 | |||
642 | This program is distributed in the hope that it will be useful, | ||
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
645 | GNU General Public License for more details. | ||
646 | |||
647 | You should have received a copy of the GNU General Public License | ||
648 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
649 | |||
650 | Also add information on how to contact you by electronic and paper mail. | ||
651 | |||
652 | If the program does terminal interaction, make it output a short | ||
653 | notice like this when it starts in an interactive mode: | ||
654 | |||
655 | <program> Copyright (C) <year> <name of author> | ||
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | ||
657 | This is free software, and you are welcome to redistribute it | ||
658 | under certain conditions; type `show c' for details. | ||
659 | |||
660 | The hypothetical commands `show w' and `show c' should show the appropriate | ||
661 | parts of the General Public License. Of course, your program's commands | ||
662 | might be different; for a GUI interface, you would use an "about box". | ||
663 | |||
664 | You should also get your employer (if you work as a programmer) or school, | ||
665 | if any, to sign a "copyright disclaimer" for the program, if necessary. | ||
666 | For more information on this, and how to apply and follow the GNU GPL, see | ||
667 | <http://www.gnu.org/licenses/>. | ||
668 | |||
669 | The GNU General Public License does not permit incorporating your program | ||
670 | into proprietary programs. If your program is a subroutine library, you | ||
671 | may consider it more useful to permit linking proprietary applications with | ||
672 | the library. If this is what you want to do, use the GNU Lesser General | ||
673 | Public License instead of this License. But first, please read | ||
674 | <http://www.gnu.org/philosophy/why-not-lgpl.html>. \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv2.1 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv2.1 new file mode 100644 index 0000000..fc3ffda --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv2.1 | |||
@@ -0,0 +1,502 @@ | |||
1 | GNU LESSER GENERAL PUBLIC LICENSE | ||
2 | Version 2.1, February 1999 | ||
3 | |||
4 | Copyright (C) 1991, 1999 Free Software Foundation, Inc. | ||
5 | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
6 | Everyone is permitted to copy and distribute verbatim copies | ||
7 | of this license document, but changing it is not allowed. | ||
8 | |||
9 | [This is the first released version of the Lesser GPL. It also counts | ||
10 | as the successor of the GNU Library Public License, version 2, hence | ||
11 | the version number 2.1.] | ||
12 | |||
13 | Preamble | ||
14 | |||
15 | The licenses for most software are designed to take away your | ||
16 | freedom to share and change it. By contrast, the GNU General Public | ||
17 | Licenses are intended to guarantee your freedom to share and change | ||
18 | free software--to make sure the software is free for all its users. | ||
19 | |||
20 | This license, the Lesser General Public License, applies to some | ||
21 | specially designated software packages--typically libraries--of the | ||
22 | Free Software Foundation and other authors who decide to use it. You | ||
23 | can use it too, but we suggest you first think carefully about whether | ||
24 | this license or the ordinary General Public License is the better | ||
25 | strategy to use in any particular case, based on the explanations below. | ||
26 | |||
27 | When we speak of free software, we are referring to freedom of use, | ||
28 | not price. Our General Public Licenses are designed to make sure that | ||
29 | you have the freedom to distribute copies of free software (and charge | ||
30 | for this service if you wish); that you receive source code or can get | ||
31 | it if you want it; that you can change the software and use pieces of | ||
32 | it in new free programs; and that you are informed that you can do | ||
33 | these things. | ||
34 | |||
35 | To protect your rights, we need to make restrictions that forbid | ||
36 | distributors to deny you these rights or to ask you to surrender these | ||
37 | rights. These restrictions translate to certain responsibilities for | ||
38 | you if you distribute copies of the library or if you modify it. | ||
39 | |||
40 | For example, if you distribute copies of the library, whether gratis | ||
41 | or for a fee, you must give the recipients all the rights that we gave | ||
42 | you. You must make sure that they, too, receive or can get the source | ||
43 | code. If you link other code with the library, you must provide | ||
44 | complete object files to the recipients, so that they can relink them | ||
45 | with the library after making changes to the library and recompiling | ||
46 | it. And you must show them these terms so they know their rights. | ||
47 | |||
48 | We protect your rights with a two-step method: (1) we copyright the | ||
49 | library, and (2) we offer you this license, which gives you legal | ||
50 | permission to copy, distribute and/or modify the library. | ||
51 | |||
52 | To protect each distributor, we want to make it very clear that | ||
53 | there is no warranty for the free library. Also, if the library is | ||
54 | modified by someone else and passed on, the recipients should know | ||
55 | that what they have is not the original version, so that the original | ||
56 | author's reputation will not be affected by problems that might be | ||
57 | introduced by others. | ||
58 | |||
59 | Finally, software patents pose a constant threat to the existence of | ||
60 | any free program. We wish to make sure that a company cannot | ||
61 | effectively restrict the users of a free program by obtaining a | ||
62 | restrictive license from a patent holder. Therefore, we insist that | ||
63 | any patent license obtained for a version of the library must be | ||
64 | consistent with the full freedom of use specified in this license. | ||
65 | |||
66 | Most GNU software, including some libraries, is covered by the | ||
67 | ordinary GNU General Public License. This license, the GNU Lesser | ||
68 | General Public License, applies to certain designated libraries, and | ||
69 | is quite different from the ordinary General Public License. We use | ||
70 | this license for certain libraries in order to permit linking those | ||
71 | libraries into non-free programs. | ||
72 | |||
73 | When a program is linked with a library, whether statically or using | ||
74 | a shared library, the combination of the two is legally speaking a | ||
75 | combined work, a derivative of the original library. The ordinary | ||
76 | General Public License therefore permits such linking only if the | ||
77 | entire combination fits its criteria of freedom. The Lesser General | ||
78 | Public License permits more lax criteria for linking other code with | ||
79 | the library. | ||
80 | |||
81 | We call this license the "Lesser" General Public License because it | ||
82 | does Less to protect the user's freedom than the ordinary General | ||
83 | Public License. It also provides other free software developers Less | ||
84 | of an advantage over competing non-free programs. These disadvantages | ||
85 | are the reason we use the ordinary General Public License for many | ||
86 | libraries. However, the Lesser license provides advantages in certain | ||
87 | special circumstances. | ||
88 | |||
89 | For example, on rare occasions, there may be a special need to | ||
90 | encourage the widest possible use of a certain library, so that it becomes | ||
91 | a de-facto standard. To achieve this, non-free programs must be | ||
92 | allowed to use the library. A more frequent case is that a free | ||
93 | library does the same job as widely used non-free libraries. In this | ||
94 | case, there is little to gain by limiting the free library to free | ||
95 | software only, so we use the Lesser General Public License. | ||
96 | |||
97 | In other cases, permission to use a particular library in non-free | ||
98 | programs enables a greater number of people to use a large body of | ||
99 | free software. For example, permission to use the GNU C Library in | ||
100 | non-free programs enables many more people to use the whole GNU | ||
101 | operating system, as well as its variant, the GNU/Linux operating | ||
102 | system. | ||
103 | |||
104 | Although the Lesser General Public License is Less protective of the | ||
105 | users' freedom, it does ensure that the user of a program that is | ||
106 | linked with the Library has the freedom and the wherewithal to run | ||
107 | that program using a modified version of the Library. | ||
108 | |||
109 | The precise terms and conditions for copying, distribution and | ||
110 | modification follow. Pay close attention to the difference between a | ||
111 | "work based on the library" and a "work that uses the library". The | ||
112 | former contains code derived from the library, whereas the latter must | ||
113 | be combined with the library in order to run. | ||
114 | |||
115 | GNU LESSER GENERAL PUBLIC LICENSE | ||
116 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
117 | |||
118 | 0. This License Agreement applies to any software library or other | ||
119 | program which contains a notice placed by the copyright holder or | ||
120 | other authorized party saying it may be distributed under the terms of | ||
121 | this Lesser General Public License (also called "this License"). | ||
122 | Each licensee is addressed as "you". | ||
123 | |||
124 | A "library" means a collection of software functions and/or data | ||
125 | prepared so as to be conveniently linked with application programs | ||
126 | (which use some of those functions and data) to form executables. | ||
127 | |||
128 | The "Library", below, refers to any such software library or work | ||
129 | which has been distributed under these terms. A "work based on the | ||
130 | Library" means either the Library or any derivative work under | ||
131 | copyright law: that is to say, a work containing the Library or a | ||
132 | portion of it, either verbatim or with modifications and/or translated | ||
133 | straightforwardly into another language. (Hereinafter, translation is | ||
134 | included without limitation in the term "modification".) | ||
135 | |||
136 | "Source code" for a work means the preferred form of the work for | ||
137 | making modifications to it. For a library, complete source code means | ||
138 | all the source code for all modules it contains, plus any associated | ||
139 | interface definition files, plus the scripts used to control compilation | ||
140 | and installation of the library. | ||
141 | |||
142 | Activities other than copying, distribution and modification are not | ||
143 | covered by this License; they are outside its scope. The act of | ||
144 | running a program using the Library is not restricted, and output from | ||
145 | such a program is covered only if its contents constitute a work based | ||
146 | on the Library (independent of the use of the Library in a tool for | ||
147 | writing it). Whether that is true depends on what the Library does | ||
148 | and what the program that uses the Library does. | ||
149 | |||
150 | 1. You may copy and distribute verbatim copies of the Library's | ||
151 | complete source code as you receive it, in any medium, provided that | ||
152 | you conspicuously and appropriately publish on each copy an | ||
153 | appropriate copyright notice and disclaimer of warranty; keep intact | ||
154 | all the notices that refer to this License and to the absence of any | ||
155 | warranty; and distribute a copy of this License along with the | ||
156 | Library. | ||
157 | |||
158 | You may charge a fee for the physical act of transferring a copy, | ||
159 | and you may at your option offer warranty protection in exchange for a | ||
160 | fee. | ||
161 | |||
162 | 2. You may modify your copy or copies of the Library or any portion | ||
163 | of it, thus forming a work based on the Library, and copy and | ||
164 | distribute such modifications or work under the terms of Section 1 | ||
165 | above, provided that you also meet all of these conditions: | ||
166 | |||
167 | a) The modified work must itself be a software library. | ||
168 | |||
169 | b) You must cause the files modified to carry prominent notices | ||
170 | stating that you changed the files and the date of any change. | ||
171 | |||
172 | c) You must cause the whole of the work to be licensed at no | ||
173 | charge to all third parties under the terms of this License. | ||
174 | |||
175 | d) If a facility in the modified Library refers to a function or a | ||
176 | table of data to be supplied by an application program that uses | ||
177 | the facility, other than as an argument passed when the facility | ||
178 | is invoked, then you must make a good faith effort to ensure that, | ||
179 | in the event an application does not supply such function or | ||
180 | table, the facility still operates, and performs whatever part of | ||
181 | its purpose remains meaningful. | ||
182 | |||
183 | (For example, a function in a library to compute square roots has | ||
184 | a purpose that is entirely well-defined independent of the | ||
185 | application. Therefore, Subsection 2d requires that any | ||
186 | application-supplied function or table used by this function must | ||
187 | be optional: if the application does not supply it, the square | ||
188 | root function must still compute square roots.) | ||
189 | |||
190 | These requirements apply to the modified work as a whole. If | ||
191 | identifiable sections of that work are not derived from the Library, | ||
192 | and can be reasonably considered independent and separate works in | ||
193 | themselves, then this License, and its terms, do not apply to those | ||
194 | sections when you distribute them as separate works. But when you | ||
195 | distribute the same sections as part of a whole which is a work based | ||
196 | on the Library, the distribution of the whole must be on the terms of | ||
197 | this License, whose permissions for other licensees extend to the | ||
198 | entire whole, and thus to each and every part regardless of who wrote | ||
199 | it. | ||
200 | |||
201 | Thus, it is not the intent of this section to claim rights or contest | ||
202 | your rights to work written entirely by you; rather, the intent is to | ||
203 | exercise the right to control the distribution of derivative or | ||
204 | collective works based on the Library. | ||
205 | |||
206 | In addition, mere aggregation of another work not based on the Library | ||
207 | with the Library (or with a work based on the Library) on a volume of | ||
208 | a storage or distribution medium does not bring the other work under | ||
209 | the scope of this License. | ||
210 | |||
211 | 3. You may opt to apply the terms of the ordinary GNU General Public | ||
212 | License instead of this License to a given copy of the Library. To do | ||
213 | this, you must alter all the notices that refer to this License, so | ||
214 | that they refer to the ordinary GNU General Public License, version 2, | ||
215 | instead of to this License. (If a newer version than version 2 of the | ||
216 | ordinary GNU General Public License has appeared, then you can specify | ||
217 | that version instead if you wish.) Do not make any other change in | ||
218 | these notices. | ||
219 | |||
220 | Once this change is made in a given copy, it is irreversible for | ||
221 | that copy, so the ordinary GNU General Public License applies to all | ||
222 | subsequent copies and derivative works made from that copy. | ||
223 | |||
224 | This option is useful when you wish to copy part of the code of | ||
225 | the Library into a program that is not a library. | ||
226 | |||
227 | 4. You may copy and distribute the Library (or a portion or | ||
228 | derivative of it, under Section 2) in object code or executable form | ||
229 | under the terms of Sections 1 and 2 above provided that you accompany | ||
230 | it with the complete corresponding machine-readable source code, which | ||
231 | must be distributed under the terms of Sections 1 and 2 above on a | ||
232 | medium customarily used for software interchange. | ||
233 | |||
234 | If distribution of object code is made by offering access to copy | ||
235 | from a designated place, then offering equivalent access to copy the | ||
236 | source code from the same place satisfies the requirement to | ||
237 | distribute the source code, even though third parties are not | ||
238 | compelled to copy the source along with the object code. | ||
239 | |||
240 | 5. A program that contains no derivative of any portion of the | ||
241 | Library, but is designed to work with the Library by being compiled or | ||
242 | linked with it, is called a "work that uses the Library". Such a | ||
243 | work, in isolation, is not a derivative work of the Library, and | ||
244 | therefore falls outside the scope of this License. | ||
245 | |||
246 | However, linking a "work that uses the Library" with the Library | ||
247 | creates an executable that is a derivative of the Library (because it | ||
248 | contains portions of the Library), rather than a "work that uses the | ||
249 | library". The executable is therefore covered by this License. | ||
250 | Section 6 states terms for distribution of such executables. | ||
251 | |||
252 | When a "work that uses the Library" uses material from a header file | ||
253 | that is part of the Library, the object code for the work may be a | ||
254 | derivative work of the Library even though the source code is not. | ||
255 | Whether this is true is especially significant if the work can be | ||
256 | linked without the Library, or if the work is itself a library. The | ||
257 | threshold for this to be true is not precisely defined by law. | ||
258 | |||
259 | If such an object file uses only numerical parameters, data | ||
260 | structure layouts and accessors, and small macros and small inline | ||
261 | functions (ten lines or less in length), then the use of the object | ||
262 | file is unrestricted, regardless of whether it is legally a derivative | ||
263 | work. (Executables containing this object code plus portions of the | ||
264 | Library will still fall under Section 6.) | ||
265 | |||
266 | Otherwise, if the work is a derivative of the Library, you may | ||
267 | distribute the object code for the work under the terms of Section 6. | ||
268 | Any executables containing that work also fall under Section 6, | ||
269 | whether or not they are linked directly with the Library itself. | ||
270 | |||
271 | 6. As an exception to the Sections above, you may also combine or | ||
272 | link a "work that uses the Library" with the Library to produce a | ||
273 | work containing portions of the Library, and distribute that work | ||
274 | under terms of your choice, provided that the terms permit | ||
275 | modification of the work for the customer's own use and reverse | ||
276 | engineering for debugging such modifications. | ||
277 | |||
278 | You must give prominent notice with each copy of the work that the | ||
279 | Library is used in it and that the Library and its use are covered by | ||
280 | this License. You must supply a copy of this License. If the work | ||
281 | during execution displays copyright notices, you must include the | ||
282 | copyright notice for the Library among them, as well as a reference | ||
283 | directing the user to the copy of this License. Also, you must do one | ||
284 | of these things: | ||
285 | |||
286 | a) Accompany the work with the complete corresponding | ||
287 | machine-readable source code for the Library including whatever | ||
288 | changes were used in the work (which must be distributed under | ||
289 | Sections 1 and 2 above); and, if the work is an executable linked | ||
290 | with the Library, with the complete machine-readable "work that | ||
291 | uses the Library", as object code and/or source code, so that the | ||
292 | user can modify the Library and then relink to produce a modified | ||
293 | executable containing the modified Library. (It is understood | ||
294 | that the user who changes the contents of definitions files in the | ||
295 | Library will not necessarily be able to recompile the application | ||
296 | to use the modified definitions.) | ||
297 | |||
298 | b) Use a suitable shared library mechanism for linking with the | ||
299 | Library. A suitable mechanism is one that (1) uses at run time a | ||
300 | copy of the library already present on the user's computer system, | ||
301 | rather than copying library functions into the executable, and (2) | ||
302 | will operate properly with a modified version of the library, if | ||
303 | the user installs one, as long as the modified version is | ||
304 | interface-compatible with the version that the work was made with. | ||
305 | |||
306 | c) Accompany the work with a written offer, valid for at | ||
307 | least three years, to give the same user the materials | ||
308 | specified in Subsection 6a, above, for a charge no more | ||
309 | than the cost of performing this distribution. | ||
310 | |||
311 | d) If distribution of the work is made by offering access to copy | ||
312 | from a designated place, offer equivalent access to copy the above | ||
313 | specified materials from the same place. | ||
314 | |||
315 | e) Verify that the user has already received a copy of these | ||
316 | materials or that you have already sent this user a copy. | ||
317 | |||
318 | For an executable, the required form of the "work that uses the | ||
319 | Library" must include any data and utility programs needed for | ||
320 | reproducing the executable from it. However, as a special exception, | ||
321 | the materials to be distributed need not include anything that is | ||
322 | normally distributed (in either source or binary form) with the major | ||
323 | components (compiler, kernel, and so on) of the operating system on | ||
324 | which the executable runs, unless that component itself accompanies | ||
325 | the executable. | ||
326 | |||
327 | It may happen that this requirement contradicts the license | ||
328 | restrictions of other proprietary libraries that do not normally | ||
329 | accompany the operating system. Such a contradiction means you cannot | ||
330 | use both them and the Library together in an executable that you | ||
331 | distribute. | ||
332 | |||
333 | 7. You may place library facilities that are a work based on the | ||
334 | Library side-by-side in a single library together with other library | ||
335 | facilities not covered by this License, and distribute such a combined | ||
336 | library, provided that the separate distribution of the work based on | ||
337 | the Library and of the other library facilities is otherwise | ||
338 | permitted, and provided that you do these two things: | ||
339 | |||
340 | a) Accompany the combined library with a copy of the same work | ||
341 | based on the Library, uncombined with any other library | ||
342 | facilities. This must be distributed under the terms of the | ||
343 | Sections above. | ||
344 | |||
345 | b) Give prominent notice with the combined library of the fact | ||
346 | that part of it is a work based on the Library, and explaining | ||
347 | where to find the accompanying uncombined form of the same work. | ||
348 | |||
349 | 8. You may not copy, modify, sublicense, link with, or distribute | ||
350 | the Library except as expressly provided under this License. Any | ||
351 | attempt otherwise to copy, modify, sublicense, link with, or | ||
352 | distribute the Library is void, and will automatically terminate your | ||
353 | rights under this License. However, parties who have received copies, | ||
354 | or rights, from you under this License will not have their licenses | ||
355 | terminated so long as such parties remain in full compliance. | ||
356 | |||
357 | 9. You are not required to accept this License, since you have not | ||
358 | signed it. However, nothing else grants you permission to modify or | ||
359 | distribute the Library or its derivative works. These actions are | ||
360 | prohibited by law if you do not accept this License. Therefore, by | ||
361 | modifying or distributing the Library (or any work based on the | ||
362 | Library), you indicate your acceptance of this License to do so, and | ||
363 | all its terms and conditions for copying, distributing or modifying | ||
364 | the Library or works based on it. | ||
365 | |||
366 | 10. Each time you redistribute the Library (or any work based on the | ||
367 | Library), the recipient automatically receives a license from the | ||
368 | original licensor to copy, distribute, link with or modify the Library | ||
369 | subject to these terms and conditions. You may not impose any further | ||
370 | restrictions on the recipients' exercise of the rights granted herein. | ||
371 | You are not responsible for enforcing compliance by third parties with | ||
372 | this License. | ||
373 | |||
374 | 11. If, as a consequence of a court judgment or allegation of patent | ||
375 | infringement or for any other reason (not limited to patent issues), | ||
376 | conditions are imposed on you (whether by court order, agreement or | ||
377 | otherwise) that contradict the conditions of this License, they do not | ||
378 | excuse you from the conditions of this License. If you cannot | ||
379 | distribute so as to satisfy simultaneously your obligations under this | ||
380 | License and any other pertinent obligations, then as a consequence you | ||
381 | may not distribute the Library at all. For example, if a patent | ||
382 | license would not permit royalty-free redistribution of the Library by | ||
383 | all those who receive copies directly or indirectly through you, then | ||
384 | the only way you could satisfy both it and this License would be to | ||
385 | refrain entirely from distribution of the Library. | ||
386 | |||
387 | If any portion of this section is held invalid or unenforceable under any | ||
388 | particular circumstance, the balance of the section is intended to apply, | ||
389 | and the section as a whole is intended to apply in other circumstances. | ||
390 | |||
391 | It is not the purpose of this section to induce you to infringe any | ||
392 | patents or other property right claims or to contest validity of any | ||
393 | such claims; this section has the sole purpose of protecting the | ||
394 | integrity of the free software distribution system which is | ||
395 | implemented by public license practices. Many people have made | ||
396 | generous contributions to the wide range of software distributed | ||
397 | through that system in reliance on consistent application of that | ||
398 | system; it is up to the author/donor to decide if he or she is willing | ||
399 | to distribute software through any other system and a licensee cannot | ||
400 | impose that choice. | ||
401 | |||
402 | This section is intended to make thoroughly clear what is believed to | ||
403 | be a consequence of the rest of this License. | ||
404 | |||
405 | 12. If the distribution and/or use of the Library is restricted in | ||
406 | certain countries either by patents or by copyrighted interfaces, the | ||
407 | original copyright holder who places the Library under this License may add | ||
408 | an explicit geographical distribution limitation excluding those countries, | ||
409 | so that distribution is permitted only in or among countries not thus | ||
410 | excluded. In such case, this License incorporates the limitation as if | ||
411 | written in the body of this License. | ||
412 | |||
413 | 13. The Free Software Foundation may publish revised and/or new | ||
414 | versions of the Lesser General Public License from time to time. | ||
415 | Such new versions will be similar in spirit to the present version, | ||
416 | but may differ in detail to address new problems or concerns. | ||
417 | |||
418 | Each version is given a distinguishing version number. If the Library | ||
419 | specifies a version number of this License which applies to it and | ||
420 | "any later version", you have the option of following the terms and | ||
421 | conditions either of that version or of any later version published by | ||
422 | the Free Software Foundation. If the Library does not specify a | ||
423 | license version number, you may choose any version ever published by | ||
424 | the Free Software Foundation. | ||
425 | |||
426 | 14. If you wish to incorporate parts of the Library into other free | ||
427 | programs whose distribution conditions are incompatible with these, | ||
428 | write to the author to ask for permission. For software which is | ||
429 | copyrighted by the Free Software Foundation, write to the Free | ||
430 | Software Foundation; we sometimes make exceptions for this. Our | ||
431 | decision will be guided by the two goals of preserving the free status | ||
432 | of all derivatives of our free software and of promoting the sharing | ||
433 | and reuse of software generally. | ||
434 | |||
435 | NO WARRANTY | ||
436 | |||
437 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO | ||
438 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. | ||
439 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR | ||
440 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY | ||
441 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE | ||
442 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
443 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE | ||
444 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME | ||
445 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | ||
446 | |||
447 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN | ||
448 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY | ||
449 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU | ||
450 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR | ||
451 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE | ||
452 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING | ||
453 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A | ||
454 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF | ||
455 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | ||
456 | DAMAGES. | ||
457 | |||
458 | END OF TERMS AND CONDITIONS | ||
459 | |||
460 | How to Apply These Terms to Your New Libraries | ||
461 | |||
462 | If you develop a new library, and you want it to be of the greatest | ||
463 | possible use to the public, we recommend making it free software that | ||
464 | everyone can redistribute and change. You can do so by permitting | ||
465 | redistribution under these terms (or, alternatively, under the terms of the | ||
466 | ordinary General Public License). | ||
467 | |||
468 | To apply these terms, attach the following notices to the library. It is | ||
469 | safest to attach them to the start of each source file to most effectively | ||
470 | convey the exclusion of warranty; and each file should have at least the | ||
471 | "copyright" line and a pointer to where the full notice is found. | ||
472 | |||
473 | <one line to give the library's name and a brief idea of what it does.> | ||
474 | Copyright (C) <year> <name of author> | ||
475 | |||
476 | This library is free software; you can redistribute it and/or | ||
477 | modify it under the terms of the GNU Lesser General Public | ||
478 | License as published by the Free Software Foundation; either | ||
479 | version 2.1 of the License, or (at your option) any later version. | ||
480 | |||
481 | This library is distributed in the hope that it will be useful, | ||
482 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
483 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
484 | Lesser General Public License for more details. | ||
485 | |||
486 | You should have received a copy of the GNU Lesser General Public | ||
487 | License along with this library; if not, write to the Free Software | ||
488 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
489 | |||
490 | Also add information on how to contact you by electronic and paper mail. | ||
491 | |||
492 | You should also get your employer (if you work as a programmer) or your | ||
493 | school, if any, to sign a "copyright disclaimer" for the library, if | ||
494 | necessary. Here is a sample; alter the names: | ||
495 | |||
496 | Yoyodyne, Inc., hereby disclaims all copyright interest in the | ||
497 | library `Frob' (a library for tweaking knobs) written by James Random Hacker. | ||
498 | |||
499 | <signature of Ty Coon>, 1 April 1990 | ||
500 | Ty Coon, President of Vice | ||
501 | |||
502 | That's all there is to it! \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv3 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv3 new file mode 100644 index 0000000..3f9959f --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_LGPLv3 | |||
@@ -0,0 +1,165 @@ | |||
1 | GNU LESSER GENERAL PUBLIC LICENSE | ||
2 | Version 3, 29 June 2007 | ||
3 | |||
4 | Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | ||
5 | Everyone is permitted to copy and distribute verbatim copies | ||
6 | of this license document, but changing it is not allowed. | ||
7 | |||
8 | |||
9 | This version of the GNU Lesser General Public License incorporates | ||
10 | the terms and conditions of version 3 of the GNU General Public | ||
11 | License, supplemented by the additional permissions listed below. | ||
12 | |||
13 | 0. Additional Definitions. | ||
14 | |||
15 | As used herein, "this License" refers to version 3 of the GNU Lesser | ||
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU | ||
17 | General Public License. | ||
18 | |||
19 | "The Library" refers to a covered work governed by this License, | ||
20 | other than an Application or a Combined Work as defined below. | ||
21 | |||
22 | An "Application" is any work that makes use of an interface provided | ||
23 | by the Library, but which is not otherwise based on the Library. | ||
24 | Defining a subclass of a class defined by the Library is deemed a mode | ||
25 | of using an interface provided by the Library. | ||
26 | |||
27 | A "Combined Work" is a work produced by combining or linking an | ||
28 | Application with the Library. The particular version of the Library | ||
29 | with which the Combined Work was made is also called the "Linked | ||
30 | Version". | ||
31 | |||
32 | The "Minimal Corresponding Source" for a Combined Work means the | ||
33 | Corresponding Source for the Combined Work, excluding any source code | ||
34 | for portions of the Combined Work that, considered in isolation, are | ||
35 | based on the Application, and not on the Linked Version. | ||
36 | |||
37 | The "Corresponding Application Code" for a Combined Work means the | ||
38 | object code and/or source code for the Application, including any data | ||
39 | and utility programs needed for reproducing the Combined Work from the | ||
40 | Application, but excluding the System Libraries of the Combined Work. | ||
41 | |||
42 | 1. Exception to Section 3 of the GNU GPL. | ||
43 | |||
44 | You may convey a covered work under sections 3 and 4 of this License | ||
45 | without being bound by section 3 of the GNU GPL. | ||
46 | |||
47 | 2. Conveying Modified Versions. | ||
48 | |||
49 | If you modify a copy of the Library, and, in your modifications, a | ||
50 | facility refers to a function or data to be supplied by an Application | ||
51 | that uses the facility (other than as an argument passed when the | ||
52 | facility is invoked), then you may convey a copy of the modified | ||
53 | version: | ||
54 | |||
55 | a) under this License, provided that you make a good faith effort to | ||
56 | ensure that, in the event an Application does not supply the | ||
57 | function or data, the facility still operates, and performs | ||
58 | whatever part of its purpose remains meaningful, or | ||
59 | |||
60 | b) under the GNU GPL, with none of the additional permissions of | ||
61 | this License applicable to that copy. | ||
62 | |||
63 | 3. Object Code Incorporating Material from Library Header Files. | ||
64 | |||
65 | The object code form of an Application may incorporate material from | ||
66 | a header file that is part of the Library. You may convey such object | ||
67 | code under terms of your choice, provided that, if the incorporated | ||
68 | material is not limited to numerical parameters, data structure | ||
69 | layouts and accessors, or small macros, inline functions and templates | ||
70 | (ten or fewer lines in length), you do both of the following: | ||
71 | |||
72 | a) Give prominent notice with each copy of the object code that the | ||
73 | Library is used in it and that the Library and its use are | ||
74 | covered by this License. | ||
75 | |||
76 | b) Accompany the object code with a copy of the GNU GPL and this license | ||
77 | document. | ||
78 | |||
79 | 4. Combined Works. | ||
80 | |||
81 | You may convey a Combined Work under terms of your choice that, | ||
82 | taken together, effectively do not restrict modification of the | ||
83 | portions of the Library contained in the Combined Work and reverse | ||
84 | engineering for debugging such modifications, if you also do each of | ||
85 | the following: | ||
86 | |||
87 | a) Give prominent notice with each copy of the Combined Work that | ||
88 | the Library is used in it and that the Library and its use are | ||
89 | covered by this License. | ||
90 | |||
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license | ||
92 | document. | ||
93 | |||
94 | c) For a Combined Work that displays copyright notices during | ||
95 | execution, include the copyright notice for the Library among | ||
96 | these notices, as well as a reference directing the user to the | ||
97 | copies of the GNU GPL and this license document. | ||
98 | |||
99 | d) Do one of the following: | ||
100 | |||
101 | 0) Convey the Minimal Corresponding Source under the terms of this | ||
102 | License, and the Corresponding Application Code in a form | ||
103 | suitable for, and under terms that permit, the user to | ||
104 | recombine or relink the Application with a modified version of | ||
105 | the Linked Version to produce a modified Combined Work, in the | ||
106 | manner specified by section 6 of the GNU GPL for conveying | ||
107 | Corresponding Source. | ||
108 | |||
109 | 1) Use a suitable shared library mechanism for linking with the | ||
110 | Library. A suitable mechanism is one that (a) uses at run time | ||
111 | a copy of the Library already present on the user's computer | ||
112 | system, and (b) will operate properly with a modified version | ||
113 | of the Library that is interface-compatible with the Linked | ||
114 | Version. | ||
115 | |||
116 | e) Provide Installation Information, but only if you would otherwise | ||
117 | be required to provide such information under section 6 of the | ||
118 | GNU GPL, and only to the extent that such information is | ||
119 | necessary to install and execute a modified version of the | ||
120 | Combined Work produced by recombining or relinking the | ||
121 | Application with a modified version of the Linked Version. (If | ||
122 | you use option 4d0, the Installation Information must accompany | ||
123 | the Minimal Corresponding Source and Corresponding Application | ||
124 | Code. If you use option 4d1, you must provide the Installation | ||
125 | Information in the manner specified by section 6 of the GNU GPL | ||
126 | for conveying Corresponding Source.) | ||
127 | |||
128 | 5. Combined Libraries. | ||
129 | |||
130 | You may place library facilities that are a work based on the | ||
131 | Library side by side in a single library together with other library | ||
132 | facilities that are not Applications and are not covered by this | ||
133 | License, and convey such a combined library under terms of your | ||
134 | choice, if you do both of the following: | ||
135 | |||
136 | a) Accompany the combined library with a copy of the same work based | ||
137 | on the Library, uncombined with any other library facilities, | ||
138 | conveyed under the terms of this License. | ||
139 | |||
140 | b) Give prominent notice with the combined library that part of it | ||
141 | is a work based on the Library, and explaining where to find the | ||
142 | accompanying uncombined form of the same work. | ||
143 | |||
144 | 6. Revised Versions of the GNU Lesser General Public License. | ||
145 | |||
146 | The Free Software Foundation may publish revised and/or new versions | ||
147 | of the GNU Lesser General Public License from time to time. Such new | ||
148 | versions will be similar in spirit to the present version, but may | ||
149 | differ in detail to address new problems or concerns. | ||
150 | |||
151 | Each version is given a distinguishing version number. If the | ||
152 | Library as you received it specifies that a certain numbered version | ||
153 | of the GNU Lesser General Public License "or any later version" | ||
154 | applies to it, you have the option of following the terms and | ||
155 | conditions either of that published version or of any later version | ||
156 | published by the Free Software Foundation. If the Library as you | ||
157 | received it does not specify a version number of the GNU Lesser | ||
158 | General Public License, you may choose any version of the GNU Lesser | ||
159 | General Public License ever published by the Free Software Foundation. | ||
160 | |||
161 | If the Library as you received it specifies that a proxy can decide | ||
162 | whether future versions of the GNU Lesser General Public License shall | ||
163 | apply, that proxy's public statement of acceptance of any version is | ||
164 | permanent authorization for you to choose that version for the | ||
165 | Library. \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_MIT b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_MIT new file mode 100644 index 0000000..d827307 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_MIT | |||
@@ -0,0 +1,19 @@ | |||
1 | All rights reserved. | ||
2 | |||
3 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
4 | of this software and associated documentation files (the "Software"), to deal | ||
5 | in the Software without restriction, including without limitation the rights | ||
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
7 | copies of the Software, and to permit persons to whom the Software is | ||
8 | furnished to do so, subject to the following conditions: | ||
9 | |||
10 | The above copyright notice and this permission notice shall be included in | ||
11 | all copies or substantial portions of the Software. | ||
12 | |||
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
19 | THE SOFTWARE. \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_Other b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_Other new file mode 100644 index 0000000..54c4590 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/COPYING_Other | |||
@@ -0,0 +1 @@ | |||
<Place your desired license here.> \ No newline at end of file | |||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_BSD b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_BSD new file mode 100644 index 0000000..14bdd06 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_BSD | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Copyright (C) $(copyright). | ||
3 | * | ||
4 | * Author: $(author) | ||
5 | * | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions are met: | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * * Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * * Neither the name of the PG_ORGANIZATION nor the | ||
15 | * names of its contributors may be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS-IS" | ||
19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
28 | * POSSIBILITY OF SUCH DAMAGE. | ||
29 | */ \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2 new file mode 100644 index 0000000..591c14e --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2 | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * Copyright (C) $(copyright). | ||
3 | * | ||
4 | * Author: $(author) | ||
5 | * | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the Free | ||
9 | * Software Foundation; version 2 of the License. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
14 | * for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., 59 | ||
18 | * Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2_or_later b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2_or_later new file mode 100644 index 0000000..0dae49f --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv2_or_later | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Copyright (C) $(copyright). | ||
3 | * | ||
4 | * Author: $(author) | ||
5 | * | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU Library General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
20 | * 02111-1307, USA. | ||
21 | */ \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv3 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv3 new file mode 100644 index 0000000..c7953e5 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_GPLv3 | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * Copyright (C) $(copyright). | ||
3 | * | ||
4 | * Author: $(author) | ||
5 | * | ||
6 | * | ||
7 | * This program is free software: you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation, either version 3 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv2.1 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv2.1 new file mode 100644 index 0000000..40a9603 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv2.1 | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * Copyright (C) $(copyright). | ||
3 | * | ||
4 | * Author: $(author) | ||
5 | * | ||
6 | * | ||
7 | * This library is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU Lesser General Public License | ||
9 | * version 2.1 as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This library is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with this library; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
19 | * 02110-1301 USA | ||
20 | */ \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv3 b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv3 new file mode 100644 index 0000000..2581a03 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_LGPLv3 | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * Copyright (C) $(copyright). | ||
3 | * | ||
4 | * Author: $(author) | ||
5 | * | ||
6 | * | ||
7 | * This library is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU Lesser General Public License | ||
9 | * version 3 as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This library is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with this library; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
19 | * 02110-1301 USA | ||
20 | */ \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_MIT b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_MIT new file mode 100644 index 0000000..0ee5519 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_MIT | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Copyright (C) $(copyright). | ||
3 | * | ||
4 | * Author: $(author) | ||
5 | * | ||
6 | * | ||
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
8 | * of this software and associated documentation files (the "Software"), to deal | ||
9 | * in the Software without restriction, including without limitation the rights | ||
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
11 | * copies of the Software, and to permit persons to whom the Software is | ||
12 | * furnished to do so, subject to the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice shall be included in | ||
15 | * all copies or substantial portions of the Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
23 | * THE SOFTWARE. | ||
24 | */ \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_Other b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_Other new file mode 100644 index 0000000..1f28ac0 --- /dev/null +++ b/plugins/org.yocto.sdk.ide/templates/projecttemplates/Licenses/Header_Other | |||
@@ -0,0 +1,9 @@ | |||
1 | /* | ||
2 | * Copyright (C) $(copyright). | ||
3 | * | ||
4 | * Author: $(author) | ||
5 | * | ||
6 | * | ||
7 | * Your desired license | ||
8 | * | ||
9 | */ \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.remotetools/.classpath b/plugins/org.yocto.sdk.remotetools/.classpath new file mode 100644 index 0000000..da264cc --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/.classpath | |||
@@ -0,0 +1,8 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <classpath> | ||
3 | <classpathentry kind="lib" path="lib/json-simple-1.1.1.jar"/> | ||
4 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
5 | <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
6 | <classpathentry kind="src" path="src"/> | ||
7 | <classpathentry kind="output" path="bin"/> | ||
8 | </classpath> | ||
diff --git a/plugins/org.yocto.sdk.remotetools/.project b/plugins/org.yocto.sdk.remotetools/.project new file mode 100644 index 0000000..6a68bf4 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/.project | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.sdk.remotetools</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | <buildCommand> | ||
9 | <name>org.eclipse.jdt.core.javabuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | <buildCommand> | ||
14 | <name>org.eclipse.pde.ManifestBuilder</name> | ||
15 | <arguments> | ||
16 | </arguments> | ||
17 | </buildCommand> | ||
18 | <buildCommand> | ||
19 | <name>org.eclipse.pde.SchemaBuilder</name> | ||
20 | <arguments> | ||
21 | </arguments> | ||
22 | </buildCommand> | ||
23 | </buildSpec> | ||
24 | <natures> | ||
25 | <nature>org.eclipse.pde.PluginNature</nature> | ||
26 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
27 | </natures> | ||
28 | </projectDescription> | ||
diff --git a/plugins/org.yocto.sdk.remotetools/.settings/org.eclipse.jdt.core.prefs b/plugins/org.yocto.sdk.remotetools/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..9b2f22e --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/.settings/org.eclipse.jdt.core.prefs | |||
@@ -0,0 +1,8 @@ | |||
1 | #Wed Aug 11 12:07:02 CST 2010 | ||
2 | eclipse.preferences.version=1 | ||
3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
5 | org.eclipse.jdt.core.compiler.compliance=1.6 | ||
6 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
8 | org.eclipse.jdt.core.compiler.source=1.6 | ||
diff --git a/plugins/org.yocto.sdk.remotetools/META-INF/MANIFEST.MF b/plugins/org.yocto.sdk.remotetools/META-INF/MANIFEST.MF new file mode 100644 index 0000000..f3376f7 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/META-INF/MANIFEST.MF | |||
@@ -0,0 +1,33 @@ | |||
1 | Manifest-Version: 1.0 | ||
2 | Bundle-ManifestVersion: 2 | ||
3 | Bundle-Name: %Bundle-Name | ||
4 | Bundle-SymbolicName: org.yocto.sdk.remotetools; singleton:=true | ||
5 | Bundle-Version: 1.4.0.qualifier | ||
6 | Bundle-Activator: org.yocto.sdk.remotetools.Activator | ||
7 | Require-Bundle: org.eclipse.ui, | ||
8 | org.eclipse.core.runtime, | ||
9 | org.eclipse.rse.core;bundle-version="3.0.0", | ||
10 | org.yocto.sdk.ide, | ||
11 | org.eclipse.rse.terminals.ui;bundle-version="1.0.100", | ||
12 | org.eclipse.cdt;bundle-version="7.0.0", | ||
13 | org.eclipse.linuxtools.tmf.core;bundle-version="0.4.0", | ||
14 | org.eclipse.ui.ide;bundle-version="3.8.0", | ||
15 | org.eclipse.ui.console;bundle-version="3.5.100" | ||
16 | Bundle-ActivationPolicy: lazy | ||
17 | Bundle-RequiredExecutionEnvironment: JavaSE-1.6 | ||
18 | Import-Package: org.eclipse.core.resources, | ||
19 | org.eclipse.debug.internal.ui, | ||
20 | org.eclipse.rse.services.terminals, | ||
21 | org.eclipse.rse.shells.ui, | ||
22 | org.eclipse.rse.subsystems.terminals.core, | ||
23 | org.eclipse.rse.subsystems.terminals.core.elements, | ||
24 | org.eclipse.rse.ui, | ||
25 | org.eclipse.rse.ui.actions, | ||
26 | org.eclipse.tm.internal.terminal.control, | ||
27 | org.eclipse.tm.internal.terminal.control.actions, | ||
28 | org.eclipse.tm.internal.terminal.provisional.api, | ||
29 | org.eclipse.ui.forms.widgets, | ||
30 | org.yocto.remote.utils | ||
31 | Bundle-Vendor: %Bundle-Vendor | ||
32 | Bundle-ClassPath: lib/json-simple-1.1.1.jar, | ||
33 | . | ||
diff --git a/plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.properties b/plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.properties new file mode 100644 index 0000000..01de146 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.properties | |||
@@ -0,0 +1,5 @@ | |||
1 | #Generated by org.apache.felix.bundleplugin | ||
2 | #Sun Feb 19 14:30:57 CST 2012 | ||
3 | version=1.1.1 | ||
4 | groupId=com.googlecode.json-simple | ||
5 | artifactId=json-simple | ||
diff --git a/plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.xml b/plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.xml new file mode 100644 index 0000000..eaa330d --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/META-INF/maven/com.googlecode.json-simple/json-simple/pom.xml | |||
@@ -0,0 +1,65 @@ | |||
1 | <project> | ||
2 | <modelVersion>4.0.0</modelVersion> | ||
3 | <groupId>com.googlecode.json-simple</groupId> | ||
4 | <artifactId>json-simple</artifactId> | ||
5 | <packaging>bundle</packaging> | ||
6 | <name>JSON.simple</name> | ||
7 | <version>1.1.1</version> | ||
8 | <description>A simple Java toolkit for JSON</description> | ||
9 | <url>http://code.google.com/p/json-simple/</url> | ||
10 | <licenses> | ||
11 | <license> | ||
12 | <name>The Apache Software License, Version 2.0</name> | ||
13 | <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
14 | </license> | ||
15 | </licenses> | ||
16 | <developers> | ||
17 | <developer> | ||
18 | <id>Yidong</id> | ||
19 | <name>Yidong Fang</name> | ||
20 | <roles> | ||
21 | <role>architect</role> | ||
22 | <role>developer</role> | ||
23 | </roles> | ||
24 | <timezone>+8</timezone> | ||
25 | </developer> | ||
26 | </developers> | ||
27 | <scm> | ||
28 | <connection>scm:svn:http://json-simple.googlecode.com/svn/trunk/</connection> | ||
29 | <developerConnection>scm:svn:http://json-simple.googlecode.com/svn/trunk/</developerConnection> | ||
30 | <url>http://json-simple.googlecode.com/svn/trunk/</url> | ||
31 | </scm> | ||
32 | |||
33 | <properties> | ||
34 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
35 | </properties> | ||
36 | |||
37 | <dependencies> | ||
38 | <dependency> | ||
39 | <groupId>junit</groupId> | ||
40 | <artifactId>junit</artifactId> | ||
41 | <version>4.10</version> | ||
42 | </dependency> | ||
43 | </dependencies> | ||
44 | |||
45 | <build> | ||
46 | <plugins> | ||
47 | <plugin> | ||
48 | <groupId>org.apache.felix</groupId> | ||
49 | <artifactId>maven-bundle-plugin</artifactId> | ||
50 | <version>2.3.6</version> | ||
51 | <extensions>true</extensions> | ||
52 | </plugin> | ||
53 | <plugin> | ||
54 | <groupId>org.apache.maven.plugins</groupId> | ||
55 | <artifactId>maven-compiler-plugin</artifactId> | ||
56 | <version>2.3.2</version> | ||
57 | <configuration> | ||
58 | <source>1.2</source> | ||
59 | <target>1.2</target> | ||
60 | </configuration> | ||
61 | </plugin> | ||
62 | </plugins> | ||
63 | </build> | ||
64 | </project> | ||
65 | |||
diff --git a/plugins/org.yocto.sdk.remotetools/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.sdk.remotetools/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..62e9daa --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/OSGI-INF/l10n/bundle.properties | |||
@@ -0,0 +1,12 @@ | |||
1 | #Properties file for org.yocto.sdk.remotetools | ||
2 | category.name = Yocto Project Remote Tools | ||
3 | commands.category.name = Yoctol Project Tools | ||
4 | command.name.oprofile = oprofile | ||
5 | command.name.powertop = powertop | ||
6 | command.name.latencytop = latencytop | ||
7 | command.name.ust.20 = lttng2.0 trace import | ||
8 | command.name.perf = perf | ||
9 | command.name.systemtap = systemtap | ||
10 | command.name.yoctobsp = yocto-bsp | ||
11 | Bundle-Vendor = yoctoproject.org | ||
12 | Bundle-Name = Yocto Project Plugin Remote Tools \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.remotetools/build.properties b/plugins/org.yocto.sdk.remotetools/build.properties new file mode 100644 index 0000000..de68275 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/build.properties | |||
@@ -0,0 +1,10 @@ | |||
1 | source.. = src/ | ||
2 | output.. = bin/ | ||
3 | bin.includes = plugin.xml,\ | ||
4 | META-INF/,\ | ||
5 | .,\ | ||
6 | icons/,\ | ||
7 | OSGI-INF/l10n/bundle.properties,\ | ||
8 | lib/,\ | ||
9 | lib/json-simple-1.1.1.jar | ||
10 | src.includes = lib/ | ||
diff --git a/plugins/org.yocto.sdk.remotetools/icons/sample.gif b/plugins/org.yocto.sdk.remotetools/icons/sample.gif new file mode 100644 index 0000000..34fb3c9 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/icons/sample.gif | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.sdk.remotetools/lib/json-simple-1.1.1.jar b/plugins/org.yocto.sdk.remotetools/lib/json-simple-1.1.1.jar new file mode 100644 index 0000000..66347a6 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/lib/json-simple-1.1.1.jar | |||
Binary files differ | |||
diff --git a/plugins/org.yocto.sdk.remotetools/plugin.xml b/plugins/org.yocto.sdk.remotetools/plugin.xml new file mode 100644 index 0000000..c801fe6 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/plugin.xml | |||
@@ -0,0 +1,134 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <?eclipse version="3.4"?> | ||
3 | <plugin> | ||
4 | |||
5 | <extension | ||
6 | point="org.eclipse.ui.views"> | ||
7 | <category | ||
8 | name="%category.name" | ||
9 | id="org.yocto.sdk.remotetools"> | ||
10 | </category> | ||
11 | <view | ||
12 | name="PowerTop" | ||
13 | category="org.yocto.sdk.remotetools" | ||
14 | class="org.yocto.sdk.remotetools.views.BaseFileView" | ||
15 | id="org.yocto.sdk.remotetools.views.PowerTopView"> | ||
16 | </view> | ||
17 | <view | ||
18 | category="org.yocto.sdk.remotetools" | ||
19 | class="org.yocto.sdk.remotetools.views.TerminalViewer" | ||
20 | id="org.yocto.sdk.remotetools.views.TerminalView" | ||
21 | name="TerminalView"> | ||
22 | </view> | ||
23 | </extension> | ||
24 | <extension | ||
25 | point="org.eclipse.ui.perspectiveExtensions"> | ||
26 | <perspectiveExtension | ||
27 | targetID="org.eclipse.jdt.ui.JavaPerspective"> | ||
28 | <view | ||
29 | ratio="0.5" | ||
30 | relative="org.eclipse.ui.views.TaskList" | ||
31 | relationship="right" | ||
32 | id="org.yocto.sdk.remotetools.views.PowerTopView"> | ||
33 | </view> | ||
34 | </perspectiveExtension> | ||
35 | </extension> | ||
36 | <extension | ||
37 | point="org.eclipse.ui.commands"> | ||
38 | <category | ||
39 | id="org.yocto.sdk.remotetools.commands.category" | ||
40 | name="%commands.category.name"> | ||
41 | </category> | ||
42 | <command | ||
43 | categoryId="org.yocto.sdk.remotetools.commands.category" | ||
44 | id="org.yocto.sdk.remotetools.command.powertop" | ||
45 | name="%command.name.powertop"> | ||
46 | </command> | ||
47 | <command | ||
48 | categoryId="org.yocto.sdk.remotetools.commands.category" | ||
49 | id="org.yocto.sdk.remotetools.command.latencytop" | ||
50 | name="%command.name.latencytop"> | ||
51 | </command> | ||
52 | <command | ||
53 | categoryId="org.yocto.sdk.remotetools.commands.category" | ||
54 | id="org.yocto.sdk.remotetools.command.perf" | ||
55 | name="%command.name.perf"> | ||
56 | </command> | ||
57 | <command | ||
58 | categoryId="org.yocto.sdk.remotetools.commands.category" | ||
59 | id="org.yocto.sdk.remotetools.command.systemtap" | ||
60 | name="%command.name.systemtap"> | ||
61 | </command> | ||
62 | <command | ||
63 | categoryId="org.yocto.sdk.remotetools.commands.category" | ||
64 | id="org.yocto.sdk.remotetools.command.yoctobsp" | ||
65 | name="%command.name.yoctobsp"> | ||
66 | </command> | ||
67 | </extension> | ||
68 | <extension | ||
69 | point="org.eclipse.ui.menus"> | ||
70 | <menuContribution | ||
71 | locationURI="menu:org.eclipse.ui.main.menu?after=additions"> | ||
72 | <menu | ||
73 | id="runYoctoTools" | ||
74 | label="&YoctoProjectTools"> | ||
75 | </menu> | ||
76 | </menuContribution> | ||
77 | <menuContribution | ||
78 | locationURI="menu:runYoctoTools"> | ||
79 | <command | ||
80 | commandId="org.yocto.sdk.remotetools.command.perf" | ||
81 | label="%command.name.perf" | ||
82 | style="push"> | ||
83 | </command> | ||
84 | <command | ||
85 | commandId="org.yocto.sdk.remotetools.command.powertop" | ||
86 | label="%command.name.powertop" | ||
87 | style="push"> | ||
88 | </command> | ||
89 | <command | ||
90 | commandId="org.yocto.sdk.remotetools.command.latencytop" | ||
91 | label="%command.name.latencytop" | ||
92 | style="push"> | ||
93 | </command> | ||
94 | <command | ||
95 | commandId="org.yocto.sdk.remotetools.command.systemtap" | ||
96 | label="%command.name.systemtap" | ||
97 | style="push"> | ||
98 | </command> | ||
99 | <separator | ||
100 | name="org.yocto.sdk.remotetools.separator2" | ||
101 | visible="true"> | ||
102 | </separator> | ||
103 | <command | ||
104 | commandId="org.yocto.sdk.remotetools.command.yoctobsp" | ||
105 | label="%command.name.yoctobsp" | ||
106 | style="push"> | ||
107 | </command> | ||
108 | </menuContribution> | ||
109 | </extension> | ||
110 | <extension | ||
111 | point="org.eclipse.ui.handlers"> | ||
112 | <handler | ||
113 | class="org.yocto.sdk.remotetools.actions.PerfHandler" | ||
114 | commandId="org.yocto.sdk.remotetools.command.perf"> | ||
115 | </handler> | ||
116 | <handler | ||
117 | class="org.yocto.sdk.remotetools.actions.SystemtapHandler" | ||
118 | commandId="org.yocto.sdk.remotetools.command.systemtap"> | ||
119 | </handler> | ||
120 | <handler | ||
121 | class="org.yocto.sdk.remotetools.actions.PowertopHandler" | ||
122 | commandId="org.yocto.sdk.remotetools.command.powertop"> | ||
123 | </handler> | ||
124 | <handler | ||
125 | class="org.yocto.sdk.remotetools.actions.LatencytopHandler" | ||
126 | commandId="org.yocto.sdk.remotetools.command.latencytop"> | ||
127 | </handler> | ||
128 | <handler | ||
129 | class="org.yocto.sdk.remotetools.actions.YoctoBspHandler" | ||
130 | commandId="org.yocto.sdk.remotetools.command.yoctobsp"> | ||
131 | </handler> | ||
132 | </extension> | ||
133 | |||
134 | </plugin> | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Activator.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Activator.java new file mode 100644 index 0000000..33de5c1 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Activator.java | |||
@@ -0,0 +1,79 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools; | ||
12 | |||
13 | import org.eclipse.core.runtime.jobs.IJobManager; | ||
14 | import org.eclipse.core.runtime.jobs.Job; | ||
15 | import org.eclipse.jface.resource.ImageDescriptor; | ||
16 | import org.eclipse.ui.plugin.AbstractUIPlugin; | ||
17 | import org.osgi.framework.BundleContext; | ||
18 | |||
19 | /** | ||
20 | * The activator class controls the plug-in life cycle | ||
21 | */ | ||
22 | public class Activator extends AbstractUIPlugin { | ||
23 | |||
24 | // The plug-in ID | ||
25 | public static final String PLUGIN_ID = "org.yocto.sdk.remotetools"; //$NON-NLS-1$ | ||
26 | |||
27 | // The shared instance | ||
28 | private static Activator plugin; | ||
29 | |||
30 | /** | ||
31 | * The constructor | ||
32 | */ | ||
33 | public Activator() { | ||
34 | } | ||
35 | |||
36 | /* | ||
37 | * (non-Javadoc) | ||
38 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) | ||
39 | */ | ||
40 | public void start(BundleContext context) throws Exception { | ||
41 | super.start(context); | ||
42 | plugin = this; | ||
43 | } | ||
44 | |||
45 | /* | ||
46 | * (non-Javadoc) | ||
47 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) | ||
48 | */ | ||
49 | public void stop(BundleContext context) throws Exception { | ||
50 | |||
51 | //cancel all jobs before plugin stop | ||
52 | IJobManager jobMan = Job.getJobManager(); | ||
53 | jobMan.cancel(LocalJob.LOCAL_JOB_FAMILY); | ||
54 | jobMan.join(LocalJob.LOCAL_JOB_FAMILY, null); | ||
55 | |||
56 | plugin = null; | ||
57 | super.stop(context); | ||
58 | } | ||
59 | |||
60 | /** | ||
61 | * Returns the shared instance | ||
62 | * | ||
63 | * @return the shared instance | ||
64 | */ | ||
65 | public static Activator getDefault() { | ||
66 | return plugin; | ||
67 | } | ||
68 | |||
69 | /** | ||
70 | * Returns an image descriptor for the image file at the given | ||
71 | * plug-in relative path | ||
72 | * | ||
73 | * @param path the path | ||
74 | * @return the image descriptor | ||
75 | */ | ||
76 | public static ImageDescriptor getImageDescriptor(String path) { | ||
77 | return imageDescriptorFromPlugin(PLUGIN_ID, path); | ||
78 | } | ||
79 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/LocalJob.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/LocalJob.java new file mode 100644 index 0000000..5b082a0 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/LocalJob.java | |||
@@ -0,0 +1,101 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | |||
12 | package org.yocto.sdk.remotetools; | ||
13 | |||
14 | import java.io.File; | ||
15 | import java.io.IOException; | ||
16 | |||
17 | import org.eclipse.core.runtime.IProgressMonitor; | ||
18 | import org.eclipse.core.runtime.IStatus; | ||
19 | import org.eclipse.core.runtime.Status; | ||
20 | import org.eclipse.core.runtime.jobs.Job; | ||
21 | import org.eclipse.ui.IWorkbenchWindow; | ||
22 | import org.eclipse.jface.dialogs.MessageDialog; | ||
23 | import org.eclipse.swt.SWTException; | ||
24 | |||
25 | public class LocalJob extends Job { | ||
26 | |||
27 | public static final String LOCAL_JOB_FAMILY = "localJobFamily"; | ||
28 | private String[] cmdarray; | ||
29 | private String[] envp; | ||
30 | private File dir; | ||
31 | private int exitValue; | ||
32 | private Exception exception; | ||
33 | private IWorkbenchWindow window; | ||
34 | |||
35 | public LocalJob(String name, String[] cmdarray, String[] envp, File dir, IWorkbenchWindow window) { | ||
36 | super(name); | ||
37 | this.cmdarray=cmdarray; | ||
38 | this.envp=envp; | ||
39 | this.dir=dir; | ||
40 | this.window=window; | ||
41 | this.exitValue=0; | ||
42 | this.exception=null; | ||
43 | } | ||
44 | |||
45 | @Override | ||
46 | protected IStatus run(IProgressMonitor monitor) { | ||
47 | Process p=null; | ||
48 | boolean cancel=false; | ||
49 | |||
50 | try { | ||
51 | //start process | ||
52 | p=Runtime.getRuntime().exec(cmdarray,envp,dir); | ||
53 | |||
54 | //wait for completion | ||
55 | while (!cancel) { | ||
56 | |||
57 | if(monitor.isCanceled()) | ||
58 | cancel=true; | ||
59 | |||
60 | try { | ||
61 | exitValue=p.exitValue(); | ||
62 | break; | ||
63 | }catch (IllegalThreadStateException e) { | ||
64 | } | ||
65 | |||
66 | Thread.sleep(500); | ||
67 | } | ||
68 | |||
69 | }catch (IOException e) { | ||
70 | exception=e; | ||
71 | }catch (InterruptedException e){ | ||
72 | cancel=true; | ||
73 | }finally { | ||
74 | if(p!=null) | ||
75 | p.destroy(); | ||
76 | } | ||
77 | try { | ||
78 | if(exitValue!=0 || exception!=null) { | ||
79 | window.getWorkbench().getDisplay().syncExec(new Runnable() { | ||
80 | public void run() { | ||
81 | MessageDialog.openError(window.getShell(), | ||
82 | Messages.LocalJob_Title, | ||
83 | Messages.ErrorLocalJob + ": " + getName() + | ||
84 | (exitValue!=0 ? "\n\tExit value: " + new Integer(exitValue).toString() : new String("")) + | ||
85 | (exception!=null ? "\n\t" + exception.getMessage() : new String ("")) | ||
86 | ); | ||
87 | } | ||
88 | }); | ||
89 | } | ||
90 | }catch (SWTException e) { | ||
91 | e.printStackTrace(); | ||
92 | }catch (Exception e) { | ||
93 | e.printStackTrace(); | ||
94 | } | ||
95 | return (cancel!=true) ? Status.OK_STATUS : Status.CANCEL_STATUS; | ||
96 | } | ||
97 | |||
98 | public boolean belongsTo(Object family) { | ||
99 | return family == LOCAL_JOB_FAMILY; | ||
100 | } | ||
101 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Messages.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Messages.java new file mode 100644 index 0000000..c4544c5 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/Messages.java | |||
@@ -0,0 +1,63 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools; | ||
12 | |||
13 | import org.eclipse.osgi.util.NLS; | ||
14 | |||
15 | public class Messages extends NLS { | ||
16 | |||
17 | private static final String BUNDLE_NAME = "org.yocto.sdk.remotetools.messages"; //$NON-NLS-1$ | ||
18 | |||
19 | public static String ErrorNoSubsystem; | ||
20 | public static String ErrorConnectSubsystem; | ||
21 | public static String ErrorNoHost; | ||
22 | public static String ErrorNoRemoteService; | ||
23 | |||
24 | public static String ErrorOprofileViewer; | ||
25 | public static String ErrorOprofile; | ||
26 | public static String ErrorLttvGui; | ||
27 | public static String ErrorUstProject; | ||
28 | |||
29 | public static String InfoDownload; | ||
30 | public static String InfoUpload; | ||
31 | |||
32 | public static String BaseSettingDialog_Connection; | ||
33 | public static String BaseSettingDialog_New; | ||
34 | public static String BaseSettingDialog_Properties; | ||
35 | public static String Usttrace_Argument_Text; | ||
36 | public static String Usttrace_Application_Text; | ||
37 | public static String Usttrace_Trace_Loc_Text; | ||
38 | public static String Powertop_Time_Text; | ||
39 | public static String Powertop_ShowPid_Text; | ||
40 | public static String TerminalViewer_text; | ||
41 | //public static String Systemtap_KO_Text; | ||
42 | public static String Metadata_Location; | ||
43 | public static String Builddir_Location; | ||
44 | public static String User_ID; | ||
45 | public static String Remote_User_ID; | ||
46 | public static String Remote_Host; | ||
47 | public static String Systemtap_Script; | ||
48 | public static String Systemtap_Args; | ||
49 | public static String Import_to_Project; | ||
50 | |||
51 | public static String LocalJob_Title; | ||
52 | public static String ErrorLocalJob; | ||
53 | public static String RemoteShellExec_1; | ||
54 | public static String RemoteShellExec_2; | ||
55 | |||
56 | static { | ||
57 | // initialize resource bundle | ||
58 | NLS.initializeMessages(BUNDLE_NAME, Messages.class); | ||
59 | } | ||
60 | |||
61 | private Messages() { | ||
62 | } | ||
63 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/SWTFactory.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/SWTFactory.java new file mode 100644 index 0000000..27b5dae --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/SWTFactory.java | |||
@@ -0,0 +1,642 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2000, 2010 IBM Corporation and others. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * IBM Corporation - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools; | ||
12 | |||
13 | import org.eclipse.core.runtime.Assert; | ||
14 | import org.eclipse.jface.dialogs.IDialogConstants; | ||
15 | import org.eclipse.jface.layout.PixelConverter; | ||
16 | import org.eclipse.jface.resource.JFaceResources; | ||
17 | import org.eclipse.swt.SWT; | ||
18 | import org.eclipse.swt.custom.CLabel; | ||
19 | import org.eclipse.swt.custom.ViewForm; | ||
20 | import org.eclipse.swt.graphics.Font; | ||
21 | import org.eclipse.swt.graphics.Image; | ||
22 | import org.eclipse.swt.layout.GridData; | ||
23 | import org.eclipse.swt.layout.GridLayout; | ||
24 | import org.eclipse.swt.widgets.Button; | ||
25 | import org.eclipse.swt.widgets.Combo; | ||
26 | import org.eclipse.swt.widgets.Composite; | ||
27 | import org.eclipse.swt.widgets.Group; | ||
28 | import org.eclipse.swt.widgets.Label; | ||
29 | import org.eclipse.swt.widgets.Layout; | ||
30 | import org.eclipse.swt.widgets.Text; | ||
31 | import org.eclipse.ui.forms.widgets.ExpandableComposite; | ||
32 | |||
33 | /** | ||
34 | * Factory class to create some SWT resources. | ||
35 | */ | ||
36 | public class SWTFactory { | ||
37 | |||
38 | /** | ||
39 | * Returns a width hint for a button control. | ||
40 | */ | ||
41 | public static int getButtonWidthHint(Button button) { | ||
42 | /*button.setFont(JFaceResources.getDialogFont());*/ | ||
43 | PixelConverter converter= new PixelConverter(button); | ||
44 | int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); | ||
45 | return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * Sets width and height hint for the button control. | ||
50 | * <b>Note:</b> This is a NOP if the button's layout data is not | ||
51 | * an instance of <code>GridData</code>. | ||
52 | * | ||
53 | * @param the button for which to set the dimension hint | ||
54 | */ | ||
55 | public static void setButtonDimensionHint(Button button) { | ||
56 | Assert.isNotNull(button); | ||
57 | Object gd= button.getLayoutData(); | ||
58 | if (gd instanceof GridData) { | ||
59 | ((GridData)gd).widthHint= getButtonWidthHint(button); | ||
60 | ((GridData)gd).horizontalAlignment = GridData.FILL; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * Creates a check box button using the parents' font | ||
66 | * @param parent the parent to add the button to | ||
67 | * @param label the label for the button | ||
68 | * @param image the image for the button | ||
69 | * @param checked the initial checked state of the button | ||
70 | * @param hspan the horizontal span to take up in the parent composite | ||
71 | * @return a new checked button set to the initial checked state | ||
72 | * @since 3.3 | ||
73 | */ | ||
74 | public static Button createCheckButton(Composite parent, String label, Image image, boolean checked, int hspan) { | ||
75 | Button button = new Button(parent, SWT.CHECK); | ||
76 | button.setFont(parent.getFont()); | ||
77 | button.setSelection(checked); | ||
78 | if(image != null) { | ||
79 | button.setImage(image); | ||
80 | } | ||
81 | if(label != null) { | ||
82 | button.setText(label); | ||
83 | } | ||
84 | GridData gd = new GridData(); | ||
85 | gd.horizontalSpan = hspan; | ||
86 | button.setLayoutData(gd); | ||
87 | setButtonDimensionHint(button); | ||
88 | return button; | ||
89 | } | ||
90 | |||
91 | /** | ||
92 | * Creates and returns a new push button with the given | ||
93 | * label and/or image. | ||
94 | * | ||
95 | * @param parent parent control | ||
96 | * @param label button label or <code>null</code> | ||
97 | * @param image image of <code>null</code> | ||
98 | * | ||
99 | * @return a new push button | ||
100 | */ | ||
101 | public static Button createPushButton(Composite parent, String label, Image image) { | ||
102 | Button button = new Button(parent, SWT.PUSH); | ||
103 | button.setFont(parent.getFont()); | ||
104 | if (image != null) { | ||
105 | button.setImage(image); | ||
106 | } | ||
107 | if (label != null) { | ||
108 | button.setText(label); | ||
109 | } | ||
110 | GridData gd = new GridData(); | ||
111 | button.setLayoutData(gd); | ||
112 | setButtonDimensionHint(button); | ||
113 | return button; | ||
114 | } | ||
115 | |||
116 | /** | ||
117 | * Creates and returns a new push button with the given | ||
118 | * label and/or image. | ||
119 | * | ||
120 | * @param parent parent control | ||
121 | * @param label button label or <code>null</code> | ||
122 | * @param image image of <code>null</code> | ||
123 | * @param fill the alignment for the new button | ||
124 | * | ||
125 | * @return a new push button | ||
126 | * @since 3.4 | ||
127 | */ | ||
128 | public static Button createPushButton(Composite parent, String label, Image image, int fill) { | ||
129 | Button button = new Button(parent, SWT.PUSH); | ||
130 | button.setFont(parent.getFont()); | ||
131 | if (image != null) { | ||
132 | button.setImage(image); | ||
133 | } | ||
134 | if (label != null) { | ||
135 | button.setText(label); | ||
136 | } | ||
137 | GridData gd = new GridData(fill); | ||
138 | button.setLayoutData(gd); | ||
139 | setButtonDimensionHint(button); | ||
140 | return button; | ||
141 | } | ||
142 | |||
143 | /** | ||
144 | * Creates and returns a new push button with the given | ||
145 | * label, tooltip and/or image. | ||
146 | * | ||
147 | * @param parent parent control | ||
148 | * @param label button label or <code>null</code> | ||
149 | * @param tooltip the tooltip text for the button or <code>null</code> | ||
150 | * @param image image of <code>null</code> | ||
151 | * | ||
152 | * @return a new push button | ||
153 | * @since 3.6 | ||
154 | */ | ||
155 | public static Button createPushButton(Composite parent, String label, String tooltip, Image image) { | ||
156 | Button button = createPushButton(parent, label, image); | ||
157 | button.setToolTipText(tooltip); | ||
158 | return button; | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * Creates and returns a new radio button with the given | ||
163 | * label. | ||
164 | * | ||
165 | * @param parent parent control | ||
166 | * @param label button label or <code>null</code> | ||
167 | * | ||
168 | * @return a new radio button | ||
169 | */ | ||
170 | public static Button createRadioButton(Composite parent, String label) { | ||
171 | Button button = new Button(parent, SWT.RADIO); | ||
172 | button.setFont(parent.getFont()); | ||
173 | if (label != null) { | ||
174 | button.setText(label); | ||
175 | } | ||
176 | GridData gd = new GridData(); | ||
177 | button.setLayoutData(gd); | ||
178 | setButtonDimensionHint(button); | ||
179 | return button; | ||
180 | } | ||
181 | |||
182 | /** | ||
183 | * Creates and returns a new radio button with the given | ||
184 | * label. | ||
185 | * | ||
186 | * @param parent parent control | ||
187 | * @param label button label or <code>null</code> | ||
188 | * @param hspan the number of columns to span in the parent composite | ||
189 | * | ||
190 | * @return a new radio button | ||
191 | * @since 3.6 | ||
192 | */ | ||
193 | public static Button createRadioButton(Composite parent, String label, int hspan) { | ||
194 | Button button = new Button(parent, SWT.RADIO); | ||
195 | button.setFont(parent.getFont()); | ||
196 | if (label != null) { | ||
197 | button.setText(label); | ||
198 | } | ||
199 | GridData gd = new GridData(GridData.BEGINNING); | ||
200 | gd.horizontalSpan = hspan; | ||
201 | button.setLayoutData(gd); | ||
202 | setButtonDimensionHint(button); | ||
203 | return button; | ||
204 | } | ||
205 | |||
206 | /** | ||
207 | * Creates a new label widget | ||
208 | * @param parent the parent composite to add this label widget to | ||
209 | * @param text the text for the label | ||
210 | * @param hspan the horizontal span to take up in the parent composite | ||
211 | * @return the new label | ||
212 | * @since 3.2 | ||
213 | * | ||
214 | */ | ||
215 | public static Label createLabel(Composite parent, String text, int hspan) { | ||
216 | Label l = new Label(parent, SWT.NONE); | ||
217 | l.setFont(parent.getFont()); | ||
218 | l.setText(text); | ||
219 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
220 | gd.horizontalSpan = hspan; | ||
221 | gd.grabExcessHorizontalSpace = false; | ||
222 | l.setLayoutData(gd); | ||
223 | return l; | ||
224 | } | ||
225 | |||
226 | /** | ||
227 | * Creates a new label widget | ||
228 | * @param parent the parent composite to add this label widget to | ||
229 | * @param text the text for the label | ||
230 | * @param font the font for the label | ||
231 | * @param hspan the horizontal span to take up in the parent composite | ||
232 | * @return the new label | ||
233 | * @since 3.3 | ||
234 | */ | ||
235 | public static Label createLabel(Composite parent, String text, Font font, int hspan) { | ||
236 | Label l = new Label(parent, SWT.NONE); | ||
237 | l.setFont(font); | ||
238 | l.setText(text); | ||
239 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
240 | gd.horizontalSpan = hspan; | ||
241 | l.setLayoutData(gd); | ||
242 | return l; | ||
243 | } | ||
244 | |||
245 | /** | ||
246 | * Creates a wrapping label | ||
247 | * @param parent the parent composite to add this label to | ||
248 | * @param text the text to be displayed in the label | ||
249 | * @param hspan the horizontal span that label should take up in the parent composite | ||
250 | * @param wrapwidth the width hint that the label should wrap at | ||
251 | * @return a new label that wraps at a specified width | ||
252 | * @since 3.3 | ||
253 | */ | ||
254 | public static Label createWrapLabel(Composite parent, String text, int hspan, int wrapwidth) { | ||
255 | Label l = new Label(parent, SWT.NONE | SWT.WRAP); | ||
256 | l.setFont(parent.getFont()); | ||
257 | l.setText(text); | ||
258 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
259 | gd.horizontalSpan = hspan; | ||
260 | gd.widthHint = wrapwidth; | ||
261 | l.setLayoutData(gd); | ||
262 | return l; | ||
263 | } | ||
264 | |||
265 | /** | ||
266 | * Creates a new <code>CLabel</code> that will wrap at the specified width and has the specified image | ||
267 | * @param parent the parent to add this label to | ||
268 | * @param text the text for the label | ||
269 | * @param image the image for the label | ||
270 | * @param hspan the h span to take up in the parent | ||
271 | * @param wrapwidth the with to wrap at | ||
272 | * @return a new <code>CLabel</code> | ||
273 | * @since 3.3 | ||
274 | */ | ||
275 | public static CLabel createWrapCLabel(Composite parent, String text, Image image, int hspan, int wrapwidth) { | ||
276 | CLabel label = new CLabel(parent, SWT.NONE | SWT.WRAP); | ||
277 | label.setFont(parent.getFont()); | ||
278 | if(text != null) { | ||
279 | label.setText(text); | ||
280 | } | ||
281 | if(image != null) { | ||
282 | label.setImage(image); | ||
283 | } | ||
284 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
285 | gd.horizontalSpan = hspan; | ||
286 | gd.widthHint = wrapwidth; | ||
287 | label.setLayoutData(gd); | ||
288 | return label; | ||
289 | } | ||
290 | |||
291 | /** | ||
292 | * Creates a wrapping label | ||
293 | * @param parent the parent composite to add this label to | ||
294 | * @param text the text to be displayed in the label | ||
295 | * @param hspan the horizontal span that label should take up in the parent composite | ||
296 | * @return a new label that wraps at a specified width | ||
297 | * @since 3.3 | ||
298 | */ | ||
299 | public static Label createWrapLabel(Composite parent, String text, int hspan) { | ||
300 | Label l = new Label(parent, SWT.NONE | SWT.WRAP); | ||
301 | l.setFont(parent.getFont()); | ||
302 | l.setText(text); | ||
303 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
304 | gd.horizontalSpan = hspan; | ||
305 | l.setLayoutData(gd); | ||
306 | return l; | ||
307 | } | ||
308 | |||
309 | /** | ||
310 | * Creates a new text widget | ||
311 | * @param parent the parent composite to add this text widget to | ||
312 | * @param hspan the horizontal span to take up on the parent composite | ||
313 | * @return the new text widget | ||
314 | * @since 3.2 | ||
315 | * | ||
316 | */ | ||
317 | public static Text createSingleText(Composite parent, int hspan) { | ||
318 | Text t = new Text(parent, SWT.SINGLE | SWT.BORDER); | ||
319 | t.setFont(parent.getFont()); | ||
320 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
321 | gd.horizontalSpan = hspan; | ||
322 | t.setLayoutData(gd); | ||
323 | return t; | ||
324 | } | ||
325 | |||
326 | /** | ||
327 | * Creates a new text widget | ||
328 | * @param parent the parent composite to add this text widget to | ||
329 | * @param style the style bits for the text widget | ||
330 | * @param hspan the horizontal span to take up on the parent composite | ||
331 | * @param fill the fill for the grid layout | ||
332 | * @return the new text widget | ||
333 | * @since 3.3 | ||
334 | */ | ||
335 | public static Text createText(Composite parent, int style, int hspan, int fill) { | ||
336 | Text t = new Text(parent, style); | ||
337 | t.setFont(parent.getFont()); | ||
338 | GridData gd = new GridData(fill); | ||
339 | gd.horizontalSpan = hspan; | ||
340 | t.setLayoutData(gd); | ||
341 | return t; | ||
342 | } | ||
343 | |||
344 | /** | ||
345 | * Creates a new text widget | ||
346 | * @param parent the parent composite to add this text widget to | ||
347 | * @param style the style bits for the text widget | ||
348 | * @param hspan the horizontal span to take up on the parent composite | ||
349 | * @return the new text widget | ||
350 | * @since 3.3 | ||
351 | */ | ||
352 | public static Text createText(Composite parent, int style, int hspan) { | ||
353 | Text t = new Text(parent, style); | ||
354 | t.setFont(parent.getFont()); | ||
355 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
356 | gd.horizontalSpan = hspan; | ||
357 | t.setLayoutData(gd); | ||
358 | return t; | ||
359 | } | ||
360 | |||
361 | /** | ||
362 | * Creates a new text widget | ||
363 | * @param parent the parent composite to add this text widget to | ||
364 | * @param style the style bits for the text widget | ||
365 | * @param hspan the horizontal span to take up on the parent composite | ||
366 | * @param width the desired width of the text widget | ||
367 | * @param height the desired height of the text widget | ||
368 | * @param fill the fill style for the widget | ||
369 | * @return the new text widget | ||
370 | * @since 3.3 | ||
371 | */ | ||
372 | public static Text createText(Composite parent, int style, int hspan, int width, int height, int fill) { | ||
373 | Text t = new Text(parent, style); | ||
374 | t.setFont(parent.getFont()); | ||
375 | GridData gd = new GridData(fill); | ||
376 | gd.horizontalSpan = hspan; | ||
377 | gd.widthHint = width; | ||
378 | gd.heightHint = height; | ||
379 | t.setLayoutData(gd); | ||
380 | return t; | ||
381 | } | ||
382 | |||
383 | /** | ||
384 | * Creates a new text widget | ||
385 | * @param parent the parent composite to add this text widget to | ||
386 | * @param style the style bits for the text widget | ||
387 | * @param hspan the horizontal span to take up on the parent composite | ||
388 | * @param text the initial text, not <code>null</code> | ||
389 | * @return the new text widget | ||
390 | * @since 3.6 | ||
391 | */ | ||
392 | public static Text createText(Composite parent, int style, int hspan, String text) { | ||
393 | Text t = new Text(parent, style); | ||
394 | t.setFont(parent.getFont()); | ||
395 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
396 | gd.horizontalSpan = hspan; | ||
397 | t.setLayoutData(gd); | ||
398 | t.setText(text); | ||
399 | return t; | ||
400 | } | ||
401 | |||
402 | /** | ||
403 | * Creates a Group widget | ||
404 | * @param parent the parent composite to add this group to | ||
405 | * @param text the text for the heading of the group | ||
406 | * @param columns the number of columns within the group | ||
407 | * @param hspan the horizontal span the group should take up on the parent | ||
408 | * @param fill the style for how this composite should fill into its parent | ||
409 | * @return the new group | ||
410 | * @since 3.2 | ||
411 | * | ||
412 | */ | ||
413 | public static Group createGroup(Composite parent, String text, int columns, int hspan, int fill) { | ||
414 | Group g = new Group(parent, SWT.NONE); | ||
415 | g.setLayout(new GridLayout(columns, false)); | ||
416 | g.setText(text); | ||
417 | g.setFont(parent.getFont()); | ||
418 | GridData gd = new GridData(fill); | ||
419 | gd.horizontalSpan = hspan; | ||
420 | g.setLayoutData(gd); | ||
421 | return g; | ||
422 | } | ||
423 | |||
424 | /** | ||
425 | * Creates a Composite widget | ||
426 | * @param parent the parent composite to add this composite to | ||
427 | * @param font the font to set on the control | ||
428 | * @param columns the number of columns within the composite | ||
429 | * @param hspan the horizontal span the composite should take up on the parent | ||
430 | * @param fill the style for how this composite should fill into its parent | ||
431 | * @return the new group | ||
432 | * @since 3.3 | ||
433 | */ | ||
434 | public static Composite createComposite(Composite parent, Font font, int columns, int hspan, int fill) { | ||
435 | Composite g = new Composite(parent, SWT.NONE); | ||
436 | g.setLayout(new GridLayout(columns, false)); | ||
437 | g.setFont(font); | ||
438 | GridData gd = new GridData(fill); | ||
439 | gd.horizontalSpan = hspan; | ||
440 | g.setLayoutData(gd); | ||
441 | return g; | ||
442 | } | ||
443 | |||
444 | /** | ||
445 | * Creates an ExpandibleComposite widget | ||
446 | * @param parent the parent to add this widget to | ||
447 | * @param style the style for ExpandibleComposite expanding handle, and layout | ||
448 | * @param label the label for the widget | ||
449 | * @param hspan how many columns to span in the parent | ||
450 | * @param fill the fill style for the widget | ||
451 | * Can be one of <code>GridData.FILL_HORIZONAL</code>, <code>GridData.FILL_BOTH</code> or <code>GridData.FILL_VERTICAL</code> | ||
452 | * @return a new ExpandibleComposite widget | ||
453 | * @since 3.6 | ||
454 | */ | ||
455 | public static ExpandableComposite createExpandibleComposite(Composite parent, int style, String label, int hspan, int fill) { | ||
456 | ExpandableComposite ex = new ExpandableComposite(parent, SWT.NONE, style); | ||
457 | ex.setText(label); | ||
458 | ex.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); | ||
459 | GridData gd = new GridData(fill); | ||
460 | gd.horizontalSpan = hspan; | ||
461 | ex.setLayoutData(gd); | ||
462 | return ex; | ||
463 | } | ||
464 | |||
465 | /** | ||
466 | * Creates a composite that uses the parent's font and has a grid layout | ||
467 | * @param parent the parent to add the composite to | ||
468 | * @param columns the number of columns the composite should have | ||
469 | * @param hspan the horizontal span the new composite should take up in the parent | ||
470 | * @param fill the fill style of the composite {@link GridData} | ||
471 | * @return a new composite with a grid layout | ||
472 | * | ||
473 | * @since 3.3 | ||
474 | */ | ||
475 | public static Composite createComposite(Composite parent, int columns, int hspan, int fill) { | ||
476 | Composite g = new Composite(parent, SWT.NONE); | ||
477 | g.setLayout(new GridLayout(columns, false)); | ||
478 | g.setFont(parent.getFont()); | ||
479 | GridData gd = new GridData(fill); | ||
480 | gd.horizontalSpan = hspan; | ||
481 | g.setLayoutData(gd); | ||
482 | return g; | ||
483 | } | ||
484 | |||
485 | /** | ||
486 | * Creates a vertical spacer for separating components. If applied to a | ||
487 | * <code>GridLayout</code>, this method will automatically span all of the columns of the parent | ||
488 | * to make vertical space | ||
489 | * | ||
490 | * @param parent the parent composite to add this spacer to | ||
491 | * @param numlines the number of vertical lines to make as space | ||
492 | * @since 3.3 | ||
493 | */ | ||
494 | public static void createVerticalSpacer(Composite parent, int numlines) { | ||
495 | Label lbl = new Label(parent, SWT.NONE); | ||
496 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
497 | Layout layout = parent.getLayout(); | ||
498 | if(layout instanceof GridLayout) { | ||
499 | gd.horizontalSpan = ((GridLayout)parent.getLayout()).numColumns; | ||
500 | } | ||
501 | gd.heightHint = numlines; | ||
502 | lbl.setLayoutData(gd); | ||
503 | } | ||
504 | |||
505 | /** | ||
506 | * creates a horizontal spacer for separating components | ||
507 | * @param comp | ||
508 | * @param numlines | ||
509 | * @since 3.3 | ||
510 | */ | ||
511 | public static void createHorizontalSpacer(Composite comp, int numlines) { | ||
512 | Label lbl = new Label(comp, SWT.NONE); | ||
513 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
514 | gd.horizontalSpan = numlines; | ||
515 | lbl.setLayoutData(gd); | ||
516 | } | ||
517 | |||
518 | /** | ||
519 | * Creates a Composite widget | ||
520 | * @param parent the parent composite to add this composite to | ||
521 | * @param font the font to set on the control | ||
522 | * @param columns the number of columns within the composite | ||
523 | * @param hspan the horizontal span the composite should take up on the parent | ||
524 | * @param fill the style for how this composite should fill into its parent | ||
525 | * @param marginwidth the width of the margin to place on the sides of the composite (default is 5, specified by GridLayout) | ||
526 | * @param marginheight the height of the margin to place o the top and bottom of the composite | ||
527 | * @return the new composite | ||
528 | * @since 3.3 | ||
529 | */ | ||
530 | public static Composite createComposite(Composite parent, Font font, int columns, int hspan, int fill, int marginwidth, int marginheight) { | ||
531 | Composite g = new Composite(parent, SWT.NONE); | ||
532 | GridLayout layout = new GridLayout(columns, false); | ||
533 | layout.marginWidth = marginwidth; | ||
534 | layout.marginHeight = marginheight; | ||
535 | g.setLayout(layout); | ||
536 | g.setFont(font); | ||
537 | GridData gd = new GridData(fill); | ||
538 | gd.horizontalSpan = hspan; | ||
539 | g.setLayoutData(gd); | ||
540 | return g; | ||
541 | } | ||
542 | |||
543 | /** | ||
544 | * Creates a {@link ViewForm} | ||
545 | * @param parent | ||
546 | * @param style | ||
547 | * @param cols | ||
548 | * @param span | ||
549 | * @param fill | ||
550 | * @param marginwidth | ||
551 | * @param marginheight | ||
552 | * @return a new {@link ViewForm} | ||
553 | * @since 3.6 | ||
554 | */ | ||
555 | public static ViewForm createViewform(Composite parent, int style, int cols, int span, int fill, int marginwidth, int marginheight) { | ||
556 | ViewForm form = new ViewForm(parent, style); | ||
557 | form.setFont(parent.getFont()); | ||
558 | GridLayout layout = new GridLayout(cols, false); | ||
559 | layout.marginWidth = marginwidth; | ||
560 | layout.marginHeight = marginheight; | ||
561 | form.setLayout(layout); | ||
562 | GridData gd = new GridData(fill); | ||
563 | gd.horizontalSpan = span; | ||
564 | form.setLayoutData(gd); | ||
565 | return form; | ||
566 | } | ||
567 | |||
568 | /** | ||
569 | * Creates a Composite widget | ||
570 | * @param parent the parent composite to add this composite to | ||
571 | * @param font the font to set on the control | ||
572 | * @param columns the number of columns within the composite | ||
573 | * @param hspan the horizontal span the composite should take up on the parent | ||
574 | * @param fill the style for how this composite should fill into its parent | ||
575 | * @param marginwidth the width of the margin to place on the sides of the composite (default is 5, specified by GridLayout) | ||
576 | * @param marginheight the height of the margin to place o the top and bottom of the composite | ||
577 | * @return the new composite | ||
578 | * @since 3.6 | ||
579 | */ | ||
580 | public static Composite createComposite(Composite parent, Font font, int style, int columns, int hspan, int fill, int marginwidth, int marginheight) { | ||
581 | Composite g = new Composite(parent, style); | ||
582 | GridLayout layout = new GridLayout(columns, false); | ||
583 | layout.marginWidth = marginwidth; | ||
584 | layout.marginHeight = marginheight; | ||
585 | g.setLayout(layout); | ||
586 | g.setFont(font); | ||
587 | GridData gd = new GridData(fill); | ||
588 | gd.horizontalSpan = hspan; | ||
589 | g.setLayoutData(gd); | ||
590 | return g; | ||
591 | } | ||
592 | |||
593 | /** | ||
594 | * This method is used to make a combo box | ||
595 | * @param parent the parent composite to add the new combo to | ||
596 | * @param style the style for the Combo | ||
597 | * @param hspan the horizontal span to take up on the parent composite | ||
598 | * @param fill how the combo will fill into the composite | ||
599 | * Can be one of <code>GridData.FILL_HORIZONAL</code>, <code>GridData.FILL_BOTH</code> or <code>GridData.FILL_VERTICAL</code> | ||
600 | * @param items the item to put into the combo | ||
601 | * @return a new Combo instance | ||
602 | * @since 3.3 | ||
603 | */ | ||
604 | public static Combo createCombo(Composite parent, int style, int hspan, int fill, String[] items) { | ||
605 | Combo c = new Combo(parent, style); | ||
606 | c.setFont(parent.getFont()); | ||
607 | GridData gd = new GridData(fill); | ||
608 | gd.horizontalSpan = hspan; | ||
609 | c.setLayoutData(gd); | ||
610 | if (items != null){ | ||
611 | c.setItems(items); | ||
612 | } | ||
613 | // Some platforms open up combos in bad sizes without this, see bug 245569 | ||
614 | c.setVisibleItemCount(30); | ||
615 | c.select(0); | ||
616 | return c; | ||
617 | } | ||
618 | |||
619 | /** | ||
620 | * This method is used to make a combo box with a default fill style of GridData.FILL_HORIZONTAL | ||
621 | * @param parent the parent composite to add the new combo to | ||
622 | * @param style the style for the Combo | ||
623 | * @param hspan the horizontal span to take up on the parent composite | ||
624 | * @param items the item to put into the combo | ||
625 | * @return a new Combo instance | ||
626 | * @since 3.3 | ||
627 | */ | ||
628 | public static Combo createCombo(Composite parent, int style, int hspan, String[] items) { | ||
629 | Combo c = new Combo(parent, style); | ||
630 | c.setFont(parent.getFont()); | ||
631 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
632 | gd.horizontalSpan = hspan; | ||
633 | c.setLayoutData(gd); | ||
634 | if (items != null){ | ||
635 | c.setItems(items); | ||
636 | } | ||
637 | // Some platforms open up combos in bad sizes without this, see bug 245569 | ||
638 | c.setVisibleItemCount(30); | ||
639 | c.select(0); | ||
640 | return c; | ||
641 | } | ||
642 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspElement.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspElement.java new file mode 100644 index 0000000..e7bf054 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspElement.java | |||
@@ -0,0 +1,88 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools; | ||
12 | |||
13 | public class YoctoBspElement { | ||
14 | private String metadataLoc; | ||
15 | private String buildLoc; | ||
16 | private String bspName; | ||
17 | private String bspOutLoc; | ||
18 | private String karch; | ||
19 | private String qarch; | ||
20 | private boolean validPropertiesFile; | ||
21 | |||
22 | public YoctoBspElement() | ||
23 | { | ||
24 | this.metadataLoc = ""; | ||
25 | this.buildLoc = ""; | ||
26 | this.bspName = ""; | ||
27 | this.bspOutLoc = ""; | ||
28 | this.karch = ""; | ||
29 | this.qarch = ""; | ||
30 | this.validPropertiesFile = false; | ||
31 | } | ||
32 | |||
33 | public String getMetadataLoc() { | ||
34 | return metadataLoc; | ||
35 | } | ||
36 | |||
37 | public void setMetadataLoc(String value) { | ||
38 | metadataLoc = value; | ||
39 | } | ||
40 | |||
41 | public String getBuildLoc() { | ||
42 | return buildLoc; | ||
43 | } | ||
44 | |||
45 | public void setBuildLoc(String value) { | ||
46 | buildLoc = value; | ||
47 | } | ||
48 | |||
49 | public String getBspName() { | ||
50 | return bspName; | ||
51 | } | ||
52 | |||
53 | public void setBspName(String value) { | ||
54 | this.bspName = value; | ||
55 | } | ||
56 | |||
57 | public String getBspOutLoc() { | ||
58 | return bspOutLoc; | ||
59 | } | ||
60 | |||
61 | public void setBspOutLoc(String value) { | ||
62 | this.bspOutLoc = value; | ||
63 | } | ||
64 | |||
65 | public String getKarch() { | ||
66 | return karch; | ||
67 | } | ||
68 | |||
69 | public void setKarch(String value) { | ||
70 | this.karch = value; | ||
71 | } | ||
72 | |||
73 | public String getQarch() { | ||
74 | return qarch; | ||
75 | } | ||
76 | |||
77 | public void setQarch(String value) { | ||
78 | this.qarch = value; | ||
79 | } | ||
80 | |||
81 | public boolean getValidPropertiesFile() { | ||
82 | return validPropertiesFile; | ||
83 | } | ||
84 | |||
85 | public void setValidPropertiesFile(boolean value) { | ||
86 | this.validPropertiesFile = value; | ||
87 | } | ||
88 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspPropertyElement.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspPropertyElement.java new file mode 100644 index 0000000..e88b4bd --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoBspPropertyElement.java | |||
@@ -0,0 +1,65 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools; | ||
12 | |||
13 | public class YoctoBspPropertyElement implements Comparable<YoctoBspPropertyElement>{ | ||
14 | private String name; | ||
15 | private String type; | ||
16 | private String value; | ||
17 | private String defaultValue; | ||
18 | |||
19 | public YoctoBspPropertyElement() | ||
20 | { | ||
21 | this.name = ""; | ||
22 | this.type = ""; | ||
23 | this.value = ""; | ||
24 | this.defaultValue = ""; | ||
25 | } | ||
26 | |||
27 | public String getName() { | ||
28 | return name; | ||
29 | } | ||
30 | |||
31 | public void setName(String value) { | ||
32 | name = value; | ||
33 | } | ||
34 | |||
35 | public String getType() { | ||
36 | return type; | ||
37 | } | ||
38 | |||
39 | public void setType(String value) { | ||
40 | type = value; | ||
41 | } | ||
42 | |||
43 | public String getDefaultValue() { | ||
44 | return defaultValue; | ||
45 | } | ||
46 | |||
47 | public void setDefaultValue(String value) { | ||
48 | this.defaultValue = value; | ||
49 | } | ||
50 | |||
51 | public String getValue() { | ||
52 | return value; | ||
53 | } | ||
54 | |||
55 | public void setValue(String value) { | ||
56 | this.value = value; | ||
57 | } | ||
58 | |||
59 | @Override | ||
60 | public int compareTo(YoctoBspPropertyElement o) { | ||
61 | return type.compareTo(o.type); | ||
62 | } | ||
63 | |||
64 | |||
65 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoJSONHelper.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoJSONHelper.java new file mode 100644 index 0000000..37ce54d --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/YoctoJSONHelper.java | |||
@@ -0,0 +1,89 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools; | ||
12 | |||
13 | import java.io.IOException; | ||
14 | import java.io.FileWriter; | ||
15 | import java.util.Iterator; | ||
16 | import java.util.Set; | ||
17 | import java.util.HashSet; | ||
18 | import java.io.FileReader; | ||
19 | |||
20 | import org.json.simple.JSONObject; | ||
21 | import org.json.simple.JSONValue; | ||
22 | |||
23 | public class YoctoJSONHelper { | ||
24 | private static final String PROPERTIES_FILE = "/tmp/properties.json"; | ||
25 | private static final String PROPERTY_VALUE_FILE = "/tmp/propertyvalues.json"; | ||
26 | |||
27 | private static HashSet<YoctoBspPropertyElement> properties; | ||
28 | |||
29 | public static HashSet<YoctoBspPropertyElement> getProperties() throws Exception { | ||
30 | |||
31 | properties = new HashSet<YoctoBspPropertyElement>(); | ||
32 | try { | ||
33 | |||
34 | JSONObject obj = (JSONObject)JSONValue.parse(new FileReader(PROPERTIES_FILE)); | ||
35 | Set<String> keys = obj.keySet(); | ||
36 | if (!keys.isEmpty()) { | ||
37 | Iterator<String> iter = keys.iterator(); | ||
38 | while (iter.hasNext()) { | ||
39 | String key = (String)iter.next(); | ||
40 | if (validKey(key)) { | ||
41 | JSONObject value_obj = (JSONObject)obj.get(key); | ||
42 | YoctoBspPropertyElement elem = new YoctoBspPropertyElement(); | ||
43 | elem.setName(key); | ||
44 | String type = (String)value_obj.get("type"); | ||
45 | elem.setType(type); | ||
46 | if (type.contentEquals("boolean")) { | ||
47 | elem.setDefaultValue((String)value_obj.get("default")); | ||
48 | } | ||
49 | properties.add(elem); | ||
50 | } | ||
51 | } | ||
52 | } | ||
53 | |||
54 | } catch (Exception e) { | ||
55 | throw e; | ||
56 | } | ||
57 | return properties; | ||
58 | } | ||
59 | |||
60 | public static void createBspJSONFile(HashSet<YoctoBspPropertyElement> properties) { | ||
61 | try { | ||
62 | JSONObject obj = new JSONObject(); | ||
63 | if (!properties.isEmpty()) { | ||
64 | Iterator<YoctoBspPropertyElement> it = properties.iterator(); | ||
65 | while (it.hasNext()) { | ||
66 | // Get property | ||
67 | YoctoBspPropertyElement propElem = (YoctoBspPropertyElement)it.next(); | ||
68 | obj.put(propElem.getName(), propElem.getValue()); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | FileWriter file = new FileWriter(PROPERTY_VALUE_FILE); | ||
73 | file.write(obj.toJSONString()); | ||
74 | file.flush(); | ||
75 | file.close(); | ||
76 | |||
77 | } catch (IOException e) { | ||
78 | e.printStackTrace(); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | private static boolean validKey(String key) { | ||
83 | if (key.contains("kernel")) | ||
84 | return false; | ||
85 | if (key.contentEquals("qemuarch")) | ||
86 | return false; | ||
87 | return true; | ||
88 | } | ||
89 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseModel.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseModel.java new file mode 100644 index 0000000..6686d39 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseModel.java | |||
@@ -0,0 +1,126 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import java.io.IOException; | ||
14 | import java.io.InputStream; | ||
15 | import java.lang.reflect.InvocationTargetException; | ||
16 | |||
17 | import org.eclipse.core.runtime.IProgressMonitor; | ||
18 | import org.eclipse.core.runtime.SubProgressMonitor; | ||
19 | import org.eclipse.jface.operation.IRunnableWithProgress; | ||
20 | import org.eclipse.rse.core.model.IHost; | ||
21 | import org.yocto.remote.utils.RemoteHelper; | ||
22 | import org.yocto.remote.utils.RemoteShellExec; | ||
23 | |||
24 | abstract public class BaseModel implements IRunnableWithProgress { | ||
25 | protected IHost host; | ||
26 | protected String taskName; | ||
27 | protected String localScript; | ||
28 | protected String remoteExec; | ||
29 | protected String localFile; | ||
30 | protected String remoteFile; | ||
31 | |||
32 | private static final int WORKLOAD = 100; | ||
33 | |||
34 | private static final int INIT_PERCENT = 5; | ||
35 | private static final int PRE_PROCESS_PERCENT = 30; | ||
36 | private static final int PROCESS_PERCENT = 30; | ||
37 | private static final int POST_PROCESS_PERCENT = 30; | ||
38 | private static final int CLEAN_PERCENT = 5; | ||
39 | |||
40 | private static final String RUN_MSG = "Running task: "; | ||
41 | private static final String INIT_MSG = "Initializing "; | ||
42 | private static final String PRE_PROCESS_MSG = "Preparing "; | ||
43 | private static final String PROCESS_MSG = "Processing "; | ||
44 | private static final String POST_PROCESS_MSG = "Finishing "; | ||
45 | private static final String CLEAN_MSG = "Cleaning "; | ||
46 | private static final String DOTS = "..."; | ||
47 | private static final String FAILED_ERR_MSG = " failed with exit code "; | ||
48 | |||
49 | public void preProcess(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException{ | ||
50 | //upload script to remote | ||
51 | try { | ||
52 | RemoteHelper.putRemoteFileInPlugin(host, localScript, remoteExec, monitor); | ||
53 | }catch (InterruptedException e){ | ||
54 | throw e; | ||
55 | }catch (InvocationTargetException e) { | ||
56 | throw e; | ||
57 | }catch (Exception e) { | ||
58 | throw new InvocationTargetException(e, e.getMessage()); | ||
59 | } | ||
60 | } | ||
61 | public void postProcess(IProgressMonitor monitor) throws InvocationTargetException,InterruptedException{} | ||
62 | |||
63 | public void setHost (IHost host) { | ||
64 | this.host = host; | ||
65 | } | ||
66 | abstract public void process(IProgressMonitor monitor) throws InvocationTargetException,InterruptedException; | ||
67 | |||
68 | public BaseModel(IHost host, String taskName, String localScript, String remoteExec) { | ||
69 | this.host = host; | ||
70 | this.taskName = taskName; | ||
71 | this.localScript = localScript; | ||
72 | this.remoteExec = remoteExec; | ||
73 | } | ||
74 | protected void init(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { | ||
75 | } | ||
76 | |||
77 | protected void clean(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { | ||
78 | } | ||
79 | |||
80 | public void run(IProgressMonitor monitor) throws InvocationTargetException, | ||
81 | InterruptedException { | ||
82 | |||
83 | try { | ||
84 | monitor.beginTask(RUN_MSG + taskName, WORKLOAD); | ||
85 | |||
86 | monitor.subTask(INIT_MSG + taskName + DOTS); | ||
87 | init(new SubProgressMonitor(monitor, INIT_PERCENT)); | ||
88 | |||
89 | monitor.subTask(PRE_PROCESS_MSG + taskName + DOTS); | ||
90 | preProcess(new SubProgressMonitor(monitor, PRE_PROCESS_PERCENT)); | ||
91 | |||
92 | monitor.subTask(PROCESS_MSG + taskName + DOTS); | ||
93 | process(new SubProgressMonitor(monitor, PROCESS_PERCENT)); | ||
94 | |||
95 | monitor.subTask(POST_PROCESS_MSG + taskName + DOTS); | ||
96 | postProcess(new SubProgressMonitor(monitor, POST_PROCESS_PERCENT)); | ||
97 | } catch (InterruptedException e){ | ||
98 | throw new InterruptedException("User cancelled!"); | ||
99 | } catch (InvocationTargetException e) { | ||
100 | throw e; | ||
101 | } finally { | ||
102 | monitor.subTask(CLEAN_MSG + taskName + DOTS); | ||
103 | clean(new SubProgressMonitor(monitor, CLEAN_PERCENT)); | ||
104 | monitor.done(); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | protected void getDataFile(IProgressMonitor monitor) throws Exception { | ||
109 | RemoteHelper.getRemoteFile( host, localFile, remoteFile, monitor); | ||
110 | } | ||
111 | protected void runRemoteShellExec(IProgressMonitor monitor, String args, boolean cancelable) throws Exception { | ||
112 | try { | ||
113 | RemoteShellExec exec = new RemoteShellExec(host, remoteExec); | ||
114 | exec.start(null, args, monitor); | ||
115 | monitor.worked(1); | ||
116 | checkTerminate(exec.getInputStream()); | ||
117 | int exit_code = exec.waitFor(cancelable ? monitor : null); | ||
118 | exec.terminate(); | ||
119 | if(exit_code != 0) | ||
120 | throw new Exception(taskName + FAILED_ERR_MSG + new Integer(exit_code).toString()); | ||
121 | } finally { | ||
122 | monitor.done(); | ||
123 | } | ||
124 | } | ||
125 | protected void checkTerminate(InputStream inputStream) throws IOException {} | ||
126 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseSettingDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseSettingDialog.java new file mode 100644 index 0000000..cd58b73 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseSettingDialog.java | |||
@@ -0,0 +1,217 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2006, 2010 PalmSource, Inc. and others. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Ewa Matejska (PalmSource) - initial API and implementation | ||
10 | * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry | ||
11 | * Martin Oberhuber (Wind River) - [196934] hide disabled system types in remotecdt combo | ||
12 | * Yu-Fen Kuo (MontaVista) - [190613] Fix NPE in Remotecdt when RSEUIPlugin has not been loaded | ||
13 | * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code | ||
14 | * Johann Draschwandtner (Wind River) - [231827][remotecdt]Auto-compute default for Remote path | ||
15 | * Johann Draschwandtner (Wind River) - [233057][remotecdt]Fix button enablement | ||
16 | * Anna Dushistova (MontaVista) - [181517][usability] Specify commands to be run before remote application launch | ||
17 | * Anna Dushistova (MontaVista) - [223728] [remotecdt] connection combo is not populated until RSE is activated | ||
18 | * Anna Dushistova (MontaVista) - [267951] [remotecdt] Support systemTypes without files subsystem | ||
19 | * Lianhao Lu (Intel) - Modified for internal use | ||
20 | * Ioana Grigoropol (Intel) - Adapt class for remote support | ||
21 | *******************************************************************************/ | ||
22 | |||
23 | package org.yocto.sdk.remotetools.actions; | ||
24 | |||
25 | import org.yocto.remote.utils.RemoteHelper; | ||
26 | import org.yocto.sdk.remotetools.Messages; | ||
27 | import org.yocto.sdk.remotetools.SWTFactory; | ||
28 | import org.eclipse.jface.dialogs.Dialog; | ||
29 | import org.eclipse.jface.dialogs.IDialogConstants; | ||
30 | import org.eclipse.rse.core.model.IHost; | ||
31 | import org.eclipse.rse.ui.actions.SystemNewConnectionAction; | ||
32 | import org.eclipse.swt.SWT; | ||
33 | import org.eclipse.swt.events.ModifyEvent; | ||
34 | import org.eclipse.swt.events.ModifyListener; | ||
35 | import org.eclipse.swt.events.SelectionAdapter; | ||
36 | import org.eclipse.swt.events.SelectionEvent; | ||
37 | import org.eclipse.swt.layout.GridData; | ||
38 | import org.eclipse.swt.layout.GridLayout; | ||
39 | import org.eclipse.swt.widgets.Button; | ||
40 | import org.eclipse.swt.widgets.Combo; | ||
41 | import org.eclipse.swt.widgets.Composite; | ||
42 | import org.eclipse.swt.widgets.Control; | ||
43 | import org.eclipse.swt.widgets.Label; | ||
44 | import org.eclipse.swt.widgets.Shell; | ||
45 | |||
46 | public class BaseSettingDialog extends Dialog { | ||
47 | |||
48 | protected String title; | ||
49 | protected String curConn; //current rse connection name | ||
50 | protected IHost conn;//rse IHost | ||
51 | |||
52 | protected Button newRemoteConnectionButton; | ||
53 | protected Label connectionLabel; | ||
54 | protected Combo connectionCombo; | ||
55 | protected SystemNewConnectionAction action = null; | ||
56 | |||
57 | |||
58 | protected BaseSettingDialog(Shell parentShell,String title, String connection) { | ||
59 | super(parentShell); | ||
60 | this.title=title; | ||
61 | this.curConn=connection; | ||
62 | } | ||
63 | |||
64 | @Override | ||
65 | protected void configureShell(Shell newShell) { | ||
66 | super.configureShell(newShell); | ||
67 | newShell.setText(title); | ||
68 | } | ||
69 | |||
70 | @Override | ||
71 | protected Control createDialogArea(Composite parent) { | ||
72 | Composite comp = (Composite)super.createDialogArea(parent); | ||
73 | GridLayout topLayout = new GridLayout(); | ||
74 | comp.setLayout(topLayout); | ||
75 | |||
76 | /* The RSE Connection dropdown with New button. */ | ||
77 | SWTFactory.createVerticalSpacer(comp, 1); | ||
78 | createRemoteConnectionGroup(comp); | ||
79 | |||
80 | return comp; | ||
81 | } | ||
82 | |||
83 | |||
84 | @Override | ||
85 | protected void createButtonsForButtonBar(Composite parent) { | ||
86 | super.createButtonsForButtonBar(parent); | ||
87 | updateCurConn(); | ||
88 | } | ||
89 | |||
90 | protected void createRemoteConnectionGroup(Composite parent) { | ||
91 | Composite projComp = new Composite(parent, SWT.NONE); | ||
92 | GridLayout projLayout = new GridLayout(); | ||
93 | projLayout.numColumns = 6; | ||
94 | projLayout.marginHeight = 0; | ||
95 | projLayout.marginWidth = 0; | ||
96 | projComp.setLayout(projLayout); | ||
97 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
98 | projComp.setLayoutData(gd); | ||
99 | |||
100 | connectionLabel = new Label(projComp, SWT.NONE); | ||
101 | connectionLabel.setText(Messages.BaseSettingDialog_Connection); | ||
102 | gd = new GridData(); | ||
103 | gd.horizontalSpan = 1; | ||
104 | connectionLabel.setLayoutData(gd); | ||
105 | |||
106 | connectionCombo = new Combo(projComp, SWT.DROP_DOWN | SWT.READ_ONLY); | ||
107 | gd = new GridData(GridData.FILL_HORIZONTAL); | ||
108 | gd.horizontalSpan = 4; | ||
109 | connectionCombo.setLayoutData(gd); | ||
110 | connectionCombo.addModifyListener(new ModifyListener() { | ||
111 | |||
112 | public void modifyText(ModifyEvent e) { | ||
113 | //setDirty(true); | ||
114 | //updateLaunchConfigurationDialog(); | ||
115 | //useDefaultsFromConnection(); | ||
116 | updateCurConn(); | ||
117 | } | ||
118 | }); | ||
119 | |||
120 | newRemoteConnectionButton = SWTFactory.createPushButton(projComp, | ||
121 | Messages.BaseSettingDialog_New, null); | ||
122 | newRemoteConnectionButton.addSelectionListener(new SelectionAdapter() { | ||
123 | |||
124 | public void widgetSelected(SelectionEvent evt) { | ||
125 | handleNewRemoteConnectionSelected(); | ||
126 | //updateLaunchConfigurationDialog(); | ||
127 | updateConnectionPulldown(); | ||
128 | } | ||
129 | }); | ||
130 | gd = new GridData(); | ||
131 | gd.horizontalSpan = 1; | ||
132 | newRemoteConnectionButton.setLayoutData(gd); | ||
133 | |||
134 | updateConnectionPulldown(); | ||
135 | } | ||
136 | |||
137 | protected boolean updateOkButton() { | ||
138 | boolean ret=false; | ||
139 | Button button=getButton(IDialogConstants.OK_ID); | ||
140 | if(button!=null) | ||
141 | button.setEnabled(false); | ||
142 | IHost currentConnectionSelected = getCurrentConnection(); | ||
143 | if (currentConnectionSelected != null) { | ||
144 | if (RemoteHelper.isHostViable(currentConnectionSelected) && button != null){ | ||
145 | button.setEnabled(true); | ||
146 | ret=true; | ||
147 | } | ||
148 | } | ||
149 | return ret; | ||
150 | } | ||
151 | |||
152 | protected void updateCurConn() { | ||
153 | IHost currentConnectionSelected = getCurrentConnection(); | ||
154 | if (currentConnectionSelected != null) { | ||
155 | if (RemoteHelper.isHostViable(currentConnectionSelected)) | ||
156 | curConn=currentConnectionSelected.getAliasName(); | ||
157 | } | ||
158 | updateOkButton(); | ||
159 | } | ||
160 | |||
161 | protected IHost getCurrentConnection() { | ||
162 | int currentSelection = connectionCombo.getSelectionIndex(); | ||
163 | String remoteConnection = currentSelection >= 0 ? connectionCombo | ||
164 | .getItem(currentSelection) : null; | ||
165 | return RemoteHelper.getRemoteConnectionByName(remoteConnection); | ||
166 | } | ||
167 | |||
168 | protected void handleNewRemoteConnectionSelected() { | ||
169 | if (action == null) { | ||
170 | action = new SystemNewConnectionAction(getShell(), | ||
171 | false, false, null); | ||
172 | } | ||
173 | |||
174 | try { | ||
175 | action.run(); | ||
176 | } catch (Exception e) { | ||
177 | // Ignore | ||
178 | } | ||
179 | } | ||
180 | |||
181 | protected void updateConnectionPulldown() { | ||
182 | int index=-1; | ||
183 | RemoteHelper.waitForRSEInitCompletition(); | ||
184 | // already initialized | ||
185 | connectionCombo.removeAll(); | ||
186 | IHost[] connections = RemoteHelper.getSuitableConnections(); | ||
187 | for (int i = 0; i < connections.length; i++) { | ||
188 | connectionCombo.add(connections[i].getAliasName()); | ||
189 | if(connections[i].getAliasName().equals(curConn)) | ||
190 | index=i; | ||
191 | } | ||
192 | |||
193 | if(index>=0) { | ||
194 | connectionCombo.select(index); | ||
195 | }else if (connections.length > 0) { | ||
196 | connectionCombo.select(connections.length - 1); | ||
197 | } | ||
198 | |||
199 | //TODO | ||
200 | //connectionCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT,true); | ||
201 | connectionCombo.pack(true); | ||
202 | connectionCombo.layout(); | ||
203 | connectionCombo.getParent().layout(); | ||
204 | |||
205 | updateCurConn(); | ||
206 | } | ||
207 | |||
208 | @Override | ||
209 | protected void okPressed() { | ||
210 | conn=getCurrentConnection(); | ||
211 | super.okPressed(); | ||
212 | } | ||
213 | |||
214 | public IHost getHost() { | ||
215 | return conn; | ||
216 | } | ||
217 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/DialogHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/DialogHandler.java new file mode 100644 index 0000000..231de77 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/DialogHandler.java | |||
@@ -0,0 +1,42 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import org.eclipse.core.commands.ExecutionEvent; | ||
14 | import org.eclipse.core.commands.ExecutionException; | ||
15 | import org.eclipse.rse.core.model.IHost; | ||
16 | import org.eclipse.ui.IWorkbenchWindow; | ||
17 | import org.eclipse.ui.handlers.HandlerUtil; | ||
18 | import org.yocto.remote.utils.TerminalHandler; | ||
19 | |||
20 | abstract public class DialogHandler extends TerminalHandler { | ||
21 | |||
22 | protected BaseSettingDialog setting; | ||
23 | |||
24 | abstract protected String getDialogTitle(); | ||
25 | |||
26 | protected void initialize(ExecutionEvent event) throws ExecutionException{ | ||
27 | IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); | ||
28 | shell = window.getShell(); | ||
29 | setting = new SimpleSettingDialog(shell, getDialogTitle(), getConnnectionName()); | ||
30 | } | ||
31 | |||
32 | @Override | ||
33 | public Object execute(ExecutionEvent event) throws ExecutionException { | ||
34 | initialize(event); | ||
35 | |||
36 | if(setting.open() == BaseSettingDialog.OK) { | ||
37 | IHost currentHost = setting.getHost(); | ||
38 | execute(currentHost); | ||
39 | } | ||
40 | return null; | ||
41 | } | ||
42 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/IBaseConstants.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/IBaseConstants.java new file mode 100644 index 0000000..d4bbe12 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/IBaseConstants.java | |||
@@ -0,0 +1,27 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | public interface IBaseConstants { | ||
14 | public static final String TCF_TYPE_ID="org.eclipse.tcf.rse.systemType";//$NON-NLS-1$ | ||
15 | |||
16 | public static final String QUALIFIER="org.yocto.sdk.remotetools";//$NON-NLS-1$ | ||
17 | |||
18 | public static final String CONNECTION_NAME_OPROFILE = QUALIFIER + "connection.oprofile"; //$NON-NLS-1$ | ||
19 | public static final String CONNECTION_NAME_UST = QUALIFIER + "connection.ust"; //$NON-NLS-1$ | ||
20 | public static final String CONNECTION_NAME_POWERTOP = QUALIFIER + "connection.powertop"; //$NON-NLS-1$ | ||
21 | public static final String CONNECTION_NAME_LATENCYTOP = QUALIFIER + "connection.latencytop"; //$NON-NLS-1$ | ||
22 | public static final String CONNECTION_NAME_PERF = QUALIFIER + "connection.perf"; //$NON-NLS-1$ | ||
23 | public static final String CONNECTION_NAME_SYSTEMTAP = QUALIFIER + "connection.systemtap"; //$NON-NLS-1$ | ||
24 | |||
25 | public static final String DIALOG_TITLE_LATENCYTOP = "Latencytop"; //$NON-NLS-1$ | ||
26 | public static final String DIALOG_TITLE_PERF = "Perf"; //$NON-NLS-1$ | ||
27 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/LatencytopHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/LatencytopHandler.java new file mode 100644 index 0000000..1088dee --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/LatencytopHandler.java | |||
@@ -0,0 +1,35 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | |||
14 | public class LatencytopHandler extends DialogHandler { | ||
15 | |||
16 | protected String changeTerm = "export TERM=xterm;"; | ||
17 | private static String initCmd="export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin; cd; sudo latencytop\r"; | ||
18 | |||
19 | @Override | ||
20 | protected String getInitCmd() { | ||
21 | return initCmd; | ||
22 | } | ||
23 | @Override | ||
24 | protected String changeTerm() { | ||
25 | return changeTerm; | ||
26 | } | ||
27 | @Override | ||
28 | protected String getConnnectionName() { | ||
29 | return IBaseConstants.CONNECTION_NAME_LATENCYTOP; | ||
30 | } | ||
31 | @Override | ||
32 | protected String getDialogTitle() { | ||
33 | return IBaseConstants.DIALOG_TITLE_LATENCYTOP; | ||
34 | } | ||
35 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileHandler.java new file mode 100644 index 0000000..980737f --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileHandler.java | |||
@@ -0,0 +1,55 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import org.eclipse.core.commands.AbstractHandler; | ||
14 | import org.eclipse.core.commands.ExecutionEvent; | ||
15 | import org.eclipse.core.commands.ExecutionException; | ||
16 | import org.eclipse.jface.dialogs.MessageDialog; | ||
17 | import org.eclipse.ui.IWorkbenchWindow; | ||
18 | import org.eclipse.ui.PlatformUI; | ||
19 | import org.eclipse.ui.handlers.HandlerUtil; | ||
20 | import org.eclipse.ui.progress.IProgressService; | ||
21 | |||
22 | public class OprofileHandler extends AbstractHandler { | ||
23 | |||
24 | public Object execute(ExecutionEvent event) throws ExecutionException { | ||
25 | |||
26 | if(OprofileModel.checkAvail()!=true) { | ||
27 | return null; | ||
28 | } | ||
29 | |||
30 | IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); | ||
31 | |||
32 | SimpleSettingDialog setting=new SimpleSettingDialog( | ||
33 | window.getShell(), | ||
34 | "Oprofile", | ||
35 | IBaseConstants.CONNECTION_NAME_OPROFILE | ||
36 | ); | ||
37 | |||
38 | if(setting.open()==BaseSettingDialog.OK) { | ||
39 | IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); | ||
40 | OprofileModel op=new OprofileModel(setting.getHost(),window); | ||
41 | try { | ||
42 | progressService.busyCursorWhile(op); | ||
43 | }catch (InterruptedException e) { | ||
44 | //user cancelled | ||
45 | }catch (Exception e) { | ||
46 | e.printStackTrace(); | ||
47 | MessageDialog.openError(window.getShell(), | ||
48 | "Oprofile", | ||
49 | (e.getCause() != null) ? e.getCause().getMessage() : e.getMessage()); | ||
50 | } | ||
51 | } | ||
52 | return null; | ||
53 | } | ||
54 | |||
55 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileModel.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileModel.java new file mode 100644 index 0000000..7fbe7c6 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileModel.java | |||
@@ -0,0 +1,171 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import java.io.BufferedReader; | ||
14 | import java.io.File; | ||
15 | import java.io.FileReader; | ||
16 | import java.io.IOException; | ||
17 | import java.lang.reflect.InvocationTargetException; | ||
18 | |||
19 | import org.eclipse.core.runtime.IProgressMonitor; | ||
20 | import org.eclipse.core.runtime.SubProgressMonitor; | ||
21 | import org.eclipse.jface.preference.IPreferenceStore; | ||
22 | import org.eclipse.rse.core.model.IHost; | ||
23 | import org.eclipse.ui.IWorkbenchWindow; | ||
24 | import org.yocto.remote.utils.CommonHelper; | ||
25 | import org.yocto.sdk.ide.YoctoSDKPlugin; | ||
26 | import org.yocto.sdk.ide.preferences.PreferenceConstants; | ||
27 | import org.yocto.sdk.remotetools.LocalJob; | ||
28 | import org.yocto.sdk.remotetools.Messages; | ||
29 | |||
30 | public class OprofileModel extends BaseModel { | ||
31 | |||
32 | private static final String REMOTE_EXEC = "/tmp/yocto_tool.sh"; | ||
33 | private static final String LOCAL_SCRIPT = "resources/yocto_tool.sh"; | ||
34 | |||
35 | private static final String LOCAL_EXEC = "oprofile-viewer"; | ||
36 | |||
37 | private static final String TASK_NAME = "oprofile command"; | ||
38 | |||
39 | private IWorkbenchWindow window; | ||
40 | public OprofileModel(IHost host, IWorkbenchWindow window) { | ||
41 | super(host, TASK_NAME, LOCAL_SCRIPT, REMOTE_EXEC); | ||
42 | this.window = window; | ||
43 | } | ||
44 | |||
45 | private void startServer(IProgressMonitor monitor) throws Exception { | ||
46 | String args="start -d oprofile-server"; | ||
47 | runRemoteShellExec(monitor, args, true); | ||
48 | } | ||
49 | |||
50 | private void stopServer(IProgressMonitor monitor) throws Exception { | ||
51 | String args = "stop -d oprofile-server"; | ||
52 | runRemoteShellExec(monitor, args, false); | ||
53 | } | ||
54 | |||
55 | private String getSearchPath() | ||
56 | { | ||
57 | try | ||
58 | { | ||
59 | String search=null; | ||
60 | IPreferenceStore store = YoctoSDKPlugin.getDefault().getPreferenceStore(); | ||
61 | String env_script=store.getString(PreferenceConstants.TOOLCHAIN_ROOT) + | ||
62 | "/" + | ||
63 | "environment-setup-" + | ||
64 | store.getString(PreferenceConstants.TOOLCHAIN_TRIPLET); | ||
65 | File file = new File(env_script); | ||
66 | |||
67 | if (file.exists()) { | ||
68 | BufferedReader input = new BufferedReader(new FileReader(file)); | ||
69 | |||
70 | try | ||
71 | { | ||
72 | String line = null; | ||
73 | |||
74 | while ((line = input.readLine()) != null) | ||
75 | { | ||
76 | if (!line.startsWith("export")) | ||
77 | continue; | ||
78 | String sKey = line.substring("export".length() + 1, line.indexOf('=')); | ||
79 | if(!sKey.equals("PATH")) | ||
80 | continue; | ||
81 | String sValue = line.substring(line.indexOf('=') + 1); | ||
82 | if (sValue.startsWith("\"") && sValue.endsWith("\"")) | ||
83 | sValue = sValue.substring(sValue.indexOf('"') + 1, sValue.lastIndexOf('"')); | ||
84 | /* If PATH ending with $PATH, we need to join with current system path */ | ||
85 | if (sKey.equalsIgnoreCase("PATH")) { | ||
86 | if (sValue.lastIndexOf("$PATH") >= 0) | ||
87 | sValue = sValue.substring(0, sValue.lastIndexOf("$PATH")) + System.getenv("PATH"); | ||
88 | } | ||
89 | search=sValue; | ||
90 | //System.out.printf("get env key %s value %s\n", sKey, sValue); | ||
91 | } | ||
92 | |||
93 | } | ||
94 | finally { | ||
95 | input.close(); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | return search; | ||
100 | |||
101 | } | ||
102 | catch (IOException e) | ||
103 | { | ||
104 | e.printStackTrace(); | ||
105 | return null; | ||
106 | } | ||
107 | |||
108 | } | ||
109 | |||
110 | @Override | ||
111 | public void process(IProgressMonitor monitor) | ||
112 | throws InvocationTargetException, InterruptedException { | ||
113 | |||
114 | boolean stopServer=true; | ||
115 | |||
116 | try { | ||
117 | try { | ||
118 | monitor.beginTask("Starting oprofile", 100); | ||
119 | //start oprofile-server | ||
120 | monitor.subTask("Starting oprofile-server"); | ||
121 | startServer(new SubProgressMonitor(monitor,80)); | ||
122 | |||
123 | //start local oprofile-viewer | ||
124 | monitor.subTask("oprofile-viewer is running locally"); | ||
125 | String searchPath=getSearchPath(); | ||
126 | |||
127 | new LocalJob("oprofile-viewer", | ||
128 | (searchPath!=null) ? | ||
129 | new String[] {LOCAL_EXEC,"-h",host.getHostName(),"-s",searchPath} : | ||
130 | new String[] {LOCAL_EXEC,"-h",host.getHostName()}, | ||
131 | null, | ||
132 | null, | ||
133 | window).schedule(); | ||
134 | //we can't stop server because the oprofile-viewer is running asynchronously | ||
135 | stopServer=false; | ||
136 | |||
137 | }catch (InterruptedException e) { | ||
138 | throw e; | ||
139 | }finally { | ||
140 | //stop oprofile-server | ||
141 | if(stopServer) { | ||
142 | monitor.subTask("Stopping oprofile-viewer"); | ||
143 | stopServer(new SubProgressMonitor(monitor,30)); | ||
144 | } | ||
145 | } | ||
146 | }catch (InterruptedException e){ | ||
147 | throw e; | ||
148 | }catch (InvocationTargetException e) { | ||
149 | throw e; | ||
150 | }catch (Exception e){ | ||
151 | throw new InvocationTargetException(e, e.getMessage()); | ||
152 | }finally { | ||
153 | monitor.done(); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | static public boolean checkAvail() { | ||
158 | boolean ret=CommonHelper.isExecAvail(LOCAL_EXEC); | ||
159 | |||
160 | if(ret==false) { | ||
161 | CommonHelper.showErrorDialog("Oprofile", null,Messages.ErrorOprofileViewer); | ||
162 | }else { | ||
163 | ret=CommonHelper.isExecAvail("opreport"); | ||
164 | if(ret==false) { | ||
165 | CommonHelper.showErrorDialog("Oprofile", null,Messages.ErrorOprofile); | ||
166 | } | ||
167 | } | ||
168 | return ret; | ||
169 | } | ||
170 | |||
171 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PerfHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PerfHandler.java new file mode 100644 index 0000000..f3f9e49 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PerfHandler.java | |||
@@ -0,0 +1,30 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | |||
14 | public class PerfHandler extends DialogHandler { | ||
15 | |||
16 | private static String initCmd="cd; perf\r"; | ||
17 | |||
18 | @Override | ||
19 | protected String getInitCmd() { | ||
20 | return initCmd; | ||
21 | } | ||
22 | @Override | ||
23 | protected String getConnnectionName() { | ||
24 | return IBaseConstants.CONNECTION_NAME_PERF; | ||
25 | } | ||
26 | @Override | ||
27 | protected String getDialogTitle() { | ||
28 | return IBaseConstants.DIALOG_TITLE_PERF; | ||
29 | } | ||
30 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopHandler.java new file mode 100644 index 0000000..fe543de --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopHandler.java | |||
@@ -0,0 +1,48 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import org.eclipse.core.commands.AbstractHandler; | ||
14 | import org.eclipse.core.commands.ExecutionEvent; | ||
15 | import org.eclipse.core.commands.ExecutionException; | ||
16 | import org.eclipse.jface.dialogs.MessageDialog; | ||
17 | import org.eclipse.ui.IWorkbenchWindow; | ||
18 | import org.eclipse.ui.PlatformUI; | ||
19 | import org.eclipse.ui.handlers.HandlerUtil; | ||
20 | import org.eclipse.ui.progress.IProgressService; | ||
21 | |||
22 | public class PowertopHandler extends AbstractHandler { | ||
23 | |||
24 | public Object execute(ExecutionEvent event) throws ExecutionException { | ||
25 | IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); | ||
26 | |||
27 | PowertopSettingDialog setting=new PowertopSettingDialog( | ||
28 | window.getShell() | ||
29 | ); | ||
30 | |||
31 | if(setting.open()==BaseSettingDialog.OK) { | ||
32 | IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); | ||
33 | PowertopModel op=new PowertopModel(setting.getHost(),setting.getTime(),window.getShell().getDisplay()); | ||
34 | try { | ||
35 | progressService.busyCursorWhile(op); | ||
36 | }catch (InterruptedException e) { | ||
37 | //user cancelled | ||
38 | }catch (Exception e) { | ||
39 | e.printStackTrace(); | ||
40 | MessageDialog.openError(window.getShell(), | ||
41 | "Powertop", | ||
42 | (e.getCause() != null) ? e.getCause().getMessage() : e.getMessage()); | ||
43 | } | ||
44 | } | ||
45 | return null; | ||
46 | } | ||
47 | |||
48 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopModel.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopModel.java new file mode 100644 index 0000000..932f1c2 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopModel.java | |||
@@ -0,0 +1,106 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import java.io.File; | ||
14 | import java.lang.reflect.InvocationTargetException; | ||
15 | import java.text.SimpleDateFormat; | ||
16 | import java.util.Calendar; | ||
17 | |||
18 | import org.eclipse.core.runtime.IProgressMonitor; | ||
19 | import org.eclipse.core.runtime.SubProgressMonitor; | ||
20 | import org.eclipse.rse.core.model.IHost; | ||
21 | import org.eclipse.swt.widgets.Display; | ||
22 | import org.eclipse.ui.IWorkbenchPage; | ||
23 | import org.eclipse.ui.PartInitException; | ||
24 | import org.eclipse.ui.PlatformUI; | ||
25 | import org.yocto.sdk.remotetools.views.BaseFileView; | ||
26 | |||
27 | public class PowertopModel extends BaseModel { | ||
28 | |||
29 | private static final String REMOTE_EXEC = "/tmp/yocto_tool.sh"; | ||
30 | private static final String LOCAL_SCRIPT = "resources/yocto_tool.sh"; | ||
31 | |||
32 | private static final String REMOTE_FILE_PREFIX = "/tmp/yocto-powertop-"; | ||
33 | private static final String LOCAL_FILE_SUFFIX = ".local"; | ||
34 | |||
35 | private static final String TASK_NAME = "powertop command"; | ||
36 | |||
37 | private Float time; | ||
38 | Display display; | ||
39 | |||
40 | public PowertopModel(IHost host, Float time, Display display) { | ||
41 | super(host, TASK_NAME, LOCAL_SCRIPT, REMOTE_EXEC); | ||
42 | this.time=time; | ||
43 | this.display=display; | ||
44 | } | ||
45 | |||
46 | @Override | ||
47 | public void postProcess(IProgressMonitor monitor) | ||
48 | throws InvocationTargetException, InterruptedException { | ||
49 | try { | ||
50 | new File(localFile).delete(); | ||
51 | }catch (Exception e) { | ||
52 | |||
53 | } | ||
54 | } | ||
55 | |||
56 | private void generateData(IProgressMonitor monitor) throws Exception { | ||
57 | String currentDate = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(Calendar.getInstance().getTime()).toString(); | ||
58 | remoteFile = new String(REMOTE_FILE_PREFIX + currentDate); | ||
59 | localFile = new String(remoteFile + LOCAL_FILE_SUFFIX); | ||
60 | |||
61 | String args = "start -l " + remoteFile + " powertop --debug --time " + time.toString(); | ||
62 | |||
63 | runRemoteShellExec(monitor, args, true); | ||
64 | } | ||
65 | |||
66 | @Override | ||
67 | public void process(IProgressMonitor monitor) | ||
68 | throws InvocationTargetException, InterruptedException { | ||
69 | |||
70 | monitor.beginTask("Running powertop", 100); | ||
71 | try { | ||
72 | //running powertop | ||
73 | monitor.subTask("Generating powertop data file remotely"); | ||
74 | generateData(new SubProgressMonitor(monitor,30)); | ||
75 | //download datafile | ||
76 | monitor.subTask("Downloading powertop data file"); | ||
77 | getDataFile(new SubProgressMonitor(monitor,30)); | ||
78 | //show it in the powertop view | ||
79 | display.syncExec(new Runnable() { | ||
80 | public void run() { | ||
81 | BaseFileView view; | ||
82 | IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); | ||
83 | try { | ||
84 | view=(BaseFileView) page.showView("org.yocto.sdk.remotetools.views.PowerTopView"); | ||
85 | }catch (PartInitException e) { | ||
86 | e.printStackTrace(); | ||
87 | return; | ||
88 | } | ||
89 | view.setInput(localFile); | ||
90 | page.bringToTop(view); | ||
91 | } | ||
92 | }); | ||
93 | |||
94 | }catch (InterruptedException e){ | ||
95 | throw e; | ||
96 | }catch (InvocationTargetException e) { | ||
97 | throw e; | ||
98 | }catch (Exception e){ | ||
99 | throw new InvocationTargetException(e, e.getMessage()); | ||
100 | }finally { | ||
101 | monitor.done(); | ||
102 | } | ||
103 | |||
104 | } | ||
105 | |||
106 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopSettingDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopSettingDialog.java new file mode 100644 index 0000000..5fb258e --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/PowertopSettingDialog.java | |||
@@ -0,0 +1,126 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import org.eclipse.jface.dialogs.IDialogConstants; | ||
14 | import org.eclipse.jface.dialogs.IDialogSettings; | ||
15 | import org.eclipse.swt.SWT; | ||
16 | import org.eclipse.swt.events.ModifyEvent; | ||
17 | import org.eclipse.swt.events.ModifyListener; | ||
18 | import org.eclipse.swt.layout.GridData; | ||
19 | import org.eclipse.swt.layout.GridLayout; | ||
20 | import org.eclipse.swt.widgets.Button; | ||
21 | import org.eclipse.swt.widgets.Composite; | ||
22 | import org.eclipse.swt.widgets.Control; | ||
23 | import org.eclipse.swt.widgets.Label; | ||
24 | import org.eclipse.swt.widgets.Shell; | ||
25 | import org.eclipse.swt.widgets.Text; | ||
26 | import org.yocto.sdk.remotetools.Activator; | ||
27 | import org.yocto.sdk.remotetools.Messages; | ||
28 | import org.yocto.sdk.remotetools.SWTFactory; | ||
29 | |||
30 | public class PowertopSettingDialog extends BaseSettingDialog { | ||
31 | |||
32 | static protected String TITLE="Powertop"; | ||
33 | |||
34 | protected boolean showPid=false; | ||
35 | protected Float time; | ||
36 | protected Text timeText; | ||
37 | |||
38 | protected PowertopSettingDialog(Shell parentShell, String title, String conn) { | ||
39 | super(parentShell,title,conn); | ||
40 | } | ||
41 | |||
42 | public PowertopSettingDialog(Shell parentShell) { | ||
43 | this(parentShell, | ||
44 | TITLE, | ||
45 | Activator.getDefault().getDialogSettings().get(IBaseConstants.CONNECTION_NAME_POWERTOP) | ||
46 | ); | ||
47 | } | ||
48 | |||
49 | public Float getTime() { | ||
50 | return time; | ||
51 | } | ||
52 | |||
53 | @Override | ||
54 | protected Control createDialogArea(Composite parent) { | ||
55 | Composite comp=(Composite)super.createDialogArea(parent); | ||
56 | GridLayout topLayout = new GridLayout(); | ||
57 | comp.setLayout(topLayout); | ||
58 | |||
59 | /*argument*/ | ||
60 | SWTFactory.createVerticalSpacer(comp, 1); | ||
61 | createInternal(comp); | ||
62 | |||
63 | updateOkButton(); | ||
64 | return comp; | ||
65 | } | ||
66 | |||
67 | protected void createInternal(Composite parent) | ||
68 | { | ||
69 | Composite projComp = new Composite(parent, SWT.NONE); | ||
70 | GridLayout projLayout = new GridLayout(); | ||
71 | projLayout.numColumns = 4; | ||
72 | projLayout.marginHeight = 0; | ||
73 | projLayout.marginWidth = 0; | ||
74 | projComp.setLayout(projLayout); | ||
75 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
76 | projComp.setLayoutData(gd); | ||
77 | |||
78 | Label label = new Label(projComp, SWT.NONE); | ||
79 | label.setText(Messages.Powertop_Time_Text); | ||
80 | gd = new GridData(); | ||
81 | gd.horizontalSpan = 1; | ||
82 | label.setLayoutData(gd); | ||
83 | |||
84 | timeText = new Text(projComp, SWT.SINGLE | SWT.BORDER); | ||
85 | timeText.setText("5"); | ||
86 | timeText.addModifyListener(new ModifyListener() { | ||
87 | public void modifyText(ModifyEvent e) { | ||
88 | updateOkButton(); | ||
89 | } | ||
90 | }); | ||
91 | gd = new GridData(GridData.FILL_HORIZONTAL); | ||
92 | gd.horizontalSpan = 3; | ||
93 | timeText.setLayoutData(gd); | ||
94 | } | ||
95 | |||
96 | @Override | ||
97 | protected boolean updateOkButton() { | ||
98 | boolean ret=super.updateOkButton(); | ||
99 | if(ret==true) { | ||
100 | try { | ||
101 | Float.valueOf(timeText.getText()); | ||
102 | }catch (Exception e) { | ||
103 | Button button=getButton(IDialogConstants.OK_ID); | ||
104 | if(button!=null) | ||
105 | button.setEnabled(false); | ||
106 | ret=false; | ||
107 | } | ||
108 | } | ||
109 | return ret; | ||
110 | } | ||
111 | |||
112 | @Override | ||
113 | protected void okPressed() { | ||
114 | IDialogSettings settings = Activator.getDefault().getDialogSettings(); | ||
115 | // store the value of the generate sections checkbox | ||
116 | if(getCurrentConnection()==null) { | ||
117 | settings.put(IBaseConstants.CONNECTION_NAME_POWERTOP, | ||
118 | (String)null); | ||
119 | }else { | ||
120 | settings.put(IBaseConstants.CONNECTION_NAME_POWERTOP, | ||
121 | getCurrentConnection().getAliasName()); | ||
122 | } | ||
123 | time=new Float(timeText.getText()); | ||
124 | super.okPressed(); | ||
125 | } | ||
126 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SimpleSettingDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SimpleSettingDialog.java new file mode 100644 index 0000000..140d892 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SimpleSettingDialog.java | |||
@@ -0,0 +1,54 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import org.yocto.sdk.remotetools.Activator; | ||
14 | import org.eclipse.jface.dialogs.IDialogSettings; | ||
15 | import org.eclipse.swt.widgets.Composite; | ||
16 | import org.eclipse.swt.widgets.Control; | ||
17 | import org.eclipse.swt.widgets.Shell; | ||
18 | |||
19 | public class SimpleSettingDialog extends BaseSettingDialog { | ||
20 | |||
21 | private final String connPropName; | ||
22 | /* | ||
23 | protected SimpleSettingDialog(Shell parentShell, String title, String conn) { | ||
24 | super(parentShell,title,conn); | ||
25 | } | ||
26 | */ | ||
27 | |||
28 | public SimpleSettingDialog(Shell parentShell, String title, String connPropertyName) { | ||
29 | super(parentShell, | ||
30 | title, | ||
31 | Activator.getDefault().getDialogSettings().get(connPropertyName) | ||
32 | ); | ||
33 | connPropName=connPropertyName; | ||
34 | } | ||
35 | |||
36 | @Override | ||
37 | protected Control createDialogArea(Composite parent) { | ||
38 | return super.createDialogArea(parent); | ||
39 | } | ||
40 | |||
41 | @Override | ||
42 | protected void okPressed() { | ||
43 | IDialogSettings settings = Activator.getDefault().getDialogSettings(); | ||
44 | // store the value of the generate sections checkbox | ||
45 | if(getCurrentConnection()==null) { | ||
46 | settings.put(connPropName, | ||
47 | (String)null); | ||
48 | }else { | ||
49 | settings.put(connPropName, | ||
50 | getCurrentConnection().getAliasName()); | ||
51 | } | ||
52 | super.okPressed(); | ||
53 | } | ||
54 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapHandler.java new file mode 100644 index 0000000..4cf30e4 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapHandler.java | |||
@@ -0,0 +1,125 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2011 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | import java.lang.reflect.InvocationTargetException; | ||
13 | import org.eclipse.core.commands.AbstractHandler; | ||
14 | import org.eclipse.core.commands.ExecutionEvent; | ||
15 | import org.eclipse.core.commands.ExecutionException; | ||
16 | |||
17 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
18 | import org.eclipse.rse.core.model.IHost; | ||
19 | import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper; | ||
20 | import org.eclipse.rse.internal.terminals.ui.views.RSETerminalConnector; | ||
21 | import org.eclipse.rse.internal.terminals.ui.views.TerminalViewTab; | ||
22 | import org.eclipse.rse.internal.terminals.ui.views.TerminalViewer; | ||
23 | import org.eclipse.rse.internal.terminals.ui.views.TerminalsUI; | ||
24 | import org.eclipse.rse.services.terminals.ITerminalShell; | ||
25 | import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem; | ||
26 | import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement; | ||
27 | import org.eclipse.swt.custom.CTabItem; | ||
28 | import org.eclipse.swt.events.DisposeEvent; | ||
29 | import org.eclipse.swt.events.DisposeListener; | ||
30 | import org.eclipse.swt.widgets.Shell; | ||
31 | import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; | ||
32 | import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; | ||
33 | import org.eclipse.ui.IWorkbenchWindow; | ||
34 | import org.eclipse.ui.handlers.HandlerUtil; | ||
35 | import org.yocto.remote.utils.RemoteHelper; | ||
36 | |||
37 | public class SystemtapHandler extends AbstractHandler { | ||
38 | protected SystemtapSettingDialog setting; | ||
39 | protected String changeTerm="export TERM=vt100;"; | ||
40 | protected String localConnection="LOCALHOST"; | ||
41 | protected IWorkbenchWindow window; | ||
42 | protected Shell shell; | ||
43 | |||
44 | public Object execute(ExecutionEvent event) throws ExecutionException { | ||
45 | |||
46 | this.window = HandlerUtil.getActiveWorkbenchWindowChecked(event); | ||
47 | shell = window.getShell(); | ||
48 | setting=new SystemtapSettingDialog( | ||
49 | shell, "Systemtap" | ||
50 | ); | ||
51 | |||
52 | |||
53 | if(setting.open() == BaseSettingDialog.OK) { | ||
54 | |||
55 | String metadata_location = ((SystemtapSettingDialog)setting).getMetadataLocation(); | ||
56 | String builddir_location = ((SystemtapSettingDialog)setting).getBuilddirLocation(); | ||
57 | String remote_host = ((SystemtapSettingDialog)setting).getRemoteHost(); | ||
58 | String user_id = ((SystemtapSettingDialog)setting).getUserID(); | ||
59 | String systemtap_script = ((SystemtapSettingDialog)setting).getSystemtapScript(); | ||
60 | String systemtap_args = ((SystemtapSettingDialog)setting).getSystemtapArgs(); | ||
61 | RemoteHelper.waitForRSEInitCompletition(); | ||
62 | IHost host = RemoteHelper.getRemoteConnectionByName(localConnection); | ||
63 | if (host == null) | ||
64 | host = RemoteHelper.createLocalConnection(); | ||
65 | final ITerminalServiceSubSystem terminalSubSystem = RemoteHelper.getTerminalSubSystem(host); | ||
66 | |||
67 | if (terminalSubSystem != null) { | ||
68 | TerminalsUI terminalsUI = TerminalsUI.getInstance(); | ||
69 | TerminalViewer terminalViewer = terminalsUI.activateTerminalsView(); | ||
70 | SystemtapModel op = new SystemtapModel(metadata_location,builddir_location, remote_host, user_id, systemtap_script, | ||
71 | systemtap_args,window.getShell().getDisplay()); | ||
72 | try { | ||
73 | op.setHost(host); | ||
74 | op.preProcess(new NullProgressMonitor()); | ||
75 | } catch (InvocationTargetException e) { | ||
76 | e.printStackTrace(); | ||
77 | } catch (InterruptedException e) { | ||
78 | e.printStackTrace(); | ||
79 | } | ||
80 | CTabItem tab = terminalViewer.getTabFolder().createTabItem( | ||
81 | host, changeTerm + "cd " + metadata_location+ ";" + "source oe-init-build-env " + builddir_location + ";" + "crosstap " + user_id + "@" + remote_host + " " + systemtap_script + " " + systemtap_args +"\r"); | ||
82 | try { | ||
83 | tab.addDisposeListener(new DisposeListener() { | ||
84 | public void widgetDisposed(DisposeEvent e) { | ||
85 | Object source = e.getSource(); | ||
86 | if (source instanceof CTabItem) { | ||
87 | CTabItem currentItem = (CTabItem) source; | ||
88 | ITerminalShell shell= getTerminalShellFromTab(currentItem); | ||
89 | if(shell!=null) { | ||
90 | shell.exit(); | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | }); | ||
95 | } catch(Exception e) { | ||
96 | e.printStackTrace(); | ||
97 | } | ||
98 | TerminalElement element = TerminalServiceHelper.createTerminalElement(tab, terminalSubSystem); | ||
99 | terminalSubSystem.addChild(element); | ||
100 | } | ||
101 | |||
102 | } | ||
103 | return false; | ||
104 | } | ||
105 | |||
106 | protected ITerminalShell getTerminalShellFromTab(CTabItem item) { | ||
107 | ITerminalShell terminalShell = null; | ||
108 | ITerminalViewControl terminalViewControl = (ITerminalViewControl)item.getData(TerminalViewTab.DATA_KEY_CONTROL); | ||
109 | ITerminalConnector terminalConnector = terminalViewControl.getTerminalConnector(); | ||
110 | if (terminalConnector instanceof RSETerminalConnector) { | ||
111 | RSETerminalConnector rseTerminalConnector = (RSETerminalConnector) terminalConnector; | ||
112 | terminalShell = rseTerminalConnector.getTerminalHostShell(); | ||
113 | } | ||
114 | return terminalShell; | ||
115 | } | ||
116 | |||
117 | protected void initialize(ExecutionEvent event) throws ExecutionException { | ||
118 | this.window = HandlerUtil.getActiveWorkbenchWindowChecked(event); | ||
119 | shell = window.getShell(); | ||
120 | setting=new SystemtapSettingDialog( | ||
121 | shell, "Systemtap" | ||
122 | ); | ||
123 | } | ||
124 | |||
125 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapModel.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapModel.java new file mode 100644 index 0000000..60d7d76 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapModel.java | |||
@@ -0,0 +1,107 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import java.io.File; | ||
14 | import java.lang.reflect.InvocationTargetException; | ||
15 | |||
16 | import org.eclipse.core.runtime.IProgressMonitor; | ||
17 | import org.eclipse.core.runtime.NullProgressMonitor; | ||
18 | import org.eclipse.core.runtime.OperationCanceledException; | ||
19 | import org.eclipse.jface.dialogs.ProgressMonitorDialog; | ||
20 | import org.eclipse.jface.operation.IRunnableWithProgress; | ||
21 | import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem; | ||
22 | import org.eclipse.rse.ui.SystemBasePlugin; | ||
23 | import org.eclipse.swt.widgets.Display; | ||
24 | import org.eclipse.ui.console.ConsolePlugin; | ||
25 | import org.eclipse.ui.console.IConsole; | ||
26 | import org.eclipse.ui.console.IConsoleManager; | ||
27 | import org.eclipse.ui.console.MessageConsole; | ||
28 | import org.yocto.remote.utils.ShellSession; | ||
29 | import org.yocto.remote.utils.RemoteHelper; | ||
30 | import org.yocto.remote.utils.CommonHelper; | ||
31 | |||
32 | public class SystemtapModel extends BaseModel { | ||
33 | protected static final String DEFAULT_INIT_SCRIPT = "oe-init-build-env"; | ||
34 | protected static final String SYSTEMTAP_CONSOLE = "Systemtap Console"; | ||
35 | |||
36 | private static final String TASK_NAME = "systemtap command"; | ||
37 | |||
38 | protected MessageConsole sessionConsole; | ||
39 | private String metadata_location; | ||
40 | private String builddir_location; | ||
41 | private String remote_host; | ||
42 | private String user_id; | ||
43 | private String systemtap_script; | ||
44 | private String systemtap_args; | ||
45 | |||
46 | Display display; | ||
47 | |||
48 | public SystemtapModel(String metadata_location, String builddir_location, String remote_host, String user_id, String systemtap_script, String systemtap_args, Display display) { | ||
49 | super(null, TASK_NAME, "", ""); | ||
50 | this.metadata_location = metadata_location; | ||
51 | this.builddir_location = builddir_location; | ||
52 | this.remote_host = remote_host; | ||
53 | this.user_id = user_id; | ||
54 | this.systemtap_script = systemtap_script; | ||
55 | this.systemtap_args = systemtap_args; | ||
56 | this.display = display; | ||
57 | } | ||
58 | |||
59 | @Override | ||
60 | public void preProcess(IProgressMonitor monitor) | ||
61 | throws InvocationTargetException, InterruptedException { | ||
62 | final ITerminalServiceSubSystem terminalSubSystem = RemoteHelper.getTerminalSubSystem(host); | ||
63 | if (!terminalSubSystem.isConnected()) { | ||
64 | try { | ||
65 | ProgressMonitorDialog dialog = new ProgressMonitorDialog(null); | ||
66 | dialog.run(true, true, new IRunnableWithProgress(){ | ||
67 | @Override | ||
68 | public void run(IProgressMonitor monitor) { | ||
69 | monitor.beginTask("Connecting to remote target ...", 100); | ||
70 | try { | ||
71 | terminalSubSystem.connect(new NullProgressMonitor(), false); | ||
72 | monitor.done(); | ||
73 | } catch (Exception e) { | ||
74 | CommonHelper.showErrorDialog("Connection failure", null, e.getMessage()); | ||
75 | monitor.done(); | ||
76 | } | ||
77 | } | ||
78 | }); | ||
79 | } catch (OperationCanceledException e) { | ||
80 | // user canceled, return silently | ||
81 | } catch (Exception e) { | ||
82 | SystemBasePlugin.logError(e.getLocalizedMessage(), e); | ||
83 | } | ||
84 | } | ||
85 | } | ||
86 | |||
87 | protected String changeTerm = "export TERM=vt100;"; | ||
88 | |||
89 | @Override | ||
90 | public void process(IProgressMonitor monitor) | ||
91 | throws InvocationTargetException, InterruptedException { | ||
92 | try { | ||
93 | ShellSession shell = new ShellSession(ShellSession.SHELL_TYPE_BASH, | ||
94 | new File(this.metadata_location),new File(this.builddir_location), | ||
95 | DEFAULT_INIT_SCRIPT, sessionConsole.newOutputStream()); | ||
96 | boolean acceptedKey = shell.ensureKnownHostKey(user_id, remote_host); | ||
97 | if (acceptedKey) { | ||
98 | String crosstapCmd = "crosstap " + user_id + "@" + remote_host + " " + systemtap_script; | ||
99 | if (systemtap_args != null) | ||
100 | crosstapCmd = crosstapCmd + " " + systemtap_args; | ||
101 | shell.execute(crosstapCmd); | ||
102 | } | ||
103 | } catch (Exception e) { | ||
104 | throw new InvocationTargetException(e,e.getMessage()); | ||
105 | } | ||
106 | } | ||
107 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapSettingDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapSettingDialog.java new file mode 100644 index 0000000..e382cd6 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapSettingDialog.java | |||
@@ -0,0 +1,280 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import java.io.File; | ||
14 | |||
15 | import org.eclipse.jface.dialogs.Dialog; | ||
16 | import org.eclipse.jface.dialogs.IDialogSettings; | ||
17 | import org.eclipse.swt.SWT; | ||
18 | import org.eclipse.swt.events.SelectionAdapter; | ||
19 | import org.eclipse.swt.events.SelectionEvent; | ||
20 | import org.eclipse.swt.layout.GridData; | ||
21 | import org.eclipse.swt.layout.GridLayout; | ||
22 | import org.eclipse.swt.widgets.Button; | ||
23 | import org.eclipse.swt.widgets.Composite; | ||
24 | import org.eclipse.swt.widgets.Control; | ||
25 | import org.eclipse.swt.widgets.DirectoryDialog; | ||
26 | import org.eclipse.swt.widgets.FileDialog; | ||
27 | import org.eclipse.swt.widgets.Label; | ||
28 | import org.eclipse.swt.widgets.Shell; | ||
29 | import org.eclipse.swt.widgets.Text; | ||
30 | import org.yocto.remote.utils.CommonHelper; | ||
31 | import org.yocto.sdk.remotetools.Activator; | ||
32 | import org.yocto.sdk.remotetools.Messages; | ||
33 | import org.yocto.sdk.remotetools.SWTFactory; | ||
34 | |||
35 | public class SystemtapSettingDialog extends Dialog { | ||
36 | |||
37 | static protected String TITLE="Systemtap Crosstap"; | ||
38 | protected String title; | ||
39 | protected String metadata_location; | ||
40 | protected String builddir_location; | ||
41 | protected String systemtap_script; | ||
42 | protected String user_id; | ||
43 | protected String remote_host; | ||
44 | protected String systemtap_args; | ||
45 | protected boolean okPressed; | ||
46 | protected Button metadataLocationBtn; | ||
47 | protected Button builddirLocationBtn; | ||
48 | protected Button systemtapScriptBtn; | ||
49 | protected Text userIDText; | ||
50 | protected Text remoteHostText; | ||
51 | protected Text systemtapArgsText; | ||
52 | protected Text systemtapScriptText; | ||
53 | protected Text metadataLocationText; | ||
54 | protected Text builddirLocationText; | ||
55 | |||
56 | protected SystemtapSettingDialog(Shell parentShell, String title) { | ||
57 | super(parentShell); | ||
58 | this.title = title; | ||
59 | this.okPressed = false; | ||
60 | setShellStyle(getShellStyle() | SWT.RESIZE); | ||
61 | } | ||
62 | |||
63 | @Override | ||
64 | protected void configureShell(Shell newShell) { | ||
65 | super.configureShell(newShell); | ||
66 | newShell.setText(title); | ||
67 | } | ||
68 | |||
69 | public boolean isOKPressed() { | ||
70 | return okPressed; | ||
71 | } | ||
72 | |||
73 | public String getSystemtapScript() { | ||
74 | return systemtap_script; | ||
75 | } | ||
76 | |||
77 | public String getMetadataLocation() { | ||
78 | return metadata_location; | ||
79 | } | ||
80 | |||
81 | public String getBuilddirLocation(){ | ||
82 | return builddir_location; | ||
83 | } | ||
84 | |||
85 | public String getRemoteHost() { | ||
86 | return remote_host; | ||
87 | } | ||
88 | |||
89 | public String getUserID() { | ||
90 | return user_id; | ||
91 | } | ||
92 | |||
93 | public String getSystemtapArgs() { | ||
94 | return systemtap_args; | ||
95 | } | ||
96 | @Override | ||
97 | protected Control createDialogArea(Composite parent) { | ||
98 | Composite comp=(Composite)super.createDialogArea(parent); | ||
99 | GridLayout topLayout = new GridLayout(); | ||
100 | comp.setLayout(topLayout); | ||
101 | |||
102 | /*argument*/ | ||
103 | SWTFactory.createVerticalSpacer(comp, 1); | ||
104 | createInternal(comp); | ||
105 | |||
106 | return comp; | ||
107 | } | ||
108 | |||
109 | protected void createInternal(Composite parent) | ||
110 | { | ||
111 | Composite projComp = new Composite(parent, SWT.NONE); | ||
112 | GridLayout projLayout = new GridLayout(); | ||
113 | projLayout.numColumns = 2; | ||
114 | projLayout.marginHeight = 0; | ||
115 | projLayout.marginWidth = 0; | ||
116 | projComp.setLayout(projLayout); | ||
117 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
118 | projComp.setLayoutData(gd); | ||
119 | |||
120 | Label label = new Label(projComp, SWT.NONE); | ||
121 | label.setText(Messages.Metadata_Location); | ||
122 | Composite textContainer = new Composite(projComp, SWT.NONE); | ||
123 | textContainer.setLayout(new GridLayout(2, false)); | ||
124 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
125 | metadataLocationText = (Text)addTextControl(textContainer, metadata_location); | ||
126 | metadataLocationBtn = addDirSelectButton(textContainer, metadataLocationText); | ||
127 | |||
128 | label = new Label(projComp, SWT.NONE); | ||
129 | label.setText(Messages.Builddir_Location); | ||
130 | textContainer = new Composite(projComp, SWT.NONE); | ||
131 | textContainer.setLayout(new GridLayout(2, false)); | ||
132 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
133 | builddirLocationText = (Text)addTextControl(textContainer, builddir_location); | ||
134 | builddirLocationBtn = addDirSelectButton(textContainer,builddirLocationText); | ||
135 | |||
136 | label = new Label(projComp, SWT.NONE); | ||
137 | label.setText(Messages.Remote_User_ID); | ||
138 | userIDText = new Text(projComp, SWT.SINGLE | SWT.BORDER); | ||
139 | |||
140 | if(user_id!=null) | ||
141 | userIDText.setText(user_id); | ||
142 | gd = new GridData(GridData.FILL_HORIZONTAL); | ||
143 | gd.horizontalSpan = 1; | ||
144 | userIDText.setLayoutData(gd); | ||
145 | |||
146 | label = new Label(projComp, SWT.NONE); | ||
147 | label.setText(Messages.Remote_Host); | ||
148 | |||
149 | remoteHostText = new Text(projComp, SWT.SINGLE | SWT.BORDER); | ||
150 | if(remote_host != null) | ||
151 | remoteHostText.setText(remote_host); | ||
152 | gd = new GridData(GridData.FILL_HORIZONTAL); | ||
153 | gd.horizontalSpan = 1; | ||
154 | remoteHostText.setLayoutData(gd); | ||
155 | |||
156 | label = new Label(projComp, SWT.NONE); | ||
157 | label.setText(Messages.Systemtap_Script); | ||
158 | textContainer = new Composite(projComp, SWT.NONE); | ||
159 | textContainer.setLayout(new GridLayout(2, false)); | ||
160 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
161 | systemtapScriptText = (Text)addTextControl(textContainer, systemtap_script); | ||
162 | systemtapScriptBtn = addFileSelectButton(textContainer, systemtapScriptText); | ||
163 | |||
164 | label = new Label(projComp, SWT.NONE); | ||
165 | label.setText(Messages.Systemtap_Args); | ||
166 | |||
167 | systemtapArgsText = new Text(projComp, SWT.SINGLE | SWT.BORDER); | ||
168 | if(systemtap_args != null) | ||
169 | systemtapArgsText.setText(systemtap_args); | ||
170 | gd = new GridData(GridData.FILL_HORIZONTAL); | ||
171 | gd.horizontalSpan = 1; | ||
172 | systemtapArgsText.setLayoutData(gd); | ||
173 | } | ||
174 | |||
175 | private Control addTextControl(final Composite parent, String value) { | ||
176 | final Text text; | ||
177 | |||
178 | text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER); | ||
179 | text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
180 | if (value != null) | ||
181 | text.setText(value); | ||
182 | text.setSize(10, 150); | ||
183 | return (Control)text; | ||
184 | } | ||
185 | |||
186 | private Button addDirSelectButton(final Composite parent, final Text text) { | ||
187 | Button button = new Button(parent, SWT.PUSH | SWT.LEAD); | ||
188 | button.setText("Browse"); | ||
189 | button.addSelectionListener(new SelectionAdapter() { | ||
190 | @Override | ||
191 | public void widgetSelected(SelectionEvent event) { | ||
192 | String dirName; | ||
193 | |||
194 | dirName = new DirectoryDialog(parent.getShell()).open(); | ||
195 | if (dirName != null) { | ||
196 | text.setText(dirName); | ||
197 | } | ||
198 | } | ||
199 | }); | ||
200 | return button; | ||
201 | } | ||
202 | |||
203 | private Button addFileSelectButton(final Composite parent, final Text text) { | ||
204 | Button button = new Button(parent, SWT.PUSH | SWT.LEAD); | ||
205 | button.setText("Browse"); | ||
206 | button.addSelectionListener(new SelectionAdapter() { | ||
207 | @Override | ||
208 | public void widgetSelected(SelectionEvent event) { | ||
209 | String fileName; | ||
210 | |||
211 | fileName = new FileDialog(parent.getShell()).open(); | ||
212 | if (fileName != null) { | ||
213 | text.setText(fileName); | ||
214 | } | ||
215 | } | ||
216 | }); | ||
217 | return button; | ||
218 | } | ||
219 | |||
220 | @Override | ||
221 | protected void okPressed() { | ||
222 | IDialogSettings settings = Activator.getDefault().getDialogSettings(); | ||
223 | metadata_location = metadataLocationText.getText(); | ||
224 | if ( (metadata_location == null) || metadata_location.isEmpty()) { | ||
225 | CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify your metadata location!"); | ||
226 | return; | ||
227 | } | ||
228 | File metadata_dir = new File(metadata_location); | ||
229 | if (!metadata_dir.exists()) { | ||
230 | CommonHelper.showErrorDialog("SystemTap Error", null, "The specified metadata location does not exist!"); | ||
231 | return; | ||
232 | } | ||
233 | if (!metadata_dir.isDirectory()) { | ||
234 | CommonHelper.showErrorDialog("SystemTap Error", null, "The specified metadata location is not a directory!"); | ||
235 | return; | ||
236 | } | ||
237 | builddir_location = builddirLocationText.getText(); | ||
238 | if ( (builddir_location == null) || builddir_location.isEmpty()) { | ||
239 | CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify your builddir location!"); | ||
240 | return; | ||
241 | } | ||
242 | File builddir_dir = new File(builddir_location); | ||
243 | if (!builddir_dir.exists()) { | ||
244 | CommonHelper.showErrorDialog("SystemTap Error", null, "The specified builddir location does not exist!"); | ||
245 | } | ||
246 | if (!builddir_dir.isDirectory()) { | ||
247 | CommonHelper.showErrorDialog("SystemTap Error", null, "The specified builddir location is not a directory!"); | ||
248 | return; | ||
249 | } | ||
250 | user_id = userIDText.getText(); | ||
251 | if ( (user_id == null) || user_id.isEmpty()) { | ||
252 | CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify remote user id!"); | ||
253 | return; | ||
254 | } | ||
255 | |||
256 | remote_host = remoteHostText.getText(); | ||
257 | if ( (remote_host == null) || remote_host.isEmpty()) { | ||
258 | CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify remote host IP!"); | ||
259 | return; | ||
260 | } | ||
261 | |||
262 | systemtap_script = systemtapScriptText.getText(); | ||
263 | if ( (systemtap_script == null) || systemtap_script.isEmpty()) { | ||
264 | CommonHelper.showErrorDialog("SystemTap Error", null, "Please specify your systemtap script"); | ||
265 | return; | ||
266 | } | ||
267 | File script_file = new File(systemtap_script); | ||
268 | if (!script_file.exists()) { | ||
269 | CommonHelper.showErrorDialog("SystemTap Error", null, "The specified systemtap script does not exist!"); | ||
270 | return; | ||
271 | } | ||
272 | if (!script_file.isFile()) { | ||
273 | CommonHelper.showErrorDialog("SystemTap Error", null, "The specified systemtap script is not a file!"); | ||
274 | return; | ||
275 | } | ||
276 | systemtap_args = systemtapArgsText.getText(); | ||
277 | okPressed = true; | ||
278 | super.okPressed(); | ||
279 | } | ||
280 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Handler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Handler.java new file mode 100644 index 0000000..9e18097 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Handler.java | |||
@@ -0,0 +1,59 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import org.eclipse.core.commands.AbstractHandler; | ||
14 | import org.eclipse.core.commands.ExecutionEvent; | ||
15 | import org.eclipse.core.commands.ExecutionException; | ||
16 | import org.eclipse.jface.dialogs.MessageDialog; | ||
17 | import org.eclipse.ui.IWorkbenchWindow; | ||
18 | import org.eclipse.ui.PlatformUI; | ||
19 | import org.eclipse.ui.handlers.HandlerUtil; | ||
20 | import org.eclipse.ui.progress.IProgressService; | ||
21 | |||
22 | import org.yocto.sdk.remotetools.Messages; | ||
23 | |||
24 | public class Ust2Handler extends AbstractHandler { | ||
25 | |||
26 | public Object execute(ExecutionEvent event) throws ExecutionException { | ||
27 | |||
28 | //if(UstModel.checkAvail()!=true) { | ||
29 | // return null; | ||
30 | //} | ||
31 | |||
32 | IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); | ||
33 | |||
34 | Ust2SettingDialog setting=new Ust2SettingDialog( | ||
35 | window.getShell() | ||
36 | ); | ||
37 | |||
38 | if(setting.open()==BaseSettingDialog.OK) { | ||
39 | IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); | ||
40 | String project = setting.getProject(); | ||
41 | if (project == null) { | ||
42 | MessageDialog.openError(window.getShell(), "Lttng-ust", Messages.ErrorUstProject); | ||
43 | return null; | ||
44 | } | ||
45 | Ust2Model op=new Ust2Model(setting.getHost(),setting.getTrace(), project, window); | ||
46 | try { | ||
47 | progressService.busyCursorWhile(op); | ||
48 | }catch (InterruptedException e) { | ||
49 | //user cancelled | ||
50 | }catch (Exception e) { | ||
51 | e.printStackTrace(); | ||
52 | MessageDialog.openError(window.getShell(), | ||
53 | "Ust", | ||
54 | (e.getCause() != null) ? e.getCause().getMessage() : e.getMessage()); | ||
55 | } | ||
56 | } | ||
57 | return null; | ||
58 | } | ||
59 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Model.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Model.java new file mode 100644 index 0000000..8dcc5b3 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Model.java | |||
@@ -0,0 +1,166 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import java.io.BufferedReader; | ||
14 | import java.io.File; | ||
15 | import java.io.IOException; | ||
16 | import java.io.InputStream; | ||
17 | import java.io.InputStreamReader; | ||
18 | import java.lang.reflect.InvocationTargetException; | ||
19 | |||
20 | import org.eclipse.core.resources.IFolder; | ||
21 | import org.eclipse.core.resources.IProject; | ||
22 | import org.eclipse.core.resources.IResource; | ||
23 | import org.eclipse.core.resources.IWorkspaceRoot; | ||
24 | import org.eclipse.core.resources.ResourcesPlugin; | ||
25 | import org.eclipse.core.runtime.IPath; | ||
26 | import org.eclipse.core.runtime.IProgressMonitor; | ||
27 | import org.eclipse.core.runtime.Path; | ||
28 | import org.eclipse.core.runtime.SubProgressMonitor; | ||
29 | import org.eclipse.rse.core.model.IHost; | ||
30 | import org.eclipse.ui.IWorkbenchWindow; | ||
31 | |||
32 | public class Ust2Model extends BaseModel { | ||
33 | |||
34 | private static final String REMOTE_EXEC = "/tmp/ust_tar.sh"; | ||
35 | private static final String LOCAL_SCRIPT = "resources/ust_tar.sh"; | ||
36 | |||
37 | private static final String LOCAL_FILE_SUFFIX = ".local.tar"; | ||
38 | private static final String REMOTE_FILE_SUFFIX = ".tar"; | ||
39 | private static final String LOCAL_EXEC = "lttv-gui"; | ||
40 | private static final String TRACE_FOLDER_NAME = "Traces"; | ||
41 | private static final String DATAFILE_PREFIX = "ustfile:"; | ||
42 | |||
43 | private static final String TASK_NAME = "ust2trace command"; | ||
44 | |||
45 | private String trace_loc; | ||
46 | |||
47 | private String prj_name; | ||
48 | |||
49 | private IWorkbenchWindow window; | ||
50 | |||
51 | public Ust2Model(IHost host, String trace, String project, IWorkbenchWindow window) { | ||
52 | super(host, TASK_NAME, LOCAL_SCRIPT, REMOTE_EXEC); | ||
53 | trace_loc = trace; | ||
54 | |||
55 | prj_name = project; | ||
56 | this.window = window; | ||
57 | } | ||
58 | |||
59 | @Override | ||
60 | protected void checkTerminate(InputStream is) throws IOException { | ||
61 | String temp; | ||
62 | BufferedReader in = new BufferedReader(new InputStreamReader(is)); | ||
63 | while((temp = in.readLine())!=null) { | ||
64 | int idx = temp.indexOf(DATAFILE_PREFIX); | ||
65 | if(idx != -1) { | ||
66 | remoteFile = temp.substring(idx + DATAFILE_PREFIX.length()); | ||
67 | break; | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | |||
72 | private void generateData(IProgressMonitor monitor) throws Exception { | ||
73 | runRemoteShellExec(monitor, trace_loc, true); | ||
74 | if(remoteFile == null) | ||
75 | throw new Exception("Ust: null remote data file"); | ||
76 | if(remoteFile.endsWith(REMOTE_FILE_SUFFIX)==false) | ||
77 | throw new Exception("Wrong ust data file " + remoteFile); | ||
78 | |||
79 | localFile = new String(remoteFile.substring(0, remoteFile.length()-4) + LOCAL_FILE_SUFFIX); | ||
80 | } | ||
81 | |||
82 | private void importToProject(IProgressMonitor monitor) throws Exception { | ||
83 | ProcessBuilder pb = new ProcessBuilder("tar", "fx", localFile); | ||
84 | pb.directory(new File("/tmp")); | ||
85 | Process p=pb.start(); | ||
86 | if(p.waitFor()!=0) | ||
87 | throw new Exception("extract ust data files failed"); | ||
88 | |||
89 | String traceName = localFile.substring(0,localFile.length()-LOCAL_FILE_SUFFIX.length()); | ||
90 | |||
91 | IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); | ||
92 | IPath full_path = wsroot.getFullPath(); | ||
93 | IProject project = wsroot.getProject(prj_name); | ||
94 | IFolder traceFolder = project.getFolder(TRACE_FOLDER_NAME); | ||
95 | if (!traceFolder.exists()) { | ||
96 | throw new Exception("Can't find file trace folder in selected project."); | ||
97 | } | ||
98 | |||
99 | String trace_str = traceName.substring(0, traceName.indexOf('-')); | ||
100 | traceFolder.createLink(new Path(trace_str), IResource.REPLACE, monitor); | ||
101 | for (IResource resource:traceFolder.members()) { | ||
102 | String extension = resource.getFileExtension(); | ||
103 | if (extension != null) | ||
104 | continue; | ||
105 | else { | ||
106 | //traceFolder.setPersistentProperty(TmfCommonConstants.TRACETYPE, "org.eclipse.linuxtools.tmf.ui.type.ctf"); | ||
107 | //resource.setPersistentProperty(TmfCommonConstants.TRACETYPE, "org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace"); | ||
108 | //traceFolder.setPersistentProperty(TmfCommonConstants.TRACEICON, "icons/obj16/garland16.png"); | ||
109 | //traceFolder.touch(null); | ||
110 | } | ||
111 | } | ||
112 | } | ||
113 | |||
114 | private String[] generateViewerParam() throws Exception { | ||
115 | String viewerParam=new String(LOCAL_EXEC); | ||
116 | int i; | ||
117 | |||
118 | ProcessBuilder pb = new ProcessBuilder("tar", "fx", localFile); | ||
119 | pb.directory(new File("/tmp")); | ||
120 | Process p=pb.start(); | ||
121 | if(p.waitFor()!=0) | ||
122 | throw new Exception("extract ust data files failed"); | ||
123 | File f=new File(localFile.substring(0,localFile.length()-LOCAL_FILE_SUFFIX.length())); | ||
124 | File []subdir=f.listFiles(); | ||
125 | |||
126 | for (i=0;i<subdir.length;i++) { | ||
127 | if(subdir[i].isDirectory()) { | ||
128 | viewerParam=viewerParam.concat(" -t " + subdir[i].getAbsolutePath()); | ||
129 | } | ||
130 | } | ||
131 | |||
132 | return viewerParam.split(" "); | ||
133 | } | ||
134 | |||
135 | @Override | ||
136 | public void process(IProgressMonitor monitor) | ||
137 | throws InvocationTargetException, InterruptedException { | ||
138 | // TODO Auto-generated method stub | ||
139 | |||
140 | String datafile; | ||
141 | |||
142 | monitor.beginTask("Running ust", 100); | ||
143 | try { | ||
144 | //preparing remote trace | ||
145 | |||
146 | monitor.subTask("Preparing user space lttng data file remotely"); | ||
147 | generateData(new SubProgressMonitor(monitor,30)); | ||
148 | |||
149 | //download datafile to local | ||
150 | monitor.subTask("Downloading user space lttng data file"); | ||
151 | getDataFile(new SubProgressMonitor(monitor,30)); | ||
152 | |||
153 | //extract datafile and import to lttng project | ||
154 | importToProject(new SubProgressMonitor(monitor,30)); | ||
155 | |||
156 | }catch (InterruptedException e){ | ||
157 | throw e; | ||
158 | }catch (InvocationTargetException e) { | ||
159 | throw e; | ||
160 | }catch (Exception e){ | ||
161 | throw new InvocationTargetException(e, e.getMessage()); | ||
162 | }finally { | ||
163 | monitor.done(); | ||
164 | } | ||
165 | } | ||
166 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java new file mode 100644 index 0000000..9fd7876 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2SettingDialog.java | |||
@@ -0,0 +1,104 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import org.yocto.sdk.remotetools.Activator; | ||
14 | import org.yocto.sdk.remotetools.Messages; | ||
15 | import org.eclipse.jface.dialogs.IDialogConstants; | ||
16 | import org.eclipse.swt.SWT; | ||
17 | import org.eclipse.swt.events.ModifyEvent; | ||
18 | import org.eclipse.swt.events.ModifyListener; | ||
19 | |||
20 | import org.eclipse.swt.layout.GridData; | ||
21 | import org.eclipse.swt.layout.GridLayout; | ||
22 | import org.eclipse.swt.widgets.Button; | ||
23 | |||
24 | import org.eclipse.swt.widgets.Composite; | ||
25 | |||
26 | import org.eclipse.swt.widgets.Label; | ||
27 | import org.eclipse.swt.widgets.Shell; | ||
28 | import org.eclipse.swt.widgets.Text; | ||
29 | |||
30 | |||
31 | public class Ust2SettingDialog extends UstSettingDialogBase { | ||
32 | |||
33 | static protected String TITLE="Lttng2.0 User Tracing Import"; | ||
34 | |||
35 | protected String trace; | ||
36 | protected Text traceText; | ||
37 | |||
38 | protected Ust2SettingDialog(Shell parentShell, String title, String conn) { | ||
39 | super(parentShell,title,conn); | ||
40 | } | ||
41 | |||
42 | public Ust2SettingDialog(Shell parentShell) { | ||
43 | this(parentShell, | ||
44 | TITLE, | ||
45 | Activator.getDefault().getDialogSettings().get(IBaseConstants.CONNECTION_NAME_UST) | ||
46 | ); | ||
47 | } | ||
48 | |||
49 | public String getTrace() { | ||
50 | return trace; | ||
51 | } | ||
52 | |||
53 | @Override | ||
54 | protected void okPressed() { | ||
55 | |||
56 | trace=traceText.getText(); | ||
57 | |||
58 | super.okPressed(); | ||
59 | } | ||
60 | |||
61 | protected void createArgument(Composite parent) | ||
62 | { | ||
63 | Composite projComp = new Composite(parent, SWT.NONE); | ||
64 | GridLayout projLayout = new GridLayout(); | ||
65 | projLayout.numColumns = 4; | ||
66 | projLayout.marginHeight = 0; | ||
67 | projLayout.marginWidth = 0; | ||
68 | projComp.setLayout(projLayout); | ||
69 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
70 | projComp.setLayoutData(gd); | ||
71 | |||
72 | Label label = new Label(projComp, SWT.NONE); | ||
73 | label.setText(Messages.Usttrace_Trace_Loc_Text); | ||
74 | gd = new GridData(); | ||
75 | gd.horizontalSpan = 4; | ||
76 | label.setLayoutData(gd); | ||
77 | |||
78 | traceText = new Text(projComp, SWT.SINGLE | SWT.BORDER); | ||
79 | traceText.addModifyListener(new ModifyListener() { | ||
80 | public void modifyText(ModifyEvent e) { | ||
81 | updateOkButton(); | ||
82 | } | ||
83 | }); | ||
84 | if(trace!=null) | ||
85 | traceText.setText(trace); | ||
86 | gd = new GridData(GridData.FILL_HORIZONTAL); | ||
87 | gd.horizontalSpan = 1; | ||
88 | traceText.setLayoutData(gd); | ||
89 | } | ||
90 | |||
91 | @Override | ||
92 | protected boolean updateOkButton() { | ||
93 | boolean ret=super.updateOkButton(); | ||
94 | if(ret==true) { | ||
95 | if(traceText.getText().isEmpty() || !traceText.getText().endsWith("/ust")) { | ||
96 | Button button=getButton(IDialogConstants.OK_ID); | ||
97 | if(button!=null) | ||
98 | button.setEnabled(false); | ||
99 | ret=false; | ||
100 | } | ||
101 | } | ||
102 | return ret; | ||
103 | } | ||
104 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/UstSettingDialogBase.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/UstSettingDialogBase.java new file mode 100644 index 0000000..70b0816 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/UstSettingDialogBase.java | |||
@@ -0,0 +1,170 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import org.yocto.sdk.remotetools.Activator; | ||
14 | import org.yocto.sdk.remotetools.Messages; | ||
15 | import org.yocto.sdk.remotetools.SWTFactory; | ||
16 | import org.eclipse.jface.dialogs.IDialogSettings; | ||
17 | import org.eclipse.swt.SWT; | ||
18 | import org.eclipse.swt.events.ModifyEvent; | ||
19 | import org.eclipse.swt.events.ModifyListener; | ||
20 | import org.eclipse.swt.layout.GridData; | ||
21 | import org.eclipse.swt.layout.GridLayout; | ||
22 | import org.eclipse.swt.widgets.Combo; | ||
23 | import org.eclipse.swt.widgets.Composite; | ||
24 | import org.eclipse.swt.widgets.Control; | ||
25 | import org.eclipse.swt.widgets.Label; | ||
26 | import org.eclipse.swt.widgets.Shell; | ||
27 | import org.eclipse.linuxtools.tmf.core.TmfProjectNature; | ||
28 | import org.eclipse.core.resources.IWorkspaceRoot; | ||
29 | import org.eclipse.core.resources.ResourcesPlugin; | ||
30 | import org.eclipse.core.resources.IProject; | ||
31 | |||
32 | |||
33 | public class UstSettingDialogBase extends BaseSettingDialog { | ||
34 | protected Label projectLabel; | ||
35 | protected Combo projectCombo; | ||
36 | protected String curProject = null; | ||
37 | |||
38 | protected UstSettingDialogBase(Shell parentShell, String title, String conn) { | ||
39 | super(parentShell,title,conn); | ||
40 | } | ||
41 | |||
42 | public String getProject() { | ||
43 | return curProject; | ||
44 | } | ||
45 | |||
46 | @Override | ||
47 | protected void okPressed() { | ||
48 | IDialogSettings settings = Activator.getDefault().getDialogSettings(); | ||
49 | // store the value of the generate sections checkbox | ||
50 | if(getCurrentConnection()==null) { | ||
51 | settings.put(IBaseConstants.CONNECTION_NAME_UST, | ||
52 | (String)null); | ||
53 | }else { | ||
54 | settings.put(IBaseConstants.CONNECTION_NAME_UST, | ||
55 | getCurrentConnection().getAliasName()); | ||
56 | } | ||
57 | super.okPressed(); | ||
58 | } | ||
59 | |||
60 | @Override | ||
61 | protected Control createDialogArea(Composite parent) { | ||
62 | Composite comp=(Composite)super.createDialogArea(parent); | ||
63 | GridLayout topLayout = new GridLayout(); | ||
64 | comp.setLayout(topLayout); | ||
65 | |||
66 | /*argument*/ | ||
67 | SWTFactory.createVerticalSpacer(comp, 1); | ||
68 | createImportProjectGroup(comp); | ||
69 | createArgument(comp); | ||
70 | |||
71 | updateOkButton(); | ||
72 | return comp; | ||
73 | } | ||
74 | |||
75 | protected void createImportProjectGroup(Composite parent) { | ||
76 | Composite projComp = new Composite(parent, SWT.NONE); | ||
77 | GridLayout projLayout = new GridLayout(); | ||
78 | projLayout.numColumns = 6; | ||
79 | projLayout.marginHeight = 0; | ||
80 | projLayout.marginWidth = 0; | ||
81 | projComp.setLayout(projLayout); | ||
82 | GridData gd = new GridData(GridData.FILL_HORIZONTAL); | ||
83 | projComp.setLayoutData(gd); | ||
84 | |||
85 | projectLabel = new Label(projComp, SWT.NONE); | ||
86 | projectLabel.setText(Messages.Import_to_Project); | ||
87 | gd = new GridData(); | ||
88 | gd.horizontalSpan = 1; | ||
89 | projectLabel.setLayoutData(gd); | ||
90 | |||
91 | projectCombo = new Combo(projComp, SWT.DROP_DOWN | SWT.READ_ONLY); | ||
92 | gd = new GridData(GridData.FILL_HORIZONTAL); | ||
93 | gd.horizontalSpan = 4; | ||
94 | projectCombo.setLayoutData(gd); | ||
95 | projectCombo.addModifyListener(new ModifyListener() { | ||
96 | |||
97 | public void modifyText(ModifyEvent e) { | ||
98 | updateCurProject(); | ||
99 | } | ||
100 | }); | ||
101 | |||
102 | updateProjectPulldown(); | ||
103 | } | ||
104 | |||
105 | protected void updateCurProject() { | ||
106 | IProject currentProjectSelected = getCurrentProject(); | ||
107 | |||
108 | if (currentProjectSelected != null) | ||
109 | curProject = currentProjectSelected.getName(); | ||
110 | |||
111 | updateOkButton(); | ||
112 | } | ||
113 | |||
114 | protected IProject getCurrentProject() { | ||
115 | if (projectCombo.getItemCount() == 0) | ||
116 | return null; | ||
117 | int currentSelection = projectCombo.getSelectionIndex(); | ||
118 | String importProject = currentSelection >= 0 ? projectCombo | ||
119 | .getItem(currentSelection) : null; | ||
120 | IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); | ||
121 | IProject project = wsroot.getProject(importProject); | ||
122 | return project; | ||
123 | } | ||
124 | |||
125 | protected void updateProjectPulldown() { | ||
126 | int index=-1; | ||
127 | |||
128 | projectCombo.removeAll(); | ||
129 | IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot(); | ||
130 | IProject[] projects = wsroot.getProjects(); | ||
131 | |||
132 | for (int i = 0; i < projects.length; ++i) { | ||
133 | try { | ||
134 | if (projects[i].isOpen() && projects[i].hasNature(TmfProjectNature.ID)) { | ||
135 | String projName = projects[i].getName(); | ||
136 | projectCombo.add(projName); | ||
137 | if (curProject != null) | ||
138 | if (projName.matches(curProject)) | ||
139 | index = i; | ||
140 | } | ||
141 | } catch (Exception e) { | ||
142 | // TODO Auto-generated catch block | ||
143 | e.printStackTrace(); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | if(index>=0) { | ||
148 | projectCombo.select(index); | ||
149 | }else if (projectCombo.getItemCount()> 0) { | ||
150 | projectCombo.select(projectCombo.getItemCount() - 1); | ||
151 | } | ||
152 | |||
153 | //TODO | ||
154 | //connectionCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT,true); | ||
155 | projectCombo.pack(true); | ||
156 | projectCombo.layout(); | ||
157 | projectCombo.getParent().layout(); | ||
158 | |||
159 | updateCurProject(); | ||
160 | } | ||
161 | protected void createArgument(Composite parent) | ||
162 | { | ||
163 | } | ||
164 | |||
165 | @Override | ||
166 | protected boolean updateOkButton() { | ||
167 | boolean ret=super.updateOkButton(); | ||
168 | return ret; | ||
169 | } | ||
170 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/YoctoBspHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/YoctoBspHandler.java new file mode 100644 index 0000000..c97afb6 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/YoctoBspHandler.java | |||
@@ -0,0 +1,38 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import org.eclipse.core.commands.AbstractHandler; | ||
14 | import org.eclipse.core.commands.ExecutionEvent; | ||
15 | import org.eclipse.core.commands.ExecutionException; | ||
16 | import org.eclipse.jface.wizard.WizardDialog; | ||
17 | import org.eclipse.ui.IWorkbenchWindow; | ||
18 | import org.eclipse.ui.handlers.HandlerUtil; | ||
19 | |||
20 | import org.yocto.sdk.remotetools.wizards.bsp.YoctoBSPWizard; | ||
21 | |||
22 | public class YoctoBspHandler extends AbstractHandler { | ||
23 | |||
24 | public Object execute(ExecutionEvent event) throws ExecutionException { | ||
25 | |||
26 | IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); | ||
27 | // Instantiates and initializes the wizard | ||
28 | YoctoBSPWizard bspWizard = new YoctoBSPWizard(); | ||
29 | //bspWizard.init(window.getWorkbench(), (IStructuredSelection)selection); | ||
30 | // Instantiates the wizard container with the wizard and opens it | ||
31 | WizardDialog dialog = new WizardDialog(window.getShell(), bspWizard); | ||
32 | //dialog.create(); | ||
33 | dialog.open(); | ||
34 | //YoctoBspDialog setting=new YoctoBspDialog(window.getShell()); | ||
35 | //setting.open(); | ||
36 | return null; | ||
37 | } | ||
38 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/messages.properties b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/messages.properties new file mode 100644 index 0000000..e5ce1b8 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/messages.properties | |||
@@ -0,0 +1,50 @@ | |||
1 | ################################################################################ | ||
2 | # Copyright (c) 2010 Intel Corporation. | ||
3 | # All rights reserved. This program and the accompanying materials | ||
4 | # are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # which accompanies this distribution, and is available at | ||
6 | # http://www.eclipse.org/legal/epl-v10.html | ||
7 | # | ||
8 | # Contributors: | ||
9 | # Intel - initial API and implementation | ||
10 | ################################################################################ | ||
11 | |||
12 | # NLS_MESSAGEFORMAT_VAR | ||
13 | # NLS_ENCODING=UTF-8 | ||
14 | |||
15 | ErrorNoSubsystem=No subsystem found. | ||
16 | ErrorConnectSubsystem=Could not connect to the remote system. | ||
17 | ErrorNoHost=No remote host found. | ||
18 | ErrorNoRemoteService=No remote TCF service found. | ||
19 | ErrorOprofileViewer=Local application "oprofile-viewer" is NOT installed.\nPlease goto http://git.yoctoproject.org/cgit/cgit.cgi/oprofileui to install OprofileUI. | ||
20 | ErrorOprofile=Oprofile is NOT installed on the local host.\n Please goto http://oprofile.sourceforge.net to install Oprofile. | ||
21 | ErrorLttvGui=Local application "lttv-gui" is NOT installed.\nPlease goto http://lttng.org to install LTTng Viewer. | ||
22 | ErrorUstProject=No Lttng Project selected. If the list is empty, please create a Lttng project under File->New! | ||
23 | |||
24 | InfoDownload=Downloading | ||
25 | InfoUpload=Uploading | ||
26 | |||
27 | BaseSettingDialog_Connection=Connection | ||
28 | BaseSettingDialog_New=New | ||
29 | BaseSettingDialog_Properties=Properties | ||
30 | Usttrace_Argument_Text=Argument | ||
31 | Usttrace_Application_Text=Application | ||
32 | Usttrace_Trace_Loc_Text=Ust directory path | ||
33 | Powertop_Time_Text=Time to gather data(sec) | ||
34 | Powertop_ShowPid_Text=show pids in wakeups list | ||
35 | TerminalViewer_text=This view is dedicated to Yocto Remote tools. Please use the "Yocto Remote Tools" menu to open the view. | ||
36 | //Systemtap_KO_Text=Kernel Module: | ||
37 | Metadata_Location=Metadata Location: | ||
38 | Builddir_Location=Build dir Location: | ||
39 | User_ID=User ID: | ||
40 | Remote_User_ID=Remote User ID: | ||
41 | Remote_Host=Remote Host: | ||
42 | Systemtap_Script=Systemtap Script: | ||
43 | Systemtap_Args=Systemtap Args: | ||
44 | Import_to_Project=Import to project: | ||
45 | |||
46 | LocalJob_Title=Launching local application | ||
47 | ErrorLocalJob=Failed in launching local application | ||
48 | |||
49 | RemoteShellExec_1=Executing {0} {1} | ||
50 | RemoteShellExec_2=Could not create the hostShellProcess.\n \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/BaseFileView.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/BaseFileView.java new file mode 100644 index 0000000..a5801c7 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/BaseFileView.java | |||
@@ -0,0 +1,140 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.views; | ||
12 | |||
13 | |||
14 | import java.io.BufferedReader; | ||
15 | import java.io.FileReader; | ||
16 | import java.util.ArrayList; | ||
17 | |||
18 | import org.eclipse.swt.widgets.Composite; | ||
19 | import org.eclipse.ui.part.*; | ||
20 | import org.eclipse.jface.viewers.*; | ||
21 | import org.eclipse.swt.graphics.Image; | ||
22 | import org.eclipse.ui.*; | ||
23 | import org.eclipse.swt.SWT; | ||
24 | |||
25 | |||
26 | /** | ||
27 | * This sample class demonstrates how to plug-in a new | ||
28 | * workbench view. The view shows data obtained from the | ||
29 | * model. The sample creates a dummy model on the fly, | ||
30 | * but a real implementation would connect to the model | ||
31 | * available either in this or another plug-in (e.g. the workspace). | ||
32 | * The view is connected to the model using a content provider. | ||
33 | * <p> | ||
34 | * The view uses a label provider to define how model | ||
35 | * objects should be presented in the view. Each | ||
36 | * view can present the same model objects using | ||
37 | * different labels and icons, if needed. Alternatively, | ||
38 | * a single label provider can be shared between views | ||
39 | * in order to ensure that objects of the same type are | ||
40 | * presented in the same way everywhere. | ||
41 | * <p> | ||
42 | */ | ||
43 | |||
44 | public class BaseFileView extends ViewPart { | ||
45 | |||
46 | /** | ||
47 | * The ID of the view as specified by the extension. | ||
48 | */ | ||
49 | public static final String ID = "org.yocto.sdk.remotetools.views.BaseFileView"; | ||
50 | |||
51 | private TableViewer viewer; | ||
52 | |||
53 | private String filename; | ||
54 | |||
55 | /* | ||
56 | * The content provider class is responsible for | ||
57 | * providing objects to the view. It can wrap | ||
58 | * existing objects in adapters or simply return | ||
59 | * objects as-is. These objects may be sensitive | ||
60 | * to the current input of the view, or ignore | ||
61 | * it and always show the same content | ||
62 | * (like Task List, for example). | ||
63 | */ | ||
64 | |||
65 | class ViewContentProvider implements IStructuredContentProvider { | ||
66 | public void inputChanged(Viewer v, Object oldInput, Object newInput) { | ||
67 | if(newInput instanceof String) | ||
68 | filename=(String)newInput; | ||
69 | } | ||
70 | public void dispose() { | ||
71 | } | ||
72 | public Object[] getElements(Object parent) { | ||
73 | ArrayList <String> elements=new ArrayList <String>(); | ||
74 | BufferedReader in; | ||
75 | String line; | ||
76 | try { | ||
77 | in=new BufferedReader(new FileReader(filename)); | ||
78 | }catch (Exception e) { | ||
79 | return new String [] {"Invalid file " + filename}; | ||
80 | } | ||
81 | |||
82 | try { | ||
83 | do { | ||
84 | line=in.readLine(); | ||
85 | if(line!=null) | ||
86 | elements.add(line); | ||
87 | }while(line!=null); | ||
88 | }catch (Exception e) { | ||
89 | e.printStackTrace(); | ||
90 | } | ||
91 | return (String[]) elements.toArray(new String[elements.size()]); | ||
92 | } | ||
93 | } | ||
94 | class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { | ||
95 | public String getColumnText(Object obj, int index) { | ||
96 | return getText(obj); | ||
97 | } | ||
98 | public Image getColumnImage(Object obj, int index) { | ||
99 | //return getImage(obj); | ||
100 | return null; | ||
101 | } | ||
102 | public Image getImage(Object obj) { | ||
103 | return PlatformUI.getWorkbench(). | ||
104 | getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | /** | ||
109 | * The constructor. | ||
110 | */ | ||
111 | public BaseFileView() { | ||
112 | } | ||
113 | |||
114 | public BaseFileView(String file) { | ||
115 | this(); | ||
116 | this.filename=file; | ||
117 | } | ||
118 | |||
119 | /** | ||
120 | * This is a callback that will allow us | ||
121 | * to create the viewer and initialize it. | ||
122 | */ | ||
123 | public void createPartControl(Composite parent) { | ||
124 | viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); | ||
125 | viewer.setContentProvider(new ViewContentProvider()); | ||
126 | viewer.setLabelProvider(new ViewLabelProvider()); | ||
127 | viewer.setInput(filename); | ||
128 | } | ||
129 | |||
130 | public void setInput(String filename) { | ||
131 | viewer.setInput(filename); | ||
132 | } | ||
133 | |||
134 | /** | ||
135 | * Passing the focus request to the viewer's control. | ||
136 | */ | ||
137 | public void setFocus() { | ||
138 | viewer.getControl().setFocus(); | ||
139 | } | ||
140 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewTab.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewTab.java new file mode 100644 index 0000000..bbb2d02 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewTab.java | |||
@@ -0,0 +1,457 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2002, 2009 IBM Corporation and others. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Initial Contributors: | ||
9 | * The following IBM employees contributed to the Remote System Explorer | ||
10 | * component that contains this file: David McKnight, Kushal Munir, | ||
11 | * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, | ||
12 | * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. | ||
13 | * | ||
14 | * Contributors: | ||
15 | * David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work | ||
16 | * Yu-Fen Kuo (MontaVista) - Adapted from CommandsViewWorkbook | ||
17 | * Anna Dushistova (MontaVista) - Adapted from CommandsViewWorkbook | ||
18 | * Yu-Fen Kuo (MontaVista) - [227572] RSE Terminal doesn't reset the "connected" state when the shell exits | ||
19 | * Martin Oberhuber (Wind River) - [227571] RSE Terminal should honor Encoding set on the IHost | ||
20 | * Michael Scharf (Wind River) - [236203] [rseterminal] Potentially UI blocking code in TerminalViewTab.createTabItem | ||
21 | * Anna Dushistova (MontaVista) - [244437] [rseterminal] Possible race condition when multiple Terminals are launched after each other | ||
22 | * Martin Oberhuber (Wind River) - [247700] Terminal uses ugly fonts in JEE package | ||
23 | * Anna Dushistova (MontaVista) - [267609] [rseterminal] The first "Launch Terminal" command creates no terminal tab | ||
24 | ********************************************************************************/ | ||
25 | package org.yocto.sdk.remotetools.views; | ||
26 | |||
27 | import java.io.UnsupportedEncodingException; | ||
28 | |||
29 | import org.eclipse.core.runtime.IAdaptable; | ||
30 | import org.eclipse.jface.action.IMenuListener; | ||
31 | import org.eclipse.jface.action.IMenuManager; | ||
32 | import org.eclipse.jface.action.MenuManager; | ||
33 | import org.eclipse.jface.action.Separator; | ||
34 | import org.eclipse.jface.resource.FontRegistry; | ||
35 | import org.eclipse.jface.util.IPropertyChangeListener; | ||
36 | import org.eclipse.jface.util.PropertyChangeEvent; | ||
37 | import org.eclipse.rse.core.model.IHost; | ||
38 | import org.eclipse.swt.SWT; | ||
39 | import org.eclipse.swt.custom.CTabFolder; | ||
40 | import org.eclipse.swt.custom.CTabItem; | ||
41 | import org.eclipse.swt.events.DisposeEvent; | ||
42 | import org.eclipse.swt.events.DisposeListener; | ||
43 | import org.eclipse.swt.events.MenuEvent; | ||
44 | import org.eclipse.swt.events.MenuListener; | ||
45 | import org.eclipse.swt.graphics.Font; | ||
46 | import org.eclipse.swt.layout.FillLayout; | ||
47 | import org.eclipse.swt.layout.GridData; | ||
48 | import org.eclipse.swt.widgets.Composite; | ||
49 | import org.eclipse.swt.widgets.Control; | ||
50 | import org.eclipse.swt.widgets.Display; | ||
51 | import org.eclipse.swt.widgets.Menu; | ||
52 | import org.eclipse.tm.internal.terminal.control.ITerminalListener; | ||
53 | import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; | ||
54 | import org.eclipse.tm.internal.terminal.control.TerminalViewControlFactory; | ||
55 | import org.eclipse.tm.internal.terminal.control.actions.TerminalActionClearAll; | ||
56 | import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCopy; | ||
57 | import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCut; | ||
58 | import org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste; | ||
59 | import org.eclipse.tm.internal.terminal.control.actions.TerminalActionSelectAll; | ||
60 | import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; | ||
61 | import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; | ||
62 | import org.eclipse.ui.PlatformUI; | ||
63 | import org.eclipse.ui.themes.IThemeManager; | ||
64 | |||
65 | /** | ||
66 | * This is the desktop view wrapper of the System View viewer. | ||
67 | */ | ||
68 | public class TerminalViewTab extends Composite { | ||
69 | |||
70 | public static String DATA_KEY_CONTROL = "$_control_$"; //$NON-NLS-1$ | ||
71 | |||
72 | private final CTabFolder tabFolder; | ||
73 | |||
74 | private IPropertyChangeListener propertyChangeListener; | ||
75 | |||
76 | private Menu menu; | ||
77 | |||
78 | private boolean fMenuAboutToShow; | ||
79 | |||
80 | private TerminalActionCopy fActionEditCopy; | ||
81 | |||
82 | private TerminalActionCut fActionEditCut; | ||
83 | |||
84 | private TerminalActionPaste fActionEditPaste; | ||
85 | |||
86 | private TerminalActionClearAll fActionEditClearAll; | ||
87 | |||
88 | private TerminalActionSelectAll fActionEditSelectAll; | ||
89 | |||
90 | protected class TerminalContextMenuHandler implements MenuListener, | ||
91 | IMenuListener { | ||
92 | public void menuHidden(MenuEvent event) { | ||
93 | fMenuAboutToShow = false; | ||
94 | fActionEditCopy.updateAction(fMenuAboutToShow); | ||
95 | } | ||
96 | |||
97 | public void menuShown(MenuEvent e) { | ||
98 | |||
99 | } | ||
100 | |||
101 | public void menuAboutToShow(IMenuManager menuMgr) { | ||
102 | fMenuAboutToShow = true; | ||
103 | fActionEditCopy.updateAction(fMenuAboutToShow); | ||
104 | fActionEditCut.updateAction(fMenuAboutToShow); | ||
105 | fActionEditSelectAll.updateAction(fMenuAboutToShow); | ||
106 | fActionEditPaste.updateAction(fMenuAboutToShow); | ||
107 | fActionEditClearAll.updateAction(fMenuAboutToShow); | ||
108 | } | ||
109 | } | ||
110 | |||
111 | public TerminalViewTab(final Composite parent, TerminalViewer viewer) { | ||
112 | super(parent, SWT.NONE); | ||
113 | tabFolder = new CTabFolder(this, SWT.NONE); | ||
114 | tabFolder.setLayout(new FillLayout()); | ||
115 | tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH)); | ||
116 | setLayout(new FillLayout()); | ||
117 | tabFolder.setBackground(parent.getBackground()); | ||
118 | tabFolder.setSimple(false); | ||
119 | tabFolder.setUnselectedImageVisible(false); | ||
120 | tabFolder.setUnselectedCloseVisible(false); | ||
121 | |||
122 | tabFolder.setMinimizeVisible(false); | ||
123 | tabFolder.setMaximizeVisible(false); | ||
124 | //TODO setupActions(); | ||
125 | } | ||
126 | |||
127 | public void dispose() { | ||
128 | if (propertyChangeListener != null) { | ||
129 | IThemeManager mgr = PlatformUI.getWorkbench().getThemeManager(); | ||
130 | mgr.removePropertyChangeListener(propertyChangeListener); | ||
131 | propertyChangeListener = null; | ||
132 | } | ||
133 | if (!tabFolder.isDisposed()) { | ||
134 | tabFolder.dispose(); | ||
135 | } | ||
136 | super.dispose(); | ||
137 | } | ||
138 | |||
139 | public CTabFolder getFolder() { | ||
140 | return tabFolder; | ||
141 | } | ||
142 | |||
143 | public void remove(Object root) { | ||
144 | |||
145 | } | ||
146 | |||
147 | public int getItemCount(){ | ||
148 | return tabFolder.getItemCount(); | ||
149 | } | ||
150 | |||
151 | public CTabItem getSelectedTab() { | ||
152 | if (tabFolder.getItemCount() > 0) { | ||
153 | int index = tabFolder.getSelectionIndex(); | ||
154 | CTabItem item = tabFolder.getItem(index); | ||
155 | return item; | ||
156 | } | ||
157 | |||
158 | return null; | ||
159 | } | ||
160 | |||
161 | public void showCurrentPage() { | ||
162 | tabFolder.setFocus(); | ||
163 | } | ||
164 | |||
165 | public void showPageFor(Object root) { | ||
166 | for (int i = 0; i < tabFolder.getItemCount(); i++) { | ||
167 | CTabItem item = tabFolder.getItem(i); | ||
168 | if (item.getData() == root) { | ||
169 | tabFolder.setSelection(item); | ||
170 | } | ||
171 | |||
172 | } | ||
173 | } | ||
174 | |||
175 | public void showPageFor(String tabName) { | ||
176 | for (int i = 0; i < tabFolder.getItemCount(); i++) { | ||
177 | CTabItem item = tabFolder.getItem(i); | ||
178 | if (item.getText().equals(tabName)) { | ||
179 | tabFolder.setSelection(item); | ||
180 | return; | ||
181 | } | ||
182 | |||
183 | } | ||
184 | } | ||
185 | |||
186 | public void disposePageFor(String tabName) { | ||
187 | for (int i = 0; i < tabFolder.getItemCount(); i++) { | ||
188 | CTabItem item = tabFolder.getItem(i); | ||
189 | if (item.getText().equals(tabName)) { | ||
190 | item.dispose(); | ||
191 | return; | ||
192 | } | ||
193 | |||
194 | } | ||
195 | } | ||
196 | |||
197 | public void propertyChange(PropertyChangeEvent e) { | ||
198 | // for now always update | ||
199 | if (tabFolder!=null) { | ||
200 | CTabItem[] items = tabFolder.getItems(); | ||
201 | for (int i=0; i<items.length; i++) { | ||
202 | Object control = items[i].getData(DATA_KEY_CONTROL); | ||
203 | if (control instanceof ITerminalViewControl) { | ||
204 | updateTheme((ITerminalViewControl) control); | ||
205 | } | ||
206 | } | ||
207 | } | ||
208 | } | ||
209 | |||
210 | public void updateTheme(final ITerminalViewControl control) { | ||
211 | if (control != null) { | ||
212 | IThemeManager mgr = PlatformUI.getWorkbench().getThemeManager(); | ||
213 | Font font; | ||
214 | FontRegistry fr = mgr.getCurrentTheme().getFontRegistry(); | ||
215 | if (fr.hasValueFor("terminal.views.view.font.definition")) { //$NON-NLS-1$ | ||
216 | //Terminal View font if available | ||
217 | font = fr.get("terminal.views.view.font.definition"); //$NON-NLS-1$ | ||
218 | } else if (fr.hasValueFor("REMOTE_COMMANDS_VIEW_FONT")) { //$NON-NLS-1$ | ||
219 | //fallback: "Remote Shell Font" | ||
220 | font = fr.get("REMOTE_COMMANDS_VIEW_FONT"); //$NON-NLS-1$ | ||
221 | } else { | ||
222 | //fallback: "Basic Text Font" | ||
223 | font = fr.get("org.eclipse.jface.textfont"); //$NON-NLS-1$ | ||
224 | } | ||
225 | control.setFont(font); | ||
226 | if (propertyChangeListener == null) { | ||
227 | final TerminalViewTab myself = this; | ||
228 | propertyChangeListener = new IPropertyChangeListener() { | ||
229 | public void propertyChange(PropertyChangeEvent event) { | ||
230 | myself.propertyChange(event); | ||
231 | } | ||
232 | }; | ||
233 | mgr.addPropertyChangeListener(propertyChangeListener); | ||
234 | } | ||
235 | } | ||
236 | } | ||
237 | /* TODO | ||
238 | public CTabItem createTabItem(IAdaptable root, | ||
239 | final String initialWorkingDirCmd,final String initialCmd) { | ||
240 | final CTabItem item = new CTabItem(tabFolder, SWT.CLOSE); | ||
241 | setTabTitle(root, item); | ||
242 | |||
243 | item.setData(root); | ||
244 | Composite c = new Composite(tabFolder, SWT.NONE); | ||
245 | c.setLayout(new FillLayout()); | ||
246 | |||
247 | tabFolder.getParent().layout(true); | ||
248 | if (root instanceof IHost) { | ||
249 | final IHost host = (IHost) root; | ||
250 | |||
251 | ITerminalConnector connector = new TCFTerminalConnector(host); | ||
252 | ITerminalViewControl terminalControl = TerminalViewControlFactory | ||
253 | .makeControl(new ITerminalListener() | ||
254 | { | ||
255 | |||
256 | public void setState(final TerminalState state) { | ||
257 | if (state == TerminalState.CLOSED | ||
258 | || state == TerminalState.CONNECTED) { | ||
259 | Display.getDefault().asyncExec(new Runnable() { | ||
260 | public void run() { | ||
261 | if (!item.isDisposed()) { | ||
262 | final ITerminalServiceSubSystem terminalServiceSubSystem = TerminalServiceHelper | ||
263 | .getTerminalSubSystem(host); | ||
264 | |||
265 | if (state == TerminalState.CONNECTED) | ||
266 | TerminalServiceHelper | ||
267 | .updateTerminalShellForTerminalElement(item); | ||
268 | |||
269 | setTabImage(host, item); | ||
270 | ISystemRegistry registry = RSECorePlugin | ||
271 | .getTheSystemRegistry(); | ||
272 | registry | ||
273 | .fireEvent(new SystemResourceChangeEvent( | ||
274 | terminalServiceSubSystem, | ||
275 | ISystemResourceChangeEvents.EVENT_REFRESH, | ||
276 | terminalServiceSubSystem)); | ||
277 | } | ||
278 | if (state == TerminalState.CONNECTED) { | ||
279 | |||
280 | if (initialWorkingDirCmd != null) { | ||
281 | Object data = item | ||
282 | .getData(DATA_KEY_CONTROL); | ||
283 | if (data instanceof ITerminalViewControl) | ||
284 | ((ITerminalViewControl) data) | ||
285 | .pasteString(initialWorkingDirCmd); | ||
286 | } | ||
287 | } | ||
288 | } | ||
289 | }); | ||
290 | } | ||
291 | |||
292 | } | ||
293 | |||
294 | public void setTerminalTitle(String title) { | ||
295 | |||
296 | } | ||
297 | }, | ||
298 | c, new ITerminalConnector[] { connector }); | ||
299 | // Specify Encoding for Terminal | ||
300 | try { | ||
301 | terminalControl.setEncoding(host.getDefaultEncoding(true)); | ||
302 | } catch (UnsupportedEncodingException e) { | ||
303 | // ignore and allow fallback to default encoding | ||
304 | } | ||
305 | terminalControl.setConnector(connector); | ||
306 | item.setData(DATA_KEY_CONTROL, terminalControl); | ||
307 | updateTheme(terminalControl); | ||
308 | terminalControl.connectTerminal(); | ||
309 | } | ||
310 | item.setControl(c); | ||
311 | tabFolder.setSelection(item); | ||
312 | item.addDisposeListener(new DisposeListener() { | ||
313 | |||
314 | public void widgetDisposed(DisposeEvent e) { | ||
315 | Object source = e.getSource(); | ||
316 | if (source instanceof CTabItem) { | ||
317 | CTabItem currentItem = (CTabItem) source; | ||
318 | Object data = currentItem.getData(DATA_KEY_CONTROL); | ||
319 | if (data instanceof ITerminalViewControl) { | ||
320 | ((ITerminalViewControl) data).disposeTerminal(); | ||
321 | } | ||
322 | data = currentItem.getData(); | ||
323 | if (data instanceof IHost) { | ||
324 | TerminalServiceHelper.removeTerminalElementFromHost( | ||
325 | currentItem, (IHost) data); | ||
326 | } | ||
327 | } | ||
328 | |||
329 | } | ||
330 | |||
331 | }); | ||
332 | |||
333 | setupContextMenus(); | ||
334 | return item; | ||
335 | |||
336 | } | ||
337 | |||
338 | protected void setupActions() { | ||
339 | fActionEditCopy = new TerminalActionCopy() { | ||
340 | protected ITerminalViewControl getTarget() { | ||
341 | return getCurrentTerminalViewControl(); | ||
342 | } | ||
343 | }; | ||
344 | fActionEditCut = new TerminalActionCut() { | ||
345 | protected ITerminalViewControl getTarget() { | ||
346 | return getCurrentTerminalViewControl(); | ||
347 | } | ||
348 | }; | ||
349 | fActionEditPaste = new TerminalActionPaste() { | ||
350 | protected ITerminalViewControl getTarget() { | ||
351 | return getCurrentTerminalViewControl(); | ||
352 | } | ||
353 | }; | ||
354 | fActionEditClearAll = new TerminalActionClearAll() { | ||
355 | protected ITerminalViewControl getTarget() { | ||
356 | return getCurrentTerminalViewControl(); | ||
357 | } | ||
358 | }; | ||
359 | fActionEditSelectAll = new TerminalActionSelectAll() { | ||
360 | protected ITerminalViewControl getTarget() { | ||
361 | return getCurrentTerminalViewControl(); | ||
362 | } | ||
363 | }; | ||
364 | } | ||
365 | |||
366 | protected void setupContextMenus() { | ||
367 | ITerminalViewControl terminalViewControl = getCurrentTerminalViewControl(); | ||
368 | if (terminalViewControl == null) | ||
369 | return; | ||
370 | |||
371 | if (menu == null) { | ||
372 | MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ | ||
373 | menu = menuMgr.createContextMenu(tabFolder); | ||
374 | loadContextMenus(menuMgr); | ||
375 | TerminalContextMenuHandler contextMenuHandler = new TerminalContextMenuHandler(); | ||
376 | menuMgr.addMenuListener(contextMenuHandler); | ||
377 | menu.addMenuListener(contextMenuHandler); | ||
378 | } | ||
379 | Control ctlText = terminalViewControl.getControl(); | ||
380 | ctlText.setMenu(menu); | ||
381 | } | ||
382 | |||
383 | protected void loadContextMenus(IMenuManager menuMgr) { | ||
384 | menuMgr.add(fActionEditCopy); | ||
385 | menuMgr.add(fActionEditPaste); | ||
386 | menuMgr.add(new Separator()); | ||
387 | menuMgr.add(fActionEditClearAll); | ||
388 | menuMgr.add(fActionEditSelectAll); | ||
389 | menuMgr.add(new Separator()); | ||
390 | |||
391 | // Other plug-ins can contribute there actions here | ||
392 | menuMgr.add(new Separator("Additions")); //$NON-NLS-1$ | ||
393 | } | ||
394 | |||
395 | private void setTabTitle(IAdaptable root, CTabItem titem) { | ||
396 | ISystemViewElementAdapter va = (ISystemViewElementAdapter) root | ||
397 | .getAdapter(ISystemViewElementAdapter.class); | ||
398 | if (va != null) { | ||
399 | updateWithUniqueTitle(va.getName(root), titem); | ||
400 | setTabImage(root, titem); | ||
401 | } | ||
402 | } | ||
403 | |||
404 | private void setTabImage(IAdaptable root, CTabItem titem) { | ||
405 | ISystemViewElementAdapter va = (ISystemViewElementAdapter) root | ||
406 | .getAdapter(ISystemViewElementAdapter.class); | ||
407 | if (va != null) { | ||
408 | if (root instanceof IHost) { | ||
409 | ITerminalServiceSubSystem terminalServiceSubSystem = TerminalServiceHelper | ||
410 | .getTerminalSubSystem((IHost) root); | ||
411 | TerminalElement element = terminalServiceSubSystem | ||
412 | .getChild(titem.getText()); | ||
413 | if (element != null) { | ||
414 | va = (ISystemViewElementAdapter) element | ||
415 | .getAdapter(ISystemViewElementAdapter.class); | ||
416 | titem | ||
417 | .setImage(va.getImageDescriptor(element) | ||
418 | .createImage()); | ||
419 | return; | ||
420 | } | ||
421 | } | ||
422 | |||
423 | titem.setImage(va.getImageDescriptor(root).createImage()); | ||
424 | } | ||
425 | } | ||
426 | |||
427 | private void updateWithUniqueTitle(String title, CTabItem currentItem) { | ||
428 | CTabItem[] items = tabFolder.getItems(); | ||
429 | int increment = 1; | ||
430 | String temp = title; | ||
431 | for (int i = 0; i < items.length; i++) { | ||
432 | if (items[i] != currentItem) { | ||
433 | String name = items[i].getText(); | ||
434 | if (name != null) { | ||
435 | if (name.equals(temp)) { | ||
436 | temp = title + " " + increment++; //$NON-NLS-1$ | ||
437 | } | ||
438 | } | ||
439 | |||
440 | } | ||
441 | } | ||
442 | currentItem.setText(temp); | ||
443 | } | ||
444 | |||
445 | private ITerminalViewControl getCurrentTerminalViewControl() { | ||
446 | if (tabFolder != null && !tabFolder.isDisposed()) { | ||
447 | CTabItem item = tabFolder.getSelection(); | ||
448 | if (item != null && !item.isDisposed()) { | ||
449 | Object data = item.getData(DATA_KEY_CONTROL); | ||
450 | if (data instanceof ITerminalViewControl) | ||
451 | return ((ITerminalViewControl) data); | ||
452 | } | ||
453 | } | ||
454 | return null; | ||
455 | } | ||
456 | */ | ||
457 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewer.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewer.java new file mode 100644 index 0000000..65a562b --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/views/TerminalViewer.java | |||
@@ -0,0 +1,139 @@ | |||
1 | /******************************************************************************** | ||
2 | * Copyright (c) 2002, 2009 IBM Corporation and others. All rights reserved. | ||
3 | * This program and the accompanying materials are made available under the terms | ||
4 | * of the Eclipse Public License v1.0 which accompanies this distribution, and is | ||
5 | * available at http://www.eclipse.org/legal/epl-v10.html | ||
6 | * | ||
7 | * Initial Contributors: | ||
8 | * The following IBM employees contributed to the Remote System Explorer | ||
9 | * component that contains this file: David McKnight, Kushal Munir, | ||
10 | * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, | ||
11 | * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. | ||
12 | * | ||
13 | * Contributors: | ||
14 | * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType | ||
15 | * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core | ||
16 | * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API | ||
17 | * Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui | ||
18 | * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() | ||
19 | * David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work | ||
20 | * Kevin Doyle (IBM) - [198534] Shell Menu Enablement Issue's | ||
21 | * Radoslav Gerganov(ProSyst) - [181563] Fix hardcoded Ctrl+Space for remote shell content assist | ||
22 | * Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandsViewPart | ||
23 | * Anna Dushistova (MontaVista) - Adapted from SystemCommandsViewPart | ||
24 | * Yu-Fen Kuo (MontaVista) - [227572] RSE Terminal doesn't reset the "connected" state when the shell exits | ||
25 | * Anna Dushistova (MontaVista) - [228577] [rseterminal] Clean up RSE Terminal impl | ||
26 | * Anna Dushistova (MontaVista) - [238257] Request a help text when no tab is open in "Remote Shell", "Remote Monitor" and "Terminals" views | ||
27 | * Anna Dushistova (MontaVista) - [235097] [rseterminal] Cannot activate RSE Terminals View with the keyboard | ||
28 | * Anna Dushistova (MontaVista) - [267609] [rseterminal] The first "Launch Terminal" command creates no terminal tab | ||
29 | *********************************************************************************/ | ||
30 | package org.yocto.sdk.remotetools.views; | ||
31 | |||
32 | import org.yocto.sdk.remotetools.Messages; | ||
33 | |||
34 | import org.eclipse.jface.action.IMenuManager; | ||
35 | import org.eclipse.jface.viewers.ISelection; | ||
36 | import org.eclipse.jface.viewers.ISelectionChangedListener; | ||
37 | import org.eclipse.jface.viewers.SelectionChangedEvent; | ||
38 | import org.eclipse.swt.SWT; | ||
39 | import org.eclipse.swt.events.SelectionEvent; | ||
40 | import org.eclipse.swt.events.SelectionListener; | ||
41 | import org.eclipse.swt.widgets.Composite; | ||
42 | import org.eclipse.swt.widgets.Label; | ||
43 | import org.eclipse.ui.ISelectionListener; | ||
44 | import org.eclipse.ui.ISelectionService; | ||
45 | import org.eclipse.ui.IWorkbenchPart; | ||
46 | import org.eclipse.ui.part.PageBook; | ||
47 | import org.eclipse.ui.part.ViewPart; | ||
48 | |||
49 | public class TerminalViewer extends ViewPart implements ISelectionListener, | ||
50 | SelectionListener, ISelectionChangedListener/*, | ||
51 | ISystemResourceChangeListener,*/{ | ||
52 | |||
53 | private TerminalViewTab tabFolder; | ||
54 | |||
55 | private PageBook pagebook; | ||
56 | |||
57 | private Label noTabShownLabel; | ||
58 | |||
59 | public static String VIEW_ID = "org.eclipse.rse.terminals.ui.view.TerminalView"; //$NON-NLS-1$ | ||
60 | |||
61 | public void createPartControl(Composite parent) { | ||
62 | pagebook = new PageBook(parent, SWT.NONE); | ||
63 | |||
64 | tabFolder = new TerminalViewTab(pagebook, this); | ||
65 | tabFolder.getFolder().addSelectionListener(this); | ||
66 | |||
67 | // Page 2: Nothing selected | ||
68 | noTabShownLabel = new Label(pagebook, SWT.TOP + SWT.LEFT + SWT.WRAP); | ||
69 | noTabShownLabel.setText(Messages.TerminalViewer_text); | ||
70 | showEmptyPage(); | ||
71 | |||
72 | |||
73 | ISelectionService selectionService = getSite().getWorkbenchWindow() | ||
74 | .getSelectionService(); | ||
75 | selectionService.addSelectionListener(this); | ||
76 | /* | ||
77 | ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); | ||
78 | |||
79 | registry.addSystemResourceChangeListener(this); | ||
80 | */ | ||
81 | } | ||
82 | |||
83 | public void setFocus() { | ||
84 | tabFolder.setFocus(); | ||
85 | } | ||
86 | |||
87 | public void selectionChanged(IWorkbenchPart part, ISelection selection) { | ||
88 | // TODO Auto-generated method stub | ||
89 | |||
90 | } | ||
91 | |||
92 | public void widgetDefaultSelected(SelectionEvent e) { | ||
93 | // TODO Auto-generated method stub | ||
94 | |||
95 | } | ||
96 | |||
97 | public void widgetSelected(SelectionEvent e) { | ||
98 | // TODO Auto-generated method stub | ||
99 | |||
100 | } | ||
101 | |||
102 | public void selectionChanged(SelectionChangedEvent event) { | ||
103 | // TODO Auto-generated method stub | ||
104 | |||
105 | } | ||
106 | /* | ||
107 | public void systemResourceChanged(ISystemResourceChangeEvent event) { | ||
108 | if (event.getType() == ISystemResourceChangeEvents.EVENT_COMMAND_SHELL_REMOVED) { | ||
109 | Object source = event.getSource(); | ||
110 | if (source instanceof TerminalElement) { | ||
111 | tabFolder.disposePageFor(((TerminalElement) source).getName()); | ||
112 | } | ||
113 | }else if(event.getType() == ISystemResourceChangeEvents.EVENT_REFRESH){ | ||
114 | if(tabFolder.getItemCount() == 0) | ||
115 | showEmptyPage(); | ||
116 | else | ||
117 | showTabsPage(); | ||
118 | } | ||
119 | } | ||
120 | */ | ||
121 | |||
122 | public void menuAboutToShow(IMenuManager manager) { | ||
123 | // TODO Auto-generated method stub | ||
124 | |||
125 | } | ||
126 | |||
127 | public TerminalViewTab getTabFolder() { | ||
128 | return tabFolder; | ||
129 | } | ||
130 | |||
131 | private void showEmptyPage() { | ||
132 | pagebook.showPage(noTabShownLabel); | ||
133 | } | ||
134 | |||
135 | private void showTabsPage(){ | ||
136 | pagebook.showPage(tabFolder); | ||
137 | } | ||
138 | |||
139 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPAction.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPAction.java new file mode 100644 index 0000000..171f181 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPAction.java | |||
@@ -0,0 +1,32 @@ | |||
1 | package org.yocto.sdk.remotetools.wizards.bsp; | ||
2 | |||
3 | /** | ||
4 | * Stores a list of items from the output of a background thread and the error message if something went wrong | ||
5 | * @author ioana.grigoropol | ||
6 | * | ||
7 | */ | ||
8 | public class BSPAction { | ||
9 | private String[] items; | ||
10 | private String message; | ||
11 | |||
12 | BSPAction(String[] items, String message){ | ||
13 | this.setItems(items); | ||
14 | this.setMessage(message); | ||
15 | } | ||
16 | |||
17 | public String[] getItems() { | ||
18 | return items; | ||
19 | } | ||
20 | |||
21 | public void setItems(String[] items) { | ||
22 | this.items = items; | ||
23 | } | ||
24 | |||
25 | public String getMessage() { | ||
26 | return message; | ||
27 | } | ||
28 | |||
29 | public void setMessage(String message) { | ||
30 | this.message = message; | ||
31 | } | ||
32 | } \ No newline at end of file | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPProgressDialog.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPProgressDialog.java new file mode 100644 index 0000000..8d5864c --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPProgressDialog.java | |||
@@ -0,0 +1,47 @@ | |||
1 | package org.yocto.sdk.remotetools.wizards.bsp; | ||
2 | |||
3 | import org.eclipse.core.runtime.IProgressMonitor; | ||
4 | import org.eclipse.jface.dialogs.ProgressMonitorDialog; | ||
5 | import org.eclipse.jface.operation.IRunnableWithProgress; | ||
6 | import org.eclipse.swt.widgets.Shell; | ||
7 | |||
8 | /** | ||
9 | * Creates a progress monitor dialog that will run in the background a BSPThread and display a custom message | ||
10 | * @author ioana.grigoropol | ||
11 | * | ||
12 | */ | ||
13 | public class BSPProgressDialog extends ProgressMonitorDialog{ | ||
14 | String displayMessage; | ||
15 | BSPThread getterThread; | ||
16 | Shell shell; | ||
17 | |||
18 | |||
19 | public BSPProgressDialog(Shell parent, BSPThread getterThread, String displayMessage) { | ||
20 | super(parent); | ||
21 | this.shell = parent; | ||
22 | this.getterThread = getterThread; | ||
23 | this.displayMessage = displayMessage; | ||
24 | } | ||
25 | |||
26 | public void run(boolean showProgressDialog){ | ||
27 | try { | ||
28 | if (showProgressDialog) | ||
29 | super.run(true, true, new IRunnableWithProgress(){ | ||
30 | @Override | ||
31 | public void run(IProgressMonitor monitor) { | ||
32 | monitor.beginTask(displayMessage + " ...", 100); | ||
33 | getterThread.run(); | ||
34 | monitor.done(); | ||
35 | } | ||
36 | }); | ||
37 | else | ||
38 | getterThread.run(); | ||
39 | } catch (Exception e) { | ||
40 | getterThread.getBspAction().setMessage(e.getMessage()); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | public BSPAction getBspAction() { | ||
45 | return getterThread.getBspAction(); | ||
46 | } | ||
47 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPThread.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPThread.java new file mode 100644 index 0000000..f6b19ac --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/BSPThread.java | |||
@@ -0,0 +1,92 @@ | |||
1 | package org.yocto.sdk.remotetools.wizards.bsp; | ||
2 | |||
3 | import java.io.BufferedReader; | ||
4 | import java.io.InputStreamReader; | ||
5 | import java.util.ArrayList; | ||
6 | |||
7 | /** | ||
8 | * Receives a command to be run on a separate thread in the background | ||
9 | * It contains an BSPAction object that will collect the output & error | ||
10 | * Output lines are processed and collected into the items of BSPAction | ||
11 | * @author ioana.grigoropol | ||
12 | * | ||
13 | */ | ||
14 | public abstract class BSPThread implements Runnable { | ||
15 | public static final String SUCCESS = "success"; | ||
16 | public static final String ERROR = "error"; | ||
17 | |||
18 | private BSPAction bspAction; | ||
19 | private String command; | ||
20 | |||
21 | /** | ||
22 | * Receives the command to be run in the background | ||
23 | * @param command | ||
24 | */ | ||
25 | public BSPThread(String command) { | ||
26 | this.command = command; | ||
27 | this.bspAction = new BSPAction(null, null); | ||
28 | } | ||
29 | |||
30 | @Override | ||
31 | public void run() { | ||
32 | ArrayList<String> values = new ArrayList<String>(); | ||
33 | |||
34 | try { | ||
35 | ProcessBuilder builder = new ProcessBuilder(new String[] {"bash", "-c", command}); | ||
36 | // redirect error stream to collect both output & error | ||
37 | builder.redirectErrorStream(true); | ||
38 | Process process = builder.start(); | ||
39 | BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); | ||
40 | String line = null; | ||
41 | String errorMessage = ""; | ||
42 | while ( (line = br.readLine()) != null) { | ||
43 | String[] result = processLine(line); | ||
44 | String status = result[0]; | ||
45 | String value = result[1]; | ||
46 | if (status.equals(ERROR) && !value.isEmpty()) { | ||
47 | errorMessage += value; | ||
48 | continue; | ||
49 | } | ||
50 | if (!value.isEmpty()) | ||
51 | values.add(value); | ||
52 | } | ||
53 | int exitVal = process.waitFor(); | ||
54 | |||
55 | // if the background process did not exit with 0 code, we should set the status accordingly | ||
56 | if (exitVal != 0) { | ||
57 | bspAction.setMessage(errorMessage); | ||
58 | bspAction.setItems(null); | ||
59 | } | ||
60 | } catch (Exception e) { | ||
61 | bspAction.setMessage(e.getMessage()); | ||
62 | bspAction.setItems(null); | ||
63 | } | ||
64 | if (!values.isEmpty()) { | ||
65 | bspAction.setMessage(null); | ||
66 | bspAction.setItems(values.toArray(new String[values.size()])); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * Each command ran in the background will have a different output and a different way of processing it | ||
72 | * @param line | ||
73 | * @return | ||
74 | */ | ||
75 | protected abstract String[] processLine(String line); | ||
76 | |||
77 | public BSPAction getBspAction() { | ||
78 | return bspAction; | ||
79 | } | ||
80 | |||
81 | public void setBspAction(BSPAction bspAction) { | ||
82 | this.bspAction = bspAction; | ||
83 | } | ||
84 | |||
85 | public String getCommand() { | ||
86 | return command; | ||
87 | } | ||
88 | |||
89 | public void setCommand(String command) { | ||
90 | this.command = command; | ||
91 | } | ||
92 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/ErrorCollectorThread.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/ErrorCollectorThread.java new file mode 100644 index 0000000..d39ac28 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/ErrorCollectorThread.java | |||
@@ -0,0 +1,19 @@ | |||
1 | package org.yocto.sdk.remotetools.wizards.bsp; | ||
2 | |||
3 | /** | ||
4 | * BSPThread that ignores the output of the process and returns an error if the process exits with non zero code | ||
5 | * @author ioana.grigoropol | ||
6 | * | ||
7 | */ | ||
8 | public class ErrorCollectorThread extends BSPThread{ | ||
9 | |||
10 | public ErrorCollectorThread(String command) { | ||
11 | super(command); | ||
12 | } | ||
13 | |||
14 | @Override | ||
15 | protected String[] processLine(String line) { | ||
16 | return null; | ||
17 | } | ||
18 | |||
19 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelArchGetter.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelArchGetter.java new file mode 100644 index 0000000..833057a --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelArchGetter.java | |||
@@ -0,0 +1,23 @@ | |||
1 | package org.yocto.sdk.remotetools.wizards.bsp; | ||
2 | |||
3 | /** | ||
4 | * BSPThread that processes the output of "yocto-bsp list karch" | ||
5 | * @author ioana.grigoropol | ||
6 | * | ||
7 | */ | ||
8 | public class KernelArchGetter extends BSPThread{ | ||
9 | |||
10 | public KernelArchGetter(String command) { | ||
11 | super(command); | ||
12 | } | ||
13 | |||
14 | @Override | ||
15 | protected String[] processLine(String line) { | ||
16 | if (line.contains(":")) | ||
17 | return new String[]{SUCCESS, ""}; | ||
18 | line = line.replaceAll("^\\s+", ""); | ||
19 | line = line.replaceAll("\\s+$", ""); | ||
20 | return new String[]{SUCCESS, line}; | ||
21 | } | ||
22 | |||
23 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelBranchesGetter.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelBranchesGetter.java new file mode 100644 index 0000000..4caea2c --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/KernelBranchesGetter.java | |||
@@ -0,0 +1,28 @@ | |||
1 | package org.yocto.sdk.remotetools.wizards.bsp; | ||
2 | |||
3 | /** | ||
4 | * BSPThread that processes the output lines from running command "yocto-bsp list" for the selected kernel | ||
5 | * @author ioana.grigoropol | ||
6 | * | ||
7 | */ | ||
8 | public class KernelBranchesGetter extends BSPThread { | ||
9 | |||
10 | public KernelBranchesGetter(String command) { | ||
11 | super(command); | ||
12 | } | ||
13 | |||
14 | @Override | ||
15 | protected String[] processLine(String line) { | ||
16 | // [TODO : Ioana]: find a better way to identify error lines | ||
17 | if (!line.startsWith("[")) | ||
18 | return new String[]{ERROR, line + "\n"}; | ||
19 | |||
20 | String[] items = line.split(","); | ||
21 | |||
22 | String value = items[0]; | ||
23 | value = value.replace("[\"", ""); | ||
24 | value = value.replaceAll("\"$", ""); | ||
25 | return new String[]{SUCCESS, value}; | ||
26 | } | ||
27 | |||
28 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java new file mode 100644 index 0000000..48c7509 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/MainPage.java | |||
@@ -0,0 +1,498 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2012 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.wizards.bsp; | ||
12 | |||
13 | import java.io.BufferedReader; | ||
14 | import java.io.File; | ||
15 | import java.io.InputStream; | ||
16 | import java.io.InputStreamReader; | ||
17 | |||
18 | import org.eclipse.core.runtime.IStatus; | ||
19 | import org.eclipse.core.runtime.Status; | ||
20 | import org.eclipse.jface.wizard.WizardPage; | ||
21 | import org.eclipse.swt.SWT; | ||
22 | import org.eclipse.swt.events.FocusEvent; | ||
23 | import org.eclipse.swt.events.FocusListener; | ||
24 | import org.eclipse.swt.events.ModifyEvent; | ||
25 | import org.eclipse.swt.events.ModifyListener; | ||
26 | import org.eclipse.swt.events.SelectionAdapter; | ||
27 | import org.eclipse.swt.events.SelectionEvent; | ||
28 | import org.eclipse.swt.layout.GridData; | ||
29 | import org.eclipse.swt.layout.GridLayout; | ||
30 | import org.eclipse.swt.widgets.Button; | ||
31 | import org.eclipse.swt.widgets.Combo; | ||
32 | import org.eclipse.swt.widgets.Composite; | ||
33 | import org.eclipse.swt.widgets.Control; | ||
34 | import org.eclipse.swt.widgets.DirectoryDialog; | ||
35 | import org.eclipse.swt.widgets.Label; | ||
36 | import org.eclipse.swt.widgets.Text; | ||
37 | import org.eclipse.swt.widgets.Widget; | ||
38 | import org.yocto.sdk.remotetools.YoctoBspElement; | ||
39 | |||
40 | /** | ||
41 | * | ||
42 | * Setting up the parameters for creating the new Yocto BSP | ||
43 | * | ||
44 | * @author jzhang | ||
45 | */ | ||
46 | public class MainPage extends WizardPage { | ||
47 | public static final String PAGE_NAME = "Main"; | ||
48 | private static final String KARCH_CMD = "yocto-bsp list karch"; | ||
49 | private static final String QARCH_CMD = "yocto-bsp list qemu property qemuarch"; | ||
50 | private static final String BSP_SCRIPT = "yocto-bsp"; | ||
51 | private static final String PROPERTIES_CMD_PREFIX = "yocto-bsp list "; | ||
52 | private static final String PROPERTIES_CMD_SURFIX = " properties -o "; | ||
53 | private static final String PROPERTIES_FILE = "/tmp/properties.json"; | ||
54 | |||
55 | private Button btnMetadataLoc; | ||
56 | private Text textMetadataLoc; | ||
57 | private Label labelMetadata; | ||
58 | |||
59 | private Button btnBspOutputLoc; | ||
60 | private Text textBspOutputLoc; | ||
61 | private Label labelBspOutput; | ||
62 | |||
63 | private Button btnBuildLoc; | ||
64 | private Text textBuildLoc; | ||
65 | private Label labelBuildLoc; | ||
66 | |||
67 | private boolean buildDirChecked; | ||
68 | private BuildLocationListener buildLocationListener; | ||
69 | |||
70 | private Text textBspName; | ||
71 | private Label labelBspName; | ||
72 | |||
73 | private Combo comboKArch; | ||
74 | private Label labelKArch; | ||
75 | |||
76 | private Combo comboQArch; | ||
77 | private Label labelQArch; | ||
78 | |||
79 | private YoctoBspElement bspElem; | ||
80 | |||
81 | public MainPage(YoctoBspElement element) { | ||
82 | super(PAGE_NAME, "yocto-bsp Main page", null); | ||
83 | |||
84 | setMessage("Enter the required fields(with *) to create new Yocto Project BSP!"); | ||
85 | this.bspElem = element; | ||
86 | } | ||
87 | |||
88 | @Override | ||
89 | public void createControl(Composite parent) { | ||
90 | setErrorMessage(null); | ||
91 | Composite composite = new Composite(parent, SWT.NONE); | ||
92 | GridLayout layout = new GridLayout(2, false); | ||
93 | GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); | ||
94 | composite.setLayout(layout); | ||
95 | gd.horizontalSpan = 2; | ||
96 | composite.setLayoutData(gd); | ||
97 | |||
98 | labelMetadata = new Label(composite, SWT.NONE); | ||
99 | labelMetadata.setText("Metadata location*: "); | ||
100 | Composite textContainer = new Composite(composite, SWT.NONE); | ||
101 | textContainer.setLayout(new GridLayout(2, false)); | ||
102 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
103 | textMetadataLoc = (Text)addTextControl(textContainer, ""); | ||
104 | textMetadataLoc.setEnabled(true); | ||
105 | textMetadataLoc.addModifyListener(new ModifyListener() { | ||
106 | @Override | ||
107 | public void modifyText(ModifyEvent e) { | ||
108 | controlChanged(e.widget); | ||
109 | } | ||
110 | }); | ||
111 | setBtnMetadataLoc(addFileSelectButton(textContainer, textMetadataLoc)); | ||
112 | |||
113 | labelBuildLoc = new Label(composite, SWT.NONE); | ||
114 | labelBuildLoc.setText("Build location: "); | ||
115 | |||
116 | textContainer = new Composite(composite, SWT.NONE); | ||
117 | textContainer.setLayout(new GridLayout(2, false)); | ||
118 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
119 | |||
120 | textBuildLoc = (Text)addTextControl(textContainer, ""); | ||
121 | buildLocationListener = new BuildLocationListener(""); | ||
122 | textBuildLoc.addFocusListener(buildLocationListener); | ||
123 | |||
124 | setBtnBuilddirLoc(addFileSelectButton(textContainer, textBuildLoc)); | ||
125 | |||
126 | labelBspName = new Label(composite, SWT.NONE); | ||
127 | labelBspName.setText("BSP Name*: "); | ||
128 | |||
129 | textContainer = new Composite(composite, SWT.NONE); | ||
130 | textContainer.setLayout(new GridLayout(2, false)); | ||
131 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
132 | |||
133 | textBspName = (Text)addTextControl(textContainer, ""); | ||
134 | textBspName.addModifyListener(new ModifyListener() { | ||
135 | @Override | ||
136 | public void modifyText(ModifyEvent e) { | ||
137 | controlChanged(e.widget); | ||
138 | } | ||
139 | }); | ||
140 | |||
141 | labelBspOutput = new Label(composite, SWT.NONE); | ||
142 | labelBspOutput.setText("BSP output location: "); | ||
143 | |||
144 | textContainer = new Composite(composite, SWT.NONE); | ||
145 | textContainer.setLayout(new GridLayout(2, false)); | ||
146 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
147 | |||
148 | textBspOutputLoc = (Text)addTextControl(textContainer, ""); | ||
149 | textBspOutputLoc.addModifyListener(new ModifyListener() { | ||
150 | @Override | ||
151 | public void modifyText(ModifyEvent e) { | ||
152 | controlChanged(e.widget); | ||
153 | } | ||
154 | }); | ||
155 | setBtnBspOutLoc(addFileSelectButton(textContainer, textBspOutputLoc)); | ||
156 | |||
157 | labelKArch = new Label(composite, SWT.NONE); | ||
158 | labelKArch.setText("Kernel Architecture*: "); | ||
159 | |||
160 | textContainer = new Composite(composite, SWT.NONE); | ||
161 | textContainer.setLayout(new GridLayout(2, false)); | ||
162 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
163 | |||
164 | comboKArch = new Combo(textContainer, SWT.READ_ONLY); | ||
165 | comboKArch.setLayout(new GridLayout(2, false)); | ||
166 | comboKArch.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | ||
167 | comboKArch.setEnabled(false); | ||
168 | comboKArch.addModifyListener(new ModifyListener() { | ||
169 | @Override | ||
170 | public void modifyText(ModifyEvent e) { | ||
171 | controlChanged(e.widget); | ||
172 | } | ||
173 | }); | ||
174 | |||
175 | labelQArch = new Label(composite, SWT.NONE); | ||
176 | labelQArch.setText("Qemu Architecture(* for karch as qemu): "); | ||
177 | labelQArch.setEnabled(false); | ||
178 | |||
179 | textContainer = new Composite(composite, SWT.NONE); | ||
180 | textContainer.setLayout(new GridLayout(2, false)); | ||
181 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
182 | |||
183 | comboQArch = new Combo(textContainer, SWT.READ_ONLY); | ||
184 | comboQArch.setLayout(new GridLayout(2, false)); | ||
185 | comboQArch.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | ||
186 | comboQArch.setEnabled(false); | ||
187 | comboQArch.addModifyListener(new ModifyListener() { | ||
188 | @Override | ||
189 | public void modifyText(ModifyEvent e) { | ||
190 | controlChanged(e.widget); | ||
191 | } | ||
192 | }); | ||
193 | |||
194 | setControl(composite); | ||
195 | validatePage(); | ||
196 | } | ||
197 | |||
198 | private Control addTextControl(final Composite parent, String value) { | ||
199 | final Text text; | ||
200 | |||
201 | text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER); | ||
202 | text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); | ||
203 | text.setText(value); | ||
204 | text.setSize(10, 150); | ||
205 | |||
206 | return text; | ||
207 | } | ||
208 | |||
209 | private Button addFileSelectButton(final Composite parent, final Text text) { | ||
210 | Button button = new Button(parent, SWT.PUSH | SWT.LEAD); | ||
211 | button.setText("Browse..."); | ||
212 | button.addSelectionListener(new SelectionAdapter() { | ||
213 | @Override | ||
214 | public void widgetSelected(SelectionEvent event) { | ||
215 | String dirName = new DirectoryDialog(parent.getShell()).open(); | ||
216 | if (dirName != null) { | ||
217 | text.setText(dirName); | ||
218 | } | ||
219 | } | ||
220 | }); | ||
221 | return button; | ||
222 | } | ||
223 | |||
224 | private void controlChanged(Widget widget) { | ||
225 | Status status = new Status(IStatus.OK, "not_used", 0, "", null); | ||
226 | setErrorMessage(null); | ||
227 | String metadataLoc = textMetadataLoc.getText(); | ||
228 | |||
229 | if (widget == textMetadataLoc) { | ||
230 | resetKarchCombo(); | ||
231 | if (metadataLoc.length() == 0) { | ||
232 | status = new Status(IStatus.ERROR, "not_used", 0, "Meta data location can't be empty!", null); | ||
233 | } else { | ||
234 | File meta_data = new File(metadataLoc); | ||
235 | if (!meta_data.exists() || !meta_data.isDirectory()) { | ||
236 | status = new Status(IStatus.ERROR, "not_used", 0, | ||
237 | "Invalid meta data location: Make sure it exists and is a directory!", null); | ||
238 | } else { | ||
239 | File bspScript = new File(metadataLoc + "/scripts/" + BSP_SCRIPT); | ||
240 | if (!bspScript.exists() || !bspScript.canExecute()) | ||
241 | status = new Status(IStatus.ERROR, "not_used", 0, | ||
242 | "Make sure yocto-bsp exists under \"" + metadataLoc + "/scripts\" and is executable!", null); | ||
243 | else { | ||
244 | kernelArchesHandler(); | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | } else if (widget == comboKArch) { | ||
249 | String selection = comboKArch.getText(); | ||
250 | if (!bspElem.getKarch().contentEquals(selection)) | ||
251 | bspElem = new YoctoBspElement(); | ||
252 | if (selection.matches("qemu")) { | ||
253 | labelQArch.setEnabled(true); | ||
254 | comboQArch.setEnabled(true); | ||
255 | } else { | ||
256 | labelQArch.setEnabled(false); | ||
257 | comboQArch.setEnabled(false); | ||
258 | } | ||
259 | } | ||
260 | |||
261 | String buildDir = textBuildLoc.getText(); | ||
262 | String outputDir = textBspOutputLoc.getText(); | ||
263 | String bspName = textBspName.getText(); | ||
264 | |||
265 | if (bspName.contains(" ")) { | ||
266 | status = new Status(IStatus.ERROR, "not_used", 0, | ||
267 | "BSP name contains space which is not allowed!", null); | ||
268 | } | ||
269 | |||
270 | if (!outputDir.isEmpty()){ | ||
271 | if (outputDir.matches(buildDir)) { | ||
272 | status = new Status(IStatus.ERROR, "not_used", 0, | ||
273 | "You've set BSP output directory the same as build directory, please leave output directory empty for this scenario!", null); | ||
274 | } else { | ||
275 | File outputDirectory = new File(outputDir); | ||
276 | if (outputDirectory.exists()){ | ||
277 | status = new Status(IStatus.ERROR, "not_used", 0, | ||
278 | "Your BSP output directory points to an exiting directory!", null); | ||
279 | } | ||
280 | } | ||
281 | } else if (buildDir.startsWith(metadataLoc) && !bspName.isEmpty()) { | ||
282 | String bspDirStr = metadataLoc + "/meta-" + bspName; | ||
283 | File bspDir = new File(bspDirStr); | ||
284 | if (bspDir.exists()) { | ||
285 | status = new Status(IStatus.ERROR, "not_used", 0, | ||
286 | "Your BSP with name: " + bspName + " already exist under directory: " + bspDirStr + ", please change your bsp name!", null); | ||
287 | } | ||
288 | } | ||
289 | |||
290 | if (status.getSeverity() == IStatus.ERROR) | ||
291 | setErrorMessage(status.getMessage()); | ||
292 | |||
293 | getWizard().getContainer().updateButtons(); | ||
294 | canFlipToNextPage(); | ||
295 | } | ||
296 | |||
297 | private Status checkBuildDir() { | ||
298 | |||
299 | String metadataLoc = textMetadataLoc.getText(); | ||
300 | String buildLoc = textBuildLoc.getText(); | ||
301 | |||
302 | if (buildLoc.isEmpty()) { | ||
303 | buildLoc = metadataLoc + "/build"; | ||
304 | return createBuildDir(buildLoc); | ||
305 | } else { | ||
306 | File buildLocDir = new File(buildLoc); | ||
307 | if (!buildLocDir.exists()) { | ||
308 | return createBuildDir(buildLoc); | ||
309 | } else if (buildLocDir.isDirectory()) { | ||
310 | return createBuildDir(buildLoc); | ||
311 | } else { | ||
312 | return new Status(IStatus.ERROR, "not_used", 0, "Invalid build location: Make sure the build location is a directory!", null); | ||
313 | } | ||
314 | } | ||
315 | } | ||
316 | |||
317 | private Status createBuildDir(String buildLoc) { | ||
318 | String metadataDir = textMetadataLoc.getText(); | ||
319 | |||
320 | // if we do not change the directory to metadata location the script will be looked into the directory indicated by user.dir system property | ||
321 | // system.property usually points to the location from where eclipse was started | ||
322 | String createBuildDirCmd = "cd " + metadataDir + ";source " + metadataDir + "/oe-init-build-env " + buildLoc; | ||
323 | |||
324 | try { | ||
325 | ProcessBuilder builder = new ProcessBuilder(new String[] {"bash", "-c", createBuildDirCmd}); | ||
326 | Process proc = builder.start(); | ||
327 | InputStream errorStream = proc.getErrorStream(); | ||
328 | InputStreamReader isr = new InputStreamReader(errorStream); | ||
329 | BufferedReader br = new BufferedReader(isr); | ||
330 | String line = null; | ||
331 | String status = ""; | ||
332 | while ( (line = br.readLine()) != null) { | ||
333 | status += line; | ||
334 | } | ||
335 | |||
336 | if (proc.waitFor() != 0) | ||
337 | return new Status(IStatus.ERROR, "not_used", 0, status, null);; | ||
338 | return new Status(IStatus.OK, "not_used", 0, "", null); | ||
339 | } catch (Exception e) { | ||
340 | return new Status(IStatus.ERROR, "not_used", 0, e.getMessage(), null); | ||
341 | } | ||
342 | } | ||
343 | |||
344 | public YoctoBspElement getBSPElement() { | ||
345 | return this.bspElem; | ||
346 | } | ||
347 | |||
348 | |||
349 | private void resetKarchCombo() { | ||
350 | comboKArch.deselectAll(); | ||
351 | comboQArch.deselectAll(); | ||
352 | comboKArch.setEnabled(false); | ||
353 | labelQArch.setEnabled(false); | ||
354 | comboQArch.setEnabled(false); | ||
355 | } | ||
356 | |||
357 | private void kernelArchesHandler() { | ||
358 | BSPAction kArchesAction = getKArches(); | ||
359 | if (kArchesAction.getMessage() == null && kArchesAction.getItems().length != 0) { | ||
360 | comboKArch.setItems(kArchesAction.getItems()); | ||
361 | comboKArch.setEnabled(true); | ||
362 | } else if (kArchesAction.getMessage() != null){ | ||
363 | setErrorMessage(kArchesAction.getMessage()); | ||
364 | return; | ||
365 | } | ||
366 | BSPAction qArchesAction = getQArches(); | ||
367 | if (qArchesAction.getMessage() == null && qArchesAction.getItems().length != 0) { | ||
368 | comboQArch.setItems(qArchesAction.getItems()); | ||
369 | } else if (qArchesAction.getMessage() != null) | ||
370 | setErrorMessage(qArchesAction.getMessage()); | ||
371 | |||
372 | } | ||
373 | |||
374 | @Override | ||
375 | public boolean canFlipToNextPage(){ | ||
376 | String err = getErrorMessage(); | ||
377 | if (err != null) | ||
378 | return false; | ||
379 | else if (!validatePage()) | ||
380 | return false; | ||
381 | return true; | ||
382 | } | ||
383 | |||
384 | |||
385 | public boolean validatePage() { | ||
386 | String metadataLoc = textMetadataLoc.getText(); | ||
387 | String bspname = textBspName.getText(); | ||
388 | String karch = comboKArch.getText(); | ||
389 | String qarch = comboQArch.getText(); | ||
390 | if (metadataLoc.isEmpty() || | ||
391 | bspname.isEmpty() || | ||
392 | karch.isEmpty()) { | ||
393 | return false; | ||
394 | } else if (karch.matches("qemu") && qarch.isEmpty()) { | ||
395 | return false; | ||
396 | } | ||
397 | |||
398 | bspElem.setBspName(bspname); | ||
399 | if (!textBspOutputLoc.getText().isEmpty()) | ||
400 | bspElem.setBspOutLoc(textBspOutputLoc.getText()); | ||
401 | else | ||
402 | bspElem.setBspOutLoc(""); | ||
403 | if (!textBuildLoc.getText().isEmpty()) { | ||
404 | checkBuildDir(); | ||
405 | bspElem.setBuildLoc(textBuildLoc.getText()); | ||
406 | } else { | ||
407 | bspElem.setBuildLoc(metadataLoc + "/build"); | ||
408 | if (!buildDirChecked) { | ||
409 | checkBuildDir(); | ||
410 | buildDirChecked = true; | ||
411 | } | ||
412 | } | ||
413 | bspElem.setMetadataLoc(metadataLoc); | ||
414 | bspElem.setKarch(karch); | ||
415 | bspElem.setQarch(qarch); | ||
416 | |||
417 | |||
418 | if (!bspElem.getValidPropertiesFile()) { | ||
419 | boolean validPropertiesFile = true; | ||
420 | BSPAction action = createPropertiesFile(); | ||
421 | if (action.getMessage() != null) { | ||
422 | validPropertiesFile = false; | ||
423 | setErrorMessage(action.getMessage()); | ||
424 | } | ||
425 | bspElem.setValidPropertiesFile(validPropertiesFile); | ||
426 | } | ||
427 | return true; | ||
428 | } | ||
429 | |||
430 | private BSPAction createPropertiesFile() { | ||
431 | String createPropertiesCmd = bspElem.getMetadataLoc() + "/scripts/" + | ||
432 | PROPERTIES_CMD_PREFIX + bspElem.getKarch() + | ||
433 | PROPERTIES_CMD_SURFIX + PROPERTIES_FILE; | ||
434 | BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new ErrorCollectorThread(createPropertiesCmd), "Creating properties file "); | ||
435 | progressDialog.run(false); | ||
436 | return progressDialog.getBspAction(); | ||
437 | } | ||
438 | |||
439 | private BSPAction getKArches() { | ||
440 | String getKArchCmd = textMetadataLoc.getText() + "/scripts/" + KARCH_CMD; | ||
441 | BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new KernelArchGetter(getKArchCmd), "Loading kernel architectures "); | ||
442 | progressDialog.run(false); | ||
443 | return progressDialog.getBspAction(); | ||
444 | } | ||
445 | |||
446 | private BSPAction getQArches() { | ||
447 | String getQArchCmd = textMetadataLoc.getText() + "/scripts/" + QARCH_CMD; | ||
448 | BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new QemuArchGetter(getQArchCmd), "Loading Qemu architectures "); | ||
449 | progressDialog.run(false); | ||
450 | return progressDialog.getBspAction(); | ||
451 | } | ||
452 | |||
453 | public Button getBtnMetadataLoc() { | ||
454 | return btnMetadataLoc; | ||
455 | } | ||
456 | |||
457 | public void setBtnMetadataLoc(Button btnMetadataLoc) { | ||
458 | this.btnMetadataLoc = btnMetadataLoc; | ||
459 | } | ||
460 | |||
461 | public Button getBtnBspOutLoc() { | ||
462 | return btnBspOutputLoc; | ||
463 | } | ||
464 | |||
465 | public void setBtnBspOutLoc(Button btnBspOutLoc) { | ||
466 | this.btnBspOutputLoc = btnBspOutLoc; | ||
467 | } | ||
468 | |||
469 | public Button getBtnBuilddirLoc() { | ||
470 | return btnBuildLoc; | ||
471 | } | ||
472 | |||
473 | public void setBtnBuilddirLoc(Button btnBuilddirLoc) { | ||
474 | this.btnBuildLoc = btnBuilddirLoc; | ||
475 | } | ||
476 | |||
477 | class BuildLocationListener implements FocusListener{ | ||
478 | String value; | ||
479 | boolean changed; | ||
480 | |||
481 | BuildLocationListener(String value){ | ||
482 | this.value = value; | ||
483 | } | ||
484 | @Override | ||
485 | public void focusGained(FocusEvent e) { | ||
486 | value = ((Text)e.getSource()).getText(); | ||
487 | } | ||
488 | |||
489 | @Override | ||
490 | public void focusLost(FocusEvent e) { | ||
491 | if(!((Text)e.getSource()).getText().equals(value)) { | ||
492 | checkBuildDir(); | ||
493 | buildDirChecked = true; | ||
494 | } | ||
495 | } | ||
496 | |||
497 | } | ||
498 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/OutputCollectorThread.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/OutputCollectorThread.java new file mode 100644 index 0000000..df5fba5 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/OutputCollectorThread.java | |||
@@ -0,0 +1,19 @@ | |||
1 | package org.yocto.sdk.remotetools.wizards.bsp; | ||
2 | |||
3 | /** | ||
4 | * BSPThread that returns all the output lines of the process execution | ||
5 | * @author ioana.grigoropol | ||
6 | * | ||
7 | */ | ||
8 | public class OutputCollectorThread extends BSPThread{ | ||
9 | |||
10 | public OutputCollectorThread(String command) { | ||
11 | super(command); | ||
12 | } | ||
13 | |||
14 | @Override | ||
15 | protected String[] processLine(String line) { | ||
16 | return new String[]{SUCCESS, line}; | ||
17 | } | ||
18 | |||
19 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/PropertiesPage.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/PropertiesPage.java new file mode 100644 index 0000000..18149e7 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/PropertiesPage.java | |||
@@ -0,0 +1,498 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2012 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.wizards.bsp; | ||
12 | |||
13 | import java.util.ArrayList; | ||
14 | import java.util.Collections; | ||
15 | import java.util.Enumeration; | ||
16 | import java.util.HashSet; | ||
17 | import java.util.Hashtable; | ||
18 | import java.util.Iterator; | ||
19 | |||
20 | import org.eclipse.jface.dialogs.MessageDialog; | ||
21 | import org.eclipse.jface.wizard.WizardPage; | ||
22 | import org.eclipse.swt.SWT; | ||
23 | import org.eclipse.swt.custom.ScrolledComposite; | ||
24 | import org.eclipse.swt.events.SelectionEvent; | ||
25 | import org.eclipse.swt.events.SelectionListener; | ||
26 | import org.eclipse.swt.layout.GridData; | ||
27 | import org.eclipse.swt.layout.GridLayout; | ||
28 | import org.eclipse.swt.widgets.Button; | ||
29 | import org.eclipse.swt.widgets.Combo; | ||
30 | import org.eclipse.swt.widgets.Composite; | ||
31 | import org.eclipse.swt.widgets.Control; | ||
32 | import org.eclipse.swt.widgets.Group; | ||
33 | import org.eclipse.swt.widgets.Label; | ||
34 | import org.eclipse.swt.widgets.Text; | ||
35 | import org.eclipse.swt.widgets.Widget; | ||
36 | import org.yocto.sdk.remotetools.YoctoBspElement; | ||
37 | import org.yocto.sdk.remotetools.YoctoBspPropertyElement; | ||
38 | import org.yocto.sdk.remotetools.YoctoJSONHelper; | ||
39 | /** | ||
40 | * | ||
41 | * Setting up the parameters for creating the new Yocto BSP | ||
42 | * | ||
43 | * @author jzhang | ||
44 | */ | ||
45 | public class PropertiesPage extends WizardPage { | ||
46 | private static final String PAGE_NAME = "Properties"; | ||
47 | private static final String VALUES_CMD_PREFIX = "yocto-bsp list "; | ||
48 | private static final String VALUES_CMD_SURFIX = " property "; | ||
49 | private static final String KERNEL_CHOICE = "kernel_choice"; | ||
50 | private static final String DEFAULT_KERNEL = "use_default_kernel"; | ||
51 | private static final String SMP_NAME = "smp"; | ||
52 | private static final String EXISTING_KBRANCH_NAME = "existing_kbranch"; | ||
53 | private static final String NEED_NEW_KBRANCH_NAME = "need_new_kbranch"; | ||
54 | private static final String NEW_KBRANCH_NAME = "new_kbranch"; | ||
55 | private static final String QARCH_NAME = "qemuarch"; | ||
56 | |||
57 | private static final String KERNEL_CHOICES = "choices"; | ||
58 | private static final String KERNEL_BRANCHES = "branches"; | ||
59 | |||
60 | private Hashtable<YoctoBspPropertyElement, Control> propertyControlMap; | ||
61 | HashSet<YoctoBspPropertyElement> properties; | ||
62 | |||
63 | private ScrolledComposite composite; | ||
64 | private Composite controlContainer = null; | ||
65 | |||
66 | private YoctoBspElement bspElem = null; | ||
67 | private boolean kArchChanged = false; | ||
68 | |||
69 | private Combo kernelCombo; | ||
70 | private Combo branchesCombo; | ||
71 | |||
72 | private Button newBranchButton; | ||
73 | private Button existingBranchButton; | ||
74 | |||
75 | private Button smpButton; | ||
76 | |||
77 | private Group kGroup = null; | ||
78 | private Group kbGroup = null; | ||
79 | // private Group otherSettingsGroup = null; | ||
80 | private Group propertyGroup = null; | ||
81 | |||
82 | public PropertiesPage(YoctoBspElement element) { | ||
83 | super(PAGE_NAME, "yocto-bsp Properties page", null); | ||
84 | this.bspElem = element; | ||
85 | } | ||
86 | |||
87 | public void onEnterPage(YoctoBspElement element) { | ||
88 | if (!element.getValidPropertiesFile()) { | ||
89 | setErrorMessage("There's no valid properties file created, please choose \"Back\" to reselect kernel architecture!"); | ||
90 | return; | ||
91 | } | ||
92 | |||
93 | if (this.bspElem == null || this.bspElem.getKarch().isEmpty() || !this.bspElem.getKarch().contentEquals(element.getKarch())) { | ||
94 | kArchChanged = true; | ||
95 | } else | ||
96 | kArchChanged = false; | ||
97 | |||
98 | this.bspElem = element; | ||
99 | try { | ||
100 | if (kArchChanged) { | ||
101 | updateKernelValues(KERNEL_CHOICES, KERNEL_CHOICE); | ||
102 | |||
103 | if (propertyGroup != null) { | ||
104 | for (Control cntrl : propertyGroup.getChildren()) { | ||
105 | cntrl.dispose(); | ||
106 | } | ||
107 | } | ||
108 | |||
109 | properties = YoctoJSONHelper.getProperties(); | ||
110 | |||
111 | if (!properties.isEmpty()) { | ||
112 | |||
113 | if (!element.getQarch().isEmpty()) { | ||
114 | YoctoBspPropertyElement qarch_elem = new YoctoBspPropertyElement(); | ||
115 | qarch_elem.setName(QARCH_NAME); | ||
116 | qarch_elem.setValue(element.getQarch()); | ||
117 | properties.add(qarch_elem); | ||
118 | } | ||
119 | |||
120 | propertyControlMap = new Hashtable<YoctoBspPropertyElement, Control>(); | ||
121 | |||
122 | ArrayList<YoctoBspPropertyElement> propertiesList = new ArrayList<YoctoBspPropertyElement>(properties); | ||
123 | Collections.sort(propertiesList, Collections.reverseOrder()); | ||
124 | |||
125 | Iterator<YoctoBspPropertyElement> it = propertiesList.iterator(); | ||
126 | Composite comp = new Composite(propertyGroup, SWT.FILL); | ||
127 | GridLayout layout = new GridLayout(2, false); | ||
128 | GridData data = new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1); | ||
129 | comp.setLayoutData(data); | ||
130 | comp.setLayout(layout); | ||
131 | |||
132 | while (it.hasNext()) { | ||
133 | // Get property | ||
134 | YoctoBspPropertyElement propElem = it.next(); | ||
135 | String type = propElem.getType(); | ||
136 | String name = propElem.getName(); | ||
137 | if (type.contentEquals("edit")) { | ||
138 | new Label (propertyGroup, SWT.FILL).setText(name + ":"); | ||
139 | |||
140 | Composite textContainer = new Composite(propertyGroup, SWT.NONE); | ||
141 | textContainer.setLayout(new GridLayout(1, false)); | ||
142 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); | ||
143 | Text text = new Text(textContainer, SWT.BORDER | SWT.SINGLE); | ||
144 | text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); | ||
145 | propertyControlMap.put(propElem, text); | ||
146 | |||
147 | } else if (type.contentEquals("boolean")) { | ||
148 | String default_value = propElem.getDefaultValue(); | ||
149 | Composite labelContainer = new Composite(propertyGroup, SWT.NONE); | ||
150 | labelContainer.setLayout(new GridLayout(2, false)); | ||
151 | labelContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL, GridData.FILL_VERTICAL, true, false, 2, 1)); | ||
152 | Button button = new Button(propertyGroup, SWT.CHECK); | ||
153 | button.setText(name); | ||
154 | if (default_value.equalsIgnoreCase("y")) { | ||
155 | button.setSelection(true); | ||
156 | } else | ||
157 | button.setSelection(false); | ||
158 | propertyControlMap.put(propElem, button); | ||
159 | } else if (type.contentEquals("choicelist")) { | ||
160 | new Label (propertyGroup, SWT.NONE).setText(name + ":"); | ||
161 | |||
162 | Composite textContainer = new Composite(propertyGroup, SWT.NONE); | ||
163 | textContainer.setLayout(new GridLayout(1, false)); | ||
164 | textContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); | ||
165 | Combo combo = new Combo(textContainer, SWT.READ_ONLY); | ||
166 | combo.setLayout(new GridLayout(2, false)); | ||
167 | combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); | ||
168 | combo.setItems(getBSPComboProperties(name)); | ||
169 | propertyControlMap.put(propElem, combo); | ||
170 | } | ||
171 | } | ||
172 | } | ||
173 | composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)); | ||
174 | composite.computeSize(SWT.DEFAULT, SWT.DEFAULT); | ||
175 | controlContainer.pack(); | ||
176 | this.composite.layout(true, true); | ||
177 | } | ||
178 | } catch (Exception e) { | ||
179 | e.printStackTrace(); | ||
180 | } | ||
181 | |||
182 | |||
183 | } | ||
184 | |||
185 | |||
186 | @Override | ||
187 | public void createControl(Composite parent) { | ||
188 | this.composite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); | ||
189 | GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false); | ||
190 | GridLayout layout = new GridLayout(2, true); | ||
191 | this.composite.setLayout(layout); | ||
192 | |||
193 | gd= new GridData(SWT.FILL, SWT.FILL, true, false); | ||
194 | gd.horizontalSpan = 2; | ||
195 | this.composite.setLayoutData(gd); | ||
196 | |||
197 | setControl(this.composite); | ||
198 | |||
199 | controlContainer = new Composite(composite, SWT.NONE); | ||
200 | controlContainer.setLayout(new GridLayout(1, true)); | ||
201 | controlContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | ||
202 | |||
203 | kGroup = new Group(controlContainer, SWT.FILL); | ||
204 | kGroup.setLayout(new GridLayout(2, false)); | ||
205 | GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1); | ||
206 | kGroup.setLayoutData(data); | ||
207 | kGroup.setText("Kernel Settings:"); | ||
208 | |||
209 | new Label (kGroup, SWT.NONE).setText("Kernel:"); | ||
210 | Composite textContainer = new Composite(kGroup, SWT.NONE); | ||
211 | textContainer.setLayout(new GridLayout(1, false)); | ||
212 | textContainer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1)); | ||
213 | |||
214 | kernelCombo = new Combo(textContainer, SWT.READ_ONLY); | ||
215 | kernelCombo.setLayout(new GridLayout(2, false)); | ||
216 | kernelCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); | ||
217 | |||
218 | kernelCombo.addSelectionListener(new SelectionListener() { | ||
219 | |||
220 | @Override | ||
221 | public void widgetSelected(SelectionEvent e) { | ||
222 | controlChanged(e.widget); | ||
223 | } | ||
224 | |||
225 | @Override | ||
226 | public void widgetDefaultSelected(SelectionEvent e) { | ||
227 | } | ||
228 | }); | ||
229 | |||
230 | kbGroup = new Group(kGroup, SWT.FILL); | ||
231 | kbGroup.setLayout(new GridLayout(2, true)); | ||
232 | data = new GridData(SWT.FILL, SWT.FILL, true, false); | ||
233 | data.horizontalSpan = 2; | ||
234 | kbGroup.setLayoutData(data); | ||
235 | kbGroup.setText("Branch Settings:"); | ||
236 | |||
237 | textContainer = new Composite(kbGroup, SWT.NONE); | ||
238 | textContainer.setLayout(new GridLayout(2, false)); | ||
239 | textContainer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); | ||
240 | |||
241 | new Label(textContainer, SWT.NONE).setText("Kernel branch:"); | ||
242 | |||
243 | branchesCombo = new Combo(textContainer, SWT.READ_ONLY); | ||
244 | branchesCombo.setLayout(new GridLayout(1, false)); | ||
245 | branchesCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); | ||
246 | branchesCombo.addSelectionListener(new SelectionListener() { | ||
247 | |||
248 | @Override | ||
249 | public void widgetSelected(SelectionEvent e) { | ||
250 | controlChanged(e.widget); | ||
251 | } | ||
252 | |||
253 | @Override | ||
254 | public void widgetDefaultSelected(SelectionEvent e) { | ||
255 | } | ||
256 | }); | ||
257 | branchesCombo.setSize(200, 200); | ||
258 | |||
259 | newBranchButton = new Button(kbGroup, SWT.RADIO); | ||
260 | newBranchButton.setText("Create a new branch from an existing one"); | ||
261 | newBranchButton.setSelection(true); | ||
262 | newBranchButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); | ||
263 | SelectionListener listener = new SelectionListener() { | ||
264 | @Override | ||
265 | public void widgetDefaultSelected(SelectionEvent e) {} | ||
266 | |||
267 | @Override | ||
268 | public void widgetSelected(SelectionEvent e) { | ||
269 | controlChanged(e.widget); | ||
270 | } | ||
271 | }; | ||
272 | |||
273 | newBranchButton.addSelectionListener(listener); | ||
274 | |||
275 | existingBranchButton = new Button(kbGroup, SWT.RADIO); | ||
276 | existingBranchButton.setText("Use existing branch"); | ||
277 | existingBranchButton.setSelection(false); | ||
278 | existingBranchButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); | ||
279 | existingBranchButton.addSelectionListener(listener); | ||
280 | |||
281 | // otherSettingsGroup = new Group(controlContainer, SWT.FILL); | ||
282 | // otherSettingsGroup.setLayout(new GridLayout(2, true)); | ||
283 | // data = new GridData(SWT.FILL, SWT.FILL, true, false); | ||
284 | // data.horizontalSpan = 2; | ||
285 | // otherSettingsGroup.setLayoutData(data); | ||
286 | // otherSettingsGroup.setText("Other Settings:"); | ||
287 | |||
288 | smpButton = new Button(kGroup, SWT.CHECK); | ||
289 | smpButton.setText("Enable SMP support"); | ||
290 | smpButton.setSelection(true); | ||
291 | |||
292 | propertyGroup = new Group(controlContainer, SWT.NONE); | ||
293 | propertyGroup.setLayout(new GridLayout(2, false)); | ||
294 | data = new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1); | ||
295 | propertyGroup.setLayoutData(data); | ||
296 | propertyGroup.setText("BSP specific settings:"); | ||
297 | |||
298 | this.composite.layout(true, true); | ||
299 | |||
300 | composite.setContent(controlContainer); | ||
301 | composite.setExpandHorizontal(true); | ||
302 | composite.setExpandVertical(true); | ||
303 | composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)); | ||
304 | controlContainer.pack(); | ||
305 | composite.pack(); | ||
306 | } | ||
307 | |||
308 | @Override | ||
309 | public boolean canFlipToNextPage() { | ||
310 | return false; | ||
311 | } | ||
312 | |||
313 | public HashSet<YoctoBspPropertyElement> getProperties() { | ||
314 | String kcSelection = kernelCombo.getText(); | ||
315 | String kbSelection = branchesCombo.getText(); | ||
316 | YoctoBspPropertyElement kcElement = new YoctoBspPropertyElement(); | ||
317 | kcElement.setName(KERNEL_CHOICE); | ||
318 | kcElement.setValue(kcSelection); | ||
319 | properties.add(kcElement); | ||
320 | YoctoBspPropertyElement defaultElement = new YoctoBspPropertyElement(); | ||
321 | defaultElement.setName(DEFAULT_KERNEL); | ||
322 | defaultElement.setValue("n"); | ||
323 | properties.add(defaultElement); | ||
324 | |||
325 | YoctoBspPropertyElement smpElement = new YoctoBspPropertyElement(); | ||
326 | smpElement.setName(SMP_NAME); | ||
327 | if (smpButton.getSelection()) | ||
328 | smpElement.setValue("y"); | ||
329 | else | ||
330 | smpElement.setValue("n"); | ||
331 | properties.add(smpElement); | ||
332 | |||
333 | YoctoBspPropertyElement newKbElement = new YoctoBspPropertyElement(); | ||
334 | YoctoBspPropertyElement kbElement = new YoctoBspPropertyElement(); | ||
335 | |||
336 | newKbElement.setName(NEED_NEW_KBRANCH_NAME); | ||
337 | if (newBranchButton.getSelection()) { | ||
338 | newKbElement.setValue("y"); | ||
339 | properties.add(newKbElement); | ||
340 | kbElement.setName(NEW_KBRANCH_NAME); | ||
341 | kbElement.setValue(kbSelection); | ||
342 | properties.add(kbElement); | ||
343 | } else { | ||
344 | newKbElement.setValue("n"); | ||
345 | properties.add(newKbElement); | ||
346 | kbElement.setName(EXISTING_KBRANCH_NAME); | ||
347 | kbElement.setValue(kbSelection); | ||
348 | properties.add(kbElement); | ||
349 | } | ||
350 | |||
351 | return properties; | ||
352 | } | ||
353 | |||
354 | public boolean validatePage() { | ||
355 | if (kernelCombo == null) | ||
356 | return false; | ||
357 | |||
358 | if ((kernelCombo != null) && (branchesCombo != null)) { | ||
359 | String kcSelection = kernelCombo.getText(); | ||
360 | String kbSelection = branchesCombo.getText(); | ||
361 | if ((kcSelection == null) || (kbSelection == null) || (kcSelection.isEmpty()) || (kbSelection.isEmpty())) { | ||
362 | setErrorMessage("Please choose a kernel and a specific branch!"); | ||
363 | return false; | ||
364 | } | ||
365 | } | ||
366 | if ((propertyControlMap != null)) { | ||
367 | if (!propertyControlMap.isEmpty()) { | ||
368 | Enumeration<YoctoBspPropertyElement> keys = propertyControlMap.keys(); | ||
369 | while (keys.hasMoreElements()) { | ||
370 | YoctoBspPropertyElement key = keys.nextElement(); | ||
371 | Control control = propertyControlMap.get(key); | ||
372 | String type = key.getType(); | ||
373 | |||
374 | if (type.contentEquals("edit")) { | ||
375 | String text_value = ((Text)control).getText(); | ||
376 | if (text_value == null) { | ||
377 | setErrorMessage("Field "+ key.getName() +" is not set. All of the field on this screen must be set!"); | ||
378 | return false; | ||
379 | } else { | ||
380 | key.setValue(text_value); | ||
381 | } | ||
382 | } else if (type.contentEquals("choicelist")) { | ||
383 | String choice_value = ((Combo)control).getText(); | ||
384 | if (choice_value == null) { | ||
385 | setErrorMessage("Field "+ key.getName() +" is not set. All of the field on this screen must be set!"); | ||
386 | return false; | ||
387 | } else { | ||
388 | key.setValue(choice_value); | ||
389 | } | ||
390 | } else { | ||
391 | boolean button_select = ((Button)control).getSelection(); | ||
392 | if (button_select) | ||
393 | key.setValue("y"); | ||
394 | else | ||
395 | key.setValue("n"); | ||
396 | } | ||
397 | updateProperties(key); | ||
398 | } | ||
399 | } | ||
400 | } | ||
401 | return true; | ||
402 | } | ||
403 | |||
404 | private void updateProperties(YoctoBspPropertyElement element) { | ||
405 | Iterator<YoctoBspPropertyElement> it = properties.iterator(); | ||
406 | |||
407 | while (it.hasNext()) { | ||
408 | YoctoBspPropertyElement propElem = it.next(); | ||
409 | if (propElem.getName().contentEquals(element.getName())) { | ||
410 | properties.remove(propElem); | ||
411 | properties.add(element); | ||
412 | break; | ||
413 | } else | ||
414 | continue; | ||
415 | } | ||
416 | } | ||
417 | private void controlChanged(Widget widget) { | ||
418 | setErrorMessage(null); | ||
419 | |||
420 | String kernel_choice = kernelCombo.getText(); | ||
421 | if ((kernel_choice == null) || (kernel_choice.isEmpty())) { | ||
422 | setErrorMessage("Please choose kernel !"); | ||
423 | return; | ||
424 | } | ||
425 | if (widget == kernelCombo) { | ||
426 | updateKernelValues(KERNEL_BRANCHES, "\\\"" + kernel_choice + "\\\"." + NEW_KBRANCH_NAME); | ||
427 | } else if (widget == branchesCombo) { | ||
428 | setErrorMessage(null); | ||
429 | branchesCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT); | ||
430 | } else if (widget == newBranchButton || widget == existingBranchButton) { | ||
431 | if (newBranchButton.getSelection()) { | ||
432 | updateKernelValues(KERNEL_BRANCHES, "\"" + kernel_choice + "\"." + NEW_KBRANCH_NAME); | ||
433 | } else { | ||
434 | updateKernelValues(KERNEL_BRANCHES, "\"" + kernel_choice + "\"." + EXISTING_KBRANCH_NAME); | ||
435 | } | ||
436 | branchesCombo.deselectAll(); | ||
437 | } | ||
438 | canFlipToNextPage(); | ||
439 | getWizard().getContainer().updateButtons(); | ||
440 | this.composite.layout(true, true); | ||
441 | composite.pack(); | ||
442 | } | ||
443 | |||
444 | private void updateKernelValues(final String value, String property) { | ||
445 | String build_dir = ""; | ||
446 | if ((bspElem.getBuildLoc() == null) || bspElem.getBuildLoc().isEmpty()) | ||
447 | build_dir = bspElem.getMetadataLoc()+"/build"; | ||
448 | else | ||
449 | build_dir = bspElem.getBuildLoc(); | ||
450 | |||
451 | String metadataLoc = bspElem.getMetadataLoc(); | ||
452 | String valuesCmd = "source " + metadataLoc + "/oe-init-build-env;" + metadataLoc + "/scripts/" + VALUES_CMD_PREFIX + bspElem.getKarch() + VALUES_CMD_SURFIX + property; | ||
453 | BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new KernelBranchesGetter(valuesCmd), "Loading Kernel " + value); | ||
454 | if (value.equals(KERNEL_CHOICES)) | ||
455 | progressDialog.run(false); | ||
456 | else if (value.equals(KERNEL_BRANCHES)) | ||
457 | progressDialog.run(true); | ||
458 | |||
459 | BSPAction action = progressDialog.getBspAction(); | ||
460 | if (action.getItems() != null) { | ||
461 | if (value.equals(KERNEL_CHOICES)) { | ||
462 | kernelCombo.setItems(action.getItems()); | ||
463 | kernelCombo.pack(); | ||
464 | kernelCombo.deselectAll(); | ||
465 | branchesCombo.setEnabled(false); | ||
466 | branchesCombo.deselectAll(); | ||
467 | } else if (value.equals(KERNEL_BRANCHES)) { | ||
468 | branchesCombo.setItems(action.getItems()); | ||
469 | branchesCombo.pack(); | ||
470 | branchesCombo.setEnabled(true); | ||
471 | } | ||
472 | composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)); | ||
473 | } else if (action.getMessage() != null) | ||
474 | MessageDialog.openError(getShell(), "Yocto-BSP", action.getMessage()); | ||
475 | composite.setMinSize(controlContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)); | ||
476 | } | ||
477 | |||
478 | private String[] getBSPComboProperties(String property) { | ||
479 | String build_dir = ""; | ||
480 | if ((bspElem.getBuildLoc() == null) || bspElem.getBuildLoc().isEmpty()) | ||
481 | build_dir = bspElem.getMetadataLoc()+"/build"; | ||
482 | else | ||
483 | build_dir = bspElem.getBuildLoc(); | ||
484 | |||
485 | String valuesCmd = "export BUILDDIR=" + build_dir + ";" + bspElem.getMetadataLoc() + "/scripts/" + VALUES_CMD_PREFIX + bspElem.getKarch() + VALUES_CMD_SURFIX + property; | ||
486 | BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new KernelBranchesGetter(valuesCmd), "Loading property " + property + "values"); | ||
487 | progressDialog.run(false); | ||
488 | BSPAction action = progressDialog.getBspAction(); | ||
489 | |||
490 | if (action.getItems() != null) { | ||
491 | return action.getItems(); | ||
492 | } else if (action.getMessage() != null) { | ||
493 | MessageDialog.openError(getShell(), "Yocto-BSP", action.getMessage()); | ||
494 | return new String[]{}; | ||
495 | } | ||
496 | return new String[]{}; | ||
497 | } | ||
498 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/QemuArchGetter.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/QemuArchGetter.java new file mode 100644 index 0000000..e235695 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/QemuArchGetter.java | |||
@@ -0,0 +1,27 @@ | |||
1 | package org.yocto.sdk.remotetools.wizards.bsp; | ||
2 | |||
3 | /** | ||
4 | * BSPThread that processes the output of running "yocto-bsp list qemu property qemuarch" | ||
5 | * @author ioana.grigoropol | ||
6 | * | ||
7 | */ | ||
8 | public class QemuArchGetter extends BSPThread { | ||
9 | |||
10 | public QemuArchGetter(String command) { | ||
11 | super(command); | ||
12 | } | ||
13 | |||
14 | @Override | ||
15 | protected String[] processLine(String line) { | ||
16 | if (!line.startsWith("[")) | ||
17 | return new String[]{ERROR, line + "\n"}; | ||
18 | |||
19 | String[] values = line.split(","); | ||
20 | |||
21 | String value = values[0]; | ||
22 | value = value.replace("[\"", ""); | ||
23 | value = value.replaceAll("\"$", ""); | ||
24 | return new String[]{SUCCESS, value}; | ||
25 | } | ||
26 | |||
27 | } | ||
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/YoctoBSPWizard.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/YoctoBSPWizard.java new file mode 100644 index 0000000..3ab24c0 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/wizards/bsp/YoctoBSPWizard.java | |||
@@ -0,0 +1,99 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.wizards.bsp; | ||
12 | |||
13 | import java.util.HashSet; | ||
14 | |||
15 | import org.eclipse.jface.dialogs.MessageDialog; | ||
16 | import org.eclipse.jface.wizard.IWizardPage; | ||
17 | import org.eclipse.jface.wizard.Wizard; | ||
18 | import org.yocto.sdk.remotetools.YoctoBspElement; | ||
19 | import org.yocto.sdk.remotetools.YoctoBspPropertyElement; | ||
20 | import org.yocto.sdk.remotetools.YoctoJSONHelper; | ||
21 | |||
22 | /** | ||
23 | * A wizard for creating Yocto BSP. | ||
24 | * | ||
25 | * @author jzhang | ||
26 | * | ||
27 | */ | ||
28 | public class YoctoBSPWizard extends Wizard { | ||
29 | private static final String CREATE_CMD = "/scripts/yocto-bsp create "; | ||
30 | private static final String PROPERTY_VALUE_FILE = "/tmp/propertyvalues.json"; | ||
31 | |||
32 | private MainPage mainPage; | ||
33 | private PropertiesPage propertiesPage; | ||
34 | private final YoctoBspElement bspElem; | ||
35 | |||
36 | public YoctoBSPWizard() { | ||
37 | super(); | ||
38 | bspElem = new YoctoBspElement(); | ||
39 | } | ||
40 | |||
41 | @Override | ||
42 | public IWizardPage getNextPage(IWizardPage page) { | ||
43 | propertiesPage.onEnterPage(mainPage.getBSPElement()); | ||
44 | return propertiesPage; | ||
45 | } | ||
46 | |||
47 | @Override | ||
48 | public void addPages() { | ||
49 | mainPage = new MainPage(bspElem); | ||
50 | addPage(mainPage); | ||
51 | propertiesPage = new PropertiesPage(bspElem); | ||
52 | addPage(propertiesPage); | ||
53 | } | ||
54 | |||
55 | private BSPAction createBSP(){ | ||
56 | YoctoBspElement element = mainPage.getBSPElement(); | ||
57 | String createBspCmd = element.getMetadataLoc() + CREATE_CMD + | ||
58 | element.getBspName() + " " + element.getKarch(); | ||
59 | |||
60 | if (!element.getBspOutLoc().isEmpty()) | ||
61 | createBspCmd = createBspCmd + " -o " + element.getBspOutLoc(); | ||
62 | else | ||
63 | createBspCmd = createBspCmd + " -o " + element.getMetadataLoc() + "/meta-" + element.getBspName(); | ||
64 | createBspCmd = createBspCmd + " -i " + PROPERTY_VALUE_FILE; | ||
65 | |||
66 | BSPProgressDialog progressDialog = new BSPProgressDialog(getShell(), new OutputCollectorThread(createBspCmd), "Creating BSP "); | ||
67 | progressDialog.run(true); | ||
68 | return progressDialog.getBspAction(); | ||
69 | } | ||
70 | |||
71 | @Override | ||
72 | public boolean performFinish() { | ||
73 | if (propertiesPage.validatePage()) { | ||
74 | HashSet<YoctoBspPropertyElement> properties = propertiesPage.getProperties(); | ||
75 | YoctoJSONHelper.createBspJSONFile(properties); | ||
76 | |||
77 | BSPAction createBSPAction = createBSP(); | ||
78 | if (createBSPAction.getMessage() != null && !createBSPAction.getMessage().isEmpty()) { | ||
79 | MessageDialog.openError(getShell(),"Yocto-BSP", createBSPAction.getMessage()); | ||
80 | return false; | ||
81 | } else { | ||
82 | String message = ""; | ||
83 | for (String item : createBSPAction.getItems()) | ||
84 | message += item + "\n"; | ||
85 | MessageDialog.openInformation(getShell(), "Yocto-BSP", message); | ||
86 | return true; | ||
87 | } | ||
88 | } else { | ||
89 | MessageDialog.openError(getShell(), "Yocto-BSP", "Property settings contains error!"); | ||
90 | return false; | ||
91 | } | ||
92 | |||
93 | } | ||
94 | |||
95 | @Override | ||
96 | public boolean canFinish() { | ||
97 | return (mainPage.validatePage() && propertiesPage.validatePage()); | ||
98 | } | ||
99 | } | ||
diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..99acff7 --- /dev/null +++ b/scripts/build.sh | |||
@@ -0,0 +1,173 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | help () | ||
4 | { | ||
5 | echo "Build the Yocto Eclipse plugins" | ||
6 | echo "Usage: [GIT_URL=url_of_repo] [DOC_GIT=url_of_repo] $0 [OPTIONS] BRANCH_NAME RELEASE_NAME [TAG_NAME]"; | ||
7 | echo "" | ||
8 | echo "Options:" | ||
9 | echo "-h - display this help and exit" | ||
10 | echo "-l - use local git repository" | ||
11 | echo "BRANCH_NAME - git branch name to build upon" | ||
12 | echo "RELEAES_NAME - release name in the final output name" | ||
13 | echo "TAG_NAME - git tag name to build upon. defaults to HEAD if not set" | ||
14 | echo "GIT_URL - use this repo for the plugins. Defaults to git://git.pokylinux.org/eclipse-poky-juno.git if not set" | ||
15 | echo "DOC_GIT - use this repo for documentation. Defaults to git://git.pokylinux.org/yocto-docs.git if not set" | ||
16 | echo "" | ||
17 | echo "Example: $0 master r0 M1.1_rc1"; | ||
18 | exit 1; | ||
19 | } | ||
20 | |||
21 | fail () | ||
22 | { | ||
23 | local retval=$1 | ||
24 | shift $1 | ||
25 | echo "[Fail $retval]: $*" | ||
26 | echo "BUILD_TOP=${BUILD_TOP}" | ||
27 | cd ${TOP} | ||
28 | exit ${retval} | ||
29 | } | ||
30 | |||
31 | find_eclipse_base () | ||
32 | { | ||
33 | [ -d ${ECLIPSE_HOME}/plugins ] && ECLIPSE_BASE=${ECLIPSE_HOME} | ||
34 | } | ||
35 | |||
36 | find_launcher () | ||
37 | { | ||
38 | local list="`ls ${ECLIPSE_BASE}/plugins/org.eclipse.equinox.launcher_*.jar`" | ||
39 | for launcher in $list; do | ||
40 | [ -f $launcher ] && LAUNCHER=${launcher} | ||
41 | done | ||
42 | } | ||
43 | |||
44 | find_buildfile () | ||
45 | { | ||
46 | local list="`ls ${ECLIPSE_BASE}/plugins/org.eclipse.pde.build_*/scripts/build.xml`" | ||
47 | for buildfile in $list; do | ||
48 | [ -f $buildfile ] && BUILDFILE=${buildfile} | ||
49 | done | ||
50 | } | ||
51 | |||
52 | check_env () | ||
53 | { | ||
54 | find_eclipse_base | ||
55 | find_launcher | ||
56 | find_buildfile | ||
57 | |||
58 | local err=0 | ||
59 | [ "x${ECLIPSE_BASE}" = "x" -o "x${LAUNCHER}" = "x" -o "x${BUILDFILE}" = "x" ] && err=1 | ||
60 | if [ $err -eq 0 ]; then | ||
61 | [ ! -d ${ECLIPSE_BASE} ] && err=1 | ||
62 | [ ! -f ${LAUNCHER} ] && err=1 | ||
63 | [ ! -f ${BUILDFILE} ] && err=1 | ||
64 | fi | ||
65 | |||
66 | if [ $err -ne 0 ]; then | ||
67 | echo "Please set env variable ECLIPSE_HOME to the eclipse installation directory!" | ||
68 | exit 1 | ||
69 | fi | ||
70 | } | ||
71 | |||
72 | USE_LOCAL_GIT_REPO=0 | ||
73 | while getopts ":lh" opt; do | ||
74 | case $opt in | ||
75 | h) | ||
76 | help | ||
77 | ;; | ||
78 | l) | ||
79 | USE_LOCAL_GIT_REPO=1 | ||
80 | ;; | ||
81 | esac | ||
82 | done | ||
83 | shift $(($OPTIND - 1)) | ||
84 | |||
85 | |||
86 | if [ $# -ne 2 ] && [ $# -ne 3 ]; then | ||
87 | help | ||
88 | fi | ||
89 | |||
90 | #milestone | ||
91 | BRANCH=$1 | ||
92 | RELEASE=$2 | ||
93 | |||
94 | if [ "x" = "x${3}" ] | ||
95 | then | ||
96 | TAG="HEAD" | ||
97 | else | ||
98 | TAG=$3 | ||
99 | fi | ||
100 | |||
101 | TOP=`pwd` | ||
102 | |||
103 | check_env | ||
104 | |||
105 | #create tmp dir for build | ||
106 | DATE=`date +%Y%m%d%H%M` | ||
107 | BUILD_TOP=`echo ${BRANCH} | sed 's%/%-%'` | ||
108 | BUILD_TOP=${TOP}/${BUILD_TOP}_build_${DATE} | ||
109 | rm -rf ${BUILD_TOP} | ||
110 | mkdir ${BUILD_TOP} || fail $? "Create temporary build directory ${BUILD_TOP}" | ||
111 | BUILD_SRC=${BUILD_TOP}/src | ||
112 | BUILD_DIR=${BUILD_TOP}/build | ||
113 | mkdir ${BUILD_DIR} || fail $? "Create temporary build directory ${BUILD_DIR}" | ||
114 | |||
115 | |||
116 | #git clone | ||
117 | GIT_URL=${GIT_URL:-git://git.pokylinux.org/eclipse-poky-kepler.git} | ||
118 | if [ $USE_LOCAL_GIT_REPO -eq 1 ]; then | ||
119 | SCRIPT_DIR=`dirname $0` | ||
120 | GIT_DIR=`readlink -f ${SCRIPT_DIR}/..` | ||
121 | GIT_URL="file://${GIT_DIR}" | ||
122 | fi | ||
123 | |||
124 | GIT_DIR=${BUILD_SRC} | ||
125 | #mkdir ${GIT_DIR} | ||
126 | #cp -r features/ ${GIT_DIR} | ||
127 | #cp -r plugins/ ${GIT_DIR} | ||
128 | #cp -r tcf/ ${GIT_DIR} | ||
129 | git clone ${GIT_URL} ${GIT_DIR} || fail $? "git clone ${GIT_URL}" | ||
130 | cd ${GIT_DIR} | ||
131 | git checkout origin/${BRANCH} || fail $? "git checkout origin/${BRANCH}" | ||
132 | git checkout ${TAG} || fail $? "git checkout ${TAG}" | ||
133 | cd ${TOP} | ||
134 | |||
135 | # generate and add documentation | ||
136 | if [ "${TAG}" = "HEAD" ]; then | ||
137 | ${GIT_DIR}/scripts/generate-doc.sh ${BRANCH} ${GIT_DIR} | ||
138 | else | ||
139 | ${GIT_DIR}/scripts/generate-doc.sh -t ${TAG} ${GIT_DIR} | ||
140 | fi | ||
141 | |||
142 | #build | ||
143 | java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.bc.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} || fail $? "normal build" | ||
144 | java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.doc.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} || fail $? "normal build" | ||
145 | java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.sdk.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} || fail $? "normal build" | ||
146 | |||
147 | if [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}.zip ] && | ||
148 | [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.bc-${RELEASE}.zip ] && | ||
149 | [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.doc-${RELEASE}.zip ]; then | ||
150 | cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.bc-${RELEASE}.zip ./org.yocto.bc-${RELEASE}-${DATE}.zip | ||
151 | cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.doc-${RELEASE}.zip ./org.yocto.doc-${RELEASE}-${DATE}.zip | ||
152 | cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}.zip ./org.yocto.sdk-${RELEASE}-${DATE}.zip | ||
153 | rm -rf ${BUILD_DIR} | ||
154 | else | ||
155 | fail 1 "Not finding normal build output" | ||
156 | fi | ||
157 | |||
158 | #build archive for update site | ||
159 | java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.bc.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} -Dp2.gathering=true || fail $? "archive build" | ||
160 | java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.doc.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} -Dp2.gathering=true || fail $? "archive build" | ||
161 | java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.sdk.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} -Dp2.gathering=true || fail $? "archive build" | ||
162 | |||
163 | #clean up | ||
164 | if [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}-group.group.group.zip ] && | ||
165 | [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.bc-${RELEASE}-group.group.group.zip ] && | ||
166 | [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.doc-${RELEASE}-group.group.group.zip ]; then | ||
167 | cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}-group.group.group.zip ./org.yocto.sdk-${RELEASE}-${DATE}-archive.zip | ||
168 | rm -rf ${BUILD_TOP} | ||
169 | else | ||
170 | fail 1 "Not finding archive build output" | ||
171 | fi | ||
172 | |||
173 | exit 0 | ||
diff --git a/scripts/find-version b/scripts/find-version new file mode 100755 index 0000000..55fbc58 --- /dev/null +++ b/scripts/find-version | |||
@@ -0,0 +1,62 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | help () | ||
4 | { | ||
5 | echo "Find the installed plugin/feature version of a eclipse build environment" | ||
6 | echo "Usage: $0 [pluginId1/featureId1[,pluginId2/featureId2]...]"; | ||
7 | echo "" | ||
8 | echo "Options:" | ||
9 | echo "pluginId/featureId - comma seperated plugin or feature ids, empty for all" | ||
10 | echo "" | ||
11 | echo "Example: $0 org.eclipse.tcf.feature.group"; | ||
12 | exit 1; | ||
13 | } | ||
14 | |||
15 | fail () | ||
16 | { | ||
17 | local retval=$1 | ||
18 | shift $1 | ||
19 | echo "[Fail $retval]: $*" | ||
20 | echo "BUILD_TOP=${BUILD_TOP}" | ||
21 | cd ${TOP} | ||
22 | exit ${retval} | ||
23 | } | ||
24 | |||
25 | find_eclipse_base () | ||
26 | { | ||
27 | [ -d ${ECLIPSE_HOME}/plugins ] && ECLIPSE_BASE=`readlink -f ${ECLIPSE_HOME}` | ||
28 | } | ||
29 | |||
30 | find_launcher () | ||
31 | { | ||
32 | local list="`ls ${ECLIPSE_BASE}/plugins/org.eclipse.equinox.launcher_*.jar`" | ||
33 | for launcher in $list; do | ||
34 | [ -f $launcher ] && LAUNCHER=${launcher} | ||
35 | done | ||
36 | } | ||
37 | |||
38 | check_env () | ||
39 | { | ||
40 | find_eclipse_base | ||
41 | find_launcher | ||
42 | |||
43 | local err=0 | ||
44 | [ "x${ECLIPSE_BASE}" = "x" -o "x${LAUNCHER}" = "x" ] && err=1 | ||
45 | if [ $err -eq 0 ]; then | ||
46 | [ ! -d ${ECLIPSE_BASE} ] && err=1 | ||
47 | [ ! -f ${LAUNCHER} ] && err=1 | ||
48 | fi | ||
49 | |||
50 | if [ $err -ne 0 ]; then | ||
51 | echo "Please set env variable ECLIPSE_HOME to the eclipse installation directory!" | ||
52 | exit 1 | ||
53 | fi | ||
54 | } | ||
55 | |||
56 | if [ $# -ne 0 ] && [ $# -ne 1 ]; then | ||
57 | help | ||
58 | fi | ||
59 | |||
60 | check_env | ||
61 | |||
62 | java -jar ${LAUNCHER} -application org.eclipse.equinox.p2.director -destination ${ECLIPSE_BASE} -profile SDKProfile -repository file:///${ECLIPSE_BASE}/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile -list $@ | ||
diff --git a/scripts/generate-doc.sh b/scripts/generate-doc.sh new file mode 100755 index 0000000..7feeb6b --- /dev/null +++ b/scripts/generate-doc.sh | |||
@@ -0,0 +1,87 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | help() | ||
4 | { | ||
5 | echo "Generate and add eclipse help from yocto's documentation" | ||
6 | echo "Usage: [DOC_GIT=url_of_repo] $0 BRANCH_NAME PLUGIN_FOLDER" | ||
7 | echo " [DOC_GIT=url_of_repo] $0 -t TAG_NAME PLUGIN_FOLDER" | ||
8 | echo "" | ||
9 | echo "Options:" | ||
10 | echo "-h - display this help and exit" | ||
11 | echo "-t TAG_NAME - tag to build the documentation upon" | ||
12 | echo "BRANCH_NAME - branch to build the documentation upon" | ||
13 | echo "PLUGIN_FOLDER - root folder of the eclipse-poky project" | ||
14 | echo "DOC_GIT - use this repo for documentation. Defaults to git://git.pokylinux.org/yocto-docs.git if not set" | ||
15 | exit 1 | ||
16 | } | ||
17 | |||
18 | fail () | ||
19 | { | ||
20 | local retval=$1 | ||
21 | shift $1 | ||
22 | echo "[Fail $retval]: $*" | ||
23 | echo "BUILD_TOP=${BUILD_TOP}" | ||
24 | cd ${TOP} | ||
25 | exit ${retval} | ||
26 | } | ||
27 | |||
28 | CHECKOUT_TAG=0 | ||
29 | while getopts ":ht" opt; do | ||
30 | case $opt in | ||
31 | h) | ||
32 | help | ||
33 | ;; | ||
34 | t) | ||
35 | CHECKOUT_TAG=1 | ||
36 | ;; | ||
37 | esac | ||
38 | done | ||
39 | shift $(($OPTIND - 1)) | ||
40 | |||
41 | if [ $# -ne 2 ]; then | ||
42 | help | ||
43 | fi | ||
44 | |||
45 | if [ $CHECKOUT_TAG -eq 0 ]; then | ||
46 | REFERENCE=origin/$1 | ||
47 | else | ||
48 | REFERENCE=$1 | ||
49 | fi | ||
50 | PLUGIN_FOLDER=`readlink -f $2` | ||
51 | |||
52 | TOP=`pwd` | ||
53 | |||
54 | DOC_DIR=${PLUGIN_FOLDER}/docs | ||
55 | rm -rf ${DOC_DIR} | ||
56 | DOC_PLUGIN_DIR=${PLUGIN_FOLDER}/plugins/org.yocto.doc.user | ||
57 | DOC_HTML_DIR=${DOC_PLUGIN_DIR}/html/ | ||
58 | |||
59 | # git clone | ||
60 | DOC_GIT=${DOC_GIT:-git://git.yoctoproject.org/yocto-docs.git} | ||
61 | git clone ${DOC_GIT} ${DOC_DIR} || fail $? "git clone ${DOC_GIT}" | ||
62 | cd ${DOC_DIR} | ||
63 | git checkout ${REFERENCE} || fail $? "git checkout ${REFERENCE}" | ||
64 | COMMIT_ID=`git rev-parse HEAD` | ||
65 | |||
66 | # build and copy | ||
67 | DOCS="yocto-project-qs adt-manual kernel-dev \ | ||
68 | bsp-guide ref-manual dev-manual profile-manual" | ||
69 | |||
70 | cd documentation | ||
71 | ECLIPSE_TARGET_AVAILABLE=`make -q eclipse &> /dev/null; echo $?` | ||
72 | if [ ${ECLIPSE_TARGET_AVAILABLE} -ne 1 ]; then | ||
73 | echo "WARNING:" | ||
74 | echo "This version does not support generating eclipse help" | ||
75 | echo "Documentation will not be available in eclipse" | ||
76 | exit 1 | ||
77 | fi | ||
78 | |||
79 | for DOC in ${DOCS}; do | ||
80 | make DOC=${DOC} eclipse | ||
81 | cp -rf ${DOC}/eclipse/html/* ${DOC_HTML_DIR} | ||
82 | cp -f ${DOC}/eclipse/${DOC}-toc.xml ${DOC_HTML_DIR} | ||
83 | done | ||
84 | |||
85 | sed -e "s/@.*@/${COMMIT_ID}/" < ${DOC_PLUGIN_DIR}/about.html.in > ${DOC_PLUGIN_DIR}/about.html | ||
86 | |||
87 | cd ${TOP} | ||
diff --git a/scripts/readme.txt b/scripts/readme.txt new file mode 100644 index 0000000..ba55b64 --- /dev/null +++ b/scripts/readme.txt | |||
@@ -0,0 +1,71 @@ | |||
1 | Note: PART I and PART II can be skipped if you have already done that. | ||
2 | |||
3 | Part I: Base environment setup | ||
4 | I-1. install JDK | ||
5 | sudo zypper install java-1_6_0-openjdk | ||
6 | |||
7 | I-2. install X11 related packages for eclipse running | ||
8 | sudo zypper install xorg-x11-xauth | ||
9 | |||
10 | I-3. using git through a SOCKS proxy(If you're behind some firewall) | ||
11 | I-3.1 Create a wrapper script for netcat | ||
12 | cat > ~/bin/proxy-wrapper | ||
13 | |||
14 | #!/bin/sh | ||
15 | PROXY=proxy-jf.intel.com | ||
16 | PORT=1080 | ||
17 | METHOD="-X 5 -x ${PROXY}:${PORT}" | ||
18 | |||
19 | nc $METHOD $* | ||
20 | |||
21 | Then Ctlr+D to save the file and "chmod +x ~/bin/proxy-wrapper" | ||
22 | |||
23 | Note: if netcat is not installed, please "sudo zypper install netcat-openbsd". | ||
24 | |||
25 | I-3.2 set git proxy environment | ||
26 | add the following line to your ~/.bashrc and "source ~/.bashrc" | ||
27 | |||
28 | export GIT_PROXY_COMMAND="/somepath/bin/proxy-wrapper" | ||
29 | |||
30 | Please be noted that it should be absolute path, since "~" is not supported. | ||
31 | |||
32 | I-4. using svn through a http_proxy(If you're behind some firewall) | ||
33 | Modify the ~/.subversion/servers | ||
34 | |||
35 | http-proxy-host = proxy.jf.intel.com | ||
36 | http-proxy-port = 911 | ||
37 | |||
38 | I-5. Get the scripts from eclipse-poky git | ||
39 | git clone git://git.pokylinux.org/eclipse-poky.git | ||
40 | |||
41 | The scripts used for auto builder is under the directory of "scripts". | ||
42 | |||
43 | |||
44 | Part II: Setup the build environment | ||
45 | II-1. Modify the scripts/setup.sh to set appropriate proxy settings. | ||
46 | Set PROXY to a http proxy URL and PORT to the port number. Comment out | ||
47 | these 2 variables if proxy is not required. | ||
48 | |||
49 | II-2. Run scripts/setup.sh to set up the build environment. | ||
50 | This will install the eclipse and relevant plugins required to build | ||
51 | Yocto eclipse plug-in. | ||
52 | |||
53 | Part III: Build & Install Yocto Eclipse plug-in | ||
54 | |||
55 | To build the Yocto Eclipse plug-in, simply run | ||
56 | "ECLIPSE_HOME=<eclipse path> scripts/build.sh <branch name> <release name>". | ||
57 | |||
58 | The <eclipse install path> is the absolute path where you installed the | ||
59 | eclipse in step II-2. | ||
60 | |||
61 | The <branch name> is the git branch name you build based on. | ||
62 | |||
63 | If successful, 2 files org.yocto.sdk-<release name>-<date>.zip and | ||
64 | org.yocto.sdk.-<release name>-<date>-archive.zip will be genereated under the | ||
65 | directory where you invoked the "build.sh" script. | ||
66 | |||
67 | The file with the "-archive" in its name is the archive zip used for eclipse | ||
68 | update manager. User should use eclipse update manager to install it. | ||
69 | |||
70 | The file without the "-archive" in its name is the zip containing only the | ||
71 | plugins/features. User should unzip it to the their target eclipse to install it. | ||
diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100755 index 0000000..bb929b9 --- /dev/null +++ b/scripts/setup.sh | |||
@@ -0,0 +1,236 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | #setup eclipse building environment for Indigo. | ||
4 | #comment out the following line if you want to using your own http proxy setting for eclipse update site | ||
5 | #PROXY=http://proxy.jf.intel.com:911 | ||
6 | |||
7 | err_exit() | ||
8 | { | ||
9 | echo "[FAILED $1]$2" | ||
10 | exit $1 | ||
11 | } | ||
12 | |||
13 | curdir=`pwd` | ||
14 | |||
15 | uname_s=`uname -s` | ||
16 | uname_m=`uname -m` | ||
17 | case ${uname_s}${uname_m} in | ||
18 | Linuxppc*) ep_arch=linux-gtk-ppc | ||
19 | cdt_arch=linux.ppc | ||
20 | ;; | ||
21 | Linuxx86_64*) ep_arch=linux-gtk-x86_64 | ||
22 | cdt_arch=linux.x86_64 | ||
23 | ;; | ||
24 | Linuxi*86) ep_arch=linux-gtk | ||
25 | cdt_arch=linux.x86 | ||
26 | ;; | ||
27 | *) | ||
28 | echo "Unknown ${uname_s}${uname_m}" | ||
29 | exit 1 | ||
30 | ;; | ||
31 | esac | ||
32 | |||
33 | #parsing proxy URLS | ||
34 | url=${PROXY} | ||
35 | if [ "x$url" != "x" ]; then | ||
36 | proto=`echo $url | grep :// | sed -e 's,^\(.*://\).*,\1,g'` | ||
37 | url=`echo $url | sed s,$proto,,g` | ||
38 | userpass=`echo $url | grep @ | cut -d@ -f1` | ||
39 | user=`echo $userpass | cut -d: -f1` | ||
40 | pass=`echo $userpass | grep : | cut -d: -f2` | ||
41 | url=`echo $url | sed s,$userpass@,,g` | ||
42 | host=`echo $url | cut -d: -f1` | ||
43 | port=`echo $url | cut -d: -f2 | sed -e 's,[^0-9],,g'` | ||
44 | [ "x$host" = "x" ] && err_exit 1 "Undefined proxy host" | ||
45 | PROXY_PARAM="-Dhttp.proxySet=true -Dhttp.proxyHost=$host" | ||
46 | [ "x$port" != "x" ] && PROXY_PARAM="${PROXY_PARAM} -Dhttp.proxyPort=$port" | ||
47 | fi | ||
48 | |||
49 | |||
50 | # prepare the base Eclipse installation in folder "eclipse" | ||
51 | ep_rel="R-" | ||
52 | ep_ver="4.3" | ||
53 | ep_date="-201306052000" | ||
54 | P2_disabled=false | ||
55 | P2_no_dropins=false | ||
56 | if [ ! -f eclipse/plugins/3.102.0.v20130605-1539.jar ]; then | ||
57 | curdir2=`pwd` | ||
58 | if [ ! -d eclipse -o -h eclipse ]; then | ||
59 | if [ -d eclipse-${ep_ver}-${ep_arch} ]; then | ||
60 | rm -rf eclipse-${ep_ver}-${ep_arch} | ||
61 | fi | ||
62 | mkdir eclipse-${ep_ver}-${ep_arch} | ||
63 | cd eclipse-${ep_ver}-${ep_arch} | ||
64 | else | ||
65 | rm -rf eclipse | ||
66 | fi | ||
67 | # Eclipse SDK: Need the SDK so we can link into docs | ||
68 | echo "Getting Eclipse SDK..." | ||
69 | #wget "http://download.eclipse.org/eclipse/downloads/drops4/${ep_rel}${ep_ver}${ep_date}/eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz" | ||
70 | #The eclipse site has moments where it is overloaded. Maintaining our own mirror solves this. | ||
71 | wget "http://downloads.yoctoproject.org/eclipse/downloads/drops4/${ep_rel}${ep_ver}${ep_date}/eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz" | ||
72 | tar xfz eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz || err_exit $? "extracting Eclipse SDK failed" | ||
73 | rm eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz | ||
74 | cd "${curdir2}" | ||
75 | if [ ! -d eclipse -o -h eclipse ]; then | ||
76 | if [ -e eclipse ]; then | ||
77 | rm eclipse | ||
78 | fi | ||
79 | ln -s eclipse-${ep_ver}-${ep_arch}/eclipse eclipse | ||
80 | fi | ||
81 | fi | ||
82 | if [ ! -f eclipse/startup.jar ]; then | ||
83 | curdir2=`pwd` | ||
84 | cd eclipse/plugins | ||
85 | if [ -h ../startup.jar ]; then | ||
86 | rm ../startup.jar | ||
87 | fi | ||
88 | LAUNCHER="`ls org.eclipse.equinox.launcher_*.jar | sort | tail -1`" | ||
89 | if [ "x${LAUNCHER}" != "x" ]; then | ||
90 | echo "eclipse LAUNCHER=${LAUNCHER}" | ||
91 | ln -s plugins/${LAUNCHER} ../startup.jar | ||
92 | else | ||
93 | echo "Eclipse: NO startup.jar LAUNCHER FOUND!" | ||
94 | fi | ||
95 | cd ${curdir2} | ||
96 | fi | ||
97 | |||
98 | LAUNCHER="eclipse/startup.jar" | ||
99 | |||
100 | get_version() | ||
101 | { | ||
102 | #$1: repository_url | ||
103 | #$2: featureId | ||
104 | #$3: 'all' or 'max' or 'min', 'max' if not specified | ||
105 | local remote_vers="`java ${PROXY_PARAM} \ | ||
106 | -jar ${LAUNCHER} \ | ||
107 | -application org.eclipse.equinox.p2.director \ | ||
108 | -destination ${curdir}/eclipse \ | ||
109 | -profile SDKProfile \ | ||
110 | -repository $1 \ | ||
111 | -list $2\ | ||
112 | | awk 'BEGIN { FS="=" } { print $2 }'`" | ||
113 | |||
114 | #find larget remote vers | ||
115 | local remote_ver="`echo ${remote_vers} | cut -d ' ' -f1`" | ||
116 | case $3 in | ||
117 | all) | ||
118 | remote_ver=${remote_vers} | ||
119 | ;; | ||
120 | min) | ||
121 | for i in ${remote_vers}; do | ||
122 | [ "${remote_ver}" \> "$i" ] && remote_ver="$i" | ||
123 | done | ||
124 | ;; | ||
125 | *) | ||
126 | for i in ${remote_vers}; do | ||
127 | [ "${remote_ver}" \< "$i" ] && remote_ver="$i" | ||
128 | done | ||
129 | ;; | ||
130 | esac | ||
131 | |||
132 | echo ${remote_ver} | ||
133 | } | ||
134 | |||
135 | check_local_version() | ||
136 | { | ||
137 | # $1 unitId | ||
138 | # $2 min version | ||
139 | # $3 max version (optional) | ||
140 | version="`get_version file:///${curdir}/eclipse/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile $1`" | ||
141 | [ "$version" \< "$2" ] && return 1 | ||
142 | if [ "x$3" != "x" ]; then | ||
143 | [ "$version" \> "$3" ] && return -1 | ||
144 | fi | ||
145 | return 0 | ||
146 | } | ||
147 | |||
148 | update_feature_remote() | ||
149 | { | ||
150 | # install a feature of with version requirement [min, max) | ||
151 | #$1: reporsitory url | ||
152 | #$2: featureId | ||
153 | #$3: min version | ||
154 | #$4: max version(optional) | ||
155 | [ $# -lt 3 ] && err_exit 1 "update_feature_remote: invalid parameters, $*" | ||
156 | check_local_version $2 $3 $4 && echo "skip installed feature $2" && return 0 | ||
157 | local installIU="" | ||
158 | if [ "x$4" != "x" ]; then | ||
159 | #has max version requirement | ||
160 | for i in "`get_version $1 $2 'all'`"; do | ||
161 | if [ "$i" \> "$3" ] || [ "$i" = "$3" ] && [ "$i" \< "$4" ]; then | ||
162 | [ "$i" \> "$installIU" ] && installIU=$i | ||
163 | fi | ||
164 | done | ||
165 | else | ||
166 | #only has minimum version requirement | ||
167 | local max_remote_ver="`get_version $1 $2 'max'`" | ||
168 | [ "$max_remote_ver" \> "$3" ] || [ "$max_remote_ver" = "$3" ] && installIU=$max_remote_ver | ||
169 | fi | ||
170 | |||
171 | [ "x$installIU" = "x" ] && err_exit 1 "Can NOT find candidates of $2 version($3, $4) at $1!" | ||
172 | installIU="$2/$installIU" | ||
173 | echo "try to install $installIU ..." | ||
174 | java ${PROXY_PARAM} -jar ${LAUNCHER} \ | ||
175 | -application org.eclipse.equinox.p2.director \ | ||
176 | -destination ${curdir}/eclipse \ | ||
177 | -profile SDKProfile \ | ||
178 | -repository $1 \ | ||
179 | -installIU ${installIU} || err_exit $? "installing ${installIU} failed" | ||
180 | } | ||
181 | |||
182 | #Eclipse Update Site | ||
183 | MAIN_UPDATE_SITE="http://download.eclipse.org/releases/kepler" | ||
184 | # The main eclipse download site is unreliable at times. For now, we're going to | ||
185 | # maintain a mirror of just what we need. | ||
186 | #MAIN_UPDATE_SITE="http://downloads.yoctoproject.org/eclipse/juno/ftp.osuosl.org/pub/eclipse/releases/juno" | ||
187 | |||
188 | UPDATE_SITE="${MAIN_UPDATE_SITE}" | ||
189 | |||
190 | #CDT related | ||
191 | CDTFEAT="8.2.0" | ||
192 | echo "Installing CDT..." | ||
193 | update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.feature.group ${CDTFEAT} | ||
194 | CDTREMOTEVER="6.2.0" | ||
195 | update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.launch.remote.feature.group ${CDTREMOTEVER} | ||
196 | |||
197 | #RSE SDK | ||
198 | RSEVER="3.5.0" | ||
199 | #TCFVER="1.0.0" | ||
200 | TMVER="3.3.1" | ||
201 | echo "Installing RSE/TCF/TM related component..." | ||
202 | update_feature_remote ${UPDATE_SITE} org.eclipse.rse.feature.group ${RSEVER} | ||
203 | #update_feature_remote ${UPDATE_SITE} org.eclipse.tcf.rse.feature.feature.group ${TCFVER} | ||
204 | update_feature_remote ${UPDATE_SITE} org.eclipse.tm.terminal.sdk.feature.group ${TMVER} | ||
205 | |||
206 | #AUTOTOOL | ||
207 | ATVER="3.2.0" | ||
208 | echo "Install AutoTool..." | ||
209 | update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.autotools.feature.group ${ATVER} | ||
210 | |||
211 | #Lttng2 | ||
212 | LTTNGREL="2.0.0" | ||
213 | echo "Install Lttng..." | ||
214 | update_feature_remote ${UPDATE_SITE} org.eclipse.linuxtools.lttng2.feature.group ${LTTNGREL} | ||
215 | |||
216 | #PTP RDT | ||
217 | PTPVER="7.0.0" | ||
218 | RDTVER="7.0.0" | ||
219 | |||
220 | update_feature_remote ${UPDATE_SITE} org.eclipse.ptp.feature.group ${PTPVER} | ||
221 | update_feature_remote ${UPDATE_SITE} org.eclipse.ptp.rdt.feature.group ${RDTVER} | ||
222 | |||
223 | #LTTng Kernel Analysis | ||
224 | LTTNGKAVER="2.0.0" | ||
225 | update_feature_remote ${UPDATE_SITE} org.eclipse.linuxtools.lttng2.kernel.feature.group ${LTTNGKAVER} | ||
226 | |||
227 | #C/C++ GDB Hardware Debugging | ||
228 | GDBHARDVER="8.3.0" | ||
229 | update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.debug.gdbjtag.feature.group ${GDBHARDVER} | ||
230 | |||
231 | echo "" | ||
232 | echo "Your build environment is successfully created." | ||
233 | echo "Run ECLIPSE_HOME=${curdir}/eclipse `dirname $0`/build.sh <branch name> <release name> to build" | ||
234 | echo "" | ||
235 | |||
236 | exit 0 | ||
diff --git a/tcf/lke_rse_tcf.patch b/tcf/lke_rse_tcf.patch new file mode 100644 index 0000000..6054b93 --- /dev/null +++ b/tcf/lke_rse_tcf.patch | |||
@@ -0,0 +1,2097 @@ | |||
1 | Index: plugins/org.eclipse.tm.tcf.rse/META-INF/MANIFEST.MF | ||
2 | =================================================================== | ||
3 | --- plugins/org.eclipse.tm.tcf.rse/META-INF/MANIFEST.MF (revision 1190) | ||
4 | +++ plugins/org.eclipse.tm.tcf.rse/META-INF/MANIFEST.MF (working copy) | ||
5 | @@ -13,8 +13,16 @@ | ||
6 | org.eclipse.ui.views, | ||
7 | org.eclipse.rse.subsystems.files.core, | ||
8 | org.eclipse.rse.subsystems.processes.core, | ||
9 | - org.eclipse.rse.processes.ui | ||
10 | + org.eclipse.rse.processes.ui, | ||
11 | + org.eclipse.rse.subsystems.terminals.core, | ||
12 | + org.eclipse.tm.tcf;bundle-version="0.3.0", | ||
13 | + org.eclipse.rse.subsystems.shells.core;bundle-version="3.1.100", | ||
14 | + org.eclipse.core.resources;bundle-version="3.6.0", | ||
15 | + org.eclipse.tm.tcf.core;version="0.3.0" | ||
16 | Import-Package: org.eclipse.tm.tcf.core;version="0.3.0", | ||
17 | + org.eclipse.rse.core.filters, | ||
18 | + org.eclipse.tm.internal.tcf.terminals, | ||
19 | + org.eclipse.rse.core.model, | ||
20 | org.eclipse.tm.tcf.protocol;version="0.3.0", | ||
21 | org.eclipse.tm.tcf.services;version="0.3.0", | ||
22 | org.eclipse.tm.tcf.util;version="0.3.0" | ||
23 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileSubSystemConfiguration.java | ||
24 | =================================================================== | ||
25 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileSubSystemConfiguration.java (revision 1190) | ||
26 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileSubSystemConfiguration.java (working copy) | ||
27 | @@ -39,6 +39,11 @@ | ||
28 | |||
29 | private final TCFFileAdapter file_adapter = new TCFFileAdapter(); | ||
30 | |||
31 | + public TCFFileSubSystemConfiguration() { | ||
32 | + super(); | ||
33 | + setIsUnixStyle(true); | ||
34 | + } | ||
35 | + | ||
36 | @Override | ||
37 | public ISubSystem createSubSystemInternal(IHost host) { | ||
38 | TCFConnectorService connectorService = (TCFConnectorService)getConnectorService(host); | ||
39 | @@ -78,13 +83,12 @@ | ||
40 | @Override | ||
41 | public IConnectorService getConnectorService(IHost host) { | ||
42 | return TCFConnectorServiceManager.getInstance() | ||
43 | - .getConnectorService(host, ITCFSubSystem.class); | ||
44 | + .getConnectorService(host, getServiceImplType()); | ||
45 | } | ||
46 | |||
47 | @Override | ||
48 | - @SuppressWarnings("unchecked") | ||
49 | - public Class getServiceImplType() { | ||
50 | - return TCFFileService.class; | ||
51 | + public Class<ITCFSubSystem> getServiceImplType() { | ||
52 | + return ITCFSubSystem.class; | ||
53 | } | ||
54 | |||
55 | @Override | ||
56 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileService.java | ||
57 | =================================================================== | ||
58 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileService.java (revision 1190) | ||
59 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/files/TCFFileService.java (working copy) | ||
60 | @@ -11,6 +11,7 @@ | ||
61 | * Uwe Stieber (Wind River) - [271224] NPE in TCFFileService#download | ||
62 | * Uwe Stieber (Wind River) - [271227] Fix compiler warnings in org.eclipse.tm.tcf.rse | ||
63 | * Uwe Stieber (Wind River) - [274277] The TCF file service subsystem implementation is not updating the progress monitor | ||
64 | + * Intel Corporation - Make recursive copy/delete available (delete/copy a folder contains files) | ||
65 | *******************************************************************************/ | ||
66 | package org.eclipse.tm.internal.tcf.rse.files; | ||
67 | |||
68 | @@ -18,6 +19,7 @@ | ||
69 | import java.io.BufferedOutputStream; | ||
70 | import java.io.File; | ||
71 | import java.io.FileInputStream; | ||
72 | +import java.io.FileNotFoundException; | ||
73 | import java.io.FileOutputStream; | ||
74 | import java.io.IOException; | ||
75 | import java.io.InputStream; | ||
76 | @@ -131,22 +133,125 @@ | ||
77 | return s; | ||
78 | } | ||
79 | |||
80 | + /* Delete from UI action will call deleteBatch interface, yet | ||
81 | + * for copy from UI action, it will call copy! It's totally | ||
82 | + * inconsistency! For solving the problem, we have to modify | ||
83 | + * the copy itself and made it recursive. We can't modify it | ||
84 | + * in the same way as delete does! | ||
85 | + * | ||
86 | + */ | ||
87 | + | ||
88 | + public void internalCopy(String srcParent, | ||
89 | + String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) | ||
90 | + throws SystemMessageException, InterruptedException { | ||
91 | + //Note the dest directory or file exist surely since UI operations have | ||
92 | + //done something, rename it to copy of XXX | ||
93 | + if (monitor != null) | ||
94 | + { | ||
95 | + if (monitor.isCanceled()) | ||
96 | + { | ||
97 | + throw new InterruptedException("User cancelled the copy operation!"); | ||
98 | + } | ||
99 | + } | ||
100 | + | ||
101 | + try | ||
102 | + { | ||
103 | + //firstly create the target directory! | ||
104 | + this.createFolder(tgtParent, tgtName, monitor); | ||
105 | + //then copy the next level directory! | ||
106 | + final String new_srcpath = toRemotePath(srcParent, srcName); | ||
107 | + final String new_tgtpath = toRemotePath(tgtParent, tgtName); | ||
108 | + IHostFile[] arrFiles = internalFetch(new_srcpath, null, | ||
109 | + FILE_TYPE_FILES_AND_FOLDERS, monitor); | ||
110 | + if (arrFiles == null || arrFiles.length <=0 ) | ||
111 | + return; | ||
112 | + else | ||
113 | + { | ||
114 | + for (int i = 0; i < arrFiles.length; i++) | ||
115 | + { | ||
116 | + String srcFile = toRemotePath(new_srcpath, arrFiles[i].getName()); | ||
117 | + String tgtFile = toRemotePath(new_tgtpath, arrFiles[i].getName()); | ||
118 | + if (arrFiles[i].isFile()) | ||
119 | + { | ||
120 | + copy(srcFile, tgtFile, monitor); | ||
121 | + } | ||
122 | + else | ||
123 | + { | ||
124 | + //do recursive directory copy! | ||
125 | + internalCopy(new_srcpath, arrFiles[i].getName(), new_tgtpath, | ||
126 | + arrFiles[i].getName(), monitor); | ||
127 | + } | ||
128 | + } | ||
129 | + } | ||
130 | + } | ||
131 | + catch (SystemMessageException e) | ||
132 | + { | ||
133 | + e.printStackTrace(); | ||
134 | + throw new SystemMessageException(e.getSystemMessage()); | ||
135 | + } | ||
136 | + catch (InterruptedException e) | ||
137 | + { | ||
138 | + throw new InterruptedException("User cancelled the copy operation!"); | ||
139 | + } | ||
140 | + } | ||
141 | + | ||
142 | public void copy(String srcParent, | ||
143 | String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) | ||
144 | throws SystemMessageException { | ||
145 | - final String src = toRemotePath(srcParent, srcName); | ||
146 | - final String tgt = toRemotePath(tgtParent, tgtName); | ||
147 | + | ||
148 | + if (monitor != null) | ||
149 | + monitor.beginTask("Copying remote files!", 1); | ||
150 | + | ||
151 | + try { | ||
152 | + | ||
153 | + IHostFile curFile = getFile(srcParent, srcName, monitor); | ||
154 | + final String srcFile = toRemotePath(srcParent, srcName); | ||
155 | + final String tgtFile = toRemotePath(tgtParent, tgtName); | ||
156 | + | ||
157 | + if (curFile.isFile()) | ||
158 | + copy(srcFile, tgtFile, monitor); | ||
159 | + else if (curFile.isDirectory()) | ||
160 | + { | ||
161 | + internalCopy(srcParent, srcName, tgtParent, tgtName, monitor); | ||
162 | + } | ||
163 | + else | ||
164 | + { | ||
165 | + FileNotFoundException e = | ||
166 | + new FileNotFoundException("Failed to find the to be " + | ||
167 | + "copied file or directory!"); | ||
168 | + throw new SystemMessageException(getMessage(e)); | ||
169 | + } | ||
170 | + } | ||
171 | + catch (Exception e) { | ||
172 | + // TODO Auto-generated catch block | ||
173 | + if (e instanceof SystemMessageException) | ||
174 | + throw (SystemMessageException)e; | ||
175 | + else if (e instanceof InterruptedException) | ||
176 | + { | ||
177 | + System.out.println("User cancelled the copy operation!"); | ||
178 | + } | ||
179 | + throw new SystemOperationFailedException(Activator.PLUGIN_ID, e); | ||
180 | + | ||
181 | + } | ||
182 | + finally { | ||
183 | + if (monitor != null) | ||
184 | + monitor.done(); | ||
185 | + } | ||
186 | + } | ||
187 | + | ||
188 | + public void copy(final String srcFile, final String tgtFile, IProgressMonitor monitor) | ||
189 | + throws SystemMessageException { | ||
190 | new TCFRSETask<Boolean>() { | ||
191 | public void run() { | ||
192 | IFileSystem fs = connector.getFileSystemService(); | ||
193 | - fs.copy(src, tgt, false, false, new IFileSystem.DoneCopy() { | ||
194 | + fs.copy(srcFile, tgtFile, false, false, new IFileSystem.DoneCopy() { | ||
195 | public void doneCopy(IToken token, FileSystemException error) { | ||
196 | if (error != null) error(error); | ||
197 | else done(Boolean.TRUE); | ||
198 | } | ||
199 | }); | ||
200 | } | ||
201 | - }.getS(monitor, "Copy: " + srcName); //$NON-NLS-1$ | ||
202 | + }.getS(monitor, "Copy: " + srcFile); //$NON-NLS-1$ | ||
203 | } | ||
204 | |||
205 | public void copyBatch(String[] srcParents, | ||
206 | @@ -226,13 +331,81 @@ | ||
207 | }.getS(monitor, "Delete"); //$NON-NLS-1$ | ||
208 | } | ||
209 | |||
210 | + private void internalDelete(String parent, String name, | ||
211 | + IProgressMonitor monitor) | ||
212 | + throws SystemMessageException, InterruptedException | ||
213 | + { | ||
214 | + if (monitor != null) | ||
215 | + { | ||
216 | + if (monitor.isCanceled()) | ||
217 | + { | ||
218 | + throw new InterruptedException("User cancelled the delete operation!"); | ||
219 | + } | ||
220 | + } | ||
221 | + | ||
222 | + try | ||
223 | + { | ||
224 | + final String new_path = toRemotePath(parent, name); | ||
225 | + IHostFile[] arrFiles = internalFetch(new_path, null, | ||
226 | + FILE_TYPE_FILES_AND_FOLDERS, monitor); | ||
227 | + if (arrFiles == null || arrFiles.length <= 0) | ||
228 | + { | ||
229 | + //This is an empty directory, directly delete! | ||
230 | + delete(parent, name, monitor); | ||
231 | + } | ||
232 | + else | ||
233 | + { | ||
234 | + for (int i = 0; i < arrFiles.length; i++) | ||
235 | + { | ||
236 | + | ||
237 | + if (arrFiles[i].isFile()) | ||
238 | + { | ||
239 | + delete(new_path, arrFiles[i].getName(), monitor); | ||
240 | + } | ||
241 | + else | ||
242 | + internalDelete(new_path, arrFiles[i].getName(), monitor); | ||
243 | + } | ||
244 | + //now the folder becomes empty, let us delete it! | ||
245 | + delete(parent, name, monitor); | ||
246 | + } | ||
247 | + } | ||
248 | + catch (SystemMessageException e) { | ||
249 | + // TODO Auto-generated catch block | ||
250 | + e.printStackTrace(); | ||
251 | + throw new SystemMessageException(e.getSystemMessage()); | ||
252 | + } | ||
253 | + catch (InterruptedException e) { | ||
254 | + throw new InterruptedException("User cancelled the delete operation!"); | ||
255 | + } | ||
256 | + } | ||
257 | + | ||
258 | @Override | ||
259 | public void deleteBatch(String[] remoteParents, String[] fileNames, | ||
260 | IProgressMonitor monitor) | ||
261 | - throws SystemMessageException { | ||
262 | - for (int i = 0; i < remoteParents.length; i++) { | ||
263 | - delete(remoteParents[i], fileNames[i], monitor); | ||
264 | + throws SystemMessageException { | ||
265 | + if (monitor != null) | ||
266 | + monitor.beginTask("Deleting selected folders or files!", remoteParents.length); | ||
267 | + try | ||
268 | + { | ||
269 | + for (int i = 0; i < remoteParents.length; i++) { | ||
270 | + IHostFile curFile = getFile(remoteParents[i], fileNames[i], monitor); | ||
271 | + if (curFile.isFile()) | ||
272 | + delete(remoteParents[i], fileNames[i], monitor); | ||
273 | + else if (curFile.isDirectory()) | ||
274 | + internalDelete(remoteParents[i], fileNames[i], monitor); | ||
275 | + } | ||
276 | } | ||
277 | + catch (Exception x) { | ||
278 | + if (x instanceof SystemMessageException) throw (SystemMessageException)x; | ||
279 | + else if (x instanceof InterruptedException) { | ||
280 | + System.out.println("user cancelled the delete operation!"); | ||
281 | + } | ||
282 | + throw new SystemOperationFailedException(Activator.PLUGIN_ID, x); | ||
283 | + } | ||
284 | + finally { | ||
285 | + if (monitor != null) | ||
286 | + monitor.done(); | ||
287 | + } | ||
288 | } | ||
289 | |||
290 | public void download(final String parent, | ||
291 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.java | ||
292 | =================================================================== | ||
293 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.java (revision 0) | ||
294 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.java (revision 0) | ||
295 | @@ -0,0 +1,28 @@ | ||
296 | +/******************************************************************************* | ||
297 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
298 | + * All rights reserved. This program and the accompanying materials | ||
299 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
300 | + * which accompanies this distribution, and is available at | ||
301 | + * http://www.eclipse.org/legal/epl-v10.html | ||
302 | + * | ||
303 | + * Contributors: | ||
304 | + * Intel Corporation - initial API and implementation | ||
305 | + ******************************************************************************/ | ||
306 | +package org.eclipse.tm.internal.tcf.rse; | ||
307 | + | ||
308 | +import org.eclipse.osgi.util.NLS; | ||
309 | + | ||
310 | +public class TCFConnectorResources extends NLS { | ||
311 | + private static final String BUNDLE_NAME = "org.eclipse.tm.internal.tcf.rse.TCFConnectorResources"; | ||
312 | + static { | ||
313 | + NLS.initializeMessages(BUNDLE_NAME, TCFConnectorResources.class); | ||
314 | + } | ||
315 | + private TCFConnectorResources() { | ||
316 | + | ||
317 | + } | ||
318 | + | ||
319 | + public static String TCFConnectorService_Name; | ||
320 | + public static String TCFConnectorService_Description; | ||
321 | + public static String PropertySet_Description; | ||
322 | + | ||
323 | +} | ||
324 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/ITCFSessionProvider.java | ||
325 | =================================================================== | ||
326 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/ITCFSessionProvider.java (revision 0) | ||
327 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/ITCFSessionProvider.java (revision 0) | ||
328 | @@ -0,0 +1,29 @@ | ||
329 | +/******************************************************************************* | ||
330 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
331 | + * All rights reserved. This program and the accompanying materials | ||
332 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
333 | + * which accompanies this distribution, and is available at | ||
334 | + * http://www.eclipse.org/legal/epl-v10.html | ||
335 | + * | ||
336 | + * Contributors: | ||
337 | + * Intel Corporation - initial API and implementation | ||
338 | + ******************************************************************************/ | ||
339 | + | ||
340 | +package org.eclipse.tm.internal.tcf.rse; | ||
341 | + | ||
342 | +import org.eclipse.rse.services.files.RemoteFileException; | ||
343 | +import org.eclipse.tm.tcf.protocol.IChannel; | ||
344 | + | ||
345 | +public interface ITCFSessionProvider { | ||
346 | + public static final int ERROR_CODE = 100; // filed error code | ||
347 | + public static final int SUCCESS_CODE = 150; // login pass code | ||
348 | + public static final int CONNECT_CLOSED = 200; // code for end of login attempts | ||
349 | + public static final int TCP_CONNECT_TIMEOUT = 10; //seconds - TODO: Make configurable | ||
350 | + | ||
351 | + public IChannel getChannel(); | ||
352 | + public String getSessionUserId(); | ||
353 | + public String getSessionPassword(); | ||
354 | + public String getSessionHostName(); | ||
355 | + public boolean isSubscribed(); | ||
356 | + public void Subscribe() throws RemoteFileException; | ||
357 | +} | ||
358 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/processes/TCFProcessSubSystemConfiguration.java | ||
359 | =================================================================== | ||
360 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/processes/TCFProcessSubSystemConfiguration.java (revision 1190) | ||
361 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/processes/TCFProcessSubSystemConfiguration.java (working copy) | ||
362 | @@ -26,10 +26,8 @@ | ||
363 | |||
364 | private final TCFProcessAdapter process_adapter = new TCFProcessAdapter(); | ||
365 | |||
366 | - @Override | ||
367 | - @SuppressWarnings("unchecked") | ||
368 | - public Class getServiceImplType() { | ||
369 | - return TCFProcessService.class; | ||
370 | + public Class<ITCFSubSystem> getServiceImplType() { | ||
371 | + return ITCFSubSystem.class; | ||
372 | } | ||
373 | |||
374 | @Override | ||
375 | @@ -50,7 +48,7 @@ | ||
376 | @Override | ||
377 | public IConnectorService getConnectorService(IHost host) { | ||
378 | return TCFConnectorServiceManager.getInstance() | ||
379 | - .getConnectorService(host, ITCFSubSystem.class); | ||
380 | + .getConnectorService(host, getServiceImplType()); | ||
381 | } | ||
382 | |||
383 | @Override | ||
384 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorService.java | ||
385 | =================================================================== | ||
386 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorService.java (revision 1190) | ||
387 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorService.java (working copy) | ||
388 | @@ -10,29 +10,49 @@ | ||
389 | * Martin Oberhuber (Wind River) - [269682] Get port from RSE Property | ||
390 | * Uwe Stieber (Wind River) - [271227] Fix compiler warnings in org.eclipse.tm.tcf.rse | ||
391 | * Anna Dushistova (MontaVista) - [285373] TCFConnectorService should send CommunicationsEvent.BEFORE_CONNECT and CommunicationsEvent.BEFORE_DISCONNECT | ||
392 | - *******************************************************************************/ | ||
393 | + * Intel Corporation - Make TCF being authenticated connection and attached streaming subscription/unsubscription method | ||
394 | + ******************************************************************************/ | ||
395 | package org.eclipse.tm.internal.tcf.rse; | ||
396 | |||
397 | +import java.io.IOException; | ||
398 | import java.util.ArrayList; | ||
399 | import java.util.HashMap; | ||
400 | import java.util.List; | ||
401 | import java.util.Map; | ||
402 | +import java.util.concurrent.ExecutionException; | ||
403 | +import java.util.concurrent.TimeUnit; | ||
404 | +import java.util.concurrent.TimeoutException; | ||
405 | |||
406 | import org.eclipse.core.runtime.IProgressMonitor; | ||
407 | import org.eclipse.rse.core.model.IHost; | ||
408 | -import org.eclipse.rse.core.subsystems.BasicConnectorService; | ||
409 | +import org.eclipse.rse.core.model.IPropertySet; | ||
410 | +import org.eclipse.rse.core.model.PropertyType; | ||
411 | +import org.eclipse.rse.core.model.SystemSignonInformation; | ||
412 | import org.eclipse.rse.core.subsystems.CommunicationsEvent; | ||
413 | +import org.eclipse.rse.services.files.RemoteFileException; | ||
414 | +import org.eclipse.rse.ui.subsystems.StandardConnectorService; | ||
415 | +import org.eclipse.tm.internal.tcf.terminals.ITerminalsService; | ||
416 | import org.eclipse.tm.tcf.core.AbstractPeer; | ||
417 | import org.eclipse.tm.tcf.protocol.IChannel; | ||
418 | import org.eclipse.tm.tcf.protocol.IPeer; | ||
419 | import org.eclipse.tm.tcf.protocol.IService; | ||
420 | +import org.eclipse.tm.tcf.protocol.IToken; | ||
421 | import org.eclipse.tm.tcf.protocol.Protocol; | ||
422 | import org.eclipse.tm.tcf.services.IFileSystem; | ||
423 | import org.eclipse.tm.tcf.services.ILocator; | ||
424 | +import org.eclipse.tm.tcf.services.IStreams; | ||
425 | import org.eclipse.tm.tcf.services.ISysMonitor; | ||
426 | +import org.eclipse.tm.tcf.util.TCFTask; | ||
427 | |||
428 | +public class TCFConnectorService extends StandardConnectorService implements | ||
429 | + ITCFSessionProvider { | ||
430 | |||
431 | -public class TCFConnectorService extends BasicConnectorService { | ||
432 | + public static final String PROPERTY_SET_NAME = "TCF Connection Settings"; | ||
433 | + public static final String PROPERTY_LOGIN_REQUIRED = "Login.Required"; //$NON-NLS-1$ | ||
434 | + public static final String PROPERTY_PWD_REQUIRED="Pwd.Required"; | ||
435 | + public static final String PROPERTY_LOGIN_PROMPT = "Login.Prompt"; //$NON-NLS-1$ | ||
436 | + public static final String PROPERTY_PASSWORD_PROMPT = "Password.Prompt"; //$NON-NLS-1$ | ||
437 | + public static final String PROPERTY_COMMAND_PROMPT = "Command.Prompt"; //$NON-NLS-1$ | ||
438 | |||
439 | private IChannel channel; | ||
440 | private Throwable channel_error; | ||
441 | @@ -40,12 +60,62 @@ | ||
442 | |||
443 | private boolean poll_timer_started; | ||
444 | |||
445 | + private boolean bSubscribed = false; | ||
446 | + | ||
447 | + /* subscribe the stream service on this TCP connection */ | ||
448 | + private IStreams.StreamsListener streamListener = new IStreams.StreamsListener() { | ||
449 | + public void created(String stream_type, String stream_id, | ||
450 | + String context_id) { | ||
451 | + System.out.printf("new stream id: %s , type: %s is created\n", | ||
452 | + stream_id, stream_type); | ||
453 | + } | ||
454 | + | ||
455 | + /** | ||
456 | + * Called when a stream is disposed. | ||
457 | + * | ||
458 | + * @param stream_type | ||
459 | + * - source type of the stream. | ||
460 | + * @param stream_id | ||
461 | + * - ID of the stream. | ||
462 | + */ | ||
463 | + public void disposed(String stream_type, String stream_id) { | ||
464 | + System.out.printf("stream id: %s type: %s is disposed\n", | ||
465 | + stream_id, stream_type); | ||
466 | + } | ||
467 | + }; | ||
468 | + | ||
469 | public TCFConnectorService(IHost host, int port) { | ||
470 | - super("TCF", "Target Communication Framework", host, port); //$NON-NLS-1$ //$NON-NLS-2$ | ||
471 | + super(TCFConnectorResources.TCFConnectorService_Name, | ||
472 | + TCFConnectorResources.TCFConnectorService_Description, host, | ||
473 | + port); //$NON-NLS-1$ //$NON-NLS-2$ | ||
474 | + getTCFPropertySet(); | ||
475 | } | ||
476 | + | ||
477 | + public IPropertySet getTCFPropertySet() { | ||
478 | + IPropertySet tcfSet = getPropertySet(PROPERTY_SET_NAME); | ||
479 | + if (tcfSet == null) { | ||
480 | + tcfSet = createPropertySet(PROPERTY_SET_NAME, TCFConnectorResources.PropertySet_Description); | ||
481 | + //add default values if not set | ||
482 | + tcfSet.addProperty(PROPERTY_LOGIN_REQUIRED, "true", PropertyType.getEnumPropertyType(new String[] {"true", "false"})); | ||
483 | + tcfSet.addProperty(PROPERTY_PWD_REQUIRED, "false", PropertyType.getEnumPropertyType(new String[] {"true", "false"})); | ||
484 | + tcfSet.addProperty(PROPERTY_LOGIN_PROMPT, "ogin: ", PropertyType.getStringPropertyType()); | ||
485 | + tcfSet.addProperty(PROPERTY_PASSWORD_PROMPT, "assword: ", PropertyType.getStringPropertyType()); | ||
486 | + tcfSet.addProperty(PROPERTY_COMMAND_PROMPT, "#", PropertyType.getStringPropertyType()); | ||
487 | + } | ||
488 | + return tcfSet; | ||
489 | + } | ||
490 | |||
491 | + /** | ||
492 | + * @return true if the associated connector service requires a password. | ||
493 | + */ | ||
494 | @Override | ||
495 | - protected void internalConnect(final IProgressMonitor monitor) throws Exception { | ||
496 | + public final boolean requiresPassword() { | ||
497 | + return false; | ||
498 | + } | ||
499 | + | ||
500 | + @Override | ||
501 | + protected void internalConnect(final IProgressMonitor monitor) | ||
502 | + throws Exception { | ||
503 | assert !Protocol.isDispatchThread(); | ||
504 | final Exception[] res = new Exception[1]; | ||
505 | // Fire comm event to signal state about to change | ||
506 | @@ -54,39 +124,55 @@ | ||
507 | synchronized (res) { | ||
508 | Protocol.invokeLater(new Runnable() { | ||
509 | public void run() { | ||
510 | - if (!connectTCFChannel(res, monitor)) add_to_wait_list(this); | ||
511 | + if (!connectTCFChannel(res, monitor)) | ||
512 | + add_to_wait_list(this); | ||
513 | } | ||
514 | }); | ||
515 | res.wait(); | ||
516 | } | ||
517 | + if (res[0] != null) throw res[0]; | ||
518 | monitor.done(); | ||
519 | - if (res[0] != null) throw res[0]; | ||
520 | } | ||
521 | |||
522 | @Override | ||
523 | - protected void internalDisconnect(final IProgressMonitor monitor) throws Exception { | ||
524 | + protected void internalDisconnect(final IProgressMonitor monitor) | ||
525 | + throws Exception { | ||
526 | assert !Protocol.isDispatchThread(); | ||
527 | final Exception[] res = new Exception[1]; | ||
528 | // Fire comm event to signal state about to change | ||
529 | fireCommunicationsEvent(CommunicationsEvent.BEFORE_DISCONNECT); | ||
530 | monitor.beginTask("Disconnecting " + getHostName(), 1); //$NON-NLS-1$ | ||
531 | - synchronized (res) { | ||
532 | - Protocol.invokeLater(new Runnable() { | ||
533 | - public void run() { | ||
534 | - if (!disconnectTCFChannel(res, monitor)) add_to_wait_list(this); | ||
535 | - } | ||
536 | - }); | ||
537 | - res.wait(); | ||
538 | + try { | ||
539 | + /* First UnSubscribe TCP channel */ | ||
540 | + Unsubscribe(); | ||
541 | + /* Disconnecting TCP channel */ | ||
542 | + synchronized (res) { | ||
543 | + Protocol.invokeLater(new Runnable() { | ||
544 | + public void run() { | ||
545 | + if (!disconnectTCFChannel(res, monitor)) | ||
546 | + add_to_wait_list(this); | ||
547 | + } | ||
548 | + }); | ||
549 | + res.wait(); | ||
550 | + } | ||
551 | + if (res[0] != null) throw res[0]; | ||
552 | + | ||
553 | } | ||
554 | - monitor.done(); | ||
555 | - if (res[0] != null) throw res[0]; | ||
556 | + catch (Exception e) { | ||
557 | + e.printStackTrace(); | ||
558 | + throw new RemoteFileException("Error creating Terminal", e); //$NON-NLS-1$ | ||
559 | + } | ||
560 | + finally { | ||
561 | + monitor.done(); | ||
562 | + } | ||
563 | } | ||
564 | |||
565 | public boolean isConnected() { | ||
566 | final boolean res[] = new boolean[1]; | ||
567 | Protocol.invokeAndWait(new Runnable() { | ||
568 | public void run() { | ||
569 | - res[0] = channel != null && channel.getState() == IChannel.STATE_OPEN; | ||
570 | + res[0] = channel != null | ||
571 | + && channel.getState() == IChannel.STATE_OPEN; | ||
572 | } | ||
573 | }); | ||
574 | return res[0]; | ||
575 | @@ -108,7 +194,8 @@ | ||
576 | if (wait_list.isEmpty()) return; | ||
577 | Runnable[] r = wait_list.toArray(new Runnable[wait_list.size()]); | ||
578 | wait_list.clear(); | ||
579 | - for (int i = 0; i < r.length; i++) r[i].run(); | ||
580 | + for (int i = 0; i < r.length; i++) | ||
581 | + r[i].run(); | ||
582 | } | ||
583 | |||
584 | private boolean connectTCFChannel(Exception[] res, IProgressMonitor monitor) { | ||
585 | @@ -117,9 +204,12 @@ | ||
586 | case IChannel.STATE_OPEN: | ||
587 | case IChannel.STATE_CLOSED: | ||
588 | synchronized (res) { | ||
589 | - if (channel_error instanceof Exception) res[0] = (Exception)channel_error; | ||
590 | - else if (channel_error != null) res[0] = new Exception(channel_error); | ||
591 | - else res[0] = null; | ||
592 | + if (channel_error instanceof Exception) | ||
593 | + res[0] = (Exception) channel_error; | ||
594 | + else if (channel_error != null) | ||
595 | + res[0] = new Exception(channel_error); | ||
596 | + else | ||
597 | + res[0] = null; | ||
598 | res.notify(); | ||
599 | return true; | ||
600 | } | ||
601 | @@ -137,7 +227,7 @@ | ||
602 | String host = getHostName().toLowerCase(); | ||
603 | int port = getConnectPort(); | ||
604 | if (port <= 0) { | ||
605 | - //Default fallback | ||
606 | + // Default fallback | ||
607 | port = TCFConnectorServiceManager.TCF_PORT; | ||
608 | } | ||
609 | IPeer peer = null; | ||
610 | @@ -146,8 +236,8 @@ | ||
611 | for (IPeer p : locator.getPeers().values()) { | ||
612 | Map<String, String> attrs = p.getAttributes(); | ||
613 | if ("TCP".equals(attrs.get(IPeer.ATTR_TRANSPORT_NAME)) && //$NON-NLS-1$ | ||
614 | - host.equalsIgnoreCase(attrs.get(IPeer.ATTR_IP_HOST)) && | ||
615 | - port_str.equals(attrs.get(IPeer.ATTR_IP_PORT))) { | ||
616 | + host.equalsIgnoreCase(attrs.get(IPeer.ATTR_IP_HOST)) | ||
617 | + && port_str.equals(attrs.get(IPeer.ATTR_IP_PORT))) { | ||
618 | peer = p; | ||
619 | break; | ||
620 | } | ||
621 | @@ -171,17 +261,18 @@ | ||
622 | |||
623 | public void congestionLevel(int level) { | ||
624 | } | ||
625 | - | ||
626 | public void onChannelClosed(Throwable error) { | ||
627 | assert channel != null; | ||
628 | channel.removeChannelListener(this); | ||
629 | channel_error = error; | ||
630 | + | ||
631 | if (wait_list.isEmpty()) { | ||
632 | fireCommunicationsEvent(CommunicationsEvent.CONNECTION_ERROR); | ||
633 | } | ||
634 | else { | ||
635 | run_wait_list(); | ||
636 | } | ||
637 | + bSubscribed = false; | ||
638 | channel = null; | ||
639 | channel_error = null; | ||
640 | } | ||
641 | @@ -192,7 +283,8 @@ | ||
642 | return false; | ||
643 | } | ||
644 | |||
645 | - private boolean disconnectTCFChannel(Exception[] res, IProgressMonitor monitor) { | ||
646 | + private boolean disconnectTCFChannel(Exception[] res, | ||
647 | + IProgressMonitor monitor) { | ||
648 | if (channel == null || channel.getState() == IChannel.STATE_CLOSED) { | ||
649 | synchronized (res) { | ||
650 | res[0] = null; | ||
651 | @@ -212,9 +304,12 @@ | ||
652 | } | ||
653 | |||
654 | public <V extends IService> V getService(Class<V> service_interface) { | ||
655 | - if (channel == null || channel.getState() != IChannel.STATE_OPEN) throw new Error("Not connected"); //$NON-NLS-1$ | ||
656 | + if (channel == null || channel.getState() != IChannel.STATE_OPEN) | ||
657 | + throw new Error("Not connected"); //$NON-NLS-1$ | ||
658 | V m = channel.getRemoteService(service_interface); | ||
659 | - if (m == null) throw new Error("Remote peer does not support " + service_interface.getName() + " service"); //$NON-NLS-1$ //$NON-NLS-2$ | ||
660 | + if (m == null) | ||
661 | + throw new Error( | ||
662 | + "Remote peer does not support " + service_interface.getName() + " service"); //$NON-NLS-1$ //$NON-NLS-2$ | ||
663 | return m; | ||
664 | } | ||
665 | |||
666 | @@ -225,4 +320,111 @@ | ||
667 | public IFileSystem getFileSystemService() { | ||
668 | return getService(IFileSystem.class); | ||
669 | } | ||
670 | + | ||
671 | + public IChannel getChannel() { | ||
672 | + // TODO Auto-generated method stub | ||
673 | + return channel; | ||
674 | + } | ||
675 | + | ||
676 | + public String getSessionHostName() { | ||
677 | + // TODO Auto-generated method stub | ||
678 | + String hostName = ""; | ||
679 | + IHost host = getHost(); | ||
680 | + if (host != null) hostName = host.getHostName(); | ||
681 | + return hostName; | ||
682 | + } | ||
683 | + | ||
684 | + public String getSessionUserId() { | ||
685 | + // TODO Auto-generated method stub | ||
686 | + return getUserId(); | ||
687 | + } | ||
688 | + | ||
689 | + public String getSessionPassword() { | ||
690 | + // TODO Auto-generated method stub | ||
691 | + String password = ""; | ||
692 | + SystemSignonInformation ssi = getSignonInformation(); | ||
693 | + if (ssi != null) { | ||
694 | + password = ssi.getPassword(); | ||
695 | + } | ||
696 | + return password; | ||
697 | + } | ||
698 | + | ||
699 | + public boolean isSubscribed() { | ||
700 | + // TODO Auto-generated method stub | ||
701 | + return bSubscribed; | ||
702 | + } | ||
703 | + | ||
704 | + public void Unsubscribe() throws IOException { | ||
705 | + if (bSubscribed) { | ||
706 | + System.out | ||
707 | + .println("Unsubscribe streams before disconnecting TCP channel."); | ||
708 | + try { | ||
709 | + new TCFTask<Object>() { | ||
710 | + public void run() { | ||
711 | + IStreams streams = getService(IStreams.class); | ||
712 | + streams.unsubscribe(ITerminalsService.NAME, streamListener, | ||
713 | + new IStreams.DoneUnsubscribe() { | ||
714 | + public void doneUnsubscribe(IToken token, | ||
715 | + Exception error) { | ||
716 | + // TODO Auto-generated method stub | ||
717 | + System.out.printf( | ||
718 | + "stream type %s unsubscribed\n", | ||
719 | + ITerminalsService.NAME); | ||
720 | + done(this); | ||
721 | + } | ||
722 | + }); | ||
723 | + } | ||
724 | + }.get(1, TimeUnit.SECONDS); | ||
725 | + } | ||
726 | + catch (InterruptedException e) { | ||
727 | + new IOException("Meet " + e.getMessage() + " when Unsubsribe streams"); | ||
728 | + } | ||
729 | + catch (ExecutionException e) { | ||
730 | + new IOException("Meet " + e.getMessage() + " when Unsubsribe streams"); | ||
731 | + } | ||
732 | + catch (TimeoutException e) { | ||
733 | + new IOException("Meet " + e.getMessage() + " when Unsubsribe streams"); | ||
734 | + } | ||
735 | + bSubscribed = false; | ||
736 | + } | ||
737 | + | ||
738 | + } | ||
739 | + | ||
740 | + public void Subscribe() throws RemoteFileException { | ||
741 | + try { | ||
742 | + new TCFTask<Object>() { | ||
743 | + public void run() { | ||
744 | + if (bSubscribed) { | ||
745 | + done(this); | ||
746 | + } | ||
747 | + else { | ||
748 | + bSubscribed = true; | ||
749 | + IStreams streams = getService(IStreams.class); | ||
750 | + streams.subscribe(ITerminalsService.NAME, streamListener, | ||
751 | + new IStreams.DoneSubscribe() { | ||
752 | + public void doneSubscribe(IToken token, | ||
753 | + Exception error) { | ||
754 | + // TODO Auto-generated method stub | ||
755 | + System.out.println("Stream subscribed"); | ||
756 | + if (error != null) { | ||
757 | + System.out.println("subscribe error"); | ||
758 | + bSubscribed = false; | ||
759 | + error(error); | ||
760 | + } | ||
761 | + else | ||
762 | + done(this); | ||
763 | + } | ||
764 | + | ||
765 | + }); | ||
766 | + }} | ||
767 | + }.getIO(); | ||
768 | + | ||
769 | + } | ||
770 | + catch (Exception e) { | ||
771 | + e.printStackTrace(); | ||
772 | + throw new RemoteFileException( | ||
773 | + "Error When Subscribe Terminal streams!", e); //$NON-NLS-1$ | ||
774 | + } | ||
775 | + | ||
776 | + } | ||
777 | } | ||
778 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.java | ||
779 | =================================================================== | ||
780 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.java (revision 0) | ||
781 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.java (revision 0) | ||
782 | @@ -0,0 +1,35 @@ | ||
783 | +/******************************************************************************* | ||
784 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
785 | + * All rights reserved. This program and the accompanying materials | ||
786 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
787 | + * which accompanies this distribution, and is available at | ||
788 | + * http://www.eclipse.org/legal/epl-v10.html | ||
789 | + * | ||
790 | + * Contributors: | ||
791 | + * Intel Corporation - initial API and implementation | ||
792 | + ******************************************************************************/ | ||
793 | +package org.eclipse.tm.internal.tcf.rse.shells; | ||
794 | + | ||
795 | +import org.eclipse.osgi.util.NLS; | ||
796 | + | ||
797 | +public class TCFShellServiceResources extends NLS { | ||
798 | + private static final String BUNDLE_NAME = "org.eclipse.tm.internal.tcf.rse.shells.TCFShellServiceResources"; //$NON-NLS-1$ | ||
799 | + | ||
800 | + public static String TCFPlugin_Unexpected_Exception; | ||
801 | + | ||
802 | + public static String TCFShellService_Description; | ||
803 | + | ||
804 | + public static String TCFShellService_Name; | ||
805 | + | ||
806 | + static { | ||
807 | + // initialize resource bundle | ||
808 | + NLS.initializeMessages(BUNDLE_NAME, TCFShellServiceResources.class); | ||
809 | + } | ||
810 | + | ||
811 | + private TCFShellServiceResources(){ | ||
812 | + } | ||
813 | + | ||
814 | +} | ||
815 | + | ||
816 | + | ||
817 | + | ||
818 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalShell.java | ||
819 | =================================================================== | ||
820 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalShell.java (revision 0) | ||
821 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalShell.java (revision 0) | ||
822 | @@ -0,0 +1,444 @@ | ||
823 | +/******************************************************************************* | ||
824 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
825 | + * All rights reserved. This program and the accompanying materials | ||
826 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
827 | + * which accompanies this distribution, and is available at | ||
828 | + * http://www.eclipse.org/legal/epl-v10.html | ||
829 | + * | ||
830 | + * Contributors: | ||
831 | + * Intel Corporation - initial API and implementation | ||
832 | + ******************************************************************************/ | ||
833 | +package org.eclipse.tm.internal.tcf.rse.shells; | ||
834 | + | ||
835 | +import java.io.BufferedWriter; | ||
836 | +import java.io.IOException; | ||
837 | +import java.io.InputStream; | ||
838 | +import java.io.OutputStream; | ||
839 | +import java.io.OutputStreamWriter; | ||
840 | +import java.io.Writer; | ||
841 | +import java.util.Map; | ||
842 | + | ||
843 | +import org.eclipse.core.runtime.IStatus; | ||
844 | +import org.eclipse.rse.core.model.IPropertySet; | ||
845 | +import org.eclipse.rse.services.clientserver.PathUtility; | ||
846 | +import org.eclipse.rse.services.clientserver.messages.CommonMessages; | ||
847 | +import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds; | ||
848 | +import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage; | ||
849 | +import org.eclipse.rse.services.clientserver.messages.SystemMessage; | ||
850 | +import org.eclipse.rse.services.clientserver.messages.SystemMessageException; | ||
851 | +import org.eclipse.rse.services.terminals.AbstractTerminalShell; | ||
852 | +import org.eclipse.rse.services.terminals.ITerminalService; | ||
853 | +import org.eclipse.rse.ui.SystemBasePlugin; | ||
854 | +import org.eclipse.tm.internal.tcf.rse.ITCFSessionProvider; | ||
855 | +import org.eclipse.tm.internal.tcf.rse.TCFConnectorService; | ||
856 | +import org.eclipse.tm.internal.tcf.rse.TCFRSETask; | ||
857 | +import org.eclipse.tm.internal.tcf.terminals.ITerminalsService; | ||
858 | +import org.eclipse.tm.tcf.protocol.IChannel; | ||
859 | +import org.eclipse.tm.tcf.protocol.IToken; | ||
860 | +import org.eclipse.tm.tcf.services.IStreams; | ||
861 | + | ||
862 | + | ||
863 | +public class TCFTerminalShell extends AbstractTerminalShell { | ||
864 | + private ITCFSessionProvider fSessionProvider; | ||
865 | + private IChannel fChannel; | ||
866 | + private String fPtyType; | ||
867 | + private ITerminalsService.TerminalContext terminalContext; | ||
868 | + private String fEncoding; | ||
869 | + private InputStream fInputStream; | ||
870 | + private OutputStream fOutputStream; | ||
871 | + private Writer fOutputStreamWriter; | ||
872 | + private int fWidth = 0; | ||
873 | + private int fHeight = 0; | ||
874 | + private String fContextID; | ||
875 | + private String in_id; | ||
876 | + private String out_id; | ||
877 | + private boolean connected = false; | ||
878 | + private ITerminalsService terminal; | ||
879 | + private int status; | ||
880 | + | ||
881 | + private IPropertySet tcfPropertySet = null; | ||
882 | + | ||
883 | + private static String defaultEncoding = new java.io.InputStreamReader(new java.io.ByteArrayInputStream(new byte[0])).getEncoding(); | ||
884 | + private ITerminalsService.TerminalsListener listeners = new ITerminalsService.TerminalsListener(){ | ||
885 | + | ||
886 | + public void exited(String terminalId, int exitCode) { | ||
887 | + // TODO Auto-generated method stub | ||
888 | + System.out.printf("Console terminal shell %s exited, current shell ID %s\n", terminalId, terminalContext.getID()); | ||
889 | + if(!terminalContext.getID().equals(terminalId)) | ||
890 | + return; | ||
891 | + terminal.removeListener(listeners); | ||
892 | + TCFTerminalShell.this.connected = false; | ||
893 | + } | ||
894 | + | ||
895 | + | ||
896 | + public void winSizeChanged(String terminalId, int newWidth, | ||
897 | + int newHeight) { | ||
898 | + // TODO Auto-generated method stub | ||
899 | + System.out.printf("Console terminal shell %s new width %d, height %d\n", terminalId, newWidth, newHeight); | ||
900 | + } | ||
901 | + }; | ||
902 | + | ||
903 | + private class LoginThread extends Thread { | ||
904 | + | ||
905 | + private String username; | ||
906 | + private String password; | ||
907 | + private int status = ITCFSessionProvider.SUCCESS_CODE; | ||
908 | + public LoginThread(String username, String password) { | ||
909 | + this.username = username; | ||
910 | + this.password = password; | ||
911 | + } | ||
912 | + | ||
913 | + public void run() { | ||
914 | + tcfPropertySet = ((TCFConnectorService)fSessionProvider).getTCFPropertySet(); | ||
915 | + String login_required = tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_LOGIN_REQUIRED); | ||
916 | + String login_prompt = tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_LOGIN_PROMPT); | ||
917 | + String password_prompt =tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_PASSWORD_PROMPT); | ||
918 | + String command_prompt = tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_COMMAND_PROMPT); | ||
919 | + String pwd_required = tcfPropertySet.getPropertyValue(TCFConnectorService.PROPERTY_PWD_REQUIRED); | ||
920 | + | ||
921 | + if (Boolean.valueOf(login_required).booleanValue()) { | ||
922 | + status = ITCFSessionProvider.SUCCESS_CODE; | ||
923 | + if (login_prompt != null && login_prompt.length() > 0) { | ||
924 | + status = readUntil(login_prompt,fInputStream); | ||
925 | + write(username + "\n"); | ||
926 | + } | ||
927 | + if (Boolean.valueOf(pwd_required).booleanValue()) { | ||
928 | + if (status == ITCFSessionProvider.SUCCESS_CODE && password_prompt != null && password_prompt.length() > 0) { | ||
929 | + status = readUntil(password_prompt,fInputStream); | ||
930 | + write(password + "\n"); | ||
931 | + } | ||
932 | + } | ||
933 | + if (status == ITCFSessionProvider.SUCCESS_CODE && command_prompt != null && command_prompt.length() > 0) { | ||
934 | + status = readUntil(command_prompt,fInputStream); | ||
935 | + write("\n"); | ||
936 | + } | ||
937 | + } else { | ||
938 | + if (command_prompt != null && command_prompt.length() > 0) { | ||
939 | + status = readUntil(command_prompt,fInputStream); | ||
940 | + write("\n"); | ||
941 | + } | ||
942 | + } | ||
943 | + } | ||
944 | + | ||
945 | + public int readUntil(String pattern,InputStream in) { | ||
946 | + try { | ||
947 | + char lastChar = pattern.charAt(pattern.length() - 1); | ||
948 | + StringBuffer sb = new StringBuffer(); | ||
949 | + int ch = in.read(); | ||
950 | + while (ch >= 0) { | ||
951 | + char tch = (char) ch; | ||
952 | + sb.append(tch); | ||
953 | + if (tch=='t' && sb.indexOf("incorrect") >= 0) { //$NON-NLS-1$ | ||
954 | + return ITCFSessionProvider.ERROR_CODE; | ||
955 | + } | ||
956 | + if (tch=='d' && sb.indexOf("closed") >= 0) { //$NON-NLS-1$ | ||
957 | + return ITCFSessionProvider.CONNECT_CLOSED; | ||
958 | + } | ||
959 | + if (tch == lastChar) { | ||
960 | + if (sb.toString().endsWith(pattern)) { | ||
961 | + return ITCFSessionProvider.SUCCESS_CODE; | ||
962 | + } | ||
963 | + } | ||
964 | + ch = in.read(); | ||
965 | + } | ||
966 | + } | ||
967 | + catch (Exception e) { | ||
968 | + e.printStackTrace(); | ||
969 | + SystemBasePlugin.logError(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), e); | ||
970 | + } | ||
971 | + return ITCFSessionProvider.CONNECT_CLOSED; | ||
972 | + } | ||
973 | + | ||
974 | + public int getLoginStatus() { | ||
975 | + return this.status; | ||
976 | + } | ||
977 | + | ||
978 | + } | ||
979 | + | ||
980 | + public void write(String value) { | ||
981 | + try { | ||
982 | + int len = value.length() + 6; | ||
983 | + fOutputStream.write(value.getBytes()); | ||
984 | + System.out.printf("value is %s\n", value); | ||
985 | + System.out.printf("write: ******************".substring(0, len <= 24 ? len : 24)); //$NON-NLS-1$ | ||
986 | + } catch (Exception e) { | ||
987 | + e.printStackTrace(); | ||
988 | + } | ||
989 | + } | ||
990 | + | ||
991 | + private int login(String username, String password) throws InterruptedException | ||
992 | + { | ||
993 | + long millisToEnd = System.currentTimeMillis() + ITCFSessionProvider.TCP_CONNECT_TIMEOUT*1000; | ||
994 | + LoginThread checkLogin = new LoginThread(username, password); | ||
995 | + status = ITCFSessionProvider.ERROR_CODE; | ||
996 | + checkLogin.start(); | ||
997 | + while (checkLogin.isAlive() && System.currentTimeMillis()<millisToEnd) | ||
998 | + checkLogin.join(500); | ||
999 | + status = checkLogin.getLoginStatus(); | ||
1000 | + checkLogin.join(); | ||
1001 | + return status; | ||
1002 | + } | ||
1003 | + /** | ||
1004 | + * Construct a new TCF connection. | ||
1005 | + * | ||
1006 | + * The TCF channel is immediately connected in the Constructor. | ||
1007 | + * | ||
1008 | + * @param sessionProvider TCF session provider | ||
1009 | + * @param ptyType Terminal type to set, or <code>null</code> if not | ||
1010 | + * relevant | ||
1011 | + * @param encoding The default encoding to use for initial command. | ||
1012 | + * @param environment Environment array to set, or <code>null</code> if | ||
1013 | + * not relevant. | ||
1014 | + * @param initialWorkingDirectory initial directory to open the Terminal in. | ||
1015 | + * Use <code>null</code> or empty String ("") to start in a | ||
1016 | + * default directory. Empty String will typically start in the | ||
1017 | + * home directory. | ||
1018 | + * @param commandToRun initial command to send. | ||
1019 | + * @throws SystemMessageException in case anything goes wrong. Channels and | ||
1020 | + * Streams are all cleaned up again in this case. | ||
1021 | + * @see ITerminalService | ||
1022 | + */ | ||
1023 | + public TCFTerminalShell(final ITCFSessionProvider sessionProvider, final String ptyType, | ||
1024 | + final String encoding, final String[] environment, | ||
1025 | + String initialWorkingDirectory, String commandToRun) | ||
1026 | + throws SystemMessageException { | ||
1027 | + Map<String, Object> map_ids; | ||
1028 | + Exception nestedException = null; | ||
1029 | + try { | ||
1030 | + fSessionProvider = sessionProvider; | ||
1031 | + fEncoding = encoding; | ||
1032 | + fPtyType = ptyType; | ||
1033 | + fChannel = fSessionProvider.getChannel(); | ||
1034 | + | ||
1035 | + if (fChannel == null || fChannel.getState() != IChannel.STATE_OPEN) | ||
1036 | + throw new Exception("TCP channel is not connected!"); | ||
1037 | + if (((TCFConnectorService)sessionProvider).isSubscribed() == false) | ||
1038 | + ((TCFConnectorService)sessionProvider).Subscribe(); | ||
1039 | + assert (((TCFConnectorService)sessionProvider).isSubscribed()); | ||
1040 | + | ||
1041 | + new TCFRSETask<ITerminalsService.TerminalContext>() { | ||
1042 | + public void run() { | ||
1043 | + terminal = ((TCFConnectorService)sessionProvider).getService(ITerminalsService.class); | ||
1044 | + terminal.addListener(listeners); | ||
1045 | + terminal.launch(ptyType, encoding, environment, new ITerminalsService.DoneLaunch() { | ||
1046 | + public void doneLaunch(IToken token, Exception error, | ||
1047 | + ITerminalsService.TerminalContext terminal) { | ||
1048 | + // TODO Auto-generated method stub | ||
1049 | + | ||
1050 | + terminalContext = terminal; | ||
1051 | + if (error != null) | ||
1052 | + error(error); | ||
1053 | + else done(terminal); | ||
1054 | + } | ||
1055 | + }); | ||
1056 | + } | ||
1057 | + | ||
1058 | + }.getS(null, TCFShellServiceResources.TCFShellService_Name); //$NON-NLS-1$ | ||
1059 | + | ||
1060 | + fPtyType = terminalContext.getPtyType(); | ||
1061 | + fEncoding = terminalContext.getEncoding(); | ||
1062 | + fContextID = terminalContext.getID(); | ||
1063 | + fWidth = terminalContext.getWidth(); | ||
1064 | + fHeight = terminalContext.getHeight(); | ||
1065 | + map_ids = terminalContext.getProperties(); | ||
1066 | + in_id = (String)map_ids.get(ITerminalsService.PROP_STDOUT_ID); | ||
1067 | + out_id = (String)map_ids.get(ITerminalsService.PROP_STDIN_ID); | ||
1068 | + | ||
1069 | + String user = fSessionProvider.getSessionUserId(); | ||
1070 | + String password = fSessionProvider.getSessionPassword(); //$NON-NLS-1$ | ||
1071 | + status = ITCFSessionProvider.ERROR_CODE; | ||
1072 | + | ||
1073 | + IStreams streams = ((TCFConnectorService)sessionProvider).getService(IStreams.class); | ||
1074 | + fOutputStream = new TCFTerminalOutputStream(streams, out_id); | ||
1075 | + fInputStream = new TCFTerminalInputStream(streams, in_id); | ||
1076 | + if (fEncoding != null) { | ||
1077 | + fOutputStreamWriter = new BufferedWriter(new OutputStreamWriter(fOutputStream, encoding)); | ||
1078 | + } else { | ||
1079 | + // default encoding == System.getProperty("file.encoding") | ||
1080 | + // TODO should try to determine remote encoding if possible | ||
1081 | + fOutputStreamWriter = new BufferedWriter(new OutputStreamWriter(fOutputStream)); | ||
1082 | + } | ||
1083 | + | ||
1084 | + try { | ||
1085 | + status = login(user, password); | ||
1086 | + } | ||
1087 | + finally | ||
1088 | + { | ||
1089 | + if ((status == ITCFSessionProvider.CONNECT_CLOSED)) | ||
1090 | + System.out.print("First time login fails, retry!"); | ||
1091 | + } | ||
1092 | + | ||
1093 | + //give another chance of retrying | ||
1094 | + if ((status == ITCFSessionProvider.CONNECT_CLOSED)) | ||
1095 | + { | ||
1096 | + ((TCFConnectorService)sessionProvider).Unsubscribe(); | ||
1097 | + ((TCFConnectorService)sessionProvider).Subscribe(); | ||
1098 | + assert (((TCFConnectorService)sessionProvider).isSubscribed()); | ||
1099 | + status = login(user, password); | ||
1100 | + } | ||
1101 | + | ||
1102 | + connected = true; | ||
1103 | + if (initialWorkingDirectory!=null && initialWorkingDirectory.length()>0 | ||
1104 | + && !initialWorkingDirectory.equals(".") //$NON-NLS-1$ | ||
1105 | + && !initialWorkingDirectory.equals("Command Shell") //$NON-NLS-1$ //FIXME workaround for bug 153047 | ||
1106 | + ) { | ||
1107 | + writeToShell("cd " + PathUtility.enQuoteUnix(initialWorkingDirectory)); //$NON-NLS-1$ | ||
1108 | + } | ||
1109 | + | ||
1110 | + if (commandToRun != null && commandToRun.length() > 0) { | ||
1111 | + writeToShell(commandToRun); | ||
1112 | + } | ||
1113 | + | ||
1114 | + } | ||
1115 | + catch (Exception e) | ||
1116 | + { | ||
1117 | + e.printStackTrace(); | ||
1118 | + nestedException = e; | ||
1119 | + } | ||
1120 | + finally { | ||
1121 | + if (status == ITCFSessionProvider.SUCCESS_CODE) { | ||
1122 | + System.out.println("TCF shell Service: Connected"); //$NON-NLS-1$ | ||
1123 | + } | ||
1124 | + else { | ||
1125 | + System.out.println("TCF shell Service: Connect failed"); //$NON-NLS-1$ | ||
1126 | + SystemMessage msg; | ||
1127 | + | ||
1128 | + if (nestedException!=null) { | ||
1129 | + msg = new SimpleSystemMessage(org.eclipse.tm.internal.tcf.rse.Activator.PLUGIN_ID, | ||
1130 | + ICommonMessageIds.MSG_EXCEPTION_OCCURRED, | ||
1131 | + IStatus.ERROR, | ||
1132 | + CommonMessages.MSG_EXCEPTION_OCCURRED, nestedException); | ||
1133 | + } else { | ||
1134 | + String strErr; | ||
1135 | + if (status == ITCFSessionProvider.CONNECT_CLOSED) | ||
1136 | + strErr = "Connection closed!"; | ||
1137 | + else if (status == ITCFSessionProvider.ERROR_CODE) | ||
1138 | + strErr = "Login Incorrect or meet other unknown error!"; | ||
1139 | + else | ||
1140 | + strErr = "Not identified Errors"; | ||
1141 | + | ||
1142 | + msg = new SimpleSystemMessage(org.eclipse.tm.internal.tcf.rse.Activator.PLUGIN_ID, | ||
1143 | + ICommonMessageIds.MSG_COMM_AUTH_FAILED, | ||
1144 | + IStatus.ERROR, | ||
1145 | + strErr, | ||
1146 | + "Meet error when trying to login in!"); | ||
1147 | + msg.makeSubstitution(((TCFConnectorService)fSessionProvider).getHost().getAliasName()); | ||
1148 | + } | ||
1149 | + throw new SystemMessageException(msg); | ||
1150 | + } | ||
1151 | + } | ||
1152 | + | ||
1153 | + } | ||
1154 | + | ||
1155 | + public void writeToShell(String command) throws IOException { | ||
1156 | + if (isActive()) { | ||
1157 | + if ("#break".equals(command)) { //$NON-NLS-1$ | ||
1158 | + command = "\u0003"; // Unicode 3 == Ctrl+C //$NON-NLS-1$ | ||
1159 | + } else { | ||
1160 | + command += "\r\n"; //$NON-NLS-1$ | ||
1161 | + } | ||
1162 | + fOutputStreamWriter.write(command); | ||
1163 | + } | ||
1164 | + } | ||
1165 | + | ||
1166 | + public void exit() { | ||
1167 | + | ||
1168 | + // TODO Auto-generated method stub | ||
1169 | + if (fChannel == null || (fChannel.getState() == IChannel.STATE_CLOSED) || !connected) { | ||
1170 | + System.out.println("This terminal shell exits already!"); | ||
1171 | + return; | ||
1172 | + } | ||
1173 | + try { | ||
1174 | + getOutputStream().close(); | ||
1175 | + getInputStream().close(); | ||
1176 | + | ||
1177 | + } | ||
1178 | + catch (IOException ioe) { | ||
1179 | + // TODO Auto-generated catch block | ||
1180 | + ioe.printStackTrace(); | ||
1181 | + } //$NON-NLS-1$ | ||
1182 | + | ||
1183 | + try { | ||
1184 | + new TCFRSETask<Object>() { | ||
1185 | + public void run() { | ||
1186 | + terminalContext.exit(new ITerminalsService.DoneCommand(){ | ||
1187 | + public void doneCommand(IToken token, | ||
1188 | + Exception error) { | ||
1189 | + // TODO Auto-generated method stub | ||
1190 | + if (error != null) | ||
1191 | + error(error); | ||
1192 | + else { | ||
1193 | + System.out.println("terminal exit command sent"); | ||
1194 | + done(this); | ||
1195 | + } | ||
1196 | + } | ||
1197 | + }); | ||
1198 | + }}.getS(null, TCFShellServiceResources.TCFShellService_Name); //seems no need block here. need further modification. | ||
1199 | + } | ||
1200 | + catch (SystemMessageException e) { | ||
1201 | + // TODO Auto-generated catch block | ||
1202 | + e.printStackTrace(); | ||
1203 | + } //$NON-NLS-1$; | ||
1204 | + } | ||
1205 | + | ||
1206 | + public InputStream getInputStream() { | ||
1207 | + // TODO Auto-generated method stub | ||
1208 | + return fInputStream; | ||
1209 | + } | ||
1210 | + | ||
1211 | + public OutputStream getOutputStream() { | ||
1212 | + // TODO Auto-generated method stub | ||
1213 | + return fOutputStream; | ||
1214 | + } | ||
1215 | + | ||
1216 | + public boolean isActive() { | ||
1217 | + // TODO Auto-generated method stub | ||
1218 | + if (fChannel != null && !(fChannel.getState() == IChannel.STATE_CLOSED) && connected) { | ||
1219 | + return true; | ||
1220 | + } | ||
1221 | + exit(); | ||
1222 | + // shell is not active: check for session lost | ||
1223 | + return false; | ||
1224 | + } | ||
1225 | + | ||
1226 | + public String getPtyType() { | ||
1227 | + return fPtyType; | ||
1228 | + } | ||
1229 | + | ||
1230 | + public void setTerminalSize(int newWidth, int newHeight) { | ||
1231 | + // do nothing | ||
1232 | + if (fChannel == null || (fChannel.getState() == IChannel.STATE_CLOSED) || !connected) { | ||
1233 | + System.out.println("This terminal shell exits already, can't set size!"); | ||
1234 | + return; | ||
1235 | + } | ||
1236 | + | ||
1237 | + try { | ||
1238 | + new TCFRSETask<Object>() { | ||
1239 | + public void run() { | ||
1240 | + if (fChannel != null && connected) { | ||
1241 | + terminal.setWinSize(fContextID, fWidth, fHeight, new ITerminalsService.DoneCommand(){ | ||
1242 | + | ||
1243 | + public void doneCommand(IToken token, Exception error) { | ||
1244 | + // TODO Auto-generated method stub | ||
1245 | + if (error != null) | ||
1246 | + error(error); | ||
1247 | + else | ||
1248 | + done(this); | ||
1249 | + | ||
1250 | + }}); | ||
1251 | + | ||
1252 | + } | ||
1253 | + }}.getS(null, TCFShellServiceResources.TCFShellService_Name); | ||
1254 | + } | ||
1255 | + catch (SystemMessageException e) { | ||
1256 | + // TODO Auto-generated catch block | ||
1257 | + e.printStackTrace(); | ||
1258 | + } //$NON-NLS-1$; | ||
1259 | + } | ||
1260 | + | ||
1261 | + public String getDefaultEncoding() { | ||
1262 | + if (fEncoding != null) return fEncoding; | ||
1263 | + return defaultEncoding; | ||
1264 | + } | ||
1265 | + | ||
1266 | +} | ||
1267 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFLoginProperties.java | ||
1268 | =================================================================== | ||
1269 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFLoginProperties.java (revision 0) | ||
1270 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFLoginProperties.java (revision 0) | ||
1271 | @@ -0,0 +1,33 @@ | ||
1272 | +/******************************************************************************* | ||
1273 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
1274 | + * All rights reserved. This program and the accompanying materials | ||
1275 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
1276 | + * which accompanies this distribution, and is available at | ||
1277 | + * http://www.eclipse.org/legal/epl-v10.html | ||
1278 | + * | ||
1279 | + * Contributors: | ||
1280 | + * Intel Corporation - initial API and implementation | ||
1281 | + ******************************************************************************/ | ||
1282 | +package org.eclipse.tm.internal.tcf.rse.shells; | ||
1283 | + | ||
1284 | +import org.eclipse.osgi.util.NLS; | ||
1285 | + | ||
1286 | + | ||
1287 | +public class TCFLoginProperties extends NLS { | ||
1288 | + private static final String BUNDLE_NAME = "org.eclipse.tm.internal.tcf.rse.shells.TCFLoginProperties"; //$NON-NLS-1$ | ||
1289 | + public static final String PropertySet_Description = "TCF Shell login word settings"; | ||
1290 | + public static String TCFLOGIN_REQUIRED; | ||
1291 | + public static String TCFPWD_REQUIRED; | ||
1292 | + public static String TCFLOGIN_PROMPT; | ||
1293 | + public static String TCFPASSWORD_PROMPT; | ||
1294 | + public static String TCFCOMMAND_PROMPT; | ||
1295 | + | ||
1296 | + static { | ||
1297 | + NLS.initializeMessages(BUNDLE_NAME, TCFLoginProperties.class); | ||
1298 | + } | ||
1299 | + | ||
1300 | + private TCFLoginProperties() { | ||
1301 | + } | ||
1302 | + | ||
1303 | + | ||
1304 | +} | ||
1305 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFServiceCommandShell.java | ||
1306 | =================================================================== | ||
1307 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFServiceCommandShell.java (revision 0) | ||
1308 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFServiceCommandShell.java (revision 0) | ||
1309 | @@ -0,0 +1,198 @@ | ||
1310 | +/******************************************************************************* | ||
1311 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
1312 | + * All rights reserved. This program and the accompanying materials | ||
1313 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
1314 | + * which accompanies this distribution, and is available at | ||
1315 | + * http://www.eclipse.org/legal/epl-v10.html | ||
1316 | + * | ||
1317 | + * Contributors: | ||
1318 | + * Intel Corporation - initial API and implementation | ||
1319 | + ******************************************************************************/ | ||
1320 | +package org.eclipse.tm.internal.tcf.rse.shells; | ||
1321 | +import java.util.ArrayList; | ||
1322 | +import java.util.StringTokenizer; | ||
1323 | + | ||
1324 | +import org.eclipse.core.runtime.IPath; | ||
1325 | +import org.eclipse.core.runtime.NullProgressMonitor; | ||
1326 | +import org.eclipse.core.runtime.Path; | ||
1327 | +import org.eclipse.rse.core.subsystems.ISubSystem; | ||
1328 | +import org.eclipse.rse.internal.services.shells.TerminalServiceHostShell; | ||
1329 | +import org.eclipse.rse.services.shells.IHostOutput; | ||
1330 | +import org.eclipse.rse.services.shells.IHostShell; | ||
1331 | +import org.eclipse.rse.services.shells.IHostShellChangeEvent; | ||
1332 | +import org.eclipse.rse.services.shells.ParsedOutput; | ||
1333 | +import org.eclipse.rse.services.shells.Patterns; | ||
1334 | +import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; | ||
1335 | +import org.eclipse.rse.subsystems.shells.core.model.ISystemOutputRemoteTypes; | ||
1336 | +import org.eclipse.rse.subsystems.shells.core.model.RemoteError; | ||
1337 | +import org.eclipse.rse.subsystems.shells.core.model.RemoteOutput; | ||
1338 | +import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem; | ||
1339 | +import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteOutput; | ||
1340 | +import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ServiceCommandShell; | ||
1341 | + | ||
1342 | +@SuppressWarnings("restriction") | ||
1343 | +public class TCFServiceCommandShell extends ServiceCommandShell { | ||
1344 | + private Patterns _patterns; | ||
1345 | + private String _workingDir; | ||
1346 | + private String _curCommand; | ||
1347 | + private IRemoteFileSubSystem _fs; | ||
1348 | + | ||
1349 | + public TCFServiceCommandShell(IRemoteCmdSubSystem cmdSS, | ||
1350 | + IHostShell hostShell) { | ||
1351 | + super(cmdSS, hostShell); | ||
1352 | + // TODO Auto-generated constructor stub | ||
1353 | + _patterns = new Patterns(); | ||
1354 | + _patterns.update("cmd"); //$NON-NLS-1$ | ||
1355 | + ISubSystem[] sses = cmdSS.getHost().getSubSystems(); | ||
1356 | + for (int i = 0; i < sses.length; i++) | ||
1357 | + { | ||
1358 | + if (sses[i] instanceof IRemoteFileSubSystem) | ||
1359 | + { | ||
1360 | + _fs = (IRemoteFileSubSystem)sses[i]; | ||
1361 | + break; | ||
1362 | + } | ||
1363 | + } | ||
1364 | + } | ||
1365 | + | ||
1366 | + public Object getContext() | ||
1367 | + { | ||
1368 | + String workingDir = _workingDir; | ||
1369 | + if (workingDir != null && workingDir.length() > 0) | ||
1370 | + { | ||
1371 | + try { | ||
1372 | + return _fs.getRemoteFileObject(workingDir, new NullProgressMonitor()); | ||
1373 | + } | ||
1374 | + catch (Exception e) | ||
1375 | + { | ||
1376 | + e.printStackTrace(); | ||
1377 | + } | ||
1378 | + } | ||
1379 | + return null; | ||
1380 | + | ||
1381 | + } | ||
1382 | + | ||
1383 | + public String getContextString() | ||
1384 | + { | ||
1385 | + return _workingDir; | ||
1386 | + } | ||
1387 | + | ||
1388 | + public void shellOutputChanged(IHostShellChangeEvent event) | ||
1389 | + { | ||
1390 | + IHostOutput[] lines = event.getLines(); | ||
1391 | + boolean gotCommand = false; | ||
1392 | + ArrayList<RemoteOutput> outputs = new ArrayList<RemoteOutput>(lines.length); | ||
1393 | + for (int i = 0; i < lines.length; i++) | ||
1394 | + { | ||
1395 | + String line = lines[i].getString(); | ||
1396 | + System.out.println("shellOutput:"+line); | ||
1397 | + System.out.printf("cur command %s\n", _curCommand); | ||
1398 | + if (line.endsWith(getPromptCommand())) { | ||
1399 | + continue; //ignore our synthetic prompt command | ||
1400 | + } | ||
1401 | + ParsedOutput parsedMsg = null; | ||
1402 | + if (!gotCommand && line.equals(_curCommand)) { | ||
1403 | + gotCommand = true; | ||
1404 | + continue; //ignore remote command echo | ||
1405 | + } else | ||
1406 | + { | ||
1407 | + try | ||
1408 | + { | ||
1409 | + // Bug 160202: Remote shell dies. | ||
1410 | + if ((_curCommand == null) || (!_curCommand.trim().equals("ls"))) { //$NON-NLS-1$ | ||
1411 | + parsedMsg = _patterns.matchLine(line); | ||
1412 | + | ||
1413 | + // Bug 160202: Remote shell dies. | ||
1414 | + if (_curCommand != null) { | ||
1415 | + String temp = _curCommand.trim(); | ||
1416 | + StringTokenizer tokenizer = new StringTokenizer(temp); | ||
1417 | + | ||
1418 | + if (tokenizer.countTokens() == 2) { | ||
1419 | + String token1 = tokenizer.nextToken(); | ||
1420 | + String token2 = tokenizer.nextToken(); | ||
1421 | + | ||
1422 | + if ((token1.equals("ls")) && (token2.indexOf('-') == 0) && (token2.indexOf('l') > 0)) { //$NON-NLS-1$ | ||
1423 | + if (line.startsWith("total")) { //$NON-NLS-1$ | ||
1424 | + parsedMsg = null; | ||
1425 | + } | ||
1426 | + } | ||
1427 | + } | ||
1428 | + } | ||
1429 | + } | ||
1430 | + } | ||
1431 | + catch (Throwable e) { | ||
1432 | + e.printStackTrace(); | ||
1433 | + } | ||
1434 | + } | ||
1435 | + | ||
1436 | + RemoteOutput output = null; | ||
1437 | + | ||
1438 | + String type = "stdout"; //$NON-NLS-1$ | ||
1439 | + | ||
1440 | + if (parsedMsg != null) { | ||
1441 | + type = parsedMsg.type; | ||
1442 | + } | ||
1443 | + | ||
1444 | + if (event.isError()) { | ||
1445 | + output = new RemoteError(this, type); | ||
1446 | + } | ||
1447 | + else { | ||
1448 | + output = new RemoteOutput(this, type); | ||
1449 | + } | ||
1450 | + | ||
1451 | + output.setText(line); | ||
1452 | + if (parsedMsg != null) | ||
1453 | + { | ||
1454 | + String file = parsedMsg.file; | ||
1455 | + if (type.equals(ISystemOutputRemoteTypes.TYPE_PROMPT)) | ||
1456 | + { | ||
1457 | + _workingDir = file; | ||
1458 | + output.setAbsolutePath(_workingDir); | ||
1459 | + } | ||
1460 | + else if(_workingDir!=null) | ||
1461 | + { | ||
1462 | + IPath p = new Path(_workingDir).append(file); | ||
1463 | + output.setAbsolutePath(p.toString()); | ||
1464 | + } | ||
1465 | + else | ||
1466 | + { | ||
1467 | + output.setAbsolutePath(file); | ||
1468 | + } | ||
1469 | + if (parsedMsg.line > 0){ | ||
1470 | + output.setLine(parsedMsg.line); | ||
1471 | + } | ||
1472 | + } | ||
1473 | + | ||
1474 | + addOutput(output); | ||
1475 | + outputs.add(output); | ||
1476 | + } | ||
1477 | + | ||
1478 | + IRemoteOutput[] remoteOutputs = outputs.toArray(new IRemoteOutput[outputs.size()]); | ||
1479 | + notifyOutputChanged(remoteOutputs, false); | ||
1480 | + } | ||
1481 | + | ||
1482 | + /** | ||
1483 | + * Return the prompt command, such that lines ending with the | ||
1484 | + * prompt command can be removed from output. | ||
1485 | + * Should be overridden in case the IHostShell used for this | ||
1486 | + * service is not an SshHostShell. | ||
1487 | + * @return String promptCommand | ||
1488 | + */ | ||
1489 | + protected String getPromptCommand() { | ||
1490 | + IHostShell shell = getHostShell(); | ||
1491 | + if (shell instanceof TerminalServiceHostShell) { | ||
1492 | + return ((TerminalServiceHostShell)shell).getPromptCommand(); | ||
1493 | + } | ||
1494 | + //return something impossible such that nothing is ever matched | ||
1495 | + return "\uffff"; //$NON-NLS-1$ | ||
1496 | + } | ||
1497 | + | ||
1498 | + public void writeToShell(String cmd) | ||
1499 | + { | ||
1500 | + _curCommand = cmd; | ||
1501 | + _patterns.update(cmd); | ||
1502 | + System.out.println("execute: cmd " + cmd); | ||
1503 | + super.writeToShell(cmd); | ||
1504 | + | ||
1505 | + } | ||
1506 | + | ||
1507 | +} | ||
1508 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalInputStream.java | ||
1509 | =================================================================== | ||
1510 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalInputStream.java (revision 0) | ||
1511 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalInputStream.java (revision 0) | ||
1512 | @@ -0,0 +1,148 @@ | ||
1513 | +/******************************************************************************* | ||
1514 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
1515 | + * All rights reserved. This program and the accompanying materials | ||
1516 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
1517 | + * which accompanies this distribution, and is available at | ||
1518 | + * http://www.eclipse.org/legal/epl-v10.html | ||
1519 | + * | ||
1520 | + * Contributors: | ||
1521 | + * Intel Corporation - initial API and implementation | ||
1522 | + ******************************************************************************/ | ||
1523 | +package org.eclipse.tm.internal.tcf.rse.shells; | ||
1524 | + | ||
1525 | +import java.io.IOException; | ||
1526 | +import java.io.InputStream; | ||
1527 | + | ||
1528 | +import org.eclipse.tm.tcf.protocol.IToken; | ||
1529 | +import org.eclipse.tm.tcf.services.IStreams; | ||
1530 | +import org.eclipse.tm.tcf.util.TCFTask; | ||
1531 | + | ||
1532 | +public class TCFTerminalInputStream extends InputStream { | ||
1533 | + private IStreams streams; | ||
1534 | + private boolean connected = true;;/* The stream is connected or not */ | ||
1535 | + String is_id; | ||
1536 | + private int value; | ||
1537 | + private boolean bEof = false;; | ||
1538 | + | ||
1539 | + public TCFTerminalInputStream(final IStreams streams, final String is_id) throws IOException{ | ||
1540 | + if (streams == null) | ||
1541 | + throw new IOException("TCP streams is null"); | ||
1542 | + this.streams = streams; | ||
1543 | + this.is_id = is_id; | ||
1544 | + } | ||
1545 | + | ||
1546 | + /* read must be synchronized */ | ||
1547 | + @Override | ||
1548 | + public synchronized int read() throws IOException { | ||
1549 | + // TODO Auto-generated method stub | ||
1550 | + if (!connected) | ||
1551 | + throw new IOException("istream is not connected"); | ||
1552 | + if (bEof) | ||
1553 | + return -1; | ||
1554 | + try { | ||
1555 | + new TCFTask<Object>() { | ||
1556 | + public void run() { | ||
1557 | + streams.read(is_id, 1, new IStreams.DoneRead() { | ||
1558 | + public void doneRead(IToken token, Exception error, int lostSize, | ||
1559 | + byte[] data, boolean eos) { | ||
1560 | + // TODO Auto-generated method stub | ||
1561 | + if (error != null) { | ||
1562 | + error(error); | ||
1563 | + return; | ||
1564 | + } | ||
1565 | + bEof = eos; | ||
1566 | + if (data != null) { | ||
1567 | + value = (int)data[0]; | ||
1568 | + if (data.length != 1) { | ||
1569 | + System.out.println("TCF inputstream read one byte, yet return more than one byte!"); | ||
1570 | + } | ||
1571 | + } | ||
1572 | + else | ||
1573 | + value = -1; | ||
1574 | + done(this); | ||
1575 | + } | ||
1576 | + }); | ||
1577 | + } | ||
1578 | + }.getIO(); | ||
1579 | + } | ||
1580 | + catch (Exception e) { | ||
1581 | + e.printStackTrace(); | ||
1582 | + throw new IOException(e); | ||
1583 | + } | ||
1584 | + return value; | ||
1585 | + } | ||
1586 | + | ||
1587 | + private static class Buffer { | ||
1588 | + byte[] buf; | ||
1589 | + Buffer() { | ||
1590 | + } | ||
1591 | + } | ||
1592 | + private Buffer buffer; | ||
1593 | + | ||
1594 | + public synchronized int read(byte b[], final int off, final int len) throws IOException { | ||
1595 | + | ||
1596 | + | ||
1597 | + if (!connected) | ||
1598 | + throw new IOException("istream is not connected"); | ||
1599 | + if (bEof) return -1; | ||
1600 | + if (b == null) { | ||
1601 | + throw new NullPointerException(); | ||
1602 | + } else if (off < 0 || len < 0 || len > b.length - off) { | ||
1603 | + throw new IndexOutOfBoundsException(); | ||
1604 | + } else if (len == 0) { | ||
1605 | + return 0; | ||
1606 | + } | ||
1607 | + try { | ||
1608 | + new TCFTask<Buffer>() { | ||
1609 | + public void run() { | ||
1610 | + streams.read(is_id, len, new IStreams.DoneRead() { | ||
1611 | + public void doneRead(IToken token, Exception error, int lostSize, | ||
1612 | + byte[] data, boolean eos) { | ||
1613 | + // TODO Auto-generated method stub | ||
1614 | + if (error != null) { | ||
1615 | + error(error); | ||
1616 | + return; | ||
1617 | + } | ||
1618 | + bEof = eos; | ||
1619 | + if (data != null) { | ||
1620 | + buffer = new Buffer(); | ||
1621 | + buffer.buf = data; | ||
1622 | + | ||
1623 | + } | ||
1624 | + done(buffer); | ||
1625 | + } | ||
1626 | + }); | ||
1627 | + } | ||
1628 | + }.getIO(); | ||
1629 | + | ||
1630 | + if (buffer.buf != null) { | ||
1631 | + int length = buffer.buf.length; | ||
1632 | + System.arraycopy(buffer.buf, 0, b, off, length); | ||
1633 | + System.out.println("read a line:"+ new String(b, off,length)); | ||
1634 | + return length; | ||
1635 | + } | ||
1636 | + else if (bEof) | ||
1637 | + return -1; | ||
1638 | + else return 0; | ||
1639 | + } catch (Exception ee) { | ||
1640 | + ee.printStackTrace(); | ||
1641 | + throw new IOException(ee); | ||
1642 | + } | ||
1643 | + } | ||
1644 | + | ||
1645 | + public void close() throws IOException { | ||
1646 | + if (!connected) return; | ||
1647 | + new TCFTask<Object>() { | ||
1648 | + public void run() { | ||
1649 | + streams.disconnect(is_id, new IStreams.DoneDisconnect() { | ||
1650 | + public void doneDisconnect(IToken token, Exception error) { | ||
1651 | + connected = false; | ||
1652 | + done(this); | ||
1653 | + } | ||
1654 | + }); | ||
1655 | + } | ||
1656 | + }.getIO(); | ||
1657 | + connected = false; | ||
1658 | + } | ||
1659 | + | ||
1660 | +} | ||
1661 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalOutputStream.java | ||
1662 | =================================================================== | ||
1663 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalOutputStream.java (revision 0) | ||
1664 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFTerminalOutputStream.java (revision 0) | ||
1665 | @@ -0,0 +1,110 @@ | ||
1666 | +/******************************************************************************* | ||
1667 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
1668 | + * All rights reserved. This program and the accompanying materials | ||
1669 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
1670 | + * which accompanies this distribution, and is available at | ||
1671 | + * http://www.eclipse.org/legal/epl-v10.html | ||
1672 | + * | ||
1673 | + * Contributors: | ||
1674 | + * Intel Corporation - initial API and implementation | ||
1675 | + ******************************************************************************/ | ||
1676 | +package org.eclipse.tm.internal.tcf.rse.shells; | ||
1677 | + | ||
1678 | +import java.io.IOException; | ||
1679 | + | ||
1680 | +import java.io.OutputStream; | ||
1681 | + | ||
1682 | +import org.eclipse.tm.tcf.protocol.IToken; | ||
1683 | +import org.eclipse.tm.tcf.services.IStreams; | ||
1684 | +import org.eclipse.tm.tcf.util.TCFTask; | ||
1685 | + | ||
1686 | +public class TCFTerminalOutputStream extends OutputStream { | ||
1687 | + | ||
1688 | + private final IStreams streams; | ||
1689 | + private boolean connected = true; | ||
1690 | + private boolean write_eof; | ||
1691 | + String os_id; | ||
1692 | + | ||
1693 | + public TCFTerminalOutputStream(final IStreams streams, final String os_id) throws IOException{ | ||
1694 | + if (streams == null) throw new IOException("istream is null"); | ||
1695 | + this.streams = streams; | ||
1696 | + this.os_id = os_id; | ||
1697 | + write_eof = false; | ||
1698 | + } | ||
1699 | + | ||
1700 | + @Override | ||
1701 | + public synchronized void write(final byte b[], final int off, final int len) throws IOException { | ||
1702 | + /* If eof is written, we can't write anything into the stream */ | ||
1703 | + if (!connected || write_eof) | ||
1704 | + throw new IOException("stream is not connected or write_eof already!"); | ||
1705 | + System.out.println("write line: " + new String(b, off, len) ); | ||
1706 | + try { | ||
1707 | + new TCFTask<Object>() { | ||
1708 | + public void run() { | ||
1709 | + streams.write(os_id, b, off, len, new IStreams.DoneWrite() { | ||
1710 | + public void doneWrite(IToken token, Exception error) { | ||
1711 | + // TODO: stream write error handling | ||
1712 | + if (error != null) error(error); | ||
1713 | + done(this); | ||
1714 | + } | ||
1715 | + }); | ||
1716 | + | ||
1717 | + } | ||
1718 | + }.getIO(); | ||
1719 | + } | ||
1720 | + catch (Exception e) | ||
1721 | + { | ||
1722 | + throw new IOException(e); | ||
1723 | + } | ||
1724 | + } | ||
1725 | + | ||
1726 | + @Override | ||
1727 | + public synchronized void write(int b) throws IOException { | ||
1728 | + | ||
1729 | + // TODO Auto-generated method stub | ||
1730 | + try { | ||
1731 | + final byte[] buf = new byte[1]; | ||
1732 | + buf[0] = (byte)b; | ||
1733 | + this.write(buf, 0, 1); | ||
1734 | + } | ||
1735 | + catch(IOException ioe) { | ||
1736 | + ioe.printStackTrace(); | ||
1737 | + throw new IOException(ioe); | ||
1738 | + } | ||
1739 | + | ||
1740 | + } | ||
1741 | + | ||
1742 | + /* close must be called --Need to reconsider it in the future*/ | ||
1743 | + public void close() throws IOException { | ||
1744 | + if (!connected) | ||
1745 | + return; | ||
1746 | + try { | ||
1747 | + new TCFTask<Object>() { | ||
1748 | + public void run() { | ||
1749 | + streams.eos(os_id, new IStreams.DoneEOS() { | ||
1750 | + public void doneEOS(IToken token, Exception error) { | ||
1751 | + // TODO Auto-generated method stub | ||
1752 | + write_eof = true; | ||
1753 | + done(this); | ||
1754 | + } | ||
1755 | + }); | ||
1756 | + } | ||
1757 | + }.getIO(); | ||
1758 | + new TCFTask<Object>() { | ||
1759 | + public void run() { | ||
1760 | + streams.disconnect(os_id, new IStreams.DoneDisconnect() { | ||
1761 | + public void doneDisconnect(IToken token, Exception error) { | ||
1762 | + connected = false; | ||
1763 | + done(this); | ||
1764 | + } | ||
1765 | + }); | ||
1766 | + | ||
1767 | + } | ||
1768 | + }.getIO(); | ||
1769 | + } | ||
1770 | + catch(Exception e) { | ||
1771 | + throw new IOException(e); | ||
1772 | + } | ||
1773 | + } | ||
1774 | + | ||
1775 | +} | ||
1776 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.properties | ||
1777 | =================================================================== | ||
1778 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.properties (revision 0) | ||
1779 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellServiceResources.properties (revision 0) | ||
1780 | @@ -0,0 +1,3 @@ | ||
1781 | +TCFPlugin_Unexpected_Exception=Unexpected {0}: {1} | ||
1782 | +TCFShellService_Name=TCF Shell Service | ||
1783 | +TCFShellService_Description=TCF Shell Service Description | ||
1784 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellSubSystemConfiguration.java | ||
1785 | =================================================================== | ||
1786 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellSubSystemConfiguration.java (revision 0) | ||
1787 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/shells/TCFShellSubSystemConfiguration.java (revision 0) | ||
1788 | @@ -0,0 +1,70 @@ | ||
1789 | +/******************************************************************************* | ||
1790 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
1791 | + * All rights reserved. This program and the accompanying materials | ||
1792 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
1793 | + * which accompanies this distribution, and is available at | ||
1794 | + * http://www.eclipse.org/legal/epl-v10.html | ||
1795 | + * | ||
1796 | + * Contributors: | ||
1797 | + * Intel Corporation - initial API and implementation | ||
1798 | + ******************************************************************************/ | ||
1799 | +package org.eclipse.tm.internal.tcf.rse.shells; | ||
1800 | + | ||
1801 | +import org.eclipse.rse.core.model.IHost; | ||
1802 | +import org.eclipse.rse.core.subsystems.IConnectorService; | ||
1803 | +import org.eclipse.rse.core.subsystems.ISubSystem; | ||
1804 | +import org.eclipse.rse.services.shells.IHostShell; | ||
1805 | +import org.eclipse.rse.services.shells.IShellService; | ||
1806 | +import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem; | ||
1807 | +import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IServiceCommandShell; | ||
1808 | +import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ShellServiceSubSystem; | ||
1809 | +import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ShellServiceSubSystemConfiguration; | ||
1810 | +import org.eclipse.tm.internal.tcf.rse.*; | ||
1811 | +import org.eclipse.tm.internal.tcf.rse.terminals.TCFTerminalService; | ||
1812 | + | ||
1813 | + | ||
1814 | +public class TCFShellSubSystemConfiguration extends | ||
1815 | + ShellServiceSubSystemConfiguration { | ||
1816 | + | ||
1817 | + public TCFShellSubSystemConfiguration() { | ||
1818 | + super(); | ||
1819 | + } | ||
1820 | + | ||
1821 | + /** | ||
1822 | + * Instantiate and return an instance of OUR subsystem. | ||
1823 | + * Do not populate it yet though! | ||
1824 | + * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(IHost) | ||
1825 | + */ | ||
1826 | + public ISubSystem createSubSystemInternal(IHost host) | ||
1827 | + { | ||
1828 | + TCFConnectorService connectorService = (TCFConnectorService)getConnectorService(host); | ||
1829 | + ISubSystem subsys = new ShellServiceSubSystem(host, connectorService, createShellService(host)); | ||
1830 | + return subsys; | ||
1831 | + } | ||
1832 | + | ||
1833 | + public IConnectorService getConnectorService(IHost host) { | ||
1834 | + return TCFConnectorServiceManager.getInstance().getConnectorService(host, getServiceImplType()); | ||
1835 | +} | ||
1836 | + | ||
1837 | + public void setConnectorService(IHost host, | ||
1838 | + IConnectorService connectorService) { | ||
1839 | + TCFConnectorServiceManager.getInstance().setConnectorService(host, getServiceImplType(), connectorService); | ||
1840 | + } | ||
1841 | + | ||
1842 | + public Class<ITCFSubSystem> getServiceImplType() | ||
1843 | + { | ||
1844 | + return ITCFSubSystem.class; | ||
1845 | + } | ||
1846 | + | ||
1847 | + public IServiceCommandShell createRemoteCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell) { | ||
1848 | + return new TCFServiceCommandShell(cmdSS, hostShell); | ||
1849 | + } | ||
1850 | + | ||
1851 | + public IShellService createShellService(IHost host) { | ||
1852 | + TCFConnectorService cserv = (TCFConnectorService)getConnectorService(host); | ||
1853 | + | ||
1854 | + return (IShellService) (new TCFTerminalService(cserv)).getAdapter(IShellService.class); | ||
1855 | + } | ||
1856 | + | ||
1857 | + | ||
1858 | +} | ||
1859 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.properties | ||
1860 | =================================================================== | ||
1861 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.properties (revision 0) | ||
1862 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/TCFConnectorResources.properties (revision 0) | ||
1863 | @@ -0,0 +1,3 @@ | ||
1864 | +TCFConnectorService_Name=TCF Connector Service | ||
1865 | +TCFConnectorService_Description=Target Communication Framework | ||
1866 | +PropertySet_Description=TCF login properties. Set these according to your remote system's login prompts. | ||
1867 | \ No newline at end of file | ||
1868 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.properties | ||
1869 | =================================================================== | ||
1870 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.properties (revision 0) | ||
1871 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.properties (revision 0) | ||
1872 | @@ -0,0 +1,3 @@ | ||
1873 | +TCFPlugin_Unexpected_Exception=Unexpected {0}: {1} | ||
1874 | +TCFTerminalService_Name=TCF Terminal Service | ||
1875 | +TCFTerminalService_Description=TCF Terminal Service Description | ||
1876 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceSubSystemConfiguration.java | ||
1877 | =================================================================== | ||
1878 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceSubSystemConfiguration.java (revision 0) | ||
1879 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceSubSystemConfiguration.java (revision 0) | ||
1880 | @@ -0,0 +1,64 @@ | ||
1881 | +/******************************************************************************* | ||
1882 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
1883 | + * All rights reserved. This program and the accompanying materials | ||
1884 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
1885 | + * which accompanies this distribution, and is available at | ||
1886 | + * http://www.eclipse.org/legal/epl-v10.html | ||
1887 | + * | ||
1888 | + * Contributors: | ||
1889 | + * Intel Corporation - initial API and implementation | ||
1890 | + ******************************************************************************/ | ||
1891 | +package org.eclipse.tm.internal.tcf.rse.terminals; | ||
1892 | + | ||
1893 | +import org.eclipse.rse.core.model.IHost; | ||
1894 | +import org.eclipse.rse.core.subsystems.IConnectorService; | ||
1895 | +import org.eclipse.rse.core.subsystems.ISubSystem; | ||
1896 | +import org.eclipse.rse.services.terminals.ITerminalService; | ||
1897 | +import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystem; | ||
1898 | +import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystemConfiguration; | ||
1899 | +import org.eclipse.tm.internal.tcf.rse.ITCFSubSystem; | ||
1900 | +import org.eclipse.tm.internal.tcf.rse.TCFConnectorService; | ||
1901 | +import org.eclipse.tm.internal.tcf.rse.TCFConnectorServiceManager; | ||
1902 | + | ||
1903 | +public class TCFTerminalServiceSubSystemConfiguration extends | ||
1904 | + TerminalServiceSubSystemConfiguration { | ||
1905 | + | ||
1906 | + | ||
1907 | + /** | ||
1908 | + * Instantiate and return an instance of OUR subsystem. Do not populate it | ||
1909 | + * yet though! | ||
1910 | + * | ||
1911 | + * @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(IHost) | ||
1912 | + */ | ||
1913 | + public ISubSystem createSubSystemInternal(IHost host) { | ||
1914 | + TCFConnectorService connectorService = (TCFConnectorService) getConnectorService(host); | ||
1915 | + ISubSystem subsys = new TerminalServiceSubSystem(host, | ||
1916 | + connectorService, createTerminalService(host)); | ||
1917 | + return subsys; | ||
1918 | + } | ||
1919 | + | ||
1920 | + /** | ||
1921 | + * @inheritDoc | ||
1922 | + * @since 1.0 | ||
1923 | + */ | ||
1924 | + public ITerminalService createTerminalService(IHost host) { | ||
1925 | + TCFConnectorService cserv = (TCFConnectorService) getConnectorService(host); | ||
1926 | + return new TCFTerminalService(cserv); | ||
1927 | + } | ||
1928 | + | ||
1929 | + public IConnectorService getConnectorService(IHost host) { | ||
1930 | + return TCFConnectorServiceManager.getInstance().getConnectorService( | ||
1931 | + host, getServiceImplType()); | ||
1932 | + } | ||
1933 | + | ||
1934 | + public void setConnectorService(IHost host, | ||
1935 | + IConnectorService connectorService) { | ||
1936 | + TCFConnectorServiceManager.getInstance().setConnectorService(host, | ||
1937 | + getServiceImplType(), connectorService); | ||
1938 | + } | ||
1939 | + | ||
1940 | + public Class<ITCFSubSystem> getServiceImplType() { | ||
1941 | + return ITCFSubSystem.class; | ||
1942 | + } | ||
1943 | + | ||
1944 | +} | ||
1945 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.java | ||
1946 | =================================================================== | ||
1947 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.java (revision 0) | ||
1948 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalServiceResources.java (revision 0) | ||
1949 | @@ -0,0 +1,36 @@ | ||
1950 | +/******************************************************************************* | ||
1951 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
1952 | + * All rights reserved. This program and the accompanying materials | ||
1953 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
1954 | + * which accompanies this distribution, and is available at | ||
1955 | + * http://www.eclipse.org/legal/epl-v10.html | ||
1956 | + * | ||
1957 | + * Contributors: | ||
1958 | + * Intel Corporation - initial API and implementation | ||
1959 | + ******************************************************************************/ | ||
1960 | +package org.eclipse.tm.internal.tcf.rse.terminals; | ||
1961 | + | ||
1962 | +import org.eclipse.osgi.util.NLS; | ||
1963 | + | ||
1964 | +public class TCFTerminalServiceResources extends NLS { | ||
1965 | + private static final String BUNDLE_NAME = "org.eclipse.tm.internal.tcf.rse.terminals.TCFTerminalServiceResources"; //$NON-NLS-1$ | ||
1966 | + | ||
1967 | + public static String TCFPlugin_Unexpected_Exception; | ||
1968 | + | ||
1969 | + public static String TCFTerminalService_Description; | ||
1970 | + | ||
1971 | + public static String TCFTerminalService_Name; | ||
1972 | + | ||
1973 | + static { | ||
1974 | + // initialize resource bundle | ||
1975 | + NLS.initializeMessages(BUNDLE_NAME, TCFTerminalServiceResources.class); | ||
1976 | + } | ||
1977 | + | ||
1978 | + private TCFTerminalServiceResources(){ | ||
1979 | + | ||
1980 | + } | ||
1981 | + | ||
1982 | +} | ||
1983 | + | ||
1984 | + | ||
1985 | + | ||
1986 | Index: plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalService.java | ||
1987 | =================================================================== | ||
1988 | --- plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalService.java (revision 0) | ||
1989 | +++ plugins/org.eclipse.tm.tcf.rse/src/org/eclipse/tm/internal/tcf/rse/terminals/TCFTerminalService.java (revision 0) | ||
1990 | @@ -0,0 +1,57 @@ | ||
1991 | +/******************************************************************************* | ||
1992 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
1993 | + * All rights reserved. This program and the accompanying materials | ||
1994 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
1995 | + * which accompanies this distribution, and is available at | ||
1996 | + * http://www.eclipse.org/legal/epl-v10.html | ||
1997 | + * | ||
1998 | + * Contributors: | ||
1999 | + * Intel Corporation - initial API and implementation | ||
2000 | + ******************************************************************************/ | ||
2001 | +package org.eclipse.tm.internal.tcf.rse.terminals; | ||
2002 | + | ||
2003 | +import org.eclipse.core.runtime.IProgressMonitor; | ||
2004 | + | ||
2005 | +import org.eclipse.rse.services.clientserver.messages.SystemMessageException; | ||
2006 | +import org.eclipse.rse.services.terminals.AbstractTerminalService; | ||
2007 | +import org.eclipse.rse.services.terminals.ITerminalShell; | ||
2008 | +import org.eclipse.tm.internal.tcf.rse.ITCFSessionProvider; | ||
2009 | +import org.eclipse.tm.internal.tcf.rse.shells.TCFTerminalShell; | ||
2010 | + | ||
2011 | +public class TCFTerminalService extends AbstractTerminalService{ | ||
2012 | + private final ITCFSessionProvider fSessionProvider; | ||
2013 | + | ||
2014 | + /** | ||
2015 | + * Return the TCF property set, and fill it with default values if it has | ||
2016 | + * not been created yet. Extender may override in order to set different | ||
2017 | + * default values. | ||
2018 | + * | ||
2019 | + * @return a property set holding properties understood by the TCF | ||
2020 | + * connector service. | ||
2021 | + */ | ||
2022 | + public ITerminalShell launchTerminal(String ptyType, String encoding, | ||
2023 | + String[] environment, String initialWorkingDirectory, | ||
2024 | + String commandToRun, IProgressMonitor monitor) | ||
2025 | + throws SystemMessageException { | ||
2026 | + // TODO Auto-generated method stub | ||
2027 | + TCFTerminalShell hostShell = new TCFTerminalShell(fSessionProvider, ptyType, encoding, environment, initialWorkingDirectory, commandToRun); | ||
2028 | + return hostShell; | ||
2029 | + } | ||
2030 | + | ||
2031 | + | ||
2032 | + public TCFTerminalService(ITCFSessionProvider sessionProvider) { | ||
2033 | + fSessionProvider = sessionProvider; | ||
2034 | + } | ||
2035 | + | ||
2036 | + public ITCFSessionProvider getSessionProvider() { | ||
2037 | + return fSessionProvider; | ||
2038 | + } | ||
2039 | + @Override | ||
2040 | + public String getName() { | ||
2041 | + return TCFTerminalServiceResources.TCFTerminalService_Name; | ||
2042 | + } | ||
2043 | + @Override | ||
2044 | + public String getDescription() { | ||
2045 | + return TCFTerminalServiceResources.TCFTerminalService_Description; | ||
2046 | + } | ||
2047 | +} | ||
2048 | Index: plugins/org.eclipse.tm.tcf.rse/plugin.xml | ||
2049 | =================================================================== | ||
2050 | --- plugins/org.eclipse.tm.tcf.rse/plugin.xml (revision 1190) | ||
2051 | +++ plugins/org.eclipse.tm.tcf.rse/plugin.xml (working copy) | ||
2052 | @@ -37,6 +37,22 @@ | ||
2053 | vendor="Wind River"> | ||
2054 | </configuration> | ||
2055 | </extension> | ||
2056 | + <extension | ||
2057 | + point="org.eclipse.rse.core.subsystemConfigurations"> | ||
2058 | + <configuration | ||
2059 | + category="shells" | ||
2060 | + class="org.eclipse.tm.internal.tcf.rse.shells.TCFShellSubSystemConfiguration" | ||
2061 | + description="Shells" | ||
2062 | + icon="icons/system-processes.gif" | ||
2063 | + iconlive="icons/system-processes-live.gif" | ||
2064 | + id="org.eclipse.tm.tcf.rse.Shells" | ||
2065 | + name="Shells" | ||
2066 | + priority="200" | ||
2067 | + serviceType="_ssh._tcp;_sftp-ssh._tcp" | ||
2068 | + systemTypeIds="org.eclipse.tm.tcf.rse.systemType" | ||
2069 | + vendor="Intel"> | ||
2070 | + </configuration> | ||
2071 | + </extension> | ||
2072 | <extension | ||
2073 | point="org.eclipse.rse.core.subsystemConfigurations"> | ||
2074 | <configuration | ||
2075 | @@ -52,6 +68,22 @@ | ||
2076 | vendor="Wind River"> | ||
2077 | </configuration> | ||
2078 | </extension> | ||
2079 | + <extension | ||
2080 | + point="org.eclipse.rse.core.subsystemConfigurations"> | ||
2081 | + <configuration | ||
2082 | + category="terminals" | ||
2083 | + class="org.eclipse.tm.internal.tcf.rse.terminals.TCFTerminalServiceSubSystemConfiguration" | ||
2084 | + description="TCF Terminal Service Description" | ||
2085 | + icon="icons/system-processes.gif" | ||
2086 | + iconlive="icons/system-processes-live.gif" | ||
2087 | + id="org.eclipse.tm.tcf.rse.Terminals" | ||
2088 | + name="Terminals" | ||
2089 | + priority="200" | ||
2090 | + serviceType="_ssh._tcp;_sftp-ssh._tcp" | ||
2091 | + systemTypeIds="org.eclipse.tm.tcf.rse.systemType" | ||
2092 | + vendor="Intel"> | ||
2093 | + </configuration> | ||
2094 | + </extension> | ||
2095 | <extension point="org.eclipse.core.runtime.adapters"> | ||
2096 | <factory | ||
2097 | class="org.eclipse.tm.internal.tcf.rse.processes.TCFSystemViewProcessAdapterFactory" | ||
diff --git a/tcf/readme b/tcf/readme new file mode 100644 index 0000000..95529a1 --- /dev/null +++ b/tcf/readme | |||
@@ -0,0 +1,175 @@ | |||
1 | The current implmentaion is based on TCF contribution 0.3.0(SVN revision 998). | ||
2 | (svn://dev.eclipse.org/svnroot/dsdp/org.eclipse.tm.tcf/tags/0.3.0) | ||
3 | |||
4 | I. Build | ||
5 | ================================ | ||
6 | 1. Check out the TCF contribution code version 0.3.0 from TCF SVN | ||
7 | repository. | ||
8 | |||
9 | svn co svn://dev.eclipse.org/svnroot/dsdp/org.eclipse.tm.tcf/tags/0.3.0 tcf_local/ | ||
10 | |||
11 | To use SVN inside Intel firewall, please use tsocks. | ||
12 | (http://opensource.intel.com/linux-wiki/LinuxDesktop?highlight=%28tsocks%29#head-7dfffbdc3bda005c74d26ed2af467643dc89844b) | ||
13 | |||
14 | 2. Apply the patches. | ||
15 | |||
16 | cd tcf_local | ||
17 | patch -p0 < ../terminals_agent.patch | ||
18 | patch -p0 < ../terminals_plugin.patch | ||
19 | patch -p0 < ../lke_rse_tcf.patch | ||
20 | |||
21 | After the successful patch, only the following components are useful | ||
22 | for CDT remote debug. Other plugins are not required. | ||
23 | |||
24 | plugins/org.eclipse.tm.tcf/ | ||
25 | TCF plugin for Eclipse integration. | ||
26 | |||
27 | plugins/org.eclipse.tm.tcf.core/ | ||
28 | TCF Java framework and intefaces for standard services. | ||
29 | |||
30 | plugins/org.eclipse.tm.tcf.rse/ | ||
31 | RSE plugin using TCF. | ||
32 | |||
33 | plugins/org.eclipse.tm.tcf.terminals/ | ||
34 | TCF Java interfaces & eclipse integration for terminal service. | ||
35 | |||
36 | agent/ | ||
37 | TCF reference agent for standard services. | ||
38 | |||
39 | org.eclipse.tm.tcf.terminals.agent/ | ||
40 | TCF reference agent with addtional terminal service. | ||
41 | |||
42 | 3. Build the agent on remote target side. | ||
43 | (This step can be skipped if the agent is already included in | ||
44 | the poky generated image) | ||
45 | |||
46 | 1) copy the directories "agent/" or "org.eclipse.tm.tcf.terminals.agent/" | ||
47 | to the remote target machine. | ||
48 | 2) cd "org.eclipse.tm.tcf.terminals.agent/" | ||
49 | 3) make | ||
50 | |||
51 | 4. Import the eclipse plugins on host side. | ||
52 | 1) In eclipse, choose from menu | ||
53 | File->Import->General->"Existing projects into workspace", | ||
54 | browse to the "tcf_local/plugins" direcotry, and click "OK". | ||
55 | 2) Check the following plugins: | ||
56 | org.eclipse.tm.tcf | ||
57 | org.eclipse.tm.tcf.core | ||
58 | org.eclipse.tm.tcf.rse | ||
59 | org.eclipse.tm.tcf.terminals | ||
60 | 3) Click "Finish" to import the eclipse plugins. | ||
61 | 4) Select Project->"Build All" to build the plugins. If the | ||
62 | build process complains about missing dependent plugin, | ||
63 | please see Note 2 below. | ||
64 | |||
65 | |||
66 | II. Usage | ||
67 | ================================ | ||
68 | On remote target side | ||
69 | 1. Build & run tcf agent on target. | ||
70 | (This step can be skipped if the agent is already included in | ||
71 | the poky generated iamge) | ||
72 | |||
73 | - cd to direcotry "org.eclipse.tm.tcf.terminals.agent". | ||
74 | - type "make" to build the tcf agent. | ||
75 | - run the tcf agent with root privilege on target. | ||
76 | e.g. sudo obj/GNU/Linux/x86_64/Debug/agent -Llog.txt | ||
77 | |||
78 | On Host side | ||
79 | 2. Launch the RSE plugin for TCF(org.eclipse.tm.tcf.rse). | ||
80 | Make sure the org.eclipse.tm.tcf.terminals plugin is launched along | ||
81 | with that plugin. | ||
82 | |||
83 | 3. CDT remote debug. | ||
84 | 1) Choose from menu Run->"Debug Configurations..."-> | ||
85 | "C/C++ Remote Application", and click the "New launch configuration" | ||
86 | button. | ||
87 | 2) In the "Main" tab, click "New..." button and it will launch a | ||
88 | "New Connection" wizard. | ||
89 | 3) In the "New Connection" dialogue, choose "TCF" as system type and | ||
90 | click "Next". | ||
91 | 4) Input the ip address of the remote target machine in "Host name:", | ||
92 | choose an arbitary unique name for "Connection name:", and click | ||
93 | "Next". | ||
94 | 5) Make sure "org.eclipse.tm.tcf.rse.Terminals" is checked, make sure | ||
95 | you have input the correct TCF session properties in the TCF | ||
96 | Connector Service and click "Next". (See Note 3 below) | ||
97 | 6) Make sure "org.eclipse.tm.tcf.rse.Files" is checked and click "Next". | ||
98 | 7) Make sure "org.eclipse.tm.tcf.rse.Processes" is checked and click | ||
99 | "Next". | ||
100 | 8) Make sure "org.eclipse.tm.tcf.rse.Shells" is checked, make sure you | ||
101 | have input the correct TCF session properties in the TCF Connector | ||
102 | Service. (See Note 3 below) | ||
103 | 9) Click "Finish" to close the "New Connection" dialogue. | ||
104 | 10) In the "Main" tab, choose the connection just created from the | ||
105 | "Connection" drop-list. | ||
106 | 11) In the "Main" tab, enter the "Remote Absolute File Path for | ||
107 | C/C++ Application". This is where the debugged application to be | ||
108 | downloaded to the remote target side. e.g. "/tmp/helloworld". | ||
109 | 12) In the "Debugger" tab, please choose the correct "GDB debugger". | ||
110 | Usually you should choose the cross-gdb which matches the host | ||
111 | and target machine. (see Known limitations 2.) | ||
112 | 13) Click "Debug". | ||
113 | 14) In the popped up "Enter Password" dialogue, enter the correct | ||
114 | "User ID" and "Password" and click "OK". It will be used to | ||
115 | login to the remote target machine. | ||
116 | |||
117 | III. Note | ||
118 | ================================ | ||
119 | 1. Sometimes the eclispe would report a exception of | ||
120 | "Java.lang.OutOfMemoryError: PermGen space" and the application hangs. | ||
121 | This is because the JVM garbage collection doesn't clean the permenant | ||
122 | generation space, which is used to store meta-data descriptions of | ||
123 | classes. To fix this problem, please add "-XX:MaxPermSize=256M" to the | ||
124 | "VM arguements" when launching the plug-ins. | ||
125 | |||
126 | 2. The following eclipse plugins should be installed before building | ||
127 | TCF related plugins. | ||
128 | |||
129 | CDT v6.0.2: http://download.eclipse.org/tools/cdt/releases/galileo | ||
130 | RSE v3.1.2: http://download.eclipse.org/dsdp/tm/updates/3.1/ | ||
131 | |||
132 | 3. TCF Connector Service Properties. | ||
133 | The TCF connector service properties are used for the TCF based RSE | ||
134 | terminals and shells subsystems. | ||
135 | |||
136 | To change these properties, click the "TCF Connection Settings" under | ||
137 | the "Available Services" in the wizard, in the right, a list of | ||
138 | properties is shown and ready for change. | ||
139 | |||
140 | Here is a list of the properties: | ||
141 | |||
142 | - Command.Prompt | ||
143 | This is a string of which the shell/terminal prompt string on the remote | ||
144 | target system will end with. The default value is | ||
145 | "# "(Pay attention there is a space after the '#'). | ||
146 | |||
147 | - Login.Prompt | ||
148 | This is a string of which the login prompt string on the remote target | ||
149 | system will end with. The default value is "ogin: "(Pay attention | ||
150 | there is a space after the ':'). | ||
151 | |||
152 | - Login.Required | ||
153 | Set to "true" if the remote target system requires the user to input | ||
154 | login user name for terminal/shell services. Otherwise set to "false". | ||
155 | The default value is "true". | ||
156 | |||
157 | - Password.Prompt | ||
158 | This is a string of which the password prompt string on the remote target | ||
159 | system will end with. The default value is "assword: ".(Pay attention | ||
160 | there is a space after the ':') | ||
161 | |||
162 | - Pwd.Required | ||
163 | Setting to "true" if the remote target system requires the user to input | ||
164 | password for terminal/shell services. Otherwise set to "false". The | ||
165 | default value is "false". | ||
166 | |||
167 | IV. Known limitations | ||
168 | ================================ | ||
169 | 1. Authentication retry is not implemented. The user only has one chance to | ||
170 | input the correct password. If it fails, the user needs to re-launch | ||
171 | shell/terminal. If the user has checked the "Save password" in the prompt | ||
172 | dialogue, it needs to be disconnected and re-connected. | ||
173 | |||
174 | 2. Users have to set the correct cross-gdb debugger manually in the | ||
175 | "Debugger" tab in the remote debug configuration. | ||
diff --git a/tcf/terminals_agent.patch b/tcf/terminals_agent.patch new file mode 100644 index 0000000..d9ca505 --- /dev/null +++ b/tcf/terminals_agent.patch | |||
@@ -0,0 +1,1042 @@ | |||
1 | Index: org.eclipse.tm.tcf.terminals.agent/terminals.c | ||
2 | =================================================================== | ||
3 | --- org.eclipse.tm.tcf.terminals.agent/terminals.c (revision 0) | ||
4 | +++ org.eclipse.tm.tcf.terminals.agent/terminals.c (revision 0) | ||
5 | @@ -0,0 +1,860 @@ | ||
6 | +/******************************************************************************* | ||
7 | + * Copyright (c) 2008 Wind River Systems, Inc. and others. | ||
8 | + * All rights reserved. This program and the accompanying materials | ||
9 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
10 | + * and Eclipse Distribution License v1.0 which accompany this distribution. | ||
11 | + * The Eclipse Public License is available at | ||
12 | + * http://www.eclipse.org/legal/epl-v10.html | ||
13 | + * and the Eclipse Distribution License is available at | ||
14 | + * http://www.eclipse.org/org/documents/edl-v10.php. | ||
15 | + * | ||
16 | + * Contributors: | ||
17 | + * Wind River Systems - initial API and implementation | ||
18 | + * Intel - implemented terminals service | ||
19 | + *******************************************************************************/ | ||
20 | + | ||
21 | +/* | ||
22 | + * Sample TCF service implementation. | ||
23 | + */ | ||
24 | + | ||
25 | +#include <config.h> | ||
26 | +#include <stdlib.h> | ||
27 | +#include <stdio.h> | ||
28 | +#include <string.h> | ||
29 | +#include <errno.h> | ||
30 | +#include <fcntl.h> | ||
31 | +#include <signal.h> | ||
32 | +#include <assert.h> | ||
33 | +#include <termios.h> | ||
34 | +#ifndef TIOCGWINSZ | ||
35 | +#include <sys/ioctl.h> | ||
36 | +#endif | ||
37 | +#include <framework/myalloc.h> | ||
38 | +#include <framework/protocol.h> | ||
39 | +#include <framework/trace.h> | ||
40 | +#include <framework/context.h> | ||
41 | +#include <framework/json.h> | ||
42 | +#include <framework/asyncreq.h> | ||
43 | +#include <framework/exceptions.h> | ||
44 | +#include <framework/waitpid.h> | ||
45 | +#include <framework/signames.h> | ||
46 | +#include <services/streamsservice.h> | ||
47 | +#include <terminals.h> | ||
48 | + | ||
49 | +#define TERMINALS_DEBUG 1 | ||
50 | + | ||
51 | +#define TERMINALS_NO_LOGIN 0 | ||
52 | + | ||
53 | +static const char * TERMINALS = "Terminals"; | ||
54 | + | ||
55 | +#if defined(WIN32) | ||
56 | +# include <tlhelp32.h> | ||
57 | +# ifdef _MSC_VER | ||
58 | +# pragma warning(disable:4201) /* nonstandard extension used : nameless struct/union (in winternl.h) */ | ||
59 | +# include <winternl.h> | ||
60 | +# else | ||
61 | +# include <ntdef.h> | ||
62 | +# endif | ||
63 | +# ifndef STATUS_INFO_LENGTH_MISMATCH | ||
64 | +# define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L) | ||
65 | +# endif | ||
66 | +# ifndef SystemHandleInformation | ||
67 | +# define SystemHandleInformation 16 | ||
68 | +# endif | ||
69 | +# error("unsupported WIN32!") | ||
70 | +#elif defined(_WRS_KERNEL) | ||
71 | +# include <symLib.h> | ||
72 | +# include <sysSymTbl.h> | ||
73 | +# include <ioLib.h> | ||
74 | +# include <ptyDrv.h> | ||
75 | +# include <taskHookLib.h> | ||
76 | +# error("unsupported WRS!") | ||
77 | +#else | ||
78 | +# include <sys/stat.h> | ||
79 | +# include <unistd.h> | ||
80 | +# include <dirent.h> | ||
81 | +# if TERMINALS_NO_LOGIN | ||
82 | +# define TERM_LAUNCH_EXEC "/bin/bash" | ||
83 | +# define TERM_LAUNCH_ARGS {TERM_LAUNCH_EXEC, NULL} | ||
84 | +# else | ||
85 | +# define TERM_LAUNCH_EXEC "/bin/login" | ||
86 | +# define TERM_LAUNCH_ARGS {TERM_LAUNCH_EXEC, "-p", NULL} | ||
87 | +# endif | ||
88 | +#endif | ||
89 | + | ||
90 | +#define PIPE_SIZE 0x1000 | ||
91 | +#define TERM_PROP_DEF_SIZE 256 | ||
92 | + | ||
93 | +typedef struct Terminal | ||
94 | +{ | ||
95 | + LINK link; | ||
96 | + int pid; /*pid of the login process of the terminal*/ | ||
97 | + TCFBroadcastGroup * bcg; | ||
98 | + int inp; | ||
99 | + int out; | ||
100 | + int err; | ||
101 | + struct TerminalInput * inp_struct; | ||
102 | + struct TerminalOutput * out_struct; | ||
103 | + struct TerminalOutput * err_struct; | ||
104 | + char inp_id[256]; | ||
105 | + char out_id[256]; | ||
106 | + char err_id[256]; | ||
107 | + | ||
108 | + char pty_type[TERM_PROP_DEF_SIZE]; | ||
109 | + char encoding[TERM_PROP_DEF_SIZE]; | ||
110 | + unsigned long width; | ||
111 | + unsigned long height; | ||
112 | + long exit_code; | ||
113 | + | ||
114 | + Channel *channel; | ||
115 | +} Terminal; | ||
116 | + | ||
117 | +typedef struct TerminalOutput | ||
118 | +{ | ||
119 | + Terminal * prs; | ||
120 | + AsyncReqInfo req; | ||
121 | + int req_posted; | ||
122 | + char buf[PIPE_SIZE]; | ||
123 | + size_t buf_pos; | ||
124 | + int eos; | ||
125 | + VirtualStream * vstream; | ||
126 | +} TerminalOutput; | ||
127 | + | ||
128 | +typedef struct TerminalInput | ||
129 | +{ | ||
130 | + Terminal * prs; | ||
131 | + AsyncReqInfo req; | ||
132 | + int req_posted; | ||
133 | + char buf[PIPE_SIZE]; | ||
134 | + size_t buf_pos; | ||
135 | + size_t buf_len; | ||
136 | + int eos; | ||
137 | + VirtualStream * vstream; | ||
138 | +} TerminalInput; | ||
139 | + | ||
140 | +#define link2term(A) ((Terminal *)((char *)(A) - offsetof(Terminal, link))) | ||
141 | + | ||
142 | +static LINK terms_list; | ||
143 | +#if defined(_WRS_KERNEL) | ||
144 | +static SEM_ID prs_list_lock = NULL; | ||
145 | +#endif | ||
146 | + | ||
147 | +static Terminal * find_terminal(int pid) | ||
148 | +{ | ||
149 | + LINK * qhp = &terms_list; | ||
150 | + LINK * qp = qhp->next; | ||
151 | + | ||
152 | + while (qp != qhp) { | ||
153 | + Terminal * prs = link2term(qp); | ||
154 | + if (prs->pid == pid) | ||
155 | + return prs; | ||
156 | + qp = qp->next; | ||
157 | + } | ||
158 | + return NULL; | ||
159 | +} | ||
160 | + | ||
161 | +static char * tid2id(int tid) | ||
162 | +{ | ||
163 | + static char s[64]; | ||
164 | + char * p = s + sizeof(s); | ||
165 | + unsigned long n = (long) tid; | ||
166 | + *(--p) = 0; | ||
167 | + do { | ||
168 | + *(--p) = (char) (n % 10 + '0'); | ||
169 | + n = n / 10; | ||
170 | + } while (n != 0); | ||
171 | + | ||
172 | + *(--p) = 'T'; | ||
173 | + return p; | ||
174 | +} | ||
175 | + | ||
176 | +static int id2tid(const char * id) | ||
177 | +{ | ||
178 | + int tid = 0; | ||
179 | + if (id == NULL) | ||
180 | + return 0; | ||
181 | + if (id[0] != 'T') | ||
182 | + return 0; | ||
183 | + if (id[1] == 0) | ||
184 | + return 0; | ||
185 | + tid = (unsigned) strtol(id + 1, (char **) &id, 10); | ||
186 | + if (id[0] != 0) | ||
187 | + return 0; | ||
188 | + return tid; | ||
189 | +} | ||
190 | + | ||
191 | +static void write_context(OutputStream * out, int tid) | ||
192 | +{ | ||
193 | + Terminal * prs = find_terminal(tid); | ||
194 | + | ||
195 | + write_stream(out, '{'); | ||
196 | + | ||
197 | + if (prs != NULL) { | ||
198 | + if (*prs->pty_type) { | ||
199 | + json_write_string(out, "PtyType"); | ||
200 | + write_stream(out, ':'); | ||
201 | + json_write_string(out, prs->pty_type); | ||
202 | + write_stream(out, ','); | ||
203 | + } | ||
204 | + | ||
205 | + if (*prs->encoding) { | ||
206 | + json_write_string(out, "Encoding"); | ||
207 | + write_stream(out, ':'); | ||
208 | + json_write_string(out, prs->encoding); | ||
209 | + write_stream(out, ','); | ||
210 | + } | ||
211 | + | ||
212 | + json_write_string(out, "Width"); | ||
213 | + write_stream(out, ':'); | ||
214 | + json_write_ulong(out, prs->width); | ||
215 | + write_stream(out, ','); | ||
216 | + | ||
217 | + json_write_string(out, "Height"); | ||
218 | + write_stream(out, ':'); | ||
219 | + json_write_ulong(out, prs->height); | ||
220 | + write_stream(out, ','); | ||
221 | + | ||
222 | + if (*prs->inp_id) { | ||
223 | + json_write_string(out, "StdInID"); | ||
224 | + write_stream(out, ':'); | ||
225 | + json_write_string(out, prs->inp_id); | ||
226 | + write_stream(out, ','); | ||
227 | + } | ||
228 | + if (*prs->out_id) { | ||
229 | + json_write_string(out, "StdOutID"); | ||
230 | + write_stream(out, ':'); | ||
231 | + json_write_string(out, prs->out_id); | ||
232 | + write_stream(out, ','); | ||
233 | + } | ||
234 | + if (*prs->err_id) { | ||
235 | + json_write_string(out, "StdErrID"); | ||
236 | + write_stream(out, ':'); | ||
237 | + json_write_string(out, prs->err_id); | ||
238 | + write_stream(out, ','); | ||
239 | + } | ||
240 | + } | ||
241 | + | ||
242 | + json_write_string(out, "ID"); | ||
243 | + write_stream(out, ':'); | ||
244 | + json_write_string(out, tid2id(tid)); | ||
245 | + | ||
246 | + write_stream(out, '}'); | ||
247 | +} | ||
248 | + | ||
249 | +static void send_event_terminal_exited(OutputStream * out, Terminal * prs) | ||
250 | +{ | ||
251 | + write_stringz(out, "E"); | ||
252 | + write_stringz(out, TERMINALS); | ||
253 | + write_stringz(out, "exited"); | ||
254 | + | ||
255 | + json_write_string(out, tid2id(prs->pid)); | ||
256 | + write_stream(out, 0); | ||
257 | + | ||
258 | + json_write_ulong(out, prs->exit_code); | ||
259 | + write_stream(out, 0); | ||
260 | + | ||
261 | + write_stream(out, MARKER_EOM); | ||
262 | +} | ||
263 | + | ||
264 | +static void send_event_terminal_win_size_changed(OutputStream * out, | ||
265 | + Terminal * prs) | ||
266 | +{ | ||
267 | + write_stringz(out, "E"); | ||
268 | + write_stringz(out, TERMINALS); | ||
269 | + write_stringz(out, "winSizeChanged"); | ||
270 | + | ||
271 | + json_write_string(out, tid2id(prs->pid)); | ||
272 | + write_stream(out, 0); | ||
273 | + | ||
274 | + json_write_long(out, prs->width); | ||
275 | + write_stream(out, 0); | ||
276 | + | ||
277 | + json_write_long(out, prs->height); | ||
278 | + write_stream(out, 0); | ||
279 | + | ||
280 | + write_stream(out, MARKER_EOM); | ||
281 | +} | ||
282 | + | ||
283 | +static int kill_term(Terminal *term) | ||
284 | +{ | ||
285 | + int err = 0; | ||
286 | + | ||
287 | +#if defined(WIN32) | ||
288 | + HANDLE h = OpenProcess(PROCESS_TERMINATE, FALSE, term->pid); | ||
289 | + if (h == NULL) | ||
290 | + { | ||
291 | + err = set_win32_errno(GetLastError()); | ||
292 | + } | ||
293 | + else | ||
294 | + { | ||
295 | + if (!TerminateProcess(h, 1)) err = set_win32_errno(GetLastError()); | ||
296 | + if (!CloseHandle(h) && !err) err = set_win32_errno(GetLastError()); | ||
297 | + } | ||
298 | +#else | ||
299 | + if (kill(term->pid, SIGTERM) < 0) | ||
300 | + err = errno; | ||
301 | +#endif | ||
302 | + return err; | ||
303 | +} | ||
304 | + | ||
305 | +static void command_exit(char * token, Channel * c) | ||
306 | +{ | ||
307 | + int err = 0; | ||
308 | + char id[256]; | ||
309 | + unsigned tid; | ||
310 | + Terminal *term = NULL; | ||
311 | + | ||
312 | + json_read_string(&c->inp, id, sizeof(id)); | ||
313 | + if (read_stream(&c->inp) != 0) | ||
314 | + exception(ERR_JSON_SYNTAX); | ||
315 | + if (read_stream(&c->inp) != MARKER_EOM) | ||
316 | + exception(ERR_JSON_SYNTAX); | ||
317 | + | ||
318 | + tid = id2tid(id); | ||
319 | + write_stringz(&c->out, "R"); | ||
320 | + write_stringz(&c->out, token); | ||
321 | + | ||
322 | + if (tid == 0) { | ||
323 | + err = ERR_INV_CONTEXT; | ||
324 | + } else { | ||
325 | + term = find_terminal(tid); | ||
326 | + if (term == NULL) { | ||
327 | + err = ERR_INV_CONTEXT; | ||
328 | + } else { | ||
329 | + err = kill_term(term); | ||
330 | + } | ||
331 | + } | ||
332 | + | ||
333 | + write_errno(&c->out, err); | ||
334 | + write_stream(&c->out, MARKER_EOM); | ||
335 | +} | ||
336 | + | ||
337 | +static void terminal_exited(Terminal * prs) | ||
338 | +{ | ||
339 | + Trap trap; | ||
340 | + | ||
341 | + if (set_trap(&trap)) { | ||
342 | + send_event_terminal_exited(&prs->bcg->out, prs); | ||
343 | + clear_trap(&trap); | ||
344 | + } else { | ||
345 | + trace(LOG_ALWAYS, "Exception sending terminal exited event: %d %s", | ||
346 | + trap.error, errno_to_str(trap.error)); | ||
347 | + } | ||
348 | + | ||
349 | +#if defined(_WRS_KERNEL) | ||
350 | + semTake(prs_list_lock, WAIT_FOREVER); | ||
351 | +#endif | ||
352 | + list_remove(&prs->link); | ||
353 | + close(prs->inp); | ||
354 | + close(prs->out); | ||
355 | + if (prs->out != prs->err) | ||
356 | + close(prs->err); | ||
357 | + if (prs->inp_struct) { | ||
358 | + TerminalInput * inp = prs->inp_struct; | ||
359 | + if (!inp->req_posted) { | ||
360 | + virtual_stream_delete(inp->vstream); | ||
361 | + loc_free(inp); | ||
362 | + } else { | ||
363 | + inp->prs = NULL; | ||
364 | + } | ||
365 | + } | ||
366 | + if (prs->out_struct) | ||
367 | + prs->out_struct->prs = NULL; | ||
368 | + if (prs->err_struct) | ||
369 | + prs->err_struct->prs = NULL; | ||
370 | + loc_free(prs); | ||
371 | +#if defined(_WRS_KERNEL) | ||
372 | + semGive(prs_list_lock); | ||
373 | +#endif | ||
374 | +} | ||
375 | + | ||
376 | +static void terminal_input_streams_callback(VirtualStream * stream, | ||
377 | + int event_code, void * args) | ||
378 | +{ | ||
379 | + TerminalInput * inp = (TerminalInput *) args; | ||
380 | + | ||
381 | + assert(inp->vstream == stream); | ||
382 | + if (!inp->req_posted) { | ||
383 | + if (inp->buf_pos >= inp->buf_len && !inp->eos) { | ||
384 | + inp->buf_pos = inp->buf_len = 0; | ||
385 | + virtual_stream_get_data(stream, inp->buf, sizeof(inp->buf), | ||
386 | + &inp->buf_len, &inp->eos); | ||
387 | + } | ||
388 | + if (inp->buf_pos < inp->buf_len) { | ||
389 | + inp->req.u.fio.bufp = inp->buf + inp->buf_pos; | ||
390 | + inp->req.u.fio.bufsz = inp->buf_len - inp->buf_pos; | ||
391 | + inp->req_posted = 1; | ||
392 | + async_req_post(&inp->req); | ||
393 | + } | ||
394 | + } | ||
395 | +} | ||
396 | + | ||
397 | +static void write_terminal_input_done(void * x) | ||
398 | +{ | ||
399 | + AsyncReqInfo * req = (AsyncReqInfo *) x; | ||
400 | + TerminalInput * inp = (TerminalInput *) req->client_data; | ||
401 | + | ||
402 | + inp->req_posted = 0; | ||
403 | + if (inp->prs == NULL) { | ||
404 | + /* Process has exited */ | ||
405 | + virtual_stream_delete(inp->vstream); | ||
406 | + loc_free(inp); | ||
407 | + } else { | ||
408 | + int wr = inp->req.u.fio.rval; | ||
409 | + | ||
410 | + if (wr < 0) { | ||
411 | + int err = inp->req.error; | ||
412 | + trace(LOG_ALWAYS, "Can't write terminal input stream: %d %s", err, | ||
413 | + errno_to_str(err)); | ||
414 | + inp->buf_pos = inp->buf_len = 0; | ||
415 | + } else { | ||
416 | + inp->buf_pos += wr; | ||
417 | + } | ||
418 | + | ||
419 | + terminal_input_streams_callback(inp->vstream, 0, inp); | ||
420 | + } | ||
421 | +} | ||
422 | + | ||
423 | +static void write_terminal_input(Terminal * prs) | ||
424 | +{ | ||
425 | + TerminalInput * inp = prs->inp_struct = (TerminalInput *) loc_alloc_zero( | ||
426 | + sizeof(TerminalInput)); | ||
427 | + inp->prs = prs; | ||
428 | + inp->req.client_data = inp; | ||
429 | + inp->req.done = write_terminal_input_done; | ||
430 | + inp->req.type = AsyncReqWrite; | ||
431 | + inp->req.u.fio.fd = prs->inp; | ||
432 | + virtual_stream_create(TERMINALS, tid2id(prs->pid), PIPE_SIZE, | ||
433 | + VS_ENABLE_REMOTE_WRITE, terminal_input_streams_callback, inp, | ||
434 | + &inp->vstream); | ||
435 | + virtual_stream_get_id(inp->vstream, prs->inp_id, sizeof(prs->inp_id)); | ||
436 | +} | ||
437 | + | ||
438 | +static void terminal_output_streams_callback(VirtualStream * stream, | ||
439 | + int event_code, void * args) | ||
440 | +{ | ||
441 | + TerminalOutput * out = (TerminalOutput *) args; | ||
442 | + | ||
443 | + assert(out->vstream == stream); | ||
444 | + if (!out->req_posted) { | ||
445 | + int buf_len = out->req.u.fio.rval; | ||
446 | + int err = 0; | ||
447 | + int eos = 0; | ||
448 | + | ||
449 | + if (buf_len < 0) { | ||
450 | + buf_len = 0; | ||
451 | + err = out->req.error; | ||
452 | + } | ||
453 | + if (buf_len == 0) | ||
454 | + eos = 1; | ||
455 | + if (out->prs == NULL) { | ||
456 | + eos = 1; | ||
457 | + err = 0; | ||
458 | + } | ||
459 | + | ||
460 | + assert(buf_len <= (int)sizeof(out->buf)); | ||
461 | + assert(out->buf_pos <= (size_t)buf_len); | ||
462 | + assert(out->req.u.fio.bufp == out->buf); | ||
463 | +#ifdef __linux__ | ||
464 | + if (err == EIO) | ||
465 | + err = 0; | ||
466 | +#endif | ||
467 | + if (err) | ||
468 | + trace(LOG_ALWAYS, "Can't read terminal output stream: %d %s", err, | ||
469 | + errno_to_str(err)); | ||
470 | + | ||
471 | + if (out->buf_pos < (size_t) buf_len || out->eos != eos) { | ||
472 | + size_t done = 0; | ||
473 | + virtual_stream_add_data(stream, out->buf + out->buf_pos, buf_len | ||
474 | + - out->buf_pos, &done, eos); | ||
475 | + out->buf_pos += done; | ||
476 | + if (eos) | ||
477 | + out->eos = 1; | ||
478 | + } | ||
479 | + | ||
480 | + if (out->buf_pos >= (size_t) buf_len) { | ||
481 | + if (!eos) { | ||
482 | + out->req_posted = 1; | ||
483 | + async_req_post(&out->req); | ||
484 | + } else if (virtual_stream_is_empty(stream)) { | ||
485 | + if (out->prs != NULL) { | ||
486 | + if (out == out->prs->out_struct) | ||
487 | + out->prs->out_struct = NULL; | ||
488 | + if (out == out->prs->err_struct) | ||
489 | + out->prs->err_struct = NULL; | ||
490 | + } | ||
491 | + virtual_stream_delete(stream); | ||
492 | + loc_free(out); | ||
493 | + } | ||
494 | + } | ||
495 | + } // end if(!out->req_posted) | ||
496 | +} | ||
497 | + | ||
498 | +static void read_terminal_output_done(void * x) | ||
499 | +{ | ||
500 | + AsyncReqInfo * req = (AsyncReqInfo *) x; | ||
501 | + TerminalOutput * out = (TerminalOutput *) req->client_data; | ||
502 | + | ||
503 | + out->buf_pos = 0; | ||
504 | + out->req_posted = 0; | ||
505 | + terminal_output_streams_callback(out->vstream, 0, out); | ||
506 | +} | ||
507 | + | ||
508 | +static TerminalOutput * read_terminal_output(Terminal * prs, int fd, char * id, | ||
509 | + size_t id_size) | ||
510 | +{ | ||
511 | + TerminalOutput * out = (TerminalOutput *) loc_alloc_zero( | ||
512 | + sizeof(TerminalOutput)); | ||
513 | + out->prs = prs; | ||
514 | + out->req.client_data = out; | ||
515 | + out->req.done = read_terminal_output_done; | ||
516 | + out->req.type = AsyncReqRead; | ||
517 | + out->req.u.fio.bufp = out->buf; | ||
518 | + out->req.u.fio.bufsz = sizeof(out->buf); | ||
519 | + out->req.u.fio.fd = fd; | ||
520 | + virtual_stream_create(TERMINALS, tid2id(prs->pid), PIPE_SIZE, | ||
521 | + VS_ENABLE_REMOTE_READ, terminal_output_streams_callback, out, | ||
522 | + &out->vstream); | ||
523 | + virtual_stream_get_id(out->vstream, id, id_size); | ||
524 | + out->req_posted = 1; | ||
525 | + async_req_post(&out->req); | ||
526 | + return out; | ||
527 | +} | ||
528 | + | ||
529 | +static char **envp_add(char **old_envp, int old_envp_len, char *env) | ||
530 | +{ | ||
531 | + char **new_envp = NULL; | ||
532 | + int i; | ||
533 | + int env_size; | ||
534 | + int old_envp_size; | ||
535 | + | ||
536 | + assert(old_envp || (old_envp==NULL && old_envp_len==0)); | ||
537 | + assert(env); | ||
538 | + assert(*env); | ||
539 | + | ||
540 | + for (i = 0, old_envp_size = 0; i < old_envp_len; i++) { | ||
541 | + old_envp_size += sizeof(char *); //size of env pointer | ||
542 | + old_envp_size += strlen(old_envp[i]) + 1; //size of env string, including trailing '\0' | ||
543 | + } | ||
544 | + assert((old_envp && old_envp[i]==NULL) || (old_envp==NULL)); | ||
545 | + old_envp_size += sizeof(char *);//last null pointer | ||
546 | + | ||
547 | + env_size = strlen(env); //new env string size | ||
548 | + | ||
549 | + new_envp = loc_alloc(old_envp_size + sizeof(char *) + env_size + 1); | ||
550 | + if (new_envp != NULL) { | ||
551 | + new_envp[0] = (char *) new_envp + old_envp_size + sizeof(char *); //setting new env ptr | ||
552 | + strcpy(new_envp[0], env); //copy new env string | ||
553 | + if (old_envp) { | ||
554 | + memcpy(&new_envp[1], old_envp, old_envp_size); //copy old envp | ||
555 | + } else { | ||
556 | + new_envp[1] = NULL; | ||
557 | + } | ||
558 | + } | ||
559 | + return new_envp; | ||
560 | +} | ||
561 | + | ||
562 | +static int start_terminal(Channel * c, char *pty_type, char *encoding, | ||
563 | + char ** envp, int envp_len, char * exe, char ** args, int *pid, | ||
564 | + Terminal ** prs) | ||
565 | +{ | ||
566 | + int err = 0; | ||
567 | + int fd_tty_master = -1; | ||
568 | + char * tty_slave_name = NULL; | ||
569 | + struct winsize size; | ||
570 | + char **newenvp = envp; | ||
571 | + | ||
572 | + memset(&size, 0, sizeof(struct winsize)); | ||
573 | + fd_tty_master = posix_openpt(O_RDWR | O_NOCTTY); | ||
574 | + if (fd_tty_master < 0 || grantpt(fd_tty_master) < 0 || unlockpt( | ||
575 | + fd_tty_master) < 0) | ||
576 | + err = errno; | ||
577 | + if (!err) { | ||
578 | + tty_slave_name = ptsname(fd_tty_master); | ||
579 | + if (tty_slave_name == NULL) | ||
580 | + err = EINVAL; | ||
581 | + } | ||
582 | + | ||
583 | + if (ioctl(fd_tty_master, TIOCGWINSZ, (char *) &size) < 0) | ||
584 | + err = errno; | ||
585 | + | ||
586 | + if (!err && fd_tty_master < 3) { | ||
587 | + int fd0 = fd_tty_master; | ||
588 | + if ((fd_tty_master = dup(fd_tty_master)) < 0 || close(fd0)) | ||
589 | + err = errno; | ||
590 | + } | ||
591 | + | ||
592 | + if (!err) { | ||
593 | + *pid = fork(); | ||
594 | + if (*pid < 0) | ||
595 | + err = errno; | ||
596 | + if (*pid == 0) { | ||
597 | + int fd = -1; | ||
598 | + int fd_tty_slave = -1; | ||
599 | + char env_term[TERM_PROP_DEF_SIZE]; | ||
600 | + | ||
601 | + if (*pty_type) { | ||
602 | + snprintf(env_term, sizeof(env_term), "TERM=%s", pty_type); | ||
603 | + newenvp = envp_add(envp, envp_len, env_term); | ||
604 | + if (newenvp == NULL) { | ||
605 | + err = ENOMEM; | ||
606 | + } else if (envp) { | ||
607 | + loc_free(envp); | ||
608 | + envp = NULL; | ||
609 | + } | ||
610 | + } | ||
611 | + | ||
612 | + if (!err && *encoding) { | ||
613 | + envp = newenvp; | ||
614 | + envp_len += 1; | ||
615 | + snprintf(env_term, sizeof(env_term), "LANG=%s", encoding); | ||
616 | + newenvp = envp_add(envp, envp_len, env_term); | ||
617 | + if (newenvp == NULL) { | ||
618 | + err = ENOMEM; | ||
619 | + } else if (envp) { | ||
620 | + loc_free(envp); | ||
621 | + envp = NULL; | ||
622 | + } | ||
623 | + } | ||
624 | + | ||
625 | + setsid(); | ||
626 | + | ||
627 | + if (!err && (fd = sysconf(_SC_OPEN_MAX)) < 0) | ||
628 | + err = errno; | ||
629 | + if (!err && (fd_tty_slave = open(tty_slave_name, O_RDWR)) < 0) | ||
630 | + err = errno; | ||
631 | +#if defined(TIOCSCTTY) | ||
632 | + if (!err && (ioctl(fd_tty_slave, TIOCSCTTY, (char *) 0)) < 0) | ||
633 | + err = errno; | ||
634 | +#endif | ||
635 | + if (!err && dup2(fd_tty_slave, 0) < 0) | ||
636 | + err = errno; | ||
637 | + if (!err && dup2(fd_tty_slave, 1) < 0) | ||
638 | + err = errno; | ||
639 | + if (!err && dup2(fd_tty_slave, 2) < 0) | ||
640 | + err = errno; | ||
641 | + while (!err && fd > 3) | ||
642 | + close(--fd); | ||
643 | + if (!err) { | ||
644 | + execve(exe, args, newenvp); | ||
645 | + err = errno; | ||
646 | + } | ||
647 | + if (newenvp) | ||
648 | + loc_free(newenvp); | ||
649 | + err = 1; | ||
650 | + if (err < 1) | ||
651 | + err = EINVAL; | ||
652 | + else if (err > 0xff) | ||
653 | + err = EINVAL; | ||
654 | + exit(err); | ||
655 | + } | ||
656 | + } | ||
657 | + | ||
658 | + if (!err) { | ||
659 | + *prs = (Terminal *) loc_alloc_zero(sizeof(Terminal)); | ||
660 | + (*prs)->inp = fd_tty_master; | ||
661 | + (*prs)->out = fd_tty_master; | ||
662 | + (*prs)->err = fd_tty_master; | ||
663 | + (*prs)->pid = *pid; | ||
664 | + (*prs)->bcg = c->bcg; | ||
665 | + (*prs)->channel = c; | ||
666 | + if (*pty_type) | ||
667 | + snprintf((*prs)->pty_type, sizeof((*prs)->pty_type), "%s", pty_type); | ||
668 | + if (*encoding) | ||
669 | + snprintf((*prs)->encoding, sizeof((*prs)->encoding), "%s", encoding); | ||
670 | + (*prs)->width = size.ws_row; | ||
671 | + (*prs)->height = size.ws_col; | ||
672 | + list_add_first(&(*prs)->link, &terms_list); | ||
673 | + } | ||
674 | + | ||
675 | + if (!err) | ||
676 | + return 0; | ||
677 | + errno = err; | ||
678 | + return -1; | ||
679 | +} | ||
680 | + | ||
681 | +static void command_get_context(char * token, Channel * c) | ||
682 | +{ | ||
683 | + int err = 0; | ||
684 | + char id[256]; | ||
685 | + int tid; | ||
686 | + Terminal *term; | ||
687 | + | ||
688 | + json_read_string(&c->inp, id, sizeof(id)); | ||
689 | + if (read_stream(&c->inp) != 0) | ||
690 | + exception(ERR_JSON_SYNTAX); | ||
691 | + if (read_stream(&c->inp) != MARKER_EOM) | ||
692 | + exception(ERR_JSON_SYNTAX); | ||
693 | + | ||
694 | + tid = id2tid(id); | ||
695 | + write_stringz(&c->out, "R"); | ||
696 | + write_stringz(&c->out, token); | ||
697 | + | ||
698 | + if (tid == 0) { | ||
699 | + err = ERR_INV_CONTEXT; | ||
700 | + } else { | ||
701 | + term = find_terminal(tid); | ||
702 | + if (term == NULL) { | ||
703 | + err = ERR_INV_CONTEXT; | ||
704 | + } else { | ||
705 | + write_context(&c->out, tid); | ||
706 | + write_stream(&c->out, 0); | ||
707 | + } | ||
708 | + } | ||
709 | + | ||
710 | + write_errno(&c->out, err); | ||
711 | + write_stream(&c->out, MARKER_EOM); | ||
712 | +} | ||
713 | + | ||
714 | +static void command_launch(char * token, Channel * c) | ||
715 | +{ | ||
716 | + int pid = 0; | ||
717 | + int err = 0; | ||
718 | + char encoding[TERM_PROP_DEF_SIZE]; | ||
719 | + char pty_type[TERM_PROP_DEF_SIZE]; | ||
720 | + char *args[] = TERM_LAUNCH_ARGS; | ||
721 | + | ||
722 | + char ** envp = NULL; | ||
723 | + int envp_len = 0; | ||
724 | + | ||
725 | + Terminal * prs = NULL; | ||
726 | + Trap trap; | ||
727 | + | ||
728 | + if (set_trap(&trap)) { | ||
729 | + json_read_string(&c->inp, pty_type, sizeof(pty_type)); | ||
730 | + if (read_stream(&c->inp) != 0) | ||
731 | + exception(ERR_JSON_SYNTAX); | ||
732 | + json_read_string(&c->inp, encoding, sizeof(encoding)); | ||
733 | + if (read_stream(&c->inp) != 0) | ||
734 | + exception(ERR_JSON_SYNTAX); | ||
735 | + envp = json_read_alloc_string_array(&c->inp, &envp_len); | ||
736 | + if (read_stream(&c->inp) != 0) | ||
737 | + exception(ERR_JSON_SYNTAX); | ||
738 | + if (read_stream(&c->inp) != MARKER_EOM) | ||
739 | + exception(ERR_JSON_SYNTAX); | ||
740 | + | ||
741 | + if (err == 0 && start_terminal(c, pty_type, encoding, envp, envp_len, | ||
742 | + TERM_LAUNCH_EXEC, args, &pid, &prs) < 0) | ||
743 | + err = errno; | ||
744 | + if (prs != NULL) { | ||
745 | + write_terminal_input(prs); | ||
746 | + prs->out_struct = read_terminal_output(prs, prs->out, prs->out_id, | ||
747 | + sizeof(prs->out_id)); | ||
748 | + if (prs->out != prs->err) | ||
749 | + prs->err_struct = read_terminal_output(prs, prs->err, | ||
750 | + prs->err_id, sizeof(prs->err_id)); | ||
751 | + } | ||
752 | + if (!err) { | ||
753 | + add_waitpid_process(pid); | ||
754 | + } | ||
755 | + //write result back | ||
756 | + { | ||
757 | + write_stringz(&c->out, "R"); | ||
758 | + write_stringz(&c->out, token); | ||
759 | + write_errno(&c->out, err); | ||
760 | + if (err || pid == 0) { | ||
761 | + write_stringz(&c->out, "null"); | ||
762 | + } else { | ||
763 | + write_context(&c->out, pid); | ||
764 | + write_stream(&c->out, 0); | ||
765 | + } | ||
766 | + write_stream(&c->out, MARKER_EOM); | ||
767 | + } | ||
768 | + clear_trap(&trap); | ||
769 | + } | ||
770 | + | ||
771 | + loc_free(envp); | ||
772 | + | ||
773 | + if (trap.error) | ||
774 | + exception(trap.error); | ||
775 | +} | ||
776 | + | ||
777 | +static void command_set_win_size(char * token, Channel * c) | ||
778 | +{ | ||
779 | + int err = 0; | ||
780 | + struct winsize size; | ||
781 | + char id[256]; | ||
782 | + unsigned tid; | ||
783 | + Terminal *term = NULL; | ||
784 | + | ||
785 | + json_read_string(&c->inp, id, sizeof(id)); | ||
786 | + if (read_stream(&c->inp) != 0) | ||
787 | + exception(ERR_JSON_SYNTAX); | ||
788 | + size.ws_col=json_read_ulong(&c->inp); | ||
789 | + if (read_stream(&c->inp) != 0) | ||
790 | + exception(ERR_JSON_SYNTAX); | ||
791 | + size.ws_row=json_read_ulong(&c->inp); | ||
792 | + if (read_stream(&c->inp) != 0) | ||
793 | + exception(ERR_JSON_SYNTAX); | ||
794 | + if (read_stream(&c->inp) != MARKER_EOM) | ||
795 | + exception(ERR_JSON_SYNTAX); | ||
796 | + | ||
797 | + tid = id2tid(id); | ||
798 | + | ||
799 | + if(tid==0 || (term=find_terminal(tid))==NULL) { | ||
800 | + err=ERR_INV_CONTEXT; | ||
801 | + }else if (term->width != size.ws_col || term->height != size.ws_row) { | ||
802 | + if(ioctl(term->inp,TIOCSWINSZ,&size)<0) { | ||
803 | + err=errno; | ||
804 | + } | ||
805 | + if(!err) { | ||
806 | + term->width=size.ws_col; | ||
807 | + term->height=size.ws_row; | ||
808 | + send_event_terminal_win_size_changed(&term->channel->out,term); | ||
809 | + } | ||
810 | + } | ||
811 | + | ||
812 | + write_stringz(&c->out, "R"); | ||
813 | + write_stringz(&c->out, token); | ||
814 | + write_errno(&c->out, err); | ||
815 | + write_stream(&c->out, MARKER_EOM); | ||
816 | + | ||
817 | +} | ||
818 | + | ||
819 | +static void waitpid_listener(int pid, int exited, int exit_code, int signal, | ||
820 | + int event_code, int syscall, void * args) | ||
821 | +{ | ||
822 | + if (exited) { | ||
823 | + Terminal * prs = find_terminal(pid); | ||
824 | + if (prs) { | ||
825 | + if (signal != 0) | ||
826 | + prs->exit_code = -signal; | ||
827 | + else | ||
828 | + prs->exit_code = exit_code; | ||
829 | + terminal_exited(prs); | ||
830 | + } | ||
831 | + } | ||
832 | +} | ||
833 | + | ||
834 | +static void channel_close_listener(Channel * c) | ||
835 | +{ | ||
836 | + LINK * l = NULL; | ||
837 | + | ||
838 | + for (l = terms_list.next; l != &terms_list;) { | ||
839 | + Terminal * term = link2term(l); | ||
840 | + l = l->next; | ||
841 | + if (term->channel == c) { | ||
842 | + trace(LOG_ALWAYS, "Terminal is left launched: T%d", term->pid); | ||
843 | + kill_term(term); | ||
844 | + } | ||
845 | + } | ||
846 | +} | ||
847 | + | ||
848 | +void ini_terminals_service(Protocol * proto) | ||
849 | +{ | ||
850 | +#if defined(_WRS_KERNEL) | ||
851 | + prs_list_lock = semMCreate(SEM_Q_PRIORITY); | ||
852 | + if (prs_list_lock == NULL) check_error(errno); | ||
853 | + if (taskCreateHookAdd((FUNCPTR)task_create_hook) != OK) check_error(errno); | ||
854 | + if (taskDeleteHookAdd((FUNCPTR)task_delete_hook) != OK) check_error(errno); | ||
855 | +#endif | ||
856 | + list_init(&terms_list); | ||
857 | + | ||
858 | + add_waitpid_listener(waitpid_listener, NULL); | ||
859 | + add_channel_close_listener(channel_close_listener); | ||
860 | + | ||
861 | + add_command_handler(proto, TERMINALS, "getContext", command_get_context); | ||
862 | + add_command_handler(proto, TERMINALS, "launch", command_launch); | ||
863 | + add_command_handler(proto, TERMINALS, "exit", command_exit); | ||
864 | + add_command_handler(proto, TERMINALS, "setWinSize", command_set_win_size); | ||
865 | +} | ||
866 | Index: org.eclipse.tm.tcf.terminals.agent/main/services-ext.h | ||
867 | =================================================================== | ||
868 | --- org.eclipse.tm.tcf.terminals.agent/main/services-ext.h (revision 0) | ||
869 | +++ org.eclipse.tm.tcf.terminals.agent/main/services-ext.h (revision 0) | ||
870 | @@ -0,0 +1,26 @@ | ||
871 | +/******************************************************************************* | ||
872 | + * Copyright (c) 2007, 2010 Wind River Systems, Inc. and others. | ||
873 | + * All rights reserved. This program and the accompanying materials | ||
874 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
875 | + * and Eclipse Distribution License v1.0 which accompany this distribution. | ||
876 | + * The Eclipse Public License is available at | ||
877 | + * http://www.eclipse.org/legal/epl-v10.html | ||
878 | + * and the Eclipse Distribution License is available at | ||
879 | + * http://www.eclipse.org/org/documents/edl-v10.php. | ||
880 | + * | ||
881 | + * Contributors: | ||
882 | + * Wind River Systems - initial API and implementation | ||
883 | + * Intel - implemented terminals service | ||
884 | + *******************************************************************************/ | ||
885 | + | ||
886 | +/* | ||
887 | + * Services initialization code extension point. | ||
888 | + * If the agent is built with additional user-defined services, | ||
889 | + * a customized version of services-ext.h file can be added to compiler headers search paths. | ||
890 | + */ | ||
891 | + | ||
892 | +#include "terminals.h" | ||
893 | + | ||
894 | +static void ini_ext_services(Protocol * proto, TCFBroadcastGroup * bcg) { | ||
895 | + ini_terminals_service(proto); | ||
896 | +} | ||
897 | Index: org.eclipse.tm.tcf.terminals.agent/terminals.h | ||
898 | =================================================================== | ||
899 | --- org.eclipse.tm.tcf.terminals.agent/terminals.h (revision 0) | ||
900 | +++ org.eclipse.tm.tcf.terminals.agent/terminals.h (revision 0) | ||
901 | @@ -0,0 +1,28 @@ | ||
902 | +/******************************************************************************* | ||
903 | + * Copyright (c) 2008 Wind River Systems, Inc. and others. | ||
904 | + * All rights reserved. This program and the accompanying materials | ||
905 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
906 | + * and Eclipse Distribution License v1.0 which accompany this distribution. | ||
907 | + * The Eclipse Public License is available at | ||
908 | + * http://www.eclipse.org/legal/epl-v10.html | ||
909 | + * and the Eclipse Distribution License is available at | ||
910 | + * http://www.eclipse.org/org/documents/edl-v10.php. | ||
911 | + * | ||
912 | + * Contributors: | ||
913 | + * Wind River Systems - initial API and implementation | ||
914 | + * Intel - implemented terminals service | ||
915 | + *******************************************************************************/ | ||
916 | + | ||
917 | +/* | ||
918 | + * TCF terminals service header file. | ||
919 | + */ | ||
920 | + | ||
921 | +#ifndef TERMINALS_H_ | ||
922 | +#define TERMINALS_H_ | ||
923 | + | ||
924 | +#include <config.h> | ||
925 | +#include <framework/protocol.h> | ||
926 | + | ||
927 | +extern void ini_terminals_service(Protocol * proto); | ||
928 | + | ||
929 | +#endif /*TERMINALS_H_*/ | ||
930 | Index: org.eclipse.tm.tcf.terminals.agent/config.h | ||
931 | =================================================================== | ||
932 | --- org.eclipse.tm.tcf.terminals.agent/config.h (revision 0) | ||
933 | +++ org.eclipse.tm.tcf.terminals.agent/config.h (revision 0) | ||
934 | @@ -0,0 +1,64 @@ | ||
935 | +/******************************************************************************* | ||
936 | + * Copyright (c) 2008 Wind River Systems, Inc. and others. | ||
937 | + * All rights reserved. This program and the accompanying materials | ||
938 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
939 | + * and Eclipse Distribution License v1.0 which accompany this distribution. | ||
940 | + * The Eclipse Public License is available at | ||
941 | + * http://www.eclipse.org/legal/epl-v10.html | ||
942 | + * and the Eclipse Distribution License is available at | ||
943 | + * http://www.eclipse.org/org/documents/edl-v10.php. | ||
944 | + * | ||
945 | + * Contributors: | ||
946 | + * Wind River Systems - initial API and implementation | ||
947 | + * Intel - implemented terminals service | ||
948 | + *******************************************************************************/ | ||
949 | + | ||
950 | +/* | ||
951 | + * This file contains "define" statements that control agent configuration. | ||
952 | + * SERVICE_* definitions control which service implementations are included into the agent. | ||
953 | + * | ||
954 | + * This is example agent configuration. It includes only few standard services, | ||
955 | + * and one example service: Day Time. | ||
956 | + */ | ||
957 | + | ||
958 | +#ifndef D_config | ||
959 | +#define D_config | ||
960 | + | ||
961 | +#include <framework/mdep.h> | ||
962 | + | ||
963 | +#if defined(WIN32) || defined(__CYGWIN__) | ||
964 | +# define TARGET_UNIX 0 | ||
965 | +#elif defined(_WRS_KERNEL) | ||
966 | +# define TARGET_UNIX 0 | ||
967 | +#else | ||
968 | +# define TARGET_UNIX 1 | ||
969 | +#endif | ||
970 | + | ||
971 | +#define SERVICE_Locator 1 | ||
972 | +#define SERVICE_Processes 1 | ||
973 | +#define SERVICE_Streams 1 | ||
974 | +#define SERVICE_FileSystem 1 | ||
975 | +#define SERVICE_SysMonitor TARGET_UNIX | ||
976 | + | ||
977 | +#define ENABLE_ZeroCopy 1 | ||
978 | + | ||
979 | +#if !defined(ENABLE_Splice) | ||
980 | +# if ENABLE_ZeroCopy | ||
981 | +# include <fcntl.h> | ||
982 | +# if defined(SPLICE_F_MOVE) | ||
983 | +# define ENABLE_Splice 1 | ||
984 | +# else | ||
985 | +# define ENABLE_Splice 0 | ||
986 | +# endif | ||
987 | +# else | ||
988 | +# define ENABLE_Splice 0 | ||
989 | +# endif | ||
990 | +#endif | ||
991 | + | ||
992 | +#define ENABLE_SSL 0 | ||
993 | + | ||
994 | +#define ENABLE_Trace 1 | ||
995 | +#define ENABLE_Discovery 1 | ||
996 | + | ||
997 | + | ||
998 | +#endif /* D_config */ | ||
999 | Index: org.eclipse.tm.tcf.terminals.agent/Makefile | ||
1000 | =================================================================== | ||
1001 | --- org.eclipse.tm.tcf.terminals.agent/Makefile (revision 0) | ||
1002 | +++ org.eclipse.tm.tcf.terminals.agent/Makefile (revision 0) | ||
1003 | @@ -0,0 +1,39 @@ | ||
1004 | +TCF_AGENT_DIR=../agent | ||
1005 | + | ||
1006 | +include $(TCF_AGENT_DIR)/Makefile.inc | ||
1007 | + | ||
1008 | +override CFLAGS += $(foreach dir,$(INCDIRS),-I$(dir)) $(OPTS) | ||
1009 | + | ||
1010 | +HFILES := $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.h)) $(HFILES) | ||
1011 | +CFILES := $(sort $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.c)) $(CFILES)) | ||
1012 | + | ||
1013 | +#no using SSL | ||
1014 | +LIBS = -lpthread -lrt | ||
1015 | + | ||
1016 | +EXECS = $(BINDIR)/agent$(EXTEXE) | ||
1017 | + | ||
1018 | +all: $(EXECS) | ||
1019 | + | ||
1020 | +$(BINDIR)/libtcf$(EXTLIB) : $(OFILES) | ||
1021 | + $(AR) rcs $@ $^ | ||
1022 | + | ||
1023 | +$(BINDIR)/agent$(EXTEXE): $(BINDIR)/main/main$(EXTOBJ) $(BINDIR)/libtcf$(EXTLIB) | ||
1024 | + $(CC) $(CFLAGS) -o $@ $(BINDIR)/main/main$(EXTOBJ) $(BINDIR)/libtcf$(EXTLIB) $(LIBS) | ||
1025 | + | ||
1026 | +$(BINDIR)/%$(EXTOBJ): %.c $(HFILES) Makefile | ||
1027 | + @mkdir -p $(dir $@) | ||
1028 | + $(CC) $(CFLAGS) -c -o $@ $< | ||
1029 | + | ||
1030 | +$(BINDIR)/%$(EXTOBJ): $(TCF_AGENT_DIR)/%.c $(HFILES) Makefile | ||
1031 | + @mkdir -p $(dir $@) | ||
1032 | + $(CC) $(CFLAGS) -c -o $@ $< | ||
1033 | + | ||
1034 | +install: all | ||
1035 | + install -d -m 755 $(INSTALLROOT)$(SBIN) | ||
1036 | + install -d -m 755 $(INSTALLROOT)$(INIT) | ||
1037 | + install -c $(BINDIR)/agent -m 755 $(INSTALLROOT)$(SBIN)/tcf-agent | ||
1038 | + install -c $(TCF_AGENT_DIR)/main/tcf-agent.init -m 755 $(INSTALLROOT)$(INIT)/tcf-agent | ||
1039 | + | ||
1040 | +clean: | ||
1041 | + rm -rf $(BINDIR) | ||
1042 | + | ||
diff --git a/tcf/terminals_plugin.patch b/tcf/terminals_plugin.patch new file mode 100644 index 0000000..352e151 --- /dev/null +++ b/tcf/terminals_plugin.patch | |||
@@ -0,0 +1,618 @@ | |||
1 | Index: plugins/org.eclipse.tm.tcf.terminals/META-INF/MANIFEST.MF | ||
2 | =================================================================== | ||
3 | --- plugins/org.eclipse.tm.tcf.terminals/META-INF/MANIFEST.MF (revision 0) | ||
4 | +++ plugins/org.eclipse.tm.tcf.terminals/META-INF/MANIFEST.MF (revision 0) | ||
5 | @@ -0,0 +1,14 @@ | ||
6 | +Manifest-Version: 1.0 | ||
7 | +Bundle-ManifestVersion: 2 | ||
8 | +Bundle-Name: %pluginName | ||
9 | +Bundle-SymbolicName: org.eclipse.tm.tcf.terminals;singleton:=true | ||
10 | +Bundle-Version: 0.3.0.qualifier | ||
11 | +Bundle-Activator: org.eclipse.tm.internal.tcf.terminals.Activator | ||
12 | +Bundle-Vendor: %providerName | ||
13 | +Require-Bundle: org.eclipse.core.runtime, | ||
14 | + org.eclipse.tm.tcf | ||
15 | +Bundle-ActivationPolicy: lazy | ||
16 | +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 | ||
17 | +Import-Package: org.eclipse.tm.tcf.core;version="0.3.0", | ||
18 | + org.eclipse.tm.tcf.protocol;version="0.3.0" | ||
19 | +Export-Package: org.eclipse.tm.internal.tcf.terminals | ||
20 | Index: plugins/org.eclipse.tm.tcf.terminals/.classpath | ||
21 | =================================================================== | ||
22 | --- plugins/org.eclipse.tm.tcf.terminals/.classpath (revision 0) | ||
23 | +++ plugins/org.eclipse.tm.tcf.terminals/.classpath (revision 0) | ||
24 | @@ -0,0 +1,7 @@ | ||
25 | +<?xml version="1.0" encoding="UTF-8"?> | ||
26 | +<classpath> | ||
27 | + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
28 | + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
29 | + <classpathentry kind="src" path="src"/> | ||
30 | + <classpathentry kind="output" path="bin"/> | ||
31 | +</classpath> | ||
32 | Index: plugins/org.eclipse.tm.tcf.terminals/.project | ||
33 | =================================================================== | ||
34 | --- plugins/org.eclipse.tm.tcf.terminals/.project (revision 0) | ||
35 | +++ plugins/org.eclipse.tm.tcf.terminals/.project (revision 0) | ||
36 | @@ -0,0 +1,28 @@ | ||
37 | +<?xml version="1.0" encoding="UTF-8"?> | ||
38 | +<projectDescription> | ||
39 | + <name>org.eclipse.tm.tcf.terminals</name> | ||
40 | + <comment></comment> | ||
41 | + <projects> | ||
42 | + </projects> | ||
43 | + <buildSpec> | ||
44 | + <buildCommand> | ||
45 | + <name>org.eclipse.jdt.core.javabuilder</name> | ||
46 | + <arguments> | ||
47 | + </arguments> | ||
48 | + </buildCommand> | ||
49 | + <buildCommand> | ||
50 | + <name>org.eclipse.pde.ManifestBuilder</name> | ||
51 | + <arguments> | ||
52 | + </arguments> | ||
53 | + </buildCommand> | ||
54 | + <buildCommand> | ||
55 | + <name>org.eclipse.pde.SchemaBuilder</name> | ||
56 | + <arguments> | ||
57 | + </arguments> | ||
58 | + </buildCommand> | ||
59 | + </buildSpec> | ||
60 | + <natures> | ||
61 | + <nature>org.eclipse.pde.PluginNature</nature> | ||
62 | + <nature>org.eclipse.jdt.core.javanature</nature> | ||
63 | + </natures> | ||
64 | +</projectDescription> | ||
65 | Index: plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/TerminalsServiceProxy.java | ||
66 | =================================================================== | ||
67 | --- plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/TerminalsServiceProxy.java (revision 0) | ||
68 | +++ plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/TerminalsServiceProxy.java (revision 0) | ||
69 | @@ -0,0 +1,191 @@ | ||
70 | +/******************************************************************************* | ||
71 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
72 | + * All rights reserved. This program and the accompanying materials | ||
73 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
74 | + * which accompanies this distribution, and is available at | ||
75 | + * http://www.eclipse.org/legal/epl-v10.html | ||
76 | + * | ||
77 | + * Contributors: | ||
78 | + * Intel - initial API and implementation | ||
79 | + *******************************************************************************/ | ||
80 | + | ||
81 | +package org.eclipse.tm.internal.tcf.terminals; | ||
82 | + | ||
83 | +import java.io.IOException; | ||
84 | +import java.util.HashMap; | ||
85 | +import java.util.Map; | ||
86 | + | ||
87 | +import org.eclipse.tm.internal.tcf.terminals.ITerminalsService; | ||
88 | +import org.eclipse.tm.tcf.core.Command; | ||
89 | +import org.eclipse.tm.tcf.protocol.IChannel; | ||
90 | +import org.eclipse.tm.tcf.protocol.IToken; | ||
91 | +import org.eclipse.tm.tcf.protocol.JSON; | ||
92 | +import org.eclipse.tm.tcf.protocol.Protocol; | ||
93 | + | ||
94 | +public class TerminalsServiceProxy implements ITerminalsService { | ||
95 | + | ||
96 | + private final IChannel channel; | ||
97 | + private final Map<TerminalsListener,IChannel.IEventListener> listeners = | ||
98 | + new HashMap<TerminalsListener,IChannel.IEventListener>(); | ||
99 | + | ||
100 | + private class TerminalContext implements ITerminalsService.TerminalContext { | ||
101 | + | ||
102 | + private final Map<String,Object> props; | ||
103 | + | ||
104 | + TerminalContext(Map<String,Object> props) { | ||
105 | + this.props = props; | ||
106 | + } | ||
107 | + | ||
108 | + public String getID() { | ||
109 | + return (String)props.get(PROP_ID); | ||
110 | + } | ||
111 | + | ||
112 | + public String getPtyType() { | ||
113 | + return (String)props.get(PROP_PTY_TYPE); | ||
114 | + } | ||
115 | + | ||
116 | + public String getEncoding() { | ||
117 | + return (String)props.get(PROP_ENCODING); | ||
118 | + } | ||
119 | + | ||
120 | + public int getWidth() { | ||
121 | + return ((Integer)props.get(PROP_WIDTH)).intValue(); | ||
122 | + } | ||
123 | + | ||
124 | + public int getHeight() { | ||
125 | + return ((Integer)props.get(PROP_HEIGHT)).intValue(); | ||
126 | + } | ||
127 | + | ||
128 | + public IToken exit(final DoneCommand done) { | ||
129 | + return new Command(channel, TerminalsServiceProxy.this, | ||
130 | + "exit", new Object[]{ getID() }) { | ||
131 | + @Override | ||
132 | + public void done(Exception error, Object[] args) { | ||
133 | + if (error == null) { | ||
134 | + assert args.length == 1; | ||
135 | + error = toError(args[0]); | ||
136 | + } | ||
137 | + done.doneCommand(token, error); | ||
138 | + } | ||
139 | + }.token; | ||
140 | + } | ||
141 | + | ||
142 | + public Map<String, Object> getProperties() { | ||
143 | + return props; | ||
144 | + } | ||
145 | + | ||
146 | + public String toString() { | ||
147 | + return "[Terminals Context " + props.toString() + "]"; | ||
148 | + } | ||
149 | + } | ||
150 | + | ||
151 | + TerminalsServiceProxy(IChannel channel) { | ||
152 | + this.channel = channel; | ||
153 | + } | ||
154 | + | ||
155 | + /** | ||
156 | + * Return service name, as it appears on the wire - a TCF name of the service. | ||
157 | + */ | ||
158 | + public String getName() { | ||
159 | + return NAME; | ||
160 | + } | ||
161 | + | ||
162 | + public IToken getContext(String id, final DoneGetContext done) | ||
163 | + { | ||
164 | + return new Command(channel, this, | ||
165 | + "getContext", new Object[]{ id }) { | ||
166 | + @SuppressWarnings("unchecked") | ||
167 | + @Override | ||
168 | + public void done(Exception error, Object[] args) { | ||
169 | + TerminalContext ctx = null; | ||
170 | + if (error == null) { | ||
171 | + assert args.length == 2; | ||
172 | + error = toError(args[0]); | ||
173 | + if (args[1] != null) ctx = new TerminalContext((Map<String, Object>)args[1]); | ||
174 | + } | ||
175 | + done.doneGetContext(token, error, ctx); | ||
176 | + } | ||
177 | + }.token; | ||
178 | + } | ||
179 | + | ||
180 | + public IToken launch(String type, String encoding, String[] environment, final DoneLaunch done) | ||
181 | + { | ||
182 | + return new Command(channel, this, "launch", | ||
183 | + new Object[]{ type, encoding, environment}) { | ||
184 | + @SuppressWarnings("unchecked") | ||
185 | + @Override | ||
186 | + public void done(Exception error, Object[] args) { | ||
187 | + TerminalContext ctx=null; | ||
188 | + if (error == null) { | ||
189 | + assert args.length == 2; | ||
190 | + error = toError(args[0]); | ||
191 | + if (args[1] != null) ctx = new TerminalContext((Map<String, Object>)args[1]); | ||
192 | + } | ||
193 | + done.doneLaunch(token, error, ctx); | ||
194 | + } | ||
195 | + }.token; | ||
196 | + } | ||
197 | + | ||
198 | + public IToken setWinSize(String context_id, int newWidth, int newHeight, final DoneCommand done) | ||
199 | + { | ||
200 | + return new Command(channel, this, "setWinSize", | ||
201 | + new Object[]{ context_id, newWidth, newHeight}) { | ||
202 | + @Override | ||
203 | + public void done(Exception error, Object[] args) { | ||
204 | + if (error == null) { | ||
205 | + assert args.length == 1; | ||
206 | + error = toError(args[0]); | ||
207 | + } | ||
208 | + done.doneCommand(token, error); | ||
209 | + } | ||
210 | + }.token; | ||
211 | + } | ||
212 | + | ||
213 | + public void addListener(final TerminalsListener listener) | ||
214 | + { | ||
215 | + IChannel.IEventListener l = new IChannel.IEventListener() { | ||
216 | + public void event(String name, byte[] data) { | ||
217 | + try { | ||
218 | + Object[] args = JSON.parseSequence(data); | ||
219 | + if (name.equals("exited")) { | ||
220 | + assert args.length == 2; | ||
221 | + listener.exited((String)args[0], ((Number)args[1]).intValue()); | ||
222 | + }else if(name.equals("winSizeChanged")) { | ||
223 | + assert args.length == 3; | ||
224 | + listener.winSizeChanged((String)args[0], ((Number)args[1]).intValue(), ((Number)args[2]).intValue()); | ||
225 | + }else { | ||
226 | + throw new IOException("Terminals service: unknown event: " + name); | ||
227 | + } | ||
228 | + }catch (Throwable x) { | ||
229 | + channel.terminate(x); | ||
230 | + } | ||
231 | + } | ||
232 | + }; | ||
233 | + channel.addEventListener(this, l); | ||
234 | + listeners.put(listener, l); | ||
235 | + } | ||
236 | + | ||
237 | + public void removeListener(TerminalsListener listener) { | ||
238 | + IChannel.IEventListener l = listeners.remove(listener); | ||
239 | + if (l != null) channel.removeEventListener(this, l); | ||
240 | + } | ||
241 | + | ||
242 | + static { | ||
243 | + /* | ||
244 | + * Make Terminal Service proxy available to all potential clients by creating | ||
245 | + * the proxy object every time a TCF communication channel is opened. | ||
246 | + * Note: extension point "org.eclipse.tm.tcf.startup" is used to load this class | ||
247 | + * at TCF startup time, so proxy factory is properly activated even if nobody | ||
248 | + * import directly from this plugin. | ||
249 | + */ | ||
250 | + Protocol.addChannelOpenListener(new Protocol.ChannelOpenListener() { | ||
251 | + | ||
252 | + public void onChannelOpen(IChannel channel) { | ||
253 | + // Check if remote server provides Daytime service | ||
254 | + if (channel.getRemoteService(ITerminalsService.NAME) == null) return; | ||
255 | + // Create service proxy | ||
256 | + channel.setServiceProxy(ITerminalsService.class, new TerminalsServiceProxy(channel)); | ||
257 | + } | ||
258 | + }); | ||
259 | + } | ||
260 | +} | ||
261 | Index: plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/ITerminalsService.java | ||
262 | =================================================================== | ||
263 | --- plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/ITerminalsService.java (revision 0) | ||
264 | +++ plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/ITerminalsService.java (revision 0) | ||
265 | @@ -0,0 +1,193 @@ | ||
266 | +/******************************************************************************* | ||
267 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
268 | + * All rights reserved. This program and the accompanying materials | ||
269 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
270 | + * which accompanies this distribution, and is available at | ||
271 | + * http://www.eclipse.org/legal/epl-v10.html | ||
272 | + * | ||
273 | + * Contributors: | ||
274 | + * Intel - initial API and implementation | ||
275 | + *******************************************************************************/ | ||
276 | + | ||
277 | +package org.eclipse.tm.internal.tcf.terminals; | ||
278 | + | ||
279 | +import java.util.Map; | ||
280 | + | ||
281 | +import org.eclipse.tm.tcf.protocol.IService; | ||
282 | +import org.eclipse.tm.tcf.protocol.IToken; | ||
283 | + | ||
284 | +/** | ||
285 | + * ITerminalsService allows to launch a new terminal on the remote target system. | ||
286 | + */ | ||
287 | +public interface ITerminalsService extends IService { | ||
288 | + | ||
289 | + /** | ||
290 | + * This service name, as it appears on the wire - a TCF name of the service. | ||
291 | + */ | ||
292 | + static final String NAME = "Terminals"; | ||
293 | + /** | ||
294 | + * Retrieve context info for given context ID. | ||
295 | + * A context corresponds to an terminal. | ||
296 | + * Context IDs are valid across TCF services, so it is allowed to issue | ||
297 | + * 'ITerminals.getContext' command with a context that was obtained, | ||
298 | + * for example, from Memory service. | ||
299 | + * However, 'ITerminals.getContext' is supposed to return only terminal specific data, | ||
300 | + * If the ID is not a terminal ID, 'ITerminals.getContext' may not return any | ||
301 | + * useful information | ||
302 | + * | ||
303 | + * @param id – context ID. | ||
304 | + * @param done - call back interface called when operation is completed. | ||
305 | + */ | ||
306 | + IToken getContext(String id, DoneGetContext done); | ||
307 | + | ||
308 | + /** | ||
309 | + * Client call back interface for getContext(). | ||
310 | + */ | ||
311 | + interface DoneGetContext { | ||
312 | + /** | ||
313 | + * Called when contexts data retrieval is done. | ||
314 | + * @param error – error description if operation failed, null if succeeded. | ||
315 | + * @param context – context data. | ||
316 | + */ | ||
317 | + void doneGetContext(IToken token, Exception error, TerminalContext context); | ||
318 | + } | ||
319 | + /** | ||
320 | + * Context property names. | ||
321 | + */ | ||
322 | + static final String | ||
323 | + /** The TCF context ID */ | ||
324 | + PROP_ID = "ID", | ||
325 | + | ||
326 | + /** The pty type */ | ||
327 | + PROP_PTY_TYPE = "PtyType", | ||
328 | + | ||
329 | + /** terminal encoding */ | ||
330 | + PROP_ENCODING = "Encoding", | ||
331 | + | ||
332 | + /** window width size */ | ||
333 | + PROP_WIDTH = "Width", | ||
334 | + | ||
335 | + /** window height size */ | ||
336 | + PROP_HEIGHT = "Height", | ||
337 | + | ||
338 | + /** Process standard input stream ID */ | ||
339 | + PROP_STDIN_ID = "StdInID", | ||
340 | + | ||
341 | + /** Process standard output stream ID */ | ||
342 | + PROP_STDOUT_ID = "StdOutID", | ||
343 | + | ||
344 | + /** Process standard error stream ID */ | ||
345 | + PROP_STDERR_ID = "StdErrID"; | ||
346 | + | ||
347 | + interface TerminalContext { | ||
348 | + | ||
349 | + /** | ||
350 | + * Get context ID. | ||
351 | + * Same as getProperties().get(“ID”) | ||
352 | + */ | ||
353 | + String getID(); | ||
354 | + | ||
355 | + /** | ||
356 | + * Get terminal type. | ||
357 | + * Same as getProperties().get(“PtyType”) | ||
358 | + */ | ||
359 | + String getPtyType(); | ||
360 | + | ||
361 | + /** | ||
362 | + * Get encoding. | ||
363 | + * Same as getProperties().get(“Encoding”) | ||
364 | + */ | ||
365 | + String getEncoding(); | ||
366 | + | ||
367 | + /** | ||
368 | + * Get width. | ||
369 | + * Same as getProperties().get(“Width”) | ||
370 | + */ | ||
371 | + int getWidth(); | ||
372 | + | ||
373 | + /** | ||
374 | + * Get height. | ||
375 | + * Same as getProperties().get(“Height”) | ||
376 | + */ | ||
377 | + int getHeight(); | ||
378 | + | ||
379 | + /** | ||
380 | + * Get all available context properties. | ||
381 | + * @return Map 'property name' -> 'property value' | ||
382 | + */ | ||
383 | + Map<String, Object> getProperties(); | ||
384 | + | ||
385 | + /** | ||
386 | + * Exit the terminal. | ||
387 | + * @param done - call back interface called when operation is completed. | ||
388 | + * @return pending command handle, can be used to cancel the command. | ||
389 | + */ | ||
390 | + IToken exit(DoneCommand done); | ||
391 | + } | ||
392 | + | ||
393 | + interface DoneCommand { | ||
394 | + void doneCommand(IToken token, Exception error); | ||
395 | + } | ||
396 | + /** | ||
397 | + * Launch a new terminal toremote machine. | ||
398 | + * @param type - requested terminal type for the new terminal. | ||
399 | + * @param encoding - requested encoding for the new terminal. | ||
400 | + * @param environment - Array of environment variable strings. | ||
401 | + * if null then default set of environment variables will be used. | ||
402 | + * @param done - call back interface called when operation is completed. | ||
403 | + * @return pending command handle, can be used to cancel the command. | ||
404 | + */ | ||
405 | + IToken launch(String type, String encoding, String[] environment, | ||
406 | + DoneLaunch done); | ||
407 | + | ||
408 | + /** | ||
409 | + * Call-back interface to be called when "start" command is complete. | ||
410 | + */ | ||
411 | + interface DoneLaunch { | ||
412 | + void doneLaunch(IToken token, Exception error, TerminalContext terminal); | ||
413 | + } | ||
414 | + | ||
415 | + | ||
416 | + /** | ||
417 | + * Set the terminal widows size | ||
418 | + * @param context_id - context ID. | ||
419 | + * @param signal - signal code. | ||
420 | + * @param done - call back interface called when operation is completed. | ||
421 | + * @return pending command handle, can be used to cancel the command. | ||
422 | + */ | ||
423 | + IToken setWinSize(String context_id, int newWidth, int newHeight, DoneCommand done); | ||
424 | + | ||
425 | + /** | ||
426 | + * Add terminals service event listener. | ||
427 | + * @param listener - event listener implementation. | ||
428 | + */ | ||
429 | + void addListener(TerminalsListener listener); | ||
430 | + | ||
431 | + /** | ||
432 | + * Remove terminals service event listener. | ||
433 | + * @param listener - event listener implementation. | ||
434 | + */ | ||
435 | + void removeListener(TerminalsListener listener); | ||
436 | + | ||
437 | + /** | ||
438 | + * Process event listener is notified when a terminal exits. | ||
439 | + * Event are reported only for terminals that were started by 'launch' command. | ||
440 | + */ | ||
441 | + interface TerminalsListener { | ||
442 | + | ||
443 | + /** | ||
444 | + * Called when a terminal exits. | ||
445 | + * @param terminal_id - terminal context ID | ||
446 | + * @param exit_code - terminal exit code | ||
447 | + */ | ||
448 | + void exited(String terminal_id, int exit_code); | ||
449 | + | ||
450 | + /** | ||
451 | + * Called when a terminal exits. | ||
452 | + * @param terminal_id - terminal context ID | ||
453 | + * @param newWidth – new terminal width | ||
454 | + * @param newHeight – new terminal height | ||
455 | + */ | ||
456 | + void winSizeChanged (String terminal_id, int newWidth, int newHeight); | ||
457 | + } | ||
458 | +} | ||
459 | Index: plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/Activator.java | ||
460 | =================================================================== | ||
461 | --- plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/Activator.java (revision 0) | ||
462 | +++ plugins/org.eclipse.tm.tcf.terminals/src/org/eclipse/tm/internal/tcf/terminals/Activator.java (revision 0) | ||
463 | @@ -0,0 +1,61 @@ | ||
464 | +/******************************************************************************* | ||
465 | + * Copyright (c) 2010 Intel Corporation. and others. | ||
466 | + * All rights reserved. This program and the accompanying materials | ||
467 | + * are made available under the terms of the Eclipse Public License v1.0 | ||
468 | + * which accompanies this distribution, and is available at | ||
469 | + * http://www.eclipse.org/legal/epl-v10.html | ||
470 | + * | ||
471 | + * Contributors: | ||
472 | + * Intel - initial API and implementation | ||
473 | + *******************************************************************************/ | ||
474 | + | ||
475 | +package org.eclipse.tm.internal.tcf.terminals; | ||
476 | + | ||
477 | +import org.eclipse.core.runtime.Plugin; | ||
478 | +import org.osgi.framework.BundleContext; | ||
479 | + | ||
480 | +/** | ||
481 | + * The activator class controls the plug-in life cycle | ||
482 | + */ | ||
483 | +public class Activator extends Plugin { | ||
484 | + | ||
485 | + // The plug-in ID | ||
486 | + public static final String PLUGIN_ID = "org.eclipse.tm.tcf.terminals"; | ||
487 | + | ||
488 | + // The shared instance | ||
489 | + private static Activator plugin; | ||
490 | + | ||
491 | + /** | ||
492 | + * The constructor | ||
493 | + */ | ||
494 | + public Activator() { | ||
495 | + } | ||
496 | + | ||
497 | + /* | ||
498 | + * (non-Javadoc) | ||
499 | + * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) | ||
500 | + */ | ||
501 | + public void start(BundleContext context) throws Exception { | ||
502 | + super.start(context); | ||
503 | + plugin = this; | ||
504 | + } | ||
505 | + | ||
506 | + /* | ||
507 | + * (non-Javadoc) | ||
508 | + * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) | ||
509 | + */ | ||
510 | + public void stop(BundleContext context) throws Exception { | ||
511 | + plugin = null; | ||
512 | + super.stop(context); | ||
513 | + } | ||
514 | + | ||
515 | + /** | ||
516 | + * Returns the shared instance | ||
517 | + * | ||
518 | + * @return the shared instance | ||
519 | + */ | ||
520 | + public static Activator getDefault() { | ||
521 | + return plugin; | ||
522 | + } | ||
523 | + | ||
524 | +} | ||
525 | Index: plugins/org.eclipse.tm.tcf.terminals/plugin.properties | ||
526 | =================================================================== | ||
527 | --- plugins/org.eclipse.tm.tcf.terminals/plugin.properties (revision 0) | ||
528 | +++ plugins/org.eclipse.tm.tcf.terminals/plugin.properties (revision 0) | ||
529 | @@ -0,0 +1,13 @@ | ||
530 | +############################################################################### | ||
531 | +# Copyright (c) 2010 Intel, Inc. and others. | ||
532 | +# All rights reserved. This program and the accompanying materials | ||
533 | +# are made available under the terms of the Eclipse Public License v1.0 | ||
534 | +# which accompanies this distribution, and is available at | ||
535 | +# http://www.eclipse.org/legal/epl-v10.html | ||
536 | +# | ||
537 | +# Contributors: | ||
538 | +# Intel - initial implementation | ||
539 | +############################################################################### | ||
540 | +pluginName = TCF Terminals service (Incubation) | ||
541 | +providerName = Eclipse.org | ||
542 | + | ||
543 | Index: plugins/org.eclipse.tm.tcf.terminals/build.properties | ||
544 | =================================================================== | ||
545 | --- plugins/org.eclipse.tm.tcf.terminals/build.properties (revision 0) | ||
546 | +++ plugins/org.eclipse.tm.tcf.terminals/build.properties (revision 0) | ||
547 | @@ -0,0 +1,8 @@ | ||
548 | +source.. = src/ | ||
549 | +output.. = bin/ | ||
550 | +bin.includes = META-INF/,\ | ||
551 | + .,\ | ||
552 | + plugin.xml,\ | ||
553 | + about.html,\ | ||
554 | + plugin.properties | ||
555 | +src.includes = about.html | ||
556 | Index: plugins/org.eclipse.tm.tcf.terminals/plugin.xml | ||
557 | =================================================================== | ||
558 | --- plugins/org.eclipse.tm.tcf.terminals/plugin.xml (revision 0) | ||
559 | +++ plugins/org.eclipse.tm.tcf.terminals/plugin.xml (revision 0) | ||
560 | @@ -0,0 +1,11 @@ | ||
561 | +<?xml version="1.0" encoding="UTF-8"?> | ||
562 | +<?eclipse version="3.4"?> | ||
563 | +<plugin> | ||
564 | + <extension | ||
565 | + point="org.eclipse.tm.tcf.startup"> | ||
566 | + <class | ||
567 | + name="org.eclipse.tm.internal.tcf.terminals.TerminalsServiceProxy"> | ||
568 | + </class> | ||
569 | + </extension> | ||
570 | + | ||
571 | +</plugin> | ||
572 | Index: plugins/org.eclipse.tm.tcf.terminals/about.html | ||
573 | =================================================================== | ||
574 | --- plugins/org.eclipse.tm.tcf.terminals/about.html (revision 0) | ||
575 | +++ plugins/org.eclipse.tm.tcf.terminals/about.html (revision 0) | ||
576 | @@ -0,0 +1,28 @@ | ||
577 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
578 | + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
579 | +<html xmlns="http://www.w3.org/1999/xhtml"> | ||
580 | +<head> | ||
581 | +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> | ||
582 | +<title>About</title> | ||
583 | +</head> | ||
584 | +<body lang="EN-US"> | ||
585 | +<h2>About This Content</h2> | ||
586 | + | ||
587 | +<p>January 10, 2008</p> | ||
588 | +<h3>License</h3> | ||
589 | + | ||
590 | +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise | ||
591 | +indicated below, the Content is provided to you under the terms and conditions of the | ||
592 | +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available | ||
593 | +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. | ||
594 | +For purposes of the EPL, "Program" will mean the Content.</p> | ||
595 | + | ||
596 | +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is | ||
597 | +being redistributed by another party ("Redistributor") and different terms and conditions may | ||
598 | +apply to your use of any object code in the Content. Check the Redistributor's license that was | ||
599 | +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise | ||
600 | +indicated below, the terms and conditions of the EPL still apply to any source code in the Content | ||
601 | +and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> | ||
602 | + | ||
603 | +</body> | ||
604 | +</html> | ||
605 | \ No newline at end of file | ||
606 | Index: plugins/org.eclipse.tm.tcf.terminals/.settings/org.eclipse.jdt.core.prefs | ||
607 | =================================================================== | ||
608 | --- plugins/org.eclipse.tm.tcf.terminals/.settings/org.eclipse.jdt.core.prefs (revision 0) | ||
609 | +++ plugins/org.eclipse.tm.tcf.terminals/.settings/org.eclipse.jdt.core.prefs (revision 0) | ||
610 | @@ -0,0 +1,8 @@ | ||
611 | +#Mon Jun 07 11:42:38 CST 2010 | ||
612 | +eclipse.preferences.version=1 | ||
613 | +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
614 | +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
615 | +org.eclipse.jdt.core.compiler.compliance=1.6 | ||
616 | +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
617 | +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
618 | +org.eclipse.jdt.core.compiler.source=1.6 | ||