Java Code Examples for org.eclipse.swt.widgets.Link#addListener()

The following examples show how to use org.eclipse.swt.widgets.Link#addListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContractPropertySection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createBdmTipsSection(Composite parent) {
    final Section bdmTipsSection = getWidgetFactory().createSection(parent, Section.NO_TITLE);
    bdmTipsSection.setLayout(GridLayoutFactory.fillDefaults().create());
    bdmTipsSection.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create());

    CreateBusinessDataProposalListener createBusinessDataProposalListener = new CreateBusinessDataProposalListener();
    DocumentProposalListener documentProposalListener = new DocumentProposalListener();

    Link tips = new Link(bdmTipsSection, SWT.None);
    tips.setText(getBdmTipsMessage());
    getWidgetFactory().adapt(tips, true, true);
    tips.addListener(SWT.Selection, e -> {
        if (Objects.equals(e.text, "documents")) {
            documentProposalListener.handleEvent((EObject) poolSelectionProvider.getAdapter(EObject.class),
                    "");
        } else {
            createBusinessDataProposalListener.handleEvent((EObject) poolSelectionProvider.getAdapter(EObject.class),
                    "");
        }
    });
    selectionProvider.addSelectionChangedListener(e -> tips.setText(getBdmTipsMessage()));

    bdmTipsSection.setClient(tips);
}
 
Example 2
Source File: GroovyHelpLinkFactory.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void createGroovyHelpLink(final Composite parent) {
    final Link docLinkText = new Link(parent, SWT.NONE);
    docLinkText.setText(GROOVY_DOC_LINK);
    docLinkText.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(final Event event) {

            try {
                final IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport().createBrowser(GROOVY_BROWSER_ID);
                browser.openURL(new URL(event.text));
            } catch (final Exception e) {
                BonitaStudioLog.error(e);
            }

        }
    });

}
 
Example 3
Source File: DialogAbout.java    From arx with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a link.
 *
 * @param parent
 * @param text
 * @param tooltip
 * @param url
 */
private void createLink(Composite parent, String text, String tooltip, final String url){
    Link link = new Link(parent, SWT.NONE);
    link.setLayoutData(SWTUtil.createFillHorizontallyGridData());
    link.setText(text);
    link.setToolTipText(tooltip);
    link.setBackground(parent.getBackground());
    link.addListener (SWT.Selection, new Listener () {
        public void handleEvent(Event event) {
            try {
                Program.launch(url);
            } catch (Exception e){
                /* Ignore*/
            }
        }
    });
}
 
