Skip to content
Merged
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
2 changes: 1 addition & 1 deletion bundles/org.eclipse.ui.views.log/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %name
Bundle-SymbolicName: org.eclipse.ui.views.log;singleton:=true
Bundle-Version: 1.4.900.qualifier
Bundle-Version: 1.4.1000.qualifier
Bundle-Activator: org.eclipse.ui.internal.views.log.Activator
Bundle-Vendor: %provider-name
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public abstract class AbstractEntry extends PlatformObject implements IWorkbench
/**
* The collection of direct children of this entry
*/
private List<AbstractEntry> children = new ArrayList<>();
private final List<AbstractEntry> children = new ArrayList<>();
protected Object parent;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ public class EventDetailsDialog extends TrayDialog {
public static final String FILTER_ENABLED = "detailsStackFilterEnabled"; //$NON-NLS-1$
public static final String FILTER_LIST = "detailsStackFilterList"; //$NON-NLS-1$

private LogView logView;
private IMemento memento;
private final LogView logView;
private final IMemento memento;

private AbstractEntry entry;
private AbstractEntry parentEntry; // parent of the entry
private AbstractEntry[] entryChildren; // children of the entry

private LogViewLabelProvider labelProvider;
private TreeViewer provider;
private final LogViewLabelProvider labelProvider;
private final TreeViewer provider;

private static int COPY_ID = 22;

Expand Down Expand Up @@ -151,15 +151,14 @@ private void initialize() {
}

private void resetChildIndex() {
if (entryChildren == null)
if (entryChildren == null) {
return;
}

LogEntry thisEntry = (LogEntry) entry;

for (int i = 0; i < entryChildren.length; i++) {
if (entryChildren[i] instanceof LogEntry) {

LogEntry logEntry = (LogEntry) entryChildren[i];
if (entryChildren[i] instanceof LogEntry logEntry) {

if (logEntry == thisEntry) {
childIndex = i;
Expand Down Expand Up @@ -215,14 +214,16 @@ public void create() {
super.create();

// dialog location
if (dialogLocation != null)
if (dialogLocation != null) {
getShell().setLocation(dialogLocation);
}

// dialog size
if (dialogSize != null)
if (dialogSize != null) {
getShell().setSize(dialogSize);
else
} else {
getShell().setSize(500, 550);
}

applyDialogFont(buttonBar);
getButton(IDialogConstants.OK_ID).setFocus();
Expand All @@ -231,16 +232,17 @@ public void create() {

@Override
protected void buttonPressed(int buttonId) {
if (IDialogConstants.OK_ID == buttonId)
if (IDialogConstants.OK_ID == buttonId) {
okPressed();
else if (IDialogConstants.CANCEL_ID == buttonId)
} else if (IDialogConstants.CANCEL_ID == buttonId) {
cancelPressed();
else if (IDialogConstants.BACK_ID == buttonId)
} else if (IDialogConstants.BACK_ID == buttonId) {
backPressed();
else if (IDialogConstants.NEXT_ID == buttonId)
} else if (IDialogConstants.NEXT_ID == buttonId) {
nextPressed();
else if (COPY_ID == buttonId)
} else if (COPY_ID == buttonId) {
copyPressed();
}
}

protected void backPressed() {
Expand Down Expand Up @@ -303,8 +305,9 @@ private void setComparator(byte sortType, final int sortOrder) {
comparator = (e1, e2) -> {
Date date1 = ((LogEntry) e1).getDate();
Date date2 = ((LogEntry) e2).getDate();
if (sortOrder == LogView.ASCENDING)
if (sortOrder == LogView.ASCENDING) {
return date1.getTime() < date2.getTime() ? LogView.DESCENDING : LogView.ASCENDING;
}
return date1.getTime() > date2.getTime() ? LogView.DESCENDING : LogView.ASCENDING;
};
} else if (sortType == LogView.PLUGIN) {
Expand Down Expand Up @@ -354,13 +357,12 @@ public void updateProperties() {
parentEntry = (AbstractEntry) entry.getParent(entry);
setEntryChildren(parentEntry);
resetChildIndex();
if (childIndex == entryChildren.length - 1)
if (childIndex == entryChildren.length - 1) {
isLastChild = true;
}
}

if (entry instanceof LogEntry) {
LogEntry logEntry = (LogEntry) entry;

if (entry instanceof LogEntry logEntry) {
String strDate = MessageFormat.format("{0}, {1}", //$NON-NLS-1$
dateFormat.format(logEntry.getDate().toInstant()), //
timeFormat.format(logEntry.getDate().toInstant()));
Expand Down Expand Up @@ -496,8 +498,9 @@ private boolean nextChildExists(AbstractEntry originalEntry, AbstractEntry origi
private void setEntryChildren() {
AbstractEntry[] children = getElements();

if (comparator != null)
if (comparator != null) {
Arrays.sort(children, comparator);
}
entryChildren = new AbstractEntry[children.length];

System.arraycopy(children, 0, entryChildren, 0, children.length);
Expand All @@ -510,8 +513,9 @@ private void setEntryChildren() {
private void setEntryChildren(AbstractEntry entry) {
Object[] children = entry.getChildren(entry);

if (comparator != null)
if (comparator != null) {
Arrays.sort(children, comparator);
}

List<AbstractEntry> result = new ArrayList<>();
for (Object element : children) {
Expand Down Expand Up @@ -826,8 +830,9 @@ private IDialogSettings getDialogSettings() {
IDialogSettings settings = PlatformUI
.getDialogSettingsProvider(FrameworkUtil.getBundle(EventDetailsDialog.class)).getDialogSettings();
IDialogSettings dialogSettings = settings.getSection(getClass().getName());
if (dialogSettings == null)
if (dialogSettings == null) {
dialogSettings = settings.addNewSection(getClass().getName());
}
return dialogSettings;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
*/
public class EventDetailsDialogAction extends SelectionProviderAction {

private LogView logView;
private final LogView logView;
/**
* The control that the dialog should appear on top of.
*/
private Control control;
private ISelectionProvider provider;
private final Control control;
private final ISelectionProvider provider;
private EventDetailsDialog propertyDialog;
private Comparator comparator;
private IMemento memento;
private final IMemento memento;

/**
* Creates a new action for opening a property dialog
Expand All @@ -57,8 +57,9 @@ public EventDetailsDialogAction(LogView logView, Control control, ISelectionProv

public boolean resetSelection(byte sortType, int sortOrder) {
IAdaptable element = (IAdaptable) getStructuredSelection().getFirstElement();
if (element == null)
if (element == null) {
return false;
}
if (propertyDialog != null && propertyDialog.isOpen()) {
propertyDialog.resetSelection(element, sortType, sortOrder);
return true;
Expand All @@ -68,21 +69,25 @@ public boolean resetSelection(byte sortType, int sortOrder) {

public void resetSelection() {
IAdaptable element = (IAdaptable) getStructuredSelection().getFirstElement();
if ((element == null) || (!(element instanceof LogEntry)))
if ((element == null) || (!(element instanceof LogEntry))) {
return;
if (propertyDialog != null && propertyDialog.isOpen())
}
if (propertyDialog != null && propertyDialog.isOpen()) {
propertyDialog.resetSelection(element);
}
}

public void resetDialogButtons() {
if (propertyDialog != null && propertyDialog.isOpen())
if (propertyDialog != null && propertyDialog.isOpen()) {
propertyDialog.resetButtons();
}
}

public void setComparator(Comparator comparator) {
this.comparator = comparator;
if (propertyDialog != null && propertyDialog.isOpen())
if (propertyDialog != null && propertyDialog.isOpen()) {
propertyDialog.setComparator(comparator);
}
}

@Override
Expand All @@ -99,8 +104,9 @@ public void run() {

//get initial selection
IAdaptable element = (IAdaptable) getStructuredSelection().getFirstElement();
if ((element == null) || (!(element instanceof LogEntry)))
if ((element == null) || (!(element instanceof LogEntry))) {
return;
}

propertyDialog = new EventDetailsDialog(control.getShell(), logView, element, provider, comparator, memento);
propertyDialog.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class FilterDialog extends TrayDialog {
private Button removeFilter;
private List filterList;

private IMemento memento;
private final IMemento memento;

public FilterDialog(Shell parentShell, IMemento memento) {
super(parentShell);
Expand Down Expand Up @@ -127,8 +127,9 @@ public void widgetSelected(SelectionEvent e) {
});
limitText.addModifyListener(e -> {
try {
if (okButton == null)
if (okButton == null) {
return;
}
int value = Integer.parseInt(limitText.getText());
okButton.setEnabled(value > 0);
} catch (NumberFormatException e1) {
Expand All @@ -151,8 +152,9 @@ public void widgetSelected(SelectionEvent e) {

maxLogTailSizeText.addModifyListener(e -> {
try {
if (okButton == null)
if (okButton == null) {
return;
}
int value = Integer.parseInt(maxLogTailSizeText.getText());
okButton.setEnabled(value > 0);
} catch (NumberFormatException e1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
public class Group extends AbstractEntry {

private String name;
private final String name;

public Group(String name) {
this.name = name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public class ImportLogAction extends Action implements IMenuCreator {
*/
private final LogView logView;
private ImportConfigurationLogAction[] actions;
private IMemento fMemento;
private final IMemento fMemento;

/**
* Action imports log file from given location to Log View.
*/
private class ImportConfigurationLogAction extends Action {
private String name;
private String location;
private final String name;
private final String location;

public ImportConfigurationLogAction(String name, String location) {
super(name, AS_RADIO_BUTTON);
Expand All @@ -69,8 +69,7 @@ public void run() {

@Override
public boolean equals(Object o) {
if (o instanceof ImportConfigurationLogAction) {
ImportConfigurationLogAction action = (ImportConfigurationLogAction) o;
if (o instanceof ImportConfigurationLogAction action) {
return name.equals(action.name) && location.equals(action.name);
}

Expand Down
Loading
Loading