Package org.eclipse.jface.dialogs

Examples of org.eclipse.jface.dialogs.Dialog


        IGeoResource resource = MapTests.createGeoResource(features, true);
        Map map = MapTests.createNonDynamicMapAndRenderer(resource, new Dimension(500,512));
        ValidateNullZero isValidAttr = new ValidateNullZero();

        // test the dialog
        Dialog dialog = isValidAttr.getDialog(Display.getDefault().getActiveShell(), ((ILayer) map.getLayersInternal().get(0)).getSchema());
        dialog.setBlockOnOpen(false);
        dialog.open();
        // check the default xPath
        assertEquals(isValidAttr.xPath,"geom"); // first entry in attributes //$NON-NLS-1$
        //set a new xPath
        isValidAttr.combo.select(1);
        // check the new xPath
View Full Code Here


    private List<IGeoResource> resourcesList;

    public void open( Shell parentShell, final int selectionType ) {

        dialog = new Dialog(parentShell){

            @Override
            protected void configureShell( Shell shell ) {
                super.configureShell(shell);
                shell.setText("");
View Full Code Here

                ToolContext toolContext;
                synchronized (this.processor.partListener) {
                    toolContext = this.processor.partListener.currentContext;
                }
                page.setContext(toolContext);
                Dialog dialog = new FeatureEditorExtensionProcessor.EditorDialog(new Shell(display
                        .getActiveShell(), SWT.RESIZE | SWT.PRIMARY_MODAL), page);
                dialog.setBlockOnOpen(false);
                page.setFeature(feature);
                dialog.open();

                PlatformUI.getPreferenceStore().putValue(
                        FeatureEditorExtensionProcessor.CURRENT_LOADER_ID, id);

            } catch (CoreException e) {
View Full Code Here

                            JGrassMapGeoResource mr = (JGrassMapGeoResource) object;
                            maps.add(mr);
                        }
                    }

                    Dialog dialog = new Dialog(shell){
                        private Text locNameText;
                        private Text mapsetNameText;
                        private Text crsText;
                        private Text xresText;
                        private Text yresText;

                        protected Control createDialogArea( Composite maxparent ) {
                            Composite parent = new Composite(maxparent, SWT.None);
                            parent.setLayout(new GridLayout());
                            parent.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL
                                    | GridData.GRAB_VERTICAL));

                            // the location name group
                            Group locNameGroup = new Group(parent, SWT.None);
                            locNameGroup.setLayout(new GridLayout(2, false));
                            locNameGroup.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL
                                    | GridData.GRAB_VERTICAL));
                            locNameGroup.setText("new location name");

                            locNameText = new Text(locNameGroup, SWT.BORDER);
                            locNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL
                                    | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_CENTER));
                            locNameText.setText("newLocation");

                            // the mapset name group
                            Group mapsetNameGroup = new Group(parent, SWT.None);
                            mapsetNameGroup.setLayout(new GridLayout(2, false));
                            mapsetNameGroup.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL
                                    | GridData.GRAB_VERTICAL));
                            mapsetNameGroup.setText("new mapset name");

                            mapsetNameText = new Text(mapsetNameGroup, SWT.BORDER);
                            mapsetNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL
                                    | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_CENTER));
                            mapsetNameText.setText("newMapset");

                            // the crs choice group
                            Group crsGroup = new Group(parent, SWT.None);
                            crsGroup.setLayout(new GridLayout(2, false));
                            crsGroup.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL
                                    | GridData.GRAB_VERTICAL));
                            crsGroup.setText("choose the coordinate reference system for the new location");

                            crsText = new Text(crsGroup, SWT.BORDER);
                            crsText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL
                                    | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_CENTER));
                            crsText.setEditable(false);

                            final Button crsButton = new Button(crsGroup, SWT.BORDER);
                            crsButton.setText(" Choose CRS ");
                            crsButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter(){
                                public void widgetSelected( org.eclipse.swt.events.SelectionEvent e ) {
                                    final ChooseCoordinateReferenceSystemDialog crsChooser = new ChooseCoordinateReferenceSystemDialog();
                                    crsChooser.open(new Shell(Display.getDefault()));
                                    CoordinateReferenceSystem readCrs = crsChooser.getCrs();
                                    if (readCrs == null)
                                        return;
                                    crsText.setText(readCrs.getName().toString());
                                    crsText.setData(readCrs);
                                }
                            });

                            // the location name group
                            Group resolutionGroup = new Group(parent, SWT.None);
                            resolutionGroup.setLayout(new GridLayout(2, false));
                            resolutionGroup.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL
                                    | GridData.GRAB_VERTICAL));
                            resolutionGroup.setText("output map resolution");

                            String res = "";
                            if (maps.size() > 0) {
                                try {
                                    JGrassRegion activeWindow = maps.get(0).getActiveWindow();
                                    res = String.valueOf(activeWindow.getNSResolution());
                                } catch (IOException e1) {
                                    e1.printStackTrace();
                                }
                            }
                            Label xresLabel = new Label(resolutionGroup, SWT.NONE);
                            xresLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
                            xresLabel.setText("X resolution");

                            xresText = new Text(resolutionGroup, SWT.BORDER);
                            xresText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL
                                    | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_CENTER));
                            xresText.setText(res);

                            Label yresLabel = new Label(resolutionGroup, SWT.NONE);
                            yresLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
                            yresLabel.setText("Y resolution");

                            yresText = new Text(resolutionGroup, SWT.BORDER);
                            yresText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL
                                    | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_CENTER));
                            yresText.setText(res);

                            return parent;
                        }

                        protected void okPressed() {
                            locationName = locNameText.getText();
                            if (locationName == null || locationName.length() < 1) {
                                locationName = "newLocation";
                            }
                            mapsetName = mapsetNameText.getText();
                            if (mapsetName == null || mapsetName.length() < 1) {
                                mapsetName = "newMapset";
                            }
                            xRes = xresText.getText();
                            yRes = yresText.getText();
                            Object crsData = crsText.getData();
                            if (crsData instanceof CoordinateReferenceSystem) {
                                crs = (CoordinateReferenceSystem) crsData;
                            }
                            super.okPressed();
                        }
                    };
                    dialog.setBlockOnOpen(true);
                    open = dialog.open();

                } catch (Exception e) {
                    String message = "An error occurred while exporting the maps.";
                    ExceptionDetailsDialog.openError("ERROR", message, IStatus.ERROR, JGrassPlugin.PLUGIN_ID, e);
                }
