Examples of SaveAsDialog


Examples of org.eclipse.php.internal.ui.dialogs.saveFiles.SaveAsDialog

  protected void performSaveAs(IProgressMonitor progressMonitor) {
    Shell shell = getSite().getShell();
    final IEditorInput input = getEditorInput();

    IDocumentProvider provider = getDocumentProvider();
    SaveAsDialog dialog = new SaveAsDialog(shell);
    dialog.setOriginalName(input.getName());
    dialog.create();

    if (dialog.open() == Window.CANCEL) {
      if (progressMonitor != null)
        progressMonitor.setCanceled(true);
      return;
    }

    IPath newPath = dialog.getResult();
    if (newPath == null) {
      if (progressMonitor != null)
        progressMonitor.setCanceled(true);
      return;
    }
View Full Code Here

Examples of org.eclipse.ui.dialogs.SaveAsDialog

        boolean isIDE = ApacheDSConfigurationPluginUtils.isIDEEnvironment();

        if ( isIDE )
        {
            // Asking the user for the location where to 'save as' the file
            SaveAsDialog dialog = new SaveAsDialog( getSite().getShell() );
            if ( !( getEditorInput() instanceof NonExistingServerConfigurationInput ) )
            {
                dialog.setOriginalFile( ResourcesPlugin.getWorkspace().getRoot().getFile(
                    new Path( getEditorInput().getToolTipText() ) ) );
            }
            if ( dialog.open() != Dialog.OK )
            {
                return false;
            }

            // Getting if the resulting file
            IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile( dialog.getResult() );

            // Creating the file if it does not exist
            if ( !file.exists() )
            {
                file.create( new ByteArrayInputStream( "".getBytes() ), true, null ); //$NON-NLS-1$
            }

            // Creating the new input for the editor
            FileEditorInput fei = new FileEditorInput( file );

            // Saving the file to disk
            saveEditorPages();
            saveConfiguration( fei, monitor );

            // Setting the new input to the editor
            setInput( fei );
        }
        else
        {
            Shell shell = getSite().getShell();
            boolean canOverwrite = false;
            String path = null;

            while ( !canOverwrite )
            {
                // Open FileDialog
                FileDialog dialog = new FileDialog( shell, SWT.SAVE );
                path = dialog.open();
                if ( path == null )
                {
                    return false;
                }
View Full Code Here

Examples of org.eclipse.ui.dialogs.SaveAsDialog

    IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
    if (projects.length > 0) {
      originalFilePath = projects[0].getFullPath().append(".xmlcatalog"); //$NON-NLS-1$
    }

    SaveAsDialog dialog = new SaveAsDialog(getShell());
    if (originalFilePath != null) {
      IFile originalFile = ResourcesPlugin.getWorkspace().getRoot().getFile(originalFilePath);
      dialog.setOriginalFile(originalFile);
    }
    dialog.create();

    dialog.getShell().setText(XMLCatalogMessages.UI_LABEL_EXPORT_DIALOG_TITLE);
    dialog.setTitle(XMLCatalogMessages.UI_LABEL_EXPORT_DIALOG_HEADING);
    dialog.setMessage(XMLCatalogMessages.UI_LABEL_EXPORT_DIALOG_MESSAGE);

    dialog.setBlockOnOpen(true);
    int rc = dialog.open();
    if (rc == Window.OK) {
      IPath path = dialog.getResult();
      if (path != null) {
        IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
        String fileName = file.getLocation().toFile().toURI().toString();

        // here we save the catalog entries to the selected file
View Full Code Here

Examples of org.eclipse.ui.dialogs.SaveAsDialog

            e.printStackTrace();
        }
    }

    public void doSaveAs() {
        SaveAsDialog dialog = new SaveAsDialog(getSite().getWorkbenchWindow()
                .getShell());
        dialog.setOriginalFile(((IFileEditorInput) getEditorInput()).getFile());
        dialog.open();
        IPath path = dialog.getResult();

        if (path == null) {
            return;
        }
View Full Code Here

Examples of org.eclipse.ui.dialogs.SaveAsDialog

   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void doSaveAs() {
    SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
    saveAsDialog.open();
    IPath path = saveAsDialog.getResult();
    if (path != null) {
      IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
      if (file != null) {
        doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file));
      }
View Full Code Here

Examples of org.eclipse.ui.dialogs.SaveAsDialog

        newInput= new FileEditorInput(file);
      else
        newInput= new FileStoreEditorInput(fileStore);
     
    } else {
      SaveAsDialog dialog= new SaveAsDialog(shell);

      IFile original= (input instanceof IFileEditorInput) ? ((IFileEditorInput) input).getFile() : null;
      if (original != null)
        dialog.setOriginalFile(original);

      dialog.create();

      if (provider.isDeleted(input) && original != null) {
        String message= NLSUtility.format(TextEditorMessages.AbstractDecoratedTextEditor_warning_saveAs_deleted, original.getName());
        dialog.setErrorMessage(null);
        dialog.setMessage(message, IMessageProvider.WARNING);
      }

      if (dialog.open() == Window.CANCEL) {
        if (progressMonitor != null)
          progressMonitor.setCanceled(true);
        return;
      }
     
      IPath filePath= dialog.getResult();
      if (filePath == null) {
        if (progressMonitor != null)
          progressMonitor.setCanceled(true);
        return;
      }
View Full Code Here

Examples of org.eclipse.ui.dialogs.SaveAsDialog

     * @param progressMonitor The IProgressMonitor.
     */
    private void doSaveAs(final IProgressMonitor progressMonitor) {
        Shell shell = getSite().getShell();

        SaveAsDialog dialog = new SaveAsDialog(shell);

        IFile original = getFile();
        dialog.setOriginalFile(original);

        dialog.create();

        boolean cancelled = false;

        if (dialog.open() == Dialog.CANCEL) {
            if (progressMonitor != null) {
                progressMonitor.setCanceled(true);
                cancelled = true;
            }
        }

        IPath filePath = null;
        if (!cancelled) {
            filePath = dialog.getResult();
            if (filePath == null) {
                if (progressMonitor != null) {
                    progressMonitor.setCanceled(true);
                    cancelled = true;
                }
View Full Code Here

Examples of org.eclipse.ui.dialogs.SaveAsDialog

    }

    public void doSaveAs(IProgressMonitor progressMonitor) {
        Shell shell = getSite().getShell();

        SaveAsDialog dialog = new SaveAsDialog(shell);

        IFile original = getFile(getEditorInput());
        if (original != null) {
            dialog.setOriginalFile(original);
        }

        dialog.create();

        boolean cancelled = false;

        if (dialog.open() == Dialog.CANCEL) {
            if (progressMonitor != null) {
                progressMonitor.setCanceled(true);
            }
            cancelled = true;
        }

        IPath filePath = null;
        if (!cancelled) {
            filePath = dialog.getResult();
            if (filePath == null) {
                if (progressMonitor != null) {
                    progressMonitor.setCanceled(true);
                }
                cancelled = true;
View Full Code Here

Examples of org.eclipse.ui.dialogs.SaveAsDialog

  public void doSaveAs() {
    IProgressMonitor progressMonitor = getProgressMonitor();
    Shell shell = getSite().getShell();
    IEditorInput input = getEditorInput();

    SaveAsDialog dialog = new SaveAsDialog(shell);

    IFile original = (input instanceof IFileEditorInput) ? ((IFileEditorInput) input).getFile()
            : null;
    if (original != null)
      dialog.setOriginalFile(original);

    dialog.create();

    IDocumentProvider provider = getDocumentProvider();
    if (provider == null) {
      // editor has programatically been closed while the dialog was open
      return;
    }

    if (provider.isDeleted(input) && original != null) {
      String message = "The original file, '" + original.getName() + "' has been deleted";
      dialog.setErrorMessage(null);
      dialog.setMessage(message, IMessageProvider.WARNING);
    }

    if (dialog.open() == Dialog.CANCEL) {
      if (progressMonitor != null)
        progressMonitor.setCanceled(true);
      editor.setSaveAsStatus(MultiPageEditor.SAVE_AS_CANCELLED);
      return;
    }

    IPath filePath = dialog.getResult();
    if (filePath == null) {
      if (progressMonitor != null)
        progressMonitor.setCanceled(true);
      editor.setSaveAsStatus(MultiPageEditor.SAVE_AS_CANCELLED);
      return;
View Full Code Here

Examples of org.eclipse.ui.dialogs.SaveAsDialog

   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void doSaveAs() {
    SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
    saveAsDialog.open();
    IPath path = saveAsDialog.getResult();
    if (path != null) {
      IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
      if (file != null) {
        doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file));
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.