Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-patch] fix for 47570


Thanks Chris,
I guess both of us fixed it the same way. Take a look at what I have submitted and tell me if you want any changes.

Hoda Amer
Staff Software Engineer
Rational Software - IBM Software Group



Chris Wiebe <cwiebe@xxxxxxx>
Sent by: cdt-patch-admin@xxxxxxxxxxx

06/24/2004 04:02 PM

Please respond to
cdt-patch

To
cdt-patch@xxxxxxxxxxx
cc
alain@xxxxxxx
Subject
[cdt-patch] fix for 47570





This patch gets rid of the dependencies on internal eclipse classes in
the class wizard.  After discussion with Alain, we decided to remove the
"Variables" button from the class wizard page since 1) the variable path
manager stuff never worked correctly and 2) the new proposed class
wizard will soon deprecate this anyway.

-Chris

Index: src/org/eclipse/cdt/internal/ui/wizards/NewWizardMessages.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/NewWizardMessages.properties,v
retrieving revision 1.12
diff -u -r1.12 NewWizardMessages.properties
--- src/org/eclipse/cdt/internal/ui/wizards/NewWizardMessages.properties                 24 Jun 2004 19:29:33 -0000                 1.12
+++ src/org/eclipse/cdt/internal/ui/wizards/NewWizardMessages.properties                 24 Jun 2004 19:56:06 -0000
@@ -156,6 +156,15 @@
CreateLinkedResourceGroup.browseButton=Browse...
CreateLinkedResourceGroup.variablesButton=Variables...
CreateLinkedResourceGroup.open=Open
+CreateLinkedResourceGroup.linkFileButton = &Link to file in the file system
+CreateLinkedResourceGroup.linkFolderButton = &Link to folder in the file system
+CreateLinkedResourceGroup.targetSelectionLabel = Select the link target.
+CreateLinkedResourceGroup.linkTargetEmpty = Link target must be specified
+CreateLinkedResourceGroup.linkTargetNotFile = Link target must be a file
+CreateLinkedResourceGroup.linkTargetNotFolder = Link target must be a folder
+CreateLinkedResourceGroup.linkTargetInvalid = Link target name is invalid
+CreateLinkedResourceGroup.linkTargetNonExistent = Link target does not exist
+CreateLinkedResourceGroup.linkTargetNotAbsolute = Link target must be absolute path or path variable and relative path.

NewClassWizardPage.error.EnterClassName=Class name is empty.
NewClassWizardPage.error.ClassNameExists=Class already exists.
Index: src/org/eclipse/cdt/internal/ui/wizards/dialogfields/LinkToFileGroup.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/dialogfields/LinkToFileGroup.java,v
retrieving revision 1.9
diff -u -r1.9 LinkToFileGroup.java
--- src/org/eclipse/cdt/internal/ui/wizards/dialogfields/LinkToFileGroup.java                 24 Jun 2004 16:03:09 -0000                 1.9
+++ src/org/eclipse/cdt/internal/ui/wizards/dialogfields/LinkToFileGroup.java                 24 Jun 2004 19:56:06 -0000
@@ -13,6 +13,7 @@
import java.io.File;

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.IResource;
import org.eclipse.core.resources.IWorkspace;
@@ -38,9 +39,6 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
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;

/**
 */
@@ -59,7 +57,6 @@
                 protected Text linkTargetField;
                 protected Button linkButton;
                 protected Button browseButton;
-                 protected Button variablesButton;
                 private Label resolvedPathLabelText;
                 private Label resolvedPathLabelData;
                 private boolean preventDialogFieldChanged = false;
@@ -83,11 +80,8 @@
                                  text.setLayoutData(gridDataForText(1));

                                  Button browseButton = getBrowseButtonControl(parent);                                  
-                                  browseButton.setLayoutData(gridDataForButton(browseButton, 1));
+                                  browseButton.setLayoutData(gridDataForButton(browseButton, 2));

