Java Code Examples for org.eclipse.swt.widgets.Widget

The following are top voted examples for showing how to use org.eclipse.swt.widgets.Widget. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: pgcodekeeper   File: CheckedTreeViewer.java   View source code 6 votes vote down vote up
@Override
public Object[] getCheckedElements() {
    Object[] checked = super.getCheckedElements();
    // add all items that are children of a checked node but not created yet
    ArrayList<Object> result = new ArrayList<>();
    for (int i = 0; i < checked.length; i++) {
        Object curr = checked[i];
        result.add(curr);
        Widget item = findItem(curr);
        if (item != null) {
            Item[] children = getChildren(item);
            // check if contains the dummy node
            if (children.length == 1 && children[0].getData() == null) {
                // not yet created
                collectChildren(curr, result);
            }
        }
    }
    return result.toArray();
}
 
Example 2
Project: Hydrograph   File: LoadTypeConfigurationDialog.java   View source code 6 votes vote down vote up
/**
 * The Function will call to disable the widgets
 * @param textbox1
 * @param textbox2
 * @param buttonWidgets
 * @return Selection Adapter
 */
private SelectionAdapter buttonSelectionListener( Text textbox2,Widget... buttonWidgets){
	Supplier<Stream<Widget>> streamSupplier = () -> Stream.of(buttonWidgets);
	SelectionAdapter adapter = new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent event) {
			newTableRadioButton.setSelection(false);
			textbox2.setEnabled(false);
			streamSupplier.get().forEach((Widget widgets) ->{((Button)widgets).setEnabled(false);});
			if(OSValidator.isMac()){
				((Button)event.getSource()).setFocus();
			}
			propertyDialogButtonBar.enableApplyButton(true);
		}
	};
	return adapter;
}
 
Example 3
Project: Hydrograph   File: ELTSchemaDialogSelectionListener.java   View source code 6 votes vote down vote up
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar,
		ListenerHelper helpers, final Widget... widgets) {
	final Button button = ((Button)widgets[0]);
	button.getShell();
	if(helpers != null){
		txtDecorator = (ControlDecoration) helpers.get(HelperType.CONTROL_DECORATION);
		file_extension=(String)helpers.get(HelperType.FILE_EXTENSION);
	}
	
	Listener listener=new Listener() {
		@Override
		public void handleEvent(Event event) {
			if(event.type==SWT.Selection){
				FilterOperationClassUtility.INSTANCE.browseFile(file_extension,((Text) widgets[0]));
					propertyDialogButtonBar.enableApplyButton(true);
					txtDecorator.hide();
			}
		}
	};
	return listener;
}
 
Example 4
Project: Hydrograph   File: ELTVerifySequenceFieldName.java   View source code 6 votes vote down vote up
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,
		Widget... widgets) {
	if (helper != null) {
		txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
	}
	Listener listener = new Listener() {

		@Override
		public void handleEvent(Event event) {
			String string = event.text;
			Matcher matchs = Pattern.compile(Constants.REGEX).matcher(string);
			LOGGER.debug("Verifying text format");
			if (!matchs.matches()) {
				txtDecorator.setDescriptionText(Messages.CHARACTERSET);
				txtDecorator.show();
				event.doit = false;

			} else
				txtDecorator.hide();

		}
	};
	return listener;
}
 
Example 5
Project: Hydrograph   File: ELTTransformDeleteSelectionListener.java   View source code 6 votes vote down vote up
@Override
	public void selectionListenerAction(
			PropertyDialogButtonBar propertyDialogButtonBar,
			ListenerHelper helpers, Widget... widgets) {

		ELTGridDetails gridDetails = (ELTGridDetails) helpers.get(HelperType.SCHEMA_GRID);
		Table table =gridDetails.getTableViewer().getTable();
		int temp = table.getSelectionIndex();
		int[] indexs=table.getSelectionIndices();
		if (temp == -1) {
			WidgetUtility.errorMessage("Please Select row to delete");
		} else {
			table.remove(indexs);
			ArrayList tempList= new ArrayList();
			for (int index :indexs) { 
//				PropertyField test =(PropertyField) gridDetails.getGrids().get(index);
//				tempList.add(test);
			}
			 gridDetails.getGrids().removeAll(tempList); 
			
		}		
	}
 
