Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2001, 2010 IBM Corporation and others.
* Copyright (c) 2001, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand All @@ -24,15 +24,22 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.ACC;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
Expand All @@ -42,6 +49,8 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.wst.sse.core.internal.SSECorePlugin;
import org.eclipse.wst.sse.core.internal.tasks.FileTaskScannerRegistryReader;
import org.eclipse.wst.sse.core.internal.tasks.TaskTagPreferenceKeys;
Expand All @@ -52,36 +61,6 @@
import com.ibm.icu.text.Collator;

class ExclusionsTab implements IPreferenceTab {
private class ArrayTreeContentProvider implements ITreeContentProvider {
public ArrayTreeContentProvider() {
super();
}

public void dispose() {
}

public Object[] getChildren(Object parentElement) {
if (parentElement instanceof Object[])
return fContentTypeSorter.sort((Object[]) parentElement);
return new Object[0];
}

public Object[] getElements(Object inputElement) {
return getChildren(inputElement);
}

public Object getParent(Object element) {
return null;
}

public boolean hasChildren(Object element) {
return getChildren(element).length > 0;
}

public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}

private class ContentTypeLabelProvider extends LabelProvider {
public String getText(Object element) {
if (element != null) {
Expand Down Expand Up @@ -189,7 +168,7 @@ public Object[] sort(Object[] unSortedCollection) {

private static final boolean _debugPreferences = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/tasks/preferences")); //$NON-NLS-1$ //$NON-NLS-2$

private CheckboxTreeViewer fContentTypeList;
private CheckboxTableViewer fContentTypeList;

private IContentTypeManager fContentTypeManager = null;

Expand Down Expand Up @@ -234,73 +213,131 @@ public ExclusionsTab(TaskTagPreferencePage parent, IPreferencesService preferenc
}

public Control createContents(Composite tabFolder) {
SashForm sash = new SashForm(tabFolder, SWT.VERTICAL);
Composite composite = new Composite(sash, SWT.NONE);
composite.setLayout(new GridLayout(2, true));
Label description = new Label(composite, SWT.NONE);
description.setText(SSEUIMessages.TaskTagExclusionTab_02);
// description.setBackground(composite.getBackground());

fContentTypeList = new CheckboxTreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
fContentTypeList.setLabelProvider(new ContentTypeLabelProvider());
fContentTypeList.setContentProvider(new ArrayTreeContentProvider());

fContentTypeList.setInput(fSupportedContentTypes.toArray());
fContentTypeList.setCheckedElements(fSupportedContentTypes.toArray());
fContentTypeList.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
for (int i = 0; i < fIgnoreContentTypes.length; i++) {
fContentTypeList.setChecked(fIgnoreContentTypes[i], false);
}

Button selectAll = new Button(composite, SWT.PUSH);
selectAll.setText(SSEUIMessages.TaskTagPreferenceTab_17);
selectAll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
selectAll.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
fContentTypeList.setCheckedElements(fSupportedContentTypes.toArray());
}
});

Button selectNone = new Button(composite, SWT.PUSH);
selectNone.setText(SSEUIMessages.TaskTagPreferenceTab_18);
selectNone.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
selectNone.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
fContentTypeList.setCheckedElements(new Object[0]);
}
});

composite = new Composite(sash, SWT.NONE);
composite.setLayout(new GridLayout(2, true));
new Label(composite, SWT.NONE).setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));

Label affectedTypesLabel = new Label(composite, SWT.NONE);
affectedTypesLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
// affectedTypesLabel.setBackground(composite.getBackground());
affectedTypesLabel.setText(SSEUIMessages.TaskTagExclusionTab_03);

final TreeViewer contentTypeTreeViewer = new TreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
contentTypeTreeViewer.setLabelProvider(new ContentTypeLabelProvider());
contentTypeTreeViewer.setContentProvider(new ContentTypeTreeProvider());
contentTypeTreeViewer.setInput(new Object[0]);
contentTypeTreeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));

fContentTypeList.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
if (event.getSelection() instanceof IStructuredSelection) {
Object[] o = ((IStructuredSelection) event.getSelection()).toArray();
contentTypeTreeViewer.setInput(o);
contentTypeTreeViewer.expandAll();
if (o.length > 0) {
contentTypeTreeViewer.reveal(o[0]);
}
}
}
});

return sash;
SashForm sash = new SashForm(tabFolder, SWT.VERTICAL);

Composite composite = new Composite(sash, SWT.NONE);
composite.setLayout(new GridLayout(2, true));

Label description = new Label(composite, SWT.NONE);
description.setText(SSEUIMessages.TaskTagExclusionTab_02);

fContentTypeList = CheckboxTableViewer.newCheckList(
composite, SWT.CHECK | SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
);
Table table = fContentTypeList.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));

TableViewerColumn col = new TableViewerColumn(fContentTypeList, SWT.NONE);
// col.getColumn().setText(SSEUIMessages.TaskTagExclusionTab_01);
col.getColumn().setWidth(480);
col.setLabelProvider(new ColumnLabelProvider() {
@Override public String getText(Object element) {
if (element instanceof IContentType) return ((IContentType) element).getName();
return super.getText(element);
}
});

fContentTypeList.setContentProvider(ArrayContentProvider.getInstance());
Object[] sortedSupported = fContentTypeSorter.sort(fSupportedContentTypes.toArray());
fContentTypeList.setInput(sortedSupported);

fContentTypeList.setCheckedElements(sortedSupported);
for (int i = 0; i < fIgnoreContentTypes.length; i++) {
fContentTypeList.setChecked(fIgnoreContentTypes[i], false);
}

table.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override public void getName(AccessibleEvent e) {
TableItem item = null;

if (e.childID != ACC.CHILDID_SELF) {
int idx = e.childID;
if (idx >= 0 && idx < table.getItemCount()) item = table.getItem(idx);
} else {
TableItem[] sel = table.getSelection();
if (sel.length > 0) item = sel[0];
}

if (item != null) {
Object el = item.getData();
if (el instanceof IContentType) {
IContentType t = (IContentType) el;

// Build a UNIQUE accessible name (not shown in the UI)
String name = t.getName(); // e.g., "DTD"
String id = t.getId(); // e.g., "org.eclipse.wst.dtd.core.dtdsource"
String shortId = id;
int dot = id.lastIndexOf('.');
if (dot >= 0 && dot + 1 < id.length()) shortId = id.substring(dot + 1);
// Result: "DTD [dtdsource] (checked/unchecked)"
e.result = name + shortId;
} else {
e.result = item.getText();
}
}
}
});

fContentTypeList.addCheckStateListener(new ICheckStateListener() {
@Override public void checkStateChanged(CheckStateChangedEvent e) {
fContentTypeList.setSelection(new StructuredSelection(e.getElement()), true);
}
});

Button selectAll = new Button(composite, SWT.PUSH);
selectAll.setText(SSEUIMessages.TaskTagPreferenceTab_17);
selectAll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
selectAll.addSelectionListener(new SelectionAdapter() {
@Override public void widgetSelected(SelectionEvent e) {
fContentTypeList.setCheckedElements(sortedSupported);
if (table.getItemCount() > 0) {
fContentTypeList.setSelection(new StructuredSelection(table.getItem(0).getData()), true);
}
}
});

Button selectNone = new Button(composite, SWT.PUSH);
selectNone.setText(SSEUIMessages.TaskTagPreferenceTab_18);
selectNone.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
selectNone.addSelectionListener(new SelectionAdapter() {
@Override public void widgetSelected(SelectionEvent e) {
fContentTypeList.setCheckedElements(new Object[0]);
if (table.getSelectionCount() == 0 && table.getItemCount() > 0) {
fContentTypeList.setSelection(new StructuredSelection(table.getItem(0).getData()), true);
}
}
});

composite = new Composite(sash, SWT.NONE);
composite.setLayout(new GridLayout(2, true));
new Label(composite, SWT.NONE).setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));

Label affectedTypesLabel = new Label(composite, SWT.NONE);
affectedTypesLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
affectedTypesLabel.setText(SSEUIMessages.TaskTagExclusionTab_03);

final TreeViewer contentTypeTreeViewer =
new TreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
contentTypeTreeViewer.setLabelProvider(new ContentTypeLabelProvider());
contentTypeTreeViewer.setContentProvider(new ContentTypeTreeProvider());
contentTypeTreeViewer.setInput(new Object[0]);
contentTypeTreeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));

