use of com.liferay.ide.server.core.ILiferayRuntimeStub in project liferay-ide by liferay.
the class LiferayRuntimeStubComposite method updateStubs.
protected void updateStubs() {
ILiferayRuntimeStub[] stubs = LiferayServerCore.getRuntimeStubs();
if (ListUtil.isEmpty(stubs)) {
return;
}
String[] names = new String[stubs.length];
LiferayRuntimeStubDelegate delegate = getStubDelegate();
String stubId = delegate.getRuntimeStubTypeId();
int stubIndex = -1;
for (int i = 0; i < stubs.length; i++) {
names[i] = stubs[i].getName();
if (stubs[i].getRuntimeStubTypeId().equals(stubId)) {
stubIndex = i;
}
}
comboRuntimeStubType.setItems(names);
if (stubIndex >= 0) {
comboRuntimeStubType.select(stubIndex);
}
}
use of com.liferay.ide.server.core.ILiferayRuntimeStub in project liferay-ide by liferay.
the class LiferayRuntimeStubComposite method createControl.
protected void createControl(Composite parent) {
setLayout(new GridLayout(2, false));
setLayoutData(new GridData(GridData.FILL_BOTH));
setBackground(parent.getBackground());
Label lblName = new Label(this, SWT.NONE);
lblName.setText(Msgs.name);
new Label(this, SWT.NONE);
textName = new Text(this, SWT.BORDER);
textName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
textName.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
runtimeWC.setName(textName.getText());
validate();
}
});
createSpacer();
Label lblRuntimeStubType = new Label(this, SWT.NONE);
lblRuntimeStubType.setText(Msgs.liferayBundleType);
createSpacer();
comboRuntimeStubType = new Combo(this, SWT.READ_ONLY);
comboRuntimeStubType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
createSpacer();
final Label lblInstall = new Label(this, SWT.WRAP);
lblInstall.setText(Msgs.liferayBundleDirectory);
new Label(this, SWT.NONE);
textInstallDir = new Text(this, SWT.BORDER);
textInstallDir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
comboRuntimeStubType.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
int index = comboRuntimeStubType.getSelectionIndex();
ILiferayRuntimeStub selectedStub = LiferayServerCore.getRuntimeStubs()[index];
LiferayRuntimeStubDelegate delegate = getStubDelegate();
delegate.setRuntimeStubTypeId(selectedStub.getRuntimeStubTypeId());
String stubTypeId = selectedStub.getRuntimeStubTypeId();
IRuntimeType runtimeType = ServerCore.findRuntimeType(stubTypeId);
for (IRuntime runtime : ServerCore.getRuntimes()) {
if (runtime.getRuntimeType().equals(runtimeType)) {
textInstallDir.setText(runtime.getLocation().toOSString());
}
}
validate();
}
});
textInstallDir.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
textInstallDirChanged(textInstallDir.getText());
}
});
Button btnBrowse = new Button(this, SWT.NONE);
btnBrowse.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
btnBrowse.setText(Msgs.browse);
btnBrowse.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent se) {
DirectoryDialog dialog = new DirectoryDialog(LiferayRuntimeStubComposite.this.getShell());
dialog.setMessage(Msgs.selectRuntimeStubDirectory);
dialog.setFilterPath(textInstallDir.getText());
String selectedDirectory = dialog.open();
if (selectedDirectory != null) {
textInstallDir.setText(selectedDirectory);
}
}
});
new Label(this, SWT.NONE);
Dialog.applyDialogFont(this);
textName.forceFocus();
}
Aggregations