Java Code Examples for org.eclipse.jface.dialogs.IDialogConstants

The following examples show how to use org.eclipse.jface.dialogs.IDialogConstants. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
protected void createButtonsForButtonBar(Composite parent){
	if (enableEmptyField) {
		parent.setLayout(new GridLayout(3, false));
		Button btnClear =
			createButton(parent, IDialogConstants.NO_ID, Messages.KontaktSelector_clearField,
				false);
		btnClear.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e){
				selection = null;
				vc.getContentProvider().stopListening();
				close();
			}
		});
	} else {
		parent.setLayout(new GridLayout(2, false));
	}
	
	createButton(parent, IDialogConstants.OK_ID, "OK", false);
	createButton(parent, IDialogConstants.CANCEL_ID, "Cancel", false);
}
 
Example 2
Source Project: saros   Source File: JoinSessionWizard.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public void createPageControls(Composite pageContainer) {
  descriptionPage.createControl(pageContainer);

  if (getContainer() instanceof WizardDialogAccessable) {
    ((WizardDialogAccessable) getContainer())
        .setWizardButtonLabel(IDialogConstants.FINISH_ID, Messages.JoinSessionWizard_accept);
  }

  isn.addCancelListener(cancelListener);

  if (isn.isCanceled()) {
    /*
     * FIXME error message is only available after negotiation
     * termination, but in most cases it should be null at this point
     * anyway
     */
    handleCanceledAsync(
        isn.isLocalCancellation() ? CancelLocation.LOCAL : CancelLocation.REMOTE, null);
  }
}
 
Example 3
Source Project: ermaster-b   Source File: CreateTablespaceAction.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void execute(Event event) {
	ERDiagram diagram = this.getDiagram();

	TablespaceDialog dialog = EclipseDBManagerFactory.getEclipseDBManager(
			diagram).createTablespaceDialog();
	if (dialog == null) {
		Activator
				.showMessageDialog("dialog.message.tablespace.not.supported");

	} else {
		dialog.init(null, diagram);

		if (dialog.open() == IDialogConstants.OK_ID) {
			CreateTablespaceCommand command = new CreateTablespaceCommand(
					diagram, dialog.getResult());
			this.execute(command);
		}
	}
}
 
Example 4
private void createWidget(String widgetId, String widgetType, int inputIndex)
        throws Exception {
    SWTBotShell activeShell = bot.activeShell();
    bot.button("Add...").click();
    assertFalse("button ok should be disabled",
            bot.button(IDialogConstants.OK_LABEL).isEnabled());
    bot.textWithLabel("Widget id*").setText(widgetId);
    bot.comboBoxWithLabel("Widget type").setSelection(widgetType);
    if (!widgetType.equals("Group")) {
        bot.comboBoxWithLabel("Input *").setSelection(inputIndex);
    } else {
        assertFalse("inputs combo box should be disabled for Group widget",
                bot.comboBoxWithLabel("Input *").isEnabled());
    }
    assertTrue("button ok should be enabled",
            bot.button(IDialogConstants.OK_LABEL).isEnabled());
    bot.button(IDialogConstants.OK_LABEL).click();
    activeShell.setFocus();
}
 
Example 5
@Test
public void testPatternExpressionViewer() {
    SWTBotTestUtil.createNewDiagram(bot);
    bot.viewById(SWTBotTestUtil.VIEWS_PROPERTIES_PROCESS_DATA).show();
    SWTBotTestUtil.selectTabbedPropertyView(bot, SWTBotConstants.VIEWS_PROPERTIES_POOL_DATA_VARIABLES);
    bot.buttonWithId(SWTBotConstants.SWTBOT_ID_ADD_PROCESS_DATA).click();
    SWTBotTestUtil.addNewData(bot, DATA_NAME_1, "Text", false, null);
    final String connectorLabel = getConnectorLabel(JDBC_DB_CONNECTOR_ID);
    final String connectorVersion = getConnectorVersion(JDBC_DB_CONNECTOR_ID);
    final String[] dbCategoryLabel = getCategoryLabels(new String[] { DB_CATEGORY_ID, GENERIC_DB_CATEGORY_ID });
    addDBConnectorWithPatternExpression(connectorLabel, connectorVersion, dbCategoryLabel, "patternDBConnector");
    bot.styledText().setText(QUERY1);
    bot.button(IDialogConstants.NEXT_LABEL).click();

    checkEnalbledChoices();
}
 