fContentTypeList.addSelectionChangedListener(event -> {
if (event.getSelection() instanceof IStructuredSelection) {
Object[] o = ((IStructuredSelection) event.getSelection()).toArray();
contentTypeTreeViewer.setInput(o);
contentTypeTreeViewer.expandAll();
if (o.length > 0) contentTypeTreeViewer.reveal(o[0]);
}
});

return sash;
}


public String getTitle() {
return SSEUIMessages.TaskTagExclusionTab_01;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2001, 2011 IBM Corporation and others.
* Copyright (c) 2001, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -250,9 +250,14 @@ public Control createContents(Composite tabFolder) {
editButton.setEnabled(false);
removeButton.setEnabled(false);

Label warning = new Label(composite, SWT.NONE);
warning.setLayoutData(new GridData());
Text warning = new Text(composite, SWT.READ_ONLY | SWT.WRAP | SWT.MULTI);
warning.setText(SSEUIMessages.TaskTagPreferenceTab_19); //$NON-NLS-1$
GridData warnGD = new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1);
warnGD.widthHint = warning.computeSize(SWT.DEFAULT, SWT.DEFAULT).x + 50; // a bit wider than natural
warning.setLayoutData(warnGD);
// style like a label so it blends in
warning.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
warning.setForeground(composite.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));

final ISelectionChangedListener selectionChangedListener = new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2001, 2020 IBM Corporation and others.
* Copyright (c) 2001, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -143,11 +143,13 @@ public Control createContents(Composite tabFolder) {
// addCheckBox(hoverComposite, showAffordanceLabel,
// CommonEditorPreferenceNames.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE, 0);

Label label = new Label(hoverComposite, SWT.NONE);
label.setText(SSEUIMessages.TextHoverPreferenceTab_hoverPreferences); //$NON-NLS-1$
Text hoverPrefsText = new Text(hoverComposite, SWT.READ_ONLY | SWT.WRAP | SWT.MULTI);
hoverPrefsText.setText(SSEUIMessages.TextHoverPreferenceTab_hoverPreferences); //$NON-NLS-1$
gd = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
gd.horizontalAlignment = GridData.BEGINNING;
label.setLayoutData(gd);
hoverPrefsText.setLayoutData(gd);
hoverPrefsText.setBackground(hoverComposite.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
hoverPrefsText.setForeground(hoverComposite.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));

fHoverTableViewer = CheckboxTableViewer.newCheckList(hoverComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
// Hover table
Expand Down Expand Up @@ -220,7 +222,7 @@ public void checkStateChanged(CheckStateChangedEvent event) {
});

// Text field for modifier string
label = new Label(hoverComposite, SWT.LEFT);
Label label = new Label(hoverComposite, SWT.LEFT);
label.setText(SSEUIMessages.TextHoverPreferenceTab_keyModifier); //$NON-NLS-1$
fModifierEditor = new Text(hoverComposite, SWT.BORDER);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2001, 2015 IBM Corporation and others.
* Copyright (c) 2001, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand All @@ -24,20 +24,19 @@
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.PlatformUI;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wst.json.core.JSONCorePlugin;
import org.eclipse.wst.json.core.contenttype.ContentTypeIdForJSON;
import org.eclipse.wst.json.core.preferences.JSONCorePreferenceNames;
import org.eclipse.wst.json.ui.internal.JSONUIMessages;
//import org.eclipse.wst.json.ui.internal.editor.IHelpContextIds;
import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames;
import org.eclipse.wst.sse.ui.internal.editor.IHelpContextIds;
import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage;

public class JSONFilesPreferencePage extends AbstractPreferencePage {
Expand Down Expand Up @@ -69,8 +68,13 @@ protected void createContentsForCreatingGroup(Composite parent) {
fDefaultSuffix.setItems(validExtensions);
fDefaultSuffix.addSelectionListener(this);

Label label = createLabel(creatingGroup, JSONUIMessages.Encoding_desc);
((GridData) label.getLayoutData()).horizontalSpan = 2;
Text label = new Text(creatingGroup, SWT.READ_ONLY | SWT.WRAP | SWT.MULTI);
label.setText(JSONUIMessages.Encoding_desc);
GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1);
label.setLayoutData(gd);
// visually match labels
label.setBackground(creatingGroup.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
label.setForeground(creatingGroup.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
fEncodingSettings = new EncodingSettings(creatingGroup, JSONUIMessages.Encoding);
((GridData) fEncodingSettings.getLayoutData()).horizontalSpan = 2;
}
Expand Down
Loading