Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/.classpath7
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/.project28
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/META-INF/MANIFEST.MF15
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/about.html28
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/build.properties7
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/plugin.properties16
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/plugin.xml18
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/test/thousandcreation/Activator.java63
-rw-r--r--examples/uml/org.eclipse.papyrus.thousandcreation/test/thousandcreation/HugeModelGenerationAction.java102
10 files changed, 292 insertions, 0 deletions
diff --git a/examples/uml/org.eclipse.papyrus.thousandcreation/.classpath b/examples/uml/org.eclipse.papyrus.thousandcreation/.classpath
new file mode 100644
index 00000000000..046bda900d2
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.thousandcreation/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="test"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/examples/uml/org.eclipse.papyrus.thousandcreation/.project b/examples/uml/org.eclipse.papyrus.thousandcreation/.project
new file mode 100644
index 00000000000..5bf180e0524
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.thousandcreation/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.thousandcreation</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/uml/org.eclipse.papyrus.thousandcreation/.settings/org.eclipse.jdt.core.prefs b/examples/uml/org.eclipse.papyrus.thousandcreation/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..523e856185d
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.thousandcreation/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Tue May 25 17:19:17 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/examples/uml/org.eclipse.papyrus.thousandcreation/META-INF/MANIFEST.MF b/examples/uml/org.eclipse.papyrus.thousandcreation/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..b3841fbcfd8
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.thousandcreation/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %providerName
+Bundle-SymbolicName: org.eclipse.papyrus.thousandcreation;singleton:=true
+Bundle-Version: 0.9.0.qualifier
+Bundle-Activator: thousandcreation.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.views.modelexplorer;bundle-version="0.9.0",
+ org.eclipse.uml2.uml;bundle-version="3.1.0",
+ org.eclipse.papyrus.infra.core;bundle-version="0.9.0",
+ org.eclipse.emf.transaction;bundle-version="1.4.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %providerName
diff --git a/examples/uml/org.eclipse.papyrus.thousandcreation/about.html b/examples/uml/org.eclipse.papyrus.thousandcreation/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.thousandcreation/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/examples/uml/org.eclipse.papyrus.thousandcreation/build.properties b/examples/uml/org.eclipse.papyrus.thousandcreation/build.properties
new file mode 100644
index 00000000000..09c456ca488
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.thousandcreation/build.properties
@@ -0,0 +1,7 @@
+source.. = test/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ plugin.properties
diff --git a/examples/uml/org.eclipse.papyrus.thousandcreation/plugin.properties b/examples/uml/org.eclipse.papyrus.thousandcreation/plugin.properties
new file mode 100644
index 00000000000..d1c7cb7c8de
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.thousandcreation/plugin.properties
@@ -0,0 +1,16 @@
+##########################################################################################
+# Copyright (c) 2010 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
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+#
+########################################################################################
+pluginName= org.eclipse.papyrus.thousandcreation(Incubation)
+providerName=Eclipse Modeling Project
+
diff --git a/examples/uml/org.eclipse.papyrus.thousandcreation/plugin.xml b/examples/uml/org.eclipse.papyrus.thousandcreation/plugin.xml
new file mode 100644
index 00000000000..8c205d51797
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.thousandcreation/plugin.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="false"
+ id="generateHugeModel"
+ objectClass="org.eclipse.core.runtime.IAdaptable">
+ <action
+ class="thousandcreation.HugeModelGenerationAction"
+ id="generateHugeModel"
+ label="Genereate Huge Model">
+ </action>
+ </objectContribution>
+ </extension>
+
+</plugin>
diff --git a/examples/uml/org.eclipse.papyrus.thousandcreation/test/thousandcreation/Activator.java b/examples/uml/org.eclipse.papyrus.thousandcreation/test/thousandcreation/Activator.java
new file mode 100644
index 00000000000..190ddd313b9
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.thousandcreation/test/thousandcreation/Activator.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package thousandcreation;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.thousandcreation"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/examples/uml/org.eclipse.papyrus.thousandcreation/test/thousandcreation/HugeModelGenerationAction.java b/examples/uml/org.eclipse.papyrus.thousandcreation/test/thousandcreation/HugeModelGenerationAction.java
new file mode 100644
index 00000000000..5c348eea1e1
--- /dev/null
+++ b/examples/uml/org.eclipse.papyrus.thousandcreation/test/thousandcreation/HugeModelGenerationAction.java
@@ -0,0 +1,102 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package thousandcreation;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.ui.IActionDelegate;
+import org.eclipse.uml2.uml.Package;
+
+
+public class HugeModelGenerationAction implements IActionDelegate {
+
+ protected Package selectedPackage;
+ protected final static int packageNumber=200;
+ protected final static int classNumber=1000;
+ protected final static String chars = "abcdefghijklmnopqrstuvwxyz";
+ protected final static String mchars="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+ public HugeModelGenerationAction() {
+ // TODO Auto-generated constructor stub
+ }
+
+/**
+ * generate a string
+ * @param length the length of the string
+ * @return a string
+ */
+ public static String generateName(int length)
+ {
+
+ String pass = "";
+ for(int i=0;i<length;i++)
+ {
+ if( i==0){
+ int integer = (int)Math.floor(Math.random() * 26);
+ pass += mchars.charAt(integer);
+ }
+ else{
+ int integer = (int)Math.floor(Math.random() * 26);
+ pass += chars.charAt(integer);
+ }
+ }
+ return pass;
+ }
+
+
+ public void run(IAction action) {
+ TransactionalEditingDomain editingDomain = EditorUtils
+ .getTransactionalEditingDomain();
+ if (editingDomain != null && selectedPackage!=null) {
+ Command command = new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ for(int i=0; i<packageNumber;i++){
+ //create packages
+ Package currentPackage=selectedPackage.createNestedPackage(generateName(10));
+ for( int j=0; j<classNumber;j++){
+ //create classes
+ currentPackage.createOwnedClass(generateName(10), false);
+ }
+ System.out.println("package "+i +"/"+packageNumber+" done.");
+ }
+ }
+ };
+ editingDomain.getCommandStack().execute(command);
+ }
+
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (selection instanceof IStructuredSelection){
+ if( ((IStructuredSelection)selection).getFirstElement() instanceof IAdaptable){
+ EObject eObject=(EObject)((IAdaptable)((IStructuredSelection)selection).getFirstElement()).getAdapter(EObject.class);
+ if( eObject instanceof Package){
+ selectedPackage=(org.eclipse.uml2.uml.Package)eObject;
+ }
+ }
+
+ }
+
+ }
+
+}

Back to the top