Example usage for org.eclipse.jface.dialogs IDialogConstants ENTRY_FIELD_WIDTH

List of usage examples for org.eclipse.jface.dialogs IDialogConstants ENTRY_FIELD_WIDTH

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants ENTRY_FIELD_WIDTH.

Prototype

int ENTRY_FIELD_WIDTH

To view the source code for org.eclipse.jface.dialogs IDialogConstants ENTRY_FIELD_WIDTH.

Click Source Link

Document

Entry field width in dialog units (value 200).

Usage

From source file:au.gov.ga.earthsci.discovery.ui.preferences.EditDiscoveryServiceDialog.java

License:Apache License

protected void createTypeCombo(final Composite parent) {
    providers = new ArrayList<IDiscoveryProvider>(DiscoveryProviderRegistry.getProviders());
    Collections.sort(providers, new DiscoveryProviderComparator());
    String[] items = new String[providers.size()];
    int selectedIndex = -1;
    for (int i = 0; i < providers.size(); i++) {
        IDiscoveryProvider provider = providers.get(i);
        items[i] = provider.getName() != null ? provider.getName() : ""; //$NON-NLS-1$
        if (service != null && service.getProvider() == provider) {
            selectedIndex = i;/*w  w w  .  jav a2s . com*/
        }
    }

    Label typeLabel = new Label(parent, SWT.NONE);
    typeLabel.setText(Messages.EditDiscoveryServiceDialog_TypeLabel);
    typeCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    typeCombo.setItems(items);
    typeCombo.select(selectedIndex);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
    typeCombo.setLayoutData(data);

    typeCombo.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            createProviderPropertyControls(parent, true);
            validate();
        }
    });
}

From source file:au.gov.ga.earthsci.discovery.ui.preferences.EditDiscoveryServiceDialog.java

License:Apache License

protected void createNameField(Composite parent) {
    Label nameLabel = new Label(parent, SWT.NONE);
    nameLabel.setText(Messages.EditDiscoveryServiceDialog_NameLabel);
    nameText = new Text(parent, SWT.BORDER);
    String name = service == null ? null : service.getName();
    nameText.setText(name != null ? name : ""); //$NON-NLS-1$
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
    nameText.setLayoutData(data);//  ww  w . j  a  v a 2 s.c  om

    nameText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validate();
        }
    });
}

From source file:au.gov.ga.earthsci.discovery.ui.preferences.EditDiscoveryServiceDialog.java

License:Apache License

protected void createLocationField(Composite parent) {
    Label urlLabel = new Label(parent, SWT.NONE);
    urlLabel.setText(Messages.EditDiscoveryServiceDialog_LocationLabel);
    urlText = new Text(parent, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
    urlText.setLayoutData(data);/*from w ww  .ja va 2 s .  c  o m*/
    DropTarget target = new DropTarget(urlText, DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK);
    target.setTransfer(new Transfer[] { URLTransfer.getInstance(), FileTransfer.getInstance() });
    target.addDropListener(new TextURLDropAdapter(urlText, true));
    URL url = service == null ? null : service.getServiceURL();
    urlText.setText(url != null ? url.toString() : ""); //$NON-NLS-1$
    urlText.setSelection(0, urlText.getText().length());

    urlText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validate();
        }
    });
}

From source file:au.gov.ga.earthsci.discovery.ui.preferences.EditDiscoveryServiceDialog.java

License:Apache License

