Permalink
Browse files

organized imports (vast automatic changes)

rearranged staged file properties form a little
added File -> Import menu to support export/import workflow
removed some extraneous logging
  • Loading branch information...
1 parent af93668 commit 62218d012c50fd28f027b81b4f554fcac742d06e @gregjan gregjan committed Jul 16, 2012
Showing with 32 additions and 142 deletions.
  1. +3 −26 workbench_plugin/src/main/java/unc/lib/cdr/workbench/acl/AccessControlFormEditor.java
  2. +0 −1 workbench_plugin/src/main/java/unc/lib/cdr/workbench/acl/AccessControlFormPage.java
  3. +0 −1 workbench_plugin/src/main/java/unc/lib/cdr/workbench/acl/EditAccessControlsCommand.java
  4. +0 −1 workbench_plugin/src/main/java/unc/lib/cdr/workbench/acl/GrantTypeDetailsPage.java
  5. +0 −2 workbench_plugin/src/main/java/unc/lib/cdr/workbench/acl/ScrolledPropertiesBlock.java
  6. +0 −1 ...nch_plugin/src/main/java/unc/lib/cdr/workbench/arrange/ArrangementCommonDropAdapterAssistant.java
  7. +0 −3 workbench_plugin/src/main/java/unc/lib/cdr/workbench/capture/FileStoreProvider.java
  8. +0 −1 workbench_plugin/src/main/java/unc/lib/cdr/workbench/capture/LinkOriginalsWizard.java
  9. +0 −7 workbench_plugin/src/main/java/unc/lib/cdr/workbench/capture/OriginalsContentProvider.java
  10. +0 −1 workbench_plugin/src/main/java/unc/lib/cdr/workbench/commands/OpenSystemEditorTempCopyHandler.java
  11. +1 −0 workbench_plugin/src/main/java/unc/lib/cdr/workbench/commands/SetDivTypeHandler.java
  12. +0 −2 workbench_plugin/src/main/java/unc/lib/cdr/workbench/originals/OriginalStub.java
  13. +0 −1 workbench_plugin/src/main/java/unc/lib/cdr/workbench/project/CdrSipExportWizard.java
  14. +0 −5 workbench_plugin/src/main/java/unc/lib/cdr/workbench/project/MetsProjectNatureSupport.java
  15. +0 −4 workbench_plugin/src/main/java/unc/lib/cdr/workbench/project/NewSipProjectWizard.java
  16. +6 −1 workbench_plugin/src/main/java/unc/lib/cdr/workbench/rcp/ApplicationActionBarAdvisor.java
  17. +1 −1 workbench_plugin/src/main/java/unc/lib/cdr/workbench/rcp/METSWorkspaceSaveParticipant.java
  18. +0 −5 workbench_plugin/src/main/java/unc/lib/cdr/workbench/stage/StageBuilder.java
  19. +5 −54 workbench_plugin/src/main/java/unc/lib/cdr/workbench/stage/StagingUtils.java
  20. +1 −1 workbench_plugin/src/main/java/unc/lib/cdr/workbench/views/HasOriginalFilter.java
  21. +15 −17 workbench_plugin/src/main/java/unc/lib/cdr/workbench/views/OriginalFingerprintSection.java
  22. +0 −1 workbench_plugin/src/main/java/unc/lib/cdr/workbench/views/OriginalResourcePropertySheetSection.java
  23. +0 −1 workbench_plugin/src/main/java/unc/lib/cdr/workbench/xwalk/CrosswalkContentProvider.java
  24. +0 −2 workbench_plugin/src/main/java/unc/lib/cdr/workbench/xwalk/CrosswalkLabelProvider.java
  25. +0 −2 workbench_plugin/src/main/java/unc/lib/cdr/workbench/xwalk/MapAttributeAdvice.java
  26. +0 −1 workbench_plugin/src/main/java/unc/lib/cdr/workbench/xwalk/MappedFeatureChoiceDialog.java
