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

The following examples show how to use org.eclipse.swt.SWT#RESIZE . 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: PipelineRunConfigurationDialog.java    From hop with Apache License 2.0 7 votes vote down vote up
public static void main( String[] args ) throws HopException {
  Display display = new Display();
  Shell shell = new Shell( display, SWT.MIN | SWT.MAX | SWT.RESIZE );

  HopClientEnvironment.init();
  HopEnvironment.init();
  HopGuiEnvironment.init();
  // LocalWorkflowRunConfiguration localConfig = new LocalWorkflowRunConfiguration( "Local", "Local pipeline engine", "5000" );
  PipelineRunConfiguration configuration = new PipelineRunConfiguration( "test", "A test run config", new ArrayList<>(), null );
  PipelineRunConfigurationDialog dialog = new PipelineRunConfigurationDialog( shell, null, configuration );
  String name = dialog.open();
  if ( name != null ) {
    // Re-open with a new dialog...
    //
    PipelineRunConfigurationDialog newDialog = new PipelineRunConfigurationDialog( shell, null, configuration );
    newDialog.open();
  }

  display.dispose();
}
 
Example 2
Source File: BaseMdiEntry.java    From BiglyBT with GNU General Public License v2.0 6 votes vote down vote up
public static SkinnedDialog buildSkinnedDialog(String id, Object ds,
	UISWTViewBuilderCore builder) {
	SkinnedDialog skinnedDialog = new SkinnedDialog("skin3_dlg_sidebar_popout",
		"shell", null, // standalone
		SWT.RESIZE | SWT.MAX | SWT.DIALOG_TRIM);

	SWTSkin skin = skinnedDialog.getSkin();

	SWTSkinObjectContainer so = (SWTSkinObjectContainer) skin.getSkinObject(
		"content-area");
	SWTSkinObjectContainer cont = BaseMdiEntry.buildStandAlone(so, null,
		SWTSkinFactory.getInstance(), id, ds, 0, builder);

	if (cont == null) {
		skinnedDialog.close();
		return null;
	}

	return skinnedDialog;
}
 
Example 3
Source File: KettleDatabaseRepositoryDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public KettleDatabaseRepositoryDialog( Shell parent, int style,
                                       RepositoryMeta repositoryMeta,
                                       RepositoriesMeta repositoriesMeta ) {
  this.display = parent.getDisplay();
  this.props = PropsUI.getInstance();
  this.input = (KettleDatabaseRepositoryMeta) repositoryMeta;
  this.repositories = repositoriesMeta;
  this.masterRepositoriesMeta = repositoriesMeta.clone();
  this.masterRepositoryName = repositoryMeta.getName();

  shell =
      new Shell( parent, style | SWT.DIALOG_TRIM | SWT.RESIZE
              | SWT.MAX | SWT.MIN | SWT.APPLICATION_MODAL | SWT.SHEET );
  shell.setText( BaseMessages.getString( PKG, "RepositoryDialog.Dialog.Main.Title" ) );

}
 
Example 4
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 5
Source File: ActionPipelineDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
public IAction open() {
    Shell parent = getParent();
    display = parent.getDisplay();

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

    backupChanged = action.hasChanged();

    createElements();

    // Detect [X] or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {
        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });

    getData();
    setActive();

    BaseTransformDialog.setSize(shell);

    int width = 750;
    int height = Const.isWindows() ? 730 : 720;

    shell.setSize(width, height);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return action;
}
 
Example 6
Source File: CommonStepDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
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.RESIZE | SWT.MAX | SWT.MIN );
    props.setLook( shell );
    setShellImage( shell, meta );
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener( new ShellAdapter() {
      @Override
      public void shellClosed( ShellEvent e ) {
        cancel();
      }
    } );

    changed = meta.hasChanged();

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

    shell.setLayout( formLayout );
    shell.setText( getTitle() );
    return display;
  }
 
Example 7
Source File: LifecycleEnvironmentDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
public LifecycleEnvironmentDialog( Shell parent, LifecycleEnvironment environment, IVariables variables ) {
  super( parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE );

  this.environment = environment;
  this.variables = variables;

  props = PropsUi.getInstance();
}
 
