use of org.eclipse.wst.common.frameworks.datamodel.IDataModelListener in project liferay-ide by liferay.
the class NewLayoutTplWizardPage method createTemplateInfoGroup.
protected void createTemplateInfoGroup(Composite parent) {
SWTUtil.createLabel(parent, SWT.RIGHT, Msgs.name, 1);
name = SWTUtil.createText(parent, 1);
this.synchHelper.synchText(name, LAYOUT_TEMPLATE_NAME, null);
SWTUtil.createLabel(parent, StringPool.EMPTY, 1);
SWTUtil.createLabel(parent, SWT.RIGHT, Msgs.id, 1);
id = SWTUtil.createText(parent, 1);
this.synchHelper.synchText(id, LAYOUT_TEMPLATE_ID, null);
SWTUtil.createLabel(parent, StringPool.EMPTY, 1);
SWTUtil.createLabel(parent, SWT.RIGHT, Msgs.templateFile, 1);
templateFile = SWTUtil.createText(parent, 1);
this.synchHelper.synchText(templateFile, LAYOUT_TEMPLATE_FILE, null);
Button templateFileBrowse = SWTUtil.createPushButton(parent, Msgs.browse, null);
templateFileBrowse.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleFileBrowseButton(NewLayoutTplWizardPage.this.templateFile, Msgs.templateFileSelection, Msgs.chooseTemplateFile);
}
});
IProject layoutProject = ProjectUtil.getProject(projectName);
String pluginVersion = LiferayDescriptorHelper.getDescriptorVersion(layoutProject);
if (pluginVersion.equals("6.2.0")) {
SWTUtil.createLabel(parent, SWT.RIGHT, Msgs.wapTemplateFile, 1);
wapTemplateFile = SWTUtil.createText(parent, 1);
this.synchHelper.synchText(wapTemplateFile, LAYOUT_WAP_TEMPLATE_FILE, null);
Button wapTemplateFileBrowse = SWTUtil.createPushButton(parent, Msgs.browse, null);
wapTemplateFileBrowse.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleFileBrowseButton(NewLayoutTplWizardPage.this.wapTemplateFile, Msgs.wapTemplateFileSelection, Msgs.chooseWAPTemplateFile);
}
});
}
SWTUtil.createLabel(parent, SWT.RIGHT, Msgs.thumbnailFile, 1);
thumbnailFile = SWTUtil.createText(parent, 1);
this.synchHelper.synchText(thumbnailFile, LAYOUT_THUMBNAIL_FILE, null);
Button thumbnailFileBrowse = SWTUtil.createPushButton(parent, Msgs.browse, null);
thumbnailFileBrowse.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleFileBrowseButton(NewLayoutTplWizardPage.this.thumbnailFile, Msgs.wapTemplateFileSelection, Msgs.chooseThumbnailFile);
}
});
synchHelper.getDataModel().addListener(new IDataModelListener() {
public void propertyChanged(DataModelEvent event) {
if (LAYOUT_TEMPLATE_NAME.equals(event.getPropertyName()) || LAYOUT_TEMPLATE_ID.equals(event.getPropertyName())) {
synchHelper.synchAllUIWithModel();
}
}
});
}
use of org.eclipse.wst.common.frameworks.datamodel.IDataModelListener in project liferay-ide by liferay.
the class NewJSFPortletOptionsWizardPage method createTopLevelComposite.
@Override
protected Composite createTopLevelComposite(Composite parent) {
Composite top = super.createTopLevelComposite(parent);
IDataModelListener listener = new IDataModelListener() {
public void propertyChanged(DataModelEvent event) {
if (PORTLET_NAME.equals(event.getPropertyName())) {
synchHelper.synchAllUIWithModel();
}
}
};
this.synchHelper.getDataModel().addListener(listener);
return top;
}
use of org.eclipse.wst.common.frameworks.datamodel.IDataModelListener in project webtools.sourceediting by eclipse.
the class NewProjectDataModelFacetWizard method synchRuntimes.
protected void synchRuntimes() {
final Boolean[] suppressBackEvents = { Boolean.FALSE };
model.addListener(new IDataModelListener() {
@Override
public void propertyChanged(DataModelEvent event) {
if (IDataModel.VALUE_CHG == event.getFlag() || IDataModel.DEFAULT_CHG == event.getFlag()) {
if (FACET_RUNTIME.equals(event.getPropertyName())) {
if (!suppressBackEvents[0].booleanValue()) {
IRuntime runtime = (IRuntime) event.getProperty();
setRuntimeAndDefaultFacets(runtime);
}
}
}
}
});
getFacetedProjectWorkingCopy().addListener(new IFacetedProjectListener() {
@Override
public void handleEvent(final IFacetedProjectEvent event) {
suppressBackEvents[0] = Boolean.TRUE;
model.setProperty(FACET_RUNTIME, getFacetedProjectWorkingCopy().getPrimaryRuntime());
suppressBackEvents[0] = Boolean.FALSE;
}
}, IFacetedProjectEvent.Type.PRIMARY_RUNTIME_CHANGED);
}
use of org.eclipse.wst.common.frameworks.datamodel.IDataModelListener in project webtools.sourceediting by eclipse.
the class DataModelFacetCreationWizardPage method launchNewRuntimeWizard.
public static boolean launchNewRuntimeWizard(Shell shell, final IDataModel model, String serverTypeID) {
if (model == null) {
return false;
}
final DataModelPropertyDescriptor[] preAdditionDescriptors = model.getValidPropertyDescriptors(FACET_RUNTIME);
final boolean[] keepWaiting = { true };
final IDataModelListener listener = new IDataModelListener() {
@Override
public void propertyChanged(final DataModelEvent event) {
if (event.getPropertyName().equals(FACET_RUNTIME) && event.getFlag() == DataModelEvent.VALID_VALUES_CHG) {
synchronized (keepWaiting) {
keepWaiting[0] = false;
keepWaiting.notify();
}
model.removeListener(this);
}
}
};
model.addListener(listener);
boolean isOK = ServerUIUtil.showNewRuntimeWizard(shell, serverTypeID, null);
if (isOK) {
// Do the rest of the processing in a separate thread. Since we are going to block
// and wait, doing this on the UI thread can cause hangs.
final Thread newRuntimeSelectionThread = new Thread() {
@Override
public void run() {
// Causes the list of runtimes held by the RuntimeManager to be refreshed and
// triggers events to listeners on that list.
RuntimeManager.getRuntimes();
synchronized (keepWaiting) {
while (keepWaiting[0] == true) {
try {
keepWaiting.wait();
} catch (InterruptedException e) {
}
}
}
// Select the new runtime.
DataModelPropertyDescriptor[] postAdditionDescriptors = model.getValidPropertyDescriptors(FACET_RUNTIME);
Object[] preAddition = new Object[preAdditionDescriptors.length];
for (int i = 0; i < preAddition.length; i++) {
preAddition[i] = preAdditionDescriptors[i].getPropertyValue();
}
Object[] postAddition = new Object[postAdditionDescriptors.length];
for (int i = 0; i < postAddition.length; i++) {
postAddition[i] = postAdditionDescriptors[i].getPropertyValue();
}
Object newAddition = getNewObject(preAddition, postAddition);
if (// can this ever be null?
newAddition != null)
model.setProperty(FACET_RUNTIME, newAddition);
}
};
newRuntimeSelectionThread.start();
return true;
}
model.removeListener(listener);
return false;
}
use of org.eclipse.wst.common.frameworks.datamodel.IDataModelListener in project liferay-ide by liferay.
the class NewLiferayPortletWizardPage method createLiferayPortletInfoGroup.
protected void createLiferayPortletInfoGroup(Composite composite) {
SelectionAdapter adapter;
Group group = SWTUtil.createGroup(composite, Msgs.liferayPortletInfo, 3);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
group.setLayoutData(gd);
// we don't need to create the name as it can never be anything different than
// the portlet name on 2nd page
// SWTUtil.createLabel(group, SWT.RIGHT, "Name:", 1);
//
// this.name = SWTUtil.createText(group, 1);
// this.synchHelper.synchText(name, LIFERAY_PORTLET_NAME, null);
// SWTUtil.createLabel(group, StringUtil.EMPTY, 1);
SWTUtil.createLabel(group, SWT.RIGHT, Msgs.iconLabel, 1);
iconFile = SWTUtil.createText(group, 1);
this.synchHelper.synchText(iconFile, ICON_FILE, null);
if (fragment) {
SWTUtil.createLabel(group, StringPool.EMPTY, 1);
} else {
Button iconFileBrowse = SWTUtil.createPushButton(group, Msgs.browse, null);
adapter = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleFileBrowseButton(NewLiferayPortletWizardPage.this.iconFile, Msgs.iconSelection, Msgs.chooseIconFileLabel);
}
};
iconFileBrowse.addSelectionListener(adapter);
}
SWTUtil.createLabel(group, StringPool.EMPTY, 1);
allowMultiInstanceButton = SWTUtil.createCheckButton(group, Msgs.allowMultipleInstances, null, true, 2);
this.synchHelper.synchCheckbox(allowMultiInstanceButton, ALLOW_MULTIPLE, null);
SWTUtil.createLabel(group, SWT.RIGHT, Msgs.cssLabel, 1);
cssFile = SWTUtil.createText(group, 1);
this.synchHelper.synchText(cssFile, CSS_FILE, null);
if (fragment) {
SWTUtil.createLabel(group, StringPool.EMPTY, 1);
} else {
Button cssFileBrowse = SWTUtil.createPushButton(group, Msgs.browse, null);
SelectionAdapter selectionAdapter = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleFileBrowseButton(NewLiferayPortletWizardPage.this.cssFile, Msgs.cssSelection, Msgs.chooseCssFileLabel);
}
};
cssFileBrowse.addSelectionListener(selectionAdapter);
}
SWTUtil.createLabel(group, SWT.RIGHT, Msgs.javascriptLabel, 1);
javascriptFile = SWTUtil.createText(group, 1);
this.synchHelper.synchText(javascriptFile, JAVASCRIPT_FILE, null);
if (fragment) {
SWTUtil.createLabel(group, StringPool.EMPTY, 1);
} else {
Button javascriptFileBrowse = SWTUtil.createPushButton(group, Msgs.browse, null);
adapter = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleFileBrowseButton(NewLiferayPortletWizardPage.this.javascriptFile, Msgs.javascriptSelection, Msgs.chooseJavascriptFileLabel);
}
};
javascriptFileBrowse.addSelectionListener(adapter);
}
SWTUtil.createLabel(group, SWT.RIGHT, Msgs.cssClassWrapperLabel, 1);
cssClassWrapper = SWTUtil.createText(group, 1);
this.synchHelper.synchText(cssClassWrapper, CSS_CLASS_WRAPPER, null);
SWTUtil.createLabel(group, StringPool.EMPTY, 1);
IDataModelListener listener = new IDataModelListener() {
public void propertyChanged(DataModelEvent event) {
if (INewJavaClassDataModelProperties.CLASS_NAME.equals(event.getPropertyName()) || PORTLET_NAME.equals(event.getPropertyName())) {
synchHelper.synchAllUIWithModel();
}
}
};
this.synchHelper.getDataModel().addListener(listener);
}
Aggregations