https://bugs.eclipse.org/bugs/show_bug.cgi?id=137343
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/editors/MethodElementEditor.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/editors/MethodElementEditor.java
index e0c7b5a..22eaeef 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/editors/MethodElementEditor.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/editors/MethodElementEditor.java
@@ -17,8 +17,10 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.EventObject;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
@@ -103,6 +105,7 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
@@ -194,6 +197,12 @@
private long changeTime = -1;
+ public Object widgetToCheck;
+
+ private Object currentFeatureEditor;
+
+ private EStructuralFeature currentEditedFeature;
+
/**
* Creates a new instance.
*/
@@ -689,6 +698,14 @@
}
public boolean mustRestoreValue(Object control, Object value) {
+ if(widgetToCheck == control) {
+ // the control is currently being checked for editable, but there is still focus lost
+ // event is being sent out even the check is not completed yet.
+ // return true so the focusLost() will not make any change to the control.
+ //
+ return true;
+ }
+
Object editControl = control;
if (editControl instanceof MethodRichTextEditor) {
editControl = ((MethodRichTextEditor) control).getRichTextControl();
@@ -711,79 +728,7 @@
}
return restore;
}
-
- public boolean checkEdit(EObject element, Object control,
- boolean checkContainerResource) {
- if (debug) {
- System.out
- .println("MethodElementEditor.checkEdit: enter, control=" + control); //$NON-NLS-1$
- }
- IStatus status = null;
- if (widgetsToRestoreValue.contains(control)) {
- if (debug) {
- System.out
- .println("MethodElementEditor.checkEdit: widget found in widgetsToRestoreValue, exit"); //$NON-NLS-1$
- }
- return false;
- }
- synchronized (widgetsToRestoreValue) {
- if (widgetsToRestoreValue.contains(control)) {
- if (debug) {
- System.out
- .println("MethodElementEditor.checkEdit: widget found in widgetsToRestoreValue, exit"); //$NON-NLS-1$
- }
- return false;
- }
-
- status = TngUtil.checkEdit(element, getSite().getShell());
- if (!status.isOK()) {
- if (control instanceof IRichText) {
- ((IRichText) control).restoreText();
- } else {
- // Add the control to the list of widgets whose value needs
- // to be restored to the original one..
- widgetsToRestoreValue.add(control);
- if (debug) {
- System.out
- .println("MethodElementEditor.checkEdit: added widget to widgetsToRestoreValue"); //$NON-NLS-1$
- }
- }
- } else if (checkContainerResource) {
- if (element.eContainer() != null
- && element.eContainer().eResource() != element
- .eResource()) {
- status = TngUtil.checkEdit(element.eContainer(), getSite()
- .getShell());
- if (!status.isOK()) {
- // Add the control to the list of widgets whose value
- // needs to be restored to the original one.
- if (debug) {
- System.out
- .println("MethodElementEditor.checkEdit: added widget to widgetsToRestoreValue"); //$NON-NLS-1$
- }
- if (control instanceof IRichText) {
- ((IRichText) control).restoreText();
- } else {
- widgetsToRestoreValue.add(control);
- }
- }
- }
- }
- }
-
- if (status != null && !status.isOK()) {
- AuthoringUIPlugin.getDefault().getMsgDialog().displayError(
- AuthoringUIResources
- .getString("AuthoringUI.editDialog.title"), //$NON-NLS-1$
- AuthoringUIResources
- .getString("AuthoringUI.editDialog.msgCannotEdit"), //$NON-NLS-1$
- status);
- return false;
- }
-
- return true;
- }
-
+
public class ModifyListener implements
org.eclipse.swt.events.ModifyListener {
@@ -801,6 +746,123 @@
checkContainerResource = checkContainer;
this.element = element;
}
+
+ private void restoreText(Object control, String txt) {
+ boolean old = disabled;
+ try {
+ disabled = true;
+ Object editControl = control;
+ if (editControl instanceof MethodRichTextEditor) {
+ editControl = ((MethodRichTextEditor) control).getRichTextControl();
+ }
+ if (editControl instanceof Text) {
+ Text text = ((Text) editControl);
+ text.setText(txt);
+ } else if (editControl instanceof IMethodRichText) {
+ IMethodRichText richText = (IMethodRichText) editControl;
+ richText.setText(txt);
+ }
+ }
+ finally {
+ disabled = old;
+ }
+ }
+
+ private boolean checkEdit(EObject element, Object control,
+ boolean checkContainerResource) {
+ // keep a reference to the current widget so mustRestoreValue() can use it to check
+ // whether a focus lost event is triggered during a checkEdit. mustRestoreValue() then
+ // returns true so focusLost() will not try to make change to the value bound to the widget
+ //
+ widgetToCheck = control;
+ try {
+ if (debug) {
+ System.out
+ .println("MethodElementEditor.checkEdit: enter, control=" + control); //$NON-NLS-1$
+ }
+ IStatus status = null;
+ if (widgetsToRestoreValue.contains(control)) {
+ if (debug) {
+ System.out
+ .println("MethodElementEditor.checkEdit: widget found in widgetsToRestoreValue, exit"); //$NON-NLS-1$
+ }
+ return false;
+ }
+
+ synchronized (widgetsToRestoreValue) {
+ if (widgetsToRestoreValue.contains(control)) {
+ if (debug) {
+ System.out
+ .println("MethodElementEditor.checkEdit: widget found in widgetsToRestoreValue, exit"); //$NON-NLS-1$
+ }
+ return false;
+ }
+
+ status = TngUtil.checkEdit(element, getSite().getShell());
+
+ if (!status.isOK()) {
+ if (control instanceof IRichText) {
+ ((IRichText) control).restoreText();
+ } else {
+ if(control == currentFeatureEditor) {
+ restoreText(control, (String) element.eGet(currentEditedFeature));
+ }
+ else {
+ // Add the control to the list of widgets whose value needs
+ // to be restored to the original one..
+ widgetsToRestoreValue.add(control);
+ if (debug) {
+ System.out
+ .println("MethodElementEditor.checkEdit: added widget to widgetsToRestoreValue"); //$NON-NLS-1$
+ }
+ }
+ }
+ } else if (checkContainerResource) {
+ if (element.eContainer() != null
+ && element.eContainer().eResource() != element
+ .eResource()) {
+ status = TngUtil.checkEdit(element.eContainer(), getSite()
+ .getShell());
+ if (!status.isOK()) {
+// // Add the control to the list of widgets whose value
+// // needs to be restored to the original one.
+// if (debug) {
+// System.out
+// .println("MethodElementEditor.checkEdit: added widget to widgetsToRestoreValue"); //$NON-NLS-1$
+// }
+ if (control instanceof IRichText) {
+ ((IRichText) control).restoreText();
+ } else {
+ if(control == currentFeatureEditor) {
+ restoreText(control, (String) element.eGet(currentEditedFeature));
+ }
+ else {
+ widgetsToRestoreValue.add(control);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (status != null && !status.isOK()) {
+ AuthoringUIPlugin.getDefault().getMsgDialog().displayError(
+ AuthoringUIResources
+ .getString("AuthoringUI.editDialog.title"), //$NON-NLS-1$
+ AuthoringUIResources
+ .getString("AuthoringUI.editDialog.msgCannotEdit"), //$NON-NLS-1$
+ status);
+ return false;
+ }
+
+ return true;
+ }
+ finally {
+ // clear the reference when the check is done
+ //
+ widgetToCheck = null;
+ }
+ }
/**
* @see org.eclipse.swt.events.ModifyListener#modifyText(ModifyEvent)
@@ -895,6 +957,17 @@
boolean checkContainer) {
return new ModifyListener(eObj, checkContainer);
}
+
+ /**
+ * Sets the specified control to be the current editor of the specified feature.
+ *
+ * @param control
+ * @param feature
+ */
+ public void setCurrentFeatureEditor(Object control, EStructuralFeature feature) {
+ currentFeatureEditor = control;
+ currentEditedFeature = feature;
+ }
protected void monitorChange() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/ConfigurationDescription.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/ConfigurationDescription.java
index 150e99e..a53040c 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/ConfigurationDescription.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/ConfigurationDescription.java
@@ -174,6 +174,14 @@
nameText.addModifyListener(modelModifyListener);
nameText.addFocusListener(new FocusAdapter() {
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.FocusAdapter#focusGained(org.eclipse.swt.events.FocusEvent)
+ */
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getNamedElement_Name());
+ }
+
public void focusLost(FocusEvent e) {
String oldContent = config.getName();
final MethodConfiguration iConfig = config;
@@ -266,6 +274,11 @@
despText.addModifyListener(modelModifyListener);
despText.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getMethodElement_BriefDescription());
+ }
+
public void focusLost(FocusEvent e) {
String oldContent = config.getBriefDescription();
if (((MethodElementEditor) getEditor()).mustRestoreValue(
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/ContentPackageDescriptionPage.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/ContentPackageDescriptionPage.java
index 87ea019..8a8ac42 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/ContentPackageDescriptionPage.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/ContentPackageDescriptionPage.java
@@ -275,6 +275,11 @@
ctrl_name.addModifyListener(modelModifyListener);
ctrl_name.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getNamedElement_Name());
+ }
+
public void focusLost(FocusEvent e) {
final Collection eClasses = Collections
.singleton(UmaPackage.eINSTANCE.getMethodPackage());
@@ -314,6 +319,11 @@
ctrl_brief_desc.addModifyListener(modelModifyListener);
ctrl_brief_desc.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getMethodElement_BriefDescription());
+ }
+
public void focusLost(FocusEvent e) {
String oldContent = contentPackage.getBriefDescription();
if (((MethodElementEditor) getEditor()).mustRestoreValue(
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/DeliveryProcessDescription.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/DeliveryProcessDescription.java
index ec6037d..fb2540f 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/DeliveryProcessDescription.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/DeliveryProcessDescription.java
@@ -15,6 +15,7 @@
import org.eclipse.epf.authoring.ui.richtext.IMethodRichText;
import org.eclipse.epf.library.edit.command.IActionManager;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.IEditorInput;
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/DescriptionFormPage.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/DescriptionFormPage.java
index 24c4fd8..36cee15 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/DescriptionFormPage.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/DescriptionFormPage.java
@@ -1031,6 +1031,11 @@
private void addGeneralSectionListeners() {
ctrl_name.addModifyListener(modelModifyListener);
ctrl_name.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getNamedElement_Name());
+ }
+
public void focusLost(FocusEvent e) {
String name = ctrl_name.getText().trim();
if (((MethodElementEditor) getEditor()).mustRestoreValue(
@@ -1106,12 +1111,27 @@
}
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.FocusAdapter#focusGained(org.eclipse.swt.events.FocusEvent)
+ */
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget, UmaPackage.eINSTANCE.getDescribableElement_PresentationName());
+ }
});
if (briefDescOn) {
ctrl_brief_desc.addModifyListener(modelModifyListener);
- ctrl_brief_desc.addListener(SWT.Deactivate, new Listener() {
- public void handleEvent(Event e) {
+ ctrl_brief_desc.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getMethodElement_BriefDescription());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
+ */
+ public void focusLost(FocusEvent e) {
String oldContent = contentElement.getBriefDescription();
if (((MethodElementEditor) getEditor()).mustRestoreValue(
e.widget, oldContent)) {
@@ -1607,6 +1627,11 @@
protected void addVersionSectionListeners() {
ctrl_version.addModifyListener(contentModifyListener);
ctrl_version.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getMethodUnit_Version());
+ }
+
public void focusLost(FocusEvent e) {
String oldContent = contentElement.getPresentation()
.getVersion();
@@ -1630,6 +1655,11 @@
ctrl_authors.addModifyListener(contentModifyListener);
ctrl_authors.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getMethodUnit_Authors());
+ }
+
public void focusLost(FocusEvent e) {
String oldContent = contentElement.getPresentation()
.getAuthors();
@@ -1696,6 +1726,11 @@
ctrl_change_desc.addModifyListener(contentModifyListener);
ctrl_change_desc.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getMethodUnit_ChangeDescription());
+ }
+
public void focusLost(FocusEvent e) {
String oldContent = contentElement.getPresentation()
.getChangeDescription();
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/MethodPluginDescriptionPage.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/MethodPluginDescriptionPage.java
index 8265bf0..ef320eb 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/MethodPluginDescriptionPage.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/MethodPluginDescriptionPage.java
@@ -486,9 +486,20 @@
}
}
});
+ ctrl_name.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getNamedElement_Name());
+ }
+ });
ctrl_brief_desc.addModifyListener(modifyListener);
ctrl_brief_desc.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getMethodElement_BriefDescription());
+ }
+
public void focusLost(FocusEvent e) {
String oldContent = plugin.getBriefDescription();
if (((MethodElementEditor) getEditor()).mustRestoreValue(
@@ -774,8 +785,17 @@
ctrl_version.addModifyListener(contentModifyListener);
ctrl_version.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getMethodUnit_Version());
+ }
+
public void focusLost(FocusEvent e) {
String oldContent = plugin.getVersion();
+ if (((MethodElementEditor) getEditor()).mustRestoreValue(
+ e.widget, oldContent)) {
+ return;
+ }
String newContent = StrUtil
.getPlainText(ctrl_version.getText());
if (!newContent.equals(oldContent)) {
@@ -789,8 +809,17 @@
ctrl_authors.addModifyListener(contentModifyListener);
ctrl_authors.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getMethodUnit_Authors());
+ }
+
public void focusLost(FocusEvent e) {
String oldContent = plugin.getAuthors();
+ if (((MethodElementEditor) getEditor()).mustRestoreValue(
+ e.widget, oldContent)) {
+ return;
+ }
String newContent = StrUtil
.getPlainText(ctrl_authors.getText());
if (!newContent.equals(oldContent)) {
@@ -845,6 +874,10 @@
ctrl_change_desc.addModifyListener(contentModifyListener);
ctrl_change_desc.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getMethodUnit_ChangeDescription());
+ }
public void focusLost(FocusEvent e) {
String oldContent = plugin.getChangeDescription();
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/ProcessDescription.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/ProcessDescription.java
index 51bc8ea..0314255 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/ProcessDescription.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/ProcessDescription.java
@@ -833,7 +833,13 @@
}
}
});
-
+ ctrl_name.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getNamedElement_Name());
+ }
+ });
+
ctrl_presentation_name.addModifyListener(modifyListener);
ctrl_presentation_name.addListener(SWT.Deactivate, new Listener() {
public void handleEvent(Event e) {
@@ -886,9 +892,20 @@
}
}
});
+ ctrl_presentation_name.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getDescribableElement_PresentationName());
+ }
+ });
ctrl_brief_desc.addModifyListener(modifyListener);
ctrl_brief_desc.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getMethodElement_BriefDescription());
+ }
+
public void focusLost(FocusEvent e) {
String oldContent = process.getBriefDescription();
if (((MethodElementEditor) getEditor()).mustRestoreValue(
@@ -910,6 +927,11 @@
ctrl_external_id.addModifyListener(contentModifyListener);
ctrl_external_id.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getProcessDescription_ExternalId());
+ }
+
public void focusLost(FocusEvent e) {
String oldContent = content.getExternalId();
if (((MethodElementEditor) getEditor()).mustRestoreValue(
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/WorkProductDescriptionPage.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/WorkProductDescriptionPage.java
index 675da7c..ab41f24 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/WorkProductDescriptionPage.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/forms/WorkProductDescriptionPage.java
@@ -173,6 +173,11 @@
ctrl_external_id.addModifyListener(contentModifyListener);
ctrl_external_id.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getWorkProductDescription_ExternalId());
+ }
+
public void focusLost(FocusEvent e) {
String oldContent = ((com.ibm.uma.WorkProductDescription) workProduct
.getPresentation()).getExternalId();
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/ActivityDocumentSection.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/ActivityDocumentSection.java
index b712718..6e30462 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/ActivityDocumentSection.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/ActivityDocumentSection.java
@@ -23,6 +23,7 @@
import com.ibm.uma.Activity;
import com.ibm.uma.ActivityDescription;
+import com.ibm.uma.BreakdownElement;
import com.ibm.uma.UmaPackage;
/**
@@ -207,10 +208,24 @@
protected void addListeners() {
super.addListeners();
-
+
+ BreakdownElement element = getElement();
+
+ purposeText.setModalObject(element);
+ purposeText.setModalObjectFeature(UmaPackage.eINSTANCE
+ .getActivityDescription_Purpose());
purposeText.addListener(SWT.Deactivate, purposeListener);
+
+ mainDescText.setModalObject(element);
+ mainDescText.setModalObjectFeature(UmaPackage.eINSTANCE.getContentDescription_MainDescription());
mainDescText.addListener(SWT.Deactivate, mainDescListener);
+
+ alternativesText.setModalObject(element);
+ alternativesText.setModalObjectFeature(UmaPackage.eINSTANCE.getActivityDescription_Alternatives());
alternativesText.addListener(SWT.Deactivate, alternativesListener);
+
+ howToStaffText.setModalObject(element);
+ howToStaffText.setModalObjectFeature(UmaPackage.eINSTANCE.getActivityDescription_HowtoStaff());
howToStaffText.addListener(SWT.Deactivate, howToStaffListener);
}
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/BreakdownElementDocumentSection.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/BreakdownElementDocumentSection.java
index 4470c13..641b62a 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/BreakdownElementDocumentSection.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/BreakdownElementDocumentSection.java
@@ -198,6 +198,11 @@
protected void addListeners() {
prefixText.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getBreakdownElement_Prefix());
+ }
+
public void focusLost(FocusEvent e) {
element = (BreakdownElement) getElement();
String oldContent = element.getPrefix();
@@ -219,6 +224,11 @@
});
briefDescText.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getMethodElement_BriefDescription());
+ }
+
public void focusLost(FocusEvent e) {
element = (BreakdownElement) getElement();
String oldContent = element.getBriefDescription();
@@ -240,7 +250,14 @@
}
});
+ BreakdownElement element = getElement();
+
+ usageGuidance.setModalObject(element);
+ usageGuidance.setModalObjectFeature(UmaPackage.eINSTANCE.getBreakdownElementDescription_UsageGuidance());
usageGuidance.addListener(SWT.Deactivate, usageGuidanceListener);
+
+ keyConsiderations.setModalObject(element);
+ keyConsiderations.setModalObjectFeature(UmaPackage.eINSTANCE.getContentDescription_KeyConsiderations());
keyConsiderations
.addListener(SWT.Deactivate, keyConsiderationsListener);
}
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/BreakdownElementGeneralSection.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/BreakdownElementGeneralSection.java
index 5acfcaa..c9757c7 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/BreakdownElementGeneralSection.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/BreakdownElementGeneralSection.java
@@ -333,9 +333,24 @@
}
protected void addListeners() {
-
+ nameText.addListener(SWT.Activate, new Listener() {
+
+ public void handleEvent(Event event) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(event.widget,
+ UmaPackage.eINSTANCE.getNamedElement_Name());
+ }
+
+ });
nameText.addListener(SWT.Deactivate, nameDeactivateListener);
+ presentationNameText.addListener(SWT.Activate, new Listener() {
+
+ public void handleEvent(Event event) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(event.widget,
+ UmaPackage.eINSTANCE.getDescribableElement_PresentationName());
+ }
+
+ });
presentationNameText.addListener(SWT.Deactivate, presentationNameDeactivateListener);
multipleButton.addSelectionListener(new SelectionListener() {
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/DescriptorDocumentSection.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/DescriptorDocumentSection.java
index 40c3723..6baf1f6 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/DescriptorDocumentSection.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/DescriptorDocumentSection.java
@@ -91,6 +91,9 @@
protected void addListeners() {
super.addListeners();
+ refinedDesc.setModalObject(getElement());
+ refinedDesc.setModalObjectFeature(UmaPackage.eINSTANCE
+ .getDescriptorDescription_RefinedDescription());
refinedDesc.addListener(SWT.Deactivate, listener);
}
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/MilestoneDocumentSection.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/MilestoneDocumentSection.java
index 838567f..54cf8c9 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/MilestoneDocumentSection.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/MilestoneDocumentSection.java
@@ -92,6 +92,9 @@
protected void addListeners() {
super.addListeners();
+ mainDesc.setModalObject(getElement());
+ mainDesc.setModalObjectFeature(UmaPackage.eINSTANCE
+ .getContentDescription_MainDescription());
mainDesc.addListener(SWT.Deactivate, listener);
}
diff --git a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/WorkProductDescriptorGeneralSection.java b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/WorkProductDescriptorGeneralSection.java
index 20225d2..512adb5 100755
--- a/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/WorkProductDescriptorGeneralSection.java
+++ b/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/properties/WorkProductDescriptorGeneralSection.java
@@ -259,6 +259,11 @@
super.addListeners();
activityEntryState.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getWorkProductDescriptor_ActivityEntryState());
+ }
+
public void focusLost(FocusEvent e) {
WorkProductDescriptor element = (WorkProductDescriptor) getElement();
String oldContent = element.getActivityEntryState();
@@ -284,6 +289,11 @@
});
activityExitState.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ ((MethodElementEditor) getEditor()).setCurrentFeatureEditor(e.widget,
+ UmaPackage.eINSTANCE.getWorkProductDescriptor_ActivityExitState());
+ }
+
public void focusLost(FocusEvent e) {
WorkProductDescriptor element = (WorkProductDescriptor) getElement();
String oldContent = element.getActivityExitState();
diff --git a/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/FileManager.java b/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/FileManager.java
index d8a5f41..f8d48af 100755
--- a/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/FileManager.java
+++ b/plugins/org.eclipse.epf.library.persistence/src/org/eclipse/epf/persistence/FileManager.java
@@ -64,15 +64,19 @@
private FileManager() {
}
- private static boolean refresh(String oldPath) throws CoreException {
+ public static IResource getResourceForLocation(String location) {
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
- IPath path = new Path(oldPath);
+ IPath path = new Path(location);
IResource resource;
- if (new File(oldPath).isFile()) {
+ if (new File(location).isFile()) {
resource = workspaceRoot.getFileForLocation(path);
} else {
resource = workspaceRoot.getContainerForLocation(path);
}
+ return resource;
+ }
+
+ public static boolean refresh(IResource resource) throws CoreException {
if (!resource.exists()) {
ArrayList foldersToRefresh = new ArrayList();
IContainer container;
@@ -99,6 +103,14 @@
return true;
}
+ private static boolean refresh(String oldPath) throws CoreException {
+ IResource resource = getResourceForLocation(oldPath);
+ if(resource != null) {
+ return refresh(resource);
+ }
+ return false;
+ }
+
public boolean move(String oldPath, String newPath) {
return move(oldPath, newPath, false);
}
@@ -260,11 +272,50 @@
if (!validateEditInitialized) {
status = workspace.validateEdit(files, context);
validateEditInitialized = true;
+ if(status.isOK()) {
+ // double-check after initialization
+ //
+ status = workspace.validateEdit(files, context);
+ }
}
-
- status = workspace.validateEdit(files, context);
-
- if (!status.isOK()) {
+ else {
+ status = workspace.validateEdit(files, context);
+ }
+
+ if(status.isOK()) {
+ // some version control provider still returns OK status even though user cancelled the check out
+ // double-check here again to make sure the file is not read-only
+ //
+ ArrayList readOnlyFiles = new ArrayList();
+ for(int i = 0; i < files.length; i++) {
+ IFile file = files[i];
+ try {
+ file.refreshLocal(IResource.DEPTH_ZERO, null);
+ } catch (CoreException e) {
+ CommonPlugin.INSTANCE.log(e);
+ }
+ if(file.isReadOnly()) {
+ readOnlyFiles.add(file);
+ }
+ }
+ if(!readOnlyFiles.isEmpty()) {
+ MultiStatus multiStatus = new MultiStatus(PLUGIN_ID, IStatus.OK, PersistenceResources
+ .getString("Persistence.modifyFilesError.msg"), null); //$NON-NLS-1$
+ for (Iterator iter = readOnlyFiles.iterator(); iter.hasNext();) {
+ IFile file = (IFile) iter.next();
+ String localPath = file.getLocation().toOSString();
+ String msg = MessageFormat
+ .format(
+ PersistenceResources
+ .getString("Persistence.FileManager.fileReadOnly"), new Object[] { localPath }); //$NON-NLS-1$
+ multiStatus.add(new ResourceStatus(IStatus.ERROR, 0,
+ file.getFullPath(), msg, null));
+ }
+ status = multiStatus;
+ return status;
+ }
+ }
+ else {
// hack for clearcase
if (fromCC(status)) {
String msg = PersistenceResources