use of org.eclipse.wst.common.frameworks.datamodel.DataModelEvent 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.DataModelEvent 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.DataModelEvent in project liferay-ide by liferay.
the class NewPluginProjectGroup method createUserSpecifiedProjectLocationField.
protected void createUserSpecifiedProjectLocationField(Composite projectGroup) {
Font font = projectGroup.getFont();
// location label
final Label locationLabel = new Label(projectGroup, SWT.NONE);
locationLabel.setFont(font);
locationLabel.setText(Msgs.wizardNewProjectCreationPageLocationLabel);
// project location entry field
locationPathField = new Text(projectGroup, SWT.BORDER);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = SIZING_TEXT_FIELD_WIDTH;
locationPathField.setLayoutData(data);
locationPathField.setFont(font);
// browse button
browseButton = new Button(projectGroup, SWT.PUSH);
browseButton.setFont(font);
browseButton.setText(Msgs.browse);
browseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleLocationBrowseButtonPressed();
}
});
final IDataModel localModel = model;
final IDataModel localNestedModel = nestedModel;
LocationListener listener = new LocationListener(localModel, localNestedModel, locationLabel);
listener.propertyChanged(new DataModelEvent(model, LIFERAY_USE_SDK_LOCATION, IDataModel.VALUE_CHG));
locationPathField.addModifyListener(listener);
model.addListener(listener);
nestedModel.addListener(listener);
}
use of org.eclipse.wst.common.frameworks.datamodel.DataModelEvent 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.DataModelEvent 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;
}
Aggregations