| author | Rainer Pielmann | 2012-05-29 07:21:24 (EDT) |
|---|---|---|
| committer | Manik Kishore | 2012-06-05 00:07:48 (EDT) |
| commit | 7c333651f758afa255ad5a5944b1676d86d404f5 (patch) (side-by-side diff) | |
| tree | cbaea6e2601f82b0ade9b935c3298de6caf50204 | |
| parent | bbc7d6bc0eb12566db066b400c8537c7ab1c5e7c (diff) | |
| download | org.eclipse.stardust.ide-7c333651f758afa255ad5a5944b1676d86d404f5.zip org.eclipse.stardust.ide-7c333651f758afa255ad5a5944b1676d86d404f5.tar.gz org.eclipse.stardust.ide-7c333651f758afa255ad5a5944b1676d86d404f5.tar.bz2 | |
Jira-ID: CRNT-24883
NPE occurred in applying license while model creation
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@56666 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
2 files changed, 126 insertions, 18 deletions
diff --git a/model/org.eclipse.stardust.model.xpdl/src/org/eclipse/stardust/model/xpdl/carnot/util/VariableContextHelper.java b/model/org.eclipse.stardust.model.xpdl/src/org/eclipse/stardust/model/xpdl/carnot/util/VariableContextHelper.java index ab45818..b204302 100644 --- a/model/org.eclipse.stardust.model.xpdl/src/org/eclipse/stardust/model/xpdl/carnot/util/VariableContextHelper.java +++ b/model/org.eclipse.stardust.model.xpdl/src/org/eclipse/stardust/model/xpdl/carnot/util/VariableContextHelper.java @@ -45,16 +45,26 @@ public class VariableContextHelper public synchronized void createContext(ModelType modelType) { - contextMap.put(modelType.getId(), new VariableContext());
+ if (modelType != null)
+ {
+ contextMap.put(modelType.getId(), new VariableContext());
+ }
} public synchronized void removeContext(ModelType modelType) { - contextMap.remove(modelType.getId());
+ if (modelType != null)
+ {
+ contextMap.remove(modelType.getId());
+ }
} public synchronized VariableContext getContext(ModelType modelType) { + if (modelType == null)
+ {
+ return null;
+ }
return contextMap.get(modelType.getId());
} @@ -77,7 +87,7 @@ public class VariableContextHelper public synchronized void updateContextID(ModelType modelType, String newID)
{
- if (contextMap.get(modelType.getId()) != null)
+ if (modelType != null && contextMap.get(modelType.getId()) != null)
{
VariableContext context = contextMap.remove(modelType.getId());
contextMap.put(newID, context);
@@ -86,12 +96,15 @@ public class VariableContextHelper public synchronized void storeVariables(ModelType workflowModel, boolean save)
{
- createContext(workflowModel);
- getContext(workflowModel).initializeVariables(workflowModel);
- getContext(workflowModel).refreshVariables(workflowModel);
- if (save)
+ if (workflowModel != null)
{
- getContext(workflowModel).saveVariables();
+ createContext(workflowModel);
+ getContext(workflowModel).initializeVariables(workflowModel);
+ getContext(workflowModel).refreshVariables(workflowModel);
+ if (save)
+ {
+ getContext(workflowModel).saveVariables();
+ }
}
}
diff --git a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/editors/WorkflowModelEditor.java b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/editors/WorkflowModelEditor.java index 7eab97d..53778ce 100644 --- a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/editors/WorkflowModelEditor.java +++ b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/editors/WorkflowModelEditor.java @@ -13,10 +13,29 @@ package org.eclipse.stardust.modeling.core.editors; import java.io.FileNotFoundException; import java.io.IOException; import java.text.MessageFormat; -import java.util.*; - -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceDeltaVisitor; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; @@ -39,9 +58,24 @@ import org.eclipse.stardust.common.CompareHelper; import org.eclipse.stardust.common.config.CurrentVersion; import org.eclipse.stardust.common.config.Version; import org.eclipse.stardust.engine.api.model.Modules; -import org.eclipse.stardust.model.xpdl.carnot.*; +import org.eclipse.stardust.model.xpdl.carnot.ActivityImplementationType; +import org.eclipse.stardust.model.xpdl.carnot.DiagramType; +import org.eclipse.stardust.model.xpdl.carnot.EndEventSymbol; +import org.eclipse.stardust.model.xpdl.carnot.IGraphicalObject; +import org.eclipse.stardust.model.xpdl.carnot.IIdentifiableModelElement; +import org.eclipse.stardust.model.xpdl.carnot.IModelElement; +import org.eclipse.stardust.model.xpdl.carnot.IModelElementNodeSymbol; +import org.eclipse.stardust.model.xpdl.carnot.INodeSymbol; +import org.eclipse.stardust.model.xpdl.carnot.ModelType; +import org.eclipse.stardust.model.xpdl.carnot.ProcessDefinitionType; +import org.eclipse.stardust.model.xpdl.carnot.PublicInterfaceSymbol; +import org.eclipse.stardust.model.xpdl.carnot.StartEventSymbol; import org.eclipse.stardust.model.xpdl.carnot.spi.SpiExtensionRegistry; -import org.eclipse.stardust.model.xpdl.carnot.util.*; +import org.eclipse.stardust.model.xpdl.carnot.util.ActivityUtil; +import org.eclipse.stardust.model.xpdl.carnot.util.CarnotConstants; +import org.eclipse.stardust.model.xpdl.carnot.util.ModelUtils; +import org.eclipse.stardust.model.xpdl.carnot.util.VariableContextHelper; +import org.eclipse.stardust.model.xpdl.carnot.util.WorkflowModelManager; import org.eclipse.stardust.modeling.common.projectnature.BpmProjectNature; import org.eclipse.stardust.modeling.common.ui.BpmUiActivator; import org.eclipse.stardust.modeling.common.ui.IWorkflowModelEditor; @@ -53,7 +87,57 @@ import org.eclipse.stardust.modeling.core.decoration.IDecorationTarget; import org.eclipse.stardust.modeling.core.editors.parts.IconFactory; import org.eclipse.stardust.modeling.core.editors.parts.NotificationAdaptee; import org.eclipse.stardust.modeling.core.editors.parts.NotificationAdapter; -import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.*; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.AddExternalReferenceAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CloseDiagramAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CommitChangesAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.ConnectAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CopyAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateActivityAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateActivityGraphAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateApplicationAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateConditionalPerformerAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateDataAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateDiagramAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateInteractiveApplicationAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateLinkTypeAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateOrganizationAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateOrganizationHierarchyAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateProcessDefinitionAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateRepositoryConnectionAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateRoleAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateSubprocessAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.CreateTriggerAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.DeleteExternalReferenceAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.DeleteSymbolAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.DeployModelAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.ElementSelectionAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.ExportDiagramAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.FixInvalidIdsAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.ForwardDeleteAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.ImportConnectionObjectAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.ImportModelElementsAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.LockAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.LockAllAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.OpenDiagramAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.OptimizeDiagramAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.PasteAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.ReferencesSearchAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.RefreshConnectionObjectAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.ReloadConnectionsAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.ResetSubprocessAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.RevertChangesAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.SearchAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.SearchConnectionAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.SetDefaultParticipantAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.ShareModelAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.ShowPropertiesAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.UnLockAllAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.UnshareModelAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.UpdateDiagramAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.UpdateModelAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.UpgradeDataAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.UpgradeModelAndDiagramAction; +import org.eclipse.stardust.modeling.core.editors.parts.diagram.actions.ValidateModelAction; import org.eclipse.stardust.modeling.core.editors.parts.diagram.commands.DeleteSymbolCommandFactory; import org.eclipse.stardust.modeling.core.jobs.ModelValidationJob; import org.eclipse.stardust.modeling.core.modelserver.ModelServer; @@ -65,7 +149,17 @@ import org.eclipse.swt.SWTException; import org.eclipse.swt.events.ShellAdapter; import org.eclipse.swt.events.ShellEvent; import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.*; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.IPropertyListener; +import org.eclipse.ui.IURIEditorInput; +import org.eclipse.ui.IWindowListener; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.dialogs.SaveAsDialog; import org.eclipse.ui.ide.IGotoMarker; @@ -960,12 +1054,13 @@ public class WorkflowModelEditor extends AbstractMultiPageGraphicalEditor protected void validateModel() { - VariableContextHelper.getInstance().storeVariables(getWorkflowModel(), true); if (getWorkflowModel() == null) { - // todo: (fh) should not happen, investigate + // When dealing with no or an invalid license this can happen return; } + + VariableContextHelper.getInstance().storeVariables(getWorkflowModel(), true); if (!PlatformUI.getPreferenceStore().getBoolean( BpmProjectNature.PREFERENCE_AUTO_VALIDATION)) |