Example 4
Source File: AbstractPage.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
protected Link addInfoText(PageContainer container, Composite parent,
		String text) {
	Link link = new Link(parent, SWT.WRAP | SWT.MULTI);
	container.adapt(link);
	GridData layoutData = new GridData(GridData.FILL, GridData.BEGINNING,
			true, false, 2, 1);
	link.setLayoutData(layoutData);
	link.setText(text);
	link.addListener(SWT.Selection, event -> {
		try {
			if (event.text != null && event.text.length() > 0) {
				Program.launch(event.text);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	});

	return link;
}
 
Example 5
Source File: CommitAttributeEditor.java    From git-appraise-eclipse with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createControl(final Composite parent, FormToolkit toolkit) {
  link = new Link(parent, SWT.BORDER);
  link.setText("<a>" + getValue() + "</a>");
  link.addListener(SWT.Selection, new Listener() {
    @Override
    public void handleEvent(Event event) {
      try {
        RepositoryCommit commit = getCommit();
        if (commit != null) {
          CommitEditor.openQuiet(commit);
        } else {
          MessageDialog alert = new MessageDialog(parent.getShell(), "Oops", null,
              "Commit " + getValue() + " not found", MessageDialog.ERROR, new String[] {"OK"}, 0);
          alert.open();
        }
      } catch (IOException e) {
        AppraiseUiPlugin.logError("Error reading commit " + getValue(), e);
      }
    }
  });
  setControl(link);
}
 
Example 6
Source File: BrowserEnvironmentWarningDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
private void setHelpLink( Display display, String helpLink, int maxTextWidth, EnvironmentCase environment ) {
  link = new Link( shell, SWT.SINGLE | SWT.WRAP );
  link.setText( helpLink );
  if ( environment == EnvironmentCase.MAC_OS_X || environment == EnvironmentCase.MAC_OS_X_THIN ) {
    FontData[] fD = link.getFont().getFontData();
    fD[ 0 ].setHeight( 13 );
    link.setFont( new Font( display, fD[ 0 ] ) );
  }
  FormData fdlink = new FormData();
  fdlink.left = new FormAttachment( warningIcon, margin ); // Link should be below description right of icon
  fdlink.top = new FormAttachment( description, margin );
  fdlink.width = maxTextWidth;
  link.setLayoutData( fdlink );
  props.setLook( link );

  link.addListener( SWT.Selection, new Listener() {
    public void handleEvent( Event event ) {
      if ( Desktop.isDesktopSupported() ) {
        try {
          Desktop.getDesktop().browse( new URI( Const.getDocUrl( URI_PATH ) ) );
        } catch ( Exception e ) {
          log.logError( "Error opening external browser", e );
        }
      }
    }
  } );
}
 
Example 7
Source File: ReportExamples.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	Composite container = (Composite) super.createDialogArea( parent );
	setTitle( Messages.getString( "ReportExamples.ContributeSamples.title" ) ); //$NON-NLS-1$
	setMessage( Messages.getString( "ReportExamples.ContributeSamples.messages" ) ); //$NON-NLS-1$	
	super.getShell( ).setText( Messages.getString( "ReportExamples.ContributeSamples.title" ) ); //$NON-NLS-1$

	Composite composite = new Composite( container, SWT.NONE );
	GridData gd = new GridData( GridData.FILL_BOTH
			| GridData.VERTICAL_ALIGN_BEGINNING );
	gd.widthHint = 380;
	gd.heightHint = 200;
	gd.horizontalIndent = 10;
	composite.setLayoutData( gd );
	composite.setLayout( new GridLayout( ) );
	new Label( composite, SWT.NONE );
	Link link = new Link( composite, SWT.WRAP );
	link.setLayoutData( new GridData( GridData.FILL_HORIZONTAL
			| GridData.VERTICAL_ALIGN_BEGINNING ) );
	String[] arguments = new String[2];
	arguments[0] = "<a>"; //$NON-NLS-1$
	arguments[1] = "</a>"; //$NON-NLS-1$
	String linkText = Messages.getFormattedString( "ReportExamples.ContributeSamples.description", arguments ); //$NON-NLS-1$
	link.setText( linkText );
	link.addListener( SWT.Selection, new Listener( ) {

		public void handleEvent( Event event )
		{
			openLink( "https://bugs.eclipse.org/bugs/enter_bug.cgi?product=BIRT&bug_severity=enhancement" ); //$NON-NLS-1$				
		}
	} );
	link.setSize( 300, 50 );
	return container;

}
 
Example 8
Source File: MissingRequirementsDialog.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite) super.createDialogArea(parent);
	Link messageLnk = new Link(composite,SWT.NONE);
	messageLnk.setText(this.message);
	messageLnk.addListener(SWT.Selection, new Listener() {
		
		@Override
		public void handleEvent(Event event) {
			OpenCheatSheetAction ch = new OpenCheatSheetAction("org.eclipse.thym.ui.requirements.cordova");
			ch.run();
		}
	});
	return composite;
}
 
Example 9
Source File: CommentAttributeEditor.java    From git-appraise-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createControl(final Composite parent, FormToolkit toolkit) {
  Composite composite = new Composite(parent, SWT.NONE);
  RowLayout layout = new RowLayout(SWT.VERTICAL);
  layout.wrap = true;
  layout.fill = true;
  layout.justify = false;
  composite.setLayout(layout);

  label = new Label(composite, SWT.NONE);
  label.setText(getValue());

  final String commit = getCommit();
  final String filePath = getFilePath();
  final int lineNo = getLineNumber();
  if (filePath != null && !filePath.isEmpty()) {
    fileLink = new Link(composite, SWT.BORDER);
    fileLink.setText("<a>" + filePath + '(' + lineNo + ")</a>");
    fileLink.addListener(SWT.Selection, new Listener() {
      @Override
      public void handleEvent(Event event) {
        AppraiseUiPlugin.openFileInEditor(filePath, getModel().getTaskRepository());
      }
    });
  }

  if (commit != null) {
    commitLabel = new Label(composite, SWT.BORDER);
    commitLabel.setText(commit);
  }

  composite.pack();
  setControl(composite);
}
 
