|
From: Matthias K <mat...@us...> - 2006-04-16 21:45:43
|
Update of /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4069/src/org/jcommander/ui/filepanel/dialogs Modified Files: DeleteConfirmDialogComposite.java Added Files: CustomConfirmDialogComposite.java Log Message: Changed Layout, added details view. --- NEW FILE: CustomConfirmDialogComposite.java --- /** * */ package org.jcommander.ui.filepanel.dialogs; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.internal.progress.ProgressMessages; /** * @author MatthiasK * */ public class CustomConfirmDialogComposite extends Composite { private Composite mainComposite = null; private Composite buttonsComposite = null; private Composite detailsComposite = null; private Composite detailsContent = null; private Button yesButton = null; private Button noButton = null; private Button detailsButton = null; private GridData detailsData = null; private int detailsHeight = 0; /** * @param parent * @param style */ public CustomConfirmDialogComposite(Composite parent, int style) { super(parent, style); initialize(); } private void initialize(){ createMainContent(this); createButtonsComposite(); //mainComposite.setLayout(new GridLayout()); this.setLayout(new GridLayout()); } private void createButtonsComposite(){ detailsComposite = new Composite(this, SWT.NONE); detailsData=new GridData(); detailsData.horizontalAlignment=SWT.FILL; //detailsData.grabExcessHorizontalSpace=true; GridLayout detailsLayout = new GridLayout(); detailsLayout.marginWidth=0; detailsComposite.setLayout(detailsLayout); detailsComposite.setLayoutData(detailsData); GridLayout gridLayout3 = new GridLayout(); GridData gridData2 = new GridData(); buttonsComposite = new Composite(this, SWT.NONE); Label fillLabel = new Label(buttonsComposite, SWT.NONE); GridData gridDataFill = new GridData(); gridDataFill.grabExcessHorizontalSpace=true; gridDataFill.minimumWidth=200; fillLabel.setLayoutData(gridDataFill); yesButton = new Button(buttonsComposite, SWT.NONE); noButton = new Button(buttonsComposite, SWT.NONE); gridData2.grabExcessHorizontalSpace = true; gridData2.horizontalAlignment = org.eclipse.swt.layout.GridData.END; gridData2.verticalAlignment = org.eclipse.swt.layout.GridData.END; buttonsComposite.setLayoutData(gridData2); buttonsComposite.setLayout(gridLayout3); gridLayout3.numColumns = 4; gridLayout3.marginHeight = 1; gridLayout3.marginWidth = 1; yesButton.setText("&Yes"); // GridLayout buttonLayout1 = new GridLayout(); GridData l1 = new GridData(); //l1.horizontalAlignment=SWT.FILL; l1.grabExcessHorizontalSpace=true; l1.minimumWidth=75; yesButton.setLayoutData(l1); GridData l2 = new GridData(); l2.grabExcessHorizontalSpace=true; //l2.horizontalAlignment=SWT.FILL; l2.minimumWidth=75; noButton.setText("&No"); noButton.setLayoutData(l2); detailsButton = new Button(buttonsComposite, SWT.NONE); GridData detailsButtonData = new GridData(); detailsButtonData.minimumWidth=75; detailsButton.setText(ProgressMessages.ProgressMonitorJobsDialog_DetailsTitle); detailsButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { super.widgetSelected(e); Shell shell = getShell(); Point shellSize = shell.getSize(); Composite composite = buttonsComposite.getParent(); if (detailsContent != null) { detailsContent.dispose(); detailsContent = null; composite.layout(); shell.setSize(shellSize.x, shellSize.y -detailsHeight); detailsButton.setText(ProgressMessages.ProgressMonitorJobsDialog_DetailsTitle); } else { //Abort if there are no jobs visible /*if (ProgressManager.getInstance().getRootElements(Policy.DEBUG_SHOW_SYSTEM_JOBS).length == 0) { detailsButton.setEnabled(false); return; }*/ detailsContent = new Composite(detailsComposite, SWT.NONE|SWT.BORDER); //detailsContent.setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE)); GridData detailsCData = new GridData(); detailsCData.horizontalAlignment=SWT.FILL; detailsCData.grabExcessHorizontalSpace=true; //detailsCData.height=200; detailsContent.setLayoutData(detailsCData); detailsContent.setLayout(new RowLayout()); createDetailsContent(detailsContent); /*Button b = new Button(detailsContent, SWT.NONE); b.setText("b");*/ detailsComposite.layout(true); detailsContent.setVisible(true); detailsButton.setText(ProgressMessages.ProgressMonitorJobsDialog_HideTitle); //b.setVisible(true); composite.layout(true); Point p = detailsContent.getSize(); detailsHeight = p.y; shell.setSize(shellSize.x, shellSize.y+detailsHeight); shell.pack(); } } }); } protected void createDetailsContent(Composite parent){ } protected void createMainContent(Composite parent){ } public Button getYesButton() { return yesButton; } public Button getNoButton() { return noButton; } } Index: DeleteConfirmDialogComposite.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/dialogs/DeleteConfirmDialogComposite.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DeleteConfirmDialogComposite.java 3 Jan 2006 17:57:59 -0000 1.9 --- DeleteConfirmDialogComposite.java 16 Apr 2006 21:45:38 -0000 1.10 *************** *** 7,15 **** import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.resource.*; - import org.eclipse.swt.*; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.*; - import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.eclipse.swt.SWT; --- 7,13 ---- *************** *** 24,50 **** * @author sky_halud */ ! public class DeleteConfirmDialogComposite extends Composite { private Label label = null; private Composite infoComposite = null; private Composite listComposite = null; ! private Composite buttonsComposite = null; ! private Button removeFileButton = null; ! private Button yesButton = null; ! private Button noButton = null; ! private List deleteFileList = null; ! private Button moveToRecycle = null; private Label trashLabel = null; public DeleteConfirmDialogComposite(Composite parent, int style) { super(parent, style); - initialize(); - } - - private void initialize() { - createInfoComposite(); - createButtonsComposite(); - this.setLayout(new GridLayout()); - setSize(new org.eclipse.swt.graphics.Point(314, 172)); } --- 22,38 ---- * @author sky_halud */ ! public class DeleteConfirmDialogComposite extends CustomConfirmDialogComposite{ private Label label = null; private Composite infoComposite = null; private Composite listComposite = null; ! private List deleteFileList; ! private Button moveToRecycleButton = null; private Label trashLabel = null; + private boolean moveToRecycle; + public DeleteConfirmDialogComposite(Composite parent, int style) { super(parent, style); } *************** *** 61,68 **** --- 49,58 ---- gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.FILL; gridData1.grabExcessVerticalSpace = true; + gridData1.heightHint=60; gridData2.horizontalAlignment = org.eclipse.swt.layout.GridData.END; gridData2.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING; GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; + gridLayout.marginWidth=0; listComposite = new Composite(info, SWT.NONE); listComposite.setLayoutData(gridData); *************** *** 70,93 **** deleteFileList = new List(listComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); deleteFileList.setLayoutData(gridData1); ! removeFileButton = new Button(listComposite, SWT.NONE); ! removeFileButton.setLayoutData(gridData2); ! removeFileButton.setText("&Remove"); ! ! removeFileButton.addSelectionListener(new SelectionAdapter() { ! public void widgetSelected(SelectionEvent e) { ! int [] indices = deleteFileList.getSelectionIndices(); ! deleteFileList.remove(indices); ! ! if(deleteFileList.getItemCount() == 0) { ! /** Nothing to delete. Disabling controls */ ! removeFileButton.setEnabled(false); ! yesButton.setEnabled(false); ! deleteFileList.setEnabled(false); ! } ! } ! }); } ! private void createInfoComposite() { GridLayout gridLayout1 = new GridLayout(); gridLayout1.numColumns = 1; --- 60,84 ---- deleteFileList = new List(listComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); deleteFileList.setLayoutData(gridData1); ! // removeFileButton = new Button(listComposite, SWT.NONE); ! // removeFileButton.setLayoutData(gridData2); ! // removeFileButton.setText("&Remove"); ! // ! // removeFileButton.addSelectionListener(new SelectionAdapter() { ! // public void widgetSelected(SelectionEvent e) { ! // int [] indices = deleteFileList.getSelectionIndices(); ! // deleteFileList.remove(indices); ! // ! // if(deleteFileList.getItemCount() == 0) { ! // /** Nothing to delete. Disabling controls */ ! // removeFileButton.setEnabled(false); ! // yesButton.setEnabled(false); ! // deleteFileList.setEnabled(false); ! // } ! // } ! // }); } ! @Override ! protected void createMainContent(Composite parent) { GridLayout gridLayout1 = new GridLayout(); gridLayout1.numColumns = 1; *************** *** 95,103 **** GridData gridData1 = new GridData(); ! infoComposite = new Composite(this, SWT.NONE); ! gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.CENTER; gridData1.grabExcessHorizontalSpace = true; gridData1.grabExcessVerticalSpace = true; ! label = new Label(this, SWT.NONE); label.setText("Delete selected files?"); label.setLayoutData(gridData1); --- 86,96 ---- GridData gridData1 = new GridData(); ! label = new Label(parent, SWT.NONE); ! ! infoComposite = new Composite(parent, SWT.NONE); ! //gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.CENTER; gridData1.grabExcessHorizontalSpace = true; gridData1.grabExcessVerticalSpace = true; ! label.setText("Delete selected files?"); label.setLayoutData(gridData1); *************** *** 105,111 **** createListComposite(infoComposite); ! Composite trashComposite = new Composite(infoComposite, SWT.NONE); ! trashComposite.setLayout(new RowLayout()); trashLabel = new Label(trashComposite, SWT.NONE); trashLabel.setText(""); --- 98,126 ---- createListComposite(infoComposite); ! moveToRecycle = ((FilePanelPlugin.getDefault().getPreferenceStore()). ! getBoolean(FilePanelPlugin.MOVE_TO_RECYCLE_KEY)); ! ! gridData2.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL; ! gridData2.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER; ! gridData2.grabExcessHorizontalSpace = true; ! gridData2.grabExcessVerticalSpace = true; ! gridLayout1.marginWidth=0; ! infoComposite.setLayoutData(gridData2); ! infoComposite.setLayout(gridLayout1); ! } ! ! @Override ! protected void createDetailsContent(Composite parent) { ! //Button b = new Button(parent, SWT.NONE); ! Composite trashComposite = new Composite(parent, SWT.NONE); ! GridLayout trashLayout = new GridLayout(); + trashLayout.numColumns=2; + trashComposite.setLayout(trashLayout); + + GridData trashData1 = new GridData(); + GridData trashData2 = new GridData(); + trashData1.verticalAlignment=SWT.CENTER; + trashData2.verticalAlignment=SWT.CENTER; trashLabel = new Label(trashComposite, SWT.NONE); trashLabel.setText(""); *************** *** 113,130 **** Image trashImg = imgDesc.createImage(getDisplay()); trashLabel.setImage(trashImg); ! ! moveToRecycle = new Button(trashComposite, SWT.CHECK); if(Platform.getOS().equals(Platform.OS_WIN32)) { ! moveToRecycle.setText("&Move to the recycle bin"); ! moveToRecycle.setToolTipText("Moved deleted files to the recycle bin"); } else { ! moveToRecycle.setText("&Move to the trash"); ! moveToRecycle.setToolTipText("Moved deleted files to the trash"); } ! moveToRecycle.setSelection((FilePanelPlugin.getDefault().getPreferenceStore()). ! getBoolean(FilePanelPlugin.MOVE_TO_RECYCLE_KEY)); ! moveToRecycle. addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { --- 128,145 ---- Image trashImg = imgDesc.createImage(getDisplay()); trashLabel.setImage(trashImg); ! trashLabel.setLayoutData(trashData1); ! ! moveToRecycleButton = new Button(trashComposite, SWT.CHECK); if(Platform.getOS().equals(Platform.OS_WIN32)) { ! moveToRecycleButton.setText("&Move to the recycle bin"); ! moveToRecycleButton.setToolTipText("Moved deleted files to the recycle bin"); } else { ! moveToRecycleButton.setText("&Move to the trash"); ! moveToRecycleButton.setToolTipText("Moved deleted files to the trash"); } ! moveToRecycleButton.setSelection(moveToRecycle); ! moveToRecycleButton. addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { *************** *** 138,175 **** } }); ! gridData2.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL; ! gridData2.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER; ! gridData2.grabExcessHorizontalSpace = true; ! gridData2.grabExcessVerticalSpace = true; ! infoComposite.setLayoutData(gridData2); ! infoComposite.setLayout(gridLayout1); ! } ! /** ! * This method initializes composite ! */ ! private void createButtonsComposite() { ! GridLayout gridLayout3 = new GridLayout(); ! GridData gridData2 = new GridData(); ! buttonsComposite = new Composite(this, SWT.NONE); ! yesButton = new Button(buttonsComposite, SWT.NONE); ! noButton = new Button(buttonsComposite, SWT.NONE); ! gridData2.grabExcessHorizontalSpace = true; ! gridData2.horizontalAlignment = org.eclipse.swt.layout.GridData.CENTER; ! gridData2.verticalAlignment = org.eclipse.swt.layout.GridData.END; ! buttonsComposite.setLayoutData(gridData2); ! buttonsComposite.setLayout(gridLayout3); ! gridLayout3.numColumns = 2; ! gridLayout3.marginHeight = 1; ! gridLayout3.marginWidth = 1; ! yesButton.setText("&Yes"); ! noButton.setText("&No"); ! } ! ! public Button getNoButton() { ! return noButton; ! } ! ! public Button getYesButton() { ! return yesButton; } --- 153,157 ---- } }); ! moveToRecycleButton.setLayoutData(trashData2); } *************** *** 179,187 **** private void toggleEnableMoveToRecycle(boolean value) { ! moveToRecycle.setEnabled(value); } private void setMoveToRecycle(boolean value) { ! moveToRecycle.setSelection(value); } --- 161,177 ---- private void toggleEnableMoveToRecycle(boolean value) { ! if (moveToRecycleButton!=null) ! { ! moveToRecycleButton.setEnabled(value); ! } } private void setMoveToRecycle(boolean value) { ! IPreferenceStore store = FilePanelPlugin.getDefault().getPreferenceStore(); ! store.setValue(FilePanelPlugin.MOVE_TO_RECYCLE_KEY,value); ! if (moveToRecycleButton!=null) ! { ! moveToRecycleButton.setSelection(value); ! } } *************** *** 192,196 **** public boolean getMoveToRecycle() { ! return moveToRecycle.getSelection(); } } // @jve:decl-index=0:visual-constraint="10,10" --- 182,186 ---- public boolean getMoveToRecycle() { ! return moveToRecycle; } } // @jve:decl-index=0:visual-constraint="10,10" |