1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 577097: Fix line endings

Some of the o.e.remote files had bad line endings. This
commit standardizes them

Change-Id: I96a2a86752b7a500d2095567f972ba51d194ae92
This commit is contained in:
Jonah Graham 2021-12-14 12:49:29 -05:00
parent 928046e272
commit 2d35961bcd
5 changed files with 755 additions and 755 deletions

View file

@ -1,112 +1,112 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012 Sage Electronic Engineering, LLC. and others. * Copyright (c) 2012 Sage Electronic Engineering, LLC. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Jason Litton (Sage Electronic Engineering, LLC) - initial API and implementation * Jason Litton (Sage Electronic Engineering, LLC) - initial API and implementation
* Greg Watson (IBM) - adapted for remote core * Greg Watson (IBM) - adapted for remote core
*******************************************************************************/ *******************************************************************************/
package org.eclipse.remote.internal.core; package org.eclipse.remote.internal.core;
import java.util.Hashtable; import java.util.Hashtable;
import org.eclipse.osgi.service.debug.DebugOptions; import org.eclipse.osgi.service.debug.DebugOptions;
import org.eclipse.osgi.service.debug.DebugOptionsListener; import org.eclipse.osgi.service.debug.DebugOptionsListener;
import org.eclipse.osgi.service.debug.DebugTrace; import org.eclipse.osgi.service.debug.DebugTrace;
import org.eclipse.osgi.util.NLS; import org.eclipse.osgi.util.NLS;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
/** /**
* Hooks our debug options to the Platform trace functonality. * Hooks our debug options to the Platform trace functonality.
* In essence, we can open Window -> Preferences -> Tracing * In essence, we can open Window -> Preferences -> Tracing
* and turn on debug options for this package. The debug output * and turn on debug options for this package. The debug output
* will come out on the console and can be saved directly to * will come out on the console and can be saved directly to
* a file. Classes that need to be debugged can call into * a file. Classes that need to be debugged can call into
* RemoteDebugOptions to get debug flags. If new flags need to be * RemoteDebugOptions to get debug flags. If new flags need to be
* created, they will need to have a unique identifier and added to * created, they will need to have a unique identifier and added to
* the .options file in this plugin * the .options file in this plugin
*/ */
public class RemoteDebugOptions implements DebugOptionsListener { public class RemoteDebugOptions implements DebugOptionsListener {
public static final String DEBUG_REMOTE_COMMANDS = "/debug/commands"; //$NON-NLS-1$ public static final String DEBUG_REMOTE_COMMANDS = "/debug/commands"; //$NON-NLS-1$
private static DebugTrace fDebugTrace; private static DebugTrace fDebugTrace;
private static DebugOptions fDebugOptions; private static DebugOptions fDebugOptions;
private static RemoteDebugOptions fRemoteDebugOptions; private static RemoteDebugOptions fRemoteDebugOptions;
public static void configure(BundleContext context) { public static void configure(BundleContext context) {
if (fRemoteDebugOptions == null) { if (fRemoteDebugOptions == null) {
fRemoteDebugOptions = new RemoteDebugOptions(context); fRemoteDebugOptions = new RemoteDebugOptions(context);
} }
} }
private RemoteDebugOptions(BundleContext context) { private RemoteDebugOptions(BundleContext context) {
Hashtable<String, String> props = new Hashtable<String, String>(2); Hashtable<String, String> props = new Hashtable<String, String>(2);
props.put(DebugOptions.LISTENER_SYMBOLICNAME, RemoteCorePlugin.getUniqueIdentifier()); props.put(DebugOptions.LISTENER_SYMBOLICNAME, RemoteCorePlugin.getUniqueIdentifier());
context.registerService(DebugOptionsListener.class.getName(), this, props); context.registerService(DebugOptionsListener.class.getName(), this, props);
} }
@Override @Override
public void optionsChanged(DebugOptions options) { public void optionsChanged(DebugOptions options) {
fDebugOptions = options; fDebugOptions = options;
fDebugTrace = options.newDebugTrace(RemoteCorePlugin.getUniqueIdentifier()); fDebugTrace = options.newDebugTrace(RemoteCorePlugin.getUniqueIdentifier());
} }
public static boolean isDebugging() { public static boolean isDebugging() {
return RemoteCorePlugin.getDefault().isDebugging(); return RemoteCorePlugin.getDefault().isDebugging();
} }
public static boolean isDebugging(String option) { public static boolean isDebugging(String option) {
if (fDebugOptions == null) { if (fDebugOptions == null) {
return false; return false;
} }
return fDebugOptions.getBooleanOption(RemoteCorePlugin.getUniqueIdentifier() + option, false); return fDebugOptions.getBooleanOption(RemoteCorePlugin.getUniqueIdentifier() + option, false);
} }
public static void setDebugging(String option, boolean value) { public static void setDebugging(String option, boolean value) {
if (fDebugOptions != null) { if (fDebugOptions != null) {
if (value) { if (value) {
fDebugOptions.setDebugEnabled(true); fDebugOptions.setDebugEnabled(true);
} }
fDebugOptions.setOption(option, Boolean.toString(value)); fDebugOptions.setOption(option, Boolean.toString(value));
} }
} }
/** /**
* Prints the given message to System.out and to the OSGi tracing (if enabled) * Prints the given message to System.out and to the OSGi tracing (if enabled)
* *
* @param message * @param message
* the message or <code>null</code> * the message or <code>null</code>
*/ */
public static void trace(String message) { public static void trace(String message) {
trace(null, message); trace(null, message);
} }
/** /**
* Prints the given message to System.out and to the OSGi tracing (if enabled) * Prints the given message to System.out and to the OSGi tracing (if enabled)
* *
* @param option * @param option
* the option to determine if tracing is displayed * the option to determine if tracing is displayed
* @param message * @param message
* the message or <code>null</code> * the message or <code>null</code>
* @param arguments * @param arguments
* optional arguments for the message or <code>null</code> * optional arguments for the message or <code>null</code>
*/ */
public static void trace(String option, String message, String... arguments) { public static void trace(String option, String message, String... arguments) {
String traceMsg = message; String traceMsg = message;
if (arguments.length > 0) { if (arguments.length > 0) {
traceMsg = NLS.bind(message, arguments); traceMsg = NLS.bind(message, arguments);
} }
if ((option != null && isDebugging(option)) || isDebugging()) { if ((option != null && isDebugging(option)) || isDebugging()) {
System.out.println(traceMsg); System.out.println(traceMsg);
if (fDebugTrace != null) { if (fDebugTrace != null) {
fDebugTrace.trace(option, traceMsg, null); fDebugTrace.trace(option, traceMsg, null);
} }
} }
} }
} }