Example 6
Project: Hydrograph   File: ELTGridAddSelectionListener.java   View source code 6 votes vote down vote up
@Override
public void selectionListenerAction(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers, Widget... widgets) {
	propertyDialogButtonBar.enableApplyButton(true);
	table=(Table)widgets[0];
	table.getParent().getShell().setFocus();
	((Button) widgets[1]).setEnabled(true);
	ELTGridDetails eltGridDetails = (ELTGridDetails)helpers.get(HelperType.SCHEMA_GRID);
	if (eltGridDetails.getGrids().size() >= 1) {
		((Button) widgets[2]).setEnabled(true);
		((Button) widgets[3]).setEnabled(true);
	}
	GridWidgetCommonBuilder gridCommonBuilder = eltGridDetails.getGridWidgetCommonBuilder();
	gridCommonBuilder.setRowSequence(rowSequence);
	gridCommonBuilder.createDefaultSchema(eltGridDetails.getGrids(), eltGridDetails.getTableViewer(), eltGridDetails.getLabel());
	rowSequence++;
	((Component)helpers.get(HelperType.COMPONENT)).setLatestChangesInSchema(true);
}
 
Example 7
Project: Hydrograph   File: ELTShortcutKeyGridListener.java   View source code 6 votes vote down vote up
@Override
public void selectionListenerAction(final PropertyDialogButtonBar propertyDialogButtonBar, final ListenerHelper helpers, Widget... widget) {
	
	ELTGridDetails gridDetails = (ELTGridDetails) helpers.get(HelperType.SCHEMA_GRID);		
	final TableViewer tableViewer = gridDetails.getTableViewer();
	final int columns = tableViewer.getCellEditors().length;
	final Widget[] widgets = widget;		
	
	table=(Table)widgets[0];
			
	if (!isKeyListenerAttached){
		for (int i =0; i < columns; i++){
			attachShortcutKeyListener(tableViewer.getCellEditors()[i].getControl(), propertyDialogButtonBar, helpers, widgets);
		}				
		attachShortcutKeyListener(table, propertyDialogButtonBar, helpers, widgets);
	}
}
 
Example 8
Project: Hydrograph   File: ELTFocusGainedListener.java   View source code 6 votes vote down vote up
@Override
public Listener getListener(
		PropertyDialogButtonBar propertyDialogButtonBar,
		ListenerHelper helper, Widget... widgets) {
	final Widget[] widgetList = widgets;
	if (helper != null) {
		txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
	}

	Listener listener = new Listener() {

		@Override
		public void handleEvent(Event event) {
			String charSet = ((Text) widgetList[0]).getText().trim();
			if (event.type == SWT.FocusIn) {
				((Text) widgetList[0]).setText(charSet.replace("@{", "").replace("}", ""));
			}
		}
	};

	return listener;
}
 
Example 9
Project: Hydrograph   File: ELTSelectionListener.java   View source code 6 votes vote down vote up
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper, Widget... widgets) {
	final Widget[] widgetList = widgets;

	if (helper != null) {
		txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
	}

	Listener listener = new Listener() {
		@Override
		public void handleEvent(Event event) {
			if (((Combo) widgetList[0]).getText().equals("Parameter") || ((Combo) widgetList[0]).getText().equals("Others")) {
				((Text) widgetList[1]).setVisible(true);
				((Text) widgetList[1]).setFocus();
				txtDecorator.hide();
			} else {
				((Text) widgetList[1]).setVisible(false);
				txtDecorator.hide();
			}
			propertyDialogButtonBar.enableApplyButton(true);
		}
	};
	return listener;
}
 
