Skip to content

Commit

Permalink
IDE-709
Browse files Browse the repository at this point in the history
Signed-off-by: Gregory Amerson <gregory.amerson@liferay.com>
  • Loading branch information
Cindy Li authored and gamerson committed Sep 24, 2012
1 parent af1bf6b commit 7bfb09e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 22 deletions.
2 changes: 1 addition & 1 deletion eclipse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<properties>
<tycho-version>0.15.0</tycho-version>
<orbit-site>http://download.eclipse.org/tools/orbit/downloads/drops/R20120119162704/repository/</orbit-site>
<sapphire-site>http://download.eclipse.org/sapphire/0.5.2/repository/</sapphire-site>
<sapphire-site>https://hudson.eclipse.org/hudson/job/sapphire-0.5.x/418/artifact/build/repository/</sapphire-site>
</properties>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.liferay.ide.eclipse.core.util.FileUtil;
import com.liferay.ide.eclipse.portlet.core.PortletCore;
import com.liferay.ide.eclipse.project.core.IPluginWizardFragmentProperties;
import com.liferay.ide.eclipse.sdk.ISDKConstants;
import com.liferay.ide.eclipse.server.core.ILiferayRuntime;
import com.liferay.ide.eclipse.server.util.ServerUtil;

Expand Down Expand Up @@ -60,7 +59,8 @@
public class NewPortletClassDataModelProvider extends NewWebClassDataModelProvider
implements INewPortletClassDataModelProperties, IPluginWizardFragmentProperties {

protected Properties categories;
private static final String PORTLET_SUFFIX_PATTERN = "(?<!^)portlet$";
protected Properties categories;
protected Properties entryCategories;
protected TemplateContextType contextType;
protected boolean fragment;
Expand Down Expand Up @@ -211,10 +211,10 @@ else if (CLASS_NAME.equals(propertyName)) {
return "NewPortlet";
}
else if (PORTLET_NAME.equals(propertyName) || LIFERAY_PORTLET_NAME.equals(propertyName)) {
return getProperty(CLASS_NAME).toString().toLowerCase();
return getProperty(CLASS_NAME).toString().toLowerCase().replaceAll( PORTLET_SUFFIX_PATTERN, "" );
}
else if (DISPLAY_NAME.equals(propertyName) || TITLE.equals(propertyName) || SHORT_TITLE.equals(propertyName)) {
return getProperty(CLASS_NAME);
return getDisplayNameFromClassName( getProperty(CLASS_NAME).toString() );
}
else if (KEYWORDS.equals(propertyName)) {
return "";
Expand All @@ -230,10 +230,10 @@ else if (CREATE_JSPS.equals(propertyName)) {
}
else if (CREATE_JSPS_FOLDER.equals(propertyName)) {
if ( getBooleanProperty( CREATE_NEW_PORTLET_CLASS ) ) {
return "/html/" + getProperty( CLASS_NAME ).toString().toLowerCase();
return "/html/" + getProperty( CLASS_NAME ).toString().toLowerCase().replaceAll( PORTLET_SUFFIX_PATTERN, "" );
}
else {
return "/html/" + getProperty( PORTLET_NAME ).toString().toLowerCase();
return "/html/" + getProperty( PORTLET_NAME ).toString().toLowerCase().replaceAll( PORTLET_SUFFIX_PATTERN, "" );
}

}
Expand All @@ -256,7 +256,7 @@ else if (JAVASCRIPT_FILE.equals(propertyName)) {
return "/js/main.js";
}
else if (CSS_CLASS_WRAPPER.equals(propertyName)) {
return getProperty(PORTLET_NAME).toString().toLowerCase() + ISDKConstants.PORTLET_PLUGIN_PROJECT_SUFFIX;
return getProperty(PORTLET_NAME).toString().toLowerCase();
}
else if (ID.equals(propertyName)) {
return getProperty(PORTLET_NAME);
Expand Down Expand Up @@ -349,6 +349,19 @@ protected Object getInitParams() {
return initParams;
}

protected String getDisplayNameFromClassName(String oldName) {
String[] words = oldName.split("(?<!^)(?=[A-Z])");
String newName = new String();
for(int i = 0 ; i < words.length ; i++) {
if( i > 0 ) {
newName = newName.concat(" ");
}
newName = newName.concat( words[i] );
}

return newName;
}

@Override
public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
if (VIEW_MODE.equals(propertyName)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected void createLiferayDisplayGroup(Composite composite) {
this.entryCategory = new Combo(group, SWT.DROP_DOWN);
this.entryCategory.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
this.synchHelper.synchCombo(entryCategory, ENTRY_CATEGORY, null);

final Label entryWeightLabel = SWTUtil.createLabel(group, "Entry Weight:", 1);

this.entryWeight = SWTUtil.createText(group, 1);
Expand Down Expand Up @@ -151,19 +151,6 @@ public void widgetSelected(SelectionEvent e) {
entryClassWrapper.setEnabled(createEntryClassButton.getSelection());
}
});

if (entryCategory != null && !entryCategory.isDisposed()) {
entryCategory.setEnabled(addToControlPanelButton.getSelection());
}
if (entryWeight != null && !entryWeight.isDisposed()) {
entryWeight.setEnabled(addToControlPanelButton.getSelection());
}
if (createEntryClassButton != null && !createEntryClassButton.isDisposed()) {
createEntryClassButton.setEnabled( addToControlPanelButton.getSelection() );
}
if (entryClassWrapper != null && !entryClassWrapper.isDisposed()) {
entryClassWrapper.setEnabled( createEntryClassButton.getSelection() && createEntryClassButton.getEnabled() );
}
}

protected void createLiferayPortletInfoGroup(Composite composite) {
Expand Down Expand Up @@ -280,6 +267,24 @@ protected Composite createTopLevelComposite(Composite parent) {
return composite;
}

@Override
protected void enter() {
super.enter();

if (entryCategory != null && !entryCategory.isDisposed()) {
entryCategory.setEnabled(addToControlPanelButton.getSelection());
}
if (entryWeight != null && !entryWeight.isDisposed()) {
entryWeight.setEnabled(addToControlPanelButton.getSelection());
}
if (createEntryClassButton != null && !createEntryClassButton.isDisposed()) {
createEntryClassButton.setEnabled( addToControlPanelButton.getSelection() );
}
if (entryClassWrapper != null && !entryClassWrapper.isDisposed()) {
entryClassWrapper.setEnabled( createEntryClassButton.getSelection() && createEntryClassButton.getEnabled() );
}
}

protected ISelectionStatusValidator getContainerDialogSelectionValidator() {
return new ISelectionStatusValidator() {

Expand Down

0 comments on commit 7bfb09e

Please sign in to comment.