1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

removal of old make ui componets (wizards/views/actions/properties)

This commit is contained in:
David Inglis 2003-09-16 20:45:41 +00:00
parent 79d4dd460c
commit 5d90b3e85b
20 changed files with 100 additions and 2240 deletions

View file

@ -1,3 +1,34 @@
2003-09-16 David Inglis
Removal of make builder ui components.
plugin.xml
removed wizards and views.
* src/org/eclipse/cdt/internal/ui/cview/CView.java
removed build actions.
* src/org/eclipse/cdt/internal/ui/preferences/CProjectPropertyPage.java
removed tabs that are now in make plugin.
* src/org/eclipse/cdt/ui/wizards/conversion/ConversionWizard.java
* src/org/eclipse/cdt/ui/wizards/conversion/ConvertProjectWizardPage.java
updated to use new c wizards.
* src/org/eclipse/cdt/internal/ui/makeview/MakeAction.java
* src/org/eclipse/cdt/internal/ui/makeview/MakeContentProvider.java
* src/org/eclipse/cdt/internal/ui/makeview/MakeLabelProvider.java
* src/org/eclipse/cdt/internal/ui/makeview/MakeTarget.java
* src/org/eclipse/cdt/internal/ui/makeview/MakeTargetAction.java
* src/org/eclipse/cdt/internal/ui/makeview/MakeView.java
* src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeConversionWizard.java
* src/org/eclipse/cdt/ui/wizards/conversion/ConvertToStdMakeProjectWizardPage.java
* src/org/eclipse/cdt/ui/wizards/BuildPathInfoBlock.java
* src/org/eclipse/cdt/ui/wizards/SettingsBlock.java
* src/org/eclipse/cdt/ui/wizards/StdCCWizard.java
* src/org/eclipse/cdt/ui/wizards/StdCWizard.java
* src/org/eclipse/cdt/ui/wizards/StdMakeProjectWizard.java
All removed now in make plugins.
2003-09-15 John Camelon
Fixed Bug 43126 : ISourceElementRequestor.acceptParameterReference accesses internal class

View file

@ -11,27 +11,18 @@ perspective.name=C/C++ Development
viewsCategory.name=&C
BuildConsoleView.name=C-Build
CView.name=C/C++ Projects
MakeView.name=Make Targets
# The Wizards
# C
newCWizardsCategory.name=C
StdCWizard.name=Standard Make C Project
StdCWizard.description=Create a new C project and let me create and manage the makefile
# C++
newCCWizardsCategory.name=C++
StdCCWizard.name=Standard Make C++ Project
StdCCWizard.description=Create a new C++ project and let me create and manage the makefile
#Project Conversion
ConversionWizard.name=Convert a project's nature
ConversionWizard.description=Convert a project's nature
#Convert Standard Make C/C++
StdMakeConversionWizard.name=Convert to a C or C++ Project
StdMakeConversionWizard.description=Convert a project's nature to C or C++
NewWizards.folder = Folder
NewWizards.folder.description = Create a new folder resource
NewWizards.file = File

View file

@ -129,13 +129,6 @@
class="org.eclipse.cdt.internal.ui.cview.CView"
id="org.eclipse.cdt.ui.CView">
</view>
<view
name="%MakeView.name"
icon="icons/full/obj16/build_menu.gif"
category="org.eclipse.cdt.ui.views"
class="org.eclipse.cdt.internal.ui.makeview.MakeView"
id="org.eclipse.cdt.ui.MakeView">
</view>
</extension>
<!-- The wizards -->
<!-- For C Wizards -->
@ -145,61 +138,11 @@
name="%newCWizardsCategory.name"
id="org.eclipse.cdt.ui.newCWizards">
</category>
<wizard
name="%StdCWizard.name"
icon="icons/full/ctool16/newc_app.gif"
category="org.eclipse.cdt.ui.newCWizards"
class="org.eclipse.cdt.ui.wizards.StdCWizard"
project="true"
finalPerspective="org.eclipse.cdt.ui.CPerspective"
id="org.eclipse.cdt.ui.wizards.StdCWizard">
<description>
%StdCWizard.description
</description>
</wizard>
<!-- For C Conversion Wizard -->
<wizard
name="%StdMakeConversionWizard.name"
icon="icons/full/ctool16/convert-normal.gif"
category="org.eclipse.cdt.ui.newCWizards"
class="org.eclipse.cdt.ui.wizards.conversion.ConvertToStdMakeConversionWizard"
project="true"
finalPerspective="org.eclipse.cdt.ui.CPerspective"
id="org.eclipse.cdt.ui.wizards.ConvertToStdMakeConversionWizard">
<description>
%StdMakeConversionWizard.description
</description>
</wizard>
<!-- For C++ Wizards -->
<category
name="%newCCWizardsCategory.name"
id="org.eclipse.cdt.ui.newCCWizards">
</category>
<wizard
name="%StdCCWizard.name"
icon="icons/full/ctool16/newcc_app.gif"
category="org.eclipse.cdt.ui.newCCWizards"
class="org.eclipse.cdt.ui.wizards.StdCCWizard"
project="true"
finalPerspective="org.eclipse.cdt.ui.CPerspective"
id="org.eclipse.cdt.ui.wizards.StdCCWizard">
<description>
%StdCCWizard.description
</description>
</wizard>
<!-- For C++ Conversion Wizard -->
<wizard
name="%StdMakeConversionWizard.name"
icon="icons/full/ctool16/convert-normal.gif"
category="org.eclipse.cdt.ui.newCCWizards"
class="org.eclipse.cdt.ui.wizards.conversion.ConvertToStdMakeConversionWizard"
project="true"
finalPerspective="org.eclipse.cdt.ui.CPerspective"
id="org.eclipse.cdt.ui.wizards.ConvertToStdMakeConversionWizard">
<description>
%StdMakeConversionWizard.description
</description>
</wizard>
<!-- File and Folder Wizards -->
<wizard
name="%NewWizards.folder"

View file

@ -20,7 +20,6 @@ import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IParent;
import org.eclipse.cdt.core.model.ISourceReference;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.resources.MakeUtil;
import org.eclipse.cdt.internal.core.model.CProject;
import org.eclipse.cdt.internal.core.model.TranslationUnit;
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
@ -29,9 +28,6 @@ import org.eclipse.cdt.internal.ui.editor.FileSearchAction;
import org.eclipse.cdt.internal.ui.editor.FileSearchActionInWorkingSet;
import org.eclipse.cdt.internal.ui.editor.OpenIncludeAction;
import org.eclipse.cdt.internal.ui.editor.SearchDialogAction;
import org.eclipse.cdt.internal.ui.makeview.MakeAction;
import org.eclipse.cdt.internal.ui.makeview.MakeTarget;
import org.eclipse.cdt.internal.ui.makeview.MakeTargetAction;
import org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage;
import org.eclipse.cdt.internal.ui.util.EditorUtility;
import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
@ -140,7 +136,6 @@ public class CView extends ViewPart implements IMenuListener, ISetSelectionTarge
AddBookmarkAction addBookmarkAction;
//BuildAction buildAction;
//BuildAction rebuildAction;
MakeTargetAction makeTargetAction;
CopyResourceAction copyResourceAction;
DeleteResourceAction deleteResourceAction;
OpenFileAction openFileAction;
@ -594,7 +589,6 @@ public class CView extends ViewPart implements IMenuListener, ISetSelectionTarge
refreshAction = new RefreshAction(shell);
buildAction = new BuildAction(shell, IncrementalProjectBuilder.INCREMENTAL_BUILD);
rebuildAction = new BuildAction(shell, IncrementalProjectBuilder.FULL_BUILD);
makeTargetAction = new MakeTargetAction(shell);
moveResourceAction = new MoveResourceAction (shell);
copyResourceAction = new CopyResourceAction(shell);
renameResourceAction = new RenameResourceAction(shell, viewer.getTree());
@ -660,7 +654,6 @@ public class CView extends ViewPart implements IMenuListener, ISetSelectionTarge
* E.g. A project was opened or closed.
*/
void updateActions(IStructuredSelection selection) {
makeTargetAction.selectionChanged(selection);
copyResourceAction.selectionChanged(selection);
refreshAction.selectionChanged(selection);
moveResourceAction.selectionChanged(selection);
@ -775,7 +768,7 @@ public class CView extends ViewPart implements IMenuListener, ISetSelectionTarge
newMenu.add(goIntoAction);
NewWizardMenu newWizMenu = new NewWizardMenu(newMenu, getSite().getWorkbenchWindow(), false);
new NewWizardMenu(newMenu, getSite().getWorkbenchWindow(), false);
menu.add(newMenu);
@ -830,32 +823,6 @@ public class CView extends ViewPart implements IMenuListener, ISetSelectionTarge
//menu.add(buildAction);
//}
//}
boolean isContainer = (resource instanceof IContainer);
if (isContainer) {
MakeTarget[] aBuild = new MakeTarget[1];
aBuild[0] = new MakeTarget(resource, "all");
menu.add(new MakeAction(aBuild, getViewSite().getShell(), "Build"));
MakeTarget[] aReBuild = new MakeTarget[1];
aReBuild[0] = new MakeTarget(resource, "clean all");
menu.add(new MakeAction(aReBuild, getViewSite().getShell(), "Rebuild"));
MakeTarget[] aClean = new MakeTarget[1];
aClean[0] = new MakeTarget(resource, "clean");
menu.add(new MakeAction(aClean, getViewSite().getShell(), "Clean"));
MenuManager submenu= new MenuManager("Make");
String [] directives = MakeUtil.getPersistentTargets(resource);
if (directives.length > 0) {
for (int i = 0; i < directives.length; i++) {
MakeTarget[] a = new MakeTarget[1];
a[0] = new MakeTarget(resource, directives[i]);
submenu.add(new MakeAction(a, getViewSite().getShell(), directives[i]));
}
}
menu.add(submenu);
menu.add(makeTargetAction);
}
menu.add(new GroupMarker(BUILD_GROUP_MARKER_END));
}