Example 10
Project: Hydrograph   File: ELTCheckFileExtensionListener.java   View source code 6 votes vote down vote up
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar,ListenerHelper helpers, Widget... widgets) {
	final Widget[] widgetList = widgets;
			
	Listener listener=new Listener() { 
		@Override
		public void handleEvent(Event event) {
			if(!((Button)widgetList[1]).getSelection()){
			ControlDecoration	fieldNameMustJava = WidgetUtility.addDecorator((Text)widgetList[0],Messages.INVALID_FILE);
			if(!WidgetUtility.isFileExtention((((Text)widgetList[0]).getText()).trim(), ".java") && !(((Text)widgetList[0]).getText().trim().isEmpty())){
				fieldNameMustJava.show();
			((Text)widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,
					255, 204));
			}
				else  
				{   
					((Text)widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,
						255, 255));
				fieldNameMustJava.hide(); 
				}
			}
		} 
	};
	return listener;
}
 
Example 11
Project: Hydrograph   File: FocusInListener.java   View source code 6 votes vote down vote up
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper, Widget... widgets) {
	final Widget[] widgetList = widgets;
	if (helper != null){
		txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
	}
	
	Listener listener = new Listener() {
		@Override
		public void handleEvent(Event event) {
			String charSet = ((Text) widgetList[0]).getText().trim();
			if(SWT.FocusIn == event.type) {
				if (StringUtils.isBlank(charSet)) {
					txtDecorator.show();
					((Text) widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 255));
					((Text) widgetList[0]).setToolTipText(txtDecorator.getDescriptionText());
				} else {
					txtDecorator.hide();
				}
			}
		}
	};
	return listener;
}
 
Example 12
Project: Hydrograph   File: ELTEventChangeListener.java   View source code 6 votes vote down vote up
@Override
public Listener getListener(
		final PropertyDialogButtonBar propertyDialogButtonBar,
		final ListenerHelper helpers, Widget... widgets) {
	final Widget[] wigetList = widgets;

	Listener listener = new Listener() {

		@Override
		public void handleEvent(Event event) {
			if (event.type == SWT.CHANGED) {
				propertyDialogButtonBar.enableApplyButton(true);
			}
		}
	};
	return listener;
}
 
Example 13
Project: Hydrograph   File: ELTCreateNewClassListener.java   View source code 6 votes vote down vote up
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, final ListenerHelper helpers, Widget... widgets) {
	final Widget[] widgetList = widgets;
	
	if (helpers != null) {
		widgetConfig = (WidgetConfig) helpers.get(HelperType.WIDGET_CONFIG);
	}
	
	 Listener listener=new Listener() {
		@Override
		public void handleEvent(Event event) {
			String comboValue = ((Combo) widgetList[0]).getText();
			if (comboValue.equals(Messages.CUSTOM)) {
				FilterOperationClassUtility.INSTANCE.createNewClassWizard((Text) widgetList[1], widgetConfig);
				if(helpers.get(HelperType.OPERATION_CLASS_DIALOG_OK_CONTROL) instanceof OperationClassDialog)
				{
					OperationClassDialog operationClassDialog=(OperationClassDialog)helpers.get(HelperType.OPERATION_CLASS_DIALOG_OK_CONTROL);
					operationClassDialog.getShell().setFocus();
				}
					
				propertyDialogButtonBar.enableApplyButton(true);
			}
		}
	};
	return listener;
}
 
Example 14
Project: Hydrograph   File: OverWriteWidgetSelectionListener.java   View source code 6 votes vote down vote up
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,
		Widget... widgets) {
	final Widget[] widgetList = widgets;

	Listener listener = new Listener() {
		@Override
		public void handleEvent(Event event) {
			if (StringUtils.equalsIgnoreCase(((Combo) widgetList[0]).getText(), String.valueOf(Boolean.TRUE))) {
				MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
						SWT.ICON_INFORMATION | SWT.OK);
				messageBox.setText(INFORMATION);
				messageBox.setMessage("All files at given location will be overwritten.");
				messageBox.open();
			}
		}
	};
	return listener;
}
 
