1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-02 13:55:39 +02:00

Fix alignment of text field on RemoteResourceBrowserWidget.

Other misc cleanup.

Signed-off-by: Greg Watson <g.watson@computer.org>
This commit is contained in:
Greg Watson 2013-12-20 17:01:34 -05:00
parent f712bdca15
commit 652dd73040
2 changed files with 106 additions and 106 deletions

View file

@ -192,6 +192,8 @@ public class RemoteConnectionWidget extends Composite {
layout.marginHeight = 0; layout.marginHeight = 0;
layout.marginWidth = 0; layout.marginWidth = 0;
layout.numColumns = 4; layout.numColumns = 4;
setLayout(layout);
setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
if (title != null) { if (title != null) {
Group group = new Group(this, SWT.NONE); Group group = new Group(this, SWT.NONE);
@ -206,9 +208,6 @@ public class RemoteConnectionWidget extends Composite {
body = group; body = group;
} }
setLayout(layout);
setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
/* /*
* Check if we need a remote services combo, or we should just use the default provider * Check if we need a remote services combo, or we should just use the default provider
*/ */
@ -225,12 +224,10 @@ public class RemoteConnectionWidget extends Composite {
*/ */
Label label = new Label(body, SWT.NONE); Label label = new Label(body, SWT.NONE);
label.setText(Messages.RemoteConnectionWidget_remoteServiceProvider); label.setText(Messages.RemoteConnectionWidget_remoteServiceProvider);
GridData gd = new GridData(); label.setLayoutData(new GridData());
gd.horizontalSpan = 1;
label.setLayoutData(gd);
fServicesCombo = new Combo(body, SWT.DROP_DOWN | SWT.READ_ONLY); fServicesCombo = new Combo(body, SWT.DROP_DOWN | SWT.READ_ONLY);
gd = new GridData(GridData.FILL_HORIZONTAL); GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
gd.horizontalSpan = 3; gd.horizontalSpan = 3;
fServicesCombo.setLayoutData(gd); fServicesCombo.setLayoutData(gd);
fServicesCombo.addSelectionListener(fWidgetListener); fServicesCombo.addSelectionListener(fWidgetListener);
@ -240,29 +237,21 @@ public class RemoteConnectionWidget extends Composite {
if ((flags & FLAG_NO_LOCAL_SELECTION) == 0 && (flags & FLAG_FORCE_PROVIDER_SELECTION) == 0) { if ((flags & FLAG_NO_LOCAL_SELECTION) == 0 && (flags & FLAG_FORCE_PROVIDER_SELECTION) == 0) {
fLocalButton = new Button(body, SWT.RADIO); fLocalButton = new Button(body, SWT.RADIO);
fLocalButton.setText(Messages.RemoteConnectionWidget_Local); fLocalButton.setText(Messages.RemoteConnectionWidget_Local);
GridData data = new GridData(); fLocalButton.setLayoutData(new GridData());
data.horizontalSpan = 1;
fLocalButton.setLayoutData(data);
fLocalButton.addSelectionListener(fWidgetListener); fLocalButton.addSelectionListener(fWidgetListener);
fLocalButton.setSelection(false); fLocalButton.setSelection(false);
fRemoteButton = new Button(body, SWT.RADIO); fRemoteButton = new Button(body, SWT.RADIO);
fRemoteButton.setText(Messages.RemoteConnectionWidget_Remote); fRemoteButton.setText(Messages.RemoteConnectionWidget_Remote);
data = new GridData(); fRemoteButton.setLayoutData(new GridData());
data.horizontalSpan = 1;
fRemoteButton.setLayoutData(data);
} else { } else {
Label remoteLabel = new Label(body, SWT.NONE); Label remoteLabel = new Label(body, SWT.NONE);
remoteLabel.setText(Messages.RemoteConnectionWidget_connectionName); remoteLabel.setText(Messages.RemoteConnectionWidget_connectionName);
GridData gd = new GridData(); remoteLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
gd.horizontalSpan = 1;
remoteLabel.setLayoutData(gd);
} }
fConnectionCombo = new Combo(body, SWT.DROP_DOWN | SWT.READ_ONLY); fConnectionCombo = new Combo(body, SWT.DROP_DOWN | SWT.READ_ONLY);
GridData gd = new GridData(GridData.FILL_HORIZONTAL); fConnectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
gd.horizontalSpan = 1;
fConnectionCombo.setLayoutData(gd);
fConnectionCombo.addSelectionListener(fWidgetListener); fConnectionCombo.addSelectionListener(fWidgetListener);
if (fDefaultServices != null) { if (fDefaultServices != null) {
fConnectionCombo.setFocus(); fConnectionCombo.setFocus();
@ -271,8 +260,7 @@ public class RemoteConnectionWidget extends Composite {
fNewConnectionButton = new Button(body, SWT.PUSH); fNewConnectionButton = new Button(body, SWT.PUSH);
fNewConnectionButton.setText(Messages.RemoteConnectionWidget_new); fNewConnectionButton.setText(Messages.RemoteConnectionWidget_new);
gd = new GridData(); fNewConnectionButton.setLayoutData(new GridData());
fNewConnectionButton.setLayoutData(gd);
fNewConnectionButton.addSelectionListener(fWidgetListener); fNewConnectionButton.addSelectionListener(fWidgetListener);
fRemoteServices = RemoteServicesImpl.getRemoteServiceDescriptors(); fRemoteServices = RemoteServicesImpl.getRemoteServiceDescriptors();

View file

@ -92,16 +92,17 @@ public class RemoteResourceBrowserWidget extends Composite {
private static final int minimumWidth = 200; private static final int minimumWidth = 200;
private static final int heightHint = 300; private static final int heightHint = 300;
private RemoteTreeViewer treeViewer; private RemoteTreeViewer fTreeViewer;
private Text remotePathText; private Text fRemotePathText;
private Button upButton; private Button fUpButton;
private Button newFolderButton; private Button fNewFolderButton;
private Button fShowHiddenButton;
private RemoteConnectionWidget fRemoteConnectionWidget; private RemoteConnectionWidget fRemoteConnectionWidget;
private String dialogTitle; private String fDialogTitle;
private String dialogLabel; private String fDialogLabel;
private boolean showHidden; private boolean fShowHidden;
private final List<IFileStore> fResources = new ArrayList<IFileStore>(); private final List<IFileStore> fResources = new ArrayList<IFileStore>();
private String fInitialPath; private String fInitialPath;
private IPath fRootPath; private IPath fRootPath;
@ -110,7 +111,7 @@ public class RemoteResourceBrowserWidget extends Composite {
private final ListenerList fSelectionListeners = new ListenerList(); private final ListenerList fSelectionListeners = new ListenerList();
private int optionFlags = FILE_BROWSER | SHOW_HIDDEN_CHECKBOX | SHOW_NEW_FOLDER_BUTTON; private int fOptionFlags = FILE_BROWSER | SHOW_HIDDEN_CHECKBOX | SHOW_NEW_FOLDER_BUTTON;
private IRunnableContext fRunnableContext; private IRunnableContext fRunnableContext;
@ -119,7 +120,7 @@ public class RemoteResourceBrowserWidget extends Composite {
setTitle(Messages.RemoteResourceBrowser_resourceTitle); setTitle(Messages.RemoteResourceBrowser_resourceTitle);
if (flags != 0) { if (flags != 0) {
optionFlags = flags; fOptionFlags = flags;
} }
setType(); setType();
@ -131,20 +132,18 @@ public class RemoteResourceBrowserWidget extends Composite {
final Composite mainComp = new Composite(this, SWT.NONE); final Composite mainComp = new Composite(this, SWT.NONE);
mainComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); mainComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
layout = new GridLayout(); mainComp.setLayout(new GridLayout(1, false));
layout.numColumns = 4;
mainComp.setLayout(layout);
if ((optionFlags & SHOW_CONNECTIONS) != 0) { if ((fOptionFlags & SHOW_CONNECTIONS) != 0) {
fRemoteConnectionWidget = new RemoteConnectionWidget(mainComp, SWT.NONE, null, fRemoteConnectionWidget = new RemoteConnectionWidget(mainComp, SWT.NONE, "", //$NON-NLS-1$
RemoteConnectionWidget.FLAG_NO_LOCAL_SELECTION); RemoteConnectionWidget.FLAG_NO_LOCAL_SELECTION);
fRemoteConnectionWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1)); fRemoteConnectionWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
fRemoteConnectionWidget.addSelectionListener(new SelectionAdapter() { fRemoteConnectionWidget.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
connectionSelected(); connectionSelected();
updateEnablement(); updateEnablement();
notifySelectionChangedListeners(new SelectionChangedEvent(treeViewer, new ISelection() { notifySelectionChangedListeners(new SelectionChangedEvent(fTreeViewer, new ISelection() {
@Override @Override
public boolean isEmpty() { public boolean isEmpty() {
return true; return true;
@ -154,27 +153,31 @@ public class RemoteResourceBrowserWidget extends Composite {
}); });
} }
Label label = new Label(mainComp, SWT.NONE); Composite textComp = new Composite(mainComp, SWT.NONE);
label.setText(dialogLabel); textComp.setLayout(new GridLayout(4, false));
textComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
Label label = new Label(textComp, SWT.NONE);
label.setText(fDialogLabel);
label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
remotePathText = new Text(mainComp, SWT.BORDER | SWT.SINGLE); fRemotePathText = new Text(textComp, SWT.BORDER | SWT.SINGLE);
remotePathText.addSelectionListener(new SelectionAdapter() { fRemotePathText.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetDefaultSelected(SelectionEvent e) { public void widgetDefaultSelected(SelectionEvent e) {
remotePathText.setSelection(remotePathText.getText().length()); fRemotePathText.setSelection(fRemotePathText.getText().length());
setRoot(remotePathText.getText()); setRoot(fRemotePathText.getText());
} }
}); });
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
gd.minimumWidth = minimumWidth; // gd.minimumWidth = minimumWidth;
remotePathText.setLayoutData(gd); fRemotePathText.setLayoutData(gd);
upButton = new Button(mainComp, SWT.PUSH | SWT.FLAT); fUpButton = new Button(textComp, SWT.PUSH | SWT.FLAT);
upButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); fUpButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
upButton.setImage(RemoteUIImages.get(RemoteUIImages.IMG_ELCL_UP_NAV)); fUpButton.setImage(RemoteUIImages.get(RemoteUIImages.IMG_ELCL_UP_NAV));
upButton.setToolTipText(Messages.RemoteResourceBrowser_UpOneLevel); fUpButton.setToolTipText(Messages.RemoteResourceBrowser_UpOneLevel);
upButton.addSelectionListener(new SelectionAdapter() { fUpButton.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
if (!fRootPath.isRoot()) { if (!fRootPath.isRoot()) {
@ -183,16 +186,16 @@ public class RemoteResourceBrowserWidget extends Composite {
} }
}); });
if ((optionFlags & SHOW_NEW_FOLDER_BUTTON) != 0) { if ((fOptionFlags & SHOW_NEW_FOLDER_BUTTON) != 0) {
// new folder: See Bug 396334 // new folder: See Bug 396334
newFolderButton = new Button(mainComp, SWT.PUSH | SWT.FLAT); fNewFolderButton = new Button(textComp, SWT.PUSH | SWT.FLAT);
newFolderButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); fNewFolderButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
newFolderButton.setImage(RemoteUIImages.get(RemoteUIImages.IMG_ELCL_NEW_FOLDER)); fNewFolderButton.setImage(RemoteUIImages.get(RemoteUIImages.IMG_ELCL_NEW_FOLDER));
newFolderButton.setToolTipText(Messages.RemoteResourceBrowser_NewFolder); fNewFolderButton.setToolTipText(Messages.RemoteResourceBrowser_NewFolder);
newFolderButton.addSelectionListener(new SelectionAdapter() { fNewFolderButton.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
ISelection selection = treeViewer.getSelection(); ISelection selection = fTreeViewer.getSelection();
if (!selection.isEmpty()) { if (!selection.isEmpty()) {
if (selection instanceof TreeSelection) { if (selection instanceof TreeSelection) {
TreePath[] treePaths = ((TreeSelection) selection).getPaths(); TreePath[] treePaths = ((TreeSelection) selection).getPaths();
@ -206,13 +209,13 @@ public class RemoteResourceBrowserWidget extends Composite {
String path = element.getFileStore().toURI().getPath(); String path = element.getFileStore().toURI().getPath();
String newPath = createNewFolder(path); String newPath = createNewFolder(path);
if (newPath != null) { if (newPath != null) {
treeViewer.expandToLevel(element, 1); fTreeViewer.expandToLevel(element, 1);
treeViewer.refresh(element); fTreeViewer.refresh(element);
Object[] children = element.getChildren(null); Object[] children = element.getChildren(null);
for (Object child : children) { for (Object child : children) {
if (child instanceof DeferredFileStore if (child instanceof DeferredFileStore
&& newPath.equals(((DeferredFileStore) child).getFileStore().getName())) { && newPath.equals(((DeferredFileStore) child).getFileStore().getName())) {
treeViewer.deferSelection(new StructuredSelection(child)); fTreeViewer.deferSelection(new StructuredSelection(child));
} }
} }
} }
@ -220,17 +223,17 @@ public class RemoteResourceBrowserWidget extends Composite {
} }
} }
} else { } else {
DeferredFileStore root = (DeferredFileStore) treeViewer.getInput(); DeferredFileStore root = (DeferredFileStore) fTreeViewer.getInput();
String path = root.getFileStore().toURI().getPath(); String path = root.getFileStore().toURI().getPath();
String newPath = createNewFolder(path); String newPath = createNewFolder(path);
if (newPath != null) { if (newPath != null) {
treeViewer.refresh(); fTreeViewer.refresh();
treeViewer.getTree().setFocus(); fTreeViewer.getTree().setFocus();
Object[] children = root.getChildren(null); Object[] children = root.getChildren(null);
for (Object child : children) { for (Object child : children) {
if (child instanceof DeferredFileStore if (child instanceof DeferredFileStore
&& newPath.equals(((DeferredFileStore) child).getFileStore().getName())) { && newPath.equals(((DeferredFileStore) child).getFileStore().getName())) {
treeViewer.deferSelection(new StructuredSelection(child)); fTreeViewer.deferSelection(new StructuredSelection(child));
} }
} }
} }
@ -240,25 +243,24 @@ public class RemoteResourceBrowserWidget extends Composite {
} else { } else {
gd = new GridData(SWT.LEFT, SWT.CENTER, false, false); gd = new GridData(SWT.LEFT, SWT.CENTER, false, false);
gd.horizontalSpan = 2; gd.horizontalSpan = 2;
upButton.setLayoutData(gd); fUpButton.setLayoutData(gd);
} }
if ((style & SWT.MULTI) == SWT.MULTI) { if ((style & SWT.MULTI) == SWT.MULTI) {
treeViewer = new RemoteTreeViewer(mainComp, SWT.MULTI | SWT.BORDER); fTreeViewer = new RemoteTreeViewer(mainComp, SWT.MULTI | SWT.BORDER);
} else { } else {
treeViewer = new RemoteTreeViewer(mainComp, SWT.SINGLE | SWT.BORDER); fTreeViewer = new RemoteTreeViewer(mainComp, SWT.SINGLE | SWT.BORDER);
} }
gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.horizontalSpan = 4;
// see bug 158380 // see bug 158380
gd.heightHint = Math.max(parent.getSize().y, heightHint); gd.heightHint = Math.max(parent.getSize().y, heightHint);
treeViewer.getTree().setLayoutData(gd); fTreeViewer.getTree().setLayoutData(gd);
treeViewer.setUseHashlookup(true); fTreeViewer.setUseHashlookup(true);
treeViewer.setComparer(new DeferredFileStoreComparer()); fTreeViewer.setComparer(new DeferredFileStoreComparer());
treeViewer.setComparator(new RemoteResourceComparator()); fTreeViewer.setComparator(new RemoteResourceComparator());
treeViewer.setContentProvider(new RemoteContentProvider()); fTreeViewer.setContentProvider(new RemoteContentProvider());
treeViewer.setLabelProvider(new WorkbenchLabelProvider()); fTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override @Override
public void selectionChanged(SelectionChangedEvent event) { public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection(); ISelection selection = event.getSelection();
@ -272,26 +274,26 @@ public class RemoteResourceBrowserWidget extends Composite {
} }
} }
if (fResources.size() > 0) { if (fResources.size() > 0) {
remotePathText.setText(fResources.get(0).toURI().getPath()); fRemotePathText.setText(fResources.get(0).toURI().getPath());
} }
updateEnablement(); updateEnablement();
notifySelectionChangedListeners(event); notifySelectionChangedListeners(event);
} }
} }
}); });
treeViewer.addDoubleClickListener(new IDoubleClickListener() { fTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override @Override
public void doubleClick(DoubleClickEvent event) { public void doubleClick(DoubleClickEvent event) {
IStructuredSelection s = (IStructuredSelection) event.getSelection(); IStructuredSelection s = (IStructuredSelection) event.getSelection();
Object o = s.getFirstElement(); Object o = s.getFirstElement();
if (treeViewer.isExpandable(o)) { if (fTreeViewer.isExpandable(o)) {
treeViewer.setExpandedState(o, !treeViewer.getExpandedState(o)); fTreeViewer.setExpandedState(o, !fTreeViewer.getExpandedState(o));
} }
} }
}); });
if ((optionFlags & DIRECTORY_BROWSER) != 0) { if ((fOptionFlags & DIRECTORY_BROWSER) != 0) {
treeViewer.addFilter(new ViewerFilter() { fTreeViewer.addFilter(new ViewerFilter() {
@Override @Override
public boolean select(Viewer viewer, Object parentElement, Object element) { public boolean select(Viewer viewer, Object parentElement, Object element) {
if ((element instanceof DeferredFileStore)) { if ((element instanceof DeferredFileStore)) {
@ -302,14 +304,14 @@ public class RemoteResourceBrowserWidget extends Composite {
}); });
} }
if ((optionFlags & SHOW_HIDDEN_CHECKBOX) != 0) { if ((fOptionFlags & SHOW_HIDDEN_CHECKBOX) != 0) {
final Button showHiddenButton = new Button(mainComp, SWT.CHECK); fShowHiddenButton = new Button(mainComp, SWT.CHECK);
showHiddenButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); fShowHiddenButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
showHiddenButton.setText(Messages.RemoteResourceBrowser_Show_hidden_files); fShowHiddenButton.setText(Messages.RemoteResourceBrowser_Show_hidden_files);
showHiddenButton.addSelectionListener(new SelectionAdapter() { fShowHiddenButton.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
showHidden = showHiddenButton.getSelection(); fShowHidden = fShowHiddenButton.getSelection();
setRoot(fRootPath.toString()); setRoot(fRootPath.toString());
} }
}); });
@ -351,7 +353,7 @@ public class RemoteResourceBrowserWidget extends Composite {
if (fFileMgr != null) { if (fFileMgr != null) {
/* /*
* Note: the call to findInitialPath must happen before the * Note: the call to findInitialPath must happen before the
* treeViewer input is set or the treeViewer fails. No idea why this * fTreeViewer input is set or the fTreeViewer fails. No idea why this
* is. * is.
*/ */
String cwd = conn.getWorkingDirectory(); String cwd = conn.getWorkingDirectory();
@ -513,9 +515,9 @@ public class RemoteResourceBrowserWidget extends Composite {
private void setRoot(String path) { private void setRoot(String path) {
if (fFileMgr != null) { if (fFileMgr != null) {
IFileStore root = fFileMgr.getResource(path); IFileStore root = fFileMgr.getResource(path);
treeViewer.setInput(new DeferredFileStore(root, !showHidden)); fTreeViewer.setInput(new DeferredFileStore(root, !fShowHidden));
remotePathText.setText(path); fRemotePathText.setText(path);
remotePathText.setSelection(remotePathText.getText().length()); fRemotePathText.setSelection(fRemotePathText.getText().length());
fResources.clear(); fResources.clear();
fResources.add(root); fResources.add(root);
fRootPath = new Path(path); fRootPath = new Path(path);
@ -527,18 +529,18 @@ public class RemoteResourceBrowserWidget extends Composite {
} }
/** /**
* Set the dialogTitle of the dialog. * Set the fDialogTitle of the dialog.
* *
* @param title * @param title
*/ */
public void setTitle(String title) { public void setTitle(String title) {
dialogTitle = title; fDialogTitle = title;
if (dialogTitle == null) { if (fDialogTitle == null) {
dialogTitle = ""; //$NON-NLS-1$ fDialogTitle = ""; //$NON-NLS-1$
} }
Shell shell = getShell(); Shell shell = getShell();
if ((shell != null) && !shell.isDisposed()) { if ((shell != null) && !shell.isDisposed()) {
shell.setText(dialogTitle); shell.setText(fDialogTitle);
} }
} }
@ -548,14 +550,14 @@ public class RemoteResourceBrowserWidget extends Composite {
* both files and directories. * both files and directories.
*/ */
public void setType() { public void setType() {
if ((optionFlags & DIRECTORY_BROWSER) == 0) { if ((fOptionFlags & DIRECTORY_BROWSER) == 0) {
dialogLabel = Messages.RemoteResourceBrowser_fileLabel; fDialogLabel = Messages.RemoteResourceBrowser_fileLabel;
setTitle(Messages.RemoteResourceBrowser_fileTitle); setTitle(Messages.RemoteResourceBrowser_fileTitle);
} else if ((optionFlags & FILE_BROWSER) == 0) { } else if ((fOptionFlags & FILE_BROWSER) == 0) {
dialogLabel = Messages.RemoteResourceBrowser_directoryLabel; fDialogLabel = Messages.RemoteResourceBrowser_directoryLabel;
setTitle(Messages.RemoteResourceBrowser_directoryTitle); setTitle(Messages.RemoteResourceBrowser_directoryTitle);
} else { } else {
dialogLabel = Messages.RemoteResourceBrowser_resourceLabel; fDialogLabel = Messages.RemoteResourceBrowser_resourceLabel;
setTitle(Messages.RemoteResourceBrowser_resourceTitle); setTitle(Messages.RemoteResourceBrowser_resourceTitle);
} }
@ -564,8 +566,9 @@ public class RemoteResourceBrowserWidget extends Composite {
private void updateEnablement() { private void updateEnablement() {
boolean upEnabled = false; boolean upEnabled = false;
boolean newFolderEnabled = false; boolean newFolderEnabled = false;
boolean connectionOpen = fConnection != null && fConnection.isOpen();
if (fConnection != null && fConnection.isOpen()) { if (connectionOpen) {
if (fResources.size() == 1) { if (fResources.size() == 1) {
IFileStore store = fResources.get(0); IFileStore store = fResources.get(0);
/* /*
@ -581,11 +584,20 @@ public class RemoteResourceBrowserWidget extends Composite {
} }
} }
if (upButton != null) { if (fUpButton != null) {
upButton.setEnabled(upEnabled); fUpButton.setEnabled(upEnabled);
} }
if (newFolderButton != null) { if (fNewFolderButton != null) {
newFolderButton.setEnabled(newFolderEnabled); fNewFolderButton.setEnabled(newFolderEnabled);
}
if (fRemotePathText != null) {
fRemotePathText.setEnabled(connectionOpen);
}
if (fTreeViewer != null) {
fTreeViewer.getTree().setEnabled(connectionOpen);
}
if (fShowHiddenButton != null) {
fShowHiddenButton.setEnabled(connectionOpen);
} }
} }
} }