mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
2004-09-24 Chris Wiebe
remove obsolete classes * src/org/eclipse/cdt/internal/ui/wizards/BaseClassSelectionDialog.java * src/org/eclipse/cdt/internal/ui/wizards/OpenNewFileWizardAction.java * src/org/eclipse/cdt/internal/ui/wizards/OpenNewFolderWizardAction.java * src/org/eclipse/cdt/ui/wizards/NewClassWizard.java * src/org/eclipse/cdt/ui/wizards/NewClassWizardPage.java
This commit is contained in:
parent
f11db48d9b
commit
a3b52da7f2
6 changed files with 9 additions and 1534 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2004-09-24 Chris Wiebe
|
||||||
|
|
||||||
|
remove obsolete classes
|
||||||
|
* src/org/eclipse/cdt/internal/ui/wizards/BaseClassSelectionDialog.java
|
||||||
|
* src/org/eclipse/cdt/internal/ui/wizards/OpenNewFileWizardAction.java
|
||||||
|
* src/org/eclipse/cdt/internal/ui/wizards/OpenNewFolderWizardAction.java
|
||||||
|
* src/org/eclipse/cdt/ui/wizards/NewClassWizard.java
|
||||||
|
* src/org/eclipse/cdt/ui/wizards/NewClassWizardPage.java
|
||||||
|
|
||||||
2004-09-24 Chris Wiebe
|
2004-09-24 Chris Wiebe
|
||||||
|
|
||||||
new folder wizards
|
new folder wizards
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2004 IBM Corporation and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Common Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* IBM Corporation - initial API and implementation
|
|
||||||
* QNX Software Systems - adapted for use in CDT
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.ui.wizards;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
|
||||||
import org.eclipse.cdt.ui.browser.typeinfo.TypeSelectionDialog;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A dialog to select a type from a list of types. The selected type will be
|
|
||||||
* opened in the editor.
|
|
||||||
*
|
|
||||||
* @deprecated use NewBaseClassSelectionDialog instead
|
|
||||||
*/
|
|
||||||
public class BaseClassSelectionDialog extends TypeSelectionDialog {
|
|
||||||
|
|
||||||
private static final String DIALOG_SETTINGS= BaseClassSelectionDialog.class.getName();
|
|
||||||
private static final int[] fVisibleTypes= {ICElement.C_CLASS, ICElement.C_STRUCT};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs an instance of <code>OpenTypeDialog</code>.
|
|
||||||
* @param parent the parent shell.
|
|
||||||
*/
|
|
||||||
public BaseClassSelectionDialog(Shell parent) {
|
|
||||||
super(parent);
|
|
||||||
setTitle(NewWizardMessages.getString("BaseClassSelectionDialog.title")); //$NON-NLS-1$
|
|
||||||
setMessage(NewWizardMessages.getString("BaseClassSelectionDialog.message")); //$NON-NLS-1$
|
|
||||||
setDialogSettings(DIALOG_SETTINGS);
|
|
||||||
setVisibleTypes(fVisibleTypes);
|
|
||||||
setFilter("*", true); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
package org.eclipse.cdt.internal.ui.wizards;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (c) Copyright IBM Corp. 2000, 2001.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import org.eclipse.jface.action.Action;
|
|
||||||
import org.eclipse.jface.action.IAction;
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
|
||||||
import org.eclipse.jface.wizard.WizardDialog;
|
|
||||||
|
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
|
||||||
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
|
||||||
import org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use NewFileCreationWizard instead
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class OpenNewFileWizardAction extends Action implements IWorkbenchWindowActionDelegate {
|
|
||||||
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
BasicNewFileResourceWizard wizard= new BasicNewFileResourceWizard();
|
|
||||||
wizard.init(CUIPlugin.getDefault().getWorkbench(), getCurrentSelection());
|
|
||||||
wizard.setNeedsProgressMonitor(true);
|
|
||||||
WizardDialog dialog=
|
|
||||||
new WizardDialog(CUIPlugin.getActiveWorkbenchShell(), wizard);
|
|
||||||
dialog.create();
|
|
||||||
dialog.getShell().setText(
|
|
||||||
CUIPlugin.getResourceString("OpenNewFileWizardAction.title")); //$NON-NLS-1$
|
|
||||||
dialog.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected IStructuredSelection getCurrentSelection() {
|
|
||||||
IWorkbenchWindow window= CUIPlugin.getActiveWorkbenchWindow();
|
|
||||||
if (window != null) {
|
|
||||||
ISelection selection= window.getSelectionService().getSelection();
|
|
||||||
if (selection instanceof IStructuredSelection) {
|
|
||||||
return (IStructuredSelection) selection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return StructuredSelection.EMPTY;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @see IActionDelegate#run(IAction)
|
|
||||||
*/
|
|
||||||
public void run(IAction action) {
|
|
||||||
run();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @see IWorkbenchWindowActionDelegate#dispose()
|
|
||||||
*/
|
|
||||||
public void dispose() {
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @see IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
|
|
||||||
*/
|
|
||||||
public void init(IWorkbenchWindow window) {
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @see IActionDelegate#selectionChanged(IAction, ISelection)
|
|
||||||
*/
|
|
||||||
public void selectionChanged(IAction action, ISelection selection) {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
package org.eclipse.cdt.internal.ui.wizards;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (c) Copyright IBM Corp. 2000, 2001.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import org.eclipse.jface.action.Action;
|
|
||||||
import org.eclipse.jface.action.IAction;
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
|
||||||
import org.eclipse.jface.wizard.WizardDialog;
|
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
|
||||||
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
|
||||||
import org.eclipse.ui.wizards.newresource.BasicNewFolderResourceWizard;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use NewFolderCreationWizard instead
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class OpenNewFolderWizardAction extends Action implements IWorkbenchWindowActionDelegate {
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
BasicNewFolderResourceWizard wizard= new BasicNewFolderResourceWizard();
|
|
||||||
wizard.init(CUIPlugin.getDefault().getWorkbench(), getCurrentSelection());
|
|
||||||
wizard.setNeedsProgressMonitor(true);
|
|
||||||
WizardDialog dialog=
|
|
||||||
new WizardDialog(CUIPlugin.getActiveWorkbenchShell(), wizard);
|
|
||||||
dialog.create();
|
|
||||||
dialog.getShell().setText(
|
|
||||||
CUIPlugin.getResourceString("OpenNewFolderWizardAction.title")); //$NON-NLS-1$
|
|
||||||
dialog.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected IStructuredSelection getCurrentSelection() {
|
|
||||||
IWorkbenchWindow window= CUIPlugin.getActiveWorkbenchWindow();
|
|
||||||
if (window != null) {
|
|
||||||
ISelection selection= window.getSelectionService().getSelection();
|
|
||||||
if (selection instanceof IStructuredSelection) {
|
|
||||||
return (IStructuredSelection) selection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return StructuredSelection.EMPTY;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @see IActionDelegate#run(IAction)
|
|
||||||
*/
|
|
||||||
public void run(IAction action) {
|
|
||||||
run();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @see IWorkbenchWindowActionDelegate#dispose()
|
|
||||||
*/
|
|
||||||
public void dispose() {
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @see IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
|
|
||||||
*/
|
|
||||||
public void init(IWorkbenchWindow window) {
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @see IActionDelegate#selectionChanged(IAction, ISelection)
|
|
||||||
*/
|
|
||||||
public void selectionChanged(IAction action, ISelection selection) {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,160 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2003, 2004 IBM Corporation and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Common Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* IBM Corporation - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.ui.wizards;
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
|
||||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
|
||||||
import org.eclipse.cdt.internal.ui.actions.WorkbenchRunnableAdapter;
|
|
||||||
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
|
|
||||||
import org.eclipse.cdt.internal.ui.wizards.NewWizardMessages;
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
|
||||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
|
||||||
import org.eclipse.swt.widgets.Display;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.ui.INewWizard;
|
|
||||||
import org.eclipse.ui.IWorkbenchPage;
|
|
||||||
import org.eclipse.ui.PartInitException;
|
|
||||||
import org.eclipse.ui.ide.IDE;
|
|
||||||
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* description for "NewClassWizard".
|
|
||||||
* @see Wizard
|
|
||||||
* @deprecated use NewClassCreationWizard instead
|
|
||||||
*/
|
|
||||||
public class NewClassWizard extends BasicNewResourceWizard implements INewWizard {
|
|
||||||
private NewClassWizardPage fPage;
|
|
||||||
private String wz_title;
|
|
||||||
// a boolean to programatically control opening the sources in the editor
|
|
||||||
private boolean openInEditor = true;
|
|
||||||
|
|
||||||
private static final String WZ_TITLE = "NewClassWizard.title"; //$NON-NLS-1$
|
|
||||||
private static final String WZ_DESC = "NewClassWizard.description"; //$NON-NLS-1$
|
|
||||||
private static final String PAGE_TITLE = "NewClassWizard.page.title"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/**
|
|
||||||
* "NewClassWizard" constructor.
|
|
||||||
*/
|
|
||||||
public NewClassWizard() {
|
|
||||||
this(CUIPlugin.getResourceString(WZ_TITLE));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public NewClassWizard(String title) {
|
|
||||||
super();
|
|
||||||
wz_title = title;
|
|
||||||
setDefaultPageImageDescriptor(CPluginImages.DESC_WIZBAN_NEWCLASS);
|
|
||||||
setWindowTitle(wz_title); //$NON-NLS-1$
|
|
||||||
setNeedsProgressMonitor(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException {
|
|
||||||
if(fPage.createClass(monitor)){
|
|
||||||
ITranslationUnit headerTU= fPage.getCreatedClassHeaderFile();
|
|
||||||
ITranslationUnit bodyTU= fPage.getCreatedClassBodyFile();
|
|
||||||
if (headerTU != null) {
|
|
||||||
IResource resource= headerTU.getResource();
|
|
||||||
selectAndReveal(resource);
|
|
||||||
if(doOpenInEditor()){
|
|
||||||
openResource((IFile) resource);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (bodyTU != null) {
|
|
||||||
IResource resource= bodyTU.getResource();
|
|
||||||
selectAndReveal(resource);
|
|
||||||
if(doOpenInEditor()){
|
|
||||||
openResource((IFile) resource);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @see Wizard#performFinish
|
|
||||||
*/
|
|
||||||
public boolean performFinish() {
|
|
||||||
if(!fPage.selectionIsCpp())
|
|
||||||
return true;
|
|
||||||
IWorkspaceRunnable op= new IWorkspaceRunnable() {
|
|
||||||
public void run(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
|
|
||||||
try {
|
|
||||||
finishPage(monitor);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new OperationCanceledException(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
getContainer().run(false, true, new WorkbenchRunnableAdapter(op));
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
handleFinishException(getShell(), e);
|
|
||||||
return false;
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public void addPages() {
|
|
||||||
super.addPages();
|
|
||||||
fPage= new NewClassWizardPage(getSelection());
|
|
||||||
addPage(fPage);
|
|
||||||
fPage.setTitle(CUIPlugin.getResourceString(PAGE_TITLE));
|
|
||||||
fPage.setDescription(CUIPlugin.getResourceString(WZ_DESC));
|
|
||||||
fPage.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void handleFinishException(Shell shell, InvocationTargetException e) {
|
|
||||||
String title= NewWizardMessages.getString("NewElementWizard.op_error.title"); //$NON-NLS-1$
|
|
||||||
String message= NewWizardMessages.getString("NewElementWizard.op_error.message"); //$NON-NLS-1$
|
|
||||||
ExceptionHandler.handle(e, shell, title, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void openResource(final IFile resource) {
|
|
||||||
final IWorkbenchPage activePage= CUIPlugin.getActivePage();
|
|
||||||
if (activePage != null) {
|
|
||||||
final Display display= getShell().getDisplay();
|
|
||||||
if (display != null) {
|
|
||||||
display.asyncExec(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
IDE.openEditor(activePage, resource, true);
|
|
||||||
} catch (PartInitException e) {
|
|
||||||
CUIPlugin.getDefault().log(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICElement getCreatedClassElement(){
|
|
||||||
return fPage.getCreatedClassElement();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return Returns the openInEditor.
|
|
||||||
*/
|
|
||||||
public boolean doOpenInEditor() {
|
|
||||||
return openInEditor;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param openInEditor The openInEditor to set.
|
|
||||||
*/
|
|
||||||
public void setOpenInEditor(boolean openInEditor) {
|
|
||||||
this.openInEditor = openInEditor;
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue