1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-31 12:55:40 +02:00

Toolchain edit: new functionality

Properties are enabled for non-C files
Some bugs fixed
This commit is contained in:
Oleg Krasilnikov 2007-04-19 17:07:16 +00:00
parent ef4ddbd189
commit 7e9fd939f3
12 changed files with 119 additions and 116 deletions

View file

@ -450,14 +450,8 @@
<instanceof value="org.eclipse.core.resources.IFolder"/> <instanceof value="org.eclipse.core.resources.IFolder"/>
<instanceof value="org.eclipse.cdt.core.model.ICContainer"/> <instanceof value="org.eclipse.cdt.core.model.ICContainer"/>
<and> <instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
<instanceof value="org.eclipse.core.resources.IFile"/> <instanceof value="org.eclipse.core.resources.IFile"/>
<test property="org.eclipse.cdt.ui.isSource" value="" />
</and>
<and>
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
<test property="org.eclipse.cdt.ui.isSource" value="" />
</and>
</or> </or>
</enabledWhen> </enabledWhen>
</page> </page>
@ -497,15 +491,8 @@
<instanceof value="org.eclipse.core.resources.IFolder"/> <instanceof value="org.eclipse.core.resources.IFolder"/>
<instanceof value="org.eclipse.cdt.core.model.ICContainer"/> <instanceof value="org.eclipse.cdt.core.model.ICContainer"/>
<and> <instanceof value="org.eclipse.core.resources.IFile"/>
` <instanceof value="org.eclipse.core.resources.IFile"/> <instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
<test property="org.eclipse.cdt.ui.isSource" value="" />
</and>
<and>
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
<test property="org.eclipse.cdt.ui.isSource" value="" />
</and>
</or> </or>
</enabledWhen> </enabledWhen>
</page> </page>
@ -546,14 +533,8 @@
<instanceof value="org.eclipse.core.resources.IFolder"/> <instanceof value="org.eclipse.core.resources.IFolder"/>
<instanceof value="org.eclipse.cdt.core.model.ICContainer"/> <instanceof value="org.eclipse.cdt.core.model.ICContainer"/>
<and> <instanceof value="org.eclipse.core.resources.IFile"/>
` <instanceof value="org.eclipse.core.resources.IFile"/> <instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
<test property="org.eclipse.cdt.ui.isSource" value="" />
</and>
<and>
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
<test property="org.eclipse.cdt.ui.isSource" value="" />
</and>
</or> </or>
</enabledWhen> </enabledWhen>
</page> </page>
@ -576,14 +557,8 @@
<instanceof value="org.eclipse.core.resources.IFolder"/> <instanceof value="org.eclipse.core.resources.IFolder"/>
<instanceof value="org.eclipse.cdt.core.model.ICContainer"/> <instanceof value="org.eclipse.cdt.core.model.ICContainer"/>
<and> <instanceof value="org.eclipse.core.resources.IFile"/>
<instanceof value="org.eclipse.core.resources.IFile"/> <instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
<test property="org.eclipse.cdt.ui.isSource" value="" />
</and>
<and>
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
<test property="org.eclipse.cdt.ui.isSource" value="" />
</and>
</or> </or>
<test property="org.eclipse.cdt.ui.toolEditEnabled" value="" /> <test property="org.eclipse.cdt.ui.toolEditEnabled" value="" />
</and> </and>
@ -633,18 +608,6 @@
<or> <or>
<instanceof value="org.eclipse.core.resources.IProject"/> <instanceof value="org.eclipse.core.resources.IProject"/>
<instanceof value="org.eclipse.cdt.core.model.ICProject"/> <instanceof value="org.eclipse.cdt.core.model.ICProject"/>
<instanceof value="org.eclipse.core.resources.IFolder"/>
<instanceof value="org.eclipse.cdt.core.model.ICContainer"/>
<and>
<instanceof value="org.eclipse.core.resources.IFile"/>
<test property="org.eclipse.cdt.ui.isSource" value="" />
</and>
<and>
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
<test property="org.eclipse.cdt.ui.isSource" value="" />
</and>
</or> </or>
</enabledWhen> </enabledWhen>
</page> </page>

View file

@ -84,7 +84,7 @@ public class ArtifactTab extends AbstractCBuildPropertyTab {
try { try {
fProp.setProperty(PROPERTY, values[n].getId()); fProp.setProperty(PROPERTY, values[n].getId());
} catch (CoreException ex) { } catch (CoreException ex) {
System.out.println(ex.getMessage()); ManagedBuilderUIPlugin.log(ex);
} }
updateData(getResDesc()); updateData(getResDesc());
} }

View file

@ -0,0 +1,37 @@
/*******************************************************************************
* 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.properties;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.ui.newui.CDTListComparator;
/**
* This class is intended to compare MBS-specific classes
*/
public class BuildListComparator extends CDTListComparator {
private static BuildListComparator comparator = null;
public static CDTListComparator getInstance() {
if (comparator == null)
comparator = new BuildListComparator();
return comparator;
}
public int compare(Object a, Object b) {
if (a == null || b == null)
return 0;
if (a instanceof ITool) {
ITool c1 = (ITool)a;
ITool c2 = (ITool)b;
return c1.getName().compareToIgnoreCase(c2.getName());
}
return super.compare(a, b);
}
}

View file

@ -3,5 +3,5 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
import org.eclipse.cdt.ui.newui.AbstractPage; import org.eclipse.cdt.ui.newui.AbstractPage;
public class Page_head_build extends AbstractPage { public class Page_head_build extends AbstractPage {
protected boolean isSingle() { return true; } protected boolean isSingle() { return false; }
} }

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.managedbuilder.ui.properties; package org.eclipse.cdt.managedbuilder.ui.properties;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.settings.model.ICResourceDescription; import org.eclipse.cdt.core.settings.model.ICResourceDescription;
@ -130,7 +131,6 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
IToolChain tc = null; IToolChain tc = null;
if (ri instanceof IFolderInfo) if (ri instanceof IFolderInfo)
tc = ManagedBuildManager.getRealToolChain(((IFolderInfo)ri).getToolChain()); tc = ManagedBuildManager.getRealToolChain(((IFolderInfo)ri).getToolChain());
int cnt = 0; int cnt = 0;
int pos = -1; int pos = -1;
c_toolchain.removeAll(); c_toolchain.removeAll();
@ -189,6 +189,7 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
} }
ITool[] tmp = new ITool[cnt]; ITool[] tmp = new ITool[cnt];
System.arraycopy(v_tools, 0, tmp, 0, cnt); System.arraycopy(v_tools, 0, tmp, 0, cnt);
Arrays.sort(tmp, BuildListComparator.getInstance());
v_tools = tmp; v_tools = tmp;
if (page.isForFile()) { // Edit tool in combo for File if (page.isForFile()) { // Edit tool in combo for File

View file

@ -15,7 +15,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
import org.eclipse.cdt.managedbuilder.core.IFolderInfo; import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions; import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory; import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
@ -76,11 +75,13 @@ public class ToolListContentProvider implements ITreeContentProvider{
if(info instanceof IFolderInfo){ if(info instanceof IFolderInfo){
tools = ((IFolderInfo)info).getFilteredTools(); tools = ((IFolderInfo)info).getFilteredTools();
} else { } else {
tools = ((IFileInfo)info).getToolsToInvoke(); tools = info.getTools();
} }
// Create an element for each one // Create an element for each one
for (int i=0; i<tools.length; i++) { for (int i=0; i<tools.length; i++) {
if (tools[i].getCustomBuildStep())
continue;
ToolListElement e = new ToolListElement(tools[i]); ToolListElement e = new ToolListElement(tools[i]);
elementList.add(e); elementList.add(e);
createChildElements(e); createChildElements(e);
@ -142,7 +143,7 @@ public class ToolListContentProvider implements ITreeContentProvider{
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/ */
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (newInput == null || oldInput == newInput) return; if (newInput == null) return;
fInfo = (IResourceInfo)newInput; fInfo = (IResourceInfo)newInput;
if (elementType == PROJECT) if (elementType == PROJECT)
elements = createElements(fInfo.getParent()); elements = createElements(fInfo.getParent());

View file

@ -39,6 +39,7 @@ import org.eclipse.swt.widgets.TableItem;
public class ToolSelectionDialog extends Dialog { public class ToolSelectionDialog extends Dialog {
private static final String EMPTY_STR = ""; //$NON-NLS-1$
private Table t1, t2; private Table t1, t2;
private CLabel errorLabel; private CLabel errorLabel;
public ITool[] all, used; public ITool[] all, used;
@ -182,62 +183,59 @@ public class ToolSelectionDialog extends Dialog {
if (!exists) added.add(t); if (!exists) added.add(t);
add(t, t2, !exists); add(t, t2, !exists);
} }
if (true/*check && removed.size() > 0 || added.size() > 0 */) { IModificationStatus st = fi.getToolChainModificationStatus(
IModificationStatus st = fi.getToolChainModificationStatus( (ITool[])removed.toArray(new ITool[removed.size()]),
(ITool[])removed.toArray(new ITool[removed.size()]), (ITool[])added.toArray(new ITool[added.size()]));
(ITool[])added.toArray(new ITool[added.size()])); if (st.isOK()) {
if (st.isOK()) { errorLabel.setText(EMPTY_STR);
errorLabel.setText(""); //$NON-NLS-1$ if(getButton(IDialogConstants.OK_ID) != null)
if(getButton(IDialogConstants.OK_ID) != null) getButton(IDialogConstants.OK_ID).setEnabled(true);
getButton(IDialogConstants.OK_ID).setEnabled(true); } else {
} else { int c = st.getCode();
int c = st.getCode(); String s = EMPTY_STR;
String s = ""; //$NON-NLS-1$ if ((c & IModificationStatus.TOOLS_CONFLICT) != 0) {
if ((c & IModificationStatus.TOOLS_CONFLICT) != 0) { s = s + Messages.getString("ToolSelectionDialog.7"); //$NON-NLS-1$
s = s + Messages.getString("ToolSelectionDialog.7"); //$NON-NLS-1$ ITool[][] tools = st.getToolsConflicts();
ITool[][] tools = st.getToolsConflicts(); for (int k=0; k<t2.getItemCount(); k++) {
for (int k=0; k<t2.getItemCount(); k++) { TableItem ti = t2.getItem(k);
TableItem ti = t2.getItem(k); ITool t = (ITool)ti.getData();
ITool t = (ITool)ti.getData(); loop:
loop: for (int i=0;i<tools.length;i++) {
for (int i=0;i<tools.length;i++) { for (int j=0;j<tools[i].length;j++) {
for (int j=0;j<tools[i].length;j++) { if (t.matches(tools[i][j])) {
if (t.matches(tools[i][j])) {
ti.setForeground(red);
break loop;
}
}
}
}
}
if ((c & IModificationStatus.TOOLS_DONT_SUPPORT_MANAGED_BUILD) != 0) {
s = s + Messages.getString("ToolSelectionDialog.8"); //$NON-NLS-1$
ITool[] tools = st.getNonManagedBuildTools();
for (int k=0; k<t2.getItemCount(); k++) {
TableItem ti = t2.getItem(k);
ITool t = (ITool)ti.getData();
for (int i=0;i<tools.length;i++) {
if (t.matches(tools[i])) {
ti.setForeground(red); ti.setForeground(red);
break; break loop;
} }
} }
} }
} }
if ((c & IModificationStatus.PROPS_NOT_DEFINED) != 0) {
s = s + Messages.getString("ToolSelectionDialog.9"); //$NON-NLS-1$
}
if ((c & IModificationStatus.PROPS_NOT_SUPPORTED) != 0) {
s = s + Messages.getString("ToolSelectionDialog.10"); //$NON-NLS-1$
}
if ((c & IModificationStatus.REQUIRED_PROPS_NOT_SUPPORTED) != 0) {
s = s + Messages.getString("ToolSelectionDialog.11"); //$NON-NLS-1$
}
errorLabel.setText(s);
if(getButton(IDialogConstants.OK_ID) != null)
getButton(IDialogConstants.OK_ID).setEnabled(false);
} }
if ((c & IModificationStatus.TOOLS_DONT_SUPPORT_MANAGED_BUILD) != 0) {
s = s + Messages.getString("ToolSelectionDialog.8"); //$NON-NLS-1$
ITool[] tools = st.getNonManagedBuildTools();
for (int k=0; k<t2.getItemCount(); k++) {
TableItem ti = t2.getItem(k);
ITool t = (ITool)ti.getData();
for (int i=0;i<tools.length;i++) {
if (t.matches(tools[i])) {
ti.setForeground(red);
break;
}
}
}
}
if ((c & IModificationStatus.PROPS_NOT_DEFINED) != 0) {
s = s + Messages.getString("ToolSelectionDialog.9"); //$NON-NLS-1$
}
if ((c & IModificationStatus.PROPS_NOT_SUPPORTED) != 0) {
s = s + Messages.getString("ToolSelectionDialog.10"); //$NON-NLS-1$
}
if ((c & IModificationStatus.REQUIRED_PROPS_NOT_SUPPORTED) != 0) {
s = s + Messages.getString("ToolSelectionDialog.11"); //$NON-NLS-1$
}
errorLabel.setText(s);
if(getButton(IDialogConstants.OK_ID) != null)
getButton(IDialogConstants.OK_ID).setEnabled(false);
} }
} }
} }

View file

@ -270,7 +270,7 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
public void setVisible(boolean visible){ public void setVisible(boolean visible){
if(visible){ if(visible){
selectedElement = null; selectedElement = null;
handleOptionSelection(); updateData(page.getResDesc());
} }
super.setVisible(visible); super.setVisible(visible);
} }

View file

@ -1520,14 +1520,8 @@
<instanceof value="org.eclipse.core.resources.IFolder"/> <instanceof value="org.eclipse.core.resources.IFolder"/>
<instanceof value="org.eclipse.cdt.core.model.ICContainer"/> <instanceof value="org.eclipse.cdt.core.model.ICContainer"/>
<and> <instanceof value="org.eclipse.core.resources.IFile"/>
<instanceof value="org.eclipse.core.resources.IFile"/> <instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
<test property="org.eclipse.cdt.ui.isSource" value="" />
</and>
<and>
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
<test property="org.eclipse.cdt.ui.isSource" value="" />
</and>
</or> </or>
</enabledWhen> </enabledWhen>
</page> </page>

View file

@ -487,7 +487,10 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
case ICPropertyTab.DISPOSE: case ICPropertyTab.DISPOSE:
break; break;
case ICPropertyTab.VISIBLE: case ICPropertyTab.VISIBLE:
if (canBeVisible()) setVisible(data != null); if (canBeVisible())
setVisible(data != null);
else
setVisible(false);
break; break;
case ICPropertyTab.SET_ICON: case ICPropertyTab.SET_ICON:
icon = (Image)data; icon = (Image)data;

View file

@ -306,6 +306,7 @@ implements
if (!isSingle()) { if (!isSingle()) {
comp.setLayout(new FillLayout()); comp.setLayout(new FillLayout());
folder = new TabFolder(comp, SWT.NONE); folder = new TabFolder(comp, SWT.NONE);
// folder.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
} }
loadExtensionsSynchronized(comp); loadExtensionsSynchronized(comp);
@ -553,7 +554,7 @@ implements
Object ob = folder.getItem(0).getData(); Object ob = folder.getItem(0).getData();
currentTab = (ICPropertyTab)ob; currentTab = (ICPropertyTab)ob;
} }
if (currentTab != null) if (currentTab != null)
currentTab.handleTabEvent(ICPropertyTab.VISIBLE, visible ? NOT_NULL : null); currentTab.handleTabEvent(ICPropertyTab.VISIBLE, visible ? NOT_NULL : null);
} }
@ -837,8 +838,13 @@ implements
// tabs adding will be made by re-creation // tabs adding will be made by re-creation
// of all elements, to preserve their order // of all elements, to preserve their order
case ICPropertyTab.MANAGEDBUILDSTATE: case ICPropertyTab.MANAGEDBUILDSTATE:
// generally, single-tabbed pages are not intended to handle this message if (folder == null) {
if (folder == null) return; if (itabs == null || itabs.size() == 0)
return;
ICPropertyTab t = ((InternalTab)itabs.get(0)).tab;
if (! t.canBeVisible())
t.handleTabEvent(ICPropertyTab.VISIBLE, null);
}
boolean willAdd = false; boolean willAdd = false;
TabItem[] ts = folder.getItems(); TabItem[] ts = folder.getItems();
int x = folder.getSelectionIndex(); int x = folder.getSelectionIndex();
@ -929,7 +935,7 @@ implements
if (internalElement == null && !checkElement()) if (internalElement == null && !checkElement())
return false; // unknown element return false; // unknown element
if (isForFile()) // only source files are applicable if (isForFile()) // only source files are applicable
return CoreModel.isValidSourceUnitName(getProject(), internalElement.getName()); return true; //CoreModel.isValidSourceUnitName(getProject(), internalElement.getName());
else else
return true; // Projects and folders are always applicable return true; // Projects and folders are always applicable
} }

View file

@ -13,7 +13,7 @@ package org.eclipse.cdt.ui.newui;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
public interface ManagedBuilderHelpContextIds { public interface CDTHelpContextIds {
public static final String PREFIX= CUIPlugin.PLUGIN_ID + "."; //$NON-NLS-1$ public static final String PREFIX= CUIPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
// Wizard pages // Wizard pages