Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddonchev2011-11-17 01:26:09 +0000
committerddonchev2011-11-17 01:26:09 +0000
commitaa76fe6d61773ad591fea885bdbbb0a1a90e9d0e (patch)
tree2ea281144d34de1644ca092a2a4b3b358d9d6680
parent8075be4980ed67d12212dd7c5fe7d944b5e2ef6a (diff)
downloadorg.eclipse.webtools.incubator.sieditor-RemoveTestCodeFromProductive.tar.gz
org.eclipse.webtools.incubator.sieditor-RemoveTestCodeFromProductive.tar.xz
org.eclipse.webtools.incubator.sieditor-RemoveTestCodeFromProductive.zip
Remove some test code in productive code.RemoveTestCodeFromProductive
Add reference from test plug-in to Mockito Small refactorings Change-Id: I4b829726bb4f4f3b1fa8ad4d68c167f4bf4ec4a5 Signed-off-by: ddonchev <dimitar.donchev@sap.com>
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/command/emf/xsd/AddEnumFacetToElementCommand.java21
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/model/utils/StatusUtils.java57
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.test/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/all/UITestsSuite.java6
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/model/commands/wsdl/RemoveSchemaCommandTest.java2
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/readonly/SIFormPageControllerReadOnlyTest.java102
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/dt/DataTypesFormPageControllerJUnitTest.java62
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/dt/DataTypesFormPageControllerPlugInTest.java203
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/AbstractFileContentChangeTest.java97
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/TestFileChangedWhileEditingWSDL.java190
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/TestFileChangedWhileEditingXSD.java167
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/TestModelRevertToSaved.java403
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/AbstractEditorWithSourcePage.java6
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/DialogManager.java46
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/EditorActivationListener.java206
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/AbstractFormPageController.java11
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/DataTypesFormPageController.java248
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/SiEditorDataTypesFormPageController.java3
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/extractwizard/ExtractNamespaceWizard.java3
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/quickFix/MissingSchemaElementQuickFix.java3
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/quickFix/MissingSchemaForSchemaQuickFix.java3
-rw-r--r--plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/wsdl/controller/SIFormPageController.java45
22 files changed, 900 insertions, 987 deletions
diff --git a/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/command/emf/xsd/AddEnumFacetToElementCommand.java b/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/command/emf/xsd/AddEnumFacetToElementCommand.java
index 9200215..80506a7 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/command/emf/xsd/AddEnumFacetToElementCommand.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/command/emf/xsd/AddEnumFacetToElementCommand.java
@@ -14,20 +14,11 @@
*******************************************************************************/
package org.eclipse.wst.sse.sieditor.command.emf.xsd;
-import java.text.MessageFormat;
-
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDPackage;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDTypeDefinition;
-
import org.eclipse.wst.sse.sieditor.command.common.AbstractNotificationOperation;
import org.eclipse.wst.sse.sieditor.model.api.IModelRoot;
import org.eclipse.wst.sse.sieditor.model.api.INamedObject;
@@ -38,6 +29,12 @@ import org.eclipse.wst.sse.sieditor.model.xsd.api.IElement;
import org.eclipse.wst.sse.sieditor.model.xsd.api.ISimpleType;
import org.eclipse.wst.sse.sieditor.model.xsd.api.IStructureType;
import org.eclipse.wst.sse.sieditor.model.xsd.impl.Element;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDPackage;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDTypeDefinition;
public class AddEnumFacetToElementCommand extends AbstractNotificationOperation {
@@ -89,8 +86,7 @@ public class AddEnumFacetToElementCommand extends AbstractNotificationOperation
IStatus status = setAnonymousSimpleTypeCommand.run(monitor, info);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.SET_FACET_TITLE, MessageFormat.format(Messages.CANNOT_ADD_FACET_ERR, input
- .getName()), status);
+ //TODO - an error dialog was bein opened here (From the model code!). Check if the erroneous status is managed correctly
return status;
}
@@ -99,8 +95,7 @@ public class AddEnumFacetToElementCommand extends AbstractNotificationOperation
addFacetCommand.setType(newType);
status = addFacetCommand.run(monitor, info);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.SET_FACET_TITLE, MessageFormat.format(Messages.CANNOT_ADD_FACET_ERR, input
- .getName()), status);
+ //TODO - an error dialog was bein opened here (From the model code!). Check if the erroneous status is managed correctly
return status;
}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/model/utils/StatusUtils.java b/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/model/utils/StatusUtils.java
index 58293c7..493ea9a 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/model/utils/StatusUtils.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.model/api/org/eclipse/wst/sse/sieditor/model/utils/StatusUtils.java
@@ -21,66 +21,11 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
public class StatusUtils {
- //FIXME test code in productive codebase
- public static boolean isUnderJunitExecution = false;
- private static long showStatusDialog_calls = 0;
-
- private static long showDialogWithResult_calls = 0;
-
- public static boolean canContinue(IStatus status) {
+ public static boolean canContinue(IStatus status) {
return status == null ||
status.getSeverity() == IStatus.OK ||
status.getSeverity() == IStatus.INFO ||
status.getSeverity() == IStatus.WARNING;
}
-
- public static void showStatusDialog(String dialogTitle, IStatus statusToShow) {
- showStatusDialog(dialogTitle, "", statusToShow); //$NON-NLS-1$
- }
-
- public static void showStatusDialog(String dialogTitle, String message, IStatus statusToShow) {
- if(statusToShow instanceof HiddenErrorStatus) {
- return;
- }
-
- if(isUnderJunitExecution) {
- showStatusDialog_calls++;
- return;
- }
-
-
- if(message.length() == 0) {
- message = statusToShow.getMessage();
- }
-
- switch(statusToShow.getSeverity()) {
- case IStatus.ERROR:
- ErrorDialog.openError(Display.getDefault().getActiveShell(), dialogTitle, message, statusToShow);
- break;
- case IStatus.WARNING:
- MessageDialog.openWarning(Display.getDefault().getActiveShell(), dialogTitle, message);
- break;
- case IStatus.INFO:
- MessageDialog.openInformation(Display.getDefault().getActiveShell(), dialogTitle, message);
- break;
- }
- }
-
- public static boolean showDialogWithResult(int kind, String title, String message) {
- //FIXME - test code in productive code base
- if(isUnderJunitExecution) {
- showDialogWithResult_calls++;
- return true;
- }
- return MessageDialog.open(kind, Display.getDefault().getActiveShell(), title, message, SWT.NONE);
- }
-
- public static long getShowStatusDialog_calls() {
- return showStatusDialog_calls;
- }
-
- public static long getShowDialogWithResult_calls_calls() {
- return showDialogWithResult_calls;
- }
}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.sse.sieditor.test/META-INF/MANIFEST.MF
index f5d4795..a21fee4 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.test/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.sse.sieditor.test/META-INF/MANIFEST.MF
@@ -33,7 +33,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.wst.sse.sieditor.fwk;bundle-version="1.0.0",
org.eclipse.wst.sse.sieditor.model;bundle-version="1.0.0",
org.eclipse.wst.sse.sieditor.ui;bundle-version="1.0.0",
- org.easymock3;bundle-version="3.0.0"
+ org.easymock3;bundle-version="3.0.0",
+ org.mockito.mockito-all;bundle-version="1.9.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.wst.sse.sieditor.test;uses:="org.osgi.framework",
diff --git a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/all/UITestsSuite.java b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/all/UITestsSuite.java
index eca9f62..701eca7 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/all/UITestsSuite.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/all/UITestsSuite.java
@@ -90,9 +90,10 @@ import org.eclipse.wst.sse.sieditor.test.ui.v2.providers.TestWSDLContentProvider
import org.eclipse.wst.sse.sieditor.test.ui.v2.providers.TestWSDLDetailsPageProvider;
import org.eclipse.wst.sse.sieditor.test.ui.v2.providers.TestWSDLLabelProvider;
import org.eclipse.wst.sse.sieditor.test.ui.v2.resources.TestCanEditResource;
+import org.eclipse.wst.sse.sieditor.test.ui.v2.resources.TestFileChangedWhileEditingWSDL;
+import org.eclipse.wst.sse.sieditor.test.ui.v2.resources.TestFileChangedWhileEditingXSD;
import org.eclipse.wst.sse.sieditor.test.ui.v2.resources.TestIsSetEditValidatorWhenCreateModel;
import org.eclipse.wst.sse.sieditor.test.ui.v2.resources.TestModelFileMoved;
-import org.eclipse.wst.sse.sieditor.test.ui.v2.resources.TestModelRevertToSaved;
import org.eclipse.wst.sse.sieditor.test.ui.v2.sections.AbstractDetailsPageSectionTest;
import org.eclipse.wst.sse.sieditor.test.ui.v2.sections.DocumentationSectionTest;
import org.eclipse.wst.sse.sieditor.test.ui.v2.sections.ElementDetailsSectionRefreshFromRefToNonRefReLayoutTest;
@@ -237,7 +238,8 @@ import org.junit.runners.Suite.SuiteClasses;
DescriptionTypeResolverTest.class,
SchemaTypeResolverTest.class,
AbstractEditorWithSourcePageUndoHandlersDisposeTest.class,
- TestModelRevertToSaved.class,
+ TestFileChangedWhileEditingXSD.class,
+ TestFileChangedWhileEditingWSDL.class,
TestCanEditResource.class,
ElementTypeEditorTest.class,
ParameterTypeEditorTest.class,
diff --git a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/model/commands/wsdl/RemoveSchemaCommandTest.java b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/model/commands/wsdl/RemoveSchemaCommandTest.java
index 95e70c3..7a31f85 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/model/commands/wsdl/RemoveSchemaCommandTest.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/model/commands/wsdl/RemoveSchemaCommandTest.java
@@ -24,7 +24,7 @@ import org.eclipse.wst.sse.sieditor.command.common.AbstractNotificationOperation
import org.eclipse.wst.sse.sieditor.command.emf.wsdl.RemoveSchemaCommand;
import org.eclipse.wst.sse.sieditor.model.api.IWsdlModelRoot;
import org.eclipse.wst.sse.sieditor.model.xsd.api.ISchema;
-
+//FIXME this test is very slow -90 seconds on an i7. Investigate !
public class RemoveSchemaCommandTest extends AbstractCommandTest {
private static final String SCHEMA_TARGET_NAMESPACE = "http://www.example.org/NewWSDLFile/";
diff --git a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/readonly/SIFormPageControllerReadOnlyTest.java b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/readonly/SIFormPageControllerReadOnlyTest.java
index b5ec255..caa7645 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/readonly/SIFormPageControllerReadOnlyTest.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/readonly/SIFormPageControllerReadOnlyTest.java
@@ -18,12 +18,26 @@ import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.only;
+import static org.mockito.Mockito.verifyZeroInteractions;
import java.io.IOException;
import java.util.ArrayList;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.sse.sieditor.model.api.IModelObject;
+import org.eclipse.wst.sse.sieditor.model.api.IWsdlModelRoot;
+import org.eclipse.wst.sse.sieditor.model.utils.StatusUtils;
+import org.eclipse.wst.sse.sieditor.model.wsdl.api.IParameter;
+import org.eclipse.wst.sse.sieditor.model.wsdl.api.IServiceInterface;
+import org.eclipse.wst.sse.sieditor.model.wsdl.api.OperationType;
+import org.eclipse.wst.sse.sieditor.model.xsd.api.IType;
+import org.eclipse.wst.sse.sieditor.test.util.SIEditorBaseTest;
+import org.eclipse.wst.sse.sieditor.ui.DialogManager;
import org.eclipse.wst.sse.sieditor.ui.v2.nodes.ITreeNode;
import org.eclipse.wst.sse.sieditor.ui.v2.wsdl.controller.SIFormPageController;
import org.eclipse.wst.sse.sieditor.ui.v2.wsdltree.nodes.FaultNode;
@@ -31,20 +45,12 @@ import org.eclipse.wst.sse.sieditor.ui.v2.wsdltree.nodes.OperationCategory;
import org.eclipse.wst.sse.sieditor.ui.v2.wsdltree.nodes.OperationNode;
import org.eclipse.wst.sse.sieditor.ui.v2.wsdltree.nodes.ParameterNode;
import org.eclipse.wst.sse.sieditor.ui.v2.wsdltree.nodes.ServiceInterfaceNode;
-import org.eclipse.wst.sse.sieditor.test.util.SIEditorBaseTest;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-
-import org.eclipse.wst.sse.sieditor.model.api.IModelObject;
-import org.eclipse.wst.sse.sieditor.model.api.IWsdlModelRoot;
-import org.eclipse.wst.sse.sieditor.model.utils.StatusUtils;
-import org.eclipse.wst.sse.sieditor.model.wsdl.api.IParameter;
-import org.eclipse.wst.sse.sieditor.model.wsdl.api.IServiceInterface;
-import org.eclipse.wst.sse.sieditor.model.wsdl.api.OperationType;
-import org.eclipse.wst.sse.sieditor.model.xsd.api.IType;
+import org.mockito.Mockito;
/**
*
@@ -66,12 +72,15 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
public static void tearDownAfterClass() throws Exception {
}
+ public static DialogManager dialogManager;
+
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
super.setUp();
+ dialogManager = mock(DialogManager.class);
}
/**
@@ -85,7 +94,7 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
private static class TestSIFormPageController extends SIFormPageController {
public TestSIFormPageController(IWsdlModelRoot model, boolean readOnly) {
- super(model, readOnly,false);
+ super(model, readOnly, false);
}
public Boolean isEditAllowed;
@@ -102,6 +111,10 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
return isDeleteAllowed != null ? isDeleteAllowed.booleanValue() : super.isDeleteAllowed(editedObject);
}
+ @Override
+ protected DialogManager getDialogManager() {
+ return dialogManager;
+ }
}
/**
@@ -149,25 +162,21 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false);
sifpc.isEditAllowed = Boolean.valueOf(true);
- StatusUtils.isUnderJunitExecution = true;
- long statusCalls = StatusUtils.getShowStatusDialog_calls();
-
int siCount = wsdlRoot.getDescription().getAllInterfaces().size();
sifpc.addNewServiceInterface();
- assertEquals(0, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ verifyZeroInteractions(dialogManager);
assertEquals(siCount + 1, wsdlRoot.getDescription().getAllInterfaces().size());
// with a readOnly controller
sifpc.isEditAllowed = Boolean.valueOf(false);
- statusCalls = StatusUtils.getShowStatusDialog_calls();
siCount = wsdlRoot.getDescription().getAllInterfaces().size();
sifpc.addNewServiceInterface();
- assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verify(dialogManager, only()).showStatusDialog(isA(String.class), isA(IStatus.class));
assertEquals(siCount, wsdlRoot.getDescription().getAllInterfaces().size());
}
@@ -187,9 +196,6 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false);
sifpc.isEditAllowed = Boolean.valueOf(true);
- StatusUtils.isUnderJunitExecution = true;
- long statusCalls = StatusUtils.getShowStatusDialog_calls();
-
IServiceInterface serviceInterface = wsdlRoot.getDescription().getAllInterfaces().iterator().next();
ServiceInterfaceNode siNode = new ServiceInterfaceNode(null, serviceInterface, sifpc);
sifpc.getTreeNodeMapper().addToNodeMap(serviceInterface, siNode);
@@ -198,18 +204,18 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
sifpc.addNewOperation(siNode);
- assertEquals(0, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verifyZeroInteractions(dialogManager);
assertEquals(operationsCount + 1, serviceInterface.getAllOperations().size());
// with a readOnly controller
sifpc.isEditAllowed = Boolean.valueOf(false);
- statusCalls = StatusUtils.getShowStatusDialog_calls();
operationsCount = serviceInterface.getAllOperations().size();
sifpc.addNewOperation(siNode);
- assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verify(dialogManager, only()).showStatusDialog(isA(String.class), isA(IStatus.class));
+
assertEquals(operationsCount, serviceInterface.getAllOperations().size());
}
@@ -229,9 +235,6 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false);
sifpc.isEditAllowed = Boolean.valueOf(true);
- StatusUtils.isUnderJunitExecution = true;
- long statusCalls = StatusUtils.getShowStatusDialog_calls();
-
IServiceInterface serviceInterface = wsdlRoot.getDescription().getAllInterfaces().iterator().next();
ServiceInterfaceNode siNode = new ServiceInterfaceNode(null, serviceInterface, sifpc);
sifpc.getTreeNodeMapper().addToNodeMap(serviceInterface, siNode);
@@ -242,18 +245,17 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
sifpc.addNewFault(operationNode);
- assertEquals(0, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verifyZeroInteractions(dialogManager);
assertEquals(faultsCount + 1, operationNode.getModelObject().getAllFaults().size());
// with a readOnly controller
sifpc.isEditAllowed = Boolean.valueOf(false);
- statusCalls = StatusUtils.getShowStatusDialog_calls();
faultsCount = operationNode.getModelObject().getAllFaults().size();
sifpc.addNewFault(operationNode);
- assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verify(dialogManager, only()).showStatusDialog(isA(String.class), isA(IStatus.class));
assertEquals(faultsCount, operationNode.getModelObject().getAllFaults().size());
}
@@ -273,9 +275,6 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false);
sifpc.isEditAllowed = Boolean.valueOf(true);
- StatusUtils.isUnderJunitExecution = true;
- long statusCalls = StatusUtils.getShowStatusDialog_calls();
-
IServiceInterface serviceInterface = wsdlRoot.getDescription().getAllInterfaces().iterator().next();
ServiceInterfaceNode siNode = new ServiceInterfaceNode(null, serviceInterface, sifpc);
sifpc.getTreeNodeMapper().addToNodeMap(serviceInterface, siNode);
@@ -286,18 +285,17 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
sifpc.addNewParameter(operationNode, OperationCategory.INPUT);
- assertEquals(0, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verifyZeroInteractions(dialogManager);
assertEquals(paramCount + 1, operationNode.getModelObject().getAllInputParameters().size());
// with a readOnly controller
sifpc.isEditAllowed = Boolean.valueOf(false);
- statusCalls = StatusUtils.getShowStatusDialog_calls();
paramCount = operationNode.getModelObject().getAllInputParameters().size();
sifpc.addNewParameter(operationNode, OperationCategory.INPUT);
- assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verify(dialogManager,only()).showStatusDialog(isA(String.class), isA(IStatus.class));
assertEquals(paramCount, operationNode.getModelObject().getAllInputParameters().size());
}
@@ -316,9 +314,6 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false);
sifpc.isEditAllowed = Boolean.valueOf(true);
- StatusUtils.isUnderJunitExecution = true;
- long statusCalls = StatusUtils.getShowStatusDialog_calls();
-
IServiceInterface serviceInterface = wsdlRoot.getDescription().getAllInterfaces().iterator().next();
ServiceInterfaceNode serviceInterfaceNode = new ServiceInterfaceNode(null, serviceInterface, sifpc);
sifpc.getTreeNodeMapper().addToNodeMap(serviceInterface, serviceInterfaceNode);
@@ -365,9 +360,6 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false);
sifpc.isEditAllowed = Boolean.valueOf(false);
- StatusUtils.isUnderJunitExecution = true;
- long statusCalls = StatusUtils.getShowStatusDialog_calls();
-
String namespace = wsdlRoot.getDescription().getNamespace();
String newNamespace = "http://someThing.com"; //$NON-NLS-1$
assertNotSame(newNamespace, namespace);
@@ -375,14 +367,14 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
sifpc.editDescriptionNamespaceTriggered(newNamespace);
assertEquals(namespace, wsdlRoot.getDescription().getNamespace());
- assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verify(dialogManager, only()).showStatusDialog(isA(String.class), isA(IStatus.class));
sifpc.isEditAllowed = Boolean.valueOf(true);
sifpc.editDescriptionNamespaceTriggered(newNamespace);
assertEquals(newNamespace, wsdlRoot.getDescription().getNamespace());
- assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verifyNoMoreInteractions(dialogManager);
}
/**
@@ -400,9 +392,6 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false);
sifpc.isEditAllowed = Boolean.valueOf(false);
- StatusUtils.isUnderJunitExecution = true;
- long statusCalls = StatusUtils.getShowStatusDialog_calls();
-
IType newType = wsdlRoot.getDescription().getContainedSchemas().get(0).getAllContainedTypes().iterator().next();
IServiceInterface service = wsdlRoot.getDescription().getAllInterfaces().iterator().next();
@@ -415,15 +404,14 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
sifpc.editParameterTypeTriggered(parameterNode, newType);
assertEquals(oldType, parameterToChange.getType());
- assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verify(dialogManager, only()).showStatusDialog(isA(String.class), isA(IStatus.class));
sifpc.isEditAllowed = Boolean.valueOf(true);
- statusCalls = StatusUtils.getShowStatusDialog_calls();
sifpc.editParameterTypeTriggered(parameterNode, newType);
assertEquals(newType, parameterToChange.getType());
- assertEquals(0, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verifyNoMoreInteractions(dialogManager);
}
/**
@@ -441,9 +429,6 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false);
sifpc.isEditAllowed = Boolean.valueOf(false);
- StatusUtils.isUnderJunitExecution = true;
- long statusCalls = StatusUtils.getShowStatusDialog_calls();
-
IServiceInterface serviceInterface = wsdlRoot.getDescription().getAllInterfaces().iterator().next();
ServiceInterfaceNode siNode = new ServiceInterfaceNode(null, serviceInterface, sifpc);
@@ -453,15 +438,14 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
sifpc.editItemNameTriggered(siNode, newName);
assertEquals(oldName, siNode.getDisplayName());
- assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verify(dialogManager, only()).showStatusDialog(isA(String.class), isA(IStatus.class));
sifpc.isEditAllowed = Boolean.valueOf(true);
- statusCalls = StatusUtils.getShowStatusDialog_calls();
sifpc.editItemNameTriggered(siNode, newName);
assertEquals(newName, siNode.getDisplayName());
- assertEquals(0, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verifyNoMoreInteractions(dialogManager);
}
/**
@@ -479,9 +463,6 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false);
sifpc.isEditAllowed = Boolean.valueOf(false);
- StatusUtils.isUnderJunitExecution = true;
- long statusCalls = StatusUtils.getShowStatusDialog_calls();
-
IServiceInterface serviceInterface = wsdlRoot.getDescription().getAllInterfaces().iterator().next();
ServiceInterfaceNode siNode = new ServiceInterfaceNode(null, serviceInterface, sifpc);
OperationNode operationNodeToEdit = (OperationNode) siNode.getChildren()[0];
@@ -493,14 +474,13 @@ public class SIFormPageControllerReadOnlyTest extends SIEditorBaseTest {
sifpc.editOperationTypeTriggered(operationNodeToEdit, newType);
assertEquals(oldType, operationNodeToEdit.getModelObject().getOperationStyle());
- assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls);
-
+ Mockito.verify(dialogManager,only()).showStatusDialog(isA(String.class), isA(IStatus.class));
+
sifpc.isEditAllowed = Boolean.valueOf(true);
- statusCalls = StatusUtils.getShowStatusDialog_calls();
sifpc.editOperationTypeTriggered(operationNodeToEdit, newType);
assertEquals(newType, operationNodeToEdit.getModelObject().getOperationStyle());
- assertEquals(0, StatusUtils.getShowStatusDialog_calls() - statusCalls);
+ Mockito.verifyNoMoreInteractions(dialogManager);
}
}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/dt/DataTypesFormPageControllerJUnitTest.java b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/dt/DataTypesFormPageControllerJUnitTest.java
index a591fc4..bd02161 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/dt/DataTypesFormPageControllerJUnitTest.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/dt/DataTypesFormPageControllerJUnitTest.java
@@ -14,6 +14,7 @@
*******************************************************************************/
package org.eclipse.wst.sse.sieditor.test.ui.v2.dt;
+import static org.mockito.Mockito.*;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.expect;
@@ -41,6 +42,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.wst.sse.sieditor.ui.DialogManager;
import org.eclipse.wst.sse.sieditor.ui.v2.dt.DataTypesFormPageController;
import org.eclipse.wst.sse.sieditor.ui.v2.dt.extractwizard.ExtractNamespaceWizard;
import org.eclipse.wst.sse.sieditor.ui.v2.dt.nodes.IDataTypesTreeNode;
@@ -60,6 +62,7 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.mockito.Mockito;
import org.eclipse.wst.sse.sieditor.command.common.AbstractNotificationOperation;
import org.eclipse.wst.sse.sieditor.command.common.DeleteSetCommand;
@@ -76,7 +79,6 @@ import org.eclipse.wst.sse.sieditor.model.api.INamedObject;
import org.eclipse.wst.sse.sieditor.model.api.INamespacedObject;
import org.eclipse.wst.sse.sieditor.model.api.IWsdlModelRoot;
import org.eclipse.wst.sse.sieditor.model.api.IXSDModelRoot;
-import org.eclipse.wst.sse.sieditor.model.utils.StatusUtils;
import org.eclipse.wst.sse.sieditor.model.wsdl.api.IDescription;
import org.eclipse.wst.sse.sieditor.model.xsd.api.IElement;
import org.eclipse.wst.sse.sieditor.model.xsd.api.ISchema;
@@ -94,21 +96,6 @@ public class DataTypesFormPageControllerJUnitTest {
/**
* @throws java.lang.Exception
*/
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- StatusUtils.isUnderJunitExecution = true;
- }
-
- /**
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
@Before
public void setUp() throws Exception {
}
@@ -146,6 +133,7 @@ public class DataTypesFormPageControllerJUnitTest {
private int partOfEditedDocCounter;
private int isDeleteCounter;
private int resourceReadOnlyCounter;
+ private DialogManager dialogManagerMock;
// fireErrorMsgEvent(String)
@@ -153,6 +141,12 @@ public class DataTypesFormPageControllerJUnitTest {
super(model, readOnly);
editAllowed = true;
isDeleteAllowed = true;
+ dialogManagerMock = null;
+ }
+
+ public TestDataTypesFormPageController(final IModelRoot model, final boolean readOnly, DialogManager dialogManagerMock) {
+ this(model, readOnly);
+ this.dialogManagerMock = dialogManagerMock;
}
// the folowing 3 methods override manage the mocking of the
@@ -333,6 +327,11 @@ public class DataTypesFormPageControllerJUnitTest {
public void setReadOnly(final boolean readOnly) {
this.readOnly = readOnly;
}
+
+ @Override
+ protected DialogManager getDialogManager() {
+ return dialogManagerMock;
+ }
}
@Test
@@ -714,7 +713,7 @@ public class DataTypesFormPageControllerJUnitTest {
replay(modelRootMock, selectedNodeMock, envMock);
final TestDataTypesFormPageController dataTypesFormPageController = new TestDataTypesFormPageController(modelRootMock,
- false);
+ false,mock(DialogManager.class));
// checks the case when the selectedNode's model object is null
boolean caught = false;
try {
@@ -864,7 +863,9 @@ public class DataTypesFormPageControllerJUnitTest {
final ITreeNode selectedNodeMock = createNiceMock(ITreeNode.class);
// when the model root is not an XSDModelRoot
// when when isEditAllowed returns false
- TestDataTypesFormPageController controller = new TestDataTypesFormPageController(modelRootMock, false);
+ final DialogManager dialogManagerMock = mock(DialogManager.class);
+ TestDataTypesFormPageController controller = new TestDataTypesFormPageController(modelRootMock, false, dialogManagerMock);
+
final ISchema schemaMock = createNiceMock(ISchema.class);
replay(schemaMock, selectedNodeMock);
controller.setRetrievedSchema(schemaMock);
@@ -872,16 +873,16 @@ public class DataTypesFormPageControllerJUnitTest {
controller.setEditAllowed(false);
controller.setFireErrorMsgCounter(0);
controller.getTreeNodeMapper().addToNodeMap(schemaMock, selectedNodeMock);
- long oldShowErrorCals = StatusUtils.getShowStatusDialog_calls();
+
+ // do test
controller.handleAddSimpleTypeAction(selectedNodeMock);
- assertEquals(oldShowErrorCals + 1, StatusUtils.getShowStatusDialog_calls());
+ Mockito.verify(dialogManagerMock, times(1)).showStatusDialog(any(String.class), any(IStatus.class));
// when the isEditAllowed returns true
controller.setEditAllowed(true);
controller.setRetrievedXsdModelRoot(null);
- oldShowErrorCals = StatusUtils.getShowStatusDialog_calls();
controller.handleAddSimpleTypeAction(selectedNodeMock);
- assertEquals(oldShowErrorCals + 1, StatusUtils.getShowStatusDialog_calls());
+ Mockito.verify(dialogManagerMock, times(2)).showStatusDialog(any(String.class), any(IStatus.class));
final IXSDModelRoot xsdModelRootMock = createNiceMock(IXSDModelRoot.class);
@@ -941,9 +942,10 @@ public class DataTypesFormPageControllerJUnitTest {
final ITreeNode selectedNodeMock = createNiceMock(ITreeNode.class);
replay(selectedNodeMock);
+ DialogManager dialogManagerMock = mock(DialogManager.class);
// when the model root is not an XSDModelRoot
// when when isEditAllowed returns false
- TestDataTypesFormPageController controller = new TestDataTypesFormPageController(modelRootMock, false);
+ TestDataTypesFormPageController controller = new TestDataTypesFormPageController(modelRootMock, false, dialogManagerMock);
final ISchema schemaMock = createNiceMock(ISchema.class);
replay(schemaMock);
controller.setRetrievedSchema(schemaMock);
@@ -951,16 +953,14 @@ public class DataTypesFormPageControllerJUnitTest {
controller.setEditAllowed(false);
controller.setFireErrorMsgCounter(0);
controller.getTreeNodeMapper().addToNodeMap(schemaMock, selectedNodeMock);
- long oldShowErrorCals = StatusUtils.getShowStatusDialog_calls();
controller.handleAddStructureTypeAction(selectedNodeMock);
- assertEquals(oldShowErrorCals + 1, StatusUtils.getShowStatusDialog_calls());
+ Mockito.verify(dialogManagerMock, only()).showStatusDialog(any(String.class), any(IStatus.class));
// when the isEditAllowed returns true
controller.setEditAllowed(true);
controller.setRetrievedXsdModelRoot(null);
- oldShowErrorCals = StatusUtils.getShowStatusDialog_calls();
controller.handleAddStructureTypeAction(selectedNodeMock);
- assertEquals(oldShowErrorCals + 1, StatusUtils.getShowStatusDialog_calls());
+ Mockito.verify(dialogManagerMock, times(2)).showStatusDialog(any(String.class), any(IStatus.class));
final IXSDModelRoot xsdModelRootMock = createNiceMock(IXSDModelRoot.class);
@@ -1013,7 +1013,8 @@ public class DataTypesFormPageControllerJUnitTest {
expect(envMock.getEditingDomain()).andReturn(null).anyTimes();
replay(treeNodeMock, modelRootMock, modelObjectMock, envMock);
- TestDataTypesFormPageController controller = new TestDataTypesFormPageController(modelRootMock, false);
+ DialogManager dialogManagerMock = mock(DialogManager.class);
+ TestDataTypesFormPageController controller = new TestDataTypesFormPageController(modelRootMock, false, dialogManagerMock);
controller.setEditAllowed(false);
controller.setEditedMatch(modelObjectMock);
controller.handleRemoveAction(Arrays.asList(treeNodeMock));
@@ -1021,11 +1022,10 @@ public class DataTypesFormPageControllerJUnitTest {
controller.setEditAllowed(true);
controller.setFireErrorMsgCounter(0);
controller.setNextTreeNodeMatch(treeNodeMock);
- final long oldShowErrorCals = StatusUtils.getShowStatusDialog_calls();
controller.handleRemoveAction(Arrays.asList(treeNodeMock));
- assertEquals(oldShowErrorCals + 1, StatusUtils.getShowStatusDialog_calls());
+ Mockito.verify(dialogManagerMock, only()).showStatusDialog(any(String.class), any(IStatus.class));
verify(treeNodeMock);
// when a ISchema is to be removed
@@ -1095,7 +1095,7 @@ public class DataTypesFormPageControllerJUnitTest {
replay(treeNodeMock, modelRootMock, envMock, xsdComponentMock);
- controller = new TestDataTypesFormPageController(modelRootMock, false);
+ controller = new TestDataTypesFormPageController(modelRootMock, false, dialogManagerMock);
controller.setEditedMatch(xsdComponentMock);
controller.setNextTreeNodeMatch(treeNodeMock);
controller.handleRemoveAction((Arrays.asList(treeNodeMock)));
diff --git a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/dt/DataTypesFormPageControllerPlugInTest.java b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/dt/DataTypesFormPageControllerPlugInTest.java
index ef15e72..1577537 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/dt/DataTypesFormPageControllerPlugInTest.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/dt/DataTypesFormPageControllerPlugInTest.java
@@ -14,6 +14,7 @@
*******************************************************************************/
package org.eclipse.wst.sse.sieditor.test.ui.v2.dt;
+import static org.mockito.Mockito.*;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
@@ -26,6 +27,8 @@ import java.util.Collection;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.sse.sieditor.ui.DialogManager;
import org.eclipse.wst.sse.sieditor.ui.v2.UIConstants;
import org.eclipse.wst.sse.sieditor.ui.v2.dt.DataTypesFormPageController;
import org.eclipse.wst.sse.sieditor.ui.v2.dt.nodes.IDataTypesTreeNode;
@@ -42,6 +45,7 @@ import org.eclipse.wst.sse.sieditor.test.util.SIEditorBaseTest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mockito;
import org.eclipse.wst.sse.sieditor.model.api.IModelObject;
@@ -65,6 +69,7 @@ public class DataTypesFormPageControllerPlugInTest extends SIEditorBaseTest {
private IWsdlModelRoot wsdlModelRoot;
private TestDataTypesFormPageController controller;
private List<ISchema> schemas;
+ protected static DialogManager dialogManager;
/**
* @throws java.lang.Exception
@@ -76,6 +81,7 @@ public class DataTypesFormPageControllerPlugInTest extends SIEditorBaseTest {
wsdlModelRoot = getWSDLModelRoot("pub/self/mix2/PurchaseOrderConfirmation.wsdl", "PurchaseOrderConfirmation.wsdl");
schemas = wsdlModelRoot.getDescription().getContainedSchemas();
controller = new TestDataTypesFormPageController(wsdlModelRoot, false);
+ dialogManager = mock(DialogManager.class);
}
/**
@@ -104,6 +110,11 @@ public class DataTypesFormPageControllerPlugInTest extends SIEditorBaseTest {
// TODO Auto-generated method stub
return super.getNextTreeNode(selectedTreeNode);
}
+
+ @Override
+ protected DialogManager getDialogManager() {
+ return dialogManager;
+ }
}
class ErrorListener implements ISIEventListener {
@@ -145,9 +156,8 @@ public class DataTypesFormPageControllerPlugInTest extends SIEditorBaseTest {
controller.setReadOnly(true);
listenerCallCounter = 0;
controller.addEventListener(new ErrorListener());
- final long oldShowErrorCals = StatusUtils.getShowStatusDialog_calls();
controller.editDocumentation(treeNodeMock, DOC_TEXT_1);
- assertEquals(oldShowErrorCals + 1, StatusUtils.getShowStatusDialog_calls());
+ Mockito.verify(dialogManager, only()).showStatusDialog(any(String.class), any(IStatus.class));
}
private int listenerCallCounter = 0;
@@ -240,10 +250,9 @@ public class DataTypesFormPageControllerPlugInTest extends SIEditorBaseTest {
listenerCallCounter = 0;
final ISIEventListener errorListener = new ErrorListener();
controller.addEventListener(errorListener);
- final long oldShowErrorCals = StatusUtils.getShowStatusDialog_calls();
controller.handleAddElementAction(namespaceNode);
- assertEquals(oldShowErrorCals + 1, StatusUtils.getShowStatusDialog_calls());
-
+ Mockito.verify(dialogManager, only()).showStatusDialog(any(String.class), any(IStatus.class));
+
controller.removeEventListener(errorListener);
}
@@ -334,10 +343,9 @@ public class DataTypesFormPageControllerPlugInTest extends SIEditorBaseTest {
listenerCallCounter = 0;
final ISIEventListener errorListener = new ErrorListener();
controller.addEventListener(errorListener);
- final long oldShowErrorCals = StatusUtils.getShowStatusDialog_calls();
controller.handleAddElementAction(parentNode);
- assertEquals(oldShowErrorCals + 1, StatusUtils.getShowStatusDialog_calls());
-
+ Mockito.verify(dialogManager, only()).showStatusDialog(any(String.class), any(IStatus.class));
+
controller.removeEventListener(eventListener);
}
@@ -415,181 +423,14 @@ public class DataTypesFormPageControllerPlugInTest extends SIEditorBaseTest {
listenerCallCounter = 0;
final ISIEventListener errorListener = new ErrorListener();
controller.addEventListener(errorListener);
- final long oldShowErrorCals = StatusUtils.getShowStatusDialog_calls();
controller.handleAddSimpleTypeAction(namespaceNode);
- assertEquals(oldShowErrorCals + 1, StatusUtils.getShowStatusDialog_calls());
-
+ Mockito.verify(dialogManager, only()).showStatusDialog(any(String.class), any(IStatus.class));
+
controller.removeEventListener(errorListener);
}
-// /**
-// * Test method for
-// * {@link org.eclipse.wst.sse.sieditor.ui.v2.dt.DataTypesFormPageController#handleAddStructureTypeAction(org.eclipse.wst.sse.sieditor.ui.v2.nodes.ITreeNode)}
-// * .
-// *
-// * @throws ExecutionException
-// */
-// @Test
-// public final void testHandleAddStructureTypeAction() throws ExecutionException {
-// final String namespace = "http://sap.com/xi/SRM/Basis/Global";
-// assertEquals(namespace, schemas.get(1).getNamespace()); //$NON-NLS-1$
-// final ISchema schema = schemas.get(1);
-// final String structureTypeName = controller.getNewStructureTypeName(schema);
-// assertNull(schema.getType(false, structureTypeName));
-// final Collection<IType> existingTypes = schema.getAllContainedTypes();
-// assertTrue(existingTypes.size() == 1);
-//
-// final INamespaceNode namespaceNode = new NamespaceNode(schema, controller.getTreeNodeMapper());
-//
-// final ISIEventListener eventListener = new ISIEventListener() {
-// @Override
-// public void notifyEvent(final ISIEvent event) {
-// listenerCallCounter += 1;
-// assertTrue(event.getEventId() == ISIEvent.ID_SELECT_TREENODE
-// || event.getEventId() == ISIEvent.ID_TREE_NODE_EXPAND
-// || event.getEventId() == ISIEvent.ID_EDIT_TREENODE);
-// assertTrue(event.getEventParams().length == 1);
-// final Object treeNodeObject = event.getEventParams()[0];
-// assertNotNull(treeNodeObject);
-// assertTrue(treeNodeObject instanceof IStructureTypeNode);
-// final IModelObject newElement = ((ITreeNode) treeNodeObject).getModelObject();
-// assertTrue(newElement instanceof IStructureType);
-// final IStructureType newType = (IStructureType) newElement;
-// assertEquals(structureTypeName, newType.getName());
-// assertEquals(namespace, newType.getNamespace());
-// assertTrue(schema.getAllContainedTypes().contains(newType));
-// assertFalse(newType.isElement());
-// assertFalse(newType.isAnonymous());
-// assertTrue(newType.getDocumentation().isEmpty());
-// assertEquals(1, newType.getAllElements().size());
-// final IElement element = newType.getAllElements().iterator().next();
-// assertEquals(Schema.getSchemaForSchema().getType(false,
-// TestDataTypesFormPageController.NEW_GLOBAL_ELEMENT_CHILD_TYPE_NAME_TEST), element.getType());
-// assertTrue(newType.getBaseType() instanceof IStructureType);
-// final IStructureType baseType = (IStructureType) newType.getBaseType();
-// assertFalse(baseType.isAnonymous());
-// // assertFalse(baseType.isElement());
-// // assertTrue(baseType.getAllElements().isEmpty());
-//
-// // tree node asserts
-// final ITreeNode newNode = controller.getTreeNodeMapper().getTreeNode(newElement);
-// assertNotNull(newNode);
-// assertEquals(newNode, event.getEventParams()[0]);
-// assertEquals(structureTypeName, newNode.getDisplayName());
-// assertTrue(newNode instanceof IStructureTypeNode);
-// assertEquals(newElement, newNode.getModelObject());
-// assertEquals(namespaceNode, newNode.getParent());
-// assertTrue(newNode.hasChildren());
-// assertEquals(1, newNode.getChildren().length);
-// assertTrue(newNode.getChildren()[0] instanceof IElementNode);
-// }
-// };
-// listenerCallCounter = 0;
-// controller.addEventListener(eventListener);
-// controller.getTreeNodeMapper().addToNodeMap(schema, namespaceNode);
-// controller.handleAddStructureTypeAction(namespaceNode);
-//
-// assertTrue(listenerCallCounter != 0);
-// assertTrue(schema.getAllContainedTypes().size() == 2);
-// for (final IType iType : schema.getAllContainedTypes()) {
-// if (existingTypes.contains(iType)) {
-// continue;
-// }
-// assertEquals(structureTypeName, iType.getName());
-//
-// // Assert the type is not empty (one default element should be
-// // created)
-// final IStructureType structure = (IStructureType) iType;
-// assertEquals(1, structure.getAllElements().size());
-// }
-//
-// controller.setReadOnly(true);
-// assertTrue(listenerCallCounter != 0);
-// controller.removeEventListener(eventListener);
-//
-// listenerCallCounter = 0;
-// final ISIEventListener errorListener = new ErrorListener();
-// controller.addEventListener(errorListener);
-// final long oldShowErrorCals = StatusUtils.getShowStatusDialog_calls();
-// controller.handleAddStructureTypeAction(namespaceNode);
-// assertEquals(oldShowErrorCals + 1, StatusUtils.getShowStatusDialog_calls());
-//
-// controller.removeEventListener(errorListener);
-//
-// controller.setReadOnly(false);
-//
-// controller.handleAddStructureTypeAction(namespaceNode);
-// assertNotNull(schema.getAllTypes("StructureType2"));
-// final IEnvironment env = schema.getModelRoot().getEnv();
-// env.getOperationHistory().undo(env.getUndoContext(), null, null);
-// assertNull(schema.getAllTypes("StructureType2"));
-// env.getOperationHistory().redo(env.getUndoContext(), null, null);
-// assertNotNull(schema.getAllTypes("StructureType2"));
-// }
-
-// @Test
-// public void testSetElementFacet() throws ExecutionException {
-//
-// IWsdlModelRoot wsdlModelRoot = null;
-// try {
-// wsdlModelRoot = getWSDLModelRoot("pub/self/mix/TypesInternalImporting.wsdl", "TypesInternalImporting.wsdl");
-// } catch (final Exception e) {
-// fail(e);
-// }
-//
-// final ISchema schema = wsdlModelRoot.getDescription().getSchema("http://www.example.com/")[0];
-//
-// final IStructureType structure = (IStructureType) schema.getType(false, "Address");
-// IElement element = structure.getElements("name").iterator().next();
-//
-// DataTypesFormPageController controller = new DataTypesFormPageController(wsdlModelRoot, false);
-// controller.setElementFacet(element, "aaa", XSDPackage.XSD_ENUMERATION_FACET);
-//
-// IEnvironment env = schema.getModelRoot().getEnv();
-// XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration) ((XSDParticle) element.getComponent()).getContent();
-// assertEquals(1, ((XSDSimpleTypeDefinition) xsdElementDeclaration.getAnonymousTypeDefinition()).getEnumerationFacets()
-// .size());
-//
-// env.getOperationHistory().undo(env.getUndoContext(), null, null);
-// assertNull(xsdElementDeclaration.getAnonymousTypeDefinition());
-//
-// env.getOperationHistory().redo(env.getUndoContext(), null, null);
-// assertNotNull(xsdElementDeclaration.getAnonymousTypeDefinition());
-// assertEquals(1, ((XSDSimpleTypeDefinition) xsdElementDeclaration.getAnonymousTypeDefinition()).getEnumerationFacets()
-// .size());
-//
-// final IStructureType globalElement = (IStructureType) schema.getType(true, "comment");
-// controller.setGlobalElementFacet(globalElement, "ggg", XSDPackage.XSD_ENUMERATION_FACET);
-// xsdElementDeclaration = (XSDElementDeclaration) globalElement.getComponent();
-// assertEquals(1, ((XSDSimpleTypeDefinition) xsdElementDeclaration.getAnonymousTypeDefinition()).getEnumerationFacets()
-// .size());
-//
-// env.getOperationHistory().undo(env.getUndoContext(), null, null);
-// assertNull(xsdElementDeclaration.getAnonymousTypeDefinition());
-//
-// env.getOperationHistory().redo(env.getUndoContext(), null, null);
-// assertNotNull(xsdElementDeclaration.getAnonymousTypeDefinition());
-// assertEquals(1, ((XSDSimpleTypeDefinition) xsdElementDeclaration.getAnonymousTypeDefinition()).getEnumerationFacets()
-// .size());
-//
-// final IStructureType typeWithAttribute = (IStructureType) schema.getType(false, "ItemsExtended");
-// element = typeWithAttribute.getElements("specialAtt").iterator().next();
-//
-// controller = new DataTypesFormPageController(wsdlModelRoot, false);
-// controller.setElementFacet(element, "aaa", XSDPackage.XSD_ENUMERATION_FACET);
-//
-// env = schema.getModelRoot().getEnv();
-// final XSDAttributeDeclaration xsdAttributeDeclaration = (XSDAttributeDeclaration) element.getComponent();
-// assertEquals(1, (xsdAttributeDeclaration.getAnonymousTypeDefinition()).getEnumerationFacets().size());
-//
-// env.getOperationHistory().undo(env.getUndoContext(), null, null);
-// assertNull(xsdAttributeDeclaration.getAnonymousTypeDefinition());
-//
-// env.getOperationHistory().redo(env.getUndoContext(), null, null);
-// assertNotNull(xsdAttributeDeclaration.getAnonymousTypeDefinition());
-// assertEquals(1, (xsdAttributeDeclaration.getAnonymousTypeDefinition()).getEnumerationFacets().size());
-// }
-
+ //deleted a log of commented test code here - if interested - see history
+
@Test
public void testHandleAddGlobalElementAction() {
@@ -674,10 +515,8 @@ public class DataTypesFormPageControllerPlugInTest extends SIEditorBaseTest {
final ISIEventListener errorListener = new ErrorListener();
controller.addEventListener(errorListener);
listenerCallCounter = 0;
- final long oldShowErrorCals = StatusUtils.getShowStatusDialog_calls();
controller.handleRemoveAction(Arrays.asList(nodeToDelete));
- assertEquals(oldShowErrorCals, StatusUtils.getShowStatusDialog_calls());
-
+ verifyZeroInteractions(dialogManager);
controller.removeEventListener(eventListener);
}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/AbstractFileContentChangeTest.java b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/AbstractFileContentChangeTest.java
new file mode 100644
index 0000000..e8d1118
--- /dev/null
+++ b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/AbstractFileContentChangeTest.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2010 SAP AG.
+ * 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:
+ * Emil Simeonov - initial API and implementation.
+ * Dimitar Donchev - initial API and implementation.
+ * Dimitar Tenev - initial API and implementation.
+ * Nevena Manova - initial API and implementation.
+ * Georgi Konstantinov - initial API and implementation.
+ *******************************************************************************/
+package org.eclipse.wst.sse.sieditor.test.ui.v2.resources;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.PartSite;
+import org.eclipse.wst.sse.sieditor.test.util.SIEditorBaseTest;
+import org.eclipse.wst.sse.sieditor.test.util.ThreadUtils;
+import org.eclipse.wst.sse.sieditor.ui.AbstractEditorWithSourcePage;
+import org.eclipse.wst.sse.sieditor.ui.DialogManager;
+import org.eclipse.wst.sse.sieditor.ui.EditorActivationListener;
+import org.junit.After;
+import org.junit.Before;
+
+public class AbstractFileContentChangeTest extends SIEditorBaseTest {
+
+ protected AbstractEditorWithSourcePage editor = null;
+ protected DialogManager dialogManagerMock = mock(DialogManager.class);
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void setDialogManagerMock() {
+ reset(dialogManagerMock);
+ when(dialogManagerMock.showDialogWithResult(eq(MessageDialog.QUESTION), any(String.class), any(String.class)))
+ .thenReturn(Boolean.valueOf(true));
+ EditorActivationListener activationListener = editor.getActivationListener();
+ activationListener.setDialogManager(dialogManagerMock);
+ }
+
+ @Override
+ @After
+ public void tearDown() throws Exception {
+ if (editor != null) {
+ editor.close(false);
+ }
+ super.tearDown();
+ // Flush threads that wait UI thread for execution
+ ThreadUtils.waitOutOfUI(100);
+
+ }
+
+ /**
+ * Without setVisible & setSize, IPartListeners won't be notified upon part
+ * activation
+ *
+ * @param editor
+ */
+ protected void show(AbstractEditorWithSourcePage editor) {
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ activePage.activate(activePage.getViewReferences()[0].getView(true));
+ activePage.activate(editor);
+ System.out.println();
+ editor.setFocus();
+ Control control = ((PartSite) editor.getEditorSite().getPart().getSite()).getPane().getControl();
+ List<Control> controls = new ArrayList<Control>();
+ controls.add(control);
+ Control parent = null;
+
+ while ((parent = control.getParent()) != null) {
+ controls.add(0, parent);
+ control = parent;
+ }
+
+ for (Control ctrl : controls) {
+ ctrl.setVisible(true);
+ ctrl.setSize(10, 10);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/TestFileChangedWhileEditingWSDL.java b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/TestFileChangedWhileEditingWSDL.java
new file mode 100644
index 0000000..c07fc7b
--- /dev/null
+++ b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/TestFileChangedWhileEditingWSDL.java
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * Copyright (c) 2010 SAP AG.
+ * 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:
+ * Emil Simeonov - initial API and implementation.
+ * Dimitar Donchev - initial API and implementation.
+ * Dimitar Tenev - initial API and implementation.
+ * Nevena Manova - initial API and implementation.
+ * Georgi Konstantinov - initial API and implementation.
+ *******************************************************************************/
+
+package org.eclipse.wst.sse.sieditor.test.ui.v2.resources;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.operation.ModalContext;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.editor.IFormPage;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.wst.sse.sieditor.command.emf.wsdl.AddServiceInterfaceCommand;
+import org.eclipse.wst.sse.sieditor.core.common.Logger;
+import org.eclipse.wst.sse.sieditor.model.api.IWsdlModelRoot;
+import org.eclipse.wst.sse.sieditor.model.utils.StatusUtils;
+import org.eclipse.wst.sse.sieditor.model.wsdl.api.IServiceInterface;
+import org.eclipse.wst.sse.sieditor.test.util.ResourceUtils;
+import org.eclipse.wst.sse.sieditor.ui.EditorActivationListener;
+import org.eclipse.wst.sse.sieditor.ui.ServiceInterfaceEditor;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestFileChangedWhileEditingWSDL extends AbstractFileContentChangeTest {
+
+ private final String TEST_INTERFACE_NAME = "TestInterface";
+
+ private IFile fileUnderEdit;
+ private String originalContents;
+ private IWsdlModelRoot modelRoot;
+ private IWorkbenchWindow window;
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
+ super.setUp();
+ copyFileAndChangeContent();
+ setDialogManagerMock();
+ }
+
+ private void copyFileAndChangeContent() throws Exception {
+ fileUnderEdit = ResourceUtils.copyFileIntoTestProject("pub/simple/NewWSDLFile.wsdl", Document_FOLDER_NAME,
+ this.getProject(), "NewWSDLFile.wsdl");
+ refreshProjectNFile(fileUnderEdit);
+
+ originalContents = ResourceUtils.getContents(fileUnderEdit, "UTF-8");
+
+ window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ final FileEditorInput eInput = new FileEditorInput(fileUnderEdit);
+ final IWorkbenchPage workbenchActivePage = window.getActivePage();
+
+ editor = (ServiceInterfaceEditor) workbenchActivePage.openEditor(eInput, ServiceInterfaceEditor.EDITOR_ID);
+ assertFalse(editor.isDirty());
+
+ modelRoot = ((ServiceInterfaceEditor) editor).getModelRoot();
+
+ List<IServiceInterface> sIs = modelRoot.getDescription().getInterface(TEST_INTERFACE_NAME);
+ assertTrue(sIs.isEmpty());
+
+ final AddServiceInterfaceCommand addInterface = new AddServiceInterfaceCommand(modelRoot, modelRoot.getDescription(),
+ TEST_INTERFACE_NAME);
+ modelRoot.getEnv().execute(addInterface);
+
+ sIs = modelRoot.getDescription().getInterface(TEST_INTERFACE_NAME);
+ assertFalse(sIs.isEmpty());
+ IServiceInterface testInterface = sIs.get(0);
+ assertNotNull(testInterface);
+ }
+
+ @Override
+ @After
+ public void tearDown() throws Exception {
+ super.tearDown();
+ editor.close(false);
+ fileUnderEdit.delete(true, false, new NullProgressMonitor());
+ }
+
+ @Test
+ public void testSIEUnderlyingFileContentsChangedWhenEditorIsSaved() throws Throwable {
+ // assert initial editor state
+ assertTrue(editor.isDirty());
+ editor.doSave(null);
+ assertFalse(editor.isDirty());
+
+ List<IServiceInterface> sIs = modelRoot.getDescription().getInterface(TEST_INTERFACE_NAME);
+ assertFalse(sIs.isEmpty());
+ IServiceInterface testInterface = sIs.get(0);
+ assertNotNull(testInterface);
+
+ // return the old file's contents
+ // set file contents from not UI thread, so any resource change
+ // listeners can react
+
+ final IRunnableWithProgress runnable = new IRunnableWithProgress() {
+
+ public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ ResourceUtils.setContents(fileUnderEdit, originalContents);
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ ModalContext.run(runnable, true, new NullProgressMonitor(), PlatformUI.getWorkbench().getDisplay());
+
+ refreshProjectNFile(fileUnderEdit);
+ show(editor);
+
+ verify(dialogManagerMock, never())
+ .showDialogWithResult(eq(MessageDialog.QUESTION), any(String.class), any(String.class));
+
+ assertFalse(editor.isDirty());
+ final List<IServiceInterface> interfaces = modelRoot.getDescription().getInterface(TEST_INTERFACE_NAME);
+ assertTrue(interfaces.isEmpty());
+ }
+
+ @Test
+ public void testSIEUnderlyingFileContentsChangedWhenEditorIsNotSaved() throws Throwable {
+ assertTrue(editor.isDirty());
+
+ // return the old file's contents
+ // set file contents from not UI thread, so any resource change
+ // listeners can react
+ final IRunnableWithProgress runnable = new IRunnableWithProgress() {
+
+ public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ ResourceUtils.setContents(fileUnderEdit, originalContents);
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ ModalContext.run(runnable, true, new NullProgressMonitor(), PlatformUI.getWorkbench().getDisplay());
+ refreshProjectNFile(fileUnderEdit);
+ show(editor);
+ // Assert that the user is asked before reload editor contents
+ verify(dialogManagerMock, times(1))
+ .showDialogWithResult(eq(MessageDialog.QUESTION), any(String.class), any(String.class));
+ verifyNoMoreInteractions(dialogManagerMock);
+ final boolean isDirty = editor.isDirty();
+ if (isDirty) {
+ // DEBUG PURPOSE - it is random failure
+ Logger.logError("ERROR testSIEUnderlyingFileContentsChangedWhenEditorIsNotSaved dirty pages: ");
+ for (final Object page : (editor).getPages()) {
+ if (page instanceof IFormPage) {
+ final IFormPage fpage = (IFormPage) page;
+ if (fpage.isDirty()) {
+ Logger.logError("Dirty page: " + (page.getClass()));
+ }
+ } else {
+ Logger.logError("Page which is not IFormPage: " + (page.getClass()));
+ }
+ }
+ }
+
+ assertFalse("editor is dirty", isDirty);
+ final List<IServiceInterface> interfaces = modelRoot.getDescription().getInterface(TEST_INTERFACE_NAME);
+ assertTrue(interfaces.isEmpty());
+ }
+}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/TestFileChangedWhileEditingXSD.java b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/TestFileChangedWhileEditingXSD.java
new file mode 100644
index 0000000..b4705ea
--- /dev/null
+++ b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/TestFileChangedWhileEditingXSD.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2010 SAP AG.
+ * 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:
+ * Emil Simeonov - initial API and implementation.
+ * Dimitar Donchev - initial API and implementation.
+ * Dimitar Tenev - initial API and implementation.
+ * Nevena Manova - initial API and implementation.
+ * Georgi Konstantinov - initial API and implementation.
+ *******************************************************************************/
+
+package org.eclipse.wst.sse.sieditor.test.ui.v2.resources;
+
+import static org.mockito.Mockito.*;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.operation.ModalContext;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.PartSite;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.wst.sse.sieditor.command.emf.xsd.AddSimpleTypeCommand;
+import org.eclipse.wst.sse.sieditor.model.api.IXSDModelRoot;
+import org.eclipse.wst.sse.sieditor.model.utils.StatusUtils;
+import org.eclipse.wst.sse.sieditor.model.xsd.api.IType;
+import org.eclipse.wst.sse.sieditor.test.util.ResourceUtils;
+import org.eclipse.wst.sse.sieditor.ui.AbstractEditorWithSourcePage;
+import org.eclipse.wst.sse.sieditor.ui.DataTypesEditor;
+import org.eclipse.wst.sse.sieditor.ui.EditorActivationListener;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class TestFileChangedWhileEditingXSD extends AbstractFileContentChangeTest {
+
+ private final String TEST_SIMPLETYPE_NAME = "TestSimpleType";
+ private IFile fileUnderEdit;
+ private String originalContents;
+ private IXSDModelRoot modelRoot;
+ private IWorkbenchWindow window;
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
+ super.setUp();
+ copyFileAndChangeContent();
+ setDialogManagerMock();
+ }
+
+ private void copyFileAndChangeContent() throws Exception {
+ fileUnderEdit = ResourceUtils.copyFileIntoTestProject("pub/xsd/example.xsd", Document_FOLDER_NAME, this.getProject(),
+ "example.xsd");
+ refreshProjectNFile(fileUnderEdit);
+
+ originalContents = ResourceUtils.getContents(fileUnderEdit, "UTF-8");
+
+ window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ final FileEditorInput eInput = new FileEditorInput(fileUnderEdit);
+ final IWorkbenchPage workbenchActivePage = window.getActivePage();
+
+ editor = (DataTypesEditor) workbenchActivePage.openEditor(eInput, DataTypesEditor.EDITOR_ID);
+ assertFalse(editor.isDirty());
+
+ modelRoot = (IXSDModelRoot) editor.getModelRoot();
+
+ assertNull(modelRoot.getSchema().getAllTypes(TEST_SIMPLETYPE_NAME));
+
+ final AddSimpleTypeCommand addSimpleType = new AddSimpleTypeCommand(modelRoot, modelRoot.getSchema(),
+ TEST_SIMPLETYPE_NAME);
+ modelRoot.getEnv().execute(addSimpleType);
+
+ assertNotNull(modelRoot.getSchema().getAllTypes(TEST_SIMPLETYPE_NAME)[0]);
+ }
+
+
+ @Override
+ @After
+ public void tearDown() throws Exception {
+ super.tearDown();
+ editor.close(false);
+ fileUnderEdit.delete(true, false, new NullProgressMonitor());
+ }
+
+ @Test
+ public void testDTEUnderlyingFileContentsChangedWhenEditorIsSaved() throws Throwable {
+ // assert initial editor state
+ assertTrue(editor.isDirty());
+ editor.doSave(new NullProgressMonitor());
+ assertFalse(editor.isDirty());
+ assertNotNull(modelRoot.getSchema().getAllTypes(TEST_SIMPLETYPE_NAME)[0]);
+
+ // return the old file's contents
+ // set file contents from not UI thread, so any resource change
+ // listeners can react
+ final IRunnableWithProgress runnable = new IRunnableWithProgress() {
+
+ public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ ResourceUtils.setContents(fileUnderEdit, originalContents);
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ ModalContext.run(runnable, true, new NullProgressMonitor(), PlatformUI.getWorkbench().getDisplay());
+ //simulate click on the editor to get things going
+ refreshProjectNFile(fileUnderEdit);
+ show(editor);
+
+ verify(dialogManagerMock, never())
+ .showDialogWithResult(eq(MessageDialog.QUESTION), any(String.class), any(String.class));
+ assertFalse(editor.isDirty());
+ Object testType = modelRoot.getSchema().getAllTypes(TEST_SIMPLETYPE_NAME);
+ assertNull(testType);
+ }
+
+ @Test
+ public void testDTEUnderlyingFileContentsChangedWhenEditorIsNotSaved() throws Throwable {
+ // assert initial editor state
+ assertTrue(editor.isDirty());
+
+ // return the old file's contents
+ // set file contents from not UI thread, so any resource change
+ // listeners can react
+ window.getActivePage().activate(editor);
+
+ final IRunnableWithProgress runnable = new IRunnableWithProgress() {
+
+ public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ ResourceUtils.setContents(fileUnderEdit, originalContents);
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ ModalContext.run(runnable, false, new NullProgressMonitor(), PlatformUI.getWorkbench().getDisplay());
+ refreshProjectNFile(fileUnderEdit);
+ //activate another part just to switch back
+
+ show(editor);
+ // Assert that the user is asked before reload editor contents
+ verify(dialogManagerMock, times(1))
+ .showDialogWithResult(eq(MessageDialog.QUESTION), any(String.class), any(String.class));
+ verifyNoMoreInteractions(dialogManagerMock);
+ assertFalse(editor.isDirty());
+ assertNull(modelRoot.getSchema().getAllTypes(TEST_SIMPLETYPE_NAME));
+
+ }
+}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/TestModelRevertToSaved.java b/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/TestModelRevertToSaved.java
deleted file mode 100644
index 119c2d3..0000000
--- a/plugins/org.eclipse.wst.sse.sieditor.test/api/org/eclipse/wst/sse/sieditor/test/ui/v2/resources/TestModelRevertToSaved.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG.
- * 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:
- * Emil Simeonov - initial API and implementation.
- * Dimitar Donchev - initial API and implementation.
- * Dimitar Tenev - initial API and implementation.
- * Nevena Manova - initial API and implementation.
- * Georgi Konstantinov - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.wst.sse.sieditor.test.ui.v2.resources;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.operation.ModalContext;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.editor.IFormPage;
-import org.eclipse.ui.internal.PartSite;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.wst.sse.sieditor.test.util.ResourceUtils;
-import org.eclipse.wst.sse.sieditor.test.util.SIEditorBaseTest;
-import org.eclipse.wst.sse.sieditor.test.util.ThreadUtils;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import org.eclipse.wst.sse.sieditor.command.emf.wsdl.AddServiceInterfaceCommand;
-import org.eclipse.wst.sse.sieditor.command.emf.xsd.AddSimpleTypeCommand;
-import org.eclipse.wst.sse.sieditor.core.common.Logger;
-import org.eclipse.wst.sse.sieditor.model.api.IWsdlModelRoot;
-import org.eclipse.wst.sse.sieditor.model.api.IXSDModelRoot;
-import org.eclipse.wst.sse.sieditor.model.utils.StatusUtils;
-import org.eclipse.wst.sse.sieditor.model.wsdl.api.IServiceInterface;
-import org.eclipse.wst.sse.sieditor.model.xsd.api.IType;
-import org.eclipse.wst.sse.sieditor.ui.AbstractEditorWithSourcePage;
-import org.eclipse.wst.sse.sieditor.ui.DataTypesEditor;
-import org.eclipse.wst.sse.sieditor.ui.ServiceInterfaceEditor;
-
-@SuppressWarnings("nls")
-public class TestModelRevertToSaved extends SIEditorBaseTest {
-
- AbstractEditorWithSourcePage editor = null;
-
- @BeforeClass
- public static void setUpBefore() {
- StatusUtils.isUnderJunitExecution = true;
- }
-
- @AfterClass
- public static void tearDownAfter() {
- StatusUtils.isUnderJunitExecution = false;
- }
-
- @Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
- }
-
- @Override
- @After
- public void tearDown() throws Exception {
- if (editor != null) {
- editor.close(false);
- }
- super.tearDown();
- // Flush threads that wait UI thread for execution
- ThreadUtils.waitOutOfUI(100);
-
- }
-
- @Test
- public void testDTEUnderlyingFileContentsChangedWhenEditorIsSaved() throws Throwable {
- final String TEST_SIMPLETYPE_NAME = "TestSimpleType";
- final IFile file = ResourceUtils.copyFileIntoTestProject("pub/xsd/example.xsd", Document_FOLDER_NAME, this.getProject(),
- "example.xsd");
- refreshProjectNFile(file);
-
- final String oldContents = ResourceUtils.getContents(file, "UTF-8");
-
- final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- final FileEditorInput eInput = new FileEditorInput(file);
- final IWorkbenchPage workbenchActivePage = window.getActivePage();
-
- editor = (DataTypesEditor) workbenchActivePage.openEditor(eInput, DataTypesEditor.EDITOR_ID);
- assertFalse(editor.isDirty());
-
- final IXSDModelRoot modelRoot = (IXSDModelRoot) editor.getModelRoot();
- IType testType[] = modelRoot.getSchema().getAllTypes(TEST_SIMPLETYPE_NAME);
- assertNull(testType);
-
- final AddSimpleTypeCommand addSimpleType = new AddSimpleTypeCommand(modelRoot, modelRoot.getSchema(), TEST_SIMPLETYPE_NAME);
- modelRoot.getEnv().execute(addSimpleType);
-
- testType = modelRoot.getSchema().getAllTypes(TEST_SIMPLETYPE_NAME);
- assertNotNull(testType[0]);
-
- // assert initial editor state
- assertTrue(editor.isDirty());
- editor.doSave(null);
- assertFalse(editor.isDirty());
-
- testType = modelRoot.getSchema().getAllTypes(TEST_SIMPLETYPE_NAME);
- assertNotNull(testType[0]);
-
- // return the old file's contents
- final long refreshDialogCalls = StatusUtils.getShowDialogWithResult_calls_calls();
- // set file contents from not UI thread, so any resource change
- // listeners can react
-
- final IRunnableWithProgress runnable = new IRunnableWithProgress() {
-
- public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ResourceUtils.setContents(file, oldContents);
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- }
- };
- ModalContext.run(runnable, true, new NullProgressMonitor(), PlatformUI.getWorkbench().getDisplay());
- // wait for the refresh editors job
- //waitForResourceChangeListener();
- // Assert the initial editor's state
- // dialog is not shown because the editor was not dirty
- assertEquals(refreshDialogCalls, StatusUtils.getShowDialogWithResult_calls_calls());
- assertFalse(editor.isDirty());
- testType = modelRoot.getSchema().getAllTypes(TEST_SIMPLETYPE_NAME);
- assertNull(testType);
-
- }
-
- @Test
- public void testDTEUnderlyingFileContentsChangedWhenEditorIsNotSaved() throws Throwable {
- final String TEST_SIMPLETYPE_NAME = "TestSimpleType";
- final IFile file = ResourceUtils.copyFileIntoTestProject("pub/xsd/example.xsd", Document_FOLDER_NAME, this.getProject(),
- "example.xsd");
- refreshProjectNFile(file);
-
- final String oldContents = ResourceUtils.getContents(file, "UTF-8");
-
- final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- final FileEditorInput eInput = new FileEditorInput(file);
- final IWorkbenchPage workbenchActivePage = window.getActivePage();
- final IWorkbenchPart initialActivePart = window.getActivePage().getActivePart();
-
- editor = (DataTypesEditor) workbenchActivePage.openEditor(eInput, DataTypesEditor.EDITOR_ID);
- show(editor);
- assertFalse(editor.isDirty());
-
- final IXSDModelRoot modelRoot = (IXSDModelRoot) editor.getModelRoot();
- IType testType[] = modelRoot.getSchema().getAllTypes(TEST_SIMPLETYPE_NAME);
- assertNull(testType);
-
- final AddSimpleTypeCommand addSimpleType = new AddSimpleTypeCommand(modelRoot, modelRoot.getSchema(), TEST_SIMPLETYPE_NAME);
- modelRoot.getEnv().execute(addSimpleType);
-
- testType = modelRoot.getSchema().getAllTypes(TEST_SIMPLETYPE_NAME);
- assertNotNull(testType[0]);
-
- // assert initial editor state
- assertTrue(editor.isDirty());
-
- // return the old file's contents
- final long refreshDialogCalls = StatusUtils.getShowDialogWithResult_calls_calls();
- // set file contents from not UI thread, so any resource change
- // listeners can react
-
- workbenchActivePage.activate(initialActivePart);
-
- final IRunnableWithProgress runnable = new IRunnableWithProgress() {
-
- public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ResourceUtils.setContents(file, oldContents);
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- }
- };
- ModalContext.run(runnable, true, new NullProgressMonitor(), PlatformUI.getWorkbench().getDisplay());
- // wait for the refresh editors job
- //waitForResourceChangeListener();
- //switch back to the DTE page
- window.getActivePage().activate(editor.getEditorSite().getPart());
- // Assert that the user is asked before reload editor contents
- assertTrue(StatusUtils.getShowDialogWithResult_calls_calls() > refreshDialogCalls);
- assertFalse(editor.isDirty());
- testType = modelRoot.getSchema().getAllTypes(TEST_SIMPLETYPE_NAME);
- assertNull(testType);
-
- }
-
- @Test
- public void testSIEUnderlyingFileContentsChangedWhenEditorIsSaved() throws Throwable {
- final String TEST_INTERFACE_NAME = "TestInterface";
- final IFile file = ResourceUtils.copyFileIntoTestProject("pub/simple/NewWSDLFile.wsdl", Document_FOLDER_NAME, this
- .getProject(), "NewWSDLFile.wsdl");
- refreshProjectNFile(file);
-
- final String oldContents = ResourceUtils.getContents(file, "UTF-8");
-
- final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- final FileEditorInput eInput = new FileEditorInput(file);
- final IWorkbenchPage workbenchActivePage = window.getActivePage();
-
- editor = (ServiceInterfaceEditor) workbenchActivePage.openEditor(eInput, ServiceInterfaceEditor.EDITOR_ID);
- assertFalse(editor.isDirty());
-
- final IWsdlModelRoot modelRoot = ((ServiceInterfaceEditor) editor).getModelRoot();
-
- List<IServiceInterface> sIs = modelRoot.getDescription().getInterface(TEST_INTERFACE_NAME);
- assertTrue(sIs.isEmpty());
-
- final AddServiceInterfaceCommand addInterface = new AddServiceInterfaceCommand(modelRoot, modelRoot.getDescription(),
- TEST_INTERFACE_NAME);
- modelRoot.getEnv().execute(addInterface);
-
- sIs = modelRoot.getDescription().getInterface(TEST_INTERFACE_NAME);
- assertFalse(sIs.isEmpty());
- IServiceInterface testInterface = sIs.get(0);
- assertNotNull(testInterface);
-
- // assert initial editor state
- assertTrue(editor.isDirty());
- editor.doSave(null);
- assertFalse(editor.isDirty());
-
- sIs = modelRoot.getDescription().getInterface(TEST_INTERFACE_NAME);
- assertFalse(sIs.isEmpty());
- testInterface = sIs.get(0);
- assertNotNull(testInterface);
-
- // return the old file's contents
- final long refreshDialogCalls = StatusUtils.getShowDialogWithResult_calls_calls();
- // set file contents from not UI thread, so any resource change
- // listeners can react
-
- final IRunnableWithProgress runnable = new IRunnableWithProgress() {
-
- public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ResourceUtils.setContents(file, oldContents);
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- }
- };
- ModalContext.run(runnable, true, new NullProgressMonitor(), PlatformUI.getWorkbench().getDisplay());
- // wait for the refresh editors job
- //waitForResourceChangeListener();
- // Assert the initial editor's state
- // dialog is not shown because the editor was not dirty
- assertEquals(refreshDialogCalls, StatusUtils.getShowDialogWithResult_calls_calls());
- assertFalse(editor.isDirty());
- final List<IServiceInterface> interfaces = modelRoot.getDescription().getInterface(TEST_INTERFACE_NAME);
- assertTrue(interfaces.isEmpty());
-
- }
-
- @Test
- public void testSIEUnderlyingFileContentsChangedWhenEditorIsNotSaved() throws Throwable {
- final String TEST_INTERFACE_NAME = "TestInterface";
- final IFile file = ResourceUtils.copyFileIntoTestProject("pub/simple/NewWSDLFile.wsdl", Document_FOLDER_NAME, this
- .getProject(), "NewWSDLFile.wsdl");
- refreshProjectNFile(file);
-
- final String oldContents = ResourceUtils.getContents(file, "UTF-8");
-
- final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- final FileEditorInput eInput = new FileEditorInput(file);
- final IWorkbenchPage workbenchActivePage = window.getActivePage();
- final IWorkbenchPart initialActivePart = window.getActivePage().getActivePart();
-
- editor = (ServiceInterfaceEditor) workbenchActivePage.openEditor(eInput, ServiceInterfaceEditor.EDITOR_ID);
- show(editor);
- workbenchActivePage.activate(editor.getEditorSite().getPart());
-
- assertFalse(editor.isDirty());
-
- final IWsdlModelRoot modelRoot = ((ServiceInterfaceEditor) editor).getModelRoot();
- List<IServiceInterface> testInterfaces = modelRoot.getDescription().getInterface(TEST_INTERFACE_NAME);
- assertTrue(testInterfaces.isEmpty());
-
- final AddServiceInterfaceCommand addInterface = new AddServiceInterfaceCommand(modelRoot, modelRoot.getDescription(),
- TEST_INTERFACE_NAME);
- modelRoot.getEnv().execute(addInterface);
-
- testInterfaces = modelRoot.getDescription().getInterface(TEST_INTERFACE_NAME);
- assertFalse(testInterfaces.isEmpty());
- final IServiceInterface testInterface = testInterfaces.get(0);
- assertNotNull(testInterface);
-
- // assert initial editor state
- assertTrue(editor.isDirty());
-
- //activate some other page
- workbenchActivePage.activate(initialActivePart);
-
- // return the old file's contents
- final long refreshDialogCalls = StatusUtils.getShowDialogWithResult_calls_calls();
- // set file contents from not UI thread, so any resource change
- // listeners can react
-
- final IRunnableWithProgress runnable = new IRunnableWithProgress() {
-
- public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ResourceUtils.setContents(file, oldContents);
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- }
- };
- ModalContext.run(runnable, true, new NullProgressMonitor(), PlatformUI.getWorkbench().getDisplay());
-
- //switch back to the SIE page
- window.getActivePage().activate(editor.getEditorSite().getPart());
-
- // Assert that the user is asked before reload editor contents
- assertTrue(StatusUtils.getShowDialogWithResult_calls_calls() > refreshDialogCalls);
-
- final boolean isDirty = editor.isDirty();
- if (isDirty) {
- // DEBUG PURPOSE - it is random failure
- Logger.logError("ERROR testSIEUnderlyingFileContentsChangedWhenEditorIsNotSaved dirty pages: ");
- for (final Object page : (editor).getPages()) {
- if (page instanceof IFormPage) {
- final IFormPage fpage = (IFormPage) page;
- if (fpage.isDirty()) {
- Logger.logError("Dirty page: " + (page.getClass()));
- }
- } else {
- Logger.logError("Page which is not IFormPage: " + (page.getClass()));
- }
- }
- }
-
- assertFalse(isDirty);
- final List<IServiceInterface> interfaces = modelRoot.getDescription().getInterface(TEST_INTERFACE_NAME);
- assertTrue(interfaces.isEmpty());
-
- }
-
- /**
- * Without setVisible & setSize, IPartListeners won't be notified upon part activation
- * @param editor
- */
- private void show(AbstractEditorWithSourcePage editor) {
- Control control = ((PartSite) editor.getEditorSite().getPart().getSite()).getPane().getControl();
- List<Control> controls = new ArrayList<Control>();
- controls.add(control);
- Control parent = null;
-
- while ((parent = control.getParent()) != null) {
- controls.add(0, parent);
- control = parent;
- }
-
- for (Control ctrl : controls) {
- ctrl.setVisible(true);
- ctrl.setSize(10, 10);
- }
- }
-
- /**
- * Waits for the refresh editors job which is started in the resource change
- * listener {@link ResourceChangeHandler}
- */
- /*
- private void waitForResourceChangeListener() {
- try {
- Job.getJobManager().join(ResourceChangeHandler.RefreshEditorsJob.REFRESH_EDITORS_FAMILY, new NullProgressMonitor());
- } catch (final InterruptedException e) {
- e.printStackTrace(System.err);
- final Job[] jobs = Job.getJobManager().find(ResourceChangeHandler.RefreshEditorsJob.REFRESH_EDITORS_FAMILY);
- if (jobs.length == 0) {
- return;
- }
- for (final Job job : jobs) {
- job.wakeUp();
- }
- waitForResourceChangeListener();
- }
- }
-*/
-}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/AbstractEditorWithSourcePage.java b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/AbstractEditorWithSourcePage.java
index 7be6a24..c24bd69 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/AbstractEditorWithSourcePage.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/AbstractEditorWithSourcePage.java
@@ -494,7 +494,7 @@ public abstract class AbstractEditorWithSourcePage extends FormEditor implements
final IStatus status = reloadCommand.execute(null, null);
if (!StatusUtils.canContinue(status)) {
Logger.log(status);
- StatusUtils.showStatusDialog(Messages.AbstractEditorWithSourcePage_1,
+ DialogManager.instance.showStatusDialog(Messages.AbstractEditorWithSourcePage_1,
MessageFormat.format(Messages.AbstractEditorWithSourcePage_2, getPartName()), status);
}
} catch (final ExecutionException e) {
@@ -677,4 +677,8 @@ public abstract class AbstractEditorWithSourcePage extends FormEditor implements
public PageChangedListenersManager getPageChangedListenersManager() {
return pageChangedListenersManager;
}
+
+ public EditorActivationListener getActivationListener() {
+ return activationListener;
+ }
}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/DialogManager.java b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/DialogManager.java
new file mode 100644
index 0000000..dc667d3
--- /dev/null
+++ b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/DialogManager.java
@@ -0,0 +1,46 @@
+package org.eclipse.wst.sse.sieditor.ui;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.sse.sieditor.model.utils.HiddenErrorStatus;
+
+public class DialogManager {
+
+ public static DialogManager instance = new DialogManager();
+
+ public void showStatusDialog(String dialogTitle, IStatus statusToShow) {
+ showStatusDialog(dialogTitle, "", statusToShow); //$NON-NLS-1$
+ }
+
+ public void showStatusDialog(String dialogTitle, String message, IStatus statusToShow) {
+ if (statusToShow instanceof HiddenErrorStatus) {
+ return;
+ }
+
+ if (message.length() == 0) {
+ message = statusToShow.getMessage();
+ }
+
+ switch (statusToShow.getSeverity()) {
+ case IStatus.ERROR:
+ ErrorDialog.openError(Display.getDefault().getActiveShell(), dialogTitle, message, statusToShow);
+ break;
+ case IStatus.WARNING:
+ MessageDialog.openWarning(Display.getDefault().getActiveShell(), dialogTitle, message);
+ break;
+ case IStatus.INFO:
+ MessageDialog.openInformation(Display.getDefault().getActiveShell(), dialogTitle, message);
+ break;
+ }
+ }
+
+ public boolean showDialogWithResult(int kind, String title, String message) {
+ return MessageDialog.open(kind, Display.getDefault().getActiveShell(), title, message, SWT.NONE);
+ }
+
+ private DialogManager() {
+ }
+}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/EditorActivationListener.java b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/EditorActivationListener.java
index 49bf268..12c416d 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/EditorActivationListener.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/EditorActivationListener.java
@@ -33,105 +33,115 @@ import org.eclipse.wst.sse.sieditor.core.common.IDisposable;
import org.eclipse.wst.sse.sieditor.model.utils.StatusUtils;
import org.eclipse.wst.sse.sieditor.ui.i18n.Messages;
-public class EditorActivationListener implements IPartListener, IWindowListener, IDisposable{
- /**
+public class EditorActivationListener implements IPartListener, IWindowListener, IDisposable {
+ /**
*
*/
- private final AbstractEditorWithSourcePage editor;
-
- private IPartService partService;
-
- private boolean activated;
-
- private final IWorkbenchPart editorPart;
-
- private long modificationStamp;
-
- public EditorActivationListener(AbstractEditorWithSourcePage editor, IWorkbenchPart editorPart) {
- this.editor = editor;
- this.editorPart = editorPart;
- this.partService = editorPart.getSite().getWorkbenchWindow().getPartService();
- partService.addPartListener(this);
- PlatformUI.getWorkbench().addWindowListener(this);
- }
-
- private void handleActivation() {
- if (activated && isInputChanged()) {
- handleEditorInputChanged();
- }
- }
-
- @Override
- public void doDispose() {
- partService.removePartListener(this);
- PlatformUI.getWorkbench().removeWindowListener(this);
- }
-
- @Override
- public void partActivated(IWorkbenchPart part) {
- activated = part == this.editorPart;
- handleActivation();
- }
-
- @Override
- public void partDeactivated(IWorkbenchPart part) {
- if (part == this.editorPart) {
- activated = false;
- }
- }
-
- public void partBroughtToTop(IWorkbenchPart part) {
- }
-
- public void partClosed(IWorkbenchPart part) {
- }
-
-
- public void partOpened(IWorkbenchPart part) {
- }
-
- @Override
- public void windowActivated(IWorkbenchWindow window) {
- if (window == this.editor.getEditorSite().getWorkbenchWindow()) {
- handleActivation();
- }
- }
-
- public void windowClosed(IWorkbenchWindow window) {
- }
-
- public void windowDeactivated(IWorkbenchWindow window) {
- }
-
- public void windowOpened(IWorkbenchWindow window) {
- }
-
- private boolean isInputChanged() {
- IDocumentProvider provider = editor.getSourcePage().getDocumentProvider();
- if (provider == null) {
- return false;
- }
-
- IDocumentProviderExtension3 provider3= (IDocumentProviderExtension3) provider;
-
- long stamp= provider.getModificationStamp(editor.getEditorInput());
- if (stamp != modificationStamp) {
- modificationStamp = stamp;
- return !provider3.isSynchronized(editor.getEditorInput());
- }
-
- return false;
- }
-
- private void handleEditorInputChanged() {
- String message= MessageFormat.format(Messages.ResourceChangeHandler_1 + "\n" + //$NON-NLS-1$
- Messages.ResourceChangeHandler_3, editor.getEditorInput().getName());
-
- boolean answer = StatusUtils.showDialogWithResult(MessageDialog.QUESTION, Messages.ResourceChangeHandler_0, message);
-
- if (answer) {
- editor.revertContentsToSavedVersion();
- }
- }
+ private final AbstractEditorWithSourcePage editor;
+ private IPartService partService;
+
+ private boolean activated;
+
+ private final IWorkbenchPart editorPart;
+
+ private long modificationStamp;
+
+ private DialogManager dialogManager;
+
+ public EditorActivationListener(AbstractEditorWithSourcePage editor, IWorkbenchPart editorPart) {
+ this.editor = editor;
+ this.editorPart = editorPart;
+ this.partService = editorPart.getSite().getWorkbenchWindow().getPartService();
+ dialogManager = DialogManager.instance;
+ partService.addPartListener(this);
+ PlatformUI.getWorkbench().addWindowListener(this);
+ }
+
+ private void handleActivation() {
+ if (activated && isInputChanged()) {
+ handleEditorInputChanged();
+ }
+ }
+
+ @Override
+ public void doDispose() {
+ partService.removePartListener(this);
+ PlatformUI.getWorkbench().removeWindowListener(this);
+ }
+
+ @Override
+ public void partActivated(IWorkbenchPart part) {
+ activated = part == this.editorPart;
+ handleActivation();
+ }
+
+ @Override
+ public void partDeactivated(IWorkbenchPart part) {
+ if (part == this.editorPart) {
+ activated = false;
+ }
+ }
+
+ public void partBroughtToTop(IWorkbenchPart part) {
+ }
+
+ public void partClosed(IWorkbenchPart part) {
+ }
+
+ public void partOpened(IWorkbenchPart part) {
+ }
+
+ @Override
+ public void windowActivated(IWorkbenchWindow window) {
+ if (window == this.editor.getEditorSite().getWorkbenchWindow()) {
+ handleActivation();
+ }
+ }
+
+ public void windowClosed(IWorkbenchWindow window) {
+ }
+
+ public void windowDeactivated(IWorkbenchWindow window) {
+ }
+
+ public void windowOpened(IWorkbenchWindow window) {
+ }
+
+ private boolean isInputChanged() {
+ IDocumentProvider provider = editor.getSourcePage().getDocumentProvider();
+ if (provider == null) {
+ return false;
+ }
+
+ IDocumentProviderExtension3 provider3 = (IDocumentProviderExtension3) provider;
+
+ long stamp = provider.getModificationStamp(editor.getEditorInput());
+ if (stamp != modificationStamp) {
+ modificationStamp = stamp;
+ return !provider3.isSynchronized(editor.getEditorInput());
+ }
+
+ return false;
+ }
+
+ private void handleEditorInputChanged() {
+ String message = MessageFormat.format(Messages.ResourceChangeHandler_1 + "\n" + //$NON-NLS-1$
+ Messages.ResourceChangeHandler_3, editor.getEditorInput().getName());
+
+ boolean answer = getDialogManager().showDialogWithResult(MessageDialog.QUESTION, Messages.ResourceChangeHandler_0,
+ message);
+
+ if (answer) {
+ editor.revertContentsToSavedVersion();
+ }
+ }
+
+ public DialogManager getDialogManager() {
+ return dialogManager;
+ }
+
+ public void setDialogManager(DialogManager manager){
+ dialogManager = manager;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/AbstractFormPageController.java b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/AbstractFormPageController.java
index 35dfe4c..7cca6ff 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/AbstractFormPageController.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/AbstractFormPageController.java
@@ -73,6 +73,7 @@ import org.eclipse.wst.sse.sieditor.model.xsd.impl.StructureType;
import org.eclipse.wst.sse.sieditor.model.xsd.impl.UnresolvedType;
import org.eclipse.wst.sse.sieditor.ui.Activator;
import org.eclipse.wst.sse.sieditor.ui.DataTypesEditor;
+import org.eclipse.wst.sse.sieditor.ui.DialogManager;
import org.eclipse.wst.sse.sieditor.ui.ServiceInterfaceEditor;
import org.eclipse.wst.sse.sieditor.ui.i18n.Messages;
import org.eclipse.wst.sse.sieditor.ui.preedit.PreEditService;
@@ -338,7 +339,7 @@ public abstract class AbstractFormPageController implements IFormPageController
try {
final IStatus status = model.getEnv().execute(command);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_edit_documentation,
+ DialogManager.instance.showStatusDialog(Messages.SIFormPageController_dlg_title_edit_documentation,
Messages.SIFormPageController_msg_failure_edit_documentation, status);
return;
}
@@ -635,7 +636,7 @@ public abstract class AbstractFormPageController implements IFormPageController
if (hasError) {
final IStatus statusToShow = new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(
Messages.AbstractFormPageController_4, path.toString()));
- StatusUtils.showStatusDialog(Messages.AbstractFormPageController_5, statusToShow);
+ DialogManager.instance.showStatusDialog(Messages.AbstractFormPageController_5, statusToShow);
}
}
@@ -749,7 +750,7 @@ public abstract class AbstractFormPageController implements IFormPageController
try {
final IStatus status = getModelObject().getModelRoot().getEnv().execute(command);
if (!status.isOK()) {
- StatusUtils.showStatusDialog(Messages.AbstractFormPageController_dlg_title_new_type, MessageFormat.format(
+ DialogManager.instance.showStatusDialog(Messages.AbstractFormPageController_dlg_title_new_type, MessageFormat.format(
Messages.AbstractFormPageController_dlg_err_msg_new_type, typeName), status);
}
} catch (final ExecutionException e) {
@@ -757,4 +758,8 @@ public abstract class AbstractFormPageController implements IFormPageController
}
}
+ protected DialogManager getDialogManager() {
+ return DialogManager.instance;
+ }
+
}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/DataTypesFormPageController.java b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/DataTypesFormPageController.java
index 6f46c93..543d63d 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/DataTypesFormPageController.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/DataTypesFormPageController.java
@@ -85,6 +85,7 @@ import org.eclipse.wst.sse.sieditor.model.xsd.impl.SimpleType;
import org.eclipse.wst.sse.sieditor.model.xsd.impl.StructureType;
import org.eclipse.wst.sse.sieditor.ui.Activator;
import org.eclipse.wst.sse.sieditor.ui.DataTypesEditor;
+import org.eclipse.wst.sse.sieditor.ui.DialogManager;
import org.eclipse.wst.sse.sieditor.ui.i18n.Messages;
import org.eclipse.wst.sse.sieditor.ui.v2.AbstractFormPageController;
import org.eclipse.wst.sse.sieditor.ui.v2.dt.extractwizard.ExtractNamespaceWizard;
@@ -207,14 +208,14 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (!isEditAllowed(selectionModelObject)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.DataTypesFormPageController_msg_editing_element_X_is_not_allowed, treeNode.getDisplayName()));
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_edit_documentation, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_edit_documentation, status);
return;
}
final IStatus status = executeCommand(new SetDocumentationCommand(model, selectionModelObject, text));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_edit_documentation, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_can_not_edit_documentation_of_element_X, treeNode.getDisplayName()),
- status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_edit_documentation,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_can_not_edit_documentation_of_element_X,
+ treeNode.getDisplayName()), status);
}
}
@@ -294,7 +295,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (!isEditAllowed(selectionModelObject)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.DataTypesFormPageController_msg_editing_element_X_is_not_allowed, selectedTreeNode.getDisplayName()));
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_element, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_element, status);
return null;
}
AbstractNotificationOperation command = null;
@@ -304,8 +305,8 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
final IXSDModelRoot modelRoot = getXSDModelRoot(schema);
newName = newName == null ? getNewElementName(schema) : newName;
command = new AddStructureTypeCommand(modelRoot, schema,
- Messages.DataTypesFormPageController_add_global_type_command_label, newName, true, (AbstractType) Schema
- .getDefaultSimpleType());
+ Messages.DataTypesFormPageController_add_global_type_command_label, newName, true,
+ (AbstractType) Schema.getDefaultSimpleType());
}
if (selectionModelObject instanceof IStructureType) {
final IStructureType strType = (IStructureType) selectionModelObject;
@@ -364,7 +365,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
return newElement;
}
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_element,
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_element,
Messages.DataTypesFormPageController_msg_can_not_add_new_element, status);
} catch (final ExecutionException e) {
Logger.log(Activator.PLUGIN_ID, IStatus.ERROR,
@@ -424,7 +425,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (!isEditAllowed(schema)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.DataTypesFormPageController_msg_editing_element_X_is_not_allowed, selectedNode.getDisplayName()));
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_simple_type, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_simple_type, status);
return null;
}
@@ -437,7 +438,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (xsdRoot == null) {
final IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(
Messages.DataTypesFormPageController_msg_can_not_find_XSD_root_for_schema_X, schema.getLocation()));
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_simple_type, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_simple_type, status);
return null;
}
newName = newName == null ? getNewSimpleTypeName(schema) : newName;
@@ -452,7 +453,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
final SimpleType simpleType = command.getSimpleType();
return simpleType;
}
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_simple_type,
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_simple_type,
Messages.DataTypesFormPageController_msg_can_not_add_simple_type, status);
} catch (final ExecutionException e) {
fireShowErrorMsgEvent(Messages.DataTypesFormPageController_error_msg_addition_simple_type_failed);
@@ -514,7 +515,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (!isEditAllowed(schema)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.DataTypesFormPageController_msg_editing_element_X_is_not_allowed, selectedElement.getDisplayName()));
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_structure_type, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_structure_type, status);
return null;
}
@@ -528,7 +529,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (xsdRoot == null) {
final IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(
Messages.DataTypesFormPageController_msg_can_not_find_XSD_root_for_schema_X, schema.getLocation()));
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_structure_type, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_structure_type, status);
return null;
}
newName = newName == null ? getNewStructureTypeName(schema) : newName;
@@ -562,7 +563,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
final IStatus status = executeCommand(compositeNotificationOperation);
if (!status.isOK()) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_structure_type,
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_structure_type,
Messages.DataTypesFormPageController_msg_can_not_add_structure_type, status);
}
return addStructureCommand.getStructureType();
@@ -614,7 +615,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (!isEditAllowed(schema)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.DataTypesFormPageController_msg_editing_element_X_is_not_allowed, selectedElement.getDisplayName()));
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_attribute, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_attribute, status);
return;
}
@@ -628,7 +629,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (xsdRoot == null) {
final IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, MessageFormat.format(
Messages.DataTypesFormPageController_msg_can_not_find_XSD_root_for_schema_X, schema.getLocation()));
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_attribute, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_attribute, status);
return;
}
@@ -661,14 +662,14 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
fireTreeNodeSelectionEvent(attribute);
fireTreeNodeEditEvent(attribute);
} else {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_attribute,
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_attribute,
Messages.DataTypesFormPageController_msg_failure_add_attribute, status);
}
} catch (final ExecutionException e) {
final IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID,
Messages.DataTypesFormPageController_msg_error_while_executing_add_attribute_command, e);
Logger.log(status);
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_attribute, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_attribute, status);
}
}
}
@@ -687,7 +688,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (nodes == null || nodes.isEmpty()) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID,
Messages.DataTypesFormPageController_msg_target_element_can_not_be_deleted);
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_element, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_element, status);
return;
}
@@ -716,7 +717,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (!deleteCommand.canExecute()) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID,
Messages.DataTypesFormPageController_msg_target_element_can_not_be_deleted);
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_element, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_element, status);
return;
}
@@ -728,14 +729,14 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
removeNodeAndItsChildrenFromMap(treeNodeToRemove);
}
} else {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_element,
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_element,
Messages.DataTypesFormPageController_msg_can_not_delete_element, status);
}
} catch (final ExecutionException e) {
final IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID,
Messages.DataTypesFormPageController_msg_failure_executing_delete_element, e);
Logger.log(status);
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_element,
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_element,
Messages.DataTypesFormPageController_msg_can_not_delete_element, status);
}
}
@@ -753,7 +754,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (!isPartOfEdittedDocument(namedObject)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.DataTypesFormPageController_msg_editing_element_X_is_not_allowed, namedObject.getName()));
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_rename_element, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_rename_element, status);
return;
}
if (namedObject instanceof IElement) {
@@ -770,8 +771,9 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
final IStatus status = executeCommand(new RenameElementCommand(model, element, newName));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_rename_element, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_can_not_rename_element_X, element.getName()), status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_rename_element,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_can_not_rename_element_X, element.getName()),
+ status);
}
}
@@ -794,15 +796,16 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (!isEditAllowed(schema)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.DataTypesFormPageController_msg_edition_schema_X_not_allowed, schema.getLocation()));
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_edit_schema, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_edit_schema, status);
return;
}
final IStatus status = executeCommand(new SetNamespaceCommand(model, schema, newNamespace));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_schema_namespace, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_set_namespace_schema_X, schema.getLocation()),
- status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_schema_namespace,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_namespace_schema_X,
+ schema.getLocation()), status);
}
}
@@ -828,8 +831,8 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
final IStatus status = executeCommand(cmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_rename_type, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_failure_rename_type_X, type.getName()), status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_rename_type,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_rename_type_X, type.getName()), status);
}
}
@@ -850,8 +853,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(new SetElementNillableCommand(model, element, nillable));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_element_nillable, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_set_nillable_element_X, element.getName()), status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_element_nillable,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_nillable_element_X,
+ element.getName()), status);
}
}
@@ -874,8 +879,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (element.getMinOccurs() != minOccurs || element.getMaxOccurs() != maxOccurs) {
final IStatus status = executeCommand(new SetElementOccurences(model, element, minOccurs, maxOccurs));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_min_occurs, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_failure_set_min_occurs_element_X, element.getName()), status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_min_occurs,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_min_occurs_element_X,
+ element.getName()), status);
}
}
@@ -900,8 +907,8 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
final IStatus status = executeCommand(new SetElementTypeCommand(model, element, type));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_elements_type, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_failure_set_type_X, type.getName()), status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_elements_type,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_type_X, type.getName()), status);
}
}
@@ -917,8 +924,8 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(cmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_set_length_facet, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_failure_set_length_facet_type_X, type.getName()), status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_set_length_facet, MessageFormat
+ .format(Messages.DataTypesFormPageController_msg_failure_set_length_facet_type_X, type.getName()), status);
}
}
@@ -928,9 +935,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(FacetsCommandFactory.createDeleteFacetCommand(model, type, facet));
if (!StatusUtils.canContinue(status)) {
- StatusUtils
- .showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_pattern_facet, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_failure_delete_pattern_facet_type_X, type.getName()), status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_delete_pattern_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_delete_pattern_facet_type_X,
+ type.getName()), status);
}
}
@@ -946,8 +954,8 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(cmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_set_length_facet, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_failure_set_length_facet_type_X, type.getName()), status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_set_length_facet, MessageFormat
+ .format(Messages.DataTypesFormPageController_msg_failure_set_length_facet_type_X, type.getName()), status);
}
}
@@ -963,9 +971,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(cmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils
- .showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_min_length_facet, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_failure_set_min_length_facet_type_X, type.getName()), status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_min_length_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_min_length_facet_type_X,
+ type.getName()), status);
}
}
@@ -981,9 +990,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(cmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_max_length_facet, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_set_max_length_facet_to_type_X, type.getName()),
- status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_max_length_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_max_length_facet_to_type_X,
+ type.getName()), status);
}
}
@@ -999,9 +1009,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(cmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_min_exclusive_facet, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_set_min_exclusive_facet_type_X, type.getName()),
- status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_min_exclusive_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_min_exclusive_facet_type_X,
+ type.getName()), status);
}
}
@@ -1017,9 +1028,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(cmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_max_exclusive_facet, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_set_max_eclusive_facet_type_X, type.getName()),
- status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_max_exclusive_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_max_eclusive_facet_type_X,
+ type.getName()), status);
}
}
@@ -1036,9 +1048,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(cmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_min_inclusive_facet, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_set_min_inclusive_facet_type_X, type.getName()),
- status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_min_inclusive_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_min_inclusive_facet_type_X,
+ type.getName()), status);
}
}
@@ -1054,9 +1067,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(cmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_max_inclusive_facet, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_set_max_inclusive_facet_type_X, type.getName()),
- status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_max_inclusive_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_max_inclusive_facet_type_X,
+ type.getName()), status);
}
}
@@ -1067,14 +1081,15 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (whitespace != null) {
final IStatus status = executeCommand(FacetsCommandFactory.createAddWhiteSpaceFacetCommand(model, type, whitespace));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_whitespace_facet, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_add_whitespace_facet_type_X, type.getName()),
- status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_add_whitespace_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_add_whitespace_facet_type_X,
+ type.getName()), status);
}
} else {
final IStatus status = executeCommand(FacetsCommandFactory.createDeleteWhiteSpaceFacetCommand(model, type, null));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_whitespace_facet,
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_whitespace_facet,
MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_delete_whitespace_facet_type_X,
type.getName()), status);
}
@@ -1093,9 +1108,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(cmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_total_digits_facet, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_set_total_digits_facet_type_X, type.getName()),
- status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_total_digits_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_total_digits_facet_type_X,
+ type.getName()), status);
}
}
@@ -1111,9 +1127,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(cmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_fraction_digits_facet, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_set_fraction_digits_facet_type_X, type.getName()),
- status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_fraction_digits_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_fraction_digits_facet_type_X,
+ type.getName()), status);
}
}
@@ -1123,8 +1140,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(FacetsCommandFactory.createAddPatternFacetCommand(model, type, value));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_pattern_facet, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_failure_add_pattern_facet_type_X, type.getName()), status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_add_pattern_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_add_pattern_facet_type_X,
+ type.getName()), status);
}
}
@@ -1134,9 +1153,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(FacetsCommandFactory.createDeletePatternFacetCommand(model, type, facet));
if (!StatusUtils.canContinue(status)) {
- StatusUtils
- .showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_pattern_facet, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_failure_delete_pattern_facet_type_X, type.getName()), status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_delete_pattern_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_delete_pattern_facet_type_X,
+ type.getName()), status);
}
}
@@ -1146,8 +1166,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(FacetsCommandFactory.createSetPatternFacetCommand(model, type, facet, value));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_pattern_facet, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_failure_set_pattern_facet_type_X, type.getName()), status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_pattern_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_pattern_facet_type_X,
+ type.getName()), status);
}
}
@@ -1157,9 +1179,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(FacetsCommandFactory.createSetEnumerationFacetCommand(model, type, facet, value));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_enumeration_facet, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_set_enumeration_facet_type_X, type.getName()),
- status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_enumeration_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_enumeration_facet_type_X,
+ type.getName()), status);
}
}
@@ -1169,9 +1192,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(FacetsCommandFactory.createAddEnumerationFacetCommand(model, type, value));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_add_enumeration_facet, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_set_enumeration_facet_type_X, type.getName()),
- status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_add_enumeration_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_enumeration_facet_type_X,
+ type.getName()), status);
}
}
@@ -1181,9 +1205,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(FacetsCommandFactory.createDeleteEnumerationFacetCommand(model, type, facet));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_enumeration_facet, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_delete_enumeration_facet_type_X, type.getName()),
- status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_delete_enumeration_facet,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_delete_enumeration_facet_type_X,
+ type.getName()), status);
}
}
@@ -1194,8 +1219,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(new SetStructureTypeBaseTypeCompositeCommand(model, structure, type));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_2, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_failure_set_type_of_structure_X, structure.getName()), status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_2,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_type_of_structure_X,
+ structure.getName()), status);
}
}
@@ -1206,8 +1233,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(new SetStructureTypeCommand(model, structure, type));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_structure_type, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_failure_set_type_of_structure_X, structure.getName()), status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_dlg_title_set_structure_type,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_type_of_structure_X,
+ structure.getName()), status);
}
}
@@ -1217,17 +1246,18 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(new SetGlobalElementNillableCommand(model, structure, nillable));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_element_nillable, MessageFormat
- .format(Messages.DataTypesFormPageController_msg_failure_set_global_element_X_nillable, structure.getName()),
- status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_element_nillable,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_global_element_X_nillable,
+ structure.getName()), status);
}
}
public void setSimpleTypeBaseType(final ISimpleType type, final ISimpleType baseType) {
final IStatus status = executeCommand(new SetBaseTypeCommand(model, type, baseType));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_base_type, MessageFormat.format(
- Messages.DataTypesFormPageController_msg_failure_set_base_type_X, type.getName()), status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_set_base_type,
+ MessageFormat.format(Messages.DataTypesFormPageController_msg_failure_set_base_type_X, type.getName()),
+ status);
}
}
@@ -1455,7 +1485,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
final IStatus status = executeCommand(addFacetCmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_SET_FACET_TTL, MessageFormat.format(
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_SET_FACET_TTL, MessageFormat.format(
Messages.DataTypesFormPageController_CANNOT_SET_FACET_TO_ANONYMOUS_TYPE, input.getName()), status);
}
}
@@ -1481,7 +1511,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (!isEditAllowed(targetModelObject)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.DataTypesFormPageController_msg_editing_element_X_is_not_allowed, selectedTreeNode.getDisplayName()));
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_0, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_0, status);
return;
}
@@ -1507,13 +1537,13 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
}
if (status.isOK()) {
- final CopyTypeCommand copyCommand = new CopyTypeCommand(targetModelObject.getModelRoot(), targetModelObject
- .getParent(), sourceType.getComponent(), targetSchema, sourceType.getName());
+ final CopyTypeCommand copyCommand = new CopyTypeCommand(targetModelObject.getModelRoot(),
+ targetModelObject.getParent(), sourceType.getComponent(), targetSchema, sourceType.getName());
status = executeCommand(copyCommand);
copiedType = copyCommand.getCopiedType();
}
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_1, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_1, status);
if (copiedType != null) {
selectedTreeNode.getChildren();
@@ -1579,7 +1609,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
if (!isEditAllowed(element)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.DataTypesFormPageController_msg_editing_element_X_is_not_allowed, element.getName()));
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_rename_element, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_rename_element, status);
return false;
}
return true;
@@ -1616,7 +1646,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
(IXSDModelRoot) firstElement.getModelObject().getModelRoot(), structureType);
final IStatus status = executeCommand(inlineStructureTypeCommand);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_inline_structure_type_dlg_title,
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_inline_structure_type_dlg_title,
Messages.DataTypesFormPageController_inline_structure_type_dlg_message, status);
}
fireTreeNodeExpandEvent(structureType);
@@ -1665,7 +1695,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
final AbstractNotificationOperation setAnonymousCommand, final String dialogTitle) {
final IStatus status = executeCommand(setAnonymousCommand);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(dialogTitle, MessageFormat.format(
+ getDialogManager().showStatusDialog(dialogTitle, MessageFormat.format(
Messages.DataTypesFormPageController_cannot_set_anonymous_X_for_element_Y_error_msg, anonymous, elementName),
status);
}
@@ -1686,8 +1716,10 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
(IWsdlModelRoot) schemaToInline.getModelRoot().getRoot(), schemaToInline);
final IStatus status = executeCommand(inlineNamespaceCompositeCommand);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_inline_schema_failed, MessageFormat.format(
- Messages.DataTypesFormPageController_inline_failed_error_msg, schemaToInline.getNamespace()), status);
+ getDialogManager().showStatusDialog(
+ Messages.DataTypesFormPageController_inline_schema_failed,
+ MessageFormat.format(Messages.DataTypesFormPageController_inline_failed_error_msg,
+ schemaToInline.getNamespace()), status);
}
fireTreeNodeExpandEvent(inlineNamespaceCompositeCommand.getNewInlinedSchema());
}
@@ -1703,7 +1735,7 @@ public class DataTypesFormPageController extends AbstractFormPageController impl
final ExtractNamespaceWizard wizard = new ExtractNamespaceWizard();
final IStatus status = initWizard(node, wizard);
if (!status.isOK()) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_initialization_error_dlg_title, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_initialization_error_dlg_title, status);
return;
}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/SiEditorDataTypesFormPageController.java b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/SiEditorDataTypesFormPageController.java
index d8b9c24..00e5cc6 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/SiEditorDataTypesFormPageController.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/SiEditorDataTypesFormPageController.java
@@ -31,6 +31,7 @@ import org.eclipse.wst.sse.sieditor.model.utils.StatusUtils;
import org.eclipse.wst.sse.sieditor.model.wsdl.api.IDescription;
import org.eclipse.wst.sse.sieditor.model.xsd.api.ISchema;
import org.eclipse.wst.sse.sieditor.ui.Activator;
+import org.eclipse.wst.sse.sieditor.ui.DialogManager;
import org.eclipse.wst.sse.sieditor.ui.i18n.Messages;
import org.eclipse.wst.sse.sieditor.ui.v2.dt.nodes.IDataTypesTreeNode;
import org.eclipse.wst.sse.sieditor.ui.v2.dt.nodes.impl.NamespaceNode;
@@ -83,7 +84,7 @@ public class SiEditorDataTypesFormPageController extends DataTypesFormPageContro
if (StatusUtils.canContinue(status)) {
return command.getNewSchema();
}
- StatusUtils.showStatusDialog(Messages.SiEditorDataTypesFormPageController_dlg_title_add_namespace, MessageFormat
+ DialogManager.instance.showStatusDialog(Messages.SiEditorDataTypesFormPageController_dlg_title_add_namespace, MessageFormat
.format(Messages.SiEditorDataTypesFormPageController_msg_failure_add_xsd_schema_to_wsdl_X, root
.getDescription().getLocation()), status);
} catch (final ExecutionException e) {
diff --git a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/extractwizard/ExtractNamespaceWizard.java b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/extractwizard/ExtractNamespaceWizard.java
index 29318fd..53c5b2b 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/extractwizard/ExtractNamespaceWizard.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/extractwizard/ExtractNamespaceWizard.java
@@ -34,6 +34,7 @@ import org.eclipse.wst.sse.sieditor.model.utils.StatusUtils;
import org.eclipse.wst.sse.sieditor.model.wsdl.impl.Description;
import org.eclipse.wst.sse.sieditor.model.xsd.api.ISchema;
import org.eclipse.wst.sse.sieditor.ui.Activator;
+import org.eclipse.wst.sse.sieditor.ui.DialogManager;
import org.eclipse.wst.sse.sieditor.ui.i18n.Messages;
import org.eclipse.wst.sse.sieditor.ui.v2.dt.extractwizard.pages.ExtractSchemaWizardPage;
import org.eclipse.wst.sse.sieditor.ui.v2.dt.extractwizard.pages.SchemaDependenciesWizardPage;
@@ -102,7 +103,7 @@ public class ExtractNamespaceWizard extends Wizard {
} finally {
final IStatus extractSchemaRunnableStatus = runnable.getStatus();
if (extractSchemaRunnableStatus.getSeverity() == IStatus.ERROR) {
- StatusUtils.showStatusDialog(Messages.ExtractNamespaceWizard_error_status_dlg_title, MessageFormat.format(
+ DialogManager.instance.showStatusDialog(Messages.ExtractNamespaceWizard_error_status_dlg_title, MessageFormat.format(
Messages.ExtractNamespaceWizard_error_status_dlg_msg, schemaNode.getNamespace()), runnable.getStatus());
}
}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/quickFix/MissingSchemaElementQuickFix.java b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/quickFix/MissingSchemaElementQuickFix.java
index e6a2113..263b541 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/quickFix/MissingSchemaElementQuickFix.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/quickFix/MissingSchemaElementQuickFix.java
@@ -24,6 +24,7 @@ import org.eclipse.wst.sse.sieditor.command.emf.xsd.EnsureSchemaElementCommand;
import org.eclipse.wst.sse.sieditor.model.utils.StatusUtils;
import org.eclipse.wst.sse.sieditor.model.xsd.api.ISchema;
import org.eclipse.wst.sse.sieditor.ui.Activator;
+import org.eclipse.wst.sse.sieditor.ui.DialogManager;
import org.eclipse.wst.sse.sieditor.ui.i18n.Messages;
public class MissingSchemaElementQuickFix implements IMarkerResolution {
@@ -50,7 +51,7 @@ public class MissingSchemaElementQuickFix implements IMarkerResolution {
status = new Status(IStatus.INFO, Activator.PLUGIN_ID,
Messages.MissingSchemaElementQuickFix_2, e);
}
- StatusUtils.showStatusDialog(Messages.MissingSchemaElementQuickFix_1, status);
+ DialogManager.instance.showStatusDialog(Messages.MissingSchemaElementQuickFix_1, status);
}
}
}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/quickFix/MissingSchemaForSchemaQuickFix.java b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/quickFix/MissingSchemaForSchemaQuickFix.java
index 042fb09..66731f8 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/quickFix/MissingSchemaForSchemaQuickFix.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/dt/quickFix/MissingSchemaForSchemaQuickFix.java
@@ -25,6 +25,7 @@ import org.eclipse.wst.sse.sieditor.core.common.Logger;
import org.eclipse.wst.sse.sieditor.model.utils.StatusUtils;
import org.eclipse.wst.sse.sieditor.model.xsd.api.ISchema;
import org.eclipse.wst.sse.sieditor.ui.Activator;
+import org.eclipse.wst.sse.sieditor.ui.DialogManager;
import org.eclipse.wst.sse.sieditor.ui.i18n.Messages;
public class MissingSchemaForSchemaQuickFix implements IMarkerResolution {
@@ -52,7 +53,7 @@ public class MissingSchemaForSchemaQuickFix implements IMarkerResolution {
} catch (ExecutionException e) {
final IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.MissingSchemaForSchemaQuickFix_0, e);
Logger.log(status);
- StatusUtils.showStatusDialog(Messages.MissingSchemaForSchemaQuickFix_0, status);
+ DialogManager.instance.showStatusDialog(Messages.MissingSchemaForSchemaQuickFix_0, status);
}
}
diff --git a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/wsdl/controller/SIFormPageController.java b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/wsdl/controller/SIFormPageController.java
index ef0cb82..8bc3324 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/wsdl/controller/SIFormPageController.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.ui/api/org/eclipse/wst/sse/sieditor/ui/v2/wsdl/controller/SIFormPageController.java
@@ -179,7 +179,7 @@ public class SIFormPageController extends AbstractFormPageController {
if (!isEditAllowed(model)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.SIFormPageController_msg_editing_wsdl_X_not_allowed, description.getLocation()));
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_service_interface, status);
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_service_interface, status);
return;
}
@@ -193,7 +193,7 @@ public class SIFormPageController extends AbstractFormPageController {
final IStatus status = model.getEnv().execute(compositeNotificationOperation);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_service_interface, MessageFormat
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_service_interface, MessageFormat
.format(Messages.SIFormPageController_msg_failure_add_new_service_interface_to_wsdl_X, description
.getLocation()), status);
}
@@ -213,7 +213,6 @@ public class SIFormPageController extends AbstractFormPageController {
return (IWsdlModelRoot) model;
}
-
/**
* Adds a new Operation to the given service interface
*
@@ -229,7 +228,7 @@ public class SIFormPageController extends AbstractFormPageController {
if (!isEditAllowed(parent.getModelObject())) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.SIFormPageController_msg_editing_element_X_not_allowed, parent.getDisplayName()));
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_operation, status);
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_operation, status);
return;
}
final IServiceInterface serviceInterface = (IServiceInterface) parent.getModelObject();
@@ -241,7 +240,7 @@ public class SIFormPageController extends AbstractFormPageController {
OperationType.REQUEST_RESPONSE);
final IStatus status = model.getEnv().execute(command);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_operation, MessageFormat.format(
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_operation, MessageFormat.format(
Messages.SIFormPageController_msg_failure_add_new_operation_to_service_interface_X, serviceInterface
.getName()), status);
return;
@@ -292,7 +291,7 @@ public class SIFormPageController extends AbstractFormPageController {
final IParameter firstInParam = allInputParameters.iterator().next();
final IModelRoot modelRoot = firstInParam.getModelRoot();
if (!EmfWsdlUtils.isModelObjectPartOfModelRoot(modelRoot, firstInParam)) {
- final boolean removeInputParams = StatusUtils.showDialogWithResult(MessageDialog.QUESTION,
+ final boolean removeInputParams = getDialogManager().showDialogWithResult(MessageDialog.QUESTION,
Messages.SIFormPageController_0, MessageFormat.format(Messages.SIFormPageController_1, operation
.getName()));
if (!removeInputParams) {
@@ -305,7 +304,7 @@ public class SIFormPageController extends AbstractFormPageController {
final AddInParameterCommand command = new AddInParameterCommand(getWsdlModelRoot(), operation, newInputParamName);
final IStatus status = model.getEnv().execute(command);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_input_parameter, MessageFormat
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_input_parameter, MessageFormat
.format(Messages.SIFormPageController_msg_failure_add_new_input_parameter_to_operation_X, operation
.getName()), status);
return;
@@ -344,7 +343,7 @@ public class SIFormPageController extends AbstractFormPageController {
final IParameter firstOutParam = allOutputParameters.iterator().next();
final IModelRoot modelRoot = firstOutParam.getModelRoot();
if (!EmfWsdlUtils.isModelObjectPartOfModelRoot(modelRoot, firstOutParam)) {
- final boolean removeOutputParams = StatusUtils.showDialogWithResult(MessageDialog.QUESTION,
+ final boolean removeOutputParams = getDialogManager().showDialogWithResult(MessageDialog.QUESTION,
Messages.SIFormPageController_2, MessageFormat.format(Messages.SIFormPageController_3, operation
.getName()));
if (!removeOutputParams) {
@@ -357,7 +356,7 @@ public class SIFormPageController extends AbstractFormPageController {
final AddOutParameterCommand command = new AddOutParameterCommand(getWsdlModelRoot(), operation, newOutputParamName);
final IStatus status = model.getEnv().execute(command);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_output_parameter, MessageFormat
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_output_parameter, MessageFormat
.format(Messages.SIFormPageController_msg_failure_add_new_output_parameter_to_operation_X, operation
.getName()), status);
return;
@@ -407,7 +406,7 @@ public class SIFormPageController extends AbstractFormPageController {
if (!isEditAllowed(operation)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.SIFormPageController_msg_editing_element_X_not_allowed, selectedElement.getDisplayName()));
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_parameter, status);
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_parameter, status);
return;
}
@@ -417,7 +416,7 @@ public class SIFormPageController extends AbstractFormPageController {
final AddFaultCommand command = new AddFaultCommand(getWsdlModelRoot(), operation, newFaultName);
final IStatus status = model.getEnv().execute(command);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_add_fault, MessageFormat.format(
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_add_fault, MessageFormat.format(
Messages.SIFormPageController_smg_failure_add_fault_to_operation_X, operation.getName()), status);
return;
}
@@ -482,7 +481,7 @@ public class SIFormPageController extends AbstractFormPageController {
if (!isEditAllowed(selectedNode.getModelObject())) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.SIFormPageController_msg_editing_element_X_not_allowed, selectedNode.getDisplayName()));
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_parameter, status);
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_add_new_parameter, status);
return;
}
@@ -642,7 +641,7 @@ public class SIFormPageController extends AbstractFormPageController {
final DeleteOperationCommand cmd = new DeleteOperationCommand(getWsdlModelRoot(), serviceInterface, operation);
final IStatus status = model.getEnv().execute(cmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_delete_operation, MessageFormat.format(
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_delete_operation, MessageFormat.format(
Messages.SIFormPageController_msg_failure_delete_operation_X, operation.getName()), status);
return;
}
@@ -662,7 +661,7 @@ public class SIFormPageController extends AbstractFormPageController {
final IStatus status = deleteItems(items);
if (status.getSeverity() != IStatus.OK) {
- StatusUtils.showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_element, status);
+ getDialogManager().showStatusDialog(Messages.DataTypesFormPageController_dlg_title_delete_element, status);
return;
}
@@ -780,7 +779,7 @@ public class SIFormPageController extends AbstractFormPageController {
if (!isEditAllowed(description)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.SIFormPageController_msg_editing_wsdl_X_not_allowed, description.getLocation()));
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_editing_namespace, status);
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_editing_namespace, status);
return;
}
if (newNamespace == null) {
@@ -795,7 +794,7 @@ public class SIFormPageController extends AbstractFormPageController {
final IStatus status = model.getEnv().execute(
new ChangeDefinitionTNSCompositeCommand(getWsdlModelRoot(), getWsdlModelRoot().getDescription(), newNamespace));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_editing_namespace,
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_editing_namespace,
Messages.SIFormPageController_msg_failure_set_target_namespace, status);
return;
}
@@ -820,7 +819,7 @@ public class SIFormPageController extends AbstractFormPageController {
if (!isEditAllowed(parameter)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.SIFormPageController_msg_editing_element_X_not_allowed, node.getDisplayName()));
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_edit_parameter_type, status);
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_edit_parameter_type, status);
return;
}
@@ -863,7 +862,7 @@ public class SIFormPageController extends AbstractFormPageController {
if (!isEditAllowed(parameter)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.SIFormPageController_msg_editing_element_X_not_allowed, node.getDisplayName()));
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_edit_parameter_type, status);
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_edit_parameter_type, status);
return;
}
@@ -902,7 +901,7 @@ public class SIFormPageController extends AbstractFormPageController {
final SetParameterTypeCommand cmd = new SetParameterTypeCommand(parameter, newType);
final IStatus status = model.getEnv().execute(cmd);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_set_parameter_type, MessageFormat
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_set_parameter_type, MessageFormat
.format(Messages.SIFormPageController_msg_failure_set_type_X_of_parameter_Y, newType.getName(),
parameter.getName()), status);
return;
@@ -932,7 +931,7 @@ public class SIFormPageController extends AbstractFormPageController {
if (!isEditAllowed(treeNode.getModelObject())) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.SIFormPageController_msg_editing_element_X_not_allowed, treeNode.getDisplayName()));
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_edit_name, status);
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_edit_name, status);
return;
}
@@ -964,7 +963,7 @@ public class SIFormPageController extends AbstractFormPageController {
}
final IStatus status = model.getEnv().execute(command);
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_rename_item, MessageFormat.format(
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_rename_item, MessageFormat.format(
Messages.SIFormPageController_msg_failure_set_new_name_X_item_Y, newName, treeNode.getDisplayName()),
status);
return;
@@ -987,14 +986,14 @@ public class SIFormPageController extends AbstractFormPageController {
if (!isEditAllowed(operation)) {
final IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID, MessageFormat.format(
Messages.SIFormPageController_msg_failure_edit_type_of_operation_X, operation.getName()));
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_edit_operation_type, status);
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_edit_operation_type, status);
return;
}
try {
final IStatus status = model.getEnv().execute(
new ChangeOperationTypeCommand(getWsdlModelRoot(), operation, type, isAsynchronousOperationFaultsEnabled()));
if (!StatusUtils.canContinue(status)) {
- StatusUtils.showStatusDialog(Messages.SIFormPageController_dlg_title_edit_operation_type, MessageFormat.format(
+ getDialogManager().showStatusDialog(Messages.SIFormPageController_dlg_title_edit_operation_type, MessageFormat.format(
Messages.SIFormPageController_msg_failure_edit_type_of_operation_X, operation.getName()), status);
return;
}

Back to the top