1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00
core - refactor cleanup
 ui - new work on make action contributions and targets
This commit is contained in:
David Inglis 2003-08-18 21:10:04 +00:00
parent 0f45720f3d
commit 58dffc1540
27 changed files with 342 additions and 329 deletions

View file

@ -61,14 +61,4 @@
class="org.eclipse.cdt.make.internal.core.MakeProject">
</cproject>
</extension>
<!-- Not really used but could be in the future -->
<extension
id="makeBuilder"
name="%makebuildmodel.name"
point="org.eclipse.cdt.core.CBuildModel">
<run
class="org.eclipse.cdt.make.internal.core.MakeBuilder">
</run>
</extension>
</plugin>

View file

@ -41,9 +41,9 @@ import org.eclipse.core.runtime.SubProgressMonitor;
public class MakeBuilder extends ACBuilder {
private static final String BUILD_ERROR = "MakeBuilder.buildError";
private static final String BUILD_ERROR = "MakeBuilder.buildError"; //$NON-NLS-1$
public final static String BUILDER_ID = MakeCorePlugin.getUniqueIdentifier() + ".makeBuilder";
public final static String BUILDER_ID = MakeCorePlugin.getUniqueIdentifier() + ".makeBuilder"; //$NON-NLS-1$
public MakeBuilder() {
}
@ -68,7 +68,7 @@ public class MakeBuilder extends ACBuilder {
*/
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
boolean bPerformBuild = true;
IMakeBuilderInfo info = BuildInfoFactory.create(args, MakeBuilder.BUILDER_ID);
IMakeBuilderInfo info = MakeCorePlugin.create(args, MakeBuilder.BUILDER_ID);
if (!shouldBuild(kind, info)) {
return new IProject[0];
}
@ -100,7 +100,7 @@ public class MakeBuilder extends ACBuilder {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
monitor.beginTask("Invoking the C Builder: " + currProject.getName(), IProgressMonitor.UNKNOWN);
monitor.beginTask("Invoking Make Builder: " + currProject.getName(), IProgressMonitor.UNKNOWN);
try {
IPath buildCommand = info.getBuildCommand();
@ -115,7 +115,7 @@ public class MakeBuilder extends ACBuilder {
IPath workingDirectory = info.getBuildLocation();
String[] targets = getTargets(kind, info);
if (targets.length != 0 && targets[targets.length - 1].equals("clean"))
if (targets.length != 0 && targets[targets.length - 1].equals("clean")) //$NON-NLS-1$
isClean = true;
// Before launching give visual cues via the monitor
subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
@ -128,15 +128,15 @@ public class MakeBuilder extends ACBuilder {
// Set the environmennt, some scripts may need the CWD var to be set.
Properties props = launcher.getEnvironment();
props.put("CWD", workingDirectory.toOSString());
props.put("PWD", workingDirectory.toOSString());
props.put("CWD", workingDirectory.toOSString()); //$NON-NLS-1$
props.put("PWD", workingDirectory.toOSString()); //$NON-NLS-1$
String[] env = null;
ArrayList envList = new ArrayList();
Enumeration names = props.propertyNames();
if (names != null) {
while (names.hasMoreElements()) {
String key = (String) names.nextElement();
envList.add(key + "=" + props.getProperty(key));
envList.add(key + "=" + props.getProperty(key)); //$NON-NLS-1$
}
env = (String[]) envList.toArray(new String[envList.size()]);
}
@ -149,12 +149,12 @@ public class MakeBuilder extends ACBuilder {
if (info.isDefaultBuildCmd()) {
if ( !info.isStopOnError()) {
buildArguments = new String[targets.length + 1];
buildArguments[0] = "-k";
buildArguments[0] = "-k"; //$NON-NLS-1$
System.arraycopy(targets, 0, buildArguments, 1, targets.length);
}
} else {
String args = info.getBuildArguments();
if ( args != null && !args.equals("")) {
if ( args != null && !args.equals("")) { //$NON-NLS-1$
String[] newArgs = makeArray(args);
buildArguments = new String[targets.length + newArgs.length];
System.arraycopy(newArgs, 0, buildArguments, 0, newArgs.length);
@ -175,21 +175,18 @@ public class MakeBuilder extends ACBuilder {
isCanceled = monitor.isCanceled();
monitor.setCanceled(false);
subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
subMonitor.subTask("Refresh From Local");
subMonitor.subTask("Updating project...");
try {
currProject.refreshLocal(IResource.DEPTH_INFINITE, subMonitor);
} catch (CoreException e) {
}
subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
subMonitor.subTask("Parsing");
} else {
errMsg = launcher.getErrorMessage();
}
if (errMsg != null) {
StringBuffer buf = new StringBuffer(buildCommand.toString() + " ");
StringBuffer buf = new StringBuffer(buildCommand.toString() + " "); //$NON-NLS-1$
for (int i = 0; i < buildArguments.length; i++) {
buf.append(buildArguments[i]);
buf.append(' ');
@ -197,8 +194,8 @@ public class MakeBuilder extends ACBuilder {
String errorDesc = MakeCorePlugin.getFormattedString(BUILD_ERROR, buf.toString());
buf = new StringBuffer(errorDesc);
buf.append(System.getProperty("line.separator", "\n"));
buf.append("(").append(errMsg).append(")");
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
buf.append("(").append(errMsg).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
cos.write(buf.toString().getBytes());
cos.flush();
}
@ -239,7 +236,7 @@ public class MakeBuilder extends ACBuilder {
}
protected String[] getTargets(int kind, IMakeBuilderInfo info) {
String targets = "";
String targets = ""; //$NON-NLS-1$
switch (kind) {
case IncrementalProjectBuilder.AUTO_BUILD :
targets = info.getAutoBuildTarget();

View file

@ -12,20 +12,24 @@ package org.eclipse.cdt.make.core;
***********************************************************************/
import java.text.MessageFormat;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.make.internal.core.BuildInfoFactory;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Preferences;
/**
* The main plugin class to be used in the desktop.
*/
public class MakeCorePlugin extends Plugin {
public static final String OLD_BUILDER_ID = "org.eclipse.cdt.core.cbuilder";
public static final String OLD_BUILDER_ID = "org.eclipse.cdt.core.cbuilder"; //$NON-NLS-1$
//The shared instance.
private static MakeCorePlugin plugin;
//Resource bundle.
@ -38,7 +42,7 @@ public class MakeCorePlugin extends Plugin {
super(descriptor);
plugin = this;
try {
resourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.make.core.PluginResources");
resourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.make.core.PluginResources"); //$NON-NLS-1$
} catch (MissingResourceException x) {
resourceBundle = null;
}
@ -86,20 +90,32 @@ public class MakeCorePlugin extends Plugin {
}
protected void initializeDefaultPluginPreferences() {
IMakeBuilderInfo info = BuildInfoFactory.create(getPluginPreferences(), MakeBuilder.BUILDER_ID, true);
IMakeBuilderInfo info = create(getPluginPreferences(), MakeBuilder.BUILDER_ID, true);
try {
info.setBuildCommand(new Path("make"));
info.setBuildLocation(new Path(""));
info.setBuildCommand(new Path("make")); //$NON-NLS-1$
info.setBuildLocation(new Path("")); //$NON-NLS-1$
info.setStopOnError(false);
info.setUseDefaultBuildCmd(true);
info.setAutoBuildEnable(false);
info.setAutoBuildTarget("all");
info.setAutoBuildTarget("all"); //$NON-NLS-1$
info.setIncrementalBuildEnable(true);
info.setIncrementalBuildTarget("all");
info.setIncrementalBuildTarget("all"); //$NON-NLS-1$
info.setFullBuildEnable(true);
info.setFullBuildTarget("clean all");
info.setFullBuildTarget("clean all"); //$NON-NLS-1$
} catch (CoreException e) {
}
getPluginPreferences().setDefault(CCorePlugin.PREF_BINARY_PARSER, CCorePlugin.PLUGIN_ID + ".ELF");
getPluginPreferences().setDefault(CCorePlugin.PREF_BINARY_PARSER, CCorePlugin.PLUGIN_ID + ".ELF"); //$NON-NLS-1$
}
public static IMakeBuilderInfo create(Preferences prefs, String builderID, boolean useDefaults) {
return BuildInfoFactory.create(prefs, builderID, useDefaults);
}
public static IMakeBuilderInfo create(IProject project, String builderID) throws CoreException {
return BuildInfoFactory.create(project, builderID);
}
public static IMakeBuilderInfo create(Map args, String builderID) {
return BuildInfoFactory.create(args, builderID);
}
}

View file

@ -21,7 +21,7 @@ import org.eclipse.core.runtime.SubProgressMonitor;
public class MakeProjectNature implements IProjectNature {
public final static String NATURE_ID = MakeCorePlugin.getUniqueIdentifier() + ".makeNature";
public final static String NATURE_ID = MakeCorePlugin.getUniqueIdentifier() + ".makeNature"; //$NON-NLS-1$
private IProject fProject;
public static void addNature(IProject project, SubProgressMonitor monitor) throws CoreException {
@ -101,8 +101,8 @@ public class MakeProjectNature implements IProjectNature {
*/
public void configure() throws CoreException {
addBuildSpec();
IMakeBuilderInfo info = BuildInfoFactory.create(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID, false);
IMakeBuilderInfo projectInfo = BuildInfoFactory.create(getProject(), MakeBuilder.BUILDER_ID);
IMakeBuilderInfo info = MakeCorePlugin.create(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID, false);
IMakeBuilderInfo projectInfo = MakeCorePlugin.create(getProject(), MakeBuilder.BUILDER_ID);
projectInfo.setBuildLocation(info.getBuildLocation());

View file

@ -72,7 +72,7 @@ public class MakeScannerInfo implements IScannerInfo {
}
String key = new String();
String value = new String();
int index = symbol.indexOf("=");
int index = symbol.indexOf("="); //$NON-NLS-1$
if (index != -1) {
key = symbol.substring(0, index).trim();
value = symbol.substring(index + 1).trim();

View file

@ -36,16 +36,16 @@ import org.w3c.dom.Node;
public class MakeScannerProvider extends AbstractCExtension implements IScannerInfoProvider {
// This is the id of the IScannerInfoProvider extension point entry
public static final String INTERFACE_IDENTITY = MakeCorePlugin.getUniqueIdentifier() + ".MakeScannerProvider";
public static final String INTERFACE_IDENTITY = MakeCorePlugin.getUniqueIdentifier() + ".MakeScannerProvider"; //$NON-NLS-1$
// Name we will use to store build property with the project
private static final QualifiedName scannerInfoProperty = new QualifiedName(MakeCorePlugin.getUniqueIdentifier(), "makeBuildInfo");
private static final String CDESCRIPTOR_ID = MakeCorePlugin.getUniqueIdentifier() + ".makeScannerInfo";
private static final QualifiedName scannerInfoProperty = new QualifiedName(MakeCorePlugin.getUniqueIdentifier(), "makeBuildInfo"); //$NON-NLS-1$
private static final String CDESCRIPTOR_ID = MakeCorePlugin.getUniqueIdentifier() + ".makeScannerInfo"; //$NON-NLS-1$
public static final String INCLUDE_PATH = "includePath";
public static final String PATH = "path";
public static final String DEFINED_SYMBOL = "definedSymbol";
public static final String SYMBOL = "symbol";
public static final String INCLUDE_PATH = "includePath"; //$NON-NLS-1$
public static final String PATH = "path"; //$NON-NLS-1$
public static final String DEFINED_SYMBOL = "definedSymbol"; //$NON-NLS-1$
public static final String SYMBOL = "symbol"; //$NON-NLS-1$
// Listeners interested in build model changes
private static Map listeners;

View file

@ -1,4 +1,4 @@
package org.eclipse.cdt.make.core;
package org.eclipse.cdt.make.internal.core;
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
@ -13,6 +13,9 @@ package org.eclipse.cdt.make.core;
import java.util.Map;
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.MakeProjectNature;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@ -30,17 +33,17 @@ public class BuildInfoFactory {
private static final String PREFIX = MakeCorePlugin.getUniqueIdentifier();
private static final String BUILD_COMMAND = PREFIX + ".buildCommand";
private static final String BUILD_LOCATION = PREFIX + ".buildLocation";
private static final String STOP_ON_ERROR = PREFIX + ".stopOnError";
private static final String USE_DEFAULT_BUILD_CMD = PREFIX + ".useDefaultBuildCmd";
private static final String BUILD_TARGET_AUTO = PREFIX + ".autoBuildTarget";
private static final String BUILD_TARGET_INCREMENTAL = PREFIX + ".incrementalBuildTarget";
private static final String BUILD_TARGET_FULL = PREFIX + ".fullBuildTarget";
private static final String BUILD_FULL_ENABLED = PREFIX + ".enableFullBuild";
private static final String BUILD_INCREMENTAL_ENABLED = PREFIX + ".enabledIncrementalBuild";
private static final String BUILD_AUTO_ENABLED = PREFIX + ".enableAutoBuild";
private static final String BUILD_ARGUMENTS = PREFIX + ".buildArguments";
static final String BUILD_COMMAND = PREFIX + ".buildCommand"; //$NON-NLS-1$
static final String BUILD_LOCATION = PREFIX + ".buildLocation"; //$NON-NLS-1$
static final String STOP_ON_ERROR = PREFIX + ".stopOnError"; //$NON-NLS-1$
static final String USE_DEFAULT_BUILD_CMD = PREFIX + ".useDefaultBuildCmd"; //$NON-NLS-1$
static final String BUILD_TARGET_AUTO = PREFIX + ".autoBuildTarget"; //$NON-NLS-1$
static final String BUILD_TARGET_INCREMENTAL = PREFIX + ".incrementalBuildTarget"; //$NON-NLS-1$
static final String BUILD_TARGET_FULL = PREFIX + ".fullBuildTarget"; //$NON-NLS-1$
static final String BUILD_FULL_ENABLED = PREFIX + ".enableFullBuild"; //$NON-NLS-1$
static final String BUILD_INCREMENTAL_ENABLED = PREFIX + ".enabledIncrementalBuild"; //$NON-NLS-1$
static final String BUILD_AUTO_ENABLED = PREFIX + ".enableAutoBuild"; //$NON-NLS-1$
static final String BUILD_ARGUMENTS = PREFIX + ".buildArguments"; //$NON-NLS-1$
private abstract static class Store implements IMakeBuilderInfo {
@ -61,9 +64,9 @@ public class BuildInfoFactory {
public IPath getBuildCommand() {
if (isDefaultBuildCmd()) {
String command = getBuildParameter("defaultCommand");
String command = getBuildParameter("defaultCommand"); //$NON-NLS-1$
if (command == null) {
return new Path("make");
return new Path("make"); //$NON-NLS-1$
}
return new Path(command);
}
@ -82,11 +85,11 @@ public class BuildInfoFactory {
if (configs.length == 0)
return null;
//The nature exists, or this builder doesn't specify a nature
IConfigurationElement[] runElement = configs[0].getChildren("run");
IConfigurationElement[] paramElement = runElement[0].getChildren("parameter");
IConfigurationElement[] runElement = configs[0].getChildren("run"); //$NON-NLS-1$
IConfigurationElement[] paramElement = runElement[0].getChildren("parameter"); //$NON-NLS-1$
for (int i = 0; i < paramElement.length; i++) {
if (paramElement[i].getAttribute("name").equals(name)) {
return paramElement[i].getAttribute("value");
if (paramElement[i].getAttribute("name").equals(name)) { //$NON-NLS-1$
return paramElement[i].getAttribute("value"); //$NON-NLS-1$
}
}
return null;
@ -100,7 +103,7 @@ public class BuildInfoFactory {
public IPath getBuildLocation() {
String location = getString(BUILD_LOCATION);
return new Path(location == null ? "" : location);
return new Path(location == null ? "" : location); //$NON-NLS-1$
}
public void setStopOnError(boolean enabled) throws CoreException {
@ -233,7 +236,7 @@ public class BuildInfoFactory {
public String getString(String name) {
String value = (String)args.get(name);
return value == null ? "" : value;
return value == null ? "" : value; //$NON-NLS-1$
}
public String getBuilderID() {

View file

@ -1,58 +0,0 @@
/**********************************************************************
* 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 v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.make.internal.core;
import org.eclipse.cdt.core.AbstractCExtension;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.core.runtime.IPath;
public class MakeBuilder extends AbstractCExtension /*implements ICBuilder */ {
public IPath[] getIncludePaths() {
return new IPath[0];
}
public void setIncludePaths(IPath[] incPaths) {
}
public IPath[] getLibraryPaths() {
return new IPath[0];
}
public void setLibraryPaths(IPath[] libPaths) {
}
public String[] getLibraries() {
return new String[0];
}
public void setLibraries(String[] libs) {
}
// public IOptimization getOptimization() {
// return null;
// }
//
// public IProject[] build(CIncrementalBuilder cbuilder) {
// ICExtensionReference ref = getExtensionReference();
// System.out.println("MakeBuilder!!!!\n Command is:" + ref.getExtensionData("command"));
// return null;
// }
//
// public void setOptimization(IOptimization o) {
// }
public String getID() {
return MakeCorePlugin.getUniqueIdentifier() + ".makeBuilder";
}
}

View file

@ -12,32 +12,22 @@ package org.eclipse.cdt.make.internal.core;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.ICExtensionReference;
import org.eclipse.cdt.core.ICOwner;
import org.eclipse.cdt.make.core.MakeScannerProvider;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.core.runtime.CoreException;
public class MakeProject implements ICOwner {
public void configure(ICDescriptor cproject) throws CoreException {
cproject.remove(CCorePlugin.BUILDER_MODEL_ID);
ICExtensionReference ext = cproject.create(CCorePlugin.BUILDER_MODEL_ID, MakeCorePlugin.getUniqueIdentifier() + ".makeBuilder");
ext.setExtensionData("command", "make");
cproject.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
cproject.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, MakeScannerProvider.INTERFACE_IDENTITY);
}
public void update(ICDescriptor cproject, String extensionID) throws CoreException {
if ( extensionID.equals(CCorePlugin.BUILDER_MODEL_ID ) ) {
ICExtensionReference ext = cproject.create(CCorePlugin.BUILDER_MODEL_ID, MakeCorePlugin.getUniqueIdentifier() + ".makeBuilder");
ext.setExtensionData("command", "make");
}
if ( extensionID.equals(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID)) {
cproject.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, MakeScannerProvider.INTERFACE_IDENTITY);
}
if ( extensionID.equals(CCorePlugin.BINARY_PARSER_UNIQ_ID)) {
cproject.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, CCorePlugin.PLUGIN_ID + ".Elf");
cproject.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, CCorePlugin.PLUGIN_ID + ".Elf"); //$NON-NLS-1$
}
}

View file

@ -91,7 +91,7 @@
</menu>
<action
label="%ActionMakeBuildCreate.label"
class="org.eclipse.cdt.make.ui.actions.CreateBuildAction"
class="org.eclipse.cdt.make.internal.ui.actions.MakeCreateBuildAction"
menubarPath="org.eclipse.cdt.make.ui.menu/group1"
enablesFor="1"
id="org.eclipse.cdt.make.ui.createBuildAction">
@ -99,26 +99,26 @@
<action
label="%ActionMakeAll.label"
icon="icons/ctool16/make.gif"
class="org.eclipse.cdt.make.ui.actions.BuildAction"
class="org.eclipse.cdt.make.internal.ui.actions.MakeBuilderAction"
menubarPath="org.eclipse.cdt.make.ui.menu/group2"
enablesFor="1"
id="org.eclipse.cdt.make.ui.makeAction.all">
id="org.eclipse.cdt.make.ui.makeBuildAction.all">
</action>
<action
label="%ActionMakeClean.label"
icon="icons/ctool16/make.gif"
class="org.eclipse.cdt.make.ui.actions.BuildAction"
class="org.eclipse.cdt.make.internal.ui.actions.MakeBuilderAction"
menubarPath="org.eclipse.cdt.make.ui.menu/group2"
enablesFor="1"
id="org.eclipse.cdt.make.ui.makeAction.clean">
id="org.eclipse.cdt.make.ui.makeBuildAction.clean">
</action>
<action
label="%ActionMakeRebuild.label"
icon="icons/ctool16/make.gif"
class="org.eclipse.cdt.make.ui.actions.BuildAction"
class="org.eclipse.cdt.make.internal.ui.actions.MakeBuilderAction"
menubarPath="org.eclipse.cdt.make.ui.menu/group2"
enablesFor="1"
id="org.eclipse.cdt.make.ui.makeAction.rebuild">
id="org.eclipse.cdt.make.ui.makeBuildAction.clean.all">
</action>
<filter
name="nature"

View file

@ -0,0 +1,20 @@
/*
* Created on 18-Aug-2003
*
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.make.internal.ui.actions;
import org.eclipse.cdt.make.core.MakeBuilder;
import org.eclipse.cdt.make.ui.actions.MakeBuildAction;
public class MakeBuilderAction extends MakeBuildAction {
protected String getBuilderID() {
return MakeBuilder.BUILDER_ID;
}
}

View file

@ -0,0 +1,20 @@
/*
* Created on 18-Aug-2003
*
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.make.internal.ui.actions;
import org.eclipse.cdt.make.core.MakeBuilder;
import org.eclipse.cdt.make.ui.actions.CreateBuildAction;
public class MakeCreateBuildAction extends CreateBuildAction {
protected String getBuilderID() {
return MakeBuilder.BUILDER_ID;
}
}

View file

@ -29,9 +29,9 @@ import org.eclipse.ui.dialogs.PropertyPage;
public class MakePropertyPage extends PropertyPage implements ICOptionContainer {
private MakeProjectOptionBlock fOptionBlock;
MakeProjectOptionBlock fOptionBlock;
private static final String MSG_CLOSEDPROJECT = "MakeProjectPropertyPage.closedproject";
private static final String MSG_CLOSEDPROJECT = "MakeProjectPropertyPage.closedproject"; //$NON-NLS-1$
public MakePropertyPage() {
super();

View file

@ -26,7 +26,7 @@ public abstract class StatusWizardPage extends WizardPage {
public StatusWizardPage(String name, boolean noErrorOnStartup) {
super(name);
fPageVisible= false;
fCurrStatus= createStatus(IStatus.OK, "");
fCurrStatus= createStatus(IStatus.OK, ""); //$NON-NLS-1$
fNoErrorOnStartup= noErrorOnStartup;
}
@ -41,7 +41,7 @@ public abstract class StatusWizardPage extends WizardPage {
// policy: wizards are not allowed to come up with an error message
if (visible && fNoErrorOnStartup && fCurrStatus.matches(IStatus.ERROR)) {
// keep the error state, but remove the message
fCurrStatus= createStatus(IStatus.ERROR, "");
fCurrStatus= createStatus(IStatus.ERROR, ""); //$NON-NLS-1$
}
updateStatus(fCurrStatus);
}

View file

@ -329,7 +329,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
/*
* Enables the buttons on the path control if the right conditions are met
*/
private void enablePathButtons() {
void enablePathButtons() {
// Enable the remove button if there is at least 1 item in the list
int items = pathList.getItemCount();
if (items > 0) {
@ -345,7 +345,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
}
}
private void enableSymbolButtons() {
void enableSymbolButtons() {
// Enable the remove button if there is at least 1 item in the list
int items = symbolList.getItemCount();
if (items > 0) {
@ -424,7 +424,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
protected void handleAddPath() {
// Popup an entry dialog
InputDialog dialog =
new InputDialog(shell, CUIPlugin.getResourceString(PATH_TITLE), CUIPlugin.getResourceString(PATH_LABEL), "", null);
new InputDialog(shell, CUIPlugin.getResourceString(PATH_TITLE), CUIPlugin.getResourceString(PATH_LABEL), "", null); //$NON-NLS-1$
String path = null;
if (dialog.open() == InputDialog.OK) {
path = dialog.getValue();
@ -442,7 +442,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
protected void handleAddSymbol() {
// Popup an entry dialog
InputDialog dialog =
new InputDialog(shell, CUIPlugin.getResourceString(SYMBOL_TITLE), CUIPlugin.getResourceString(SYMBOL_LABEL), "", null);
new InputDialog(shell, CUIPlugin.getResourceString(SYMBOL_TITLE), CUIPlugin.getResourceString(SYMBOL_LABEL), "", null); //$NON-NLS-1$
String symbol = null;
if (dialog.open() == InputDialog.OK) {
symbol = dialog.getValue();

View file

@ -0,0 +1,46 @@
/*
* Created on 18-Aug-2003
*
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.make.ui.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.actions.ActionDelegate;
public abstract class AbstractMakeBuilderAction extends ActionDelegate implements IObjectActionDelegate {
IWorkbenchPart part;
ISelection fSelection;
public AbstractMakeBuilderAction() {
super();
}
/**
* @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
part = targetPart;
}
/**
* @see IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
fSelection = selection;
}
protected Shell getShell() {
return part.getSite().getShell();
}
protected abstract String getBuilderID();
}

View file

@ -8,7 +8,16 @@
***********************************************************************/
package org.eclipse.cdt.make.ui.actions;
public class CreateBuildAction extends MakeAction {
import org.eclipse.jface.action.IAction;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public abstract class CreateBuildAction extends AbstractMakeBuilderAction implements IWorkbenchWindowActionDelegate {
public void init(IWorkbenchWindow window) {
}
public void run(IAction action) {
}
}

View file

@ -1,60 +0,0 @@
/*******************************************************************************
* Copyright (c) 2000, 2003 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.make.ui.actions;
import org.eclipse.cdt.make.ui.views.MakeTarget;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.actions.ActionDelegate;
public class MakeAction extends ActionDelegate implements IObjectActionDelegate {
ISelection fSelection;
IWorkbenchPart part;
/**
* @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
part = targetPart;
}
/**
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
if (fSelection instanceof IStructuredSelection
&& ((IStructuredSelection) fSelection).getFirstElement() instanceof IProject) {
IProject project = (IProject) ((IStructuredSelection) fSelection).getFirstElement();
MakeBuildAction build = null;
if (action.getId().equals("org.eclipse.cdt.make.ui.makeAction.all")) {
build = new MakeBuildAction(new org.eclipse.cdt.make.ui.views.MakeTarget[] { new MakeTarget(project, "all")}, part.getSite().getShell(), "all");
} else if (action.getId().equals("org.eclipse.cdt.make.ui.makeAction.clean")) {
build = new MakeBuildAction(new MakeTarget[] { new MakeTarget(project, "all")}, part.getSite().getShell(), "all");
} else if (action.getId().equals("org.eclipse.cdt.make.ui.makeAction.rebuild")) {
build = new MakeBuildAction(new MakeTarget[] { new MakeTarget(project, "all")}, part.getSite().getShell(), "all");
}
if ( build != null ) {
build.run();
}
}
}
/**
* @see IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
fSelection = selection;
}
}

View file

@ -0,0 +1,106 @@
package org.eclipse.cdt.make.ui.actions;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
import org.eclipse.cdt.make.core.MakeBuilder;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.ui.views.MakeTarget;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
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;
public class MakeBuild {
/**
* Causes all editors to save any modified resources depending on the user's
* preference.
*/
static void saveAllResources(MakeTarget[] targets) {
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);
}
}
}
}
}
}
}
static public void run(boolean fork, IRunnableContext context, final MakeTarget[] targets) {
try {
context.run(fork, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
saveAllResources(targets);
// Map infoMap = new HashMap();
// IMakeBuilderInfo info = MakeCorePlugin.create(infoMap, MakeBuilder.BUILDER_ID);
// project.build(IncrementalProjectBuilder.FULL_BUILD, MakeBuilder.BUILDER_ID, infoMap, monitor);
}
};
MakeUIPlugin.getWorkspace().run(runnable, monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
} catch (OperationCanceledException e) {
throw new InterruptedException(e.getMessage());
}
}
});
} catch (InterruptedException e) {
return;
} catch (InvocationTargetException e) {
MakeUIPlugin.logException(e, "Build Error", "Error Building Projects");
}
}
}

View file

@ -1,110 +1,46 @@
/*******************************************************************************
* Copyright (c) 2000, 2003 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.make.ui.actions;
/*
* (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.cdt.internal.ui.CPluginImages;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.ui.views.MakeTarget;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.IAction;
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;
public class MakeBuildAction extends Action {
static final String PREFIX = "BuildAction.";
MakeTarget[] targets;
Shell shell;
public MakeBuildAction (MakeTarget[] targets, Shell shell, String s) {
super (s);
this.shell = shell;
this.targets = targets;
setToolTipText(PREFIX);
setImageDescriptor(CPluginImages.DESC_BUILD_MENU);
}
import org.eclipse.jface.viewers.IStructuredSelection;
public abstract class MakeBuildAction extends AbstractMakeBuilderAction {
protected final String makeActionID = "org.eclipse.cdt.make.ui.makeBuildAction."; //$NON-NLS-1$
/**
* Causes all editors to save any modified resources depending on the user's
* preference.
* @see IActionDelegate#run(IAction)
*/
void saveAllResources() {
public void run(IAction action) {
if (fSelection instanceof IStructuredSelection
&& ((IStructuredSelection) fSelection).getFirstElement() instanceof IProject) {
IProject project = (IProject) ((IStructuredSelection) fSelection).getFirstElement();
MakeTarget target = null;
String id = action.getId();
if ( id.startsWith(makeActionID) ) {
String targets = id.substring(makeActionID.length());
if ( targets.length() > 0) {
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();
// }
// project.build (IncrementalProjectBuilder.FULL_BUILD, MakeBuilder.BUILDER_ID, monitor);
// } catch (CoreException e) {
// }
}
}
};
new ProgressMonitorDialog(shell).run(true, true, op);
} catch (InvocationTargetException e) {
// handle exception
} catch (InterruptedException e) {
// handle cancelation
if ( target != null ) {
ProgressMonitorDialog pd = new ProgressMonitorDialog(MakeUIPlugin.getActiveWorkbenchShell());
MakeBuild.run(true, pd, new MakeTarget[] {target});
} else {
MakeUIPlugin.errorDialog(getShell(), "Make Build Contribution Error", "build target not defined", (IStatus)null);
}
}
}
}

View file

@ -13,7 +13,6 @@ import java.util.ArrayList;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.make.core.BuildInfoFactory;
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
import org.eclipse.cdt.make.core.MakeBuilder;
import org.eclipse.cdt.make.core.MakeCorePlugin;
@ -119,7 +118,7 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
MakeProjectNature.addNature(project[i], new SubProgressMonitor(monitor, 1));
QualifiedName qlocation = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildLocation");
String location = project[i].getPersistentProperty(qlocation);
IMakeBuilderInfo newInfo = BuildInfoFactory.create(project[i], MakeBuilder.BUILDER_ID);
IMakeBuilderInfo newInfo = MakeCorePlugin.create(project[i], MakeBuilder.BUILDER_ID);
newInfo.setBuildCommand(new Path(location));
//remove old properties

View file

@ -5,7 +5,6 @@ package org.eclipse.cdt.make.ui.views;
* All Rights Reserved.
*/
import org.eclipse.cdt.make.ui.actions.MakeBuildAction;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
@ -49,8 +48,8 @@ public class MakeView extends ViewPart {
//System.out.println ("Double click on " + element);
if (element instanceof MakeTarget) {
MakeTarget ta = (MakeTarget) element;
Action build = new MakeBuildAction(new MakeTarget[] { ta }, getViewSite().getShell(), "Build");
build.run();
// Action build = new MakeBuildAction(new MakeTarget[] { ta }, getViewSite().getShell(), "Build");
// build.run();
}
//if (viewer.isExpandable(element)) {
// viewer.setExpandedState(element, !viewer.getExpandedState(element));
@ -112,13 +111,13 @@ public class MakeView extends ViewPart {
}
};
Action build = new MakeBuildAction(new MakeTarget[] { ta }, getViewSite().getShell(), "Build");
// Action build = new MakeBuildAction(new MakeTarget[] { ta }, getViewSite().getShell(), "Build");
menu.add(add);
menu.add(edit);
menu.add(del);
//menu.add (new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(build);
// menu.add(build);
if (ta.isLeaf()) {
add.setEnabled(false);
} else {

View file

@ -97,7 +97,7 @@ public class ConvertToMakeProjectWizard extends ConversionWizard {
}
protected void doRun(IProgressMonitor monitor) throws CoreException {
monitor.beginTask("Converting to Make Project", 2);
monitor.beginTask("Converting to Make Project...", 2);
super.doRun(new SubProgressMonitor(monitor, 1));
optionsPage.performApply(new SubProgressMonitor(monitor, 1));
}

View file

@ -42,7 +42,7 @@ public class MakeProjectWizardOptionPage extends NewCProjectWizardOptionPage {
}
public MakeProjectWizardOptionPage(String title, String description) {
super("MakeProjectSettingsPage");
super("MakeProjectSettingsPage"); //$NON-NLS-1$
setTitle(title);
setDescription(description);
}

View file

@ -49,6 +49,6 @@ public abstract class NewMakeProjectWizard extends NewCProjectWizard {
}
public String getProjectID() {
return MakeCorePlugin.getUniqueIdentifier() + ".make";
return MakeCorePlugin.getUniqueIdentifier() + ".make"; //$NON-NLS-1$
}
}

View file

@ -14,7 +14,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.jface.wizard.Wizard;
public class UpdateMakeProjectWizard extends Wizard {
private static final String MAKE_UPDATE_WINDOW_TITLE = "MakeWizardUpdate.window_title";
private static final String MAKE_UPDATE_WINDOW_TITLE = "MakeWizardUpdate.window_title"; //$NON-NLS-1$
private UpdateMakeProjectWizardPage page1;
private IProject[] selected;

View file

@ -32,8 +32,8 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
public class UpdateMakeProjectWizardPage extends StatusWizardPage {
private static final String MAKE_UPDATE_TITLE = "MakeWizardUpdatePage.title";
private static final String MAKE_UPDATE_DESCRIPTION = "MakeWizardUpdatePage.description";
private static final String MAKE_UPDATE_TITLE = "MakeWizardUpdatePage.title"; //$NON-NLS-1$
private static final String MAKE_UPDATE_DESCRIPTION = "MakeWizardUpdatePage.description"; //$NON-NLS-1$
private IProject[] selected;
private CheckboxTableViewer makeProjectListViewer;
@ -66,7 +66,7 @@ public class UpdateMakeProjectWizardPage extends StatusWizardPage {
}
public UpdateMakeProjectWizardPage(IProject[] selected) {
super("UpdateMakeProjectWizardPage", true);
super("UpdateMakeProjectWizardPage", true); //$NON-NLS-1$
setTitle(MakeUIPlugin.getResourceString(MAKE_UPDATE_TITLE));
setDescription(MakeUIPlugin.getResourceString(MAKE_UPDATE_DESCRIPTION));
this.selected = selected;
@ -107,7 +107,7 @@ public class UpdateMakeProjectWizardPage extends StatusWizardPage {
return tablePart.getSelection();
}
private void dialogChanged() {
void dialogChanged() {
IStatus genStatus = validatePlugins();
updateStatus(genStatus);
}
@ -141,6 +141,6 @@ public class UpdateMakeProjectWizardPage extends StatusWizardPage {
if (tablePart.getSelectionCount() == 0) {
return createStatus(IStatus.ERROR, "No projects selected");
}
return createStatus(IStatus.OK, "");
return createStatus(IStatus.OK, ""); //$NON-NLS-1$
}
}