Java 类org.eclipse.swt.widgets.Dialog 实例源码

项目:proclipsing    文件:PathAndLibrariesSelectionDrawer.java   
public void drawProcessingAppFinder(final Composite composite, 
        final String processingPath, final List<String> selectedLibs ) {

    Listener buttonListener = new Listener() {
        public void handleEvent(Event event) {
            Dialog dialog = OS.helper().getDialog(composite.getShell());

            if(dialog instanceof FileDialog)
                processing_app_path_text.setText(((FileDialog)dialog).open());
            else if(dialog instanceof DirectoryDialog)
                processing_app_path_text.setText(((DirectoryDialog)dialog).open());

        }
    };

    ModifyListener textModifyListener = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validate_listener.validate();
            showDiscoveredLibraries((Text)e.getSource(), baselibs_viewer, true);
            setSelectedLibs(baselibs_viewer, selectedLibs);
        }
    };

    processing_app_path_text = drawDirFinder(composite, 
            PROCESSING_APP_PATH_LABEL, processingPath, buttonListener, textModifyListener);
}
项目:logbook    文件:LayoutLogic.java   
/**
 * Shellのウインドウ位置とサイズを読み込み適用します
 * 
 * @param clazz ウインドウクラス
 * @param shell Shell
 */
public static void applyWindowLocation(Class<? extends Dialog> clazz, Shell shell) {
    Map<String, WindowLocationBean> map = AppConfig.get().getWindowLocationMap();
    WindowLocationBean location;
    synchronized (map) {
        location = map.get(clazz.getName());
    }
    if (location != null) {
        if ((location.getWidth() > 0) && (location.getHeight() > 0)) {
            shell.setLocation(location.getX(), location.getY());
            shell.setSize(location.getWidth(), location.getHeight());
        }
    }
}
项目:logbook    文件:LayoutLogic.java   
/**
 * Shellのウインドウ位置とサイズを保存します
 * 
 * @param clazz ウインドウクラス
 * @param shell Shell
 */
public static void saveWindowLocation(Class<? extends Dialog> clazz, Shell shell) {
    Map<String, WindowLocationBean> map = AppConfig.get().getWindowLocationMap();
    Point location = shell.getLocation();
    Point size = shell.getSize();
    WindowLocationBean wlocation = new WindowLocationBean();
    wlocation.setX(location.x);
    wlocation.setY(location.y);
    wlocation.setWidth(size.x);
    wlocation.setHeight(size.y);
    synchronized (map) {
        map.put(clazz.getName(), wlocation);
    }
}
项目:logbookpn    文件:LayoutLogic.java   
/**
 * Shellのウインドウ位置とサイズを読み込み適用します
 * 
 * @param clazz ウインドウクラス
 * @param shell Shell
 */
public static void applyWindowLocation(Class<? extends Dialog> clazz, Shell shell) {
    Map<String, WindowLocationBean> map = AppConfig.get().getWindowLocationMap();
    WindowLocationBean location;
    synchronized (map) {
        location = map.get(clazz.getName());
    }
    if (location != null) {
        if ((location.getWidth() > 0) && (location.getHeight() > 0)) {
            shell.setLocation(location.getX(), location.getY());
            shell.setSize(location.getWidth(), location.getHeight());
        }
    }
}
项目:logbookpn    文件:LayoutLogic.java   
/**
 * Shellのウインドウ位置とサイズを保存します
 * 
 * @param clazz ウインドウクラス
 * @param shell Shell
 */
public static void saveWindowLocation(Class<? extends Dialog> clazz, Shell shell) {
    Map<String, WindowLocationBean> map = AppConfig.get().getWindowLocationMap();
    Point location = shell.getLocation();
    Point size = shell.getSize();
    WindowLocationBean wlocation = new WindowLocationBean();
    wlocation.setX(location.x);
    wlocation.setY(location.y);
    wlocation.setWidth(size.x);
    wlocation.setHeight(size.y);
    synchronized (map) {
        map.put(clazz.getName(), wlocation);
    }
}
项目:logbook-EN    文件:LayoutLogic.java   
/**
 * Shellのウインドウ位置とサイズを読み込み適用します
 * 
 * @param clazz ウインドウクラス
 * @param shell Shell
 */
