示例#1
0
 /** Update the settings for the global window cache of the workspace. */
 public static void reconfigureWindowCache() {
   final WindowCacheConfig c = new WindowCacheConfig();
   IEclipsePreferences d = DefaultScope.INSTANCE.getNode(Activator.getPluginId());
   IEclipsePreferences p = InstanceScope.INSTANCE.getNode(Activator.getPluginId());
   c.setPackedGitLimit(
       p.getInt(
           GitCorePreferences.core_packedGitLimit,
           d.getInt(GitCorePreferences.core_packedGitLimit, 0)));
   c.setPackedGitWindowSize(
       p.getInt(
           GitCorePreferences.core_packedGitWindowSize,
           d.getInt(GitCorePreferences.core_packedGitWindowSize, 0)));
   c.setPackedGitMMAP(
       p.getBoolean(
           GitCorePreferences.core_packedGitMMAP,
           d.getBoolean(GitCorePreferences.core_packedGitMMAP, false)));
   c.setDeltaBaseCacheLimit(
       p.getInt(
           GitCorePreferences.core_deltaBaseCacheLimit,
           d.getInt(GitCorePreferences.core_deltaBaseCacheLimit, 0)));
   c.setStreamFileThreshold(
       p.getInt(
           GitCorePreferences.core_streamFileThreshold,
           d.getInt(GitCorePreferences.core_streamFileThreshold, 0)));
   c.install();
 }
示例#2
0
  public void execute(IProgressMonitor m) throws CoreException {
    if (mergeResult != null)
      throw new CoreException(
          new Status(IStatus.ERROR, Activator.getPluginId(), CoreText.OperationAlreadyExecuted));
    IProgressMonitor monitor;
    if (m == null) monitor = new NullProgressMonitor();
    else monitor = m;
    IWorkspaceRunnable action =
        new IWorkspaceRunnable() {

          public void run(IProgressMonitor mymonitor) throws CoreException {
            IProject[] validProjects = ProjectUtil.getValidOpenProjects(repository);
            mymonitor.beginTask(NLS.bind(CoreText.MergeOperation_ProgressMerge, refName), 3);
            Git git = new Git(repository);
            mymonitor.worked(1);
            MergeCommand merge = git.merge();
            try {
              Ref ref = repository.getRef(refName);
              if (ref != null) merge.include(ref);
              else merge.include(ObjectId.fromString(refName));
            } catch (IOException e) {
              throw new TeamException(CoreText.MergeOperation_InternalError, e);
            }
            if (fastForwardMode != null) merge.setFastForward(fastForwardMode);
            if (commit != null) merge.setCommit(commit.booleanValue());
            if (squash != null) merge.setSquash(squash.booleanValue());
            if (mergeStrategy != null) {
              merge.setStrategy(mergeStrategy);
            }
            if (message != null) merge.setMessage(message);
            try {
              mergeResult = merge.call();
              mymonitor.worked(1);
              if (MergeResult.MergeStatus.NOT_SUPPORTED.equals(mergeResult.getMergeStatus()))
                throw new TeamException(
                    new Status(IStatus.INFO, Activator.getPluginId(), mergeResult.toString()));
            } catch (NoHeadException e) {
              throw new TeamException(CoreText.MergeOperation_MergeFailedNoHead, e);
            } catch (ConcurrentRefUpdateException e) {
              throw new TeamException(CoreText.MergeOperation_MergeFailedRefUpdate, e);
            } catch (CheckoutConflictException e) {
              mergeResult = new MergeResult(e.getConflictingPaths());
              return;
            } catch (GitAPIException e) {
              throw new TeamException(e.getLocalizedMessage(), e.getCause());
            } finally {
              ProjectUtil.refreshValidProjects(validProjects, new SubProgressMonitor(mymonitor, 1));
              mymonitor.done();
            }
          }
        };
    // lock workspace to protect working tree changes
    ResourcesPlugin.getWorkspace()
        .run(action, getSchedulingRule(), IWorkspace.AVOID_UPDATE, monitor);
  }
示例#3
0
 @Override
 protected IStatus run(IProgressMonitor monitor) {
   try {
     RepositoryProvider.unmap(project);
     return Status.OK_STATUS;
   } catch (TeamException e) {
     return new Status(
         IStatus.ERROR,
         Activator.getPluginId(),
         MessageFormat.format(
             CoreText.GitProjectData_UnmappingGoneResourceFailed, project.getName()),
         e);
   }
 }
示例#4
0
 private static File propertyFile(IProject project) {
   return new File(
       project.getWorkingLocation(Activator.getPluginId()).toFile(),
       "GitProjectData.properties"); //$NON-NLS-1$
 }
示例#5
0
 @Override
 public void init(final IWorkbench workbench) {
   corePreferences =
       new ScopedPreferenceStore(
           InstanceScope.INSTANCE, org.eclipse.egit.core.Activator.getPluginId());
 }