Java 类org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages 实例源码

项目:gama    文件:ImportProjectWizardPage.java   
/**
 * 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<Object>(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;
}
项目:OpenSPIFe    文件:AbstractEnsembleProjectExportWizardPage.java   
/**
 * Create the buttons for the group that determine if the entire or
 * selected directory structure should be created.
 * @param optionsGroup
 * @param font
 */
protected void createDirectoryStructureOptions(Composite optionsGroup, Font font) {
    // create directory structure radios
    createDirectoryStructureButton = new Button(optionsGroup, SWT.RADIO
            | SWT.LEFT);
    createDirectoryStructureButton.setText(DataTransferMessages.FileExport_createDirectoryStructure);
    createDirectoryStructureButton.setSelection(false);
    createDirectoryStructureButton.setFont(font);

    // create directory structure radios
    createSelectionOnlyButton = new Button(optionsGroup, SWT.RADIO
            | SWT.LEFT);
    createSelectionOnlyButton.setText(DataTransferMessages.FileExport_createSelectedDirectories);
    createSelectionOnlyButton.setSelection(true);
    createSelectionOnlyButton.setFont(font);
}
项目:OpenSPIFe    文件:AbstractEnsembleProjectExportWizardPage.java   
/**
  * 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("Directory " + directory.getAbsolutePath()
                + " does not exist. Would you like to create it?")) {
    return false;
}

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

     return true;
 }
项目:OpenSPIFe    文件:SPIFePlanIntegrationWizardPage.java   
/**
 * Create the area with the extra options.
 * 
 * @param workArea
 */
@SuppressWarnings("unused")
private void createOptionsArea(Composite workArea) {
    Composite optionsGroup = new Composite(workArea, SWT.NONE);
    optionsGroup.setLayout(new GridLayout());
    optionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    copyCheckbox = new Button(optionsGroup, SWT.CHECK);
    copyCheckbox
            .setText(DataTransferMessages.WizardProjectsImportPage_CopyProjectsIntoWorkspace);
    copyCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    copyCheckbox.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            copyFiles = copyCheckbox.getSelection();
        }
    });
}
项目:translationstudio8    文件:WizardFileSystemResourceExportPage2.java   
/**
 * 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;
}
项目:translationstudio8    文件:WizardFileSystemResourceExportPage2.java   
/**
 * 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;
}
项目:translationstudio8    文件:ExportProjectWizardPage.java   
/**
 * 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;
}
项目:translationstudio8    文件:ExportProjectWizardPage.java   
/**
 * 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);
        }
    }
}
项目:translationstudio8    文件:ImportProjectWizard.java   
/**
    * 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);        
   }
项目:sadlos2    文件:OwlImportOperation.java   
/**
   * Imports the specified file system objects into the workspace.
   * If the import fails, adds a status object to the list to be returned by
   * <code>getStatus</code>.
   *
   * @param filesToImport the list of file system objects to import
   *   (element type: <code>Object</code>)
* @throws CoreException 
   * @exception OperationCanceledException if canceled
   */
  void importFileSystemObjects(List filesToImport) throws CoreException {
      Iterator filesEnum = filesToImport.iterator();
      while (filesEnum.hasNext()) {
          Object fileSystemObject = filesEnum.next();
          if (source == null) {
              // We just import what we are given into the destination
              IPath sourcePath = new Path(provider
                      .getFullPath(fileSystemObject)).removeLastSegments(1);
              if (provider.isFolder(fileSystemObject) && sourcePath.isEmpty()) {
                  // If we don't have a parent then we have selected the
                  // file systems root. Roots can't copied (at least not
                  // under windows).
                  errorTable.add(new Status(IStatus.INFO,
                          PlatformUI.PLUGIN_ID, 0, DataTransferMessages.ImportOperation_cannotCopy,
                          null));
                  continue;
              }
              source = sourcePath.toFile();
          }
          importRecursivelyFrom(fileSystemObject, POLICY_DEFAULT);
      }
  }