public static void applyWindowLocation(Class<? extends Dialog> clazz, Shell shell) {
    Map<String, WindowLocationBean> map = AppConfig.get().getWindowLocationMap();
    WindowLocationBean location;
    synchronized (map) {
        location = map.get(clazz.getName());
    }
    if (location != null) {
        if ((location.getWidth() > 0) && (location.getHeight() > 0)) {
            shell.setLocation(location.getX(), location.getY());
            shell.setSize(location.getWidth(), location.getHeight());
        }
    }
}
项目:logbook-EN    文件:LayoutLogic.java   
/**
 * Shellのウインドウ位置とサイズを保存します
 * 
 * @param clazz ウインドウクラス
 * @param shell Shell
 */
public static void saveWindowLocation(Class<? extends Dialog> clazz, Shell shell) {
    Map<String, WindowLocationBean> map = AppConfig.get().getWindowLocationMap();
    Point location = shell.getLocation();
    Point size = shell.getSize();
    WindowLocationBean wlocation = new WindowLocationBean();
    wlocation.setX(location.x);
    wlocation.setY(location.y);
    wlocation.setWidth(size.x);
    wlocation.setHeight(size.y);
    synchronized (map) {
        map.put(clazz.getName(), wlocation);
    }
}
项目:proclipsing    文件:ProclipsingPreferencePage.java   
public void drawProcessingAppFinder(final Composite composite) {

        Label processingPathLabel = new Label(composite, SWT.NONE);
        processingPathLabel.setText(PROCESSING_APP_PATH_LABEL);    

        GridData gd1 = new GridData();
        gd1.widthHint = LABEL_WIDTH_HINT;
        gd1.horizontalSpan = 2;
        gd1.horizontalAlignment = SWT.BEGINNING;
        processingPathLabel.setLayoutData(gd1);

        processing_app_path_text = new Text(composite, SWT.NONE | SWT.BORDER );
        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.widthHint = PATH_TEXT_WIDTH_HINT;
        processing_app_path_text.setLayoutData(gd);        

        Button button = new Button(composite, SWT.PUSH);
        button.setText(DIR_SEARCH_BUTTON_LABEL);
        button.addListener(SWT.Selection, new Listener() {
            public void handleEvent(Event event) {
            Dialog dialog = OS.helper().getDialog(composite.getShell());

            if(dialog instanceof FileDialog)
                processing_app_path_text.setText(((FileDialog)dialog).open());
            else if(dialog instanceof DirectoryDialog)
                processing_app_path_text.setText(((DirectoryDialog)dialog).open());

            }
        });        
    }