View file

@ -1,124 +0,0 @@
package org.eclipse.cdt.internal.ui.makeview;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.BuildAction;
import org.eclipse.cdt.core.resources.MakeUtil;
import org.eclipse.cdt.internal.ui.CPluginImages;
public class MakeAction extends Action {
static final String PREFIX = "BuildAction.";
MakeTarget[] targets;
Shell shell;
public MakeAction (MakeTarget[] targets, Shell shell, String s) {
super (s);
this.shell = shell;
this.targets = targets;
setToolTipText(PREFIX);
setImageDescriptor(CPluginImages.DESC_BUILD_MENU);
}
/**
* Causes all editors to save any modified resources depending on the user's
* preference.
*/
void saveAllResources() {
if (!BuildAction.isSaveAllSet())
return;
List projects = new ArrayList();
for (int i = 0; i < targets.length; ++i ) {
MakeTarget target = targets[i];
projects.add(target.getResource().getProject());
}
IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
for (int i = 0; i < windows.length; i++) {
IWorkbenchPage [] pages = windows[i].getPages();
for (int j = 0; j < pages.length; j++) {
IWorkbenchPage page = pages[j];
IEditorReference[] editorReferences = page.getEditorReferences();
for (int k = 0; k < editorReferences.length; k++) {
IEditorPart editor = editorReferences[k].getEditor(false);
if (editor != null && editor.isDirty()) {
IEditorInput input = editor.getEditorInput();
if (input instanceof IFileEditorInput) {
IFile inputFile = ((IFileEditorInput)input).getFile();
if (projects.contains(inputFile.getProject())) {
page.saveEditor(editor, false);
}
}
}
}
}
}
}
public void run() {
try {
saveAllResources();
IRunnableWithProgress op = new IRunnableWithProgress () {
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
for (int i = 0; i < targets.length; ++i ) {
MakeTarget target = targets[i];
IResource res = target.getResource();
IProject project = res.getProject();
try {
if (! project.equals(res) || target.isLeaf()) {
String dir = res.getLocation().toOSString();
MakeUtil.setSessionBuildDir(project, dir);
if (target.isLeaf()) {
MakeUtil.setSessionTarget(project, target.toString());
}
}
// Full build to force builder for targets like clean and rebuild.
// maybe this should be a option
project.build (IncrementalProjectBuilder.FULL_BUILD, monitor);
} catch (CoreException e) {
}
MakeUtil.removeSessionBuildDir(project);
MakeUtil.removeSessionTarget(project);
}
}
};
new ProgressMonitorDialog(shell).run(true, true, op);
} catch (InvocationTargetException e) {
// handle exception
} catch (InterruptedException e) {
// handle cancelation
}
}
}

View file

@ -1,168 +0,0 @@
package org.eclipse.cdt.internal.ui.makeview;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Control;
public class MakeContentProvider implements ITreeContentProvider, IResourceChangeListener {
protected Viewer viewer;
/**
* Constructor for MakeContentProvider
*/
public MakeContentProvider() {
super();
}
/**
* @see ITreeContentProvider#getChildren(Object)
*/
public Object[] getChildren(Object obj) {
if (obj instanceof MakeTarget) {
MakeTarget md = (MakeTarget)obj;
return (Object[])md.getChildren();
}
return new Object[0];
}
/**
* @see ITreeContentProvider#getParent(Object)
*/
public Object getParent(Object obj) {
if (obj instanceof MakeTarget) {
MakeTarget directives = (MakeTarget)obj;
return directives.getParent();
}
return null;
}
/**
* @see ITreeContentProvider#hasChildren(Object)
*/
public boolean hasChildren(Object obj) {
return getChildren(obj).length > 0;
}
/**
* @see IStructuredContentProvider#getElements(Object)
*/
public Object[] getElements(Object obj) {
return getChildren(obj);
}
/**
* @see IContentProvider#dispose()
*/
public void dispose() {
if (viewer != null) {
Object obj = viewer.getInput();
if (obj instanceof MakeTarget) {
MakeTarget target = (MakeTarget)obj;
IWorkspace workspace = target.getResource().getWorkspace();
workspace.removeResourceChangeListener(this);
}
}
}
/**
* @see IContentProvider#inputChanged(Viewer, Object, Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
this.viewer = viewer;
if (oldInput != null) {
if (oldInput instanceof MakeTarget) {
IResource res = ((MakeTarget)oldInput).getResource();
if (res instanceof IWorkspaceRoot) {
IWorkspace workspace = res.getWorkspace();
workspace.removeResourceChangeListener(this);
}
}
}
if (newInput != null) {
if (newInput instanceof MakeTarget) {
IResource res = ((MakeTarget)newInput).getResource();
if (res instanceof IWorkspaceRoot) {
IWorkspace workspace = res.getWorkspace();
workspace.addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE);
}
}
}
}
public void resourceChanged (final IResourceChangeEvent event) {
final IResourceDelta deltas = event.getDelta();
Control ctrl = viewer.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
// Get the affected resource
ctrl.getDisplay().syncExec(new Runnable() {
public void run() {
processDelta (deltas);
}
});
}
}
void processDelta (IResourceDelta delta) {
// Bail out if the widget was disposed.
Control ctrl = viewer.getControl();
if (ctrl == null || ctrl.isDisposed()) {
return;
}
if (delta == null) {
return;
}
int changeFlags = delta.getFlags();
IResourceDelta[] affectedChildren =
delta.getAffectedChildren(IResourceDelta.CHANGED);
// Not interested in Content changes.
for (int i = 0; i < affectedChildren.length; i++) {
if ((affectedChildren[i].getFlags() & IResourceDelta.TYPE) != 0) {
return;
}
}
// handle open and closing.
if ((changeFlags & (IResourceDelta.OPEN | IResourceDelta.SYNC)) != 0) {
ctrl.setRedraw(false);
viewer.refresh();
ctrl.setRedraw(true);
return;
}
// Handle changed children recursively.
for (int i = 0; i < affectedChildren.length; i++) {
processDelta(affectedChildren[i]);
}
// We are only interested in creation and deletion of folders.
affectedChildren = delta.getAffectedChildren(IResourceDelta.REMOVED | IResourceDelta.ADDED);
if (affectedChildren.length > 0) {
for (int i = 0; i < affectedChildren.length; i++) {
IResource r = affectedChildren[i].getResource();
if (r instanceof IContainer) {
ctrl.setRedraw(false);
viewer.refresh();
ctrl.setRedraw(true);
break;
}
}
}
}
}

View file

@ -1,77 +0,0 @@
package org.eclipse.cdt.internal.ui.makeview;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import java.util.Hashtable;
import java.util.Map;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.graphics.Image;
public class MakeLabelProvider implements ILabelProvider {
/**
* The cache of images that have been dispensed by this provider.
* Maps ImageDescriptor->Image.
*/
private Map imageTable = null;
/**
* @see ILabelProvider#getImage(Object)
*/
public Image getImage(Object obj) {
Image image = null;
//obtain the cached image corresponding to the descriptor
if (imageTable == null) {
imageTable = new Hashtable(4);
}
if (obj instanceof MakeTarget) {
ImageDescriptor descriptor = ((MakeTarget)obj).getImageDescriptor();
image = (Image) imageTable.get(descriptor);
if (image == null) {
image = descriptor.createImage();
imageTable.put(descriptor, image);
}
}
return image;
}
/**
* @see ILabelProvider#getText(Object)
*/
public String getText(Object obj) {
if (obj instanceof MakeTarget) {
return ((MakeTarget)obj).toString();
}
return "";
}
/**
* @see IBaseLabelProvider#addListener(ILabelProviderListener)
*/
public void addListener(ILabelProviderListener arg0) {
}
/**
* @see IBaseLabelProvider#dispose()
*/
public void dispose() {
}
/**
* @see IBaseLabelProvider#isLabelProperty(Object, String)
*/
public boolean isLabelProperty(Object arg0, String arg1) {
return false;
}
/**
* @see IBaseLabelProvider#removeListener(ILabelProviderListener)
*/
public void removeListener(ILabelProviderListener arg0) {
}
}

