Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jface wiki #8

Merged
merged 5 commits into from
Dec 21, 2023
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
1 change: 1 addition & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
-Pbuild-individual-bundles
-Dtycho.target.eager=true
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2020 IBM Corporation and others.
* Copyright (c) 2009, 2023 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -22,6 +22,7 @@
* Daniel Kruegler <[email protected]> - Bug 473779
* Simon Scholz <[email protected]> - Bug 506306
* Axel Richard <[email protected]> - Bug 354538
* Christoph Läubrich - issue #1435
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;

Expand All @@ -37,6 +38,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.core.runtime.ILog;
import org.eclipse.e4.core.commands.ExpressionContext;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IContextFunction;
Expand Down Expand Up @@ -1170,7 +1172,16 @@ private void scheduleManagerUpdate(IContributionManager mgr) {
mgrToUpdate.clear();
}
for (IContributionManager mgr1 : toUpdate) {
mgr1.update(false);
try {
mgr1.update(false);
} catch (RuntimeException e) {
String message = String.format(
"ContributionManager '%s' threw an exception while performing update!", mgr1); //$NON-NLS-1$
ILog.get().error(message, e);
synchronized (mgrToUpdate) {
mgrToUpdate.add(mgr1);
}
}
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*******************************************************************************/
package org.eclipse.jface.action;

import java.util.Arrays;

import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.NotEnabledException;
import org.eclipse.jface.action.ExternalActionManager.IBindingManagerCallback;
Expand Down Expand Up @@ -1168,7 +1170,22 @@ private void handleShowProxy(Menu proxy) {
if (holdMenu == null) {
return;
}

// for backwards compatibility (in case the menu is NOT calculated asynchronously)
copyMenu(holdMenu, proxy);

// in case the menu is populated asynchronously by the menu creator, this listener will update it once it's complete
holdMenu.addListener(SWT.Show, evt -> {
// This one is (currently) being triggered from ContextuaLaunchAction
if (evt.data == null || evt.data != holdMenu)
return;

// remove all items in the proxy...
Arrays.stream(proxy.getItems()).forEach(Widget::dispose);

// ... and replace them with the new content
copyMenu(holdMenu, proxy);
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ protected boolean updateSelection(IStructuredSelection selection) {
if (!super.updateSelection(selection) || selection.isEmpty()) {
return false;
}
if (getSelectedResources().size() > 1) {
return true;
}
for (IResource r : getSelectedResources()) {
if (!r.isAccessible()) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Lars Vogel <[email protected]> - Bug 474273
* Simon Scholz <[email protected]> - Bug 486777
* Dinesh Palanisamy (ETAS GmbH) - Issue #998 Copy as path for resources
* Dinesh Palanisamy (ETAS GmbH) - Issue #1440 Improvement in generics
*******************************************************************************/
package org.eclipse.ui.internal.ide.dialogs;

Expand Down Expand Up @@ -1068,11 +1069,11 @@ public void performChange(IResource resource) {
};
}

private List/* <IResource> */ getResourcesToVisit(IResource resource) throws CoreException {
private List<IResource> getResourcesToVisit(IResource resource) throws CoreException {
// use set for fast lookup
final Set/* <URI> */ visited = new HashSet/* <URI> */();
final Set<URI> visited = new HashSet<>();
// use list to preserve the order of visited resources
final List/* <IResource> */ toVisit = new ArrayList/* <IResource> */();
final List<IResource> toVisit = new ArrayList<>();
visited.add(resource.getLocationURI());
resource.accept(proxy -> {
IResource childResource = proxy.requestResource();
Expand All @@ -1086,7 +1087,7 @@ public void performChange(IResource resource) {
return toVisit;
}

private boolean shouldPerformRecursiveChanges(List/* <IResourceChange> */ changes) {
private boolean shouldPerformRecursiveChanges(List<IResourceChange> changes) {
if (!changes.isEmpty()) {
StringBuilder message = new StringBuilder(IDEWorkbenchMessages.ResourceInfo_recursiveChangesSummary)
.append('\n');
Expand All @@ -1106,20 +1107,20 @@ private boolean shouldPerformRecursiveChanges(List/* <IResourceChange> */ change
return false;
}

private void scheduleRecursiveChangesJob(final IResource resource, final List/* <IResourceChange> */ changes) {
private void scheduleRecursiveChangesJob(final IResource resource, final List<IResourceChange> changes) {
Job.create(IDEWorkbenchMessages.ResourceInfo_recursiveChangesJobName, monitor -> {
try {
List/* <IResource> */ toVisit = getResourcesToVisit(resource);
List<IResource> toVisit = getResourcesToVisit(resource);

// Prepare the monitor for the given amount of work
SubMonitor subMonitor = SubMonitor.convert(monitor,
IDEWorkbenchMessages.ResourceInfo_recursiveChangesJobName,
toVisit.size());

// Apply changes recursively
for (Iterator /* <IResource> */ it = toVisit.iterator(); it.hasNext();) {
for (Iterator<IResource> it = toVisit.iterator(); it.hasNext();) {
SubMonitor iterationMonitor = subMonitor.split(1).setWorkRemaining(changes.size());
IResource childResource = (IResource) it.next();
IResource childResource = it.next();
iterationMonitor.subTask(NLS
.bind(IDEWorkbenchMessages.ResourceInfo_recursiveChangesSubTaskName,
childResource.getFullPath()));
Expand Down Expand Up @@ -1166,7 +1167,7 @@ public boolean performOk() {
new NullProgressMonitor());
}

List/* <IResourceChange> */ changes = new ArrayList/* <IResourceChange> */();
List<IResourceChange> changes = new ArrayList<>();

ResourceAttributes attrs = resource.getResourceAttributes();
if (attrs != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ public void fillContextMenu(IMenuManager menu) {
buildAction.selectionChanged(selection);
menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, buildAction);
}
if (!hasClosedProjects) {
// To refresh, even if one project is open
if (hasOpenProjects) {
refreshAction.selectionChanged(selection);
menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, refreshAction);
}
Expand Down
Loading
Loading