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; }
@Override public int hashCode() { if (hashCode == 0) { hashCode = 7; hashCode = 31 * hashCode + project.hashCode(); hashCode = 31 * hashCode + siteConnection.hashCode(); } return hashCode; }
@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); }
@Override public int hashCode() { return fSite.hashCode(); }
public String getToolTipText() { return fSite == null ? "" : fSite.toString(); // $NON-NLS-1$ }
public String getName() { return fSite == null ? "" : fSite.getName(); // $NON-NLS-1$ }
public boolean canDisconnect() { IConnectionPoint connectionPoint = siteConnection.getDestination(); return (connectionPoint == null) ? false : connectionPoint.canDisconnect(); }