|
Lines 15-21
Link Here
|
| 15 |
import java.util.ArrayList; |
15 |
import java.util.ArrayList; |
| 16 |
import java.util.List; |
16 |
import java.util.List; |
| 17 |
|
17 |
|
|
|
18 |
import org.eclipse.core.runtime.IAdaptable; |
| 18 |
import org.eclipse.core.runtime.IConfigurationElement; |
19 |
import org.eclipse.core.runtime.IConfigurationElement; |
|
|
20 |
import org.eclipse.core.runtime.Platform; |
| 19 |
import org.eclipse.core.runtime.RegistryFactory; |
21 |
import org.eclipse.core.runtime.RegistryFactory; |
| 20 |
|
22 |
|
| 21 |
/** |
23 |
/** |
|
Lines 62-68
Link Here
|
| 62 |
* {@link #setTerminalSize(int, int)}, {@link #save(ISettingsStore)} |
64 |
* {@link #setTerminalSize(int, int)}, {@link #save(ISettingsStore)} |
| 63 |
* |
65 |
* |
| 64 |
*/ |
66 |
*/ |
| 65 |
static private class TerminalConnectorProxy implements ITerminalConnector { |
67 |
static private class TerminalConnectorProxy implements ITerminalConnector, IAdaptable { |
| 66 |
/** |
68 |
/** |
| 67 |
* The connector |
69 |
* The connector |
| 68 |
*/ |
70 |
*/ |
|
Lines 170-175
Link Here
|
| 170 |
public void initialize() throws Exception { |
172 |
public void initialize() throws Exception { |
| 171 |
throw new IllegalStateException("Connector already initialized!"); //$NON-NLS-1$ |
173 |
throw new IllegalStateException("Connector already initialized!"); //$NON-NLS-1$ |
| 172 |
} |
174 |
} |
|
|
175 |
public Object getAdapter(Class adapter) { |
| 176 |
ITerminalConnector connector=getConnector(); |
| 177 |
// if we cannot create the connector then we cannot adapt... |
| 178 |
if(connector==null) |
| 179 |
return null; |
| 180 |
// maybe the connector is adaptable |
| 181 |
if(connector instanceof IAdaptable) { |
| 182 |
Object result =((IAdaptable)connector).getAdapter(adapter); |
| 183 |
// Not sure if the next block is needed.... |
| 184 |
if(result==null) |
| 185 |
//defer to the platform |
| 186 |
result= Platform.getAdapterManager().getAdapter(connector, adapter); |
| 187 |
if(result!=null) |
| 188 |
return result; |
| 189 |
} |
| 190 |
// maybe the real adapter is what we need.... |
| 191 |
if(adapter.isInstance(connector)) |
| 192 |
return connector; |
| 193 |
else |
| 194 |
// maybe we have to be adapted.... |
| 195 |
return Platform.getAdapterManager().getAdapter(this, adapter); |
| 196 |
} |
| 173 |
} |
197 |
} |
| 174 |
/** |
198 |
/** |
| 175 |
* @return null or a new connector created from the extension |
199 |
* @return null or a new connector created from the extension |