mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
Bug 492922 - Property test against the connection type ID
Test the connection type id instead of if the connection has a service implementing ISerialPortService to prevent the test passing for connections that it should not. Change-Id: I6201e0f479e3bda7384daa4f0159e998b4fc2d22 Signed-off-by: Jonathan Williams <jonwilliams@qnx.com>
This commit is contained in:
parent
d50e6c710e
commit
beb118fdf2
7 changed files with 30 additions and 27 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.remote.core;singleton:=true
|
||||
Bundle-Version: 2.0.0.qualifier
|
||||
Bundle-Version: 2.1.0.qualifier
|
||||
Bundle-Activator: org.eclipse.remote.internal.core.RemoteCorePlugin
|
||||
Bundle-Vendor: %pluginProvider
|
||||
Bundle-ActivationPolicy: lazy
|
||||
|
@ -15,6 +15,7 @@ Bundle-Localization: plugin
|
|||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Import-Package: org.eclipse.cdt.utils.pty,
|
||||
org.eclipse.cdt.utils.spawner,
|
||||
org.eclipse.core.expressions,
|
||||
org.eclipse.core.filesystem,
|
||||
org.eclipse.core.resources,
|
||||
org.eclipse.core.runtime,
|
||||
|
|
|
@ -77,5 +77,15 @@
|
|||
class="org.eclipse.remote.internal.core.preferences.PreferenceInitializer">
|
||||
</initializer>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.expressions.propertyTesters">
|
||||
<propertyTester
|
||||
class="org.eclipse.remote.core.RemoteConnectionPropertyTester"
|
||||
id="org.eclipse.remote.core.remoteConnectionTester"
|
||||
namespace="org.eclipse.remote.core"
|
||||
properties="isConnectionType"
|
||||
type="org.eclipse.remote.core.IRemoteConnection">
|
||||
</propertyTester>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
</parent>
|
||||
|
||||
<artifactId>org.eclipse.remote.core</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</project>
|
||||
|
|
|
@ -8,22 +8,25 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - initial contribution
|
||||
*******************************************************************************/
|
||||
package org.eclipse.remote.serial.internal.ui;
|
||||
package org.eclipse.remote.core;
|
||||
|
||||
import org.eclipse.core.expressions.PropertyTester;
|
||||
import org.eclipse.remote.core.IRemoteConnection;
|
||||
import org.eclipse.remote.serial.core.ISerialPortService;
|
||||
|
||||
public class SerialPortConnectionPropertyTester extends PropertyTester {
|
||||
/**
|
||||
* @since 2.1
|
||||
*/
|
||||
public class RemoteConnectionPropertyTester extends PropertyTester {
|
||||
|
||||
@Override
|
||||
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
|
||||
if (receiver instanceof IRemoteConnection) {
|
||||
IRemoteConnection remote = (IRemoteConnection) receiver;
|
||||
return remote.hasService(ISerialPortService.class);
|
||||
} else {
|
||||
return false;
|
||||
if (property.equals("isConnectionType")) {
|
||||
IRemoteConnection connection = (IRemoteConnection) receiver;
|
||||
if (connection.getConnectionType().getId().equals(expectedValue)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,7 @@ import org.eclipse.remote.core.IRemoteConnection;
|
|||
|
||||
public interface ISerialPortService extends IRemoteConnection.Service {
|
||||
|
||||
static final String TYPE_ID = "org.eclipse.remote.serial.core.connectionType"; //$NON-NLS-1$
|
||||
static final String CONNECTION_TYPE_ID = "org.eclipse.remote.serial.core.connectionType"; //$NON-NLS-1$
|
||||
static final String PORT_NAME_ATTR = "serial.portName"; //$NON-NLS-1$
|
||||
static final String BAUD_RATE_ATTR = "serial.baudRate"; //$NON-NLS-1$
|
||||
static final String BYTE_SIZE_ATTR = "serial.byteSize"; //$NON-NLS-1$
|
||||
|
|
|
@ -8,16 +8,6 @@
|
|||
factory="org.eclipse.remote.serial.internal.ui.SerialPortConnectionsUI$Factory"
|
||||
service="org.eclipse.remote.ui.IRemoteUIConnectionService">
|
||||
</connectionTypeService>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.expressions.propertyTesters">
|
||||
<propertyTester
|
||||
class="org.eclipse.remote.serial.internal.ui.SerialPortConnectionPropertyTester"
|
||||
id="remoteTester"
|
||||
namespace="org.eclipse.remote.serial.ui"
|
||||
properties="isSerialRemote"
|
||||
type="org.eclipse.remote.core.IRemoteConnection">
|
||||
</propertyTester>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.propertyPages">
|
||||
|
@ -29,9 +19,8 @@
|
|||
<enabledWhen>
|
||||
<adapt type="org.eclipse.remote.core.IRemoteConnection">
|
||||
<test
|
||||
forcePluginActivation="false"
|
||||
property="org.eclipse.remote.serial.ui.isSerialRemote">
|
||||
</test>
|
||||
property="org.eclipse.remote.core.isConnectionType"
|
||||
value="org.eclipse.remote.serial.core.connectionType"/>
|
||||
</adapt>
|
||||
</enabledWhen>
|
||||
</page>
|
||||
|
|
|
@ -25,8 +25,8 @@ import org.eclipse.ui.dialogs.PropertyPage;
|
|||
|
||||
public class SerialPortConnectionPropertyPage extends PropertyPage implements IWorkbenchPropertyPage {
|
||||
|
||||
private SerialPortConnectionBlock block;
|
||||
private IRemoteConnectionWorkingCopy workingCopy;
|
||||
protected SerialPortConnectionBlock block;
|
||||
protected IRemoteConnectionWorkingCopy workingCopy;
|
||||
|
||||
public SerialPortConnectionPropertyPage() {
|
||||
super();
|
||||
|
|
Loading…
Add table
Reference in a new issue