Search in sources :

Example 11 with SaveAsDialog

use of org.eclipse.ui.dialogs.SaveAsDialog in project InformationSystem by ObeoNetwork.

the class ApplicationEditor method doSaveAs.

/**
 * This also changes the editor's input.
 * <!-- begin-user-doc -->
 * <!-- 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));
        }
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) SaveAsDialog(org.eclipse.ui.dialogs.SaveAsDialog) FileEditorInput(org.eclipse.ui.part.FileEditorInput)

Example 12 with SaveAsDialog

use of org.eclipse.ui.dialogs.SaveAsDialog in project InformationSystem by ObeoNetwork.

the class DatabaseEditor method doSaveAs.

/**
 * This also changes the editor's input.
 * <!-- begin-user-doc -->
 * <!-- 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));
        }
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) SaveAsDialog(org.eclipse.ui.dialogs.SaveAsDialog) FileEditorInput(org.eclipse.ui.part.FileEditorInput)

Example 13 with SaveAsDialog

use of org.eclipse.ui.dialogs.SaveAsDialog in project InformationSystem by ObeoNetwork.

the class OverviewEditor method doSaveAs.

/**
 * This also changes the editor's input.
 * <!-- begin-user-doc -->
 * <!-- 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));
        }
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) SaveAsDialog(org.eclipse.ui.dialogs.SaveAsDialog) FileEditorInput(org.eclipse.ui.part.FileEditorInput)

Example 14 with SaveAsDialog

use of org.eclipse.ui.dialogs.SaveAsDialog in project gemoc-studio by eclipse.

the class GexpressionsEditor method doSaveAs.

/**
 * This also changes the editor's input.
 * <!-- begin-user-doc -->
 * <!-- 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));
        }
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) SaveAsDialog(org.eclipse.ui.dialogs.SaveAsDialog) FileEditorInput(org.eclipse.ui.part.FileEditorInput)

Example 15 with SaveAsDialog

use of org.eclipse.ui.dialogs.SaveAsDialog in project webtools.sourceediting by eclipse.

the class AdvancedOptionsDialog method invokeExportDialog.

protected void invokeExportDialog() {
    IPath originalFilePath = null;
    IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
    if (projects.length > 0) {
        // $NON-NLS-1$
        originalFilePath = projects[0].getFullPath().append(".xmlcatalog");
    }
    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
            try {
                createFileIfRequired(file);
                workingUserCatalog.setLocation(fileName);
                workingUserCatalog.save();
            } catch (Exception ex) {
                try {
                    String title = XMLCatalogMessages.UI_LABEL_CATALOG_SAVE_ERROR;
                    String briefMessage = XMLCatalogMessages.UI_LABEL_CATALOG_COULD_NOT_BE_SAVED;
                    String reason = file.isReadOnly() ? NLS.bind(XMLCatalogMessages.UI_LABEL_FILE_IS_READ_ONLY, fileName) : NLS.bind(XMLCatalogMessages.ERROR_SAVING_FILE, fileName);
                    String details = NLS.bind(XMLCatalogMessages.ERROR_SAVING_FILE, fileName);
                    ErrorDialog.openError(Display.getCurrent().getActiveShell(), title, briefMessage, createStatus(reason, details));
                } catch (Exception ex2) {
                }
            }
            close();
        }
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) SaveAsDialog(org.eclipse.ui.dialogs.SaveAsDialog) IProject(org.eclipse.core.resources.IProject)

Aggregations

IPath (org.eclipse.core.runtime.IPath)42 SaveAsDialog (org.eclipse.ui.dialogs.SaveAsDialog)42 IFile (org.eclipse.core.resources.IFile)39 FileEditorInput (org.eclipse.ui.part.FileEditorInput)35 IWorkspace (org.eclipse.core.resources.IWorkspace)5 CoreException (org.eclipse.core.runtime.CoreException)5 Shell (org.eclipse.swt.widgets.Shell)4 IFileEditorInput (org.eclipse.ui.IFileEditorInput)4 File (java.io.File)3 IEditorInput (org.eclipse.ui.IEditorInput)3 FileStoreEditorInput (org.eclipse.ui.ide.FileStoreEditorInput)3 IFileStore (org.eclipse.core.filesystem.IFileStore)2 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IStatus (org.eclipse.core.runtime.IStatus)2 IFigure (org.eclipse.draw2d.IFigure)2 ScalableFreeformRootEditPart (org.eclipse.gef.editparts.ScalableFreeformRootEditPart)2 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)2 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)2 FileDialog (org.eclipse.swt.widgets.FileDialog)2