项目:sadlos2    文件:OwlImportOperation.java   
/**
   * Queries the user whether the resource with the specified path should be
   * overwritten by a file system object that is being imported.
   * 
   * @param resourcePath the workspace path of the resource that needs to be overwritten
   * @return <code>true</code> to overwrite, <code>false</code> to not overwrite
   * @exception OperationCanceledException if canceled
   */
  boolean queryOverwrite(IPath resourcePath)
          throws OperationCanceledException {
      String overwriteAnswer = overwriteCallback.queryOverwrite(resourcePath
              .makeRelative().toString());

      if (overwriteAnswer.equals(IOverwriteQuery.CANCEL)) {
    throw new OperationCanceledException(DataTransferMessages.DataTransfer_emptyString);
}

      if (overwriteAnswer.equals(IOverwriteQuery.NO)) {
          return false;
      }

      if (overwriteAnswer.equals(IOverwriteQuery.NO_ALL)) {
          this.overwriteState = OVERWRITE_NONE;
          return false;
      }

      if (overwriteAnswer.equals(IOverwriteQuery.ALL)) {
    this.overwriteState = OVERWRITE_ALL;
}

      return true;
  }
项目:tmxeditor8    文件:WizardFileSystemResourceExportPage2.java   
/**
 * 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;
}
项目:tmxeditor8    文件:WizardFileSystemResourceExportPage2.java   
/**
 * 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;
}
项目:tmxeditor8    文件:ExportProjectWizardPage.java   
/**
 * 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;
}
项目:tmxeditor8    文件:ExportProjectWizardPage.java   
/**
 * 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);
        }
    }
}
项目:tmxeditor8    文件:ImportProjectWizard.java   
/**
    * 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);        
   }
项目:n4js    文件:AbstractExportToSingleFileWizardPage.java   
/**
 * 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)
 */
private boolean ensureTargetDirectoryIsValid(File targetDirectory) {
    if (targetDirectory.exists() && !targetDirectory.isDirectory()) {
        displayErrorDialog(DataTransferMessages.FileExport_directoryExists);
        giveFocusToDestination();
        return false;
    }

    return ensureDirectoryExists(targetDirectory);
}
项目:n4js    文件:ExportSelectionPage.java   
@Override
protected void createOptionsGroupButtons(Group optionsGroup) {
    Font font = optionsGroup.getFont();
    optionsGroup.setLayout(new GridLayout(2, true));

    Composite left = new Composite(optionsGroup, SWT.NONE);
    left.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
    left.setLayout(new GridLayout(1, true));

    // compress... checkbox
    compressContentsCheckbox = new Button(left, SWT.CHECK | SWT.LEFT);
    compressContentsCheckbox.setText(DataTransferMessages.ZipExport_compressContents);
    compressContentsCheckbox.setFont(font);

}
项目:gama    文件:ImportProjectWizardPage.java   
/**
 * 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);
}
项目:gama    文件:ImportProjectWizardPage.java   
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);
    }
}
项目:gama    文件:ImportProjectWizardPage.java   
/**
 * 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);
    }

}
项目:gama    文件:ImportProjectWizardPage.java   
/**
 * The browse button has been selected. Select the location.
 */
protected void handleLocationArchiveButtonPressed() {

    final 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 {
        final File path = new File(fileName).getParentFile();
        if (path != null && path.exists()) {
            dialog.setFilterPath(path.toString());
        }
    }

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

}
项目:APICloud-Studio    文件:WizardFolderImportPage.java   
/**
 * The browse button has been selected. Select the location.
 */
protected void handleLocationDirectoryButtonPressed()
{

    DirectoryDialog dialog = new DirectoryDialog(directoryPathField.getShell());
    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
    {
        File path = new File(dirName);
        if (path.exists())
        {
            dialog.setFilterPath(new Path(dirName).toOSString());
        }
    }

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

    setProjectName();

    setPageComplete(directoryPathField.getText() != null);

}
项目:OpenSPIFe    文件:AbstractEnsembleProjectExportWizardPage.java   
/**
 * Create an instance of this class.
 *
 * @param selection the selection
 */