Example 10
Source File: DiffAttributeEditor.java    From git-appraise-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createControl(final Composite parent, FormToolkit toolkit) {
  Composite composite = new Composite(parent, SWT.NONE);
  GridLayout layout = new GridLayout(1, false);
  composite.setLayout(layout);

  final String filePath =
      getTaskAttribute().getAttribute(AppraiseReviewTaskSchema.DIFF_NEWPATH).getValue();

  Link fileLink = new Link(composite, SWT.BORDER);
  fileLink.setText("<a>View in Workspace</a>");
  fileLink.addListener(SWT.Selection, new Listener() {
    @Override
    public void handleEvent(Event event) {
      AppraiseUiPlugin.openFileInEditor(filePath, getModel().getTaskRepository());
    }
  });

  final String diffText =
      getTaskAttribute().getAttribute(AppraiseReviewTaskSchema.DIFF_TEXT).getValue();

  final StyledText text = new StyledText(composite, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.READ_ONLY);
  text.setText(diffText);
  text.setStyleRanges(getStyleRangesForDiffText(diffText));

  GridData diffTextGridData = new GridData();
  diffTextGridData.grabExcessHorizontalSpace = true;
  diffTextGridData.horizontalAlignment = SWT.FILL;
  text.setLayoutData(diffTextGridData);

  composite.pack();
  setControl(composite);
}
 
Example 11
Source File: SctRootPageContent.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createContents(Composite parent) {
	Label label = new Label(parent, SWT.NONE);
	label.setText("YAKINDU Statechart Tools general settings.");
	Link link = new Link(parent, SWT.NONE);
	link.setText("For more information visit <a>www.statecharts.org</a>");
	link.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event event) {
			org.eclipse.swt.program.Program.launch(YAKINDU_ORG);
		}
	});
	return parent;
}
 
Example 12
Source File: GraphvizConfigurationDialog.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Control createMessageArea(Composite composite) {
	// prevent creation of messageLabel by super implementation
	String linkText = message;
	message = null;
	super.createMessageArea(composite);
	message = linkText;

	Link messageLink = new Link(composite, SWT.WRAP);
	messageLink.setText(message);
	GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
			.grab(true, false).applyTo(messageLink);
	messageLink.addListener(SWT.Selection, new Listener() {
		@Override
		public void handleEvent(Event event) {
			Shell shell = PlatformUI.getWorkbench()
					.getActiveWorkbenchWindow().getShell();
			PreferenceDialog pref = PreferencesUtil
					.createPreferenceDialogOn(shell,
							"org.eclipse.gef.dot.internal.ui.GraphvizPreferencePage", //$NON-NLS-1$
							null, null);
			if (pref != null) {
				close();
				pref.open();
			}
		}
	});
	return composite;
}
 
Example 13
Source File: BrowserEnvironmentWarningDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void setHelpLink( Display display, String helpLink, int maxTextWidth, EnvironmentCase environment ) {
  link = new Link( shell, SWT.SINGLE | SWT.WRAP );
  link.setText( helpLink );
  if ( environment == EnvironmentCase.MAC_OS_X || environment == EnvironmentCase.MAC_OS_X_THIN ) {
    FontData[] fD = link.getFont().getFontData();
    fD[0].setHeight( 13 );
    link.setFont( new Font( display, fD[0] ) );
  }
  FormData fdlink = new FormData();
  fdlink.left = new FormAttachment( warningIcon, margin ); // Link should be below description right of icon
  fdlink.top = new FormAttachment( description, margin );
  fdlink.width = maxTextWidth;
  link.setLayoutData( fdlink );
  props.setLook( link );

  link.addListener( SWT.Selection, new Listener() {
    public void handleEvent( Event event ) {
      if ( Desktop.isDesktopSupported() ) {
        try {
          Desktop.getDesktop().browse( new URI( Const.getDocUrl( URI_PATH ) ) );
        } catch ( Exception e ) {
          log.logError( "Error opening external browser", e );
        }
      }
    }
  } );
}
 
