Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 455781fa88992a17ec14a0dd34a0600f06bccd53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*******************************************************************************
 * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
 * This program and the accompanying materials are made available under the terms
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
 * available at http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.tcf.te.ui.startup.internal;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.IStartup;
import org.eclipse.ui.PlatformUI;

/**
 * Set the default TCF CDT plugin preferences
 */
@SuppressWarnings("restriction")
public class StartupPreferencesInitializer extends AbstractPreferenceInitializer implements IStartup {

    /* (non-Javadoc)
     * @see org.eclipse.ui.IStartup#earlyStartup()
     */
    @Override
    public void earlyStartup() {
        PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {

            @Override
            public void run() {
                initializeDefaultPreferences();
            }
        });
    }

    /* (non-Javadoc)
     * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
     */
    @Override
    public void initializeDefaultPreferences() {

        // "TCF Remote Application" launch is hidden by default.
        // No longer supported or maintained.
        IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
        if (store != null) {
            store.setDefault(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_TYPES, true);

            boolean added = false;
            String typeId = "org.eclipse.tcf.cdt.launch.remoteApplicationLaunchType"; //$NON-NLS-1$

            String typeList = store.getDefaultString(IInternalDebugUIConstants.PREF_FILTER_TYPE_LIST);
            if ("".equals(typeList)) { //$NON-NLS-1$
                typeList = typeId;
                added = true;
            } else if (!typeList.contains(typeId)) {
                typeList = typeList + "," + typeId; //$NON-NLS-1$
                added = true;
            }
            if (added) {
                store.setDefault(IInternalDebugUIConstants.PREF_FILTER_TYPE_LIST, typeList);
            }
        }
    }

}

Back to the top