Example 6
Source Project: birt   Source File: ImportBirtRuntimeAction.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Open confirm dialog
 * 
 * @param file
 * @return
 */
private int openDialog( final String file )
{
	final int[] result = {IDialogConstants.CANCEL_ID};
	shell.getDisplay( ).syncExec( new Runnable( ) {

		public void run( )
		{
			String title = BirtWTPMessages.BIRTOverwriteQuery_title;
			String msg = NLS.bind(
					BirtWTPMessages.BIRTOverwriteQuery_message, file );
			String[] options = {IDialogConstants.YES_LABEL,
					IDialogConstants.NO_LABEL,
					IDialogConstants.YES_TO_ALL_LABEL,
					IDialogConstants.CANCEL_LABEL};
			MessageDialog dialog = new MessageDialog( shell, title,
					null, msg, MessageDialog.QUESTION, options, 0 );
			result[0] = dialog.open( );
		}
	} );
	return result[0];
}
 
Example 7
/**
 * 编辑选中的元素 ;
 */
protected void editElement() {
	ISelection selection = tableViewer.getSelection();
	if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
		@SuppressWarnings("unchecked")
		Iterator<ElementBean> iter = structuredSelection.iterator();
		ElementBean bean = iter.next();

		AddOrEditElementOfXmlConvertDialog dialog = new AddOrEditElementOfXmlConvertDialog(getShell(), false,
				elementsList);
		dialog.create();
		dialog.setInitEditData(bean);
		int result = dialog.open();
		if (result == IDialogConstants.OK_ID) {
			refreshTable(dialog.getCurrentElement());
		}
	} else {
		MessageDialog.openInformation(getShell(), Messages.getString("dialogs.XmlConvertManagerDialog.msgTitle2"),
				Messages.getString("dialogs.XmlConvertManagerDialog.msg3"));
	}
}
 
Example 8
/**
 * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
 */
@Override
protected void buttonPressed(int buttonId) {
  if (IDialogConstants.BACK_ID == buttonId) {

    if (MessageDialog.openConfirm(getShell(),
            Messages.RuleConfigurationEditDialog_titleRestoreDefault,
            Messages.RuleConfigurationEditDialog_msgRestoreDefault)) {

      if (mRule.getMetaData().hasSeverity()) {
        mSeverityCombo.setSelection(
                new StructuredSelection(mRule.getMetaData().getDefaultSeverityLevel()));
        mCommentText.setText(new String());
      }

      // restore the default value for the properties
      int size = mConfigPropertyWidgets != null ? mConfigPropertyWidgets.length : 0;
      for (int i = 0; i < size; i++) {
        mConfigPropertyWidgets[i].restorePropertyDefault();
      }
    }
  } else {
    super.buttonPressed(buttonId);
  }
}
 
Example 9
protected static void askUserToSwitch(IWorkbenchPart part, int warningsNumber) {
    final IPreferenceStore store = FindbugsPlugin.getDefault().getPreferenceStore();
    String message = "SpotBugs analysis finished, " + warningsNumber
            + " warnings found.\n\nSwitch to the SpotBugs perspective?";

    MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoCancelQuestion(null, "SpotBugs analysis finished",
            message, "Remember the choice and do not ask me in the future", false, store,
            FindBugsConstants.ASK_ABOUT_PERSPECTIVE_SWITCH);

    boolean remember = dialog.getToggleState();
    int returnCode = dialog.getReturnCode();

    if (returnCode == IDialogConstants.YES_ID) {
        if (remember) {
            store.setValue(FindBugsConstants.SWITCH_PERSPECTIVE_AFTER_ANALYSIS, true);
        }
        switchPerspective(part);
    } else if (returnCode == IDialogConstants.NO_ID) {
        if (remember) {
            store.setValue(FindBugsConstants.SWITCH_PERSPECTIVE_AFTER_ANALYSIS, false);
        }
    }
}
 