Example 14
Source File: BusinessDataViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Composite createEmptyBDMComposite(Composite parent) {
    Composite client = widgetFactory.createComposite(parent);
    client.setLayout(GridLayoutFactory.fillDefaults().create());
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    Composite emptyBDMComposite = widgetFactory.createComposite(client);
    emptyBDMComposite.setLayout(GridLayoutFactory.fillDefaults().create());
    emptyBDMComposite
            .setLayoutData(GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, true).create());

    final ImageHyperlink imageHyperlink = widgetFactory.createImageHyperlink(emptyBDMComposite, SWT.NO_FOCUS);
    imageHyperlink.setLayoutData(GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.FILL).create());
    imageHyperlink.setImage(Pics.getImage("defineBdm_60.png", DataPlugin.getDefault()));
    imageHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            commandExecutor.executeCommand(DEFINE_BDM_COMMAND, null);
        }
    });

    Link labelLink = new Link(emptyBDMComposite, SWT.NO_FOCUS);
    widgetFactory.adapt(labelLink, false, false);
    labelLink.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.CENTER).create());
    labelLink.setText(Messages.defineBdmTooltip);
    labelLink.addListener(SWT.Selection, e -> commandExecutor.executeCommand(DEFINE_BDM_COMMAND, null));

    return client;
}
 
Example 15
Source File: RenamingPreferencePage.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void createFieldEditors() {
	final StringFieldEditor urlField = new StringFieldEditor(RENAME_DATABASE_URL,
			Messages.RenamingPreferencePage_databaseUrl, getFieldEditorParent());
	textUrl = urlField.getTextControl(getFieldEditorParent());
	addField(urlField);

	final StringFieldEditor userField = new StringFieldEditor(RENAME_DATABASE_USER,
			Messages.RenamingPreferencePage_databaseUserId, getFieldEditorParent());
	addField(userField);
	textUser = userField.getTextControl(getFieldEditorParent());

	final StringFieldEditor passwordField = new StringFieldEditor(RENAME_DATABASE_PASSWORD,
			Messages.RenamingPreferencePage_databasePassword, getFieldEditorParent());
	passwordField.getTextControl(getFieldEditorParent()).setEchoChar('*');
	textPassword = passwordField.getTextControl(getFieldEditorParent());
	addField(passwordField);

	final Button buttonCheckDbConnection = new Button(getFieldEditorParent(), SWT.NONE);
	GridDataFactory.swtDefaults().span(2, 1).align(SWT.RIGHT, SWT.CENTER).applyTo(buttonCheckDbConnection);
	buttonCheckDbConnection.setText(Messages.RenamingPreferencePage_buttonValidateConnection);
	buttonCheckDbConnection.addListener(SWT.Selection, e -> checkDbConnection());

	labelRenameDatabaseCopy = new Label(getFieldEditorParent(), SWT.NONE);
	labelRenameDatabaseCopy.setText("H2 Database is copied to");

	linkRenameDatabaseCopy = new Link(getFieldEditorParent(), SWT.NONE);
	linkRenameDatabaseCopy.setText("<a>C:\\dev\\mp\\rename2.mv.db</a>");
	linkRenameDatabaseCopy.addListener(SWT.Selection, e -> openDirectoryForLocalH2DatabaseCopy());

	showRenameCopyIfRequired();
}
 
Example 16
Source File: AboutDialog.java    From developer-studio with Apache License 2.0 4 votes vote down vote up
protected Control createDialogArea(Composite parent) {

		Image logoImage =
		                  ResourceManager.getPluginImage("org.wso2.developerstudio.eclipse.platform.ui",
		                                                 "icons/carbon-studio-logo.png");
		logoWidth = logoImage.getImageData().width;
		logoHeight = logoImage.getImageData().height;

		parent.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		Composite dialogArea = (Composite) super.createDialogArea(parent);
		dialogArea.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));

		Composite composite = new Composite(dialogArea, SWT.BORDER);
		composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		composite.setLayout(new GridLayout(1, false));
		composite.setSize(new Point(logoWidth + 200, logoHeight * 4));
		
		GridData gd_composite = new GridData(SWT.CENTER, SWT.TOP, true, true, 1, 1);
		gd_composite.widthHint = logoWidth + 200;
		gd_composite.heightHint = logoHeight * 4;
		 
		composite.setLayoutData(gd_composite);

		Label lblDevsLogo = new Label(composite, SWT.NONE);
		lblDevsLogo.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblDevsLogo.setImage(logoImage);
		GridData gdDevsLogo = new GridData(SWT.CENTER, SWT.TOP, false, false, 1, 1);
		gdDevsLogo.widthHint = logoWidth;
		gdDevsLogo.heightHint = logoHeight;
		lblDevsLogo.setLayoutData(gdDevsLogo);

		Label lblVersion = new Label(composite, SWT.NONE);
		lblVersion.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BORDER));
		lblVersion.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblVersion.setText(KERNAL_MSG.concat(getVersion()));

		Label lblLicense = new Label(composite, SWT.NONE);
		lblLicense.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblLicense.setText(LICENSED);

		Link linkDevStudioUrl = new Link(composite, SWT.NONE);
		linkDevStudioUrl.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		linkDevStudioUrl.setText("Visit :<a>" + URL + "</a>");
		linkDevStudioUrl.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				org.eclipse.swt.program.Program.launch(URL);
			}
		});

		addProductIcons(composite);
		return dialogArea;
	}
 
