mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Merge remote-tracking branch 'cdt/master' into sd90
This commit is contained in:
commit
3bd6a3eb46
59 changed files with 808 additions and 451 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
|||
/*/*/bin
|
||||
/*/*/index
|
||||
/*/*/target
|
||||
.DS_Store
|
||||
|
|
|
@ -1,3 +1,21 @@
|
|||
2012-03-30 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
Bug #371277
|
||||
* src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java
|
||||
(regenerateMakefiles): Fix setting of status on error.
|
||||
(runScript): Switch to use sh -c for all script execution.
|
||||
|
||||
2012-03-30 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
Bug #372557
|
||||
* src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java
|
||||
(runScript): Fix index out of range exception when environment variable is
|
||||
unknown.
|
||||
|
||||
2012-03-29 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* src/org/eclipse/cdt/autotools/core/AutotoolsNewProjectNature.java: Fix old nature id to contain the .core specifier.
|
||||
|
||||
2012-01-03 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
Refactor all packages to be org.eclipse.cdt.autotools.core.
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
public class AutotoolsNewProjectNature implements IProjectNature {
|
||||
|
||||
public static final String AUTOTOOLS_NATURE_ID = "org.eclipse.cdt.autotools.core.autotoolsNatureV2"; //$NON-NLS-1$
|
||||
public static final String OLD_AUTOTOOLS_NATURE_ID = "org.eclipse.linuxtools.cdt.autotools.autotoolsNatureV2"; //$NON-NLS-1$
|
||||
public static final String OLD_AUTOTOOLS_NATURE_ID = "org.eclipse.linuxtools.cdt.autotools.core.autotoolsNatureV2"; //$NON-NLS-1$
|
||||
public final static String BUILDER_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".genmakebuilder"; //$NON-NLS-1$
|
||||
public final static String OLD_AUTOTOOLS_BUILDER_ID = "org.eclipse.linuxtools.cdt.autotools.genmakebuilder"; //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
|
|||
}
|
||||
|
||||
private Status regenerateMakefiles(IConfiguration icfg, boolean reconfigure) throws CoreException {
|
||||
Status status;
|
||||
MultiStatus status;
|
||||
int rc = IStatus.OK;
|
||||
String errMsg = new String();
|
||||
boolean needFullConfigure = false;
|
||||
|
@ -614,7 +614,14 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
|
|||
} finally {
|
||||
// getGenerationProblems().clear();
|
||||
status = new MultiStatus(AutotoolsPlugin
|
||||
.getUniqueIdentifier(), rc, errMsg, null);
|
||||
.getUniqueIdentifier(), rc, errMsg, null);
|
||||
if (rc != IStatus.OK)
|
||||
status.add(new Status (
|
||||
rc,
|
||||
AutotoolsPlugin.getUniqueIdentifier(),
|
||||
0,
|
||||
errMsg,
|
||||
null));
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
@ -1032,21 +1039,24 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
|
|||
}
|
||||
configTargets[0] = getPathString(commandPath);
|
||||
|
||||
// Fix for bug #343731
|
||||
// Fix for bug #343879
|
||||
if (Platform.getOS().equals(Platform.OS_WIN32)
|
||||
|| Platform.getOS().equals(Platform.OS_MACOSX)) {
|
||||
|| Platform.getOS().equals(Platform.OS_MACOSX))
|
||||
removePWD = true;
|
||||
// Neither Mac or Windows support calling scripts directly.
|
||||
String command = null;
|
||||
for (String arg : configTargets) {
|
||||
// TODO check for spaces in args
|
||||
if (command == null)
|
||||
command = arg;
|
||||
else
|
||||
command += " " + arg;
|
||||
}
|
||||
configTargets = new String[] { "-c", command };
|
||||
|
||||
// Fix for bug #343731 and bug #371277
|
||||
// Always use sh -c for executing autotool scripts which should
|
||||
// work on all Linux POSIX compliant shells including bash, dash, as
|
||||
// well as Windows and Mac OSX.
|
||||
String command = null;
|
||||
for (String arg : configTargets) {
|
||||
// TODO check for spaces in args
|
||||
if (command == null)
|
||||
command = arg;
|
||||
else
|
||||
command += " " + arg;
|
||||
}
|
||||
configTargets = new String[] { "-c", command };
|
||||
|
||||
for (int i = 0; i < configTargets.length; ++i) {
|
||||
// try to resolve the build macros in any argument
|
||||
|
@ -1060,7 +1070,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
|
|||
cfg);
|
||||
// strip any env-var settings from options
|
||||
// fix for bug #356278
|
||||
if (resolved.charAt(0) != '-')
|
||||
if (resolved.length() > 0 && resolved.charAt(0) != '-')
|
||||
resolved = stripEnvVarsFromOption(resolved, additionalEnvs);
|
||||
configTargets[i] = resolved;
|
||||
} catch (BuildMacroException e) {
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
2012-03-30 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* src/org/eclipse/cdt/autotools/tests/ProjectTools.java
|
||||
(setup): Fix to return false when Workbench is null.
|
||||
|
||||
2012-03-30 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* zip/project2.zip: Fix autogen.sh to make the configure script executable.
|
||||
|
||||
2012-03-29 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* src/org/eclipse/cdt/autotools/tests/ProjectTools.java (build): Refresh the workspace root so resource tests
|
||||
will work consistently.
|
||||
|
||||
2012-01-03 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
Refactor to org.eclipse.cdt.autotools.tests.
|
||||
|
|
|
@ -13,6 +13,8 @@ import org.eclipse.cdt.core.CommandLauncher;
|
|||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.internal.autotools.core.configure.AutotoolsConfigurationManager;
|
||||
import org.eclipse.cdt.internal.autotools.core.configure.IAConfiguration;
|
||||
import org.eclipse.cdt.internal.autotools.ui.wizards.ConvertToAutotoolsProjectWizard;
|
||||
import org.eclipse.cdt.internal.autotools.ui.wizards.ConvertToAutotoolsProjectWizardPage;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||
|
@ -23,6 +25,7 @@ import org.eclipse.core.resources.IFile;
|
|||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IWorkspaceDescription;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
|
@ -35,8 +38,6 @@ 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.cdt.internal.autotools.ui.wizards.ConvertToAutotoolsProjectWizard;
|
||||
import org.eclipse.cdt.internal.autotools.ui.wizards.ConvertToAutotoolsProjectWizardPage;
|
||||
import org.eclipse.ui.dialogs.IOverwriteQuery;
|
||||
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
|
||||
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
|
||||
|
@ -58,19 +59,19 @@ public class ProjectTools {
|
|||
*/
|
||||
public static boolean setup() throws Exception {
|
||||
if (!setupComplete) {
|
||||
IWorkspaceDescription desc;
|
||||
workspace = ResourcesPlugin.getWorkspace();
|
||||
root = workspace.getRoot();
|
||||
monitor = new NullProgressMonitor();
|
||||
if(workspace == null) {
|
||||
return false;
|
||||
}
|
||||
if(root == null) {
|
||||
return false;
|
||||
}
|
||||
desc = workspace.getDescription();
|
||||
desc.setAutoBuilding(false);
|
||||
workspace.setDescription(desc);
|
||||
IWorkspaceDescription desc;
|
||||
workspace = ResourcesPlugin.getWorkspace();
|
||||
if (workspace == null) {
|
||||
return false;
|
||||
}
|
||||
root = workspace.getRoot();
|
||||
monitor = new NullProgressMonitor();
|
||||
if (root == null) {
|
||||
return false;
|
||||
}
|
||||
desc = workspace.getDescription();
|
||||
desc.setAutoBuilding(false);
|
||||
workspace.setDescription(desc);
|
||||
}
|
||||
setupComplete = true;
|
||||
return true;
|
||||
|
@ -83,6 +84,7 @@ public class ProjectTools {
|
|||
public static boolean build() {
|
||||
try {
|
||||
workspace.build(IncrementalProjectBuilder.FULL_BUILD, getMonitor());
|
||||
workspace.getRoot().refreshLocal(IResource.DEPTH_INFINITE, getMonitor());
|
||||
} catch (CoreException e) {
|
||||
return false;
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -1,3 +1,37 @@
|
|||
2012-03-30 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java
|
||||
(AutomakeEditor): Make constructor public so openEditor will work.
|
||||
* src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeErrorHandler.java
|
||||
(AutomakeErrorHandler): Change constructor to accept an IEditorInput rather than
|
||||
an IDocument.
|
||||
* src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileReconcilingStrategy.java
|
||||
(AutomakefileReconcilingStrategy): Pass an IEditorInput to create the
|
||||
AutomakeErrorHandler.
|
||||
* src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeDocumentProvider.java
|
||||
(connect): Ditto.
|
||||
|
||||
2012-03-30 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacro.java
|
||||
(equals): Fix FindBugs error with missing null case.
|
||||
(hashCode): New method to fix FindBugs error.
|
||||
* src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java
|
||||
(AutomakeEditor): Fix constructor to remove static variable.
|
||||
(static initializer): Fix FindBugs error with static variable usage.
|
||||
|
||||
2012-03-30 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
Bug #371277
|
||||
* src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAction.java
|
||||
(..run): Use sh -c to execute the autotool scripts.
|
||||
|
||||
2012-03-29 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
Resolves: bug#374026
|
||||
* src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizard.java (createItems): Change to accept any
|
||||
type of project that has at least one toolchain that is based upon the GNU Autotools toolchain.
|
||||
|
||||
2012-01-03 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
Refactor entire plug-in to org.eclipse.cdt.autotools.ui.
|
||||
|
|
|
@ -42,7 +42,14 @@ public class AutoconfMacro implements Comparable<Object> {
|
|||
}
|
||||
|
||||
public boolean equals(Object x) {
|
||||
if (x == null)
|
||||
return false;
|
||||
AutoconfMacro y = (AutoconfMacro)x;
|
||||
return getName().equals(y.getName());
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return getName().hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
|
@ -259,7 +258,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
|||
Process process = cmdL.execute(command, argumentList, envList,
|
||||
execDir, new NullProgressMonitor());
|
||||
|
||||
if (cmdL.waitAndRead(stdout, stderr) == CommandLauncher.OK) {
|
||||
if (cmdL.waitAndRead(stdout, stderr, new NullProgressMonitor()) == CommandLauncher.OK) {
|
||||
try {
|
||||
status = 0;
|
||||
monitor.done();
|
||||
|
@ -389,30 +388,18 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
|||
|
||||
String[] newArgumentList;
|
||||
|
||||
// Fix for bug #343905
|
||||
// For Windows and Mac, we cannot run a script directly (in this case, the
|
||||
// autotools are scripts). We need to run "sh -c command args where command
|
||||
// plus args is represented in a single string.
|
||||
if (Platform.getOS().equals(Platform.OS_WIN32)
|
||||
|| Platform.getOS().equals(Platform.OS_MACOSX)) {
|
||||
// Neither Mac or Windows support calling scripts directly.
|
||||
StringBuffer command = new StringBuffer(strippedCommand);
|
||||
for (String arg : argumentList) {
|
||||
command.append(" " + arg);
|
||||
}
|
||||
newArgumentList = new String[] { "-c", command.toString() };
|
||||
} else {
|
||||
// Otherwise, we don't need the -c argument and can present the command
|
||||
// name and arguments as individual arguments
|
||||
if (argumentList == null)
|
||||
newArgumentList = new String[1];
|
||||
else
|
||||
newArgumentList = new String[argumentList.length + 1];
|
||||
newArgumentList[0] = strippedCommand;
|
||||
if (argumentList != null)
|
||||
System.arraycopy(argumentList, 0, newArgumentList, 1, argumentList.length);
|
||||
}
|
||||
|
||||
// Fix for bug #343905 and bug #371277
|
||||
// For Windows and Mac, we cannot run a script directly (in this case,
|
||||
// autotools are scripts). We need to run "sh -c command args where command
|
||||
// plus args is represented in a single string. The same applies for
|
||||
// some Linux shells such as dash. Using sh -c will work on all Linux
|
||||
// POSIX-compliant shells.
|
||||
StringBuffer command = new StringBuffer(strippedCommand);
|
||||
for (String arg : argumentList) {
|
||||
command.append(" " + arg);
|
||||
}
|
||||
newArgumentList = new String[] { "-c", command.toString() };
|
||||
|
||||
OutputStream stdout = consoleOutStream;
|
||||
OutputStream stderr = consoleOutStream;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.Iterator;
|
|||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
import org.eclipse.ui.IFileEditorInput;
|
||||
import org.eclipse.ui.IURIEditorInput;
|
||||
import org.eclipse.ui.editors.text.TextFileDocumentProvider;
|
||||
|
@ -105,8 +106,7 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
|
|||
public void connect(Object element) throws CoreException {
|
||||
super.connect(element);
|
||||
IMakefile makefile = getWorkingCopy(element);
|
||||
IDocument document = getDocument(element);
|
||||
AutomakeErrorHandler errorHandler = new AutomakeErrorHandler(document);
|
||||
AutomakeErrorHandler errorHandler = new AutomakeErrorHandler((IEditorInput)element);
|
||||
errorHandler.update(makefile);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,9 +34,12 @@ public class AutomakeEditor extends MakefileEditor {
|
|||
private static AutomakeEditor fgInstance;
|
||||
private IEditorInput input;
|
||||
|
||||
static {
|
||||
fgInstance = new AutomakeEditor();
|
||||
}
|
||||
|
||||
public AutomakeEditor() {
|
||||
super();
|
||||
fgInstance = this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -52,9 +52,8 @@ public class AutomakeErrorHandler {
|
|||
|
||||
}
|
||||
|
||||
public AutomakeErrorHandler(IDocument document) {
|
||||
this.document = document;
|
||||
IEditorInput input = AutomakeEditor.getDefault().getEditorInput();
|
||||
public AutomakeErrorHandler(IEditorInput input) {
|
||||
this.document = AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider().getDocument(input);
|
||||
this.fAnnotationModel = (AnnotationModel)AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider().getAnnotationModel(input);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class AutomakefileReconcilingStrategy implements IReconcilingStrategy {
|
|||
input = (IEditorInput) fEditor.getEditorInput();
|
||||
fManager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
|
||||
fDocumentProvider= AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider();
|
||||
fErrorHandler= new AutomakeErrorHandler(fDocumentProvider.getDocument(input));
|
||||
fErrorHandler= new AutomakeErrorHandler(input);
|
||||
fMakefileReconcilingParticipant= (IReconcilingParticipant)fEditor;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ public class AutotoolsBuildWizard extends AbstractCWizard {
|
|||
* @since 5.1
|
||||
*/
|
||||
public static final String EMPTY_PROJECT = AutotoolsWizardMessages.getResourceString("AutotoolsBuildWizard.2"); //$NON-NLS-1$
|
||||
public static final String AUTOTOOLS_TOOLCHAIN_ID = "org.eclipse.linuxtools.cdt.autotools.core.toolChain"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Creates and returns an array of items to be displayed
|
||||
*/
|
||||
|
@ -49,38 +51,50 @@ public class AutotoolsBuildWizard extends AbstractCWizard {
|
|||
IBuildPropertyValue[] vs = bpt.getSupportedValues();
|
||||
Arrays.sort(vs, BuildListComparator.getInstance());
|
||||
ArrayList<EntryDescriptor> items = new ArrayList<EntryDescriptor>();
|
||||
|
||||
// look for Autotools project type
|
||||
|
||||
// look for project types that have a toolchain based on the Autotools toolchain
|
||||
// and if so, add an entry for the project type.
|
||||
// Fix for bug#374026
|
||||
EntryDescriptor oldsRoot = null;
|
||||
SortedMap<String, IProjectType> sm = ManagedBuildManager.getExtensionProjectTypeMap();
|
||||
for (Map.Entry<String, IProjectType> e : sm.entrySet()) {
|
||||
IProjectType pt = e.getValue();
|
||||
if (pt.getId().equals(AUTOTOOLS_PROJECTTYPE_ID)) {
|
||||
AutotoolsBuildWizardHandler h = new AutotoolsBuildWizardHandler(pt, parent, wizard);
|
||||
IToolChain[] tcs = ManagedBuildManager.getExtensionToolChains(pt);
|
||||
for(int i = 0; i < tcs.length; i++){
|
||||
IToolChain t = tcs[i];
|
||||
if(t.isSystemObject())
|
||||
continue;
|
||||
if (!isValid(t, supportedOnly, wizard))
|
||||
continue;
|
||||
AutotoolsBuildWizardHandler h = new AutotoolsBuildWizardHandler(pt, parent, wizard);
|
||||
IToolChain[] tcs = ManagedBuildManager.getExtensionToolChains(pt);
|
||||
for(int i = 0; i < tcs.length; i++){
|
||||
IToolChain t = tcs[i];
|
||||
|
||||
h.addTc(t);
|
||||
IToolChain parent = t;
|
||||
while (parent.getSuperClass() != null) {
|
||||
parent = parent.getSuperClass();
|
||||
}
|
||||
|
||||
String pId = null;
|
||||
if (CDTPrefUtil.getBool(CDTPrefUtil.KEY_OTHERS)) {
|
||||
if (oldsRoot == null) {
|
||||
oldsRoot = new EntryDescriptor(OTHERS_LABEL, null, OTHERS_LABEL, true, null, null);
|
||||
items.add(oldsRoot);
|
||||
}
|
||||
pId = oldsRoot.getId();
|
||||
} else { // do not group to <Others>
|
||||
pId = null;
|
||||
}
|
||||
items.add(new EntryDescriptor(pt.getId(), pId, pt.getName(), true, h, null));
|
||||
if (!parent.getId().equals(AUTOTOOLS_TOOLCHAIN_ID))
|
||||
continue;
|
||||
|
||||
if(t.isSystemObject())
|
||||
continue;
|
||||
if (!isValid(t, supportedOnly, wizard))
|
||||
continue;
|
||||
|
||||
h.addTc(t);
|
||||
}
|
||||
|
||||
String pId = null;
|
||||
if (CDTPrefUtil.getBool(CDTPrefUtil.KEY_OTHERS)) {
|
||||
if (oldsRoot == null) {
|
||||
oldsRoot = new EntryDescriptor(OTHERS_LABEL, null, OTHERS_LABEL, true, null, null);
|
||||
items.add(oldsRoot);
|
||||
}
|
||||
pId = oldsRoot.getId();
|
||||
} else { // do not group to <Others>
|
||||
pId = null;
|
||||
}
|
||||
|
||||
if (h.getToolChainsCount() > 0)
|
||||
items.add(new EntryDescriptor(pt.getId(), pId, pt.getName(), true, h, null));
|
||||
}
|
||||
|
||||
return (EntryDescriptor[])items.toArray(new EntryDescriptor[items.size()]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* IBM - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.make.ui.dialogs;
|
||||
|
||||
|
@ -108,7 +108,7 @@ public abstract class AbstractDiscoveryPage extends DialogPage {
|
|||
private void handleVariablesButtonSelected(Text textField) {
|
||||
String variable = getVariable();
|
||||
if (variable != null) {
|
||||
textField.append(variable);
|
||||
textField.insert(variable);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2010 QNX Software Systems and others.
|
||||
* Copyright (c) 2000, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -407,7 +407,7 @@ public class SettingsBlock extends AbstractCOptionPage {
|
|||
private void handleVariablesButtonSelected(Text textField) {
|
||||
String variable = getVariable();
|
||||
if (variable != null) {
|
||||
textField.append(variable);
|
||||
textField.insert(variable);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -263,6 +263,22 @@ public class PreprocessorBugsTests extends PreprocessorTestsBase {
|
|||
validateProblemCount(2); // the inclusions
|
||||
}
|
||||
|
||||
// #define UNFOLD(v,x) v:x
|
||||
// UNFOLD("A",
|
||||
// #ifdef X
|
||||
// "B")
|
||||
// #else
|
||||
// "C") /* parse error in this line */
|
||||
// #endif
|
||||
public void testDirectiveInExpansion_Bug375739() throws Exception {
|
||||
initializeScanner();
|
||||
validateString("A");
|
||||
validateToken(IToken.tCOLON);
|
||||
validateString("C");
|
||||
validateEOF();
|
||||
validateProblemCount(0);
|
||||
}
|
||||
|
||||
// #if 0xe000
|
||||
// ok
|
||||
// #endif
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
@ -75,11 +75,6 @@ public class CParameter extends PlatformObject implements IParameter {
|
|||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
IASTName name = getPrimaryDeclaration();
|
||||
|
@ -100,6 +95,9 @@ public class CParameter extends PlatformObject implements IParameter {
|
|||
public IScope getScope() {
|
||||
// IASTParameterDeclaration or IASTSimpleDeclaration
|
||||
for (IASTName declaration : declarations) {
|
||||
if (declaration == null)
|
||||
break; // Skip nulls at the end of the declarations array
|
||||
|
||||
IASTNode parent = declaration.getParent();
|
||||
if (parent instanceof ICASTKnRFunctionDeclarator) {
|
||||
parent = parent.getParent();
|
||||
|
@ -120,7 +118,7 @@ public class CParameter extends PlatformObject implements IParameter {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param name the name from a parameter declaration
|
||||
*/
|
||||
public void addDeclaration(IASTName name) {
|
||||
if (name != null && name.isActive())
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
@ -51,7 +50,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.formatter.CodeFormatter;
|
||||
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
|
@ -63,7 +61,6 @@ import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriter;
|
|||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ContainerNode;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ProblemRuntimeException;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.util.FileHelper;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
|
@ -82,10 +79,10 @@ import org.eclipse.text.edits.TextEdit;
|
|||
import org.eclipse.text.edits.TextEditGroup;
|
||||
|
||||
public class ChangeGenerator extends ASTVisitor {
|
||||
private final Map<String, Integer> sourceOffsets = new LinkedHashMap<String, Integer>();
|
||||
private final Map<IASTNode, Map<ModificationKind, List<ASTModification>>> classifiedModifications =
|
||||
new HashMap<IASTNode, Map<ModificationKind, List<ASTModification>>>();
|
||||
private final Map<IFile, MultiTextEdit> changes = new LinkedHashMap<IFile, MultiTextEdit>();
|
||||
private int processedOffset;
|
||||
private MultiTextEdit rootEdit;
|
||||
private CompositeChange change;
|
||||
|
||||
private final ASTModificationStore modificationStore;
|
||||
|
@ -118,20 +115,20 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
generateChange(rootNode, this);
|
||||
}
|
||||
|
||||
public void generateChange(IASTNode rootNode, ASTVisitor pathProvider)
|
||||
private void generateChange(IASTNode rootNode, ASTVisitor pathProvider)
|
||||
throws ProblemRuntimeException {
|
||||
change = new CompositeChange(ChangeGeneratorMessages.ChangeGenerator_compositeChange);
|
||||
classifyModifications();
|
||||
rootNode.accept(pathProvider);
|
||||
for (IFile file : changes.keySet()) {
|
||||
MultiTextEdit edit = changes.get(file);
|
||||
IASTTranslationUnit ast = rootNode.getTranslationUnit();
|
||||
ITranslationUnit tu = (ITranslationUnit) CoreModel.getDefault().create(file);
|
||||
edit = formatChangedCode(edit, ast.getRawSignature(), tu);
|
||||
TextFileChange subchange= ASTRewriteAnalyzer.createCTextFileChange(file);
|
||||
subchange.setEdit(edit);
|
||||
change.add(subchange);
|
||||
}
|
||||
if (rootEdit == null)
|
||||
return;
|
||||
IASTTranslationUnit ast = rootNode.getTranslationUnit();
|
||||
String source = ast.getRawSignature();
|
||||
ITranslationUnit tu = ast.getOriginatingTranslationUnit();
|
||||
formatChangedCode(source, tu);
|
||||
TextFileChange subchange= ASTRewriteAnalyzer.createCTextFileChange((IFile) tu.getResource());
|
||||
subchange.setEdit(rootEdit);
|
||||
change.add(subchange);
|
||||
}
|
||||
|
||||
private void classifyModifications() {
|
||||
|
@ -161,7 +158,7 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
@Override
|
||||
public int visit(IASTTranslationUnit tu) {
|
||||
IASTFileLocation location = tu.getFileLocation();
|
||||
sourceOffsets.put(location.getFileName(), Integer.valueOf(location.getNodeOffset()));
|
||||
processedOffset = location.getNodeOffset();
|
||||
return super.visit(tu);
|
||||
}
|
||||
|
||||
|
@ -317,25 +314,22 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
|
||||
/**
|
||||
* Applies the C++ code formatter to the code affected by refactoring.
|
||||
*
|
||||
* @param multiEdit The text edit produced by refactoring.
|
||||
*
|
||||
* @param code The code being modified.
|
||||
* @param tu The translation unit containing the code.
|
||||
* @return The text edit containing formatted refactoring changes, or the original text edit
|
||||
* in case of errors.
|
||||
*/
|
||||
private MultiTextEdit formatChangedCode(MultiTextEdit multiEdit, String code, ITranslationUnit tu) {
|
||||
private void formatChangedCode(String code, ITranslationUnit tu) {
|
||||
IDocument document = new Document(code);
|
||||
try {
|
||||
// Apply refactoring changes to a temporary document.
|
||||
TextEdit edit = multiEdit.copy();
|
||||
TextEdit edit = rootEdit.copy();
|
||||
edit.apply(document, TextEdit.UPDATE_REGIONS);
|
||||
|
||||
// Expand regions affected by the changes to cover complete lines. We calculate two
|
||||
// sets of regions, reflecting the state of the document before and after
|
||||
// the refactoring changes.
|
||||
TextEdit[] edits = edit.getChildren();
|
||||
TextEdit[] originalEdits = multiEdit.getChildren();
|
||||
TextEdit[] originalEdits = rootEdit.getChildren();
|
||||
IRegion[] regionsAfter = new IRegion[edits.length];
|
||||
IRegion[] regionsBefore = new IRegion[edits.length];
|
||||
int numRegions = 0;
|
||||
|
@ -396,13 +390,11 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
edit = new ReplaceEdit(region.getOffset(), region.getLength(), document.get());
|
||||
resultEdit.addChild(edit);
|
||||
}
|
||||
return resultEdit;
|
||||
rootEdit = resultEdit;
|
||||
} catch (MalformedTreeException e) {
|
||||
CCorePlugin.log(e);
|
||||
return multiEdit;
|
||||
} catch (BadLocationException e) {
|
||||
CCorePlugin.log(e);
|
||||
return multiEdit;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -461,10 +453,9 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
}
|
||||
String code = writer.toString();
|
||||
ReplaceEdit edit = new ReplaceEdit(insertPos, length, code);
|
||||
IFile file = FileHelper.getFileFromNode(anchorNode);
|
||||
MultiTextEdit parentEdit = getEdit(anchorNode, file);
|
||||
parentEdit.addChild(edit);
|
||||
sourceOffsets.put(file.getName(), edit.getOffset());
|
||||
addToRootEdit(anchorNode);
|
||||
rootEdit.addChild(edit);
|
||||
processedOffset = edit.getOffset();
|
||||
}
|
||||
|
||||
private void handleReplace(IASTNode node) {
|
||||
|
@ -474,8 +465,6 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
ChangeGeneratorWriterVisitor writer =
|
||||
new ChangeGeneratorWriterVisitor(modificationStore, commentMap);
|
||||
IASTFileLocation fileLocation = node.getFileLocation();
|
||||
Integer val = sourceOffsets.get(fileLocation.getFileName());
|
||||
int processedOffset = val != null ? val.intValue() : 0;
|
||||
if (modifications.size() == 1 && modifications.get(0).getNewNode() == null) {
|
||||
int offset = getOffsetIncludingComments(node);
|
||||
int endOffset = getEndOffsetIncludingComments(node);
|
||||
|
@ -519,11 +508,9 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
}
|
||||
edit = new ReplaceEdit(offset, endOffset - offset, code);
|
||||
}
|
||||
IFile file = FileHelper.getFileFromNode(node);
|
||||
MultiTextEdit parentEdit = getEdit(node, file);
|
||||
parentEdit.addChild(edit);
|
||||
|
||||
sourceOffsets.put(fileLocation.getFileName(), edit.getExclusiveEnd());
|
||||
addToRootEdit(node);
|
||||
rootEdit.addChild(edit);
|
||||
processedOffset = edit.getExclusiveEnd();
|
||||
}
|
||||
|
||||
private void handleAppends(IASTNode node) {
|
||||
|
@ -551,32 +538,31 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
writer.newLine();
|
||||
}
|
||||
String code = writer.toString();
|
||||
IFile file = FileHelper.getFileFromNode(node);
|
||||
MultiTextEdit parentEdit = getEdit(node, file);
|
||||
addToRootEdit(node);
|
||||
ReplaceEdit edit = new ReplaceEdit(anchor.getOffset(), anchor.getLength(),
|
||||
code + anchor.getText());
|
||||
parentEdit.addChild(edit);
|
||||
rootEdit.addChild(edit);
|
||||
IASTFileLocation fileLocation = node.getFileLocation();
|
||||
sourceOffsets.put(fileLocation.getFileName(), endOffset(fileLocation));
|
||||
processedOffset = endOffset(fileLocation);
|
||||
}
|
||||
|
||||
private void handleAppends(IASTTranslationUnit tu) {
|
||||
List<ASTModification> modifications = getModifications(tu, ModificationKind.APPEND_CHILD);
|
||||
private void handleAppends(IASTTranslationUnit node) {
|
||||
List<ASTModification> modifications = getModifications(node, ModificationKind.APPEND_CHILD);
|
||||
if (modifications.isEmpty())
|
||||
return;
|
||||
|
||||
IASTNode prevNode = null;
|
||||
IASTDeclaration[] declarations = tu.getDeclarations();
|
||||
IASTDeclaration[] declarations = node.getDeclarations();
|
||||
if (declarations.length != 0) {
|
||||
prevNode = declarations[declarations.length - 1];
|
||||
} else {
|
||||
IASTPreprocessorStatement[] preprocessorStatements = tu.getAllPreprocessorStatements();
|
||||
IASTPreprocessorStatement[] preprocessorStatements = node.getAllPreprocessorStatements();
|
||||
if (preprocessorStatements.length != 0) {
|
||||
prevNode = preprocessorStatements[preprocessorStatements.length - 1];
|
||||
}
|
||||
}
|
||||
int offset = prevNode != null ? getEndOffsetIncludingComments(prevNode) : 0;
|
||||
String source = tu.getRawSignature();
|
||||
String source = node.getRawSignature();
|
||||
int endOffset = skipTrailingBlankLines(source, offset);
|
||||
|
||||
ChangeGeneratorWriterVisitor writer =
|
||||
|
@ -597,7 +583,7 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
// TODO(sprigogin): Temporary workaround for invalid handling of line breaks in StatementWriter
|
||||
if (!writer.toString().endsWith("\n")) //$NON-NLS-1$
|
||||
writer.newLine();
|
||||
|
||||
|
||||
}
|
||||
if (prevNode != null) {
|
||||
IASTNode nextNode = getNextSiblingOrPreprocessorNode(prevNode);
|
||||
|
@ -607,16 +593,15 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
}
|
||||
|
||||
String code = writer.toString();
|
||||
IFile file = FileHelper.getFileFromNode(tu);
|
||||
MultiTextEdit parentEdit = getEdit(tu, file);
|
||||
parentEdit.addChild(new ReplaceEdit(offset, endOffset - offset, code));
|
||||
addToRootEdit(node);
|
||||
rootEdit.addChild(new ReplaceEdit(offset, endOffset - offset, code));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of nodes the given node is part of, for example function parameters if
|
||||
* the node is a parameter.
|
||||
*
|
||||
* @param node the node possibly belonging to a list.
|
||||
*
|
||||
* @param node the node possibly belonging to a list.
|
||||
* @return the list of nodes containing the given node, or <code>null</code> if the node
|
||||
* does not belong to a list
|
||||
*/
|
||||
|
@ -630,7 +615,7 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
} else if (node.getPropertyInParent() == ICPPASTFunctionDeclarator.EXCEPTION_TYPEID) {
|
||||
return ((ICPPASTFunctionDeclarator) node.getParent()).getExceptionSpecification();
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -822,7 +807,7 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
* Skips whitespace between the beginning of the line and the given position.
|
||||
*
|
||||
* @param text The text to scan.
|
||||
* @param startPos The start position.
|
||||
* @param startPos The start position.
|
||||
* @return The beginning of the line containing the start position, if there are no
|
||||
* non-whitespace characters between the beginning of the line and the start position.
|
||||
* Otherwise returns the start position.
|
||||
|
@ -842,9 +827,9 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
/**
|
||||
* Skips whitespace between the beginning of the line and the given position and blank lines
|
||||
* above that.
|
||||
*
|
||||
*
|
||||
* @param text The text to scan.
|
||||
* @param startPos The start position.
|
||||
* @param startPos The start position.
|
||||
* @return The beginning of the first blank line preceding the start position,
|
||||
* or beginning of the current line, if there are no non-whitespace characters between
|
||||
* the beginning of the line and the start position.
|
||||
|
@ -867,7 +852,7 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
* below that.
|
||||
*
|
||||
* @param text The text to scan.
|
||||
* @param startPos The start position.
|
||||
* @param startPos The start position.
|
||||
* @return The beginning of the first non-blank line following the start position, if there are
|
||||
* no non-whitespace characters between the start position and the end of the line.
|
||||
* Otherwise returns the start position.
|
||||
|
@ -890,7 +875,7 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
*
|
||||
* @param text The text to scan.
|
||||
* @param delimiter the delimiter to find
|
||||
* @param startPos The start position.
|
||||
* @param startPos The start position.
|
||||
* @return The position of the given delimiter, or the start position if a non-whitespace
|
||||
* character is encountered before the given delimiter.
|
||||
*/
|
||||
|
@ -912,7 +897,7 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
*
|
||||
* @param text The text to scan.
|
||||
* @param delimiter the delimiter to find
|
||||
* @param startPos The start position.
|
||||
* @param startPos The start position.
|
||||
* @return The position after the given delimiter, or the start position if a non-whitespace
|
||||
* character is encountered before the given delimiter.
|
||||
*/
|
||||
|
@ -928,23 +913,20 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
return startPos;
|
||||
}
|
||||
|
||||
private MultiTextEdit getEdit(IASTNode modifiedNode, IFile file) {
|
||||
MultiTextEdit edit = changes.get(file);
|
||||
if (edit == null) {
|
||||
edit = new MultiTextEdit();
|
||||
changes.put(file, edit);
|
||||
private void addToRootEdit(IASTNode modifiedNode) {
|
||||
if (rootEdit == null) {
|
||||
rootEdit = new MultiTextEdit();
|
||||
}
|
||||
TextEditGroup editGroup = new TextEditGroup(ChangeGeneratorMessages.ChangeGenerator_group);
|
||||
for (List<ASTModification> modifications : getModifications(modifiedNode).values()) {
|
||||
for (ASTModification modification : modifications) {
|
||||
if (modification.getAssociatedEditGroup() != null) {
|
||||
editGroup = modification.getAssociatedEditGroup();
|
||||
edit.addChildren(editGroup.getTextEdits());
|
||||
return edit;
|
||||
rootEdit.addChildren(editGroup.getTextEdits());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return edit;
|
||||
}
|
||||
|
||||
private int getOffsetIncludingComments(IASTNode node) {
|
||||
|
|
|
@ -224,7 +224,7 @@ final class ScannerContext {
|
|||
cond.fTakeElse= false;
|
||||
newState= cond.fInitialState;
|
||||
} else if (withinExpansion) {
|
||||
newState= CodeState.eParseInactive;
|
||||
newState= CodeState.eSkipInactive;
|
||||
} else {
|
||||
newState= fInactiveState;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,9 @@ cxxHeaderName=C++ Header File
|
|||
asmSourceName=Assembly Source File
|
||||
binaryFileName=Binary File
|
||||
|
||||
cdt_pathentry_var.description=CDT PathEntry Variable
|
||||
cdt_pathentry_var.description=CDT PathEntry variable
|
||||
config_name_var.description=The name of the active configuration for the project specified as an argument
|
||||
config_description_var.description=The description of the active configuration for the project specified as an argument
|
||||
|
||||
PDOMProviderName=PDOM Provider
|
||||
|
||||
|
|
|
@ -588,6 +588,22 @@
|
|||
description="%cdt_pathentry_var.description">
|
||||
</variable>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.variables.dynamicVariables">
|
||||
<variable
|
||||
name="config_name"
|
||||
resolver="org.eclipse.cdt.internal.core.ConfigurationNameVariableResolver"
|
||||
description="%config_name_var.description">
|
||||
</variable>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.variables.dynamicVariables">
|
||||
<variable
|
||||
name="config_description"
|
||||
resolver="org.eclipse.cdt.internal.core.ConfigurationDescriptionVariableResolver"
|
||||
description="%config_description_var.description">
|
||||
</variable>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.core.CBuildConsole">
|
||||
<CBuildConsole
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2000, 2010 QNX Software Systems and others.
|
||||
# Copyright (c) 2000, 2010, 2012 QNX Software Systems and others.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
|
@ -9,6 +9,7 @@
|
|||
# QNX Software Systems - Initial API and implementation
|
||||
# Markus Schorn (Wind River Systems)
|
||||
# Anton Leherbauer (Wind River Systems)
|
||||
# Anton Gorenkov
|
||||
###############################################################################
|
||||
ACBuilder.ProblemsView.Location=line {0}, external location: {1}
|
||||
CBuilder.build_error= Build Error
|
||||
|
@ -68,6 +69,9 @@ Util.unknownFormat=Unknown debug format
|
|||
|
||||
PathEntryVariableResolver.0=CDT PathEntry variable not specified
|
||||
|
||||
ConfigurationInfoVariableResolver.noProjectName=Project name should be specified as variable argument for '${'{0}'}' variable
|
||||
ConfigurationInfoVariableResolver.wrongProjectName=The "{0}" project referenced by the '${'{1}'}' variable does not exist
|
||||
|
||||
CTagsIndexMarker.fileMissing=CTags output file missing
|
||||
CTagsIndexMarker.CTagsMissing=CTags not installed or not in path
|
||||
DOMIndexerMarker.EmptyScannerInfo=File not indexed because it was not built
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012 Anton Gorenkov and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Anton Gorenkov - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
|
||||
public class ConfigurationDescriptionVariableResolver extends ConfigurationInfoVariableResolver {
|
||||
@Override
|
||||
protected String fetchConfigurationInfo(ICConfigurationDescription configuration) {
|
||||
return configuration.getDescription();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012 Anton Gorenkov and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Anton Gorenkov - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.variables.IDynamicVariable;
|
||||
import org.eclipse.core.variables.IDynamicVariableResolver;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
public abstract class ConfigurationInfoVariableResolver implements IDynamicVariableResolver {
|
||||
@Override
|
||||
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
|
||||
if (argument == null) {
|
||||
String message = NLS.bind(CCorePlugin.getResourceString("ConfigurationInfoVariableResolver.noProjectName"), //$NON-NLS-1$
|
||||
variable.getName());
|
||||
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, message, null));
|
||||
}
|
||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(argument);
|
||||
if (!project.exists()) {
|
||||
String message = NLS.bind(CCorePlugin.getResourceString("ConfigurationInfoVariableResolver.wrongProjectName"), //$NON-NLS-1$
|
||||
argument, variable.getName());
|
||||
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, message, null));
|
||||
}
|
||||
ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(project);
|
||||
return fetchConfigurationInfo(projectDescription.getActiveConfiguration());
|
||||
}
|
||||
|
||||
protected abstract String fetchConfigurationInfo(ICConfigurationDescription configuration);
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012 Anton Gorenkov and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Anton Gorenkov - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
|
||||
public class ConfigurationNameVariableResolver extends ConfigurationInfoVariableResolver {
|
||||
@Override
|
||||
protected String fetchConfigurationInfo(ICConfigurationDescription configuration) {
|
||||
return configuration.getName();
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* QnX Software System
|
||||
* QNX Software Systems
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.corext.template.c;
|
||||
|
@ -28,12 +28,10 @@ import org.eclipse.cdt.core.model.ITranslationUnit;
|
|||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.PreferenceConstants;
|
||||
|
||||
|
||||
/**
|
||||
* A context for C/C++.
|
||||
*/
|
||||
public class CContext extends TranslationUnitContext {
|
||||
|
||||
public class CContext extends TranslationUnitContext {
|
||||
/**
|
||||
* Creates a C/C++ code template context.
|
||||
*
|
||||
|
@ -43,8 +41,8 @@ public class CContext extends TranslationUnitContext {
|
|||
* @param completionLength the length of the context
|
||||
* @param translationUnit the translation unit represented by the document
|
||||
*/
|
||||
public CContext(TemplateContextType type, IDocument document, int completionOffset, int completionLength,
|
||||
ITranslationUnit translationUnit) {
|
||||
public CContext(TemplateContextType type, IDocument document, int completionOffset,
|
||||
int completionLength, ITranslationUnit translationUnit) {
|
||||
super(type, document, completionOffset, completionLength, translationUnit);
|
||||
}
|
||||
|
||||
|
@ -61,31 +59,27 @@ public class CContext extends TranslationUnitContext {
|
|||
super(type, document, completionPosition, translationUnit);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see DocumentTemplateContext#getStart()
|
||||
*/
|
||||
@Override
|
||||
public int getStart() {
|
||||
if (fIsManaged && getCompletionLength() > 0)
|
||||
return super.getStart();
|
||||
|
||||
|
||||
try {
|
||||
IDocument document= getDocument();
|
||||
|
||||
int start= getCompletionOffset();
|
||||
int end= getCompletionOffset() + getCompletionLength();
|
||||
|
||||
while (start != 0 && Character.isUnicodeIdentifierPart(document.getChar(start - 1)))
|
||||
|
||||
while (start != 0 && isUnicodeIdentifierPartOrPoundSign(document.getChar(start - 1)))
|
||||
start--;
|
||||
|
||||
|
||||
while (start != end && Character.isWhitespace(document.getChar(start)))
|
||||
start++;
|
||||
|
||||
|
||||
if (start == end)
|
||||
start= getCompletionOffset();
|
||||
|
||||
return start;
|
||||
|
||||
return start;
|
||||
} catch (BadLocationException e) {
|
||||
return super.getStart();
|
||||
}
|
||||
|
@ -101,25 +95,21 @@ public class CContext extends TranslationUnitContext {
|
|||
|
||||
int start= getCompletionOffset();
|
||||
int end= getCompletionOffset() + getCompletionLength();
|
||||
|
||||
|
||||
while (start != end && Character.isWhitespace(document.getChar(end - 1)))
|
||||
end--;
|
||||
|
||||
return end;
|
||||
|
||||
return end;
|
||||
} catch (BadLocationException e) {
|
||||
return super.getEnd();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @see TemplateContext#evaluate(Template)
|
||||
*/
|
||||
@Override
|
||||
public TemplateBuffer evaluate(Template template) throws BadLocationException, TemplateException {
|
||||
if (!canEvaluate(template))
|
||||
return null;
|
||||
|
||||
|
||||
TemplateTranslator translator= new TemplateTranslator();
|
||||
TemplateBuffer buffer= translator.translate(template.getPattern());
|
||||
|
||||
|
@ -130,10 +120,14 @@ public class CContext extends TranslationUnitContext {
|
|||
|
||||
ICProject project= getCProject();
|
||||
int indentationLevel = isReadOnly() ? 0 : getIndentationLevel();
|
||||
CFormatter formatter= new CFormatter(TextUtilities.getDefaultLineDelimiter(getDocument()), indentationLevel, useCodeFormatter, project);
|
||||
CFormatter formatter= new CFormatter(TextUtilities.getDefaultLineDelimiter(getDocument()),
|
||||
indentationLevel, useCodeFormatter, project);
|
||||
formatter.format(buffer, this);
|
||||
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private boolean isUnicodeIdentifierPartOrPoundSign(char c) {
|
||||
return Character.isUnicodeIdentifierPart(c) || c == '#';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2004, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -70,6 +70,7 @@ import org.eclipse.cdt.internal.ui.preferences.CodeTemplatePreferencePage;
|
|||
import org.eclipse.cdt.internal.ui.viewsupport.IViewPartInputProvider;
|
||||
import org.eclipse.cdt.internal.ui.wizards.NewElementWizardPage;
|
||||
import org.eclipse.cdt.internal.ui.wizards.SourceFolderSelectionDialog;
|
||||
import org.eclipse.cdt.internal.ui.wizards.classwizard.NewClassWizardUtil;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ComboDialogField;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
|
||||
|
@ -82,22 +83,22 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
|
||||
private static final int MAX_FIELD_CHARS = 50;
|
||||
private static final String NO_TEMPLATE = ""; //$NON-NLS-1$
|
||||
|
||||
private IWorkspaceRoot fWorkspaceRoot;
|
||||
|
||||
private final IWorkspaceRoot fWorkspaceRoot;
|
||||
|
||||
// field IDs
|
||||
private static final int SOURCE_FOLDER_ID = 1;
|
||||
protected static final int NEW_FILE_ID = 2;
|
||||
private static final int ALL_FIELDS = SOURCE_FOLDER_ID | NEW_FILE_ID;
|
||||
int fLastFocusedField = 0;
|
||||
private StringButtonDialogField fSourceFolderDialogField;
|
||||
private final StringButtonDialogField fSourceFolderDialogField;
|
||||
private IStatus fSourceFolderStatus;
|
||||
private IStatus fNewFileStatus;
|
||||
private final IStatus STATUS_OK = new StatusInfo();
|
||||
|
||||
|
||||
/**
|
||||
* This flag isFirstTime is used to keep a note
|
||||
* that the file creation wizard has just been
|
||||
* that the file creation wizard has just been
|
||||
* created.
|
||||
*/
|
||||
private boolean isFirstTime = true;
|
||||
|
@ -105,19 +106,19 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
private Template[] fTemplates;
|
||||
|
||||
private ComboDialogField fTemplateDialogField;
|
||||
|
||||
|
||||
public AbstractFileCreationWizardPage(String name) {
|
||||
super(name);
|
||||
|
||||
setDescription(NewFileWizardMessages.AbstractFileCreationWizardPage_description);
|
||||
|
||||
setDescription(NewFileWizardMessages.AbstractFileCreationWizardPage_description);
|
||||
|
||||
fWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
|
||||
|
||||
|
||||
SourceFolderFieldAdapter sourceFolderAdapter = new SourceFolderFieldAdapter();
|
||||
fSourceFolderDialogField = new StringButtonDialogField(sourceFolderAdapter);
|
||||
fSourceFolderDialogField.setDialogFieldListener(sourceFolderAdapter);
|
||||
fSourceFolderDialogField.setLabelText(NewFileWizardMessages.AbstractFileCreationWizardPage_sourceFolder_label);
|
||||
fSourceFolderDialogField.setButtonLabel(NewFileWizardMessages.AbstractFileCreationWizardPage_sourceFolder_button);
|
||||
fSourceFolderDialogField.setLabelText(NewFileWizardMessages.AbstractFileCreationWizardPage_sourceFolder_label);
|
||||
fSourceFolderDialogField.setButtonLabel(NewFileWizardMessages.AbstractFileCreationWizardPage_sourceFolder_button);
|
||||
|
||||
fTemplates= getApplicableTemplates();
|
||||
if (fTemplates != null && fTemplates.length > 0) {
|
||||
|
@ -129,24 +130,24 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
fNewFileStatus = STATUS_OK;
|
||||
fLastFocusedField = 0;
|
||||
}
|
||||
|
||||
|
||||
// -------- UI Creation ---------
|
||||
|
||||
@Override
|
||||
public void createControl(Composite parent) {
|
||||
initializeDialogUnits(parent);
|
||||
|
||||
|
||||
Composite composite = new Composite(parent, SWT.NONE);
|
||||
int nColumns = 3;
|
||||
|
||||
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.numColumns = nColumns;
|
||||
composite.setLayout(layout);
|
||||
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
composite.setFont(parent.getFont());
|
||||
|
||||
|
||||
createSourceFolderControls(composite, nColumns);
|
||||
|
||||
|
||||
createFileControls(composite, nColumns - 1);
|
||||
// Placeholder for the right column.
|
||||
(new Composite(composite, SWT.NO_FOCUS)).setLayoutData(new GridData(1, 1));
|
||||
|
@ -159,15 +160,15 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
setMessage(null);
|
||||
setControl(composite);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a separator line. Expects a <code>GridLayout</code> with at least 1 column.
|
||||
*
|
||||
*
|
||||
* @param composite the parent composite
|
||||
* @param nColumns number of columns to span
|
||||
*/
|
||||
protected void createSeparator(Composite composite, int nColumns) {
|
||||
(new Separator(SWT.SEPARATOR | SWT.HORIZONTAL)).doFillIntoGrid(composite, nColumns, convertHeightInCharsToPixels(1));
|
||||
(new Separator(SWT.SEPARATOR | SWT.HORIZONTAL)).doFillIntoGrid(composite, nColumns, convertHeightInCharsToPixels(1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,7 +176,7 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
* the source folder location. The method expects that the parent composite
|
||||
* uses a <code>GridLayout</code> as its layout manager and that the
|
||||
* grid layout has at least 3 columns.
|
||||
*
|
||||
*
|
||||
* @param parent the parent composite
|
||||
* @param nColumns the number of columns to span. This number must be
|
||||
* greater or equal three
|
||||
|
@ -186,23 +187,23 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
LayoutUtil.setWidthHint(textControl, getMaxFieldWidth());
|
||||
textControl.addFocusListener(new StatusFocusListener(SOURCE_FOLDER_ID));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the controls for the file name field. Expects a <code>GridLayout</code> with at
|
||||
* Creates the controls for the file name field. Expects a <code>GridLayout</code> with at
|
||||
* least 2 columns.
|
||||
*
|
||||
*
|
||||
* @param parent the parent composite
|
||||
* @param nColumns number of columns to span
|
||||
*/
|
||||
*/
|
||||
protected abstract void createFileControls(Composite parent, int nColumns);
|
||||
|
||||
/**
|
||||
* Creates the controls for the file template field. Expects a <code>GridLayout</code> with at
|
||||
* Creates the controls for the file template field. Expects a <code>GridLayout</code> with at
|
||||
* least 3 columns.
|
||||
*
|
||||
*
|
||||
* @param parent the parent composite
|
||||
* @param columns number of columns to span
|
||||
*/
|
||||
*/
|
||||
protected void createTemplateControls(Composite parent, int columns) {
|
||||
if (fTemplateDialogField != null) {
|
||||
fTemplateDialogField.doFillIntoGrid(parent, columns - 1);
|
||||
|
@ -267,7 +268,7 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
|
||||
/**
|
||||
* Returns the selected template and saves its name for future use.
|
||||
*
|
||||
*
|
||||
* @return the selected template or <code>null</code> if none.
|
||||
*/
|
||||
protected Template getTemplate() {
|
||||
|
@ -285,12 +286,12 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The wizard owning this page is responsible for calling this method with the
|
||||
* current selection. The selection is used to initialize the fields of the wizard
|
||||
* current selection. The selection is used to initialize the fields of the wizard
|
||||
* page.
|
||||
*
|
||||
*
|
||||
* @param selection used to initialize the fields
|
||||
*/
|
||||
public void init(IStructuredSelection selection) {
|
||||
|
@ -298,10 +299,10 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
initFields(celem);
|
||||
doStatusUpdate();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Utility method to inspect a selection to find a C element.
|
||||
*
|
||||
* Utility method to inspect a selection to find a C element.
|
||||
*
|
||||
* @param selection the selection to be inspected
|
||||
* @return a C element to be used as the initial selection, or <code>null</code>,
|
||||
* if no C element exists in the given selection
|
||||
|
@ -311,8 +312,8 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
if (selection != null && !selection.isEmpty()) {
|
||||
Object selectedElement = selection.getFirstElement();
|
||||
if (selectedElement instanceof IAdaptable) {
|
||||
IAdaptable adaptable = (IAdaptable) selectedElement;
|
||||
|
||||
IAdaptable adaptable = (IAdaptable) selectedElement;
|
||||
|
||||
celem = (ICElement) adaptable.getAdapter(ICElement.class);
|
||||
if (celem == null) {
|
||||
IResource resource = (IResource) adaptable.getAdapter(IResource.class);
|
||||
|
@ -333,7 +334,7 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
if (part instanceof ContentOutline) {
|
||||
part = CUIPlugin.getActivePage().getActiveEditor();
|
||||
}
|
||||
|
||||
|
||||
if (part instanceof IViewPartInputProvider) {
|
||||
Object elem = ((IViewPartInputProvider)part).getViewPartInput();
|
||||
if (elem instanceof ICElement) {
|
||||
|
@ -351,7 +352,7 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (celem == null || celem.getElementType() == ICElement.C_MODEL) {
|
||||
try {
|
||||
ICProject[] projects = CoreModel.create(getWorkspaceRoot()).getCProjects();
|
||||
|
@ -367,7 +368,7 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
|
||||
/**
|
||||
* Initializes all fields provided by the page with a given selection.
|
||||
*
|
||||
*
|
||||
* @param elem the selection used to initialize this page or <code>
|
||||
* null</code> if no selection was available
|
||||
*/
|
||||
|
@ -379,40 +380,32 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
|
||||
/**
|
||||
* Initializes the source folder field.
|
||||
*
|
||||
*
|
||||
* @param elem the C element used to compute the initial folder
|
||||
*/
|
||||
protected void initSourceFolder(ICElement elem) {
|
||||
ICContainer folder = null;
|
||||
if (elem != null) {
|
||||
folder = CModelUtil.getSourceFolder(elem);
|
||||
if (folder == null) {
|
||||
ICProject cproject = elem.getCProject();
|
||||
if (cproject != null) {
|
||||
try {
|
||||
if (cproject.exists()) {
|
||||
ISourceRoot[] roots = cproject.getSourceRoots();
|
||||
if (roots != null && roots.length > 0)
|
||||
folder = roots[0];
|
||||
}
|
||||
} catch (CModelException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
if (folder == null) {
|
||||
folder = cproject.findSourceRoot(cproject.getResource());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
setSourceFolderFullPath(folder != null ? folder.getResource().getFullPath() : null, false);
|
||||
IPath folderPath = null;
|
||||
if (elem != null) {
|
||||
ICContainer folder = NewClassWizardUtil.getSourceFolder(elem);
|
||||
if (folder == null) {
|
||||
ICProject cproject = elem.getCProject();
|
||||
if (cproject != null) {
|
||||
folder = NewClassWizardUtil.getFirstSourceRoot(cproject);
|
||||
}
|
||||
}
|
||||
if (folder != null) {
|
||||
folderPath = folder.getResource().getFullPath();
|
||||
}
|
||||
}
|
||||
setSourceFolderFullPath(folderPath, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the recommended maximum width for text fields (in pixels). This
|
||||
* method requires that createContent has been called before this method is
|
||||
* call. Subclasses may override to change the maximum width for text
|
||||
* call. Subclasses may override to change the maximum width for text
|
||||
* fields.
|
||||
*
|
||||
*
|
||||
* @return the recommended maximum width for text fields.
|
||||
*/
|
||||
protected int getMaxFieldWidth() {
|
||||
|
@ -424,7 +417,7 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
* when the current editor does not have focus or does not return a text selection.
|
||||
* @return Returns the test selection of the current editor or <code>null</code>.
|
||||
*
|
||||
* @since 3.0
|
||||
* @since 3.0
|
||||
*/
|
||||
protected ITextSelection getCurrentTextSelection() {
|
||||
IWorkbenchPart part = CUIPlugin.getActivePage().getActivePart();
|
||||
|
@ -439,21 +432,21 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the focus to the source folder's text field.
|
||||
*/
|
||||
*/
|
||||
protected void setFocusOnSourceFolder() {
|
||||
fSourceFolderDialogField.setFocus();
|
||||
}
|
||||
|
||||
protected final class StatusFocusListener implements FocusListener {
|
||||
private int fieldID;
|
||||
private final int fieldID;
|
||||
|
||||
public StatusFocusListener(int fieldID) {
|
||||
this.fieldID = fieldID;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
fLastFocusedField = this.fieldID;
|
||||
|
@ -463,7 +456,7 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
}
|
||||
doStatusUpdate();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
fLastFocusedField = 0;
|
||||
|
@ -481,29 +474,29 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
handleFieldChanged(ALL_FIELDS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void dialogFieldChanged(DialogField field) {
|
||||
handleFieldChanged(ALL_FIELDS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------- validation ----------
|
||||
|
||||
|
||||
/**
|
||||
* This method is a hook which gets called after the source folder's
|
||||
* text input field has changed. This default implementation updates
|
||||
* the model and returns an error status. The underlying model
|
||||
* is only valid if the returned status is OK.
|
||||
*
|
||||
*
|
||||
* @return the model's error status
|
||||
*/
|
||||
protected IStatus sourceFolderChanged() {
|
||||
StatusInfo status = new StatusInfo();
|
||||
|
||||
|
||||
IPath folderPath = getSourceFolderFullPath();
|
||||
if (folderPath == null) {
|
||||
status.setError(NewFileWizardMessages.AbstractFileCreationWizardPage_error_EnterSourceFolderName);
|
||||
status.setError(NewFileWizardMessages.AbstractFileCreationWizardPage_error_EnterSourceFolderName);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -513,36 +506,36 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
if (resType == IResource.PROJECT || resType == IResource.FOLDER) {
|
||||
IProject proj = res.getProject();
|
||||
if (!proj.isOpen()) {
|
||||
status.setError(NLS.bind(NewFileWizardMessages.AbstractFileCreationWizardPage_error_NotAFolder, folderPath));
|
||||
status.setError(NLS.bind(NewFileWizardMessages.AbstractFileCreationWizardPage_error_NotAFolder, folderPath));
|
||||
return status;
|
||||
}
|
||||
if (!CoreModel.hasCCNature(proj) && !CoreModel.hasCNature(proj)) {
|
||||
if (resType == IResource.PROJECT) {
|
||||
status.setError(NewFileWizardMessages.AbstractFileCreationWizardPage_warning_NotACProject);
|
||||
status.setError(NewFileWizardMessages.AbstractFileCreationWizardPage_warning_NotACProject);
|
||||
return status;
|
||||
}
|
||||
status.setWarning(NewFileWizardMessages.AbstractFileCreationWizardPage_warning_NotInACProject);
|
||||
status.setWarning(NewFileWizardMessages.AbstractFileCreationWizardPage_warning_NotInACProject);
|
||||
}
|
||||
ICElement e = CoreModel.getDefault().create(res.getFullPath());
|
||||
if (CModelUtil.getSourceFolder(e) == null) {
|
||||
status.setError(NLS.bind(NewFileWizardMessages.AbstractFileCreationWizardPage_error_NotASourceFolder, folderPath));
|
||||
status.setError(NLS.bind(NewFileWizardMessages.AbstractFileCreationWizardPage_error_NotASourceFolder, folderPath));
|
||||
return status;
|
||||
}
|
||||
} else {
|
||||
status.setError(NLS.bind(NewFileWizardMessages.AbstractFileCreationWizardPage_error_NotAFolder, folderPath));
|
||||
status.setError(NLS.bind(NewFileWizardMessages.AbstractFileCreationWizardPage_error_NotAFolder, folderPath));
|
||||
return status;
|
||||
}
|
||||
} else {
|
||||
status.setError(NLS.bind(NewFileWizardMessages.AbstractFileCreationWizardPage_error_FolderDoesNotExist, folderPath));
|
||||
status.setError(NLS.bind(NewFileWizardMessages.AbstractFileCreationWizardPage_error_FolderDoesNotExist, folderPath));
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Hook method that gets called when a field on this page has changed.
|
||||
*
|
||||
*
|
||||
* @param fields Bitwise-OR'd ids of the fields that changed.
|
||||
*/
|
||||
protected void handleFieldChanged(int fields) {
|
||||
|
@ -572,7 +565,7 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
(fSourceFolderStatus != lastStatus) ? fSourceFolderStatus : STATUS_OK,
|
||||
(fNewFileStatus != lastStatus) ? fNewFileStatus : STATUS_OK,
|
||||
};
|
||||
|
||||
|
||||
// the mode severe status will be displayed and the ok button enabled/disabled.
|
||||
updateStatus(status);
|
||||
}
|
||||
|
@ -602,7 +595,7 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
fSourceFolderDialogField.dialogFieldChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected IProject getCurrentProject() {
|
||||
IPath folderPath = getSourceFolderFullPath();
|
||||
if (folderPath != null) {
|
||||
|
@ -613,13 +606,13 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
|
||||
/**
|
||||
* Returns the workspace root.
|
||||
*
|
||||
*
|
||||
* @return the workspace root
|
||||
*/
|
||||
*/
|
||||
protected IWorkspaceRoot getWorkspaceRoot() {
|
||||
return fWorkspaceRoot;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* @see WizardPage#becomesVisible
|
||||
*/
|
||||
|
@ -633,9 +626,9 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
|
||||
/**
|
||||
* Sets the focus on the starting input field.
|
||||
*/
|
||||
*/
|
||||
protected abstract void setFocus();
|
||||
|
||||
|
||||
IPath chooseSourceFolder(IPath initialPath) {
|
||||
ICElement initElement = getSourceFolderFromPath(initialPath);
|
||||
if (initElement instanceof ISourceRoot) {
|
||||
|
@ -644,11 +637,11 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
if (projRoot != null && projRoot.equals(initElement))
|
||||
initElement = cProject;
|
||||
}
|
||||
|
||||
|
||||
SourceFolderSelectionDialog dialog = new SourceFolderSelectionDialog(getShell());
|
||||
dialog.setInput(CoreModel.create(fWorkspaceRoot));
|
||||
dialog.setInitialSelection(initElement);
|
||||
|
||||
|
||||
if (dialog.open() == Window.OK) {
|
||||
Object result = dialog.getFirstResult();
|
||||
if (result instanceof ICElement) {
|
||||
|
@ -690,45 +683,45 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
/**
|
||||
* Returns the full path computed from the file name field
|
||||
* and the source folder.
|
||||
*
|
||||
*
|
||||
* @return the file path
|
||||
*/
|
||||
public abstract IPath getFileFullPath();
|
||||
|
||||
|
||||
/**
|
||||
* Hook method that gets called when the file name has changed. The method validates the
|
||||
* Hook method that gets called when the file name has changed. The method validates the
|
||||
* file name and returns the status of the validation.
|
||||
*
|
||||
*
|
||||
* @return the status of the validation
|
||||
*/
|
||||
protected abstract IStatus fileNameChanged();
|
||||
|
||||
/**
|
||||
* Creates the new file using the entered field values.
|
||||
*
|
||||
*
|
||||
* @param monitor a progress monitor to report progress.
|
||||
* @throws CoreException Thrown when the creation failed.
|
||||
*/
|
||||
public abstract void createFile(IProgressMonitor monitor) throws CoreException;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the created file. The method only returns a valid translation unit
|
||||
* Returns the created file. The method only returns a valid translation unit
|
||||
* after <code>createFile</code> has been called.
|
||||
*
|
||||
*
|
||||
* @return the created translation unit
|
||||
* @see #createFile(IProgressMonitor)
|
||||
*/
|
||||
*/
|
||||
public abstract ITranslationUnit getCreatedFileTU();
|
||||
|
||||
|
||||
/**
|
||||
* @return the name of the template used in the previous dialog invocation, or
|
||||
* the name of the default template.
|
||||
*/
|
||||
public abstract String getDefaultTemplateName();
|
||||
|
||||
|
||||
/**
|
||||
* Saves the name of the last used template.
|
||||
*
|
||||
*
|
||||
* @param name the name of a template, or an empty string for no template.
|
||||
*/
|
||||
public abstract void saveLastUsedTemplateName(String name);
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.TreeSet;
|
|||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.jface.action.ActionContributionItem;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
|
@ -27,6 +28,8 @@ import org.eclipse.jface.viewers.IStructuredSelection;
|
|||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
import org.eclipse.ui.IViewReference;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
|
@ -148,6 +151,27 @@ public class ChangeBuildConfigActionBase {
|
|||
return new ChangeConfigAction(fProjects, sName, builder.toString(), accel + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Class used to efficiently special case the scenario where there's only a single project in the
|
||||
* workspace. See bug 375760
|
||||
*/
|
||||
private static class ImaginarySelection implements ISelection {
|
||||
private IProject fProject;
|
||||
|
||||
ImaginarySelection(IProject project) {
|
||||
fProject = project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return fProject == null;
|
||||
}
|
||||
|
||||
IProject getProject() {
|
||||
return fProject;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* selectionChanged() event handler. Fills the list of managed-built projects
|
||||
* based on the selection. If some non-managed-built projects are selected,
|
||||
|
@ -247,6 +271,9 @@ public class ChangeBuildConfigActionBase {
|
|||
}
|
||||
|
||||
}
|
||||
else if (selection instanceof ImaginarySelection) {
|
||||
fProjects.add(((ImaginarySelection)selection).getProject());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -278,6 +305,52 @@ public class ChangeBuildConfigActionBase {
|
|||
}
|
||||
}
|
||||
action.setEnabled(enable);
|
||||
|
||||
// Bug 375760
|
||||
//
|
||||
// We shouldn't require that the projects view have focus. If the selection switched
|
||||
// to something that doesn't provide us a project context, query any of the three projects/resources
|
||||
// view to see if they have a selection. If so, try again using that selection. We give precedence to
|
||||
// the CDT projects view, then to the project explorer, and finally to the resource navigator
|
||||
//
|
||||
// Also, if the view has no selection, see if the workspace has only one project. If so, we don't need
|
||||
// to rely on the selection mechanism to tell us which project to operate on!
|
||||
//
|
||||
if (badObject || fProjects.isEmpty()) {
|
||||
IWorkbenchPage page = CUIPlugin.getActivePage();
|
||||
if (page != null) {
|
||||
IViewReference viewRef = page.findViewReference("org.eclipse.cdt.ui.CView"); //$NON-NLS-1$
|
||||
if (viewRef == null) {
|
||||
viewRef = page.findViewReference("org.eclipse.ui.navigator.ProjectExplorer"); //$NON-NLS-1$
|
||||
if (viewRef == null) {
|
||||
viewRef = page.findViewReference("org.eclipse.ui.views.ResourceNavigator"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
if (viewRef != null) {
|
||||
IViewPart view = viewRef.getView(false);
|
||||
if (view != null) {
|
||||
ISelection cdtSelection = view.getSite().getSelectionProvider().getSelection();
|
||||
if (cdtSelection != null) {
|
||||
if (cdtSelection.isEmpty()) {
|
||||
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
|
||||
if (projects != null && projects.length == 1) {
|
||||
IProject project = projects[0];
|
||||
if (CoreModel.getDefault().isNewStyleProject(project) && (getCfgs(project).length > 0)) {
|
||||
onSelectionChanged(action, new ImaginarySelection(project));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!cdtSelection.equals(selection)) {
|
||||
onSelectionChanged(action, cdtSelection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ICConfigurationDescription[] getCfgs(IProject prj) {
|
||||
|
|
|
@ -27,7 +27,8 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
|
|||
org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)",
|
||||
org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)",
|
||||
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
|
||||
org.eclipse.core.filesystem;bundle-version="1.2.0"
|
||||
org.eclipse.core.filesystem;bundle-version="1.2.0",
|
||||
org.eclipse.core.variables;bundle-version="3.2.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Import-Package: com.ibm.icu.text
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2011 QNX Software Systems and others.
|
||||
* Copyright (c) 2000, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -52,6 +52,7 @@ import org.eclipse.core.runtime.IStatus;
|
|||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.IStatusHandler;
|
||||
|
@ -542,7 +543,11 @@ public class CDebugUtils {
|
|||
* @since 6.0
|
||||
*/
|
||||
public static String getProgramName(ILaunchConfiguration configuration) throws CoreException {
|
||||
return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
|
||||
String programName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String) null);
|
||||
if (programName != null) {
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
}
|
||||
return programName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2010 Freescale and others.
|
||||
* Copyright (c) 2008, 2012 Freescale and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -24,6 +24,7 @@ import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainer;
|
|||
import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
||||
/**
|
||||
|
@ -159,6 +160,7 @@ public class ProgramRelativePathSourceContainer extends AbstractSourceContainer{
|
|||
if (programName == null) {
|
||||
return fProgramPath; // return empty path
|
||||
}
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
|
||||
// get executable file
|
||||
IFile exeFile = null;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2004, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -33,14 +33,15 @@ import org.eclipse.core.runtime.IStatus;
|
|||
import org.eclipse.core.runtime.MultiStatus;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.model.IProcess;
|
||||
|
||||
public class CDebugAdapter implements ICDIDebugger {
|
||||
|
||||
final ICDebugger fDebugger;
|
||||
|
||||
/**
|
||||
* @param debugger
|
||||
*/
|
||||
|
@ -48,8 +49,7 @@ public class CDebugAdapter implements ICDIDebugger {
|
|||
fDebugger = debugger;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
/* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.debug.core.ICDIDebugger#createDebuggerSession(org.eclipse.debug.core.ILaunch,
|
||||
* org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable,
|
||||
|
@ -93,12 +93,13 @@ public class CDebugAdapter implements ICDIDebugger {
|
|||
String format = "{0} ({1})"; //$NON-NLS-1$
|
||||
String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis()));
|
||||
String message = InternalDebugCoreMessages.getString("CDebugAdapter.1"); //$NON-NLS-1$
|
||||
return MessageFormat.format(format, new String[]{message, timestamp});
|
||||
return MessageFormat.format(format, message, timestamp);
|
||||
}
|
||||
|
||||
protected void abort(String message, Throwable exception, int code) throws CoreException {
|
||||
MultiStatus status = new MultiStatus(CDebugCorePlugin.getUniqueIdentifier(), code, message, exception);
|
||||
status.add(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), code, exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
|
||||
status.add(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), code,
|
||||
exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
|
||||
exception));
|
||||
throw new CoreException(status);
|
||||
}
|
||||
|
@ -123,7 +124,11 @@ public class CDebugAdapter implements ICDIDebugger {
|
|||
}
|
||||
|
||||
public static String getProgramName(ILaunchConfiguration configuration) throws CoreException {
|
||||
return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
|
||||
String programName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String) null);
|
||||
if (programName != null) {
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
}
|
||||
return programName;
|
||||
}
|
||||
|
||||
public static IPath getProgramPath(ILaunchConfiguration configuration) throws CoreException {
|
||||
|
@ -133,5 +138,4 @@ public class CDebugAdapter implements ICDIDebugger {
|
|||
}
|
||||
return new Path(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010 Freescale Semiconductor and others.
|
||||
* Copyright (c) 2010, 2012 Freescale Semiconductor and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -32,6 +32,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
@ -275,6 +276,7 @@ public class CSourceFinder implements ISourceFinder, ILaunchConfigurationListene
|
|||
String programNameConfig = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, ""); //$NON-NLS-1$
|
||||
IProject project = resource.getProject();
|
||||
if (project != null && project.getName().equals(projectNameConfig)) {
|
||||
programNameConfig = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programNameConfig);
|
||||
Path path = new Path(programNameConfig);
|
||||
if (!path.isEmpty()) {
|
||||
IFile file = project.getFile(path);
|
||||
|
|
|
@ -38,7 +38,8 @@ ShowDebuggerConsoleAction.tooltip=Show Debugger Console On Target Selection
|
|||
AddBreakpoint.label=Toggle &Breakpoint\tDouble Click
|
||||
AddBreakpointInteractive.label=&Add Breakpoint...\tCtrl+Double Click
|
||||
EnableBreakpoint.label=&Toggle Breakpoint Enabled\tShift+Double Click
|
||||
BreakpointProperties.label=Breakpoint P&roperties...\tCtrl+Double Click
|
||||
BreakpointProperties.label=Breakpoint P&roperties
|
||||
RulerBreakpointProperties.label=Breakpoint P&roperties...\tCtrl+Double Click
|
||||
BreakpointPropertiesCommand.name=C/C++ Breakpoint Properties
|
||||
BreakpointPropertiesCommand.description=View and edit properties for a given C/C++ breakpoint
|
||||
ManageFunctionBreakpointAction.label=Toggle Breakpoint
|
||||
|
|
|
@ -272,6 +272,17 @@
|
|||
helpContextId="move_to_line_action_context"
|
||||
label="%GlobalMoveToLineAction.label"
|
||||
menubarPath="org.eclipse.ui.run/stepGroup"/>
|
||||
<action
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ToggleInstructionStepModeActionDelegate"
|
||||
helpContextId="toggle_instruction_step_mode_action_context"
|
||||
icon="icons/elcl16/instr_step.gif"
|
||||
id="org.eclipse.cdt.debug.ui.actions.ToggleInstructionStepMode"
|
||||
label="%ToggleInstructionStepModeAction.label"
|
||||
menubarPath="org.eclipse.ui.run/stepGroup"
|
||||
state="false"
|
||||
style="toggle"
|
||||
toolbarPath="org.eclipse.debug.ui.main.toolbar/renderGroup">
|
||||
</action>
|
||||
</actionSet>
|
||||
</extension>
|
||||
<extension
|
||||
|
@ -398,7 +409,6 @@
|
|||
style="toggle"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.ToggleInstructionStepModeActionDelegate"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ToggleInstructionStepModeActionDelegate"
|
||||
enablesFor="1"
|
||||
icon="icons/elcl16/instr_step.gif"
|
||||
helpContextId="toggle_instruction_step_mode_action_context"
|
||||
label="%ToggleInstructionStepModeAction.label"
|
||||
|
@ -416,7 +426,7 @@
|
|||
targetID="#CEditorRulerContext"
|
||||
id="org.eclipse.cdt.debug.ui.CEditorRulerActions">
|
||||
<action
|
||||
label="%BreakpointProperties.label"
|
||||
label="%RulerBreakpointProperties.label"
|
||||
helpContextId="breakpoint_properties_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CBreakpointPropertiesRulerActionDelegate"
|
||||
menubarPath="debug"
|
||||
|
@ -494,7 +504,7 @@
|
|||
targetID="#ASMEditorRulerContext"
|
||||
id="org.eclipse.cdt.debug.ui.AsmEditorRulerActions">
|
||||
<action
|
||||
label="%BreakpointProperties.label"
|
||||
label="%RulerBreakpointProperties.label"
|
||||
helpContextId="breakpoint_properties_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CBreakpointPropertiesRulerActionDelegate"
|
||||
menubarPath="debug"
|
||||
|
@ -897,7 +907,6 @@
|
|||
class="org.eclipse.cdt.debug.internal.ui.actions.ToggleInstructionStepModeActionDelegate"
|
||||
disabledIcon="icons/dlcl16/instr_step.gif"
|
||||
icon="icons/elcl16/instr_step.gif"
|
||||
enablesFor="1"
|
||||
label="%ToggleInstructionStepModeAction.label"
|
||||
helpContextId="toggle_instruction_step_mode_action_context"
|
||||
tooltip="%ToggleInstructionStepModeAction.tooltip">
|
||||
|
@ -1758,7 +1767,15 @@
|
|||
id="org.eclipse.cdt.debug.menu.command.breakpointProperties"
|
||||
label="%BreakpointProperties.label"
|
||||
tooltip="%BreakpointProperties.label">
|
||||
<visibleWhen checkEnabled="true">
|
||||
<visibleWhen>
|
||||
<with variable="selection">
|
||||
<count value="1"/>
|
||||
<iterate>
|
||||
<or>
|
||||
<adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint"/>
|
||||
</or>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
|
@ -1828,9 +1845,7 @@
|
|||
<or>
|
||||
<test property="org.eclipse.cdt.debug.ui.isCEditorSupportsCBreakpoint"/>
|
||||
<test property="org.eclipse.cdt.debug.ui.isAsmEditorSupportsCBreakpoint"/>
|
||||
<test
|
||||
property="org.eclipse.cdt.debug.ui.isDisassemblyEditorSupportsCBreakpoint">
|
||||
</test>
|
||||
<test property="org.eclipse.cdt.debug.ui.isDisassemblyEditorSupportsCBreakpoint" />
|
||||
<with variable="selection">
|
||||
<count value="1"/>
|
||||
<test property="org.eclipse.cdt.debug.ui.isCDeclarationSupportsCBreakpoint"/>
|
||||
|
@ -1849,7 +1864,8 @@
|
|||
</reference>
|
||||
<or>
|
||||
<test property="org.eclipse.cdt.debug.ui.isCEditorSupportsCBreakpoint"/>
|
||||
<test property="org.eclipse.cdt.debug.ui.isAsmEditorSupportsCBreakpoint"/>
|
||||
<test property="org.eclipse.cdt.debug.ui.isAsmEditorSupportsCBreakpoint"/>
|
||||
<test property="org.eclipse.cdt.debug.ui.isDisassemblyEditorSupportsCBreakpoint" />
|
||||
<with variable="selection">
|
||||
<count value="1"/>
|
||||
<test property="org.eclipse.cdt.debug.ui.isCDeclarationSupportsCBreakpoint"/>
|
||||
|
|
|
@ -23,25 +23,33 @@ import org.eclipse.debug.core.model.IDebugElement;
|
|||
import org.eclipse.debug.core.model.IDebugTarget;
|
||||
import org.eclipse.debug.core.model.IDisconnect;
|
||||
import org.eclipse.debug.core.model.ITerminate;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.debug.ui.contexts.DebugContextEvent;
|
||||
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.ui.IViewActionDelegate;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
import org.eclipse.ui.actions.ActionDelegate;
|
||||
|
||||
/**
|
||||
* Turns instruction step mode on/off for selected target.
|
||||
*/
|
||||
public class ToggleInstructionStepModeActionDelegate extends ActionDelegate implements IViewActionDelegate, IPropertyChangeListener {
|
||||
public class ToggleInstructionStepModeActionDelegate extends ActionDelegate
|
||||
implements IViewActionDelegate, IWorkbenchWindowActionDelegate, IPropertyChangeListener, IDebugContextListener
|
||||
{
|
||||
|
||||
private ISteppingModeTarget fTarget = null;
|
||||
|
||||
private IAction fAction = null;
|
||||
|
||||
private IViewPart fView;
|
||||
private IWorkbenchWindow fWindow = null;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
|
||||
|
@ -63,14 +71,22 @@ public class ToggleInstructionStepModeActionDelegate extends ActionDelegate impl
|
|||
*/
|
||||
@Override
|
||||
public void init( IViewPart view ) {
|
||||
fView = view;
|
||||
fWindow = view.getSite().getWorkbenchWindow();
|
||||
DebugUITools.getDebugContextManager().getContextService(fWindow).addDebugContextListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(IWorkbenchWindow window) {
|
||||
fWindow = window;
|
||||
DebugUITools.getDebugContextManager().getContextService(fWindow).addDebugContextListener(this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate2#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
DebugUITools.getDebugContextManager().getContextService(fWindow).removeDebugContextListener(this);
|
||||
ISteppingModeTarget target = getTarget();
|
||||
if ( target != null && target instanceof ITargetProperties ) {
|
||||
((ITargetProperties)target).removePropertyChangeListener( this );
|
||||
|
@ -100,7 +116,10 @@ public class ToggleInstructionStepModeActionDelegate extends ActionDelegate impl
|
|||
target.enableInstructionStepping( enabled );
|
||||
if ( enabled && target instanceof ICDebugTarget ) {
|
||||
try {
|
||||
getView().getSite().getPage().showView( ICDebugUIConstants.ID_DSF_DISASSEMBLY_VIEW );
|
||||
IWorkbenchPage page = fWindow.getActivePage();
|
||||
if (page != null) {
|
||||
page.showView( ICDebugUIConstants.ID_DSF_DISASSEMBLY_VIEW );
|
||||
}
|
||||
}
|
||||
catch( PartInitException e ) {
|
||||
CDebugUIPlugin.log( e.getStatus() );
|
||||
|
@ -117,11 +136,11 @@ public class ToggleInstructionStepModeActionDelegate extends ActionDelegate impl
|
|||
run( action );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
@Override
|
||||
public void selectionChanged( IAction action, ISelection selection ) {
|
||||
public void debugContextChanged(DebugContextEvent event) {
|
||||
if (fAction == null) return;
|
||||
|
||||
ISelection selection = event.getContext();
|
||||
ISteppingModeTarget newTarget = null;
|
||||
if ( selection instanceof IStructuredSelection ) {
|
||||
newTarget = getTargetFromSelection( ((IStructuredSelection)selection).getFirstElement() );
|
||||
|
@ -132,16 +151,16 @@ public class ToggleInstructionStepModeActionDelegate extends ActionDelegate impl
|
|||
((ITargetProperties)oldTarget).removePropertyChangeListener( this );
|
||||
}
|
||||
setTarget( null );
|
||||
action.setChecked( false );
|
||||
fAction.setChecked( false );
|
||||
}
|
||||
if ( newTarget != null && !isTerminated( newTarget ) ) {
|
||||
setTarget( newTarget );
|
||||
if ( newTarget instanceof ITargetProperties ) {
|
||||
((ITargetProperties)newTarget).addPropertyChangeListener( this );
|
||||
}
|
||||
action.setChecked( newTarget.isInstructionSteppingEnabled() );
|
||||
fAction.setChecked( newTarget.isInstructionSteppingEnabled() );
|
||||
}
|
||||
action.setEnabled(
|
||||
fAction.setEnabled(
|
||||
newTarget != null
|
||||
&& newTarget.supportsInstructionStepping()
|
||||
&& !isTerminated( newTarget ) );
|
||||
|
@ -183,8 +202,7 @@ public class ToggleInstructionStepModeActionDelegate extends ActionDelegate impl
|
|||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
private IViewPart getView() {
|
||||
return fView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*****************************************************************
|
||||
* Copyright (c) 2011 Texas Instruments and others
|
||||
* Copyright (c) 2011, 2012 Texas Instruments and others
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* Patrick Chuong (Texas Instruments) -
|
||||
* Update CDT ToggleBreakpointTargetFactory enablement (340177)
|
||||
* Patrick Chuong (Texas Instruments) - Bug 375871
|
||||
*****************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.breakpoints;
|
||||
|
||||
|
@ -20,6 +21,7 @@ import org.eclipse.cdt.core.model.IFunctionDeclaration;
|
|||
import org.eclipse.cdt.core.model.IMethodDeclaration;
|
||||
import org.eclipse.cdt.core.model.IVariableDeclaration;
|
||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditor;
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||
import org.eclipse.cdt.internal.ui.editor.asm.AsmTextEditor;
|
||||
import org.eclipse.core.expressions.PropertyTester;
|
||||
|
@ -87,12 +89,13 @@ public class ToggleCBreakpointTester extends PropertyTester {
|
|||
return true; // can't figure the associated project, enable it by default.
|
||||
}
|
||||
}
|
||||
} else if ("isDisassemblyEditorSupportsCBreakpoint".equals(property) && (receiver instanceof DisassemblyEditor)) { //$NON-NLS-1$
|
||||
if (!CDebugUtils.isCustomToggleBreakpointFactory())
|
||||
return true;
|
||||
// No additional check is required, the check for the receiver is enough.
|
||||
|
||||
// test for IVariableDeclaration, IFunctionDeclaration, IMethodDeclaration
|
||||
} else if ("isCDeclarationSupportsCBreakpoint".equals(property) && (receiver instanceof List<?>)) { //$NON-NLS-1$
|
||||
if (!CDebugUtils.isCustomToggleBreakpointFactory())
|
||||
return true;
|
||||
|
||||
List<?> list = (List<?>) receiver;
|
||||
if (list.size() == 1) {
|
||||
Object element = list.get(0);
|
||||
|
@ -100,6 +103,9 @@ public class ToggleCBreakpointTester extends PropertyTester {
|
|||
(element instanceof IVariableDeclaration ||
|
||||
element instanceof IFunctionDeclaration ||
|
||||
element instanceof IMethodDeclaration)) {
|
||||
|
||||
if (!CDebugUtils.isCustomToggleBreakpointFactory())
|
||||
return true;
|
||||
|
||||
IDeclaration cElement = (IDeclaration) element;
|
||||
|
||||
|
|
4
doc/org.eclipse.cdt.doc.isv/.gitignore
vendored
4
doc/org.eclipse.cdt.doc.isv/.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
/cdtconvert.txt
|
||||
.metadata
|
||||
cdtconvert.txt
|
||||
reference
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
/extension-points
|
||||
api
|
||||
extension-points
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2010 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* IBM Corporation
|
||||
* Ericsson - Updated for DSF
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* IBM Corporation
|
||||
* Ericsson - Updated for DSF
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||
|
||||
|
@ -142,7 +142,8 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
|
|||
protected void handleVariablesButtonSelected(Text textField) {
|
||||
String variable = getVariable();
|
||||
if (variable != null) {
|
||||
textField.append(variable);
|
||||
// We should use insert() but not append() to be consistent with the Platform behavior (e.g. Common tab)
|
||||
textField.insert(variable);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2008, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - bug 178731
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - bug 178731
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||
|
||||
|
@ -26,6 +26,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
|
||||
|
@ -54,6 +55,9 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
|
|||
try {
|
||||
projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
|
||||
programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
|
||||
if (programName != null) {
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
if (projectName != null && !projectName.equals("")) { //$NON-NLS-1$
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* IBM Corporation
|
||||
* Marc Khouzam (Ericsson) - Support setting the path in which the core file
|
||||
* dialog should start (Bug 362039)
|
||||
* Anton Gorenkov
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||
|
||||
|
@ -139,7 +140,6 @@ public class CMainTab extends CAbstractMainTab {
|
|||
protected void createExeFileGroup(Composite parent, int colSpan) {
|
||||
Composite mainComp = new Composite(parent, SWT.NONE);
|
||||
GridLayout mainLayout = new GridLayout();
|
||||
mainLayout.numColumns = 3;
|
||||
mainLayout.marginHeight = 0;
|
||||
mainLayout.marginWidth = 0;
|
||||
mainComp.setLayout(mainLayout);
|
||||
|
@ -149,7 +149,6 @@ public class CMainTab extends CAbstractMainTab {
|
|||
fProgLabel = new Label(mainComp, SWT.NONE);
|
||||
fProgLabel.setText(LaunchMessages.getString("CMainTab.C/C++_Application")); //$NON-NLS-1$
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 3;
|
||||
fProgLabel.setLayoutData(gd);
|
||||
fProgText = new Text(mainComp, SWT.SINGLE | SWT.BORDER);
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
|
@ -161,7 +160,17 @@ public class CMainTab extends CAbstractMainTab {
|
|||
}
|
||||
});
|
||||
|
||||
fSearchButton = createPushButton(mainComp, LaunchMessages.getString("CMainTab.Search..."), null); //$NON-NLS-1$
|
||||
Composite buttonComp = new Composite(mainComp, SWT.NONE);
|
||||
GridLayout layout = new GridLayout(3, false);
|
||||
layout.marginHeight = 0;
|
||||
layout.marginWidth = 0;
|
||||
buttonComp.setLayout(layout);
|
||||
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
|
||||
buttonComp.setLayoutData(gd);
|
||||
buttonComp.setFont(parent.getFont());
|
||||
|
||||
createVariablesButton(buttonComp, LaunchMessages.getString("CMainTab.Variables"), fProgText); //$NON-NLS-1$
|
||||
fSearchButton = createPushButton(buttonComp, LaunchMessages.getString("CMainTab.Search..."), null); //$NON-NLS-1$
|
||||
fSearchButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent evt) {
|
||||
|
@ -171,7 +180,7 @@ public class CMainTab extends CAbstractMainTab {
|
|||
});
|
||||
|
||||
Button browseForBinaryButton;
|
||||
browseForBinaryButton = createPushButton(mainComp, LaunchMessages.getString("Launch.common.Browse_2"), null); //$NON-NLS-1$
|
||||
browseForBinaryButton = createPushButton(buttonComp, LaunchMessages.getString("Launch.common.Browse_2"), null); //$NON-NLS-1$
|
||||
browseForBinaryButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent evt) {
|
||||
|
@ -444,6 +453,11 @@ public class CMainTab extends CAbstractMainTab {
|
|||
|
||||
if (!fDontCheckProgram) {
|
||||
String programName = fProgText.getText().trim();
|
||||
try {
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
} catch (CoreException e) {
|
||||
// Silently ignore substitution failure (for consistency with "Arguments" and "Work directory" fields)
|
||||
}
|
||||
if (programName.length() == 0) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Program_not_specified")); //$NON-NLS-1$
|
||||
return false;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Ericsson - Updated for DSF
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Ericsson - Updated for DSF
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||
|
||||
|
@ -239,7 +239,7 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
|
|||
protected void handleWorkingDirVariablesButtonSelected() {
|
||||
String variableText = getVariable();
|
||||
if (variableText != null) {
|
||||
fWorkingDirText.append(variableText);
|
||||
fWorkingDirText.insert(variableText);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2008, 2010 QNX Software Systems and others.
|
||||
# Copyright (c) 2008, 2012 QNX Software Systems and others.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
|
@ -94,6 +94,7 @@ CMainTab.CoreFile_type=Core file
|
|||
CMainTab.TraceFile_type=Trace file
|
||||
CMainTab.CoreFile_path=Core file (leave blank or select root directory to trigger prompt):
|
||||
CMainTab.TraceFile_path=Trace data file (leave blank or select root directory to trigger prompt):
|
||||
CMainTab.Variables=&Variables...
|
||||
CMainTab.Search...=Searc&h Project...
|
||||
CMainTab.Choose_program_to_run=Choose a &program to run:
|
||||
CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2011 Ericsson and others.
|
||||
* Copyright (c) 2010, 2012 Ericsson and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -105,7 +105,8 @@ public class LaunchUtils {
|
|||
abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_not_specified"), null, //$NON-NLS-1$
|
||||
ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
|
||||
}
|
||||
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
|
||||
IPath programPath = new Path(programName);
|
||||
if (programPath.isEmpty()) {
|
||||
abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_does_not_exist"), null, //$NON-NLS-1$
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.junit.runners.Suite;
|
|||
* want to run. When creating a new test class, it should be
|
||||
* added to the list below.
|
||||
*
|
||||
* This suite is for tests to be run with GDB 7.4
|
||||
* This suite is for tests to be run with GDB 7.4.
|
||||
*/
|
||||
|
||||
@RunWith(Suite.class)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 - 2010 QNX Software Systems and others.
|
||||
* Copyright (c) 2007, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,11 +8,11 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Andy Jin - Hardware debugging UI improvements, bug 229946
|
||||
* Anna Dushistova(MontaVista) - bug 241279
|
||||
* Anna Dushistova (MontaVista) - bug 241279
|
||||
* - Hardware Debugging: Host name or ip address not saving in
|
||||
* the debug configuration
|
||||
* Andy Jin (QNX) - Added DSF debugging, bug 248593
|
||||
* Bruce Griffith,Sage Electronic Engineering, LLC - bug 305943
|
||||
* Bruce Griffith, Sage Electronic Engineering, LLC - bug 305943
|
||||
* - API generalization to become transport-independent (e.g. to
|
||||
* allow connections via serial ports and pipes).
|
||||
*******************************************************************************/
|
||||
|
@ -141,7 +141,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
private void variablesButtonSelected(Text text) {
|
||||
StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
|
||||
if (dialog.open() == StringVariableSelectionDialog.OK) {
|
||||
text.append(dialog.getVariableExpression());
|
||||
text.insert(dialog.getVariableExpression());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 - 2010 QNX Software Systems and others.
|
||||
* Copyright (c) 2007, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Andy Jin - Hardware debugging UI improvements, bug 229946
|
||||
* Anna Dushistova(MontaVista) - bug 241279
|
||||
* Anna Dushistova (MontaVista) - bug 241279
|
||||
* - Hardware Debugging: Host name or ip address not saving in
|
||||
* the debug configuration
|
||||
* Andy Jin (QNX) - Added DSF debugging, bug 248593
|
||||
|
@ -139,7 +139,7 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(
|
||||
getShell());
|
||||
if (dialog.open() == StringVariableSelectionDialog.OK) {
|
||||
text.append(dialog.getVariableExpression());
|
||||
text.insert(dialog.getVariableExpression());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2011 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -60,6 +60,7 @@ import org.eclipse.core.runtime.Path;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
@ -645,6 +646,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
|
|||
|
||||
if (configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_AUTO, false)) {
|
||||
String programPath = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STR);
|
||||
programPath = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programPath);
|
||||
ICConfigurationDescription buildConfig = LaunchUtils.getBuildConfigByProgramPath(buildProject, programPath);
|
||||
if (buildConfig != null)
|
||||
buildConfigID = buildConfig.getId();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2011 Nokia and others.
|
||||
* Copyright (c) 2010, 2012 Nokia and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -43,6 +43,7 @@ import org.eclipse.core.runtime.MultiStatus;
|
|||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
@ -253,6 +254,7 @@ public abstract class AbstractCLaunchDelegate2 extends LaunchConfigurationDelega
|
|||
// If automatic configuration detection then discover the build config corresponding to the executable
|
||||
if (configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_AUTO, false)) {
|
||||
String programPath = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, ""); //$NON-NLS-1$
|
||||
programPath = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programPath);
|
||||
ICConfigurationDescription buildConfig = LaunchUtils.getBuildConfigByProgramPath(project, programPath);
|
||||
if (buildConfig != null)
|
||||
buildConfigID = buildConfig.getId();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2004, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -75,6 +75,7 @@ public class LaunchMessages extends NLS {
|
|||
public static String CMainTab_ProjectColon;
|
||||
public static String CMainTab_C_Application;
|
||||
public static String CMainTab_CoreFile_path;
|
||||
public static String CMainTab_Variables;
|
||||
public static String CMainTab_Search;
|
||||
public static String CMainTab_Choose_program_to_run;
|
||||
public static String CMainTab_Choose_program_to_run_from_NAME;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2002, 2010 QNX Software Systems and others.
|
||||
# Copyright (c) 2002, 2012 QNX Software Systems and others.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# QNX Software Systems - Initial API and implementation
|
||||
# QNX Software Systems - Initial API and implementation
|
||||
# Monta Vista - Joanne Woo - Bug 87556
|
||||
# Nokia - Ken Ryall - Bug 118894
|
||||
# Carlos O'Donnel (CodeSourcery) - Bug 218366
|
||||
# IBM Corporation
|
||||
# Sergey Prigogin (Google)
|
||||
# Nokia - Ken Ryall - Bug 118894
|
||||
# Carlos O'Donnel (CodeSourcery) - Bug 218366
|
||||
# IBM Corporation
|
||||
# Sergey Prigogin (Google)
|
||||
###############################################################################
|
||||
|
||||
AbstractCLaunchDelegate_Debugger_not_installed=CDT Debugger not installed
|
||||
|
@ -81,6 +81,7 @@ CMainTab_Main=Main
|
|||
CMainTab_ProjectColon=&Project:
|
||||
CMainTab_C_Application=C/C++ Application:
|
||||
CMainTab_CoreFile_path=Core file (leave blank to trigger prompt):
|
||||
CMainTab_Variables=&Variables...
|
||||
CMainTab_Search=Searc&h Project...
|
||||
CMainTab_Choose_program_to_run=Choose a &program to run:
|
||||
CMainTab_Choose_program_to_run_from_NAME=Choose a program to run from {0}:
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.launch.internal.ui;
|
||||
|
||||
|
@ -26,7 +26,6 @@ import org.eclipse.core.variables.IStringVariableManager;
|
|||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.debug.ui.StringVariableSelectionDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.accessibility.AccessibleAdapter;
|
||||
import org.eclipse.swt.accessibility.AccessibleEvent;
|
||||
|
@ -83,8 +82,6 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
|
|||
handleWorkingDirBrowseButtonSelected();
|
||||
} else if (source == fUseDefaultWorkingDirButton) {
|
||||
handleUseDefaultWorkingDirButtonSelected();
|
||||
} else if (source == fVariablesButton) {
|
||||
handleWorkingDirVariablesButtonSelected();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,8 +145,7 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
|
|||
fFileSystemButton = createPushButton(buttonComp, LaunchMessages.WorkingDirectoryBlock_1, null);
|
||||
fFileSystemButton.addSelectionListener(fListener);
|
||||
|
||||
fVariablesButton = createPushButton(buttonComp, LaunchMessages.WorkingDirectoryBlock_17, null);
|
||||
fVariablesButton.addSelectionListener(fListener);
|
||||
fVariablesButton = createVariablesButton(buttonComp, LaunchMessages.WorkingDirectoryBlock_17, null);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -234,19 +230,6 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
|
|||
fFileSystemButton.setEnabled(!def);
|
||||
}
|
||||
|
||||
protected void handleWorkingDirVariablesButtonSelected() {
|
||||
String variableText = getVariable();
|
||||
if (variableText != null) {
|
||||
fWorkingDirText.append(variableText);
|
||||
}
|
||||
}
|
||||
|
||||
private String getVariable() {
|
||||
StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
|
||||
dialog.open();
|
||||
return dialog.getVariableExpression();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default working directory
|
||||
*/
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* IBM Corporation
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.launch.ui;
|
||||
|
||||
|
@ -20,15 +20,12 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||
import org.eclipse.debug.ui.StringVariableSelectionDialog;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.accessibility.AccessibleAdapter;
|
||||
import org.eclipse.swt.accessibility.AccessibleEvent;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
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;
|
||||
|
@ -120,43 +117,12 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
|
|||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
fArgumentVariablesButton= createPushButton(group, LaunchMessages.CArgumentsTab_Variables, null);
|
||||
fArgumentVariablesButton= createVariablesButton(group, LaunchMessages.CArgumentsTab_Variables, fPrgmArgumentsText);
|
||||
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
|
||||
fArgumentVariablesButton.setLayoutData(gd);
|
||||
fArgumentVariablesButton.addSelectionListener(new SelectionAdapter() {
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
|
||||
*/
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent arg0) {
|
||||
handleVariablesButtonSelected(fPrgmArgumentsText);
|
||||
}
|
||||
});
|
||||
addControlAccessibleListener(fArgumentVariablesButton, fArgumentVariablesButton.getText()); // need to strip the mnemonic from buttons
|
||||
}
|
||||
|
||||
/**
|
||||
* A variable entry button has been pressed for the given text
|
||||
* field. Prompt the user for a variable and enter the result
|
||||
* in the given field.
|
||||
*/
|
||||
protected void handleVariablesButtonSelected(Text textField) {
|
||||
String variable = getVariable();
|
||||
if (variable != null) {
|
||||
textField.append(variable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompts the user to choose and configure a variable and returns
|
||||
* the resulting string, suitable to be used as an attribute.
|
||||
*/
|
||||
private String getVariable() {
|
||||
StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
|
||||
dialog.open();
|
||||
return dialog.getVariableExpression();
|
||||
}
|
||||
|
||||
public void addControlAccessibleListener(Control control, String controlName) {
|
||||
//strip mnemonic (&)
|
||||
String[] strs = controlName.split("&"); //$NON-NLS-1$
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=118894
|
||||
* IBM Corporation
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=118894
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.launch.ui;
|
||||
|
||||
|
@ -35,6 +35,7 @@ import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
|
|||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
|
@ -375,6 +376,9 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
try {
|
||||
projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
|
||||
programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
|
||||
if (programName != null) {
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
if (programName != null) {
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - bug 178731
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - bug 178731
|
||||
* Anton Gorenkov
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.launch.ui;
|
||||
|
||||
|
@ -26,11 +27,18 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
|
||||
import org.eclipse.debug.ui.StringVariableSelectionDialog;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IFileEditorInput;
|
||||
|
@ -54,6 +62,9 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
|
|||
try {
|
||||
projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
|
||||
programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
|
||||
if (programName != null) {
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
if (projectName != null && !projectName.equals("")) { //$NON-NLS-1$
|
||||
|
@ -160,4 +171,44 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
|
|||
return platform;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a button that allows user to insert build variables.
|
||||
*
|
||||
* @since 7.0
|
||||
*/
|
||||
protected Button createVariablesButton(Composite parent, String label, final Text textField) {
|
||||
Button variablesButton = createPushButton(parent, label, null);
|
||||
variablesButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent arg0) {
|
||||
handleVariablesButtonSelected(textField);
|
||||
}
|
||||
});
|
||||
return variablesButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* A variable entry button has been pressed for the given text
|
||||
* field. Prompt the user for a variable and enter the result
|
||||
* in the given field.
|
||||
*/
|
||||
private void handleVariablesButtonSelected(Text textField) {
|
||||
String variable = getVariable();
|
||||
if (variable != null) {
|
||||
// We should use insert() but not append() to be consistent with the Platform behavior (e.g. Common tab)
|
||||
textField.insert(variable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompts the user to choose and configure a variable and returns
|
||||
* the resulting string, suitable to be used as an attribute.
|
||||
*/
|
||||
private String getVariable() {
|
||||
StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
|
||||
dialog.open();
|
||||
return dialog.getVariableExpression();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2010 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,6 +10,7 @@
|
|||
* Ken Ryall (Nokia) - bug 178731
|
||||
* IBM Corporation
|
||||
* Sergey Prigogin (Google)
|
||||
* Anton Gorenkov
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.launch.ui;
|
||||
|
||||
|
@ -31,6 +32,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
|
@ -343,7 +345,6 @@ public class CMainTab extends CAbstractMainTab {
|
|||
protected void createExeFileGroup(Composite parent, int colSpan) {
|
||||
Composite mainComp = new Composite(parent, SWT.NONE);
|
||||
GridLayout mainLayout = new GridLayout();
|
||||
mainLayout.numColumns = 3;
|
||||
mainLayout.marginHeight = 0;
|
||||
mainLayout.marginWidth = 0;
|
||||
mainComp.setLayout(mainLayout);
|
||||
|
@ -353,7 +354,6 @@ public class CMainTab extends CAbstractMainTab {
|
|||
fProgLabel = new Label(mainComp, SWT.NONE);
|
||||
fProgLabel.setText(LaunchMessages.CMainTab_C_Application);
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 3;
|
||||
fProgLabel.setLayoutData(gd);
|
||||
fProgText = new Text(mainComp, SWT.SINGLE | SWT.BORDER);
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
|
@ -365,7 +365,17 @@ public class CMainTab extends CAbstractMainTab {
|
|||
}
|
||||
});
|
||||
|
||||
fSearchButton = createPushButton(mainComp, LaunchMessages.CMainTab_Search, null);
|
||||
Composite buttonComp = new Composite(mainComp, SWT.NONE);
|
||||
GridLayout layout = new GridLayout(3, false);
|
||||
layout.marginHeight = 0;
|
||||
layout.marginWidth = 0;
|
||||
buttonComp.setLayout(layout);
|
||||
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
|
||||
buttonComp.setLayoutData(gd);
|
||||
buttonComp.setFont(parent.getFont());
|
||||
|
||||
createVariablesButton(buttonComp, LaunchMessages.CMainTab_Variables, fProgText);
|
||||
fSearchButton = createPushButton(buttonComp, LaunchMessages.CMainTab_Search, null);
|
||||
fSearchButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent evt) {
|
||||
|
@ -375,7 +385,7 @@ public class CMainTab extends CAbstractMainTab {
|
|||
});
|
||||
|
||||
Button fBrowseForBinaryButton;
|
||||
fBrowseForBinaryButton = createPushButton(mainComp, LaunchMessages.Launch_common_Browse_2, null);
|
||||
fBrowseForBinaryButton = createPushButton(buttonComp, LaunchMessages.Launch_common_Browse_2, null);
|
||||
fBrowseForBinaryButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent evt) {
|
||||
|
@ -432,6 +442,11 @@ public class CMainTab extends CAbstractMainTab {
|
|||
}
|
||||
|
||||
name = fProgText.getText().trim();
|
||||
try {
|
||||
name = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(name);
|
||||
} catch (CoreException e) {
|
||||
// Silently ignore substitution failure (for consistency with "Arguments" and "Work directory" fields)
|
||||
}
|
||||
if (name.length() == 0) {
|
||||
setErrorMessage(LaunchMessages.CMainTab_Program_not_specified);
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue