Package org.eclipse.swt.custom

Examples of org.eclipse.swt.custom.CTabItem


    if (!service2.isKeyExist(cinfo.getId(), cinfo.getDb(), key))
      throw new KeyNotExistException(cinfo.getId(), cinfo.getDb(), key);

    if (!openDataContent.isOpen(cinfo.getId(), cinfo.getDb(), key)) {
      final CTabItem tbtmNewItem = new CTabItem(tabFolder_1, SWT.NONE);
      tbtmNewItem.setText("New Item");
      tbtmNewItem.setShowClose(true);
      Composite composite_2 = new Composite(tabFolder_1, SWT.NONE);
      tbtmNewItem.setControl(composite_2);
      composite_2.setLayout(new GridLayout(1, false));
      tbtmNewItem.setText(key);
     
      tbtmNewItem.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
          DataContent dataContent = (DataContent) tbtmNewItem
              .getData();

          openDataContent.remove(dataContent);
          tbtmNewItem.dispose();
        }
      });

     
      DataContent content = null;
      if (type == NodeType.STRING) {
        tbtmNewItem.setImage(strImage);
        content = new StringDataContent(tbtmNewItem, iconImage, cinfo.getId(),
            cinfo.getServerName(), cinfo.getDb(), key,
            I18nFile.STRING);

      } else if (type == NodeType.HASH) {
        tbtmNewItem.setImage(hashImage);
        content = new HashDataContent(tbtmNewItem, iconImage, cinfo.getId(),
            cinfo.getServerName(), cinfo.getDb(), key,
            I18nFile.HASH);
      } else if (type == NodeType.LIST) {
        tbtmNewItem.setImage(listImage);
        content = new ListDataContent(tbtmNewItem, iconImage, cinfo.getId(),
            cinfo.getServerName(), cinfo.getDb(), key,
            I18nFile.LIST);
      } else if (type == NodeType.SET) {
        tbtmNewItem.setImage(setImage);
        content = new SetDataContent(tbtmNewItem, iconImage, cinfo.getId(),
            cinfo.getServerName(), cinfo.getDb(), key, I18nFile.SET);
      } else if (type == NodeType.SORTEDSET) {
        tbtmNewItem.setImage(zsetImage);
        content = new ZSetDataContent(tbtmNewItem, iconImage, cinfo.getId(),
            cinfo.getServerName(), cinfo.getDb(), key,
            I18nFile.ZSET);
      }
      content.setShell(composite_2);
View Full Code Here


  private void console() {
    int id = (Integer) itemsSelected[0].getData(NODE_ID);

    if(!openConsole.isOpen(id)){
      final Console console = new Console(tabFolder_1, id);
      CTabItem  tabItem = console.init();
      openConsole.add(console);
     
      tabItem.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
          openConsole.remove(console);
        }
      });
    }else
View Full Code Here

  private void publish() {
    int id = (Integer) itemsSelected[0].getData(NODE_ID);
   
    if(!openPublish.isOpen(id)){
      final Publish publish = new Publish(tabFolder_1, id);
      CTabItem  tabItem = publish.init();
      openPublish.add(publish);
      tabItem.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
          openPublish.remove(publish);
        }
      });
    }else
View Full Code Here

  private void subscribe() {
    int id = (Integer) itemsSelected[0].getData(NODE_ID);
   
    if(!openSubscribe.isOpen(id)){
      final Subscribe subscribe = new Subscribe(tabFolder_1, id);
      CTabItem  tabItem = subscribe.init();
      openSubscribe.add(subscribe);
      tabItem.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
          openSubscribe.remove(subscribe);
        }
      });
    }else
