Author: Grid.Qian
Date: 2009-07-02 05:35:12 -0400 (Thu, 02 Jul 2009)
New Revision: 16334
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/DeleteChildCommand.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/DeletePartnerLinkTypeCommand.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties
Log:
JBIDE-4532: revert the change for this issue
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java 2009-07-02
09:18:17 UTC (rev 16333)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java 2009-07-02
09:35:12 UTC (rev 16334)
@@ -14,7 +14,7 @@
public final class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.bpel.ui.messages";
//$NON-NLS-1$
+ private static final String BUNDLE_NAME =
"org.eclipse.bpel.ui.messages";//$NON-NLS-1
private Messages() {
@@ -702,9 +702,6 @@
public static String OutlinePage_showOverviewView;
public static String OutlinePage_showOutlineView;
-
- public static String DeletePartnerLinkTypeWarningMessage;
- public static String DeletePartnerLinkTypeWarningDialogTitle;
static {
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/DeleteChildCommand.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/DeleteChildCommand.java 2009-07-02
09:18:17 UTC (rev 16333)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/DeleteChildCommand.java 2009-07-02
09:35:12 UTC (rev 16334)
@@ -34,14 +34,12 @@
import org.eclipse.bpel.ui.util.ModelHelper;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.wsdl.Definition;
/**
- * Deletes a model object from an IContainer, and removes any references to it
- * from other model objects.
+ * Deletes a model object from an IContainer, and removes any references to it from
other
+ * model objects.
*
* This is more or less the opposite of InsertInContainerCommand.
*
@@ -51,30 +49,28 @@
private EObject fChild;
private EObject fParent;
-
+
IContainer fContainer;
-
+
Resource[] resourcesToModify = null;
-
+
CompoundCommand fDeleteLinksCmd;
- CompoundCommand fDeletePLTsCmd;
-
+ CompoundCommand fDeletePLTsCmd;
+
public DeleteChildCommand(EObject child) {
super(new ArrayList(2));
fParent = child.eContainer();
-
+
if (fParent instanceof FaultHandler || fParent instanceof EventHandler) {
- // If the child of the FH/EH is the *only* child, then we want to
- // delete the
+ // If the child of the FH/EH is the *only* child, then we want to delete the
// entire FH/EH, since it has no meaningful attributes of its own.
- IContainer<EObject> container = BPELUtil.adapt(fParent,
- IContainer.class);
+ IContainer<EObject> container = BPELUtil.adapt(fParent, IContainer.class);
List<EObject> children = container.getChildren(fParent);
if (children.size() == 1 && children.contains(child)) {
// delete the FH instead
child = fParent;
- fParent = child.eContainer();
+ fParent = child.eContainer();
}
}
this.fChild = child;
@@ -82,21 +78,19 @@
if (fParent != null) {
addModelRoot(fParent);
}
-
+
fContainer = BPELUtil.adapt(fParent, IContainer.class);
-
+
String childType = null;
- ILabeledElement labeledElement = BPELUtil.adapt(child,
- ILabeledElement.class);
+ ILabeledElement labeledElement = BPELUtil.adapt(child, ILabeledElement.class);
if (labeledElement != null) {
childType = labeledElement.getTypeLabel(child);
}
- if (childType == null) {
- childType = Messages.DeleteChildCommand_Item_1;
+ if (childType == null) {
+ childType = Messages.DeleteChildCommand_Item_1;
}
- setLabel(NLS.bind(Messages.DeleteChildCommand_Delete_2,
- (new Object[] { childType })));
+ setLabel(NLS.bind(Messages.DeleteChildCommand_Delete_2, (new Object[] { childType })));
}
/**
@@ -104,10 +98,10 @@
*/
@Override
public boolean canDoExecute() {
- if (fChild == null || fParent == null || fContainer == null) {
+ if (fChild == null || fParent == null || fContainer==null ) {
return false;
- }
- return fContainer.canRemoveChild(fParent, fChild);
+ }
+ return fContainer.canRemoveChild ( fParent, fChild );
}
// TODO: this is a hack.
@@ -115,103 +109,78 @@
public Resource[] getResources() {
if (resourcesToModify == null) {
Process process = ModelHelper.getProcess(fParent);
- if (process == null)
- return EMPTY_RESOURCE_ARRAY;
+ if (process == null) return EMPTY_RESOURCE_ARRAY;
BPELEditor bpelEditor = ModelHelper.getBPELEditor(process);
-
+
Set<Resource> resultSet = new HashSet<Resource>();
resultSet.add(fParent.eResource());
-
+
// Figure out which model objects are being deleted.
HashSet<Object> deletingSet = new HashSet<Object>();
ModelHelper.addSubtreeToCollection(fChild, deletingSet);
-
- // If we are deleting any PartnerLinks which reference PLTs in the
- // Artifacts WSDL
+
+ // If we are deleting any PartnerLinks which reference PLTs in the Artifacts WSDL
// file, also delete the referenced PLTs.
Set<PartnerLinkType> partnerLinkTypes = null;
- Definition artifactsDefinition = bpelEditor
- .getArtifactsDefinition();
-
- for (Iterator it = deletingSet.iterator(); it.hasNext();) {
+ Definition artifactsDefinition = bpelEditor.getArtifactsDefinition();
+
+ for (Iterator it = deletingSet.iterator(); it.hasNext(); ) {
Object object = it.next();
if (object instanceof PartnerLink) {
- PartnerLinkType plt = ((PartnerLink) object)
- .getPartnerLinkType();
- if ((plt != null)
- && (plt.getEnclosingDefinition() == artifactsDefinition)) {
- if (partnerLinkTypes == null)
- partnerLinkTypes = new HashSet<PartnerLinkType>();
+ PartnerLinkType plt = ((PartnerLink)object).getPartnerLinkType();
+ if ((plt != null) && (plt.getEnclosingDefinition() == artifactsDefinition))
{
+ if (partnerLinkTypes == null) partnerLinkTypes = new
HashSet<PartnerLinkType>();
if (partnerLinkTypes.add(plt)) {
resultSet.add(plt.eResource());
}
}
}
}
- resourcesToModify = resultSet
- .toArray(new Resource[resultSet.size()]);
+ resourcesToModify = resultSet.toArray(new Resource[resultSet.size()]);
}
return resourcesToModify;
}
-
+
/**
* @see org.eclipse.bpel.ui.commands.util.AutoUndoCommand#doExecute()
*/
@Override
public void doExecute() {
-
- if (!canExecute()) {
+
+ if (!canExecute()) {
throw new IllegalStateException();
}
Process process = ModelHelper.getProcess(fParent);
- if (process == null)
- return;
+ if (process == null) return;
BPELEditor bpelEditor = ModelHelper.getBPELEditor(process);
-
+
EObject topModelObject = process;
-
- // Multi-delete safety: if the child does not have a resource, assume it
- // has
+
+ // Multi-delete safety: if the child does not have a resource, assume it has
// already been deleted, and do nothing.
if (fChild.eResource() == null) {
return;
}
-
+
// Figure out which model objects are being deleted.
HashSet deletingSet = new HashSet();
ModelHelper.addSubtreeToCollection(fChild, deletingSet);
-
- // If we are deleting any PartnerLinks which reference PLTs in the
- // Artifacts WSDL
+
+ // If we are deleting any PartnerLinks which reference PLTs in the Artifacts WSDL
// file, also delete the referenced PLTs.
Set<PartnerLinkType> partnerLinkTypes = null;
Definition artifactsDefinition = bpelEditor.getArtifactsDefinition();
- for (Iterator it = deletingSet.iterator(); it.hasNext();) {
+ for (Iterator it = deletingSet.iterator(); it.hasNext(); ) {
Object object = it.next();
if (object instanceof PartnerLink) {
- PartnerLinkType plt = ((PartnerLink) object)
- .getPartnerLinkType();
- if ((plt != null)
- && (plt.getEnclosingDefinition() == artifactsDefinition)) {
- // We should ask the user if delete the partner link type
- if (MessageDialog
- .openQuestion(
- PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getShell(),
- Messages.DeletePartnerLinkTypeWarningDialogTitle,
- NLS.bind(Messages.DeletePartnerLinkTypeWarningMessage,
- (new Object[] {((PartnerLink) object).getName(), plt.getName() })))) {
- if (partnerLinkTypes == null)
- partnerLinkTypes = new HashSet<PartnerLinkType>();
- if (partnerLinkTypes.add(plt)) {
- if (fDeletePLTsCmd == null)
- fDeletePLTsCmd = new CompoundCommand();
- fDeletePLTsCmd
- .add(new DeletePartnerLinkTypeCommand(plt));
- }
+ PartnerLinkType plt = ((PartnerLink)object).getPartnerLinkType();
+ if ((plt != null) && (plt.getEnclosingDefinition() == artifactsDefinition))
{
+ if (partnerLinkTypes == null) partnerLinkTypes = new
HashSet<PartnerLinkType>();
+ if (partnerLinkTypes.add(plt)) {
+ if (fDeletePLTsCmd == null) fDeletePLTsCmd = new CompoundCommand();
+ fDeletePLTsCmd.add(new DeletePartnerLinkTypeCommand(plt));
}
}
}
@@ -222,61 +191,49 @@
ModelHelper.addSubtreeToCollection(topModelObject, notDeletingSet);
notDeletingSet.removeAll(deletingSet);
- // We also need to find any flow links which involve a deleted object
- // and remove them.
+ // We also need to find any flow links which involve a deleted object and remove them.
// This is a hack, but it could be worse..
// step 1: find all the flows which contain deleted objects
HashSet<Flow> flowSet = new HashSet<Flow>();
- for (Iterator<EObject> it = deletingSet.iterator(); it.hasNext();) {
- Flow[] flws = FlowLinkUtil.getParentFlows(it.next());
+ for (Iterator<EObject> it = deletingSet.iterator(); it.hasNext(); ) {
+ Flow [] flws = FlowLinkUtil.getParentFlows(it.next());
flowSet.addAll(Arrays.asList(flws));
}
// step 2: if any of the flows is being deleted, we can ignore it
- // this is safe because the source, dest and link itself are all
- // children of the flow
+ // this is safe because the source, dest and link itself are all children of the flow
flowSet.removeAll(deletingSet);
-
- // step 3: check each link in each of the remaining flows to see if it
- // involves a
- // deleted object. Even if both source and target are being deleted, we
- // should still
- // delete the link, since it is a child of the Flow which is not being
- // deleted.
+
+ // step 3: check each link in each of the remaining flows to see if it involves a
+ // deleted object. Even if both source and target are being deleted, we should still
+ // delete the link, since it is a child of the Flow which is not being deleted.
fDeleteLinksCmd = new CompoundCommand();
- for (Iterator<Flow> flowIt = flowSet.iterator(); flowIt.hasNext();) {
+ for (Iterator<Flow> flowIt = flowSet.iterator(); flowIt.hasNext(); ) {
Flow flow = flowIt.next();
- for (Iterator<Link> it = FlowLinkUtil.getFlowLinks(flow).iterator(); it
- .hasNext();) {
+ for (Iterator<Link> it = FlowLinkUtil.getFlowLinks(flow).iterator();
it.hasNext(); ) {
Link link = it.next();
- if (deletingSet.contains(FlowLinkUtil.getLinkSource(link))
- || deletingSet.contains(FlowLinkUtil
- .getLinkTarget(link))) {
- // NOTE: this is safe even if the link is scheduled for
- // deletion by
+ if (deletingSet.contains(FlowLinkUtil.getLinkSource(link)) ||
deletingSet.contains(FlowLinkUtil.getLinkTarget(link))) {
+ // NOTE: this is safe even if the link is scheduled for deletion by
// a GEF DeleteAction, see comment in DeleteLinkCommand.
DeleteLinkCommand child = new DeleteLinkCommand(link);
- if (child.canExecute())
- fDeleteLinksCmd.add(child);
+ if (child.canExecute()) fDeleteLinksCmd.add(child);
}
}
}
-
+
fDeleteLinksCmd.doExecute();
-
+
if (fDeletePLTsCmd != null) {
fDeletePLTsCmd.doExecute();
}
-
+
// finally, we can remove the child.
fContainer.removeChild(fParent, fChild);
- // IMPORTANT: since the parent is a not-deleted object and the child
- // will be
- // a deleted object, this step must be done *after* the IContainer
- // removal ;)
- for (Iterator it = notDeletingSet.iterator(); it.hasNext();) {
- BPELUtil.deleteNonContainmentRefs((EObject) it.next(), deletingSet);
+ // IMPORTANT: since the parent is a not-deleted object and the child will be
+ // a deleted object, this step must be done *after* the IContainer removal ;)
+ for (Iterator it = notDeletingSet.iterator(); it.hasNext(); ) {
+ BPELUtil.deleteNonContainmentRefs((EObject)it.next(), deletingSet);
}
}
}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/DeletePartnerLinkTypeCommand.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/DeletePartnerLinkTypeCommand.java 2009-07-02
09:18:17 UTC (rev 16333)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/DeletePartnerLinkTypeCommand.java 2009-07-02
09:35:12 UTC (rev 16334)
@@ -10,12 +10,8 @@
*******************************************************************************/
package org.eclipse.bpel.ui.commands;
-import java.util.HashSet;
-import java.util.Set;
-
import org.eclipse.bpel.model.partnerlinktype.PartnerLinkType;
import org.eclipse.bpel.ui.IBPELUIConstants;
-import org.eclipse.bpel.ui.util.ModelHelper;
/**
@@ -30,20 +26,4 @@
public DeletePartnerLinkTypeCommand(PartnerLinkType plt) {
super(plt);
}
-
- /**
- * Override super's method because we should not delete other partner link
- */
- @Override
- public void doExecute() {
- fDefinition = fElement.getEnclosingDefinition();
-
- Set<Object> modelRootSet = new HashSet<Object>();
- modelRootSet.add(fElement.eResource());
- modelRootSet.add(ModelHelper.getBPELEditor(fElement).getResource());
-
- fElement.setEnclosingDefinition(null);
- fDefinition.getEExtensibilityElements().remove(fElement);
-
- }
}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties 2009-07-02
09:18:17 UTC (rev 16333)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties 2009-07-02
09:35:12 UTC (rev 16334)
@@ -136,7 +136,10 @@
BPELPreferencePage_WSIL_EnterLocation = <enter location>
#
# This has \n for a reason. The wrapping in the widget works, but not as expected.
-BPELPreferencePage_WSIL_Description =
+BPELPreferencePage_WSIL_Description = \
+The document above contains links to other WSIL documents shown below.\n\
+You can add or remove WSIL links to/from the above document.\n\
+The result will be shown in the WSIL browser of the editor.
#
BPELUIRegistry_Expression_language_editors_must_provide_expressionLanguage_and_class__8=Expression
language editors must provide expressionLanguage and class.
BPELUtil__unknown_URI__54=<unknown URI>
@@ -693,5 +696,3 @@
SaveImageAction_2=Overwrite {0}?
SaveImageAction_3=Error
SaveImageAction_4=Can't save image to the file {0}
-DeletePartnerLinkTypeWarningDialogTitle=Warning
-DeletePartnerLinkTypeWarningMessage=When you delete the PartnerLink --
''{0}'', you may delete its reference PartnerLinkType --
''{1}'' too, do you want to delete the PartnerLinkType?