Java 类org.eclipse.swt.events.DisposeListener 实例源码

项目:n4js    文件:PackageJsonComparePage.java   
private Control createPreviewer(Composite parent) {
    final CompareConfiguration compareConfiguration = new CompareConfiguration();
    compareConfiguration.setLeftLabel("Original package.json");
    compareConfiguration.setLeftEditable(false);
    compareConfiguration.setRightLabel("Merged package.json");
    compareConfiguration.setRightEditable(false);
    compareConfiguration.setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.FALSE);

    fViewer = new TextMergeViewer(parent, SWT.NONE, compareConfiguration);
    // add initial input in order to avoid problems when disposing the viewer later:
    fViewer.setInput(new DiffNode(new DiffElementFromString(""), new DiffElementFromString("")));

    Control control = fViewer.getControl();
    control.addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(DisposeEvent e) {
            compareConfiguration.dispose();
        }
    });
    return control;
}
项目:n4js    文件:SpecComparePage.java   
private Control createPreviewer(Composite parent) {
    final CompareConfiguration compareConfiguration = new CompareConfiguration();
    compareConfiguration.setLeftLabel("Original " + docTypeName);
    compareConfiguration.setLeftEditable(false);
    compareConfiguration.setRightLabel("Updated " + docTypeName);
    compareConfiguration.setRightEditable(false);
    compareConfiguration.setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.FALSE);
    compareConfiguration.setProperty(PREFIX_SUFFIX_PROPERTY, fPrefixSuffix);

    fViewer = new TextMergeViewer(parent, SWT.NONE, compareConfiguration);
    // add initial input in order to avoid problems when disposing the viewer later:
    fViewer.setInput(new DiffNode(new TargetElementFromString(""), new TargetElementFromString("")));

    Control control = fViewer.getControl();
    control.addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(DisposeEvent e) {
            compareConfiguration.dispose();
        }
    });
    return control;
}
项目:eZooKeeper    文件:AbstractDataModelWidgetView.java   
/**
 * Constructor.
 *
 * @param model The {@link DataModel}.
 * @param widget The {@link Widget} view.
 */
public AbstractDataModelWidgetView(DataModel<?, ?, ?> model, W widget) {
    _Model = model;
    _Widget = widget;

    registerModelEventListener();

    _Widget.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            unregisterModelEventListener();
            _Widget.removeDisposeListener(this);
        }
    });
}
项目:eZooKeeper    文件:BaseControlContribution.java   
/**
 * Adds a {@link DisposeListener} to the created {@link Control}. Listeners can be added either before or after the
 * Control is created.
 * 
 * @param disposeListener The {@link DisposeListener} to add.
 * 
 * @see Control#addControlDisposeListener(DisposeListener)
 */
public void addControlDisposeListener(DisposeListener disposeListener) {

    Control control = getControl();
    if (control != null) {
        if (control.isDisposed()) {
            return;
        }

        control.addDisposeListener(disposeListener);
    }
    else {
        if (_DisposeListeners == null) {
            _DisposeListeners = new LinkedHashSet<DisposeListener>();
        }

        _DisposeListeners.add(disposeListener);
    }
}
项目:eZooKeeper    文件:DataModelFormEditor.java   
protected void addImageHyperlinkToolBarContribution(final IManagedForm headerForm,
        final IToolBarManager toolBarManager, final BaseControlContribution baseControlContribution,
        final DataModel<?, ?, ?> model) {

    final Separator separator = new Separator();
    toolBarManager.add(separator);
    toolBarManager.add(baseControlContribution);

    baseControlContribution.addControlDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {

            if (!model.isDestroyed()) {
                // Only do this clean up when the model destruction caused the widget disposal
                // WARNING: toolBarManager.update(true); throws a NullPointer if called during app exit.
                return;
            }

            toolBarManager.remove(separator);
            separator.dispose();
            toolBarManager.remove(baseControlContribution);
            toolBarManager.update(true);
        }
    });
}
项目:eZooKeeper    文件:ZnodeNewWizardComposite.java   
/**
 * TODO: Comment.
 * 
 * @param parent
 */
public ZnodeNewWizardComposite(Composite parent, ZnodeModel parentZnodeModel) {
    super(parent);

    _ParentZnodeModel = parentZnodeModel;

    ParentZnodeModelEventListener delegate = new ParentZnodeModelEventListener();

    final IGenericDataModelEventListener parentZnodeModelEventListener = (IGenericDataModelEventListener) SwtThreadSafeDelegatingInvocationHandler
            .createProxyInstance(delegate, IGenericDataModelEventListener.class, true);

    _ParentZnodeModel.addGenericEventListener(parentZnodeModelEventListener);
    addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            _ParentZnodeModel.removeGenericEventListener(parentZnodeModelEventListener);
        }
    });

    setNumColumns(3);
}
项目:neoscada    文件:ChartManager.java   
public ChartManager ( final Composite parent, final int style )
{
    super ( parent, style );

    setLayout ( makeLayout () );

    // title row

    this.title = new Label ( this, SWT.NONE );
    this.title.setLayoutData ( new GridData ( GridData.CENTER, GridData.FILL, true, false, 1, 1 ) );

    // row 2

    this.chartArea = new ChartArea ( this, SWT.NONE );
    this.chartArea.setLayoutData ( makeMainLayoutData () );

    addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            onDispose ();
        }
    } );
}
项目:neoscada    文件:ChartViewerPane.java   
public void createControl ( final Composite parent )
{
    this.wrapper = new Composite ( parent, SWT.NONE );
    this.wrapper.setLayout ( GridLayoutFactory.slimStack () );

    final Composite extensionSpace = new Composite ( this.wrapper, SWT.NONE );
    extensionSpace.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, false ) );
    extensionSpace.setLayout ( new RowLayout ( SWT.HORIZONTAL ) );
    this.chartArea = new ChartArea ( this.wrapper, SWT.NONE );
    this.chartArea.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) );
    this.viewer = new ChartViewer ( this.chartArea.getDisplay (), this.chartArea.getChartRenderer (), this.configuration, new CompositeExtensionSpace ( extensionSpace ), null );

    parent.addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            handleDispose ();
        }
    } );
}
项目:neoscada    文件:ToolBarNavigator.java   
public ToolBarNavigator ( final Composite parent, final int style, final ViewManager viewManager )
{
    this.viewManager = viewManager;
    this.toolbar = new ToolBar ( parent, style );
    this.resourceManager = new LocalResourceManager ( JFaceResources.getResources ( parent.getDisplay () ) );

    this.toolbar.addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            handleDispose ();
        }
    } );

    viewManager.addViewManagerListener ( this );
}
项目:neoscada    文件:DataItemLabel.java   
public DataItemLabel ( final Composite composite, final String connectionId, final String itemId )
{
    this.label = new CLabel ( composite, SWT.NONE );
    this.dataItem = new DataItemObservableValue ( Activator.getDefault ().getBundle ().getBundleContext (), connectionId, itemId );
    this.label.addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            handleDispose ();
        }
    } );
    this.model = PojoObservables.observeDetailValue ( this.dataItem, "value", Variant.class ); //$NON-NLS-1$
    this.dbc = new DataBindingContext ();

    bind ();
}
项目:neoscada    文件:VisibilityTester.java   
private void checkCreateDialog ()
{
    if ( this.dialog != null )
    {
        return;
    }

    this.dialog = new Shell ();
    this.dialog.setText ( "Visibility Tester" );
    this.dialog.open ();
    this.dialog.setLayout ( new GridLayout ( 1, false ) );
    this.dialog.addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            VisibilityTester.this.dialog = null;
        }
    } );
}
项目:neoscada    文件:CallbackDialog.java   
private Composite createComposite ( final Composite wrapper )
{
    this.dbc = new DataBindingContext ( DisplayRealm.getRealm ( wrapper.getDisplay () ) );

    wrapper.addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            CallbackDialog.this.dbc.dispose ();
        }
    } );

    final Composite composite = new Composite ( wrapper, SWT.NONE );
    composite.setLayout ( new GridLayout ( 2, false ) );

    for ( final CallbackWidgetFactory factory : this.factories )
    {
        factory.createGridWidgets ( this.dbc, composite );
    }

    return composite;
}
项目:neoscada    文件:ServersViewer.java   
public ServersViewer ( final Composite parent )
{
    parent.setLayout ( new FillLayout () );
    this.viewer = new TreeViewer ( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL );

    this.contentProvider = new ObservableSetTreeContentProvider ( new ObservableFactoryImpl (), null );
    this.viewer.setContentProvider ( this.contentProvider );
    this.labelProvider = new ServerLabelProvider ( this.contentProvider.getKnownElements () );
    this.viewer.setLabelProvider ( this.labelProvider );

    this.viewer.setInput ( HivesPlugin.getDefault ().getServerManager () );
    this.viewer.getControl ().addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            handleDispose ();
        }
    } );

    ColumnViewerToolTipSupport.enableFor ( this.viewer );
}
项目:AppleCommander    文件:DiskWindow.java   
/**
 * Setup the Disk window and display (open) it.
 */
