Java Code Examples for org.eclipse.swt.SWT#DIALOG_TRIM

The following examples show how to use org.eclipse.swt.SWT#DIALOG_TRIM . 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 check out the related API usage on the sidebar.
Example 1
Source Project: Rel   File: RestoreDatabaseDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Create the dialog.
 * @param parent
 * @param style
 */
public RestoreDatabaseDialog(Shell parent) {
	super(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
	setText("Create and Restore Database");
	
	newDatabaseDialog = new DirectoryDialog(parent);
	newDatabaseDialog.setText("Create Database");
	newDatabaseDialog.setMessage("Select a folder to hold a new database.");
	newDatabaseDialog.setFilterPath(System.getProperty("user.home"));

	restoreFileDialog = new FileDialog(Core.getShell(), SWT.OPEN);
	restoreFileDialog.setFilterPath(System.getProperty("user.home"));
	restoreFileDialog.setFilterExtensions(new String[] {"*.rel", "*.*"});
	restoreFileDialog.setFilterNames(new String[] {"Rel script", "All Files"});
	restoreFileDialog.setText("Load Backup");
}
 
Example 2
public GraphModelDialog( Shell parent, GraphModel graphModel, RowMetaInterface inputRowMeta ) {
  super( parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.CLOSE );
  this.inputRowMeta = inputRowMeta;

  props = PropsUI.getInstance();
  ok = false;

  // We will only replace at OK
  //
  this.originalGraphModel = graphModel;

  // We will change graphModel, copy it first
  //
  this.graphModel = new GraphModel( graphModel );

  mouseDownPoint = new Point( -1, -1 );
}
 
Example 3
Source Project: pentaho-kettle   File: BaseDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns a {@link org.eclipse.swt.events.SelectionAdapter} that is used to "submit" the dialog.
 */
private Display prepareLayout() {

  // Prep the parent shell and the dialog shell
  final Shell parent = getParent();
  final Display display = parent.getDisplay();

  shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.SHEET );
  shell.setImage( GUIResource.getInstance().getImageSpoon() );
  props.setLook( shell );
  // Detect X or ALT-F4 or something that kills this window...
  shell.addShellListener( new ShellAdapter() {
    @Override
    public void shellClosed( ShellEvent e ) {
      dispose();
    }
  } );

  final FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = MARGIN_SIZE;
  formLayout.marginHeight = MARGIN_SIZE;

  shell.setLayout( formLayout );
  shell.setText( this.title );
  return display;
}
 
Example 4
@Override
protected void setShellStyle( int newShellStyle )
{
	super.setShellStyle( newShellStyle
			| SWT.DIALOG_TRIM
			| SWT.RESIZE
			| SWT.APPLICATION_MODAL );
}
 
Example 5
public static void
popoutStandAlone(
	String						title,
	Map<String,Object>			state,
	String						configPrefix )
{
	SkinnedDialog skinnedDialog =
			new SkinnedDialog(
					"skin3_dlg_sidebar_popout",
					"shell",
					null,	// standalone
					SWT.RESIZE | SWT.MAX | SWT.DIALOG_TRIM);

	SWTSkin skin = skinnedDialog.getSkin();

	SWTSkinObjectContainer cont = 
		BaseMdiEntry.importStandAlone(
			(SWTSkinObjectContainer)skin.getSkinObject( "content-area" ), 
			state,
			null );

	if ( cont != null ){

		skinnedDialog.setTitle( title );

		skinnedDialog.open( configPrefix, true );

	}else{

		skinnedDialog.close();
	}
}
 
Example 6
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display, SWT.DIALOG_TRIM);
	shell.setSize(800, 600);

	new SimpleBrowserWindow(shell, "http://google.com", 0.8, 0.5, true, false);

	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}
 
Example 7
Source Project: Rel   File: VarExternalDefinitionDialog.java    License: Apache License 2.0 5 votes vote down vote up
public VarExternalDefinitionDialog(RevDatabase database, Shell shell, String variableType, String variableName) {
	super(shell, SWT.DIALOG_TRIM | SWT.RESIZE);
	this.database = database;
	this.variableType = variableType;
	this.variableName = variableName;
	success = false;
}
 