protected void createProviderPropertyControls(Composite parent, boolean packShell) {
    if (propertyControls != null) {
        for (Control control : propertyControls) {
            if (control != null) {
                control.dispose();//from  w  ww .  j a  va2 s .c o m
            }
        }
        for (Label label : propertyLabels) {
            if (label != null) {
                label.dispose();
            }
        }
    }
    IDiscoveryProvider provider = null;
    int selectedIndex = typeCombo.getSelectionIndex();
    if (selectedIndex >= 0) {
        provider = providers.get(selectedIndex);
    }

    @SuppressWarnings("unchecked")
    IDiscoveryServiceProperty<Object>[] properties = provider == null ? null
            : (IDiscoveryServiceProperty<Object>[]) provider.getProperties();
    if (properties == null) {
        propertyControls = new Control[0];
        propertyLabels = new Label[0];
    } else {
        propertyControls = new Control[properties.length];
        propertyLabels = new Label[properties.length];

        for (int i = 0; i < properties.length; i++) {
            IDiscoveryServiceProperty<Object> property = properties[i];

            String label = property.getLabel();
            label = label != null ? label + ":" : ""; //$NON-NLS-1$ //$NON-NLS-2$
            propertyLabels[i] = new Label(parent, SWT.NONE);
            propertyLabels[i].setText(label);

            Object value = null;
            if (originalService != null && originalService.getProvider() == provider) {
                value = property.getValue(originalService);
            } else if (service != null && service.getProvider() == provider) {
                value = property.getValue(service);
            }
            propertyControls[i] = property.createControl(parent, value, new ModifyListener() {
                @Override
                public void modifyText(ModifyEvent e) {
                    validate();
                }
            });
            GridData data = new GridData(GridData.FILL_HORIZONTAL);
            data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
            propertyControls[i].setLayoutData(data);
        }
    }

    parent.pack();
    if (packShell) {
        getShell().pack();
    }
}

From source file:ca.uvic.cs.tagsea.dialogs.RefreshTagsDialog.java

License:Open Source License

private void createProjectSelectionTable(Composite radioGroup) {
    projectNames = CheckboxTableViewer.newCheckList(radioGroup, SWT.BORDER);
    projectNames.setContentProvider(new WorkbenchContentProvider());
    projectNames.setLabelProvider(new WorkbenchLabelProvider());
    projectNames.setSorter(new ResourceSorter(ResourceSorter.NAME));
    projectNames.addFilter(new ViewerFilter() {
        private final IProject[] projectHolder = new IProject[1];

        public boolean select(Viewer viewer, Object parentElement, Object element) {
            if (!(element instanceof IProject)) {
                return false;
            }/* w  ww  .j  av  a2  s. co  m*/
            IProject project = (IProject) element;
            if (!project.isAccessible()) {
                return false;
            }
            projectHolder[0] = project;
            return true;
        }
    });
    projectNames.setInput(ResourcesPlugin.getWorkspace().getRoot());
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    data.heightHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    projectNames.getTable().setLayoutData(data);
    projectNames.setCheckedElements(selection);
    //table is disabled to start because all button is selected
    projectNames.getTable().setEnabled(selectedButton.getSelection());
    projectNames.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            selection = projectNames.getCheckedElements();
            updateEnablement();
        }
    });
}

