mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +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.control;bundle-version="4.5.0",
|
||||
org.eclipse.ui;bundle-version="3.8.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Localization: plugin
|
||||
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
|
||||
private final IMementoHandler mementoHandler = new TelnetMementoHandler();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#needsUserConfiguration()
|
||||
*/
|
||||
@Override
|
||||
public boolean needsUserConfiguration() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#getPanel(org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanelContainer)
|
||||
*/
|
||||
@Override
|
||||
public IConfigurationPanel getPanel(IConfigurationPanelContainer 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
|
||||
public void execute(Map<String, Object> properties, ITerminalService.Done done) {
|
||||
Assert.isNotNull(properties);
|
||||
|
@ -109,20 +100,14 @@ public class TelnetLauncherDelegate extends AbstractLauncherDelegate {
|
|||
return Messages.TelnetLauncherDelegate_terminalTitle_default;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
|
||||
*/
|
||||
@Override
|
||||
public Object getAdapter(Class adapter) {
|
||||
public <T> T getAdapter(Class<T> adapter) {
|
||||
if (IMementoHandler.class.equals(adapter)) {
|
||||
return mementoHandler;
|
||||
return adapter.cast(mementoHandler);
|
||||
}
|
||||
return super.getAdapter(adapter);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
|
||||
Assert.isNotNull(properties);
|
||||
|
|
|
@ -7,7 +7,7 @@ Bundle-Activator: org.eclipse.tm.terminal.view.core.activator.CoreBundleActivato
|
|||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
|
||||
org.eclipse.core.runtime;bundle-version="3.8.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Localization: plugin
|
||||
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) {
|
||||
try {
|
||||
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) {
|
||||
if (Platform.inDebugMode()) {
|
||||
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.IScopeContext;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.eclipse.core.runtime.preferences.PreferenceFilterEntry;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
|
||||
/**
|
||||
|
@ -58,7 +59,7 @@ public class ScopedEclipsePreferences {
|
|||
/**
|
||||
* The registered preference change listeners.
|
||||
*/
|
||||
private final ListenerList listeners = new ListenerList();
|
||||
private final ListenerList<IPreferenceChangeListener> listeners = new ListenerList<>();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -108,19 +109,13 @@ public class ScopedEclipsePreferences {
|
|||
Assert.isNotNull(stream);
|
||||
try {
|
||||
IPreferenceFilter filter = new IPreferenceFilter() {
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.preferences.IPreferenceFilter#getScopes()
|
||||
*/
|
||||
@Override
|
||||
public String[] getScopes() {
|
||||
return new String[] { InstanceScope.SCOPE };
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.preferences.IPreferenceFilter#getMapping(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Map getMapping(String scope) {
|
||||
public Map<String, PreferenceFilterEntry[]> getMapping(String scope) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
@ -437,12 +432,9 @@ public class ScopedEclipsePreferences {
|
|||
if (listeners.isEmpty())
|
||||
return;
|
||||
|
||||
// Get the list or currently registered listeners
|
||||
Object[] l = listeners.getListeners();
|
||||
// Create the preference change event
|
||||
final PreferenceChangeEvent event = new PreferenceChangeEvent(node, key, oldValue, newValue);
|
||||
for (int i = 0; i < l.length; i++) {
|
||||
final IPreferenceChangeListener listener = (IPreferenceChangeListener) l[i];
|
||||
for (IPreferenceChangeListener listener : listeners) {
|
||||
ISafeRunnable job = new ISafeRunnable() {
|
||||
@Override
|
||||
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.control;bundle-version="4.5.0",
|
||||
org.eclipse.ui;bundle-version="3.8.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Localization: plugin
|
||||
Export-Package: org.eclipse.tm.terminal.view.ui.actions,
|
||||
|
|
|
@ -37,8 +37,8 @@ public class ExternalExecutablesState extends AbstractSourceProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Map getCurrentState() {
|
||||
Map<String, String> map = new HashMap<String, String>(1);
|
||||
public Map<String, String> getCurrentState() {
|
||||
Map<String, String> map = new HashMap<>(1);
|
||||
map.put(CONFIGURED_STATE, Boolean.valueOf(enabled).toString().toUpperCase());
|
||||
return map;
|
||||
}
|
||||
|
|
|
@ -40,9 +40,6 @@ public abstract class AbstractLauncherDelegate extends PlatformObject implements
|
|||
// The hidden attribute
|
||||
private boolean hidden;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
|
||||
throws CoreException {
|
||||
|
@ -94,41 +91,26 @@ public abstract class AbstractLauncherDelegate extends PlatformObject implements
|
|||
NLS.bind(Messages.Extension_error_missingRequiredAttribute, attributeName, extensionId), null));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#getId()
|
||||
*/
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#getLabel()
|
||||
*/
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return label != null ? label.trim() : ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#getEnablement()
|
||||
*/
|
||||
@Override
|
||||
public Expression getEnablement() {
|
||||
return expression;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.ILauncherDelegate#isHidden()
|
||||
*/
|
||||
@Override
|
||||
public boolean isHidden() {
|
||||
return hidden;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof AbstractLauncherDelegate) {
|
||||
|
@ -137,9 +119,6 @@ public abstract class AbstractLauncherDelegate extends PlatformObject implements
|
|||
return super.equals(obj);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id.hashCode();
|
||||
|
|
|
@ -43,9 +43,6 @@ public class DynamicContributionItems extends CompoundContributionItem implement
|
|||
// Reference to the local terminal launcher delegate
|
||||
/* default */ ILauncherDelegate delegate;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.menus.IWorkbenchContribution#initialize(org.eclipse.ui.services.IServiceLocator)
|
||||
*/
|
||||
@Override
|
||||
public void initialize(IServiceLocator 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$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
|
||||
*/
|
||||
@Override
|
||||
protected IContributionItem[] getContributionItems() {
|
||||
List<IContributionItem> items = new ArrayList<IContributionItem>();
|
||||
List<IContributionItem> items = new ArrayList<>();
|
||||
|
||||
if (delegate != null) {
|
||||
List<Map<String, String>> l = ExternalExecutablesManager.load();
|
||||
|
@ -118,7 +112,7 @@ public class DynamicContributionItems extends CompoundContributionItem implement
|
|||
if (selection != null && selection.isEmpty())
|
||||
selection = null;
|
||||
|
||||
Map<String, Object> properties = new HashMap<String, Object>();
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
|
||||
if (selection != null)
|
||||
properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
|
||||
|
|
|
@ -46,25 +46,16 @@ public abstract class AbstractConfigurationPanel implements IConfigurationPanel
|
|||
this.container = container;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#getContainer()
|
||||
*/
|
||||
@Override
|
||||
public IConfigurationPanelContainer getContainer() {
|
||||
return container;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IMessageProvider#getMessage()
|
||||
*/
|
||||
@Override
|
||||
public final String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType()
|
||||
*/
|
||||
@Override
|
||||
public final int getMessageType() {
|
||||
return messageType;
|
||||
|
@ -81,9 +72,6 @@ public abstract class AbstractConfigurationPanel implements IConfigurationPanel
|
|||
this.messageType = messageType;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
@ -97,40 +85,25 @@ public abstract class AbstractConfigurationPanel implements IConfigurationPanel
|
|||
this.topControl = topControl;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#getControl()
|
||||
*/
|
||||
@Override
|
||||
public Composite getControl() {
|
||||
return topControl;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#setSelection(org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
@Override
|
||||
public void setSelection(ISelection selection) {
|
||||
this.selection = selection;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#getSelection()
|
||||
*/
|
||||
@Override
|
||||
public ISelection getSelection() {
|
||||
return selection;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
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
|
||||
public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
|
||||
}
|
||||
|
@ -150,9 +123,6 @@ public abstract class AbstractConfigurationPanel implements IConfigurationPanel
|
|||
return settingsSlotId;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#setEnabled(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
|
@ -165,39 +135,24 @@ public abstract class AbstractConfigurationPanel implements IConfigurationPanel
|
|||
return enabled;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#isValid()
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
setMessage(null, NONE);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#activate()
|
||||
*/
|
||||
@Override
|
||||
public void activate() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#extractData(java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public void extractData(Map<String, Object> data) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#setupData(java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public void setupData(Map<String, Object> data) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.interfaces.IConfigurationPanel#updateData(java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
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.constants.IContextPropertiesConstants;
|
||||
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.nls.Messages;
|
||||
import org.eclipse.ui.ISharedImages;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.WorkbenchEncoding;
|
||||
import org.osgi.framework.Bundle;
|
||||
|
||||
|
@ -69,10 +69,10 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
|||
// The last selected encoding
|
||||
/* default */ String lastSelectedEncoding;
|
||||
// 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
|
||||
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.
|
||||
|
@ -124,9 +124,6 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
|||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.tm.terminal.view.ui.panels.AbstractConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
|
||||
Assert.isNotNull(settings);
|
||||
|
@ -202,7 +199,7 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
|||
*/
|
||||
private HashMap<String, String> deSerialize(String hostString) {
|
||||
Assert.isNotNull(hostString);
|
||||
HashMap<String, String> attr = new HashMap<String, String>();
|
||||
HashMap<String, String> attr = new HashMap<>();
|
||||
|
||||
if (hostString.length() != 0) {
|
||||
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
|
||||
public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
|
||||
Iterator<String> nextHost = hostSettingsMap.keySet().iterator();
|
||||
|
@ -314,7 +308,7 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
|||
* @return The list of host names.
|
||||
*/
|
||||
private List<String> getHostList() {
|
||||
List<String> hostList = new ArrayList<String>();
|
||||
List<String> hostList = new ArrayList<>();
|
||||
hostList.addAll(hostSettingsMap.keySet());
|
||||
return hostList;
|
||||
}
|
||||
|
@ -402,7 +396,7 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
|||
deleteHostButton = new Button(comboComposite, SWT.NONE);
|
||||
// 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.setToolTipText(Messages.AbstractConfigurationPanel_deleteButtonTooltip);
|
||||
|
@ -521,7 +515,7 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
|
|||
*/
|
||||
protected void fillEncodingCombo() {
|
||||
if (encodingCombo != null) {
|
||||
List<String> encodings = new ArrayList<String>();
|
||||
List<String> encodings = new ArrayList<>();
|
||||
|
||||
// Default encoding
|
||||
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.
|
||||
*/
|
||||
private void addEncodings(List<String> encodings, String... toadd) {
|
||||
Set<String> aliases = new HashSet<String>();
|
||||
Set<String> aliases = new HashSet<>();
|
||||
for (String name : toadd) {
|
||||
if (name == null)
|
||||
continue;
|
||||
|
|
|
@ -34,18 +34,14 @@ import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
|
|||
import org.eclipse.jface.viewers.ColumnWeightData;
|
||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.ITableLabelProvider;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.TableLayout;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.window.Window;
|
||||
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.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
|
@ -93,14 +89,11 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
|||
private Button commandBrowseButton;
|
||||
private Text arguments;
|
||||
|
||||
/* default */ final List<Map<String, String>> executables = new ArrayList<Map<String, String>>();
|
||||
/* default */ final Map<String, Image> images = new HashMap<String, Image>();
|
||||
/* default */ final List<Map<String, String>> executables = new ArrayList<>();
|
||||
/* default */ final Map<String, Image> images = new HashMap<>();
|
||||
|
||||
/* default */ static final Object[] NO_ELEMENTS = new Object[0];
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
|
||||
*/
|
||||
@Override
|
||||
public void init(IWorkbench workbench) {
|
||||
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
|
||||
protected Control createContents(final Composite 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.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
||||
command.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
command.addModifyListener(e -> {
|
||||
boolean valid = true;
|
||||
String message = null;
|
||||
|
||||
|
@ -150,7 +138,6 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
|||
|
||||
setValid(valid);
|
||||
setErrorMessage(message);
|
||||
}
|
||||
});
|
||||
|
||||
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.select(0);
|
||||
workingDir.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
workingDir.addModifyListener(e -> {
|
||||
boolean valid = true;
|
||||
String message = null;
|
||||
|
||||
|
@ -259,7 +244,6 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
|||
|
||||
setValid(valid);
|
||||
setErrorMessage(message);
|
||||
}
|
||||
});
|
||||
|
||||
browseButton = new Button(group, SWT.PUSH);
|
||||
|
@ -583,12 +567,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
|||
|
||||
viewer.setInput(executables);
|
||||
|
||||
viewer.addPostSelectionChangedListener(new ISelectionChangedListener() {
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
updateButtons();
|
||||
}
|
||||
});
|
||||
viewer.addPostSelectionChangedListener(event -> 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
|
||||
protected void performDefaults() {
|
||||
if (!Platform.OS_WIN32.equals(Platform.getOS())) {
|
||||
|
@ -652,9 +628,6 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
|||
super.performDefaults();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.preference.PreferencePage#performOk()
|
||||
*/
|
||||
@Override
|
||||
public boolean performOk() {
|
||||
if (!Platform.OS_WIN32.equals(Platform.getOS())) {
|
||||
|
@ -698,9 +671,6 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
|
|||
return super.performOk();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.DialogPage#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
for (Image i : images.values()) {
|
||||
|
|
|
@ -58,10 +58,10 @@ public class OutputStreamMonitor implements IDisposable {
|
|||
private boolean 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
|
||||
private final ListenerList listeners;
|
||||
private final ListenerList<ITerminalServiceOutputStreamMonitorListener> listeners;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -80,7 +80,7 @@ public class OutputStreamMonitor implements IDisposable {
|
|||
|
||||
this.lineSeparator = lineSeparator;
|
||||
|
||||
this.listeners = new ListenerList();
|
||||
this.listeners = new ListenerList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,9 +126,6 @@ public class OutputStreamMonitor implements IDisposable {
|
|||
disposables.remove(disposable);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.services.IDisposable#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
// If already disposed --> return immediately
|
||||
|
@ -160,12 +157,7 @@ public class OutputStreamMonitor implements IDisposable {
|
|||
return;
|
||||
|
||||
// Create a new runnable which is constantly reading from the stream
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
readStream();
|
||||
}
|
||||
};
|
||||
Runnable runnable = () -> readStream();
|
||||
|
||||
// Create the reader thread
|
||||
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.size() > 0) {
|
||||
for (Object candidate : listeners.getListeners()) {
|
||||
if (!(candidate instanceof ITerminalServiceOutputStreamMonitorListener))
|
||||
continue;
|
||||
((ITerminalServiceOutputStreamMonitorListener) candidate).onContentReadFromStream(byteBuffer,
|
||||
bytesRead);
|
||||
for (ITerminalServiceOutputStreamMonitorListener candidate : listeners) {
|
||||
candidate.onContentReadFromStream(byteBuffer, bytesRead);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,16 +49,13 @@ public class TabFolderToolbarHandler extends PlatformObject {
|
|||
// Reference to the selection listener
|
||||
private ToolbarSelectionChangedListener selectionChangedListener;
|
||||
// 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.
|
||||
*/
|
||||
protected class ToolbarSelectionChangedListener implements ISelectionChangedListener {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
|
||||
*/
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
boolean enable = event != null;
|
||||
|
@ -100,9 +97,8 @@ public class TabFolderToolbarHandler extends PlatformObject {
|
|||
*
|
||||
* @return The tab folder or <code>null</code>.
|
||||
*/
|
||||
@SuppressWarnings("cast")
|
||||
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>.
|
||||
*/
|
||||
@SuppressWarnings("cast")
|
||||
public ITerminalViewControl getActiveTerminalViewControl() {
|
||||
ITerminalViewControl terminal = null;
|
||||
|
||||
// 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 we have the active tab item, we can get the active terminal control
|
||||
CTabItem activeTabItem = manager.getActiveTabItem();
|
||||
|
|
|
@ -54,8 +54,6 @@ 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.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
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.nls.Messages;
|
||||
|
@ -167,32 +165,20 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
|||
return draggedTabFolderManager;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.swt.dnd.Transfer#getTypeIds()
|
||||
*/
|
||||
@Override
|
||||
protected int[] getTypeIds() {
|
||||
return new int[] { TYPEID };
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.swt.dnd.Transfer#getTypeNames()
|
||||
*/
|
||||
@Override
|
||||
protected String[] getTypeNames() {
|
||||
return new String[] { TYPE_NAME };
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.swt.dnd.ByteArrayTransfer#javaToNative(java.lang.Object, org.eclipse.swt.dnd.TransferData)
|
||||
*/
|
||||
@Override
|
||||
public void javaToNative(Object data, TransferData transferData) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.swt.dnd.ByteArrayTransfer#nativeToJava(org.eclipse.swt.dnd.TransferData)
|
||||
*/
|
||||
@Override
|
||||
public Object nativeToJava(TransferData transferData) {
|
||||
return null;
|
||||
|
@ -211,12 +197,7 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
|||
*/
|
||||
private void addDragSupport() {
|
||||
// The event listener is registered as filter. It will receive events from all widgets.
|
||||
PlatformUI.getWorkbench().getDisplay().addFilter(SWT.DragDetect, new Listener() {
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
|
||||
*/
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
PlatformUI.getWorkbench().getDisplay().addFilter(SWT.DragDetect, event -> {
|
||||
// Only handle events where a CTabFolder is the source
|
||||
if (!(event.widget instanceof CTabFolder))
|
||||
return;
|
||||
|
@ -264,7 +245,6 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
|||
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
|
||||
public void dispose() {
|
||||
// Dispose the tab folder manager
|
||||
|
@ -356,18 +333,12 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
|
||||
*/
|
||||
@Override
|
||||
public void init(IViewSite site, IMemento memento) throws PartInitException {
|
||||
super.init(site, memento);
|
||||
restoreState(memento);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
public void createPartControl(Composite parent) {
|
||||
// Create the page book control
|
||||
|
@ -666,10 +637,6 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
|||
mementoHandler.restoreState(this, memento);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.part.IShowInTarget#show(org.eclipse.ui.part.ShowInContext)
|
||||
*/
|
||||
@SuppressWarnings("cast")
|
||||
@Override
|
||||
public boolean show(ShowInContext context) {
|
||||
if (context != null) {
|
||||
|
@ -696,7 +663,7 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
|||
boolean isValid = true;
|
||||
|
||||
// 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();
|
||||
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 (isValid) {
|
||||
selection = new StructuredSelection(elements);
|
||||
ICommandService service = (ICommandService) PlatformUI.getWorkbench()
|
||||
.getService(ICommandService.class);
|
||||
ICommandService service = PlatformUI.getWorkbench().getService(ICommandService.class);
|
||||
Command command = service != null
|
||||
? service.getCommand("org.eclipse.tm.terminal.connector.local.command.launch") //$NON-NLS-1$
|
||||
: null;
|
||||
|
@ -790,8 +756,7 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
|
|||
try {
|
||||
ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null);
|
||||
Assert.isNotNull(pCmd);
|
||||
IHandlerService handlerSvc = (IHandlerService) PlatformUI.getWorkbench()
|
||||
.getService(IHandlerService.class);
|
||||
IHandlerService handlerSvc = PlatformUI.getWorkbench().getService(IHandlerService.class);
|
||||
Assert.isNotNull(handlerSvc);
|
||||
IEvaluationContext ctx = handlerSvc.getCurrentState();
|
||||
ctx = new EvaluationContext(ctx, selection);
|
||||
|
|
Loading…
Add table
Reference in a new issue