org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages Java Examples

The following examples show how to use org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImportProjectWizard.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
    * Constructor for ExternalProjectImportWizard.
    * 
    * @param initialPath Default path for wizard to import
    * @since 3.5
    */
public ImportProjectWizard(String initialPath)
   {
       super();
       this.initialPath = initialPath;
       setWindowTitle(DataTransferMessages.DataTransfer_importTitle);
       setNeedsProgressMonitor(true);
       IDialogSettings workbenchSettings = IDEWorkbenchPlugin.getDefault()
       		.getDialogSettings();
       
	IDialogSettings wizardSettings = workbenchSettings
	        .getSection(IMPORT_PROJECT_SECTION);
	if (wizardSettings == null) {
		wizardSettings = workbenchSettings
	            .addNewSection(IMPORT_PROJECT_SECTION);
	}
	setDialogSettings(wizardSettings);        
   }
 
Example #2
Source File: ImportProjectWizard.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
    * Constructor for ExternalProjectImportWizard.
    * 
    * @param initialPath Default path for wizard to import
    * @since 3.5
    */
public ImportProjectWizard(String initialPath)
   {
       super();
       this.initialPath = initialPath;
       setWindowTitle(DataTransferMessages.DataTransfer_importTitle);
       setNeedsProgressMonitor(true);
       IDialogSettings workbenchSettings = IDEWorkbenchPlugin.getDefault()
       		.getDialogSettings();
       
	IDialogSettings wizardSettings = workbenchSettings
	        .getSection(IMPORT_PROJECT_SECTION);
	if (wizardSettings == null) {
		wizardSettings = workbenchSettings
	            .addNewSection(IMPORT_PROJECT_SECTION);
	}
	setDialogSettings(wizardSettings);        
   }
 
Example #3
Source File: ImportProjectWizardPage.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Collect the list of .project files that are under directory into files.
 *
 * @param files
 * @param monitor
 *            The monitor to report to
 * @return boolean <code>true</code> if the operation was completed.
 */
private boolean collectProjectFilesFromProvider(final Collection<ProjectRecord> files, final Object entry,
		final int level, final IProgressMonitor monitor) {

	if (monitor.isCanceled()) { return false; }
	monitor.subTask(NLS.bind(DataTransferMessages.WizardProjectsImportPage_CheckingMessage,
			structureProvider.getLabel(entry)));
	List<?> children = structureProvider.getChildren(entry);
	if (children == null) {
		children = new ArrayList<>(1);
	}
	final Iterator<?> childrenEnum = children.iterator();
	while (childrenEnum.hasNext()) {
		final Object child = childrenEnum.next();
		if (structureProvider.isFolder(child)) {
			collectProjectFilesFromProvider(files, child, level + 1, monitor);
		}
		final String elementLabel = structureProvider.getLabel(child);
		if (elementLabel.equals(IProjectDescription.DESCRIPTION_FILE_NAME)) {
			files.add(new ProjectRecord(child, entry, level));
		}
	}
	return true;
}
 
Example #4
Source File: ExportProjectWizardPage.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Open an appropriate destination browser so that the user can specify a source to import from
 */
protected void handleDestinationBrowseButtonPressed() {
	FileDialog dialog = new FileDialog(getContainer().getShell(), SWT.SAVE | SWT.SHEET);
	dialog.setFilterExtensions(new String[] { "*.hszip", "*" }); //$NON-NLS-1$ //$NON-NLS-2$
	dialog.setText(DataTransferMessages.ArchiveExport_selectDestinationTitle);
	String currentSourceString = getDestinationValue();
	int lastSeparatorIndex = currentSourceString.lastIndexOf(File.separator);
	if (lastSeparatorIndex != -1) {
		dialog.setFilterPath(currentSourceString.substring(0, lastSeparatorIndex));
	}
	String selectedFileName = dialog.open();

	if (selectedFileName != null) {
		setErrorMessage(null);
		setDestinationValue(selectedFileName);
		if (getWhiteCheckedResources().size() > 0) {
			setDescription(null);
		}
	}
}
 
Example #5
Source File: ExportProjectWizardPage.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Open an appropriate destination browser so that the user can specify a source to import from
 */
