private static String getLastSyncConnection(IContainer container) {
    if (container == null) {
      return null;
    }
    // only shows the decorator when user chooses to
    // remember the decision
    boolean remember = ResourceSynchronizationUtils.isRememberDecision(container);
    if (!remember) {
      return null;
    }

    String lastConnection = ResourceSynchronizationUtils.getLastSyncConnection(container);
    if (lastConnection == null) {
      return null;
    }

    ISiteConnection[] sites = SiteConnectionUtils.findSitesForSource(container, true);
    String target;
    for (ISiteConnection site : sites) {
      target = site.getDestination().getName();
      if (target.equals(lastConnection)) {
        return target;
      }
    }
    return null;
  }
예제 #2
0
 @Override
 public int hashCode() {
   if (hashCode == 0) {
     hashCode = 7;
     hashCode = 31 * hashCode + project.hashCode();
     hashCode = 31 * hashCode + siteConnection.hashCode();
   }
   return hashCode;
 }
예제 #3
0
 @SuppressWarnings("rawtypes")
 public Object getAdapter(Class adapter) {
   if (adapter == IProject.class) {
     return project;
   } else if (adapter == ISiteConnection.class) {
     return siteConnection;
   } else if (adapter == IConnectionPoint.class) {
     return siteConnection.getDestination();
   } else if (adapter == IFileStore.class) {
     IConnectionPoint destination = siteConnection.getDestination();
     try {
       return (destination == null) ? null : destination.getRoot();
     } catch (CoreException e) {
       // falls through on error
     }
   }
   return super.getAdapter(adapter);
 }
예제 #4
0
 @Override
 public int hashCode() {
   return fSite.hashCode();
 }
예제 #5
0
 public String getToolTipText() {
   return fSite == null ? "" : fSite.toString(); // $NON-NLS-1$
 }
예제 #6
0
 public String getName() {
   return fSite == null ? "" : fSite.getName(); // $NON-NLS-1$
 }
예제 #7
0
 public boolean canDisconnect() {
   IConnectionPoint connectionPoint = siteConnection.getDestination();
   return (connectionPoint == null) ? false : connectionPoint.canDisconnect();
 }