Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorMikhail Sennikovsky2006-05-05 10:29:16 +0000
committerMikhail Sennikovsky2006-05-05 10:29:16 +0000
commit20a29763988ce97d6fdec77f5b733db5be459cf7 (patch)
treecc5e87834b7e85be3799f4bbdd97aae7ae078cda /build
parent34a2d013f9a77ff0b577f240b30fae4c52e514dd (diff)
downloadorg.eclipse.cdt-20a29763988ce97d6fdec77f5b733db5be459cf7.tar.gz
org.eclipse.cdt-20a29763988ce97d6fdec77f5b733db5be459cf7.tar.xz
org.eclipse.cdt-20a29763988ce97d6fdec77f5b733db5be459cf7.zip
Fix for browsing workspace functionality in the FileListControl
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/NewBuildMacroDialog.java2
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPreferenceStore.java12
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControl.java71
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControlFieldEditor.java11
4 files changed, 50 insertions, 46 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/NewBuildMacroDialog.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/NewBuildMacroDialog.java
index 5bc67ea7f79..dd4293c4a60 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/NewBuildMacroDialog.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/NewBuildMacroDialog.java
@@ -236,6 +236,8 @@ public class NewBuildMacroDialog extends StatusDialog {
/* Enable workspace support for list editor */
fListEditor.setWorkspaceSupport(true);
+ fListEditor.setContext(fMacrosBlock.getContextInfo());
+
if(fEditedMacro != null){
loadMacroSettings(fEditedMacro,true);
fMacroNameEdit.setEnabled(false);
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPreferenceStore.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPreferenceStore.java
index e11cb2141be..73c28f18f18 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPreferenceStore.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPreferenceStore.java
@@ -18,6 +18,7 @@ import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.Option;
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
@@ -25,9 +26,12 @@ import org.eclipse.cdt.managedbuilder.internal.macros.DefaultMacroSubstitutor;
import org.eclipse.cdt.managedbuilder.internal.macros.IMacroContextInfo;
import org.eclipse.cdt.managedbuilder.internal.macros.MacroResolver;
import org.eclipse.cdt.managedbuilder.internal.macros.MbsMacroSupplier;
+import org.eclipse.cdt.managedbuilder.internal.ui.MacrosSetBlock;
+import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuildOptionBlock;
import org.eclipse.cdt.managedbuilder.internal.ui.ToolsSettingsBlock;
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacro;
+import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.ListenerList;
@@ -220,7 +224,7 @@ public class BuildToolSettingsPreferenceStore implements IPreferenceStore {
null,
EMPTY_STRING,
WHITESPACE,
- block.obtainMacroProvider())),
+ obtainMacroProvider())),
WHITESPACE);
} catch (BuildException e) {
}
@@ -236,6 +240,12 @@ public class BuildToolSettingsPreferenceStore implements IPreferenceStore {
return getDefaultString(name);
}
+ public BuildMacroProvider obtainMacroProvider(){
+ if(block != null)
+ return block.obtainMacroProvider();
+ return (BuildMacroProvider)ManagedBuildManager.getBuildMacroProvider();
+ }
+
public static String listToString(String[] items) {
return listToString(items,DEFAULT_SEPERATOR);
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControl.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControl.java
index 69c130eac24..f4b7ef1f9f9 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControl.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControl.java
@@ -17,14 +17,11 @@ import java.util.Iterator;
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
-import org.eclipse.cdt.managedbuilder.core.IBuildObject;
-import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.managedbuilder.core.IToolChain;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData;
+import org.eclipse.cdt.managedbuilder.internal.macros.DefaultMacroSubstitutor;
+import org.eclipse.cdt.managedbuilder.internal.macros.IMacroContextInfo;
+import org.eclipse.cdt.managedbuilder.internal.macros.MacroResolver;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIImages;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
@@ -141,15 +138,13 @@ public class FileListControl {
IResource resource = null;
currentPathText = getText().getText();
- if(option != null && holder != null){
+ if(contextInfo != null){
try {
- currentPathText = ManagedBuildManager.getBuildMacroProvider().
- resolveValue(
- currentPathText,
- "", //$NON-NLS-1$
- " ", //$NON-NLS-1$
- IBuildMacroProvider.CONTEXT_OPTION,
- new OptionContextData(option, holder));
+ currentPathText =
+ MacroResolver.resolveToString(currentPathText,
+ new DefaultMacroSubstitutor(contextInfo ,
+ "", //$NON-NLS-1$
+ " ")); //$NON-NLS-1$
} catch (BuildMacroException e) {
}
}
@@ -160,13 +155,7 @@ public class FileListControl {
/* Resolve variables */
IStringVariableManager variableManager =
VariablesPlugin.getDefault().getStringVariableManager();
-/*
- try {
- currentPathText = variableManager.performStringSubstitution(
- currentPathText, false);
- } catch (CoreException e)
- {}
-*/
+
/* Remove workspace location prefix (if any) */
path = new Path(currentPathText);
IPath workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation();
@@ -180,18 +169,8 @@ public class FileListControl {
if (!path.toString().trim().equals("")) { //$NON-NLS-1$
resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
}
- if (resource == null){
- if(holder instanceof ITool){
- IBuildObject bo = ((ITool)holder).getParent();
- if(bo instanceof IResourceConfiguration){
- resource = ((IResourceConfiguration)bo).getParent().getOwner();
- } else if(bo instanceof IToolChain){
- resource = ((IToolChain)bo).getParent().getOwner();
- }
- } else if(holder instanceof IToolChain){
- resource = ((IToolChain)holder).getParent().getOwner();
- }
- }
+ if (resource == null)
+ resource = rc;
/* Create workspace folder/file selection dialog and
* set initial selection */
@@ -237,7 +216,7 @@ public class FileListControl {
if (resource != null) {
getText().setText(variableManager.generateVariableExpression(WORKSPACELOC_VAR,
- resource.getFullPath().toOSString()));
+ resource.getFullPath().toString()));
}
}
@@ -335,8 +314,8 @@ public class FileListControl {
/* Workspace support */
private boolean fWorkspaceSupport = false;
- private IOption option;
- private IHoldsOptions holder;
+ private IMacroContextInfo contextInfo;
+ private IResource rc;
private java.util.List listeners = new ArrayList();
private String oldValue[];
@@ -754,16 +733,22 @@ public class FileListControl {
public void setWorkspaceSupport(boolean enable) {
fWorkspaceSupport = enable;
}
-
+
/**
- * Set the project the field editor was created for.
+ * Set the field editor context.
* @param project
*/
- public void setContext(IOption option, IHoldsOptions holder) {
- this.option = option;
- this.holder = holder;
+ public void setContext(IMacroContextInfo info) {
+ contextInfo = info;
+ for(;info != null;info = info.getNext()){
+ if(info.getContextType() == IBuildMacroProvider.CONTEXT_PROJECT){
+ IManagedProject mngProj = (IManagedProject)info.getContextData();
+ this.rc = mngProj.getOwner();
+ break;
+ }
+ }
}
-
+
/**
* Returns the input dialog string
*
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControlFieldEditor.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControlFieldEditor.java
index ffec5811b62..ed7e5efa161 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControlFieldEditor.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControlFieldEditor.java
@@ -18,6 +18,8 @@ import java.util.StringTokenizer;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IOption;
+import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData;
+import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -205,9 +207,14 @@ public class FileListControlFieldEditor extends FieldEditor {
/* Enable workspace support for list and set project */
list.setWorkspaceSupport(true);
if (store instanceof BuildToolSettingsPreferenceStore){
- Object[] option = ((BuildToolSettingsPreferenceStore)store).getOption(getPreferenceName());
+ BuildToolSettingsPreferenceStore btsStore = ((BuildToolSettingsPreferenceStore)store);
+ Object[] option = btsStore.getOption(getPreferenceName());
if(option != null){
- list.setContext((IOption)option[1], (IHoldsOptions)option[0]);
+ list.setContext(
+ btsStore.obtainMacroProvider().getMacroContextInfo(
+ IBuildMacroProvider.CONTEXT_OPTION,
+ new OptionContextData((IOption)option[1],
+ (IHoldsOptions)option[0])));
}
}
}

Back to the top