diff options
author | Eugene Tarassov | 2011-10-28 18:27:28 +0000 |
---|---|---|
committer | Eugene Tarassov | 2011-10-28 18:27:28 +0000 |
commit | 8fdb7ce7139aeda0dc3f083017772e483afdc46b (patch) | |
tree | c900fc06651e9aa24471f5baea333d5a20127cc4 | |
parent | 72227b6b32ac17c680a6c70d1695219c705e5e1a (diff) | |
parent | 654fbe2ad7404d5ac76f1dea67f4e4f72643e5d9 (diff) | |
download | org.eclipse.tcf-8fdb7ce7139aeda0dc3f083017772e483afdc46b.tar.gz org.eclipse.tcf-8fdb7ce7139aeda0dc3f083017772e483afdc46b.tar.xz org.eclipse.tcf-8fdb7ce7139aeda0dc3f083017772e483afdc46b.zip |
Merge branch 'master' of ssh://git.eclipse.org/gitroot/tcf/org.eclipse.tcf
33 files changed, 2113 insertions, 338 deletions
diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.core/META-INF/MANIFEST.MF index 0f28c078e..f44d53132 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.core/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tm.te.core/META-INF/MANIFEST.MF @@ -17,6 +17,6 @@ Export-Package: org.eclipse.tm.te.core.activator;x-internal:=true, org.eclipse.tm.te.core.connection, org.eclipse.tm.te.core.connection.interfaces, org.eclipse.tm.te.core.connection.managers, - org.eclipse.tm.te.core.model, + org.eclipse.tm.te.core.model.interfaces, org.eclipse.tm.te.core.nls;x-internal:=true, org.eclipse.tm.te.core.utils.text diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutable.java b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutable.java new file mode 100644 index 000000000..fae9c0eed --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutable.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2011 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.tm.te.core.async; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.tm.te.core.async.interfaces.IAsyncExecutable; +import org.eclipse.tm.te.runtime.callback.Callback; +import org.eclipse.tm.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tm.te.runtime.properties.PropertiesContainer; +import org.eclipse.tm.te.runtime.utils.ProgressHelper; + +/** + * Abstract asynchronous executable implementation. + */ +public abstract class AbstractAsyncExecutable extends PropertiesContainer implements IAsyncExecutable { + + private boolean cancelable = true; + + /** + * Constructor. + */ + public AbstractAsyncExecutable() { + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.core.async.interfaces.IAsyncExecutable#execute(org.eclipse.tm.te.runtime.interfaces.callback.ICallback) + */ + @Override + public final void execute(ICallback callback) { + execute(null, ProgressHelper.PROGRESS_NONE, callback); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.core.async.interfaces.IAsyncExecutable#execute(org.eclipse.core.runtime.IProgressMonitor, int, org.eclipse.tm.te.runtime.interfaces.callback.ICallback) + */ + @Override + public final void execute(IProgressMonitor progress, int ticksToUse, ICallback callback) { + progress = ProgressHelper.getProgressMonitor(progress, ticksToUse); + int jobTicks = getJobTicks(); + ProgressHelper.beginTask(progress, getTaskName(), jobTicks); + callback = new Callback(progress, ProgressHelper.PROGRESS_DONE, callback); + + internalExecute(progress, callback); + } + + protected abstract void internalExecute(IProgressMonitor monitor, ICallback callback); + + /** + * Return the ticks for this executable. + */ + protected int getJobTicks() { + return 100; + } + + /** + * Return the name of the task. + */ + protected String getTaskName() { + return ""; //$NON-NLS-1$ + } + + /** + * Return <code>true</code> if the job can be canceled. + */ + public final boolean isCancelable() { + return cancelable; + } + + /** + * Set if the job can be canceled. + * + * @param cancelable <code>true</code> if the job should be cancelable. + */ + public final void setCancelable(boolean cancelable) { + this.cancelable = cancelable; + } +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutableJob.java b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutableJob.java new file mode 100644 index 000000000..c6b2536aa --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutableJob.java @@ -0,0 +1,208 @@ +/******************************************************************************* + * Copyright (c) 2011 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.tm.te.core.async; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.IJobManager; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.tm.te.core.async.interfaces.IAsyncExecutable; +import org.eclipse.tm.te.runtime.callback.Callback; +import org.eclipse.tm.te.runtime.concurrent.util.ExecutorsUtil; +import org.eclipse.tm.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tm.te.runtime.utils.ProgressHelper; + +/** + * Abstract asynchronous executable job implementation. + */ +public abstract class AbstractAsyncExecutableJob extends Job implements IAsyncExecutable { + + /** + * Job family id to identify jobs based on {@link AbstractAsyncExecutableJob}. + * + * @see IJobManager + */ + public final String ID = "jobfamily.jobs.asynchronous"; //$NON-NLS-1$ + + private int rescheduleDelay = -1; + private boolean cancelable = true; + protected boolean finished = false; + private boolean statusHandled = false; + + private String jobFamily = null; + + private ICallback jobCallback = null; + + /** + * Constructor. + * + * @param name The job name. + * @param context The context to refresh. + * @param mode The refresh mode. + */ + protected AbstractAsyncExecutableJob(String name) { + super(name); + setPriority(Job.INTERACTIVE); + setJobFamily(ID); + } + + /** + * Set the delay if the job should be rescheduled. + * @param seconds The reschedule delay or <code>-1</code> if job should not be rescheduled. + */ + public final void setRescheduleDelay(int seconds) { + this.rescheduleDelay = seconds; + } + + /** + * Return the delay in seconds until the job should be rescheduled. + */ + public final int getRescheduleDelay() { + return rescheduleDelay; + } + + /** + * Sets if the result status should be handled by the job manager. + * @param handled <code>true</code> if the job manager should not handle the result status. + */ + protected void setStatusHandled(boolean handled) { + this.statusHandled = handled; + } + + /** + * Set if the job can be canceled. + * @param cancelable <code>true</code> if the job should be cancelable. + */ + public final void setCancelable(boolean cancelable) { + this.cancelable = cancelable; + } + + /** + * Return <code>true</code> if the job can be canceled. + */ + public final boolean isCancelable() { + return cancelable; + } + + /** + * Set the callback for the job. + * @param callback The callback. + */ + public final void setJobCallback(ICallback callback) { + this.jobCallback = callback; + } + + /** + * Return the job callback. + */ + public final ICallback getJobCallback() { + return jobCallback; + } + + /** + * Return <code>true</code> if the job is finished. + */ + public final boolean isFinished() { + return finished; + } + + /** + * Set the job family to identify a job using <code>belongsTo(Object family)</code>. + * @param jobFamily The job family or <code>null</code>. + */ + public final void setJobFamily(String jobFamily) { + this.jobFamily = jobFamily; + } + + /** + * Return the job family. + */ + public final String getJobFamily() { + return jobFamily; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object) + */ + @Override + public boolean belongsTo(Object family) { + if (family instanceof String && getJobFamily() != null && getJobFamily().startsWith(family.toString())) { + return true; + } + return super.belongsTo(family); + } + + /** + * Number of ticks the job uses to show the progress. + * + * @return The number of progress ticks. + */ + protected abstract int getJobTicks(); + + /* (non-Javadoc) + * @see org.eclipse.tm.te.core.async.interfaces.IAsyncExecutable#execute(org.eclipse.tm.te.runtime.interfaces.callback.ICallback) + */ + @Override + public final void execute(ICallback callback) { + execute(null, ProgressHelper.PROGRESS_NONE, callback); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.core.async.interfaces.IAsyncExecutable#execute(org.eclipse.core.runtime.IProgressMonitor, int, org.eclipse.tm.te.runtime.interfaces.callback.ICallback) + */ + @Override + public final void execute(IProgressMonitor progress, int ticksToUse, ICallback callback) { + finished = false; + progress = ProgressHelper.getProgressMonitor(progress, ticksToUse); + int jobTicks = getJobTicks(); + ProgressHelper.beginTask(progress, "", jobTicks); //$NON-NLS-1$ + callback = new Callback(progress, ProgressHelper.PROGRESS_DONE, callback); + if (getJobCallback() != null && getJobCallback() != callback) { + callback.addParentCallback(getJobCallback()); + } + + internalExecute(progress, new Callback(progress, ProgressHelper.PROGRESS_DONE, callback) { + @Override + protected void internalDone(Object caller, IStatus status) { + finished = true; + } + }); + } + + /** + * The job itself. + * + * @param monitor The progress monitor (never <code>null</code>). + * @param callback The callback. + */ + protected abstract void internalExecute(final IProgressMonitor monitor, final ICallback callback); + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + protected final IStatus run(final IProgressMonitor monitor) { + finished = false; + int jobTicks = getJobTicks(); + ProgressHelper.beginTask(monitor, "", jobTicks); //$NON-NLS-1$ + final Callback callback = new Callback(monitor, ProgressHelper.PROGRESS_DONE, getJobCallback()); + internalExecute(monitor, callback); + ExecutorsUtil.waitAndExecute(0, callback.getDoneConditionTester(isCancelable() ? monitor : null)); + finished = true; + + if (getRescheduleDelay() >= 0 && Platform.isRunning() && (!isCancelable() || !monitor.isCanceled())) { + schedule(getRescheduleDelay() * 1000); + } + + return statusHandled ? Status.OK_STATUS : callback.getStatus(); + } +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncExecutableStepperJob.java b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncExecutableStepperJob.java new file mode 100644 index 000000000..073fd5cd4 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncExecutableStepperJob.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2011 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.tm.te.core.async; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.tm.te.core.async.interfaces.IAsyncExecutable; +import org.eclipse.tm.te.runtime.callback.Callback; +import org.eclipse.tm.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tm.te.runtime.utils.ProgressHelper; + +/** + * Asynchronous executable stepper job. + * <p> + * The job executes a list of actions. If any action returns with an error, the whole job will be + * aborted. + */ +public class AsyncExecutableStepperJob extends AbstractAsyncExecutableJob { + private final IAsyncExecutable[] actions; + + /** + * Constructor. + * + * @param name The job name. Must not be <code>null</code> + * @param actions The actions to execute. Must not be <code>null</code>. + */ + public AsyncExecutableStepperJob(String name, IAsyncExecutable[] actions) { + super(name); + + Assert.isNotNull(actions); + this.actions = actions; + } + + /** + * Returns the actions to execute. + * + * @return The actions to execute. + */ + protected IAsyncExecutable[] getActions() { + return actions; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.core.async.AbstractAsyncExecutableJob#getJobTicks() + */ + @Override + protected int getJobTicks() { + return getActions().length * 100; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.core.async.AbstractAsyncExecutableJob#internalExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tm.te.runtime.interfaces.callback.ICallback) + */ + @Override + protected final void internalExecute(final IProgressMonitor monitor, final ICallback callback) { + if (getActions() == null || getActions().length == 0) { + callback.done(this, Status.OK_STATUS); + } + else { + ICallback stepCallback = new Callback() { + private int index = 0; + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.callback.Callback#internalDone(java.lang.Object, org.eclipse.core.runtime.IStatus) + */ + @Override + protected void internalDone(Object caller, IStatus status) { + if (!ProgressHelper.isCancelOrError(caller, status, getProgressMonitor(), null) && index < getActions().length) { + setProperty(PROPERTY_IS_DONE, false); + getActions()[index++].execute(monitor, 100, this); + } + else { + callback.done(caller, status); + } + } + }; + stepCallback.done(this, Status.OK_STATUS); + } + } +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/interfaces/IAsyncExecutable.java b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/interfaces/IAsyncExecutable.java new file mode 100644 index 000000000..57c84be6b --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/interfaces/IAsyncExecutable.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2011 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.tm.te.core.async.interfaces; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.tm.te.runtime.interfaces.callback.ICallback; + +/** + * Describes a common interface of an encapsulated executable. + * <p> + * All required steps combined to execute the action must be executed by the implementor of the + * executable. The executable itself has no UI or job control. It is only supposed to use the + * provided progress monitors to give feedback and report errors using exceptions and the callback + * mechanism. + */ +public interface IAsyncExecutable { + + /** + * Execute the necessary steps to complete the executable. + * <p> + * If the executable has been finished, the specified callback <b>must</b> be called! + * + * @param callback The callback to invoke or <code>null</code> + */ + public void execute(ICallback callback); + + /** + * Execute the necessary steps to complete the executable. + * <p> + * User feedback can be provided through the specified progress monitor, if not <code>null</code>. + * <p> + * If the executable has been finished, the specified callback <b>must</b> be called! + * + * @param progress The progress monitor or <code>null</code>. + * @param ticksToUse The ticks to use from the progress monitor. + * @param callback The callback to invoke or <code>null</code> + */ + public void execute(IProgressMonitor progress, int ticksToUse, ICallback callback); +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/connection/interfaces/IConnectStrategy.java b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/connection/interfaces/IConnectStrategy.java index 4af03b653..0433ff7aa 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/connection/interfaces/IConnectStrategy.java +++ b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/connection/interfaces/IConnectStrategy.java @@ -10,7 +10,7 @@ package org.eclipse.tm.te.core.connection.interfaces; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.tm.te.core.model.IConnectable; +import org.eclipse.tm.te.core.model.interfaces.IConnectable; import org.eclipse.tm.te.runtime.interfaces.callback.ICallback; import org.eclipse.tm.te.runtime.interfaces.extensions.IExecutableExtension; diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/model/IConnectable.java b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/model/interfaces/IConnectable.java index 8e30d75d7..1051d0f7e 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/model/IConnectable.java +++ b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/model/interfaces/IConnectable.java @@ -8,7 +8,7 @@ * of this software may be licensed only pursuant to the terms * of an applicable Wind River license agreement. */ -package org.eclipse.tm.te.core.model; +package org.eclipse.tm.te.core.model.interfaces; import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer; diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/META-INF/MANIFEST.MF index 0bfe08225..962ff8d5e 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/META-INF/MANIFEST.MF @@ -31,7 +31,7 @@ Export-Package: org.eclipse.tm.te.tcf.ui.activator;x-internal:=true, org.eclipse.tm.te.tcf.ui.internal.model;x-internal:=true, org.eclipse.tm.te.tcf.ui.internal.navigator;x-internal:=true, org.eclipse.tm.te.tcf.ui.internal.navigator.images;x-internal:=true, - org.eclipse.tm.te.tcf.ui.internal.nls;x-internal:=true, - org.eclipse.tm.te.tcf.ui.internal.wizards;x-internal:=true, - org.eclipse.tm.te.tcf.ui.internal.wizards.pages;x-internal:=true, - org.eclipse.tm.te.tcf.ui.tables + org.eclipse.tm.te.tcf.ui.nls;x-internal:=true, + org.eclipse.tm.te.tcf.ui.tables, + org.eclipse.tm.te.tcf.ui.wizards;x-internal:=true, + org.eclipse.tm.te.tcf.ui.wizards.pages;x-internal:=true diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.properties index 684064aee..0fb07dd50 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.properties @@ -19,8 +19,8 @@ UnreachablePeersFilter.name=Unreachable TCF Targets NewWizards.category.name=Target Communication Framework (TCF) -NewTargetWizard.name=TCF Target -NewTargetWizard.description=Specify the attributes to connect to the TCF target. +NewTargetWizard.name=Peer +NewTargetWizard.description=Specify the attributes of the peer to connect to. # ***** Editor Pages ***** diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.xml index faf85e294..562c15aa8 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.xml @@ -55,7 +55,7 @@ </category> <wizard category="org.eclipse.tm.te.tcf.ui.newWizards.category" - class="org.eclipse.tm.te.tcf.ui.internal.wizards.NewTargetWizard" + class="org.eclipse.tm.te.tcf.ui.wizards.NewTargetWizard" icon="icons/elcl16/newTarget_wiz.gif" id="org.eclipse.tm.te.tcf.ui.wizards.NewTargetWizard" name="%NewTargetWizard.name"> diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/nls/Messages.properties deleted file mode 100644 index 938eb2e57..000000000 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/nls/Messages.properties +++ /dev/null @@ -1,28 +0,0 @@ -# -# org.eclipse.tm.te.tcf.ui -# Externalized Strings. -# - -NodePropertiesContentProvider_peerNode_sectionTitle=Peer - -NodePropertiesLabelProvider_state=Link State -NodePropertiesLabelProvider_state__1=Unknown -NodePropertiesLabelProvider_state_0=Reachable -NodePropertiesLabelProvider_state_1=Communicating -NodePropertiesLabelProvider_state_2=Not Reachable. Connection attempt timed out. -NodePropertiesLabelProvider_state_3=Not Reachable. Connection attempt failed. - -NodePropertiesLabelProvider_lastScannerError=Communication failed. Possible cause: - -NodePropertiesLabelProvider_services_local=Local Services -NodePropertiesLabelProvider_services_remote=Remote Services - -NewTargetWizard_windowTitle=New TCF Target -NewTargetWizard_error_savePeer=Failed to save peer: {0} - -NewTargetWizardPage_title=New TCF Target -NewTargetWizardPage_TransportTypeControl_label=Type: -NewTargetWizardPage_AgentHostControl_label=Host: -NewTargetWizardPage_AgentPortControl_label=Port: -NewTargetWizardPage_PeerIdControl_label=ID: -NewTargetWizardPage_PeerNameControl_label=Name: diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/wizards/pages/NewTargetWizardPage.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/wizards/pages/NewTargetWizardPage.java deleted file mode 100644 index 138bc4eed..000000000 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/wizards/pages/NewTargetWizardPage.java +++ /dev/null @@ -1,258 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2011 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.tm.te.tcf.ui.internal.wizards.pages;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tm.tcf.protocol.IPeer;
-import org.eclipse.tm.te.tcf.ui.internal.help.IContextHelpIds;
-import org.eclipse.tm.te.tcf.ui.internal.nls.Messages;
-import org.eclipse.tm.te.ui.wizards.pages.AbstractValidatableWizardPage;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Wizard page implementation querying all information needed
- * to create the different TCF peer types.
- */
-public class NewTargetWizardPage extends AbstractValidatableWizardPage {
- private Combo transportTypeControl;
- private Text addressControl;
- private Text portControl;
- private Text peerIdControl;
- private Text peerNameControl;
-
- /**
- * Constructor.
- */
- public NewTargetWizardPage() {
- this(NewTargetWizardPage.class.getName());
- }
-
- /**
- * Constructor.
- *
- * @param pageName The page name. Must not be <code>null</code>.
- */
- public NewTargetWizardPage(String pageName) {
- super(pageName);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createControl(Composite parent) {
- // Setup title and description
- setTitle(Messages.NewTargetWizardPage_title);
-
- // Create the main panel
- Composite mainPanel = new Composite(parent, SWT.NONE);
- mainPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- mainPanel.setLayout(new GridLayout());
-
- setControl(mainPanel);
-
- // Setup the help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(mainPanel, IContextHelpIds.NEW_TARGET_WIZARD_PAGE);
-
- // Create the main panel sub controls
- createMainPanelControls(mainPanel);
-
- // Adjust the font
- Dialog.applyDialogFont(mainPanel);
- }
-
- /**
- * Creates the main panel sub controls.
- *
- * @param parent The parent main panel composite. Must not be <code>null</code>.
- */
- protected void createMainPanelControls(Composite parent) {
- Assert.isNotNull(parent);
-
- Composite panel = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0; layout.marginWidth = 0;
- panel.setLayout(layout);
- panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- // Add the controls
- Label label = new Label(panel, SWT.NONE);
- label.setText(Messages.NewTargetWizardPage_TransportTypeControl_label);
-
- transportTypeControl = new Combo(panel, SWT.READ_ONLY);
- transportTypeControl.setItems(new String[] { "TCP" }); //$NON-NLS-1$
- transportTypeControl.select(0);
- transportTypeControl.setEnabled(false);
- transportTypeControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- label = new Label(panel, SWT.NONE);
- label.setText(Messages.NewTargetWizardPage_AgentHostControl_label);
-
- addressControl = new Text(panel, SWT.SINGLE | SWT.BORDER);
- addressControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- addressControl.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- updatePeerId();
- }
- });
-
- label = new Label(panel, SWT.NONE);
- label.setText(Messages.NewTargetWizardPage_AgentPortControl_label);
-
- portControl = new Text(panel, SWT.SINGLE | SWT.BORDER);
- portControl.setText("1534"); //$NON-NLS-1$
- portControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- portControl.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- updatePeerId();
- }
- });
-
- label = new Label(panel, SWT.NONE);
- label.setText(Messages.NewTargetWizardPage_PeerIdControl_label);
-
- peerIdControl = new Text(panel, SWT.SINGLE | SWT.BORDER);
- peerIdControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- label = new Label(panel, SWT.NONE);
- label.setText(Messages.NewTargetWizardPage_PeerNameControl_label);
-
- peerNameControl = new Text(panel, SWT.SINGLE | SWT.BORDER);
- peerNameControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Restore the page history and trigger
- // an update of the peer id
- setupContent();
- }
-
- /**
- * Setup the control content.
- */
- protected void setupContent() {
- restoreWidgetValues();
- updatePeerId();
- }
-
- /**
- * Update peer id control.
- */
- protected void updatePeerId() {
- String address = addressControl.getText();
- String port = portControl.getText();
- String type = transportTypeControl.getText();
-
- if (!"".equals(address) && !"".equals(port)) { //$NON-NLS-1$ //$NON-NLS-2$
- peerIdControl.setText(type + ":" //$NON-NLS-1$
- + address + ":" //$NON-NLS-1$
- + port);
- } else {
- peerIdControl.setText(""); //$NON-NLS-1$
- }
-
- validatePage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.controls.wizards.pages.AbstractValidatableWizardPage#validatePage()
- */
- @Override
- public void validatePage() {
- super.validatePage();
- if (!isPageComplete()) return;
-
- if (isValidationInProgress()) return;
- setValidationInProgress(true);
-
- boolean valid = true;
-
- if ("".equals(addressControl.getText()) || "".equals(portControl)) { //$NON-NLS-1$ //$NON-NLS-2$
- valid = false;
- }
-
- setPageComplete(valid);
- setValidationInProgress(false);
- }
-
- /**
- * Updates the given attributes map with the current control content.
- *
- * @param peerAttributes The peer attributes map to update. Must not be <code>null</code>.
- */
- protected void updatePeerAttributes(Map<String, String> peerAttributes) {
- Assert.isNotNull(peerAttributes);
-
- peerAttributes.put(IPeer.ATTR_IP_HOST, addressControl.getText());
- peerAttributes.put(IPeer.ATTR_IP_PORT, portControl.getText());
- peerAttributes.put(IPeer.ATTR_ID, peerIdControl.getText());
- peerAttributes.put(IPeer.ATTR_NAME, peerNameControl.getText());
- peerAttributes.put(IPeer.ATTR_TRANSPORT_NAME, transportTypeControl.getText());
- }
-
- /**
- * Returns the peer attributes.
- *
- * @return The peer attributes or <code>null</code> if canceled.
- */
- public final Map<String, String> getPeerAttributes() {
- // Create a new peer attributes map
- Map<String, String> peerAttributes = new HashMap<String, String>();
- // Update with the current control content
- updatePeerAttributes(peerAttributes);
-
- return peerAttributes;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.wizards.pages.AbstractWizardPage#saveWidgetValues()
- */
- @Override
- public void saveWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- // The transport type control is not saved
- settings.put(IPeer.ATTR_IP_HOST, addressControl.getText());
- settings.put(IPeer.ATTR_IP_PORT, portControl.getText());
- settings.put(IPeer.ATTR_ID, peerIdControl.getText());
- settings.put(IPeer.ATTR_NAME, peerNameControl.getText());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.ui.wizards.pages.AbstractWizardPage#restoreWidgetValues()
- */
- @Override
- public void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- // The transport type control is not restored
- if (settings.get(IPeer.ATTR_IP_HOST) != null) addressControl.setText(settings.get(IPeer.ATTR_IP_HOST));
- if (settings.get(IPeer.ATTR_IP_PORT) != null) portControl.setText(settings.get(IPeer.ATTR_IP_PORT));
- if (settings.get(IPeer.ATTR_ID) != null) peerIdControl.setText(settings.get(IPeer.ATTR_ID));
- if (settings.get(IPeer.ATTR_NAME) != null) peerNameControl.setText(settings.get(IPeer.ATTR_NAME));
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/nls/Messages.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/nls/Messages.java index 7516bf1b0..74527f171 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/nls/Messages.java +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/nls/Messages.java @@ -7,7 +7,7 @@ * Contributors: * Wind River Systems - initial API and implementation *******************************************************************************/ -package org.eclipse.tm.te.tcf.ui.internal.nls; +package org.eclipse.tm.te.tcf.ui.nls; import java.lang.reflect.Field; @@ -19,7 +19,7 @@ import org.eclipse.osgi.util.NLS; public class Messages extends NLS { // The plug-in resource bundle name - private static final String BUNDLE_NAME = "org.eclipse.tm.te.tcf.ui.internal.nls.Messages"; //$NON-NLS-1$ + private static final String BUNDLE_NAME = "org.eclipse.tm.te.tcf.ui.nls.Messages"; //$NON-NLS-1$ /** * Static constructor. @@ -87,9 +87,32 @@ public class Messages extends NLS { public static String NewTargetWizard_error_savePeer; public static String NewTargetWizardPage_title; - public static String NewTargetWizardPage_TransportTypeControl_label; - public static String NewTargetWizardPage_AgentHostControl_label; - public static String NewTargetWizardPage_AgentPortControl_label; - public static String NewTargetWizardPage_PeerIdControl_label; - public static String NewTargetWizardPage_PeerNameControl_label; + public static String NewTargetWizardPage_description; + public static String NewTargetWizardPage_section_transportType; + public static String NewTargetWizardPage_section_attributes; + + public static String PeerIdControl_label; + public static String PeerNameControl_label; + + public static String TransportTypeControl_label; + public static String TransportTypeControl_tcpType_label; + + public static String MyRemoteHostAddressControl_label; + public static String MyRemoteHostAddressControl_information_missingTargetNameAddress; + public static String MyRemoteHostAddressControl_error_invalidTargetNameAddress; + public static String MyRemoteHostAddressControl_error_invalidTargetIpAddress; + public static String MyRemoteHostAddressControl_error_targetNameNotResolveable; + public static String MyRemoteHostAddressControl_information_checkNameAddressUserInformation; + + public static String PeerAttributesTablePart_button_new; + public static String PeerAttributesTablePart_button_edit; + public static String PeerAttributesTablePart_button_remove; + public static String PeerAttributesTablePart_column_name; + public static String PeerAttributesTablePart_column_value; + public static String PeerAttributesTablePart_add_dialogTitle; + public static String PeerAttributesTablePart_add_title; + public static String PeerAttributesTablePart_add_message; + public static String PeerAttributesTablePart_edit_dialogTitle; + public static String PeerAttributesTablePart_edit_title; + public static String PeerAttributesTablePart_edit_message; } diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/nls/Messages.properties new file mode 100644 index 000000000..791c47b44 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/nls/Messages.properties @@ -0,0 +1,51 @@ +# +# org.eclipse.tm.te.tcf.ui +# Externalized Strings. +# + +NodePropertiesContentProvider_peerNode_sectionTitle=Peer + +NodePropertiesLabelProvider_state=Link State +NodePropertiesLabelProvider_state__1=Unknown +NodePropertiesLabelProvider_state_0=Reachable +NodePropertiesLabelProvider_state_1=Communicating +NodePropertiesLabelProvider_state_2=Not Reachable. Connection attempt timed out. +NodePropertiesLabelProvider_state_3=Not Reachable. Connection attempt failed. + +NodePropertiesLabelProvider_lastScannerError=Communication failed. Possible cause: + +NodePropertiesLabelProvider_services_local=Local Services +NodePropertiesLabelProvider_services_remote=Remote Services + +NewTargetWizard_windowTitle=New Peer +NewTargetWizard_error_savePeer=Failed to save peer: {0} + +NewTargetWizardPage_title=New Peer +NewTargetWizardPage_description=Define the properties of the new peer. +NewTargetWizardPage_section_transportType=Specify the transport type and properties: +NewTargetWizardPage_section_attributes=Specify additional peer attributes: + +PeerIdControl_label=Peer ID: +PeerNameControl_label=Peer Name: + +TransportTypeControl_label=Type: +TransportTypeControl_tcpType_label=TCP + +MyRemoteHostAddressControl_label=Host: +MyRemoteHostAddressControl_information_missingTargetNameAddress=Please enter a valid peer host name or IP address. +MyRemoteHostAddressControl_error_invalidTargetNameAddress=Peer host name or IP address is not valid. +MyRemoteHostAddressControl_error_invalidTargetIpAddress=Peer host IP address is not valid. +MyRemoteHostAddressControl_error_targetNameNotResolveable=Cannot resolve the peer host name to a valid IP address. +MyRemoteHostAddressControl_information_checkNameAddressUserInformation=The peer host name can be validated by pressing the check button. + +PeerAttributesTablePart_button_new=New... +PeerAttributesTablePart_button_edit=Edit... +PeerAttributesTablePart_button_remove=Remove +PeerAttributesTablePart_column_name=Name +PeerAttributesTablePart_column_value=Value +PeerAttributesTablePart_add_dialogTitle=Add +PeerAttributesTablePart_add_title=Add Attribute +PeerAttributesTablePart_add_message=Specify the name and the value of the new peer attribute. +PeerAttributesTablePart_edit_dialogTitle=Edit +PeerAttributesTablePart_edit_title=Edit Attribute +PeerAttributesTablePart_edit_message=Edit the selected peer attribute. diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/tables/NodePropertiesContentProvider.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/tables/NodePropertiesContentProvider.java index 310dabdbd..d46baf1cf 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/tables/NodePropertiesContentProvider.java +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/tables/NodePropertiesContentProvider.java @@ -25,8 +25,8 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.tm.tcf.protocol.Protocol; import org.eclipse.tm.te.tcf.locator.interfaces.nodes.IPeerModel; import org.eclipse.tm.te.tcf.locator.interfaces.nodes.IPeerModelProperties; -import org.eclipse.tm.te.tcf.ui.internal.nls.Messages; -import org.eclipse.tm.te.ui.tables.TableNode; +import org.eclipse.tm.te.tcf.ui.nls.Messages; +import org.eclipse.tm.te.ui.tables.properties.NodePropertiesTableTableNode; import org.eclipse.ui.forms.widgets.Section; @@ -70,10 +70,10 @@ public class NodePropertiesContentProvider implements IStructuredContentProvider */ @Override public Object[] getElements(final Object inputElement) { - List<TableNode> nodes = new ArrayList<TableNode>(); + List<NodePropertiesTableTableNode> nodes = new ArrayList<NodePropertiesTableTableNode>(); if (inputElement instanceof IPeerModel) { - TableNode lastErrorNode = null; + NodePropertiesTableTableNode lastErrorNode = null; // Get all custom properties of the node final Map<String, Object> properties = new HashMap<String, Object>(); @@ -96,7 +96,7 @@ public class NodePropertiesContentProvider implements IStructuredContentProvider if (name.endsWith(".silent") || Arrays.asList(FILTERED_PROPERTIES).contains(name)) continue; //$NON-NLS-1$ // Create the properties node, if not one of the services nodes if (!IPeerModelProperties.PROP_LOCAL_SERVICES.equals(name) && !IPeerModelProperties.PROP_REMOTE_SERVICES.equals(name)) { - TableNode propertiesNode = new TableNode(name, properties.get(name) != null ? properties.get(name).toString() : ""); //$NON-NLS-1$ + NodePropertiesTableTableNode propertiesNode = new NodePropertiesTableTableNode(name, properties.get(name) != null ? properties.get(name).toString() : ""); //$NON-NLS-1$ if (!IPeerModelProperties.PROP_LAST_SCANNER_ERROR.equals(name)) nodes.add(propertiesNode); else lastErrorNode = propertiesNode; } else { @@ -115,7 +115,7 @@ public class NodePropertiesContentProvider implements IStructuredContentProvider if (counter < 6) { counter++; } else { - TableNode propertiesNode = new TableNode(withName ? name : "\t", nodeValue.toString()); //$NON-NLS-1$ + NodePropertiesTableTableNode propertiesNode = new NodePropertiesTableTableNode(withName ? name : "\t", nodeValue.toString()); //$NON-NLS-1$ nodes.add(propertiesNode); if (withName) withName = false; counter = 1; @@ -127,14 +127,14 @@ public class NodePropertiesContentProvider implements IStructuredContentProvider String value = nodeValue.toString(); if (value.endsWith(", ")) value = value.substring(0, value.length() - 2); //$NON-NLS-1$ if (value.trim().length() > 0) { - TableNode propertiesNode = new TableNode(withName ? name : "\t", value); //$NON-NLS-1$ + NodePropertiesTableTableNode propertiesNode = new NodePropertiesTableTableNode(withName ? name : "\t", value); //$NON-NLS-1$ nodes.add(propertiesNode); } } } else { // Less than 6 service names listed -> generate a single node - TableNode propertiesNode = new TableNode(name, services); + NodePropertiesTableTableNode propertiesNode = new NodePropertiesTableTableNode(name, services); nodes.add(propertiesNode); } } @@ -142,13 +142,13 @@ public class NodePropertiesContentProvider implements IStructuredContentProvider if (lastErrorNode != null) { // Add an empty line before the error - TableNode propertiesNode = new TableNode("", ""); //$NON-NLS-1$ //$NON-NLS-2$ + NodePropertiesTableTableNode propertiesNode = new NodePropertiesTableTableNode("", ""); //$NON-NLS-1$ //$NON-NLS-2$ nodes.add(propertiesNode); nodes.add(lastErrorNode); } } - return nodes.toArray(new TableNode[nodes.size()]); + return nodes.toArray(new NodePropertiesTableTableNode[nodes.size()]); } /* (non-Javadoc) diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/tables/NodePropertiesLabelProvider.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/tables/NodePropertiesLabelProvider.java index 7a82041e2..29702845e 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/tables/NodePropertiesLabelProvider.java +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/tables/NodePropertiesLabelProvider.java @@ -18,8 +18,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; import org.eclipse.tm.te.tcf.locator.interfaces.nodes.IPeerModelProperties; -import org.eclipse.tm.te.tcf.ui.internal.nls.Messages; -import org.eclipse.tm.te.ui.tables.TableNode; +import org.eclipse.tm.te.tcf.ui.nls.Messages; +import org.eclipse.tm.te.ui.tables.properties.NodePropertiesTableTableNode; /** @@ -57,13 +57,13 @@ public class NodePropertiesLabelProvider extends LabelProvider implements ITable String label = null; - if (element instanceof TableNode) { + if (element instanceof NodePropertiesTableTableNode) { switch (columnIndex) { case 0: - label = ((TableNode)element).name; + label = ((NodePropertiesTableTableNode)element).name; break; case 1: - label = ((TableNode)element).value; + label = ((NodePropertiesTableTableNode)element).value; break; } @@ -76,7 +76,7 @@ public class NodePropertiesLabelProvider extends LabelProvider implements ITable label = Messages.NodePropertiesLabelProvider_services_local; } else if (IPeerModelProperties.PROP_REMOTE_SERVICES.equals(label)) { label = Messages.NodePropertiesLabelProvider_services_remote; - } else if (columnIndex == 1 && IPeerModelProperties.PROP_STATE.equals(((TableNode)element).name)) { + } else if (columnIndex == 1 && IPeerModelProperties.PROP_STATE.equals(((NodePropertiesTableTableNode)element).name)) { label = Messages.getString("NodePropertiesLabelProvider_state_" + label.replace('-', '_')); //$NON-NLS-1$ } } @@ -98,7 +98,7 @@ public class NodePropertiesLabelProvider extends LabelProvider implements ITable */ @Override public Color getForeground(Object element, int columnIndex) { - if (element instanceof TableNode && IPeerModelProperties.PROP_LAST_SCANNER_ERROR.equals(((TableNode)element).name)) { + if (element instanceof NodePropertiesTableTableNode && IPeerModelProperties.PROP_LAST_SCANNER_ERROR.equals(((NodePropertiesTableTableNode)element).name)) { return getParentViewer().getControl().getDisplay().getSystemColor(SWT.COLOR_RED); } return null; diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/tables/NodePropertiesViewerComparator.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/tables/NodePropertiesViewerComparator.java index 058ac8524..91194f289 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/tables/NodePropertiesViewerComparator.java +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/tables/NodePropertiesViewerComparator.java @@ -11,7 +11,7 @@ package org.eclipse.tm.te.tcf.ui.tables; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.Viewer; -import org.eclipse.tm.te.tcf.ui.internal.nls.Messages; +import org.eclipse.tm.te.tcf.ui.nls.Messages; import org.eclipse.tm.te.ui.tables.TableViewerComparator; diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/wizards/NewTargetWizard.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/NewTargetWizard.java index 47ad97fda..c258da3e3 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/wizards/NewTargetWizard.java +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/NewTargetWizard.java @@ -7,7 +7,7 @@ * Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tm.te.tcf.ui.internal.wizards;
+package org.eclipse.tm.te.tcf.ui.wizards;
import java.io.IOException;
import java.util.Map;
@@ -25,8 +25,8 @@ import org.eclipse.tm.te.tcf.locator.interfaces.services.ILocatorModelLookupServ import org.eclipse.tm.te.tcf.locator.interfaces.services.ILocatorModelRefreshService;
import org.eclipse.tm.te.tcf.ui.internal.PeersPersistenceManager;
import org.eclipse.tm.te.tcf.ui.internal.model.Model;
-import org.eclipse.tm.te.tcf.ui.internal.nls.Messages;
-import org.eclipse.tm.te.tcf.ui.internal.wizards.pages.NewTargetWizardPage;
+import org.eclipse.tm.te.tcf.ui.nls.Messages;
+import org.eclipse.tm.te.tcf.ui.wizards.pages.NewTargetWizardPage;
import org.eclipse.tm.te.ui.views.ViewsUtil;
import org.eclipse.tm.te.ui.views.interfaces.IUIConstants;
import org.eclipse.tm.te.ui.wizards.AbstractWizard;
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/PeerAttributesTablePart.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/PeerAttributesTablePart.java new file mode 100644 index 000000000..168cd6902 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/PeerAttributesTablePart.java @@ -0,0 +1,381 @@ +/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.tcf.ui.wizards.controls;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tm.te.tcf.ui.nls.Messages;
+import org.eclipse.tm.te.ui.dialogs.NameValuePairDialog;
+import org.eclipse.tm.te.ui.forms.parts.TablePart;
+import org.eclipse.tm.te.ui.swt.SWTControlUtil;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.services.IDisposable;
+
+/**
+ * Peer attributes table part implementation.
+ */
+public class PeerAttributesTablePart extends TablePart implements IDisposable {
+ // The list of table nodes
+ /* default */ final List<TableNode> nodes = new ArrayList<TableNode>();
+
+ // A list of names which are banned from using
+ private String[] bannedNames;
+
+ /**
+ * Peer attributes table table node implementation.
+ */
+ protected static class TableNode extends PlatformObject {
+ /**
+ * The node name.
+ */
+ public String name = ""; //$NON-NLS-1$
+
+ /**
+ * The node value.
+ */
+ public String value = ""; //$NON-NLS-1$
+ }
+
+ /**
+ * Peer attributes table label provider implementation.
+ */
+ protected static class TableLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ String text = null;
+ if (element instanceof TableNode) {
+ switch (columnIndex) {
+ case 0:
+ text = ((TableNode)element).name;
+ break;
+ case 1:
+ text = ((TableNode)element).value;
+ break;
+ }
+ }
+ return text != null ? text : ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Constructor.
+ */
+ public PeerAttributesTablePart() {
+ super(new String[] {
+ Messages.PeerAttributesTablePart_button_new,
+ Messages.PeerAttributesTablePart_button_edit,
+ Messages.PeerAttributesTablePart_button_remove
+ });
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.services.IDisposable#dispose()
+ */
+ @Override
+ public void dispose() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.forms.parts.TablePart#configureTableViewer(org.eclipse.jface.viewers.TableViewer)
+ */
+ @Override
+ protected void configureTableViewer(final TableViewer viewer) {
+ super.configureTableViewer(viewer);
+
+ if (viewer != null && viewer.getTable() != null && !viewer.getTable().isDisposed()) {
+ Table table = viewer.getTable();
+
+ // Create the table columns
+ new TableColumn(table, SWT.NONE).setText(Messages.PeerAttributesTablePart_column_name);
+ new TableColumn(table, SWT.NONE).setText(Messages.PeerAttributesTablePart_column_value);
+
+ // Create and configure the table layout
+ TableLayout tableLayout = new TableLayout();
+ tableLayout.addColumnData(new ColumnWeightData(40, true));
+ tableLayout.addColumnData(new ColumnWeightData(60, true));
+ table.setLayout(tableLayout);
+
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ // Setup the cell editors
+ viewer.setColumnProperties(new String[] { Messages.PeerAttributesTablePart_column_name, Messages.PeerAttributesTablePart_column_value });
+
+ CellEditor[] cellEditors = new CellEditor[viewer.getColumnProperties().length];
+ cellEditors[0] = new TextCellEditor(table);
+ ((Text)cellEditors[0].getControl()).setTextLimit(250);
+ cellEditors[1] = new TextCellEditor(table);
+ ((Text)cellEditors[1].getControl()).setTextLimit(250);
+
+ viewer.setCellEditors(cellEditors);
+ viewer.setCellModifier(new ICellModifier() {
+ @Override
+ public boolean canModify(Object element, String property) {
+ return element instanceof TableNode;
+ }
+ @Override
+ public Object getValue(Object element, String property) {
+ String value = null;
+ if (element instanceof TableNode) {
+ if (Messages.PeerAttributesTablePart_column_name.equals(property)) {
+ value = ((TableNode)element).name;
+ }
+ else if (Messages.PeerAttributesTablePart_column_value.equals(property)) {
+ value = ((TableNode)element).value;
+ }
+ }
+ return value;
+ }
+ @Override
+ public void modify(Object element, String property, Object value) {
+ if (element instanceof TableItem) element = ((TableItem)element).getData();
+ if (element instanceof TableNode) {
+ if (Messages.PeerAttributesTablePart_column_name.equals(property)) {
+ ((TableNode)element).name = value != null ? value.toString() : ""; //$NON-NLS-1$
+ }
+ else if (Messages.PeerAttributesTablePart_column_value.equals(property)) {
+ ((TableNode)element).value = value != null ? value.toString() : ""; //$NON-NLS-1$
+ }
+ viewer.setInput(nodes);
+ }
+ }
+ });
+
+ // Create and set content and label provider
+ viewer.setContentProvider(new ArrayContentProvider());
+ viewer.setLabelProvider(new TableLabelProvider());
+
+ // Attach listeners
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateButtons();
+ }
+ });
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.forms.parts.AbstractPartWithButtons#createControl(org.eclipse.swt.widgets.Composite, int, int, org.eclipse.ui.forms.widgets.FormToolkit)
+ */
+ @Override
+ public void createControl(Composite parent, int style, int span, FormToolkit toolkit) {
+ super.createControl(parent, style, span, toolkit);
+ nodes.clear();
+ getTableViewer().setInput(nodes);
+ updateButtons();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.forms.parts.AbstractPartWithButtons#onButtonSelected(org.eclipse.swt.widgets.Button)
+ */
+ @Override
+ protected void onButtonSelected(Button button) {
+ Assert.isNotNull(button);
+
+ if (Messages.PeerAttributesTablePart_button_new.equals(button.getText())) {
+ onNewPressed();
+ }
+ else if (Messages.PeerAttributesTablePart_button_edit.equals(button.getText())) {
+ onEditPressed();
+ }
+ else if (Messages.PeerAttributesTablePart_button_remove.equals(button.getText())) {
+ onRemovePressed();
+ }
+ }
+
+ /**
+ * Update the button enablements.
+ */
+ protected void updateButtons() {
+ int selectionCount = getTableViewer().getTable().getSelectionCount();
+
+ SWTControlUtil.setEnabled(getButton(Messages.PeerAttributesTablePart_button_edit), selectionCount == 1);
+ SWTControlUtil.setEnabled(getButton(Messages.PeerAttributesTablePart_button_remove), selectionCount == 1);
+ }
+
+ /**
+ * Called from {@link #onButtonSelected(Button)} if "New..." got pressed.
+ */
+ protected void onNewPressed() {
+ doEditTableNode(null);
+ }
+
+ /**
+ * Called from {@link #onButtonSelected(Button)} if "Edit..." got pressed.
+ */
+ protected void onEditPressed() {
+ // Get the selection from the table
+ ISelection selection = getTableViewer().getSelection();
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ doEditTableNode((TableNode)((IStructuredSelection)selection).getFirstElement());
+ }
+ }
+
+ /**
+ * Called from {@link #onButtonSelected(Button)} if "Remove..." got pressed.
+ */
+ protected void onRemovePressed() {
+ // Get the selection from the table
+ ISelection selection = getTableViewer().getSelection();
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ TableNode node = (TableNode)((IStructuredSelection)selection).getFirstElement();
+ int index = nodes.indexOf(node);
+ nodes.remove(node);
+ getTableViewer().setInput(nodes);
+ if (index < nodes.size()) getTableViewer().setSelection(new StructuredSelection(nodes.get(index)));
+ updateButtons();
+ }
+ }
+
+ /**
+ * Opens the name/pair dialog.
+ *
+ * @param node The node to edit or <code>null</code>.
+ */
+ protected void doEditTableNode(TableNode node) {
+ // If the node is null, the dialog will be opened as "Add" dialog
+ boolean addMode = node == null;
+
+ // Determine the initial values
+ String name = node != null ? node.name : ""; //$NON-NLS-1$
+ String value = node != null ? node.value : ""; //$NON-NLS-1$
+
+ // Determine the used names
+ Set<String> usedNames = new HashSet<String>(convertList2Map(nodes).keySet());
+
+ // Add banned names to the used names list
+ if (bannedNames != null) {
+ for (String bannedName : bannedNames) {
+ usedNames.add(bannedName);
+ }
+ }
+
+ // Remove the current name
+ usedNames.remove(name);
+
+ // Determine the dialog title, the title and the default message
+ String dialogTitle = addMode ? Messages.PeerAttributesTablePart_add_dialogTitle : Messages.PeerAttributesTablePart_edit_dialogTitle;
+ String title = addMode ? Messages.PeerAttributesTablePart_add_title : Messages.PeerAttributesTablePart_edit_title;
+ String message = addMode ? Messages.PeerAttributesTablePart_add_message : Messages.PeerAttributesTablePart_edit_message;
+
+ // Construct the name/value pair dialog
+ NameValuePairDialog dialog = new NameValuePairDialog(getViewer().getControl().getShell(),
+ dialogTitle, title, message,
+ new String[] { Messages.PeerAttributesTablePart_column_name, Messages.PeerAttributesTablePart_column_value },
+ new String[] { name, value },
+ usedNames
+ );
+
+ // Open the dialog
+ if (dialog.open() == Window.OK) {
+ // If the user pressed OK, copy the data to the given node
+ // or create a new node in add mode.
+ String[] pair = dialog.getNameValuePair();
+ if (addMode) {
+ node = new TableNode();
+ nodes.add(node);
+ }
+
+ Assert.isNotNull(node);
+ node.name = pair[0];
+ node.value = pair[1];
+
+ // Refresh the view
+ getTableViewer().setInput(nodes);
+ getTableViewer().setSelection(new StructuredSelection(node));
+ }
+ }
+
+ /**
+ * Convert the given list into a map.
+ *
+ * @param list The list of table node. Must not be <code>null</code>:
+ * @return The corresponding map.
+ */
+ private static Map<String, String> convertList2Map(List<TableNode> list) {
+ Assert.isNotNull(list);
+ Map<String, String> map = new LinkedHashMap<String, String>();
+ for (TableNode node : list) {
+ map.put(node.name, node.value);
+ }
+ return map;
+ }
+
+ /**
+ * Returns the configured attributes.
+ *
+ * @return The configured attributes.
+ */
+ public Map<String, String> getAttributes() {
+ return convertList2Map(nodes);
+ }
+
+ /**
+ * Set a list of banned names.
+ *
+ * @param bannedNames The list of banned names or <code>null</code>.
+ */
+ public final void setBannedNames(String[] bannedNames) {
+ this.bannedNames = bannedNames;
+ }
+
+ /**
+ * Returns the list of banned names.
+ *
+ * @return The list of banned names or <code>null</code>.
+ */
+ public final String[] getBannedNames() {
+ return bannedNames;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/PeerIdControl.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/PeerIdControl.java new file mode 100644 index 000000000..551806c41 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/PeerIdControl.java @@ -0,0 +1,38 @@ +/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.tcf.ui.wizards.controls;
+
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.tm.te.tcf.ui.nls.Messages;
+import org.eclipse.tm.te.ui.controls.BaseEditBrowseTextControl;
+
+/**
+ * Peer id control implementation.
+ */
+public class PeerIdControl extends BaseEditBrowseTextControl {
+
+ /**
+ * Constructor.
+ *
+ * @param parentPage The parent dialog page this control is embedded in.
+ * Might be <code>null</code> if the control is not associated with a page.
+ */
+ public PeerIdControl(IDialogPage parentPage) {
+ super(parentPage);
+
+ setIsGroup(false);
+ setHasHistory(false);
+ setHideBrowseButton(true);
+ setReadOnly(true);
+ setEditFieldLabel(Messages.PeerIdControl_label);
+ setAdjustBackgroundColor(parentPage != null);
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/PeerNameControl.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/PeerNameControl.java new file mode 100644 index 000000000..1c9df762d --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/PeerNameControl.java @@ -0,0 +1,37 @@ +/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.tcf.ui.wizards.controls;
+
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.tm.te.tcf.ui.nls.Messages;
+import org.eclipse.tm.te.ui.controls.BaseEditBrowseTextControl;
+
+/**
+ * Peer name control implementation.
+ */
+public class PeerNameControl extends BaseEditBrowseTextControl {
+
+ /**
+ * Constructor.
+ *
+ * @param parentPage The parent dialog page this control is embedded in.
+ * Might be <code>null</code> if the control is not associated with a page.
+ */
+ public PeerNameControl(IDialogPage parentPage) {
+ super(parentPage);
+
+ setIsGroup(false);
+ setHasHistory(false);
+ setHideBrowseButton(true);
+ setEditFieldLabel(Messages.PeerNameControl_label);
+ setAdjustBackgroundColor(parentPage != null);
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/TcpTransportPanel.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/TcpTransportPanel.java new file mode 100644 index 000000000..1c249382c --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/TcpTransportPanel.java @@ -0,0 +1,313 @@ +/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.tcf.ui.wizards.controls;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.TypedEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tm.tcf.protocol.IPeer;
+import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tm.te.tcf.ui.nls.Messages;
+import org.eclipse.tm.te.ui.controls.BaseDialogPageControl;
+import org.eclipse.tm.te.ui.controls.net.RemoteHostAddressControl;
+import org.eclipse.tm.te.ui.controls.net.RemoteHostPortControl;
+import org.eclipse.tm.te.ui.controls.panels.AbstractWizardConfigurationPanel;
+import org.eclipse.tm.te.ui.controls.validator.NameOrIPValidator;
+import org.eclipse.tm.te.ui.controls.validator.Validator;
+import org.eclipse.tm.te.ui.wizards.interfaces.ISharedDataWizardPage;
+import org.eclipse.tm.te.ui.wizards.interfaces.IValidatableWizardPage;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * TCP transport type wizard configuration panel.
+ */
+public class TcpTransportPanel extends AbstractWizardConfigurationPanel implements ISharedDataWizardPage {
+
+ public static final String TRANSPORT_TYPE_ID = "TCP"; //$NON-NLS-1$
+
+ private RemoteHostAddressControl addressControl = null;
+ private RemoteHostPortControl portControl = null;
+
+ /**
+ * Local remote host address control implementation.
+ */
+ protected class MyRemoteHostAddressControl extends RemoteHostAddressControl {
+
+ /**
+ * Constructor.
+ *
+ * @param parentPage The parent dialog page this control is embedded in. Must not be <code>null</code>!
+ */
+ public MyRemoteHostAddressControl(IDialogPage parentPage) {
+ super(parentPage);
+ setEditFieldLabel(Messages.MyRemoteHostAddressControl_label);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.net.RemoteHostAddressControl#configureEditFieldValidator(org.eclipse.tm.te.ui.controls.validator.Validator)
+ */
+ @Override
+ protected void configureEditFieldValidator(Validator validator) {
+ if (validator instanceof NameOrIPValidator) {
+ validator.setMessageText(NameOrIPValidator.INFO_MISSING_NAME_OR_IP, Messages.MyRemoteHostAddressControl_information_missingTargetNameAddress);
+ validator.setMessageText(NameOrIPValidator.ERROR_INVALID_NAME_OR_IP, Messages.MyRemoteHostAddressControl_error_invalidTargetNameAddress);
+ validator.setMessageText(NameOrIPValidator.ERROR_INVALID_NAME, Messages.MyRemoteHostAddressControl_error_invalidTargetNameAddress);
+ validator.setMessageText(NameOrIPValidator.ERROR_INVALID_IP, Messages.MyRemoteHostAddressControl_error_invalidTargetIpAddress);
+ validator.setMessageText(NameOrIPValidator.INFO_CHECK_NAME, getUserInformationTextCheckNameAddress());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.net.RemoteHostAddressControl#getUserInformationTextCheckNameAddress()
+ */
+ @Override
+ protected String getUserInformationTextCheckNameAddress() {
+ return Messages.MyRemoteHostAddressControl_information_checkNameAddressUserInformation;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.BaseDialogPageControl#getValidatableWizardPage()
+ */
+ @Override
+ public IValidatableWizardPage getValidatableWizardPage() {
+ return TcpTransportPanel.this.getParentControl().getValidatableWizardPage();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.BaseEditBrowseTextControl#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ @Override
+ public void modifyText(ModifyEvent e) {
+ super.modifyText(e);
+ if (TcpTransportPanel.this.getParentControl() instanceof ModifyListener) {
+ ((ModifyListener)TcpTransportPanel.this.getParentControl()).modifyText(e);
+ }
+ }
+ }
+
+ /**
+ * Local remote host port control implementation.
+ */
+ protected class MyRemoteHostPortControl extends RemoteHostPortControl {
+
+ /**
+ * Constructor.
+ *
+ * @param parentPage The parent dialog page this control is embedded in. Must not be <code>null</code>!
+ */
+ public MyRemoteHostPortControl(IDialogPage parentPage) {
+ super(parentPage);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.BaseDialogPageControl#getValidatableWizardPage()
+ */
+ @Override
+ public IValidatableWizardPage getValidatableWizardPage() {
+ return TcpTransportPanel.this.getParentControl().getValidatableWizardPage();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.BaseEditBrowseTextControl#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ @Override
+ public void modifyText(ModifyEvent e) {
+ super.modifyText(e);
+ if (TcpTransportPanel.this.getParentControl() instanceof ModifyListener) {
+ ((ModifyListener)TcpTransportPanel.this.getParentControl()).modifyText(e);
+ }
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parentPageControl The parent control. Must not be <code>null</code>!
+ */
+ public TcpTransportPanel(BaseDialogPageControl parentPageControl) {
+ super(parentPageControl);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.panels.AbstractWizardConfigurationPanel#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (addressControl != null) { addressControl.dispose(); addressControl = null; }
+ if (portControl != null) { portControl.dispose(); portControl = null; }
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit)
+ */
+ @Override
+ public void setupPanel(Composite parent, FormToolkit toolkit) {
+ Assert.isNotNull(parent);
+ Assert.isNotNull(toolkit);
+
+ boolean adjustBackgroundColor = getParentControl().getParentPage() != null;
+
+ Composite panel = toolkit.createComposite(parent);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0; layout.marginWidth = 0;
+ panel.setLayout(layout);
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ if (adjustBackgroundColor) panel.setBackground(parent.getBackground());
+
+ setControl(panel);
+
+ addressControl = doCreateAddressControl(getParentControl().getParentPage());
+ addressControl.setupPanel(panel);
+
+ portControl = doCreatePortControl(getParentControl().getParentPage());
+ portControl.setParentControlIsInnerPanel(true);
+ portControl.setupPanel(addressControl.getInnerPanelComposite());
+ portControl.setEditFieldControlText("1534"); //$NON-NLS-1$
+ }
+
+ /**
+ * Creates the address control instance.
+ *
+ * @param parentPage The parent dialog page or <code>null</code>.
+ * @return The address control instance.
+ */
+ protected RemoteHostAddressControl doCreateAddressControl(IDialogPage parentPage) {
+ return new MyRemoteHostAddressControl(parentPage);
+ }
+
+ /**
+ * Creates the port control instance.
+ *
+ * @param parentPage The parent dialog page or <code>null</code>.
+ * @return The port control instance.
+ */
+ protected RemoteHostPortControl doCreatePortControl(IDialogPage parentPage) {
+ return new MyRemoteHostPortControl(parentPage);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.panels.AbstractWizardConfigurationPanel#isValid()
+ */
+ @Override
+ public boolean isValid() {
+ boolean valid = super.isValid();
+ if (!valid) return false;
+
+ valid = addressControl.isValid();
+ setMessage(addressControl.getMessage(), addressControl.getMessageType());
+
+ valid &= portControl.isValid();
+ if (portControl.getMessageType() > getMessageType()) {
+ setMessage(portControl.getMessage(), portControl.getMessageType());
+ }
+
+ return valid;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.interfaces.IWizardConfigurationPanel#dataChanged(org.eclipse.tm.te.runtime.interfaces.nodes.IPropertiesContainer, org.eclipse.swt.events.TypedEvent)
+ */
+ @Override
+ public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
+ Assert.isNotNull(data);
+
+ boolean isDirty = false;
+
+ if (addressControl != null) {
+ String address = addressControl.getEditFieldControlText();
+ if (address != null) isDirty |= !address.equals(data.getStringProperty(IPeer.ATTR_IP_HOST));
+ }
+
+ if (portControl != null) {
+ String port = portControl.getEditFieldControlText();
+ if (port != null) isDirty |= !port.equals(data.getStringProperty(IPeer.ATTR_IP_PORT));
+ }
+
+ return isDirty;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.wizards.interfaces.ISharedDataWizardPage#setupData(org.eclipse.tm.te.runtime.interfaces.nodes.IPropertiesContainer)
+ */
+ @Override
+ public void setupData(IPropertiesContainer data) {
+ if (data == null) return;
+
+ if (addressControl != null) {
+ addressControl.setEditFieldControlText(data.getStringProperty(IPeer.ATTR_IP_HOST));
+ }
+
+ if (portControl != null) {
+ portControl.setEditFieldControlText(data.getStringProperty(IPeer.ATTR_IP_PORT));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.wizards.interfaces.ISharedDataWizardPage#extractData(org.eclipse.tm.te.runtime.interfaces.nodes.IPropertiesContainer)
+ */
+ @Override
+ public void extractData(IPropertiesContainer data) {
+ if (data == null) return;
+
+ if (addressControl != null) {
+ data.setProperty(IPeer.ATTR_IP_HOST, addressControl.getEditFieldControlText());
+ }
+
+ if (portControl != null) {
+ data.setProperty(IPeer.ATTR_IP_PORT, portControl.getEditFieldControlText());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.wizards.interfaces.ISharedDataWizardPage#initializeData(org.eclipse.tm.te.runtime.interfaces.nodes.IPropertiesContainer)
+ */
+ @Override
+ public void initializeData(IPropertiesContainer data) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.wizards.interfaces.ISharedDataWizardPage#removeData(org.eclipse.tm.te.runtime.interfaces.nodes.IPropertiesContainer)
+ */
+ @Override
+ public void removeData(IPropertiesContainer data) {
+ if (data == null) return;
+ data.setProperty(IPeer.ATTR_IP_HOST, null);
+ data.setProperty(IPeer.ATTR_IP_PORT, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.panels.AbstractWizardConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
+ super.doSaveWidgetValues(settings, idPrefix);
+ if (addressControl != null) addressControl.doSaveWidgetValues(settings, idPrefix);
+ if (portControl != null) portControl.doSaveWidgetValues(settings, idPrefix);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.panels.AbstractWizardConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
+ super.doRestoreWidgetValues(settings, idPrefix);
+ if (addressControl != null) addressControl.doRestoreWidgetValues(settings, idPrefix);
+ if (portControl != null) portControl.doRestoreWidgetValues(settings, idPrefix);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/TransportTypeControl.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/TransportTypeControl.java new file mode 100644 index 000000000..65acfe28b --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/TransportTypeControl.java @@ -0,0 +1,125 @@ +/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.tcf.ui.wizards.controls;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tm.te.tcf.ui.nls.Messages;
+import org.eclipse.tm.te.ui.controls.BaseEditBrowseTextControl;
+import org.eclipse.tm.te.ui.swt.SWTControlUtil;
+
+/**
+ * Transport type control implementation.
+ */
+public class TransportTypeControl extends BaseEditBrowseTextControl {
+
+ public final static String[] TRANSPORT_TYPES = new String[] {
+ TcpTransportPanel.TRANSPORT_TYPE_ID
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param parentPage The parent dialog page this control is embedded in.
+ * Might be <code>null</code> if the control is not associated with a page.
+ */
+ public TransportTypeControl(IDialogPage parentPage) {
+ super(parentPage);
+ setIsGroup(false);
+ setReadOnly(true);
+ setHideBrowseButton(true);
+ setEditFieldLabel(Messages.TransportTypeControl_label);
+ setAdjustBackgroundColor(parentPage != null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.BaseEditBrowseTextControl#setupPanel(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void setupPanel(Composite parent) {
+ super.setupPanel(parent);
+
+ List<String> transportTypeLabels = new ArrayList<String>();
+ for (String transportType : TRANSPORT_TYPES) {
+ String label = getTransportTypeLabel(transportType);
+ if (label != null) transportTypeLabels.add(label);
+ }
+
+ setEditFieldControlHistory(transportTypeLabels.toArray(new String[transportTypeLabels.size()]));
+ SWTControlUtil.select(getEditFieldControl(), 0);
+ SWTControlUtil.setEnabled(getEditFieldControl(), transportTypeLabels.size() > 1);
+ }
+
+ /**
+ * Returns the label of the given transport type.
+ *
+ * @param transportType The transport type. Must not be <code>null</code>.
+ * @return The corresponding label or <code>null</code> if the transport type is unknown.
+ */
+ protected String getTransportTypeLabel(String transportType) {
+ Assert.isNotNull(transportType);
+
+ if (TcpTransportPanel.TRANSPORT_TYPE_ID.equals(transportType)) return Messages.TransportTypeControl_tcpType_label;
+
+ return null;
+ }
+
+ /**
+ * Returns the currently selected transport type.
+ *
+ * @return The currently selected transport type.
+ */
+ public String getSelectedTransportType() {
+ String type = getEditFieldControlText();
+
+ if (Messages.TransportTypeControl_tcpType_label.equals(type)) type = TcpTransportPanel.TRANSPORT_TYPE_ID;
+
+ return type;
+ }
+
+ /**
+ * Sets the selected transport type to the specified one.
+ *
+ * @param transportType The transport type. Must not be <code>null</code>.
+ */
+ public void setSelectedTransportType(String transportType) {
+ Assert.isNotNull(transportType);
+
+ // Get the transport type label for given transport type
+ String label = getTransportTypeLabel(transportType);
+ int index = SWTControlUtil.indexOf(getEditFieldControl(), label);
+ if (index != -1) SWTControlUtil.select(getEditFieldControl(), index);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.BaseEditBrowseTextControl#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
+ // The widget is not user editable and the history is used
+ // for presenting the available transport types. Neither save
+ // or restore the history actively.
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.BaseEditBrowseTextControl#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
+ */
+ @Override
+ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
+ // The widget is not user editable and the history is used
+ // for presenting the available transport types. Neither save
+ // or restore the history actively.
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/TransportTypePanelControl.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/TransportTypePanelControl.java new file mode 100644 index 000000000..bd3c60494 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/controls/TransportTypePanelControl.java @@ -0,0 +1,30 @@ +/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.tcf.ui.wizards.controls;
+
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.tm.te.ui.controls.BaseWizardConfigurationPanelControl;
+
+/**
+ * Transport type wizard panel control.
+ */
+public class TransportTypePanelControl extends BaseWizardConfigurationPanelControl {
+
+ /**
+ * Constructor.
+ *
+ * @param parentPage The parent dialog page this control is embedded in.
+ * Might be <code>null</code> if the control is not associated with a page.
+ */
+ public TransportTypePanelControl(IDialogPage parentPage) {
+ super(parentPage);
+ }
+
+}
\ No newline at end of file diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/pages/NewTargetWizardPage.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/pages/NewTargetWizardPage.java new file mode 100644 index 000000000..4d475c052 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/wizards/pages/NewTargetWizardPage.java @@ -0,0 +1,414 @@ +/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.tcf.ui.wizards.pages;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tm.tcf.protocol.IPeer;
+import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tm.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tm.te.tcf.ui.internal.help.IContextHelpIds;
+import org.eclipse.tm.te.tcf.ui.nls.Messages;
+import org.eclipse.tm.te.tcf.ui.wizards.controls.PeerAttributesTablePart;
+import org.eclipse.tm.te.tcf.ui.wizards.controls.PeerIdControl;
+import org.eclipse.tm.te.tcf.ui.wizards.controls.PeerNameControl;
+import org.eclipse.tm.te.tcf.ui.wizards.controls.TcpTransportPanel;
+import org.eclipse.tm.te.tcf.ui.wizards.controls.TransportTypeControl;
+import org.eclipse.tm.te.tcf.ui.wizards.controls.TransportTypePanelControl;
+import org.eclipse.tm.te.ui.controls.interfaces.IWizardConfigurationPanel;
+import org.eclipse.tm.te.ui.forms.FormLayoutFactory;
+import org.eclipse.tm.te.ui.swt.SWTControlUtil;
+import org.eclipse.tm.te.ui.wizards.interfaces.ISharedDataWizardPage;
+import org.eclipse.tm.te.ui.wizards.pages.AbstractValidatableWizardPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * Wizard page implementation querying all information needed
+ * to create the different TCF peer types.
+ */
+public class NewTargetWizardPage extends AbstractValidatableWizardPage {
+ private PeerIdControl peerIdControl;
+ private PeerNameControl peerNameControl;
+ TransportTypeControl transportTypeControl;
+ TransportTypePanelControl transportTypePanelControl;
+ private PeerAttributesTablePart tablePart;
+
+ private FormToolkit toolkit = null;
+
+ /**
+ * Local transport type control implementation.
+ */
+ private class MyTransportTypeControl extends TransportTypeControl {
+
+ /**
+ * Constructor.
+ *
+ * @param parentPage The parent dialog page this control is embedded in.
+ * Might be <code>null</code> if the control is not associated with a page.
+ */
+ public MyTransportTypeControl(IDialogPage parentPage) {
+ super(parentPage);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.BaseEditBrowseTextControl#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (transportTypePanelControl != null) {
+ transportTypePanelControl.showConfigurationPanel(getSelectedTransportType());
+ validatePage();
+ }
+ }
+ }
+
+ /**
+ * Local transport type panel control implementation.
+ */
+ private class MyTransportTypePanelControl extends TransportTypePanelControl {
+
+ /**
+ * Constructor.
+ *
+ * @param parentPage The parent dialog page this control is embedded in.
+ * Might be <code>null</code> if the control is not associated with a page.
+ */
+ public MyTransportTypePanelControl(IDialogPage parentPage) {
+ super(parentPage);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.BaseControl#isValid()
+ */
+ @Override
+ public boolean isValid() {
+ boolean valid = super.isValid();
+ if (!valid) return false;
+
+ // Get the currently selected transport type
+ if (transportTypeControl != null) {
+ String transportType = transportTypeControl.getSelectedTransportType();
+ if (transportType != null) {
+ // get the panel for the transport type and validate the panel
+ IWizardConfigurationPanel panel = getConfigurationPanel(transportType);
+
+ if (panel != null) {
+ valid = panel.isValid();
+ setMessage(panel.getMessage(), panel.getMessageType());
+ }
+ }
+ }
+
+ return valid;
+ }
+ }
+
+ /**
+ * Constructor.
+ */
+ public NewTargetWizardPage() {
+ this(NewTargetWizardPage.class.getName());
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param pageName The page name. Must not be <code>null</code>.
+ */
+ public NewTargetWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.DialogPage#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (peerIdControl != null) { peerIdControl.dispose(); peerIdControl = null; }
+ if (peerNameControl != null) { peerNameControl.dispose(); peerNameControl = null; }
+ if (transportTypeControl != null) { transportTypeControl.dispose(); transportTypeControl = null; }
+ if (transportTypePanelControl != null) { transportTypePanelControl.dispose(); transportTypePanelControl = null; }
+ if (tablePart != null) { tablePart.dispose(); tablePart = null; }
+
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ // Setup title and description
+ setTitle(Messages.NewTargetWizardPage_title);
+ setDescription(Messages.NewTargetWizardPage_description);
+
+ // Create the forms toolkit
+ toolkit = new FormToolkit(parent.getDisplay());
+
+ // Create the main panel
+ Composite mainPanel = toolkit.createComposite(parent);
+ mainPanel.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
+ mainPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ mainPanel.setBackground(parent.getBackground());
+
+ setControl(mainPanel);
+
+ // Setup the help
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(mainPanel, IContextHelpIds.NEW_TARGET_WIZARD_PAGE);
+
+ // Do not validate the page while creating the controls
+ boolean changed = setValidationInProgress(true);
+ // Create the main panel sub controls
+ createMainPanelControls(mainPanel, toolkit);
+ // Reset the validation in progress state
+ if (changed) setValidationInProgress(false);
+
+ // Adjust the font
+ Dialog.applyDialogFont(mainPanel);
+
+ // Validate the page for the first time
+ validatePage();
+ }
+
+ /**
+ * Creates the main panel sub controls.
+ *
+ * @param parent The parent main panel composite. Must not be <code>null</code>.
+ * @param toolkit The form toolkit. Must not be <code>null</code>.
+ */
+ protected void createMainPanelControls(Composite parent, FormToolkit toolkit) {
+ Assert.isNotNull(parent);
+
+ // Create the client composite
+ Composite client = toolkit.createComposite(parent);
+ client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2));
+ client.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ client.setBackground(parent.getBackground());
+
+ // Add the controls
+ peerIdControl = new PeerIdControl(this);
+ peerIdControl.setFormToolkit(toolkit);
+ peerIdControl.setParentControlIsInnerPanel(true);
+ peerIdControl.setupPanel(client);
+ peerIdControl.getEditFieldControl().setEnabled(false);
+ peerIdControl.setEditFieldControlText(UUID.randomUUID().toString());
+
+ peerNameControl = new PeerNameControl(this);
+ peerNameControl.setFormToolkit(toolkit);
+ peerNameControl.setParentControlIsInnerPanel(true);
+ peerNameControl.setupPanel(client);
+ peerNameControl.getEditFieldControl().setFocus();
+
+ createEmptySpace(client, 5, 2, toolkit);
+
+ // Create and configure the transport type section
+ Section transportTypeSection = toolkit.createSection(client, ExpandableComposite.TITLE_BAR);
+ transportTypeSection.setText(Messages.NewTargetWizardPage_section_transportType);
+ transportTypeSection.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2));
+ GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.horizontalSpan = 2;
+ transportTypeSection.setLayoutData(layoutData);
+ transportTypeSection.setBackground(client.getBackground());
+
+ Composite transportTypeClient = toolkit.createComposite(transportTypeSection);
+ transportTypeClient.setLayout(new GridLayout());
+ transportTypeClient.setBackground(transportTypeSection.getBackground());
+ transportTypeSection.setClient(transportTypeClient);
+
+ // Create the transport type control
+ transportTypeControl = new MyTransportTypeControl(this);
+ transportTypeControl.setFormToolkit(toolkit);
+ transportTypeControl.setupPanel(transportTypeClient);
+
+ // The transport type specific controls are placed into a stack
+ transportTypePanelControl = new MyTransportTypePanelControl(this);
+
+ // Create and add the panels
+ transportTypePanelControl.addConfigurationPanel(TransportTypeControl.TRANSPORT_TYPES[0], new TcpTransportPanel(transportTypePanelControl));
+
+ // Setup the panel control
+ transportTypePanelControl.setupPanel(transportTypeClient, TransportTypeControl.TRANSPORT_TYPES, toolkit);
+ layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ layoutData.horizontalSpan = 2;
+ transportTypePanelControl.getPanel().setLayoutData(layoutData);
+ toolkit.adapt(transportTypePanelControl.getPanel());
+
+ transportTypePanelControl.showConfigurationPanel(transportTypeControl.getSelectedTransportType());
+
+ // Create the advanced peer properties table
+ createPeerAttributesTableControl(client, toolkit);
+
+ // restore the widget values from the history
+ restoreWidgetValues();
+ }
+
+ /**
+ * Creates the peer attributes table controls.
+ *
+ * @param parent The parent composite. Must not be <code>null</code>.
+ * @param toolkit The form toolkit. Must not be <code>null</code>.
+ */
+ protected void createPeerAttributesTableControl(Composite parent, FormToolkit toolkit) {
+ Assert.isNotNull(parent);
+
+ createEmptySpace(parent, 5, 2, toolkit);
+
+ // Create and configure the advanced attributes section
+ Section attributesSection = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
+ attributesSection.setText(Messages.NewTargetWizardPage_section_attributes);
+ attributesSection.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2));
+ GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.horizontalSpan = 2;
+ attributesSection.setLayoutData(layoutData);
+ attributesSection.setBackground(parent.getBackground());
+
+ Composite client = toolkit.createComposite(attributesSection);
+ client.setLayout(new GridLayout(2, false));
+ client.setBackground(attributesSection.getBackground());
+ attributesSection.setClient(client);
+
+ tablePart = new PeerAttributesTablePart();
+ tablePart.setMinSize(SWTControlUtil.convertWidthInCharsToPixels(client, 20), SWTControlUtil.convertHeightInCharsToPixels(client, 6));
+ tablePart.setBannedNames(new String[] { IPeer.ATTR_ID, IPeer.ATTR_AGENT_ID, IPeer.ATTR_SERVICE_MANGER_ID, IPeer.ATTR_NAME, IPeer.ATTR_TRANSPORT_NAME, IPeer.ATTR_IP_HOST, IPeer.ATTR_IP_PORT });
+ tablePart.createControl(client, SWT.SINGLE | SWT.FULL_SELECTION, 2, toolkit);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.controls.wizards.pages.AbstractValidatableWizardPage#validatePage()
+ */
+ @Override
+ public void validatePage() {
+ super.validatePage();
+ if (!isPageComplete()) return;
+
+ if (isValidationInProgress()) return;
+ setValidationInProgress(true);
+
+ boolean valid = true;
+
+ if (peerIdControl != null) {
+ valid &= peerIdControl.isValid();
+ setMessage(peerIdControl.getMessage(), peerIdControl.getMessageType());
+ }
+
+ if (peerNameControl != null) {
+ valid &= peerNameControl.isValid();
+ if (peerNameControl.getMessageType() > getMessageType()) {
+ setMessage(peerNameControl.getMessage(), peerNameControl.getMessageType());
+ }
+ }
+
+ if (transportTypeControl != null) {
+ valid &= transportTypeControl.isValid();
+ if (transportTypeControl.getMessageType() > getMessageType()) {
+ setMessage(transportTypeControl.getMessage(), transportTypeControl.getMessageType());
+ }
+ }
+
+ if (transportTypePanelControl != null) {
+ valid &= transportTypePanelControl.isValid();
+ if (transportTypePanelControl.getMessageType() > getMessageType()) {
+ setMessage(transportTypePanelControl.getMessage(), transportTypePanelControl.getMessageType());
+ }
+ }
+
+ setPageComplete(valid);
+ setValidationInProgress(false);
+ }
+
+ /**
+ * Updates the given attributes map with the current control content.
+ *
+ * @param peerAttributes The peer attributes map to update. Must not be <code>null</code>.
+ */
+ protected void updatePeerAttributes(Map<String, String> peerAttributes) {
+ Assert.isNotNull(peerAttributes);
+
+ peerAttributes.put(IPeer.ATTR_ID, peerIdControl.getEditFieldControlText());
+
+ String value = peerNameControl.getEditFieldControlText();
+ if (value != null && !"".equals(value)) peerAttributes.put(IPeer.ATTR_NAME, value); //$NON-NLS-1$
+
+ value = transportTypeControl.getSelectedTransportType();
+ if (value != null && !"".equals(value)) peerAttributes.put(IPeer.ATTR_TRANSPORT_NAME, value); //$NON-NLS-1$
+
+ IWizardConfigurationPanel panel = transportTypePanelControl.getConfigurationPanel(value);
+ if (panel instanceof ISharedDataWizardPage) {
+ IPropertiesContainer data = new PropertiesContainer();
+ ((ISharedDataWizardPage)panel).extractData(data);
+
+ value = data.getStringProperty(IPeer.ATTR_IP_HOST);
+ if (value != null && !"".equals(value)) peerAttributes.put(IPeer.ATTR_IP_HOST, value); //$NON-NLS-1$
+ value = data.getStringProperty(IPeer.ATTR_IP_PORT);
+ if (value != null && !"".equals(value)) peerAttributes.put(IPeer.ATTR_IP_PORT, value); //$NON-NLS-1$
+ }
+
+ Map<String, String> additionalAttributes = tablePart.getAttributes();
+ if (additionalAttributes != null && !additionalAttributes.isEmpty()) {
+ peerAttributes.putAll(additionalAttributes);
+ }
+ }
+
+ /**
+ * Returns the peer attributes.
+ *
+ * @return The peer attributes or <code>null</code> if canceled.
+ */
+ public final Map<String, String> getPeerAttributes() {
+ // Create a new peer attributes map
+ Map<String, String> peerAttributes = new HashMap<String, String>();
+ // Update with the current control content
+ updatePeerAttributes(peerAttributes);
+
+ return peerAttributes;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.wizards.pages.AbstractWizardPage#saveWidgetValues()
+ */
+ @Override
+ public void saveWidgetValues() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ if (peerIdControl != null) peerIdControl.saveWidgetValues(settings, null);
+ if (peerNameControl != null) peerNameControl.saveWidgetValues(settings, null);
+ if (transportTypeControl != null) transportTypeControl.saveWidgetValues(settings, null);
+ if (transportTypePanelControl != null) transportTypePanelControl.saveWidgetValues(settings, null);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.wizards.pages.AbstractWizardPage#restoreWidgetValues()
+ */
+ @Override
+ public void restoreWidgetValues() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ if (peerIdControl != null) peerIdControl.restoreWidgetValues(settings, null);
+ if (peerNameControl != null) peerNameControl.restoreWidgetValues(settings, null);
+ if (transportTypeControl != null) transportTypeControl.restoreWidgetValues(settings, null);
+ if (transportTypePanelControl != null) transportTypePanelControl.restoreWidgetValues(settings, null);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.forms/src/org/eclipse/tm/te/ui/forms/parts/AbstractPartWithButtons.java b/target_explorer/plugins/org.eclipse.tm.te.ui.forms/src/org/eclipse/tm/te/ui/forms/parts/AbstractPartWithButtons.java index 5a2400af0..e547caaac 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui.forms/src/org/eclipse/tm/te/ui/forms/parts/AbstractPartWithButtons.java +++ b/target_explorer/plugins/org.eclipse.tm.te.ui.forms/src/org/eclipse/tm/te/ui/forms/parts/AbstractPartWithButtons.java @@ -96,6 +96,7 @@ public abstract class AbstractPartWithButtons extends AbstractPart { panel.setLayout(layout);
GridData layoutData = new GridData(SWT.BEGINNING, SWT.FILL, false, true);
panel.setLayoutData(layoutData);
+ panel.setBackground(parent.getBackground());
SelectionListener listener = new SelectionAdapter() {
@Override
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/dialogs/NameValuePairDialog.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/dialogs/NameValuePairDialog.java new file mode 100644 index 000000000..178129bf5 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/dialogs/NameValuePairDialog.java @@ -0,0 +1,206 @@ +/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.ui.dialogs;
+
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tm.te.ui.interfaces.IContextHelpIds;
+import org.eclipse.tm.te.ui.jface.dialogs.CustomTitleAreaDialog;
+import org.eclipse.tm.te.ui.nls.Messages;
+import org.eclipse.tm.te.ui.swt.SWTControlUtil;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Dialog implementation allowing to enter the data for name/value pairs.
+ */
+public class NameValuePairDialog extends CustomTitleAreaDialog {
+
+ private String name;
+ private String value;
+
+ private String dialogTitle;
+ private String title;
+ private String message;
+ private String[] fieldLabels;
+ private String[] initialValues;
+ private Set<String> usedNames;
+
+ private Text nameText;
+ private Text valueText;
+
+ /**
+ * Constructor.
+ *
+ * @param shell The parent shell or <code>null</code>.
+ * @param dialogTitle The dialog title. Must not be <code>null</code>.
+ * @param title The title. Must not be <code>null</code>.
+ * @param message The dialogs default message. Must not be <code>null</code>.
+ * @param fieldLabels The field labels. Must not be <code>null</code>.
+ * @param initialValues The field initial values. Must not be <code>null</code>.
+ * @param usedNames The list of used names. Must not be <code>null</code>.
+ */
+ public NameValuePairDialog(Shell shell, String dialogTitle, String title, String message, String[] fieldLabels, String[] initialValues, Set<String> usedNames) {
+ super(shell);
+
+ Assert.isNotNull(dialogTitle);
+ Assert.isNotNull(title);
+ Assert.isNotNull(message);
+ Assert.isNotNull(fieldLabels);
+ Assert.isNotNull(initialValues);
+ Assert.isNotNull(usedNames);
+
+ this.dialogTitle = dialogTitle;
+ this.title = title;
+ this.message = message;
+ this.fieldLabels = fieldLabels;
+ this.initialValues = initialValues;
+ this.usedNames = usedNames;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite top = (Composite)super.createDialogArea(parent);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(top, IContextHelpIds.NAME_VALUE_PAIR_DIALOG);
+
+ setDialogTitle(dialogTitle);
+ setTitle(title);
+ setDefaultMessage(message, IMessageProvider.NONE);
+
+ Composite panel = new Composite(top, SWT.NONE);
+ panel.setLayout(new GridLayout(2, false));
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ Label label = new Label(panel, SWT.NONE);
+ label.setText(fieldLabels[0]);
+
+ nameText = new Text(panel, SWT.BORDER | SWT.SINGLE);
+ nameText.setText(initialValues[0]);
+ GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.widthHint = 300;
+ nameText.setLayoutData(layoutData);
+ nameText.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ updateButtons();
+ }
+ });
+
+ label = new Label(panel, SWT.NONE);
+ label.setText(fieldLabels[1]);
+
+ valueText = new Text(panel, SWT.BORDER | SWT.SINGLE);
+ valueText.setText(initialValues[1]);
+ layoutData = new GridData(GridData.FILL_HORIZONTAL);
+ layoutData.widthHint = 300;
+ valueText.setLayoutData(layoutData);
+ valueText.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ updateButtons();
+ }
+ });
+
+ applyDialogFont(panel);
+ return panel;
+ }
+
+ /**
+ * Return the name/value pair entered in this dialog.
+ * <p>
+ * If the cancel button was hit, both will be <code>null</code>.
+ */
+ public String[] getNameValuePair() {
+ return new String[] { name, value };
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tm.te.ui.jface.dialogs.CustomTitleAreaDialog#create()
+ */
+ @Override
+ public void create() {
+ super.create();
+ updateButtons();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+ */
+ @Override
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == IDialogConstants.OK_ID) {
+ name= SWTControlUtil.getText(nameText).trim();
+ value = SWTControlUtil.getText(valueText).trim();
+ } else {
+ name = null;
+ value = null;
+ }
+ super.buttonPressed(buttonId);
+ }
+
+ /**
+ * Enable the OK button if valid input
+ */
+ protected void updateButtons() {
+ String name = SWTControlUtil.getText(nameText).trim();
+ String value = SWTControlUtil.getText(valueText).trim();
+
+ if (name.trim().length() == 0) {
+ setMessage(getErrorMissingName(), IMessageProvider.INFORMATION);
+ }
+ else if (usedNames.contains(name.trim())) {
+ setMessage(NLS.bind(getErrorUsedOrIllegalName(), name), IMessageProvider.ERROR);
+ }
+ else if (value.trim().length() == 0) {
+ setMessage(NLS.bind(getErrorMissingValue(), name), IMessageProvider.INFORMATION);
+ }
+ else {
+ setMessage(message, IMessageProvider.NONE);
+ }
+ getButton(IDialogConstants.OK_ID).setEnabled(getMessageType() == IMessageProvider.NONE);
+ }
+
+ /**
+ * Returns the text to show as missing name error.
+ */
+ protected String getErrorMissingName() {
+ return Messages.NameValuePairDialog_missingName_error;
+ }
+
+ /**
+ * Returns the text to show as used or illegal name error.
+ */
+ protected String getErrorUsedOrIllegalName() {
+ return Messages.NameValuePairDialog_usedOrIllegalName_error;
+ }
+
+ /**
+ * Returns the text to show as missing value error.
+ */
+ protected String getErrorMissingValue() {
+ return Messages.NameValuePairDialog_missingValue_error;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/dialogs/RenameDialog.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/dialogs/RenameDialog.java index 22447e6ac..55787f940 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/dialogs/RenameDialog.java +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/dialogs/RenameDialog.java @@ -1,13 +1,12 @@ -/** - * RenameDialog.java - * Created on Aug 22, 2011 - * - * Copyright (c) 2011 Wind River Systems, Inc. +/******************************************************************************* + * Copyright (c) 2011 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 * - * The right to copy, distribute, modify, or otherwise make use - * of this software may be licensed only pursuant to the terms - * of an applicable Wind River license agreement. - */ + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ package org.eclipse.tm.te.ui.dialogs; import java.util.ArrayList; diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/IContextHelpIds.java index a0fb47ba6..8fa2515b6 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/IContextHelpIds.java +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/IContextHelpIds.java @@ -25,4 +25,9 @@ public interface IContextHelpIds { * New target wizard context help id. */ public final static String NEW_TARGET_WIZARD = PREFIX + "NewTargetWizard"; //$NON-NLS-1$ + + /** + * Name/value pair dialog context help id. + */ + public final static String NAME_VALUE_PAIR_DIALOG = PREFIX + "NameValuePairDialog"; //$NON-NLS-1$ } diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.java index c7797532d..04cb5a899 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.java +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.java @@ -50,4 +50,8 @@ public class Messages extends NLS { public static String DefaultStatusHandler_error_title; public static String DefaultStatusHandler_information_title; public static String DefaultStatusHandler_toggleMessage_doNotShowAgain; + + public static String NameValuePairDialog_missingName_error; + public static String NameValuePairDialog_missingValue_error; + public static String NameValuePairDialog_usedOrIllegalName_error; } diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.properties index 952a7550e..5ddd069a3 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.properties +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.properties @@ -28,3 +28,9 @@ DefaultStatusHandler_warning_title=Warning DefaultStatusHandler_error_title=Error DefaultStatusHandler_information_title=Information DefaultStatusHandler_toggleMessage_doNotShowAgain=Do not show this dialog again. + +# ***** Dialogs ***** + +NameValuePairDialog_missingName_error=Please enter a name. +NameValuePairDialog_missingValue_error=Please enter a value for ''{0}''. +NameValuePairDialog_usedOrIllegalName_error=The name ''{0}'' is reserved or already in use. diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/tables/TableNode.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/tables/properties/NodePropertiesTableTableNode.java index 4c3a98910..e679310ac 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/tables/TableNode.java +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/tables/properties/NodePropertiesTableTableNode.java @@ -7,7 +7,7 @@ * Contributors: * Wind River Systems - initial API and implementation *******************************************************************************/ -package org.eclipse.tm.te.ui.tables; +package org.eclipse.tm.te.ui.tables.properties; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.PlatformObject; @@ -15,7 +15,7 @@ import org.eclipse.core.runtime.PlatformObject; /** * Target Explorer: Immutable representation of a table node. */ -public final class TableNode extends PlatformObject { +public final class NodePropertiesTableTableNode extends PlatformObject { /** * The node name. */ @@ -32,7 +32,7 @@ public final class TableNode extends PlatformObject { * @param name The node name. Must not be <code>null</code>. * @param value The node value. Must not be <code>null</code>. */ - public TableNode(String name, String value) { + public NodePropertiesTableTableNode(String name, String value) { Assert.isNotNull(name); Assert.isNotNull(value); diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/pages/AbstractWizardPage.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/pages/AbstractWizardPage.java index aade11395..1d2e9a053 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/pages/AbstractWizardPage.java +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/pages/AbstractWizardPage.java @@ -87,19 +87,20 @@ public abstract class AbstractWizardPage extends WizardPage { * empty space between controls.
*
* @param parent The parent composite. Must not be <code>null</code>.
+ * @param heightHint The height hint in pixel or <code>SWT.DEFAULT</code>.
* @param span The horizontal span.
* @param toolkit The form toolkit or <code>null</code>.
*
* @return
*/
- protected Label createEmptySpace(Composite parent, int span, FormToolkit toolkit) {
+ protected Label createEmptySpace(Composite parent, int heightHint, int span, FormToolkit toolkit) {
Assert.isNotNull(parent);
Label emptySpace = toolkit != null ? toolkit.createLabel(parent, null) : new Label(parent, SWT.NONE);
GridData layoutData = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
layoutData.horizontalSpan = span;
- layoutData.widthHint = 0; layoutData.heightHint = SWTControlUtil.convertHeightInCharsToPixels(emptySpace, 1);
+ layoutData.widthHint = 0; layoutData.heightHint = heightHint != SWT.DEFAULT ? heightHint : SWTControlUtil.convertHeightInCharsToPixels(emptySpace, 1);
emptySpace.setLayoutData(layoutData);
|