diff options
author | Michael Valenta | 2002-05-15 12:49:06 +0000 |
---|---|---|
committer | Michael Valenta | 2002-05-15 12:49:06 +0000 |
commit | ee5f8c55b1148c4e1ce237cd17a51b0a0332af83 (patch) | |
tree | 812b57f3127ebc07448b6065f88b601db9bd66c4 | |
parent | 9d0cdfe9f677ab9297a7517662176b9205af39e8 (diff) | |
download | eclipse.platform.team-ee5f8c55b1148c4e1ce237cd17a51b0a0332af83.tar.gz eclipse.platform.team-ee5f8c55b1148c4e1ce237cd17a51b0a0332af83.tar.xz eclipse.platform.team-ee5f8c55b1148c4e1ce237cd17a51b0a0332af83.zip |
Added help to Ignore Preferences page
5 files changed, 39 insertions, 7 deletions
diff --git a/bundles/org.eclipse.team.ui/help_contexts.xml b/bundles/org.eclipse.team.ui/help_contexts.xml new file mode 100644 index 000000000..e2d1a69cf --- /dev/null +++ b/bundles/org.eclipse.team.ui/help_contexts.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?NLS TYPE="org.eclipse.help.contexts"?> +<contexts> + + <!-- ********************************** --> + <!-- Preference Pages --> + <!-- ********************************** --> + <context id="ignore_preference_page_context" > + <description>You may wish to exclude certain resources from version control. Resources whose names match any enabled pattern will not be released. The wildcard characters '*' and '?' are permitted. These settings will not affect resources already under version control. Use this page to specify a list of resource name patterns to ignore. + </description> + <!-- Old reference fom 1.0 --> + <topic label="More info" href="reference/ref20.html"/> + </context> +</contexts>
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml index 7f85b581f..a8e96282b 100644 --- a/bundles/org.eclipse.team.ui/plugin.xml +++ b/bundles/org.eclipse.team.ui/plugin.xml @@ -23,6 +23,11 @@ <extension-point id="configurationWizards" name="Configuration Wizards"/> <extension-point id="targetConfigWizards" name="Target Site Addition Wizards"/> +<!-- *************** Help **************** --> + <extension point="org.eclipse.help.contexts"> + <contexts file="help_contexts.xml" plugin="org.eclipse.team.ui"/> + </extension> + <!-- **************** PREFERENCES ******************* --> <extension point = "org.eclipse.ui.preferencePages"> diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java new file mode 100644 index 000000000..6d8c5fb1e --- /dev/null +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2002 IBM 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 - Initial implementation + ******************************************************************************/ +package org.eclipse.team.internal.ui; + +public interface IHelpContextIds { + public static final String PREFIX = TeamUIPlugin.ID + "."; //$NON-NLS-1$ + + // Preference Pages + public static final String IGNORE_PREFERENCE_PAGE = PREFIX + "ignore_preference_page_context"; +} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java index 9c71eecf7..a0b344663 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java @@ -1,4 +1,4 @@ -package org.eclipse.team.internal.ui;
/*
* (c) Copyright IBM Corp. 2000, 2002.
* All Rights Reserved.
*/
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
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.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.team.core.IIgnoreInfo;
import org.eclipse.team.core.Team;
import org.eclipse.team.internal.core.TeamPlugin;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
+package org.eclipse.team.internal.ui;
/*
* (c) Copyright IBM Corp. 2000, 2002.
* All Rights Reserved.
*/
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
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.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.team.core.IIgnoreInfo;
import org.eclipse.team.core.Team;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.help.WorkbenchHelp;
public class IgnorePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
private Table ignoreTable;
private Button addButton;
private Button removeButton; - public void init(IWorkbench workbench) {
setDescription(Policy.bind("IgnorePreferencePage.description")); //$NON-NLS-1$
}
/**
* Creates preference page controls on demand.
*
* @param parent the parent for the preference page
*/
protected Control createContents(Composite ancestor) {
noDefaultAndApplyButton();
Composite parent = new Composite(ancestor, SWT.NULL);
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.numColumns = 2;
parent.setLayout(layout);
// set F1 help
//WorkbenchHelp.setHelp(parent, new DialogPageContextComputer (this, IVCMHelpContextIds.IGNORE_PREFERENCE_PAGE));
Label l1 = new Label(parent, SWT.NULL);
l1.setText(Policy.bind("IgnorePreferencePage.ignorePatterns")); //$NON-NLS-1$
GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
data.horizontalSpan = 2;
l1.setLayoutData(data);
ignoreTable = new Table(parent, SWT.CHECK | SWT.BORDER);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint= convertWidthInCharsToPixels(30);
ignoreTable.setLayoutData(gd);
ignoreTable.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
handleSelection();
}
});
Composite buttons = new Composite(parent, SWT.NULL);
buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
buttons.setLayout(layout);
addButton = new Button(buttons, SWT.PUSH);
addButton.setText(Policy.bind("IgnorePreferencePage.add")); //$NON-NLS-1$
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
data.widthHint = Math.max(widthHint, addButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
addButton.setLayoutData(data);
addButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
addIgnore();
}
});
removeButton = new Button(buttons, SWT.PUSH);
removeButton.setText(Policy.bind("IgnorePreferencePage.remove")); //$NON-NLS-1$
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
data.widthHint = Math.max(widthHint, removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
removeButton.setLayoutData(data);
removeButton.setEnabled(false);
removeButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
removeIgnore();
}
});
fillTable();
return parent;
}
/**
* Do anything necessary because the OK button has been pressed.
*
* @return whether it is okay to close the preference page
*/
public boolean performOk() {
int count = ignoreTable.getItemCount();
String[] patterns = new String[count];
boolean[] enabled = new boolean[count];
TableItem[] items = ignoreTable.getItems();
for (int i = 0; i < count; i++) {
patterns[i] = items[i].getText();
enabled[i] = items[i].getChecked();
}
Team.setAllIgnores(patterns, enabled);
TeamUIPlugin.getPlugin().broadcastPropertyChange(new PropertyChangeEvent(TeamUIPlugin.getPlugin(), TeamUIPlugin.GLOBAL_IGNORES_CHANGED, null, null));
return true;
}
private void fillTable() {
IIgnoreInfo[] ignore = Team.getAllIgnores();
for (int i = 0; i < ignore.length; i++) {
IIgnoreInfo info = ignore[i];
TableItem item = new TableItem(ignoreTable, SWT.NONE);
item.setText(info.getPattern());
item.setChecked(info.getEnabled());
}
}
private void addIgnore() {
InputDialog dialog = new InputDialog(getShell(), Policy.bind("IgnorePreferencePage.enterPatternShort"), Policy.bind("IgnorePreferencePage.enterPatternLong"), null, null); //$NON-NLS-1$ //$NON-NLS-2$
dialog.open();
if (dialog.getReturnCode() != InputDialog.OK) return;
String pattern = dialog.getValue();
if (pattern.equals("")) return; //$NON-NLS-1$
// Check if the item already exists
TableItem[] items = ignoreTable.getItems();
for (int i = 0; i < items.length; i++) {
if (items[i].getText().equals(pattern)) {
MessageDialog.openWarning(getShell(), Policy.bind("IgnorePreferencePage.patternExistsShort"), Policy.bind("IgnorePreferencePage.patternExistsLong")); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
}
TableItem item = new TableItem(ignoreTable, SWT.NONE);
item.setText(pattern);
item.setChecked(true);
}
private void removeIgnore() {
int[] selection = ignoreTable.getSelectionIndices();
ignoreTable.remove(selection);
}
private void handleSelection() {
if (ignoreTable.getSelectionCount() > 0) {
removeButton.setEnabled(true);
} else {
removeButton.setEnabled(false);
}
} + public void init(IWorkbench workbench) {
}
/**
* Creates preference page controls on demand.
*
* @param parent the parent for the preference page
*/
protected Control createContents(Composite ancestor) {
noDefaultAndApplyButton();
Composite parent = new Composite(ancestor, SWT.NULL);
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.numColumns = 2;
parent.setLayout(layout);
// set F1 help
WorkbenchHelp.setHelp(parent, IHelpContextIds.IGNORE_PREFERENCE_PAGE);
Label l1 = new Label(parent, SWT.NULL);
l1.setText(Policy.bind("IgnorePreferencePage.ignorePatterns")); //$NON-NLS-1$
GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
data.horizontalSpan = 2;
l1.setLayoutData(data);
ignoreTable = new Table(parent, SWT.CHECK | SWT.BORDER);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint= convertWidthInCharsToPixels(30);
ignoreTable.setLayoutData(gd);
ignoreTable.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
handleSelection();
}
});
Composite buttons = new Composite(parent, SWT.NULL);
buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
buttons.setLayout(layout);
addButton = new Button(buttons, SWT.PUSH);
addButton.setText(Policy.bind("IgnorePreferencePage.add")); //$NON-NLS-1$
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
data.widthHint = Math.max(widthHint, addButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
addButton.setLayoutData(data);
addButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
addIgnore();
}
});
removeButton = new Button(buttons, SWT.PUSH);
removeButton.setText(Policy.bind("IgnorePreferencePage.remove")); //$NON-NLS-1$
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
data.widthHint = Math.max(widthHint, removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
removeButton.setLayoutData(data);
removeButton.setEnabled(false);
removeButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
removeIgnore();
}
});
fillTable();
return parent;
}
/**
* Do anything necessary because the OK button has been pressed.
*
* @return whether it is okay to close the preference page
*/
public boolean performOk() {
int count = ignoreTable.getItemCount();
String[] patterns = new String[count];
boolean[] enabled = new boolean[count];
TableItem[] items = ignoreTable.getItems();
for (int i = 0; i < count; i++) {
patterns[i] = items[i].getText();
enabled[i] = items[i].getChecked();
}
Team.setAllIgnores(patterns, enabled);
TeamUIPlugin.getPlugin().broadcastPropertyChange(new PropertyChangeEvent(TeamUIPlugin.getPlugin(), TeamUIPlugin.GLOBAL_IGNORES_CHANGED, null, null));
return true;
}
private void fillTable() {
IIgnoreInfo[] ignore = Team.getAllIgnores();
for (int i = 0; i < ignore.length; i++) {
IIgnoreInfo info = ignore[i];
TableItem item = new TableItem(ignoreTable, SWT.NONE);
item.setText(info.getPattern());
item.setChecked(info.getEnabled());
}
}
private void addIgnore() {
InputDialog dialog = new InputDialog(getShell(), Policy.bind("IgnorePreferencePage.enterPatternShort"), Policy.bind("IgnorePreferencePage.enterPatternLong"), null, null); //$NON-NLS-1$ //$NON-NLS-2$
dialog.open();
if (dialog.getReturnCode() != InputDialog.OK) return;
String pattern = dialog.getValue();
if (pattern.equals("")) return; //$NON-NLS-1$
// Check if the item already exists
TableItem[] items = ignoreTable.getItems();
for (int i = 0; i < items.length; i++) {
if (items[i].getText().equals(pattern)) {
MessageDialog.openWarning(getShell(), Policy.bind("IgnorePreferencePage.patternExistsShort"), Policy.bind("IgnorePreferencePage.patternExistsLong")); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
}
TableItem item = new TableItem(ignoreTable, SWT.NONE);
item.setText(pattern);
item.setChecked(true);
}
private void removeIgnore() {
int[] selection = ignoreTable.getSelectionIndices();
ignoreTable.remove(selection);
}
private void handleSelection() {
if (ignoreTable.getSelectionCount() > 0) {
removeButton.setEnabled(true);
} else {
removeButton.setEnabled(false);
}
} } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties index ac74bab40..ea0b1e210 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties @@ -25,11 +25,6 @@ ConfigurationWizard.exceptionCreatingWizard=Exception creating wizard. DeconfigureProjectAction.deconfigureProject=Deconfigure Project IgnorePreferencePage.add=&Add... -IgnorePreferencePage.description=You may wish to exclude certain resources from version control.\n\ - Resources whose names match any enabled pattern will not be released.\n\ - The wildcard characters '*' and '?' are permitted.\n\ - These settings will not affect resources already under version control.\n\ - Use this page to specify a list of resource name patterns to ignore. IgnorePreferencePage.enterPatternLong=Please enter a pattern: IgnorePreferencePage.enterPatternShort=Enter Ignore Pattern IgnorePreferencePage.ignorePatterns=&Ignore Patterns: |