~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetConfigurationDialog.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2009 QNX Software Systems and others.
 
3
 * All rights reserved. This program and the accompanying materials
 
4
 * are made available under the terms of the Eclipse Public License v1.0
 
5
 * which accompanies this distribution, and is available at
 
6
 * http://www.eclipse.org/legal/epl-v10.html
 
7
 *
 
8
 * Contributors:
 
9
 *     QNX Software Systems - initial API and implementation
 
10
 *******************************************************************************/
 
11
 
 
12
package org.eclipse.cdt.internal.ui.workingsets;
 
13
 
 
14
import org.eclipse.jface.dialogs.IDialogConstants;
 
15
import org.eclipse.jface.dialogs.TrayDialog;
 
16
import org.eclipse.jface.window.IShellProvider;
 
17
import org.eclipse.swt.SWT;
 
18
import org.eclipse.swt.layout.GridData;
 
19
import org.eclipse.swt.widgets.Composite;
 
20
import org.eclipse.swt.widgets.Control;
 
21
import org.eclipse.swt.widgets.Shell;
 
22
 
 
23
/**
 
24
 * A dialog for management of working set configurations. These collect the selection of project
 
25
 * configurations for the member projects of the working sets into named presets.
 
26
 * 
 
27
 * @author Christian W. Damus (cdamus)
 
28
 * 
 
29
 * @since 6.0
 
30
 */
 
31
public class WorkingSetConfigurationDialog extends TrayDialog {
 
32
 
 
33
        private WorkingSetConfigurationBlock block;
 
34
 
 
35
        /**
 
36
         * Initializes me with my shell.
 
37
         * 
 
38
         * @param shell
 
39
         */
 
40
        public WorkingSetConfigurationDialog(Shell shell) {
 
41
                super(shell);
 
42
        }
 
43
 
 
44
        /**
 
45
         * Initializes me with my shell provider.
 
46
         * 
 
47
         * @param parentShell
 
48
         */
 
49
        public WorkingSetConfigurationDialog(IShellProvider parentShell) {
 
50
                super(parentShell);
 
51
        }
 
52
 
 
53
        @Override
 
54
        protected boolean isResizable() {
 
55
                return true;
 
56
        }
 
57
 
 
58
        @Override
 
59
        protected void configureShell(Shell newShell) {
 
60
                setHelpAvailable(false);
 
61
 
 
62
                super.configureShell(newShell);
 
63
 
 
64
                newShell.setText(WorkingSetMessages.WSConfigDialog_title);
 
65
        }
 
66
 
 
67
        @Override
 
68
        protected Control createDialogArea(Composite parent) {
 
69
                Composite result = (Composite) super.createDialogArea(parent);
 
70
 
 
71
                block = new WorkingSetConfigurationBlock(WorkingSetConfigurationManager.getDefault()
 
72
                                .createWorkspaceSnapshot());
 
73
                Control contents = block.createContents(result);
 
74
                contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
 
75
 
 
76
                return result;
 
77
        }
 
78
 
 
79
        @Override
 
80
        protected void buttonPressed(int buttonId) {
 
81
                if (buttonId == IDialogConstants.OK_ID) {
 
82
                        if (!block.build()) {
 
83
                                // user cancelled: don't save, and don't close the dialog
 
84
                                return;
 
85
                        }
 
86
 
 
87
                        block.save();
 
88
                }
 
89
 
 
90
                super.buttonPressed(buttonId);
 
91
        }
 
92
}