Example 15
Project: Hydrograph   File: VerifyNumbericOrParameterFocusOutListener.java   View source code 6 votes vote down vote up
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,  Widget... widgets) {
	final Widget[] widgetList = widgets;
		Listener listener=new Listener() {
			@Override
			public void handleEvent(Event event) {
				String string=((Text) widgetList[0]).getText().trim();
				Matcher matcher=Pattern.compile("[\\d]*").matcher(string);
				if(!matcher.matches() && StringUtils.isNotBlank(string)){
					((Text) widgetList[0]).setText(string.replace("@{", "").replace("}", ""));
					((Text) widgetList[0]).setText("@{"+((Text) widgetList[0]).getText()+"}");
					((Text) widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 255));
				}
			}
		};
	return listener;
}
 
Example 16
Project: Hydrograph   File: ELTVerifyTextListener.java   View source code 6 votes vote down vote up
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,  Widget... widgets) {
		if (helper != null) {
			txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
		}
			Listener listener=new Listener() {
			
			@Override
			public void handleEvent(Event event) {
				String string=event.text;
				Matcher matchs=Pattern.compile(regex).matcher(string);
				logger.debug(this+"::ELTVerifyTextListener is called");
				if(!matchs.matches()){
					txtDecorator.setDescriptionText(errorMessage);
					txtDecorator.show();
					event.doit=false;
					logger.trace("Pattern does not matches !matchs.matches() with :" + string);
				}else{
					txtDecorator.hide();
					logger.trace("Pattern matches with :" + string);
				}
			}
		};
	return listener;
}
 
Example 17
Project: n4js   File: AbstractExportToSingleFileWizardPage.java   View source code 5 votes vote down vote up
/**
 * Handle all events and enablements for widgets in this page
 *
 * @param e
 *            Event
 */
@Override
public void handleEvent(Event e) {
	Widget source = e.widget;

	if (source == destinationBrowseButton) {
		handleDestinationBrowseButtonPressed();
	}

	updatePageCompletion();
}
 
Example 18
Project: n4js   File: ExportSelectionPage.java   View source code 5 votes vote down vote up
@Override
public void handleEvent(Event event) {
	Widget source = event.widget;

	if (source == destinationBrowseButton) {
		handleDestinationBrowseButtonPressed();
	}

	updatePageCompletion();

}
 
Example 19
Project: eZooKeeper   File: SwtThreadSafeDelegatingInvocationHandler.java   View source code 5 votes vote down vote up
/**
 * Returns the widget.
 * 
 * @return The widget
 */
public final Widget getWidget() {
    Object delegate = getDelegate();
    if (delegate instanceof IWidgetProvider) {
        return ((IWidgetProvider) delegate).getWidget();
    }
    return (Widget) delegate;
}
 
Example 20
Project: RxSWT   File: Preconditions.java   View source code 5 votes vote down vote up
public static boolean checkWidget(Observer<?> observer, Widget widget) {
	if (null == widget) {
		observer.onError(new NullPointerException("The given widget was null"));
		return false;
	} else if (widget.isDisposed()) {
		observer.onError(new IllegalStateException("The given widget is diposed"));
		return false;
	} else if (!(Thread.currentThread().equals(widget.getDisplay().getThread()))) {
		observer.onError(new IllegalStateException(
				"Expected to be called on the main thread but was " + Thread.currentThread().getName()));
		return false;
	}
	return true;
}
 
Example 21
Project: xcalendar   File: XCalendarDefaultEventHandler.java   View source code 5 votes vote down vote up
/**
 * 
 */
@Override
protected boolean accepts(Context context, Event event) {
	//
	final Widget widget = event.widget;
	if(calendar == null || calendar.isDisposed()) return false;
	
	//
	final Shell shell = calendar.getShell();
	if(widget != calendar && widget != shell) return false;
	return isMouseEvent(event) || event.type == SWT.Deactivate;
}
 
Example 22
Project: gw4e.project   File: AbstractRunner.java   View source code 5 votes vote down vote up
private   SWTBotView  waitForConsoleBeDisplayed () {
	getConsoleView(bot);
	Matcher<Widget> console = getConsoleMatcher () ;
	bot.waitUntil(Conditions.waitForWidget(console));
	SWTBotView consoleView = getConsoleView(bot);
	consoleView.setFocus();
	 
	return consoleView;
}
 