View file

@ -1,28 +1,28 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012 IBM Corporation and others. * Copyright (c) 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM - Initial API and implementation * IBM - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.remote.internal.core.preferences; package org.eclipse.remote.internal.core.preferences;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.remote.core.IRemotePreferenceConstants; import org.eclipse.remote.core.IRemotePreferenceConstants;
/** /**
* Class used to initialize default preference values. * Class used to initialize default preference values.
* *
* @since 6.0 * @since 6.0
*/ */
public class PreferenceInitializer extends AbstractPreferenceInitializer { public class PreferenceInitializer extends AbstractPreferenceInitializer {
@Override @Override
public void initializeDefaultPreferences() { public void initializeDefaultPreferences() {
Preferences.setDefaultString(IRemotePreferenceConstants.PREF_CONNECTION_TYPE_ID, "org.eclipse.remote.JSch"); //$NON-NLS-1$ Preferences.setDefaultString(IRemotePreferenceConstants.PREF_CONNECTION_TYPE_ID, "org.eclipse.remote.JSch"); //$NON-NLS-1$
} }
} }

View file

@ -1,491 +1,491 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2011 IBM Corporation and others. * Copyright (c) 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.remote.internal.core.preferences; package org.eclipse.remote.internal.core.preferences;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.DefaultScope; import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
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.remote.internal.core.RemoteCorePlugin; import org.eclipse.remote.internal.core.RemoteCorePlugin;
import org.osgi.service.prefs.BackingStoreException; import org.osgi.service.prefs.BackingStoreException;
/** /**
* Convenience class to facilitate using the new {@link IEclipsePreferences} story. Adapted from * Convenience class to facilitate using the new {@link IEclipsePreferences} story. Adapted from
* org.eclipse.debug.internal.core.Preferences. * org.eclipse.debug.internal.core.Preferences.
* *
* @since 5.0 * @since 5.0
* @noinstantiate This class is not intended to be instantiated by clients. * @noinstantiate This class is not intended to be instantiated by clients.
*/ */
public final class Preferences { public final class Preferences {
private static final IScopeContext[] contexts = new IScopeContext[] { DefaultScope.INSTANCE, InstanceScope.INSTANCE }; private static final IScopeContext[] contexts = new IScopeContext[] { DefaultScope.INSTANCE, InstanceScope.INSTANCE };
private static final int DEFAULT_CONTEXT = 0; private static final int DEFAULT_CONTEXT = 0;
private static final int INSTANCE_CONTEXT = 1; private static final int INSTANCE_CONTEXT = 1;
private static final String fQualifier = RemoteCorePlugin.getUniqueIdentifier(); private static final String fQualifier = RemoteCorePlugin.getUniqueIdentifier();
/** /**
* Adds the given preference listener to the {@link DefaultScope} and the {@link InstanceScope} * Adds the given preference listener to the {@link DefaultScope} and the {@link InstanceScope}
* *
* @param listener * @param listener
*/ */
public static void addPreferenceChangeListener(IPreferenceChangeListener listener) { public static void addPreferenceChangeListener(IPreferenceChangeListener listener) {
contexts[DEFAULT_CONTEXT].getNode(fQualifier).addPreferenceChangeListener(listener); contexts[DEFAULT_CONTEXT].getNode(fQualifier).addPreferenceChangeListener(listener);
contexts[INSTANCE_CONTEXT].getNode(fQualifier).addPreferenceChangeListener(listener); contexts[INSTANCE_CONTEXT].getNode(fQualifier).addPreferenceChangeListener(listener);
} }
/** /**
* Returns whether the named preference is know in the preference store. * Returns whether the named preference is know in the preference store.
* *
* @param name * @param name
* @return * @return
*/ */
public static boolean contains(String name) { public static boolean contains(String name) {
return (contexts[INSTANCE_CONTEXT].getNode(fQualifier).get(name, null) != null || contexts[DEFAULT_CONTEXT].getNode( return (contexts[INSTANCE_CONTEXT].getNode(fQualifier).get(name, null) != null || contexts[DEFAULT_CONTEXT].getNode(
fQualifier).get(name, null) != null); fQualifier).get(name, null) != null);
} }
/** /**
* Returns the value in the preference store for the given key. If the key * Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope * is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value. * lookup order for finding the preference value.
* *
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the value of the preference or the given default value * @return the value of the preference or the given default value
*/ */
public static boolean getBoolean(String key) { public static boolean getBoolean(String key) {
return Platform.getPreferencesService().getBoolean(fQualifier, key, false, null); return Platform.getPreferencesService().getBoolean(fQualifier, key, false, null);
} }
/** /**
* Returns the value in the preference store for the given key. If the key * Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope * is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value. * lookup order for finding the preference value.
* *
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the value of the preference or the given default value * @return the value of the preference or the given default value
*/ */
public static byte[] getByteArray(String key) { public static byte[] getByteArray(String key) {
return Platform.getPreferencesService().getByteArray(fQualifier, key, null, null); return Platform.getPreferencesService().getByteArray(fQualifier, key, null, null);
} }
/** /**
* Returns the default boolean value stored in the {@link DefaultScope} for * Returns the default boolean value stored in the {@link DefaultScope} for
* the given key or the specified default value if the key does not appear * the given key or the specified default value if the key does not appear
* in the {@link DefaultScope} * in the {@link DefaultScope}
* *
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the boolean value set in the {@link DefaultScope} for the given * @return the boolean value set in the {@link DefaultScope} for the given
* key, or the specified default value. * key, or the specified default value.
*/ */
public static synchronized boolean getDefaultBoolean(String key, boolean defaultvalue) { public static synchronized boolean getDefaultBoolean(String key, boolean defaultvalue) {
return contexts[DEFAULT_CONTEXT].getNode(fQualifier).getBoolean(key, defaultvalue); return contexts[DEFAULT_CONTEXT].getNode(fQualifier).getBoolean(key, defaultvalue);
} }
/** /**
* Returns the default byte array value stored in the {@link DefaultScope} for the given key or the specified default value if * Returns the default byte array value stored in the {@link DefaultScope} for the given key or the specified default value if
* the key does not * the key does not
* appear in the {@link DefaultScope} * appear in the {@link DefaultScope}
* *
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the byte array value set in the {@link DefaultScope} for the * @return the byte array value set in the {@link DefaultScope} for the
* given key, or the specified default value. * given key, or the specified default value.
*/ */
public static synchronized byte[] getDefaultByteArray(String key, byte[] defaultvalue) { public static synchronized byte[] getDefaultByteArray(String key, byte[] defaultvalue) {
return contexts[DEFAULT_CONTEXT].getNode(fQualifier).getByteArray(key, defaultvalue); return contexts[DEFAULT_CONTEXT].getNode(fQualifier).getByteArray(key, defaultvalue);
} }
/** /**
* Returns the default double value stored in the {@link DefaultScope} for * Returns the default double value stored in the {@link DefaultScope} for
* the given key or the specified default value if the key does not appear * the given key or the specified default value if the key does not appear
* in the {@link DefaultScope} * in the {@link DefaultScope}
* *
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the double value set in the {@link DefaultScope} for the given * @return the double value set in the {@link DefaultScope} for the given
* key, or the specified default value. * key, or the specified default value.
*/ */
public static synchronized double getDefaultDouble(String key, double defaultvalue) { public static synchronized double getDefaultDouble(String key, double defaultvalue) {
return contexts[DEFAULT_CONTEXT].getNode(fQualifier).getDouble(key, defaultvalue); return contexts[DEFAULT_CONTEXT].getNode(fQualifier).getDouble(key, defaultvalue);
} }
/** /**
* Returns the default float value stored in the {@link DefaultScope} for * Returns the default float value stored in the {@link DefaultScope} for
* the given key or the specified default value if the key does not appear * the given key or the specified default value if the key does not appear
* in the {@link DefaultScope} * in the {@link DefaultScope}
* *
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the float value set in the {@link DefaultScope} for the given * @return the float value set in the {@link DefaultScope} for the given
* key, or the specified default value. * key, or the specified default value.
*/ */
public static synchronized float getDefaultFloat(String key, float defaultvalue) { public static synchronized float getDefaultFloat(String key, float defaultvalue) {
return contexts[DEFAULT_CONTEXT].getNode(fQualifier).getFloat(key, defaultvalue); return contexts[DEFAULT_CONTEXT].getNode(fQualifier).getFloat(key, defaultvalue);
} }
/** /**
* Returns the default integer value stored in the {@link DefaultScope} for * Returns the default integer value stored in the {@link DefaultScope} for
* the given key or the specified default value if the key does not appear * the given key or the specified default value if the key does not appear
* in the {@link DefaultScope} * in the {@link DefaultScope}
* *
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the integer value set in the {@link DefaultScope} for the given * @return the integer value set in the {@link DefaultScope} for the given
* key, or the specified default value. * key, or the specified default value.
*/ */
public static synchronized int getDefaultInt(String key, int defaultvalue) { public static synchronized int getDefaultInt(String key, int defaultvalue) {
return contexts[DEFAULT_CONTEXT].getNode(fQualifier).getInt(key, defaultvalue); return contexts[DEFAULT_CONTEXT].getNode(fQualifier).getInt(key, defaultvalue);
} }
/** /**
* Returns the default long value stored in the {@link DefaultScope} for the * Returns the default long value stored in the {@link DefaultScope} for the
* given key or the specified default value if the key does not appear in * given key or the specified default value if the key does not appear in
* the {@link DefaultScope} * the {@link DefaultScope}
* *
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the long value set in the {@link DefaultScope} for the given key, * @return the long value set in the {@link DefaultScope} for the given key,
* or the specified default value. * or the specified default value.
*/ */
public static synchronized long getDefaultLong(String key, long defaultvalue) { public static synchronized long getDefaultLong(String key, long defaultvalue) {
return contexts[DEFAULT_CONTEXT].getNode(fQualifier).getLong(key, defaultvalue); return contexts[DEFAULT_CONTEXT].getNode(fQualifier).getLong(key, defaultvalue);
} }
/** /**
* Returns the default string value stored in the {@link DefaultScope} for * Returns the default string value stored in the {@link DefaultScope} for
* the given key or the specified default value if the key does not appear * the given key or the specified default value if the key does not appear
* in the {@link DefaultScope} * in the {@link DefaultScope}
* *
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the string value set in the {@link DefaultScope} for the given * @return the string value set in the {@link DefaultScope} for the given
* key, or the specified default value. * key, or the specified default value.
*/ */
public static synchronized String getDefaultString(String key, String defaultvalue) { public static synchronized String getDefaultString(String key, String defaultvalue) {
return contexts[DEFAULT_CONTEXT].getNode(fQualifier).get(key, defaultvalue); return contexts[DEFAULT_CONTEXT].getNode(fQualifier).get(key, defaultvalue);
} }
/** /**
* Returns the value in the preference store for the given key. If the key * Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope * is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value. * lookup order for finding the preference value.
* *
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the value of the preference or the given default value * @return the value of the preference or the given default value
*/ */
public static double getDouble(String key) { public static double getDouble(String key) {
return Platform.getPreferencesService().getDouble(fQualifier, key, 0.0, null); return Platform.getPreferencesService().getDouble(fQualifier, key, 0.0, null);
} }
/** /**
* Returns the value in the preference store for the given key. If the key * Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope * is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value. * lookup order for finding the preference value.
* *
* @param fQualifier * @param fQualifier
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the value of the preference or the given default value * @return the value of the preference or the given default value
*/ */
public static float getFloat(String key) { public static float getFloat(String key) {
return Platform.getPreferencesService().getFloat(fQualifier, key, 0.0f, null); return Platform.getPreferencesService().getFloat(fQualifier, key, 0.0f, null);
} }
/** /**
* Returns the value in the preference store for the given key. If the key * Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope * is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value. * lookup order for finding the preference value.
* *
* @param fQualifier * @param fQualifier
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the value of the preference or the given default value * @return the value of the preference or the given default value
*/ */
public static int getInt(String key) { public static int getInt(String key) {
return Platform.getPreferencesService().getInt(fQualifier, key, 0, null); return Platform.getPreferencesService().getInt(fQualifier, key, 0, null);
} }
/** /**
* Returns the value in the preference store for the given key. If the key * Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope * is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value. * lookup order for finding the preference value.
* *
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the value of the preference or the given default value * @return the value of the preference or the given default value
*/ */
public static long getLong(String key) { public static long getLong(String key) {
return Platform.getPreferencesService().getLong(fQualifier, key, 0L, null); return Platform.getPreferencesService().getLong(fQualifier, key, 0L, null);
} }
/** /**
* Returns the value in the preference store for the given key. If the key * Returns the value in the preference store for the given key. If the key
* is not defined then return the default value. Use the canonical scope * is not defined then return the default value. Use the canonical scope
* lookup order for finding the preference value. * lookup order for finding the preference value.
* *
* @param key * @param key
* @param defaultvalue * @param defaultvalue
* *
* @return the value of the preference or the given default value * @return the value of the preference or the given default value
*/ */
public static String getString(String key) { public static String getString(String key) {
return Platform.getPreferencesService().getString(fQualifier, key, null, null); return Platform.getPreferencesService().getString(fQualifier, key, null, null);
} }
/** /**
* Returns true if the named preference has the default value. * Returns true if the named preference has the default value.
* *
* @param name * @param name
* @return * @return
*/ */
public static boolean isDefault(String name) { public static boolean isDefault(String name) {
String defVal = contexts[DEFAULT_CONTEXT].getNode(fQualifier).get(name, null); String defVal = contexts[DEFAULT_CONTEXT].getNode(fQualifier).get(name, null);
if (defVal != null) { if (defVal != null) {
String val = contexts[INSTANCE_CONTEXT].getNode(fQualifier).get(name, null); String val = contexts[INSTANCE_CONTEXT].getNode(fQualifier).get(name, null);
return (val != null && val.equals(defVal)); return (val != null && val.equals(defVal));
} }
return false; return false;
} }
/** /**
* Removes the given preference listener from the {@link DefaultScope} and * Removes the given preference listener from the {@link DefaultScope} and
* the {@link InstanceScope} * the {@link InstanceScope}
* *
* @param listener * @param listener
*/ */
public static void removePreferenceChangeListener(IPreferenceChangeListener listener) { public static void removePreferenceChangeListener(IPreferenceChangeListener listener) {
contexts[DEFAULT_CONTEXT].getNode(fQualifier).removePreferenceChangeListener(listener); contexts[DEFAULT_CONTEXT].getNode(fQualifier).removePreferenceChangeListener(listener);
contexts[INSTANCE_CONTEXT].getNode(fQualifier).removePreferenceChangeListener(listener); contexts[INSTANCE_CONTEXT].getNode(fQualifier).removePreferenceChangeListener(listener);
} }
/** /**
* Save the preferences for the given plugin identifier. It should be noted * Save the preferences for the given plugin identifier. It should be noted
* that all pending preference changes will be flushed with this method. * that all pending preference changes will be flushed with this method.
*/ */
public static synchronized void savePreferences() { public static synchronized void savePreferences() {
try { try {
contexts[DEFAULT_CONTEXT].getNode(fQualifier).flush(); contexts[DEFAULT_CONTEXT].getNode(fQualifier).flush();
contexts[INSTANCE_CONTEXT].getNode(fQualifier).flush(); contexts[INSTANCE_CONTEXT].getNode(fQualifier).flush();
} catch (BackingStoreException bse) { } catch (BackingStoreException bse) {
RemoteCorePlugin.log(bse); RemoteCorePlugin.log(bse);
} }
} }
/** /**
* Sets a boolean preference in the {@link InstanceScope}. * Sets a boolean preference in the {@link InstanceScope}.
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the value * the value
*/ */
public static synchronized void setBoolean(String key, boolean value) { public static synchronized void setBoolean(String key, boolean value) {
contexts[INSTANCE_CONTEXT].getNode(fQualifier).putBoolean(key, value); contexts[INSTANCE_CONTEXT].getNode(fQualifier).putBoolean(key, value);
} }
/** /**
* Sets a byte array preference in the {@link InstanceScope}. * Sets a byte array preference in the {@link InstanceScope}.
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the value * the value
*/ */
public static synchronized void setByteArray(String key, byte[] value) { public static synchronized void setByteArray(String key, byte[] value) {
contexts[INSTANCE_CONTEXT].getNode(fQualifier).putByteArray(key, value); contexts[INSTANCE_CONTEXT].getNode(fQualifier).putByteArray(key, value);
} }
/** /**
* Sets a boolean in the {@link DefaultScope} * Sets a boolean in the {@link DefaultScope}
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the new value * the new value
*/ */
public static synchronized void setDefaultBoolean(String key, boolean value) { public static synchronized void setDefaultBoolean(String key, boolean value) {
contexts[DEFAULT_CONTEXT].getNode(fQualifier).putBoolean(key, value); contexts[DEFAULT_CONTEXT].getNode(fQualifier).putBoolean(key, value);
} }
/** /**
* Sets a byte array in the {@link DefaultScope} * Sets a byte array in the {@link DefaultScope}
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the new value * the new value
*/ */
public static synchronized void setDefaultByteArray(String key, byte[] value) { public static synchronized void setDefaultByteArray(String key, byte[] value) {
contexts[DEFAULT_CONTEXT].getNode(fQualifier).putByteArray(key, value); contexts[DEFAULT_CONTEXT].getNode(fQualifier).putByteArray(key, value);
} }
/** /**
* Sets a double in the {@link DefaultScope} * Sets a double in the {@link DefaultScope}
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the new value * the new value
*/ */
public static synchronized void setDefaultDouble(String key, double value) { public static synchronized void setDefaultDouble(String key, double value) {
contexts[DEFAULT_CONTEXT].getNode(fQualifier).putDouble(key, value); contexts[DEFAULT_CONTEXT].getNode(fQualifier).putDouble(key, value);
} }
/** /**
* Sets a float in the {@link DefaultScope} * Sets a float in the {@link DefaultScope}
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the new value * the new value
*/ */
public static synchronized void setDefaultFloat(String key, float value) { public static synchronized void setDefaultFloat(String key, float value) {
contexts[DEFAULT_CONTEXT].getNode(fQualifier).putFloat(key, value); contexts[DEFAULT_CONTEXT].getNode(fQualifier).putFloat(key, value);
} }
/** /**
* Sets a integer in the {@link DefaultScope} * Sets a integer in the {@link DefaultScope}
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the new value * the new value
*/ */
public static synchronized void setDefaultInt(String key, int value) { public static synchronized void setDefaultInt(String key, int value) {
contexts[DEFAULT_CONTEXT].getNode(fQualifier).putInt(key, value); contexts[DEFAULT_CONTEXT].getNode(fQualifier).putInt(key, value);
} }
/** /**
* Sets a long in the {@link DefaultScope} * Sets a long in the {@link DefaultScope}
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the new value * the new value
*/ */
public static synchronized void setDefaultLong(String key, long value) { public static synchronized void setDefaultLong(String key, long value) {
contexts[DEFAULT_CONTEXT].getNode(fQualifier).putLong(key, value); contexts[DEFAULT_CONTEXT].getNode(fQualifier).putLong(key, value);
} }
/** /**
* Sets a string in the {@link DefaultScope} * Sets a string in the {@link DefaultScope}
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the new value * the new value
*/ */
public static synchronized void setDefaultString(String key, String value) { public static synchronized void setDefaultString(String key, String value) {
contexts[DEFAULT_CONTEXT].getNode(fQualifier).put(key, value); contexts[DEFAULT_CONTEXT].getNode(fQualifier).put(key, value);
} }
/** /**
* Sets a double preference in the {@link InstanceScope}. * Sets a double preference in the {@link InstanceScope}.
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the value * the value
*/ */
public static synchronized void setDouble(String key, double value) { public static synchronized void setDouble(String key, double value) {
contexts[INSTANCE_CONTEXT].getNode(fQualifier).putDouble(key, value); contexts[INSTANCE_CONTEXT].getNode(fQualifier).putDouble(key, value);
} }
/** /**
* Sets a float preference in the {@link InstanceScope}. * Sets a float preference in the {@link InstanceScope}.
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the value * the value
*/ */
public static synchronized void setFloat(String key, float value) { public static synchronized void setFloat(String key, float value) {
contexts[INSTANCE_CONTEXT].getNode(fQualifier).putFloat(key, value); contexts[INSTANCE_CONTEXT].getNode(fQualifier).putFloat(key, value);
} }
/** /**
* Sets a integer preference in the {@link InstanceScope}. * Sets a integer preference in the {@link InstanceScope}.
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the value * the value
*/ */
public static synchronized void setInt(String key, int value) { public static synchronized void setInt(String key, int value) {
contexts[INSTANCE_CONTEXT].getNode(fQualifier).putInt(key, value); contexts[INSTANCE_CONTEXT].getNode(fQualifier).putInt(key, value);
} }
/** /**
* Sets a long preference in the {@link InstanceScope}. * Sets a long preference in the {@link InstanceScope}.
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the value * the value
*/ */
public static synchronized void setLong(String key, long value) { public static synchronized void setLong(String key, long value) {
contexts[INSTANCE_CONTEXT].getNode(fQualifier).putLong(key, value); contexts[INSTANCE_CONTEXT].getNode(fQualifier).putLong(key, value);
} }
/** /**
* Sets a string preference in the {@link InstanceScope}. * Sets a string preference in the {@link InstanceScope}.
* *
* @param key * @param key
* the key * the key
* @param value * @param value
* the value * the value
*/ */
public static synchronized void setString(String key, String value) { public static synchronized void setString(String key, String value) {
contexts[INSTANCE_CONTEXT].getNode(fQualifier).put(key, value); contexts[INSTANCE_CONTEXT].getNode(fQualifier).put(key, value);
} }
/** /**
* Sets the given preference to its default value. This is done by removing * Sets the given preference to its default value. This is done by removing
* any set value from the {@link InstanceScope}. Has no effect if the given * any set value from the {@link InstanceScope}. Has no effect if the given
* key is <code>null</code>. * key is <code>null</code>.
* *
* @param key * @param key
* the key for the preference * the key for the preference
*/ */
public static synchronized void setToDefault(String key) { public static synchronized void setToDefault(String key) {
if (key != null) { if (key != null) {
contexts[INSTANCE_CONTEXT].getNode(fQualifier).remove(key); contexts[INSTANCE_CONTEXT].getNode(fQualifier).remove(key);
} }
} }
/** /**
* Constructor * Constructor
*/ */
private Preferences() { private Preferences() {
// no direct instantiation // no direct instantiation
} }
} }