public void open() {
    shell = new Shell(parentShell, SWT.SHELL_TRIM);
    shell.setLayout(new FillLayout());
    shell.setImage(imageManager.get(ImageManager.ICON_DISK));
    setStandardWindowTitle();
    shell.addDisposeListener(new DisposeListener() {
            public void widgetDisposed(DisposeEvent event) {
                dispose(event);
            }
        });

    CTabFolder tabFolder = new CTabFolder(shell, SWT.BOTTOM);
    new DiskExplorerTab(tabFolder, disks, imageManager, this);
    diskMapTabs = new DiskMapTab[disks.length];
    for (int i=0; i<disks.length; i++) {
        if (disks[i].supportsDiskMap()) {
            diskMapTabs[i] = new DiskMapTab(tabFolder, disks[i]);
        }
    }
    diskInfoTab = new DiskInfoTab(tabFolder, disks);
    tabFolder.setSelection(tabFolder.getItems()[0]);


    shell.open();
}
项目:applecommander    文件:DiskWindow.java   
/**
 * Setup the Disk window and display (open) it.
 */
public void open() {
    shell = new Shell(parentShell, SWT.SHELL_TRIM);
    shell.setLayout(new FillLayout());
    shell.setImage(imageManager.get(ImageManager.ICON_DISK));
    setStandardWindowTitle();
    shell.addDisposeListener(new DisposeListener() {
            public void widgetDisposed(DisposeEvent event) {
                dispose(event);
            }
        });

    CTabFolder tabFolder = new CTabFolder(shell, SWT.BOTTOM);
    new DiskExplorerTab(tabFolder, disks, imageManager, this);
    diskMapTabs = new DiskMapTab[disks.length];
    for (int i=0; i<disks.length; i++) {
        if (disks[i].supportsDiskMap()) {
            diskMapTabs[i] = new DiskMapTab(tabFolder, disks[i]);
        }
    }
    diskInfoTab = new DiskInfoTab(tabFolder, disks);
    tabFolder.setSelection(tabFolder.getItems()[0]);


    shell.open();
}
项目:Hydrograph    文件:HydrographInstallationDialog.java   
@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.getShell().setMinimumSize(950, 500);
    folder = new CTabFolder(composite, SWT.NONE);
    configureFolder();
    createFolderItems(folder);

    GridData folderData = new GridData(SWT.FILL, SWT.FILL, true, true);
    folderData.widthHint = convertHorizontalDLUsToPixels(TAB_WIDTH_IN_DLUS);
    folderData.heightHint = convertVerticalDLUsToPixels(TAB_HEIGHT_IN_DLUS);
    folder.setLayoutData(folderData);
    folder.addSelectionListener(createFolderSelectionListener());
    folder.addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(DisposeEvent e) {
            releaseContributions();
        }
    });
    return composite;
}
项目:Hydrograph    文件:CustomAboutDialog.java   
/**
 * Create the context menu for the text widget.
 * 
 * @since 3.4
 */
private void createTextMenu() {
    final MenuManager textManager = new MenuManager();
    textManager.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(),
            null, IWorkbenchCommandConstants.EDIT_COPY, CommandContributionItem.STYLE_PUSH)));
    textManager.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(),
            null, IWorkbenchCommandConstants.EDIT_SELECT_ALL, CommandContributionItem.STYLE_PUSH)));
    text.setMenu(textManager.createContextMenu(text));
    text.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            textManager.dispose();
        }
    });

}
项目:BiglyBT    文件:BuddyPluginViewBetaChat.java   
protected void
addDisposeListener(
    final DisposeListener   listener )
{
    if ( shell != null ){

        if ( shell.isDisposed()){

            listener.widgetDisposed( null );

        }else{

            shell.addDisposeListener( listener );
        }
    }
}
项目:BiglyBT    文件:FontUtils.java   
/**
 * Change the height of the installed <code>Font</code> and takes care of disposing
 * the new font when the control is disposed
 * @param control
 * @param height
 * @param style one or both of SWT.BOLD, SWT.ITALIC, or SWT.NORMAL
 */