From source file:com.aptana.webserver.ui.internal.ExternalWebServerPropertyDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite dialogArea = (Composite) super.createDialogArea(parent);

    setTitle(Messages.SimpleWebServerPropertyDialog_Title);
    getShell().setText(Messages.SimpleWebServerPropertyDialog_ShellTitle);

    Composite composite = new Composite(dialogArea, SWT.NONE);
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    PixelConverter converter = new PixelConverter(composite);
    composite.setLayout(GridLayoutFactory.swtDefaults()
            .margins(converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN),
                    converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN))
            .spacing(converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING),
                    converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING))
            .numColumns(3).create());//from w w  w.  j ava  2s. c om

    /* row 1 */
    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.SimpleWebServerPropertyDialog_Name_Label));

    nameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    nameText.setLayoutData(GridDataFactory.fillDefaults()
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT).span(2, 1)
            .grab(true, false).create());

    /* row 1 */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.SimpleWebServerPropertyDialog_BaseURL_Label));

    baseUrlText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    baseUrlText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(baseUrlText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).create());
    baseUrlText.setText("http://"); //$NON-NLS-1$

    /* row 2 */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.SimpleWebServerPropertyDialog_DocRoot_Label));

    documentRootText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    documentRootText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(documentRootText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .grab(true, false).create());

    Button browseButton = new Button(composite, SWT.PUSH);
    browseButton.setText('&' + StringUtil.ellipsify(CoreStrings.BROWSE));
    browseButton.setLayoutData(GridDataFactory.fillDefaults()
            .hint(Math.max(
                    new PixelConverter(browseButton)
                            .convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH),
                    browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x), SWT.DEFAULT)
            .create());

    /* -- */
    browseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            browseFileSystem();
        }
    });

    /* row 3 - start command */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.ExternalWebServerPropertyDialog_StartCommandLabel));

    startCommandText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    startCommandText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(baseUrlText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).create());

    /* row 4 - stop command */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.ExternalWebServerPropertyDialog_StopCommandLabel));

    stopCommandText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    stopCommandText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(baseUrlText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).create());

    // Set up existing values...
    if (source != null) {
        String name = source.getName();
        nameText.setText((name != null) ? name : StringUtil.EMPTY);

        URL url = source.getBaseURL();
        if (url != null) {
            baseUrlText.setText(url.toExternalForm());
        }
        IPath path = source.getDocumentRootPath();
        if (path != null) {
            documentRootText.setText(path.toOSString());
        }

        String startCommand = source.getStartCommand();
        startCommandText.setText((startCommand != null) ? startCommand : StringUtil.EMPTY);

        String stopCommand = source.getStopCommand();
        stopCommandText.setText((stopCommand != null) ? stopCommand : StringUtil.EMPTY);
    }

    addListeners();

    return dialogArea;
}

From source file:com.aptana.webserver.ui.internal.SimpleWebServerPropertyDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite dialogArea = (Composite) super.createDialogArea(parent);

    setTitle(Messages.SimpleWebServerPropertyDialog_Title);
    getShell().setText(Messages.SimpleWebServerPropertyDialog_ShellTitle);

    Composite composite = new Composite(dialogArea, SWT.NONE);
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    PixelConverter converter = new PixelConverter(composite);
    composite.setLayout(GridLayoutFactory.swtDefaults()
            .margins(converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN),
                    converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN))
            .spacing(converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING),
                    converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING))
            .numColumns(3).create());/*from  w ww. j a v  a 2  s  . c o  m*/

    /* row 1 */
    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.SimpleWebServerPropertyDialog_Name_Label));

    nameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    nameText.setLayoutData(GridDataFactory.fillDefaults()
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT).span(2, 1)
            .grab(true, false).create());

    /* row 1 */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.SimpleWebServerPropertyDialog_BaseURL_Label));

    baseUrlText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    baseUrlText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(baseUrlText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).create());
    baseUrlText.setText("http://"); //$NON-NLS-1$

    /* row 2 */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.SimpleWebServerPropertyDialog_DocRoot_Label));

    documentRootText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    documentRootText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(documentRootText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .grab(true, false).create());

    Button browseButton = new Button(composite, SWT.PUSH);
    browseButton.setText('&' + StringUtil.ellipsify(CoreStrings.BROWSE));
    browseButton.setLayoutData(GridDataFactory.fillDefaults()
            .hint(Math.max(
                    new PixelConverter(browseButton)
                            .convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH),
                    browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x), SWT.DEFAULT)
            .create());

    /* -- */
    browseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            browseFileSystem();
        }
    });

    if (source != null) {
        String name = source.getName();
        nameText.setText((name != null) ? name : StringUtil.EMPTY);
        URL url = source.getBaseURL();
        if (url != null) {
            baseUrlText.setText(url.toExternalForm());
        }
        IPath path = source.getDocumentRootPath();
        if (path != null) {
            documentRootText.setText(path.toOSString());
        }
    }

    addListeners();

    return dialogArea;
}

From source file:com.bluexml.side.application.ui.dialogs.RessourcesSelection.java

License:Open Source License

/**
 * Creates the controls needed to edit the working directory
 * attribute of an external tool/*from  w  w w.  ja v  a  2 s.com*/
 * 
 * @param parent
 *            the composite to create the controls in
 */
protected void createWorkDirectoryComponent(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    String locationLabel = getLocationLabel();
    group.setText(locationLabel);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    group.setLayout(layout);
    group.setLayoutData(gridData);

    locationField = new Text(group, SWT.BORDER);

    locationField.setText(initialValue);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    locationField.setLayoutData(gridData);
    locationField.addModifyListener(fListener);
    addControlAccessibleListener(locationField, group.getText());

    Composite buttonComposite = new Composite(group, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 3;
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
    buttonComposite.setLayout(layout);
    buttonComposite.setLayoutData(gridData);
    buttonComposite.setFont(parent.getFont());

    if (!dataType.equals(RESOURCE_TYPE_STRING)) {
        workspaceLocationButton = createPushButton(buttonComposite,
                Activator.Messages.getString("SelectResources.2"), null); //$NON-NLS-1$
        workspaceLocationButton.addSelectionListener(fListener);
        addControlAccessibleListener(workspaceLocationButton,
                group.getText() + " " + workspaceLocationButton.getText()); //$NON-NLS-1$

        fileLocationButton = createPushButton(buttonComposite,
                Activator.Messages.getString("SelectResources.3"), null); //$NON-NLS-1$
        fileLocationButton.addSelectionListener(fListener);
        addControlAccessibleListener(fileLocationButton, group.getText() + " " + fileLocationButton.getText()); //$NON-NLS-1$
    }
    variablesLocationButton = createPushButton(buttonComposite,
            Activator.Messages.getString("SelectResources.4"), null); //$NON-NLS-1$
    variablesLocationButton.addSelectionListener(fListener);
    addControlAccessibleListener(variablesLocationButton,
            group.getText() + " " + variablesLocationButton.getText()); //$NON-NLS-1$
}

From source file:com.bluexml.side.util.libs.eclipse.RessourcesSelection.java

License:Open Source License

/**
 * Creates the controls needed to edit the working directory
 * attribute of an external tool/*from w  ww  . j  av  a  2 s  . c o  m*/
 * 
 * @param parent
 *            the composite to create the controls in
 */
protected void createWorkDirectoryComponent(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    String locationLabel = getLocationLabel();
    group.setText(locationLabel);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    group.setLayout(layout);
    group.setLayoutData(gridData);

    int style = SWT.BORDER;
    if (dataType.equals(RESOURCE_TYPE.RESOURCE_TYPE_STRING_MULTILINE)) {
        style = SWT.MULTI | SWT.BORDER;
    }
    locationField = new Text(group, style);

    locationField.setText(initialValue);
    if (dataType.equals(RESOURCE_TYPE.RESOURCE_TYPE_STRING_MULTILINE)) {
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        int lineCount = locationField.getLineCount();
        int lineHeight = locationField.getLineHeight();

        int i = (lineCount + 10) * lineHeight;
        gridData.heightHint = i;
        locationField.setSize(100, i);
        gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH * 2;
    } else {
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    }

    locationField.setLayoutData(gridData);
    locationField.addModifyListener(fListener);
    addControlAccessibleListener(locationField, group.getText());

    Composite buttonComposite = new Composite(group, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 3;
    gridData = new GridData(GridData.FILL_BOTH);
    buttonComposite.setLayout(layout);
    buttonComposite.setLayoutData(gridData);
    buttonComposite.setFont(parent.getFont());

    if (!(dataType.equals(RESOURCE_TYPE.RESOURCE_TYPE_STRING)
            || dataType.equals(RESOURCE_TYPE.RESOURCE_TYPE_STRING_MULTILINE))) {
        workspaceLocationButton = createPushButton(buttonComposite,
                StylingUtil.Messages.getString("SelectResources.2"), null); //$NON-NLS-1$
        workspaceLocationButton.addSelectionListener(fListener);
        addControlAccessibleListener(workspaceLocationButton,
                group.getText() + " " + workspaceLocationButton.getText()); //$NON-NLS-1$

        fileLocationButton = createPushButton(buttonComposite,
                StylingUtil.Messages.getString("SelectResources.3"), null); //$NON-NLS-1$
        fileLocationButton.addSelectionListener(fListener);
        addControlAccessibleListener(fileLocationButton, group.getText() + " " + fileLocationButton.getText()); //$NON-NLS-1$
    }
    variablesLocationButton = createPushButton(buttonComposite,
            StylingUtil.Messages.getString("SelectResources.4"), null); //$NON-NLS-1$

    if (!dataType.equals(RESOURCE_TYPE.RESOURCE_TYPE_STRING_MULTILINE)) {
        variablesLocationButton.addSelectionListener(fListener);
        addControlAccessibleListener(variablesLocationButton,
                group.getText() + " " + variablesLocationButton.getText()); //$NON-NLS-1$
    } else {
        variablesLocationButton.setVisible(false);
    }

}

From source file:com.drgarbage.bytecode.jdi.dialogs.SelectDebugTargetDialog.java

License:Apache License

private void createDebugTargetSelectionTable(Composite parent) {
    tableViewer = new TableViewer(parent, SWT.BORDER);
    tableViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            buttonPressed(OK);//from w ww .  jav  a 2  s . co  m
        }

    });

    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            updateEnablement();
        }

    });

    tableViewer.setContentProvider(new ArrayContentProvider());
    //        vmsTableViewer.setLabelProvider(new DefaultLabelProvider());
    tableViewer.setLabelProvider(new ITableLabelProvider() {

        public void addListener(ILabelProviderListener listener) {
        }

        public void dispose() {
        }

        public Image getColumnImage(Object element, int columnIndex) {
            if (columnIndex == 0 && element instanceof IJavaType[]) {
                IJavaType[] jts = (IJavaType[]) element;
                if (jts.length > 0) {
                    IJavaType firstType = jts[0];
                    // determine the image from the launch config type
                    String imageKey = getImageKey(firstType.getDebugTarget().getLaunch());

                    if (imageKey != null) {
                        return DebugPluginImages.getImage(imageKey);
                    }
                }
            }

            return null;
        }

        public String getColumnText(Object element, int columnIndex) {

            if (element instanceof IJavaType[]) {
                IJavaType[] jts = (IJavaType[]) element;
                if (jts.length > 0) {
                    IJavaType firstType = jts[0];
                    try {
                        return firstType.getDebugTarget().getName();
                    } catch (DebugException e) {
                    }
                }
            }
            return null;
        }

        private String getImageKey(ILaunch launch) {
            ILaunchConfiguration configuration = launch.getLaunchConfiguration();
            if (configuration != null) {
                try {
                    return configuration.getType().getIdentifier();
                } catch (CoreException e) {
                    BytecodeVisualizerPlugin.log(e);
                    return null;
                }
            }
            // if no config, use the old "mode" way
            if (launch.getLaunchMode().equals(ILaunchManager.DEBUG_MODE)) {
                return IDebugUIConstants.IMG_OBJS_LAUNCH_DEBUG;
            } else if (launch.isTerminated()) {
                return IDebugUIConstants.IMG_OBJS_LAUNCH_RUN_TERMINATED;
            } else {
                return IDebugUIConstants.IMG_OBJS_LAUNCH_RUN;
            }
        }

        public boolean isLabelProperty(Object element, String property) {
            return false;
        }

        public void removeListener(ILabelProviderListener listener) {
        }

    });
    tableViewer.addFilter(new ViewerFilter() {
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            return true;
        }
    });
    tableViewer.setInput(displayCandidates);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    data.heightHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    tableViewer.getTable().setLayoutData(data);

}