Skip to content

Commit

Permalink
TEIIDDES-1879 removed capturing of incorrect resource-adapter propert…
Browse files Browse the repository at this point in the history
…y definitions

* Added Note and tooltip to point users to translator documentation to find applicable properties
  • Loading branch information
blafond committed Oct 14, 2013
1 parent 4f6b205 commit 6505750
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 36 deletions.
Expand Up @@ -9,9 +9,11 @@

import static org.teiid.designer.runtime.DqpPlugin.Util;
import static org.teiid.designer.runtime.ui.DqpUiConstants.UTIL;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Properties;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
Expand All @@ -26,12 +28,10 @@
import org.teiid.designer.core.workspace.ModelWorkspaceException;
import org.teiid.designer.metamodels.core.ModelType;
import org.teiid.designer.runtime.DqpPlugin;
import org.teiid.designer.runtime.TeiidServer;
import org.teiid.designer.runtime.connection.ModelConnectionMapper;
import org.teiid.designer.runtime.spi.ITeiidDataSource;
import org.teiid.designer.runtime.spi.ITeiidServer;
import org.teiid.designer.runtime.spi.ITeiidTranslator;
import org.teiid.designer.runtime.spi.TeiidPropertyDefinition;
import org.teiid.designer.vdb.VdbModelEntry;
import org.teiid.designer.vdb.connections.SourceHandler;
import org.teiid.designer.vdb.connections.VdbSourceConnection;
Expand Down Expand Up @@ -274,39 +274,42 @@ public PropertyDefinition[] getTranslatorDefinitions( String translatorName ) {

if (translator != null) {
Collection<PropertyDefinition> props = new ArrayList<PropertyDefinition>();

for (TeiidPropertyDefinition propDefn : translator.getPropertyDefinitions()) {
TranslatorProperty prop = new TranslatorProperty(propDefn.getPropertyTypeClassName());
prop.advanced = propDefn.isAdvanced();
prop.description = propDefn.getDescription();
prop.displayName = propDefn.getDisplayName();
prop.id = propDefn.getName();
prop.masked = propDefn.isMasked();
prop.modifiable = propDefn.isModifiable();
prop.required = propDefn.isRequired();

prop.defaultValue = (propDefn.getDefaultValue() == null) ? StringUtilities.EMPTY_STRING
: propDefn.getDefaultValue().toString();

if (propDefn.isConstrainedToAllowedValues()) {
Collection values = propDefn.getAllowedValues();
prop.allowedValues = new String[values.size()];
int i = 0;

for (Object value : values) {
prop.allowedValues[i++] = value.toString();
}
} else {
// if boolean type turn into allowed values
String type = propDefn.getPropertyTypeClassName();

if (Boolean.class.getName().equals(type) || Boolean.TYPE.getName().equals(type)) {
prop.allowedValues = new String[] { Boolean.TRUE.toString(), Boolean.FALSE.toString() };
}
}

props.add(prop);
}

// NOTE: Currently translator.getPropertyDefinitions() will only return property definitions for
// the resource-adapter properties and NOT the translator, so need to comment this out for the time
// being
// for (TeiidPropertyDefinition propDefn : translator.getPropertyDefinitions()) {
// TranslatorProperty prop = new TranslatorProperty(propDefn.getPropertyTypeClassName());
// prop.advanced = propDefn.isAdvanced();
// prop.description = propDefn.getDescription();
// prop.displayName = propDefn.getDisplayName();
// prop.id = propDefn.getName();
// prop.masked = propDefn.isMasked();
// prop.modifiable = propDefn.isModifiable();
// prop.required = propDefn.isRequired();
//
// prop.defaultValue = (propDefn.getDefaultValue() == null) ? StringUtilities.EMPTY_STRING
// : propDefn.getDefaultValue().toString();
//
// if (propDefn.isConstrainedToAllowedValues()) {
// Collection values = propDefn.getAllowedValues();
// prop.allowedValues = new String[values.size()];
// int i = 0;
//
// for (Object value : values) {
// prop.allowedValues[i++] = value.toString();
// }
// } else {
// // if boolean type turn into allowed values
// String type = propDefn.getPropertyTypeClassName();
//
// if (Boolean.class.getName().equals(type) || Boolean.TYPE.getName().equals(type)) {
// prop.allowedValues = new String[] { Boolean.TRUE.toString(), Boolean.FALSE.toString() };
// }
// }
//
// props.add(prop);
// }

return props.toArray(new PropertyDefinition[props.size()]);
}
Expand Down
Expand Up @@ -210,6 +210,9 @@ TranslatorOverridesPanel.removePropertyAction.text = -
TranslatorOverridesPanel.removePropertyAction.toolTip = Remove the selected custom property
TranslatorOverridesPanel.restorePropertyDefaultAction.toolTip = Restore the selected property to its default value
TranslatorOverridesPanel.usingPropertyDefaultValue = This default value will be used.
TranslatorOverridesPanel.overridePropertiesNoteLabel =NOTE: See associated translator documentation for applicable properties
TranslatorOverridesPanel.overridePropertiesNoteTooltip = Translator property definitions are not yet available. \
See the documentation for your specific translator type to find applicable properties.

PropertiesPanel.teiid=Teiid
PropertiesPanel.allowedLanguages=Allowed Languages
Expand Down
Expand Up @@ -19,6 +19,7 @@
import java.util.List;
import java.util.Set;

import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.DoubleClickEvent;
Expand Down Expand Up @@ -48,6 +49,7 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
Expand Down Expand Up @@ -306,6 +308,7 @@ public void doubleClick( DoubleClickEvent event ) {
this.txtDescription = new Text(pnlOverrides, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
this.txtDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
((GridData)this.txtDescription.getLayoutData()).heightHint = 35;
((GridData)this.txtDescription.getLayoutData()). horizontalSpan = 2;
this.txtDescription.setToolTipText(Util.getString(PREFIX + "txtTranslatorDescription.toolTip")); //$NON-NLS-1$
this.txtDescription.setEnabled(false);
this.txtDescription.addModifyListener(new ModifyListener() {
Expand Down Expand Up @@ -416,7 +419,7 @@ public void selectionChanged( SelectionChangedEvent event ) {
//
// add toolbar below the table
//
Composite toolbarPanel = WidgetFactory.createPanel(pnlOverrides, SWT.NONE, GridData.VERTICAL_ALIGN_BEGINNING, 1, 3);
Composite toolbarPanel = WidgetFactory.createPanel(pnlOverrides, SWT.NONE, GridData.VERTICAL_ALIGN_BEGINNING, 1, 4);

this.addPropertyButton = WidgetFactory.createButton(toolbarPanel, GridData.FILL);
this.addPropertyButton.setImage(VdbUiPlugin.singleton.getImage(ADD));
Expand Down Expand Up @@ -471,6 +474,12 @@ public void widgetDefaultSelected(SelectionEvent e) {

}
});

org.teiid.designer.ui.common.widget.Label noteLabel =
WidgetFactory.createLabel(toolbarPanel, Util.getString(PREFIX + "overridePropertiesNoteLabel")); //$NON-NLS-1$
noteLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(noteLabel);
noteLabel.setToolTipText(Util.getString(PREFIX + "overridePropertiesNoteTooltip")); //$NON-NLS-1$

}

Expand Down

0 comments on commit 6505750

Please sign in to comment.