View Full Code Here

    Image consoleImage = new Image(tabFolder.getShell().getDisplay(),
        getClass().getResourceAsStream("/console.png"));

    initMenu();
   
    tbtmNewItem = new CTabItem(tabFolder, SWT.NONE);
    tbtmNewItem.setShowClose(true);
    Composite composite_3 = new Composite(tabFolder, SWT.NONE);
    tbtmNewItem.setControl(composite_3);
    composite_3.setLayout(new GridLayout(1, false));
    tbtmNewItem.setText(server.getName() +" "+RedisClient.i18nFile.getText(I18nFile.CONSOLE));
    tbtmNewItem.setImage(consoleImage);

    composite_4 = new Composite(composite_3, SWT.NONE);
    composite_4.setLayout(new GridLayout(3, false));
    composite_4.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
   
    btnExecButton = new Button(composite_4, SWT.NONE);
    btnExecButton.setText(RedisClient.i18nFile.getText(I18nFile.RUNCURRENT));
    btnExecButton.setImage(runImage);
    btnExecButton.setToolTipText(RedisClient.i18nFile.getText(I18nFile.RUNCURRENTTIP)+"\tF7");

    btnExecSelectButton = new Button(composite_4, SWT.NONE);
    btnExecSelectButton.setText(RedisClient.i18nFile.getText(I18nFile.RUNSELECT));
    btnExecSelectButton.setImage(runImage);
    btnExecSelectButton.setToolTipText(RedisClient.i18nFile.getText(I18nFile.RUNSELECTTIP)+"\tF8");

    btnExecNextButton = new Button(composite_4, SWT.NONE);
    btnExecNextButton.setText(RedisClient.i18nFile.getText(I18nFile.RUNFOLLOW));
    btnExecNextButton.setImage(runImage);
    btnExecNextButton.setToolTipText(RedisClient.i18nFile.getText(I18nFile.RUNFOLLOWTIP)+"\tF9");

    SashForm sashForm3 = new SashForm(composite_3, SWT.VERTICAL);
    sashForm3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
   
    inputCmd = new StyledText(sashForm3, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
    inputCmd.addLineStyleListener(new LineStyleListener()
    {
        public void lineGetStyle(LineStyleEvent e)
        {
            StyleRange style = new StyleRange();
            style.metrics = new GlyphMetrics(0, 0, Integer.toString(100000).length()*5);

        e.bullet = new Bullet(ST.BULLET_DOT, style);
      }
    });

    inputCmd.addControlListener(new ControlAdapter() {
      @Override
      public void controlResized(ControlEvent e) {
        inputCmd.setFocus();
      }
    });
    inputCmd.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseDown(MouseEvent e) {
        text = inputCmd;
        final Clipboard cb = new Clipboard(tabFolder.getShell().getDisplay());
        TextTransfer transfer = TextTransfer.getInstance();
            String data = (String) cb.getContents(transfer);
            if(data != null)
              menu.getItem(2).setEnabled(true);
            else
              menu.getItem(2).setEnabled(false);
           
        if(inputCmd.getSelectionText().length() > 0){
          menu.getItem(0).setEnabled(true);
          menu.getItem(1).setEnabled(true);
        }else{
          menu.getItem(0).setEnabled(false);
          menu.getItem(1).setEnabled(false);
        }
        inputCmd.setMenu(menu);
         
      }
    });
   
    tabFolder_2 = new CTabFolder(sashForm3, SWT.BORDER);

    tbtmNewItem_1 = new CTabItem(tabFolder_2, SWT.NONE);
    tbtmNewItem_1.setText(RedisClient.i18nFile.getText(I18nFile.RESULT));

    Composite composite_5 = new Composite(tabFolder_2, SWT.NONE);
    tbtmNewItem_1.setControl(composite_5);
    composite_5.setLayout(new GridLayout(1, false));
View Full Code Here

        HashMap<String, CTabItem> tabsMap = new HashMap<String, CTabItem>();
        Constructs[] values = Constructs.values();
        for( final Constructs construct : values ) {
            String category = construct.category;
            CTabItem tabItem = tabsMap.get(category);
            if (tabItem == null) {
                Composite composite = new Composite(tabFolder, SWT.NONE);
                GridLayout compositeLayout = new GridLayout(2, true);
                composite.setLayout(compositeLayout);
                GridData compositeGD = new GridData(SWT.FILL, SWT.FILL, true, true);
                composite.setLayoutData(compositeGD);
                tabItem = new CTabItem(tabFolder, SWT.NONE);
                tabItem.setText(category);
                tabItem.setControl(composite);
                tabsMap.put(category, tabItem);
            }
            Control control = tabItem.getControl();
            Button constructButton = new Button((Composite) control, SWT.PUSH);
            constructButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
            constructButton.setText(construct.name);
            constructButton.setToolTipText(construct.toolTip);
            constructButton.addSelectionListener(new SelectionAdapter(){
View Full Code Here

        }
        public void show( WindowEvent event ) {
            setEnability();
        }
        private void setEnability() {
            CTabItem tab = tabFolder.getSelection();
            if(tab == null) {
                getForwardAction().setEnabled(false);
                getBackwardAction().setEnabled(false);
                getRefreshAction().setEnabled(false);
            }else {
                Control cont = tab.getControl();
                if(cont instanceof Browser) {
                    getForwardAction().setEnabled(((Browser)cont).isForwardEnabled());
                    getBackwardAction().setEnabled(((Browser)cont).isBackEnabled());
                    getRefreshAction().setEnabled(true);
                }
View Full Code Here

        }
        public void widgetDefaultSelected( SelectionEvent e ) {
            setEnability();
        }
        public void open( WindowEvent event ) {
            CTabItem item = new CTabItem(tabFolder, SWT.NONE);
            Browser browser = createBrowser(item, null);
            item.setText(MessageFormat.format(Messages.BrowserContainerView_pageCount, new Object[] { count++ }));
            tabFolder.setSelection(item);
            event.browser = browser;
        }
View Full Code Here

        }
        public void changed( TitleEvent event ) {
            String title = event.title;
            if(title != null && title.length() != 0) {
                if(title.indexOf("http://") == -1) { //$NON-NLS-1$
                    CTabItem item = tabMap.get(event.getSource());
                  item.setText(title);
                }
            }
        }
View Full Code Here

     */
    public IAction getForwardAction() {
        if(this.forward == null) {
            this.forward = new Action() {
                public void run() {
                    CTabItem tab = tabFolder.getSelection();
                    if(tab == null)
                        return;
                    Control cont = tab.getControl();
                    if(cont instanceof Browser) {
                        ((Browser)cont).forward();
                    }
                }
            };
View Full Code Here

TOP

Related Classes of org.eclipse.swt.custom.CTabItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.