Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
added warning if you try to export before all files are staged.
Browse files Browse the repository at this point in the history
removed some unused old code
removed some system.out statements
  • Loading branch information
gregjan committed Apr 24, 2012
1 parent b86bf60 commit 37e54ca
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 148 deletions.
3 changes: 3 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
#Mon Mar 19 10:11:00 EDT 2012
eclipse.preferences.version=1
encoding/<project>=UTF-8
5 changes: 5 additions & 0 deletions .settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,5 @@
#Fri Mar 02 11:36:34 EST 2012
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
Expand Up @@ -52,7 +52,7 @@ public URIFragmentEditorInput(String projectName, String fragmentID, String name
this.fragmentID = fragmentID;
this.name = name;

System.out.println("constructed from parts: " + toString());
//System.out.println("constructed from parts: " + toString());
}

@Override
Expand Down
Expand Up @@ -173,9 +173,6 @@ private void createInheritContent(Composite parent, FormToolkit toolkit) {
s1.setLayoutData(gd);

inheritFlag = toolkit.createButton(s1, "Yes, groups may retain roles granted above this level.", SWT.CHECK); //$NON-NLS-1$
for(IItemPropertyDescriptor d : acleditor.itemDelegator.getPropertyDescriptors(model)) {
System.out.println(d);
}
inheritFlag.setSelection(model.isInherit());
inheritFlag.addSelectionListener(new SelectionAdapter() {
@Override
Expand Down
Expand Up @@ -18,6 +18,7 @@
import java.io.File;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
Expand All @@ -35,6 +36,8 @@
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Widget;

import unc.lib.cdr.workbench.stage.StagingUtils;

/**
* @author Gregory Jansen
*
Expand Down Expand Up @@ -245,6 +248,16 @@ private void updatePageCompletion() {
this.setPageComplete(false);
return;
}
try {
int unstaged = StagingUtils.countUnstaged(project);
if(unstaged > 0) {
this.setErrorMessage("There are still "+unstaged+" files queued for staging. All captured files must be staged prior to export.");
this.setPageComplete(false);
return;
}
} catch(CoreException e) {
e.printStackTrace();
}
if(getDestinationValue() == null || "".equals(getDestinationValue().trim())) {
this.setErrorMessage("You must select a file location for the export.");
this.setPageComplete(false);
Expand Down

This file was deleted.

This file was deleted.

Expand Up @@ -31,13 +31,16 @@
import java.net.URISyntaxException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.codec.binary.Hex;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
Expand All @@ -63,6 +66,23 @@ public class StagingUtils {
private static final Logger log = LoggerFactory.getLogger(StagingUtils.class);
private static final int chunkSize = 8192;


public static int countUnstaged(IProject project) throws CoreException {
int result = 0;
IMarker[] captured = project.findMarkers(IResourceConstants.MARKER_CAPTURED, false, IResource.DEPTH_INFINITE);
List<IFile> toStage = new ArrayList<IFile>();
for (IMarker m : captured) {
if (m.getResource() instanceof IFile) {
IMarker[] staged = m.getResource().findMarkers(IResourceConstants.MARKER_STAGED, false,
IResource.DEPTH_ZERO);
if (staged.length <= 0) {
result++;
}
}
}
return result;
}

/**
* @param r
*/
Expand Down

0 comments on commit 37e54ca

Please sign in to comment.