Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2009-09-07 07:30:02 +0000
committerAlexander Kurtakov2009-09-07 07:30:02 +0000
commitb340a3db80ab1b6f4fe58330209c98989f015e06 (patch)
tree72c4261602d4f3694110613c057f0f9d9c82f670 /rpmstubby
parent8de4a1e1d0ad3c33c8231b453989b1a4d4d9c030 (diff)
downloadorg.eclipse.linuxtools-b340a3db80ab1b6f4fe58330209c98989f015e06.tar.gz
org.eclipse.linuxtools-b340a3db80ab1b6f4fe58330209c98989f015e06.tar.xz
org.eclipse.linuxtools-b340a3db80ab1b6f4fe58330209c98989f015e06.zip
2009-09-07 Alexander Kurtakov <akurtako@redhat.com>
* src/org/eclipse/linuxtools/rpmstubby/model/PomModel.java: New file. * src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyFeatureAction.java: New file. * src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyPomAction.java: New file. * src/org/eclipse/linuxtools/rpmstubby/SpecfilePomWriter.java: New file. * src/org/eclipse/linuxtools/rpmstubby/StubbyPomGenerator.java: New file. * plugin.properties: Externalize strings. * plugin.xml: Likewise. * src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyAction.java (run): Make it abstract class. (setActivePart): Likewise. * src/org/eclipse/linuxtools/rpmstubby/preferences/StubbyPreferencePage.java (init): Add javadoc. (createFieldEditors): Likewise. * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java (generatePrepSection): Format and javadoc added. (getPackageName): Likewise (writeContent): Likewise. (throwCoreException): Likewise. (StubbyGenerator): Likewise. (generateSpecfile): Likewise. (generateFetchScript): Likewise.
Diffstat (limited to 'rpmstubby')
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/ChangeLog91
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/plugin.properties4
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/plugin.xml125
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/SpecfilePomWriter.java36
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java60
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/StubbyPomGenerator.java261
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/model/PomModel.java159
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyAction.java46
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyFeatureAction.java37
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyPomAction.java43
-rw-r--r--rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/preferences/StubbyPreferencePage.java19
11 files changed, 707 insertions, 174 deletions
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/ChangeLog b/rpmstubby/org.eclipse.linuxtools.rpmstubby/ChangeLog
index 8cd75df397..08f22d0aef 100644
--- a/rpmstubby/org.eclipse.linuxtools.rpmstubby/ChangeLog
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/ChangeLog
@@ -1,3 +1,24 @@
+2009-09-07 Alexander Kurtakov <akurtako@redhat.com>
+
+ * src/org/eclipse/linuxtools/rpmstubby/model/PomModel.java: New file.
+ * src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyFeatureAction.java: New file.
+ * src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyPomAction.java: New file.
+ * src/org/eclipse/linuxtools/rpmstubby/SpecfilePomWriter.java: New file.
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyPomGenerator.java: New file.
+ * plugin.properties: Externalize strings.
+ * plugin.xml: Likewise.
+ * src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyAction.java (run): Make it abstract class.
+ (setActivePart): Likewise.
+ * src/org/eclipse/linuxtools/rpmstubby/preferences/StubbyPreferencePage.java (init): Add javadoc.
+ (createFieldEditors): Likewise.
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java (generatePrepSection): Format and javadoc added.
+ (getPackageName): Likewise
+ (writeContent): Likewise.
+ (throwCoreException): Likewise.
+ (StubbyGenerator): Likewise.
+ (generateSpecfile): Likewise.
+ (generateFetchScript): Likewise.
+
2009-08-07 Alexander Kurtakov <akurtako@redhat.com>
* plugin.properties: Fix provider to be Eclipse not Eclipse.org.
@@ -12,7 +33,7 @@
2009-02-18 Alexander Kurtakov <akurtako@redhat.com>
- * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java (generatePrepSection): Put Fixme in commented block so it get annotated.
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java (generatePrepSection): Put Fixme in commented block so it get annotated.
(generateSpecfile): Likewise.
* src/org/eclipse/linuxtools/rpmstubby/StubbyPackageModel.java (getDescription): Proper constant name.
(getLicense): Likewise
@@ -30,31 +51,31 @@
2009-01-23 Alexander Kurtakov <akurtako@redhat.com>
- * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java (generatePrepSection): When generating our fetch script run %setup -c to match the tarball created.
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java (generatePrepSection): When generating our fetch script run %setup -c to match the tarball created.
* src/org/eclipse/linuxtools/rpmstubby/FeatureVisitor.java (getFeatures): Add javadoc.
(visit): Extract constant.
* src/org/eclipse/linuxtools/rpmstubby/StubbyPackageModel.java (resolveFeatureProperties): Fix NPE when model returns null.
2009-01-21 Alexander Kurtakov <akurtako@redhat.com>
Fix #260887.
- * src/org/eclipse/linuxtools/rpmstubby/model/MainPackage.java
+ * src/org/eclipse/linuxtools/rpmstubby/model/MainPackage.java
(getDocFilesRoot): New method.
(setDocFilesRoot): Likewise.
(setDocFiles): Likewise.
(getDocFiles): Likewise.
- * src/org/eclipse/linuxtools/rpmstubby/SpecfileWriter.java
+ * src/org/eclipse/linuxtools/rpmstubby/SpecfileWriter.java
(write): Add javadoc and populate docs data.
(SpecfileWriter): Add javadoc.
- * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
(generateFilesSections): Generate %doc in the %files section.
(generateSpecfile): Move %files related generation to generateFilesSections.
- * src/org/eclipse/linuxtools/rpmstubby/StubbyPackageModel.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyPackageModel.java
(populateDocFiles): New method.
(StubbyPackageModel): Store featureDir for later usage.
2009-01-20 Alexander Kurtakov <akurtako@redhat.com>
- * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
(getDepsOrReqs): Use StringBuilder.
(getPackageFiles): Likewise.
(generateSpecfile): Likewise.
@@ -67,31 +88,31 @@
2009-01-20 Alexander Kurtakov <akurtako@redhat.com>
Fix #260884.
- * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
(getProvidesBundlesString): Add \ for multiline.
(generateFetchScript): Fix escaping.
2009-01-20 Alexander Kurtakov <akurtako@redhat.com>
Fix #260879.
- * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
(generatePrepSection): Add comment for FIXME in %setup call.
-
+
2009-01-20 Alexander Kurtakov <akurtako@redhat.com>
Fix #260875.
* build.properties: Add license header.
* plugin.properties: Fix copyright year.
* plugin.xml: Add license header.
- * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
(generateSpecfile): Add comment for the Source0 generation.
* src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyAction.java: Fix copyright year.
-
+
2009-01-20 Alexander Kurtakov <akurtako@redhat.com>
Fix #260871.
* .settings/org.eclipse.jdt.core.prefs: Warn about missing javadoc.
* src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java: Format and javadoc.
(getProvidesBundlesString): Handle properly *-feature named features.
- * src/org/eclipse/linuxtools/rpmstubby/StubbyPackageModel.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyPackageModel.java
(getMissingFeaturesAsString): Add javadoc.
(getIncudedFeatures): Likewise.
(isAllIncludedFeatureFound): Likewise.
@@ -100,16 +121,16 @@
(populatePackagePreambleData): Add javadoc.
(StubbyPackageModel): Add javadoc.
* src/org/eclipse/linuxtools/rpmstubby/StubbyPlugin.java (PLUGIN_ID): Add javadoc.
-
-
+
+
2009-01-20 Alexander Kurtakov <akurtako@redhat.com>
* .settings/org.eclipse.jdt.core.prefs: Enable warnings for missing javadoc tags.
- * src/org/eclipse/linuxtools/rpmstubby/StubbyLog.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyLog.java
(createStatus): Fix javadoc.
- * src/org/eclipse/linuxtools/rpmstubby/StubbyPlugin.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyPlugin.java
(getActiveWorkbenchShell): Likewise.
-
+
2009-01-20 Alexander Kurtakov <akurtako@redhat.com>
* plugin.xml: Remove unneeded <or>.
@@ -117,7 +138,7 @@
2009-01-15 Alexander Kurtakov <akurtako@redhat.com>
* .settings/org.eclipse.jdt.core.prefs: Enable javadoc validity warnings.
- * src/org/eclipse/linuxtools/rpmstubby/StubbyLog.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyLog.java
(logInfo): Fix javadoc.
(logError): Likewise.
(log): Likewise.
@@ -142,39 +163,39 @@
2008-12-04 Alexander Kurtakov <akurtakov@gmail.com>
- * src/org/eclipse/linuxtools/rpmstubby/StubbyPackageModel.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyPackageModel.java
(getLicense): Add support for recognizing CPL.
2008-11-28 Alexander Kurtakov <akurtakov@gmail.com>
- * src/org/eclipse/linuxtools/rpmstubby/model/MainPackage.java
+ * src/org/eclipse/linuxtools/rpmstubby/model/MainPackage.java
(toString): Use StringBuilder instead of StringBuffer.
- * src/org/eclipse/linuxtools/rpmstubby/model/PackageItem.java
+ * src/org/eclipse/linuxtools/rpmstubby/model/PackageItem.java
(toString): Likewise.
- * src/org/eclipse/linuxtools/rpmstubby/model/SubPackage.java
+ * src/org/eclipse/linuxtools/rpmstubby/model/SubPackage.java
(toString): Likewise.
- * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
(generatePrepSection): Likewise.
(generateBuildSection): Likewise.
(generateSpecfile): Likewise.
(generateFetchScript): Likewise.
-
+
2008-11-28 Alexander Kurtakov <akurtakov@gmail.com>
- * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
(generateSpecfile): Fix hardcoded eclipse version to require 3.4.0 for the dropins support.
2008-11-20 Alexander Kurtakov <akurtakov@gmail.com>
- * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
(generateSpecfile): Make it install in %{_datadir}/eclipse/dropins/feature_name.
-
+
2008-11-20 Alexander Kurtakov <akurtakov@gmail.com>
* .settings/org.eclipse.jdt.core.prefs: Enable more warnings.
* src/org/eclipse/linuxtools/rpmstubby/model/IPackage.java: Switch to Lists from arrays.
* src/org/eclipse/linuxtools/rpmstubby/model/IPackagePreamble.java: Likewise.
- * src/org/eclipse/linuxtools/rpmstubby/model/MainPackage.java
+ * src/org/eclipse/linuxtools/rpmstubby/model/MainPackage.java
(getSources): Likewise.
(setPaches): Likewise.
(toString): Likewise
@@ -182,20 +203,20 @@
(getBuildRequires): Likewise
(setBuildRequires): Likewise
(getPaches): Likewise.
- * src/org/eclipse/linuxtools/rpmstubby/model/SubPackage.java
+ * src/org/eclipse/linuxtools/rpmstubby/model/SubPackage.java
(setProvides): Likewise.
(toString): Likewise.
(getProvides): Likewise.
(setRequires): Likewise.
(getRequires): Likewise.
- * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
(getPackageName): Do not use feature as the name of the feature.
(getDepsOrReqs): Switch to Lists from arrays.
(getPackageFiles): Likewise.
(getProvidesBundles): Likewise.
(generateSpecfile): Fix %eclipse_base value.
(getProvidesBundlesString): Switch to Lists from arrays.
- * src/org/eclipse/linuxtools/rpmstubby/StubbyPackageModel.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyPackageModel.java
(getDescription): Switch to Lists from arrays.
(getLicense): Likewise.
(StubbyPackageModel): Likewise.
@@ -211,11 +232,11 @@
2008-11-19 Alexander Kurtakov <akurtakov@gmail.com>
- * src/org/eclipse/linuxtools/rpmstubby/StubbyPackageModel.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyPackageModel.java
(getBundleValue): Remove org.eclipse.core.internal classes usage.
- * src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyAction.java
+ * src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyAction.java
(run): Fix generics warning.
- * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
+ * src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
(generateSpecfile): Don't generate Provides for every plugin.
2008-11-03 Andrew Overholt <overholt@redhat.com>
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/plugin.properties b/rpmstubby/org.eclipse.linuxtools.rpmstubby/plugin.properties
index b71972895e..4b23fda46d 100644
--- a/rpmstubby/org.eclipse.linuxtools.rpmstubby/plugin.properties
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/plugin.properties
@@ -9,4 +9,6 @@
# Red Hat, Inc. - initial API and implementation
#################################################################################
bundleName=Feature to RPM specfile Stubber (Incubation)
-provider=Eclipse \ No newline at end of file
+provider=Eclipse
+menu.label = Stubby
+action.label = Stub out an RPM specfile \ No newline at end of file
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/plugin.xml b/rpmstubby/org.eclipse.linuxtools.rpmstubby/plugin.xml
index 21d474716c..f8fca1de87 100644
--- a/rpmstubby/org.eclipse.linuxtools.rpmstubby/plugin.xml
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/plugin.xml
@@ -1,79 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?><!--
- Copyright (c) 2009 Red Hat, Inc.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- Red Hat - initial API and implementation
- -->
+<?eclipse version="3.2"?>
+ <!--
+ Copyright (c) 2009 Red Hat, Inc. All rights reserved. This program and
+ the accompanying materials are made available under the terms of the
+ Eclipse Public License v1.0 which accompanies this distribution, and
+ is available at http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors: Red Hat - initial API and implementation
+ -->
<plugin>
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="feature.xml"
- id="org.eclipse.linuxtools.rpmstubby.contribution1">
- <menu
- label="Stubby"
- path="additions"
- id="org.eclipse.linuxtools.rpmstubby.menu1">
- <separator
- name="group1">
- </separator>
- </menu>
- <action
- label="Stub out an RPM specfile"
- class="org.eclipse.linuxtools.rpmstubby.popup.actions.StubifyAction"
- menubarPath="org.eclipse.linuxtools.rpmstubby.menu1/group1"
- enablesFor="+"
- id="org.eclipse.linuxtools.rpmstubby.newAction">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IProject"
- adaptable="true"
- id="org.eclipse.linuxtools.rpmstubby.contribution2">
- <menu
- label="Stubby"
- path="additions"
- id="org.eclipse.linuxtools.rpmstubby.menu1">
- <separator
- name="group1">
- </separator>
- </menu>
- <action
- label="Stub out an RPM specfile"
- class="org.eclipse.linuxtools.rpmstubby.popup.actions.StubifyAction"
- menubarPath="org.eclipse.linuxtools.rpmstubby.menu1/group1"
- enablesFor="+"
- id="org.eclipse.linuxtools.rpmstubby.newAction">
- </action>
- <visibility>
- <objectState
- name="projectNature"
- value="org.eclipse.pde.FeatureNature"/>
- </visibility>
- </objectContribution>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.eclipse.linuxtools.rpm.ui.editor.mainpage"
- class="org.eclipse.linuxtools.rpmstubby.preferences.StubbyPreferencePage"
- id="org.eclipse.linuxtools.rpmstubby.preferences.stubbyPreferencePage"
- name="Stubby">
- </page>
- </extension>
- <extension
- point="org.eclipse.core.runtime.preferences">
- <initializer
- class="org.eclipse.linuxtools.rpmstubby.preferences.PreferenceInitializer">
- </initializer>
- </extension>
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="feature.xml" id="org.eclipse.linuxtools.rpmstubby.contribution1">
+ <menu label="%menu.label" path="additions"
+ id="org.eclipse.linuxtools.rpmstubby.menu1" />
+ <action label="%action.label"
+ class="org.eclipse.linuxtools.rpmstubby.popup.actions.StubifyFeatureAction"
+ menubarPath="org.eclipse.linuxtools.rpmstubby.menu1/group1"
+ enablesFor="+" id="org.eclipse.linuxtools.rpmstubby.newAction" />
+ </objectContribution>
+ <objectContribution objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true" id="org.eclipse.linuxtools.rpmstubby.contribution2">
+ <menu label="%menu.label" path="additions"
+ id="org.eclipse.linuxtools.rpmstubby.menu1" />
+ <action label="%action.label"
+ class="org.eclipse.linuxtools.rpmstubby.popup.actions.StubifyFeatureAction"
+ menubarPath="org.eclipse.linuxtools.rpmstubby.menu1/group1"
+ enablesFor="+" id="org.eclipse.linuxtools.rpmstubby.newAction" />
+ <visibility>
+ <objectState name="projectNature" value="org.eclipse.pde.FeatureNature" />
+ </visibility>
+ </objectContribution>
+ <objectContribution objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="pom.xml" id="org.eclipse.linuxtools.rpmstubby.contribution1">
+ <menu label="%menu.label" path="additions"
+ id="org.eclipse.linuxtools.rpmstubby.menu1" />
+ <action label="%action.label"
+ class="org.eclipse.linuxtools.rpmstubby.popup.actions.StubifyPomAction"
+ menubarPath="org.eclipse.linuxtools.rpmstubby.menu1/group1"
+ enablesFor="+" id="org.eclipse.linuxtools.rpmstubby.newAction" />
+ </objectContribution>
+ </extension>
+ <extension point="org.eclipse.ui.preferencePages">
+ <page category="org.eclipse.linuxtools.rpm.ui.editor.mainpage"
+ class="org.eclipse.linuxtools.rpmstubby.preferences.StubbyPreferencePage"
+ id="org.eclipse.linuxtools.rpmstubby.preferences.stubbyPreferencePage"
+ name="%menu.label" />
+ </extension>
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.linuxtools.rpmstubby.preferences.PreferenceInitializer">
+ </initializer>
+ </extension>
</plugin>
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/SpecfilePomWriter.java b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/SpecfilePomWriter.java
new file mode 100644
index 0000000000..901d289f0a
--- /dev/null
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/SpecfilePomWriter.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.rpmstubby;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * Utility class used for writing the generated specfile to a file.
+ *
+ */
+public class SpecfilePomWriter {
+
+ /**
+ * Parse the pom.xml and write the generated specfile.
+ * @param pomFile The pom.xml file.
+ */
+ public void write(IFile pomFile) {
+
+ StubbyPomGenerator generator = new StubbyPomGenerator(pomFile);
+ try {
+ generator.writeContent(pomFile.getProject().getName());
+ } catch (CoreException e) {
+ StubbyLog.logError(e);
+ }
+ }
+
+}
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
index 3dad42bb90..5da603df1e 100644
--- a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/StubbyGenerator.java
@@ -37,7 +37,7 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
/**
- * Generates the RPM specfile and the fetch script based on the feature and user
+ * Generates the RPM specfile and the fetch script based on the feature and user
* preferences.
*
*/
@@ -52,9 +52,11 @@ public class StubbyGenerator {
/**
* Creates the specfile and fetch script generator for the given packages.
- *
- * @param mainPackage The main feature.
- * @param subPackages The included features or plugins.
+ *
+ * @param mainPackage
+ * The main feature.
+ * @param subPackages
+ * The included features or plugins.
*/
public StubbyGenerator(MainPackage mainPackage, List<SubPackage> subPackages) {
this.mainPackage = mainPackage;
@@ -70,6 +72,7 @@ public class StubbyGenerator {
/**
* Generates a RPM specfile based on the parsed data from the feature.xml.
+ *
* @return The generated specfile.
*/
public String generateSpecfile() {
@@ -95,8 +98,10 @@ public class StubbyGenerator {
if (withFetchScript) {
String fetchScriptName = "%{name}-fetch-src.sh";
buffer.append("## sh ").append(fetchScriptName).append("\n");
- buffer.append("Source0: %{name}-fetched-src-%{src_repo_tag}.tar.bz2\n");
- buffer.append("Source1: " ).append(fetchScriptName).append("\n");
+ buffer
+ .append("Source0: %{name}-fetched-src-%{src_repo_tag}.tar.bz2\n");
+ buffer.append("Source1: ").append(fetchScriptName).append(
+ "\n");
} else {
buffer.append("Source0: #FIXME\n");
}
@@ -195,11 +200,13 @@ public class StubbyGenerator {
private void generatePrepSection(StringBuilder buffer) {
buffer.append("\n%prep\n");
- // Fetch scripts generated by rpmstubby don't require adding -n options to %setup call but -c.
+ // Fetch scripts generated by rpmstubby don't require adding -n options
+ // to %setup call but -c.
if (withFetchScript) {
buffer.append("%setup -q -c\n\n");
} else {
- buffer.append("#FIXME Replace FIXME with the root directory name in Source0\n");
+ buffer
+ .append("#FIXME Replace FIXME with the root directory name in Source0\n");
buffer.append("%setup -q -n FIXME\n\n");
}
if (!usePdebuildScript) {
@@ -238,16 +245,17 @@ public class StubbyGenerator {
}
/**
- * Generates a fetch script. The script is better suited for cvs for now.
- * It lists all the plugins and features and tries to export them.
+ * Generates a fetch script. The script is better suited for cvs for now. It
+ * lists all the plugins and features and tries to export them.
+ *
* @return The generated fetch script.
*/
public String generateFetchScript() {
StringBuilder buffer = new StringBuilder();
buffer.append("#!/bin/sh\n");
buffer.append("usage='usage: $0 <tag>'\n");
- buffer.append("name=eclipse-" + getPackageName(mainPackage.getName()).toLowerCase()
- + "\n");
+ buffer.append("name=eclipse-"
+ + getPackageName(mainPackage.getName()).toLowerCase() + "\n");
buffer.append("tag=$1\n");
buffer.append("tar_name=$name-fetched-src-$tag\n\n");
buffer.append("# example of fetch command:\n");
@@ -280,8 +288,11 @@ public class StubbyGenerator {
}
/**
- * Returns the last meaningful part of the feature id before the feature substring.
- * @param packageName The feature id from which to extract the name.
+ * Returns the last meaningful part of the feature id before the feature
+ * substring.
+ *
+ * @param packageName
+ * The feature id from which to extract the name.
* @return The part of the feature id to be used for package name.
*/
public String getPackageName(String packageName) {
@@ -294,11 +305,17 @@ public class StubbyGenerator {
}
/**
- * Writes the given contents to a file with the given fileName in the specified project.
- * @param projectName The name of the project to put the file into.
- * @param fileName The name of the file.
- * @param contents The contents of the file.
- * @throws CoreException Thrown when the project doesn't exist.
+ * Writes the given contents to a file with the given fileName in the
+ * specified project.
+ *
+ * @param projectName
+ * The name of the project to put the file into.
+ * @param fileName
+ * The name of the file.
+ * @param contents
+ * The contents of the file.
+ * @throws CoreException
+ * Thrown when the project doesn't exist.
*/
public void writeContent(String projectName, String fileName,
String contents) throws CoreException {
@@ -338,9 +355,8 @@ public class StubbyGenerator {
}
private void throwCoreException(String message) throws CoreException {
- IStatus status = new Status(IStatus.ERROR,
- "org.eclipse.linuxtools.rpm.ui.editor", IStatus.OK, message,
- null);
+ IStatus status = new Status(IStatus.ERROR, StubbyPlugin.PLUGIN_ID,
+ IStatus.OK, message, null);
throw new CoreException(status);
}
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/StubbyPomGenerator.java b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/StubbyPomGenerator.java
new file mode 100644
index 0000000000..1cd2d25d5f
--- /dev/null
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/StubbyPomGenerator.java
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.rpmstubby;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.linuxtools.rpmstubby.model.PomModel;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * Generator for RPM specfile from maven pom.xml.
+ *
+ */
+public class StubbyPomGenerator {
+
+ private PomModel model;
+
+ /**
+ * Creates the generator by parsing the pom.xml file.
+ * @param pomFile The pom.xml file to generate specfile for.
+ */
+ public StubbyPomGenerator(IFile pomFile) {
+ parse(pomFile);
+ }
+
+ private void parse(IFile pomFile) {
+ DocumentBuilderFactory docfactory = DocumentBuilderFactory
+ .newInstance();
+ DocumentBuilder docbuilder;
+ try {
+ docbuilder = docfactory.newDocumentBuilder();
+ Document docroot = docbuilder.parse(pomFile.getContents());
+ model = new PomModel(docroot);
+
+ } catch (ParserConfigurationException e) {
+ StubbyLog.logError(e);
+ } catch (SAXException e) {
+ StubbyLog.logError(e);
+ } catch (IOException e) {
+ StubbyLog.logError(e);
+ } catch (CoreException e) {
+ StubbyLog.logError(e);
+ }
+ }
+
+ /**
+ * Generates a RPM specfile based on the parsed data from the pom file.
+ *
+ * @return The generated specfile.
+ */
+ public String generateSpecfile() {
+ StringBuilder buffer = new StringBuilder();
+ String packageName = model.getPackageName();
+ buffer.append("Name: " + packageName.toLowerCase() + "\n");
+ buffer.append("Version: " + model.getVersion() + "\n");
+ buffer.append("Release: 1%{?dist}" + "\n");
+ buffer.append("Summary: " + model.getSummary() + "\n\n");
+ buffer.append("Group: Development/Libraries\n");
+ buffer.append("License: " + model.getLicense() + "\n");
+ buffer.append("URL: " + model.getURL() + "\n");
+ buffer.append("Source0: #FIXME\n");
+ buffer
+ .append("BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)\n\n");
+ buffer.append("BuildArch: noarch\n\n");
+ generateRequires(buffer);
+ buffer.append("\n%description\n" + model.getDescription() + "\n\n");
+ generateJavadocSubpackage(buffer);
+ generatePrepSection(buffer);
+ generateBuildSection(buffer);
+ generateInstallSection(buffer);
+ generatePostPostun(buffer);
+ generateCleanSection(buffer);
+ generateFilesSections(buffer);
+ generateChangelog(buffer);
+
+ return buffer.toString();
+ }
+
+ private void generateRequires(StringBuilder buffer) {
+ for (String dependency: model.getDependencies()) {
+ buffer.append("BuildRequires: "+dependency+"\n");
+ }
+ for (String dependency: model.getDependencies()) {
+ buffer.append("Requires: "+dependency+"\n");
+ }
+ }
+
+ private void generateJavadocSubpackage(StringBuilder buffer) {
+ buffer.append("%package javadoc\n");
+ buffer.append("Group: Documentation\n");
+ buffer.append("Summary: Javadoc for %{name}\n\n");
+
+ buffer.append("%description javadoc\n");
+ buffer.append("API documentation for %{name}.\n\n");
+
+ }
+
+ private void generatePostPostun(StringBuilder buffer) {
+ buffer.append("%post\n");
+ buffer.append("%update_maven_depmap\n\n");
+ buffer.append("%postun\n");
+ buffer.append("%update_maven_depmap\n\n");
+
+ }
+
+ private void generateChangelog(StringBuilder buffer) {
+ buffer.append("%changelog\n\n");
+ buffer.append("#FIXME\n");
+ }
+
+ private void generateCleanSection(StringBuilder buffer) {
+ buffer.append("%clean\n");
+ buffer.append("%{__rm} -rf %{buildroot}\n\n");
+ }
+
+ private void generateInstallSection(StringBuilder buffer) {
+ buffer.append("%install\n");
+ buffer.append("rm -rf %{buildroot}\n\n");
+
+ buffer.append("# jars\n");
+ buffer.append("install -d -m 0755 %{buildroot}%{_javadir}/%{name}\n");
+ buffer
+ .append("install -m 644 #TODO jars %{buildroot}%{_javadir}/%{name}/\n\n");
+
+ buffer
+ .append("(cd %{buildroot}%{_javadir}/%{name} && for jar in *-%{version}*; \\\n");
+ buffer
+ .append(" do ln -sf ${jar} `echo $jar| sed \"s|-%{version}||g\"`; done)\n\n");
+
+ buffer.append("%add_to_maven_depmap " + model.getGroupId() + " "
+ + model.getArtifactId() + " %{version} JPP "
+ + model.getArtifactId() + "\n\n");
+
+ buffer.append("# poms\n");
+ buffer
+ .append("install -d -m 755 %{buildroot}%{_datadir}/maven2/poms\n");
+ buffer.append("install -pm 644 pom.xml \\\n");
+ buffer
+ .append(" %{buildroot}%{_datadir}/maven2/poms/JPP.%{name}.pom\n\n");
+
+ buffer.append("# javadoc\n");
+ buffer
+ .append("install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}-%{version}\n");
+ buffer
+ .append("cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}-%{version}/\n");
+ buffer
+ .append("ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name}\n");
+ buffer.append("rm -rf target/site/api*\n\n");
+ }
+
+ private void generateFilesSections(StringBuilder buffer) {
+ buffer.append("%files\n");
+ buffer.append("%defattr(-,root,root,-)\n");
+ buffer.append("%{_javadir}/%{name}\n");
+ buffer.append("%{_datadir}/maven2/poms/*\n");
+ buffer.append("%{_mavendepmapfragdir}/*\n\n");
+
+ buffer.append("%files javadoc\n");
+ buffer.append("%defattr(-,root,root,-)\n");
+ buffer.append("%{_javadocdir}/%{name}-%{version}\n");
+ buffer.append("%{_javadocdir}/%{name}\n\n");
+ }
+
+ private void generatePrepSection(StringBuilder buffer) {
+ buffer.append("\n%prep\n");
+ buffer.append("%setup -q -n FIXME\n\n");
+ buffer.append("mkdir external_repo\n");
+ buffer.append("ln -s %{_javadir} external_repo/JPP\n\n");
+ }
+
+ private void generateBuildSection(StringBuilder buffer) {
+ buffer.append("%build\n");
+ buffer.append("export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository\n");
+ buffer.append("mvn-jpp \\\n");
+ buffer.append(" -e \\\n");
+ buffer.append(" -Dmaven2.jpp.mode=true \\\n");
+ buffer.append(" -Dmaven.repo.local=$MAVEN_REPO_LOCAL \\\n");
+ buffer.append(" install javadoc:javadoc\n\n");
+ }
+
+ /**
+ * Writes the given contents to a file with the given fileName in the
+ * specified project.
+ *
+ * @param projectName
+ * The name of the project to put the file into.
+ * @throws CoreException
+ * Thrown when the project doesn't exist.
+ */
+ public void writeContent(String projectName) throws CoreException {
+ String fileName = model.getPackageName().toLowerCase() + ".spec";
+ String contents = generateSpecfile();
+ InputStream contentInputStream = new ByteArrayInputStream(contents
+ .getBytes());
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IResource resource = root.findMember(new Path(projectName));
+ if (!resource.exists() || !(resource instanceof IContainer)) {
+ throwCoreException("Project \"" + projectName
+ + "\" does not exist.");
+ }
+ IContainer container = (IContainer) resource;
+ final IFile file = container.getFile(new Path(fileName));
+ try {
+ InputStream stream = contentInputStream;
+ if (file.exists()) {
+ file.setContents(stream, true, true, null);
+ } else {
+ file.create(stream, true, null);
+ }
+ stream.close();
+ } catch (IOException e) {
+ StubbyLog.logError(e);
+ }
+ StubbyPlugin.getActiveWorkbenchShell().getDisplay().asyncExec(
+ new Runnable() {
+ public void run() {
+ IWorkbenchPage page = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ try {
+ IDE.openEditor(page, file, true);
+ } catch (PartInitException e) {
+ StubbyLog.logError(e);
+ }
+ }
+ });
+ }
+
+ private void throwCoreException(String message) throws CoreException {
+ IStatus status = new Status(IStatus.ERROR, StubbyPlugin.PLUGIN_ID,
+ IStatus.OK, message, null);
+ throw new CoreException(status);
+ }
+}
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/model/PomModel.java b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/model/PomModel.java
new file mode 100644
index 0000000000..596d90546d
--- /dev/null
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/model/PomModel.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.rpmstubby.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Gives easy access to data from the maven pom.xml file.
+ *
+ */
+public class PomModel {
+
+ private Document docroot;
+ private XPath xpath;
+
+ /**
+ * Instantiates the model with the given XML document and preparing the
+ * XPath evaluation environment.
+ *
+ * @param docroot
+ * The document to query.
+ */
+ public PomModel(Document docroot) {
+ this.docroot = docroot;
+ xpath = XPathFactory.newInstance().newXPath();
+ }
+
+ /**
+ * Returns the proposed package name.
+ *
+ * @return The proposed package name.
+ */
+ public String getPackageName() {
+ // TODO make it return names suitable for Fedora's package naming
+ // guidelines.
+ return xpathEval("/project/artifactId");
+ }
+
+ /**
+ * Returns the artifact id xpath:/project/artifactId .
+ *
+ * @return The artifact id.
+ */
+ public String getArtifactId() {
+ return xpathEval("/project/artifactId");
+ }
+
+ /**
+ * Returns the group id (xpath:/project/groupId) or the groupId of the
+ * parent (xpath:/project/parent/groupId) if groupId is not present.
+ *
+ * @return The group id.
+ */
+ public String getGroupId() {
+ String groupId = xpathEval("/project/groupId");
+ if (groupId.equals("")) {
+ groupId = xpathEval("/project/parent/groupId");
+ }
+ return groupId;
+ }
+
+ /**
+ * Returns the summary (xpath:/project/name). Maven project name is verbose
+ * and it corresponds to the RPM specfile Summary tag.
+ *
+ * @return The summary.
+ */
+ public String getSummary() {
+ return xpathEval("/project/name");
+ }
+
+ /**
+ * Returns the project version (xpath:/project/version).
+ *
+ * @return The version.
+ */
+ public String getVersion() {
+ return xpathEval("/project/version");
+ }
+
+ /**
+ * Returns the license (xpath:/project/licenses/license/name).
+ *
+ * @return The license name.
+ */
+ public String getLicense() {
+ // TODO make it return suitable license names.
+ return xpathEval("/project/licenses/license/name");
+ }
+
+ /**
+ * Returns the URL (xpath:/project/organization/url).
+ *
+ * @return The project url.
+ */
+ public String getURL() {
+ return xpathEval("/project/organization/url");
+ }
+
+ /**
+ * Returns the project description (xpath:/project/description).
+ *
+ * @return The project description.
+ */
+ public String getDescription() {
+ getDependencies();
+ return xpathEval("/project/description");
+ }
+
+ public List<String> getDependencies() {
+ List<String> dependencies = new ArrayList<String>();
+ NodeList nodes = xpathEvalNodes("/project/dependencies/dependency/artifactId");
+ for (int i=0; i<nodes.getLength(); i++){
+ Node node =nodes.item(i);
+ dependencies.add(node.getTextContent());
+ }
+ return dependencies;
+ }
+
+ private String xpathEval(String path) {
+ String result = "";
+ try {
+ result = xpath.evaluate(path, docroot);
+ } catch (XPathExpressionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ private NodeList xpathEvalNodes(String path) {
+ NodeList result = null;
+ try {
+ result = (NodeList) xpath.evaluate(path, docroot, XPathConstants.NODESET);
+ } catch (XPathExpressionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return result;
+ }
+}
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyAction.java b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyAction.java
index 638d61b27c..a18e4e403c 100644
--- a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyAction.java
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyAction.java
@@ -10,66 +10,44 @@
*******************************************************************************/
package org.eclipse.linuxtools.rpmstubby.popup.actions;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.linuxtools.rpmstubby.SpecfileWriter;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
-public class StubifyAction implements IObjectActionDelegate {
+/**
+ * Base class for the different stubify actions.
+ *
+ */
+public abstract class StubifyAction implements IObjectActionDelegate {
- private ISelection selection;
- private IFile featureFile = null;
+ protected ISelection selection;
/**
- * Constructor for StubifyAction.
+ * @see IActionDelegate#run(IAction)
*/
- public StubifyAction() {
- super();
- }
+ public abstract void run(IAction action);
/**
* @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
IStructuredSelection structuredSelection = null;
- ISelectionProvider provider= targetPart.getSite().getSelectionProvider();
+ ISelectionProvider provider = targetPart.getSite()
+ .getSelectionProvider();
if (provider != null) {
- ISelection selection= provider.getSelection();
+ ISelection selection = provider.getSelection();
if (selection instanceof IStructuredSelection)
- structuredSelection = (IStructuredSelection)selection;
+ structuredSelection = (IStructuredSelection) selection;
}
structuredSelection = StructuredSelection.EMPTY;
this.selection = (ISelection) structuredSelection.getFirstElement();
}
- /**
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- StructuredSelection structuredSelection = (StructuredSelection) selection;
- for (Iterator<?> selectionIter = structuredSelection.iterator(); selectionIter.hasNext();) {
- Object selected = selectionIter.next();
- if (selected instanceof IProject) {
- featureFile = ((IProject) selected).getFile(new Path("/feature.xml"));
- } else if (selected instanceof IFile) {
- featureFile = (IFile) selected;
- } else {
- // FIXME: error
- }
- }
- SpecfileWriter specfileWriter = new SpecfileWriter();
- specfileWriter.write(featureFile);
- }
/**
* @see IActionDelegate#selectionChanged(IAction, ISelection)
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyFeatureAction.java b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyFeatureAction.java
new file mode 100644
index 0000000000..3187b83a32
--- /dev/null
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyFeatureAction.java
@@ -0,0 +1,37 @@
+package org.eclipse.linuxtools.rpmstubby.popup.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.linuxtools.rpmstubby.SpecfileWriter;
+
+/**
+ * Action handling stybifying RPM spec file from a Eclipse feature.xml file.
+ *
+ */
+public class StubifyFeatureAction extends StubifyAction {
+
+ @Override
+ public void run(IAction action) {
+ IFile featureFile = null;
+ StructuredSelection structuredSelection = (StructuredSelection) selection;
+ for (Iterator<?> selectionIter = structuredSelection.iterator(); selectionIter
+ .hasNext();) {
+ Object selected = selectionIter.next();
+ if (selected instanceof IProject) {
+ featureFile = ((IProject) selected).getFile(new Path(
+ "/feature.xml"));
+ } else if (selected instanceof IFile) {
+ featureFile = (IFile) selected;
+ } else {
+ // FIXME: error
+ }
+ }
+ SpecfileWriter specfileWriter = new SpecfileWriter();
+ specfileWriter.write(featureFile);
+ }
+}
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyPomAction.java b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyPomAction.java
new file mode 100644
index 0000000000..b4e65597be
--- /dev/null
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/popup/actions/StubifyPomAction.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.rpmstubby.popup.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.linuxtools.rpmstubby.SpecfilePomWriter;
+
+/**
+ * Action handling stybifying RPM spec file from a Maven pom.xml file.
+ *
+ */
+public class StubifyPomAction extends StubifyAction {
+
+ @Override
+ public void run(IAction action) {
+ IFile pomFile = null;
+ StructuredSelection structuredSelection = (StructuredSelection) selection;
+ for (Iterator<?> selectionIter = structuredSelection.iterator(); selectionIter
+ .hasNext();) {
+ Object selected = selectionIter.next();
+ if (selected instanceof IFile) {
+ pomFile = (IFile) selected;
+ } else {
+ // FIXME: error
+ }
+ }
+ SpecfilePomWriter specfileWriter = new SpecfilePomWriter();
+ specfileWriter.write(pomFile);
+ }
+
+}
diff --git a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/preferences/StubbyPreferencePage.java b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/preferences/StubbyPreferencePage.java
index 7f3d16c54a..58db324eea 100644
--- a/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/preferences/StubbyPreferencePage.java
+++ b/rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/preferences/StubbyPreferencePage.java
@@ -16,6 +16,10 @@ import org.eclipse.linuxtools.rpmstubby.StubbyPlugin;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
+/**
+ * Preference page for controlling spec files stub creation.
+ *
+ */
public class StubbyPreferencePage extends FieldEditorPreferencePage implements
IWorkbenchPreferencePage {
@@ -27,10 +31,9 @@ public class StubbyPreferencePage extends FieldEditorPreferencePage implements
setPreferenceStore(StubbyPlugin.getDefault().getPreferenceStore());
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ /**
+ * @see
+ * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
*/
@Override
public void createFieldEditors() {
@@ -47,13 +50,11 @@ public class StubbyPreferencePage extends FieldEditorPreferencePage implements
"Use the pdebuild script for building", getFieldEditorParent()));
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ /**
+ * @see
+ * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
public void init(IWorkbench workbench) {
-
}
}

Back to the top