View Full Code Here

        }
        return composite;
    }

    public static void open(Shell shell, Object result) {
        Dialog dialog = new OperationInvocationResultDialog(shell, result);
        dialog.open();
    }
View Full Code Here

    if (resource == null && encodingSupport == null) {
      MessageDialog.openInformation(parentShell, fDialogTitle, TextEditorMessages.ChangeEncodingAction_message_noEncodingSupport);
      return;
    }

    Dialog dialog= new Dialog(parentShell) {
      private AbstractEncodingFieldEditor fEncodingEditor;
      private IPreferenceStore store= null;

      /*
       * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
       */
      protected void configureShell(Shell newShell) {
        super.configureShell(newShell);
        newShell.setText(fDialogTitle);
      }

      /*
       * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
       */
      protected Control createDialogArea(Composite parent) {
        Control composite= super.createDialogArea(parent);
        if (!(composite instanceof Composite)) {
          composite.dispose();
          composite= new Composite(parent, SWT.NONE);
        }

        GridLayout layout= new GridLayout();
        layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
        layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
        layout.verticalSpacing= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
        layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
        parent.setLayout(layout);

        GridData data = new GridData(GridData.FILL_BOTH);
        composite.setLayoutData(data);
        composite.setFont(parent.getFont());

        DialogPage page= new MessageDialogPage((Composite)composite) {
          public void setErrorMessage(String newMessage) {
            super.setErrorMessage(newMessage);
            setButtonEnabledState(IDialogConstants.OK_ID, newMessage == null);
            setButtonEnabledState(APPLY_ID, newMessage == null);
          }

          private void setButtonEnabledState(int id, boolean state) {
            Button button= getButton(id);
            if (button != null)
              button.setEnabled(state);
          }
        };

        if (resource != null) {
          fEncodingEditor= new ResourceEncodingFieldEditor("", (Composite)composite, resource); //$NON-NLS-1$
          fEncodingEditor.setPage(page);
          fEncodingEditor.load();
        } else {
          fEncodingEditor= new EncodingFieldEditor(ENCODING_PREF_KEY, "", (Composite)composite); //$NON-NLS-1$
          store= new PreferenceStore();
          String defaultEncoding= encodingSupport.getDefaultEncoding();
          store.setDefault(ENCODING_PREF_KEY, defaultEncoding);
          String encoding= encodingSupport.getEncoding();
          if (encoding != null)
            store.setValue(ENCODING_PREF_KEY, encoding);
          fEncodingEditor.setPreferenceStore(store);

          fEncodingEditor.setPage(page);
          fEncodingEditor.load();

          if (encoding == null || encoding.equals(defaultEncoding) || encoding.length() == 0)
            fEncodingEditor.loadDefault();
        }

        return composite;
      }

      /*
       * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
       */
      protected void createButtonsForButtonBar(Composite parent) {
        createButton(parent, APPLY_ID, TextEditorMessages.ChangeEncodingAction_button_apply_label, false);
        super.createButtonsForButtonBar(parent);
      }

      /*
       * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
       */
      protected void buttonPressed(int buttonId) {
        if (buttonId == APPLY_ID)
          apply();
        else
          super.buttonPressed(buttonId);
      }

      /*
       * @see org.eclipse.jface.dialogs.Dialog#okPressed()
       */
      protected void okPressed() {
        apply();
        super.okPressed();
      }

      private void apply() {
        fEncodingEditor.store();

        if (resource == null) {
          String encoding= fEncodingEditor.getPreferenceStore().getString(fEncodingEditor.getPreferenceName());
          encodingSupport.setEncoding(encoding);
        }
      }
    };
    dialog.open();
  }