protected void handleDestinationBrowseButtonPressed() {
	FileDialog dialog = new FileDialog(getContainer().getShell(), SWT.SAVE | SWT.SHEET);
	dialog.setFilterExtensions(new String[] { "*.hszip", "*" }); //$NON-NLS-1$ //$NON-NLS-2$
	dialog.setText(DataTransferMessages.ArchiveExport_selectDestinationTitle);
	String currentSourceString = getDestinationValue();
	int lastSeparatorIndex = currentSourceString.lastIndexOf(File.separator);
	if (lastSeparatorIndex != -1) {
		dialog.setFilterPath(currentSourceString.substring(0, lastSeparatorIndex));
	}
	String selectedFileName = dialog.open();

	if (selectedFileName != null) {
		setErrorMessage(null);
		setDestinationValue(selectedFileName);
		if (getWhiteCheckedResources().size() > 0) {
			setDescription(null);
		}
	}
}
 
Example #6
Source File: ExportProjectWizardPage.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a boolean indicating whether the passed File handle is is valid and available for use.
 */
protected boolean ensureTargetFileIsValid(File targetFile) {
	if (targetFile.exists() && targetFile.isDirectory()) {
		displayErrorDialog(DataTransferMessages.ZipExport_mustBeFile);
		giveFocusToDestination();
		return false;
	}

	if (targetFile.exists()) {
		if (targetFile.canWrite()) {
			if (!queryYesNoQuestion(DataTransferMessages.ZipExport_alreadyExists)) {
				return false;
			}
		} else {
			displayErrorDialog(DataTransferMessages.ZipExport_alreadyExistsError);
			giveFocusToDestination();
			return false;
		}
	}

	return true;
}
 
Example #7
Source File: ExportProjectWizardPage.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a boolean indicating whether the passed File handle is is valid and available for use.
 */
protected boolean ensureTargetFileIsValid(File targetFile) {
	if (targetFile.exists() && targetFile.isDirectory()) {
		displayErrorDialog(DataTransferMessages.ZipExport_mustBeFile);
		giveFocusToDestination();
		return false;
	}

	if (targetFile.exists()) {
		if (targetFile.canWrite()) {
			if (!queryYesNoQuestion(DataTransferMessages.ZipExport_alreadyExists)) {
				return false;
			}
		} else {
			displayErrorDialog(DataTransferMessages.ZipExport_alreadyExistsError);
			giveFocusToDestination();
			return false;
		}
	}

	return true;
}
 
Example #8
Source File: WizardFileSystemResourceExportPage2.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Answer a boolean indicating whether the receivers destination specification widgets currently all contain valid
 * values.
 */
protected boolean validateDestinationGroup() {
	String destinationValue = getDestinationValue();
	if (destinationValue.length() == 0) {
		setMessage(destinationEmptyMessage());
		return false;
	}

	String conflictingContainer = getConflictingContainerNameFor(destinationValue);
	if (conflictingContainer == null) {
		// no error message, but warning may exists
		String threatenedContainer = getOverlappingProjectName(destinationValue);
		if (threatenedContainer == null)
			setMessage(null);
		else
			setMessage(NLS.bind(DataTransferMessages.FileExport_damageWarning, threatenedContainer), WARNING);

	} else {
		setErrorMessage(NLS.bind(DataTransferMessages.FileExport_conflictingContainer, conflictingContainer));
		giveFocusToDestination();
		return false;
	}

	return true;
}
 
Example #9
Source File: WizardFileSystemResourceExportPage2.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Attempts to ensure that the specified directory exists on the local file system. Answers a boolean indicating
 * success.
 * @return boolean
 * @param directory
 *            java.io.File
 */
protected boolean ensureDirectoryExists(File directory) {
	if (!directory.exists()) {
		if (!queryYesNoQuestion(DataTransferMessages.DataTransfer_createTargetDirectory)) {
			return false;
		}

		if (!directory.mkdirs()) {
			displayErrorDialog(DataTransferMessages.DataTransfer_directoryCreationError);
			giveFocusToDestination();
			return false;
		}
	}

	return true;
}
 