Example 8
Source File: TextFileInputDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void getFixed() {
  TextFileInputMeta info = new TextFileInputMeta();
  getInfo( info, true );

  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 ( TextFileInputFieldInterface field1 : fields ) {
          BaseFileField field = (BaseFileField) 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 9
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();
}
 
Example 10
Source File: ElasticSearchBulkDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public String open() {
  Shell parent = getParent();
  Display display = parent.getDisplay();

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

  lsMod = new ModifyListener() {

    public void modifyText( ModifyEvent e ) {
      model.setChanged();
    }
  };

  changed = model.hasChanged();

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

  shell.setLayout( formLayout );
  shell.setText( BaseMessages.getString( PKG, "ElasticSearchBulkDialog.DialogTitle" ) );

  int middle = props.getMiddlePct();
  int margin = Const.MARGIN;

  // Stepname line
  wlStepname = new Label( shell, SWT.RIGHT );
  wlStepname.setText( BaseMessages.getString( PKG, "System.Label.StepName" ) );
  props.setLook( wlStepname );
  fdlStepname = new FormData();
  fdlStepname.left = new FormAttachment( 0, 0 );
  fdlStepname.top = new FormAttachment( 0, margin );
  fdlStepname.right = new FormAttachment( middle, -margin );
  wlStepname.setLayoutData( fdlStepname );
  wStepname = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  wStepname.setText( stepname );
  props.setLook( wStepname );
  wStepname.addModifyListener( lsMod );
  fdStepname = new FormData();
  fdStepname.left = new FormAttachment( middle, 0 );
  fdStepname.top = new FormAttachment( 0, margin );
  fdStepname.right = new FormAttachment( 100, 0 );
  wStepname.setLayoutData( fdStepname );

  wTabFolder = new CTabFolder( shell, SWT.BORDER );
  props.setLook( wTabFolder, Props.WIDGET_STYLE_TAB );

  // GENERAL TAB
  addGeneralTab();

  // Servers TAB
  addServersTab();

  // Fields TAB
  addFieldsTab();

  // Settings TAB
  addSettingsTab();

  // ////////////
  // BUTTONS //
  // //////////
  wOK = new Button( shell, SWT.PUSH );
  wOK.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
  wCancel = new Button( shell, SWT.PUSH );
  wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );

  setButtonPositions( new Button[]{wOK, wCancel}, margin, null );

  fdTabFolder = new FormData();
  fdTabFolder.left = new FormAttachment( 0, 0 );
  fdTabFolder.top = new FormAttachment( wStepname, margin );
  fdTabFolder.right = new FormAttachment( 100, 0 );
  fdTabFolder.bottom = new FormAttachment( wOK, -margin );
  wTabFolder.setLayoutData( fdTabFolder );

  // //////////////////
  // Std Listeners //
  // ////////////////
  addStandardListeners();

  wTabFolder.setSelection( 0 );

  // Set the shell size, based upon previous time...
  setSize();
  getData( model );
  model.setChanged( changed );

  shell.open();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
  return stepname;
}
 
Example 11
Source File: TipDayEx.java    From SWET with MIT License 4 votes vote down vote up
public void open(final Shell parent, Display... parentDisplay) {
	if (TipDayEx.index == -1) {
		TipDayEx.index = new Random().nextInt(this.tips.size());
	}
	this.shell = new Shell(parent,
			SWT.SYSTEM_MODAL | SWT.TITLE | SWT.BORDER | SWT.CLOSE | SWT.RESIZE);
	this.shell.setText("Tip of the day");
	this.shell.setLayout(new GridLayout(2, false));

	this.shell.addListener(SWT.Traverse, new Listener() {
		@Override
		public void handleEvent(final Event event) {
			switch (event.detail) {
			case SWT.TRAVERSE_ESCAPE:
				TipDayEx.this.shell.dispose();
				event.detail = SWT.TRAVERSE_NONE;
				event.doit = false;
				break;
			}
		}
	});
	buildLeftColumn();
	buildTip();
	buildButtons();

	this.shell.setDefaultButton(this.buttonClose);
	this.shell.pack();
	this.shell.open();

	if (parentDisplay != null) {
		display = parentDisplay[0];
	} else {

		display = this.shell.getDisplay();
	}
	Monitor primary = display.getPrimaryMonitor();
	Rectangle bounds = primary.getBounds();
	Rectangle rect = shell.getBounds();

	int x = bounds.x + (bounds.width - rect.width) / 2;
	int y = bounds.y + (bounds.height - rect.height) / 2;

	shell.setLocation(x, y);

	while (!this.shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}
 
Example 12
Source File: CalcExpDialog.java    From logbook with MIT License 4 votes vote down vote up
/**
 * Create the dialog.
 * @param parent
 */
public CalcExpDialog(Shell parent) {
    super(parent, SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.RESIZE);
    this.setText("経験値計算機");
}
 
Example 13
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 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, true );

  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 ) {
          BaseFileField field = (BaseFileField) 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: ExpressionBuilder.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected void setShellStyle( int newShellStyle )
{
	newShellStyle |= SWT.MAX | SWT.RESIZE;
	super.setShellStyle( newShellStyle );
}
 
Example 16
Source File: ExtendedItemFilterDialog.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 17
Source File: QuickOutlinePopup.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public QuickOutlinePopup(Shell parent) {
	super(parent, SWT.RESIZE, true, false, true, true, true, null, Messages.QuickOutlinePopup_pressESC);
}
 
Example 18
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 19
Source File: InspectBlockDialog.java    From offspring with MIT License 4 votes vote down vote up
@Override
protected void setShellStyle(int newShellStyle) {
  super.setShellStyle(SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE
      | SWT.RESIZE);
  setBlockOnOpen(false);
}
 
Example 20
Source File: CustomAbstractInformationControl.java    From APICloud-Studio with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Creates an abstract information control with the given shell as parent.
 * <p>
 * <em>Important: Subclasses are required to call {@link #create()} at the end of their constructor.</em>
 * </p>
 * 
 * @param parentShell
 *            the parent of this control's shell
 * @param isResizable
 *            <code>true</code> if the control should be resizable
 */
public CustomAbstractInformationControl(Shell parentShell, boolean isResizable)
{
	this(parentShell, SWT.TOOL | SWT.ON_TOP | (isResizable ? SWT.RESIZE : 0), null, null);
}