push-to-client 기능은 사용자 간에 IDE 구성을 공유하는 수단을 제공합니다. 개발자는 나중에 이전 IDE 환경을 복원할 수 있도록 자신의 구성을 로컬로 내보낼 수 있습니다. 개발자 팀의 경우 단일 IDE를 설정한 후 push-to-client를 통해 공통 서버에서 해당 IDE를 공유할 수 있습니다. 개발자가 해당 서버에 연결하면 개발자의 IDE를 이전에 내보낸 구성과 자동으로 동기화하게 됩니다. 이러한 방식으로 팀 간에 공통 설정을 공유할 수 있습니다.
com.ibm.etools.systems.pushtoclient.core
org.eclipse.core.resources
org.eclipse.core.runtime
org.eclipse.ui
<extension
point="com.ibm.etools.systems.pushtoclient.core.configurationExtensions">
<configurationExtension
class="p2c.test.ConfigurationExtension1"
description="Custom Elements"
icon="icons/obj.gif"
id="p2c.test.configurationExtension1"
name="Test Extension">
</configurationExtension>
</extension>
각 확장기능에는 class, description, icon, id 및
name이 포함되어야 합니다. 참가 기능은 클래스에
임베드되어 있습니다. 클래스는 IConfigurationExtension을 구현해야 합니다.
대부분의 경우 ConfigurationExtension 구현을 확장하는 것이
좋습니다.package p2c.test;
import com.ibm.etools.systems.pushtoclient.core.extensions.IConfigurationElement;
import com.ibm.etools.systems.pushtoclient.core.extensions.ConfigurationElement;
import com.ibm.etools.systems.pushtoclient.core.extensions.ConfigurationExtension;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IProgressMonitor;
public class ConfigurationExtension1 extends ConfigurationExtension {
public ConfigurationExtension1(String id, String name, String description){
super(id, name, description);
}
public void populateExportElements(IConfigurationElement parent){
parent.setToExport(true);
}
이 경우 사용자에게는 구성 정보를 모두 사용하도록 선택하거나
하나도 사용하지 않도록 선택하는 방법 밖에 없습니다.@Override
public void populateExportElements(
IConfigurationElement parent) {
// folder representing one category of items
ConfigurationElement folderElement = new ConfigurationElement("Element X", "Custom properties X");
parent.add(folderElement);
// contents of first category
ConfigurationElement stuff = new ConfigurationElement("X child element", "");
stuff.setToExport(true);
folderElement.add(stuff);
folderElement.setToExport(true);
// folder representing another category of items
ConfigurationElement folderElement2 = new ConfigurationElement("Element Y", "Custom properties Y");
parent.add(folderElement2);
// contents of the second category
ConfigurationElement thing1 = new ConfigurationElement("Y child element 1", "");
folderElement2.add(thing1);
thing1.setToExport(true);
ConfigurationElement thing2 = new ConfigurationElement("Y child element 2", "");
folderElement2.add(thing2);
folderElement2.setToExport(true);
parent.setToExport(true);
}
push-to-client 마법사를 통해 요소를 내보내는 경우 해당 요소는 다음과 같이 표시됩니다.

이 확장기능에 대한 루트 요소의 이름 및 설명인 Test Extension은 확장점에서 생성되는 반면 하위 요소는 populateExportElements()의 구현을 통해 생성됩니다.
사용자가 내보내기 마법사를 완료하면 exportToCache() 메소드가 호출됩니다. 구성 확장기능의 요소가 제출된 후 선택한 항목에 따라 해당 구성 아티팩트가 제공된 cachedFolder 디렉토리에 특정한 형식으로 저장됩니다. 이 형식은 구현자에 의해 판별됩니다. 이 cachedFolder 디렉토리는 각 구성 확장기능에 대해 고유하며 구성 id를 이름으로 사용합니다.
@Override
public void exportToCache(IConfigurationElement element,
IFolder cacheFolder, IProgressMonitor monitor) {
// find all the elements that are "set to export" and
// then save to the cache folder
if (element.hasChildren()){
IConfigurationElement[] folders = element.getChildren();
for (IConfigurationElement folder: folders){
if (folder.isSetToExport()){
IConfigurationElement[] children = folder.getChildren();
for (IConfigurationElement child: children){
if (child.isSetToExport()){
// store in model for export
...
}
}
}
}
// create file to store exported information
IFile file = cacheFolder.getFile(new Path("test.properties"));
...
}
}
구성을 캐시 디렉토리로 내보낸 후에는 기본 push-to-client 프레임워크에서 나머지 조작을 처리합니다. 로컬 위치로 내보내는 경우 캐시된 정보를 해당 위치에서 아카이브합니다. 공통 서버로 내보내는 경우 변경된 정보를 아카이브하여 해당 서버로 전송합니다.
구성을 가져오는 경우 push-to-client 프레임워크는 먼저 내보낸 구성 아카이브를 Eclipse 작업공간에 다운로드한 후 RemoteSystemsTempFiles 폴더에 아카이브 컨텐츠를 추출합니다. 내보내기와 마찬가지로 가져오기에도 각 구성 확장기능을 위한 캐시된 폴더가 있습니다. 이 폴더는 내보내기에 사용되는 것과 동일한 폴더입니다. 가져오기 마법사는 사용자에게 요소를 가져올 것인지 확인하는 프롬프트를 표시해야 합니다. populateExportElements()와 마찬가지로 각 구성 확장기능은 수신 정보를 표시하는 구성 요소를 작성하여 populateImportElements()를 구현합니다. 이 메소드의 유일한 매개변수는 구성 확장기능을 위한 캐시된 폴더를 리턴하는 요소입니다.
@Override
public void populateImportElements(
IConfigurationElement parent) {
// parent file is the cached folder for this configuration
File parentFile = parent.getFile();
// test.properties is contained in the parent folder
File testFile = new File(parentFile, "test.properties");
// read and parse the file and populate import elements based on contents of testFile
...
가져오기를 수행하면 다음 대화 상자가 표시됩니다. 일반적으로 가져오는 모든 항목이 기본적으로 선택됩니다.

@Override
public void importToWorkspace(IConfigurationElement element,
IProgressMonitor monitor) {
// find all the elements that are "set to export" (same as "set to import")
if (element.hasChildren()){
IConfigurationElement[] folders = element.getChildren();
for (IConfigurationElement folder: folders){
if (folder.isSetToExport()){
IConfigurationElement[] children = folder.getChildren();
for (IConfigurationElement child: children){
if (child.isSetToExport()){
// transfer the corresponding information to the workspace ...
}
}
}
}
}
}