Example 10
protected void moveData(final IStructuredSelection structuredSelection) {
    final DataAware container = (DataAware) getDataContainerObservable().getValue();
    final MoveDataWizard moveDataWizard = new MoveDataWizard(container);
    if (createWizardDialog(moveDataWizard, IDialogConstants.FINISH_LABEL).open() == Dialog.OK) {
        final DataAware dataAware = moveDataWizard.getSelectedDataAwareElement();
        try {
            final MoveDataCommand cmd = new MoveDataCommand(TransactionUtil.getEditingDomain(dataAware), container,
                    structuredSelection.toList(), dataAware);
            OperationHistoryFactory.getOperationHistory().execute(cmd, null, null);

            if (!(cmd.getCommandResult().getStatus().getSeverity() == Status.OK)) {
                final List<Object> data = (List<Object>) cmd.getCommandResult().getReturnValue();
                String dataNames = "";
                for (final Object d : data) {
                    dataNames = dataNames + ((Element) d).getName() + ",";
                }
                dataNames = dataNames.substring(0, dataNames.length() - 1);
                MessageDialog.openWarning(Display.getDefault().getActiveShell(), Messages.PromoteDataWarningTitle,
                        Messages.bind(Messages.PromoteDataWarningMessage, dataNames));
            }

        } catch (final ExecutionException e1) {
            BonitaStudioLog.error(e1);
        }
    }
}
 
Example 11
Source Project: tmxeditor8   Source File: BatchQADialog.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void createButtonsForButtonBar(Composite parent) {
	// ROBERTHELP 品质检查
	String language = CommonFunction.getSystemLanguage();
	final String helpUrl = MessageFormat.format(
			"/net.heartsome.cat.ts.ui.help/html/{0}/ch05s04.html#translation-qa-check", language);
	setHelpUrl(helpUrl);
	
	installBtn = createButton(parent, IDialogConstants.CLIENT_ID,
			Messages.getString("qa.dialogs.BatchQADialog.name1"), false);
	
	super.createButtonsForButtonBar(parent);
	Button okBtn = getButton(IDialogConstants.OK_ID);
	okBtn.setText(Messages.getString("qa.all.dialog.ok"));
	Button cancelBtn = getButton(IDialogConstants.CANCEL_ID);
	cancelBtn.setText(Messages.getString("qa.all.dialog.cancel"));
	initLister(parent.getShell());
}
 
Example 12
Source Project: ermaster-b   Source File: RelationOutlineEditPart.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performRequest(Request request) {
	Relation relation = (Relation) this.getModel();

	if (request.getType().equals(RequestConstants.REQ_OPEN)) {
		Relation copy = relation.copy();

		RelationDialog dialog = new RelationDialog(PlatformUI
				.getWorkbench().getActiveWorkbenchWindow().getShell(), copy);

		if (dialog.open() == IDialogConstants.OK_ID) {
			ChangeRelationPropertyCommand command = new ChangeRelationPropertyCommand(
					relation, copy);
			this.execute(command);
		}
	}

	super.performRequest(request);
}
 
