Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-08-09 09:15:06 +0000
committerUwe Stieber2012-08-09 09:15:06 +0000
commitec531d22c43aa3ecae948aa20b4defdfe4877ace (patch)
tree62b34c1a929c62d3553ac9ce27520b4b686fe0d9 /target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor
parent2c9db2f4f297f92647e3c36d8d46d5d9f7b26ae9 (diff)
downloadorg.eclipse.tcf-ec531d22c43aa3ecae948aa20b4defdfe4877ace.tar.gz
org.eclipse.tcf-ec531d22c43aa3ecae948aa20b4defdfe4877ace.tar.xz
org.eclipse.tcf-ec531d22c43aa3ecae948aa20b4defdfe4877ace.zip
Target Explorer: Unify properties editor page save handling and provide StatusHandlerUtil
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java403
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/AttributesSection.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java21
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java35
4 files changed, 239 insertions, 248 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java
index 4a511b6b0..fe81e2d30 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java
@@ -1,173 +1,230 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.ui.editor;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.ui.editor.sections.AttributesSection;
-import org.eclipse.tcf.te.tcf.ui.editor.sections.GeneralInformationSection;
-import org.eclipse.tcf.te.tcf.ui.editor.sections.ServicesSection;
-import org.eclipse.tcf.te.tcf.ui.editor.sections.TransportSection;
-import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds;
-import org.eclipse.tcf.te.tcf.ui.internal.ImageConsts;
-import org.eclipse.tcf.te.tcf.ui.nls.Messages;
-import org.eclipse.tcf.te.ui.forms.CustomFormToolkit;
-import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
-import org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-
-/**
- * Peer overview page implementation.
- */
-public class OverviewEditorPage extends AbstractCustomFormToolkitEditorPage implements IValidatingContainer {
- // References to the page sub sections
- private GeneralInformationSection infoSection;
- private TransportSection transportSection;
- private ServicesSection servicesSection;
- private AttributesSection attributesSection;
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#dispose()
- */
- @Override
- public void dispose() {
- if (infoSection != null) { infoSection.dispose(); infoSection = null; }
- if (transportSection != null) { transportSection.dispose(); transportSection = null; }
- if (servicesSection != null) { servicesSection.dispose(); servicesSection = null; }
- if (attributesSection != null) { attributesSection.dispose(); attributesSection = null; }
- super.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getContextHelpId()
- */
- @Override
- protected String getContextHelpId() {
- return IContextHelpIds.OVERVIEW_EDITOR_PAGE;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormTitle()
- */
- @Override
- protected String getFormTitle() {
- return Messages.OverviewEditorPage_title;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormImage()
- */
- @Override
- protected Image getFormImage() {
- return UIPlugin.getImage(ImageConsts.PEER);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#doCreateFormContent(org.eclipse.swt.widgets.Composite, org.eclipse.tcf.te.ui.forms.CustomFormToolkit)
- */
- @Override
- protected void doCreateFormContent(Composite parent, CustomFormToolkit toolkit) {
- Assert.isNotNull(parent);
- Assert.isNotNull(toolkit);
-
- // Setup the main panel (using the table wrap layout)
- Composite panel = toolkit.getFormToolkit().createComposite(parent);
- TableWrapLayout layout = new TableWrapLayout();
- layout.makeColumnsEqualWidth = true;
- layout.numColumns = 2;
- panel.setLayout(layout);
- panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- infoSection = new GeneralInformationSection(getManagedForm(), panel);
- infoSection.getSection().setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP));
- getManagedForm().addPart(infoSection);
-
- transportSection = new TransportSection(getManagedForm(), (Composite)infoSection.getSection().getClient());
- ((GridData)transportSection.getSection().getLayoutData()).horizontalSpan = 2;
- getManagedForm().addPart(transportSection);
-
- servicesSection = new ServicesSection(getManagedForm(), panel);
- TableWrapData layoutData = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP);
- servicesSection.getSection().setLayoutData(layoutData);
- getManagedForm().addPart(servicesSection);
-
- attributesSection = new AttributesSection(getManagedForm(), panel);
- layoutData = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB);
- layoutData.colspan = 2;
- attributesSection.getSection().setLayoutData(layoutData);
- getManagedForm().addPart(attributesSection);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.forms.editor.FormPage#setActive(boolean)
- */
- @Override
- public void setActive(boolean active) {
- super.setActive(active);
- if (infoSection != null) infoSection.setActive(active);
- if (transportSection != null) transportSection.setActive(active);
- if (servicesSection != null) servicesSection.setActive(active);
- if (attributesSection != null) attributesSection.setActive(active);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#validate()
- */
- @Override
- public void validate() {
- // Get the scrolled form
- ScrolledForm form = getManagedForm().getForm();
-
- String message = null;
- int messageType = IMessageProvider.NONE;
-
- if (infoSection != null) {
- infoSection.isValid();
- if (infoSection.getMessageType() > messageType) {
- message = infoSection.getMessage();
- messageType = infoSection.getMessageType();
- }
- }
-
- if (transportSection != null) {
- transportSection.isValid();
- if (transportSection.getMessageType() > messageType) {
- message = transportSection.getMessage();
- messageType = transportSection.getMessageType();
- }
- }
-
- if (servicesSection != null) {
- servicesSection.isValid();
- if (servicesSection.getMessageType() > messageType) {
- message = servicesSection.getMessage();
- messageType = servicesSection.getMessageType();
- }
- }
-
- if (attributesSection != null) {
- attributesSection.isValid();
- if (attributesSection.getMessageType() > messageType) {
- message = attributesSection.getMessage();
- messageType = attributesSection.getMessageType();
- }
- }
-
- // Apply the message to the form
- form.setMessage(message, messageType);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.ui.editor;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerUtil;
+import org.eclipse.tcf.te.runtime.utils.StatusHelper;
+import org.eclipse.tcf.te.tcf.locator.ScannerRunnable;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.ui.editor.sections.AttributesSection;
+import org.eclipse.tcf.te.tcf.ui.editor.sections.GeneralInformationSection;
+import org.eclipse.tcf.te.tcf.ui.editor.sections.ServicesSection;
+import org.eclipse.tcf.te.tcf.ui.editor.sections.TransportSection;
+import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds;
+import org.eclipse.tcf.te.tcf.ui.internal.ImageConsts;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.forms.CustomFormToolkit;
+import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
+import org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+/**
+ * Peer overview page implementation.
+ */
+public class OverviewEditorPage extends AbstractCustomFormToolkitEditorPage implements IValidatingContainer {
+ // References to the page sub sections
+ private GeneralInformationSection infoSection;
+ private TransportSection transportSection;
+ private ServicesSection servicesSection;
+ private AttributesSection attributesSection;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (infoSection != null) { infoSection.dispose(); infoSection = null; }
+ if (transportSection != null) { transportSection.dispose(); transportSection = null; }
+ if (servicesSection != null) { servicesSection.dispose(); servicesSection = null; }
+ if (attributesSection != null) { attributesSection.dispose(); attributesSection = null; }
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getContextHelpId()
+ */
+ @Override
+ protected String getContextHelpId() {
+ return IContextHelpIds.OVERVIEW_EDITOR_PAGE;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormTitle()
+ */
+ @Override
+ protected String getFormTitle() {
+ return Messages.OverviewEditorPage_title;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormImage()
+ */
+ @Override
+ protected Image getFormImage() {
+ return UIPlugin.getImage(ImageConsts.PEER);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#doCreateFormContent(org.eclipse.swt.widgets.Composite, org.eclipse.tcf.te.ui.forms.CustomFormToolkit)
+ */
+ @Override
+ protected void doCreateFormContent(Composite parent, CustomFormToolkit toolkit) {
+ Assert.isNotNull(parent);
+ Assert.isNotNull(toolkit);
+
+ // Setup the main panel (using the table wrap layout)
+ Composite panel = toolkit.getFormToolkit().createComposite(parent);
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.makeColumnsEqualWidth = true;
+ layout.numColumns = 2;
+ panel.setLayout(layout);
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ infoSection = new GeneralInformationSection(getManagedForm(), panel);
+ infoSection.getSection().setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP));
+ getManagedForm().addPart(infoSection);
+
+ transportSection = new TransportSection(getManagedForm(), (Composite)infoSection.getSection().getClient());
+ ((GridData)transportSection.getSection().getLayoutData()).horizontalSpan = 2;
+ getManagedForm().addPart(transportSection);
+
+ servicesSection = new ServicesSection(getManagedForm(), panel);
+ TableWrapData layoutData = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP);
+ servicesSection.getSection().setLayoutData(layoutData);
+ getManagedForm().addPart(servicesSection);
+
+ attributesSection = new AttributesSection(getManagedForm(), panel);
+ layoutData = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB);
+ layoutData.colspan = 2;
+ attributesSection.getSection().setLayoutData(layoutData);
+ getManagedForm().addPart(attributesSection);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.editor.FormPage#setActive(boolean)
+ */
+ @Override
+ public void setActive(boolean active) {
+ super.setActive(active);
+ if (infoSection != null) infoSection.setActive(active);
+ if (transportSection != null) transportSection.setActive(active);
+ if (servicesSection != null) servicesSection.setActive(active);
+ if (attributesSection != null) attributesSection.setActive(active);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#validate()
+ */
+ @Override
+ public void validate() {
+ // Get the scrolled form
+ ScrolledForm form = getManagedForm().getForm();
+
+ String message = null;
+ int messageType = IMessageProvider.NONE;
+
+ if (infoSection != null) {
+ infoSection.isValid();
+ if (infoSection.getMessageType() > messageType) {
+ message = infoSection.getMessage();
+ messageType = infoSection.getMessageType();
+ }
+ }
+
+ if (transportSection != null) {
+ transportSection.isValid();
+ if (transportSection.getMessageType() > messageType) {
+ message = transportSection.getMessage();
+ messageType = transportSection.getMessageType();
+ }
+ }
+
+ if (servicesSection != null) {
+ servicesSection.isValid();
+ if (servicesSection.getMessageType() > messageType) {
+ message = servicesSection.getMessage();
+ messageType = servicesSection.getMessageType();
+ }
+ }
+
+ if (attributesSection != null) {
+ attributesSection.isValid();
+ if (attributesSection.getMessageType() > messageType) {
+ message = attributesSection.getMessage();
+ messageType = attributesSection.getMessageType();
+ }
+ }
+
+ // Apply the message to the form
+ form.setMessage(message, messageType);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage#postDoSave(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void postDoSave(IProgressMonitor monitor) {
+ // If necessary, write the changed peer attributes
+ final Object input = getEditorInputNode();
+ if (input instanceof IPeerModel) {
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ // Get the persistence service
+ IURIPersistenceService uRIPersistenceService = ServiceManager.getInstance().getService(IURIPersistenceService.class);
+ if (uRIPersistenceService == null) {
+ throw new IOException("Persistence service instance unavailable."); //$NON-NLS-1$
+ }
+ // Save the peer node to the new persistence storage
+ uRIPersistenceService.write(((IPeerModel)input).getPeer(), null);
+ } catch (IOException e) {
+ // Build up the message template
+ String template = NLS.bind(Messages.OverviewEditorPage_error_save, ((IPeerModel)input).getName(), Messages.PossibleCause);
+ // Handle the status
+ StatusHandlerUtil.handleStatus(StatusHelper.getStatus(e), input, template, null, IContextHelpIds.MESSAGE_SAVE_FAILED, OverviewEditorPage.this, null);
+ }
+ }
+ };
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ // Trigger a change event for the original data node
+ ((IPeerModel)input).fireChangeEvent("properties", null, ((IPeerModel)input).getProperties()); //$NON-NLS-1$
+ // And make sure the editor tabs are updated
+ ((IPeerModel)input).fireChangeEvent("editor.refreshTab", Boolean.FALSE, Boolean.TRUE); //$NON-NLS-1$
+ }
+ });
+
+ // Force a scan of the peer
+ ScannerRunnable runnable2 = new ScannerRunnable(null, ((IPeerModel)input));
+ Protocol.invokeLater(runnable2);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/AttributesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/AttributesSection.java
index 2cce11655..6e89290a6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/AttributesSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/AttributesSection.java
@@ -9,7 +9,6 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.ui.editor.sections;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -25,9 +24,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.tcf.core.peers.Peer;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
@@ -321,31 +318,6 @@ public class AttributesSection extends AbstractSection {
// Extract the data into the original data node
extractData(od);
-
- // If the working copy and the original data copy differs at this point,
- // the data changed really and we have to write the peer to the persistence
- // storage.
- if (!odc.equals(wc)) {
- try {
- // Get the persistence service
- IURIPersistenceService uRIPersistenceService = ServiceManager.getInstance().getService(IURIPersistenceService.class);
- if (uRIPersistenceService == null) {
- throw new IOException("Persistence service instance unavailable."); //$NON-NLS-1$
- }
- // Save the peer node to the new persistence storage
- uRIPersistenceService.write(od.getPeer(), null);
- } catch (IOException e) {
- // Pass on to the editor page
- }
-
- Protocol.invokeLater(new Runnable() {
- @Override
- public void run() {
- // Trigger a change event for the original data node
- od.fireChangeEvent("properties", null, od.getProperties()); //$NON-NLS-1$
- }
- });
- }
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java
index 6687ce51e..630efdf39 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java
@@ -16,6 +16,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.TypedEvent;
import org.eclipse.swt.layout.GridData;
@@ -30,6 +31,8 @@ import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableNodePropert
import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerUtil;
+import org.eclipse.tcf.te.runtime.utils.StatusHelper;
import org.eclipse.tcf.te.tcf.core.peers.Peer;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
@@ -37,6 +40,7 @@ import org.eclipse.tcf.te.tcf.locator.nodes.PeerRedirector;
import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin;
import org.eclipse.tcf.te.tcf.ui.editor.controls.InfoSectionPeerIdControl;
import org.eclipse.tcf.te.tcf.ui.editor.controls.InfoSectionPeerNameControl;
+import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds;
import org.eclipse.tcf.te.tcf.ui.internal.ImageConsts;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.ui.forms.parts.AbstractSection;
@@ -351,7 +355,7 @@ public class GeneralInformationSection extends AbstractSection {
// Extract the data into the original data node
extractData(od);
- // If the name changed, trigger a save of the data
+ // If the name changed, trigger a delete of the old data
if (!oldName.equals(wc.getStringProperty(IPeer.ATTR_NAME))) {
try {
// Get the persistence service
@@ -365,19 +369,12 @@ public class GeneralInformationSection extends AbstractSection {
oldData.put(key, odc.getStringProperty(key));
}
uRIPersistenceService.delete(new Peer(oldData), null);
- // Save the peer node to the new persistence storage
- uRIPersistenceService.write(od.getPeer(), null);
} catch (IOException e) {
- // Pass on to the editor page
+ // Build up the message template
+ String template = NLS.bind(Messages.GeneralInformationSection_error_delete, oldName, Messages.PossibleCause);
+ // Handle the status
+ StatusHandlerUtil.handleStatus(StatusHelper.getStatus(e), od, template, null, IContextHelpIds.MESSAGE_DELETE_FAILED, GeneralInformationSection.this, null);
}
-
- Protocol.invokeLater(new Runnable() {
- @Override
- public void run() {
- // Trigger a change event for the original data node
- od.fireChangeEvent("properties", null, od.getProperties()); //$NON-NLS-1$
- }
- });
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java
index 2ba13b44b..ea28fad7a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java
@@ -9,7 +9,6 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.ui.editor.sections;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -27,13 +26,10 @@ import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.persistence.interfaces.IURIPersistenceService;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.tcf.core.Tcf;
import org.eclipse.tcf.te.tcf.core.interfaces.ITransportTypes;
import org.eclipse.tcf.te.tcf.core.peers.Peer;
-import org.eclipse.tcf.te.tcf.locator.ScannerRunnable;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelUpdateService;
@@ -395,37 +391,6 @@ public class TransportSection extends AbstractSection {
}
// Extract the data into the original data node
extractData(od);
-
- // If the working copy and the original data copy differs at this point,
- // the data changed really and we have to write the peer to the persistence
- // storage.
- if (!odc.equals(wc)) {
- try {
- // Get the persistence service
- IURIPersistenceService uRIPersistenceService = ServiceManager.getInstance().getService(IURIPersistenceService.class);
- if (uRIPersistenceService == null) {
- throw new IOException("Persistence service instance unavailable."); //$NON-NLS-1$
- }
- // Save the peer node to the new persistence storage
- uRIPersistenceService.write(od.getPeer(), null);
- } catch (IOException e) {
- // Pass on to the editor page
- }
-
- Protocol.invokeLater(new Runnable() {
- @Override
- public void run() {
- // Trigger a change event for the original data node
- od.fireChangeEvent("properties", null, od.getProperties()); //$NON-NLS-1$
- // And make sure the editor tabs are updated
- od.fireChangeEvent("editor.refreshTab", Boolean.FALSE, Boolean.TRUE); //$NON-NLS-1$
- }
- });
-
- // As the transport section changed, force a scan of the peer
- ScannerRunnable runnable = new ScannerRunnable(null, od);
- Protocol.invokeLater(runnable);
- }
}
/**

Back to the top