1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-30 21:55:31 +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.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>
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
<instanceof value="org.eclipse.core.resources.IFile"/>
</or>
</enabledWhen>
</page>
@ -497,15 +491,8 @@
<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>
<instanceof value="org.eclipse.core.resources.IFile"/>
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
</or>
</enabledWhen>
</page>
@ -546,14 +533,8 @@
<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>
<instanceof value="org.eclipse.core.resources.IFile"/>
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
</or>
</enabledWhen>
</page>
@ -576,14 +557,8 @@
<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>
<instanceof value="org.eclipse.core.resources.IFile"/>
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
</or>
<test property="org.eclipse.cdt.ui.toolEditEnabled" value="" />
</and>
@ -633,18 +608,6 @@
<or>
<instanceof value="org.eclipse.core.resources.IProject"/>
<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>
</enabledWhen>
</page>

View file

@ -84,7 +84,7 @@ public class ArtifactTab extends AbstractCBuildPropertyTab {
try {
fProp.setProperty(PROPERTY, values[n].getId());
} catch (CoreException ex) {
System.out.println(ex.getMessage());
ManagedBuilderUIPlugin.log(ex);
}
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;
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;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
@ -130,7 +131,6 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
IToolChain tc = null;
if (ri instanceof IFolderInfo)
tc = ManagedBuildManager.getRealToolChain(((IFolderInfo)ri).getToolChain());
int cnt = 0;
int pos = -1;
c_toolchain.removeAll();
@ -189,6 +189,7 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
}
ITool[] tmp = new ITool[cnt];
System.arraycopy(v_tools, 0, tmp, 0, cnt);
Arrays.sort(tmp, BuildListComparator.getInstance());
v_tools = tmp;
if (page.isForFile()) { // Edit tool in combo for File

View file

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

View file

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

View file

@ -1520,14 +1520,8 @@
<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>
<instanceof value="org.eclipse.core.resources.IFile"/>
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
</or>
</enabledWhen>
</page>

View file

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

View file

@ -306,6 +306,7 @@ implements
if (!isSingle()) {
comp.setLayout(new FillLayout());
folder = new TabFolder(comp, SWT.NONE);
// folder.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
}
loadExtensionsSynchronized(comp);
@ -553,7 +554,7 @@ implements
Object ob = folder.getItem(0).getData();
currentTab = (ICPropertyTab)ob;
}
if (currentTab != null)
if (currentTab != null)
currentTab.handleTabEvent(ICPropertyTab.VISIBLE, visible ? NOT_NULL : null);
}
@ -837,8 +838,13 @@ implements
// tabs adding will be made by re-creation
// of all elements, to preserve their order
case ICPropertyTab.MANAGEDBUILDSTATE:
// generally, single-tabbed pages are not intended to handle this message
if (folder == null) return;
if (folder == null) {
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;
TabItem[] ts = folder.getItems();
int x = folder.getSelectionIndex();
@ -929,7 +935,7 @@ implements
if (internalElement == null && !checkElement())
return false; // unknown element
if (isForFile()) // only source files are applicable
return CoreModel.isValidSourceUnitName(getProject(), internalElement.getName());
return true; //CoreModel.isValidSourceUnitName(getProject(), internalElement.getName());
else
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;
public interface ManagedBuilderHelpContextIds {
public interface CDTHelpContextIds {
public static final String PREFIX= CUIPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
// Wizard pages