/** * {@inheritDoc} * * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) */ @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText( DocBridgeUI.getInstance().getString("DocumentationLinkDialog_title")); // $NON-NLS-1$ newShell.setSize(450, 520); }
private void createWebValueEditor(Group grpDocumentationSettings) { btnWeb = new Button(grpDocumentationSettings, SWT.RADIO); btnWeb.setText( DocBridgeUI.getInstance() .getString("DocumentationLinkDialog_WebEditor_title")); // $NON-NLS-1$ btnWeb.addSelectionListener( new SelectionAdapter() { /** * {@inheritDoc} * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { valueText.setEnabled(true); treeViewer.getControl().setEnabled(false); } }); valueText = new Text(grpDocumentationSettings, SWT.BORDER); valueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); valueText.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { value = valueText.getText(); updateButtons(); } }); }
private void createNameEditor(Group grpDocumentationSettings) { Label nameLabel = new Label(grpDocumentationSettings, SWT.NONE); nameLabel.setText( DocBridgeUI.getInstance() .getString("DocumentationLinkDialog_NameEditor_title")); // $NON-NLS-1$ nameText = new Text(grpDocumentationSettings, SWT.BORDER); nameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); nameText.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { name = nameText.getText(); updateButtons(); } }); }
private void createWorkspaceValueEditor(Group grpDocumentationSettings) { btnWorkspace = new Button(grpDocumentationSettings, SWT.RADIO); btnWorkspace.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); btnWorkspace.addSelectionListener( new SelectionAdapter() { /** * {@inheritDoc} * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { valueText.setEnabled(false); treeViewer.getControl().setEnabled(true); } }); btnWorkspace.setText( DocBridgeUI.getInstance() .getString("DocumentationLinkDialog_WorkspaceEditor_title")); // $NON-NLS-1$ treeViewer = new TreeViewer(grpDocumentationSettings, SWT.BORDER); Tree tree = treeViewer.getTree(); tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); tree.setEnabled(false); treeViewer.setContentProvider(new WorkbenchContentProvider()); treeViewer.setLabelProvider(new WorkbenchLabelProvider()); treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot()); treeViewer.addSelectionChangedListener( new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof StructuredSelection) { Object selection = ((StructuredSelection) event.getSelection()).getFirstElement(); if (selection instanceof IFile) { value = DocumentationLink.WORKSPACE_PREFIX + ((IFile) selection).getFullPath().toString(); } else { value = null; } updateButtons(); } } }); }
/** * {@inheritDoc} * * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createDialogArea(Composite parent) { Composite container = initDialogContainer(parent); Group grpDocumentationSettings = new Group(container, SWT.NONE); grpDocumentationSettings.setLayout(new GridLayout(2, false)); grpDocumentationSettings.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); grpDocumentationSettings.setText( DocBridgeUI.getInstance() .getString("DocumentationLinkDialog_SettingsGroup_title")); // $NON-NLS-1$ createNameEditor(grpDocumentationSettings); createWebValueEditor(grpDocumentationSettings); createWorkspaceValueEditor(grpDocumentationSettings); return container; }