Example #10
Source File: WizardFileSystemResourceExportPage2.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Attempts to ensure that the specified directory exists on the local file system. Answers a boolean indicating
 * success.
 * @return boolean
 * @param directory
 *            java.io.File
 */
protected boolean ensureDirectoryExists(File directory) {
	if (!directory.exists()) {
		if (!queryYesNoQuestion(DataTransferMessages.DataTransfer_createTargetDirectory)) {
			return false;
		}

		if (!directory.mkdirs()) {
			displayErrorDialog(DataTransferMessages.DataTransfer_directoryCreationError);
			giveFocusToDestination();
			return false;
		}
	}

	return true;
}
 
Example #11
Source File: WizardFileSystemResourceExportPage2.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Answer a boolean indicating whether the receivers destination specification widgets currently all contain valid
 * values.
 */
protected boolean validateDestinationGroup() {
	String destinationValue = getDestinationValue();
	if (destinationValue.length() == 0) {
		setMessage(destinationEmptyMessage());
		return false;
	}

	String conflictingContainer = getConflictingContainerNameFor(destinationValue);
	if (conflictingContainer == null) {
		// no error message, but warning may exists
		String threatenedContainer = getOverlappingProjectName(destinationValue);
		if (threatenedContainer == null)
			setMessage(null);
		else
			setMessage(NLS.bind(DataTransferMessages.FileExport_damageWarning, threatenedContainer), WARNING);

	} else {
		setErrorMessage(NLS.bind(DataTransferMessages.FileExport_conflictingContainer, conflictingContainer));
		giveFocusToDestination();
		return false;
	}

	return true;
}
 
Example #12
Source File: ImportProjectWizardPage.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * The browse button has been selected. Select the location.
 */
protected void handleLocationArchiveButtonPressed() {

	FileDialog dialog = new FileDialog(archivePathField.getShell(), SWT.SHEET);
	dialog.setFilterExtensions(FILE_IMPORT_MASK);
	dialog
			.setText(DataTransferMessages.WizardProjectsImportPage_SelectArchiveDialogTitle);

	String fileName = archivePathField.getText().trim();
	if (fileName.length() == 0) {
		fileName = previouslyBrowsedArchive;
	}

	if (fileName.length() == 0) {
		dialog.setFilterPath(IDEWorkbenchPlugin.getPluginWorkspace()
				.getRoot().getLocation().toOSString());
	} else {
		File path = new File(fileName).getParentFile();
		if (path != null && path.exists()) {
			dialog.setFilterPath(path.toString());
		}
	}

	String selectedArchive = dialog.open();
	if (selectedArchive != null) {
		previouslyBrowsedArchive = selectedArchive;
		archivePathField.setText(previouslyBrowsedArchive);
		updateProjectsList(selectedArchive);
	}

}
 
Example #13
Source File: ImportProjectWizardPage.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * More (many more) parameters.
 * 
 * @param pageName
 * @param initialPath
 * @param currentSelection
 * @since 3.5
 */
public ImportProjectWizardPage(String pageName,String initialPath,
		IStructuredSelection currentSelection) {
		super(pageName);
	this.initialPath = initialPath;
	this.currentSelection = currentSelection;
	setPageComplete(false);
	setTitle(DataTransferMessages.WizardProjectsImportPage_ImportProjectsTitle);
	setDescription(Messages.getString("wizard.ImportProjectWizardPage.desc"));
	setImageDescriptor(Activator.getImageDescriptor("images/importProject_logo.png"));
}
 
Example #14
Source File: ImportProjectWizardPage2.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("restriction")
protected ImportProjectWizardPage2(String pageName, String initialPath, IStructuredSelection currentSelection) {
	super(pageName);
	setTitle(DataTransferMessages.DataTransfer_importTitle);

	initData();
}
 
