1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-30 12:25:35 +02:00

Commits for the deprecation of IPluginDescriptor (may it rest in peace)

This commit is contained in:
Sean Evoy 2004-05-19 19:36:11 +00:00
parent 22c73dc031
commit ad91f39a81
19 changed files with 161 additions and 765 deletions

View file

@ -14,7 +14,7 @@ package org.eclipse.cdt.managedbuilder.internal.ui;
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.cdt.ui.*;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
@ -29,14 +29,11 @@ public class ManagedBuilderUIImages {
private static ImageRegistry imageRegistry = new ImageRegistry();
// Subdirectory (under the package containing this class) where 16 color images are
private static URL fgIconBaseURL;
private static URL iconBaseURL = null;
static {
try {
fgIconBaseURL= new URL(ManagedBuilderUIPlugin.getDefault().getDescriptor().getInstallURL(), "icons/" ); //$NON-NLS-1$
} catch (MalformedURLException e) {
CUIPlugin.getDefault().log(e);
}
iconBaseURL = Platform.getBundle(ManagedBuilderUIPlugin.getUniqueIdentifier()).getEntry("icons/");
}
private static final String NAME_PREFIX= ManagedBuilderUIPlugin.getUniqueIdentifier() + '.';
private static final int NAME_PREFIX_LENGTH= NAME_PREFIX.length();
private static final String T= "full/"; //$NON-NLS-1$
@ -100,9 +97,9 @@ public class ManagedBuilderUIImages {
StringBuffer buffer= new StringBuffer(prefix);
buffer.append(name);
try {
return new URL(fgIconBaseURL, buffer.toString());
return new URL(iconBaseURL, buffer.toString());
} catch (MalformedURLException e) {
CUIPlugin.getDefault().log(e);
ManagedBuilderUIPlugin.log(e);
return null;
}
}

View file

@ -0,0 +1,56 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.managedbuilder.internal.ui;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* @since 2.0
*/
public class ManagedBuilderUIMessages {
// Bundle ID
private static final String BUNDLE_ID = "org.eclipse.cdt.managedbuilder.internal.ui.PluginResources"; //$NON-NLS-1$
//Resource bundle.
private static ResourceBundle resourceBundle;
static {
try {
resourceBundle = ResourceBundle.getBundle(BUNDLE_ID);
} catch (MissingResourceException x) {
resourceBundle = null;
}
}
public static String getFormattedString(String key, String arg) {
return MessageFormat.format(getResourceString(key), new String[] { arg });
}
public static String getFormattedString(String key, String[] args) {
return MessageFormat.format(getResourceString(key), args);
}
public static String getResourceString(String key) {
try {
return resourceBundle.getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
private ManagedBuilderUIMessages() {
// No constructor
}
}

View file

@ -12,14 +12,10 @@ package org.eclipse.cdt.managedbuilder.internal.ui;
* **********************************************************************/
import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
@ -32,22 +28,9 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
public class ManagedBuilderUIPlugin extends AbstractUIPlugin {
//The shared instance.
private static ManagedBuilderUIPlugin plugin;
//Resource bundle.
private static ResourceBundle resourceBundle;
/**
* @param descriptor
*/
public ManagedBuilderUIPlugin(IPluginDescriptor descriptor) {
super(descriptor);
plugin = this;
try {
resourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.managedbuilder.internal.ui.PluginResources"); //$NON-NLS-1$
} catch (MissingResourceException x) {
resourceBundle = null;
}
}
// Unique ID of the plugin
private static final String PLUGIN_ID = "org.eclipse.cdt.managedbuilder.ui"; //$NON-NLS-1$
public static Shell getActiveWorkbenchShell() {
IWorkbenchWindow window = getActiveWorkbenchWindow();
if (window != null) {
@ -70,16 +53,6 @@ public class ManagedBuilderUIPlugin extends AbstractUIPlugin {
return plugin;
}
public static String getResourceString(String key) {
try {
return resourceBundle.getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
/**
* Answers the <code>Shell</code> associated with the active workbench, or
* one of the windows associated with the workbench.
@ -94,25 +67,11 @@ public class ManagedBuilderUIPlugin extends AbstractUIPlugin {
}
}
public static String getFormattedString(String key, String arg) {
return MessageFormat.format(getResourceString(key), new String[] { arg });
}
public static String getFormattedString(String key, String[] args) {
return MessageFormat.format(getResourceString(key), args);
}
/**
* Convenience method which returns the unique identifier of this plugin.
*/
public static String getUniqueIdentifier() {
if (getDefault() == null) {
// If the default instance is not yet initialized,
// return a static identifier. This identifier must
// match the plugin id defined in plugin.xml
return "org.eclipse.cdt.managedbuilder.ui"; //$NON-NLS-1$
}
return getDefault().getDescriptor().getUniqueIdentifier();
return PLUGIN_ID;
}
public static void log(IStatus status) {

View file

@ -36,8 +36,8 @@ public class ManagedMakeStartup implements IStartup {
for (int index = projects.length - 1; index >= 0; --index) {
IProject project = projects[index];
boolean shouldUpdate = MessageDialog.openQuestion(shell,
ManagedBuilderUIPlugin.getResourceString("ManagedBuilderStartup.update.12x.title"), //$NON-NLS-1$
ManagedBuilderUIPlugin.getFormattedString("ManagedBuilderStartup.update.12x.message", new String[]{project.getName()})); //$NON-NLS-1$
ManagedBuilderUIMessages.getResourceString("ManagedBuilderStartup.update.12x.title"), //$NON-NLS-1$
ManagedBuilderUIMessages.getFormattedString("ManagedBuilderStartup.update.12x.message", new String[]{project.getName()})); //$NON-NLS-1$
// Go for it
if (shouldUpdate) {
ProgressMonitorDialog pd = new ProgressMonitorDialog(shell);

View file

@ -32,6 +32,7 @@ import org.eclipse.cdt.managedbuilder.core.IToolReference;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@ -118,13 +119,13 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
if (backupFile.exists()) {
Shell shell = ManagedBuilderUIPlugin.getDefault().getShell();
boolean shouldUpdate = MessageDialog.openQuestion(shell,
ManagedBuilderUIPlugin.getResourceString("ManagedBuildConvert.12x.warning.title"), //$NON-NLS-1$
ManagedBuilderUIPlugin.getFormattedString("ManagedBuildConvert.12x.warning.message", project.getName())); //$NON-NLS-1$
ManagedBuilderUIMessages.getResourceString("ManagedBuildConvert.12x.warning.title"), //$NON-NLS-1$
ManagedBuilderUIMessages.getFormattedString("ManagedBuildConvert.12x.warning.message", project.getName())); //$NON-NLS-1$
if (shouldUpdate) {
backupFile.delete(true, monitor);
} else {
monitor.setCanceled(true);
throw new OperationCanceledException(ManagedBuilderUIPlugin.getFormattedString("ManagedBuildConvert.12x.cancelled.message", project.getName())); //$NON-NLS-1$
throw new OperationCanceledException(ManagedBuilderUIMessages.getFormattedString("ManagedBuildConvert.12x.cancelled.message", project.getName())); //$NON-NLS-1$
}
}
settingsFile.copy(backupFile.getFullPath(), true, monitor);
@ -445,7 +446,7 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
}
// Backup the file
monitor.beginTask(ManagedBuilderUIPlugin.getFormattedString("ManagedBuildConvert.12x.monitor.message.backup", projectName), 1); //$NON-NLS-1$
monitor.beginTask(ManagedBuilderUIMessages.getFormattedString("ManagedBuildConvert.12x.monitor.message.backup", projectName), 1); //$NON-NLS-1$
backupFile(settingsFile, monitor, project);
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
@ -460,7 +461,7 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
NodeList targetNodes = document.getElementsByTagName(ITarget.TARGET_ELEMENT_NAME);
// This is a guess, but typically the project has 1 target, 2 configs, and 6 tool defs
int listSize = targetNodes.getLength();
monitor.beginTask(ManagedBuilderUIPlugin.getFormattedString("ManagedBuildConvert.12x.monitor.message.project", projectName), listSize * 9); //$NON-NLS-1$
monitor.beginTask(ManagedBuilderUIMessages.getFormattedString("ManagedBuildConvert.12x.monitor.message.project", projectName), listSize * 9); //$NON-NLS-1$
for (int targIndex = 0; targIndex < listSize; ++targIndex) {
Element oldTarget = (Element) targetNodes.item(targIndex);
String oldTargetId = oldTarget.getAttribute(ITarget.ID);
@ -563,8 +564,8 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
return;
} catch (InvocationTargetException e) {
ManagedBuilderUIPlugin.logException(e,
ManagedBuilderUIPlugin.getResourceString("ManagedBuilderStartup.update.exception.error"), //$NON-NLS-1$
ManagedBuilderUIPlugin.getFormattedString("ManagedBuilderStartup.update.exception.message", project.getName())); //$NON-NLS-1$
ManagedBuilderUIMessages.getResourceString("ManagedBuilderStartup.update.exception.error"), //$NON-NLS-1$
ManagedBuilderUIMessages.getFormattedString("ManagedBuilderStartup.update.exception.message", project.getName())); //$NON-NLS-1$
}
}

View file

@ -11,7 +11,7 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
import org.eclipse.cdt.internal.ui.dialogs.SelectionStatusDialog;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
@ -217,7 +217,7 @@ public class BrowseEntryDialog extends SelectionStatusDialog {
// Finally make the browse button
browseButton = new Button(basicGroup, SWT.PUSH);
applyDialogFont(browseButton);
browseButton.setText(ManagedBuilderUIPlugin.getResourceString(BROWSE));
browseButton.setText(ManagedBuilderUIMessages.getResourceString(BROWSE));
setButtonLayoutData(browseButton);
data = (GridData) browseButton.getLayoutData();
data.horizontalAlignment = GridData.BEGINNING;
@ -328,7 +328,7 @@ public class BrowseEntryDialog extends SelectionStatusDialog {
// Make sure that the specified location exists
IPath path = new Path(folderName);
if (!path.isValidPath(folderName)) {
updateStatus(IStatus.ERROR, ManagedBuilderUIPlugin.getResourceString(ERROR_FOLDER_NAME_INVALID)); //$NON-NLS-1$
updateStatus(IStatus.ERROR, ManagedBuilderUIMessages.getResourceString(ERROR_FOLDER_NAME_INVALID)); //$NON-NLS-1$
return;
}
}

View file

@ -1,616 +0,0 @@
package org.eclipse.cdt.managedbuilder.ui.properties;
/**********************************************************************
* Copyright (c) 2002,2004 IBM Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.util.Assert;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;
public class BuildOptionListFieldEditor extends FieldEditor {
/**
* Multi-purpose dialog to prompt the user for a value, path, or file.
*
* @since 2.0
*/
class SelectPathInputDialog extends InputDialog {
// Constants for externalized strings
private static final String BROWSE = "BuildPropertyCommon.label.browse"; //$NON-NLS-1$
private int type;
/**
* @param parentShell
* @param dialogTitle
* @param dialogMessage
* @param initialValue
* @param validator
* @param type
*/
public SelectPathInputDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue, IInputValidator validator, int type) {
super(parentShell, dialogTitle, dialogMessage, initialValue, validator);
this.type = type;
}
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
protected void createButtonsForButtonBar(Composite parent) {
super.createButtonsForButtonBar(parent);
if (type != IOption.BROWSE_NONE) {
final Button browse = createButton(parent, 3, ManagedBuilderUIPlugin.getResourceString(BROWSE), true);
browse.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent ev) {
String currentName;
String result;
switch (type) {
case IOption.BROWSE_DIR :
DirectoryDialog dialog = new DirectoryDialog(getParentShell(), SWT.OPEN);
currentName = getText().getText();
if(currentName != null && currentName.trim().length() != 0) {
dialog.setFilterPath(currentName);
}
result = dialog.open();
if(result != null) {
getText().setText(result);
}
break;
case IOption.BROWSE_FILE:
FileDialog browseDialog = new FileDialog(getParentShell());
currentName = getText().getText();
if (currentName != null && currentName.trim().length() != 0) {
browseDialog.setFilterPath(currentName);
}
result = browseDialog.open();
if (result != null) {
getText().setText(result);
}
break;
}
}
});
}
}
}
// Label constants
private static final String LABEL = "BuildPropertyCommon.label"; //$NON-NLS-1$
private static final String TITLE = LABEL + ".title"; //$NON-NLS-1$
private static final String NEW = LABEL + ".new"; //$NON-NLS-1$
private static final String REMOVE = LABEL + ".remove"; //$NON-NLS-1$
private static final String UP = LABEL + ".up"; //$NON-NLS-1$
private static final String DOWN = LABEL + ".down"; //$NON-NLS-1$
private static final String EDIT = LABEL + ".editVar"; //$NON-NLS-1$
private static final String FILE_TITLE = "BrowseEntryDialog.title.file"; //$NON-NLS-1$
private static final String DIR_TITLE = "BrowseEntryDialog.title.directory"; //$NON-NLS-1$
private static final String FILE_MSG = "BrowseEntryDialog.message.file"; //$NON-NLS-1$
private static final String DIR_MSG = "BrowseEntryDialog.message.directory"; //$NON-NLS-1$
// The top-level control for the field editor.
private Composite top;
// The list of tags.
private List list;
// The group control for the list and button composite
private Group controlGroup;
private String fieldName;
private SelectionListener selectionListener;
private int browseType;
private IConfiguration configuration;
private IResource owner;
// The button for adding the contents of the text field to the list
private Button addButton;
// The button for swapping the currently-selected list item down
private Button downButton;
// The button to start the edit process
private Button editButton;
// The button for removing the currently-selected list item.
private Button removeButton;
// The button for swapping the currently selected item up
private Button upButton;
/**
* @param name the name of the preference this field editor works on
* @param labelText the label text of the field editor
* @param parent the parent of the field editor's control
*/
public BuildOptionListFieldEditor(String name, String labelText, Composite parent) {
super(name, labelText, parent);
this.fieldName = labelText;
browseType = IOption.BROWSE_NONE;
}
/* (non-Javadoc)
* Event handler for the addButton widget
*/
protected void addPressed() {
setPresentsDefaultValue(false);
// Prompt user for a new item
String input = getNewInputObject();
// Add it to the list
if (input != null && input.length() > 0) {
int index = list.getSelectionIndex();
if (index >= 0) {
list.add(input, index + 1);
list.setSelection(index + 1);
}
else {
list.add(input, 0);
list.setSelection(0);
}
selectionChanged();
}
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
*/
protected void adjustForNumColumns(int numColumns) {
((GridData)top.getLayoutData()).horizontalSpan = numColumns;
}
/* (non-Javadoc)
* Creates the Add, Remove, Up, and Down button in the button composite.
*
* @param container the box for the buttons
*/
private void createButtons(Composite container) {
addButton = createPushButton(container, ManagedBuilderUIPlugin.getResourceString(NEW));
editButton = createPushButton(container, ManagedBuilderUIPlugin.getResourceString(EDIT));
removeButton = createPushButton(container, ManagedBuilderUIPlugin.getResourceString(REMOVE));
upButton = createPushButton(container, ManagedBuilderUIPlugin.getResourceString(UP));
downButton = createPushButton(container, ManagedBuilderUIPlugin.getResourceString(DOWN));
}
/**
* @param items
* @return
*/
protected String createList(String[] items) {
return BuildToolsSettingsStore.createList(items);
}
/* (non-Javadoc)
* Rather than using the ControlFactory helper methods, this field
* editor is using this helper method. Other field editors use a similar
* set of method calls, so this seems like the safest approach
*
* @param parent the button composite
* @param label the label to place in the button
* @return
*/
private Button createPushButton(Composite parent, String label) {
Button button = new Button(parent, SWT.PUSH);
button.setText(label);
button.setFont(parent.getFont());
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.heightHint = convertVerticalDLUsToPixels(button, IDialogConstants.BUTTON_HEIGHT);
int widthHint = convertHorizontalDLUsToPixels(button, IDialogConstants.BUTTON_WIDTH);
data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
button.setLayoutData(data);
button.addSelectionListener(getSelectionListener());
return button;
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int)
*/
protected void doFillIntoGrid(Composite parent, int numColumns) {
top = parent;
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = numColumns;
top.setLayoutData(gd);
controlGroup = ControlFactory.createGroup(top, getLabelText(), 2);
GridData groupData = new GridData(GridData.FILL_HORIZONTAL);
groupData.horizontalSpan = numColumns;
controlGroup.setLayoutData(groupData);
// Make the list
list = new List(controlGroup, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
list.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
selectionChanged();
}
});
list.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
list = null;
}
});
list.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
// Popup the editor on the selected item from the list
editSelection();
}
});
list.addKeyListener(new KeyAdapter() {
/* (non-Javadoc)
* @see org.eclipse.swt.events.KeyAdapter#keyPressed(org.eclipse.swt.events.KeyEvent)
*/
public void keyPressed(KeyEvent e) {
// Is this the delete key
if (e.keyCode == SWT.DEL) {
removePressed();
} else {
super.keyPressed(e);
}
}
});
// Create a composite for the buttons
Composite buttonGroup = new Composite(controlGroup, SWT.NONE);
GridData buttonData = new GridData();
buttonData.horizontalSpan = 1;
buttonData.verticalAlignment = GridData.BEGINNING;
buttonGroup.setLayoutData(buttonData);
GridLayout buttonLayout = new GridLayout();
buttonLayout.numColumns = 1;
buttonLayout.marginHeight = 0;
buttonLayout.marginWidth = 0;
buttonGroup.setLayout(buttonLayout);
buttonGroup.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
addButton = null;
editButton = null;
removeButton = null;
upButton = null;
downButton = null;
}
});
// Create the buttons
createButtons(buttonGroup);
// Create a grid data that takes up the extra space in the dialog and spans one column.
GridData listData = new GridData(GridData.FILL_HORIZONTAL);
Point buttonGroupSize = buttonGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT);
listData.heightHint = buttonGroupSize.y;
listData.widthHint = buttonGroupSize.x * 2;
list.setLayoutData(listData);
}
/* (non-Javadoc)
* Creates a selection listener that handles the selection events
* for the button controls and single-click events in the list to
* trigger a selection change.
*/
public void createSelectionListener() {
selectionListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
Widget widget = event.widget;
if (widget == addButton) {
addPressed();
} else if (widget == editButton) {
editPressed();
} else if (widget == removeButton) {
removePressed();
} else if (widget == upButton) {
upPressed();
} else if (widget == downButton) {
downPressed();
} else if (widget == list) {
selectionChanged();
}
}
};
}
/* (non-Javadoc)
* Event handler for the down button
*/
protected void downPressed() {
swap(false);
}
/* (non-Javadoc)
* Event handler for the edit button pressed event. Delegates
* the work to a helper method.
*/
private void editPressed() {
editSelection();
}
/* (non-Javadoc)
* Edit the value of the selected item.
*/
protected void editSelection() {
// Edit the selection index
int index = list.getSelectionIndex();
if (index != -1) {
String selItem = list.getItem(index);
if (selItem != null) {
InputDialog dialog = new InputDialog(getShell(), ManagedBuilderUIPlugin.getResourceString(TITLE), fieldName, selItem, null);
String newItem = null;
if (dialog.open() == InputDialog.OK) {
newItem = dialog.getValue();
if (newItem != null && !newItem.equals(selItem)) {
list.setItem(index, newItem);
selectionChanged();
}
}
}
}
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#doLoad()
*/
protected void doLoad() {
if (list != null) {
String s = getPreferenceStore().getString(getPreferenceName());
String[] array = parseString(s);
for (int i = 0; i < array.length; i++){
list.add(array[i]);
}
list.setSelection(0);
selectionChanged();
}
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
*/
protected void doLoadDefault() {
if (list != null) {
list.removeAll();
String s = getPreferenceStore().getDefaultString(getPreferenceName());
String[] array = parseString(s);
for (int i = 0; i < array.length; i++){
list.add(array[i]);
}
list.setSelection(0);
selectionChanged();
}
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#doStore()
*/
protected void doStore() {
String s = createList(list.getItems());
if (s != null)
getPreferenceStore().setValue(getPreferenceName(), s);
}
/* (non-Javadoc)
* @return Returns the configuration.
*/
private IConfiguration getConfiguration() {
if (configuration == null) {
BuildToolsSettingsStore store = (BuildToolsSettingsStore)getPreferenceStore();
if (store != null) {
configuration = store.getOwner();
}
}
return configuration;
}
/*(non-Javadoc)
* @return Returns the owner.
*/
private IResource getOwner() {
if (owner == null) {
IConfiguration config = getConfiguration();
if (config != null) {
owner = config.getOwner();
}
}
return owner;
}
/* (non-Javadoc)
* Answers a <code>String</code> containing the value the user entered, or
* <code>null</code> if the user cancelled the interaction.
*
* @return
*/
protected String getNewInputObject() {
// Create a dialog to prompt for a new list item
String input = null;
String title = new String();
String message = new String();
String initVal = new String();
IPath path = null;
if (browseType == IOption.BROWSE_DIR) {
title = ManagedBuilderUIPlugin.getResourceString(DIR_TITLE);
message = ManagedBuilderUIPlugin.getResourceString(DIR_MSG);
path = getOwner().getLocation();
initVal = path == null ? initVal : path.toString();
} else if (browseType == IOption.BROWSE_FILE) {
title = ManagedBuilderUIPlugin.getResourceString(FILE_TITLE);
message = ManagedBuilderUIPlugin.getResourceString(FILE_MSG);
path = getOwner().getLocation();
initVal = path == null ? initVal : path.toString();
} else {
title = ManagedBuilderUIPlugin.getResourceString(TITLE);
message = fieldName;
}
// Prompt for value
SelectPathInputDialog dialog = new SelectPathInputDialog(getShell(), title, message, initVal, null, browseType);
if (dialog.open() == SelectPathInputDialog.OK) {
input = dialog.getValue();
if (input == null || input.length() == 0) return ""; //$NON-NLS-1$
}
// Double-quote the spaces in paths (if any)
switch (browseType) {
case IOption.BROWSE_DIR:
case IOption.BROWSE_FILE:
String[] segments = input.split("\\s"); //$NON-NLS-1$
if (segments.length > 1) {
// Double-quote paths with whitespaces
input = "\"" + input + "\"";
}
break;
default:
break;
}
return input;
}
/* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls()
*/
public int getNumberOfControls() {
// The group control has a list and buttons so we want it to get at
// least 2 columns to display in.
return 2;
}
/* (non-Javadoc)
* Returns this field editor's selection listener.
* The listener is created if nessessary.
*
* @return the selection listener
*/
private SelectionListener getSelectionListener() {
if (selectionListener == null)
createSelectionListener();
return selectionListener;
}
/* (non-Javadoc)
* Returns this field editor's shell.
*
* @return the shell
*/
protected Shell getShell() {
if (addButton == null)
return null;
return addButton.getShell();
}
/* (non-Javadoc)
* @param stringList
* @return
*/
protected String[] parseString(String stringList) {
return BuildToolsSettingsStore.parseString(stringList);
}
/* (non-Javadoc)
* Event handler for the removeButton selected event
*/
protected void removePressed() {
// Remove the selected item from the list
setPresentsDefaultValue(false);
int index = list.getSelectionIndex();
if (index >= 0) {
list.remove(index);
if (index - 1 < 0) {
list.setSelection(0);
} else {
list.setSelection(index - 1);
}
selectionChanged();
}
}
/* (non-Javadoc)
* Clean up the list and button control states after the event
* handlers fire.
*/
protected void selectionChanged() {
int index = list.getSelectionIndex();
int size = list.getItemCount();
// Enable the edit button if there is at least one item in the list
editButton.setEnabled(size > 0);
// Enable the remove button if there is at least one item in the list
removeButton.setEnabled(size > 0);
// Enable the up button IFF there is more than 1 item and selection index is not first item
upButton.setEnabled(size > 1 && index > 0);
// Enable the down button IFF there is more than 1 item and selection index not last item
downButton.setEnabled(size > 1 && index >= 0 && index < size - 1);
}
/**
* Set the behaviour of the field editor when the new button is pressed.
*
* @param browseType
*/
public void setBrowseStrategy(int browseType) {
this.browseType = browseType;
}
/* (non-Javadoc)
* Swaps the location of two list elements. If the argument is <code>true</code>
* the list item is swapped with the item preceeding it in the list. Otherwise
* it is swapped with the item following it.
*
* @param moveUp
*/
private void swap(boolean moveUp) {
setPresentsDefaultValue(false);
int index = list.getSelectionIndex();
int target = moveUp ? index - 1 : index + 1;
if (index >= 0) {
String[] selection = list.getSelection();
Assert.isTrue(selection.length == 1);
list.remove(index);
list.add(selection[0], target);
list.setSelection(target);
}
selectionChanged();
}
/* (non-Javadoc)
* Event handler for the up button. It simply swaps the selected
* item with the list item above it.
*/
protected void upPressed() {
swap(true);
}
}

View file

@ -29,10 +29,7 @@ import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildSettingsPage;
import org.eclipse.cdt.managedbuilder.ui.properties.BuildToolsSettingsStore;
import org.eclipse.cdt.managedbuilder.ui.properties.ToolListContentProvider;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.preference.IPreferencePageContainer;
@ -181,7 +178,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
// Display a message page instead of the properties control
final Label invalidInfo = new Label(composite, SWT.LEFT);
invalidInfo.setFont(composite.getFont());
invalidInfo.setText(ManagedBuilderUIPlugin.getResourceString("BuildPropertyPage.error.version_low")); //$NON-NLS-1$
invalidInfo.setText(ManagedBuilderUIMessages.getResourceString("BuildPropertyPage.error.version_low")); //$NON-NLS-1$
invalidInfo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_CENTER, true, true));
return composite;
}
@ -190,7 +187,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
// Add a config selection area
Group configGroup = ControlFactory.createGroup(composite, ManagedBuilderUIPlugin.getResourceString(ACTIVE_LABEL), 1);
Group configGroup = ControlFactory.createGroup(composite, ManagedBuilderUIMessages.getResourceString(ACTIVE_LABEL), 1);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.grabExcessHorizontalSpace = true;
configGroup.setLayoutData(gd);
@ -200,24 +197,24 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
form.marginWidth = 5;
configGroup.setLayout(form);
Label platformLabel = ControlFactory.createLabel(configGroup, ManagedBuilderUIPlugin.getResourceString(PLATFORM_LABEL));
Label platformLabel = ControlFactory.createLabel(configGroup, ManagedBuilderUIMessages.getResourceString(PLATFORM_LABEL));
targetSelector = ControlFactory.createSelectCombo(configGroup, getPlatformNames(), defaultTarget.getName());
targetSelector.addListener(SWT.Selection, new Listener () {
public void handleEvent(Event e) {
handleTargetSelection();
}
});
targetSelector.setToolTipText(ManagedBuilderUIPlugin.getResourceString(PLAT_TIP));
Label configLabel = ControlFactory.createLabel(configGroup, ManagedBuilderUIPlugin.getResourceString(CONFIG_LABEL));
targetSelector.setToolTipText(ManagedBuilderUIMessages.getResourceString(PLAT_TIP));
Label configLabel = ControlFactory.createLabel(configGroup, ManagedBuilderUIMessages.getResourceString(CONFIG_LABEL));
configSelector = new Combo(configGroup, SWT.READ_ONLY|SWT.DROP_DOWN);
configSelector.addListener(SWT.Selection, new Listener () {
public void handleEvent(Event e) {
handleConfigSelection();
}
});
configSelector.setToolTipText(ManagedBuilderUIPlugin.getResourceString(CONF_TIP));
manageConfigs = ControlFactory.createPushButton(configGroup, ManagedBuilderUIPlugin.getResourceString(ADD_CONF));
manageConfigs.setToolTipText(ManagedBuilderUIPlugin.getResourceString(ADD_TIP));
configSelector.setToolTipText(ManagedBuilderUIMessages.getResourceString(CONF_TIP));
manageConfigs = ControlFactory.createPushButton(configGroup, ManagedBuilderUIMessages.getResourceString(ADD_CONF));
manageConfigs.setToolTipText(ManagedBuilderUIMessages.getResourceString(ADD_TIP));
manageConfigs.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleManageConfig();
@ -249,7 +246,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
configSelector.setLayoutData(fd);
// Create the sash form
sashGroup = ControlFactory.createGroup(composite, ManagedBuilderUIPlugin.getResourceString(SETTINGS_LABEL), 1);
sashGroup = ControlFactory.createGroup(composite, ManagedBuilderUIMessages.getResourceString(SETTINGS_LABEL), 1);
sashGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
sashForm = new SashForm(sashGroup, SWT.NONE);
sashForm.setOrientation(SWT.HORIZONTAL);
@ -539,7 +536,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
int selectionIndex = configSelector.getSelectionIndex();
if (selectionIndex == -1) return;
String configName = configSelector.getItem(selectionIndex);
if (configName.equals(ManagedBuilderUIPlugin.getResourceString(ALL_CONFS))) {
if (configName.equals(ManagedBuilderUIMessages.getResourceString(ALL_CONFS))) {
// This is the all config
return;
} else {
@ -592,7 +589,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
// Event handler for the manage configuration button event
private void handleManageConfig () {
ManageConfigDialog manageDialog = new ManageConfigDialog(getShell(), ManagedBuilderUIPlugin.getResourceString(MANAGE_TITLE), selectedTarget);
ManageConfigDialog manageDialog = new ManageConfigDialog(getShell(), ManagedBuilderUIMessages.getResourceString(MANAGE_TITLE), selectedTarget);
if (manageDialog.open() == ManageConfigDialog.OK) {
boolean updateConfigs = false;
@ -881,6 +878,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
ListIterator iter = pages.listIterator();
while (iter.hasNext()) {
BuildSettingsPage page = (BuildSettingsPage) iter.next();
if (page == null) continue;
if (page instanceof BuildToolSettingsPage) {
// if the currentsettings page is not the tool settings page
// then update the all build options field editor based on the

View file

@ -23,7 +23,7 @@ import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.ToolReference;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.graphics.Point;
@ -31,10 +31,10 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
// Field editor label
private static final String COMMAND = "FieldEditors.tool.command"; //$NON-NLS-1$
// option names that stores additional options
private static final String COMPILER_FLAGS = ManagedBuilderUIPlugin.getResourceString("BuildToolSettingsPage.compilerflags"); //$NON-NLS-1$
private static final String LINKER_FLAGS = ManagedBuilderUIPlugin.getResourceString("BuildToolSettingsPage.linkerflags"); //$NON-NLS-1$
private static final String COMPILER_FLAGS = ManagedBuilderUIMessages.getResourceString("BuildToolSettingsPage.compilerflags"); //$NON-NLS-1$
private static final String LINKER_FLAGS = ManagedBuilderUIMessages.getResourceString("BuildToolSettingsPage.linkerflags"); //$NON-NLS-1$
// all build options field editor label
private static final String ALL_OPTIONS = ManagedBuilderUIPlugin.getResourceString("BuildToolSettingsPage.alloptions"); //$NON-NLS-1$
private static final String ALL_OPTIONS = ManagedBuilderUIMessages.getResourceString("BuildToolSettingsPage.alloptions"); //$NON-NLS-1$
// Whitespace character
private static final String WHITESPACE = " "; //$NON-NLS-1$
// field editor that displays all the build options for a particular tool
@ -75,7 +75,7 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
super.createFieldEditors();
// Add a string editor to edit the tool command
StringFieldEditor stringField = new StringFieldEditor(tool.getId(),
ManagedBuilderUIPlugin.getResourceString(COMMAND),
ManagedBuilderUIMessages.getResourceString(COMMAND),
getFieldEditorParent());
stringField.setEmptyStringAllowed(false);
addField(stringField);

View file

@ -11,7 +11,7 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIImages;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IInputValidator;
@ -74,7 +74,7 @@ public class FileListControl {
protected void createButtonsForButtonBar(Composite parent) {
super.createButtonsForButtonBar(parent);
if (type != IOption.BROWSE_NONE) {
final Button browse = createButton(parent, 3, ManagedBuilderUIPlugin.getResourceString(BROWSE), false);
final Button browse = createButton(parent, 3, ManagedBuilderUIMessages.getResourceString(BROWSE), false);
browse.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent ev) {
String currentName;
@ -129,16 +129,16 @@ public class FileListControl {
// The type of browse support that is required
private int browseType;
private IPath path;
private static final String ADD_STR = ManagedBuilderUIPlugin.getResourceString("FileListControl.add"); //$NON-NLS-1$
private static final String DEL_STR = ManagedBuilderUIPlugin.getResourceString("FileListControl.delete"); //$NON-NLS-1$
private static final String EDIT_STR = ManagedBuilderUIPlugin.getResourceString("FileListControl.edit"); //$NON-NLS-1$
private static final String MOVEUP_STR = ManagedBuilderUIPlugin.getResourceString("FileListControl.moveup"); //$NON-NLS-1$
private static final String MOVEDOWN_STR = ManagedBuilderUIPlugin.getResourceString("FileListControl.movedown"); //$NON-NLS-1$
private static final String FILE_TITLE = ManagedBuilderUIPlugin.getResourceString("BrowseEntryDialog.title.file"); //$NON-NLS-1$
private static final String DIR_TITLE = ManagedBuilderUIPlugin.getResourceString("BrowseEntryDialog.title.directory"); //$NON-NLS-1$
private static final String FILE_MSG = ManagedBuilderUIPlugin.getResourceString("BrowseEntryDialog.message.file"); //$NON-NLS-1$
private static final String DIR_MSG = ManagedBuilderUIPlugin.getResourceString("BrowseEntryDialog.message.directory"); //$NON-NLS-1$
private static final String TITLE = ManagedBuilderUIPlugin.getResourceString("BuildPropertyCommon.label.title"); //$NON-NLS-1$
private static final String ADD_STR = ManagedBuilderUIMessages.getResourceString("FileListControl.add"); //$NON-NLS-1$
private static final String DEL_STR = ManagedBuilderUIMessages.getResourceString("FileListControl.delete"); //$NON-NLS-1$
private static final String EDIT_STR = ManagedBuilderUIMessages.getResourceString("FileListControl.edit"); //$NON-NLS-1$
private static final String MOVEUP_STR = ManagedBuilderUIMessages.getResourceString("FileListControl.moveup"); //$NON-NLS-1$
private static final String MOVEDOWN_STR = ManagedBuilderUIMessages.getResourceString("FileListControl.movedown"); //$NON-NLS-1$
private static final String FILE_TITLE = ManagedBuilderUIMessages.getResourceString("BrowseEntryDialog.title.file"); //$NON-NLS-1$
private static final String DIR_TITLE = ManagedBuilderUIMessages.getResourceString("BrowseEntryDialog.title.directory"); //$NON-NLS-1$
private static final String FILE_MSG = ManagedBuilderUIMessages.getResourceString("BrowseEntryDialog.message.file"); //$NON-NLS-1$
private static final String DIR_MSG = ManagedBuilderUIMessages.getResourceString("BrowseEntryDialog.message.directory"); //$NON-NLS-1$
private static final String TITLE = ManagedBuilderUIMessages.getResourceString("BuildPropertyCommon.label.title"); //$NON-NLS-1$
//images
private final Image IMG_ADD = ManagedBuilderUIImages
.get(ManagedBuilderUIImages.IMG_FILELIST_ADD);
@ -367,8 +367,8 @@ public class FileListControl {
private void removePressed() {
int index = list.getSelectionIndex();
if (browseType == IOption.BROWSE_DIR || browseType == IOption.BROWSE_FILE) {
String quest = ManagedBuilderUIPlugin.getResourceString("FileListControl.deletedialog.message"); //$NON-NLS-1$
String title = ManagedBuilderUIPlugin.getResourceString("FileListControl.deletedialog.title"); //$NON-NLS-1$
String quest = ManagedBuilderUIMessages.getResourceString("FileListControl.deletedialog.message"); //$NON-NLS-1$
String title = ManagedBuilderUIMessages.getResourceString("FileListControl.deletedialog.title"); //$NON-NLS-1$
boolean delDir = MessageDialog.openQuestion(list.getShell(), title,
quest);
if (delDir && index != -1)
@ -408,7 +408,7 @@ public class FileListControl {
int index = list.getSelectionIndex();
if (index != -1) {
String selItem = list.getItem(index);
String title = ManagedBuilderUIPlugin.getResourceString("FileListControl.editdialog.title"); //$NON-NLS-1$
String title = ManagedBuilderUIMessages.getResourceString("FileListControl.editdialog.title"); //$NON-NLS-1$
if (selItem != null) {
InputDialog dialog = new InputDialog(null, title, compTitle,
selItem, null);

View file

@ -18,7 +18,7 @@ import java.util.TreeMap;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
@ -144,14 +144,14 @@ public class ManageConfigDialog extends Dialog {
private void createBuildArtifactGroup(Composite parent) {
final Group outputGroup = new Group(parent, SWT.NONE);
outputGroup.setFont(parent.getFont());
outputGroup.setText(ManagedBuilderUIPlugin.getResourceString(OUTPUT_GROUP));
outputGroup.setText(ManagedBuilderUIMessages.getResourceString(OUTPUT_GROUP));
outputGroup.setLayout(new GridLayout(3, false));
outputGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Three labels
final Label nameLabel = new Label(outputGroup, SWT.LEFT);
nameLabel.setFont(outputGroup.getFont());
nameLabel.setText(ManagedBuilderUIPlugin.getResourceString(OUTPUT_NAME));
nameLabel.setText(ManagedBuilderUIMessages.getResourceString(OUTPUT_NAME));
nameLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Label placeHolder = new Label(outputGroup, SWT.CENTER);
@ -160,7 +160,7 @@ public class ManageConfigDialog extends Dialog {
final Label extLabel = new Label(outputGroup, SWT.LEFT);
extLabel.setFont(outputGroup.getFont());
extLabel.setText(ManagedBuilderUIPlugin.getResourceString(OUTPUT_EXT));
extLabel.setText(ManagedBuilderUIMessages.getResourceString(OUTPUT_EXT));
extLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Now we need two text widgets separated by a label
@ -212,20 +212,20 @@ public class ManageConfigDialog extends Dialog {
// Create the config list group area
final Group configListGroup = new Group(parent, SWT.NONE);
configListGroup.setFont(parent.getFont());
configListGroup.setText(ManagedBuilderUIPlugin.getResourceString(CONFIGS));
configListGroup.setText(ManagedBuilderUIMessages.getResourceString(CONFIGS));
configListGroup.setLayout(new GridLayout(3, false));
configListGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
// Create the 2 labels first to align the buttons and list controls
final Label currentConfigLabel = new Label(configListGroup, SWT.LEFT);
currentConfigLabel.setFont(configListGroup.getFont());
currentConfigLabel.setText(ManagedBuilderUIPlugin.getResourceString(CURRENT_CONFIGS));
currentConfigLabel.setText(ManagedBuilderUIMessages.getResourceString(CURRENT_CONFIGS));
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
currentConfigLabel.setLayoutData(data);
final Label deletedConfigLabel = new Label(configListGroup, SWT.LEFT);
deletedConfigLabel.setFont(configListGroup.getFont());
deletedConfigLabel.setText(ManagedBuilderUIPlugin.getResourceString(DELETED_CONFIGS));
deletedConfigLabel.setText(ManagedBuilderUIMessages.getResourceString(DELETED_CONFIGS));
deletedConfigLabel.setLayoutData(new GridData());
// Create the current config list
@ -253,7 +253,7 @@ public class ManageConfigDialog extends Dialog {
newBtn = new Button(buttonBar, SWT.PUSH);
newBtn.setFont(buttonBar.getFont());
newBtn.setText(ManagedBuilderUIPlugin.getResourceString(NEW));
newBtn.setText(ManagedBuilderUIMessages.getResourceString(NEW));
setButtonLayoutData(newBtn);
newBtn.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
@ -268,7 +268,7 @@ public class ManageConfigDialog extends Dialog {
removeBtn = new Button(buttonBar, SWT.PUSH);
removeBtn.setFont(buttonBar.getFont());
removeBtn.setText(ManagedBuilderUIPlugin.getResourceString(REMOVE));
removeBtn.setText(ManagedBuilderUIMessages.getResourceString(REMOVE));
setButtonLayoutData(removeBtn);
removeBtn.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
@ -283,7 +283,7 @@ public class ManageConfigDialog extends Dialog {
restoreBtn = new Button(buttonBar, SWT.PUSH);
restoreBtn.setFont(buttonBar.getFont());
restoreBtn.setText(ManagedBuilderUIPlugin.getResourceString(RESTORE));
restoreBtn.setText(ManagedBuilderUIMessages.getResourceString(RESTORE));
setButtonLayoutData(restoreBtn);
restoreBtn.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
@ -346,13 +346,13 @@ public class ManageConfigDialog extends Dialog {
private void createMakeCommandGroup(Composite parent) {
final Group makeCommandGroup = new Group(parent, SWT.NONE);
makeCommandGroup.setFont(parent.getFont());
makeCommandGroup.setText(ManagedBuilderUIPlugin.getResourceString(GROUP));
makeCommandGroup.setText(ManagedBuilderUIMessages.getResourceString(GROUP));
makeCommandGroup.setLayout(new GridLayout(1, true));
makeCommandGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
makeCommandDefault = new Button(makeCommandGroup, SWT.CHECK | SWT.LEFT);
makeCommandDefault.setFont(makeCommandGroup.getFont());
makeCommandDefault.setText(ManagedBuilderUIPlugin.getResourceString(DEF_BTN));
makeCommandDefault.setText(ManagedBuilderUIMessages.getResourceString(DEF_BTN));
setButtonLayoutData(makeCommandDefault);
makeCommandDefault.setBackground(makeCommandGroup.getBackground());
makeCommandDefault.setForeground(makeCommandGroup.getForeground());
@ -476,7 +476,7 @@ public class ManageConfigDialog extends Dialog {
}
NewConfigurationDialog dialog = new NewConfigurationDialog(getShell(),
managedTarget,
ManagedBuilderUIPlugin.getResourceString(CONF_DLG));
ManagedBuilderUIMessages.getResourceString(CONF_DLG));
if (dialog.open() == NewConfigurationDialog.OK) {
// Get the new name and configuration to base the new config on
String newConfigName = dialog.getNewName();

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedProjectOptionBlock;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ErrorParserBlock;
@ -73,7 +74,7 @@ public class ManagedBuilderPropertyPage extends PropertyPage implements ICOption
private void contentForClosedProject(Composite parent) {
Label label = new Label(parent, SWT.LEFT);
label.setText(ManagedBuilderUIPlugin.getResourceString(MSG_CLOSEDPROJECT));
label.setText(ManagedBuilderUIMessages.getResourceString(MSG_CLOSEDPROJECT));
label.setFont(parent.getFont());
noDefaultAndApplyButton();
@ -100,7 +101,7 @@ public class ManagedBuilderPropertyPage extends PropertyPage implements ICOption
new ProgressMonitorDialog(getShell()).run(false, true, op);
} catch (InvocationTargetException e) {
Throwable e1 = e.getTargetException();
ManagedBuilderUIPlugin.errorDialog(getShell(), ManagedBuilderUIPlugin.getResourceString("ManagedProjectPropertyPage.internalError"),e1.toString(), e1); //$NON-NLS-1$
ManagedBuilderUIPlugin.errorDialog(getShell(), ManagedBuilderUIMessages.getResourceString("ManagedProjectPropertyPage.internalError"),e1.toString(), e1); //$NON-NLS-1$
return false;
} catch (InterruptedException e) {
// cancelled

View file

@ -11,7 +11,7 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
* BitMethods Inc - Initial API and implementation
***********************************************************************/
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.util.Assert;
import org.eclipse.swt.SWT;
@ -130,7 +130,7 @@ public class MultiLineTextFieldEditor extends FieldEditor {
widthInChars = width;
setValidateStrategy(strategy);
isValid = false;
errorMessage = ManagedBuilderUIPlugin.getResourceString(ERROR_MESSAGE);
errorMessage = ManagedBuilderUIMessages.getResourceString(ERROR_MESSAGE);
createControl(parent);
}

View file

@ -13,7 +13,7 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
@ -151,7 +151,7 @@ public class NewConfigurationDialog extends Dialog {
// Add a label and a text widget
final Label nameLabel = new Label(composite, SWT.LEFT);
nameLabel.setFont(parent.getFont());
nameLabel.setText(ManagedBuilderUIPlugin.getResourceString(NAME));
nameLabel.setText(ManagedBuilderUIMessages.getResourceString(NAME));
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 1;
nameLabel.setLayoutData(gd);
@ -170,7 +170,7 @@ public class NewConfigurationDialog extends Dialog {
// Create a group fro the radio buttons
final Group group = new Group(composite, SWT.NONE);
group.setFont(composite.getFont());
group.setText(ManagedBuilderUIPlugin.getResourceString(GROUP));
group.setText(ManagedBuilderUIMessages.getResourceString(GROUP));
GridLayout layout = new GridLayout(3, false);
group.setLayout(layout);
gd = new GridData(GridData.FILL_HORIZONTAL);
@ -186,7 +186,7 @@ public class NewConfigurationDialog extends Dialog {
// Add a radio button and combo box to copy from default config
btnCopy = new Button(group, SWT.RADIO);
btnCopy.setFont(group.getFont());
btnCopy.setText(ManagedBuilderUIPlugin.getResourceString(COPY));
btnCopy.setText(ManagedBuilderUIMessages.getResourceString(COPY));
setButtonLayoutData(btnCopy);
btnCopy.addSelectionListener(radioListener);
@ -209,7 +209,7 @@ public class NewConfigurationDialog extends Dialog {
// Create a radio button and combo for clonable configs
btnClone = new Button(group, SWT.RADIO);
btnClone.setFont(group.getFont());
btnClone.setText(ManagedBuilderUIPlugin.getResourceString(CLONE));
btnClone.setText(ManagedBuilderUIMessages.getResourceString(CLONE));
setButtonLayoutData(btnClone);
btnClone.addSelectionListener(radioListener);
btnClone.setSelection(true);
@ -322,8 +322,8 @@ public class NewConfigurationDialog extends Dialog {
// Make sure the name is not a duplicate
if (isDuplicateName(currentName)) {
MessageDialog.openError(getShell(),
ManagedBuilderUIPlugin.getResourceString(TITLE),
ManagedBuilderUIPlugin.getFormattedString(DUPLICATE, currentName)); //$NON-NLS-1$
ManagedBuilderUIMessages.getResourceString(TITLE),
ManagedBuilderUIMessages.getFormattedString(DUPLICATE, currentName)); //$NON-NLS-1$
return false;
}
// TODO make sure there are no invalid chars in name

View file

@ -14,7 +14,7 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIImages;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
@ -56,6 +56,6 @@ class ToolListLabelProvider extends LabelProvider {
}
protected RuntimeException unknownElement(Object element) {
return new RuntimeException(ManagedBuilderUIPlugin.getFormattedString(ERROR_UNKNOWN_ELEMENT, element.getClass().getName()));
return new RuntimeException(ManagedBuilderUIMessages.getFormattedString(ERROR_UNKNOWN_ELEMENT, element.getClass().getName()));
}
}

View file

@ -20,10 +20,10 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderHelpContextIds;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.cdt.ui.wizards.NewCProjectWizard;
import org.eclipse.core.boot.BootLoader;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@ -98,7 +98,7 @@ public class CProjectPlatformPage extends WizardPage {
// Create a check box table of valid configurations
final Label configLabel = new Label(composite, SWT.LEFT);
configLabel.setFont(composite.getFont());
configLabel.setText(ManagedBuilderUIPlugin.getResourceString(CONFIG_LABEL));
configLabel.setText(ManagedBuilderUIMessages.getResourceString(CONFIG_LABEL));
Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.MULTI
| SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
@ -162,7 +162,7 @@ public class CProjectPlatformPage extends WizardPage {
showAll = new Button(composite, SWT.CHECK | SWT.LEFT);
showAll.setFont(composite.getFont());
showAll.setText(ManagedBuilderUIPlugin.getResourceString(SHOWALL_LABEL));
showAll.setText(ManagedBuilderUIMessages.getResourceString(SHOWALL_LABEL));
showAll.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
populateTargets();
@ -187,11 +187,11 @@ public class CProjectPlatformPage extends WizardPage {
// Create the platform selection label and combo widgets
final Label platformLabel = new Label(composite, SWT.LEFT);
platformLabel.setFont(composite.getFont());
platformLabel.setText(ManagedBuilderUIPlugin.getResourceString(TARGET_LABEL));
platformLabel.setText(ManagedBuilderUIMessages.getResourceString(TARGET_LABEL));
platformSelection = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
platformSelection.setFont(composite.getFont());
platformSelection.setToolTipText(ManagedBuilderUIPlugin.getResourceString(TARGET_TIP));
platformSelection.setToolTipText(ManagedBuilderUIMessages.getResourceString(TARGET_TIP));
platformSelection.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
handleTargetSelection();
@ -290,8 +290,8 @@ public class CProjectPlatformPage extends WizardPage {
// Get a list of platforms defined by plugins
ITarget[] allTargets = ManagedBuildManager.getDefinedTargets(null);
targets = new ArrayList();
String os = BootLoader.getOS();
String arch = BootLoader.getOSArch();
String os = Platform.getOS();
String arch = Platform.getOSArch();
// Add all of the concrete targets to the target list
for (int index = 0; index < allTargets.length; ++index) {
ITarget target = allTargets[index];

View file

@ -12,7 +12,7 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
* **********************************************************************/
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@ -26,7 +26,7 @@ public class NewManagedCCProjectWizard extends NewManagedProjectWizard {
private static final String MSG_CREATE = "MngCCWizard.message.creating"; //$NON-NLS-1$
public NewManagedCCProjectWizard() {
this(ManagedBuilderUIPlugin.getResourceString(WZ_TITLE), ManagedBuilderUIPlugin.getResourceString(WZ_DESC));
this(ManagedBuilderUIMessages.getResourceString(WZ_TITLE), ManagedBuilderUIMessages.getResourceString(WZ_DESC));
}
public NewManagedCCProjectWizard(String title, String desc) {
@ -42,7 +42,7 @@ public class NewManagedCCProjectWizard extends NewManagedProjectWizard {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
monitor.beginTask(ManagedBuilderUIPlugin.getResourceString(MSG_CREATE), 8); //$NON-NLS-1$
monitor.beginTask(ManagedBuilderUIMessages.getResourceString(MSG_CREATE), 8); //$NON-NLS-1$
super.doRun(new SubProgressMonitor(monitor, 7));
// Add C++ Nature.
if (newProject != null) {

View file

@ -11,7 +11,7 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
public class NewManagedCProjectWizard extends NewManagedProjectWizard {
// String constants
@ -21,7 +21,7 @@ public class NewManagedCProjectWizard extends NewManagedProjectWizard {
private static final String SETTINGS_DESC= "MngCWizardSettings.description"; //$NON-NLS-1$
public NewManagedCProjectWizard() {
this(ManagedBuilderUIPlugin.getResourceString(WZ_TITLE), ManagedBuilderUIPlugin.getResourceString(WZ_DESC));
this(ManagedBuilderUIMessages.getResourceString(WZ_TITLE), ManagedBuilderUIMessages.getResourceString(WZ_DESC));
}
public NewManagedCProjectWizard(String title, String description) {

View file

@ -20,7 +20,7 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.cdt.ui.wizards.NewCProjectWizard;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@ -52,7 +52,7 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
protected NewManagedProjectOptionPage optionPage;
public NewManagedProjectWizard() {
this(ManagedBuilderUIPlugin.getResourceString(WZ_TITLE), ManagedBuilderUIPlugin.getResourceString(WZ_DESC));
this(ManagedBuilderUIMessages.getResourceString(WZ_TITLE), ManagedBuilderUIMessages.getResourceString(WZ_DESC));
}
public NewManagedProjectWizard(String title, String description) {
@ -65,14 +65,14 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
// Add the configuration selection page
targetConfigurationPage = new CProjectPlatformPage(PREFIX, this);
targetConfigurationPage.setTitle(ManagedBuilderUIPlugin.getResourceString(CONF_TITLE));
targetConfigurationPage.setDescription(ManagedBuilderUIPlugin.getResourceString(CONF_DESC));
targetConfigurationPage.setTitle(ManagedBuilderUIMessages.getResourceString(CONF_TITLE));
targetConfigurationPage.setDescription(ManagedBuilderUIMessages.getResourceString(CONF_DESC));
addPage(targetConfigurationPage);
// Add the options (tabbed) page
optionPage = new NewManagedProjectOptionPage(PREFIX, this);
optionPage.setTitle(ManagedBuilderUIPlugin.getResourceString(OPTIONS_TITLE));
optionPage.setDescription(ManagedBuilderUIPlugin.getResourceString(OPTIONS_DESC));
optionPage.setTitle(ManagedBuilderUIMessages.getResourceString(OPTIONS_TITLE));
optionPage.setDescription(ManagedBuilderUIMessages.getResourceString(OPTIONS_DESC));
addPage(optionPage);
}
@ -91,14 +91,14 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
// Add the managed build nature
try {
monitor.subTask(ManagedBuilderUIPlugin.getResourceString(MSG_ADD_NATURE));
monitor.subTask(ManagedBuilderUIMessages.getResourceString(MSG_ADD_NATURE));
ManagedCProjectNature.addManagedNature(newProject, new SubProgressMonitor(monitor, 1));
} catch (CoreException e) {
// Bail out of the project creation
}
// Add the builder
try {
monitor.subTask(ManagedBuilderUIPlugin.getResourceString(MSG_ADD_BUILDER));
monitor.subTask(ManagedBuilderUIMessages.getResourceString(MSG_ADD_BUILDER));
ManagedCProjectNature.addManagedBuilder(newProject, new SubProgressMonitor(monitor, 1));
} catch (CoreException e) {
// Bail out of the project creation
@ -154,7 +154,7 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
}
// Save the build options
monitor.subTask(ManagedBuilderUIPlugin.getResourceString(MSG_SAVE));
monitor.subTask(ManagedBuilderUIMessages.getResourceString(MSG_SAVE));
ManagedBuildManager.saveBuildInfo(newProject, true);
monitor.done();
}