View Full Code Here

  public void dispose() {

  }

  public Object execute(ExecutionEvent event) throws ExecutionException {
    Dialog dialog = PreferencesUtil.createPreferenceDialogOn(HandlerUtil.getActiveShell(event),
            TestingPreferencePage.ID, new String[] { TestingPreferencePage.ID }, null);
    dialog.open();
    return null;
  }
View Full Code Here

      m.contributeTo(mn);
      mn.add(new Separator());
    }
    mn.add(new Action("About AppWrench") {
      public void run() {
        Dialog dialog = new Dialog(Display.getCurrent()
            .getActiveShell()) {

         
          protected Control createDialogArea(Composite parent) {
            Composite createDialogArea = (Composite) super
                .createDialogArea(parent);
            GridLayout layout = new GridLayout(2, false);
            layout.marginWidth = 0;
            layout.marginHeight = 0;
            createDialogArea.setLayout(layout);
            ImageDescriptor imageDescriptorFromPlugin = Activator
                .imageDescriptorFromPlugin(Activator.PLUGIN_ID,
                    "icons/onpositive.jpg");
            final Image createImage = imageDescriptorFromPlugin
                .createImage();
            Label label = new Label(createDialogArea, SWT.NONE);
            label.setImage(createImage);
            createDialogArea
                .addDisposeListener(new DisposeListener() {

                  public void widgetDisposed(DisposeEvent e) {
                    createImage.dispose();
                  }
                });
            FormText ft = new FormText(createDialogArea, SWT.NONE);
            ft
                .setText(
                    "<form><p><b>AppWrench 1.3</b></p><p>(c) Copyright <a>OnPositive Technologies, LLC. 2009-2010t</a>.  All rights reserved.</p><p></p></form>",
                    true, true);
            ft.addHyperlinkListener(new IHyperlinkListener() {

              public void linkExited(HyperlinkEvent e) {

              }

              public void linkEntered(HyperlinkEvent e) {
               
              }

              public void linkActivated(HyperlinkEvent e) {

                try {
                  PlatformUI
                      .getWorkbench()
                      .getBrowserSupport()
                      .getExternalBrowser()
                      .openURL(
                          new URL(
                              "http://onpositive.com"));
                } catch (PartInitException e1) {
                  Activator.log(e1);
                } catch (MalformedURLException e1) {
                  Activator.log(e1);
                }
              }

            });
            ft.setBackground(Display.getCurrent().getSystemColor(
                SWT.COLOR_WHITE));
            createDialogArea.setBackground(Display.getCurrent()
                .getSystemColor(SWT.COLOR_WHITE));
            return createDialogArea;
          }

          protected void createButtonsForButtonBar(Composite parent) {
            GridLayout gridLayout = (GridLayout) parent.getLayout();
            Composite c = new Composite(parent, SWT.NONE);
            GridLayout layout = new GridLayout(2, false);
            layout.marginHeight = 0;
            c.setLayout(layout);
            gridLayout.makeColumnsEqualWidth = false;
            gridLayout.numColumns += 1;
            Link l = new Link(c, SWT.NONE);
            l.setText("<a>Open User guide</a>  ");
            l.addSelectionListener(new SelectionAdapter() {
             
              public void widgetSelected(SelectionEvent e) {
                IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
                helpSystem.displayHelpResource("/com.onpositive.gae.tools.core/html/overview.html");
              }
            });
            Link l1 = new Link(c, SWT.NONE);
            l1.addSelectionListener(new SelectionAdapter() {
             
              public void widgetSelected(SelectionEvent e) {
                try {
                  PlatformUI
                      .getWorkbench()
                      .getBrowserSupport()
                      .getExternalBrowser()
                      .openURL(
                          new URL(
                              "http://appwrench.onpositive.com"));
                } catch (PartInitException e1) {
                  Activator.log(e1);
                } catch (MalformedURLException e1) {
                  Activator.log(e1);
                }
              }
            });
            parent.setLayoutData(GridDataFactory.fillDefaults()
                .grab(true, false).create());
            c.setLayoutData(GridDataFactory.fillDefaults().grab(
                true, false).create());
            l1.setText("<a>Open product web site</a>");
            Button createButton = createButton(parent,
                IDialogConstants.OK_ID,
                IDialogConstants.OK_LABEL, true);
            createButton.setFocus();
          }
        };
        dialog.open();
      }
    });
    return mn.createContextMenu(parent);
  }
View Full Code Here

        try {
            return Utils.runSWTSync(new Callable<Boolean>() {

                public Boolean call() {
                    Dialog dialog = new FeedbackDialog(EditorAPI.getShell(),
                        saros, FeedbackManager.this, message);
                    return dialog.open() == Window.OK;
                }

            });
        } catch (Exception e) {
            log.error("Exception when trying to open FeedbackDialog.", e);
View Full Code Here

  protected abstract IStructuredCleanupProcessor getCleanupProcessor();

  public void run() {
    if (getTextEditor() instanceof StructuredTextEditor) {
      final StructuredTextEditor editor = (StructuredTextEditor) getTextEditor();
      Dialog cleanupDialog = getCleanupDialog(editor.getSite().getShell());
      if (cleanupDialog != null) {
        if (cleanupDialog.open() == Window.OK) {
          // setup runnable
          Runnable runnable = new Runnable() {
            public void run() {
              IStructuredCleanupProcessor cleanupProcessor = getCleanupProcessor();
              if (cleanupProcessor != null)
View Full Code Here

TOP

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

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.