View file

@ -1,141 +0,0 @@
package org.eclipse.cdt.internal.ui.makeview;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import java.util.ArrayList;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.core.resources.MakeUtil;
import org.eclipse.cdt.internal.ui.CPluginImages;
/**
* A leaf is a IResource with a Make Directive.
* We use the term Directive instead of Make Targets
* to not confuse with remote targets.
*/
public class MakeTarget implements IAdaptable {
private static final MakeTarget[] emptyArray= new MakeTarget[0];
private IResource resource;
private String target;
public MakeTarget(IResource res) {
this(res, "");
}
public MakeTarget(IResource res, String goals) {
resource = res;
target = (goals == null) ? "" : goals;
}
/**
* @see IAdaptable#getAdapter(Object)
*/
public Object getAdapter(Class adapter) {
if (adapter == IResource.class) {
return resource;
}
return null;
}
/**
*/
public MakeTarget[] getChildren() {
if (resource != null && target.length() == 0) {
ArrayList list = new ArrayList();
if (resource instanceof IWorkspaceRoot) {
IWorkspaceRoot root = (IWorkspaceRoot)resource;
IProject [] projects = root.getProjects();
for (int i = 0; i < projects.length; i++) {
if (projects[i].isOpen()) {
try {
if (projects[i].hasNature(CProjectNature.C_NATURE_ID)) {
list.add (new MakeTarget(projects[i]));
}
} catch (CoreException e) {
}
}
}
} else if (resource instanceof IContainer) {
IContainer container = (IContainer)resource;
try {
IResource[] resources = container.members();
for (int i = 0; i < resources.length; i++) {
if (resources[i] instanceof IContainer) {
list.add (new MakeTarget(resources[i]));
}
}
} catch (CoreException e) {
}
String [] targets = MakeUtil.getPersistentTargets(resource);
for (int i = 0; i < targets.length; i++) {
if (targets[i] == null)
targets[i] = "";
list.add (new MakeTarget(resource, targets[i]));
}
}
return (MakeTarget[])list.toArray(emptyArray);
}
return emptyArray;
}
/**
*/
public MakeTarget getParent() {
if (target.length() == 0)
return new MakeTarget(resource.getParent());
return new MakeTarget(resource);
}
public String toString() {
if (target.length() == 0)
return resource.getName();
return target;
}
public ImageDescriptor getImageDescriptor() {
if (isLeaf()) {
return CPluginImages.DESC_BUILD_MENU;
}
IWorkbenchAdapter adapter = (IWorkbenchAdapter)((IAdaptable)resource).getAdapter(IWorkbenchAdapter.class);
if (adapter == null)
return null;
return adapter.getImageDescriptor(resource);
}
public IResource getResource () {
return resource;
}
public boolean isLeaf () {
return (target.length() != 0);
}
/**
* @see Object#equals(Object)
*/
public boolean equals(Object obj) {
if (null == obj)
return false;
if (!(obj instanceof MakeTarget))
return false;
MakeTarget other = (MakeTarget)obj;
return (resource.equals(other.resource) && target.equals(other.target));
}
}

View file

@ -1,49 +0,0 @@
package org.eclipse.cdt.internal.ui.makeview;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.cdt.core.resources.MakeUtil;
import org.eclipse.cdt.internal.ui.CPluginImages;
public class MakeTargetAction extends Action {
Shell shell;
IResource resource;
public MakeTargetAction (Shell shell) {
super("Add Make Targets");
this.shell = shell;
setToolTipText("BuildAction");
setImageDescriptor(CPluginImages.DESC_BUILD_MENU);
}
public void run() {
InputDialog dialog = new InputDialog(shell, "Target Dialog: ", "Enter Target(s): ", null, null);
dialog.open();
String value = dialog.getValue();
if (value != null && value.length() > 0) {
if (resource != null)
MakeUtil.addPersistentTarget(resource, value);
}
}
public void selectionChanged(IStructuredSelection selection) {
Object obj = (IAdaptable)selection.getFirstElement();
if (obj instanceof IAdaptable) {
IAdaptable element = (IAdaptable)obj;
resource = (IResource)element.getAdapter(IResource.class);
}
}
}

View file

@ -1,172 +0,0 @@
package org.eclipse.cdt.internal.ui.makeview;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.cdt.core.resources.MakeUtil;
public class MakeView extends ViewPart {
TreeViewer viewer;
public MakeView() {
super();
}
/**
* @see IWorkbenchPart#setFocus()
*/
public void setFocus() {
viewer.getTree().setFocus();
}
/**
* Handles double clicks in viewer.
* Opens editor if file double-clicked.
*/
protected void handleDoubleClick(DoubleClickEvent event) {
IStructuredSelection s = (IStructuredSelection)event.getSelection();
Object element = s.getFirstElement();
//System.out.println ("Double click on " + element);
if (element instanceof MakeTarget) {
MakeTarget ta = (MakeTarget)element;
Action build = new MakeAction (new MakeTarget[] {ta}, getViewSite().getShell(), "Build");
build.run ();
}
//if (viewer.isExpandable(element)) {
// viewer.setExpandedState(element, !viewer.getExpandedState(element));
//}
}
/**
* called to create the context menu of the outline
*/
protected void contextMenuAboutToShow(IMenuManager menu) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
Object element = selection.getFirstElement ();
if (element instanceof MakeTarget) {
final MakeTarget ta = (MakeTarget)element;
Action add = new Action ("Add...") {
public void run() {
InputDialog dialog = new InputDialog(getViewSite().getShell(),
"Target Dialog: ", "Enter Target(s): ", null, null);
dialog.open ();
String value = dialog.getValue ();
if (value != null && value.length() > 0) {
IResource res = ta.getResource ();
MakeUtil.addPersistentTarget (res, value);
viewer.getControl().setRedraw(false);
viewer.refresh ();
viewer.getControl().setRedraw(true);
viewer.expandToLevel(ta, 2);
}
}
};
Action edit = new Action ("Edit...") {
public void run() {
String oldtarget = ta.toString();
InputDialog dialog = new InputDialog(getViewSite().getShell(),
"Target Dialog: ", "Enter Target(s): ", oldtarget, null);
dialog.open ();
String value = dialog.getValue ();
if (value != null && value.length() > 0 && !value.equals(oldtarget)) {
IResource res = ta.getResource();
MakeUtil.replacePersistentTarget(res, oldtarget, value);
viewer.getControl().setRedraw(false);
viewer.refresh ();
viewer.getControl().setRedraw(true);
viewer.expandToLevel(ta, 2);
}
}
};
Action del = new Action ("Delete") {
public void run() {
String target = ta.toString();
if (target != null) {
IResource res = ta.getResource();
MakeUtil.removePersistentTarget(res, target);
viewer.getControl().setRedraw(false);
viewer.refresh ();
viewer.getControl().setRedraw(true);
}
}
};
Action build = new MakeAction(new MakeTarget[]{ta}, getViewSite().getShell(), "Build");
Action refresh = new Action("Refresh") {
public void run() {
viewer.refresh ();
}
};
menu.add (add);
menu.add (edit);
menu.add (del);
//menu.add (new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add (build);
menu.add (refresh);
if (ta.isLeaf()) {
add.setEnabled(false);
} else {
edit.setEnabled(false);
del.setEnabled(false);
}
}
//menu.add (new Separator(IWorkbenchActionConstants.MB_ADDITIONS+"-end"));
}
/**
* @see ContentOutlinePage#createControl
*/
public void createPartControl (Composite parent) {
viewer= new TreeViewer (parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
viewer.setUseHashlookup (true);
viewer.setContentProvider(new MakeContentProvider());
viewer.setLabelProvider (new MakeLabelProvider());
MenuManager manager= new MenuManager("#PopUp");
manager.setRemoveAllWhenShown(true);
manager.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
contextMenuAboutToShow(manager);
}
});
Control control = viewer.getControl();
Menu menu = manager.createContextMenu(control);
control.setMenu (menu);
viewer.setInput (new MakeTarget(ResourcesPlugin.getWorkspace().getRoot()));
viewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
handleDoubleClick(event);
}
});
getSite().setSelectionProvider(viewer);
}
}

