mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Bug 310514: Exporting resource snapshots in addition to cdt index.
This commit is contained in:
parent
9e8cd5b29b
commit
ea6bcda223
5 changed files with 135 additions and 26 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -17,10 +17,10 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.net.URI;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.zip.Deflater;
|
import java.util.zip.Deflater;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
|
@ -35,11 +35,14 @@ import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMProjectIndexLocationConverter;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMProjectIndexLocationConverter;
|
||||||
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
||||||
import org.eclipse.cdt.internal.core.resources.ResourceLookup;
|
import org.eclipse.cdt.internal.core.resources.ResourceLookup;
|
||||||
|
import org.eclipse.core.filesystem.URIUtil;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
|
@ -48,11 +51,23 @@ import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
|
|
||||||
public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Option constant (value:1) to indicate that a resource snapshot
|
||||||
|
* should be saved along with the exported PDOM.
|
||||||
|
* @since 5.2
|
||||||
|
*/
|
||||||
|
public static int EXPORT_OPTION_RESOURCE_SNAPSHOT = 1;
|
||||||
|
|
||||||
|
private static final String RESOURCE_PREFIX = "res-"; //$NON-NLS-1$
|
||||||
|
private static final String CDT_PREFIX = "cdt-"; //$NON-NLS-1$
|
||||||
|
private static final String RESOURCE_SNAP_EXTENSION = "snap.zip"; //$NON-NLS-1$
|
||||||
|
|
||||||
private ICProject fProject;
|
private ICProject fProject;
|
||||||
private String fTargetLocation;
|
private String fTargetLocation;
|
||||||
private File fTargetLocationFile;
|
private File fTargetLocationFile;
|
||||||
private MessageDigest fMessageDigest;
|
private MessageDigest fMessageDigest;
|
||||||
|
private int fOptions;
|
||||||
|
|
||||||
public TeamPDOMExportOperation(ICProject project) {
|
public TeamPDOMExportOperation(ICProject project) {
|
||||||
fProject= project;
|
fProject= project;
|
||||||
}
|
}
|
||||||
|
@ -62,6 +77,7 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOptions(int options) {
|
public void setOptions(int options) {
|
||||||
|
fOptions = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAlgorithm(MessageDigest md) {
|
public void setAlgorithm(MessageDigest md) {
|
||||||
|
@ -114,6 +130,14 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
// store preferences
|
// store preferences
|
||||||
monitor.setTaskName(Messages.TeamPDOMExportOperation_taskExportIndex);
|
monitor.setTaskName(Messages.TeamPDOMExportOperation_taskExportIndex);
|
||||||
IndexerPreferences.setIndexImportLocation(fProject.getProject(), fTargetLocation.toString());
|
IndexerPreferences.setIndexImportLocation(fProject.getProject(), fTargetLocation.toString());
|
||||||
|
|
||||||
|
// store resource snapshot
|
||||||
|
if ((fOptions & EXPORT_OPTION_RESOURCE_SNAPSHOT) != 0) {
|
||||||
|
IPath p = Path.fromOSString(fTargetLocationFile.getAbsolutePath());
|
||||||
|
p = computeSnapshotPath(p);
|
||||||
|
URI snapURI = URIUtil.toURI(p);
|
||||||
|
fProject.getProject().saveSnapshot(IProject.SNAPSHOT_TREE | /*Project.SNAPSHOT_SET_AUTOLOAD*/2, snapURI, null);
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
return;
|
return;
|
||||||
|
@ -128,6 +152,14 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IPath computeSnapshotPath(IPath p) {
|
||||||
|
final String fileName = p.lastSegment();
|
||||||
|
if (fileName.startsWith(CDT_PREFIX)) {
|
||||||
|
return p.removeLastSegments(1).append(RESOURCE_PREFIX + fileName.substring(4));
|
||||||
|
}
|
||||||
|
return p.removeFileExtension().addFileExtension(RESOURCE_SNAP_EXTENSION);
|
||||||
|
}
|
||||||
|
|
||||||
private void getTargetLocation() throws CoreException {
|
private void getTargetLocation() throws CoreException {
|
||||||
fTargetLocationFile= TeamPDOMImportOperation.expandLocation(fProject.getProject(), fTargetLocation);
|
fTargetLocationFile= TeamPDOMImportOperation.expandLocation(fProject.getProject(), fTargetLocation);
|
||||||
}
|
}
|
||||||
|
@ -152,8 +184,8 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
IIndexFile[] ifiles= pdom.getAllFiles();
|
IIndexFile[] ifiles= pdom.getAllFiles();
|
||||||
for (int i = 0; i < ifiles.length; i++) {
|
for (IIndexFile ifile : ifiles) {
|
||||||
String fullPath= ifiles[i].getLocation().getFullPath();
|
String fullPath= ifile.getLocation().getFullPath();
|
||||||
if (fullPath != null) {
|
if (fullPath != null) {
|
||||||
fullPaths.add(fullPath);
|
fullPaths.add(fullPath);
|
||||||
}
|
}
|
||||||
|
@ -165,8 +197,7 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
int i=0;
|
int i=0;
|
||||||
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
|
||||||
IFile[] files= new IFile[fullPaths.size()];
|
IFile[] files= new IFile[fullPaths.size()];
|
||||||
for (Iterator<String> iterator = fullPaths.iterator(); iterator.hasNext();) {
|
for (String fullPath : fullPaths) {
|
||||||
String fullPath= iterator.next();
|
|
||||||
files[i++]= root.getFile(new Path(fullPath));
|
files[i++]= root.getFile(new Path(fullPath));
|
||||||
}
|
}
|
||||||
Map<String, Object> map= Checksums.createChecksumMap(files, fMessageDigest, monitor);
|
Map<String, Object> map= Checksums.createChecksumMap(files, fMessageDigest, monitor);
|
||||||
|
@ -223,8 +254,7 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
close(out);
|
close(out);
|
||||||
}
|
}
|
||||||
IFile[] wsResource= ResourceLookup.findFilesForLocation(new Path(fTargetLocationFile.getAbsolutePath()));
|
IFile[] wsResource= ResourceLookup.findFilesForLocation(new Path(fTargetLocationFile.getAbsolutePath()));
|
||||||
for (int i = 0; i < wsResource.length; i++) {
|
for (IFile file : wsResource) {
|
||||||
IFile file = wsResource[i];
|
|
||||||
file.refreshLocal(0, new NullProgressMonitor());
|
file.refreshLocal(0, new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.3.0,4.0.0)",
|
||||||
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
|
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.search;bundle-version="[3.2.0,4.0.0)",
|
org.eclipse.search;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.compare;bundle-version="[3.3.0,4.0.0)",
|
org.eclipse.compare;bundle-version="[3.3.0,4.0.0)",
|
||||||
org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)",
|
org.eclipse.cdt.core;bundle-version="[5.2.0,6.0.0)",
|
||||||
org.eclipse.ui.console;bundle-version="[3.1.100,4.0.0)",
|
org.eclipse.ui.console;bundle-version="[3.1.100,4.0.0)",
|
||||||
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
|
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.help;bundle-version="[3.2.0,4.0.0)",
|
org.eclipse.help;bundle-version="[3.2.0,4.0.0)",
|
||||||
|
|
|
@ -26,8 +26,10 @@ public class Messages extends NLS {
|
||||||
public static String TeamProjectIndexExportWizardPage_destinationMessage;
|
public static String TeamProjectIndexExportWizardPage_destinationMessage;
|
||||||
public static String TeamProjectIndexExportWizardPage_errorDlgTitle;
|
public static String TeamProjectIndexExportWizardPage_errorDlgTitle;
|
||||||
public static String TeamProjectIndexExportWizardPage_errorExporting;
|
public static String TeamProjectIndexExportWizardPage_errorExporting;
|
||||||
|
public static String TeamProjectIndexExportWizardPage_errorInOperation;
|
||||||
public static String TeamProjectIndexExportWizardPage_labelProjectTable;
|
public static String TeamProjectIndexExportWizardPage_labelProjectTable;
|
||||||
public static String TeamProjectIndexExportWizardPage_noProjectError;
|
public static String TeamProjectIndexExportWizardPage_noProjectError;
|
||||||
|
public static String TeamProjectIndexExportWizardPage_resourceSnapshotButton;
|
||||||
public static String TeamProjectIndexExportWizardPage_selectAll;
|
public static String TeamProjectIndexExportWizardPage_selectAll;
|
||||||
public static String TeamProjectIndexExportWizardPage_title;
|
public static String TeamProjectIndexExportWizardPage_title;
|
||||||
public static String TeamProjectIndexExportWizardPage_variableButton;
|
public static String TeamProjectIndexExportWizardPage_variableButton;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -23,12 +23,15 @@ import org.eclipse.core.runtime.MultiStatus;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
||||||
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
||||||
import org.eclipse.jface.viewers.ICheckStateListener;
|
import org.eclipse.jface.viewers.ICheckStateListener;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.window.Window;
|
import org.eclipse.jface.window.Window;
|
||||||
|
import org.eclipse.jface.wizard.WizardPage;
|
||||||
|
import org.eclipse.osgi.util.NLS;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
@ -39,10 +42,10 @@ import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Event;
|
import org.eclipse.swt.widgets.Event;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Listener;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Table;
|
import org.eclipse.swt.widgets.Table;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
import org.eclipse.ui.dialogs.WizardDataTransferPage;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
@ -55,11 +58,13 @@ import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.ListContentProvider;
|
import org.eclipse.cdt.internal.ui.viewsupport.ListContentProvider;
|
||||||
|
|
||||||
public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage {
|
public class TeamProjectIndexExportWizardPage extends WizardPage implements Listener {
|
||||||
|
private static final int SIZING_TEXT_FIELD_WIDTH = 250;
|
||||||
|
|
||||||
private IStructuredSelection fInitialSelection;
|
private IStructuredSelection fInitialSelection;
|
||||||
private CheckboxTableViewer fProjectViewer;
|
private CheckboxTableViewer fProjectViewer;
|
||||||
private Text fDestinationField;
|
private Text fDestinationField;
|
||||||
|
private Button fResourceSnapshotButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an instance of this class
|
* Create an instance of this class
|
||||||
|
@ -106,7 +111,7 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage {
|
||||||
giveFocusToDestination();
|
giveFocusToDestination();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the checkbox tree and list for selecting resources.
|
* Creates the checkbox tree and list for selecting resources.
|
||||||
*
|
*
|
||||||
* @param parent the parent control
|
* @param parent the parent control
|
||||||
|
@ -272,6 +277,18 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage {
|
||||||
};
|
};
|
||||||
button.addSelectionListener(listener);
|
button.addSelectionListener(listener);
|
||||||
|
|
||||||
|
// resource snapshot destination group
|
||||||
|
Composite resourceSnapshotDestinationGroup = new Composite(parent, SWT.NONE);
|
||||||
|
resourceSnapshotDestinationGroup.setLayout(new GridLayout(1, false));
|
||||||
|
resourceSnapshotDestinationGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
|
||||||
|
resourceSnapshotDestinationGroup.setFont(font);
|
||||||
|
|
||||||
|
fResourceSnapshotButton = new Button(resourceSnapshotDestinationGroup, SWT.CHECK);
|
||||||
|
fResourceSnapshotButton.setText(Messages.TeamProjectIndexExportWizardPage_resourceSnapshotButton);
|
||||||
|
fResourceSnapshotButton.setFont(font);
|
||||||
|
fResourceSnapshotButton.setLayoutData(gd= new GridData());
|
||||||
|
gd.grabExcessHorizontalSpace= true;
|
||||||
|
gd.horizontalAlignment= GridData.FILL;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onInsertVariable() {
|
protected void onInsertVariable() {
|
||||||
|
@ -287,10 +304,16 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage {
|
||||||
|
|
||||||
// about to invoke the operation so save our state
|
// about to invoke the operation so save our state
|
||||||
saveWidgetValues();
|
saveWidgetValues();
|
||||||
|
|
||||||
return executeExportOperation(projectsToExport);
|
return executeExportOperation(projectsToExport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void saveWidgetValues() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void restoreWidgetValues() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private ICProject[] getCheckedElements() {
|
private ICProject[] getCheckedElements() {
|
||||||
Object[] obj= fProjectViewer.getCheckedElements();
|
Object[] obj= fProjectViewer.getCheckedElements();
|
||||||
ICProject[] prjs= new ICProject[obj.length];
|
ICProject[] prjs= new ICProject[obj.length];
|
||||||
|
@ -302,13 +325,17 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage {
|
||||||
final String dest= getDestinationValue();
|
final String dest= getDestinationValue();
|
||||||
final MultiStatus status= new MultiStatus(CUIPlugin.PLUGIN_ID,
|
final MultiStatus status= new MultiStatus(CUIPlugin.PLUGIN_ID,
|
||||||
0, Messages.TeamProjectIndexExportWizardPage_errorExporting, null);
|
0, Messages.TeamProjectIndexExportWizardPage_errorExporting, null);
|
||||||
|
final boolean exportResourceSnapshot = fResourceSnapshotButton.getSelection();
|
||||||
|
|
||||||
IRunnableWithProgress op= new IRunnableWithProgress() {
|
IRunnableWithProgress op= new IRunnableWithProgress() {
|
||||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||||
monitor.beginTask("", projects.length); //$NON-NLS-1$
|
monitor.beginTask("", projects.length); //$NON-NLS-1$
|
||||||
for (ICProject project : projects) {
|
for (ICProject project : projects) {
|
||||||
TeamPDOMExportOperation op= new TeamPDOMExportOperation(project);
|
TeamPDOMExportOperation op= new TeamPDOMExportOperation(project);
|
||||||
op.setTargetLocation(dest);
|
op.setTargetLocation(dest);
|
||||||
|
if (exportResourceSnapshot) {
|
||||||
|
op.setOptions(TeamPDOMExportOperation.EXPORT_OPTION_RESOURCE_SNAPSHOT);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
op.run(new SubProgressMonitor(monitor, 1));
|
op.run(new SubProgressMonitor(monitor, 1));
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
@ -352,7 +379,6 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage {
|
||||||
* Answer a boolean indicating whether the receivers destination specification
|
* Answer a boolean indicating whether the receivers destination specification
|
||||||
* widgets currently all contain valid values.
|
* widgets currently all contain valid values.
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
protected boolean validateDestinationGroup() {
|
protected boolean validateDestinationGroup() {
|
||||||
String destinationValue = getDestinationValue();
|
String destinationValue = getDestinationValue();
|
||||||
if (destinationValue.length() == 0) {
|
if (destinationValue.length() == 0) {
|
||||||
|
@ -364,7 +390,6 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean validateSourceGroup() {
|
protected boolean validateSourceGroup() {
|
||||||
// there must be some resources selected for Export
|
// there must be some resources selected for Export
|
||||||
boolean isValid = true;
|
boolean isValid = true;
|
||||||
|
@ -375,17 +400,15 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage {
|
||||||
} else {
|
} else {
|
||||||
setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
}
|
}
|
||||||
return super.validateSourceGroup() && isValid;
|
return isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void updateWidgetEnablements() {
|
protected void updateWidgetEnablements() {
|
||||||
boolean pageComplete = determinePageCompletion();
|
boolean pageComplete = determinePageCompletion();
|
||||||
setPageComplete(pageComplete);
|
setPageComplete(pageComplete);
|
||||||
if (pageComplete) {
|
if (pageComplete) {
|
||||||
setMessage(null);
|
setMessage(null);
|
||||||
}
|
}
|
||||||
super.updateWidgetEnablements();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -393,13 +416,65 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage {
|
||||||
updateWidgetEnablements();
|
updateWidgetEnablements();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getErrorDialogTitle() {
|
protected String getErrorDialogTitle() {
|
||||||
return Messages.TeamProjectIndexExportWizardPage_errorDlgTitle;
|
return Messages.TeamProjectIndexExportWizardPage_errorDlgTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
protected boolean allowNewContainerName() {
|
* Returns whether this page is complete. This determination is made based upon
|
||||||
return false;
|
* the current contents of this page's controls. Subclasses wishing to include
|
||||||
}
|
* their controls in this determination should override the hook methods
|
||||||
|
* <code>validateSourceGroup</code> and/or <code>validateOptionsGroup</code>.
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if this page is complete, and <code>false</code> if
|
||||||
|
* incomplete
|
||||||
|
* @see #validateSourceGroup
|
||||||
|
* @see #validateDestinationGroup
|
||||||
|
*/
|
||||||
|
private boolean determinePageCompletion() {
|
||||||
|
boolean complete = validateSourceGroup() && validateDestinationGroup();
|
||||||
|
|
||||||
|
// Avoid draw flicker by not clearing the error
|
||||||
|
// message unless all is valid.
|
||||||
|
if (complete) {
|
||||||
|
setErrorMessage(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return complete;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if the page is complete and update the page appropriately.
|
||||||
|
*/
|
||||||
|
protected void updatePageCompletion() {
|
||||||
|
boolean pageComplete = determinePageCompletion();
|
||||||
|
setPageComplete(pageComplete);
|
||||||
|
if (pageComplete) {
|
||||||
|
setErrorMessage(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display an error dialog with the specified message.
|
||||||
|
*
|
||||||
|
* @param message the error message
|
||||||
|
*/
|
||||||
|
private void displayErrorDialog(String message) {
|
||||||
|
MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(),
|
||||||
|
getErrorDialogTitle(), message, SWT.SHEET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display an error dislog with the information from the
|
||||||
|
* supplied exception.
|
||||||
|
* @param exception Throwable
|
||||||
|
*/
|
||||||
|
private void displayErrorDialog(Throwable exception) {
|
||||||
|
String message = exception.getMessage();
|
||||||
|
//Some system exceptions have no message
|
||||||
|
if (message == null) {
|
||||||
|
message = NLS.bind(Messages.TeamProjectIndexExportWizardPage_errorInOperation, exception);
|
||||||
|
}
|
||||||
|
displayErrorDialog(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ TeamProjectIndexExportWizardPage_errorExporting=Errors occurred while exporting
|
||||||
TeamProjectIndexExportWizardPage_destinationMessage=Enter a destination archive file.
|
TeamProjectIndexExportWizardPage_destinationMessage=Enter a destination archive file.
|
||||||
TeamProjectIndexExportWizardPage_noProjectError=At least one project must be selected.
|
TeamProjectIndexExportWizardPage_noProjectError=At least one project must be selected.
|
||||||
TeamProjectIndexExportWizardPage_errorDlgTitle=Export C/C++ Index
|
TeamProjectIndexExportWizardPage_errorDlgTitle=Export C/C++ Index
|
||||||
|
TeamProjectIndexExportWizardPage_errorInOperation=Error occurred during operation: {0}
|
||||||
|
TeamProjectIndexExportWizardPage_resourceSnapshotButton=Export resource snapshot
|
||||||
StringVariableSelectionDialog_title=Select Variable
|
StringVariableSelectionDialog_title=Select Variable
|
||||||
StringVariableSelectionDialog_message=&Choose a variable (? = any character, * = any string):
|
StringVariableSelectionDialog_message=&Choose a variable (? = any character, * = any string):
|
||||||
StringVariableSelectionDialog_columnArgument=&Argument:
|
StringVariableSelectionDialog_columnArgument=&Argument:
|
||||||
|
|
Loading…
Add table
Reference in a new issue