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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.ui.workbench.swt;singleton:=true
Bundle-Version: 0.17.900.qualifier
Bundle-Version: 0.17.1000.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ public void activate(MPart element) {
IEclipseContext curContext = getContext(element);
if (curContext != null) {
EPartService ps = curContext.get(EPartService.class);
if (ps != null)
if (ps != null) {
ps.activate(element, requiresFocus(element));
}
}
}

Expand All @@ -107,9 +108,9 @@ public void removeGui(MUIElement element, Object widget) {
}

public Object getUIContainer(MUIElement element) {
if (element.getParent() != null)
if (element.getParent() != null) {
return element.getParent().getWidget();
else {
} else {
Object value = element.getTransientData().get(IPresentationEngine.RENDERING_PARENT_KEY);
if (value != null) {
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,15 @@ private void initDragHandleResource() {
IPath path = IPath.fromOSString("$ws$/images/dragHandle.svg");
URL url = FileLocator.find(bundle, path, null);
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
if (desc != null)
if (desc != null) {
JFaceResources.getImageRegistry().put(DRAG_HANDLE, desc);
}
path = IPath.fromOSString("$ws$/images/dragHandle-rotated.svg");
url = FileLocator.find(bundle, path, null);
ImageDescriptor desc_rotated = ImageDescriptor.createFromURL(url);
if (desc_rotated != null)
if (desc_rotated != null) {
JFaceResources.getImageRegistry().put(DRAG_HANDLE_ROTATED, desc_rotated);
}
}

private Image rotateImage(Display display, Image image, Integer[] frameInts) {
Expand All @@ -153,8 +155,9 @@ private Image rotateImage(Display display, Image image, Integer[] frameInts) {
frameInts[3] = tmp;
}

if (rotatedImageMap.get(image) != null)
if (rotatedImageMap.get(image) != null) {
return rotatedImageMap.get(image);
}

// rotate 90 degrees,,,
Rectangle bounds = image.getBounds();
Expand Down Expand Up @@ -206,14 +209,16 @@ public CSSValue getCSSValue(Control styleControl, String className,
}

// super hack
if (className != null)
if (className != null) {
WidgetElement.setCSSClass(styleControl, className);
}

CSSStyleDeclaration styleDeclarations = csseng.getViewCSS()
.getComputedStyle(tempEment, ""); //$NON-NLS-1$

if (styleDeclarations == null)
if (styleDeclarations == null) {
return null;
}

return styleDeclarations.getPropertyCSSValue(attributeName);
}
Expand All @@ -231,17 +236,20 @@ public Image createImage(Control styleControl, String classId,
if (tempEment == null) {
return null;
}
if (classId != null)
if (classId != null) {
WidgetElement.setCSSClass(styleControl, classId);
}

CSSStyleDeclaration styleDeclarations = csseng.getViewCSS()
.getComputedStyle(tempEment, "");
if (styleDeclarations == null)
if (styleDeclarations == null) {
return null;
}

CSSValue imagePath = styleDeclarations.getPropertyCSSValue(attName);
if (imagePath == null)
if (imagePath == null) {
return null;
}

if (imagePath.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
// String imageString = ((CSSPrimitiveValue) imagePath)
Expand All @@ -255,8 +263,9 @@ public Image createImage(Control styleControl, String classId,
.getPropertyCSSValue("frame-cuts"); //$NON-NLS-1$
if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
CSSValueList valueList = (CSSValueList) value;
if (valueList.getLength() != 4)
if (valueList.getLength() != 4) {
return null;
}

for (int i = 0; i < valueList.getLength(); i++) {
CSSValue val = valueList.item(i);
Expand All @@ -283,11 +292,10 @@ private void addHandleImageDisposedListener(
ImageBasedFrame imageBasedFrame, final Control toFrame,
final String classId, final boolean vertical) {
final Listener listener = event -> {
if (!(event.widget instanceof ImageBasedFrame)) {
if (!(event.widget instanceof ImageBasedFrame frame)) {
return;
}

ImageBasedFrame frame = (ImageBasedFrame) event.widget;
if (!isImagesRefreshRequired(frame)) {
return;
}
Expand Down Expand Up @@ -315,11 +323,10 @@ private void addHandleImageDisposedListener(
private void addFrameImageDisposedListener(ImageBasedFrame imageBasedFrame,
final Control toFrame, final String classId, final boolean vertical) {
final Listener listener = event -> {
if (!(event.widget instanceof ImageBasedFrame)) {
if (!(event.widget instanceof ImageBasedFrame frame)) {
return;
}

ImageBasedFrame frame = (ImageBasedFrame) event.widget;
if (!isImagesRefreshRequired(frame)) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public final class DialogSettingsProvider implements IDialogSettingsProvider {
*/
private static final String KEY_DEFAULT_DIALOG_SETTINGS_ROOTURL = "default_dialog_settings_rootUrl"; //$NON-NLS-1$

private Bundle fBundle;
private final Bundle fBundle;

private IDialogSettings fDialogSettings;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Terry Parker <tparker@google.com> - Bug 416673
* Christian Georgi (SAP) - Bug 432480
* Simon Scholz <simon.scholz@vogella.com> - Bug 478896
* Christoph Läubrich - Bug 563459
* Christoph Läubrich - Bug 563459
******************************************************************************/

package org.eclipse.e4.ui.internal.workbench.swt;
Expand Down Expand Up @@ -158,8 +158,9 @@ public Object start(IApplicationContext applicationContext) throws Exception {
// place it off so it's not visible
shell.setLocation(0, 10000);
}
if (!checkInstanceLocation(instanceLocation, shell, workbench.getContext()))
if (!checkInstanceLocation(instanceLocation, shell, workbench.getContext())) {
return EXIT_OK;
}

// Create and run the UI (if any)
workbench.createAndRunUI(workbench.getApplication());
Expand All @@ -176,10 +177,12 @@ public Object start(IApplicationContext applicationContext) throws Exception {

return EXIT_OK;
} finally {
if (display != null)
if (display != null) {
display.dispose();
if (instanceLocation != null)
}
if (instanceLocation != null) {
instanceLocation.release();
}
}
}

Expand Down Expand Up @@ -410,18 +413,21 @@ private URI determineApplicationModelURI(IApplicationContext appContext) {
*/
private Optional<String> getArgValue(String argName, IApplicationContext appContext, boolean singledCmdArgValue) {
// Is it in the arg list ?
if (argName == null || argName.length() == 0)
if (argName == null || argName.length() == 0) {
return Optional.empty();
}

if (singledCmdArgValue) {
for (String arg : args) {
if (("-" + argName).equals(arg))
if (("-" + argName).equals(arg)) {
return Optional.of("true");
}
}
} else {
for (int i = 0; i < args.length; i++) {
if (("-" + argName).equals(args[i]) && i + 1 < args.length)
if (("-" + argName).equals(args[i]) && i + 1 < args.length) {
return Optional.of(args[i + 1]);
}
}
}

Expand Down Expand Up @@ -737,8 +743,9 @@ private static File getVersionFile(URL workspaceUrl, boolean create) {
static public void initializeServices(MApplication appModel) {
IEclipseContext appContext = appModel.getContext();
// make sure we only add trackers once
if (appContext.containsKey(CONTEXT_INITIALIZED))
if (appContext.containsKey(CONTEXT_INITIALIZED)) {
return;
}
appContext.set(CONTEXT_INITIALIZED, "true");
initializeApplicationServices(appContext);
List<MWindow> windows = appModel.getChildren();
Expand All @@ -748,10 +755,12 @@ static public void initializeServices(MApplication appModel) {
((EObject) appModel).eAdapters().add(new AdapterImpl() {
@Override
public void notifyChanged(Notification notification) {
if (notification.getFeatureID(MApplication.class) != UiPackageImpl.ELEMENT_CONTAINER__CHILDREN)
if (notification.getFeatureID(MApplication.class) != UiPackageImpl.ELEMENT_CONTAINER__CHILDREN) {
return;
if (notification.getEventType() != Notification.ADD)
}
if (notification.getEventType() != Notification.ADD) {
return;
}
MWindow childWindow = (MWindow) notification.getNewValue();
initializeWindowServices(childWindow);
}
Expand Down Expand Up @@ -792,17 +801,19 @@ static public void initializeWindowServices(MWindow childWindow) {
((EObject) childWindow).eAdapters().add(new AdapterImpl() {
@Override
public void notifyChanged(Notification notification) {
if (notification.getFeatureID(MWindow.class) != BasicPackageImpl.WINDOW__CONTEXT)
if (notification.getFeatureID(MWindow.class) != BasicPackageImpl.WINDOW__CONTEXT) {
return;
}
IEclipseContext windowContext = (IEclipseContext) notification.getNewValue();
initWindowContext(windowContext);
}
});
}

static private void initWindowContext(IEclipseContext windowContext) {
if (windowContext == null)
if (windowContext == null) {
return;
}
SelectionAggregator selectionAggregator = ContextInjectionFactory.make(SelectionAggregator.class,
windowContext);
windowContext.set(SelectionAggregator.class, selectionAggregator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ public class MenuService implements EMenuService {

@Override
public boolean registerContextMenu(Object parent, String menuId) {
if (!(parent instanceof Control)) {
if (!(parent instanceof Control parentControl)) {
return false;
}
Control parentControl = (Control) parent;
for (MMenu mmenu : myPart.getMenus()) {
if (menuId.equals(mmenu.getElementId())
&& mmenu instanceof MPopupMenu) {
Expand Down
Loading
Loading