View | Details | Raw Unified | Return to bug 209565 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/internal/ide/misc/ContainerSelectionGroup.java (-1 / +11 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 9-14 Link Here
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Igor Fedorenko <igorfie@yahoo.com> - 
10
 *     Igor Fedorenko <igorfie@yahoo.com> - 
11
 *     		Fix for Bug 136921 [IDE] New File dialog locks for 20 seconds
11
 *     		Fix for Bug 136921 [IDE] New File dialog locks for 20 seconds
12
 *     Remy Chi Jian Suen <remy.suen@gmail.com> -
13
 *     		Fix for Bug 209565 [Dialogs] The OK button in ContainerSelectionDialog should be disabled if no project is available
12
 *******************************************************************************/
14
 *******************************************************************************/
13
package org.eclipse.ui.internal.ide.misc;
15
package org.eclipse.ui.internal.ide.misc;
14
16
Lines 293-298 Link Here
293
		// This has to be done after the viewer has been laid out
295
		// This has to be done after the viewer has been laid out
294
		treeViewer.setInput(ResourcesPlugin.getWorkspace());
296
		treeViewer.setInput(ResourcesPlugin.getWorkspace());
295
	}
297
	}
298
	
299
	/**
300
	 * Returns whether there are any containers available for the user to select.
301
	 * @return <tt>true</tt> if there are selectable containers, <tt>false</tt> otherwise
302
	 */
303
	public boolean hasContainers() {
304
		return treeViewer.getTree().getItems() != 0;
305
	}
296
306
297
	/**
307
	/**
298
	 * Returns the currently entered container name. Null if the field is empty.
308
	 * Returns the currently entered container name. Null if the field is empty.
(-)extensions/org/eclipse/ui/dialogs/ContainerSelectionDialog.java (-1 / +15 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 9-14 Link Here
9
 *   IBM Corporation - initial API and implementation 
9
 *   IBM Corporation - initial API and implementation 
10
 *   Sebastian Davids <sdavids@gmx.de> - Fix for bug 19346 - Dialog
10
 *   Sebastian Davids <sdavids@gmx.de> - Fix for bug 19346 - Dialog
11
 *     font should be activated and used by other components.
11
 *     font should be activated and used by other components.
12
 *   Remy Chi Jian Suen <remy.suen@gmail.com> - Fix for bug 209565 - [Dialogs]
13
 *     The OK button in ContainerSelectionDialog should be disabled if no
14
 *     project is available
12
 *******************************************************************************/
15
 *******************************************************************************/
13
16
14
package org.eclipse.ui.dialogs;
17
package org.eclipse.ui.dialogs;
Lines 18-23 Link Here
18
21
19
import org.eclipse.core.resources.IContainer;
22
import org.eclipse.core.resources.IContainer;
20
import org.eclipse.core.runtime.IPath;
23
import org.eclipse.core.runtime.IPath;
24
import org.eclipse.jface.dialogs.IDialogConstants;
21
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.SWT;
22
import org.eclipse.swt.layout.GridData;
26
import org.eclipse.swt.layout.GridData;
23
import org.eclipse.swt.widgets.Composite;
27
import org.eclipse.swt.widgets.Composite;
Lines 106-111 Link Here
106
    }
110
    }
107
111
108
    /* (non-Javadoc)
112
    /* (non-Javadoc)
113
     * Method declared in Window.
114
     */
115
    protected Control createContents(Composite parent) {
116
    	Control control = super.createContents(parent);
117
    	// disable the 'OK' button if there are no containers to select
118
    	getButton(IDialogConstants.OK_ID).setEnabled(group.hasContainers());
119
    	return control;
120
    }
121
122
    /* (non-Javadoc)
109
     * Method declared on Dialog.
123
     * Method declared on Dialog.
110
     */
124
     */
111
    protected Control createDialogArea(Composite parent) {
125
    protected Control createDialogArea(Composite parent) {

Return to bug 209565