mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-28 18:53:20 +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-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.remote.core;singleton:=true
|
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-Activator: org.eclipse.remote.internal.core.RemoteCorePlugin
|
||||||
Bundle-Vendor: %pluginProvider
|
Bundle-Vendor: %pluginProvider
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
|
@ -15,6 +15,7 @@ Bundle-Localization: plugin
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Import-Package: org.eclipse.cdt.utils.pty,
|
Import-Package: org.eclipse.cdt.utils.pty,
|
||||||
org.eclipse.cdt.utils.spawner,
|
org.eclipse.cdt.utils.spawner,
|
||||||
|
org.eclipse.core.expressions,
|
||||||
org.eclipse.core.filesystem,
|
org.eclipse.core.filesystem,
|
||||||
org.eclipse.core.resources,
|
org.eclipse.core.resources,
|
||||||
org.eclipse.core.runtime,
|
org.eclipse.core.runtime,
|
||||||
|
|
|
@ -77,5 +77,15 @@
|
||||||
class="org.eclipse.remote.internal.core.preferences.PreferenceInitializer">
|
class="org.eclipse.remote.internal.core.preferences.PreferenceInitializer">
|
||||||
</initializer>
|
</initializer>
|
||||||
</extension>
|
</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>
|
</plugin>
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>org.eclipse.remote.core</artifactId>
|
<artifactId>org.eclipse.remote.core</artifactId>
|
||||||
|
<version>2.1.0-SNAPSHOT</version>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -8,22 +8,25 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - initial contribution
|
* 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.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
|
@Override
|
||||||
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
|
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
|
||||||
if (receiver instanceof IRemoteConnection) {
|
if (receiver instanceof IRemoteConnection) {
|
||||||
IRemoteConnection remote = (IRemoteConnection) receiver;
|
if (property.equals("isConnectionType")) {
|
||||||
return remote.hasService(ISerialPortService.class);
|
IRemoteConnection connection = (IRemoteConnection) receiver;
|
||||||
} else {
|
if (connection.getConnectionType().getId().equals(expectedValue)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
|
@ -15,7 +15,7 @@ import org.eclipse.remote.core.IRemoteConnection;
|
||||||
|
|
||||||
public interface ISerialPortService extends IRemoteConnection.Service {
|
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 PORT_NAME_ATTR = "serial.portName"; //$NON-NLS-1$
|
||||||
static final String BAUD_RATE_ATTR = "serial.baudRate"; //$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$
|
static final String BYTE_SIZE_ATTR = "serial.byteSize"; //$NON-NLS-1$
|
||||||
|
|
|
@ -8,16 +8,6 @@
|
||||||
factory="org.eclipse.remote.serial.internal.ui.SerialPortConnectionsUI$Factory"
|
factory="org.eclipse.remote.serial.internal.ui.SerialPortConnectionsUI$Factory"
|
||||||
service="org.eclipse.remote.ui.IRemoteUIConnectionService">
|
service="org.eclipse.remote.ui.IRemoteUIConnectionService">
|
||||||
</connectionTypeService>
|
</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>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.propertyPages">
|
point="org.eclipse.ui.propertyPages">
|
||||||
|
@ -29,9 +19,8 @@
|
||||||
<enabledWhen>
|
<enabledWhen>
|
||||||
<adapt type="org.eclipse.remote.core.IRemoteConnection">
|
<adapt type="org.eclipse.remote.core.IRemoteConnection">
|
||||||
<test
|
<test
|
||||||
forcePluginActivation="false"
|
property="org.eclipse.remote.core.isConnectionType"
|
||||||
property="org.eclipse.remote.serial.ui.isSerialRemote">
|
value="org.eclipse.remote.serial.core.connectionType"/>
|
||||||
</test>
|
|
||||||
</adapt>
|
</adapt>
|
||||||
</enabledWhen>
|
</enabledWhen>
|
||||||
</page>
|
</page>
|
||||||
|
|
|
@ -25,8 +25,8 @@ import org.eclipse.ui.dialogs.PropertyPage;
|
||||||
|
|
||||||
public class SerialPortConnectionPropertyPage extends PropertyPage implements IWorkbenchPropertyPage {
|
public class SerialPortConnectionPropertyPage extends PropertyPage implements IWorkbenchPropertyPage {
|
||||||
|
|
||||||
private SerialPortConnectionBlock block;
|
protected SerialPortConnectionBlock block;
|
||||||
private IRemoteConnectionWorkingCopy workingCopy;
|
protected IRemoteConnectionWorkingCopy workingCopy;
|
||||||
|
|
||||||
public SerialPortConnectionPropertyPage() {
|
public SerialPortConnectionPropertyPage() {
|
||||||
super();
|
super();
|
||||||
|
|
Loading…
Add table
Reference in a new issue