Search in sources :

Example 6 with IDEFormEditor

use of com.liferay.ide.ui.form.IDEFormEditor in project liferay-ide by liferay.

the class InputContext method doSaveAs.

/**
 * @param monitor
 */
public void doSaveAs(IProgressMonitor monitor) throws Exception {
    // Get the editor shell
    IDEFormEditor editor = getEditor();
    Shell shell = editor.getSite().getShell();
    // Create the save as dialog
    SaveAsDialog dialog = new SaveAsDialog(shell);
    // Set the initial file name to the original file name
    IFile file = null;
    if (_fEditorInput instanceof IFileEditorInput) {
        file = ((IFileEditorInput) _fEditorInput).getFile();
        dialog.setOriginalFile(file);
    }
    // Create the dialog
    dialog.create();
    if (_fDocumentProvider.isDeleted(_fEditorInput) && (file != null)) {
        String message = NLS.bind("File does not exist: {0}", file.getName());
        dialog.setErrorMessage(null);
        dialog.setMessage(message, IMessageProvider.WARNING);
    }
    if (dialog.open() == Window.OK) {
        // Get the path to where the new file will be stored
        IPath path = dialog.getResult();
        _handleSaveAs(monitor, path);
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) SaveAsDialog(org.eclipse.ui.dialogs.SaveAsDialog) IFileEditorInput(org.eclipse.ui.IFileEditorInput) IDEFormEditor(com.liferay.ide.ui.form.IDEFormEditor)

Aggregations

IDEFormEditor (com.liferay.ide.ui.form.IDEFormEditor)6 IPluginPackageModel (com.liferay.ide.portlet.core.IPluginPackageModel)1 PluginPackageModel (com.liferay.ide.portlet.core.PluginPackageModel)1 LiferayProjectSelectionDialog (com.liferay.ide.project.ui.dialog.LiferayProjectSelectionDialog)1 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)1 IPath (org.eclipse.core.runtime.IPath)1 IJavaProject (org.eclipse.jdt.core.IJavaProject)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 Viewer (org.eclipse.jface.viewers.Viewer)1 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)1 Shell (org.eclipse.swt.widgets.Shell)1 IFileEditorInput (org.eclipse.ui.IFileEditorInput)1 SaveAsDialog (org.eclipse.ui.dialogs.SaveAsDialog)1