Example 13
private static void showSetupRustNotification() {
	Display.getDefault().asyncExec(() -> {
		if (hasCancelledSetup) {
			return;
		}
		setHasCancelledSetup(true);
		Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
		int dialogResponse = MessageDialog.open(MessageDialog.CONFIRM, shell,
				Messages.RLSStreamConnectionProvider_rustSupportNotFound,
				Messages.RLSStreamConnectionProvider_requirementsNotFound, SWT.NONE,
				Messages.RLSStreamConnectionProvider_OpenPreferences, IDialogConstants.CANCEL_LABEL); // $NON-NLS-4$
		if (dialogResponse == 0) {
			PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(shell,
					CorrosionPreferencePage.PAGE_ID, new String[] { CorrosionPreferencePage.PAGE_ID }, null);
			preferenceDialog.setBlockOnOpen(true);
			preferenceDialog.open();
			setHasCancelledSetup(false);
		}
	});
}
 
Example 14
public void createConnector(final String connectorDefinitionId) {
    final String widgetId = "textWidget";
    final String pageId = "connectorDefPageId";
    SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot);
    SWTBotShell activeShell = bot.activeShell();
    bot.textWithLabel("Definition id *").setText(connectorDefinitionId);
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.button("Add...").click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.button("Add...").click();
    bot.textWithLabel("Page id *").setText(pageId);
    bot.button("Add...").click();
    bot.textWithLabel("Widget id*").setText(widgetId);
    bot.textWithLabel("Display name").setText("text");
    bot.comboBoxWithLabel("Widget type").setSelection("Text");
    bot.comboBoxWithLabel("Input *").setSelection(0);
    bot.button(IDialogConstants.OK_LABEL).click();
    activeShell.setFocus();
    bot.button("Apply").click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.button("Add...").click();
    bot.button(IDialogConstants.FINISH_LABEL).click();
}
 
Example 15
/**
 * Opens a path variable selection dialog
 */
private void handleVariablesButtonPressed() {
	int variableTypes = IResource.FOLDER;
	PathVariableSelectionDialog dialog = new PathVariableSelectionDialog(getShell(), variableTypes);
	dialog.setResource(fParent);
	if (dialog.open() == IDialogConstants.OK_ID) {
		String[] variableNames = (String[]) dialog.getResult();
		if (variableNames != null && variableNames.length == 1) {
			fLinkLocation.setText(variableNames[0]);
			fRootDialogField.setText(new Path(variableNames[0]).lastSegment());
			if (fAdapter != null) {
				fAdapter.dialogFieldChanged(fRootDialogField);
			}
		}
	}
}
 
Example 16
@Override
protected Control createButtonBar(Composite parent) {
	Composite blank = new Composite(parent, SWT.NONE);
	blank.setLayoutData(new GridData(1,1));
	Composite buttonbar = new Composite(parent, SWT.None);
	buttonbar.setLayout(new GridLayout(3,false));
	buttonbar.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false));
	if(messageType == YES_NO_SEEDETAILS || messageType == YES_NO){
		super.createButton(buttonbar, YES, IDialogConstants.YES_LABEL, false);	
		super.createButton(buttonbar, NO, IDialogConstants.NO_LABEL, true);
	}
	if(messageType == OK_SEEDETAILS || messageType == OK_ONLY){
		super.createButton(buttonbar, OK, IDialogConstants.OK_LABEL, true);
	}
	if(messageType == YES_NO_SEEDETAILS || messageType == OK_SEEDETAILS ){
		super.createButton(buttonbar, SEE_DETAILS, seeDetails, false);
	}
	return buttonBar;
}
 
Example 17
@Override
protected void createButtonsForButtonBar(Composite parent) {
	super.createButtonsForButtonBar(parent);
	Button okBtn = getButton(IDialogConstants.OK_ID);
	okBtn.setText(Messages.getString("qa.preference.NonTranslationQAPage.enterBtn"));
	
	Button cancelBtn = getButton(IDialogConstants.CANCEL_ID);
	cancelBtn.setText(Messages.getString("qa.preference.NonTranslationQAPage.cancelBtn"));
}
 
Example 18
Source Project: Pydev   Source File: SWTUtil.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns a width hint for a button control.
 * @param button the button
 * @return the width hint
 */