Example 17
Source File: SimpleNoteComposite.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void createContent(Composite parent) {
  contentLabel = new Link(parent, SWT.WRAP);
  contentLabel.addListener(SWT.Selection, new LinkListener());
}
 
Example 18
Source File: PictureControl.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected void addModifyImageHandler(Link modifyImageLink) {
	modifyImageLink.addListener(SWT.Selection, e -> {
		handleModifyImage();
	});
}
 
Example 19
Source File: ApplicationOverviewEditorPart.java    From codewind-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public ProjectStatusSection(Composite parent, FormToolkit toolkit, int hSpan, int vSpan) {
	Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
       section.setText(Messages.AppOverviewEditorProjectStatusSection);
       section.setLayoutData(new GridData(SWT.FILL,SWT.FILL, true, false, hSpan, vSpan));
       section.setExpanded(true);
       
       Composite composite = toolkit.createComposite(section);
       GridLayout layout = new GridLayout();
       layout.numColumns = 2;
       layout.marginHeight = 5;
       layout.marginWidth = 10;
       layout.verticalSpacing = 5;
       layout.horizontalSpacing = 10;
       composite.setLayout(layout);
       composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
       toolkit.paintBordersFor(composite);
       section.setClient(composite);
       
       autoBuildEntry = new StringEntry(composite, Messages.AppOverviewEditorAutoBuildEntry);
       injectMetricsEntry = new StringEntry(composite, Messages.AppOverviewEditorInjectMetricsEntry);
       appStatusEntry = new StringEntry(composite, Messages.AppOverviewEditorAppStatusEntry);
       buildStatusEntry = new StringEntry(composite, Messages.AppOverviewEditorBuildStatusEntry);
       lastImageBuildEntry = new StringEntry(composite, Messages.AppOverviewEditorLastImageBuildEntry);
       lastBuildEntry = new StringEntry(composite, Messages.AppOverviewEditorLastBuildEntry);
       
	Label label = new Label(composite, SWT.NONE);
	label.setFont(boldFont);
	label.setText(Messages.AppOverviewEditorProjectLogs);
	label.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
	projectLogs = new Link(composite, SWT.NONE);
	projectLogs.setText("");
	projectLogs.setVisible(false);
	GridData data = new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false);
	data.horizontalIndent = 2;
	data.exclude = true;
	projectLogs.setLayoutData(data);
	IDEUtil.paintBackgroundToMatch(projectLogs, composite);
	projectLogs.addListener(SWT.Selection, event -> {
		CodewindEclipseApplication app = (CodewindEclipseApplication) getApp(getConn());
		if (app == null) {
			Logger.logError("A log link was selected but could not find the application for the " + connectionId //$NON-NLS-1$
					+ " connection with name: " + projectId); //$NON-NLS-1$
			return;
		}
		Optional<ProjectLogInfo> logInfo = app.getLogInfos().stream().filter(info -> info.logName.equals(event.text)).findFirst();
		if (logInfo.isPresent()) {
			try {
				SocketConsole console = app.getConsole(logInfo.get());
				if (console == null) {
					console = CodewindConsoleFactory.createLogFileConsole(app, logInfo.get());
					app.addConsole(console);
				}
				ConsolePlugin.getDefault().getConsoleManager().showConsoleView(console);
			} catch (Exception e) {
				Logger.logError("An error occurred trying to open the " + logInfo.get().logName //$NON-NLS-1$
						+ "log file for application: " + projectId, e); //$NON-NLS-1$
				MessageDialog.openError(parent.getShell(), Messages.AppOverviewEditorOpenLogErrorTitle,
						NLS.bind(Messages.AppOverviewEditorOpenLogErrorMsg, new String[] {logInfo.get().logName, app.name, e.getMessage()}));
			}
		} else {
			Logger.logError("The " + event.text + " was selected but the associated log info could not be found for the " + projectId + " project."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
		}
	});
	noProjectLogs = new Text(composite, SWT.READ_ONLY);
	noProjectLogs.setText(Messages.AppOverviewEditorNoProjectLogs);
	noProjectLogs.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
	noProjectLogs.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false));
	IDEUtil.paintBackgroundToMatch(noProjectLogs, composite);
}
 