public AbstractEnsembleProjectExportWizardPage(IStructuredSelection selection) {
    this("fileSystemExportPage1", selection); //$NON-NLS-1$
    setTitle(DataTransferMessages.DataTransfer_fileSystemTitle);
    setDescription(DataTransferMessages.FileExport_exportLocalFileSystem);
    this.currentSelection = selection;
}
项目:OpenSPIFe    文件:AbstractEnsembleProjectExportWizardPage.java   
/**
 * 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);
}
项目:OpenSPIFe    文件:AbstractEnsembleProjectExportWizardPage.java   
/**
 *  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);
}
项目:OpenSPIFe    文件:AbstractEnsembleProjectExportWizardPage.java   
/**
    *   Answer a boolean indicating whether the receivers destination specification
    *   widgets currently all contain valid values.
    */
   @Override
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;
   }
项目:OpenSPIFe    文件:AbstractEnsembleProjectExportWizardPage.java   
@Override
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 {
        setErrorMessage(null);
    }
    return super.validateSourceGroup() && isValid;
}
项目:OpenSPIFe    文件:SPIFePlanIntegrationWizardPage.java   
/**
 * 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);
}
项目:OpenSPIFe    文件:SPIFePlanIntegrationWizardPage.java   
/**
 * 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(Collection files,
        Object entry, int level, 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);
    }
    Iterator childrenEnum = children.iterator();
    while (childrenEnum.hasNext()) {
        Object child = childrenEnum.next();
        if (structureProvider.isFolder(child)) {
            collectProjectFilesFromProvider(files, child, level + 1,
                    monitor);
        }
        String elementLabel = structureProvider.getLabel(child);
        if (elementLabel.equals(IProjectDescription.DESCRIPTION_FILE_NAME)) {
            files.add(new ProjectRecord(child, entry, level));
        }
    }
    return true;
}
项目:OpenSPIFe    文件:SPIFePlanIntegrationWizardPage.java   
/**
 * The browse button has been selected. Select the location.
 */
protected void handleLocationDirectoryButtonPressed() {

    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 {
        File path = new File(dirName);
        if (path.exists()) {
            dialog.setFilterPath(new Path(dirName).toOSString());
        }
    }

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

}
项目:OpenSPIFe    文件:SPIFePlanIntegrationWizardPage.java   
/**
 * 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);
    }

}
项目:translationstudio8    文件:WizardFileSystemResourceExportPage2.java   
/**
 * 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
}
项目:translationstudio8    文件:WizardFileSystemResourceExportPage2.java   
/**
 * 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);
}
项目:translationstudio8    文件:WizardFileSystemResourceExportPage2.java   
/**
 * 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);
}
项目:translationstudio8    文件:WizardFileSystemResourceExportPage2.java   
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;
}
项目:translationstudio8    文件:ArchiveFileExportOperation2.java   
/**
 * 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);
}
项目:translationstudio8    文件:ImportProjectWizardPage.java   
/**
 * 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);
}
项目:translationstudio8    文件:ImportProjectWizardPage.java   
/**
 * 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"));
}
项目:translationstudio8    文件:ImportProjectWizardPage.java   
/**
 * 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(Collection files,
        Object entry, int level, 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);
    }
    Iterator childrenEnum = children.iterator();
    while (childrenEnum.hasNext()) {
        Object child = childrenEnum.next();
        if (structureProvider.isFolder(child)) {
            collectProjectFilesFromProvider(files, child, level + 1,
                    monitor);
        }
        String elementLabel = structureProvider.getLabel(child);
        if (elementLabel.equals(IProjectDescription.DESCRIPTION_FILE_NAME)) {
            files.add(new ProjectRecord(child, entry, level));
        }
    }
    return true;
}