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

The following examples show how to use org.eclipse.swt.SWT#DIALOG_TRIM . 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 File: BaseDialog.java    From pentaho-kettle with 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 2
Source File: RestoreDatabaseDialog.java    From Rel with 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 3
Source File: GraphModelDialog.java    From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 6 votes vote down vote up
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 4
Source File: CustomTxtParserInputWizardPage.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
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 5
Source File: ExcelExportProgessBar.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
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 6
Source File: ExternalizedTextEditorDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void setShellStyle( int newShellStyle )
{
	super.setShellStyle( newShellStyle
			| SWT.DIALOG_TRIM
			| SWT.RESIZE
			| SWT.APPLICATION_MODAL );
}
 
Example 7
Source File: VarExternalDefinitionDialog.java    From Rel with 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
Source File: SimpleBrowserWindow.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
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 9
Source File: BaseMdiEntry.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
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 10
Source File: GradientEditorDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void setShellStyle( int newShellStyle )
{
	super.setShellStyle( newShellStyle
			| SWT.DIALOG_TRIM
			| SWT.RESIZE
			| SWT.APPLICATION_MODAL );
}
 
Example 11
Source File: TeraFastDialog.java    From pentaho-kettle with 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 12
Source File: AbstractStyleEditorDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
public AbstractStyleEditorDialog(Shell parent) {
	super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
}
 
Example 13
Source File: ReportItemParametersDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected void setShellStyle( int newShellStyle )
{
	super.setShellStyle( newShellStyle
			| SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL );
}
 
Example 14
Source File: TextFileInputDialog.java    From hop with 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 15
Source File: VarTypeDialog.java    From Rel with 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 16
Source File: TestingGuiPlugin.java    From hop with 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 17
Source File: VarTypeDialog.java    From Rel with Apache License 2.0 4 votes vote down vote up
public VarTypeDialog(Shell shell, int style) {
	super(shell, SWT.DIALOG_TRIM | SWT.RESIZE);
}
 
Example 18
Source File: AbstractStyleEditorDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
public AbstractStyleEditorDialog(Shell parent) {
	super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
}
 
Example 19
Source File: FindReplaceDialog.java    From pmTrans with GNU Lesser General Public License v3.0 4 votes vote down vote up
public FindReplaceDialog(Shell parent, StyledText text) {
	super(parent, SWT.DIALOG_TRIM);
	this.text = text;
}
 
Example 20
Source File: HopGui.java    From hop with 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();
}