KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > classpath > DefaultClasspathEntryEditor


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.debug.ui.classpath;
12
13 import org.eclipse.debug.core.ILaunchConfiguration;
14 import org.eclipse.jdt.internal.launching.DefaultProjectClasspathEntry;
15 import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
16 import org.eclipse.jface.window.Window;
17 import org.eclipse.swt.widgets.Shell;
18
19 public class DefaultClasspathEntryEditor implements IClasspathEditor {
20
21     /* (non-Javadoc)
22      * @see org.eclipse.jdt.internal.debug.ui.classpath.IClasspathEditor#canEdit(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.jdt.launching.IRuntimeClasspathEntry[])
23      */

24     public boolean canEdit(ILaunchConfiguration configuration, IRuntimeClasspathEntry[] entries) {
25         return entries.length == 1 && entries[0] instanceof DefaultProjectClasspathEntry;
26     }
27
28     /* (non-Javadoc)
29      * @see org.eclipse.jdt.internal.debug.ui.classpath.IClasspathEditor#edit(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.jdt.launching.IRuntimeClasspathEntry[])
30      */

31     public IRuntimeClasspathEntry[] edit(Shell shell, ILaunchConfiguration configuration, IRuntimeClasspathEntry[] entries) {
32         DefaultClasspathEntryDialog dialog = new DefaultClasspathEntryDialog(shell, entries[0]);
33         if (dialog.open() == Window.OK) {
34             return entries;
35         }
36         return null;
37     }
38
39 }
40
Popular Tags