mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
More modernization to terminal code.
* Update to Java 8 BREE * Remove useless non-javadoc comments * Generification, lambdas and etc. Change-Id: Id81032fe7cea6b37ac95c274f6e009714ec87441 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
parent
eb1b8a0dc3
commit
17c7327574
15 changed files with 109 additions and 291 deletions
|
@ -12,7 +12,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
|
||||||
org.eclipse.tm.terminal.view.ui;bundle-version="4.5.0";resolution:=optional,
|
org.eclipse.tm.terminal.view.ui;bundle-version="4.5.0";resolution:=optional,
|
||||||
org.eclipse.tm.terminal.control;bundle-version="4.5.0",
|
org.eclipse.tm.terminal.control;bundle-version="4.5.0",
|
||||||
org.eclipse.ui;bundle-version="3.8.0"
|
org.eclipse.ui;bundle-version="3.8.0"
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Export-Package: org.eclipse.tm.terminal.connector.telnet.activator;x-internal:=true,
|
Export-Package: org.eclipse.tm.terminal.connector.telnet.activator;x-internal:=true,
|
||||||
|
|
|
@ -41,25 +41,16 @@ public class TelnetLauncherDelegate extends AbstractLauncherDelegate {
|
||||||
// The Telnet terminal connection memento handler
|
// The Telnet terminal connection memento handler
|
||||||
private final IMementoHandler mementoHandler = new TelnetMementoHandler();
|
private final IMementoHandler mementoHandler = new TelnetMementoHandler();
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#needsUserConfiguration()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needsUserConfiguration() {
|
public boolean needsUserConfiguration() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#getPanel(org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanelContainer)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
|
public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
|
||||||
return new TelnetWizardConfigurationPanel(container);
|
return new TelnetWizardConfigurationPanel(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tm.terminal.view.core.interfaces.ITerminalService.Done)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Map<String, Object> properties, ITerminalService.Done done) {
|
public void execute(Map<String, Object> properties, ITerminalService.Done done) {
|
||||||
Assert.isNotNull(properties);
|
Assert.isNotNull(properties);
|
||||||
|
@ -109,20 +100,14 @@ public class TelnetLauncherDelegate extends AbstractLauncherDelegate {
|
||||||
return Messages.TelnetLauncherDelegate_terminalTitle_default;
|
return Messages.TelnetLauncherDelegate_terminalTitle_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter(Class adapter) {
|
public <T> T getAdapter(Class<T> adapter) {
|
||||||
if (IMementoHandler.class.equals(adapter)) {
|
if (IMementoHandler.class.equals(adapter)) {
|
||||||
return mementoHandler;
|
return adapter.cast(mementoHandler);
|
||||||
}
|
}
|
||||||
return super.getAdapter(adapter);
|
return super.getAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
|
public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
|
||||||
Assert.isNotNull(properties);
|
Assert.isNotNull(properties);
|
||||||
|
|
|
@ -7,7 +7,7 @@ Bundle-Activator: org.eclipse.tm.terminal.view.core.activator.CoreBundleActivato
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
|
Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
|
||||||
org.eclipse.core.runtime;bundle-version="3.8.0"
|
org.eclipse.core.runtime;bundle-version="3.8.0"
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Export-Package: org.eclipse.tm.terminal.view.core,
|
Export-Package: org.eclipse.tm.terminal.view.core,
|
||||||
|
|
|
@ -34,7 +34,7 @@ public final class TerminalServiceFactory {
|
||||||
if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
|
if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
|
||||||
try {
|
try {
|
||||||
Class<?> clazz = bundle.loadClass("org.eclipse.tm.terminal.view.ui.services.TerminalService"); //$NON-NLS-1$
|
Class<?> clazz = bundle.loadClass("org.eclipse.tm.terminal.view.ui.services.TerminalService"); //$NON-NLS-1$
|
||||||
instance = (ITerminalService) clazz.newInstance();
|
instance = (ITerminalService) clazz.getDeclaredConstructor().newInstance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (Platform.inDebugMode()) {
|
if (Platform.inDebugMode()) {
|
||||||
Platform.getLog(bundle).log(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(),
|
Platform.getLog(bundle).log(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(),
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChange
|
||||||
import org.eclipse.core.runtime.preferences.IPreferenceFilter;
|
import org.eclipse.core.runtime.preferences.IPreferenceFilter;
|
||||||
import org.eclipse.core.runtime.preferences.IScopeContext;
|
import org.eclipse.core.runtime.preferences.IScopeContext;
|
||||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||||
|
import org.eclipse.core.runtime.preferences.PreferenceFilterEntry;
|
||||||
import org.osgi.service.prefs.BackingStoreException;
|
import org.osgi.service.prefs.BackingStoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,7 +59,7 @@ public class ScopedEclipsePreferences {
|
||||||
/**
|
/**
|
||||||
* The registered preference change listeners.
|
* The registered preference change listeners.
|
||||||
*/
|
*/
|
||||||
private final ListenerList listeners = new ListenerList();
|
private final ListenerList<IPreferenceChangeListener> listeners = new ListenerList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -108,19 +109,13 @@ public class ScopedEclipsePreferences {
|
||||||
Assert.isNotNull(stream);
|
Assert.isNotNull(stream);
|
||||||
try {
|
try {
|
||||||
IPreferenceFilter filter = new IPreferenceFilter() {
|
IPreferenceFilter filter = new IPreferenceFilter() {
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.runtime.preferences.IPreferenceFilter#getScopes()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getScopes() {
|
public String[] getScopes() {
|
||||||
return new String[] { InstanceScope.SCOPE };
|
return new String[] { InstanceScope.SCOPE };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.runtime.preferences.IPreferenceFilter#getMapping(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Map getMapping(String scope) {
|
public Map<String, PreferenceFilterEntry[]> getMapping(String scope) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -437,12 +432,9 @@ public class ScopedEclipsePreferences {
|
||||||
if (listeners.isEmpty())
|
if (listeners.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get the list or currently registered listeners
|
|
||||||
Object[] l = listeners.getListeners();
|
|
||||||
// Create the preference change event
|
// Create the preference change event
|
||||||
final PreferenceChangeEvent event = new PreferenceChangeEvent(node, key, oldValue, newValue);
|
final PreferenceChangeEvent event = new PreferenceChangeEvent(node, key, oldValue, newValue);
|
||||||
for (int i = 0; i < l.length; i++) {
|
for (IPreferenceChangeListener listener : listeners) {
|
||||||
final IPreferenceChangeListener listener = (IPreferenceChangeListener) l[i];
|
|
||||||
ISafeRunnable job = new ISafeRunnable() {
|
ISafeRunnable job = new ISafeRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void handleException(Throwable exception) {
|
public void handleException(Throwable exception) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
|
||||||
org.eclipse.tm.terminal.view.core;bundle-version="4.5.0",
|
org.eclipse.tm.terminal.view.core;bundle-version="4.5.0",
|
||||||
org.eclipse.tm.terminal.control;bundle-version="4.5.0",
|
org.eclipse.tm.terminal.control;bundle-version="4.5.0",
|
||||||
org.eclipse.ui;bundle-version="3.8.0"
|
org.eclipse.ui;bundle-version="3.8.0"
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Export-Package: org.eclipse.tm.terminal.view.ui.actions,
|
Export-Package: org.eclipse.tm.terminal.view.ui.actions,
|
||||||
|
|
|
@ -37,8 +37,8 @@ public class ExternalExecutablesState extends AbstractSourceProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map getCurrentState() {
|
public Map<String, String> getCurrentState() {
|
||||||
Map<String, String> map = new HashMap<String, String>(1);
|
Map<String, String> map = new HashMap<>(1);
|
||||||
map.put(CONFIGURED_STATE, Boolean.valueOf(enabled).toString().toUpperCase());
|
map.put(CONFIGURED_STATE, Boolean.valueOf(enabled).toString().toUpperCase());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,6 @@ public abstract class AbstractLauncherDelegate extends PlatformObject implements
|
||||||
// The hidden attribute
|
// The hidden attribute
|
||||||
private boolean hidden;
|
private boolean hidden;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
|
public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
|
@ -94,41 +91,26 @@ public abstract class AbstractLauncherDelegate extends PlatformObject implements
|
||||||
NLS.bind(Messages.Extension_error_missingRequiredAttribute, attributeName, extensionId), null));
|
NLS.bind(Messages.Extension_error_missingRequiredAttribute, attributeName, extensionId), null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#getId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#getLabel()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label != null ? label.trim() : ""; //$NON-NLS-1$
|
return label != null ? label.trim() : ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#getEnablement()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Expression getEnablement() {
|
public Expression getEnablement() {
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#isHidden()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHidden() {
|
public boolean isHidden() {
|
||||||
return hidden;
|
return hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof AbstractLauncherDelegate) {
|
if (obj instanceof AbstractLauncherDelegate) {
|
||||||
|
@ -137,9 +119,6 @@ public abstract class AbstractLauncherDelegate extends PlatformObject implements
|
||||||
return super.equals(obj);
|
return super.equals(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#hashCode()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return id.hashCode();
|
return id.hashCode();
|
||||||
|
|
|
@ -43,9 +43,6 @@ public class DynamicContributionItems extends CompoundContributionItem implement
|
||||||
// Reference to the local terminal launcher delegate
|
// Reference to the local terminal launcher delegate
|
||||||
/* default */ ILauncherDelegate delegate;
|
/* default */ ILauncherDelegate delegate;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.menus.IWorkbenchContribution#initialize(org.eclipse.ui.services.IServiceLocator)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(IServiceLocator serviceLocator) {
|
public void initialize(IServiceLocator serviceLocator) {
|
||||||
this.serviceLocator = serviceLocator;
|
this.serviceLocator = serviceLocator;
|
||||||
|
@ -55,12 +52,9 @@ public class DynamicContributionItems extends CompoundContributionItem implement
|
||||||
.getLauncherDelegate("org.eclipse.tm.terminal.connector.local.launcher.local", false); //$NON-NLS-1$
|
.getLauncherDelegate("org.eclipse.tm.terminal.connector.local.launcher.local", false); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected IContributionItem[] getContributionItems() {
|
protected IContributionItem[] getContributionItems() {
|
||||||
List<IContributionItem> items = new ArrayList<IContributionItem>();
|
List<IContributionItem> items = new ArrayList<>();
|
||||||
|
|
||||||
if (delegate != null) {
|
if (delegate != null) {
|
||||||
List<Map<String, String>> l = ExternalExecutablesManager.load();
|
List<Map<String, String>> l = ExternalExecutablesManager.load();
|
||||||
|
@ -118,7 +112,7 @@ public class DynamicContributionItems extends CompoundContributionItem implement
|
||||||
if (selection != null && selection.isEmpty())
|
if (selection != null && selection.isEmpty())
|
||||||
selection = null;
|
selection = null;
|
||||||
|
|
||||||
Map<String, Object> properties = new HashMap<String, Object>();
|
Map<String, Object> properties = new HashMap<>();
|
||||||
properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
|
properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
|
||||||
if (selection != null)
|
if (selection != null)
|
||||||
properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
|
properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
|
||||||
|
|
|
@ -46,25 +46,16 @@ public abstract class AbstractConfigurationPanel implements IConfigurationPanel
|
||||||
this.container = container;
|
this.container = container;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#getContainer()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IConfigurationPanelContainer getContainer() {
|
public IConfigurationPanelContainer getContainer() {
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.IMessageProvider#getMessage()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public final String getMessage() {
|
public final String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public final int getMessageType() {
|
public final int getMessageType() {
|
||||||
return messageType;
|
return messageType;
|
||||||
|
@ -81,9 +72,6 @@ public abstract class AbstractConfigurationPanel implements IConfigurationPanel
|
||||||
this.messageType = messageType;
|
this.messageType = messageType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#dispose()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
}
|
}
|
||||||
|
@ -97,40 +85,25 @@ public abstract class AbstractConfigurationPanel implements IConfigurationPanel
|
||||||
this.topControl = topControl;
|
this.topControl = topControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#getControl()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Composite getControl() {
|
public Composite getControl() {
|
||||||
return topControl;
|
return topControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#setSelection(org.eclipse.jface.viewers.ISelection)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelection(ISelection selection) {
|
public void setSelection(ISelection selection) {
|
||||||
this.selection = selection;
|
this.selection = selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#getSelection()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ISelection getSelection() {
|
public ISelection getSelection() {
|
||||||
return selection;
|
return selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
|
public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
|
public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
|
||||||
}
|
}
|
||||||
|
@ -150,9 +123,6 @@ public abstract class AbstractConfigurationPanel implements IConfigurationPanel
|
||||||
return settingsSlotId;
|
return settingsSlotId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#setEnabled(boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setEnabled(boolean enabled) {
|
public void setEnabled(boolean enabled) {
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
|
@ -165,39 +135,24 @@ public abstract class AbstractConfigurationPanel implements IConfigurationPanel
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#isValid()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
setMessage(null, NONE);
|
setMessage(null, NONE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#activate()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void activate() {
|
public void activate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#extractData(java.util.Map)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void extractData(Map<String, Object> data) {
|
public void extractData(Map<String, Object> data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#setupData(java.util.Map)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setupData(Map<String, Object> data) {
|
public void setupData(Map<String, Object> data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#updateData(java.util.Map)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void updateData(Map<String, Object> data) {
|
public void updateData(Map<String, Object> data) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,10 +46,10 @@ import org.eclipse.tm.terminal.view.core.TerminalContextPropertiesProviderFactor
|
||||||
import org.eclipse.tm.terminal.view.core.interfaces.ITerminalContextPropertiesProvider;
|
import org.eclipse.tm.terminal.view.core.interfaces.ITerminalContextPropertiesProvider;
|
||||||
import org.eclipse.tm.terminal.view.core.interfaces.constants.IContextPropertiesConstants;
|
import org.eclipse.tm.terminal.view.core.interfaces.constants.IContextPropertiesConstants;
|
||||||
import org.eclipse.tm.terminal.view.core.interfaces.constants.ITerminalsConnectorConstants;
|
import org.eclipse.tm.terminal.view.core.interfaces.constants.ITerminalsConnectorConstants;
|
||||||
import org.eclipse.tm.terminal.view.ui.activator.UIPlugin;
|
|
||||||
import org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanelContainer;
|
import org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanelContainer;
|
||||||
import org.eclipse.tm.terminal.view.ui.nls.Messages;
|
import org.eclipse.tm.terminal.view.ui.nls.Messages;
|
||||||
import org.eclipse.ui.ISharedImages;
|
import org.eclipse.ui.ISharedImages;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.WorkbenchEncoding;
|
import org.eclipse.ui.WorkbenchEncoding;
|
||||||
import org.osgi.framework.Bundle;
|
import org.osgi.framework.Bundle;
|
||||||
|
|
||||||
|
@ -69,10 +69,10 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
||||||
// The last selected encoding
|
// The last selected encoding
|
||||||
/* default */ String lastSelectedEncoding;
|
/* default */ String lastSelectedEncoding;
|
||||||
// The last entered custom encodings
|
// The last entered custom encodings
|
||||||
/* default */ final List<String> encodingHistory = new ArrayList<String>();
|
/* default */ final List<String> encodingHistory = new ArrayList<>();
|
||||||
|
|
||||||
// A map containing the settings per host
|
// A map containing the settings per host
|
||||||
protected final Map<String, Map<String, String>> hostSettingsMap = new HashMap<String, Map<String, String>>();
|
protected final Map<String, Map<String, String>> hostSettingsMap = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -124,9 +124,6 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.panels.AbstractConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
|
public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
|
||||||
Assert.isNotNull(settings);
|
Assert.isNotNull(settings);
|
||||||
|
@ -202,7 +199,7 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
||||||
*/
|
*/
|
||||||
private HashMap<String, String> deSerialize(String hostString) {
|
private HashMap<String, String> deSerialize(String hostString) {
|
||||||
Assert.isNotNull(hostString);
|
Assert.isNotNull(hostString);
|
||||||
HashMap<String, String> attr = new HashMap<String, String>();
|
HashMap<String, String> attr = new HashMap<>();
|
||||||
|
|
||||||
if (hostString.length() != 0) {
|
if (hostString.length() != 0) {
|
||||||
String[] hostAttrs = hostString.split("\\:");//$NON-NLS-1$
|
String[] hostAttrs = hostString.split("\\:");//$NON-NLS-1$
|
||||||
|
@ -237,9 +234,6 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.tm.terminal.view.ui.panels.AbstractConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
|
public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
|
||||||
Iterator<String> nextHost = hostSettingsMap.keySet().iterator();
|
Iterator<String> nextHost = hostSettingsMap.keySet().iterator();
|
||||||
|
@ -314,7 +308,7 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
||||||
* @return The list of host names.
|
* @return The list of host names.
|
||||||
*/
|
*/
|
||||||
private List<String> getHostList() {
|
private List<String> getHostList() {
|
||||||
List<String> hostList = new ArrayList<String>();
|
List<String> hostList = new ArrayList<>();
|
||||||
hostList.addAll(hostSettingsMap.keySet());
|
hostList.addAll(hostSettingsMap.keySet());
|
||||||
return hostList;
|
return hostList;
|
||||||
}
|
}
|
||||||
|
@ -402,7 +396,7 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
||||||
deleteHostButton = new Button(comboComposite, SWT.NONE);
|
deleteHostButton = new Button(comboComposite, SWT.NONE);
|
||||||
// deleteHostButton.setText(Messages.AbstractConfigurationPanel_delete);
|
// deleteHostButton.setText(Messages.AbstractConfigurationPanel_delete);
|
||||||
|
|
||||||
ISharedImages workbenchImages = UIPlugin.getDefault().getWorkbench().getSharedImages();
|
ISharedImages workbenchImages = PlatformUI.getWorkbench().getSharedImages();
|
||||||
deleteHostButton.setImage(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE).createImage());
|
deleteHostButton.setImage(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE).createImage());
|
||||||
|
|
||||||
deleteHostButton.setToolTipText(Messages.AbstractConfigurationPanel_deleteButtonTooltip);
|
deleteHostButton.setToolTipText(Messages.AbstractConfigurationPanel_deleteButtonTooltip);
|
||||||
|
@ -521,7 +515,7 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
||||||
*/
|
*/
|
||||||
protected void fillEncodingCombo() {
|
protected void fillEncodingCombo() {
|
||||||
if (encodingCombo != null) {
|
if (encodingCombo != null) {
|
||||||
List<String> encodings = new ArrayList<String>();
|
List<String> encodings = new ArrayList<>();
|
||||||
|
|
||||||
// Default encoding
|
// Default encoding
|
||||||
encodings.add("Default (ISO-8859-1)"); //$NON-NLS-1$
|
encodings.add("Default (ISO-8859-1)"); //$NON-NLS-1$
|
||||||
|
@ -551,7 +545,7 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
||||||
* Add given encoding names to the list. Duplicates are filtered out by comparing aliases.
|
* Add given encoding names to the list. Duplicates are filtered out by comparing aliases.
|
||||||
*/
|
*/
|
||||||
private void addEncodings(List<String> encodings, String... toadd) {
|
private void addEncodings(List<String> encodings, String... toadd) {
|
||||||
Set<String> aliases = new HashSet<String>();
|
Set<String> aliases = new HashSet<>();
|
||||||
for (String name : toadd) {
|
for (String name : toadd) {
|
||||||
if (name == null)
|
if (name == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -34,18 +34,14 @@ import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
|
||||||
import org.eclipse.jface.viewers.ColumnWeightData;
|
import org.eclipse.jface.viewers.ColumnWeightData;
|
||||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.viewers.ITableLabelProvider;
|
import org.eclipse.jface.viewers.ITableLabelProvider;
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
|
||||||
import org.eclipse.jface.viewers.TableLayout;
|
import org.eclipse.jface.viewers.TableLayout;
|
||||||
import org.eclipse.jface.viewers.TableViewer;
|
import org.eclipse.jface.viewers.TableViewer;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.jface.window.Window;
|
import org.eclipse.jface.window.Window;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
|
@ -93,14 +89,11 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
||||||
private Button commandBrowseButton;
|
private Button commandBrowseButton;
|
||||||
private Text arguments;
|
private Text arguments;
|
||||||
|
|
||||||
/* default */ final List<Map<String, String>> executables = new ArrayList<Map<String, String>>();
|
/* default */ final List<Map<String, String>> executables = new ArrayList<>();
|
||||||
/* default */ final Map<String, Image> images = new HashMap<String, Image>();
|
/* default */ final Map<String, Image> images = new HashMap<>();
|
||||||
|
|
||||||
/* default */ static final Object[] NO_ELEMENTS = new Object[0];
|
/* default */ static final Object[] NO_ELEMENTS = new Object[0];
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IWorkbench workbench) {
|
public void init(IWorkbench workbench) {
|
||||||
Bundle bundle = Platform.getBundle("org.eclipse.debug.ui"); //$NON-NLS-1$
|
Bundle bundle = Platform.getBundle("org.eclipse.debug.ui"); //$NON-NLS-1$
|
||||||
|
@ -109,9 +102,6 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Control createContents(final Composite parent) {
|
protected Control createContents(final Composite parent) {
|
||||||
final GC gc = new GC(parent);
|
final GC gc = new GC(parent);
|
||||||
|
@ -134,9 +124,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
||||||
|
|
||||||
command = new Text(group, SWT.SINGLE | SWT.BORDER);
|
command = new Text(group, SWT.SINGLE | SWT.BORDER);
|
||||||
command.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
command.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
||||||
command.addModifyListener(new ModifyListener() {
|
command.addModifyListener(e -> {
|
||||||
@Override
|
|
||||||
public void modifyText(ModifyEvent e) {
|
|
||||||
boolean valid = true;
|
boolean valid = true;
|
||||||
String message = null;
|
String message = null;
|
||||||
|
|
||||||
|
@ -150,7 +138,6 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
||||||
|
|
||||||
setValid(valid);
|
setValid(valid);
|
||||||
setErrorMessage(message);
|
setErrorMessage(message);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
commandBrowseButton = new Button(group, SWT.PUSH);
|
commandBrowseButton = new Button(group, SWT.PUSH);
|
||||||
|
@ -231,9 +218,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
||||||
}
|
}
|
||||||
workingDir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
workingDir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
||||||
workingDir.select(0);
|
workingDir.select(0);
|
||||||
workingDir.addModifyListener(new ModifyListener() {
|
workingDir.addModifyListener(e -> {
|
||||||
@Override
|
|
||||||
public void modifyText(ModifyEvent e) {
|
|
||||||
boolean valid = true;
|
boolean valid = true;
|
||||||
String message = null;
|
String message = null;
|
||||||
|
|
||||||
|
@ -259,7 +244,6 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
||||||
|
|
||||||
setValid(valid);
|
setValid(valid);
|
||||||
setErrorMessage(message);
|
setErrorMessage(message);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
browseButton = new Button(group, SWT.PUSH);
|
browseButton = new Button(group, SWT.PUSH);
|
||||||
|
@ -583,12 +567,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
||||||
|
|
||||||
viewer.setInput(executables);
|
viewer.setInput(executables);
|
||||||
|
|
||||||
viewer.addPostSelectionChangedListener(new ISelectionChangedListener() {
|
viewer.addPostSelectionChangedListener(event -> updateButtons());
|
||||||
@Override
|
|
||||||
public void selectionChanged(SelectionChangedEvent event) {
|
|
||||||
updateButtons();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
updateButtons();
|
updateButtons();
|
||||||
|
|
||||||
|
@ -618,9 +597,6 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void performDefaults() {
|
protected void performDefaults() {
|
||||||
if (!Platform.OS_WIN32.equals(Platform.getOS())) {
|
if (!Platform.OS_WIN32.equals(Platform.getOS())) {
|
||||||
|
@ -652,9 +628,6 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
||||||
super.performDefaults();
|
super.performDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.preference.PreferencePage#performOk()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean performOk() {
|
public boolean performOk() {
|
||||||
if (!Platform.OS_WIN32.equals(Platform.getOS())) {
|
if (!Platform.OS_WIN32.equals(Platform.getOS())) {
|
||||||
|
@ -698,9 +671,6 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
||||||
return super.performOk();
|
return super.performOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.DialogPage#dispose()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
for (Image i : images.values()) {
|
for (Image i : images.values()) {
|
||||||
|
|
|
@ -58,10 +58,10 @@ public class OutputStreamMonitor implements IDisposable {
|
||||||
private boolean disposed;
|
private boolean disposed;
|
||||||
|
|
||||||
// A list of object to dispose if this monitor is disposed
|
// A list of object to dispose if this monitor is disposed
|
||||||
private final List<IDisposable> disposables = new ArrayList<IDisposable>();
|
private final List<IDisposable> disposables = new ArrayList<>();
|
||||||
|
|
||||||
// The list of registered listener
|
// The list of registered listener
|
||||||
private final ListenerList listeners;
|
private final ListenerList<ITerminalServiceOutputStreamMonitorListener> listeners;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -80,7 +80,7 @@ public class OutputStreamMonitor implements IDisposable {
|
||||||
|
|
||||||
this.lineSeparator = lineSeparator;
|
this.lineSeparator = lineSeparator;
|
||||||
|
|
||||||
this.listeners = new ListenerList();
|
this.listeners = new ListenerList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,9 +126,6 @@ public class OutputStreamMonitor implements IDisposable {
|
||||||
disposables.remove(disposable);
|
disposables.remove(disposable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.services.IDisposable#dispose()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
// If already disposed --> return immediately
|
// If already disposed --> return immediately
|
||||||
|
@ -160,12 +157,7 @@ public class OutputStreamMonitor implements IDisposable {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Create a new runnable which is constantly reading from the stream
|
// Create a new runnable which is constantly reading from the stream
|
||||||
Runnable runnable = new Runnable() {
|
Runnable runnable = () -> readStream();
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
readStream();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create the reader thread
|
// Create the reader thread
|
||||||
thread = new Thread(runnable, "Terminal Output Stream Monitor Thread"); //$NON-NLS-1$
|
thread = new Thread(runnable, "Terminal Output Stream Monitor Thread"); //$NON-NLS-1$
|
||||||
|
@ -319,11 +311,8 @@ public class OutputStreamMonitor implements IDisposable {
|
||||||
|
|
||||||
// If listeners are registered, invoke the listeners now.
|
// If listeners are registered, invoke the listeners now.
|
||||||
if (listeners.size() > 0) {
|
if (listeners.size() > 0) {
|
||||||
for (Object candidate : listeners.getListeners()) {
|
for (ITerminalServiceOutputStreamMonitorListener candidate : listeners) {
|
||||||
if (!(candidate instanceof ITerminalServiceOutputStreamMonitorListener))
|
candidate.onContentReadFromStream(byteBuffer, bytesRead);
|
||||||
continue;
|
|
||||||
((ITerminalServiceOutputStreamMonitorListener) candidate).onContentReadFromStream(byteBuffer,
|
|
||||||
bytesRead);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,16 +49,13 @@ public class TabFolderToolbarHandler extends PlatformObject {
|
||||||
// Reference to the selection listener
|
// Reference to the selection listener
|
||||||
private ToolbarSelectionChangedListener selectionChangedListener;
|
private ToolbarSelectionChangedListener selectionChangedListener;
|
||||||
// The list of actions available within the toolbar
|
// The list of actions available within the toolbar
|
||||||
private final List<AbstractTerminalAction> toolbarActions = new ArrayList<AbstractTerminalAction>();
|
private final List<AbstractTerminalAction> toolbarActions = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default selection listener implementation.
|
* Default selection listener implementation.
|
||||||
*/
|
*/
|
||||||
protected class ToolbarSelectionChangedListener implements ISelectionChangedListener {
|
protected class ToolbarSelectionChangedListener implements ISelectionChangedListener {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void selectionChanged(SelectionChangedEvent event) {
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
boolean enable = event != null;
|
boolean enable = event != null;
|
||||||
|
@ -100,9 +97,8 @@ public class TabFolderToolbarHandler extends PlatformObject {
|
||||||
*
|
*
|
||||||
* @return The tab folder or <code>null</code>.
|
* @return The tab folder or <code>null</code>.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("cast")
|
|
||||||
protected final CTabFolder getTabFolder() {
|
protected final CTabFolder getTabFolder() {
|
||||||
return (CTabFolder) getParentView().getAdapter(CTabFolder.class);
|
return getParentView().getAdapter(CTabFolder.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,12 +106,11 @@ public class TabFolderToolbarHandler extends PlatformObject {
|
||||||
*
|
*
|
||||||
* @return The currently active terminal control or <code>null</code>.
|
* @return The currently active terminal control or <code>null</code>.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("cast")
|
|
||||||
public ITerminalViewControl getActiveTerminalViewControl() {
|
public ITerminalViewControl getActiveTerminalViewControl() {
|
||||||
ITerminalViewControl terminal = null;
|
ITerminalViewControl terminal = null;
|
||||||
|
|
||||||
// Get the active tab item from the tab folder manager
|
// Get the active tab item from the tab folder manager
|
||||||
TabFolderManager manager = (TabFolderManager) getParentView().getAdapter(TabFolderManager.class);
|
TabFolderManager manager = getParentView().getAdapter(TabFolderManager.class);
|
||||||
if (manager != null) {
|
if (manager != null) {
|
||||||
// If we have the active tab item, we can get the active terminal control
|
// If we have the active tab item, we can get the active terminal control
|
||||||
CTabItem activeTabItem = manager.getActiveTabItem();
|
CTabItem activeTabItem = manager.getActiveTabItem();
|
||||||
|
|
|
@ -54,8 +54,6 @@ import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Event;
|
|
||||||
import org.eclipse.swt.widgets.Listener;
|
|
||||||
import org.eclipse.tm.terminal.view.ui.activator.UIPlugin;
|
import org.eclipse.tm.terminal.view.ui.activator.UIPlugin;
|
||||||
import org.eclipse.tm.terminal.view.ui.interfaces.ITerminalsView;
|
import org.eclipse.tm.terminal.view.ui.interfaces.ITerminalsView;
|
||||||
import org.eclipse.tm.terminal.view.ui.nls.Messages;
|
import org.eclipse.tm.terminal.view.ui.nls.Messages;
|
||||||
|
@ -167,32 +165,20 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
||||||
return draggedTabFolderManager;
|
return draggedTabFolderManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.swt.dnd.Transfer#getTypeIds()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected int[] getTypeIds() {
|
protected int[] getTypeIds() {
|
||||||
return new int[] { TYPEID };
|
return new int[] { TYPEID };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.swt.dnd.Transfer#getTypeNames()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] getTypeNames() {
|
protected String[] getTypeNames() {
|
||||||
return new String[] { TYPE_NAME };
|
return new String[] { TYPE_NAME };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.swt.dnd.ByteArrayTransfer#javaToNative(java.lang.Object, org.eclipse.swt.dnd.TransferData)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void javaToNative(Object data, TransferData transferData) {
|
public void javaToNative(Object data, TransferData transferData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.swt.dnd.ByteArrayTransfer#nativeToJava(org.eclipse.swt.dnd.TransferData)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object nativeToJava(TransferData transferData) {
|
public Object nativeToJava(TransferData transferData) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -211,12 +197,7 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
||||||
*/
|
*/
|
||||||
private void addDragSupport() {
|
private void addDragSupport() {
|
||||||
// The event listener is registered as filter. It will receive events from all widgets.
|
// The event listener is registered as filter. It will receive events from all widgets.
|
||||||
PlatformUI.getWorkbench().getDisplay().addFilter(SWT.DragDetect, new Listener() {
|
PlatformUI.getWorkbench().getDisplay().addFilter(SWT.DragDetect, event -> {
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void handleEvent(Event event) {
|
|
||||||
// Only handle events where a CTabFolder is the source
|
// Only handle events where a CTabFolder is the source
|
||||||
if (!(event.widget instanceof CTabFolder))
|
if (!(event.widget instanceof CTabFolder))
|
||||||
return;
|
return;
|
||||||
|
@ -264,7 +245,6 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
||||||
draggedFolder.notifyListeners(SWT.MouseUp, null);
|
draggedFolder.notifyListeners(SWT.MouseUp, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,9 +312,6 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.part.WorkbenchPart#dispose()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
// Dispose the tab folder manager
|
// Dispose the tab folder manager
|
||||||
|
@ -356,18 +333,12 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IViewSite site, IMemento memento) throws PartInitException {
|
public void init(IViewSite site, IMemento memento) throws PartInitException {
|
||||||
super.init(site, memento);
|
super.init(site, memento);
|
||||||
restoreState(memento);
|
restoreState(memento);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void createPartControl(Composite parent) {
|
public void createPartControl(Composite parent) {
|
||||||
// Create the page book control
|
// Create the page book control
|
||||||
|
@ -666,10 +637,6 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
||||||
mementoHandler.restoreState(this, memento);
|
mementoHandler.restoreState(this, memento);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.part.IShowInTarget#show(org.eclipse.ui.part.ShowInContext)
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("cast")
|
|
||||||
@Override
|
@Override
|
||||||
public boolean show(ShowInContext context) {
|
public boolean show(ShowInContext context) {
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
|
@ -696,7 +663,7 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
||||||
boolean isValid = true;
|
boolean isValid = true;
|
||||||
|
|
||||||
// Build a new structured selection with the adapted elements
|
// Build a new structured selection with the adapted elements
|
||||||
List<Object> elements = new ArrayList<Object>();
|
List<Object> elements = new ArrayList<>();
|
||||||
|
|
||||||
Iterator<?> iterator = ((IStructuredSelection) selection).iterator();
|
Iterator<?> iterator = ((IStructuredSelection) selection).iterator();
|
||||||
while (iterator.hasNext() && isValid) {
|
while (iterator.hasNext() && isValid) {
|
||||||
|
@ -781,8 +748,7 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
||||||
// If the selection is valid, fire the command to open the local terminal
|
// If the selection is valid, fire the command to open the local terminal
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
selection = new StructuredSelection(elements);
|
selection = new StructuredSelection(elements);
|
||||||
ICommandService service = (ICommandService) PlatformUI.getWorkbench()
|
ICommandService service = PlatformUI.getWorkbench().getService(ICommandService.class);
|
||||||
.getService(ICommandService.class);
|
|
||||||
Command command = service != null
|
Command command = service != null
|
||||||
? service.getCommand("org.eclipse.tm.terminal.connector.local.command.launch") //$NON-NLS-1$
|
? service.getCommand("org.eclipse.tm.terminal.connector.local.command.launch") //$NON-NLS-1$
|
||||||
: null;
|
: null;
|
||||||
|
@ -790,8 +756,7 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
||||||
try {
|
try {
|
||||||
ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null);
|
ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null);
|
||||||
Assert.isNotNull(pCmd);
|
Assert.isNotNull(pCmd);
|
||||||
IHandlerService handlerSvc = (IHandlerService) PlatformUI.getWorkbench()
|
IHandlerService handlerSvc = PlatformUI.getWorkbench().getService(IHandlerService.class);
|
||||||
.getService(IHandlerService.class);
|
|
||||||
Assert.isNotNull(handlerSvc);
|
Assert.isNotNull(handlerSvc);
|
||||||
IEvaluationContext ctx = handlerSvc.getCurrentState();
|
IEvaluationContext ctx = handlerSvc.getCurrentState();
|
||||||
ctx = new EvaluationContext(ctx, selection);
|
ctx = new EvaluationContext(ctx, selection);
|
||||||
|
|
Loading…
Add table
Reference in a new issue