Example #15
Source File: JavaCamelJobScriptsExportWSWizardPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
protected void createDestinationGroup(Composite parent) {
    Font font = parent.getFont();
    // destination specification group
    Composite destinationSelectionGroup = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    destinationSelectionGroup.setLayout(layout);
    destinationSelectionGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
    destinationSelectionGroup.setFont(font);

    destinationLabel = new Label(destinationSelectionGroup, SWT.NONE);
    destinationLabel.setText(getDestinationLabel());
    destinationLabel.setFont(font);

    // destination name entry field
    destinationNameField = new Combo(destinationSelectionGroup, SWT.SINGLE | SWT.BORDER);
    destinationNameField.addListener(SWT.Modify, this);
    destinationNameField.addListener(SWT.Selection, this);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    destinationNameField.setLayoutData(data);
    destinationNameField.setFont(font);
    BidiUtils.applyBidiProcessing(destinationNameField, "file"); //$NON-NLS-1$

    // destination browse button
    destinationBrowseButton = new Button(destinationSelectionGroup, SWT.PUSH);
    destinationBrowseButton.setText(DataTransferMessages.DataTransfer_browse);
    destinationBrowseButton.addListener(SWT.Selection, this);
    destinationBrowseButton.setFont(font);
    setButtonLayoutData(destinationBrowseButton);

    new Label(parent, SWT.NONE); // vertical spacer
}
 
Example #16
Source File: WizardFileSystemResourceExportPage2.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create the export destination specification widgets
 * @param parent
 *            org.eclipse.swt.widgets.Composite
 */
protected void createDestinationGroup(Composite parent) {

	Font font = parent.getFont();
	// destination specification group
	Composite destinationSelectionGroup = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 3;
	destinationSelectionGroup.setLayout(layout);
	destinationSelectionGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
			| GridData.VERTICAL_ALIGN_FILL));
	destinationSelectionGroup.setFont(font);

	Label destinationLabel = new Label(destinationSelectionGroup, SWT.NONE);
	destinationLabel.setText(getDestinationLabel());
	destinationLabel.setFont(font);

	// destination name entry field
	destinationNameField = new Text(destinationSelectionGroup, SWT.BORDER);
	destinationNameField.addListener(SWT.Modify, this);
	destinationNameField.addListener(SWT.Selection, this);
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
	data.widthHint = SIZING_TEXT_FIELD_WIDTH;
	destinationNameField.setLayoutData(data);
	destinationNameField.setFont(font);

	// destination browse button
	destinationBrowseButton = new Button(destinationSelectionGroup, SWT.PUSH);
	destinationBrowseButton.setText(DataTransferMessages.DataTransfer_browse);
	destinationBrowseButton.addListener(SWT.Selection, this);
	destinationBrowseButton.setFont(font);
	setButtonLayoutData(destinationBrowseButton);

	new Label(parent, SWT.NONE); // vertical spacer
}
 
Example #17
Source File: WizardFileSystemResourceExportPage2.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create the button for checking if we should ask if we are going to overwrite existing files.
 * @param optionsGroup
 * @param font
 */
protected void createOverwriteExisting(Group optionsGroup, Font font) {
	// overwrite... checkbox
	overwriteExistingFilesCheckbox = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
	overwriteExistingFilesCheckbox.setText(DataTransferMessages.ExportFile_overwriteExisting);
	overwriteExistingFilesCheckbox.setFont(font);
}
 
Example #18
Source File: WizardFileSystemResourceExportPage2.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the target for export does not exist then attempt to create it. Answer a boolean indicating whether the target
 * exists (ie.- if it either pre-existed or this method was able to create it)
 * @return boolean
 */
protected boolean ensureTargetIsValid(File targetDirectory) {
	if (targetDirectory.exists() && !targetDirectory.isDirectory()) {
		displayErrorDialog(DataTransferMessages.FileExport_directoryExists);
		giveFocusToDestination();
		return false;
	}

	return ensureDirectoryExists(targetDirectory);
}
 
Example #19
Source File: WizardFileSystemResourceExportPage2.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
protected boolean validateSourceGroup() {
	// there must be some resources selected for Export
	boolean isValid = true;
	List resourcesToExport = getWhiteCheckedResources();
	if (resourcesToExport.size() == 0) {
		setErrorMessage(DataTransferMessages.FileExport_noneSelected);
		isValid = false;
	} else if (getDestinationValue() != null && !getDestinationValue().equals("")){
		setDescription("");
	} else {
		setErrorMessage(null);
		
	}
	return super.validateSourceGroup() && isValid;
}
 