Example 23
Project: pgcodekeeper   File: CheckedTreeViewer.java   View source code 5 votes vote down vote up
/**
 * Update element after a checkstate change.
 * @param element
 */
protected void doCheckStateChanged(Object element) {
    Widget item = findItem(element);
    if (item instanceof TreeItem) {
        TreeItem treeItem = (TreeItem) item;
        treeItem.setGrayed(false);
        updateChildrenItems(treeItem);
        updateParentItems(treeItem.getParentItem());
    }
}
 
Example 24
Project: pgcodekeeper   File: UiSync.java   View source code 5 votes vote down vote up
public static void exec(Widget w, Runnable r) {
    try {
        exec(w.getDisplay(), r);
    } catch (SWTException ex) {
        if (ex.code != SWT.ERROR_WIDGET_DISPOSED) {
            throw ex;
        }
        // do nothing: UI is already dead
    }
}
 
Example 25
Project: Hydrograph   File: FTPAuthenticEditorDialog.java   View source code 5 votes vote down vote up
private void updateWidgetsValue(Widget... widgets){
	if(optionList.length >1){
		for(int i = 0;  i <= widgets.length - 1; i++){
			if(widgets[i] != null && !widgets[i].isDisposed()){
				((Text)widgets[i]).setText("");;
			}
		}
	}
}
 
Example 26
Project: Hydrograph   File: FTPWidgetUtility.java   View source code 5 votes vote down vote up
/**
 *  Create Label Widget
 * @param control
 * @param widgetName
 * @return
 */
public Widget createLabel(Composite control, String widgetName){
	Label label = new Label(control, SWT.NONE);
	GridData label_gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	label.setLayoutData(label_gridData);
	label.setText(widgetName);
	return label;
}
 
Example 27
Project: Hydrograph   File: FTPWidgetUtility.java   View source code 5 votes vote down vote up
/**
 * Create Text Widget
 * @param control
 * @param widgetName
 * @return
 */
public Widget createText(Composite control, String widgetName, int style){
	Text text = new Text(control, style);
	GridData gd_text = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd_text.horizontalIndent = 10;
	text.setLayoutData(gd_text);
	text.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 204));
	return text;
}
 
Example 28
Project: Hydrograph   File: FTPWidgetUtility.java   View source code 5 votes vote down vote up
/**
 * Create Combo Widget
 * @param control
 * @param widgetName
 * @return
 */
public Widget CreateCombo(Composite control, String[] widgetName){
	Combo combo = new Combo(control, SWT.READ_ONLY);
	combo.setItems(widgetName);
	combo.select(0);
	GridData gd_partitionKeyButton = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd_partitionKeyButton.horizontalIndent = 10;
	combo.setLayoutData(gd_partitionKeyButton);
	
	return combo;
}
 
Example 29
Project: Hydrograph   File: FTPOperationConfigDialog.java   View source code 5 votes vote down vote up
private void updateWidgetsValue(Widget... widgets){
		for(int i = 0;  i <= widgets.length - 1; i++){
			if(widgets[i] != null && !widgets[i].isDisposed()){
				((Text)widgets[i]).setText("");;
			}
		}
}
 
Example 30
Project: Hydrograph   File: TransformDialog.java   View source code 5 votes vote down vote up
private void addButtonListener(final MappingSheetRow mappingSheetRow,
		final TableViewer operationalInputFieldTableViewer,Widget addButton) {
	addButton.addListener(SWT.MouseUp, new Listener(){

		@Override
		public void handleEvent(Event event) {
			operationInputTableAddButton(mappingSheetRow,
					operationalInputFieldTableViewer);
			}
	});
}
 