public static void setFontHeight(Control control, int height, int style) {
    FontData[] fDatas = control.getFont().getFontData();
    for (int i = 0; i < fDatas.length; i++) {
        fDatas[i].height = height;
        fDatas[i].setStyle(style);
    }
    final Font newFont = new Font(control.getDisplay(), fDatas);
    control.setFont(newFont);
    control.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            if (null != newFont && !newFont.isDisposed()) {
                newFont.dispose();
            }
        }
    });
}
项目:BiglyBT    文件:BlockedIpsWindow.java   
public static void
show(
        Core _core,
Display         display,
String          ipsBlocked,
String          ipsBanned)
{
    if(instance == null || instance.isDisposed())
    {
        instance = create(_core, display, ipsBlocked, ipsBanned);
        instance.addDisposeListener(new DisposeListener() {
            @Override
            public void widgetDisposed(DisposeEvent event) {
                instance = null;
            }
        });
    }
    else
    {
        instance.open();
    }
}
项目:team-explorer-everywhere    文件:WorkItemLinksControl.java   
public WorkItemLinksControl(
    final Composite parent,
    final int style,
    final TFSServer server,
    final WorkItem workItemInput,
    final WIFormLinksControlOptions options) {
    super(parent, style | SWT.MULTI, server, workItemInput);
    linksControlOptions = options;

    addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(final DisposeEvent e) {
            imageHelper.dispose();
        }
    });
}
项目:team-explorer-everywhere    文件:WorkItemFormHeader.java   
private void populate() {
    final Color backgroundColor = getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);

    final FillLayout layout = new FillLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    setLayout(layout);

    setBackground(backgroundColor);

    label = new CLabel(this, SWT.LEFT);
    label.setBackground(backgroundColor);

    attachWorkItemListeners();

    addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(final DisposeEvent e) {
            onDispose();
        }
    });
}
项目:team-explorer-everywhere    文件:QueryResultsControl.java   
public QueryResultsControl(final Composite parent, final int style) {
    super(parent, style | SWT.FULL_SELECTION, WorkItem.class);

    setupTable(getTable());

    createActions();

    createTransfers();

    addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(final DisposeEvent e) {
            imageHelper.dispose();
            QueryResultsControl.this.onTableDisposed(e);
        }
    });

    // VS, Web Access and Excel do not display grouping in their number
    // formats despite what locale says, so we do the same.
    resultNumberFormat.setGroupingUsed(false);
}
项目:team-explorer-everywhere    文件:PageHelpers.java   
public static ImageHyperlink createDropHyperlink(
    final FormToolkit toolkit,
    final Composite parent,
    final String text) {
    final ImageHyperlink link = toolkit.createImageHyperlink(parent, SWT.WRAP | SWT.CENTER | SWT.RIGHT);

    link.setBackground(parent.getBackground());
    link.setForeground(parent.getForeground());

    final Image arrow = ImageUtils.createDisclosureTriangle(link);

    link.setText(text);
    link.setImage(arrow);
    link.setUnderlined(false);

    link.addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(final DisposeEvent e) {
            if (arrow != null) {
                arrow.dispose();
            }
        }
    });

    return link;
}
项目:team-explorer-everywhere    文件:TeamExplorerPendingChangesTreeSection.java   
private void createTreeViewer(final FormToolkit toolkit, final Composite parent) {
    treeViewer = new TreeViewer(treeComposite, SWT.MULTI | SWT.NO_SCROLL);
    AutomationIDHelper.setWidgetID(treeViewer.getTree(), PENDING_CHANGES_TREE_ID);
    treeViewer.setContentProvider(new PendingChangesTreeContentProvider());
    treeViewer.setLabelProvider(new PendingChangesTreeLabelProvider());
    treeViewer.addDoubleClickListener(new PendingChangesTreeDoubleClickListener());
    treeViewer.addTreeListener(new SectionTreeViewerListener());
    treeViewer.setInput(pendingChangesTree);
    restoreState();

    addPendingChangesChangedListener(pendingChangesListener);
    addPendingChangesCountChangedListener(pendingChangesCountListener);

    treeViewer.getTree().addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(final DisposeEvent e) {
            removePendingChangesChangedListener(pendingChangesListener);
            removePendingChangesCountChangedListener(pendingChangesCountListener);
        }
    });

    GridDataBuilder.newInstance().hAlignFill().hGrab().applyTo(treeViewer.getTree());
    registerContextMenu(getContext(), treeViewer.getTree(), treeViewer);
}
项目:team-explorer-everywhere    文件:WorkItemHistoryControl.java   
private void setTextControlFont(final Text text) {
    final FontData[] tahomaFontData = getShell().getDisplay().getFontList("Tahoma", true); //$NON-NLS-1$
    if (tahomaFontData != null && tahomaFontData.length > 0) {
        historyFont = new Font(getShell().getDisplay(), "Tahoma", 10, SWT.NORMAL); //$NON-NLS-1$
    }

    if (historyFont != null) {
        text.setFont(historyFont);
    }

    addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(final DisposeEvent e) {
            if (historyFont != null) {
                historyFont.dispose();
            }
        }
    });
}
项目:team-explorer-everywhere    文件:NotesCheckinControl.java   
protected NotesCheckinControl(final Composite parent, final int style, final CheckinControlOptions options) {
    super(parent, style, Messages.getString("NotesCheckinControl.Title"), CheckinSubControlType.CHECKIN_NOTES); //$NON-NLS-1$

    this.options = options;

    final FillLayout layout = new FillLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    setLayout(layout);

    final int rootStyle = options.isForDialog() ? SWT.BORDER : SWT.NONE;
    rootComposite = new ScrolledComposite(this, SWT.V_SCROLL | rootStyle);
    rootComposite.setLayout(new FillLayout());
    rootComposite.setExpandHorizontal(true);
    rootComposite.setExpandVertical(true);

    addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(final DisposeEvent e) {
            if (pendingCheckin != null) {
                pendingCheckin.getPendingChanges().removeAffectedTeamProjectsChangedListener(teamProjectsListener);
            }
        }
    });
}
项目:subclipse    文件:ChangePathsFlatViewer.java   
public ChangePathsFlatViewer(Composite parent, SVNHistoryPage page) {
  super(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI /* SWT.FULL_SELECTION */);

  GridData data = new GridData(GridData.FILL_BOTH);
  getControl().setLayoutData(data);
  getControl().addDisposeListener(new DisposeListener() {
    public void widgetDisposed(DisposeEvent e) {
      if (currentPathFont != null) {
        currentPathFont.dispose();
      }
    }
  });

  setLabelProvider(new ChangePathLabelProvider());
  setContentProvider(new ChangePathsFlatContentProvider(page));
  getTable().setHeaderVisible(false);
  getTable().setLinesVisible(false);
}
项目:Notepad4e    文件:NotepadView.java   
/**
 * Adds a new note to the view.
 * 
 * @param title
 * @param text
 * @param style
 * @param editable
 * @param noteBullets
 */
