Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2014-06-02 08:00:27 +0000
committerAnsgar Radermacher2014-06-02 08:02:22 +0000
commitb3dcba1ed8c5dae53dad7558d9efbbcbf050c991 (patch)
tree616560a7c1a78f1a156b0116786b8dbe22dc25b1 /plugins
parent8983ebd426b67124423463e8a642c0a5145e4e17 (diff)
downloadorg.eclipse.papyrus-b3dcba1ed8c5dae53dad7558d9efbbcbf050c991.tar.gz
org.eclipse.papyrus-b3dcba1ed8c5dae53dad7558d9efbbcbf050c991.tar.xz
org.eclipse.papyrus-b3dcba1ed8c5dae53dad7558d9efbbcbf050c991.zip
436296 - [Validation] DSML plugin generation is broken
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java41
-rw-r--r--plugins/infra/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java7
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ProfileDefinitionDialog.java8
3 files changed, 40 insertions, 16 deletions
diff --git a/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java b/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java
index 2c93f7ba872..26f04f9894f 100644
--- a/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java
+++ b/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java
@@ -20,9 +20,9 @@ import java.util.jar.Attributes;
import java.util.jar.Attributes.Name;
import java.util.jar.Manifest;
-import org.eclipse.core.internal.resources.Folder;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -53,6 +53,16 @@ public class ManifestEditor extends ProjectEditor implements IManifestEditor {
/**
*
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#initOk()
+ *
+ * {@inheritDoc}
+ */
+ public boolean initOk() {
+ return (manifest != null) && (manifestFile != null);
+ }
+
+ /**
+ *
* @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#addDependency(java.lang.String)
*
* {@inheritDoc}
@@ -81,8 +91,12 @@ public class ManifestEditor extends ProjectEditor implements IManifestEditor {
this.manifest = new Manifest(this.manifestFile.getContents());
} catch (final IOException e) {
Activator.log.error(e);
+ // assure that exception is not silently captured (for users not examining the error log)
+ throw new RuntimeException(e);
} catch (final CoreException e) {
Activator.log.error(e);
+ // assure that exception is not silently captured (for users not examining the error log)
+ throw new RuntimeException(e);
}
}
@@ -275,9 +289,9 @@ public class ManifestEditor extends ProjectEditor implements IManifestEditor {
final String input = "Manifest-Version: 1.0\n"; //without the "/n", it doesn't work!!!!! //$NON-NLS-1$
if(!this.manifestFile.getParent().exists()) {
final IContainer parent = this.manifestFile.getParent();
- if(parent instanceof Folder) {
+ if(parent instanceof IFolder) {
if(!parent.exists()) {
- ((Folder)parent).create(true, false, null);
+ ((IFolder)parent).create(true, false, null);
}
}
}
@@ -286,13 +300,12 @@ public class ManifestEditor extends ProjectEditor implements IManifestEditor {
this.manifest = new Manifest(this.manifestFile.getContents());
- final int i;
- // InputStream is = this.manifestFile.getContents();
- // while((i = is.read()) > 0) {
-
- // System.out.println(i);
- // }
- // this.manifest = new Manifest(this.manifestFile.getContents());
+ // final int i;
+ // InputStream is = this.manifestFile.getContents();
+ // while((i = is.read()) > 0) {
+ // System.out.println(i);
+ // }
+ // this.manifest = new Manifest(this.manifestFile.getContents());
} catch (final CoreException ex) {
Activator.log.error(ex);
@@ -336,7 +349,13 @@ public class ManifestEditor extends ProjectEditor implements IManifestEditor {
if(this.manifest != null) {
final Name symbolicName = new Name(BUNDLE_SYMBOLIC_NAME);
final String name = this.manifest.getMainAttributes().getValue(symbolicName);
- return name;
+ int semiColon = name.indexOf(";"); //$NON-NLS-1$
+ if (semiColon != -1) {
+ return name.substring(0, semiColon);
+ }
+ else {
+ return name;
+ }
}
return null;
}
diff --git a/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java b/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java
index ba840ad71ed..7b9ec396eea 100644
--- a/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java
+++ b/plugins/infra/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java
@@ -229,13 +229,16 @@ public class PluginProjectEditor extends ProjectEditor implements IPluginProject
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+ transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", //$NON-NLS-1$
+ "3"); //$NON-NLS-1$
StreamResult result = new StreamResult(new StringWriter());
DOMSource source = new DOMSource(this.pluginXML);
transformer.transform(source, result);
String resultAsString = result.getWriter().toString();
- if(!resultAsString.endsWith("\n")) {
- resultAsString += "\n";
+ if(!resultAsString.endsWith("\n")) { //$NON-NLS-1$
+ resultAsString += "\n"; //$NON-NLS-1$
}
InputStream inputStream = getInputStream(resultAsString);
this.pluginFile.setContents(inputStream, true, true, null);
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ProfileDefinitionDialog.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ProfileDefinitionDialog.java
index 8e846a173d9..a76f6c92aa1 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ProfileDefinitionDialog.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/ui/dialogs/ProfileDefinitionDialog.java
@@ -260,14 +260,16 @@ public class ProfileDefinitionDialog extends TitleAreaDialog {
group.setLayout(layout);
// new copyright area
- constraintCheck = new Button(group, SWT.CHECK);
+ constraintCheck = new Button(group, SWT.RADIO);
// Enable button by default, see bug #411256
constraintCheck.setSelection(true);
// should look
- constraintCheck.setText("Save OCL constraints into the definition"); //$NON-NLS-1$
+ constraintCheck.setText("Save constraints into the definition (OCL only)"); //$NON-NLS-1$
+ Button writeToPlugin = new Button(group, SWT.RADIO);
+ writeToPlugin.setText("Ignore. Use this option, if you use (a generated) plugin that embeds the constraints"); //$NON-NLS-1$
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
gd.heightHint = 60;
- constraintCheck.setLayoutData(gd);
+ group.setLayoutData(gd);
return group;
}
/**

Back to the top