public static int getButtonWidthHint(Button button) {
    button.setFont(JFaceResources.getDialogFont());
    PixelConverter converter = new PixelConverter(button);
    int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}
 
Example 19
private void editGroovyEditor(int buttonIndex, String inputName, String inputtype, String scriptName,
        String groovyScript) {
    SWTBotShell activeShell = bot.activeShell();
    bot.toolbarButtonWithId(SWTBOT_ID_EDITBUTTON, buttonIndex).click();
    bot.table().select("Script");
    bot.waitUntil(Conditions.widgetIsEnabled(bot.textWithLabel("Name")), 10000);
    bot.textWithLabel("Name").setText(scriptName);
    bot.styledText().setText(groovyScript);
    assertFalse("return type combobox should be disabled", bot.comboBoxWithLabel("Return type").isEnabled());
    assertEquals("return type should be" + inputtype, bot.comboBoxWithLabel("Return type").getText(), inputtype);
    bot.button(IDialogConstants.OK_LABEL).click();
    activeShell.setFocus();
    assertEquals("wrong value for " + inputName, bot.textWithLabel(inputName).getText(), scriptName);
}
 
Example 20
Source Project: sarl   Source File: MainProjectWizardPage.java    License: Apache License 2.0 5 votes vote down vote up
private GridLayout initGridLayout(GridLayout layout, boolean margins) {
	layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
	layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
	if (margins) {
		layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
		layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
	} else {
		layout.marginWidth = 0;
		layout.marginHeight = 0;
	}
	return layout;
}
 
Example 21
/**
    * creates the following controls (sample)
    * File Format : [{added_flag}{dirty_flag}{name} {revision}  {date}  {author}]  [Add Variables]
    * Example : [                           ]
    * supportedBindings is a map of {key : description} (ex : {"name","name of the resource being decorated"})
    * @returns the text control for the format and the text control for the example         
    */
protected TextPair createFormatEditorControl(
       Composite composite, 
       String title, 
       String buttonText, 
       final Map supportedBindings) {
       
       createLabel(composite, title, 1);
	
       Text format = new Text(composite, SWT.BORDER);
	format.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	format.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {				
			updateExamples();
		}
	});
	Button b = new Button(composite, SWT.NONE);
	b.setText(buttonText);
	GridData data = new GridData();
	data.horizontalAlignment = GridData.FILL;
	int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
	data.widthHint = Math.max(widthHint, b.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
	b.setLayoutData(data);
	final Text formatToInsert = format;
	b.addListener(SWT.Selection, new Listener() {
		public void handleEvent (Event event) {
			addVariables(formatToInsert, supportedBindings);
		}			
	});
	
	return new TextPair(format, null);
}
 
Example 22
Source Project: developer-studio   Source File: UpdaterDialog.java    License: Apache License 2.0 5 votes vote down vote up
protected void createButtonsForButtonBar(Composite parent) {
	// Change parent layout data to fill the whole bar
	parent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

	installBtn = createButton(parent, IDialogConstants.NO_ID, INSTALL_BTN_TXT, true);
	installBtn.setEnabled(false);
	installBtn.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event e) {
			switch (e.type) {
			case SWT.Selection:
				if (tabFolder.getSelection()[0].getText().equals(ALL_FEATURES_TAB_TITLE)) {
					updateManager.setSelectedFeaturesToInstall(selectedFeatures);
					updateManager.installSelectedFeatures(new NullProgressMonitor());
				} else if (tabFolder.getSelection()[0].getText().equals(UPDATES_TAB_TITLE)) {
					updateManager.setSelectedUpdates(selectedUpdates);
					updateManager.installSelectedUpdates(new NullProgressMonitor());
				}
				dialog.close();
				break;
			}
		}
	});

	// Create a spacer label
	Label spacer = new Label(parent, SWT.NONE);
	spacer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

	// Update layout of the parent composite to count the spacer
	GridLayout layout = (GridLayout) parent.getLayout();
	layout.numColumns++;
	layout.makeColumnsEqualWidth = false;
	createButton(parent, IDialogConstants.CANCEL_ID, CANCEL_BTN_TXT, false);
}
 