private void addNewNoteTab(String title, String text, String style, boolean editable, String bullets) {
    CTabItem tab = new CTabItem(tabFolder, SWT.NONE);
    tab.setText(title);
    // Add listener to clean up corresponding note when disposing the tab.
    tab.addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(DisposeEvent event) {
            CTabItem itemToDispose = (CTabItem) event.getSource();
            ((Note) itemToDispose.getControl()).dispose();
        }
    });
    Note note = new Note(tabFolder, text, editable);
    // Style can be null if new note.
    if (style != null && !style.isEmpty()) {
        note.deserialiseStyle(style);
    }
    // Bullets can be null if new note or upgrading from old plugin version.
    if (bullets != null && !bullets.isEmpty()) {
        note.deserialiseBullets(bullets);
    }
    tab.setControl(note);
}
项目:google-cloud-eclipse    文件:FontUtil.java   
/**
 * Converts the font of the control by adding a single style bit, unless the font already have
 * that style.
 * <p>
 * If the font is converted, it will attach a {@link DisposeListener}
 * to the <code>control</code> to dispose the font when it's not needed anymore.
 * <p>
 * <em>If converting fonts is a frequent operation, this method will create
 * several {@link DisposeListener}s that can lead to high resource allocation</em>
 *
 * @param control whose font will be changed
 * @param style e.g. SWT.BOLD or SWT.ITALIC
 */
