use of org.eclipse.jface.dialogs.PopupDialog in project liferay-ide by liferay.
the class InitConfigureProjectPage method createSpecialDescriptor.
@Override
public void createSpecialDescriptor(Composite parent, int style) {
Composite fillLayoutComposite = SWTUtil.createComposite(parent, 2, 2, GridData.FILL_HORIZONTAL);
final StringBuilder descriptorBuilder = new StringBuilder("The initial step will be to upgrade to Liferay Workspace or Liferay Plugins SDK 7.0. ");
descriptorBuilder.append("For more details, please see <a>dev.liferay.com</a>.");
String url = "https://dev.liferay.com/develop/tutorials";
SWTUtil.createHyperLink(fillLayoutComposite, SWT.WRAP, descriptorBuilder.toString(), 1, url);
final StringBuilder extensionDecBuilder = new StringBuilder("The first step will help you convert a Liferay Plugins SDK 6.2 to Liferay Plugins SDK 7.0 or to Liferay Workspace.\n");
extensionDecBuilder.append("Click the \"Import Projects\" button to import your project into the Eclipse workspace ");
extensionDecBuilder.append("(this process maybe need 5-10 minutes for bundle initialization).\n");
extensionDecBuilder.append("Note:\n");
extensionDecBuilder.append(" To save time, downloading the 7.0 ivy cache locally could be a good choice when upgrading to Liferay Plugins SDK 7. \n");
extensionDecBuilder.append(" Theme and Ext projects will be ignored since this tool does not support them currently. \n");
Label image = new Label(fillLayoutComposite, SWT.WRAP);
image.setImage(loadImage("question.png"));
PopupDialog popupDialog = new PopupDialog(fillLayoutComposite.getShell(), PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, false, false, false, false, null, null) {
private static final int _cursorSize = 15;
@Override
protected Point getInitialLocation(Point initialSize) {
Display display = getShell().getDisplay();
Point location = display.getCursorLocation();
location.x += _cursorSize;
location.y += _cursorSize;
return location;
}
@Override
protected Control createDialogArea(Composite parent) {
Label label = new Label(parent, SWT.WRAP);
label.setText(extensionDecBuilder.toString());
label.setFont(new Font(null, "Times New Roman", 11, SWT.NORMAL));
GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH);
gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING;
gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING;
label.setLayoutData(gd);
return label;
}
};
image.addListener(SWT.MouseHover, new org.eclipse.swt.widgets.Listener() {
@Override
public void handleEvent(org.eclipse.swt.widgets.Event event) {
popupDialog.open();
}
});
image.addListener(SWT.MouseExit, new org.eclipse.swt.widgets.Listener() {
@Override
public void handleEvent(org.eclipse.swt.widgets.Event event) {
popupDialog.close();
}
});
}
use of org.eclipse.jface.dialogs.PopupDialog in project bndtools by bndtools.
the class OSGiRunLaunchDelegate method launch.
@Override
public void launch(final ILaunchConfiguration configuration, String mode, final ILaunch launch, IProgressMonitor monitor) throws CoreException {
SubMonitor progress = SubMonitor.convert(monitor, 2);
try {
boolean dynamic = configuration.getAttribute(LaunchConstants.ATTR_DYNAMIC_BUNDLES, LaunchConstants.DEFAULT_DYNAMIC_BUNDLES);
if (dynamic)
registerLaunchPropertiesRegenerator(run, launch);
} catch (Exception e) {
throw new CoreException(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error obtaining OSGi project launcher.", e));
}
display = Workbench.getInstance().getDisplay();
display.syncExec(new Runnable() {
@Override
public void run() {
dialog = new PopupDialog(new Shell(display), PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, false, true, true, true, false, "Errors in running OSGi Framework", "") {
@Override
protected Control createDialogArea(Composite parent) {
textArea = new Text(parent, SWT.LEAD | SWT.READ_ONLY | SWT.WRAP);
return textArea;
}
@Override
protected void fillDialogMenu(IMenuManager dialogMenu) {
super.fillDialogMenu(dialogMenu);
Action dismissAction = new Action("Close") {
@Override
public void run() {
close();
}
};
dialogMenu.add(dismissAction);
}
@Override
protected Control createInfoTextArea(Composite parent) {
Link link = new Link(parent, SWT.NONE);
link.setText("<a>Dismiss\u2026</a> ");
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
close();
}
});
GridDataFactory.fillDefaults().grab(true, false).align(SWT.END, SWT.FILL).applyTo(link);
return link;
}
@Override
protected Point getDefaultSize() {
Point p = getShell().getSize();
p.x = Math.max(400, p.x / 2);
p.y = Math.max(200, p.y / 2);
return p;
}
@Override
protected Point getInitialLocation(Point initialSize) {
Rectangle r = getShell().getBounds();
return new Point(r.x + r.width - initialSize.x, r.y + r.height - initialSize.y);
}
@Override
public boolean close() {
if (textArea != null) {
textArea.setText("");
}
return super.close();
}
};
}
});
super.launch(configuration, mode, launch, progress.newChild(1, SubMonitor.SUPPRESS_NONE));
}
Aggregations