-                                  Button variablesButton = getVariablesButtonControl(parent);                                  
-                                  variablesButton.setLayoutData(gridDataForButton(variablesButton, 1));
-                                  
                                  DialogField.createEmptySpace(parent);

                                  resolvedPathLabelText = new Label(parent, SWT.SINGLE);
@@ -107,7 +101,7 @@
                  * @see DialogField#getNumberOfControls
                  */                                  
                 public int getNumberOfControls() {
-                                  return 5;                
+                                  return 4;                
                 }
                 
                 public Button getLinkCheckButtonControl(Composite parent){
@@ -120,7 +114,6 @@
                                                                    public void widgetSelected(SelectionEvent e) {
                                                                                     createLink = linkButton.getSelection();
                                                                                     browseButton.setEnabled(createLink);
-                                                                                     variablesButton.setEnabled(createLink);
                                                                                     linkTargetField.setEnabled(createLink);
                                                                                     resolveVariable();
                                                                                     if (listener != null)
@@ -196,23 +189,6 @@
                                  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.
                  *
@@ -221,7 +197,7 @@
                 private IStatus createStatus(int severity, String message) {
                                  return new Status(
                                                   severity,
-                                                   WorkbenchPlugin.getDefault().getBundle().getSymbolicName(),
+                                                   CUIPlugin.PLUGIN_ID,
                                                   severity,
                                                   message,                
                                                   null);
@@ -279,7 +255,7 @@
                                                                    if (linkTargetName != null)
                                                                                     dialog.setFilterPath(linkTargetName);
                                                   }
-                                                   dialog.setMessage(WorkbenchMessages.getString("CreateLinkedResourceGroup.targetSelectionLabel")); //$NON-NLS-1$
+                                                   dialog.setMessage(NewWizardMessages.getString("CreateLinkedResourceGroup.targetSelectionLabel")); //$NON-NLS-1$
                                                   selection = dialog.open();
                                  }                                                                                    
                                  if (selection != null) {
@@ -289,29 +265,6 @@
                                  }
                 }
                 /**
-                  * 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
                  * a variable, if the value is a relative path.
                  * Displays the resolved value if the entered value is a variable.
@@ -361,11 +314,12 @@
                                  if (type == IResource.FILE && linkTargetFile.isFile() == false) {
                                                   return createStatus(
                                                                    IStatus.ERROR,
-                                                                    WorkbenchMessages.getString("CreateLinkedResourceGroup.linkTargetNotFile"));                 //$NON-NLS-1$
-                                  } else if (type == IResource.FOLDER && linkTargetFile.isDirectory() == false) {
+                                                                    NewWizardMessages.getString("CreateLinkedResourceGroup.linkTargetNotFile"));                 //$NON-NLS-1$
+                                  }
+                                  else if (type == IResource.FOLDER && linkTargetFile.isDirectory() == false) {
                                                   return createStatus(
                                                                    IStatus.ERROR,
-                                                                    WorkbenchMessages.getString("CreateLinkedResourceGroup.linkTargetNotFolder"));                 //$NON-NLS-1$
+                                                                    NewWizardMessages.getString("CreateLinkedResourceGroup.linkTargetNotFolder"));                 //$NON-NLS-1$
                                  }
                                  return createStatus(IStatus.OK, ""); //$NON-NLS-1$
                 }
@@ -402,7 +356,7 @@
                                                   // locationStatus takes precedence over missing location warning.
                                                   return createStatus(
                                                                    IStatus.WARNING,
-                                                                    WorkbenchMessages.getString("CreateLinkedResourceGroup.linkTargetNonExistent"));                 //$NON-NLS-1$                
+                                                                    NewWizardMessages.getString("CreateLinkedResourceGroup.linkTargetNonExistent"));                 //$NON-NLS-1$                
                                  }
                                  return locationStatus;
                 }


Back to the top