fd7558aeda418c03d81a67d6242ce7ed43a76883
[public/netxms.git] / webui / webapp / FileManager / src / org / netxms / ui / eclipse / filemanager / dialogs / CreateFolderDialog.java
1 /**
2 * NetXMS - open source network management system
3 * Copyright (C) 2003-2011 Victor Kirhenshtein
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 package org.netxms.ui.eclipse.filemanager.dialogs;
20
21 import org.eclipse.jface.dialogs.Dialog;
22 import org.eclipse.swt.SWT;
23 import org.eclipse.swt.layout.GridData;
24 import org.eclipse.swt.layout.GridLayout;
25 import org.eclipse.swt.widgets.Composite;
26 import org.eclipse.swt.widgets.Control;
27 import org.eclipse.swt.widgets.Shell;
28 import org.netxms.ui.eclipse.filemanager.Messages;
29 import org.netxms.ui.eclipse.tools.MessageDialogHelper;
30 import org.netxms.ui.eclipse.tools.WidgetHelper;
31 import org.netxms.ui.eclipse.widgets.LabeledText;
32
33 /**
34 * Dialog for starting file upload
35 */
36 public class CreateFolderDialog extends Dialog
37 {
38 private LabeledText textNewDirectoryName;
39 private String newDirectoryName;
40
41 /**
42 *
43 * @param parentShell
44 */
45 public CreateFolderDialog(Shell parentShell)
46 {
47 super(parentShell);
48 }
49
50 /* (non-Javadoc)
51 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
52 */
53 @Override
54 protected void configureShell(Shell newShell)
55 {
56 super.configureShell(newShell);
57 newShell.setText(Messages.get().StartClientToServerFileUploadDialog_Title);
58 }
59
60 /* (non-Javadoc)
61 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
62 */
63 @Override
64 protected Control createDialogArea(Composite parent)
65 {
66 Composite dialogArea = (Composite)super.createDialogArea(parent);
67
68 GridLayout layout = new GridLayout();
69 layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
70 layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
71 layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
72 dialogArea.setLayout(layout);
73
74 textNewDirectoryName = new LabeledText(dialogArea, SWT.NONE);
75 textNewDirectoryName.setLabel("New folder name");
76 GridData gd = new GridData();
77 gd.horizontalAlignment = SWT.FILL;
78 gd.grabExcessHorizontalSpace = true;
79 textNewDirectoryName.setLayoutData(gd);
80
81 return dialogArea;
82 }
83
84 /* (non-Javadoc)
85 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
86 */
87 @Override
88 protected void okPressed()
89 {
90 newDirectoryName = textNewDirectoryName.getText();
91
92 super.okPressed();
93 }
94
95 /**
96 * @return the remoteFileName
97 */
98 public String getNewName()
99 {
100 return newDirectoryName;
101 }
102 }