- Timestamp:
- 07/27/12 18:55:51 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modelicaml/org.openmodelica.modelicaml.common/src/org/openmodelica/modelicaml/common/services/ModelicaMLServices.java
r1593 r1594 8 8 import java.io.OutputStreamWriter; 9 9 import java.io.UnsupportedEncodingException; 10 import java.text.SimpleDateFormat; 10 11 import java.util.ArrayList; 11 12 import java.util.Collections; … … 32 33 import org.eclipse.papyrus.core.utils.BusinessModelResolver; 33 34 import org.eclipse.papyrus.resource.uml.UmlModel; 35 import org.eclipse.papyrus.ui.toolbox.notification.builders.NotificationBuilder; 36 import org.eclipse.swt.widgets.Display; 34 37 import org.eclipse.swt.widgets.Shell; 35 38 import org.eclipse.ui.IWorkbench; … … 44 47 import org.openmodelica.modelicaml.common.instantiation.ClassInstantiation; 45 48 import org.openmodelica.modelicaml.common.instantiation.TreeObject; 49 import org.openmodelica.modelicaml.common.utls.ResourceManager; 46 50 47 51 public class ModelicaMLServices { 48 52 53 /* 54 * Papyrus notification popup 55 */ 56 public static void notify(final String title, final String message, final int messageType, final long displayTimeInSeconds){ 57 Display.getDefault().asyncExec(new Runnable() { 58 public void run() { 59 60 NotificationBuilder notification = new NotificationBuilder(); 61 62 notification.setAsynchronous(true); 63 notification.setTemporary(true); 64 notification.setDelay(displayTimeInSeconds * 1000); 65 // notification.setHTML(true); // does not work :( 66 67 if (messageType == 0) { 68 notification.setType(org.eclipse.papyrus.ui.toolbox.notification.Type.INFO); 69 } 70 else if (messageType == 1) { 71 notification.setType(org.eclipse.papyrus.ui.toolbox.notification.Type.WARNING); 72 } 73 else if (messageType == 2) { 74 notification.setType(org.eclipse.papyrus.ui.toolbox.notification.Type.ERROR); 75 } 76 77 notification.setTitle(title); 78 notification.setMessage(message); 79 80 // set ModelicaML image 81 notification.setImage(ResourceManager.getPluginImage("org.openmodelica.modelicaml.common", "icons/ModelicaML_logo.gif")); 82 83 // run 84 notification.run(); 85 } 86 }); 87 } 49 88 50 89 … … 68 107 // } 69 108 109 // notify("Checking if code generation is needed ... ", 1); 110 70 111 if (generatedCodeTimeStamp != null && modifiedModelTimeStamp != null) { 71 112 // if code was generated after the model modification -> no need for regenerating code … … 84 125 boolean codeGenDirExists = folder.isDirectory(); 85 126 if (codeGenDirExists) { 86 System.err.println("Skipping code generation ... "); 127 128 // System.err.println("Skipping Modelica code generation ... "); 129 130 String resourceName = resource.getURI().toPlatformString(true); 131 SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss"); 132 String lastCodeGeneration = sdf.format(generatedCodeTimeStamp); 133 String lastModification = sdf.format(modifiedModelTimeStamp); 134 135 notify("ModelicaML Code Generation", 136 "Code generation was skipped." + 137 "\nThe model '"+resourceName+"' " + 138 "\nhas not changed since the last code generation." + 139 140 "\n\nLast model modification: "+lastModification + 141 "\nLast code generation : "+lastCodeGeneration, 142 -1, 143 2); 144 87 145 return false; 88 146 }
Note: See TracChangeset
for help on using the changeset viewer.