Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Hirsl2005-02-01 15:15:40 +0000
committerVladimir Hirsl2005-02-01 15:15:40 +0000
commit1ba71c339b023ddafadb02540fe9a6771e51bd16 (patch)
tree1c3ca6b4887e614d235d5c4f2e17fe910e2b2388 /build/org.eclipse.cdt.make.ui
parentf33bcba3fa90d20e23af0d5de9c4812923c2349a (diff)
downloadorg.eclipse.cdt-1ba71c339b023ddafadb02540fe9a6771e51bd16.tar.gz
org.eclipse.cdt-1ba71c339b023ddafadb02540fe9a6771e51bd16.tar.xz
org.eclipse.cdt-1ba71c339b023ddafadb02540fe9a6771e51bd16.zip
Further SCD profile work.
Definition of 'per file' profile and profile options page and initial implementation.
Diffstat (limited to 'build/org.eclipse.cdt.make.ui')
-rw-r--r--build/org.eclipse.cdt.make.ui/plugin.properties1
-rw-r--r--build/org.eclipse.cdt.make.ui/plugin.xml7
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties20
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryOptionsBlock.java132
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryPage.java119
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java107
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveryOptionsBlock.java68
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java281
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java128
9 files changed, 590 insertions, 273 deletions
diff --git a/build/org.eclipse.cdt.make.ui/plugin.properties b/build/org.eclipse.cdt.make.ui/plugin.properties
index 265d5518376..622752a6386 100644
--- a/build/org.eclipse.cdt.make.ui/plugin.properties
+++ b/build/org.eclipse.cdt.make.ui/plugin.properties
@@ -69,3 +69,4 @@ ProjectPathProperties.name=C/C++ Project Paths
DiscoveredScannerInfoContainer.name=Discovered scanner configuration container
GCCPerProjectProfile.name=GCC per project scanner info profile
+GCCPerFileProfile.name=GCC per file scanner info profile
diff --git a/build/org.eclipse.cdt.make.ui/plugin.xml b/build/org.eclipse.cdt.make.ui/plugin.xml
index c779593c414..548f90188ab 100644
--- a/build/org.eclipse.cdt.make.ui/plugin.xml
+++ b/build/org.eclipse.cdt.make.ui/plugin.xml
@@ -534,4 +534,11 @@
class="org.eclipse.cdt.make.ui.dialogs.GCCPerProjectSCDProfilePage"
name="%GCCPerProjectProfile.name"
profileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+ </extension>
+ <extension
+ point="org.eclipse.cdt.make.ui.DiscoveryProfilePage">
+ <profilePage
+ class="org.eclipse.cdt.make.ui.dialogs.GCCPerFileSCDProfilePage"
+ name="%GCCPerFileProfile.name"
+ profileId="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"/>
</extension></plugin>
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties
index 70bacd27e84..10b5761d98e 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties
@@ -217,29 +217,11 @@ ManageDefinedSymbolsDialog.discoveredGroup.title=Discovered symbol definitions
# --- ScannerConfigOptionsDialog ---
ScannerConfigOptionsDialog.title=Discovery Options
ScannerConfigOptionsDialog.description=Set the scanner configuration discovery options for this project
-ScannerConfigOptionsDialog.label.missingBuilderInformation=Builder is missing or disabled on project.
-ScannerConfigOptionsDialog.scGroup.label=Automated discovery of paths and symbols
-ScannerConfigOptionsDialog.scGroup.enabled.label=Automate discovery of paths and symbols
-ScannerConfigOptionsDialog.scGroup.selectedProfile.label=Discovery profile:
-ScannerConfigOptionsDialog.siBuilder.parser.group_label=Build output parser options
-ScannerConfigOptionsDialog.siBuilder.parser.enable.label=Enable build output parser
-ScannerConfigOptionsDialog.siBuilder.parser.label=Make build output parser:
-ScannerConfigOptionsDialog.siProvider.cmd.group_label=Generate scanner info command options
-ScannerConfigOptionsDialog.siProvider.cmd.enable.label=Enable generate scanner info command
-ScannerConfigOptionsDialog.siProvider.cmd.use_default=Use default
-ScannerConfigOptionsDialog.siProvider.cmd.label=Generate scanner info command:
-ScannerConfigOptionsDialog.siProvider.parser.label=Command output parser:
-ScannerConfigOptionsDialog.siProvider.cmd.error_message=Must enter a 'generate scanner info' command
-ScannerConfigOptionsDialog.siProblem.group.label=Discovery problem reporting
-ScannerConfigOptionsDialog.siProblem.generation.enable.label=Report path detection problems
-
-ScannerConfigOptionsDialog.title=Discovery Options
-ScannerConfigOptionsDialog.description=Set the scanner configuration discovery options for this project
ScannerConfigOptionsDialog.scGroup.label=Automated discovery of paths and symbols
ScannerConfigOptionsDialog.scGroup.enabled.button=Automate discovery of paths and symbols
ScannerConfigOptionsDialog.scGroup.problemReporting.enabled.button=Report path detection problems
ScannerConfigOptionsDialog.scGroup.selectedProfile.combo=Discovery profile:
-ScannerConfigOptionsDialog.boProvider.group.label=Discovery profile options
+ScannerConfigOptionsDialog.profile.group.label=Discovery profile options
ScannerConfigOptionsDialog.boProvider.parser.enabled.button=Enable build output scanner info discovery
ScannerConfigOptionsDialog.boProvider.open.label=Load build output from file
ScannerConfigOptionsDialog.boProvider.browse.button=Browse...
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryOptionsBlock.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryOptionsBlock.java
index 9f081d561b3..892a5ff52f7 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryOptionsBlock.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryOptionsBlock.java
@@ -16,12 +16,18 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
+import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.ui.dialogs.ICOptionPage;
+import org.eclipse.cdt.make.internal.ui.preferences.TabFolderLayout;
+import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
+import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.widgets.Composite;
@@ -30,30 +36,64 @@ import org.eclipse.swt.widgets.Composite;
*
* @author vhirsl
*/
-public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPage {
+public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage {
+ private Preferences fPrefs;
+ private IScannerConfigBuilderInfo2 fBuildInfo;
+ private boolean fInitialized = false;
+
private Map fProfilePageMap = null;
// Composite parent provided by the block.
private Composite fCompositeParent;
- private ICOptionPage fCurrentPage;
+ private AbstractDiscoveryPage fCurrentPage;
/**
+ * @return Returns the project.
+ */
+ protected IProject getProject() {
+ return getContainer().getProject();
+ }
+ /**
+ * @return Returns the fPrefs.
+ */
+ protected Preferences getPrefs() {
+ return fPrefs;
+ }
+ /**
+ * @return Returns the fBuildInfo.
+ */
+ protected IScannerConfigBuilderInfo2 getBuildInfo() {
+ return fBuildInfo;
+ }
+ /**
+ * @return Returns the fInitialized.
+ */
+ protected boolean isInitialized() {
+ return fInitialized;
+ }
+ /**
+ * @param initialized The fInitialized to set.
+ */
+ protected void setInitialized(boolean initialized) {
+ fInitialized = initialized;
+ }
+ /**
* Create a profile page only on request
*
* @author vhirsl
*/
protected static class DiscoveryProfilePageConfiguration {
- ICOptionPage page;
+ AbstractDiscoveryPage page;
IConfigurationElement fElement;
public DiscoveryProfilePageConfiguration(IConfigurationElement element) {
fElement = element;
}
- public ICOptionPage getPage() throws CoreException {
+ public AbstractDiscoveryPage getPage() throws CoreException {
if (page == null) {
- page = (ICOptionPage) fElement.createExecutableExtension("class"); //$NON-NLS-1$
+ page = (AbstractDiscoveryPage) fElement.createExecutableExtension("class"); //$NON-NLS-1$
}
return page;
}
@@ -95,13 +135,73 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPag
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#setContainer(org.eclipse.cdt.ui.dialogs.ICOptionContainer)
+ */
+ public void setContainer(ICOptionContainer container) {
+ super.setContainer(container);
+
+ fPrefs = getContainer().getPreferences();
+ IProject project = getContainer().getProject();
+
+ fInitialized = true;
+ if (project != null) {
+ try {
+ fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
+ } catch (CoreException e) {
+ // missing builder information (builder disabled or legacy project)
+ fInitialized = false;
+ fBuildInfo = null;
+ }
+ } else {
+ fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, false);
+ }
+ }
+
+ protected void updateContainer() {
+ getContainer().updateContainer();
+ }
+
+ /**
+ * @param project
+ */
+ protected void createBuildInfo() {
+ if (getProject() != null) {
+ try {
+ // get the project properties
+ fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(getProject());
+ }
+ catch (CoreException e) {
+ fBuildInfo = null;
+ }
+ }
+ else {
+ // get the preferences
+ fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, false);
+ }
+ }
+
+ /**
+ * Create build info based on preferences
+ */
+ protected void createDefaultBuildInfo() {
+ // Populate with the default values
+ if (getProject() != null) {
+ // get the preferences
+ fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, false);
+ } else {
+ // get the defaults
+ fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, true);
+ }
+ }
+
protected Composite getCompositeParent() {
return fCompositeParent;
}
protected void setCompositeParent(Composite parent) {
fCompositeParent = parent;
-// fCompositeParent.setLayout(new TabFolderLayout());
+ fCompositeParent.setLayout(new TabFolderLayout());
}
/* (non-Javadoc)
@@ -122,31 +222,32 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPag
return;
}
String profileId = getCurrentProfileId();
- ICOptionPage page = getDiscoveryProfilePage(profileId);
+ AbstractDiscoveryPage page = getDiscoveryProfilePage(profileId);
if (page != null) {
if (page.getControl() == null) {
Composite parent = getCompositeParent();
- page.setContainer(getContainer());
+ page.setContainer(this);
page.createControl(parent);
parent.layout(true);
- } else {
- page.setVisible(false);
+ }
+ if (fCurrentPage != null) {
+ fCurrentPage.setVisible(false);
}
page.setVisible(true);
}
setCurrentPage(page);
}
- protected ICOptionPage getCurrentPage() {
+ protected AbstractDiscoveryPage getCurrentPage() {
return fCurrentPage;
}
- protected void setCurrentPage(ICOptionPage page) {
+ protected void setCurrentPage(AbstractDiscoveryPage page) {
fCurrentPage = page;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#isValid()
+ * @see org.eclipse.cdt.ui.dialogs.AbstractDiscoveryPage#isValid()
*/
public boolean isValid() {
return (getCurrentPage() == null) ? true : getCurrentPage().isValid();
@@ -159,7 +260,7 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPag
return getCurrentPage().getErrorMessage();
}
- protected ICOptionPage getDiscoveryProfilePage(String profileId) {
+ protected AbstractDiscoveryPage getDiscoveryProfilePage(String profileId) {
DiscoveryProfilePageConfiguration configElement =
(DiscoveryProfilePageConfiguration) fProfilePageMap.get(profileId);
if (configElement != null) {
@@ -196,4 +297,5 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractDiscoveryPag
}
protected abstract String getCurrentProfileId();
+
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryPage.java
index 5b7c7074a37..92a233772c1 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryPage.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryPage.java
@@ -10,14 +10,8 @@
***********************************************************************/
package org.eclipse.cdt.make.ui.dialogs;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
-import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
-import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
-import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.resource.ImageDescriptor;
/**
@@ -25,13 +19,25 @@ import org.eclipse.jface.resource.ImageDescriptor;
*
* @author vhirsl
*/
-public abstract class AbstractDiscoveryPage extends AbstractCOptionPage {
+public abstract class AbstractDiscoveryPage extends DialogPage {
+ protected static final String PREFIX = "ScannerConfigOptionsDialog"; //$NON-NLS-1$
+ protected static final String PROFILE_GROUP_LABEL = PREFIX + ".profile.group.label"; //$NON-NLS-1$
- private Preferences fPrefs;
- private IScannerConfigBuilderInfo2 fBuildInfo;
- private boolean fInitialized = false;
+ protected AbstractDiscoveryOptionsBlock fContainer;
/**
+ * @return Returns the fContainer.
+ */
+ protected AbstractDiscoveryOptionsBlock getContainer() {
+ return fContainer;
+ }
+ /**
+ * @param container The fContainer to set.
+ */
+ protected void setContainer(AbstractDiscoveryOptionsBlock container) {
+ fContainer = container;
+ }
+ /**
*
*/
public AbstractDiscoveryPage() {
@@ -53,89 +59,20 @@ public abstract class AbstractDiscoveryPage extends AbstractCOptionPage {
super(title, image);
}
- /**
- * @return Returns the fPrefs.
- */
- protected Preferences getPrefs() {
- return fPrefs;
- }
- /**
- * @return Returns the fBuildInfo.
- */
- protected IScannerConfigBuilderInfo2 getBuildInfo() {
- return fBuildInfo;
- }
- /**
- * @return Returns the fInitialized.
- */
- protected boolean isInitialized() {
- return fInitialized;
- }
- /**
- * @param initialized The fInitialized to set.
- */
- protected void setInitialized(boolean initialized) {
- fInitialized = initialized;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#setContainer(org.eclipse.cdt.ui.dialogs.ICOptionContainer)
- */
- public void setContainer(ICOptionContainer container) {
- super.setContainer(container);
+ protected abstract boolean isValid();
+ protected abstract void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo);
+ protected abstract void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo);
+
+ public void performApply() {
+ IScannerConfigBuilderInfo2 buildInfo = getContainer().getBuildInfo();
- fPrefs = getContainer().getPreferences();
- IProject project = getContainer().getProject();
-
- fInitialized = true;
- if (project != null) {
- try {
- fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
- } catch (CoreException e) {
- // missing builder information (builder disabled or legacy project)
- fInitialized = false;
- fBuildInfo = null;
- }
- } else {
- fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, false);
- }
- }
-
- /**
- * Create build info based on project properties
- * @param project
- * @return
- */
- protected IScannerConfigBuilderInfo2 createBuildInfo(IProject project) {
- IScannerConfigBuilderInfo2 bi = null;
- if (project != null) {
- try {
- bi = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
- } catch (CoreException e) {
- // disabled builder... just log it
- MakeCorePlugin.log(e);
- }
- }
- else {
- bi = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, false);
- }
- return bi;
+ populateBuildInfo(buildInfo);
}
- /**
- * Create build info based on preferences
- * @return
- */
- protected IScannerConfigBuilderInfo2 createBuildInfo() {
- IScannerConfigBuilderInfo2 bi = null;
- // Populate with the default values
- if (getContainer().getProject() != null) {
- // get the preferences
- bi = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, false);
- } else {
- // get the defaults
- bi = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, true);
- }
- return bi;
+ public void performDefaults() {
+ IScannerConfigBuilderInfo2 buildInfo = getContainer().getBuildInfo();
+
+ restoreFromBuildinfo(buildInfo);
}
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java
index 57e85f690a3..94fbf2dcae3 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java
@@ -30,11 +30,12 @@ import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathContainer;
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
-import org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector;
import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
@@ -558,57 +559,59 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
private boolean deleteEntry() {
boolean rc = false;
- List newSelection = new ArrayList();
- List selElements = fDiscoveredContainerList.getSelectedElements();
- for (int i = 0; i < selElements.size(); ++i) {
- DiscoveredElement elem = (DiscoveredElement) selElements.get(i);
- if (elem.getEntryKind() != DiscoveredElement.CONTAINER) {
- DiscoveredElement parent = elem.getParent();
- if (parent != null) {
- Object[] children = parent.getChildren();
- if (elem.delete()) {
- // ScannerInfoCollector collector = ScannerInfoCollector.getInstance();
- IProject project = fCProject.getProject();
- SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
- getSCProfileInstance(project, ScannerConfigProfileManager.NULL_PROFILE_ID); // use selected profile for the project
- PerProjectSICollector collector = (PerProjectSICollector) profileInstance.getScannerInfoCollector();
- switch (elem.getEntryKind()) {
- case DiscoveredElement.PATHS_GROUP:
- collector.deleteAllPaths(project);
- break;
- case DiscoveredElement.SYMBOLS_GROUP:
- collector.deleteAllSymbols(project);
- break;
- case DiscoveredElement.INCLUDE_PATH:
- collector.deletePath(project, elem.getEntry());
- break;
- case DiscoveredElement.SYMBOL_DEFINITION:
- collector.deleteSymbol(project, elem.getEntry());
- break;
- }
- rc = true;
- // set new selection
- for (int j = 0; j < children.length; ++j) {
- DiscoveredElement child = (DiscoveredElement) children[j];
- if (elem.equals(child)) {
- newSelection.clear();
- if (j + 1 < children.length) {
- newSelection.add(children[j + 1]);
- }
- else if (j - 1 >= 0) {
- newSelection.add(children[j - 1]);
- }
- else {
- newSelection.add(parent);
- }
- break;
- }
- }
- }
- }
- }
- }
- fDiscoveredContainerList.postSetSelection(new StructuredSelection(newSelection));
+ IProject project = fCProject.getProject();
+ SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
+ getSCProfileInstance(project, ScannerConfigProfileManager.NULL_PROFILE_ID); // use selected profile for the project
+ IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
+ if (collector instanceof IScannerInfoCollectorUtil) {
+ IScannerInfoCollectorUtil collectorUtil = (IScannerInfoCollectorUtil) collector;
+ List newSelection = new ArrayList();
+ List selElements = fDiscoveredContainerList.getSelectedElements();
+ for (int i = 0; i < selElements.size(); ++i) {
+ DiscoveredElement elem = (DiscoveredElement) selElements.get(i);
+ if (elem.getEntryKind() != DiscoveredElement.CONTAINER) {
+ DiscoveredElement parent = elem.getParent();
+ if (parent != null) {
+ Object[] children = parent.getChildren();
+ if (elem.delete()) {
+ switch (elem.getEntryKind()) {
+ case DiscoveredElement.PATHS_GROUP:
+ collectorUtil.deleteAllPaths(project);
+ break;
+ case DiscoveredElement.SYMBOLS_GROUP:
+ collectorUtil.deleteAllSymbols(project);
+ break;
+ case DiscoveredElement.INCLUDE_PATH:
+ collectorUtil.deletePath(project, elem.getEntry());
+ break;
+ case DiscoveredElement.SYMBOL_DEFINITION:
+ collectorUtil.deleteSymbol(project, elem.getEntry());
+ break;
+ }
+ rc = true;
+ // set new selection
+ for (int j = 0; j < children.length; ++j) {
+ DiscoveredElement child = (DiscoveredElement) children[j];
+ if (elem.equals(child)) {
+ newSelection.clear();
+ if (j + 1 < children.length) {
+ newSelection.add(children[j + 1]);
+ }
+ else if (j - 1 >= 0) {
+ newSelection.add(children[j - 1]);
+ }
+ else {
+ newSelection.add(parent);
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ fDiscoveredContainerList.postSetSelection(new StructuredSelection(newSelection));
+ }
return rc;
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveryOptionsBlock.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveryOptionsBlock.java
index 642b5b3742c..a2cf95ba7e9 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveryOptionsBlock.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveryOptionsBlock.java
@@ -15,9 +15,6 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.ICDescriptorOperation;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject;
@@ -28,6 +25,7 @@ import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigNature;
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathContainer;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
+import org.eclipse.cdt.make.internal.ui.preferences.TabFolderLayout;
import org.eclipse.cdt.make.ui.IMakeHelpContextIds;
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
@@ -120,16 +118,13 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
// Create a group for scanner config discovery
if (createScannerConfigControls(scComp, tabColumns)) {
// create a composite for discovery profile options
- profileComp = ControlFactory.createComposite(composite, 1);
+ profileComp = new Composite(composite, SWT.NULL);
// ((GridLayout)profileComp.getLayout()).marginHeight = 5;
// ((GridLayout)profileComp.getLayout()).marginWidth = 5;
// ((GridLayout)profileComp.getLayout()).verticalSpacing = 5;
profileComp.setFont(font);
- GridData gd = (GridData) profileComp.getLayoutData();
- gd.grabExcessHorizontalSpace = true;
- // gd.grabExcessVerticalSpace = true;
- gd.horizontalAlignment = GridData.FILL;
- gd.verticalAlignment = GridData.FILL;
+ profileComp.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+ profileComp.setLayout(new TabFolderLayout());
// Must set the composite parent to super class.
setCompositeParent(profileComp);
@@ -196,7 +191,12 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
((GridData)label.getLayoutData()).grabExcessHorizontalSpace = false;
profileComboBox = new Combo(scGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
-
+ profileComboBox.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ getBuildInfo().setSelectedProfileId(getCurrentProfileId());
+ handleDiscoveryProfileChanged();
+ }
+ });
// fill the combobox and set the initial value
for (Iterator items = getDiscoveryProfileIdList().iterator(); items.hasNext();) {
String profileId = (String)items.next();
@@ -252,33 +252,21 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
// init buildInfo
final IProject project = getContainer().getProject();
// Create new build info in case of new C++ project wizard
- final IScannerConfigBuilderInfo2 buildInfo = createBuildInfo(project);
+ createBuildInfo();
- if (buildInfo != null) {
- populateBuildInfo(buildInfo);
- buildInfo.store();
+ if (getBuildInfo() != null) {
+ populateBuildInfo(getBuildInfo());
monitor.worked(1);
if (scEnabledButton.getSelection()) {
- getCurrentPage().performApply(monitor);
+ getCurrentPage().performApply();
}
monitor.worked(1);
if (project != null) {
configureProject(project, monitor);
- ICDescriptorOperation op = new ICDescriptorOperation() {
-
- public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
- buildInfo.save();
- }
-
- };
- CCorePlugin.getDefault().getCDescriptorManager().
- runDescriptorOperation(project, op, monitor);
- }
- else {
- buildInfo.save();
}
+ getBuildInfo().save();
}
monitor.done();
}
@@ -321,10 +309,12 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
}
private void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) {
- buildInfo.setAutoDiscoveryEnabled(scEnabledButton.getSelection());
- String profileName = profileComboBox.getItem(profileComboBox.getSelectionIndex());
- buildInfo.setSelectedProfileId(getDiscoveryProfileId(profileName));
- buildInfo.setProblemReportingEnabled(scProblemReportingEnabledButton.getSelection());
+ if (buildInfo != null) {
+ buildInfo.setAutoDiscoveryEnabled(scEnabledButton.getSelection());
+ String profileName = profileComboBox.getItem(profileComboBox.getSelectionIndex());
+ buildInfo.setSelectedProfileId(getDiscoveryProfileId(profileName));
+ buildInfo.setProblemReportingEnabled(scProblemReportingEnabledButton.getSelection());
+ }
}
/* (non-Javadoc)
@@ -336,19 +326,23 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
// Missing builder info on a non-legacy project
return;
}
- IScannerConfigBuilderInfo2 buildInfo = createBuildInfo();
+ createDefaultBuildInfo();
- restoreFromBuildinfo(buildInfo);
+ restoreFromBuildinfo(getBuildInfo());
enableAllControls();
getCurrentPage().performDefaults();
+
+ handleDiscoveryProfileChanged();
}
private void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
- scEnabledButton.setSelection(buildInfo.isAutoDiscoveryEnabled());
- String profileId = buildInfo.getSelectedProfileId();
- profileComboBox.setText(getDiscoveryProfileName(profileId));
- scProblemReportingEnabledButton.setSelection(buildInfo.isProblemReportingEnabled());
+ if (buildInfo != null) {
+ scEnabledButton.setSelection(buildInfo.isAutoDiscoveryEnabled());
+ String profileId = buildInfo.getSelectedProfileId();
+ profileComboBox.setText(getDiscoveryProfileName(profileId));
+ scProblemReportingEnabledButton.setSelection(buildInfo.isProblemReportingEnabled());
+ }
}
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java
new file mode 100644
index 00000000000..20dc4548749
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java
@@ -0,0 +1,281 @@
+/***********************************************************************
+ * Copyright (c) 2004 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
+ ***********************************************************************/
+package org.eclipse.cdt.make.ui.dialogs;
+
+import java.io.File;
+
+import org.eclipse.cdt.internal.ui.util.SWTUtil;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
+import org.eclipse.cdt.make.internal.core.scannerconfig.jobs.BuildOutputReaderJob;
+import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.swt.SWT;
+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.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * SCD per project profile property/preference page
+ *
+ * @author vhirsl
+ */
+public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage {
+ private static final int DEFAULT_HEIGHT = 60;
+
+ private static final String BO_PROVIDER_PARSER_ENABLED_BUTTON = PREFIX + ".boProvider.parser.enabled.button"; //$NON-NLS-1$
+ private static final String BO_PROVIDER_OPEN_LABEL = PREFIX + ".boProvider.open.label"; //$NON-NLS-1$
+ private static final String BO_PROVIDER_BROWSE_BUTTON = PREFIX + ".boProvider.browse.button"; //$NON-NLS-1$
+ private static final String BO_PROVIDER_OPEN_FILE_DIALOG = PREFIX + ".boProvider.browse.openFileDialog"; //$NON-NLS-1$
+ private static final String BO_PROVIDER_LOAD_BUTTON = PREFIX + ".boProvider.load.button"; //$NON-NLS-1$
+
+ private Button bopEnabledButton;
+ private Text bopOpenFileText;
+ private Button bopLoadButton;
+
+ // thread syncronization
+ private static Object lock = GCCPerFileSCDProfilePage.class;
+ private Shell shell;
+ private static GCCPerFileSCDProfilePage instance;
+ private static boolean loadButtonInitialEnabled = true;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite page = ControlFactory.createComposite(parent, 1);
+// ((GridData) page.getLayoutData()).grabExcessVerticalSpace = true;
+// ((GridData) page.getLayoutData()).verticalAlignment = GridData.FILL;
+
+ // Add the profile UI contribution.
+ Group profileGroup = ControlFactory.createGroup(page,
+ MakeUIPlugin.getResourceString(PROFILE_GROUP_LABEL), 3);
+
+ GridData gd = (GridData) profileGroup.getLayoutData();
+ gd.grabExcessHorizontalSpace = true;
+// PixelConverter converter = new PixelConverter(profileGroup);
+// gd.heightHint = converter.convertVerticalDLUsToPixels(DEFAULT_HEIGHT);
+ ((GridLayout) profileGroup.getLayout()).makeColumnsEqualWidth = false;
+
+ // Add bop enabled checkbox
+ bopEnabledButton = ControlFactory.createCheckBox(profileGroup,
+ MakeUIPlugin.getResourceString(BO_PROVIDER_PARSER_ENABLED_BUTTON));
+// bopEnabledButton.setFont(parent.getFont());
+ ((GridData)bopEnabledButton.getLayoutData()).horizontalSpan = 3;
+ ((GridData)bopEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true;
+ bopEnabledButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ handleModifyOpenFileText();
+ }
+
+ });
+
+ // load label
+ Label loadLabel = ControlFactory.createLabel(profileGroup,
+ MakeUIPlugin.getResourceString(BO_PROVIDER_OPEN_LABEL));
+ ((GridData) loadLabel.getLayoutData()).horizontalSpan = 3;
+
+ // text field
+ bopOpenFileText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
+ bopOpenFileText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ handleModifyOpenFileText();
+ }
+ });
+
+ // browse button
+ Button browseButton = ControlFactory.createPushButton(profileGroup,
+ MakeUIPlugin.getResourceString(BO_PROVIDER_BROWSE_BUTTON));
+ ((GridData) browseButton.getLayoutData()).widthHint =
+ SWTUtil.getButtonWidthHint(browseButton);
+ browseButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent event) {
+ handleBOPBrowseButtonSelected();
+ }
+
+ private void handleBOPBrowseButtonSelected() {
+ FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
+ dialog.setText(MakeUIPlugin.getResourceString(BO_PROVIDER_OPEN_FILE_DIALOG)); //$NON-NLS-1$
+ String fileName = getBopOpenFileText();
+ IPath filterPath;
+ if (fileName.length() == 0 && getContainer().getProject() != null) {
+ filterPath = getContainer().getProject().getLocation();
+ }
+ else {
+ IPath filePath = new Path(fileName);
+ filterPath = filePath.removeLastSegments(1).makeAbsolute();
+ }
+ dialog.setFilterPath(filterPath.toOSString());
+ String res = dialog.open();
+ if (res == null) {
+ return;
+ }
+ setBopOpenFileText(res);
+ }
+ });
+
+ // load button
+ bopLoadButton = ControlFactory.createPushButton(profileGroup,
+ MakeUIPlugin.getResourceString(BO_PROVIDER_LOAD_BUTTON));
+ ((GridData) bopLoadButton.getLayoutData()).widthHint =
+ SWTUtil.getButtonWidthHint(bopLoadButton);
+ bopLoadButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent event) {
+ handleBOPLoadFileButtonSelected();
+ }
+
+ });
+ bopLoadButton.setEnabled(loadButtonInitialEnabled);
+ if (getContainer().getProject() == null) { // project properties
+ bopLoadButton.setVisible(false);
+ }
+
+ setControl(page);
+ // set the shell variable; must be after setControl
+ //lock.acquire();
+ synchronized (lock) {
+ shell = getShell();
+ instance = this;
+ }
+ //lock.release();
+ initializeValues();
+ }
+
+ protected void handleModifyOpenFileText() {
+ String fileName = getBopOpenFileText();
+ bopLoadButton.setEnabled(bopEnabledButton.getSelection() &&
+ fileName.length() > 0 &&
+ (new File(fileName)).exists());
+ }
+
+ private String getBopOpenFileText() {
+ // from project relative path to absolute path
+ String fileName = bopOpenFileText.getText().trim();
+ if (fileName.length() > 0) {
+ IPath filePath = new Path(fileName);
+ if (!filePath.isAbsolute()) {
+ if (getContainer().getProject() != null) {
+ IPath projectPath = getContainer().getProject().getLocation();
+ filePath = projectPath.append(filePath);
+ fileName = filePath.toString();
+ }
+ }
+ }
+ return fileName;
+ }
+
+ private void setBopOpenFileText(String fileName) {
+ // from absolute path to project relative path
+ if (fileName.length() > 0) {
+ IPath filePath = new Path(fileName);
+ if (filePath.isAbsolute()) {
+ if (getContainer().getProject() != null) {
+ IPath projectPath = getContainer().getProject().getLocation();
+ if (projectPath.isPrefixOf(filePath)) {
+ filePath = filePath.removeFirstSegments(projectPath.segmentCount());
+ filePath = filePath.setDevice(null);
+ fileName = filePath.toString();
+ }
+ }
+ }
+ }
+ bopOpenFileText.setText(fileName);
+ }
+
+ private void initializeValues() {
+ bopEnabledButton.setSelection(getContainer().getBuildInfo().isBuildOutputParserEnabled());
+ setBopOpenFileText(getContainer().getBuildInfo().getBuildOutputFilePath());
+ }
+
+ private void handleBOPLoadFileButtonSelected() {
+ loadButtonInitialEnabled = false;
+ bopLoadButton.setEnabled(false);
+
+ // populate buildInfo to be used by the reader job
+ populateBuildInfo(getContainer().getBuildInfo());
+ IProject project = getContainer().getProject();
+ Job readerJob = new BuildOutputReaderJob(project, getContainer().getBuildInfo());
+ readerJob.setPriority(Job.LONG);
+ readerJob.addJobChangeListener(new JobChangeAdapter() {
+
+ public void done(IJobChangeEvent event) {
+ //lock.acquire();
+ synchronized (lock) {
+ if (!instance.shell.isDisposed()) {
+ instance.shell.getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ if (!instance.shell.isDisposed()) {
+ instance.bopLoadButton.setEnabled(instance.bopEnabledButton.getSelection());
+ }
+ loadButtonInitialEnabled = instance.bopEnabledButton.getSelection();//true;
+ }
+
+ });
+ }
+ else {
+ loadButtonInitialEnabled = instance.bopEnabledButton.getSelection();//true;
+ }
+ }
+ //lock.release();
+ }
+
+ });
+ readerJob.schedule();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#isValid()
+ */
+ protected boolean isValid() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#populateBuildInfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2)
+ */
+ protected void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) {
+ if (buildInfo != null) {
+ buildInfo.setBuildOutputFileActionEnabled(true);
+ buildInfo.setBuildOutputFilePath(getBopOpenFileText());
+ buildInfo.setBuildOutputParserEnabled(bopEnabledButton.getSelection());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#restoreFromBuildinfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2)
+ */
+ protected void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
+ if (buildInfo != null) {
+ setBopOpenFileText(buildInfo.getBuildOutputFilePath());
+ bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled());
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java
index f95ad96c5d7..cd917c05f7e 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java
@@ -18,9 +18,7 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.jobs.BuildOutputReaderJo
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
@@ -41,15 +39,13 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
/**
- * SCD profile property/preference page
+ * SCD per project profile property/preference page
*
* @author vhirsl
*/
public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
private static final int DEFAULT_HEIGHT = 160;
- private static final String PREFIX = "ScannerConfigOptionsDialog"; //$NON-NLS-1$
- private static final String BO_PROVIDER_GROUP_LABEL = PREFIX + ".boProvider.group.label"; //$NON-NLS-1$
private static final String BO_PROVIDER_PARSER_ENABLED_BUTTON = PREFIX + ".boProvider.parser.enabled.button"; //$NON-NLS-1$
private static final String BO_PROVIDER_OPEN_LABEL = PREFIX + ".boProvider.open.label"; //$NON-NLS-1$
private static final String BO_PROVIDER_BROWSE_BUTTON = PREFIX + ".boProvider.browse.button"; //$NON-NLS-1$
@@ -83,15 +79,19 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
* @see org.eclipse.cdt.ui.dialogs.AbstractCOptionPage#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
+ Composite page = ControlFactory.createComposite(parent, 1);
+// ((GridData) page.getLayoutData()).grabExcessVerticalSpace = true;
+// ((GridData) page.getLayoutData()).verticalAlignment = GridData.FILL;
+
// Add the profile UI contribution.
- Group profileGroup = ControlFactory.createGroup(parent,
- MakeUIPlugin.getResourceString(BO_PROVIDER_GROUP_LABEL), 3);
+ Group profileGroup = ControlFactory.createGroup(page,
+ MakeUIPlugin.getResourceString(PROFILE_GROUP_LABEL), 3);
GridData gd = (GridData) profileGroup.getLayoutData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = GridData.FILL;
// PixelConverter converter = new PixelConverter(parent);
-// gd.heightHint = converter.convertHorizontalDLUsToPixels(DEFAULT_HEIGHT);
+// gd.heightHint = converter.convertVerticalDLUsToPixels(DEFAULT_HEIGHT);
((GridLayout) profileGroup.getLayout()).makeColumnsEqualWidth = false;
// Add bop enabled checkbox
@@ -135,7 +135,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
private void handleBOPBrowseButtonSelected() {
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
dialog.setText(MakeUIPlugin.getResourceString(BO_PROVIDER_OPEN_FILE_DIALOG)); //$NON-NLS-1$
- String fileName = bopOpenFileText.getText().trim();
+ String fileName = getBopOpenFileText();
IPath filterPath;
if (fileName.length() == 0 && getContainer().getProject() != null) {
filterPath = getContainer().getProject().getLocation();
@@ -149,7 +149,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
if (res == null) {
return;
}
- bopOpenFileText.setText(res);
+ setBopOpenFileText(res);
}
});
@@ -227,8 +227,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
}
});
-
- setControl(parent);
+ setControl(page);
// set the shell variable; must be after setControl
//lock.acquire();
synchronized (lock) {
@@ -239,19 +238,13 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
initializeValues();
}
- /**
- *
- */
protected void handleModifyOpenFileText() {
- String fileName = bopOpenFileText.getText().trim();
+ String fileName = getBopOpenFileText();
bopLoadButton.setEnabled(bopEnabledButton.getSelection() &&
fileName.length() > 0 &&
new File(fileName).exists());
}
- /**
- *
- */
protected void handleModifyRunCommandText() {
String cmd = sipRunCommandText.getText().trim();
isValid = (cmd.length() > 0) ? true : false;
@@ -259,14 +252,45 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
getContainer().updateContainer();
}
- /**
- *
- */
+ private String getBopOpenFileText() {
+ // from project relative path to absolute path
+ String fileName = bopOpenFileText.getText().trim();
+ if (fileName.length() > 0) {
+ IPath filePath = new Path(fileName);
+ if (!filePath.isAbsolute()) {
+ if (getContainer().getProject() != null) {
+ IPath projectPath = getContainer().getProject().getLocation();
+ filePath = projectPath.append(filePath);
+ fileName = filePath.toString();
+ }
+ }
+ }
+ return fileName;
+ }
+
+ private void setBopOpenFileText(String fileName) {
+ // from absolute path to project relative path
+ if (fileName.length() > 0) {
+ IPath filePath = new Path(fileName);
+ if (filePath.isAbsolute()) {
+ if (getContainer().getProject() != null) {
+ IPath projectPath = getContainer().getProject().getLocation();
+ if (projectPath.isPrefixOf(filePath)) {
+ filePath = filePath.removeFirstSegments(projectPath.segmentCount());
+ filePath = filePath.setDevice(null);
+ fileName = filePath.toString();
+ }
+ }
+ }
+ }
+ bopOpenFileText.setText(fileName);
+ }
+
private void initializeValues() {
- bopEnabledButton.setSelection(getBuildInfo().isBuildOutputParserEnabled());
- bopOpenFileText.setText(getBuildInfo().getBuildOutputFilePath());
- sipEnabledButton.setSelection(getBuildInfo().isProviderOutputParserEnabled(providerId));
- sipRunCommandText.setText(getBuildInfo().getProviderRunCommand(providerId));
+ bopEnabledButton.setSelection(getContainer().getBuildInfo().isBuildOutputParserEnabled());
+ setBopOpenFileText(getContainer().getBuildInfo().getBuildOutputFilePath());
+ sipEnabledButton.setSelection(getContainer().getBuildInfo().isProviderOutputParserEnabled(providerId));
+ sipRunCommandText.setText(getContainer().getBuildInfo().getProviderRunCommand(providerId));
}
private void handleBOPLoadFileButtonSelected() {
@@ -274,9 +298,9 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
bopLoadButton.setEnabled(false);
// populate buildInfo to be used by the reader job
- populateBuildInfo(getBuildInfo(), null);
+ populateBuildInfo(getContainer().getBuildInfo());
IProject project = getContainer().getProject();
- Job readerJob = new BuildOutputReaderJob(project, getBuildInfo());
+ Job readerJob = new BuildOutputReaderJob(project, getContainer().getBuildInfo());
readerJob.setPriority(Job.LONG);
readerJob.addJobChangeListener(new JobChangeAdapter() {
@@ -321,44 +345,30 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.ui.dialogs.AbstractCOptionPage#performApply(org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#populateBuildInfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2)
*/
- public void performApply(IProgressMonitor monitor) throws CoreException {
- IProject project = getContainer().getProject();
- // Create new build info in case of new C++ project wizard
- IScannerConfigBuilderInfo2 buildInfo = createBuildInfo(project);
-
+ protected void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) {
if (buildInfo != null) {
- populateBuildInfo(buildInfo, monitor);
- buildInfo.store();
+ buildInfo.setBuildOutputFileActionEnabled(true);
+ buildInfo.setBuildOutputFilePath(getBopOpenFileText());
+ buildInfo.setBuildOutputParserEnabled(bopEnabledButton.getSelection());
+
+ buildInfo.setProviderOutputParserEnabled(providerId, sipEnabledButton.getSelection());
+ buildInfo.setProviderRunCommand(providerId, sipRunCommandText.getText().trim());
}
}
- private void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo, IProgressMonitor monitor) {
- buildInfo.setBuildOutputFileActionEnabled(true);
- buildInfo.setBuildOutputFilePath(bopOpenFileText.getText().trim());
- buildInfo.setBuildOutputParserEnabled(bopEnabledButton.getSelection());
-
- buildInfo.setProviderOutputParserEnabled(providerId, sipEnabledButton.getSelection());
- buildInfo.setProviderRunCommand(providerId, sipRunCommandText.getText().trim());
- }
-
/* (non-Javadoc)
- * @see org.eclipse.cdt.ui.dialogs.AbstractCOptionPage#performDefaults()
+ * @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#restoreFromBuildinfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2)
*/
- public void performDefaults() {
- // Create buildInfo with defaults
- IScannerConfigBuilderInfo2 buildInfo = createBuildInfo();
-
- restoreFromBuildinfo(buildInfo);
- }
-
- private void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
- bopOpenFileText.setText(buildInfo.getBuildOutputFilePath());
- bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled());
-
- sipEnabledButton.setSelection(buildInfo.isProviderOutputParserEnabled(providerId));
- sipRunCommandText.setText(buildInfo.getProviderRunCommand(providerId));
+ protected void restoreFromBuildinfo(IScannerConfigBuilderInfo2 buildInfo) {
+ if (buildInfo != null) {
+ setBopOpenFileText(buildInfo.getBuildOutputFilePath());
+ bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled());
+
+ sipEnabledButton.setSelection(buildInfo.isProviderOutputParserEnabled(providerId));
+ sipRunCommandText.setText(buildInfo.getProviderRunCommand(providerId));
+ }
}
}

Back to the top