View file

@ -1,62 +1,62 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012 IBM Corporation and others. * Copyright (c) 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM - Initial API and implementation * IBM - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.remote.internal.ui.preferences; package org.eclipse.remote.internal.ui.preferences;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.jface.preference.ComboFieldEditor; import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.remote.core.IRemoteConnectionType; import org.eclipse.remote.core.IRemoteConnectionType;
import org.eclipse.remote.core.IRemotePreferenceConstants; import org.eclipse.remote.core.IRemotePreferenceConstants;
import org.eclipse.remote.core.IRemoteServicesManager; import org.eclipse.remote.core.IRemoteServicesManager;
import org.eclipse.remote.internal.ui.RemoteUIPlugin; import org.eclipse.remote.internal.ui.RemoteUIPlugin;
import org.eclipse.remote.internal.ui.messages.Messages; import org.eclipse.remote.internal.ui.messages.Messages;
import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.IWorkbenchPreferencePage;
/** /**
* @since 4.1 * @since 4.1
* *
*/ */
public class RemoteDevelopmentPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { public class RemoteDevelopmentPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
public RemoteDevelopmentPreferencePage() { public RemoteDevelopmentPreferencePage() {
super(GRID); super(GRID);
setPreferenceStore(new PreferencesAdapter()); setPreferenceStore(new PreferencesAdapter());
} }
@Override @Override
public void init(IWorkbench workbench) { public void init(IWorkbench workbench) {
// Do nothing // Do nothing
} }
@Override @Override
protected void createFieldEditors() { protected void createFieldEditors() {
List<String[]> namesAndValues = new ArrayList<String[]>(); List<String[]> namesAndValues = new ArrayList<String[]>();
String[] nameAndValue = new String[2]; String[] nameAndValue = new String[2];
nameAndValue[0] = "None"; //$NON-NLS-1$ nameAndValue[0] = "None"; //$NON-NLS-1$
nameAndValue[1] = ""; //$NON-NLS-1$ nameAndValue[1] = ""; //$NON-NLS-1$
namesAndValues.add(nameAndValue); namesAndValues.add(nameAndValue);
IRemoteServicesManager manager = RemoteUIPlugin.getService(IRemoteServicesManager.class); IRemoteServicesManager manager = RemoteUIPlugin.getService(IRemoteServicesManager.class);
for (IRemoteConnectionType service : manager.getRemoteConnectionTypes()) { for (IRemoteConnectionType service : manager.getRemoteConnectionTypes()) {
nameAndValue = new String[2]; nameAndValue = new String[2];
nameAndValue[0] = service.getName(); nameAndValue[0] = service.getName();
nameAndValue[1] = service.getId(); nameAndValue[1] = service.getId();
namesAndValues.add(nameAndValue); namesAndValues.add(nameAndValue);
} }
addField(new ComboFieldEditor(IRemotePreferenceConstants.PREF_CONNECTION_TYPE_ID, addField(new ComboFieldEditor(IRemotePreferenceConstants.PREF_CONNECTION_TYPE_ID,
Messages.RemoteDevelopmentPreferencePage_Default_connection_type, namesAndValues.toArray(new String[namesAndValues Messages.RemoteDevelopmentPreferencePage_Default_connection_type, namesAndValues.toArray(new String[namesAndValues
.size()][2]), getFieldEditorParent())); .size()][2]), getFieldEditorParent()));
} }
} }

View file

@ -1,62 +1,62 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2015 QNX Software Systems and others. * Copyright (c) 2015 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Doug Schaefer * Doug Schaefer
*******************************************************************************/ *******************************************************************************/
package org.eclipse.remote.internal.ui.views; package org.eclipse.remote.internal.ui.views;
import org.eclipse.jface.wizard.Wizard; import org.eclipse.jface.wizard.Wizard;
import org.eclipse.remote.core.IRemoteConnectionWorkingCopy; import org.eclipse.remote.core.IRemoteConnectionWorkingCopy;
import org.eclipse.remote.core.exception.RemoteConnectionException; import org.eclipse.remote.core.exception.RemoteConnectionException;
import org.eclipse.remote.internal.ui.Messages; import org.eclipse.remote.internal.ui.Messages;
import org.eclipse.remote.internal.ui.RemoteUIPlugin; import org.eclipse.remote.internal.ui.RemoteUIPlugin;
import org.eclipse.remote.ui.IRemoteUIConnectionWizard; import org.eclipse.remote.ui.IRemoteUIConnectionWizard;
/** /**
* @since 2.0 * @since 2.0
*/ */
public class NewRemoteConnectionWizard extends Wizard { public class NewRemoteConnectionWizard extends Wizard {
private final NewRemoteConnectionTypePage typePage; private final NewRemoteConnectionTypePage typePage;
public NewRemoteConnectionWizard() { public NewRemoteConnectionWizard() {
setWindowTitle(Messages.NewRemoteConnectionWizard_0); setWindowTitle(Messages.NewRemoteConnectionWizard_0);
typePage = new NewRemoteConnectionTypePage(); typePage = new NewRemoteConnectionTypePage();
setForcePreviousAndNextButtons(true); setForcePreviousAndNextButtons(true);
} }
@Override @Override
public void addPages() { public void addPages() {
addPage(typePage); addPage(typePage);
} }
@Override @Override
public boolean performFinish() { public boolean performFinish() {
IRemoteUIConnectionWizard nextWizard = typePage.getNextWizard(); IRemoteUIConnectionWizard nextWizard = typePage.getNextWizard();
if (nextWizard != null) { if (nextWizard != null) {
IRemoteConnectionWorkingCopy wc = nextWizard.getConnection(); IRemoteConnectionWorkingCopy wc = nextWizard.getConnection();
try { try {
wc.save(); wc.save();
} catch (RemoteConnectionException e) { } catch (RemoteConnectionException e) {
RemoteUIPlugin.log(e); RemoteUIPlugin.log(e);
return false; return false;
} }
return true; return true;
} else { } else {
// what happened? // what happened?
return false; return false;
} }
} }
@Override @Override
public boolean canFinish() { public boolean canFinish() {
// don't allow to finish since we need to activate actual connection wizard page // don't allow to finish since we need to activate actual connection wizard page
return false; return false;
} }
} }