Package org.eclipse.jface.dialogs

Examples of org.eclipse.jface.dialogs.InputDialog


        saveAllButton.setImage(saveAllImg);
        saveAllButton.setToolTipText(Messages.PointPropertiesEditor_17);
        saveAllButton.addSelectionListener(new SelectionAdapter(){
            public void widgetSelected( SelectionEvent e ) {
                String newStyleName = Messages.PointPropertiesEditor_18;
                InputDialog iDialog = new InputDialog(saveAllButton.getShell(), Messages.PointPropertiesEditor_19,
                        Messages.PointPropertiesEditor_20, newStyleName, null);
                iDialog.setBlockOnOpen(true);
                int open = iDialog.open();
                if (open == SWT.CANCEL) {
                    return;
                }
                String name = iDialog.getValue();
                if (name == null || name.length() == 0) {
                    name = newStyleName;
                }
                styleWrapper.setName(name);
                try {
View Full Code Here


        saveAllButton.setImage(saveAllImg);
        saveAllButton.setToolTipText(Messages.LinePropertiesEditor_17);
        saveAllButton.addSelectionListener(new SelectionAdapter(){
            public void widgetSelected( SelectionEvent e ) {
                String newStyleName = Messages.LinePropertiesEditor_18;
                InputDialog iDialog = new InputDialog(saveAllButton.getShell(), Messages.LinePropertiesEditor_19,
                        Messages.LinePropertiesEditor_20, newStyleName, null);
                iDialog.setBlockOnOpen(true);
                int open = iDialog.open();
                if (open == SWT.CANCEL) {
                    return;
                }
                String name = iDialog.getValue();
                if (name == null || name.length() == 0) {
                    name = newStyleName;
                }
                styleWrapper.setName(name);
                try {
View Full Code Here

   */
  public static String getUserName(Shell parent){
    String title = Messages.InternationalizedDialog_Title;
    String message = Messages.InternationalizedDialog_Prompt;
    String name = System.getenv("user.name"); //$NON-NLS-1$
    InputDialog prompt = new InputDialog(
      parent,
      title,
      message,
      name,
      new IInputValidator(){
        public String isValid(String name) {
          return name.length() > 2 ? name : null;
        }     
    });   
    if( prompt.open() == Window.OK ){
      return prompt.getValue();
    }
    return null; // user pressed cancel   
  }
View Full Code Here

        }

        @Override
        protected String getNewInputObject() {
            String str = null;
            InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(),
                    Messages.TileSet_dialog_new_title, Messages.TileSet_dialog_new_desc, str, null);
            int result = dialog.open();
            if (result == Window.OK) {
                str = dialog.getValue();
            }
            if (str == null || "".equals(str)) { //$NON-NLS-1$
                return null; // nothing to add
            }
View Full Code Here

    private void processRenameFolder() {

        final Runnable runnable = new Runnable() {
            public void run() {
                final Folder folder = (Folder) selection.getFirstElement();
                final InputDialog dialog = new InputDialog(Display.getDefault().getActiveShell(),
                        Messages.RenameFolderAction_dialogTitle,
                        Messages.RenameFolderAction_dialogMsg, folder.getName(), null);
                final int folderNameDialogResult = dialog.open();
                if (folderNameDialogResult == Dialog.OK) {
                    folder.setName(dialog.getValue());
                }
                viewer.refresh();
            }
        };
View Full Code Here

                    } else {
                        bounds = new ReferencedEnvelope(env, v.getCRS());
                    }
                    MapReference ref = bmManager.getMapReference(map);
                    Bookmark bookmark = new Bookmark(bounds, ref, null);
                    InputDialog dialog = new InputDialog(
                            Display.getCurrent().getActiveShell(),
                            Messages.BookmarkAction_dialogtitle_bookmarklocation,
                            Messages.BookmarkAction_dialogprompt_enterbookmarkname,
                            bookmark.getName(), null);
                    dialog.open();
                    if (dialog.getReturnCode() == Window.OK) {
                        String name = dialog.getValue();
                        bookmark.setName(name);
                        bmManager = BookmarksPlugin.getBookmarkService();
                        bmManager.addBookmark(bookmark);
                        refreshView();
                    }
                    ((BookmarksView) view)
                            .selectReveal(new StructuredSelection(bookmark));
                }
            } else if (RENAME_BOOKMARK_ACTION_ID.equals(action.getId())) {
                IBookmark bookmark = (IBookmark) selection.getFirstElement();
                InputDialog dialog = new InputDialog(Display.getCurrent()
                        .getActiveShell(),
                        Messages.BookmarkAction_dialogtitle_renamebookmark,
                        Messages.BookmarkAction_dialogprompt_enterbookmarkname,
                        bookmark.getName(), null);
                dialog.open();
                if (dialog.getReturnCode() == Window.OK) {
                    String name = dialog.getValue();
                    bookmark.setName(name);
                    refreshView();
                }
            } else if (SAVE_BOOKMARKS_ACTION_ID.equals(action.getId())) {
                BookmarksPlugin.getDefault().storeToPreferences();
View Full Code Here

                            if (object instanceof JGrassMapGeoResource) {
                                JGrassMapGeoResource mr = (JGrassMapGeoResource) object;
                                File oldMapFile = mr.getMapFile();
                                String oldMapName = oldMapFile.getName();

                                InputDialog iDialog = new InputDialog(shell, "New map name",
                                        "Please enter the new name for the map: " + oldMapName, oldMapName + "_new", null);
                                iDialog.open();
                                String newMapName = iDialog.getValue();
                                if (newMapName != null && newMapName.length() > 0) {
                                    newMapName = newMapName.replaceAll("\\s+", "_");

                                    JGrassMapEnvironment oldMapEnvironment = new JGrassMapEnvironment(oldMapFile);
                                    JGrassRegion jGrassRegion = oldMapEnvironment.getActiveRegion();
View Full Code Here

                                    String[] mapsetpathAndMapname = JGrassCatalogUtilities
                                            .getMapsetpathAndMapnameFromJGrassMapGeoResource(mr);
                                    String oldMapName = mapsetpathAndMapname[1];
                                    String mapsetName = mapsetpathAndMapname[0];
                                    try {
                                        InputDialog iDialog = new InputDialog(Display.getDefault().getActiveShell(),
                                                "New map name", "Please enter the new name for the map: " + oldMapName, "new_"
                                                        + oldMapName, null);
                                        iDialog.open();
                                        String newMapName = iDialog.getValue();
                                        if (newMapName.indexOf(' ') != -1) {
                                            MessageBox msgBox = new MessageBox(Display.getDefault().getActiveShell(),
                                                    SWT.ICON_ERROR);
                                            msgBox.setMessage("Map names can't contain spaces. Please choose a name without spaces.");
                                            msgBox.open();
View Full Code Here

                Object firstElement = selection.getFirstElement();
                if (firstElement instanceof JGrassService) {
                    final JGrassService jgrassService = (JGrassService) firstElement;
                    URL identifier = jgrassService.getIdentifier();
                    String locationPath = URLUtils.urlToFile(identifier).getAbsolutePath();
                    InputDialog iDialog = new InputDialog(Display.getDefault().getActiveShell(), "New mapset name",
                            "Please enter the name for the new mapset to create.", "newmapset", null);
                    iDialog.open();
                    String mapsetName = iDialog.getValue();
                    if (mapsetName.indexOf(' ') != -1) {
                        MessageBox msgBox = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR);
                        msgBox.setMessage("Mapset names can't contain spaces. Please choose a name without spaces.");
                        msgBox.open();
                        mapsetName = null;
View Full Code Here

     */
    protected String getNewInputObject() {
        if( prompt == null ){
            prompt = "Please enter:";
        }
        InputDialog dialog = new InputDialog( getShell(), "New "+getLabelText(), prompt, "", new IInputValidator(){
            public String isValid( String newText ) {
                if( newText == null || newText.length() == 0 ){
                    return "Action is required";
                }
                return null;
            }
        });
       
        int sucess = dialog.open();
        if( sucess == InputDialog.CANCEL ){
            return null; // we may have to produce a default value here
        }
        return dialog.getValue();
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.dialogs.InputDialog

Copyright © 2018 www.massapicom. 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.