From a80dc1c7acbcb13663b592656f3f662980326a75 Mon Sep 17 00:00:00 2001 From: "donghyuk.yang" Date: Wed, 30 Apr 2014 18:48:07 +0900 Subject: [PATCH] BUILD: SYNC: Support to synchronize projects and modified some modules - Remove a remote project if it does not exists in local when connecting server. - Remove a remote project when user removes a local project. - Pass real BUILD_TYPE value (not environment format) when building a project. - Support to manage GBS option in windows. - Hide tab border in Package manager. Change-Id: I3b279d2cda37ecb64d4edbbe0bde074a16474edd Signed-off-by: donghyuk.yang --- .../src/org/tizen/nativeplatform/Activator.java | 5 ++ .../build/PlatformExternalBuildRunner.java | 34 +++++++++ .../build/gbs/GBSBuildCommandProvider.java | 26 +++++-- .../build/gbs/GBSBuildResultProcessor.java | 6 +- .../command/launcher/HostCommandLauncher.java | 11 +++ .../tizen/nativeplatform/gbs/GBSOptionManager.java | 16 +++- .../nativeplatform/pkgmgr/ui/RPMPackageDialog.java | 4 +- .../remote/connection/WorkspaceSyncronizer.java | 30 +------- .../nativeplatform/util/PlatformProjectUtil.java | 24 +++++- .../tizen/nativeplatform/util/RootstrapUtil.java | 8 +- .../nativeplatform/views/ui/RootstrapView.java | 86 +++++++++++++++++++++- 11 files changed, 207 insertions(+), 43 deletions(-) diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/Activator.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/Activator.java index 247bab1..36e0d5d 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/Activator.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/Activator.java @@ -27,6 +27,8 @@ package org.tizen.nativeplatform; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; @@ -69,6 +71,9 @@ public class Activator extends AbstractUIPlugin { PlatformProjectDependentPackager.getInstance(), true); PreferencesManager.setDefaultValues(); CommandUtil.clearPlatformTempDir(); + PlatformResourceChangeListener listener = new PlatformResourceChangeListener(); + ResourcesPlugin.getWorkspace().addResourceChangeListener( + listener, IResourceChangeEvent.PRE_DELETE); } /* diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformExternalBuildRunner.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformExternalBuildRunner.java index 2704486..5f45cbc 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformExternalBuildRunner.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformExternalBuildRunner.java @@ -84,9 +84,12 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.QualifiedName; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.ptp.remotetools.core.IRemoteExecutionTools; import org.eclipse.ptp.remotetools.core.IRemoteFileTools; +import org.eclipse.ptp.remotetools.core.IRemoteScript; import org.eclipse.ptp.remotetools.exception.CancelException; import org.eclipse.ptp.remotetools.exception.RemoteConnectionException; +import org.eclipse.ptp.remotetools.exception.RemoteExecutionException; import org.eclipse.ptp.remotetools.exception.RemoteOperationException; import org.eclipse.swt.widgets.Display; import org.tizen.common.util.OSChecker; @@ -208,6 +211,37 @@ public class PlatformExternalBuildRunner extends ExternalBuildRunner { throw new CoreException(status); } } + gitInit(project); + } + + + private static void gitInit(IProject project) { + String targetPath = RootstrapUtil.getUserSyncWorkspacePath(project.getName()); + String workspacePath = new Path(targetPath).removeLastSegments(1).toString(); + IPath projectPath = new Path(workspacePath).append(project.getName()); + String gitPath = projectPath.append(".git").toString(); + IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool(); + try { + boolean exists = filetool.hasDirectory(projectPath.toString(), new NullProgressMonitor()); + if (exists) { + exists = filetool.hasDirectory(gitPath, new NullProgressMonitor()); + if (!exists) { + IRemoteExecutionTools execTool = RemoteConnectionManager.getRemoteTools().getExecTool(); + String cmds[] = {"cd " + projectPath, "git init"}; + IRemoteScript script = execTool.createScript(); + script.setScript(cmds); + execTool.executeScript(script); + } + } + } catch (RemoteExecutionException e) { + e.printStackTrace(); + } catch (RemoteOperationException e) { + e.printStackTrace(); + } catch (RemoteConnectionException e) { + e.printStackTrace(); + } catch (CancelException e) { + e.printStackTrace(); + } } protected boolean invokeExternalBuild(int kind, IProject project, IConfiguration configuration, diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/gbs/GBSBuildCommandProvider.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/gbs/GBSBuildCommandProvider.java index 2b820fe..364bbc2 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/gbs/GBSBuildCommandProvider.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/gbs/GBSBuildCommandProvider.java @@ -30,7 +30,12 @@ package org.tizen.nativeplatform.build.gbs; import java.util.ArrayList; import java.util.List; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.envvar.IEnvironmentVariable; +import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IPath; import org.tizen.common.util.OSChecker; @@ -85,7 +90,15 @@ public class GBSBuildCommandProvider implements IBuildCommandProvider { args.add(op); } args.add(DEFINE_OP); - args.add("BUILD_TYPE ${BUILD_TYPE}"); + ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(config); + IEnvironmentVariableManager mngr = CCorePlugin.getDefault().getBuildEnvironmentManager(); + IEnvironmentVariable[] vars = mngr.getVariables(cfgDes, true); + for (IEnvironmentVariable var : vars) { + if (var.getName().equals("BUILD_TYPE")) { + args.add(String.format("\"BUILD_TYPE %s\"", var.getValue())); + break; + } + } return args.toArray(new String[0]); } @@ -105,13 +118,16 @@ public class GBSBuildCommandProvider implements IBuildCommandProvider { List args = new ArrayList(); if (OSChecker.isWindows()) { args.add("/C"); - args.add("rmdir"); - args.add("/S"); - args.add("/Q"); + if (configPath.toFile().exists()) { + args.add("rmdir"); + args.add("/S"); + args.add("/Q"); + args.add(configPath.toOSString()); + } } else { args.add("-rf"); + args.add(configPath.toOSString()); } - args.add(configPath.toOSString()); return args.toArray(new String[0]); } diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/gbs/GBSBuildResultProcessor.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/gbs/GBSBuildResultProcessor.java index 0f26a7a..ecb43dd 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/gbs/GBSBuildResultProcessor.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/gbs/GBSBuildResultProcessor.java @@ -168,8 +168,10 @@ public class GBSBuildResultProcessor implements IBuildResultProcessor { List xmls = getRemoteXmlFiles(rootstrap); for (String xml : xmls) { try { - String fileName = FileUtil.getFileNameFromPath(xml); - String targetPath = configPath.append(fileName).toOSString(); + String filename = FileUtil.getFileNameFromPath(xml); + String targetPath = configPath.append(filename).toOSString(); + String remoteTargetPath = remoteConfigPath.append(filename).toString(); + filetool.copyFile(xml, remoteTargetPath, new NullProgressMonitor()); copytool.downloadFileToFile(xml, targetPath); xmlfiles.add(targetPath); } catch (RemoteConnectionException e) { diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/command/launcher/HostCommandLauncher.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/command/launcher/HostCommandLauncher.java index 87917fd..8401362 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/command/launcher/HostCommandLauncher.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/command/launcher/HostCommandLauncher.java @@ -266,6 +266,7 @@ public class HostCommandLauncher { contents = new StringBuilder(); input = new BufferedReader(new InputStreamReader(proc.getInputStream())); + err = new BufferedReader(new InputStreamReader(proc.getErrorStream())); String line = null; while ((line = input.readLine()) != null) { contents.append(line); @@ -275,6 +276,16 @@ public class HostCommandLauncher { throw new InterruptedException("Command execution is canceled!"); } } + if (includeStdErr) { + while ((line = err.readLine()) != null) { + contents.append(line); + contents.append(LINE_SEPARATOR); + if (monitor != null && monitor.isCanceled()) { + contents.append(String.format("Canceled command: %s", command)); + throw new InterruptedException("Command execution is canceled!"); + } + } + } // wait for process finish proc.waitFor(); diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/gbs/GBSOptionManager.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/gbs/GBSOptionManager.java index 639d8e6..8b1c5a7 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/gbs/GBSOptionManager.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/gbs/GBSOptionManager.java @@ -30,7 +30,9 @@ package org.tizen.nativeplatform.gbs; import java.util.ArrayList; import java.util.List; +import org.tizen.common.util.OSChecker; import org.tizen.nativeplatform.command.launcher.HostCommandLauncher; +import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager; public class GBSOptionManager { private static List options = new ArrayList(); @@ -63,9 +65,17 @@ public class GBSOptionManager { // check GBS command try { + if (OSChecker.isWindows()) { + if (!RemoteConnectionManager.connected()) { + return false; + } + } if (!HostCommandLauncher.execute("which gbs")) { return false; } + + // In windows, version output is from error stream. It should be fixed. + // In ubuntu, version output is from standard output stream. String result = HostCommandLauncher.executeOutput("gbs --version", null, true, null); // result format : gbs [version] @@ -145,6 +155,10 @@ public class GBSOptionManager { startArgs = true; } } - initialized = true; + setInitialize(true); + } + + public static void setInitialize(boolean value) { + initialized = value; } } diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java index cd76e24..da892a5 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java @@ -201,7 +201,7 @@ public class RPMPackageDialog extends Dialog { } private void createDialogDescription(Composite composite) { - Composite comp_descrip = new Composite(composite, SWT.NONE); + Composite comp_descrip = new Composite(composite, SWT.NONE | SWT.BORDER); Color whiteColor = new Color(composite.getDisplay(), 255, 255, 255); comp_descrip.setLayout(new GridLayout(1, false)); @@ -216,7 +216,7 @@ public class RPMPackageDialog extends Dialog { } private void createTabs(Composite parent) { - tabFolder = new TabFolder(parent, SWT.BORDER); + tabFolder = new TabFolder(parent, SWT.NONE); tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH)); tabFolder.setLayout(new GridLayout(1, false)); if (enableRootstrapTab) { diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/remote/connection/WorkspaceSyncronizer.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/remote/connection/WorkspaceSyncronizer.java index 510265b..b5c0d97 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/remote/connection/WorkspaceSyncronizer.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/remote/connection/WorkspaceSyncronizer.java @@ -19,7 +19,8 @@ import org.tizen.nativeplatform.util.RootstrapUtil; public class WorkspaceSyncronizer { - public static String[] EXCLUDES = {".git/", "Debug/", "Release/", ".cproject", ".project", ".tproject"}; + public static String[] EXCLUDES = {".git/", "Debug/", "Release/", ".cproject", ".project", ".tproject", + ".gitignore"}; public static boolean syncronize(IProject project, IProgressMonitor monitor) { final String host = RemoteConnectionManager.getRemoteTools().getHost(); @@ -36,9 +37,6 @@ public class WorkspaceSyncronizer { RsyncProcessor processor = new RsyncProcessor(host, user, sshKeyPath); UserLogger.end(PlatformUserInteraction.CATE_SYNCRONIZE, PlatformUserInteraction.SYNC_WORKSPACE); boolean result = processor.uploadSync(sourcePath, workspacePath, EXCLUDES, monitor); - if (result) { - gitInit(workspacePath, project); - } return result; } catch (RemoteOperationException e) { e.printStackTrace(); @@ -51,28 +49,4 @@ public class WorkspaceSyncronizer { } return false; } - - private static void gitInit(String workspacePath, IProject project) { - IPath projectPath = new Path(workspacePath).append(project.getName()); - String gitPath = projectPath.append(".git").toString(); - IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool(); - try { - boolean exists = filetool.hasDirectory(gitPath, new NullProgressMonitor()); - if (!exists) { - IRemoteExecutionTools execTool = RemoteConnectionManager.getRemoteTools().getExecTool(); - String cmds[] = {"cd " + projectPath, "git init"}; - IRemoteScript script = execTool.createScript(); - script.setScript(cmds); - execTool.executeScript(script); - } - } catch (RemoteExecutionException e) { - e.printStackTrace(); - } catch (RemoteOperationException e) { - e.printStackTrace(); - } catch (RemoteConnectionException e) { - e.printStackTrace(); - } catch (CancelException e) { - e.printStackTrace(); - } - } } diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/PlatformProjectUtil.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/PlatformProjectUtil.java index 9f076c8..4f6e0f6 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/PlatformProjectUtil.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/PlatformProjectUtil.java @@ -34,10 +34,16 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.ptp.remotetools.core.IRemoteFileTools; +import org.eclipse.ptp.remotetools.exception.CancelException; +import org.eclipse.ptp.remotetools.exception.RemoteConnectionException; +import org.eclipse.ptp.remotetools.exception.RemoteOperationException; import org.tizen.nativeplatform.IPlatformProject; import org.tizen.nativeplatform.IPlatformXMLStore; import org.tizen.nativeplatform.build.PlatformConfigurationManager; import org.tizen.nativeplatform.manifest.PlatformManifestXMLStore; +import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager; import org.tizen.nativeplatform.types.PkgTypes; public class PlatformProjectUtil { @@ -123,7 +129,23 @@ public class PlatformProjectUtil { break; } } - return result; } + + public static void removeRemoteProject(String projectName) { + if (!RemoteConnectionManager.connected()) { + return; + } + String remoteProjectPath = RootstrapUtil.getUserSyncWorkspacePath(projectName); + IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool(); + try { + filetool.removeDirectory(remoteProjectPath, new NullProgressMonitor()); + } catch (RemoteOperationException e) { + e.printStackTrace(); + } catch (RemoteConnectionException e) { + e.printStackTrace(); + } catch (CancelException e) { + e.printStackTrace(); + } + } } diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/RootstrapUtil.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/RootstrapUtil.java index 5f1878c..59dcfad 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/RootstrapUtil.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/RootstrapUtil.java @@ -80,7 +80,7 @@ public class RootstrapUtil { .toString(); } - public static String getUserSyncWorkspacePath(String project) { + public static String getUserSyncWorkspacePath() { InetAddress ia = null; try { ia = InetAddress.getLocalHost(); @@ -91,7 +91,11 @@ public class RootstrapUtil { SmartBuildInterface sbi = SmartBuildInterface.getInstance(); String linuxWorkspace = sbi.getMinGWPathFromWindowsPath(workspace, false); String dir = ip + "_" + user; - return new Path(getRemoteRootstrapBasePath()).append(REMOTE_WORKSPACE_DIR).append(dir).append(linuxWorkspace).append(project).toString(); + return new Path(getRemoteRootstrapBasePath()).append(REMOTE_WORKSPACE_DIR).append(dir).append(linuxWorkspace).toString(); + } + + public static String getUserSyncWorkspacePath(String project) { + return new Path(getUserSyncWorkspacePath()).append(project).toString(); } public static String getUserSyncRootstrapPath(String id) { diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapView.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapView.java index b1fd772..2c32973 100644 --- a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapView.java +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapView.java @@ -32,6 +32,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -45,10 +46,14 @@ import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; import org.eclipse.cdt.managedbuilder.core.IManagedProject; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceProxyVisitor; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IContributionItem; @@ -66,8 +71,8 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.ptp.remotetools.core.IRemoteCopyTools; import org.eclipse.ptp.remotetools.core.IRemoteFileTools; +import org.eclipse.ptp.remotetools.core.IRemoteItem; import org.eclipse.ptp.remotetools.exception.CancelException; import org.eclipse.ptp.remotetools.exception.RemoteConnectionException; import org.eclipse.ptp.remotetools.exception.RemoteOperationException; @@ -111,10 +116,12 @@ import org.tizen.nativecommon.build.exception.SBIException; import org.tizen.nativeplatform.Activator; import org.tizen.nativeplatform.build.PlatformConfigurationManager; import org.tizen.nativeplatform.command.launcher.CommandUtil; +import org.tizen.nativeplatform.gbs.GBSOptionManager; import org.tizen.nativeplatform.pkg.commander.IPkgCommander; import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget; import org.tizen.nativeplatform.pkgmgr.PkgMgrInitializer; import org.tizen.nativeplatform.pkgmgr.ui.RPMPackageDialog; +import org.tizen.nativeplatform.remote.connection.PlatformResourceProxyVisitor; import org.tizen.nativeplatform.remote.connection.RemoteConnectionManager; import org.tizen.nativeplatform.remote.connection.RootstrapSyncronizer; import org.tizen.nativeplatform.remote.connection.RsyncProcessor; @@ -630,12 +637,12 @@ public class RootstrapView extends ViewPart { InterruptedException { monitor.beginTask("Synchronizing...", 4); try { - monitor.subTask("Synchronizing rootstraps..."); RootstrapManager.reinitialize(new SubProgressMonitor(monitor, 1)); monitor.subTask("Clear platform temp directory"); CommandUtil.clearPlatformTempDir(); monitor.worked(1); initBuildserver(new SubProgressMonitor(monitor, 1)); + initWorkspace(new SubProgressMonitor(monitor, 1)); SWTUtil.syncExec(new Runnable() { public void run() { updateToolbarEnable(); @@ -656,6 +663,80 @@ public class RootstrapView extends ViewPart { } } + private void initWorkspace(IProgressMonitor monitor) { + monitor.beginTask("", 4); + monitor.subTask("Initialize workspace..."); + List projList = new ArrayList(); + try { + IWorkspace works = ResourcesPlugin.getWorkspace(); + IProject[] projs = works.getRoot().getProjects(); + for (IProject proj : projs) { + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(proj); + if (info == null) { + continue; + } + IConfiguration config = info.getDefaultConfiguration(); + if (config == null) { + continue; + } + IManagedProject managedProject = config.getManagedProject(); + if (managedProject == null) { + continue; + } + String projectArtifactType = managedProject.getProjectType() != null ? managedProject + .getProjectType().getBuildArtefactType().getId() + : null; + if (!projectArtifactType.equals(PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE)) { + continue; + } + projList.add(proj.getName()); + } + monitor.worked(1); + + // remove remote projects if it do not exists on local workspace. + String userSyncworkspace = RootstrapUtil.getUserSyncWorkspacePath(); + IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool(); + + filetool.assureDirectory(userSyncworkspace, new SubProgressMonitor(monitor, 1)); + IRemoteItem[] items = filetool.listItems(userSyncworkspace, new SubProgressMonitor(monitor, 1)); + List removeProjs = new ArrayList(); + for (IRemoteItem item : items) { + String projectName = new Path(item.getPath()).lastSegment(); + if (!projList.contains(projectName)) { + removeProjs.add(item.getPath()); + } + } + removeRemoteProjects(removeProjs, new SubProgressMonitor(monitor, 1)); + } catch (RemoteConnectionException e) { + e.printStackTrace(); + } catch (RemoteOperationException e) { + e.printStackTrace(); + } catch (CancelException e) { + e.printStackTrace(); + } finally { + monitor.done(); + } + } + + private void removeRemoteProjects(List projPath, IProgressMonitor monitor) { + monitor.beginTask("", projPath.size()); + monitor.subTask("Remove projects..."); + IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool(); + try { + for (String path : projPath) { + filetool.removeDirectory(path, new SubProgressMonitor(monitor, 1)); + } + } catch (RemoteConnectionException e) { + e.printStackTrace(); + } catch (RemoteOperationException e) { + e.printStackTrace(); + } catch (CancelException e) { + e.printStackTrace(); + } finally { + monitor.done(); + } + } + private void initBuildserver(IProgressMonitor monitor) { monitor.beginTask("Setting build server...", 3); IRemoteFileTools filetool = RemoteConnectionManager.getRemoteTools().getFileTool(); @@ -756,6 +837,7 @@ public class RootstrapView extends ViewPart { "Failed to close remote connection", e.getMessage())); return; } + GBSOptionManager.setInitialize(false); } private void showAddDialog() { -- 2.7.4