Index: trunk/org.modelica.mdt.ui/src/org/modelica/mdt/ui/wizards/NewPackageWizard.java
===================================================================
--- trunk/org.modelica.mdt.ui/src/org/modelica/mdt/ui/wizards/NewPackageWizard.java	(revision 291)
+++ trunk/org.modelica.mdt.ui/src/org/modelica/mdt/ui/wizards/NewPackageWizard.java	(revision 292)
@@ -48,4 +48,5 @@
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
@@ -116,66 +117,88 @@
 			this.description = description;
 		}
+		
+		/**
+		 * the workhorse of this class, contains the actual code
+		 * that creates the folder and files of the package
+		 * 
+		 * @param monitor where the progress of creation of the package is 
+		 *  reported
+		 */
+		private void createPackage(IProgressMonitor monitor)
+			throws CoreException
+		{
+			monitor.beginTask("Creating package " + packageName, 2);
+			/*
+			 * generate contents of package.mo
+			 */
+			String contents = "";
+			
+			if (!parentPackage.equals(""))
+			{
+				/* generate within clause if we are not top level package */
+				contents += "within " + parentPackage + ";\n\n";
+			}
+			
+			if (isEncapsulated)
+			{
+				contents += "encapsulated ";
+			}
+			contents += "package " + packageName;
+
+			if (!description.equals(""))
+			{
+				contents += " \"" + description + "\"";
+			}
+			contents += "\n\nend " + packageName + ";";
+			
+			monitor.worked(1);
+
+			/*
+			 * create the new package's root folder  
+			 */
+
+			IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+			IContainer pkgParent = (IContainer) root.findMember(packagePath);
+
+			IFolder pkgFolder = 
+				pkgParent.getFolder(new Path(packageName));
+
+			pkgFolder.create(false, true, null);
+			monitor.worked(1);
+
+			/*
+			 * create the new package's package.mo file
+			 */
+			IFile packageMo = 
+				pkgFolder.getFile(new Path("package.mo"));
+
+			packageMo.create(new ByteArrayInputStream(contents.getBytes()),
+					true, null);
+
+			monitor.done();
+
+		}
 		public void run(IProgressMonitor monitor)
 				throws InvocationTargetException, InterruptedException 
 		{
-			monitor.beginTask("Creating package " + packageName, 3);
-			/*
-			 * generate contents of package.mo
-			 */
-			String contents = "";
-			
-			if (!parentPackage.equals(""))
-			{
-				/* generate within clause if we are not top level package */
-				contents += "within " + parentPackage + ";\n\n";
-			}
-			
-			if (isEncapsulated)
-			{
-				contents += "encapsulated ";
-			}
-			contents += "package " + packageName;
-
-			if (!description.equals(""))
-			{
-				contents += " \"" + description + "\"";
-			}
-			contents += "\n\nend " + packageName + ";";
-			
-			monitor.worked(1);
-
-			try 
-			{
-				/*
-				 * create the new package's root folder  
-				 */
-
-				IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
-				IContainer pkgParent = (IContainer) root.findMember(packagePath);
-
-				IFolder pkgFolder = 
-					pkgParent.getFolder(new Path(packageName));
-
-				pkgFolder.create(false, true, null);
-				monitor.worked(1);
-
-				/*
-				 * create the new package's package.mo file
-				 */
-				IFile packageMo = 
-					pkgFolder.getFile(new Path("package.mo"));
-
-				packageMo.create(new ByteArrayInputStream(contents.getBytes()),
-						true, null);
-				monitor.worked(1);
-
+			/*
+			 * run all package creation operations inside a IWorkspaceRunnble
+			 * to provide better batching of change events
+			 */
+			IWorkspaceRunnable wr = new IWorkspaceRunnable()
+			{
+				public void run(IProgressMonitor monitor) throws CoreException
+				{
+					createPackage(monitor);
+				}
+			};
+			
+			try
+			{
+				ResourcesPlugin.getWorkspace().run(wr, monitor);
 			}
 			catch (CoreException e) 
 			{
 				throw new InvocationTargetException(e);
-			}
-			finally
-			{
-				monitor.done();
 			}
 		}