Example 23
@Test
public void testNewCategory() throws Exception {
    final String id = "test3";
    final String version = "1.0.0";
    final String categoryId = "category1";
    SWTBotActorFilterUtil.createActorFilterDefinition(bot, id, version);
    SWTBotActorFilterUtil.createNewCategory(bot, categoryId);
    bot.treeWithLabel(Messages.categoryLabel).select(categoryId);
    bot.button(IDialogConstants.FINISH_LABEL).click();
    ActorFilterDefRepositoryStore store = (ActorFilterDefRepositoryStore) RepositoryManager
            .getInstance().getRepositoryStore(ActorFilterDefRepositoryStore.class);
    ConnectorDefinition actorDefinition = store.getDefinition(id, version);
    assertEquals("category list size should be equal to 1", 1, actorDefinition
            .getCategory().size());
}
 
Example 24
Source Project: tmxeditor8   Source File: TSWizardDialog.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected void setButtonLayoutData(Button button) {
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);

	// On large fonts this can make this dialog huge
	widthHint = Math.min(widthHint,
			button.getDisplay().getBounds().width / 5);
	Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
	data.widthHint = Math.max(widthHint, minSize.x);

	button.setLayoutData(data);
}
 
Example 25
@Override
public OverwriteState askOverwrite(IPatient patient, ILabResult oldResult,
	TransientLabResult newResult){
	QueryOverwriteDialogRunnable runnable =
		new QueryOverwriteDialogRunnable(patient, oldResult, newResult);
	Display.getDefault().syncExec(runnable);
	int retVal = runnable.result;
	
	if (retVal == IDialogConstants.YES_TO_ALL_ID) {
		return OverwriteState.OVERWRITEALL;
	} else if (retVal == IDialogConstants.YES_ID) {
		return OverwriteState.OVERWRITE;
	}
	return OverwriteState.IGNORE;
}
 
Example 26
@Override
protected void createButtonsForButtonBar(Composite parent) {
	super.createButtonsForButtonBar(parent);
	getButton(IDialogConstants.OK_ID).setText(Messages.getString("dialog.TMX2TXTConverterDialog.ok"));
	getButton(IDialogConstants.CANCEL_ID).setText(Messages.getString("dialog.TMX2TXTConverterDialog.cancel"));
	parent.layout();
	
	getDialogArea().getParent().layout();
	getShell().layout();
}
 
Example 27
@Test
public void testConditionExpressions() throws IOException, InterruptedException {
    new BotApplicationWorkbenchWindow(bot).importBOSArchive()
            .setArchive(
                    TestDecisionTable.class.getResource("TestDecisionTable-1.0.bos"))
            .finish();

    final SWTBotEditor botEditor = bot.activeEditor();
    final SWTBotGefEditor gmfEditor = bot.gefEditor(botEditor.getTitle());

    gmfEditor.getEditPart("sf1").click();
    bot.viewById(SWTBotTestUtil.VIEWS_PROPERTIES_PROCESS_GENERAL).show();
    SWTBotTestUtil.selectTabbedPropertyView(bot, "General");

    bot.radio(useDecisionTable).click();
    bot.waitUntil(Conditions.widgetIsEnabled(bot.button(editDecisionTable)));
    bot.button(editDecisionTable).click();

    bot.waitUntil(Conditions.shellIsActive(Messages.wizardPageTitle));
    bot.waitUntil(Conditions.widgetIsEnabled(bot.link("<A>" + Messages.addRow + "</A>")));

    bot.link("<A>" + Messages.addRow + "</A>").click(Messages.addRow);

    bot.waitUntil(Conditions.widgetIsEnabled(bot.link("<A>" + Messages.addCondition + "</A>")));
    addTrueCondition(0, "true");
    addTrueCondition(1, "1==2");
    addFalseCondition(2, "sdkgjskrg");

    changeCondition(2, "myBoolean");
    testUpdateLineButtonEnabled();
    bot.toolbarButtonWithId(ExpressionViewer.SWTBOT_ID_ERASEBUTTON, 0).click();
    testUpdateLineButtonNotEnabled();

    changeCondition(0, "myText==\"\"");
    testUpdateLineButtonEnabled();
    bot.button(Messages.updateLine).click();
    bot.button(IDialogConstants.FINISH_LABEL).click();
}
 
