Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-07-04 14:36:52 +0000
committercletavernie2012-07-04 14:36:52 +0000
commit0d6a2fde5b6cabaad865d6a8214a8eb2c6acd655 (patch)
treef46ffe1fd4c8622124891d049bd285665e3ec441 /sandbox
parente74e2d975c3087bead0a64b3e9957958c7cf316c (diff)
downloadorg.eclipse.papyrus-0d6a2fde5b6cabaad865d6a8214a8eb2c6acd655.tar.gz
org.eclipse.papyrus-0d6a2fde5b6cabaad865d6a8214a8eb2c6acd655.tar.xz
org.eclipse.papyrus-0d6a2fde5b6cabaad865d6a8214a8eb2c6acd655.zip
351695: Create a new plugin to edit project files
https://bugs.eclipse.org/bugs/show_bug.cgi?id=351695
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BuildEditor.java10
-rw-r--r--sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BundlePropertiesEditor.java2
-rw-r--r--sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ClasspathEditor.java33
-rw-r--r--sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java30
-rw-r--r--sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IFileEditor.java2
-rw-r--r--sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/AbstractProjectEditor.java2
-rw-r--r--sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/EMFFacetProjectEditor.java7
-rw-r--r--sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/FeatureProjectEditor.java32
-rw-r--r--sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java10
-rw-r--r--sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java45
10 files changed, 105 insertions, 68 deletions
diff --git a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BuildEditor.java b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BuildEditor.java
index 4c07b152058..ebdb5de82b0 100644
--- a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BuildEditor.java
+++ b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BuildEditor.java
@@ -148,9 +148,15 @@ public class BuildEditor extends AbstractFileEditor implements IBuildEditor {
*
* {@inheritDoc}
*/
- public void save() throws Throwable {
+ public void save() {
if(exists()) {
- this.buildConfig.store(new FileOutputStream(this.buildFile), ""); //$NON-NLS-1$
+ try {
+ this.buildConfig.store(new FileOutputStream(this.buildFile), "");
+ } catch (FileNotFoundException ex) {
+ Activator.log.error(ex);
+ } catch (IOException ex) {
+ Activator.log.error(ex);
+ }
}
}
diff --git a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BundlePropertiesEditor.java b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BundlePropertiesEditor.java
index 69ebaea1b19..4cc9a9e7a44 100644
--- a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BundlePropertiesEditor.java
+++ b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BundlePropertiesEditor.java
@@ -47,7 +47,7 @@ public class BundlePropertiesEditor extends AbstractFileEditor {
}
- public void save() throws Throwable {
+ public void save() {
// TODO Auto-generated method stub
}
diff --git a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ClasspathEditor.java b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ClasspathEditor.java
index bfadf16d899..70a8d2c8b8f 100644
--- a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ClasspathEditor.java
+++ b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ClasspathEditor.java
@@ -41,7 +41,7 @@ import org.eclipse.papyrus.eclipse.project.editors.interfaces.IClasspathEditor;
/**
*
* The editor for the classpath file
- *
+ *
*/
public class ClasspathEditor extends AbstractFileEditor implements IClasspathEditor {
@@ -57,7 +57,7 @@ public class ClasspathEditor extends AbstractFileEditor implements IClasspathEdi
*
* @param project
*/
- public ClasspathEditor(final IProject project) throws AssertionFailedException{
+ public ClasspathEditor(final IProject project) throws AssertionFailedException {
super(project);
this.javaProject = JavaCore.create(project);
}
@@ -84,8 +84,12 @@ public class ClasspathEditor extends AbstractFileEditor implements IClasspathEdi
*
* @throws Throwable
*/
- public void save() throws Throwable {
- this.javaProject.save(new NullProgressMonitor(), true);
+ public void save() {
+ try {
+ this.javaProject.save(new NullProgressMonitor(), true);
+ } catch (JavaModelException ex) {
+ Activator.log.error(ex);
+ }
}
/**
@@ -94,7 +98,7 @@ public class ClasspathEditor extends AbstractFileEditor implements IClasspathEdi
*
* {@inheritDoc}
*/
- public void addSourceFolderToClasspath(final String folderPath){
+ public void addSourceFolderToClasspath(final String folderPath) {
if(exists() && !isSourceFolderRegistered(folderPath)) {
@@ -112,15 +116,15 @@ public class ClasspathEditor extends AbstractFileEditor implements IClasspathEdi
int entryKind = IClasspathEntry.CPE_SOURCE;
IPath path2 = new Path(folderPath);
- IClasspathEntry [] classpathes =null;
+ IClasspathEntry[] classpathes = null;
try {
- classpathes = this.javaProject.getRawClasspath();
+ classpathes = this.javaProject.getRawClasspath();
} catch (JavaModelException e) {
e.printStackTrace();
}
- IClasspathEntry [] entries = new IClasspathEntry[classpathes.length +1 ];
- for(int i=0;i<classpathes.length;i++){
+ IClasspathEntry[] entries = new IClasspathEntry[classpathes.length + 1];
+ for(int i = 0; i < classpathes.length; i++) {
entries[i] = classpathes[i];
}
entries[classpathes.length] = new ClasspathEntry(contentKind, entryKind, path2, inclusionPatterns, exclusionPatterns, sourceAttachmentPath, sourceAttachmentRootPath, specificOutputLocation, isExported, accessRules, combineAccessRules, extraAttributes);
@@ -138,18 +142,18 @@ public class ClasspathEditor extends AbstractFileEditor implements IClasspathEdi
*
* {@inheritDoc}
*/
- public boolean isSourceFolderRegistered(final String folderPath){
- IClasspathEntry [] entries =null;
+ public boolean isSourceFolderRegistered(final String folderPath) {
+ IClasspathEntry[] entries = null;
try {
entries = this.javaProject.getRawClasspath();
} catch (JavaModelException e) {
Activator.log.error(e);
}
- for(int i=0;i<entries.length;i++){
+ for(int i = 0; i < entries.length; i++) {
IClasspathEntry entry = entries[i];
- if(entry.getEntryKind()==IClasspathEntry.CPE_SOURCE){
- if(entry.getPath().equals(new Path(folderPath))){
+ if(entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ if(entry.getPath().equals(new Path(folderPath))) {
return true;
}
}
@@ -185,6 +189,7 @@ public class ClasspathEditor extends AbstractFileEditor implements IClasspathEdi
}
return files;
}
+
/**
*
* @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#createFiles(Set)
diff --git a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java
index 333615f38f6..8811e8cfdb6 100644
--- a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java
+++ b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java
@@ -190,23 +190,29 @@ public class ManifestEditor extends ProjectEditor implements IManifestEditor {
* {@inheritDoc}
*/
@Override
- public void save() throws IOException, CoreException {
+ public void save() {
ByteArrayOutputStream os = new ByteArrayOutputStream();
- this.manifest.write(os);
+ try {
+ this.manifest.write(os);
- final StringReader reader = new StringReader(os.toString("UTF-8")); //$NON-NLS-1$
- this.manifestFile.setContents(new InputStream() {
+ final StringReader reader = new StringReader(os.toString("UTF-8")); //$NON-NLS-1$
+ this.manifestFile.setContents(new InputStream() {
- @Override
- public int read() throws IOException {
- return reader.read();
- }
- }, true, true, null);
-
- //Use the PDE formatter for ManifestFiles
- FormatOperation.format(this.manifestFile, new NullProgressMonitor());
+ @Override
+ public int read() throws IOException {
+ return reader.read();
+ }
+ }, true, true, null);
+
+ //Use the PDE formatter for ManifestFiles
+ FormatOperation.format(this.manifestFile, new NullProgressMonitor());
+ } catch (IOException ex) {
+ Activator.log.error(ex);
+ } catch (CoreException ex) {
+ Activator.log.error(ex);
+ }
}
@Override
diff --git a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IFileEditor.java b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IFileEditor.java
index 543c5178836..f83574d10d4 100644
--- a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IFileEditor.java
+++ b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IFileEditor.java
@@ -54,7 +54,7 @@ public interface IFileEditor {
//TODO : Remove that "Throwable" exception...
/** save the modification on the editor */
- public void save() throws Throwable;
+ public void save();
/**
*
diff --git a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/AbstractProjectEditor.java b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/AbstractProjectEditor.java
index 30e6918ef87..47941284b2d 100644
--- a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/AbstractProjectEditor.java
+++ b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/AbstractProjectEditor.java
@@ -172,7 +172,7 @@ public abstract class AbstractProjectEditor extends AbstractFileEditor implement
*
* {@inheritDoc}
*/
- public void save() throws Throwable {
+ public void save() {
if(this.description != null) {
try {
getProject().setDescription(this.description, null);
diff --git a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/EMFFacetProjectEditor.java b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/EMFFacetProjectEditor.java
index 82800de7f0b..91e42ce01d3 100644
--- a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/EMFFacetProjectEditor.java
+++ b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/EMFFacetProjectEditor.java
@@ -91,6 +91,7 @@ public class EMFFacetProjectEditor extends JavaProjectEditor implements IEMFFace
this.manifestEditor.init();
this.pluginEditor.init();
}
+
/**
*
* @see org.eclipse.papyrus.eclipse.project.editors.project.JavaProjectEditor#getMissingFiles()
@@ -104,6 +105,7 @@ public class EMFFacetProjectEditor extends JavaProjectEditor implements IEMFFace
files.addAll(this.manifestEditor.getMissingFiles());
return files;
}
+
/**
*
* @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IEMFFacetProjectEditor#registerFacetSets(java.util.List)
@@ -205,11 +207,12 @@ public class EMFFacetProjectEditor extends JavaProjectEditor implements IEMFFace
}
@Override
- public void save() throws Throwable {
+ public void save() {
this.pluginEditor.save();
this.manifestEditor.save();
super.save();
}
+
/**
*
* @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IEMFFacetProjectEditor#addDependency(java.lang.String, java.lang.String)
@@ -226,6 +229,7 @@ public class EMFFacetProjectEditor extends JavaProjectEditor implements IEMFFace
this.pluginEditor.create();
this.manifestEditor.create();
}
+
/**
*
* @see org.eclipse.papyrus.eclipse.project.editors.project.JavaProjectEditor#createFiles(java.util.Set)
@@ -258,4 +262,3 @@ public class EMFFacetProjectEditor extends JavaProjectEditor implements IEMFFace
return buildCommand;
}
}
-
diff --git a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/FeatureProjectEditor.java b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/FeatureProjectEditor.java
index 15c7ddad07e..e3f23483b78 100644
--- a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/FeatureProjectEditor.java
+++ b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/FeatureProjectEditor.java
@@ -3,9 +3,7 @@ package org.eclipse.papyrus.eclipse.project.editors.project;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
-import java.util.ArrayList;
import java.util.Collections;
-import java.util.List;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
@@ -13,6 +11,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
@@ -32,7 +31,7 @@ import org.xml.sax.SAXException;
public class FeatureProjectEditor extends ProjectEditor implements IFeatureProjectEditor {
//TODO pour l'externalization : utiliser l'éditeur de Properties! dans java Utils
-
+
private Document fragmentXML;;
private IFile fragmentFile;;
@@ -141,20 +140,23 @@ public class FeatureProjectEditor extends ProjectEditor implements IFeatureProje
* {@inheritDoc}
*/
@Override
- public void save() throws Throwable {
+ public void save() {
if(exists()) {
- TransformerFactory transformerFactory = TransformerFactory.newInstance();
- Transformer transformer = transformerFactory.newTransformer();
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
- StreamResult result = new StreamResult(new StringWriter());
- DOMSource source = new DOMSource(this.fragmentXML);
- transformer.transform(source, result);
-
- InputStream inputStream = getInputStream(result.getWriter().toString());
- if(inputStream == null) {
- throw new Exception("An error occured when modifying plugin.xml ; modifications aborted"); //$NON-NLS-1$
+ try {
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ Transformer transformer = transformerFactory.newTransformer();
+ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
+ StreamResult result = new StreamResult(new StringWriter());
+ DOMSource source = new DOMSource(this.fragmentXML);
+ transformer.transform(source, result);
+
+ InputStream inputStream = getInputStream(result.getWriter().toString());
+ this.fragmentFile.setContents(inputStream, true, true, null);
+ } catch (TransformerException ex) {
+ Activator.log.error(ex);
+ } catch (CoreException ex) {
+ Activator.log.error(ex);
}
- this.fragmentFile.setContents(inputStream, true, true, null);
}
super.save();
}
diff --git a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java
index d788409b28e..b6244e62603 100644
--- a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java
+++ b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java
@@ -20,6 +20,8 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.papyrus.eclipse.project.editors.Activator;
import org.eclipse.papyrus.eclipse.project.editors.file.BuildEditor;
import org.eclipse.papyrus.eclipse.project.editors.file.ClasspathEditor;
import org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor;
@@ -121,9 +123,13 @@ public class JavaProjectEditor extends ProjectEditor implements IJavaProjectEdit
* @throws Throwable
*/
@Override
- public void save() throws Throwable {
+ public void save() {
super.save();
- this.javaProject.save(new NullProgressMonitor(), true);
+ try {
+ this.javaProject.save(new NullProgressMonitor(), true);
+ } catch (JavaModelException ex) {
+ Activator.log.error(ex);
+ }
this.classpathEditor.save();
this.buildEditor.save();
}
diff --git a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java
index 8bc96dfac02..ba840ad71ed 100644
--- a/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java
+++ b/sandbox/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java
@@ -24,6 +24,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
@@ -47,11 +48,11 @@ import org.xml.sax.SAXException;
*/
public class PluginProjectEditor extends ProjectEditor implements IPluginProjectEditor {
- private Document pluginXML;;
+ private Document pluginXML;
- private IFile pluginFile;;
+ private IFile pluginFile;
- private Element pluginRoot;;
+ private Element pluginRoot;
/**
*
@@ -75,7 +76,7 @@ public class PluginProjectEditor extends ProjectEditor implements IPluginProject
* {@inheritDoc}
*/
@Override
- public void init(){
+ public void init() {
this.pluginFile = getPlugin();
if(this.pluginFile != null && this.pluginFile.exists()) {
DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
@@ -164,7 +165,7 @@ public class PluginProjectEditor extends ProjectEditor implements IPluginProject
if(name.equals(EXTENSION)) {
NamedNodeMap attributes = item.getAttributes();
Node point = attributes.getNamedItem(POINT);
- if(extensionPoint.equals(point.getNodeValue())){
+ if(extensionPoint.equals(point.getNodeValue())) {
if(item instanceof Node) {
extensions.add(item);
}
@@ -180,7 +181,8 @@ public class PluginProjectEditor extends ProjectEditor implements IPluginProject
/**
*
- * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IPluginProjectEditor#setAttribute(org.w3c.dom.Element, java.lang.String, java.lang.String)
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IPluginProjectEditor#setAttribute(org.w3c.dom.Element, java.lang.String,
+ * java.lang.String)
*
* {@inheritDoc}
*/
@@ -221,20 +223,27 @@ public class PluginProjectEditor extends ProjectEditor implements IPluginProject
* {@inheritDoc}
*/
@Override
- public void save() throws Throwable {
+ public void save() {
if(exists()) {
- TransformerFactory transformerFactory = TransformerFactory.newInstance();
- Transformer transformer = transformerFactory.newTransformer();
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
- StreamResult result = new StreamResult(new StringWriter());
- DOMSource source = new DOMSource(this.pluginXML);
- transformer.transform(source, result);
+ try {
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ Transformer transformer = transformerFactory.newTransformer();
+ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
+ StreamResult result = new StreamResult(new StringWriter());
+ DOMSource source = new DOMSource(this.pluginXML);
+ transformer.transform(source, result);
- InputStream inputStream = getInputStream(result.getWriter().toString());
- if(inputStream == null) {
- throw new Exception("An error occured when modifying plugin.xml ; modifications aborted"); //$NON-NLS-1$
+ String resultAsString = result.getWriter().toString();
+ if(!resultAsString.endsWith("\n")) {
+ resultAsString += "\n";
+ }
+ InputStream inputStream = getInputStream(resultAsString);
+ this.pluginFile.setContents(inputStream, true, true, null);
+ } catch (TransformerException ex) {
+ Activator.log.error(ex);
+ } catch (CoreException ex) {
+ Activator.log.error(ex);
}
- this.pluginFile.setContents(inputStream, true, true, null);
}
super.save();
}
@@ -264,7 +273,7 @@ public class PluginProjectEditor extends ProjectEditor implements IPluginProject
public Set<String> getMissingFiles() {
Set<String> files = super.getMissingFiles();
IFile plugin = getProject().getFile(PLUGIN_XML_FILE);
- if(!plugin.exists()){
+ if(!plugin.exists()) {
files.add(PLUGIN_XML_FILE);
}
return files;

Back to the top