Example 31
Project: Hydrograph   File: ELTSelectionTaskListener.java   View source code 5 votes vote down vote up
@Override
public Listener getListener(
		final PropertyDialogButtonBar propertyDialogButtonBar,
		final ListenerHelper helper, final Widget... widgets) {

	Listener listener = new Listener() {
		@Override
		public void handleEvent(Event event) {
			selectionListenerAction(propertyDialogButtonBar,helper, widgets);
		}
	};
	return listener;
}
 
Example 32
Project: Hydrograph   File: PortFocusOutListener.java   View source code 5 votes vote down vote up
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers,
		Widget... widgets) {
	if (helpers != null) {
		txtDecorator = (ControlDecoration) helpers.get(HelperType.CONTROL_DECORATION);
		txtDecorator.hide();
	}

	Listener listener = new Listener() {

		@Override
		public void handleEvent(Event event) {
			String charSet = ((Text) widgets[0]).getText().trim();
			if (SWT.FocusOut == event.type) {
				Matcher matchs=Pattern.compile(Constants.PORT_VALIDATION_REGEX).matcher(charSet);
				if (StringUtils.isBlank(charSet)){
					txtDecorator.show();
					((Text) widgets[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 204));
					((Text) widgets[0]).setToolTipText(txtDecorator.getDescriptionText());
				} else if (matchs.matches()||ParameterUtil.isParameter(charSet)) {
					txtDecorator.hide();
				}else{
					txtDecorator.show();
				}
			} 
		}
	};
	return listener;
}
 
Example 33
Project: Hydrograph   File: DelimiterFocusOutListener.java   View source code 5 votes vote down vote up
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,
		Widget... widgets) {
	final Widget[] widgetList = widgets;
	if (helper != null) {
		txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
		txtDecorator.hide();
	}

	Listener listener = new Listener() {

		@Override
		public void handleEvent(Event event) {
			String charSet = ((Text) widgetList[0]).getText();
			if (SWT.FocusOut == event.type) {
				if (StringUtils.isEmpty(charSet)){
					txtDecorator.show();
					((Text) widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 204));
					((Text) widgetList[0]).setToolTipText(txtDecorator.getDescriptionText());
				} else {
					txtDecorator.hide();
				}
			} 
		}
	};
	return listener;
}
 
Example 34
Project: Hydrograph   File: XmlFilePathModifyListener.java   View source code 5 votes vote down vote up
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper, Widget... widgets) {
	final Widget[] widgetList = widgets;
	if (helper != null) {
		txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
	}
	
	Listener listener=new Listener() {
		
		@Override
		public void handleEvent(Event event) {
			IPath path = new Path(((Text) widgetList[0]).getText().trim());
			if (event.type == SWT.Modify ) {
				if (StringUtils.isNotBlank(path.segment(0))) {
					if (path.lastSegment().endsWith(".xml")) {
						txtDecorator.hide();
						((Text) widgetList[0]).setToolTipText("");
						((Text) widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 255));

					}else{
						txtDecorator.show();
						txtDecorator.setDescriptionText("Select valid XML file");
						((Text) widgetList[0]).setToolTipText(txtDecorator.getDescriptionText());
						((Text) widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 204));
					}
				}
			}
		}
	};
	
	return listener;
}
 
Example 35
Project: Hydrograph   File: VerifyDigitLimitNumericListener.java   View source code 5 votes vote down vote up
@Override
public Listener getListener(
		PropertyDialogButtonBar propertyDialogButtonBar,
		ListenerHelper helpers, Widget... widgets) {
	final Widget[] widgetList = widgets;	
	if (helpers != null) {
		txtDecorator = (ControlDecoration) helpers.get(HelperType.CONTROL_DECORATION);
		characterLimit = (int) helpers.get(HelperType.CHARACTER_LIMIT);
	}

	
	Listener listener=new Listener() {
		@Override
		public void handleEvent(Event event) {
			Text text = (Text)widgetList[0];
			text.setTextLimit(characterLimit);
			String string=event.text;
			Matcher matchs=Pattern.compile("[\\d]*").matcher(string);
			if(!matchs.matches()){
				txtDecorator.setDescriptionText(Messages.FIELDBATCH);
				txtDecorator.show();
				event.doit=false;
		}else
			txtDecorator.hide();
		}
	};
return listener;
}
 