Example 28
Source Project: ermaster-b   Source File: PlaceTableAction.java    License: Apache License 2.0 5 votes vote down vote up
@Override
	public void execute(Event event) throws Exception {
		ERDiagram diagram = this.getDiagram();
		ERModel model = oneEditor.getModel();
		
		List<ERTable> input = new ArrayList<ERTable>();
		input.addAll(diagram.getDiagramContents().getContents().getTableSet().getList());
		
		NodeSelectionDialog dialog = new NodeSelectionDialog(
				PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
				diagram);
		
		FigureCanvas canvas = (FigureCanvas) oneEditor.getGraphicalViewer().getControl();
		Point point = new Point(
				canvas.getHorizontalBar().getSelection() + canvas.getClientArea().width / 2,
				canvas.getVerticalBar().getSelection() + canvas.getClientArea().height / 2);
		
		if (dialog.open() == IDialogConstants.OK_ID) {
			Object[] results = dialog.getResult();
			for (Object result : results) {
				ERTable curTable = (ERTable) result;
				ERVirtualTable virtualTable = new ERVirtualTable(model, curTable);
				virtualTable.setPoint(point.x, point.y);
				model.addTable(virtualTable);
//				oneEditor.setContents(model);
//				oneEditor.refreshContents();
//				model.changeAll();
			}
			
		}

	}
 
Example 29
Source Project: APICloud-Studio   Source File: InputDialog.java    License: GNU General Public License v3.0 5 votes vote down vote up
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    okButton = createButton(parent, IDialogConstants.OK_ID,
            IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID,
            IDialogConstants.CANCEL_LABEL, false);
    //do this here because setting the text will set enablement on the ok
    // button
    text.setFocus();
    if (value != null) {
        text.setText(value);
        text.selectAll();
    }
}
 
Example 30
Source Project: ADT_Frontend   Source File: GitCredentialsService.java    License: MIT License 5 votes vote down vote up
/**
 * Opens a dialog for the user to enter the credentials for the git account
 * with the error message from the previous try.
 * Retrieves credentials from secure storage
 */
public static IExternalRepositoryInfoRequest getCredentialsFromUser(Shell shell,
		String repositoryURL, String errorMessage) {
	//get credentials from the secure storage if present
	repositoryCredentials = getRepoCredentialsFromSecureStorage(repositoryURL);

	//open the user credentials pop-up
	Display.getDefault().syncExec(() -> {
		Dialog userCredentialsDialog = new AbapGitStagingCredentialsDialog(shell, errorMessage, repositoryCredentials);
		if (repositoryCredentials != null) {
			((AbapGitStagingCredentialsDialog) userCredentialsDialog).setStoreInSecureStorage(true);
		}
		if (userCredentialsDialog.open() == IDialogConstants.OK_ID) {
			repositoryCredentials = ((AbapGitStagingCredentialsDialog) userCredentialsDialog).getExternalRepoInfo();
			if (repositoryCredentials != null) {

				if (((AbapGitStagingCredentialsDialog) userCredentialsDialog).storeInSecureStorage()) {
					//store the credentials in secure storage
					storeCredentialsInSecureStorage(repositoryCredentials, repositoryURL);
				} else {
					deleteCredentialsFromSecureStorage(repositoryURL);
				}
			}
		}
		else {
			repositoryCredentials = null;
		}
	});
	return repositoryCredentials;
}