项目:RouterLogger    文件:AboutDialog.java   
private void createContents(final Shell shell) {
    shell.setLayout(new GridLayout(2, false));

    final Label icon = new Label(shell, SWT.NONE);
    icon.setImage(Images.getMainIcons()[6]);
    GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 3);
    icon.setLayoutData(gridData);

    final Label info = new Label(shell, SWT.NONE);
    info.setText(this.message);
    gridData = new GridData(SWT.LEAD, SWT.CENTER, false, true);
    info.setLayoutData(gridData);

    final Link linkProject = new Link(shell, SWT.NONE);
    linkProject.setText("<a href=\"" + getApplicationUrl() + "\">" + getApplicationUrl() + "</a>");
    gridData = new GridData(SWT.LEAD, SWT.CENTER, false, true);
    linkProject.setLayoutData(gridData);
    linkProject.addSelectionListener(new LinkSelectionListener());

    final Link linkIcon = new Link(shell, SWT.NONE);
    String url = getIconUrl().startsWith("http") ? getIconUrl() : "http://" + getIconUrl();
    linkIcon.setText(Messages.get("msg.info.icon") + " <a href=\"" + url + "\">" + getIconUrl() + "</a>");
    gridData = new GridData(SWT.LEAD, SWT.CENTER, false, true);
    linkIcon.setLayoutData(gridData);
    linkIcon.addSelectionListener(new LinkSelectionListener());

    final Button okButton = new Button(shell, SWT.PUSH);
    okButton.setText(Messages.get("lbl.button.ok"));
    final GC gc = new GC(okButton);
    gc.setFont(okButton.getFont());
    final int buttonWidth = org.eclipse.jface.dialogs.Dialog.convertHorizontalDLUsToPixels(gc.getFontMetrics(), IDialogConstants.BUTTON_WIDTH);
    gc.dispose();
    GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, false).span(2, 1).minSize(buttonWidth, SWT.DEFAULT).applyTo(okButton);
    okButton.setFocus();
    okButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            shell.close();
        }
    });
    shell.setDefaultButton(okButton);
}
项目:CyclesMod    文件:AboutDialog.java   
private void createContents(final Shell shell) {
    shell.setLayout(new GridLayout(2, false));

    final Label icon = new Label(shell, SWT.NONE);
    icon.setImage(Images.getMainIcons()[5]);
    GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false, 0, 3);
    icon.setLayoutData(gridData);

    final Label info = new Label(shell, SWT.NONE);
    info.setText(this.message);
    gridData = new GridData(SWT.LEAD, SWT.CENTER, false, true);
    info.setLayoutData(gridData);

    final Link linkProject = new Link(shell, SWT.NONE);
    linkProject.setText("<a href=\"" + getApplicationUrl() + "\">" + getApplicationUrl() + "</a>");
    gridData = new GridData(SWT.LEAD, SWT.CENTER, false, true);
    linkProject.setLayoutData(gridData);
    linkProject.addSelectionListener(new LinkSelectionListener());

    final Link linkIcon = new Link(shell, SWT.NONE);
    String url = getIconUrl().startsWith("http") ? getIconUrl() : "http://" + getIconUrl();
    linkIcon.setText(Messages.get("msg.info.icon") + " <a href=\"" + url + "\">" + getIconUrl() + "</a>");
    gridData = new GridData(SWT.LEAD, SWT.CENTER, false, true);
    linkIcon.setLayoutData(gridData);
    linkIcon.addSelectionListener(new LinkSelectionListener());

    final Button okButton = new Button(shell, SWT.PUSH);
    okButton.setText(Messages.get("lbl.button.ok"));
    final GC gc = new GC(okButton);
    gc.setFont(okButton.getFont());
    final FontMetrics fontMetrics = gc.getFontMetrics();
    final int buttonWidth = org.eclipse.jface.dialogs.Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
    gc.dispose();
    GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, false).span(2, 1).minSize(buttonWidth, SWT.DEFAULT).applyTo(okButton);
    okButton.setFocus();
    okButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            shell.close();
        }
    });
    shell.setDefaultButton(okButton);
}
项目:vdt-plugin    文件:BrowseableField.java   
public Dialog getBrowseDialog() {
    return browseDialog;
}
项目:vdt-plugin    文件:BrowseableField.java   
public void setBrowseDialog(Dialog browseDialog) {
    this.browseDialog = browseDialog;
}
项目:proclipsing    文件:OSHelper.java   
public Dialog getDialog(Shell shell) {
        System.out.println("OS FILE DIALOG");
//        return new FileDialog(shell);
        return new DirectoryDialog(shell);
    }
项目:proclipsing    文件:MacOSHelper.java   
public Dialog getDialog(Shell shell) {
    return new FileDialog(shell);
}
项目:logbook    文件:SaveWindowLocationAdapter.java   
/**
 * コンストラクター
 *
 * @param dialogClass ウインドウ
 */
public SaveWindowLocationAdapter(Class<? extends Dialog> dialogClass) {
    this.dialogClass = dialogClass;
}
项目:logbookpn    文件:SaveWindowLocationAdapter.java   
/**
 * コンストラクター
 * 
 * @param dialog ウインドウ
 */
public SaveWindowLocationAdapter(Class<? extends Dialog> dialogClass) {
    this.dialogClass = dialogClass;
}
项目:logbook-EN    文件:SaveWindowLocationAdapter.java   
/**
 * コンストラクター
 * 
 * @param dialog ウインドウ
 */
public SaveWindowLocationAdapter(Class<? extends Dialog> dialogClass) {
    this.dialogClass = dialogClass;
}