public SettingsSetupEditor()

in org.apache.ivyde.eclipse/src/java/org/apache/ivyde/internal/eclipse/ui/SettingsSetupEditor.java [71:162]


    public SettingsSetupEditor(Composite parent, int style, IProject project) {
        super(parent, style);

        GridLayout layout = new GridLayout();
        setLayout(layout);

        loadOnDemandButton = new Button(this, SWT.CHECK);
        loadOnDemandButton.setText("reload the settings only on demand");
        loadOnDemandButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));

        settingsEditor = new PathEditor(this, SWT.NONE, "Ivy settings path:", project, "*.xml") {

            protected Text createText(Composite parent) {
                errorDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
                    FieldDecorationRegistry.DEC_ERROR);

                settingsTextDeco = new DecoratedField(parent, SWT.LEFT | SWT.TOP,
                        new IControlCreator() {
                            public Control createControl(Composite p, int s) {
                                return new Text(p, SWT.SINGLE | SWT.BORDER);
                            }
                        });
                settingsTextDeco.addFieldDecoration(errorDecoration, SWT.TOP | SWT.LEFT, false);
                // settingsTextDeco.setMarginWidth(2);
                settingsTextDeco.hideDecoration(errorDecoration);
                // this doesn't work well: we want the decoration image to be clickable, but it
                // actually
                // hides the clickable area
                // settingsTextDeco.getLayoutControl().addMouseListener(new MouseAdapter() {
                // public void mouseDoubleClick(MouseEvent e) {
                // super.mouseDoubleClick(e);
                // }
                // public void mouseDown(MouseEvent e) {
                // if (settingsError != null) {
                // settingsError.show(IStatus.ERROR, "IvyDE configuration problem", null);
                // }
                // }
                // });

                Text settingsText = (Text) settingsTextDeco.getControl();
                settingsText.setToolTipText(TOOLTIP_SETTINGS_PATH);
                settingsTextDeco.getLayoutControl().setLayoutData(
                    new GridData(GridData.FILL, GridData.CENTER, true, false));

                return settingsText;
            }

            protected boolean addButtons(Composite buttons) {
                defaultButton = new Button(buttons, SWT.NONE);
                defaultButton
                        .setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false));
                defaultButton.setText("Default");
                defaultButton.addSelectionListener(new SelectionAdapter() {
                    public void widgetSelected(SelectionEvent e) {
                        getText().setText("");
                    }
                });
                return true;
            }

            protected void setFile(String f) {
                try {
                    getText().setText(new File(f).toURI().toURL().toExternalForm());
                    textUpdated();
                } catch (MalformedURLException ex) {
                    // this cannot happen
                    IvyPlugin
                            .logError("The file got from the file browser has an invalid URL", ex);
                }
            }

            protected void textUpdated() {
                settingsUpdated();
            }
        };
        settingsEditor.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));

        ivyUserDirEditor = new PathEditor(this, SWT.NONE, "Ivy user dir:", project, null) {
            protected void textUpdated() {
                settingsUpdated();
            }
        };
        ivyUserDirEditor.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));

        propFilesEditor = new FileListEditor(this, SWT.NONE, "Property files:", "Property file:",
                project, "*.properties") {
            protected void fileListUpdated() {
                settingsUpdated();
            }
        };
        propFilesEditor.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
    }