KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > preferences > SettingsTransferRegistryReader


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  ******************************************************************************/

11
12 package org.eclipse.ui.internal.preferences;
13
14 import java.util.ArrayList JavaDoc;
15 import java.util.Collection JavaDoc;
16
17 import org.eclipse.core.runtime.IConfigurationElement;
18 import org.eclipse.core.runtime.IExtensionRegistry;
19 import org.eclipse.core.runtime.Platform;
20 import org.eclipse.ui.internal.WorkbenchPlugin;
21 import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
22 import org.eclipse.ui.internal.registry.RegistryReader;
23
24 /**
25  * The SettingsTransferRegistryReader is the class that supplies all of the
26  * transfer settings used by the settingsTransfer in the preferencesTransfer
27  * extension point.
28  *
29  *
30  * @since 3.3
31  *
32  */

33 public class SettingsTransferRegistryReader extends RegistryReader {
34
35     Collection JavaDoc settingsTransfers = new ArrayList JavaDoc();
36
37     /**
38      * Create an instance of the receiver.
39      */

40     public SettingsTransferRegistryReader() {
41
42     }
43
44     /**
45      * Get all of the currently registered settings transfers.
46      *
47      * @return IConfigurationElement[]
48      */

49     public IConfigurationElement[] getSettingTransfers() {
50
51         settingsTransfers = new ArrayList JavaDoc();
52         IExtensionRegistry registry = Platform.getExtensionRegistry();
53         readRegistry(registry, WorkbenchPlugin.PI_WORKBENCH,
54                 IWorkbenchRegistryConstants.PL_PREFERENCE_TRANSFER);
55
56         IConfigurationElement[] transfers = new IConfigurationElement[settingsTransfers
57                 .size()];
58         settingsTransfers.toArray(transfers);
59         return transfers;
60
61     }
62
63     /*
64      * (non-Javadoc)
65      *
66      * @see org.eclipse.ui.internal.registry.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
67      */

68     protected boolean readElement(IConfigurationElement element) {
69         if (element.getName().equals(
70                 IWorkbenchRegistryConstants.TAG_SETTINGS_TRANSFER)) {
71
72             settingsTransfers.add(element);
73             return true;
74         }
75
76         //Ignore the preference transfers
77
return element.getName().equals(
78                 IWorkbenchRegistryConstants.TAG_TRANSFER);
79     }
80
81 }
82
Popular Tags