Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2012-12-06 08:34:31 -0500
committerTobias Schwarz2012-12-06 08:34:31 -0500
commit926a368aaba058deebb468fe7bd6b921fafb5dec (patch)
treef541804acbe3924031aaa63cfe6ef2f956c670c6
parent630f12baedc116c343402c87a25e64af04b62c42 (diff)
downloadorg.eclipse.tcf-926a368aaba058deebb468fe7bd6b921fafb5dec.tar.gz
org.eclipse.tcf-926a368aaba058deebb468fe7bd6b921fafb5dec.tar.xz
org.eclipse.tcf-926a368aaba058deebb468fe7bd6b921fafb5dec.zip
Target Explorer: fix flickering during validation
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java19
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java39
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractTreeSection.java19
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/interfaces/IValidatingContainer.java158
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractEditorPage.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/wizards/pages/AbstractValidatingWizardPage.java21
10 files changed, 247 insertions, 104 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java
index 06692981a..139f6b07a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/NewNodeWizardPage.java
@@ -283,31 +283,27 @@ public abstract class NewNodeWizardPage extends AbstractValidatingWizardPage {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.pages.AbstractValidatingWizardPage#validate()
+ * @see org.eclipse.tcf.te.ui.wizards.pages.AbstractValidatingWizardPage#doValidate()
*/
@Override
- public void validate() {
- super.validate();
- if (!isPageComplete()) return;
-
- if (isValidationInProgress()) return;
- setValidationInProgress(true);
+ protected ValidationResult doValidate() {
+ ValidationResult result = new ValidationResult();
boolean valid = true;
+
if (folderControl != null) {
valid &= folderControl.isValid();
- setMessage(folderControl.getMessage(), folderControl.getMessageType());
+ result.setResult(folderControl);
}
if (nameControl != null) {
valid &= nameControl.isValid();
- if (nameControl.getMessageType() > getMessageType()) {
- setMessage(nameControl.getMessage(), nameControl.getMessageType());
- }
+ result.setResult(nameControl);
}
- setPageComplete(valid);
- setValidationInProgress(false);
+ result.setValid(valid);
+
+ return result;
}
/*
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java
index 490326966..555d77e5d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/TargetSelectionPage.java
@@ -241,22 +241,21 @@ public class TargetSelectionPage extends AbstractValidatingWizardPage {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.pages.AbstractValidatingWizardPage#validate()
+ * @see org.eclipse.tcf.te.ui.wizards.pages.AbstractValidatingWizardPage#doValidate()
*/
@Override
- public void validate() {
- super.validate();
- if (!isPageComplete()) return;
- if (isValidationInProgress()) return;
- setValidationInProgress(true);
+ protected ValidationResult doValidate() {
+ ValidationResult result = new ValidationResult();
+
boolean valid = true;
+
ISelection selection = treeViewer.getSelection();
if (selection.isEmpty()) {
- setMessage(getDefaultDescription(), IMessageProvider.ERROR);
- valid = false;
+ result.setResult(getDefaultDescription(), IMessageProvider.ERROR);
+ result.setValid(valid);
}
- setPageComplete(valid);
- setValidationInProgress(false);
+
+ return result;
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java
index 2f4bd3e6a..ada7fd55f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java
@@ -209,4 +209,12 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
}
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage#doValidate()
+ */
+ @Override
+ protected ValidationResult doValidate() {
+ return null;
+ }
}
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 37b074e8d..c980df7bc 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
@@ -13,7 +13,6 @@ 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;
@@ -35,16 +34,14 @@ 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 {
+public class OverviewEditorPage extends AbstractCustomFormToolkitEditorPage {
// References to the page sub sections
private GeneralInformationSection infoSection;
private TransportSection transportSection;
@@ -136,52 +133,34 @@ public class OverviewEditorPage extends AbstractCustomFormToolkitEditorPage impl
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#validate()
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage#doValidate()
*/
@Override
- public void validate() {
- // Get the scrolled form
- ScrolledForm form = getManagedForm().getForm();
-
- String message = null;
- int messageType = IMessageProvider.NONE;
+ protected ValidationResult doValidate() {
+ ValidationResult result = new ValidationResult();
if (infoSection != null) {
infoSection.isValid();
- if (infoSection.getMessageType() > messageType) {
- message = infoSection.getMessage();
- messageType = infoSection.getMessageType();
- }
+ result.setResult(infoSection);
}
if (transportSection != null) {
transportSection.isValid();
- if (transportSection.getMessageType() > messageType) {
- message = transportSection.getMessage();
- messageType = transportSection.getMessageType();
- }
+ result.setResult(transportSection);
}
if (servicesSection != null) {
servicesSection.isValid();
- if (servicesSection.getMessageType() > messageType) {
- message = servicesSection.getMessage();
- messageType = servicesSection.getMessageType();
- }
+ result.setResult(servicesSection);
}
if (attributesSection != null) {
attributesSection.isValid();
- if (attributesSection.getMessageType() > messageType) {
- message = attributesSection.getMessage();
- messageType = attributesSection.getMessageType();
- }
+ result.setResult(attributesSection);
}
- // Apply the message to the form
- form.setMessage(message, messageType);
+ return result;
}
-
/* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage#postDoSave(org.eclipse.core.runtime.IProgressMonitor)
*/
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java
index c0c347c01..68b7b7e2e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/NewTargetWizardPage.java
@@ -303,46 +303,37 @@ public class NewTargetWizardPage extends AbstractValidatingWizardPage implements
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.pages.AbstractValidatingWizardPage#validate()
+ * @see org.eclipse.tcf.te.ui.wizards.pages.AbstractValidatingWizardPage#doValidate()
*/
@Override
- public void validate() {
- super.validate();
- if (!isPageComplete()) return;
-
- if (isValidationInProgress()) return;
- setValidationInProgress(true);
+ protected ValidationResult doValidate() {
+ ValidationResult result = new ValidationResult();
boolean valid = true;
if (peerIdControl != null) {
valid &= peerIdControl.isValid();
- setMessage(peerIdControl.getMessage(), peerIdControl.getMessageType());
+ result.setResult(peerIdControl);
}
if (peerNameControl != null) {
valid &= peerNameControl.isValid();
- if (peerNameControl.getMessageType() > getMessageType()) {
- setMessage(peerNameControl.getMessage(), peerNameControl.getMessageType());
- }
+ result.setResult(peerNameControl);
}
if (transportTypeControl != null) {
valid &= transportTypeControl.isValid();
- if (transportTypeControl.getMessageType() > getMessageType()) {
- setMessage(transportTypeControl.getMessage(), transportTypeControl.getMessageType());
- }
+ result.setResult(transportTypeControl);
}
if (transportTypePanelControl != null) {
valid &= transportTypePanelControl.isValid();
- if (transportTypePanelControl.getMessageType() > getMessageType()) {
- setMessage(transportTypePanelControl.getMessage(), transportTypePanelControl.getMessageType());
- }
+ result.setResult(transportTypePanelControl);
}
- setPageComplete(valid);
- setValidationInProgress(false);
+ result.setValid(valid);
+
+ return result;
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractTreeSection.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractTreeSection.java
index 5f6e8d218..b86e0eb5f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractTreeSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractTreeSection.java
@@ -14,6 +14,7 @@ import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -149,6 +150,16 @@ public abstract class AbstractTreeSection extends AbstractStructuredViewerSectio
}
/**
+ * Reveals the tree viewer instance to clients.
+ *
+ * @return The tree viewer instance or <code>null</code>.
+ */
+ public TreeViewer getViewer() {
+ StructuredViewer viewer = getTreePart().getViewer();
+ return viewer instanceof TreeViewer ? (TreeViewer)viewer : null;
+ }
+
+ /**
* Creates the tree viewer instance.
*
* @param parent The parent composite. Must not be <code>null</code>.
@@ -198,4 +209,12 @@ public abstract class AbstractTreeSection extends AbstractStructuredViewerSectio
*/
protected void initializeButtonsEnablement() {
}
+
+ /**
+ * Indicates whether the sections parent page has become the active in the editor.
+ *
+ * @param active <code>True</code> if the parent page should be visible, <code>false</code> otherwise.
+ */
+ public void setActive(boolean active) {
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/interfaces/IValidatingContainer.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/interfaces/IValidatingContainer.java
index c82912066..919801ece 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/interfaces/IValidatingContainer.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.swt/src/org/eclipse/tcf/te/ui/jface/interfaces/IValidatingContainer.java
@@ -1,26 +1,132 @@
-/*******************************************************************************
- * 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.ui.jface.interfaces;
-
-
-/**
- * Interface to be implemented by container managing the validation
- * of contained validatable sub elements.
- */
-public interface IValidatingContainer {
-
- /**
- * Validates the container status.
- * <p>
- * If necessary, set the corresponding messages and message types to signal when some sub
- * elements of the container needs user attention.
- */
- public void validate();
-}
+/*******************************************************************************
+ * 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.ui.jface.interfaces;
+
+import org.eclipse.jface.dialogs.IMessageProvider;
+
+
+/**
+ * Interface to be implemented by container managing the validation
+ * of contained validatable sub elements.
+ */
+public interface IValidatingContainer {
+
+ public static class ValidationResult implements IMessageProvider {
+
+ private String message = null;
+ private int type = -1;
+ private boolean valid = true;
+
+ /**
+ * Set the result from the given message provider.
+ * If the provider is a ValidationResult, the valid state is used too.
+ * If the provider is <code>null</code>, the message is set to <code>null</code> and the type to IMessageProvider.NONE.
+ * The new result is set or not in the same way as setResult(type,message) or setResult(valid,type,message) works.
+ * @param provider The message provider or <code>null</code>.
+ */
+ public void setResult(IMessageProvider provider) {
+ if (provider instanceof ValidationResult) {
+ setResult(provider.getMessage(), provider.getMessageType(), ((ValidationResult)provider).isValid());
+ }
+ else if (provider != null) {
+ setResult(provider.getMessage(), provider.getMessageType());
+ }
+ else {
+ setResult(null, NONE);
+ }
+ }
+
+ /**
+ * Set the message type and text,
+ * if type > actual type.
+ * @param message The message text.
+ * @param type The message type.
+ */
+ public void setResult(String message, int type) {
+ if (this.type < type) {
+ this.message = message;
+ this.type = type;
+ }
+ }
+
+ /**
+ * Set the validation result, message type and text,
+ * if type > actual type or !valid.
+ * @param message The message text.
+ * @param type The message type.
+ * @param valid The validation result.
+ */
+ public void setResult(String message, int type, boolean valid) {
+ if (this.type < type || (!valid && this.valid)) {
+ this.message = message;
+ this.type = type;
+ if (this.valid) {
+ this.valid = valid;
+ }
+ }
+ }
+
+ /**
+ * Set the message text.
+ * @param message The message text.
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ /**
+ * Set the message type.
+ * @param type The message type.
+ */
+ public void setMessageType(int type) {
+ this.type = type;
+ }
+
+ /**
+ * Set the validation result.
+ * A validation can be valid even when message and message type are set.
+ * @param valid The validation result.
+ */
+ public void setValid(boolean valid) {
+ this.valid = valid;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IMessageProvider#getMessage()
+ */
+ @Override
+ public String getMessage() {
+ return message;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType()
+ */
+ @Override
+ public int getMessageType() {
+ return type;
+ }
+
+ /**
+ * Return <code>true</code> if the result can be seen as valid.
+ */
+ public boolean isValid() {
+ return valid;
+ }
+ }
+
+ /**
+ * Validates the container status.
+ * <p>
+ * If necessary, set the corresponding messages and message types to signal when some sub
+ * elements of the container needs user attention.
+ */
+ public void validate();
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractEditorPage.java
index 39d9e4113..744cba007 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractEditorPage.java
@@ -14,24 +14,27 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.osgi.util.NLS;
import org.eclipse.tcf.te.runtime.nls.Messages;
+import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
import org.eclipse.tcf.te.ui.views.activator.UIPlugin;
import org.eclipse.tcf.te.ui.views.editor.Editor;
import org.eclipse.tcf.te.ui.views.interfaces.IEditorPage;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.part.MultiPageSelectionProvider;
/**
* Abstract details editor page implementation.
*/
-public abstract class AbstractEditorPage extends FormPage implements IEditorPage {
+public abstract class AbstractEditorPage extends FormPage implements IEditorPage, IValidatingContainer {
// The unique page id
private String id;
@@ -152,4 +155,27 @@ public abstract class AbstractEditorPage extends FormPage implements IEditorPage
public void postDoSave(IProgressMonitor monitor) {
// do nothing
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#validate()
+ */
+ @Override
+ public final void validate() {
+ // Get the scrolled form
+ ScrolledForm form = getManagedForm().getForm();
+
+ ValidationResult result = doValidate();
+ if (result != null) {
+ form.setMessage(result.getMessage(), result.getMessageType());
+ }
+ else {
+ form.setMessage(null, IMessageProvider.NONE);
+ }
+ }
+
+ /**
+ * Do the validation.
+ * @return The validation result or <code>null</code>.
+ */
+ protected abstract ValidationResult doValidate();
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java
index ae0f5061f..2518ef72b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java
@@ -506,4 +506,12 @@ public abstract class TreeViewerExplorerEditorPage extends AbstractCustomFormToo
}
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage#doValidate()
+ */
+ @Override
+ protected ValidationResult doValidate() {
+ return null;
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/wizards/pages/AbstractValidatingWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/wizards/pages/AbstractValidatingWizardPage.java
index 9d41a74f8..6fe9785a1 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/wizards/pages/AbstractValidatingWizardPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/wizards/pages/AbstractValidatingWizardPage.java
@@ -9,6 +9,7 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.wizards.pages;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
@@ -84,15 +85,25 @@ public abstract class AbstractValidatingWizardPage extends AbstractWizardPage im
* @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#validate()
*/
@Override
- public void validate() {
+ public final void validate() {
if (isValidationInProgress()) return;
- setValidationInProgress(true);
- setMessage(null);
- setErrorMessage(null);
- setPageComplete(true);
+ ValidationResult result = doValidate();
+ if (result != null) {
+ setMessage(result.getMessage(), result.getMessageType());
+ setPageComplete(result.isValid());
+ }
+ else {
+ setMessage(null, IMessageProvider.NONE);
+ setPageComplete(true);
+ }
setValidationInProgress(false);
}
+ /**
+ * Do the validation.
+ * @return The validation result or <code>null</code>.
+ */
+ protected abstract ValidationResult doValidate();
}

Back to the top