diff --git a/bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/IFindReplaceTargetExtension5.java b/bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/IFindReplaceTargetExtension5.java
new file mode 100644
index 00000000000..7724bddb98e
--- /dev/null
+++ b/bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/IFindReplaceTargetExtension5.java
@@ -0,0 +1,43 @@
+package org.eclipse.jface.text;
+
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Extension to search and replace using an "inline"-Find replace Bar. In order for this inline
+ * find-replace bar to work, inheriting panes need to provide a way to inject a "toolbar".
+ *
+ * In the future, extension could be elevated to a "IInlineToolBarExtension", in case there are
+ * other tools that want to profit from this extension
+ *
+ * @since 3.24
+ */
+public interface IFindReplaceTargetExtension5 {
+
+ /**
+ * This is called every time the inline find-replace dialog is to be shown. The implementing
+ * class guarantees to then provide a composite onto which the inline search is drawn.
+ *
+ * The composite is expected to have a GridLayout with a single column. Neither the width nor
+ * the height are specified (XXX ?).
+ *
+ * TODO: I'm unhappy with the name, but it seems consistent with the current status Quo defined
+ * in IFindReplaceTargetExtension
+ *
+ * @return the composite the inline find-replace dialog may draw on
+ */
+ public Composite beginInlineSession();
+
+ /**
+ * Updates the layout of the implementing class. Is required, for example, when the
+ * "replace"-dropdown is opened/closed
+ *
+ * TODO: I'd like to avoid having this method. Is there a better way?
+ */
+ public void updateLayout();
+
+ /**
+ * The implementing class may now dispose of the composite created in beginInlineSession.
+ *
+ */
+ public void endInlineSession();
+}
diff --git a/bundles/org.eclipse.ui.ide/.project b/bundles/org.eclipse.ui.ide/.project
index f9de5f0ac41..c663fbbf333 100644
--- a/bundles/org.eclipse.ui.ide/.project
+++ b/bundles/org.eclipse.ui.ide/.project
@@ -37,6 +37,13 @@
org.eclipse.jdt.core.javanatureorg.eclipse.pde.api.tools.apiAnalysisNature
+
+
+ src/org/eclipse/ui/internal/views/markers/search-feature
+ 2
+ C:/Users/mwittmer/Documents/search-feature
+
+ 1676382308432
diff --git a/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
index 959d5c2fd13..d6c085fd9ef 100644
--- a/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
@@ -63,7 +63,8 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.19.0,4.0.0)";resol
org.eclipse.e4.ui.ide;bundle-version="[3.15.0,4.0.0)";visibility:=reexport,
org.eclipse.e4.core.di;bundle-version="[1.9.0,2.0.0)",
org.eclipse.e4.core.di.extensions;bundle-version="[0.18.0,1.0.0)",
- org.eclipse.ui.navigator;bundle-version="3.12.0"
+ org.eclipse.ui.navigator;bundle-version="3.12.0",
+ org.eclipse.ui.workbench.texteditor
Import-Package: javax.annotation;version="[1.3.0,2.0.0)",
javax.inject;version="[1.0.0,2.0.0)",
org.osgi.service.event;version="[1.4.0,2.0.0)"
diff --git a/bundles/org.eclipse.ui.ide/plugin.xml b/bundles/org.eclipse.ui.ide/plugin.xml
index b170640a475..0e9523e8850 100644
--- a/bundles/org.eclipse.ui.ide/plugin.xml
+++ b/bundles/org.eclipse.ui.ide/plugin.xml
@@ -1089,7 +1089,13 @@
id="org.eclipse.ui.ide.markers.copyMarkerResourceQualifiedName"
name="%command.copyMarkerResourceQualifiedName.name"
defaultHandler="org.eclipse.ui.internal.views.markers.CopyMarkerResourceQualifiedNameHandler">
-
+
+
+
+
+
+ *
* @since 3.4
*
*/
-public class ExtendedMarkersView extends ViewPart {
+public class ExtendedMarkersView extends ViewPart implements IFindReplaceTarget, IFindReplaceTargetExtension5 {
/**
* The Markers View Update Job Family
+ *
* @since 3.6
*/
public final Object MARKERSVIEW_UPDATE_JOB_FAMILY = new Object();
@@ -162,16 +175,20 @@ public class ExtendedMarkersView extends ViewPart {
private UIUpdateJob uiUpdateJob;
+ private Composite parentComposite;
+ private Composite viewerComposite;
+ private Composite findComposite;
private MarkersTreeViewer viewer;
private Action filterAction;
-
+ private FindReplaceAction findReplaceAction;
/**
* Tells whether the tree has been painted.
+ *
* @since 3.7
*/
- private boolean treePainted= false;
+ private boolean treePainted = false;
private ISelectionListener pageSelectionListener;
private IPartListener2 partListener;
@@ -183,21 +200,18 @@ public class ExtendedMarkersView extends ViewPart {
private RedoActionHandler redoAction;
- private boolean isViewVisible= true;
-
+ private boolean isViewVisible = true;
/**
* Return a new instance of the receiver.
*
- * @param contentGeneratorId
- * the id of the generator to load.
+ * @param contentGeneratorId the id of the generator to load.
*/
public ExtendedMarkersView(String contentGeneratorId) {
super();
defaultGeneratorIds = new String[] { contentGeneratorId };
}
-
/**
* Add all concrete {@link MarkerSupportItem} elements associated with the
* receiver to allMarkers.
@@ -205,8 +219,7 @@ public ExtendedMarkersView(String contentGeneratorId) {
* @param markerItem
* @param allMarkers
*/
- private void addAllConcreteItems(MarkerSupportItem markerItem,
- Collection allMarkers) {
+ private void addAllConcreteItems(MarkerSupportItem markerItem, Collection allMarkers) {
if (markerItem.isConcrete()) {
allMarkers.add(markerItem);
return;
@@ -233,8 +246,7 @@ void addExpandedCategory(MarkerCategory category) {
* Add all of the markers in markerItem recursively.
*
* @param markerItem
- * @param allMarkers
- * {@link Collection} of {@link IMarker}
+ * @param allMarkers {@link Collection} of {@link IMarker}
*/
private void addMarkers(MarkerSupportItem markerItem, Collection allMarkers) {
if (markerItem.getMarker() != null)
@@ -255,8 +267,8 @@ private void addMarkers(MarkerSupportItem markerItem, Collection allMar
private void createViewer(Composite parent) {
parent.setLayout(new FillLayout());
- viewer = new MarkersTreeViewer(new Tree(parent, SWT.H_SCROLL
- /*| SWT.VIRTUAL */| SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION));
+ viewer = new MarkersTreeViewer(
+ new Tree(parent, SWT.H_SCROLL/* | SWT.VIRTUAL */ | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION));
WorkbenchViewerSetup.setupViewer(viewer);
viewer.getTree().setLinesVisible(true);
viewer.setUseHashlookup(true);
@@ -270,7 +282,7 @@ private void createViewer(Composite parent) {
viewer.getTree().addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
- treePainted= true;
+ treePainted = true;
viewer.getTree().removePaintListener(this);
}
});
@@ -279,8 +291,7 @@ public void paintControl(PaintEvent e) {
/**
* Create the columns for the receiver.
*
- * @param currentColumns
- * the columns to refresh
+ * @param currentColumns the columns to refresh
* @param widths
*/
private void createColumns(TreeColumn[] currentColumns, int[] widths) {
@@ -306,8 +317,7 @@ private void createColumns(TreeColumn[] currentColumns, int[] widths) {
// Show the help in the first column
column.setLabelProvider(new MarkerColumnLabelProvider(markerField));
column.getColumn().setText(markerField.getColumnHeaderText());
- column.getColumn().setToolTipText(
- markerField.getColumnTooltipText());
+ column.getColumn().setToolTipText(markerField.getColumnTooltipText());
column.getColumn().setImage(markerField.getColumnHeaderImage());
EditingSupport support = markerField.getEditingSupport(viewer);
@@ -318,24 +328,23 @@ private void createColumns(TreeColumn[] currentColumns, int[] widths) {
updateDirectionIndicator(column.getColumn(), markerField);
IMemento columnWidths = null;
- if (memento != null){
+ if (memento != null) {
columnWidths = memento.getChild(TAG_COLUMN_WIDTHS);
}
- //adjust the column width
+ // adjust the column width
int columnWidth = i < widths.length ? widths[i] : -1;
columnWidth = getFieldWidth(markerField, columnWidth, false);
if (columnWidths != null) {
// save it
columnWidths.putInteger(
- markerField.getConfigurationElement().getAttribute(
- MarkerSupportInternalUtilities.ATTRIBUTE_ID), columnWidth);
+ markerField.getConfigurationElement().getAttribute(MarkerSupportInternalUtilities.ATTRIBUTE_ID),
+ columnWidth);
}
// Take trim into account if we are using the default value, but not
// if it is restored.
if (columnWidth < 0)
- layout.addColumnData(new ColumnPixelData(markerField
- .getDefaultColumnWidth(tree), true, true));
+ layout.addColumnData(new ColumnPixelData(markerField.getDefaultColumnWidth(tree), true, true));
else
layout.addColumnData(new ColumnPixelData(columnWidth, true));
}
@@ -385,7 +394,7 @@ int getFieldWidth(MarkerField markerField, int preferredWidth, boolean considerU
Tree tree = getViewer().getTree();
if (considerUIWidths) {
- TreeColumn[] columns= tree.getColumns();
+ TreeColumn[] columns = tree.getColumns();
for (TreeColumn column : columns) {
if (markerField.equals(column.getData(MARKER_FIELD))) {
return column.getWidth();
@@ -396,9 +405,8 @@ int getFieldWidth(MarkerField markerField, int preferredWidth, boolean considerU
if (preferredWidth < 0 && memento != null) {
IMemento columnWidths = memento.getChild(TAG_COLUMN_WIDTHS);
if (columnWidths != null) {
- Integer value = columnWidths.getInteger(markerField
- .getConfigurationElement().getAttribute(
- MarkerSupportInternalUtilities.ATTRIBUTE_ID));
+ Integer value = columnWidths.getInteger(markerField.getConfigurationElement()
+ .getAttribute(MarkerSupportInternalUtilities.ATTRIBUTE_ID));
// Make sure we get a useful value
if (value != null && value.intValue() >= 0)
preferredWidth = value.intValue();
@@ -419,7 +427,23 @@ int getFieldWidth(MarkerField markerField, int preferredWidth, boolean considerU
@Override
public void createPartControl(Composite parent) {
- createViewer(parent);
+ parentComposite = new Composite(parent, SWT.NULL);
+ GridLayout parentCompositeLayout = new GridLayout(1, true);
+ parentCompositeLayout.marginBottom = 0;
+ parentCompositeLayout.verticalSpacing = 0;
+ parentCompositeLayout.horizontalSpacing = 0;
+ parentComposite.setLayout(parentCompositeLayout);
+
+ viewerComposite = new Composite(parentComposite, SWT.NULL);
+ GridData viewerCompositeGD = new GridData();
+ viewerCompositeGD.grabExcessHorizontalSpace = true;
+ viewerCompositeGD.grabExcessVerticalSpace = true;
+ viewerCompositeGD.horizontalAlignment = GridData.FILL;
+ viewerCompositeGD.verticalAlignment = GridData.FILL;
+ viewerComposite.setLayout(new FillLayout());
+ viewerComposite.setLayoutData(viewerCompositeGD);
+
+ createViewer(viewerComposite);
addDoubleClickListener();
@@ -441,15 +465,14 @@ public void createPartControl(Composite parent) {
getSite().setSelectionProvider(viewer);
- IUndoContext undoContext= getUndoContext();
- undoAction= new UndoActionHandler(getSite(), undoContext);
+ IUndoContext undoContext = getUndoContext();
+ undoAction = new UndoActionHandler(getSite(), undoContext);
undoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_UNDO);
- redoAction= new RedoActionHandler(getSite(), undoContext);
+ redoAction = new RedoActionHandler(getSite(), undoContext);
redoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_REDO);
getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);
-
startView();
}
@@ -459,7 +482,7 @@ public void createPartControl(Composite parent) {
*/
private void startView() {
viewer.setInput(builder.getMarkers());
- //always use a clone for Thread safety
+ // always use a clone for Thread safety
IContentProvider contentProvider = viewer.getContentProvider();
Markers clone = createViewerInputClone();
if (clone == null) {
@@ -470,17 +493,19 @@ private void startView() {
}
/**
- * Attaches an {@link IDoubleClickListener} to expand items that are not openable
+ * Attaches an {@link IDoubleClickListener} to expand items that are not
+ * openable
+ *
* @since 3.8
*/
private void addDoubleClickListener() {
viewer.addDoubleClickListener(event -> {
ISelection selection = event.getSelection();
- if(selection instanceof ITreeSelection) {
+ if (selection instanceof ITreeSelection) {
ITreeSelection ss = (ITreeSelection) selection;
- if(ss.size() == 1) {
+ if (ss.size() == 1) {
Object obj = ss.getFirstElement();
- if(viewer.isExpandable(obj)) {
+ if (viewer.isExpandable(obj)) {
viewer.setExpandedState(obj, !viewer.getExpandedState(obj));
}
}
@@ -508,8 +533,8 @@ private void addPageAndPartSelectionListener() {
private void addSelectionListener() {
viewer.addSelectionChangedListener(event -> {
ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection){
- updateStatusLine((IStructuredSelection)selection);
+ if (selection instanceof IStructuredSelection) {
+ updateStatusLine((IStructuredSelection) selection);
}
});
}
@@ -577,7 +602,8 @@ protected void open(ISelection selection, boolean activate) {
/**
* Returns the complete list of selected {@link IMarker}s from the view.
*
- * @return the complete list of selected {@link IMarker}s or an empty array, never null
+ * @return the complete list of selected {@link IMarker}s or an empty array,
+ * never null
* @since 3.8
*/
IMarker[] getOpenableMarkers() {
@@ -631,7 +657,7 @@ public void dispose() {
* @return MarkerSupportItem[]
*/
MarkerSupportItem[] getAllConcreteItems() {
- MarkerSupportItem[] elements =getActiveViewerInputClone().getElements();
+ MarkerSupportItem[] elements = getActiveViewerInputClone().getElements();
Collection allMarkers = new ArrayList<>();
for (MarkerSupportItem element : elements) {
addAllConcreteItems(element, allMarkers);
@@ -656,7 +682,7 @@ Collection getAllFilters() {
* @return IMarker[]
*/
IMarker[] getAllMarkers() {
- MarkerSupportItem[] elements =getActiveViewerInputClone().getElements();
+ MarkerSupportItem[] elements = getActiveViewerInputClone().getElements();
Collection allMarkers = new ArrayList<>();
for (MarkerSupportItem element : elements) {
addMarkers(element, allMarkers);
@@ -688,7 +714,7 @@ Collection getCategoriesToExpand() {
IMemento expanded = this.memento.getChild(TAG_EXPANDED);
if (expanded != null) {
IMemento[] mementoCategories = expanded.getChildren(TAG_CATEGORY);
- MarkerCategory[] markerCategories =getActiveViewerInputClone().getCategories();
+ MarkerCategory[] markerCategories = getActiveViewerInputClone().getCategories();
if (markerCategories != null) {
for (MarkerCategory markerCategorie : markerCategories) {
for (IMemento mementoCategorie : mementoCategories) {
@@ -742,9 +768,8 @@ private IContentProvider getContentProvider() {
* @return String
*/
private String getFieldId(TreeColumn treeColumn) {
- return ((MarkerField) treeColumn.getData(MARKER_FIELD))
- .getConfigurationElement().getAttribute(
- MarkerSupportInternalUtilities.ATTRIBUTE_ID);
+ return ((MarkerField) treeColumn.getData(MARKER_FIELD)).getConfigurationElement()
+ .getAttribute(MarkerSupportInternalUtilities.ATTRIBUTE_ID);
}
/**
@@ -771,8 +796,7 @@ private SelectionListener getHeaderListener() {
public void widgetSelected(SelectionEvent e) {
final TreeColumn column = (TreeColumn) e.widget;
- final MarkerField field = (MarkerField) column
- .getData(MARKER_FIELD);
+ final MarkerField field = (MarkerField) column.getData(MARKER_FIELD);
setPrimarySortField(field, column);
}
};
@@ -850,8 +874,8 @@ public void partVisible(IWorkbenchPartReference partRef) {
}
/**
- * @return true if the builder noticed that marker updates were made
- * but UI is not updated yet
+ * @return true if the builder noticed that marker updates were made but UI is
+ * not updated yet
*/
private boolean hasPendingChanges() {
boolean[] changeFlags = builder.readChangeFlags();
@@ -908,8 +932,8 @@ public boolean getSortAscending() {
* Get the status message for the title and status line.
*
* @param markers the markers for which to get the status message
- * @param counts an array of {@link Integer} where index indicates
- * [errors,warnings,infos,others]
+ * @param counts an array of {@link Integer} where index indicates
+ * [errors,warnings,infos,others]
* @return String
*/
private String getStatusMessage(Markers markers, Integer[] counts) {
@@ -930,7 +954,7 @@ private String getStatusMessage(Markers markers, Integer[] counts) {
}
filteredCount += childCount;
}
- } else if(markerLimitsEnabled) {
+ } else if (markerLimitsEnabled) {
filteredCount = markerLimit;
} else {
filteredCount = -1;
@@ -945,9 +969,8 @@ private String getStatusMessage(Markers markers, Integer[] counts) {
}
return status;
}
- String message= MessageFormat.format(
- MarkerMessages.errorsAndWarningsSummaryBreakdown,
- counts[0], counts[1], /* combine infos and others */ counts[2] + counts[3]);
+ String message = MessageFormat.format(MarkerMessages.errorsAndWarningsSummaryBreakdown, counts[0], counts[1],
+ /* combine infos and others */ counts[2] + counts[3]);
if (filteredCount < 0 || filteredCount >= totalCount) {
return message;
}
@@ -963,20 +986,24 @@ private String getStatusMessage(Markers markers, Integer[] counts) {
Markers getViewerInput() {
return (Markers) viewer.getInput();
}
+
/**
* Return the active clone currently in use by UI.
*
* @return Object
*/
Markers getActiveViewerInputClone() {
- /*The ideal place to hold the reference for the
- clone is the view,as it is a for-ui-only clone*/
+ /*
+ * The ideal place to hold the reference for the clone is the view,as it is a
+ * for-ui-only clone
+ */
return builder.getClonedMarkers();
}
/**
- * Return a new clone to use in UI.Can return
- * null if markers are changing or building.
+ * Return a new clone to use in UI.Can return null if markers are changing or
+ * building.
+ *
* @see CachedMarkerBuilder#createMarkersClone()
*
*
@@ -1005,16 +1032,14 @@ public void init(IViewSite site, IMemento m) throws PartInitException {
}
if (generatorDescriptor == null && defaultGeneratorIds.length > 0) {
- generatorDescriptor = MarkerSupportRegistry.getInstance()
- .getContentGenDescriptor(defaultGeneratorIds[0]);
+ generatorDescriptor = MarkerSupportRegistry.getInstance().getContentGenDescriptor(defaultGeneratorIds[0]);
if (generatorDescriptor == null) {
logInvalidGenerator(defaultGeneratorIds[0]);
}
}
if (generatorDescriptor == null) {
- generatorDescriptor = MarkerSupportRegistry.getInstance()
- .getDefaultContentGenDescriptor();
+ generatorDescriptor = MarkerSupportRegistry.getInstance().getDefaultContentGenDescriptor();
}
builder = new CachedMarkerBuilder(this);
@@ -1026,11 +1051,9 @@ public void init(IViewSite site, IMemento m) throws PartInitException {
// Add in the markers view actions
- menuService.populateContributionManager((ContributionManager) site
- .getActionBars().getMenuManager(), "menu:" //$NON-NLS-1$
+ menuService.populateContributionManager((ContributionManager) site.getActionBars().getMenuManager(), "menu:" //$NON-NLS-1$
+ MarkerSupportRegistry.MARKERS_ID);
- menuService.populateContributionManager((ContributionManager) site
- .getActionBars().getToolBarManager(),
+ menuService.populateContributionManager((ContributionManager) site.getActionBars().getToolBarManager(),
"toolbar:" + MarkerSupportRegistry.MARKERS_ID); //$NON-NLS-1$
builder.restoreState(m);
@@ -1129,8 +1152,7 @@ MarkerContentGenerator getGenerator() {
* @param id
*/
void logInvalidGenerator(String id) {
- StatusManager.getManager().handle(
- new Status(IStatus.WARNING, IDEWorkbenchPlugin.IDE_WORKBENCH,
+ StatusManager.getManager().handle(new Status(IStatus.WARNING, IDEWorkbenchPlugin.IDE_WORKBENCH,
NLS.bind("Invalid markerContentGenerator {0} ", //$NON-NLS-1$
id)));
}
@@ -1139,8 +1161,8 @@ void logInvalidGenerator(String id) {
* Open the filters dialog for the receiver.
*/
void openFiltersDialog() {
- FiltersConfigurationDialog dialog = new FiltersConfigurationDialog(
- getSite().getWorkbenchWindow().getShell(), generator);
+ FiltersConfigurationDialog dialog = new FiltersConfigurationDialog(getSite().getWorkbenchWindow().getShell(),
+ generator);
if (dialog.open() == Window.OK) {
generator.updateFilters(dialog.getFilters(), dialog.andFilters());
}
@@ -1189,7 +1211,7 @@ public boolean isMarkerLimitsEnabled() {
*/
void reexpandCategories() {
if (!getCategoriesToExpand().isEmpty() && builder.isShowingHierarchy()) {
- MarkerItem[] items =getActiveViewerInputClone().getElements();
+ MarkerItem[] items = getActiveViewerInputClone().getElements();
IContentProvider provider = viewer.getContentProvider();
for (int i = 0; i < items.length; i++) {
String name = ((MarkerCategory) items[i]).getName();
@@ -1206,8 +1228,8 @@ void reexpandCategories() {
}
/**
- * Register the context menu for the receiver so that commands may be added
- * to it.
+ * Register the context menu for the receiver so that commands may be added to
+ * it.
*/
private void registerContextMenu() {
MenuManager contextMenu = new MenuManager();
@@ -1251,16 +1273,16 @@ public void saveState(IMemento m) {
int[] positions = viewer.getTree().getColumnOrder();
for (int i = 0; i < fields.length; i++) {
TreeColumn column = viewer.getTree().getColumn(i);
- MarkerField markerField= (MarkerField)column.getData(MARKER_FIELD);
+ MarkerField markerField = (MarkerField) column.getData(MARKER_FIELD);
/*
* Workaround for TeeColumn.getWidth() returning 0 in some cases, see
* https://bugs.eclipse.org/341865 for details.
*/
- int width= getFieldWidth(markerField, -1, treePainted);
+ int width = getFieldWidth(markerField, -1, treePainted);
columnEntry.putInteger(getFieldId(column), width);
- fields[positions[i]]= markerField;
+ fields[positions[i]] = markerField;
}
if (generator != null) {
generator.saveState(m, fields);
@@ -1303,10 +1325,8 @@ void setPrimarySortField(MarkerField field) {
return;
}
}
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.WARNING,
- "Sorting by non visible field " //$NON-NLS-1$
- + field.getName(), null));
+ StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.WARNING, "Sorting by non visible field " //$NON-NLS-1$
+ + field.getName(), null));
}
/**
@@ -1333,8 +1353,7 @@ void setSelection(StructuredSelection structuredSelection, boolean reveal) {
List newSelection = new ArrayList<>(structuredSelection.size());
for (Object next : structuredSelection) {
if (next instanceof IMarker) {
- MarkerItem marker = builder.getMarkers().getMarkerItem(
- (IMarker) next);
+ MarkerItem marker = builder.getMarkers().getMarkerItem((IMarker) next);
if (marker != null) {
newSelection.add(marker);
}
@@ -1450,7 +1469,7 @@ void updateTitle() {
* Updates this view's title image.
*
* @param counts an array of {@link Integer} where index indicates
- * [errors,warnings,infos,others]
+ * [errors,warnings,infos,others]
* @since 3.7
*/
void updateTitleImage(Integer[] counts) {
@@ -1461,8 +1480,7 @@ void updateTitleImage(Integer[] counts) {
*/
private void initDragAndDrop() {
int operations = DND.DROP_COPY;
- Transfer[] transferTypes = new Transfer[] {
- MarkerTransfer.getInstance(), TextTransfer.getInstance() };
+ Transfer[] transferTypes = new Transfer[] { MarkerTransfer.getInstance(), TextTransfer.getInstance() };
DragSourceListener listener = new DragSourceAdapter() {
@Override
public void dragSetData(DragSourceEvent event) {
@@ -1483,14 +1501,16 @@ public void dragFinished(DragSourceEvent event) {
private void initToolBar() {
IActionBars bars = getViewSite().getActionBars();
IToolBarManager tm = bars.getToolBarManager();
+ setFindReplaceAction(
+ new FindReplaceAction(EditorMessages.getBundleForConstructedKeys(), "MarkersView.Find.", this)); //$NON-NLS-1$
createFilterAction();
tm.add(new Separator("FilterGroup")); //$NON-NLS-1$
tm.add(filterAction);
}
/**
- * The user is attempting to drag marker data. Add the appropriate data to
- * the event depending on the transfer type.
+ * The user is attempting to drag marker data. Add the appropriate data to the
+ * event depending on the transfer type.
*/
private void performDragSetData(DragSourceEvent event) {
if (MarkerTransfer.getInstance().isSupportedType(event.dataType)) {
@@ -1517,10 +1537,10 @@ Object[] getHiddenFields() {
/**
* @param visible
*/
- void setVisibleFields(Collection visible,int[] widths) {
+ void setVisibleFields(Collection visible, int[] widths) {
generator.setVisibleFields(visible);
- //viewer.setSelection(new StructuredSelection());
- //viewer.removeAndClearAll();
+ // viewer.setSelection(new StructuredSelection());
+ // viewer.removeAndClearAll();
createColumns(viewer.getTree().getColumns(), widths);
scheduleUpdate(0L);
}
@@ -1533,8 +1553,7 @@ TreeViewer getViewer() {
}
/**
- * The method should not be called directly, see
- * {@link MarkerUpdateScheduler}
+ * The method should not be called directly, see {@link MarkerUpdateScheduler}
*
* Cancel a scheduled delay
*/
@@ -1547,8 +1566,7 @@ void cancelQueuedUpdates() {
}
/**
- * The method should not be called directly, see
- * {@link MarkerUpdateScheduler}
+ * The method should not be called directly, see {@link MarkerUpdateScheduler}
*
* @param delay
* @return UIUpdateJob
@@ -1563,8 +1581,7 @@ UIUpdateJob scheduleUpdate(long delay) {
// uiUpdateJob.setPriority(Job.SHORT);
uiUpdateJob.setSystem(true);
}
- IWorkbenchSiteProgressService progressService = builder
- .getProgressService();
+ IWorkbenchSiteProgressService progressService = builder.getProgressService();
if (progressService != null) {
progressService.schedule(uiUpdateJob, delay);
} else {
@@ -1584,23 +1601,24 @@ long getLastUIRefreshTime() {
}
return -1;
}
+
/**
* @return true if the UI isUpdating
*
*/
boolean isUIUpdating() {
- return uiUpdateJob!=null?uiUpdateJob.isUpdating():false;
+ return uiUpdateJob != null ? uiUpdateJob.isUpdating() : false;
}
/**
- * Return the next secondary id that has not been opened for a primary id of
- * a part.
+ * Return the next secondary id that has not been opened for a primary id of a
+ * part.
*
* @return part
*/
static String newSecondaryID(IViewPart part) {
- while (part.getSite().getPage().findViewReference(
- part.getSite().getId(), String.valueOf(instanceCount)) != null) {
+ while (part.getSite().getPage().findViewReference(part.getSite().getId(),
+ String.valueOf(instanceCount)) != null) {
instanceCount++;
}
@@ -1711,9 +1729,9 @@ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
}
/**
- * Return the undo context associated with operations performed in this view. By default, return
- * the workspace undo context. Subclasses should override if a more specific undo context should
- * be used.
+ * Return the undo context associated with operations performed in this view. By
+ * default, return the workspace undo context. Subclasses should override if a
+ * more specific undo context should be used.
*
* @since 3.7
*/
@@ -1729,16 +1747,19 @@ protected IUndoContext getUndoContext() {
*/
protected String getDeleteOperationName(IMarker[] markers) {
Assert.isLegal(markers.length > 0);
- return markers.length == 1 ? MarkerMessages.deleteMarker_operationName : MarkerMessages.deleteMarkers_operationName;
+ return markers.length == 1 ? MarkerMessages.deleteMarker_operationName
+ : MarkerMessages.deleteMarkers_operationName;
}
/**
* Tells whether this view is visible.
*
- * See bug 401632 why we can't use {@link IWorkbenchPage#isPartVisible(IWorkbenchPart)}.
+ * See bug 401632 why we can't use
+ * {@link IWorkbenchPage#isPartVisible(IWorkbenchPart)}.
*
*
- * @return true if this view is visible, false otherwise
+ * @return true if this view is visible, false
+ * otherwise
*/
boolean isVisible() {
return isViewVisible;
@@ -1751,4 +1772,110 @@ public T getAdapter(Class adapter) {
}
return super.getAdapter(adapter);
}
+
+ /**
+ * <-- for finding -->
+ */
+
+ @Override
+ public Composite beginInlineSession() {
+ findComposite = new Composite(parentComposite, SWT.NULL);
+ findComposite.setLayout(new GridLayout(1, false));
+ GridData findCompositeGD = new GridData();
+ findCompositeGD.horizontalAlignment = GridData.FILL;
+ findCompositeGD.verticalAlignment = GridData.FILL;
+ findComposite.setLayoutData(findCompositeGD);
+
+ return findComposite;
+ }
+
+ @Override
+ public void updateLayout() {
+ // TODO not sure which one of these three does what I want to do
+ parentComposite.layout();
+ parentComposite.redraw();
+ parentComposite.update();
+ }
+
+ @Override
+ public void endInlineSession() {
+ findComposite.dispose();
+ findComposite = null;
+ }
+
+ @Override
+ public boolean canPerformFind() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public int findAndSelect(int widgetOffset, String findString, boolean searchForward, boolean caseSensitive,
+ boolean wholeWord) {
+
+ var tree = viewer.getTree();
+ var items = tree.getItems();
+ ArrayList selection = new ArrayList<>();
+ for (var item : items) {
+ // TODO: has children?
+ for (var child : ((MarkerViewerContentProvider) viewer.getContentProvider()).getElements(item)) {
+ MarkerSupportItem[] markerCategoryChildren = ((MarkerCategory) child).getChildren();
+ for (var markerSupportItem : markerCategoryChildren) {
+ String markerMessage = markerSupportItem.getMarker().getAttribute(IMarker.MESSAGE,
+ MarkerSupportInternalUtilities.UNKNOWN_ATRRIBTE_VALUE_STRING);
+ if (markerMessage.contains(findString)) {
+ ArrayList