Example 20
Source File: CreateContractInputFromBusinessObjectWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private void createProcessDataMappingTreeViewer(Composite composite, EMFDataBindingContext dbc) {
    final Composite viewerComposite = new Composite(composite, SWT.NONE);
    viewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    viewerComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(15, 15).create());
    createButtonComposite(viewerComposite);
    treeViewer = new CheckboxTreeViewer(viewerComposite,
            SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
    treeViewer.getTree()
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 200).create());
    treeViewer.getTree().setHeaderVisible(true);
    treeViewer.addFilter(hidePersistenceIdMapping());
    final FieldToContractInputMappingViewerCheckStateManager manager = new FieldToContractInputMappingViewerCheckStateManager();
    treeViewer.addCheckStateListener(manager);
    treeViewer.setCheckStateProvider(manager);
    final ObservableListTreeContentProvider provider = new ObservableListTreeContentProvider(
            new FieldToContractInputMappingObservableFactory(),
            new FieldToContractInputMappingTreeStructureAdvisor());
    treeViewer.setContentProvider(provider);

    final TreeViewerColumn nameTreeViewerColumn = new TreeViewerColumn(treeViewer, SWT.FILL);
    nameTreeViewerColumn.getColumn().setText(Messages.attributeName);
    nameTreeViewerColumn.getColumn().setWidth(250);
    lazyFieldStatusProvider = new UnselectLazyReferencesInMultipleContainer();
    nameTreeViewerColumn.setLabelProvider(new FieldNameColumnLabelProvider(lazyFieldStatusProvider));

    final TreeViewerColumn typeTreeViewerColumn = new TreeViewerColumn(treeViewer, SWT.FILL);
    typeTreeViewerColumn.getColumn().setText(Messages.attributetype);
    typeTreeViewerColumn.getColumn().setWidth(150);
    typeTreeViewerColumn.setLabelProvider(new FieldTypeColumnLabelProvider());

    final TreeViewerColumn inputTypeTreeViewerColumn = new TreeViewerColumn(treeViewer, SWT.FILL);
    inputTypeTreeViewerColumn.getColumn().setText(Messages.inputType);
    inputTypeTreeViewerColumn.getColumn().setWidth(150);
    inputTypeTreeViewerColumn.setLabelProvider(new InputTypeColumnLabelProvider(contract));
    inputTypeTreeViewerColumn.setEditingSupport(new ContractInputTypeEditingSupport(treeViewer, contract));

    final TreeViewerColumn mandatoryTreeViewerColumn = new TreeViewerColumn(treeViewer, SWT.FILL);
    mandatoryTreeViewerColumn.getColumn().setText(Messages.mandatory);
    mandatoryTreeViewerColumn.getColumn().setWidth(80);
    mandatoryTreeViewerColumn.setLabelProvider(new MandatoryColumnLabelProvider());

    IViewerObservableSet checkedElements = ViewersObservables.observeCheckedElements(treeViewer,
            FieldToContractInputMapping.class);

    final IObservableValue<FieldToContractInputMapping> observeInput = ViewersObservables.observeInput(treeViewer);
    dbc.bindValue(observeInput,
            selectedDataObservable,
            null,
            UpdateStrategyFactory.updateValueStrategy().withConverter(selectedDataToFieldMappings()).create());

    generationOptions.getEditModeObservable().addValueChangeListener(event -> {
        if (selectedDataObservable.getValue() instanceof BusinessObjectData) {
            createMapping(selectedDataObservable.getValue());
            treeViewer.setInput(mappings);
        }
    });

    createButtonListeners(checkedElements);

    multiValidator = new EmptySelectionMultivalidator(selectedDataObservable, checkedElements, mappings,
            contract.eContainer(), generationOptions.getEditModeObservable());
    dbc.addValidationStatusProvider(multiValidator);

    new Label(viewerComposite, SWT.NONE); //FILLER

    Link formGenerationDocLink = new Link(viewerComposite, SWT.NONE);
    formGenerationDocLink.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    formGenerationDocLink.setText(Messages.moreInfoFormGenerationLink);
    formGenerationDocLink.addListener(SWT.Selection, event -> openBrowser(FORM_GENERATION_REDIRECT_ID));

    ColumnViewerToolTipSupport.enableFor(treeViewer);
}