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); }
/** * 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()); } } }
/** * 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); } }
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()); } }); }
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); }
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); }
public Dialog getBrowseDialog() { return browseDialog; }
public void setBrowseDialog(Dialog browseDialog) { this.browseDialog = browseDialog; }
public Dialog getDialog(Shell shell) { System.out.println("OS FILE DIALOG"); // return new FileDialog(shell); return new DirectoryDialog(shell); }
public Dialog getDialog(Shell shell) { return new FileDialog(shell); }
/** * コンストラクター * * @param dialogClass ウインドウ */ public SaveWindowLocationAdapter(Class<? extends Dialog> dialogClass) { this.dialogClass = dialogClass; }
/** * コンストラクター * * @param dialog ウインドウ */ public SaveWindowLocationAdapter(Class<? extends Dialog> dialogClass) { this.dialogClass = dialogClass; }