View file

@ -7,157 +7,68 @@ package org.eclipse.cdt.internal.ui.preferences;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
import org.eclipse.cdt.internal.ui.dialogs.StatusTool;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.wizards.BinaryParserBlock;
import org.eclipse.cdt.ui.wizards.BuildPathInfoBlock;
import org.eclipse.cdt.ui.wizards.IndexerBlock;
import org.eclipse.cdt.ui.wizards.SettingsBlock;
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
import org.eclipse.cdt.utils.ui.swt.IValidation;
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
import org.eclipse.ui.dialogs.PropertyPage;
import org.eclipse.ui.help.WorkbenchHelp;
public class CProjectPropertyPage extends PropertyPage implements IStatusChangeListener, IValidation {
private static final String MSG_NOCPROJECT= "CProjectPropertyPage.nocproject";
private static final String MSG_CLOSEDPROJECT= "CProjectPropertyPage.closedproject";
private TabFolder folder;
SettingsBlock settingsBlock;
IndexerBlock indexerBlock;
BinaryParserBlock binaryParserBlock;
private BuildPathInfoBlock pathInfoBlock;
public class CProjectPropertyPage extends PropertyPage implements ICOptionContainer {
private CProjectOptionBlock fOptionBlock;
private static final String MSG_CLOSEDPROJECT = "CProjectPropertyPage.closedproject";
public CProjectPropertyPage() {
super();
fOptionBlock = new CProjectOptionBlock(this);
}
protected Control createContents(Composite parent) {
Composite composite= new Composite(parent, SWT.NONE);
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new FillLayout());
IProject project= getProject();
IProject project = getProject();
if (!project.isOpen()) {
contentForClosedProject(composite);
contentForClosedProject(composite);
} else {
contentForCProject(composite);
}
return composite;
}
private void contentForCProject(Composite parent) {
folder = new TabFolder(parent, SWT.NONE);
folder.setLayout(new TabFolderLayout());
settingsBlock = new SettingsBlock(this, getProject());
TabItem item2 = new TabItem(folder, SWT.NONE);
item2.setText(settingsBlock.getLabel());
Image img2 = settingsBlock.getImage();
if (img2 != null)
item2.setImage(img2);
item2.setData(settingsBlock);
item2.setControl(settingsBlock.getControl(folder));
indexerBlock = new IndexerBlock(this, getProject());
TabItem item3 = new TabItem(folder, SWT.NONE);
item3.setText(indexerBlock.getLabel());
Image img3 = indexerBlock.getImage();
if (img3 != null)
item3.setImage(img3);
item3.setData(indexerBlock);
item3.setControl(indexerBlock.getControl(folder));
binaryParserBlock = new BinaryParserBlock(this, getProject());
TabItem item4 = new TabItem(folder, SWT.NONE);
item4.setText(binaryParserBlock.getLabel());
Image img4 = binaryParserBlock.getImage();
if (img4 != null)
item4.setImage(img4);
item4.setData(binaryParserBlock);
item4.setControl(binaryParserBlock.getControl(folder));
pathInfoBlock = new BuildPathInfoBlock(this, getProject());
TabItem pathItem = new TabItem(folder, SWT.NONE);
pathItem.setText(pathInfoBlock.getLabel());
Image pathImg = pathInfoBlock.getImage();
if (pathImg != null) {
pathItem.setImage(pathImg);
}
pathItem.setData(pathInfoBlock);
pathItem.setControl(pathInfoBlock.getControl(folder));
WorkbenchHelp.setHelp(parent, ICHelpContextIds.PROJECT_PROPERTY_PAGE);
fOptionBlock.createContents(parent);
// WorkbenchHelp.setHelp(parent, ICMakeHelpContextIds.PROJECT_PROPERTY_PAGE);
}
private void contentForClosedProject(Composite parent) {
Label label= new Label(parent, SWT.LEFT);
Label label = new Label(parent, SWT.LEFT);
label.setText(CUIPlugin.getResourceString(MSG_CLOSEDPROJECT));
label.setFont(parent.getFont());
noDefaultAndApplyButton();
}
public void setComplete(boolean complete) {
boolean ok = true;
if (ok && settingsBlock != null) {
ok = settingsBlock.isValid();
}
if (ok && indexerBlock != null) {
ok = indexerBlock.isValid();
}
if (ok && binaryParserBlock != null) {
ok = binaryParserBlock.isValid();
}
if (ok && pathInfoBlock != null) {
ok = pathInfoBlock.isValid();
}
setValid(ok);
}
/**
* @see PreferencePage#performOk
*/
* @see PreferencePage#performOk
*/
public boolean performOk() {
Shell shell= getControl().getShell();
IRunnableWithProgress runnable= new IRunnableWithProgress() {
Shell shell = getControl().getShell();
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Property changes", 20);
if (settingsBlock != null) {
settingsBlock.doRun(getProject(), monitor);
}
monitor.worked(2);
if (indexerBlock != null) {
indexerBlock.doRun(getProject(), monitor);
}
monitor.worked(10);
if (binaryParserBlock != null) {
binaryParserBlock.doRun(getProject(), monitor);
}
monitor.worked(15);
if (pathInfoBlock != null) {
pathInfoBlock.doRun(getProject(), monitor);
}
monitor.worked(19);
monitor.done();
fOptionBlock.performApply(monitor);
}
};
IRunnableWithProgress op= new WorkspaceModifyDelegatingOperation(runnable);
IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(runnable);
try {
new ProgressMonitorDialog(shell).run(false, true, op);
} catch (InvocationTargetException e) {
@ -168,35 +79,42 @@ public class CProjectPropertyPage extends PropertyPage implements IStatusChangeL
}
return true;
}
IProject getProject() {
Object element= getElement();
public IProject getProject() {
Object element = getElement();
if (element instanceof IProject) {
return (IProject)element;
return (IProject) element;
}
return null;
}
/**
* @see DialogPage#setVisible(boolean)
*/
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible && folder != null) {
settingsBlock.setVisible(visible);
indexerBlock.setVisible(visible);
binaryParserBlock.setVisible(visible);
pathInfoBlock.setVisible(visible);
folder.setFocus();
fOptionBlock.setVisible(visible);
}
public void updateContainer() {
boolean ok = true;
ok = fOptionBlock.isValid();
if (!ok) {
setErrorMessage(fOptionBlock.getErrorMessage());
}
}
/**
* @see IStatusChangeListener#statusChanged(IStatus)
*/
public void statusChanged(IStatus status) {
setValid(!status.matches(IStatus.ERROR));
StatusTool.applyToStatusLine(this, status);
}
if (ok) {
setErrorMessage(null);
}
setValid(ok);
}
protected void performDefaults() {
fOptionBlock.performDefaults();
super.performDefaults();
}
public boolean isValid() {
updateContainer();
return super.isValid();
}
}

View file

