mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
Bug Fixing
This commit is contained in:
parent
4edd1d9f5c
commit
7279810163
4 changed files with 21 additions and 63 deletions
|
@ -1,5 +1,6 @@
|
||||||
2004-06-24 Hoda Amer
|
2004-06-24 Hoda Amer
|
||||||
A small fix to the New Class Wizard "link to file" option.
|
A small fix to the New Class Wizard "link to file" option.
|
||||||
|
Fix for PR# 47570 : [New Class Wizard] Use of internal Eclipse classes in CDT(LinkToFileGroup)
|
||||||
|
|
||||||
2004-06-24 Chris Wiebe
|
2004-06-24 Chris Wiebe
|
||||||
Fix for PR 48783 : [New Class Wizard] Err Create C++ Class with "Link to File" checkbox selected
|
Fix for PR 48783 : [New Class Wizard] Err Create C++ Class with "Link to File" checkbox selected
|
||||||
|
|
|
@ -156,6 +156,16 @@ CreateLinkedResourceGroup.resolvedPathLabel=Resolved Location:
|
||||||
CreateLinkedResourceGroup.browseButton=Browse...
|
CreateLinkedResourceGroup.browseButton=Browse...
|
||||||
CreateLinkedResourceGroup.variablesButton=Variables...
|
CreateLinkedResourceGroup.variablesButton=Variables...
|
||||||
CreateLinkedResourceGroup.open=Open
|
CreateLinkedResourceGroup.open=Open
|
||||||
|
CreateLinkedResourceGroup.targetSelectionLabel= Select the link target.
|
||||||
|
CreateLinkedResourceGroup.linkTargetNotFile= Link target must be a file
|
||||||
|
CreateLinkedResourceGroup.linkTargetNotFolder= Link target must be a folder
|
||||||
|
CreateLinkedResourceGroup.linkTargetNonExistent= Link target does not exist
|
||||||
|
CreateLinkedResourceGroup.linkTargetEmpty = Link target must be specified
|
||||||
|
CreateLinkedResourceGroup.linkTargetInvalid = Link target name is invalid
|
||||||
|
CreateLinkedResourceGroup.linkTargetNotAbsolute = Link target must be absolute path or path variable and relative path.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NewClassWizardPage.error.EnterClassName=Class name is empty.
|
NewClassWizardPage.error.EnterClassName=Class name is empty.
|
||||||
NewClassWizardPage.error.ClassNameExists=Class already exists.
|
NewClassWizardPage.error.ClassNameExists=Class already exists.
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.ui.wizards.dialogfields;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.wizards.NewWizardMessages;
|
import org.eclipse.cdt.internal.ui.wizards.NewWizardMessages;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.core.resources.IPathVariableManager;
|
import org.eclipse.core.resources.IPathVariableManager;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
|
@ -38,11 +39,10 @@ import org.eclipse.swt.widgets.FileDialog;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Listener;
|
import org.eclipse.swt.widgets.Listener;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
import org.eclipse.ui.internal.WorkbenchMessages;
|
|
||||||
import org.eclipse.ui.internal.WorkbenchPlugin;
|
|
||||||
import org.eclipse.ui.internal.ide.dialogs.PathVariableSelectionDialog;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* This class is part of the NewClassWizard
|
||||||
|
* It handels the Link to file part
|
||||||
*/
|
*/
|
||||||
public class LinkToFileGroup extends StringButtonDialogField {
|
public class LinkToFileGroup extends StringButtonDialogField {
|
||||||
private String fText;
|
private String fText;
|
||||||
|
@ -59,7 +59,6 @@ public class LinkToFileGroup extends StringButtonDialogField {
|
||||||
protected Text linkTargetField;
|
protected Text linkTargetField;
|
||||||
protected Button linkButton;
|
protected Button linkButton;
|
||||||
protected Button browseButton;
|
protected Button browseButton;
|
||||||
protected Button variablesButton;
|
|
||||||
private Label resolvedPathLabelText;
|
private Label resolvedPathLabelText;
|
||||||
private Label resolvedPathLabelData;
|
private Label resolvedPathLabelData;
|
||||||
private boolean preventDialogFieldChanged = false;
|
private boolean preventDialogFieldChanged = false;
|
||||||
|
@ -80,14 +79,11 @@ public class LinkToFileGroup extends StringButtonDialogField {
|
||||||
getLinkCheckButtonControl(parent);
|
getLinkCheckButtonControl(parent);
|
||||||
|
|
||||||
Text text= getTextControl(parent);
|
Text text= getTextControl(parent);
|
||||||
text.setLayoutData(gridDataForText(1));
|
text.setLayoutData(gridDataForText(2));
|
||||||
|
|
||||||
Button browseButton = getBrowseButtonControl(parent);
|
Button browseButton = getBrowseButtonControl(parent);
|
||||||
browseButton.setLayoutData(gridDataForButton(browseButton, 1));
|
browseButton.setLayoutData(gridDataForButton(browseButton, 1));
|
||||||
|
|
||||||
Button variablesButton = getVariablesButtonControl(parent);
|
|
||||||
variablesButton.setLayoutData(gridDataForButton(variablesButton, 1));
|
|
||||||
|
|
||||||
DialogField.createEmptySpace(parent);
|
DialogField.createEmptySpace(parent);
|
||||||
|
|
||||||
resolvedPathLabelText = new Label(parent, SWT.SINGLE);
|
resolvedPathLabelText = new Label(parent, SWT.SINGLE);
|
||||||
|
@ -120,7 +116,6 @@ public class LinkToFileGroup extends StringButtonDialogField {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
createLink = linkButton.getSelection();
|
createLink = linkButton.getSelection();
|
||||||
browseButton.setEnabled(createLink);
|
browseButton.setEnabled(createLink);
|
||||||
variablesButton.setEnabled(createLink);
|
|
||||||
linkTargetField.setEnabled(createLink);
|
linkTargetField.setEnabled(createLink);
|
||||||
resolveVariable();
|
resolveVariable();
|
||||||
if (listener != null)
|
if (listener != null)
|
||||||
|
@ -196,23 +191,6 @@ public class LinkToFileGroup extends StringButtonDialogField {
|
||||||
return browseButton;
|
return browseButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Button getVariablesButtonControl(Composite parent){
|
|
||||||
// variables button
|
|
||||||
if(variablesButton == null){
|
|
||||||
assertCompositeNotNull(parent);
|
|
||||||
variablesButton = new Button(parent, SWT.PUSH);
|
|
||||||
//setButtonLayoutData(variablesButton);
|
|
||||||
variablesButton.setFont(parent.getFont());
|
|
||||||
variablesButton.setText(NewWizardMessages.getString("CreateLinkedResourceGroup.variablesButton")); //$NON-NLS-1$
|
|
||||||
variablesButton.addSelectionListener(new SelectionAdapter() {
|
|
||||||
public void widgetSelected(SelectionEvent event) {
|
|
||||||
handleVariablesButtonPressed();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
variablesButton.setEnabled(createLink);
|
|
||||||
}
|
|
||||||
return variablesButton;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Returns a new status object with the given severity and message.
|
* Returns a new status object with the given severity and message.
|
||||||
*
|
*
|
||||||
|
@ -221,7 +199,7 @@ public class LinkToFileGroup extends StringButtonDialogField {
|
||||||
private IStatus createStatus(int severity, String message) {
|
private IStatus createStatus(int severity, String message) {
|
||||||
return new Status(
|
return new Status(
|
||||||
severity,
|
severity,
|
||||||
WorkbenchPlugin.getDefault().getBundle().getSymbolicName(),
|
CUIPlugin.getPluginId(),
|
||||||
severity,
|
severity,
|
||||||
message,
|
message,
|
||||||
null);
|
null);
|
||||||
|
@ -279,7 +257,7 @@ public class LinkToFileGroup extends StringButtonDialogField {
|
||||||
if (linkTargetName != null)
|
if (linkTargetName != null)
|
||||||
dialog.setFilterPath(linkTargetName);
|
dialog.setFilterPath(linkTargetName);
|
||||||
}
|
}
|
||||||
dialog.setMessage(WorkbenchMessages.getString("CreateLinkedResourceGroup.targetSelectionLabel")); //$NON-NLS-1$
|
dialog.setMessage(NewWizardMessages.getString("CreateLinkedResourceGroup.targetSelectionLabel")); //$NON-NLS-1$
|
||||||
selection = dialog.open();
|
selection = dialog.open();
|
||||||
}
|
}
|
||||||
if (selection != null) {
|
if (selection != null) {
|
||||||
|
@ -288,29 +266,6 @@ public class LinkToFileGroup extends StringButtonDialogField {
|
||||||
dialogFieldChanged();
|
dialogFieldChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Opens a path variable selection dialog
|
|
||||||
*/
|
|
||||||
protected void handleVariablesButtonPressed() {
|
|
||||||
int variableTypes = IResource.FOLDER;
|
|
||||||
|
|
||||||
// allow selecting file and folder variables when creating a
|
|
||||||
// linked file
|
|
||||||
if (type == IResource.FILE)
|
|
||||||
variableTypes |= IResource.FILE;
|
|
||||||
|
|
||||||
PathVariableSelectionDialog dialog =
|
|
||||||
new PathVariableSelectionDialog(linkTargetField.getShell(), variableTypes);
|
|
||||||
if (dialog.open() == IDialogConstants.OK_ID) {
|
|
||||||
String[] variableNames = (String[]) dialog.getResult();
|
|
||||||
if (variableNames != null && variableNames.length == 1)
|
|
||||||
{
|
|
||||||
linkTargetField.setText(variableNames[0]);
|
|
||||||
if (!preventDialogFieldChanged)
|
|
||||||
dialogFieldChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Tries to resolve the value entered in the link target field as
|
* Tries to resolve the value entered in the link target field as
|
||||||
* a variable, if the value is a relative path.
|
* a variable, if the value is a relative path.
|
||||||
|
@ -326,14 +281,6 @@ public class LinkToFileGroup extends StringButtonDialogField {
|
||||||
IPath path = new Path(linkTargetField.getText());
|
IPath path = new Path(linkTargetField.getText());
|
||||||
IPath resolvedPath = pathVariableManager.resolvePath(path);
|
IPath resolvedPath = pathVariableManager.resolvePath(path);
|
||||||
|
|
||||||
/* (path.equals(resolvedPath)) {
|
|
||||||
resolvedPathLabelText.setVisible(false);
|
|
||||||
resolvedPathLabelData.setVisible(false);
|
|
||||||
} else {
|
|
||||||
resolvedPathLabelText.setVisible(true);
|
|
||||||
resolvedPathLabelData.setVisible(true);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
resolvedPathLabelData.setText(resolvedPath.toOSString());
|
resolvedPathLabelData.setText(resolvedPath.toOSString());
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -361,11 +308,11 @@ public class LinkToFileGroup extends StringButtonDialogField {
|
||||||
if (type == IResource.FILE && linkTargetFile.isFile() == false) {
|
if (type == IResource.FILE && linkTargetFile.isFile() == false) {
|
||||||
return createStatus(
|
return createStatus(
|
||||||
IStatus.ERROR,
|
IStatus.ERROR,
|
||||||
WorkbenchMessages.getString("CreateLinkedResourceGroup.linkTargetNotFile")); //$NON-NLS-1$
|
NewWizardMessages.getString("CreateLinkedResourceGroup.linkTargetNotFile")); //$NON-NLS-1$
|
||||||
} else if (type == IResource.FOLDER && linkTargetFile.isDirectory() == false) {
|
} else if (type == IResource.FOLDER && linkTargetFile.isDirectory() == false) {
|
||||||
return createStatus(
|
return createStatus(
|
||||||
IStatus.ERROR,
|
IStatus.ERROR,
|
||||||
WorkbenchMessages.getString("CreateLinkedResourceGroup.linkTargetNotFolder")); //$NON-NLS-1$
|
NewWizardMessages.getString("CreateLinkedResourceGroup.linkTargetNotFolder")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return createStatus(IStatus.OK, ""); //$NON-NLS-1$
|
return createStatus(IStatus.OK, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -402,7 +349,7 @@ public class LinkToFileGroup extends StringButtonDialogField {
|
||||||
// locationStatus takes precedence over missing location warning.
|
// locationStatus takes precedence over missing location warning.
|
||||||
return createStatus(
|
return createStatus(
|
||||||
IStatus.WARNING,
|
IStatus.WARNING,
|
||||||
WorkbenchMessages.getString("CreateLinkedResourceGroup.linkTargetNonExistent")); //$NON-NLS-1$
|
NewWizardMessages.getString("CreateLinkedResourceGroup.linkTargetNonExistent")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return locationStatus;
|
return locationStatus;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class StringDialogField extends DialogField {
|
||||||
protected static GridData gridDataForText(int span) {
|
protected static GridData gridDataForText(int span) {
|
||||||
GridData gd= new GridData();
|
GridData gd= new GridData();
|
||||||
gd.horizontalAlignment= GridData.FILL;
|
gd.horizontalAlignment= GridData.FILL;
|
||||||
gd.grabExcessHorizontalSpace= false;
|
gd.grabExcessHorizontalSpace= true;
|
||||||
gd.horizontalSpan= span;
|
gd.horizontalSpan= span;
|
||||||
return gd;
|
return gd;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue