blob: 5607426db426c19e396e1a99a8004e018fab56d1 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2020 Christian Pontesegger and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Christian Pontesegger - initial API and implementation
*******************************************************************************/
package org.eclipse.skills.ui.notifications;
import org.eclipse.skills.model.IUserTask;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
public class TaskCompletedNotification extends AbstractNotificationPopup {
public static void display(IUserTask task) {
Display.getDefault().asyncExec(() -> {
final TaskCompletedNotification popup = new TaskCompletedNotification(task);
popup.setFadingEnabled(true);
popup.setDelayClose(3000);
popup.open();
});
}
private final IUserTask fUserTask;
public TaskCompletedNotification(IUserTask userTask) {
super(Display.getDefault());
fUserTask = userTask;
}
@Override
protected String getPopupShellTitle() {
return "Task completed";
}
@Override
protected void createContentArea(Composite parent) {
final Composite container = new Composite(parent, SWT.NULL);
final GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
container.setLayoutData(data);
container.setLayout(new GridLayout(1, false));
final Label successMsg = new Label(container, SWT.NULL);
successMsg.setText("Task completed");
new Label(container, SWT.NONE);
final Label testLabel1 = new Label(container, SWT.NONE);
testLabel1.setText(fUserTask.getTask().getTitle());
}
}