@@ -15,60 +15,37 @@
*/
package unc.lib.cdr.workbench.acl;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
import java.util.EventObject;
import java.util.HashMap;
import java.util.Map;
-import edu.unc.lib.schemas.acl.AccessControlType;
-import gov.loc.mods.mods.presentation.MODSEditor;
-import gov.loc.mods.mods.presentation.ModsEditorPlugin;
-import gov.loc.mods.mods.presentation.URIFragmentEditorInput;
-
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.command.BasicCommandStack;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CommandStackListener;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.views.contentoutline.ContentOutline;
-import org.eclipse.ui.views.properties.PropertySheet;
import unc.lib.cdr.workbench.project.MetsProjectNature;
-import unc.lib.cdr.workbench.rcp.Activator;
+import edu.unc.lib.schemas.acl.AccessControlType;
+import gov.loc.mods.mods.presentation.ModsEditorPlugin;
+import gov.loc.mods.mods.presentation.URIFragmentEditorInput;
/**
* @author Gregory Jansen
@@ -25,7 +25,6 @@
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.ecore.xml.type.XMLTypeFactory;
import org.eclipse.emf.edit.command.SetCommand;
-import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -36,7 +36,6 @@
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.emf.ecore.xml.type.internal.XMLCalendar;
-import org.eclipse.emf.edit.ui.util.EditUIUtil;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
@@ -38,7 +38,6 @@
import org.eclipse.ui.forms.widgets.TableWrapLayout;
import unc.lib.cdr.workbench.project.MetsProjectNature;
-
import edu.unc.lib.schemas.acl.AclPackage;
import edu.unc.lib.schemas.acl.GrantType;
@@ -18,7 +18,6 @@
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
-import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
@@ -39,7 +38,6 @@
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.MasterDetailsBlock;
import org.eclipse.ui.forms.SectionPart;
-import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
@@ -26,7 +26,6 @@
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
@@ -15,9 +15,6 @@
*/
package unc.lib.cdr.workbench.capture;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.runtime.CoreException;
@@ -18,7 +18,6 @@
import java.net.URI;
import java.util.List;
-import org.eclipse.core.resources.IProject;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
@@ -20,18 +20,11 @@
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -10,7 +10,6 @@
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -12,6 +12,7 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.handlers.RadioState;
+
import unc.lib.cdr.workbench.project.MetsProjectNature;
public class SetDivTypeHandler extends AbstractHandler {
@@ -13,8 +13,6 @@
import java.util.List;
import java.util.Map;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -4,7 +4,6 @@
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
@@ -16,17 +16,12 @@
package unc.lib.cdr.workbench.project;
import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
/**
@@ -17,12 +17,8 @@
import java.net.URI;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
@@ -33,6 +33,7 @@
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
private IWorkbenchAction newWizardDropDownAction;
+ private IWorkbenchAction importAction;
private IWorkbenchAction aboutAction;
private IWorkbenchAction introAction;
private IWorkbenchAction showHelpAction;
@@ -56,6 +57,9 @@ protected void makeActions(IWorkbenchWindow window) {
} catch (NullPointerException e) {
e.printStackTrace();
}
+
+ importAction = ActionFactory.IMPORT.create(window);
+ register(importAction);
aboutAction = ActionFactory.ABOUT.create(window);
showHelpAction = ActionFactory.HELP_CONTENTS.create(window);
register(showHelpAction);
@@ -72,7 +76,7 @@ protected void makeActions(IWorkbenchWindow window) {
deleteAction = ActionFactory.DELETE.create(window);
register(deleteAction);
- newWizardMenu = ContributionItemFactory.NEW_WIZARD_SHORTLIST.create(window);
+ newWizardMenu = ContributionItemFactory.NEW_WIZARD_SHORTLIST.create(window);
}
@Override
@@ -83,6 +87,7 @@ protected void fillMenuBar(IMenuManager menuBar) {
MenuManager newMenu = new MenuManager("New", "new");
newMenu.add(this.newWizardMenu);
menu.add(newMenu);
+ menu.add(importAction);
menuBar.add(menu);
}
{
@@ -85,7 +85,7 @@ public void rollback(ISaveContext context) {
public void saving(ISaveContext context) throws CoreException {
LOG.debug("METS save participant called, save(context)");
// find all projects with METS nature
- if(context.getKind() == ISaveContext.FULL_SAVE || context.getKind() == ISaveContext.SNAPSHOT) {
+ if(context.getKind() == ISaveContext.FULL_SAVE) {
for (IProject p : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
if (p.isOpen() && p.hasNature(MetsProjectNature.NATURE_ID)) {
MetsProjectNature n = (MetsProjectNature) p.getNature(MetsProjectNature.NATURE_ID);
@@ -24,11 +24,7 @@
import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -38,7 +34,6 @@
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
-import unc.lib.cdr.workbench.IResourceConstants;
import unc.lib.cdr.workbench.originals.OriginalFileStore;
import unc.lib.cdr.workbench.project.MetsProjectNature;
@@ -28,11 +28,8 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
-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;
@@ -43,14 +40,11 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.URIUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -71,7 +65,6 @@
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,
@@ -157,38 +150,6 @@ public static void stage(OriginalFileStore original, IProgressMonitor monitor) t
}
/**
- * @param f
- * @return
- * @throws CoreException
- */
- // public static IFileStore getStageRoot() throws CoreException {
- // // get the file store for staging this file
- // try {
- // URI stage = this.;
- // String stageChoice = store.getString(PreferenceConstants.P_STAGE_CHOICE);
- // if (PreferenceConstants.P_STAGE_CHOICE_LOCAL.equals(stageChoice)) {
- // String rawPath = store.getString(PreferenceConstants.P_LOCAL_STAGE_PATH);
- // IPath path = new Path(rawPath);
- // File f = path.toFile();
- // stage = f.toURI();
- // //stage = ("file:" + rawPath.replace('\\', '/'));
- // } else if
- // (PreferenceConstants.P_STAGE_CHOICE_IRODS_PROD.equals(stageChoice)) {
- // stage = new URI(store.getString(PreferenceConstants.P_PROD_IRODS_URI));
- // } else if
- // (PreferenceConstants.P_STAGE_CHOICE_IRODS_TEST.equals(stageChoice)) {
- // stage = new URI(store.getString(PreferenceConstants.P_TEST_IRODS_URI));
- // } else {
- // throw new Error("unknown stage choice " + stageChoice);
- // }
- // return stageRootFileStore;
- // } catch (URISyntaxException e) {
- // throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID,
- // "The staging location is not configured correctly in preferences.", e));
- // }
- // }
-
- /**
* @param stageFileStore
* @return
*/
@@ -245,8 +206,8 @@ public static final String copyWithMD5Digest(IFileStore source, IFileStore desti
IProgressMonitor monitor) throws CoreException {
// TODO honor cancellation requests during copy
// TODO report progress
- log.info("source: " + source);
- log.info("destination: " + destination);
+ log.debug("source: " + source);
+ log.debug("destination: " + destination);
// monitor.subTask("Copying file " + source.getName() + "...");
String result = null;
byte[] buffer = new byte[chunkSize];
@@ -269,6 +230,9 @@ public static final String copyWithMD5Digest(IFileStore source, IFileStore desti
destination.getParent().mkdir(EFS.NONE, null);
out = new BufferedOutputStream(destination.openOutputStream(EFS.NONE, null), 1024 * 64);
while ((bytesRead = in.read(buffer, 0, chunkSize)) != -1) {
+ if(monitor.isCanceled()) {
+ throw new CoreException(new Status(IStatus.CANCEL, Activator.PLUGIN_ID, "Staging cancelled"));
+ }
out.write(buffer, 0, bytesRead);
messageDigest.update(buffer, 0, bytesRead);
totalBytesCopied = totalBytesCopied + bytesRead;
@@ -413,17 +377,4 @@ private static String checksumWithMD5Digest(IFileStore source, IFileInfo sourceI
}
return result;
}
-
- /**
- * @param f
- * @param topOriginal
- * @param prestageBase
- * @return
- * @throws URISyntaxException
- */
- private static URI getPrestageLocation(IFile f, IResource topOriginal, URI prestageBase) throws URISyntaxException {
- IPath path = f.getProjectRelativePath().makeRelativeTo(topOriginal.getParent().getProjectRelativePath());
- URI test = URIUtil.fromString(path.toString());
- return new URI(prestageBase.toString()+ test.getRawPath() );
- }
}
@@ -4,8 +4,8 @@
import org.eclipse.jface.viewers.IFilter;
-import unc.lib.cdr.workbench.originals.OriginalStub;
import unc.lib.cdr.workbench.originals.OriginalFileStore;
+import unc.lib.cdr.workbench.originals.OriginalStub;
import unc.lib.cdr.workbench.project.MetsProjectNature;
public class HasOriginalFilter implements IFilter {
Oops, something went wrong.

0 comments on commit 62218d0

Please sign in to comment.