@ -1,629 +0,0 @@
package org.eclipse.cdt.ui.wizards;
import org.eclipse.cdt.core.build.standard.StandardBuildManager;
import org.eclipse.cdt.core.resources.IStandardBuildInfo;
import org.eclipse.cdt.internal.ui.util.SWTUtil;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.cdt.utils.ui.swt.IValidation;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
/**
* @deprecated
*/
public class BuildPathInfoBlock implements IWizardTab {
private static final String PREFIX = "BuildPathInfoBlock"; //$NON-NLS-1$
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
private static final String PATHS = PREFIX + ".paths"; //$NON-NLS-1$
private static final String SYMBOLS = PREFIX + ".symbols"; //$NON-NLS-1$
private static final String BROWSE = PREFIX + ".browse"; //$NON-NLS-1$
private static final String PATH_TITLE = BROWSE + ".path"; //$NON-NLS-1$
private static final String PATH_LABEL = BROWSE + ".path.label"; //$NON-NLS-1$
private static final String SYMBOL_TITLE = BROWSE + ".symbol"; //$NON-NLS-1$
private static final String SYMBOL_LABEL = BROWSE + ".symbol.label"; //$NON-NLS-1$
private static final String NEW = "BuildPropertyCommon.label.new"; //$NON-NLS-1$
private static final String REMOVE = "BuildPropertyCommon.label.remove"; //$NON-NLS-1$
private static final String UP = "BuildPropertyCommon.label.up"; //$NON-NLS-1$
private static final String DOWN = "BuildPropertyCommon.label.down"; //$NON-NLS-1$
private IProject project;
private IValidation page;
private List pathList;
private List symbolList;
private Composite pathButtonComp;
private Button addPath;
private Button removePath;
private Button pathUp;
private Button pathDown;
private Composite symbolButtonComp;
private Button addSymbol;
private Button removeSymbol;
private Button symbolUp;
private Button symbolDown;
private Shell shell;
/**
* @param valid
*/
public BuildPathInfoBlock(IValidation valid) {
this(valid, null);
}
/**
* @param page
* @param project
*/
public BuildPathInfoBlock(IValidation valid, IProject project) {
this.page = valid;
this.project = project;
}
/**
* @param composite
*/
private void createPathListButtons(Composite parent) {
// Create a composite for the buttons
pathButtonComp = ControlFactory.createComposite(parent, 1);
GridData gd = new GridData(GridData.FILL_BOTH);
pathButtonComp.setFont(parent.getFont());
// Add the buttons
addPath = ControlFactory.createPushButton(pathButtonComp, CUIPlugin.getResourceString(NEW));
addPath.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleAddPath();
}
});
addPath.setEnabled(true);
addPath.setFont(parent.getFont());
addPath.setLayoutData(new GridData());
SWTUtil.setButtonDimensionHint(addPath);
removePath = ControlFactory.createPushButton(pathButtonComp, CUIPlugin.getResourceString(REMOVE));
removePath.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleRemovePath();
}
});
removePath.setFont(parent.getFont());
removePath.setLayoutData(new GridData());
SWTUtil.setButtonDimensionHint(removePath);
pathUp = ControlFactory.createPushButton(pathButtonComp, CUIPlugin.getResourceString(UP));
pathUp.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handlePathUp();
}
});
pathUp.setFont(parent.getFont());
pathUp.setLayoutData(new GridData());
SWTUtil.setButtonDimensionHint(pathUp);
pathDown = ControlFactory.createPushButton(pathButtonComp, CUIPlugin.getResourceString(DOWN));
pathDown.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handlePathDown();
}
});
pathDown.setFont(parent.getFont());
pathDown.setLayoutData(new GridData());
SWTUtil.setButtonDimensionHint(pathDown);
}
/**
* @param composite
*/
private void createPathListControl(Composite parent, int numColumns) {
// Create the list
pathList = new List(parent, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
pathList.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
enablePathButtons();
}
});
pathList.addMouseListener(new MouseListener() {
public void mouseDoubleClick(MouseEvent e) {
editPathListItem();
}
public void mouseDown(MouseEvent e) {
// Handled by the selection listener
}
public void mouseUp(MouseEvent e) {
// Handled by the selection listener
}
});
// Make it occupy the first 2 columns
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = numColumns - 1;
pathList.setLayoutData(gd);
pathList.setFont(parent.getFont());
}
/**
* @param composite
*/
private void createSymbolListButtons(Composite parent) {
// Create a composite for the buttons
symbolButtonComp = ControlFactory.createComposite(parent, 1);
GridData gd = new GridData(GridData.FILL_BOTH);
symbolButtonComp.setFont(parent.getFont());
// Add the buttons
addSymbol = ControlFactory.createPushButton(symbolButtonComp, CUIPlugin.getResourceString(NEW));
addSymbol.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleAddSymbol();
}
});
addSymbol.setEnabled(true);
addSymbol.setFont(parent.getFont());
addSymbol.setLayoutData(new GridData());
SWTUtil.setButtonDimensionHint(addSymbol);
removeSymbol = ControlFactory.createPushButton(symbolButtonComp, CUIPlugin.getResourceString(REMOVE));
removeSymbol.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleRemoveSymbol();
}
});
removeSymbol.setFont(parent.getFont());
removeSymbol.setLayoutData(new GridData());
SWTUtil.setButtonDimensionHint(removeSymbol);
symbolUp = ControlFactory.createPushButton(symbolButtonComp, CUIPlugin.getResourceString(UP));
symbolUp.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleSymbolUp();
}
});
symbolUp.setFont(parent.getFont());
symbolUp.setLayoutData(new GridData());
SWTUtil.setButtonDimensionHint(symbolUp);
symbolDown = ControlFactory.createPushButton(symbolButtonComp, CUIPlugin.getResourceString(DOWN));
symbolDown.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleSymbolDown();
}
});
symbolDown.setFont(parent.getFont());
symbolDown.setLayoutData(new GridData());
SWTUtil.setButtonDimensionHint(symbolDown);
}
/**
* @param composite
*/
private void createSymbolListControl(Composite parent, int numColumns) {
// Create the list
symbolList = new List(parent, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
symbolList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
enableSymbolButtons();
}
});
symbolList.addMouseListener(new MouseListener() {
public void mouseDoubleClick(MouseEvent e) {
editSymbolListItem();
}
public void mouseDown(MouseEvent e) {
// Handled by the selection event
}
public void mouseUp(MouseEvent e) {
// Handled by the selection event
}
});
// Make it occupy the first n-1 columns
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = numColumns - 1;
symbolList.setLayoutData(gd);
symbolList.setFont(parent.getFont());
}
/* (non-Javadoc)
* @see org.eclipse.cdt.ui.wizards.IWizardTab#doRun(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IProgressMonitor)
*/
public void doRun(IProject project, IProgressMonitor monitor) {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
if (project != null) {
try {
// Store the paths and symbols
monitor.beginTask("Setting Include Paths", 1);
StandardBuildManager.setIncludePaths(project, getPathListContents());
monitor.beginTask("Setting Defined Symbols", 1);
StandardBuildManager.setPreprocessorSymbols(project, getSymbolListContents());
StandardBuildManager.saveBuildInfo(project);
} catch (CoreException e) {
// Should probably tell someone
}
}
}
/*
* Double-click handler to allow edit of path information
*/
protected void editPathListItem() {
// Edit the selection index
int index = pathList.getSelectionIndex();
if (index != -1) {
String selItem = pathList.getItem(index);
if (selItem != null) {
InputDialog dialog = new InputDialog(shell, CUIPlugin.getResourceString(PATH_TITLE), CUIPlugin.getResourceString(PATH_LABEL), selItem, null);
String newItem = null;
if (dialog.open() == InputDialog.OK) {
newItem = dialog.getValue();
if (newItem != null && !newItem.equals(selItem)) {
pathList.setItem(index, newItem);
}
}
}
}
}
/*
* Double-click handler to allow edit of symbol information
*/
protected void editSymbolListItem() {
// Edit the selection index
int index = symbolList.getSelectionIndex();
if (index != -1) {
String selItem = symbolList.getItem(index);
if (selItem != null) {
InputDialog dialog = new InputDialog(shell, CUIPlugin.getResourceString(SYMBOL_TITLE), CUIPlugin.getResourceString(SYMBOL_LABEL), selItem, null);
String newItem = null;
if (dialog.open() == InputDialog.OK) {
newItem = dialog.getValue();
if (newItem != null && !newItem.equals(selItem)) {
symbolList.setItem(index, newItem);
}
}
}
}
}
/*
* Enables the buttons on the path control if the right conditions are met
*/
private void enablePathButtons() {
// Enable the remove button if there is at least 1 item in the list
int items = pathList.getItemCount();
if (items > 0){
removePath.setEnabled(true);
// Enable the up/down buttons depending on what item is selected
int index = pathList.getSelectionIndex();
pathUp.setEnabled(items > 1 && index > 0);
pathDown.setEnabled(items > 1 && index < (items - 1));
} else {
removePath.setEnabled(false);
pathUp.setEnabled(false);
pathDown.setEnabled(false);
}
}
private void enableSymbolButtons() {
// Enable the remove button if there is at least 1 item in the list
int items = symbolList.getItemCount();
if (items > 0){
removeSymbol.setEnabled(true);
// Enable the up/down buttons depending on what item is selected
int index = symbolList.getSelectionIndex();
symbolUp.setEnabled(items > 1 && index > 0);
symbolDown.setEnabled(items > 1 && index < (items - 1));
} else {
removeSymbol.setEnabled(false);
symbolUp.setEnabled(false);
symbolDown.setEnabled(false);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.ui.wizards.IWizardTab#getControl(org.eclipse.swt.widgets.Composite)
*/
public Composite getControl(Composite parent) {
this.shell = parent.getShell();
// Create the composite control for the tab
int tabColumns = 3;
Font font = parent.getFont();
Composite composite = ControlFactory.createComposite(parent, tabColumns);
composite.setFont(font);
GridData gd;
// Create a label for the include paths control
Label paths = ControlFactory.createLabel(composite, CUIPlugin.getResourceString(PATHS));
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = tabColumns;
paths.setLayoutData(gd);
paths.setFont(font);
//Create the list and button controls
createPathListControl(composite, tabColumns);
createPathListButtons(composite);
enablePathButtons();
// Create a label for the symbols control
Label symbols = ControlFactory.createLabel(composite, CUIPlugin.getResourceString(SYMBOLS));
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = tabColumns;
symbols.setLayoutData(gd);
symbols.setFont(font);
// Create list and button controls for symbols
createSymbolListControl(composite, tabColumns);
createSymbolListButtons(composite);
enableSymbolButtons();
return composite;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.ui.wizards.IWizardTab#getImage()
*/
public Image getImage() {
// We don't decorate the tabs for the wizard or property page
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.ui.wizards.IWizardTab#getLabel()
*/
public String getLabel() {
// Return the label defined in the CPluginProperties.resource file
return CUIPlugin.getResourceString(LABEL);
}
/**
* @return
*/
private String[] getPathListContents() {
return pathList.getItems();
}
/**
* @return
*/
private String[] getSymbolListContents() {
return symbolList.getItems();
}
/**
*
*/
protected void handleAddPath() {
// Popup an entry dialog
InputDialog dialog = new InputDialog(shell, CUIPlugin.getResourceString(PATH_TITLE), CUIPlugin.getResourceString(PATH_LABEL), "", null);
String path = null;
if (dialog.open() == InputDialog.OK) {
path = dialog.getValue();
}
if (path != null && path.length() > 0) {
pathList.add(path);
pathList.select(pathList.getItemCount() - 1);
enablePathButtons();
}
}
/**
*
*/
protected void handleAddSymbol() {
// Popup an entry dialog
InputDialog dialog = new InputDialog(shell, CUIPlugin.getResourceString(SYMBOL_TITLE), CUIPlugin.getResourceString(SYMBOL_LABEL), "", null);
String symbol = null;
if (dialog.open() == InputDialog.OK) {
symbol = dialog.getValue();
}
if (symbol != null && symbol.length() > 0) {
symbolList.add(symbol);
symbolList.select(symbolList.getItemCount() - 1);
enableSymbolButtons();
}
}
/**
*
*/
protected void handlePathDown() {
// Get the selection index
int index = pathList.getSelectionIndex();
int items = pathList.getItemCount();
if (index == -1 || index == items - 1) {
return;
}
// Swap the items in the list
String selItem = pathList.getItem(index);
pathList.remove(index);
if (index + 1 == items) {
pathList.add(selItem);
} else {
pathList.add(selItem, ++index);
}
// Keep the swapped item selected
pathList.select(index);
enablePathButtons();
}
/**
*
*/
protected void handlePathUp() {
// Get the selection index
int index = pathList.getSelectionIndex();
if (index == -1 || index == 0) {
return;
}
// Swap the items in the list
String selItem = pathList.getItem(index);
pathList.remove(index);
pathList.add(selItem, --index);
// Keep the index selected
pathList.select(index);
enablePathButtons();
}
/**
*
*/
protected void handleRemovePath() {
// Get the selection index
int index = pathList.getSelectionIndex();
if (index == -1) {
return;
}
// Remove the element at that index
pathList.remove(index);
index = index - 1 < 0 ? 0 : index -1;
pathList.select(index);
// Check if the buttons should still be enabled
enablePathButtons();
}
/**
*
*/
protected void handleRemoveSymbol() {
// Get the selection index
int index = symbolList.getSelectionIndex();
if (index == -1) {
return;
}
// Remove the item at that index
symbolList.remove(index);
index = index - 1 < 0 ? 0 : index -1;
symbolList.select(index);
// Check if the button state should be toggled
enableSymbolButtons();
}
/**
*
*/
protected void handleSymbolDown() {
// Get the selection index
int index = symbolList.getSelectionIndex();
int items = symbolList.getItemCount();
if (index == -1 || index == items - 1) {
return;
}
// Swap the items in the list
String selItem = symbolList.getItem(index);
symbolList.remove(index);
if (index + 1 == items) {
symbolList.add(selItem);
} else {
symbolList.add(selItem, ++index);
}
// Keep the swapped item selected
symbolList.select(index);
enableSymbolButtons();
}
/**
*
*/
protected void handleSymbolUp() {
// Get the selection index
int index = symbolList.getSelectionIndex();
if (index == -1 || index == 0) {
return;
}
// Swap the items in the list
String selItem = symbolList.getItem(index);
symbolList.remove(index);
symbolList.add(selItem, --index);
// Keep the index selected
symbolList.select(index);
enableSymbolButtons();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.ui.wizards.IWizardTab#isValid()
*/
public boolean isValid() {
// Info on this page is not critical
return true;
}
private void setPathListContents() {
if (project != null) {
try {
IStandardBuildInfo info = StandardBuildManager.getBuildInfo(project);
pathList.setItems(info.getIncludePaths());
} catch (CoreException e) {
}
}
}
private void setSymbolListContents() {
if (project != null) {
try {
IStandardBuildInfo info = StandardBuildManager.getBuildInfo(project);
symbolList.setItems(info.getPreprocessorSymbols());
} catch (CoreException e) {
}
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.ui.wizards.IWizardTab#setVisible(boolean)
*/
public void setVisible(boolean visible) {
// Set the content from the project
setPathListContents();
pathList.select(0);
enablePathButtons();
setSymbolListContents();
symbolList.select(0);
enableSymbolButtons();
}
}

View file

@ -1,252 +0,0 @@
package org.eclipse.cdt.ui.wizards;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.utils.ui.swt.IValidation;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.cdt.utils.ui.controls.RadioButtonsArea;
public class SettingsBlock implements IWizardTab {
private static final String PREFIX = "SettingsBlock"; //$NON-NLS-1$
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
private static final String KEEP_GOING = PREFIX + ".keepOnGoing"; //$NON-NLS-1$
private static final String STOP_ERROR = PREFIX + ".stopOnError"; //$NON-NLS-1$
private static final String MAKE_OPTION = PREFIX + ".makeOption.label";
//$NON-NLS-1$
private static final String MAKE_USE_DEFAULT =
PREFIX + ".makeOption.use_default";
//$NON-NLS-1$
private static final String MAKE_BUILD_CMD = PREFIX + ".makeOption.build_cmd";
//$NON-NLS-1$
private static final String KEEP_ARG = "keep"; //$NON-NLS-1$
private static final String STOP_ARG = "stop"; //$NON-NLS-1$
protected RadioButtonsArea radioButtons;
protected Button defButton;
protected Text cmdText;
private boolean stopOnError;
private boolean useDefaultBuildCmd;
private boolean defaultSelectionMade = false;
private String buildCmd;
IValidation page;
public SettingsBlock(IValidation valid) {
this(valid, null);
}
public SettingsBlock(IValidation valid, IProject project) {
if (project != null) {
try {
CProjectNature nature =
(CProjectNature) project.getNature(CProjectNature.C_NATURE_ID);
if (nature != null) {
stopOnError = nature.isStopOnError();
useDefaultBuildCmd = nature.isDefaultBuildCmd();
if (!useDefaultBuildCmd) {
buildCmd = nature.getBuildCommand().toOSString();
if (buildCmd.indexOf(' ') > 0) {
buildCmd = "\"" + buildCmd + "\"";
}
buildCmd += " " + nature.getFullBuildArguments();
}
}
} catch (CoreException e) {
}
} else {
// FIXME: Should use the default settings
stopOnError = false;
useDefaultBuildCmd = true;
}
page = valid;
}
public String getLabel() {
return CUIPlugin.getResourceString(LABEL);
}
public Image getImage() {
return null;
}
public Composite getControl(Composite parent) {
Composite composite = ControlFactory.createComposite(parent, 1);
String[][] radios =
new String[][] { { CUIPlugin.getResourceString(STOP_ERROR), STOP_ARG }, {
CUIPlugin.getResourceString(KEEP_GOING), KEEP_ARG }
};
radioButtons =
new RadioButtonsArea(composite, CUIPlugin.getResourceString(LABEL), 1, radios);
Group mgroup =
ControlFactory.createGroup(
composite,
CUIPlugin.getResourceString(MAKE_OPTION),
1);
defButton =
ControlFactory.createCheckBox(
mgroup,
CUIPlugin.getResourceString(MAKE_USE_DEFAULT));
defButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (defButton.getSelection() == true) {
cmdText.setEnabled(false);
radioButtons.setEnabled(true);
if (null != page)
page.setComplete(isValid());
}
else {
cmdText.setEnabled(true);
radioButtons.setEnabled(false);
if (null != page)
page.setComplete(isValid());
}
}
});
Composite cmdComp = new Composite(mgroup, SWT.NULL);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.makeColumnsEqualWidth = false;
layout.marginWidth = 0;
layout.horizontalSpacing = 0;
cmdComp.setLayout(layout);
cmdComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label label =
ControlFactory.createLabel(cmdComp, CUIPlugin.getResourceString(MAKE_BUILD_CMD));
((GridData) (label.getLayoutData())).horizontalAlignment = GridData.BEGINNING;
((GridData) (label.getLayoutData())).grabExcessHorizontalSpace = false;
cmdText = ControlFactory.createTextField(cmdComp, SWT.SINGLE | SWT.BORDER);
((GridData) (cmdText.getLayoutData())).horizontalAlignment = GridData.FILL;
((GridData) (cmdText.getLayoutData())).grabExcessHorizontalSpace = true;
cmdText.addListener(SWT.Modify, new Listener() {
public void handleEvent(Event e) {
page.setComplete(isValid());
}
});
if ( buildCmd != null )
cmdText.setText(buildCmd);
if (useDefaultBuildCmd) {
cmdText.setEnabled(false);
} else {
radioButtons.setEnabled(false);
}
return composite;
}
public boolean isValid() {
if (defButton.getSelection() != true) {
String cmd = getBuildLine();
if (cmd == null || cmd.length() == 0) {
return false;
}
}
return true;
}
public void setVisible(boolean visible) {
if ( !defaultSelectionMade ) {
if (stopOnError)
radioButtons.setSelectValue(STOP_ARG);
else
radioButtons.setSelectValue(KEEP_ARG);
defButton.setSelection(useDefaultBuildCmd);
defaultSelectionMade = true;
}
}
public void doRun(IProject project, IProgressMonitor monitor) {
try {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
monitor.beginTask("Settings", 1);
CProjectNature nature =
(CProjectNature) project.getNature(CProjectNature.C_NATURE_ID);
if (nature != null) {
nature.setStopOnError(isStopOnError());
nature.setBuildCommandOverride(useDefaultBuildCmd());
if (!useDefaultBuildCmd()) {
String bldLine = getBuildLine();
int start = 0;
int end = -1;
if (!bldLine.startsWith("\"")) {
end = bldLine.indexOf(' ');
} else {
start = 1;
end = bldLine.indexOf('"', 1);
}
IPath path;
if (end == -1) {
path = new Path(bldLine);
} else {
path = new Path(bldLine.substring(start, end));
}
nature.setBuildCommand(path, new SubProgressMonitor(monitor, 50));
String args = "";
if (end != -1) {
args = bldLine.substring(end + 1);
}
nature.setFullBuildArguments(args, new SubProgressMonitor(monitor, 50));
}
}
}
catch (CoreException e) {
}
}
private boolean isStopOnError() {
if ( defaultSelectionMade ) {
if (radioButtons != null)
return radioButtons.getSelectedValue().equals(STOP_ARG);
}
return stopOnError;
}
private boolean useDefaultBuildCmd() {
if ( defaultSelectionMade ) {
if (defButton != null)
return defButton.getSelection();
}
return useDefaultBuildCmd;
}
private String getBuildLine() {
if (cmdText != null) {
String cmd = cmdText.getText();
if (cmd != null)
return cmd.trim();
}
return null;
}
}

View file

@ -1,49 +0,0 @@
package org.eclipse.cdt.ui.wizards;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.swt.widgets.TabFolder;
/**
*/
public class StdCCWizard extends StdMakeProjectWizard {
private static final String WZ_TITLE = "StdCCWizard.title";
private static final String WZ_DESC = "StdCCWizard.description";
private static final String SETTINGS_TITLE= "StdCCWizardSettings.title"; //$NON-NLS-1$
private static final String SETTINGS_DESC= "StdCCWizardSettings.description"; //$NON-NLS-1$
public StdCCWizard() {
this(CUIPlugin.getResourceString(WZ_TITLE), CUIPlugin.getResourceString(WZ_DESC));
}
public StdCCWizard(String title, String desc) {
super(title, desc);
}
public void addTabItems(TabFolder folder) {
super.addTabItems(folder);
fTabFolderPage.setTitle(CUIPlugin.getResourceString(SETTINGS_TITLE));
fTabFolderPage.setDescription(CUIPlugin.getResourceString(SETTINGS_DESC));
}
protected void doRun(IProgressMonitor monitor) throws CoreException {
super.doRun(monitor);
// Add C++ Nature.
if (newProject != null) {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
monitor.beginTask("Standard C++ Make", 1);
// Add C++ Nature to the newly created project.
CCorePlugin.getDefault().convertProjectFromCtoCC(newProject, monitor);
}
}
}

View file

@ -1,33 +0,0 @@
package org.eclipse.cdt.ui.wizards;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.swt.widgets.TabFolder;
/**
*/
public class StdCWizard extends StdMakeProjectWizard {
private static final String WZ_TITLE = "StdCWizard.title";
private static final String WZ_DESC = "StdCWizard.description";
private static final String SETTINGS_TITLE= "StdCWizardSettings.title"; //$NON-NLS-1$
private static final String SETTINGS_DESC= "StdCWizardSettings.description"; //$NON-NLS-1$
public StdCWizard() {
this(CUIPlugin.getResourceString(WZ_TITLE), CUIPlugin.getResourceString(WZ_DESC));
}
public StdCWizard(String title, String desc) {
super(title, desc);
}
public void addTabItems(TabFolder folder) {
super.addTabItems(folder);
fTabFolderPage.setTitle(CUIPlugin.getResourceString(SETTINGS_TITLE));
fTabFolderPage.setDescription(CUIPlugin.getResourceString(SETTINGS_DESC));
}
}

View file

@ -1,128 +0,0 @@
package org.eclipse.cdt.ui.wizards;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
/**
*/
public abstract class StdMakeProjectWizard extends CProjectWizard {
private static final String OP_ERROR= "StdMakeProjectWizard.op_error";
private static final String WZ_TITLE= "StdMakeProjectWizard.title";
private static final String WZ_DESC= "StdMakeProjectWizard.description";
private static final String SETTINGS_TITLE= "StdMakeWizardSettings.title"; //$NON-NLS-1$
private static final String SETTINGS_DESC= "StdMakeWizardSettings.description"; //$NON-NLS-1$
private ReferenceBlock referenceBlock;
private SettingsBlock settingsBlock;
private BinaryParserBlock binaryParserBlock;
private BuildPathInfoBlock pathInfoBlock;
public StdMakeProjectWizard() {
this(CUIPlugin.getResourceString(WZ_TITLE), CUIPlugin.getResourceString(WZ_DESC));
}
public StdMakeProjectWizard(String title, String desc) {
super(title, desc);
}
public void addTabItems(TabFolder folder) {
fTabFolderPage.setTitle(CUIPlugin.getResourceString(SETTINGS_TITLE));
fTabFolderPage.setDescription(CUIPlugin.getResourceString(SETTINGS_DESC));
referenceBlock = new ReferenceBlock(getValidation());
TabItem item = new TabItem(folder, SWT.NONE);
item.setText(referenceBlock.getLabel());
Image img = referenceBlock.getImage();
if (img != null)
item.setImage(img);
item.setData(referenceBlock);
item.setControl(referenceBlock.getControl(folder));
addTabItem(referenceBlock);
settingsBlock = new SettingsBlock(getValidation());
TabItem item2 = new TabItem(folder, SWT.NONE);
item2.setText(settingsBlock.getLabel());
Image img2 = settingsBlock.getImage();
if (img2 != null)
item2.setImage(img2);
item2.setData(settingsBlock);
item2.setControl(settingsBlock.getControl(folder));
addTabItem(settingsBlock);
binaryParserBlock = new BinaryParserBlock(getValidation());
TabItem item3 = new TabItem(folder, SWT.NONE);
item3.setText(binaryParserBlock.getLabel());
Image img3 = binaryParserBlock.getImage();
if (img3 != null)
item3.setImage(img3);
item3.setData(binaryParserBlock);
item3.setControl(binaryParserBlock.getControl(folder));
addTabItem(binaryParserBlock);
pathInfoBlock = new BuildPathInfoBlock(getValidation());
TabItem pathItem = new TabItem(folder, SWT.NONE);
pathItem.setText(pathInfoBlock.getLabel());
Image pathImg = pathInfoBlock.getImage();
if (pathImg != null) {
pathItem.setImage(pathImg);
}
pathItem.setData(pathInfoBlock);
pathItem.setControl(pathInfoBlock.getControl(folder));
addTabItem(pathInfoBlock);
}
protected void doRunPrologue(IProgressMonitor monitor) {
}
protected void doRunEpilogue(IProgressMonitor monitor) {
}
protected void doRun(IProgressMonitor monitor) throws CoreException {
// super.doRun() just creates the project and does not assign a builder to it.
super.doRun(monitor);
// Modify the project based on what the user has selected
if (newProject != null) {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
monitor.beginTask("Standard Make", 4);
// Update the referenced project if provided.
if (referenceBlock != null) {
referenceBlock.doRun(newProject, new SubProgressMonitor(monitor, 1));
}
// Update the settings.
if (settingsBlock != null) {
settingsBlock.doRun(newProject, new SubProgressMonitor(monitor, 1));
}
// Update the binary parser
if (binaryParserBlock != null) {
binaryParserBlock.doRun(newProject, new SubProgressMonitor(monitor, 1));
}
// Update the binary parser
if (pathInfoBlock != null) {
pathInfoBlock.doRun(newProject, new SubProgressMonitor(monitor, 1));
}
}
}
public String getProjectID() {
return CCorePlugin.PLUGIN_ID + ".make";
}
}

View file

@ -7,13 +7,10 @@ package org.eclipse.cdt.ui.wizards.conversion;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.wizards.CProjectWizard;
import org.eclipse.cdt.ui.wizards.NewCProjectWizard;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.ui.IWorkbench;
/**
@ -27,7 +24,7 @@ import org.eclipse.ui.IWorkbench;
* @see CtoCCConversionWizard#addPages
*/
public abstract class ConversionWizard
extends CProjectWizard {
extends NewCProjectWizard {
// Titles and descriptions may be overwritten by subclasses through the accessor methods.
private static final String WZ_TITLE = "ConversionWizard.title"; //$NON-NLS-1$
@ -108,16 +105,6 @@ public abstract class ConversionWizard
return PREFIX;
}
/**
* Method addTabItems, allows subclasses to add additional pages
*
* @see org.eclipse.cdt.ui.wizards.CProjectWizard#addTabItems(TabFolder)
*/
public void addTabItems(TabFolder folder) {
// we have no tabs, but must implement this abstract method
}
/**
* Method doRun calls the doRunPrologue and mainPage's doRun method and the
* doRunEpliogue. Subclasses may overwrite to add further actions

View file

@ -67,7 +67,7 @@ import org.eclipse.ui.PlatformUI;
public abstract class ConvertProjectWizardPage
extends WizardPage {
public static final String KEY_TITLE = "ConvertionWizard.title";
public static final String KEY_TITLE = "ConvertionWizard.title";
public static final String KEY_CONVERTING = "ConvertionWizard.converting";
private static final String PROJECT_LIST = "ConversionWizard.projectlist";
@ -504,15 +504,19 @@ public abstract class ConvertProjectWizardPage
}
}
protected void addCNature(IProject project, IProgressMonitor monitor, boolean addMakeBuilder) throws CoreException{
CCorePlugin.getDefault().convertProjectToC(project, monitor, CCorePlugin.PLUGIN_ID + ".make", addMakeBuilder); //$NON-NLS-1$
if ( getWizard() instanceof ConversionWizard) {
CCorePlugin.getDefault().convertProjectToC(project, monitor, ((ConversionWizard)getWizard()).getProjectID());
}
}
protected void addCCNature(IProject project, IProgressMonitor monitor, boolean addMakeBuilder) throws CoreException{
if (project.hasNature(CProjectNature.C_NATURE_ID)) {
CCorePlugin.getDefault().convertProjectFromCtoCC(project, monitor); //$NON-NLS-1$
} else {
CCorePlugin.getDefault().convertProjectToCC(project, monitor, CCorePlugin.PLUGIN_ID + ".make", addMakeBuilder); //$NON-NLS-1$
}
if ( getWizard() instanceof ConversionWizard) {
if (project.hasNature(CProjectNature.C_NATURE_ID)) {
CCorePlugin.getDefault().convertProjectFromCtoCC(project, monitor);
} else {
CCorePlugin.getDefault().convertProjectToCC(project, monitor, ((ConversionWizard)getWizard()).getProjectID());
}
}
}
}

View file

@ -1,93 +0,0 @@
package org.eclipse.cdt.ui.wizards.conversion;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.ui.CUIPlugin;
/**
* This wizard provides a method by which the user can
* add a C nature to a project that previously had no nature associated with it.
*/
public class ConvertToStdMakeConversionWizard extends ConversionWizard {
private static final String WZ_TITLE = "ConvertToStdMakeConversionWizard.title"; //$NON-NLS-1$
private static final String WZ_DESC = "ConvertToStdMakeConversionWizard.description"; //$NON-NLS-1$
private static final String PREFIX= "ConvertToStdMakeConversionWizard"; //$NON-NLS-1$
private static final String WINDOW_TITLE = "ConvertToStdMakeConversionWizard.windowTitle";//$NON-NLS-1$
/**
* ConvertToStdMakeConversionWizard Wizard constructor
*/
public ConvertToStdMakeConversionWizard() {
this(getWindowTitleResource(), getWzDescriptionResource());
}
/**
* ConvertToStdMakeConversionWizard Wizard constructor
*
* @param title
* @param desc
*/
public ConvertToStdMakeConversionWizard(String title, String desc) {
super(title, desc);
}
/**
* Method getWzDescriptionResource, allows Wizard description label value
* to be changed by subclasses
*
* @return String
*/
protected static String getWzDescriptionResource() {
return CUIPlugin.getResourceString(WZ_DESC);
}
/**
* Method getWzTitleResource, allows Wizard description label value
* to be changed by subclasses
*
* @return String
*/
protected static String getWzTitleResource() {
return CUIPlugin.getResourceString(WZ_TITLE);
}
/**
* Method getWindowTitleResource, allows Wizard Title label value to be
* changed by subclasses
*
* @return String
*/
protected static String getWindowTitleResource() {
return CUIPlugin.getResourceString(WINDOW_TITLE);
}
/**
* Method getPrefix, allows prefix value to be changed by subclasses
*
* @return String
*/
protected static String getPrefix() {
return PREFIX;
}
/**
* Method addPages adds our Simple to C conversion Wizard page.
*
* @see Wizard#createPages
*/
public void addPages() {
mainPage = new ConvertToStdMakeProjectWizardPage(getPrefix());
addPage(mainPage);
}
public String getProjectID() {
return CCorePlugin.PLUGIN_ID + ".make";//$NON-NLS-1$
}
}

View file

@ -1,66 +0,0 @@
package org.eclipse.cdt.ui.wizards.conversion;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IProject;
/**
*
* ConvertToStdMakeProjectWizardPage
* Standard main page for a wizard that adds a C project Nature to a project with no nature associated with it.
* This conversion is one way in that the project cannot be converted back (i.e have the nature removed).
*
* @author Judy N. Green
* @since Aug 6, 2002
*<p>
* Example useage:
* <pre>
* mainPage = new ConvertToStdMakeProjectWizardPage("ConvertProjectPage");
* mainPage.setTitle("Project Conversion");
* mainPage.setDescription("Add C or C++ a Nature to a project.");
* </pre>
* </p>
*/
public class ConvertToStdMakeProjectWizardPage extends ConvertProjectWizardPage {
private static final String WZ_TITLE = "StdMakeConversionWizard.title"; //$NON-NLS-1$
private static final String WZ_DESC = "StdMakeConversionWizard.description"; //$NON-NLS-1$
/**
* Constructor for ConvertToStdMakeProjectWizardPage.
* @param pageName
*/
public ConvertToStdMakeProjectWizardPage(String pageName) {
super(pageName);
}
/**
* Method getWzTitleResource returns the correct Title Label for this class
* overriding the default in the superclass.
*/
protected String getWzTitleResource(){
return CUIPlugin.getResourceString(WZ_TITLE);
}
/**
* Method getWzDescriptionResource returns the correct description
* Label for this class overriding the default in the superclass.
*/
protected String getWzDescriptionResource(){
return CUIPlugin.getResourceString(WZ_DESC);
}
/**
* Method isCandidate returns true for all projects.
*
* @param project
* @return boolean
*/
public boolean isCandidate(IProject project) {
return true; // all
}
}