Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-06-21 15:27:38 +0000
committercletavernie2012-06-21 15:27:38 +0000
commit9e5c4e44ea6e7740234905a3b885c8d5f7eda845 (patch)
tree112f034a3daba26f7b14dfaee063a9ee834f73cd
parentd02417225438c381315a7ab8593518e5c44f9aa4 (diff)
downloadorg.eclipse.papyrus-9e5c4e44ea6e7740234905a3b885c8d5f7eda845.tar.gz
org.eclipse.papyrus-9e5c4e44ea6e7740234905a3b885c8d5f7eda845.tar.xz
org.eclipse.papyrus-9e5c4e44ea6e7740234905a3b885c8d5f7eda845.zip
346384: Papyrus should provide a wizard to generate a Customization plug-in
https://bugs.eclipse.org/bugs/show_bug.cgi?id=346384
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization/src/org/eclipse/papyrus/customization/plugin/ManifestEditor.java31
1 files changed, 28 insertions, 3 deletions
diff --git a/plugins/customization/org.eclipse.papyrus.customization/src/org/eclipse/papyrus/customization/plugin/ManifestEditor.java b/plugins/customization/org.eclipse.papyrus.customization/src/org/eclipse/papyrus/customization/plugin/ManifestEditor.java
index 6d1045ce0a6..9bdfbf43262 100644
--- a/plugins/customization/org.eclipse.papyrus.customization/src/org/eclipse/papyrus/customization/plugin/ManifestEditor.java
+++ b/plugins/customization/org.eclipse.papyrus.customization/src/org/eclipse/papyrus/customization/plugin/ManifestEditor.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* 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
@@ -47,8 +47,8 @@ public class ManifestEditor {
//TODO : Improve the detection of existing dependency
//If a.b.c exists, then a.b cannot be added (Because it is already contained)
- //Moreover, the Manifest allows newlines anywhere (Including in the
- //middle of a word) : check if these newlines appear in this map,
+ //Moreover, the Manifest allows newlines anywhere (Including in the
+ //middle of a word) : check if these newlines appear in this map,
//or if they have already been parsed. If the manifest value is copied as-is in the map,
//then we need to take care of newlines when parsing it
@@ -71,6 +71,31 @@ public class ManifestEditor {
setValue(key, "", value); //$NON-NLS-1$
}
+ public void setSingleton(boolean singleton) {
+ String value = manifest.getMainAttributes().getValue("bundle-symbolicName");
+ String[] directives = value.split(";");
+
+ if(directives.length == 0) {
+ return; //This should not happen if the Manifest is well-formed
+ } else {
+ value = directives[0];
+ boolean isDefined = false;
+ for(int i = 1; i < directives.length; i++) {
+ String directive = directives[i];
+ if(directive.startsWith("singleton:=")) {
+ directive = "singleton:=" + singleton;
+ isDefined = true;
+ }
+ value += ";" + directive;
+ }
+ if(!isDefined) {
+ value += ";singleton:=" + singleton;
+ }
+ }
+
+ manifest.getMainAttributes().putValue("bundle-symbolicName", value);
+ }
+
public void setValue(String key, String name, String value) {
manifest.getAttributes(key).put(name, value);
}

Back to the top