/** * This method should be called whenever <code>aListener</code> is activated (becomes active). * This will check the timestamps of the underlying files to see if they are different from the * last cached modified value. <code>aListener</code> should be prepared to prompt the user if * they would like to refresh with the contents on disk if we are dirty. */ public void checkActivation(ResourceStateValidatorPresenter presenter) throws CoreException { checkConsistency(presenter); }
public void lostActivation(ResourceStateValidatorPresenter presenter) throws CoreException { checkConsistency(presenter); }
/** * This method should be called at least the first time a ResourceStateValidatorPresenter * becomes active and is about to edit its contents. The returned IStatus may have an ERROR * status which should be presented to the user. */ public IStatus validateState(ResourceStateValidatorPresenter presenter) throws CoreException { List roResources, nonResROFiles, roFiles = null; List[] readOnly = selectReadOnlyResources(provider.getResources()); roResources = readOnly[0]; roFiles = readOnly[1]; nonResROFiles = selectReadOnlyFiles(provider.getNonResourceFiles()); if (nonResROFiles != null) { if (roFiles == null) roFiles = nonResROFiles; else roFiles.addAll(nonResROFiles); } if (roFiles == null || roFiles.isEmpty()) return OK_STATUS; IFile[] files = new IFile[roFiles.size()]; roFiles.toArray(files); Object ctx = presenter != null ? presenter.getValidateEditContext() : null; IStatus result = ResourcesPlugin.getWorkspace().validateEdit(files, ctx); cacheValidateState(result, roResources, nonResROFiles); if (!result.isOK()) checkConsistency(presenter); return result; }