Example 8
protected void setShellStyle( int newShellStyle )
{
	super.setShellStyle( newShellStyle
			| SWT.DIALOG_TRIM
			| SWT.RESIZE
			| SWT.APPLICATION_MODAL );
}
 
Example 9
public void open(int minValue, int maxValue) {
	childShell = new Shell(shell.getDisplay(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
	childShell.setText("Exporting to Excel.. please wait");

	progressBar = new ProgressBar(childShell, SWT.SMOOTH);
	progressBar.setMinimum(minValue);
	progressBar.setMaximum(maxValue);
	progressBar.setBounds(0, 0, 400, 25);
	progressBar.setFocus();

	childShell.pack();
	childShell.open();
}
 
Example 10
private void openLegend() {
    final String cg = Messages.CustomTxtParserInputWizardPage_capturedGroup;
    final String ucg = Messages.CustomTxtParserInputWizardPage_unidentifiedCaptureGroup;
    final String ut = Messages.CustomTxtParserInputWizardPage_uncapturedText;
    int line1start = 0;
    String line1 = Messages.CustomTxtParserInputWizardPage_nonMatchingLine;
    int line2start = line1start + line1.length();
    String line2 = Messages.CustomTxtParserInputWizardPage_matchingRootLine + ' ' + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
    int line3start = line2start + line2.length();
    String line3 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + ' '  + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
    int line4start = line3start + line3.length();
    String line4 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + ' ' + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
    int line5start = line4start + line4.length();
    String line5 = Messages.CustomTxtParserInputWizardPage_nonMatchingLine;
    int line6start = line5start + line5.length();
    String line6 = Messages.CustomTxtParserInputWizardPage_matchingRootLine + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$

    final Shell legendShell = new Shell(getShell(), SWT.DIALOG_TRIM);
    legendShell.setLayout(new FillLayout());
    StyledText legendText = new StyledText(legendShell, SWT.MULTI);
    legendText.setFont(fixedFont);
    legendText.setText(line1 + line2 + line3 + line4 + line5 + line6);
    legendText.setStyleRange(new StyleRange(line2start, line2.length(), COLOR_BLACK, COLOR_YELLOW, SWT.ITALIC));
    legendText.setStyleRange(new StyleRange(line3start, line3.length(), COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
    legendText.setStyleRange(new StyleRange(line4start, line4.length(), COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
    legendText.setStyleRange(new StyleRange(line6start, line6.length(), COLOR_BLACK, COLOR_YELLOW, SWT.ITALIC));
    legendText.setStyleRange(new StyleRange(line2start + line2.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_GREEN, SWT.BOLD));
    legendText.setStyleRange(new StyleRange(line2start + line2.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_MAGENTA));
    legendText.setStyleRange(new StyleRange(line3start + line3.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_LIGHT_GREEN, SWT.BOLD));
    legendText.setStyleRange(new StyleRange(line3start + line3.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_LIGHT_MAGENTA));
    legendText.setStyleRange(new StyleRange(line4start + line4.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_LIGHT_GREEN, SWT.BOLD));
    legendText.setStyleRange(new StyleRange(line4start + line4.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_LIGHT_MAGENTA));
    legendText.setStyleRange(new StyleRange(line6start + line6.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_GREEN, SWT.BOLD));
    legendText.setStyleRange(new StyleRange(line6start + line6.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_MAGENTA));
    legendShell.setText(Messages.CustomTxtParserInputWizardPage_previewLegend);
    legendShell.pack();
    legendShell.open();
}
 
Example 11
Source Project: hop   File: HopGui.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Build the shell
 */
protected void open() {
  shell = new Shell( display, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX );
  shell.setImage( GuiResource.getInstance().getImageHopUi() );

  shell.setText( BaseMessages.getString( PKG, "HopGui.Application.Name" ) );
  addMainMenu();
  addMainToolbar();
  addPerspectivesToolbar();
  addMainPerspectivesComposite();

  loadPerspectives();

  replaceKeyboardShortcutListeners( this );

  shell.addListener( SWT.Close, this::closeEvent );

  BaseTransformDialog.setSize( shell );

  // Open the Hop GUI shell and wait until it's closed
  //
  // shell.pack();
  shell.open();

  openingLastFiles = true; // TODO: make this configurable.

  try {
    ExtensionPointHandler.callExtensionPoint( log, HopExtensionPoint.HopGuiStart.id, this );
  } catch ( Exception e ) {
    new ErrorDialog( shell, "Error", "Error calling extension point '" + HopExtensionPoint.HopGuiStart.id + "'", e );
  }
  // Open the previously used files. Extension points can disable this
  //
  if ( openingLastFiles ) {
    auditDelegate.openLastFiles();
  }
  boolean retry = true;
  while ( retry ) {
    try {
      while ( !shell.isDisposed() ) {
        if ( !display.readAndDispatch() ) {
          display.sleep();
        }
      }
      retry = false;
    } catch ( Throwable throwable ) {
      System.err.println( "Error in the Hop GUI : " + throwable.getMessage() + Const.CR + Const.getClassicStackTrace( throwable ) );
    }
  }
  display.dispose();
}
 
Example 12
protected void setShellStyle( int newShellStyle )
{
	super.setShellStyle( newShellStyle
			| SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL );
}
 
Example 13
Source Project: pentaho-kettle   File: TeraFastDialog.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see org.pentaho.di.trans.step.StepDialogInterface#open()
 */
public String open() {
  this.changed = this.meta.hasChanged();

  final Shell parent = getParent();
  final Display display = parent.getDisplay();

  this.shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX );
  this.props.setLook( this.shell );
  setShellImage( this.shell, this.meta );

  FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = Const.FORM_MARGIN;
  formLayout.marginHeight = Const.FORM_MARGIN;

  this.shell.setLayout( formLayout );
  this.shell.setText( BaseMessages.getString( PKG, "TeraFastDialog.Shell.Title" ) );

  buildUi();
  assignChangeListener();
  listeners();

  //
  // Search the fields in the background
  //

  final Runnable runnable = new Runnable() {
    public void run() {
      final StepMeta stepMetaSearchFields =
        TeraFastDialog.this.transMeta.findStep( TeraFastDialog.this.stepname );
      if ( stepMetaSearchFields == null ) {
        return;
      }
      try {
        final RowMetaInterface row = TeraFastDialog.this.transMeta.getPrevStepFields( stepMetaSearchFields );

        // Remember these fields...
        for ( int i = 0; i < row.size(); i++ ) {
          TeraFastDialog.this.inputFields.put( row.getValueMeta( i ).getName(), Integer.valueOf( i ) );
        }

        setComboBoxes();
      } catch ( KettleException e ) {
        TeraFastDialog.this.logError( BaseMessages.getString( PKG, "System.Dialog.GetFieldsFailed.Message" ) );
      }
    }
  };
  new Thread( runnable ).start();
  //
  // // Set the shell size, based upon previous time...
  setSize();

  getData();
  this.meta.setChanged( this.changed );
  disableInputs();

  this.shell.open();
  while ( !this.shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
  return this.stepname;
}
 
Example 14
public AbstractStyleEditorDialog(Shell parent) {
	super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
}
 
Example 15
Source Project: hop   File: TextFileInputDialog.java    License: Apache License 2.0 4 votes vote down vote up
private void getFixed() {
  TextFileInputMeta info = new TextFileInputMeta();
  getInfo( info );

  Shell sh = new Shell( shell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN );

  try {
    List<String> rows = getFirst( 50, false );
    fields = getFields( info, rows );

    final TextFileImportWizardPage1 page1 = new TextFileImportWizardPage1( "1", props, rows, fields );
    page1.createControl( sh );
    final TextFileImportWizardPage2 page2 = new TextFileImportWizardPage2( "2", props, rows, fields );
    page2.createControl( sh );

    Wizard wizard = new Wizard() {
      public boolean performFinish() {
        wFields.clearAll( false );

        for ( ITextFileInputField field1 : fields ) {
          TextFileInputField field = (TextFileInputField) field1;
          if ( !field.isIgnored() && field.getLength() > 0 ) {
            TableItem item = new TableItem( wFields.table, SWT.NONE );
            item.setText( 1, field.getName() );
            item.setText( 2, "" + field.getTypeDesc() );
            item.setText( 3, "" + field.getFormat() );
            item.setText( 4, "" + field.getPosition() );
            item.setText( 5, field.getLength() < 0 ? "" : "" + field.getLength() );
            item.setText( 6, field.getPrecision() < 0 ? "" : "" + field.getPrecision() );
            item.setText( 7, "" + field.getCurrencySymbol() );
            item.setText( 8, "" + field.getDecimalSymbol() );
            item.setText( 9, "" + field.getGroupSymbol() );
            item.setText( 10, "" + field.getNullString() );
            item.setText( 11, "" + field.getIfNullValue() );
            item.setText( 12, "" + field.getTrimTypeDesc() );
            item.setText( 13, field.isRepeated() ? BaseMessages.getString( PKG, "System.Combo.Yes" ) : BaseMessages
              .getString( PKG, "System.Combo.No" ) );
          }

        }
        int size = wFields.table.getItemCount();
        if ( size == 0 ) {
          new TableItem( wFields.table, SWT.NONE );
        }

        wFields.removeEmptyRows();
        wFields.setRowNums();
        wFields.optWidth( true );

        input.setChanged();

        return true;
      }
    };

    wizard.addPage( page1 );
    wizard.addPage( page2 );

    WizardDialog wd = new WizardDialog( shell, wizard );
    WizardDialog.setDefaultImage( GuiResource.getInstance().getImageWizard() );
    wd.setMinimumPageSize( 700, 375 );
    wd.updateSize();
    wd.open();
  } catch ( Exception e ) {
    new ErrorDialog( shell, BaseMessages.getString( PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogTitle" ),
      BaseMessages.getString( PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogMessage" ), e );
  }
}
 
Example 16
Source Project: Rel   File: VarTypeDialog.java    License: Apache License 2.0 4 votes vote down vote up
public VarTypeDialog(RevDatabase database, Shell shell) {
	super(shell, SWT.DIALOG_TRIM);
	this.database = database;
	variableType = null;
}
 
Example 17
Source Project: hop   File: TestingGuiPlugin.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * List all unit tests which are defined
 * And allow the user to select one
 */
public RowMetaAndData selectUnitTestFromAllTests() {
  HopGui hopGui = HopGui.getInstance();
  IHopMetadataProvider metadataProvider = hopGui.getMetadataProvider();

  IRowMeta rowMeta = new RowMeta();
  rowMeta.addValueMeta( new ValueMetaString( "Unit test" ) );
  rowMeta.addValueMeta( new ValueMetaString( "Description" ) );
  rowMeta.addValueMeta( new ValueMetaString( "Filename" ) );

  List<RowMetaAndData> rows = new ArrayList<>();

  try {
    IHopMetadataSerializer<PipelineUnitTest> testSerializer = metadataProvider.getSerializer( PipelineUnitTest.class );

    List<String> testNames = testSerializer.listObjectNames();
    for ( String testName : testNames ) {
      PipelineUnitTest unitTest = testSerializer.load( testName );
      unitTest.initializeVariablesFrom( hopGui.getVariables() );

      Object[] row = RowDataUtil.allocateRowData( rowMeta.size() );
      row[ 0 ] = testName;
      row[ 1 ] = unitTest.getDescription();
      row[ 2 ] = unitTest.getPipelineFilename();

      rows.add( new RowMetaAndData( rowMeta, row ) );
    }

    // Now show a selection dialog...
    //
    SelectRowDialog dialog = new SelectRowDialog( hopGui.getShell(), new Variables(), SWT.DIALOG_TRIM | SWT.MAX | SWT.RESIZE, rows );
    RowMetaAndData selection = dialog.open();
    if ( selection != null ) {
      return selection;
    }
    return null;
  } catch ( Exception e ) {
    new ErrorDialog( hopGui.getShell(), "Error", "Error listing/deleting unit test(s)", e );
    return null;
  }
}
 
Example 18
Source Project: Rel   File: VarTypeDialog.java    License: Apache License 2.0 4 votes vote down vote up
public VarTypeDialog(Shell shell, int style) {
	super(shell, SWT.DIALOG_TRIM | SWT.RESIZE);
}
 
Example 19
public AbstractStyleEditorDialog(Shell parent) {
	super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
}
 
Example 20
public FindReplaceDialog(Shell parent, StyledText text) {
	super(parent, SWT.DIALOG_TRIM);
	this.text = text;
}