Skip to content

Commit

Permalink
TEIIDDES-2395 added Find Model Object action & dialog to the Model
Browse files Browse the repository at this point in the history
Explorer's New* drop-down action list on the top toolbar
  • Loading branch information
blafond committed Mar 26, 2015
1 parent d0261e7 commit cbe8400
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ interface Images extends UiConstants.Images {
String NEW_PUSHDOWN_FUNCTION = OBJ16 + "PushdownFunction.gif"; //$NON-NLS-1$
String BUILD_MODEL_IMPORTS_ICON = OBJ16 + "Imports.gif"; //$NON-NLS-1$
String FIND = CVIEW16 + "find.gif"; //$NON-NLS-1$
String FIND_MODEL_OBJECT = CTOOL16 + "opentype.gif"; //$NON-NLS-1$
String FIND_REPLACE = CVIEW16 + "find_replace.gif"; //$NON-NLS-1$

String ENUM_OVERLAY_ICON = OVR16 + "enum_co.gif"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbench;
Expand All @@ -37,6 +38,11 @@ public final class FindModelObjectHandler extends AbstractHandler {
@Override
public Object execute( ExecutionEvent event ) throws ExecutionException {
Shell shell = HandlerUtil.getActiveShell(event);

return executeInternal(shell);
}

public static Object executeInternal( Shell shell ) {
ModelObjectSelectionDialog dialog = new ModelObjectSelectionDialog(shell);

if (!dialog.userCancelledDuringLoad()) {
Expand Down Expand Up @@ -93,5 +99,9 @@ public Object execute( ExecutionEvent event ) throws ExecutionException {

return null; // per javadoc
}

public static void findObject() {
FindModelObjectHandler.executeInternal(Display.getCurrent().getActiveShell());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.teiid.designer.ui.PluginConstants;
import org.teiid.designer.ui.UiConstants;
import org.teiid.designer.ui.UiPlugin;
import org.teiid.designer.ui.actions.FindModelObjectHandler;
import org.teiid.designer.ui.common.product.ProductCustomizerMgr;
import org.teiid.designer.ui.viewsupport.DesignerPropertiesUtil;
import org.teiid.designer.ui.viewsupport.IPropertiesContext;
Expand Down Expand Up @@ -131,6 +132,22 @@ public void run() {
return list;
}

private void addFindModelObjectAction(Menu menu) {
new Separator().fill(menu, -1);

IAction action = new Action("Find model object...", UiPlugin.getDefault().getImageDescriptor(PluginConstants.Images.FIND_MODEL_OBJECT)) {

@Override
public void run() {
FindModelObjectHandler.findObject();
}

};

ActionContributionItem item = new ActionContributionItem(action);
item.fill(menu, -1);
}

private void addGoToExamplesAction(Menu menu) {
new Separator().fill(menu, -1);

Expand Down Expand Up @@ -158,6 +175,7 @@ private Menu fillMenu(Menu menu) {
addActionToMenu(menu, action);
}

addFindModelObjectAction(menu);
addGoToExamplesAction(menu);

setEnabled(!actions.isEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public ModelObjectSelectionDialog( Shell parent ) {
super(parent, new FindObjectLabelProvider(FindObjectLabelProvider.OBJECT));

fQualifierRenderer = new FindObjectLabelProvider(FindObjectLabelProvider.CONTAINER);
setSize(50, 15);
setSize(200, 300);
setAllowDuplicates(false);

setTitle(TITLE);
Expand Down Expand Up @@ -291,8 +291,8 @@ public Control createDialogArea( final Composite parent ) {
createLabel(contents, fUpperListLabel);
Control listCtrl = createFilteredList(contents);
final GridData gdlc = (GridData)listCtrl.getLayoutData();
gdlc.heightHint = convertHeightInCharsToPixels(8);
gdlc.widthHint = SWT.DEFAULT;
gdlc.heightHint = convertHeightInCharsToPixels(18);
gdlc.widthHint = 300;

createLabel(contents, fLowerListLabel);
createLowerList(contents);
Expand Down Expand Up @@ -359,7 +359,6 @@ public void widgetDisposed( DisposeEvent e ) {
});

GridData data = new GridData();
// data.widthHint= convertWidthInCharsToPixels(50);
data.heightHint = convertHeightInCharsToPixels(8);
data.grabExcessVerticalSpace = true;
data.grabExcessHorizontalSpace = true;
Expand Down

0 comments on commit cbe8400

Please sign in to comment.