Example #20
Source File: ArchiveFileExportOperation2.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the status of the operation. If there were any errors, the result is a status object containing
 * individual status objects for each error. If there were no errors, the result is a status object with error code
 * <code>OK</code>.
 * @return the status
 */
public IStatus getStatus() {
	IStatus[] errors = new IStatus[errorTable.size()];
	errorTable.toArray(errors);
	return new MultiStatus(IDEWorkbenchPlugin.IDE_WORKBENCH, IStatus.OK, errors,
			DataTransferMessages.FileSystemExportOperation_problemsExporting, null);
}
 
Example #21
Source File: ImportProjectWizardPage.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the label to be used when rendering this project record in the
 * UI.
 * 
 * @return String the label
 * @since 3.4
 */
public String getProjectLabel() {
	if (description == null)
		return projectName;

	String path = projectSystemFile == null ? structureProvider
			.getLabel(parent) : projectSystemFile
			.getParent();

	return NLS.bind(
			DataTransferMessages.WizardProjectsImportPage_projectLabel,
			projectName, path);
}
 
Example #22
Source File: ImportProjectWizardPage.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * More (many more) parameters.
 * 
 * @param pageName
 * @param initialPath
 * @param currentSelection
 * @since 3.5
 */
public ImportProjectWizardPage(String pageName,String initialPath,
		IStructuredSelection currentSelection) {
		super(pageName);
	this.initialPath = initialPath;
	this.currentSelection = currentSelection;
	setPageComplete(false);
	setTitle(DataTransferMessages.WizardProjectsImportPage_ImportProjectsTitle);
	setDescription(Messages.getString("wizard.ImportProjectWizardPage.desc"));
	setImageDescriptor(Activator.getImageDescriptor("images/importProject_logo.png"));
}
 
Example #23
Source File: ImportProjectWizardPage.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * The browse button has been selected. Select the location.
 */
protected void handleLocationArchiveButtonPressed() {

	FileDialog dialog = new FileDialog(archivePathField.getShell(), SWT.SHEET);
	dialog.setFilterExtensions(FILE_IMPORT_MASK);
	dialog
			.setText(DataTransferMessages.WizardProjectsImportPage_SelectArchiveDialogTitle);

	String fileName = archivePathField.getText().trim();
	if (fileName.length() == 0) {
		fileName = previouslyBrowsedArchive;
	}

	if (fileName.length() == 0) {
		dialog.setFilterPath(IDEWorkbenchPlugin.getPluginWorkspace()
				.getRoot().getLocation().toOSString());
	} else {
		File path = new File(fileName).getParentFile();
		if (path != null && path.exists()) {
			dialog.setFilterPath(path.toString());
		}
	}

	String selectedArchive = dialog.open();
	if (selectedArchive != null) {
		previouslyBrowsedArchive = selectedArchive;
		archivePathField.setText(previouslyBrowsedArchive);
		updateProjectsList(selectedArchive);
	}

}
 
Example #24
Source File: ImportProjectWizardPage2.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("restriction")
protected ImportProjectWizardPage2(String pageName,String initialPath, IStructuredSelection currentSelection) {
	super(pageName);
	setTitle(DataTransferMessages.DataTransfer_importTitle);
	
	initData();
}
 
Example #25
Source File: WizardFileSystemResourceExportPage2.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create the export destination specification widgets
 * @param parent
 *            org.eclipse.swt.widgets.Composite
 */
protected void createDestinationGroup(Composite parent) {

	Font font = parent.getFont();
	// destination specification group
	Composite destinationSelectionGroup = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 3;
	destinationSelectionGroup.setLayout(layout);
	destinationSelectionGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
			| GridData.VERTICAL_ALIGN_FILL));
	destinationSelectionGroup.setFont(font);

	Label destinationLabel = new Label(destinationSelectionGroup, SWT.NONE);
	destinationLabel.setText(getDestinationLabel());
	destinationLabel.setFont(font);

	// destination name entry field
	destinationNameField = new Text(destinationSelectionGroup, SWT.BORDER);
	destinationNameField.addListener(SWT.Modify, this);
	destinationNameField.addListener(SWT.Selection, this);
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
	data.widthHint = SIZING_TEXT_FIELD_WIDTH;
	destinationNameField.setLayoutData(data);
	destinationNameField.setFont(font);

	// destination browse button
	destinationBrowseButton = new Button(destinationSelectionGroup, SWT.PUSH);
	destinationBrowseButton.setText(DataTransferMessages.DataTransfer_browse);
	destinationBrowseButton.addListener(SWT.Selection, this);
	destinationBrowseButton.setFont(font);
	setButtonLayoutData(destinationBrowseButton);

	new Label(parent, SWT.NONE); // vertical spacer
}
 
