1
/*******************************************************************************
2
* Copyright (C) 2003-2008, 2013, Guillaume Brocker
4
* All rights reserved. This program and the accompanying materials
5
* are made available under the terms of the Eclipse Public License v1.0
6
* which accompanies this distribution, and is available at
7
* http://www.eclipse.org/legal/epl-v10.html
10
* Guillaume Brocker - Initial API and implementation
12
******************************************************************************/
14
package eclox.ui.wizard;
16
import org.eclipse.core.resources.IResource;
17
import org.eclipse.jface.viewers.IStructuredSelection;
18
import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
20
import eclox.ui.Images;
21
import eclox.ui.Plugin;
26
* To change the template for this generated type comment go to
27
* Window - Preferences - Java - Code Generation - Code and Comments
29
public class NewDoxyfileWizardPage extends WizardNewFileCreationPage {
32
* Retrieves the initial doxyfile name relative to the given object that
33
* is supposed to be a resource.
35
* If the object is not an IResourec instance, and adapter is searched for it.
37
private static String getInitialFileName( Object object ) {
41
if( object == null ) {
44
// Try the direct convertion to a IResource
45
else if( object instanceof IResource ) {
46
resource = (IResource) object;
48
// Try to find an adapter
50
resource = (IResource) org.eclipse.core.runtime.Platform.getAdapterManager().getAdapter(object, IResource.class);
53
// Finally, gets the project name for the resource (if one has been found).
54
return (resource != null) ? (resource.getProject().getName() + ".doxyfile") : new String();
60
* @param selection The current selection object.
62
public NewDoxyfileWizardPage(IStructuredSelection selection) {
63
super("page", selection);
64
setTitle("Doxygen Configuration");
65
setDescription("Creates a new Doxygen configuration file.");
66
setFileName( selection != null ? getInitialFileName(selection.getFirstElement()) : new String() );
67
setImageDescriptor( Plugin.getImageDescriptor(Images.DOXYFILE_WIZARD));
71
* @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#getNewFileLabel()
73
protected String getNewFileLabel() {
74
return "Doxyfile &name:";