1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

final fix for [Bug 184185] New CDTWizard extension mechanism should use abstract classes instead of interfaces

This commit is contained in:
Mikhail Sennikovsky 2007-04-26 22:01:54 +00:00
parent 5961aaeb02
commit 5a24d7c682
5 changed files with 85 additions and 139 deletions

View file

@ -14,7 +14,7 @@ import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.managedbuilder.core.IToolChain; import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.ui.properties.AbstractCBuildPropertyTab; import org.eclipse.cdt.managedbuilder.ui.properties.AbstractCBuildPropertyTab;
import org.eclipse.cdt.managedbuilder.ui.properties.Messages; import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
import org.eclipse.cdt.managedbuilder.ui.wizards.ICBuildWizardHandler; import org.eclipse.cdt.managedbuilder.ui.wizards.MBSWizardHandler;
import org.eclipse.cdt.ui.newui.CDTPrefUtil; import org.eclipse.cdt.ui.newui.CDTPrefUtil;
import org.eclipse.cdt.ui.newui.PageLayout; import org.eclipse.cdt.ui.newui.PageLayout;
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage; import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
@ -111,8 +111,8 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
private void setPref(boolean set) { private void setPref(boolean set) {
if (h_selected == null || !h_selected.supportsPreferred()) if (h_selected == null || !h_selected.supportsPreferred())
return; return;
if (h_selected instanceof ICBuildWizardHandler) { if (h_selected instanceof MBSWizardHandler) {
IToolChain[] tcs = ((ICBuildWizardHandler)h_selected).getSelectedToolChains(); IToolChain[] tcs = ((MBSWizardHandler)h_selected).getSelectedToolChains();
for (int i=0; i<tcs.length; i++) { for (int i=0; i<tcs.length; i++) {
String id = (tcs[i] == null) ? CDTPrefUtil.NULL : tcs[i].getId(); String id = (tcs[i] == null) ? CDTPrefUtil.NULL : tcs[i].getId();
if (set) CDTPrefUtil.addPreferredTC(id); if (set) CDTPrefUtil.addPreferredTC(id);

View file

@ -1,26 +0,0 @@
/*******************************************************************************
* Copyright (c) 2007 Intel 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:
* Intel Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.wizards;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.ui.wizards.ICWizardHandler;
/**
* Build-system specific methods for Wizard Handler
*/
public interface ICBuildWizardHandler extends ICWizardHandler {
public IToolChain[] getSelectedToolChains();
public int getToolChainsCount();
public String getPropertyId();
public IProjectType getProjectType();
}

View file

@ -68,7 +68,7 @@ import org.eclipse.swt.widgets.TableItem;
* - whole view of right pane, including * - whole view of right pane, including
* *
*/ */
public class MBSWizardHandler extends CWizardHandler implements ICBuildWizardHandler { public class MBSWizardHandler extends CWizardHandler {
public static final String ARTIFACT = "org.eclipse.cdt.build.core.buildArtefactType"; //$NON-NLS-1$ public static final String ARTIFACT = "org.eclipse.cdt.build.core.buildArtefactType"; //$NON-NLS-1$
private static final String PROPERTY = "org.eclipse.cdt.build.core.buildType"; //$NON-NLS-1$ private static final String PROPERTY = "org.eclipse.cdt.build.core.buildType"; //$NON-NLS-1$

View file

@ -60,6 +60,11 @@ public class CWizardHandler implements Cloneable {
name = _name; name = _name;
} }
/**
* Called when user selects corresponding item in wizard tree
*
* @parame pane - parent for handler-specific data
*/
public void handleSelection() { public void handleSelection() {
List preferred = CDTPrefUtil.getPreferredTCs(); List preferred = CDTPrefUtil.getPreferredTCs();
if (table == null) { if (table == null) {
@ -74,29 +79,105 @@ public class CWizardHandler implements Cloneable {
parent.layout(); parent.layout();
} }
/**
* Called when user leaves corresponding item in wizard tree
*/
public void handleUnSelection() { public void handleUnSelection() {
if (table != null) { if (table != null) {
table.setVisible(false); table.setVisible(false);
} }
} }
/**
* @return text for label above handler-specific pane
*/
public String getHeader() { return head; } public String getHeader() { return head; }
/**
* @return text for label in left tree
*/
public String getName() { return name; } public String getName() { return name; }
/**
* @return null if data is consistent
* else returns error message
*/
public String getErrorMessage() { return null; } public String getErrorMessage() { return null; }
/**
* Defines whether only supported project types and toolchains are displayed
* @param supp
*/
public void setSupportedOnly(boolean supp) { supportedOnly = supp;} public void setSupportedOnly(boolean supp) { supportedOnly = supp;}
/**
* @return true if only supported project types and toolchains are displayed
*/
public boolean supportedOnly() { return supportedOnly; } public boolean supportedOnly() { return supportedOnly; }
/**
* @return true if handler is able to process preferred toolchains
*/
public boolean supportsPreferred() { return false; } public boolean supportsPreferred() { return false; }
/**
* @return 1st handler-specific page
*/
public IWizardPage getSpecificPage() { return null; } public IWizardPage getSpecificPage() { return null; }
/**
* Asks handler to update its data according to preferred list.
* Usually, marks preferred toolchains somehow (icon, font etc)
* @param prefs - list of strings (preferred Toolchain IDs)
*/
public void updatePreferred(List prefs) {} public void updatePreferred(List prefs) {}
/**
* Creates project
*
* @param proj - simple project to be used as base
* @param defaults - true if called from 1st Wizard page
* @throws CoreException
*/
public void createProject(IProject proj, boolean defaults) public void createProject(IProject proj, boolean defaults)
throws CoreException {} throws CoreException {}
/**
*
* @return true if settings were changed
* since last call to saveState()
*/
public boolean isChanged() { return true; } public boolean isChanged() { return true; }
/**
* Stores current internal settings
*/
public void saveState() {} public void saveState() {}
/**
* Called when Finish button pressed,
* even if project was created before.
* @param proj
*/
public void postProcess(IProject proj) {} public void postProcess(IProject proj) {}
/**
* Checks whether this item can be added to Wizard tree
*
* @param data - Wizard Item data to be added
* as child to current Wizard item
* @return - true if item can be added.
*/
public boolean isApplicable(EntryDescriptor data) { return true; } public boolean isApplicable(EntryDescriptor data) { return true; }
/**
* Initializes the handler to be used for the specified entry
*
* @param data - Wizard Item data to be handled
* @throws CoreException
*/
public void initialize(EntryDescriptor data) throws CoreException {} public void initialize(EntryDescriptor data) throws CoreException {}
public boolean canFinich() {return true;} public boolean canFinich() {return true;}
public Object clone() { public Object clone() {

View file

@ -1,109 +0,0 @@
/*******************************************************************************
* Copyright (c) 2007 Intel 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:
* Intel Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui.wizards;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.wizard.IWizardPage;
public interface ICWizardHandler extends Cloneable {
/**
* Called when user selects corresponding item in wizard tree
*
* @parame pane - parent for handler-specific data
*/
public void handleSelection();
/**
* Called when user leaves corresponding item in wizard tree
*/
public void handleUnSelection();
/**
* @return text for label above handler-specific pane
*/
public String getHeader();
/**
* @return text for label in left tree
*/
public String getName();
/**
* @return 1st handler-specific page
*/
public IWizardPage getSpecificPage();
/**
* Creates project
*
* @param proj - simple project to be used as base
* @param defaults - true if called from 1st Wizard page
* @throws CoreException
*/
public void createProject(IProject proj, boolean defaults) throws CoreException;
/**
* Called when Finish button pressed,
* even if project was created before.
* @param proj
*/
public void postProcess(IProject proj);
/**
* @return true if only supported project types and toolchains are displayed
*/
public boolean supportedOnly();
/**
* Defines whether only supported project types and toolchains are displayed
* @param supp
*/
public void setSupportedOnly(boolean supp);
/**
* @return true if handler is able to process preferred toolchains
*/
public boolean supportsPreferred();
/**
* Asks handler to update its data according to preferred list.
* Usually, marks preferred toolchains somehow (icon, font etc)
* @param prefs - list of strings (preferred Toolchain IDs)
*/
public void updatePreferred(List prefs);
/**
* @return null if data is consistent
* else returns error message
*/
public String getErrorMessage();
/**
* Stores current internal settings
*/
public void saveState();
/**
*
* @return true if settings were changed
* since last call to saveState()
*/
public boolean isChanged();
/**
* Checks whether this item can be added to Wizard tree
*
* @param data - Wizard Item data to be added
* as child to current Wizard item
* @return - true if item can be added.
*/
public boolean isApplicable(EntryDescriptor data);
/**
* Initializes the handler to be used for the specified entry
*
* @param data - Wizard Item data to be handled
* @throws CoreException
*/
public void initialize(EntryDescriptor data) throws CoreException;
public boolean canFinich();
public Object clone();
}