Skip to content

Commit

Permalink
TEIIDDES-3044 (cntd) - added generate data service action model editor
Browse files Browse the repository at this point in the history
page toolbar
  • Loading branch information
blafond committed Jun 13, 2017
1 parent 7f617f4 commit 7d6e8d2
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 4 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.ResourceBundle;
import org.teiid.core.designer.PluginUtil;
import org.teiid.core.designer.util.PluginUtilImpl;
import org.teiid.designer.datatools.ui.DatatoolsUiConstants.PC;


/**
Expand Down Expand Up @@ -133,6 +132,7 @@ interface Images {
public static final String STANDARD_VDB = PC.OBJ16 + "standard-vdb.png"; //$NON-NLS-1$
public static final String SHOW_VDB_ERRORS = PC.CTOOL16 + "show-vdb-errors.png"; //$NON-NLS-1$
public static final String WARNING_ICON = PC.OBJ16 + "warning.gif"; //$NON-NLS-1$
public static final String GENERATE_DATA_SERVICE = PC.CTOOL16 + "generate-data-service.png"; //$NON-NLS-1$
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static String getString( String key ) {
*/
public GenerateDataServiceAction() {
super(getString("label"), SWT.DEFAULT); //$NON-NLS-1$
setImageDescriptor(DqpUiPlugin.getDefault().getImageDescriptor(Images.DYNAMIC_VDB));
setImageDescriptor(DqpUiPlugin.getDefault().getImageDescriptor(Images.GENERATE_DATA_SERVICE));
setId(ModelActionConstants.Special.GENERATE_DATA_SERVICE);

worker = new GenerateDataServiceWorker();
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package org.teiid.designer.transformation.ui;

import java.util.ResourceBundle;

import org.eclipse.swt.graphics.Color;
import org.teiid.core.designer.PluginUtil;
import org.teiid.core.designer.util.PluginUtilImpl;
Expand Down Expand Up @@ -124,6 +125,8 @@ class PC {
String CLONE_DISABLED_ICON = PC.CVIEW16 + "clone-disabled.png"; //$NON-NLS-1$

String PREVIEW_DATA_ICON = PC.CVIEW16 + "previewData.gif"; //$NON-NLS-1$

public static final String GENERATE_DATA_SERVICE = PC.CVIEW16 + "generate-data-service.png"; //$NON-NLS-1$
}

interface SQLPanels {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
import org.teiid.designer.ui.actions.SortableSelectionAction;
import org.teiid.designer.ui.common.UILabelUtil;
import org.teiid.designer.ui.common.UiLabelConstants;
import org.teiid.designer.ui.common.actions.ModelActionConstants;
import org.teiid.designer.ui.common.actions.ModelActionConstants.Special;
import org.teiid.designer.ui.common.eventsupport.SelectionUtilities;
import org.teiid.designer.ui.common.text.StyledTextEditor;
Expand Down Expand Up @@ -150,6 +151,8 @@ public class ModelEditorMainPage extends EditorPart implements ModelEditorPage,

Button previewButton;

Button generateDataServiceButton;

private TabItem propertiesTab;
ModelObjectPropertiesPanel propertiesPanel;

Expand Down Expand Up @@ -302,6 +305,7 @@ public void widgetSelected(SelectionEvent e) {
public void widgetDefaultSelected(SelectionEvent e) {
}
});
previewButton.setToolTipText(org.teiid.designer.ui.common.actions.Messages.PREVIEW_DATA_TOOLTIP);

if( isRelational) {
Button addTableButton = getToolkit().createButton(vertToolbar, BLANK, SWT.PUSH);
Expand Down Expand Up @@ -378,6 +382,37 @@ public void widgetDefaultSelected(SelectionEvent e) {
}
});
}

Composite bottomSep = getToolkit().createCompositeSeparator(vertToolbar);
GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.horizontalSpan = 1;
layoutData.heightHint = 2;
bottomSep.setLayoutData(layoutData);

// PREVIEW
generateDataServiceButton = getToolkit().createButton(vertToolbar, BLANK, SWT.PUSH);
generateDataServiceButton.setImage(UiPlugin.getDefault().getImage(UiConstants.Images.GENERATE_DATA_SERVICE));
GridDataFactory.fillDefaults().grab(true, false).applyTo(previewButton);
generateDataServiceButton.setEnabled(false);
generateDataServiceButton.addSelectionListener(new SelectionListener() {

@Override
public void widgetSelected(SelectionEvent e) {
SortableSelectionAction action = ModelerSpecialActionManager.getAction(ModelActionConstants.Special.GENERATE_DATA_SERVICE);
if( action != null ) {
ISelection selection = modelTreeViewer.getSelection();
Object sel = SelectionUtilities.getSelectedEObject(selection);
action.setSelection(new StructuredSelection(sel));
action.run();
}

}

@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
generateDataServiceButton.setToolTipText(org.teiid.designer.ui.common.actions.Messages.GENERATE_DATA_SERVICE_TOOLTIP);
}

modelTree = new Tree(composite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.MULTI);
Expand Down Expand Up @@ -417,6 +452,10 @@ public void selectionChanged(SelectionChangedEvent event) {
if( action != null ) {
previewButton.setEnabled(action.isApplicable(event.getSelection()));
}
action = ModelerSpecialActionManager.getAction(ModelActionConstants.Special.GENERATE_DATA_SERVICE);
if( action != null ) {
generateDataServiceButton.setEnabled(action.isApplicable(event.getSelection()));
}

propertiesPanel.selectionChanged(event);
resetDescription();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ SHOW_MODEL_STATISTICS=Show Model Statistics
CREATE_WEB_SERVICE_FROM_RELATIONAL_TOOLTIP =TBD
SET_DATATYPE_TOOLTIP =TBD
GET_EXECUTION_PLAN_CONTEXT_TOOLTIP =TBD
PREVIEW_DATA_TOOLTIP =TBD
PREVIEW_DATA_TOOLTIP =Preview data for selected table or view
JDBC_COST_ANALYSIS_TOOLTIP =TBD
SET_EXCLUDE_FROM_DOCUMENT_TOOLTIP =TBD
SET_INCLUDE_IN_DOCUMENT_TOOLTIP =TBD
Expand All @@ -62,7 +62,7 @@ SET_FUNCTION_PARAMETER_TYPE_TOOLTIP =TBD
GENERATE_REST_VIRTUAL_PROCEDURES_TOOLTIP =TBD
CREATE_WEB_SERVICE_FROM_XML_TOOLTIP =TBD
CREATE_XML_VIEW_FROM_XSD_TOOLTIP =TBD
GENERATE_DATA_SERVICE_TOOLTIP =TBD
GENERATE_DATA_SERVICE_TOOLTIP =Generate a deployable -vdb.xml representing the selected view or table

JDBC_IMPORT_TOOLTIP =TBD
EXPORT_TEIID_DDL_TOOLTIP =Export Teiid DDL metadata for this model. \
Expand Down

0 comments on commit 7d6e8d2

Please sign in to comment.