public static void convertFont(Control control, int style) {
  for (FontData fontData : control.getFont().getFontData()) {
    if (hasStyle(fontData, style)) {
      return;
    }
  }
  FontDescriptor fontDescriptor = FontDescriptor.createFrom(control.getFont()).setStyle(style);
  final Font newFont = fontDescriptor.createFont(control.getDisplay());
  control.setFont(newFont);
  control.addDisposeListener(new DisposeListener() {
    @Override
    public void widgetDisposed(DisposeEvent event) {
      newFont.dispose();
    }
  });
}
项目:google-cloud-eclipse    文件:MiniSelector.java   
private void create(Composite parent) {
  displayExecutor = DisplayExecutor.create(parent.getDisplay());
  comboViewer = new ComboViewer(parent, SWT.READ_ONLY | SWT.DROP_DOWN);
  comboViewer.setComparator(new ViewerComparator());
  comboViewer.setLabelProvider(new LabelProvider() {
    @Override
    public String getText(Object element) {
      if (element instanceof GcpProject) {
        GcpProject project = (GcpProject) element;
        return project.getName() + " (" + project.getId() + ")";
      }
      return super.getText(element);
    }
  });
  comboViewer.setContentProvider(ArrayContentProvider.getInstance());
  comboViewer.setInput(EMPTY_PROJECTS);
  parent.addDisposeListener(new DisposeListener() {
    @Override
    public void widgetDisposed(DisposeEvent event) {
      cancelFetch();
    }
  });

  fetch();
}
项目:eclipse-weblogic-plugin    文件:ListFieldEditor.java   
@Override
public List getListControl(final Composite parent) {
    if (this.list == null) {
        this.list = new List(parent, 2820);

        this.list.addSelectionListener(this.getSelectionListener());
        this.list.addDisposeListener(new DisposeListener() {
            @Override
            public void widgetDisposed(final DisposeEvent event) {
                ListFieldEditor.this.list = null;
            }
        });
    } else {
        this.checkParent(this.list, parent);
    }
    return this.list;
}
项目:TuxGuitar-1.3.1-fork    文件:TGChannelManagerDialog.java   
public void show(TGViewContext viewContext){
    Shell parent = viewContext.getAttribute(TGViewContext.ATTRIBUTE_PARENT);

    this.dialog = DialogUtils.newDialog(parent, SWT.DIALOG_TRIM | SWT.RESIZE );
    this.dialog.setLayout(createGridLayout(1,false, true, true));

    this.createWindow(this.dialog, new GridData(SWT.FILL,SWT.FILL,true,true));

    this.addListeners();
    this.dialog.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            removeListeners();
        }
    });

    DialogUtils.openDialog(this.dialog, DialogUtils.OPEN_STYLE_CENTER | DialogUtils.OPEN_STYLE_PACK);
}
项目:TuxGuitar-1.3.1-fork    文件:TGLyricEditor.java   
public void show() {
    this.dialog = DialogUtils.newDialog(TuxGuitar.getInstance().getShell(), SWT.DIALOG_TRIM | SWT.RESIZE);
    this.dialog.setLayout(getDialogLayout());
    this.dialog.setSize(EDITOR_WIDTH,EDITOR_HEIGHT);
    this.dialog.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            onDispose();
        }
    });

    this.track = TuxGuitar.getInstance().getTablatureEditor().getTablature().getCaret().getTrack();
    this.loadComposites();
    this.loadProperties();
    this.loadIcons();
    this.updateItems();
    this.addListeners();
    DialogUtils.openDialog(this.dialog,DialogUtils.OPEN_STYLE_CENTER);
}
项目:TuxGuitar-1.3.1-fork    文件:TGMatrixConfig.java   
private void addListeners(){
    this.button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            ColorDialog dlg = new ColorDialog(ButtonColor.this.button.getShell());
            dlg.setRGB(ButtonColor.this.value);
            dlg.setText(TuxGuitar.getProperty("choose-color"));
            RGB result = dlg.open();
            if (result != null) {
                ButtonColor.this.loadColor(result);
            }
        }
    });
    this.button.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            ButtonColor.this.disposeColor();
        }
    });
}
项目:TuxGuitar-1.3.1-fork    文件:TGBrowserDialog.java   
public void show(){
    this.dialog = DialogUtils.newDialog(TuxGuitar.getInstance().getShell(),SWT.DIALOG_TRIM | SWT.RESIZE);
    this.dialog.setLayout(new GridLayout());
    this.dialog.setImage(TuxGuitar.getInstance().getIconManager().getAppIcon());

    this.menu.init(getShell());
    this.toolBar.init(getShell());
    this.initTable(this.dialog);
    this.updateCollections(null);
    this.updateTable();
    this.dialog.setSize(SHELL_WIDTH,SHELL_HEIGHT);
    this.dialog.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            exit();
        }
    });

    this.loadProperties();
    this.updateBars();

    TGBrowserManager.getInstance(this.context).setFactoryHandler(this);
    TuxGuitar.getInstance().getIconManager().addLoader(this);
    TuxGuitar.getInstance().getLanguageManager().addLoader(this);
    DialogUtils.openDialog(this.dialog, DialogUtils.OPEN_STYLE_CENTER);
}
项目:TuxGuitar-1.3.1-fork    文件:TGTransportDialog.java   
public void show() {
    this.dialog = DialogUtils.newDialog(TuxGuitar.getInstance().getShell(), SWT.DIALOG_TRIM);
    this.dialog.setImage(TuxGuitar.getInstance().getIconManager().getAppIcon());
    this.dialog.setLayout(new GridLayout());
    this.dialog.setText(TuxGuitar.getProperty("transport"));
    this.initComposites();
    this.initToolBar();
    this.redrawProgress();

    this.addListeners();
    this.dialog.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            removeListeners();
            TuxGuitar.getInstance().updateCache(true);
        }
    });
    DialogUtils.openDialog(this.dialog, DialogUtils.OPEN_STYLE_CENTER | DialogUtils.OPEN_STYLE_PACK);
}
项目:TuxGuitar-1.3.1-fork    文件:Option.java   
protected Label showLabel(Composite parent,int hAlign,int vAlign,boolean grabExcessHSpace,boolean grabExcessVSpace,int labelStyle,int fontStyle,int fontScale,String text){
    Label label = new Label(parent,labelStyle);
    label.setText(text);
    label.setLayoutData(new GridData(hAlign,vAlign,grabExcessHSpace,grabExcessVSpace));

    FontData[] fontDatas = label.getFont().getFontData();
    if(fontDatas.length > 0){
        final Font font = new Font(label.getDisplay(),fontDatas[0].getName(),(fontDatas[0].getHeight() + fontScale),fontStyle);
        label.setFont(font);
        label.addDisposeListener(new DisposeListener() {
            public void widgetDisposed(DisposeEvent arg0) {
                font.dispose();
            }
        });
    }
    return label;
}
项目:TuxGuitar-1.3.1-fork    文件:StylesOption.java   
private void addListeners(){
    this.button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            if(StylesOption.this.initialized){
                ColorDialog dlg = new ColorDialog(getShell());
                dlg.setRGB(ButtonColor.this.value);
                dlg.setText(TuxGuitar.getProperty("choose-color"));
                RGB result = dlg.open();
                if (result != null) {
                    ButtonColor.this.loadColor(result);
                }
            }
        }
    });
    this.button.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            ButtonColor.this.disposeColor();
        }
    });
}
项目:TuxGuitar-1.3.1-fork    文件:TGFretBoardConfig.java   
private void addListeners(){
    this.button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            ColorDialog dlg = new ColorDialog(ButtonColor.this.button.getShell());
            dlg.setRGB(ButtonColor.this.value);
            dlg.setText(TuxGuitar.getProperty("choose-color"));
            RGB result = dlg.open();
            if (result != null) {
                ButtonColor.this.loadColor(result);
            }
        }
    });
    this.button.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            ButtonColor.this.disposeColor();
        }
    });
}