Example 36
Project: Hydrograph   File: ELTNormalFocusOutListener.java   View source code 5 votes vote down vote up
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,
		Widget... widgets) {
	final Widget[] widgetList = widgets;
	if (helper != null) {
		txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
		txtDecorator.hide();
	}

	Listener listener = new Listener() {

		@Override
		public void handleEvent(Event event) {
			String charSet = ((Text) widgetList[0]).getText().trim();
			if (SWT.FocusOut == event.type) {
				if (StringUtils.isBlank(charSet)){
					txtDecorator.show();
					((Text) widgetList[0]).setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 204));
					((Text) widgetList[0]).setToolTipText(txtDecorator.getDescriptionText());
				} else {
					txtDecorator.hide();
				}
			} 
		}
	};
	return listener;
}
 
Example 37
Project: Hydrograph   File: OperationClassComboChangeListener.java   View source code 5 votes vote down vote up
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers,
		Widget... widgets) {
	final Widget[] widgetList = widgets;

	Listener listener = new Listener() {
		@Override
		public void handleEvent(Event event) {
			String comboValue = ((Combo) widgetList[0]).getText();
			propertyDialogButtonBar.enableApplyButton(true);
			if (Messages.CUSTOM.equalsIgnoreCase(comboValue) && !FilterOperationClassUtility.INSTANCE.isCheckBoxSelected()) {
				((Text) widgetList[1]).setText("");
				((Text) widgetList[1]).setEnabled(true);
				FilterOperationClassUtility.INSTANCE.enableAndDisableButtons(true, false);
			} else {
				if(FilterOperationClassUtility.INSTANCE.isCheckBoxSelected())
				{
					MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK);
					messageBox.setText(Messages.ERROR);
					messageBox.setMessage(Messages.CHECKBOX_DISABLE_MESSAGE);
					if (messageBox.open() == SWT.OK) {
						((Combo) widgetList[0]).setText(Messages.CUSTOM);
					} 
				}
				else
				{
					FilterOperationClassUtility.INSTANCE.setOperationClassNameInTextBox(comboValue, (Text)widgetList[1]);
					((Text) widgetList[1]).setEnabled(false);
					FilterOperationClassUtility.INSTANCE.enableAndDisableButtons(false, false);
					((Button) widgetList[2]).setEnabled(false);
				}
			}
		} 
	};
	return listener;
}
 
Example 38
Project: Hydrograph   File: DisposeSchemaGridListener.java   View source code 5 votes vote down vote up
@Override
public void mouseAction(PropertyDialogButtonBar propertyDialogButtonBar,
		ListenerHelper helpers, Event event, Widget... widgets) {
	   Table table=(Table)event.widget;
	   Shell tip=(Shell) table.getData("tip");
	   Label label=(Label) table.getData("label");
	if(tip!=null) 
	{
	 tip.dispose();
        tip = null;
        label = null;
	}
}
 
Example 39
Project: Hydrograph   File: MouseExitSchemaGridListener.java   View source code 5 votes vote down vote up
@Override
public void mouseAction(PropertyDialogButtonBar propertyDialogButtonBar,
		ListenerHelper helpers, Event event, Widget... widgets) {
       	Label label=(Label )event.widget;
		label.getShell().dispose();
        
}
 
Example 40
Project: Hydrograph   File: ELTGridDeleteAllSelectionListener.java   View source code 5 votes vote down vote up
@Override
public void selectionListenerAction(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers, Widget... widgets) {
	propertyDialogButtonBar.enableApplyButton(true);
	Table table = (Table) widgets[0];
	boolean userAns = WidgetUtility.eltConfirmMessage("Do you really want to delete all properties?");
	if (userAns) {
		ELTGridDetails gridDetails = (ELTGridDetails) helpers.get(HelperType.SCHEMA_GRID);
		gridDetails.getGrids().removeAll(gridDetails.getGrids());
		gridDetails.getTableViewer().refresh();
	}
}