Example #26
Source File: GzipLeveledStructureProvider.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean closeArchive() {
    try {
        fFile.close();
    } catch (IOException e) {
        Activator.getDefault().logError(DataTransferMessages.ZipImport_couldNotClose
                + fFile.getName(), e);
        return false;
    }
    return true;
}
 
Example #27
Source File: TarLeveledStructureProvider.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean closeArchive(){
    try {
        getTarFile().close();
    } catch (IOException e) {
        IDEWorkbenchPlugin.log(DataTransferMessages.ZipImport_couldNotClose
                + getTarFile().getName(), e);
        return false;
    }
    return true;
}
 
Example #28
Source File: ImportProjectWizardPage.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets the label to be used when rendering this project record in the UI.
 *
 * @return String the label
 * @since 3.4
 */
public String getProjectLabel() {
	final String path =
			projectSystemFile == null ? structureProvider.getLabel(parent) : projectSystemFile.getParent();

	return NLS.bind(DataTransferMessages.WizardProjectsImportPage_projectLabel, projectName, path);
}
 
Example #29
Source File: ImportProjectWizardPage.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
private void updateProjectsStatus() {
	projectsList.refresh(true);
	final ProjectRecord[] projects = getProjectRecords();

	boolean displayConflictWarning = false;
	boolean displayInvalidWarning = false;

	for (final ProjectRecord project : projects) {
		if (project.hasConflicts || project.isInvalid) {
			projectsList.setGrayed(project, true);
			displayConflictWarning |= project.hasConflicts;
			displayInvalidWarning |= project.isInvalid;
		} else {
			projectsList.setChecked(project, true);
		}
	}

	if (displayConflictWarning && displayInvalidWarning) {
		setMessage(DataTransferMessages.WizardProjectsImportPage_projectsInWorkspaceAndInvalid, WARNING);
	} else if (displayConflictWarning) {
		setMessage(DataTransferMessages.WizardProjectsImportPage_projectsInWorkspace, WARNING);
	} else if (displayInvalidWarning) {
		setMessage(DataTransferMessages.WizardProjectsImportPage_projectsInvalid, WARNING);
	} else {
		setMessage("Select a directory or an archive to search for existing GAMA projects.");
	}
	setPageComplete(projectsList.getCheckedElements().length > 0);
	if (selectedProjects.length == 0) {
		setMessage(DataTransferMessages.WizardProjectsImportPage_noProjectsToImport, WARNING);
	}
}
 
Example #30
Source File: ImportProjectWizardPage.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
/**
 * The browse button has been selected. Select the location.
 */
protected void handleLocationDirectoryButtonPressed() {

	final DirectoryDialog dialog = new DirectoryDialog(directoryPathField.getShell(), SWT.SHEET);
	dialog.setMessage(DataTransferMessages.WizardProjectsImportPage_SelectDialogTitle);

	String dirName = directoryPathField.getText().trim();
	if (dirName.length() == 0) {
		dirName = previouslyBrowsedDirectory;
	}

	if (dirName.length() == 0) {
		dialog.setFilterPath(IDEWorkbenchPlugin.getPluginWorkspace().getRoot().getLocation().toOSString());
	} else {
		final File path = new File(dirName);
		if (path.exists()) {
			dialog.setFilterPath(new Path(dirName).toOSString());
		}
	}

	final String selectedDirectory = dialog.open();
	if (selectedDirectory != null) {
		previouslyBrowsedDirectory = selectedDirectory;
		directoryPathField.setText(previouslyBrowsedDirectory);
		updateProjectsList(selectedDirectory);
	}

}