/** Returns the "dirty" state */ public boolean isDirty() { // Check each settings page List<AbstractConfigurePropertyOptionsPage> pages = getPagesForConfig(); // Make sure we have something to work on if (pages == null) { // Nothing to do return false; } ListIterator<AbstractConfigurePropertyOptionsPage> iter = pages.listIterator(); while (iter.hasNext()) { AbstractConfigurePropertyOptionsPage page = iter.next(); if (page == null) continue; if (page.isDirty()) return true; } return false; }
private void setValues() { /* * This method updates the context of the build property pages * - Which configuration/resource configuration is selected * - Which tool/option category is selected * * It is called: * - When a property page becomes visible * - When the user changes the configuration selection * - When the user changes the "exclude" setting for a resource */ IConfiguration icfg = getCfg(icfgd.getConfiguration()); if (icfg instanceof IMultiConfiguration) { fTree.setInput(null); fTree.getControl().setEnabled(false); currentSettingsPage.setVisible(false); return; } IAConfiguration currCfg = getAutotoolsCfg(); // Create the Tree Viewer content provider if first time if (listprovider == null) { listprovider = new ToolListContentProvider(); fTree.setContentProvider(listprovider); } // Update the selected configuration and the Tree Viewer ToolListElement[] newElements; fTree.setInput(currCfg); fTree.getControl().setEnabled(true); newElements = (ToolListElement[]) listprovider.getElements(currCfg); fTree.expandAll(); selectedElement = newElements[0]; fTree.setSelection(new StructuredSelection(selectedElement), true); }
private void displayPageForElement(ToolListElement element) { selectedElement = element; settingsStore.setSelection(getAutotoolsCfg(), selectedElement); AbstractConfigurePropertyOptionsPage oldPage = currentSettingsPage; currentSettingsPage = null; // Create a new settings page if necessary List<AbstractConfigurePropertyOptionsPage> pages = getPagesForConfig(); ListIterator<AbstractConfigurePropertyOptionsPage> iter = pages.listIterator(); while (iter.hasNext()) { AbstractConfigurePropertyOptionsPage page = iter.next(); if (page.getName().equals(element.getName())) { currentSettingsPage = page; break; } } if (currentSettingsPage == null) { if (element.getType() == IConfigureOption.TOOL) { currentSettingsPage = new AutotoolsToolPropertyOptionPage(element, getAutotoolsCfg()); } else { currentSettingsPage = new AutotoolsCategoryPropertyOptionPage(element, getAutotoolsCfg()); } pages.add(currentSettingsPage); currentSettingsPage.setContainer(this); if (currentSettingsPage.getControl() == null) { currentSettingsPage.createControl(settingsPageContainer); } } // Make all the other pages invisible Control[] children = settingsPageContainer.getChildren(); Control currentControl = currentSettingsPage.getControl(); for (int i = 0; i < children.length; i++) { if (children[i] != currentControl) children[i].setVisible(false); } currentSettingsPage.setVisible(true); currentSettingsPage.updateFields(); if (oldPage != null && oldPage != currentSettingsPage) oldPage.setVisible(false); // Set the size of the scrolled area containerSC.setMinSize(currentSettingsPage.computeSize()); settingsPageContainer.layout(); }
protected void setValues() { /* * This method updates the context of the build property pages * - Which configuration/resource configuration is selected * - Which tool/option category is selected * * It is called: * - When a property page becomes visible * - When the user changes the configuration selection * - When the user changes the "exclude" setting for a resource */ IConfiguration icfg = getCfg(icfgd.getConfiguration()); if (icfg instanceof IMultiConfiguration) { fTree.setInput(null); fTree.getControl().setEnabled(false); currentSettingsPage.setVisible(false); return; } IAConfiguration currCfg = getAutotoolsCfg(); // Create the Tree Viewer content provider if first time if (listprovider == null) { listprovider = new ToolListContentProvider(); fTree.setContentProvider(listprovider); } // Update the selected configuration and the Tree Viewer ToolListElement[] newElements; fTree.setInput(currCfg); fTree.getControl().setEnabled(true); newElements = (ToolListElement[]) listprovider.getElements(currCfg); fTree.expandAll(); selectedElement = newElements[0]; fTree.setSelection(new StructuredSelection(selectedElement), true); // // Determine what the selection in the tree should be // // If the saved selection is not null, try to match the saved selection // // with an object in the new element list. // // Otherwise, select the first tool in the tree // Object primaryObject = null; // if (selectedElement != null) { // selectedElement = matchSelectionElement(selectedElement, newElements); // } // // if (selectedElement == null) { // selectedElement = (newElements != null && newElements.length > 0 ? newElements[0] : null); // } // // if (selectedElement != null) { // primaryObject = selectedElement.getTool(); // if (primaryObject == null) { // primaryObject = selectedElement.getOptionCategory(); // } // if (primaryObject != null) { // if (primaryObject instanceof IOptionCategory) { // ((ToolSettingsPrefStore)settingsStore).setSelection(getResDesc(), selectedElement, // (IOptionCategory)primaryObject); // } // optionList.setSelection(new StructuredSelection(selectedElement), true); // } // } // specificResize(); }